   
	var popupHandle = new Array();
    var iTotalPopup = 0;

	// Input	: sStatus	(status string to be displayed on window status)
	// Output	: sStatus will be displayed on window status
	// Purpose	: Best used with <A HREF>, for example:
	//		  <A HREF="http://www.eResources.com" onMouseOver="return setStatus('eResources Site')">
	//		  So that the actual URL can be hidden
	function setStatus(sStatus)
	{
		window.status = sStatus;
		return true;
	}

	// Input	: emailStr (email string to evaluate)
	// Output	: true 	-> if email has correct format
	//		  false	-> if email has wrong format
	// Purpose	: to validate an email format
	function isValidEmail (str)
	{
		  str =  trim(str);
		  var at="@"
		  var dot="."
		  var lat=str.indexOf(at)
		  var lstr=str.length
		  var ldot=str.indexOf(dot)
		  if (str.indexOf(at)==-1){
		    return false;
		  }

		  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		    return false;
		  }

		  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		      return false;
		  }

		  if (str.indexOf(at,(lat+1))!=-1){
		      return false;
		  }

		  if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		      return false;
		  }

		  if (str.indexOf(dot,(lat+2))==-1){
		      return false;
		  }

		  if (str.indexOf(" ")!=-1){
		      return false;
		  }
	
		var filter=/^([\w-']+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,10}(?:\.[a-z]{2})?)$/i
		if (filter.test(str))
		{
			return true;
		}
		else{
			return false;
		}
	}
	function isValidEmailOld (str)
	{
		  var at="@"
		  var dot="."
		  var lat=str.indexOf(at)
		  var lstr=str.length
		  var ldot=str.indexOf(dot)
		  if (str.indexOf(at)==-1){
		    return false;
		  }

		  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		    return false;
		  }

		  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		      return false;
		  }

		  if (str.indexOf(at,(lat+1))!=-1){
		      return false;
		  }

		  if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		      return false;
		  }

		  if (str.indexOf(dot,(lat+2))==-1){
		      return false;
		  }

		  if (str.indexOf(" ")!=-1){
		      return false;
		  }

 		  return true

    }
	
	function isUSAZIP(alphane)
	{
		
		var numaric = alphane
		for(var j=0; j < numaric.length; j++)
		{
			var alphaa = numaric.charAt(j);
			
					
			var hh = alphaa.charCodeAt(0);
			// - and 0-9
			if( (hh == 45) || (hh > 47 && hh < 59) )
			{
				
				if ((j == 5) && (hh != 45)) {
					return false;
				}
				
				if ((j != 5) && (hh == 45)) {
					return false;
				}
			}
			else{
				return false;
			}
		}
	    return true;
	}
	
	function ZIPAlphaNumeric(alphane)
	{
		var numaric = alphane
		for(var j=0; j < numaric.length; j++)
		{
			var alphaa = numaric.charAt(j);
			var hh = alphaa.charCodeAt(0);
			// Space - and 0-9A-Za-z
			if( (hh == 32) || (hh == 45) || (hh > 47 && hh < 59) || (hh > 64 && hh < 91) || (hh > 96 && hh < 123))
			{
			}
			else{
				return false;
			}
		}
	    return true;
	}
	

  	// Input  : URL		-> URL to display
  	//	        pWidth	-> Width of popup Window
  	//	        pHeight	-> Height of popup Window
  	// Output : new popup window
  	// Purpose: to pop up new window with pWidth width and pHeight height and display URL
  	function popup(URL, pWidth, pHeight)
  	{
		var iHandle = window.open(URL,'_blank','width=' + pWidth + ',height=' + pHeight + ',toolbar=no,top=100,left=100,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
		popupHandle[ iTotalPopup++ ] = iHandle;
		return true;
  	}

  	function popup2(URL, pWidth, pHeight)
  	{
		window.open(URL,'_blank','width=' + pWidth + ',height=' + pHeight + ',toolbar=yes, top=100,left=100,scrollbars=yes,status=no,menubar=no,resizable=yes');
		return true;
  	}

  	function destroyPopup()
  	{
  	        for (var iCount=0; iCount < iTotalPopup; iCount++) {
  	               popupHandle[ iCount ].close();
  	        }
  	}
	
	function popupBar(URL, pWidth, pHeight)
  	{
		var iHandle = window.open(URL,'_blank','width=' + pWidth + ',height=' + pHeight + ',toolbar=yes, top=100,left=100,scrollbars=yes,status=no,menubar=no,resizable=yes');
		popupHandle[ iTotalPopup++ ] = iHandle;
		return true;
  	}
	
	function center()
	{
		var leftX = (screen.width - self.document.body.offsetWidth) / 2;
		var topY  = (screen.height - self.document.body.offsetHeight) / 2;
		moveTo(leftX, topY);
	}
	
  	// ---------------------- DISABLE RIGHT CLICK
	function right(e) {
		if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false;
		else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
			alert("Due to security issue, right click function is disabled!");
			return false;
		}
		return true;
	}

	function disableRightClick()
	{
		document.onmousedown=right;
		document.onmouseup=right;
		if (document.layers) window.captureEvents(Event.MOUSEDOWN);
		if (document.layers) window.captureEvents(Event.MOUSEUP);
		window.onmousedown=right;
		window.onmouseup=right;
	}


	// ---------------------- STRINGS FUNCTION
	function trim(str)
	{
    	str = this != window? this : str;
    	return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
	}

	function isInteger(s){
	var i;
	for (i = 0; i < s.length; i++){   
		var c = s.charAt(i);
		if (((c < "0") || (c > "9"))) return false;
	}
	return true;
	}
	
	function isValidYear(pVal)			//function to check whether the input value is a valid year or not
	{
		if (pVal.length != 4) {
			return false;
		}
		
		if (!isInteger(pVal)) {
			return false;
		}
		
		if (parseInt(pVal) < 1940 || parseInt(pVal) > 2040) {
			return false;
		}
		
		return true;
	}
	
	function stripCharsInBag(s, bag){
	var i;
	var returnString = "";
	for (i = 0; i < s.length; i++){   
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) returnString += c;
	}
	return returnString;
	}
	
	function daysInFebruary (year){
	return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
	}
	
	function IsDecimal(sText,iLength)
	{
		//alert(sText);		
		var ValidChars = "0123456789.";
		var IsNumber   = true;
		var Char;
	
		for (i = 0; i < sText.length && IsNumber == true; i++) 
		{ 
			Char = sText.charAt(i); 
			if ((i == 0) && (Char == "-")) { 	// check first character for minus sign
				IsNumber = false;
			}
			
			else if (Char == ".") {
				if (iLength < sText.length - 1 - i)   IsNumber = false; 
			}	
			
			else if (ValidChars.indexOf(Char) == -1) IsNumber = false;
			
		}
		return IsNumber;
	}  

	function replace(pStr,pFind,pReplace) {
        // Replaces pFind with pReplace in pStr
        var strLength = pStr.length, txtLength = pFind.length;
        if ((strLength == 0) || (txtLength == 0)) return pStr;

        var i = pStr.indexOf(pFind);
        if ((!i) && (pFind != pStr.substring(0,txtLength))) return pStr;
        if (i == -1) return pStr;

        var newstr = pStr.substring(0,i) + pReplace;

        if (i+txtLength < strLength)
            newstr += replace(pStr.substring(i+txtLength,strLength),pFind,pReplace);

        return newstr;
    }

    function DaysArray(n) {
		for (var i = 1; i <= n; i++) {
			this[i] = 31
			if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
			if (i==2) {this[i] = 29}
		} 
	return this
	}

    function viewFormat(pDocRecNo)
	{
		popup('/include/docFormat_list.asp?docRecNo='+pDocRecNo, 650, 550);
	}

	function sendIt()
	{
		var sEmail = document.form1.txtTo.value;
		var sArray = sEmail.split(",")

		for (iCount=0; iCount<sArray.length; iCount++) {
			if (! isValidEmail(sArray[iCount])){
				document.form1.txtTo.focus();
				return false;
			}
		}

		if (! isValidEmail(document.form1.txtFrom.value)) {
			document.form1.txtFrom.focus();
			return false;
		}

		return true;
	}

	// Validate Social Security Number
    function validateSSN( strValue ) {
        var objRegExp  = /^\d{3}\-\d{2}\-\d{4}$/;

        //check for valid SSN
        return objRegExp.test(strValue);
    }


    function validateUSDate( strValue ) {
    /************************************************
    DESCRIPTION: Validates that a string contains only 
        valid dates with 2 digit month, 2 digit day, 
        4 digit year. Date separator can be ., -, or /.
        Uses combination of regular expressions and 
        string parsing to validate date.
        Ex. mm/dd/yyyy or mm-dd-yyyy or mm.dd.yyyy
        
    PARAMETERS:
       strValue - String to be tested for validity
       
    RETURNS:
       True if valid, otherwise false.
       
    REMARKS:
       Avoids some of the limitations of the Date.parse()
       method such as the date separator character.
    *************************************************/
      var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
     
      //check to see if in correct format
      if(!objRegExp.test(strValue))
        return false; //doesn't match pattern, bad date
      else
      {
            var arrayDate = strValue.split(RegExp.$1); //split date into month, day, year
        	var intDay = parseInt(arrayDate[1],10); 
        	var intYear = parseInt(arrayDate[2],10);
            var intMonth = parseInt(arrayDate[0],10);
            var booLeapYear = (intYear % 4 == 0 && (intYear % 100 != 0 || intYear % 400 == 0));
        	
        	//check for valid month
        	if(intMonth > 12 || intMonth < 1) {
        		return false;
        	}
        	
            //create a lookup for months
            var arrayLookup = new Array();
            
            arrayLookup[ 1 ] = 31;
            if (booLeapYear) {
                arrayLookup[ 2 ] = 29;
            } else {
                arrayLookup[ 2 ] = 28;
            }
                
            arrayLookup[ 3 ] = 31;
            arrayLookup[ 4 ] = 30;
            arrayLookup[ 5 ] = 31;
            arrayLookup[ 6 ] = 30;
            arrayLookup[ 7 ] = 31;
            arrayLookup[ 8 ] = 31;
            arrayLookup[ 9 ] = 30;
            arrayLookup[ 10] = 31;
            arrayLookup[ 11] = 30;
            arrayLookup[ 12] = 31;
            
            if (intDay > arrayLookup[ intMonth ]) {
                return false;
            }
            
            return true; 
      }
        
    }
	var dtCh= "/";
	var minYear=1900;
    var maxYear=2500;
	
	function isDate(dtStr){
		var daysInMonth = DaysArray(12)
		var pos1=dtStr.indexOf(dtCh)
		var pos2=dtStr.indexOf(dtCh,pos1+1)
		var strMonth=dtStr.substring(0,pos1)
		var strDay=dtStr.substring(pos1+1,pos2)
		var strYear=dtStr.substring(pos2+1)
		strYr=strYear
		if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
		if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
		for (var i = 1; i <= 3; i++) {
			if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
		}
		month=parseInt(strMonth)
		day=parseInt(strDay)
		year=parseInt(strYr)
		if (pos1==-1 || pos2==-1){
			alert("The date format should be : mm/dd/yyyy")
			return false
		}
		if (strMonth.length<1 || month<1 || month>12){
			alert("Please enter a valid month")
			return false
		}
		if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
			alert("Please enter a valid day")
			return false
		}
		if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
			alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
			return false
		}
		if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
			alert("Please enter a valid date")
			return false
		}
	return true
	}

	function isDate2(dtStr){
		var daysInMonth = DaysArray(12)
		var pos1=dtStr.indexOf(dtCh)
		var pos2=dtStr.indexOf(dtCh,pos1+1)
		var strMonth=dtStr.substring(0,pos1)
		var strDay=dtStr.substring(pos1+1,pos2)
		var strYear=dtStr.substring(pos2+1)
		strYr=strYear
		if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
		if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
		for (var i = 1; i <= 3; i++) {
			if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
		}
		month=parseInt(strMonth)
		day=parseInt(strDay)
		year=parseInt(strYr)
		if (pos1==-1 || pos2==-1){
			//alert("The date format should be : mm/dd/yyyy")
			return false
		}
		if (strMonth.length<1 || month<1 || month>12){
			//alert("Please enter a valid month")
			return false
		}
		if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
			//alert("Please enter a valid day")
			return false
		}
		if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
			//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
			return false
		}
		if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
			//alert("Please enter a valid date")
			return false
		}
	return true
	}
		
    function ValidGPA(pObj)
	{
		if (!pObj) return false;
		if (pObj.value == "") return false;
		if (isNaN(pObj.value)) return false;

		if (parseFloat(pObj.value) < 0 || parseFloat(pObj.value) > 6.0)
		    return false;

		var objGPAReg = /([1-5]([.][0-9]*)?|6([.][0])?)/;

		return objGPAReg.test( pObj.value );
	}

	function CountWords (this_field) {
		var char_count = this_field.value.length;
		var fullStr = this_field.value + " ";
		var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
		var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
		var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
		var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
		var splitString = cleanedStr.split(" ");
		var word_count = splitString.length -1;
		if (fullStr.length <2) {
			word_count = 0;
		}
		if (word_count == 1) {
			wordOrWords = " word";
		}
		else {
			wordOrWords = " words";
		}

		if (char_count == 1) {
			charOrChars = " character";
		}
		else {
			charOrChars = " characters";
		}

		return word_count + " " + wordOrWords;
	}

	var isNN = (navigator.appName.indexOf("Netscape")!=-1);

    function autoTab(input,len, e) {
        var keyCode = (isNN) ? e.which : e.keyCode;
        var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
        if(input.value.length >= len && !containsElement(filter,keyCode)) {
        input.value = input.value.slice(0, len);
        input.form[(getIndex(input)+1) % input.form.length].focus();
    }

    function containsElement(arr, ele) {
        var found = false, index = 0;
        while(!found && index < arr.length)
            if(arr[index] == ele)
                found = true;
            else
                index++;
        return found;
    }

    function getIndex(input) {
        var index = -1, i = 0, found = false;
        while (i < input.form.length && index == -1)
            if (input.form[i] == input)index = i;
                else i++;
            return index;
        }
        return true;
    }


    function validateUSPhone(strValue) {
      // var objRegExp  = /^[1-9]\d{2}\s?\d{3}\-\d{4}$/;
      var objRegExp = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,3})|(\(?\d{2,3}\)?))(-| )?(\d{3,4})(-| )?(\d{4})$/

      return objRegExp.test(strValue);
   }


	// ---------------- <LABEL id="lblError" name="lblError"></LABEL> MUST EXIST!!! ----------------
	function showError(pObj, pMessage) {
	    if (pObj) {
            pObj.innerHTML = pMessage;
            pObj.style.display = "inline";
        }
    }

    function GetObj(pID)
    {
        var obj = document.getElementById(pID);
        return obj;
    }

    function WordsCount (pObj) {
        var char_count = pObj.value.length;
        var fullStr = pObj.value + " ";
        var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
        var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
        var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
        var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
        var splitString = cleanedStr.split(" ");
        var word_count = splitString.length -1;

        if (fullStr.length <2) {
            word_count = 0;
        }

        return word_count;
    }

    function focusDiv(element_id) {
        var d=document;
        if(d.getElementById ) {
           var elem = d.getElementById(element_id);
           if(elem) {
             if(d.createRange) {
               var rng = d.createRange();
               if(rng.selectNodeContents) {
                 rng.selectNodeContents(elem);
                 if(window.getSelection) {
                   var sel=window.getSelection();
                   if(sel.removeAllRanges) sel.removeAllRanges();
                   if(sel.addRange) sel.addRange(rng);
                 }
               }
             } else if(d.body && d.body.createTextRange) {
               var rng = d.body.createTextRange();
               rng.moveToElementText(elem);
             }
           }
        }
    }





//mimics :focus pseudo-class for IE (ADDED BY MATT on 12/10/04)
function suckerfish(type, tag, parentId) {
	if (window.attachEvent) {
		window.attachEvent("onload", function() {
			var sfEls = (parentId==null)?document.getElementsByTagName(tag):document.getElementById(parentId).getElementsByTagName(tag);
			type(sfEls);
		});
	}
}

var sfHover = function(sfEls) {
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

var sfFocus = function(sfEls) {
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onfocus=function() {
			this.className+=" sffocus";
		}
		sfEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
		}
	}
}

function getCookie(NameOfCookie)
{ 
	var col_array=document.cookie.split(";");
	var num=0;
	var find=0;
	var sResult="0";
	var sText = "";
	while (num < col_array.length)
	{
		begin = col_array[num].indexOf(NameOfCookie+"="); 
		if (begin != -1) 
		{ 
		  begin += NameOfCookie.length+1;  
		  end = col_array[num].length;
		  sResult = unescape(col_array[num].substring(begin, end)); 
		  find+=1;
		} 
		else
		{
			sText =sText + ";" + col_array[num];
		}
		num+=1;
		
	}
	if (find>1)
	{
		document.cookie= " ";
		document.cookie= NameOfCookie + "=" + escape(sResult) + sText + ";"
	}	
	return sResult; 
}

function setCookie(NameOfCookie, value, expiredays) 
{ 
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	if (getCookie(NameOfCookie)!= '0') 
	{
		document.cookie = " ";
	}
	document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()) +";path=/" ;
}

function delCookie (NameOfCookie) 
{ 
	document.cookie = " ";
	if (getCookie(NameOfCookie)!= '0') 
	{
		document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
} 

suckerfish(sfHover, "INPUT");
suckerfish(sfHover, "TEXTAREA");

suckerfish(sfFocus, "INPUT");
suckerfish(sfFocus, "TEXTAREA");