//This function preloads the global navigation elements
var navRoll = false;
//Set this variable to false so no global rollovers will work until all preloading is done.
function plGnav()
{
	plImages();
	navRoll = true;

}

//This function preloads rollover images with a & i suffixes for active and inactive
//The function can preload any number of images.
//usage: uPreload( object name, directory of image, extension of image )
var imgSuffix = new Array('i', 'a', 'o');
function uPreload(imgName, imgPath, imgExt)
{
	for (i=0; i < imgSuffix.length; i++) {
		eval( imgName + imgSuffix[i] + " = new Image();" );
  		eval( imgName + imgSuffix[i] + ".src = '" + imgPath + '/' + imgName + imgSuffix[i] + imgExt + "';" );
    }
}
    
function plImages()
{
	var linkArray = document.getElementsByTagName("img");
    for (var loop=0; loop<linkArray.length; loop++)
    {
    	imgClassArray = linkArray[loop].className.split(' ');
        for (var i=0; i<imgClassArray.length; i++)
        {
         	if (imgClassArray[i] == "pl")
         	{
    			var imgPath = linkArray[loop].src.substring( 0, linkArray[loop].src.lastIndexOf( '/' ));
    			uPreload( linkArray[loop].id, imgPath, linkArray[loop].src.substring( linkArray[loop].src.lastIndexOf( '.' ) ) );
         	}
        }
    }
}
 
//This function is for navigation rollover images; uName is name of graphic, uState is on, off or over state
function nr(uName, uState)
{
   if(navRoll)
   {
      document.images[uName].src = self[uName + uState].src;
   }
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function pServ(strURL,strType,strHeight,strWidth) {
	var strOptions="";
	var iMyWidth;
	var iMyHeight;
	iMyWidth =(window.screen.width / 2) - (strWidth / 2 + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
	iMyHeight =(window.screen.height /2) - (strHeight / 2 + 15); //half the screen height minus half the new window height (plus title and status bars).
	if (strType=="fixed" || strType=="2") strOptions="status=no,scrollbars=no,height=" + strHeight + ",width=" + strWidth + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight;
	if (strType=="console" || strType=="1") strOptions="resizable,height=" + strHeight + ",width=" + strWidth + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight;
	if (strType=="elastic" || strType=="3") strOptions="toolbar,menubar,scrollbars,resizable,location,height=" + strHeight + ",width=" + strWidth  + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight;
	if (strType=="console2" || strType=="4") strOptions="scrollbars=yes,height=" + strHeight + ",width=" + strWidth + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight;
	
	var wName = strURL.split('?')[0].replace( /[\/\.\:\#]/g, '_' ); //Uses strURL to create unique window name for js object.
	window.open(strURL,wName,strOptions);
}

