
// set a rollover image to the over state
function imageOver(m){
	if(document.images){
		oImage = document.getElementById(m);
		thisSrc = oImage.src;
		if((thisSrc.indexOf("_on.") < 0) && (thisSrc.indexOf("_over.") < 0)){
			oImage.src =  parseName(thisSrc,"_over");	
		}
	}
}


// set a rollover image to the out state
function imageOut(m){
	if(document.images){
		oImage = document.getElementById(m);
		thisSrc = oImage.src;
		if((thisSrc.indexOf("_on.") < 0) && (thisSrc.indexOf("_over.") > -1)){
			lastP = thisSrc.lastIndexOf(".");
			nameArray = new Array;
			nameArray[0] = thisSrc.substr(0,lastP);
			nameArray[1] = thisSrc.substr(lastP,thisSrc.length-1);
			lastO = nameArray[0].lastIndexOf("_");
			nameArray[0] = nameArray[0].substr(0,lastO);
			oImage.src =  nameArray[0] + nameArray[1];
		}
	}	
}


// a function to toggle two images not part of a rollover. Assumption is that both images are in the same directory.
function swapImage(imageID,image1,image2,imagePath){
	if (document.images){
		thisImg = document.getElementById(imageID);
		if(thisImg.src.indexOf(image1) > -1){
			thisImg.src = imagePath + image2;
		} else {
			thisImg.src = imagePath + image1;
		}
	}	
}

// a function to generically pre-load images for rollovers.
// using the onLoad event, I poll through the images Array of the page and if the image has an id
// (indicating that it has an associated behaivior)
// I try to pre-load the image. To prevent as many false calls as possible, I 
// try to weed out images with no "over" state by only using images that are
// 		a: defined
//		b: have an id (indicating they are named for a purpose)
//		c: aren't named "spacer.gif" (because that image is used frequently and  doesn't have an over state)
// 		d: don't have a source name containing either _over or _on (indicating that these elements aren't going to change even though they have an id)
// If an image is called and doesn't exist it will be ignored.
function loadImages(){
	overImage = new Array;
	for(i in document.images){
		outImage = document.images[i];
		if((outImage.id != null) && (outImage.id != "") && (outImage.src.indexOf("spacer.gif") == -1)) {			
			thisSrc = outImage.src;
			if((thisSrc.indexOf("_on.") < 0) && (thisSrc.indexOf("_over.") < 0)){
				overImage[i] = new Image;
				overImage[i].src = parseName(thisSrc,"_over");	
			} 
		}
	}
}


// All images in this site that are used in rollovers have two (or three) states - filename.type, and filename_over.type (or _on)
// to set the src of rollovers, I use this function to get the root name of the file and then the imageOver() or imageOut() functions
// to set the state of the image, or loadImages() to preload the over state of an image.
function parseName(iName,iState){
	lastP = iName.lastIndexOf(".");
	nameArray = new Array;
	nameArray[0] = iName.substr(0,lastP);
	nameArray[1] = iName.substr(lastP,iName.length-1);
	return  nameArray[0] + iState + nameArray[1];
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// COLLECTION OF FUNCTIONS TO OPEN AND CLOSE SPANS
var currentlyOpenSpan = "";
function openSpan(spanID){
	document.getElementById("bub_" + spanID).className = "closedItem";
	document.getElementById("pop_" + spanID).className = "openItem";
	currentlyOpenSpan = spanID;
}

function closeSpan(spanID){
	document.getElementById("bub_" + spanID).className = "openItem";
	document.getElementById("pop_" + spanID).className = "closedItem";
	if (currentlyOpenSpan == spanID){
		currentlyOpenSpan = "";
	}
}

function swapSpan(spanID){
	if (currentlyOpenSpan!=""){
		closeSpan(currentlyOpenSpan)
	}
	openSpan(spanID);
	
}

function  hideSpan(spanName){
	document.getElementById(spanName).className = "closedItem";
}

function revealSpan(spanName){
	document.getElementById(spanName).className = "openItem";
}
//////////////////////////////