/*

This block of code contains general script functions that need to be on every page

*/

// ----------------------------- Fly Open Window ------------------------------------------
winName = "";

// openMe creates a window with a set name, locaton, width, height, top & left postions
function openMe(winName,urlPath,width,height,top,left) {
	winName = winName;
	BrowserName = navigator.appName;
	BrowserVersion = parseFloat(navigator.appVersion);
	
	// the adjusts the window for Netscape's lack of a phantom scroll bar
	if (BrowserName == "Netscape") width -= 15;
	
	eval(winName + '= eval(\'window.open(urlPath,"\' + winName + \'","resizable=no,scrollbars=no,titlebar=no,width=\' + width + \',height=\' + height + \',top=' + top + ',left=' + left + '")\')')
	eval('window.' + winName + '.focus()');
}

// ----------------------------- Search Box PreSubmit Validation ------------------------------------------
function checkFieldsSearch(frmName) {
 
	var frmName = frmName; 
	
	if (frmName == "searchForm") {
		var textcheck = document.searchForm.search.value;  
	}
	if (textcheck == "") { 
		alert("\nPlease enter a value to search for!");
		return false;
	} else if (textcheck.length <= 2) {  
		alert("\nPlease enter an value longer than two characters.")
		return false;
	} else {
		var validChar = 0;
		for(var i=0; i<textcheck.length; i++){
			if(textcheck.charAt(i) != " "){
				validChar = 1;
			}
		}
		if(validChar == 0){
			alert("\nPlease enter a valid value to search!")
			return false;
		} else {
			return true;
		}
    }
}

// Check to see if browser supports rollovers.
var blnImageSupport = (document.images)? true:null;

//Image Replacer, much faster than the Macromedia version
function CV_ChangeImage(strImageName,sNewImagePath) { 
   // Change the original scource with the new one..
   if (blnImageSupport) { 
      document.images[strImageName].src = sNewImagePath;
   }
}

// ** Generic Dreamweaver Code **
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
// ** End Generic Dreamweaver Code **

/*
 
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.

*/


var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}


