	var listPopup = null;

	function listPopUp(url, width, height) 
	{
		var winClosed = false;
	
		if (window.listPopup == null) winClosed = true;
		else if (listPopup.closed) winClosed = true;
	
		if (!winClosed) 
			listPopup.location.href = url;
	  else
			listPopup = window.open(url,"listpopupWindow","width=" + width + ",height=" + height+",scrollbars=yes,toolbars=0,statusbars=0,menubars=0,resizable=1");

		if (!listPopup.opener) 
			listPopup.opener = self;
			
		window.listPopup.focus();
	}
	
	function validateEmail(formObj)
	{
		txt=formObj.Email.value;
		if (emptyField(formObj.Email))
		{
			alert("Please include your email address so we respond to your question or comment.")		
		}
		else
			return true;
		return false;
	}
	
	function validatePledgeEmail(formObj)
	{
		txt=formObj.Email.value;
		if (emptyField(formObj.Email))
		{
			alert("Please include your email address.")		
		}
		else
			return true;
		return false;
	}	
	
		
/* This is, at best, a perfunctory test of email address 
    entry validity.  Is there an "@" sign and sufficient
    letters prefixing it, is there a .net, .gov, .org or
    .com in the suffix? Alert user if questioned. */
	function emailCheck(formObj) {
			txt=formObj.Email.value;
			if (emptyField(formObj.Email))
				return true;
  		if (txt.indexOf("@")<3)
				alert("Your email address seems incorrect. Please check the prefix and '@' sign.");
			else if ((txt.indexOf(".com")<5) 
				&&(txt.indexOf(".org")<5)
  			&&(txt.indexOf(".gov")<5)
				&&(txt.indexOf(".net")<5)
				&&(txt.indexOf(".mil")<5)) {
  				alert("Your email address seems incorrect. Please"
   					+" check the suffix for accuracy. (It should include a "
 						+".com,.net,.org,.gov or .mil)");
  		}
			else if(Validate(formObj.Email)!=0)
      		return false;
			else return true;
			
			return false;
	}

	function Validate(email)
	{
		address = new String(email.value);
		// alert(address);
		if(address.length == 0) return 0; 
	
 		invalidchars = new Array(' ', ',', '[', ']', '/', '=', ';', '`', '+', '!', '#', '$', '%', '^', '&', '*', '(', ')', '~', ':', '\"', '\'', '\b', '<', '>', '?', '|', '{', '}');
		error_messages = new Array();
		error_messages[0] = "Valid";
		error_messages[1] = "Address must have an @ then a \'.\'\nand cannot begin with @";
		error_messages[2] = "Address cannot have \'.\' next to @ or as final character";
		error_messages[3] = "Spaces are invalid";
		error_messages[4] = "Commas are invalid";
		error_messages[5] = "Brackets are invalid";
		error_messages[6] = "Brackets are invalid";
		error_messages[7] = "Slashes are invalid";
		error_messages[8] = "Equals are invalid";
		error_messages[9] = "Semi-Colons are invalid";
		error_messages[10] = "Accents are invalid";
		error_messages[11] = "Plus signs are invalid";
		error_messages[12] = "Exclamations are invalid";
		error_messages[13] = "Pound signs are invalid";
		error_messages[14] = "Dollar signs are invalid";
		error_messages[15] = "Percents are invalid";
		error_messages[16] = "Not sign is invalid";
		error_messages[17] = "Ampersands are invalid";
		error_messages[18] = "Stars are invalid";
		error_messages[19] = "Parentheses are invalid";
		error_messages[20] = "Parentheses are invalid";
		error_messages[21] = "Approximation signs are invalid";
		error_messages[22] = "Colons are invalid";
		error_messages[23] = "Invalid charaters used";
		error_messages[24] = "Invalid charaters used";
		error_messages[25] = "Invalid charaters used";
		error_messages[26] = "Less-than signs are invalid";
		error_messages[27] = "Greater-than signs are invalid";
		error_messages[28] = "Question-mark signs are invalid";
		error_messages[29] = "Invalid charaters used";
		error_messages[30] = "Invalid charaters used";
		error_messages[31] = "Invalid charaters used";
		
		var atloc=address.indexOf('@');
		var dotloc=address.lastIndexOf('.');
		var strOpt="\n\nYou also may simply leave this field blank";
         
   // Tests For one '.' and one '@' in correct order
   // And makes sure first substring isn't null
	 // alert("@loc: " + atloc + " .Loc: " + dotloc);
		if(atloc<1||dotloc==-1||dotloc<atloc)
		{
			alert("\nInvalid E-Mail Address\n" + error_messages[1] + "\nExample: sam@somplace.com" + strOpt);           
			return 1;
		}
                
   // Tests second and third substrings for nullness
   	else if(dotloc < atloc+2 || address.length < dotloc+2)
		{
      alert("\nInvalid E-Mail Address\n"+error_messages[2] + "\nExample: sam@somplace.com" + strOpt);     
      return 2;
   	}             
        
   // Tests for individual syntax errors
   // Only common keystroke errors included!        
   	for(var ct=0;ct<invalidchars.length;ct++)
  	{
			status=invalidchars[ct];
      if(address.indexOf(invalidchars[ct])!=-1)
			{
				alert("\nInvalid E-mail Address\n" + error_messages[ct+3] + "\nExample: sam@somplace.com" + strOpt);
				return (ct+3);
      }
   }
	 return 0;
	}	
	
	// Check to see if field is empty
	function emptyField(textObj) {
		if (textObj.value.length == 0) return true;
		for (var i=0; i<textObj.value.length; ++i) {
			var ch = textObj.value.charAt(i);
			if (ch != ' ' && ch != '\t') return false;
		}
		return true;
	}
	
	
	function Checknumber(object_value)
	{
		//Returns true if value is a number or is NULL
			//otherwise returns false	

		if (object_value.length == 0)
			return true;

		//Returns true if value is a number defined as
		//   having an optional leading + or -.
		//   having at most 1 decimal point.
		//   otherwise containing only the characters 0-9.
		var start_format = " .+-0123456789";
		var number_format = " .0123456789";
		var check_char;
		var decimal = false;
		var trailing_blank = false;
		var digits = false;

		//The first character can be + - .  blank or a digit.
		check_char = start_format.indexOf(object_value.charAt(0))
		//Was it a decimal?
		if (check_char == 1)
			decimal = true;
		else if (check_char < 1)
			return false;
       
		//Remaining characters can be only . or a digit, but only one decimal.
		for (var i = 1; i < object_value.length; i++)
		{
			check_char = number_format.indexOf(object_value.charAt(i))
			if (check_char < 0)
				return false;
			else if (check_char == 1)
			{
				if (decimal)		// Second decimal.
					return false;
				else
					decimal = true;
			}
			else if (check_char == 0)
			{
				if (decimal || digits)	
					trailing_blank = true;
					// ignore leading blanks
			}
			else if (trailing_blank)
				return false;
			else
				digits = true;
		}	
		//All tests passed, so...
		return true
	}
