	//global 'on' color
	onColor = '#92c367';
	
	//get pagename
	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();
	
	
function nav() {

			//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) {all = document.all} else {all = document.anchors};
		
		ao = document.body.getElementsByTagName("div");
		aol= ao.length;
		
		js = new Array();
		cnt = 0;
		
				
		for (i=0;i<itot;i++) {
			if(all[i].href) {
				lin = all[i].href;
				if(lin==document.location.href) {all[i].style.color = onColor};
			}
			
			//while we're at it, build an array of all hidden nav lists (subsections) called "js"
			if(all[i].id) {
				j = all[i].id;
				if (j.indexOf('sb')>=0) {
					js[cnt]=j;
					cnt=cnt+1;
				}
				
			}
			
			}
			
		//loop through subsection array looking for which subsection (if any) matches the current page.  Convention is to to name each page to match the subsection.  All subsection ul's are named sb[sectionName] - for example, if the section is schools, the subsection would be named "sbSchools".  To further the conventions, the main link for that section (in this case Schools) should be named the same thing without the 'sb' - e.g. "schools" for its name and id attributes
	
		if (document.getElementById('sbwhat')) {document.getElementById('sbwhat').style.display = 'block'};
	
		
		for(m=0; m<=(js.length-1); m++) {
					nm = js[m].substring(2,(l.length+1));
					nm = nm.toLowerCase();
					nml = nm.length;
					p = l.substring(0,nml);
					if(p==nm) {
						whichOn = 'sb' + p;
						document.getElementById(whichOn).style.display = 'block';	//turn on subsection menu
						document.getElementById(p).style.color = onColor;			//turn on section link
					}
				}
		
		for (j=0;j<=document.location.href.length;j++) {
			if (document.location.href.substring(j,j+1)=="/") {
				c=c+1;
				cs[c]=j;
				}
		}
		
}
		
function sectionOn() {
	//turn on current section
	
	if(section) {
		if (section=='giving_opportunities') {
			document.images[section].src = '/images/navGivingOpportunitiesOn.gif';
			document.images[section].hsrc = '/images/navGivingOpportunitiesOn.gif';
			}
		if (section=='ways_to_give') {
			document.images[section].src = '/images/navWaysToGiveOn.gif';
			document.images[section].hsrc = '/images/navWaysToGiveOn.gif';
			}
		if (section=='donor_recognition') {
			document.images[section].src = '/images/navDonorRecognitionOn.gif';
			document.images[section].hsrc = '/images/navDonorRecognitionOn.gif';
			}
		if (section=='about') {
			document.images[section].src = '/images/navAboutOn.gif';
			document.images[section].hsrc = '/images/navAboutOn.gif';
			}
	}
	
	nav();
	
}
	
	
//catch all 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 = onColor;
	
}

function Popper(URL,Width,Height,Left,Top,Resizable,Scrollbars) {
WinID = 'winder';
window.open(URL,WinID,'width='+Width+',height='+Height+',left='+Left+',top='+Top+',channelmode=0,dependent=0,directories=0,location=0,menubar=0,resizable='+Resizable+',scrollbars='+Scrollbars+',status=0,toolbar=0');
}
