<!--//
/*
This file contains common javascript library code that will be used throughout the site. It will be added to and modified throughout the project.
*/

/*
The following image functions can be called with one or two parameters. If there is only one parameter it is assumed that the image is loose in the /images/ directory and we are simply calling the function with the image short name. If there are two parameters then we are passing the image name and the path off of the /images/ directory that the image resides in.

Primarily for nav type image routines - otherwise the code can just be inline.
*/

function imgOn() {
	var a = 0;
	a = arguments.length;
	imgToSwap = arguments[0];
//	alert("ImgOn" +imgToSwap);
	if (document.images) 
	{
		if (a == 1) {
			if (document.images[imgToSwap] != null) {
				document.images[imgToSwap].src = "/images/"+imgToSwap+"_r.gif";
			}
		} else {
			if (document.images[imgToSwap] != null) {
				document.images[imgToSwap].src = "/images/"+arguments[1]+imgToSwap+"_r.gif";
			}
		}
	}
}

function imgOff() {
	var a = 0;
	a = arguments.length;
	imgToSwap = arguments[0];
//	alert("ImgOff" +imgToSwap);

	if (document.images) 
	{
		if (a == 1) {
			if (document.images[imgToSwap] != null) {
				document.images[imgToSwap].src = "/images/"+imgToSwap+".gif";
			}
		} else {
			if (document.images[imgToSwap] != null) {
				document.images[imgToSwap].src = "/images/"+arguments[1]+imgToSwap+".gif";
			}
		}
	}
}

function imgSelect() {
	var a = 0;
	a = arguments.length;
	imgToSwap = arguments[0];
	if (document.images) 
	{
//		alert("ImgOn" +Num);
		if (a == 1) {
			if (document.images[imgToSwap] != null) {
				document.images[imgToSwap].src = "/images/"+imgToSwap+"_s.gif";
			}
		} else {
			if (document.images[imgToSwap] != null) {
				document.images[imgToSwap].src = "/images/"+arguments[1]+imgToSwap+"_s.gif";
			}
		}
	}
}


// preload nav images
function MM_preloadImages() {
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


//This function display's a div that was previously hidden..
function expandcontent(cid){
	if (document.all) {
		document.all(cid).style.display=(document.all(cid).style.display!="block")? "block" : "block";
	} else if (document.getElementById){
		document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "block";
	}
}

//This function hide's a div that was previously displayed. 
function contractContent(cid){
	if (document.all) {
		theDiv=document.all(cid);
		theDiv.style.display="none";
	} else if (document.getElementById){
		theDiv=document.getElementById(cid);
		theDiv.style.display="none";
	}
}

//This function swaps the state of a div (if it was hidden it show's it and vice versa).
function toggleCisplay(cid){
	if (document.all) {
		document.all(cid).style.display=(document.all(cid).style.display!="block")? "block" :"none";
	} else if (document.getElementById){
		document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none";
	}
}

			
//PRINT FUNCTION
function wPrint() 
{
	if (window.print) window.print();
}


//
// QueryString - parses url values into objects. Should be replaced with JSP code to accomplish the same thing...
//

function QueryString(key)
{
	var value = null;
	for (var i=0;i<QueryString.keys.length;i++)
	{
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		}
	}
	return value;
}
QueryString.keys = new Array();
QueryString.values = new Array();

function QueryString_Parse()
{
	var query = window.location.search.substring(1);
	var pairs = query.split("&");
	
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos >= 0)
		{
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;		
		}
	}

}

QueryString_Parse();

function openSharePopup(dest) 
{
	thePopup = window.open(dest,'popupWindow','scrollbars=yes,resizable=yes,width=420,height=460');
	if(thePopup.opener == null) 
	{
		thePopup.opener = window;
	}
	thePopup.focus();
}


var NS4 = false; 
if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) { NS4 = true; } 


//-->