function uPreload(imgList, uPath, iSufx, iExt)
{
   if(iExt != null)
   {
      var imgExt = iExt;
   }
   else 
   {
      var imgExt = 'gif';
   }
   var imgSuffix = new Array('i', 'a');
   if(document.images)
   {
      imgArgArray = imgList.split(',');
      for(var z = 0; z < imgArgArray.length; z++)
      {
         var imgArg = imgArgArray[z];
         var imgSufLen = imgSuffix.length;
         for(j = 0; j < imgSufLen; j++)
         {
            var imgSuf = imgSuffix[j];
            imgNew = imgArg + imgSuf + ' = new Image();';
            eval(imgNew);
            imgSrc = imgArg + imgSuf + '.src = \'' + uPath + '/' + imgArg + imgSuf + '.' + imgExt + '\';';
            eval(imgSrc);
         }
      }
   }
}

function plImages()
{
    var links = document.getElementsByTagName("img");
    for (var i=0; i<links.length; i++)
    {
        classes = links[i].className.split(' ');
        for (var j=0; j<classes.length; j++)
        {
        	if (classes[j] == "pl")
        	{
				uPreload( links[i].id, links[i].src.substring( 0, links[i].src.lastIndexOf('/')), links[i].src.substring( links[i].src.lastIndexOf('.') ) );
				break;
        	}
        }
    }
}

//This function preloads the global rollover elements
navRoll = false;
//Set this variable to false so no global rollovers will work until all preloading is done.
function pl()
{
   plImages();
   navRoll = true;
}

//This function is for navigation rollover images and window status; 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 divDisp(divID)
{
	if ((document.getElementById(divID).style.display == 'none'))
	{
		document.getElementById(divID).style.display = 'block';
	}
	else
	{
		document.getElementById(divID).style.display = 'none';
	}
}

// Searches document.location for a string specified by the user and returns true or false.
var foundString = false;
function docLocation(srchString)
{
	var xUrl = document.location;
	var xUrl = xUrl.toString();
	if (xUrl.indexOf(srchString) != -1 )
	{
		return foundString = true;
	}
	else
	{
		return foundString = false;
	}
}

function showForm(divID)
{
	divID = divID.toString();
	docLocation(divID);
	if (foundString)
	{
		divDisp(divID);
	}
}

function embdFlsh(flashWidth, flashHeight, flashSwf, imgVersion, imgAlt)
{
	detectFlash(7);
   	var mPc = '';
   	if((haveFlash) && (haveFlashVer))
   	{
   		var fullUrl = flashSwf.split("?") //Split flashSwf at the "?" so we can get the path and swf name without xml data on the next line.
   		var flUrl = fullUrl[0];
   		var flQuery = fullUrl[1];
   		var flashUrl = flUrl.substring(flUrl.lastIndexOf("/"),flUrl.length); //Gets specific name of SWF without path. We find this so we can get only the path on the next line.
   		var flashPath = flUrl.substring(0,flUrl.length - flashUrl.length); //Gets full path without SWF name to use for object base parameter.
   		var oBase = '<param name="base" value="'+ flashPath +'"/>';
     	var flshUrl1 = '<param name="movie" value="'+ flashSwf +'" />';
     	var flshUrl2 = '<embed src="'+ flashSwf +'" base="'+ flashPath +'" bgcolor="#000000" quality="high" width="' + flashWidth + '" height="' + flashHeight + '" name="'+ flQuery +'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
     	mPc += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + flashWidth + '" height="' + flashHeight + '" id="'+ flQuery +'" align="middle">';
	  	mPc += '<param name="allowScriptAccess" value="always" />';
	  	mPc += '<param name="quality" value="high" />';
		mPc += '<param name="scale" value="exactfit" />';
		mPc += '<param name="bgcolor" value="#000000" />';
	  	mPc += oBase;
	 	mPc += flshUrl1;
	  	mPc += flshUrl2;
	 	mPc += '</object>';
   	}
   	else if((!haveFlash) || (!haveFlashVer))
   	{
		mPc += '<img src="'+ imgVersion +'" width="'+ flashWidth +'" height="'+ flashHeight +'" alt="'+ imgAlt +'" title="'+ imgAlt +'" />';
	}
	document.write(mPc);
}

function wPop(url, winName, wWidth, wHeight, scrll)
{
   var scrollB;
   if(!scrll)
   {
      scrollB = 'no';
      var pWidth = wWidth;
   }
   else 
   {
      scrollB = scrll;
      wWidth = parseInt(wWidth) + 20;
   }
   var iMyWidth;
   var iMyHeight;
   iMyWidth =(window.screen.width / 2) - (wWidth / 2 + 10);
   //half the screen width minus half the new window width (plus 5 pixel borders).
   iMyHeight =(window.screen.height /2) - (wHeight/ 2 + 15);
   //half the screen height minus half the new window height (plus title and status bars).
   var zWin = window.open(url, winName, "status=no,toolbar=no,menubar=no,width=" + wWidth + ",height=" + wHeight + ",resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=" + scrollB);
   zWin.focus();
}
