// javascript function include file

// -------EMAIL ERR -------------------------------------------------
function isChr(vChr) {
var chrCheck = new Array(" ","\;","!","~","`","#","$","%","^","&","*","(",")","=","+","{","}","[","]","|","?",">","<","\/","\\","\:","\"","\'")

for(var i = 0; i < vChr.length; i++) {
	for(var j = 0; j < chrCheck.length; j++) {
		if(vChr.charAt(i) == chrCheck[j] ) {
		return true;
		}
	}
}
return false;
}

function emailErr(emailStr,arrSet) {	

if(emailStr.length < 8 ) {
//alert("too short or empty");
return true;
}

if(isChr(emailStr,arrSet)) { 
//alert("invalid character");
return true;
}

var atCount = 0
var dotCount = 0
	
	for (var i = 0; i < emailStr.length; i++) {
	if (emailStr.charAt(i).indexOf("@") > -1){
	atCount += 1
	 }
	}
	if (atCount != 1) { 
	//alert("too many or no @'s");
	return true;
	}
	
	for (var j = 0; j < emailStr.length; j++) {
	if (emailStr.charAt(j).indexOf(".") > -1) {
	dotCount += 1
	 }
	}
	
	if (dotCount < 1 ) {
	//alert("no dots");
	return true;
	}
	
return false;
}

//  Validates search field
function validateSearch() {

var x;
thestring = document.searchForm.textToSearch.value;
                        
   for (x = 0; x < thestring.length; x++)
      {
         if  ( thestring.charAt(x) != " ")
               {
                  break;
               }
      }
        
         if ( x == thestring.length )    // if it got to end of string and string was blank
        	{
			alert('Please enter a term into the search field.');
			return false;
			}
			else {
			return true;
				}
	}
	
// ------FUNCTION openWindow------------------------------------------------
// Opens a small popup window
function openWindow(url) {

  popupWin = window.open(url, 'extWindow', 'width=700,height=550,toolbar=yes,scrollbars=yes,resizable=yes,menubar=yes,status=yes,location=yes')
  popupWin.focus();

}


// Opens a small popup window - New function added on 01/23/2003 
function openWindowSize(url, width, height) {

	windowName  = "flash";
        params      = "toolbar=0,";
        params     += "location=0,";
        params     += "directories=0,";
        params     += "status=0,";
        params     += "menubar=0,";
        params     += "scrollbars=1,";
        params     += "resizable=0,";
        params += "width="+width+",";
	params += "height="+height;
	win = window.open(url, windowName, params);				
        self.name="main";

}


// FUNCTION textboxSize displays different sized textbox depending on browser
	function textboxSize()
{	if (is_nav == true){
	document.write("<input type=\"text\" name=\"queryText\" maxlength=\"50\" size=\"12\">")
	}
	else {
	document.write("<input type=\"text\" name=\"queryText\" maxlength=\"50\" size=\"14\">")
	}
}

// FUNCTION loadFlash2 loads flash movie if pc, empty image if mac
function loadFlash2(movie, abbrev, size, pics) {
	var divDoc
	if (is_nav){
		divDoc = eval("document.int" + abbrev + "movie.document");
	} 
	else {
		divDoc = eval("document");
	}
	if (is_mac) {
		divDoc.write("<a href=\"#\" onmouseover=\"MM_showHideLayers('int" + abbrev + "movie','','hide'); MM_showHideLayers('" + pics + "','','hide')\"><img src=\"" + base + "/images/gbl_misc_spacer.gif\" width=\"145\" height=\"" + size + "\" border=\"0\"></a>")
	}
	else {
		divDoc.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#3,0,0,0\" width=\"145\" height=\"" + size + "\" border=\"1\"><param name=\"SRC\" value=\"" + base + "/flash/" + movie + ".swf\"><embed src=\"" + base + "/flash/" + movie + ".swf\" pluginspage=\"http://www.macromedia.com/shockwave/download/\" type=\"application/x-shockwave-flash\" width=\"145\" height=\"" + size + "\"></embed></object>")
	}
}

// client-side JavaScript browser sniff. 
    // convert all characters to lowercase to simplify testing 
    var agt=navigator.userAgent.toLowerCase(); 

    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
                && (agt.indexOf('webtv')==-1)); 
   
    var is_ie   = (agt.indexOf("msie") != -1);
	
	var is_mac    = (agt.indexOf("mac")!=-1);
	
// functions to show drop down menu
function MM_showHideLayers() { //v3.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; }
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_preloadImages() { //v3.0
  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];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//Declare global variable to hold asp variable determining page server
var base = ""

//Function to input asp variable value into the base
function getAspVar(aspVar) {
	base = aspVar
}

//Function to navigate to correct path from flash movie
function navFlash(url) {
	window.location = (base + url)
}

// ------FUNCTION transactionWindow------------------------------------------------
// Opens a transaction popup window
function transactionWindow(url) {

  popupWinTran = window.open(url, 'tranWindow', 'width=400,height=450,menubar=no,resizable=no,toolbar=no,status=no,screenY=200,screenX=200,top=200,left=350')
popupWinTran.focus();
}

// ------FUNCTION printerWindow------------------------------------------------
// Opens a printer friendly popup window
function printerWindow(url) {

  popupWinPrint = window.open(url, 'printWindow', 'width=575,height=600,menubar=yes,resizable=no,scrollbars=yes,toolbar=yes,status=no,screenY=200,screenX=200,top=50,left=200')
popupWinPrint.focus();
}