    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;
	}
	
	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){
		    alert("Email address seems incorrect (check @ and .'s)");
			return false;
		  }

		  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		    alert("Email address seems incorrect (check @ and .'s)");
			return false;
		  }

		  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		      alert("Email address seems incorrect (check @ and .'s)");
			  return false;
		  }

		  if (str.indexOf(at,(lat+1))!=-1){
		      alert("Email address seems incorrect (check @ and .'s)");
			  return false;
		  }

		  if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		      alert("Email address seems incorrect (check @ and .'s)");
			  return false;
		  }

		  if (str.indexOf(dot,(lat+2))==-1){
		      alert("Email address seems incorrect (check @ and .'s)");
			  return false;
		  }

		  if (str.indexOf(" ")!=-1){
		      alert("Please enter valid email.");
			  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{
			alert("Please enter valid email.");
			return false;
		}
	}
	
	// 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 isValidEmailOLD (emailStr) 
	{
		
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) {
			alert("Email address seems incorrect (check @ and .'s)")
			return false;
		}
		var user=matchArray[1]
		var domain=matchArray[2]

		if (user.match(userPat)==null) {
			alert("The username doesn't seem to be valid.")
			return false
		}

		var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) {
      			for (var i=1;i<=4;i++) {
	    			if (IPArray[i]>255) {
	        			alert("Destination IP address is invalid!");
					return false;
	    			}
	  		}
	  		return true;
		}

		// Domain is symbolic name
		var domainArray=domain.match(domainPat)
		if (domainArray==null) {
			alert("The domain name doesn't seem to be valid.");
			return false;
		}

		var atomPat=new RegExp(atom,"g");
		var domArr=domain.match(atomPat);
		var len=domArr.length;
		if (domArr[domArr.length-1].length<2 || 
			domArr[domArr.length-1].length>3) {   
			alert("The address must end in a three-letter domain, or two letter country.");
			return false;
		}

		if (len<2) {
			var errStr="This address is missing a hostname!";
			alert(errStr);
			return false;
		}

		// If we've gotten this far, everything's valid!
		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,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;
  	}
  	
  	// ---------------------- 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;
	}
	
	function trim(str) 
	{
        	str = this != window? this : str;
        	return str.replace(/^\s+/g, '').replace(/\s+$/g, '');                
    	}
    	
    function viewFormat(pDocRecNo)
	{
		popup('/include/docFormat_list.asp?docRecNo='+pDocRecNo, 550, 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; 
      }
        
    }