        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 isValidEmailNew(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;
		}
	}
	
	// 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 (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=auto,copyhistory=no,resizable=yes');
		popupHandle[ iTotalPopup++ ] = iHandle;
		return true;
  	}
  	
  	function popup2(URL, pWidth, pHeight)
  	{
		var iHandle = window.open(URL,'_blank','width=' + pWidth + ',height=' + pHeight + ',toolbar=no, top=100,left=100,scrollbars=yes,status=no,menubar=no,resizable=yes');
		popupHandle[ iTotalPopup++ ] = iHandle;
		return true;
  	}
  	
  	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 destroyPopup()
  	{
  	        for (var iCount=0; iCount < iTotalPopup; iCount++) {
  	               popupHandle[ iCount ].close();
  	        }
  	}
  	
  	
  	// ---------------------- 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, pType)
	{
		popup('/include/docFormat_list.asp?docRecNo='+pDocRecNo+'&docType='+pType, 700, 400);
	}
    	
    	function center()
	{
		var leftX = (screen.width - self.document.body.offsetWidth) / 2;
		var topY  = (screen.height - self.document.body.offsetHeight) / 2;
		moveTo(leftX, topY);
	}
    	
    	function sendIt()
	{
		var sEmail = document.form1.txtTo.value;
		var sArray = sEmail.split(",")
		var bSend  = true;
	
		for (iCount=0; iCount<sArray.length; iCount++) {
			if (! isValidEmail(trim(sArray[iCount]))){
				document.form1.txtTo.focus();
				bSend = false;
			}
		}
		
		if (bSend ) {
			if (! isValidEmail(document.form1.txtFrom.value)) {
				document.form1.txtFrom.focus();
				bSend = false;
			}
		}	
		
		if (bSend) document.form1.submit();	
	}
	
	function replace(string,text,by) {
        // Replaces text with by in string
            var strLength = string.length, txtLength = text.length;
            if ((strLength == 0) || (txtLength == 0)) return string;
        
            var i = string.indexOf(text);
            if ((!i) && (text != string.substring(0,txtLength))) return string;
            if (i == -1) return string;
        
            var newstr = string.substring(0,i) + by;
        
            if (i+txtLength < strLength)
                newstr += replace(string.substring(i+txtLength,strLength),text,by);
        
            return newstr;
        }