//stuff for expand/collapse

 var listitems= document.getElementsByTagName("*");

 
 function init() {	
	for(i = 0;i < listitems.length;i++) {
			w = listitems[i].id;
			wo = listitems[i];
			if (w.substring(0,8) == 'showHide') {
				wo.className="itemhidden";
			}
		}
 }
 
 function closeExcept(po) {
	for(i = 0;i < listitems.length;i++) {
			w = listitems[i].id;
			wo = listitems[i];
			if (w.substring(0,8) == 'showHide') {
				if(w!=po) {
					wo.className="itemhidden";
				}
			}
		}
 }

 function expandcollapse(postid) { 
    var whichpost = document.getElementById(postid); 
   	closeExcept(postid);
 	if (whichpost.className=="itemshown") { 
    	  whichpost.className="itemhidden"; 
    	} 
 
   	else { 
     	 whichpost.className="itemshown"; 
     	} 
    } 
	



// stuff for navigation


function page() {
	//get pagename
	init();
	l = document.location.href;
	l.toString();
	b = l.lastIndexOf('/')+1;
	dl = l.lastIndexOf('.');
	dl = l.length-dl;
	e = l.length-dl;
	l = l.substring(b,e);
	
	//current directory	stuff
	c = 0;	
	cs=new Array();
	
	//change style of hyperlinks to current page anywhere on the page
	
	//the next two lines set up what we're checking here: if it's IE we can just run through all the objects in the document and check out their properties.  If it is something standards based, like Firefox, we have to use document.anchors, and also we have to make sure to name our links so we can find them (even thought we aren't USING the name to find them (argh!).  In other words, the script will work in ie with or without named links, but needs the names for the others
	
	if (document.all) {itot = document.all.length} else {itot = document.anchors.length};
	if (document.all) {al = document.all} else {al = document.anchors};
	
	
	
	for (i=0;i<itot;i++) {
		dis = (al[i].id);
		if(al[i].href) {
			lin = al[i].href;
			
			if(lin==document.location.href) {
				if(dis.indexOf('subNav')>=0) {
					al[i].style.backgroundColor = '#bdafa1';
//					al[i].style.backgroundColor = '#cc9900';
					al[i].style.color = '#ffffff';
					al[i].style.fontWeight = 'bold';
				};
				if(dis.indexOf('twoRows')>=0) {
//					al[i].style.backgroundImage = 'url(../images/hoverBgroundLong.gif)';
					al[i].style.color = '#969689';
				};
				if(dis.indexOf('thirdLevel')>=0) {
			        al[i].style.fontWeight = 'bold';   
			    }
//			   };
			  // alert(subsection);
//			 if(subsection!='none') {
			    //alert(subsection);
//			    if (dis.indexOf(subsection)>=0) {
//			        if (dis.indexOf('twoRows') < 0 ) {
//			            al[i].style.backgroundImage = 'url(../images/hoverBground.gif)';
//			            }
//			         if (dis.indexOf('twoRows') >= 0 ) {
//			            al[i].style.backgroundImage = 'url(../images/hoverBgroundLong.gif)';
//			            }
//			    }

			}
		}
		}
//		section = 'mainNav' + section;
//		section = document.getElementById(section);
//		section.style.backgroundColor = '#381605';
//		section.style.color = '#fff';
//		section.style.textDecoration = 'none';
	
	for (j=0;j<=document.location.href.length;j++) {
		if (document.location.href.substring(j,j+1)=="/") {
			c=c+1;
			cs[c]=j;
			}
	}
	dirBegin = cs[c-1]+1;
	dirEnd = cs[c];
	dirName = document.location.href.substring(dirBegin,dirEnd);
	
	for (m=0;m<itot;m++) {
		if(al[m].href) {
			huruf = al[m].href;
			if(huruf.indexOf(dirName)>0) {
				if (huruf.substring(cs[c],huruf.length) == '/index.htm') {
					al[m].style.color = '#3b5591';
				}
			}
		}
	}
	
}
	
//catch function to manually turn something on - this is a temporary solution for third level pages that are currently in 2nd level directories.  Eventually we'll add the ability for the script to recognize both the section and the subsection via directories the current page is in
	
function manual(whichLink) {

	document.getElementById(whichLink).style.color = '#FFA500';
	
}

window.onload = page