        function isEmail (emailStr) {
		
    		var b = 0 ;
    		var i = 0 ;
    		var errmsg = "Please enter a valid email address" ;
    		var punct = "" ;
    		var min = 0 ;
    		var max = 0 ;
            
            var checkTLD=1;
            var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|ws)$/;
            var emailPat=/^(.+)@(.+)$/;
            var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
            var validChars="\[^\\s" + specialChars + "\]";
            var quotedUser="(\"[^\"]*\")";
            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(errmsg);
              return false;
            }
            var user=matchArray[1];
            var domain=matchArray[2];
            
            for (i=0; i<user.length; i++) {
              if (user.charCodeAt(i)>127) {
              alert(errmsg);
              return false;
              }
            }
            for (i=0; i<domain.length; i++) {
              if (domain.charCodeAt(i)>127) {
              alert(errmsg);
              return false;
              }
            }
            
            if (user.match(userPat)==null) {
              alert(errmsg);
              return false;
            }
            
            var atomPat=new RegExp("^" + atom + "$");
            var domArr=domain.split(".");
            var len=domArr.length;
            for (i=0;i<len;i++) {
    			if (domArr[i].search(atomPat)==-1) {
                  alert(errmsg);
                  return false;
                }
            }
            
            if (checkTLD && domArr[domArr.length-1].length!=2 &&
              domArr[domArr.length-1].search(knownDomsPat)==-1) {
              alert(errmsg);
              return false;
            }
            
            if (len<2) {
              alert(errmsg);
              return false;
            }
            
           	return true;
        }		
		
		function checkform(f) {
			var myform = document.getElementById(f);
			
			//Perform field validation
			if (myform.f_firstname.value == "") {
				 alert("Please enter a value for the \"First Name\" field.");
				 myform.f_firstname.focus();
				 return (false)
	  		}
		  	
			if (myform.f_lastname.value == "") {
			   alert("Please enter a value for the \"Last Name\" field.");
			   myform.f_lastname.focus();
			   return (false);
			}
		
		    var Email  = myform.f_email.value;
		
		    if (!isEmail(Email)) {
		       //alert("Please enter a valid email address.");
		       myform.f_email.focus();
		       return (false);
			} 		 
	
	 		if (myform.f_phone.value == "") {
			   alert("Please enter a value for the \"Telephone\" field.");
			   myform.f_phone.focus();
			   return (false);
			}	
	  		
			if (myform.f_phone.value.length < 10) {
				alert("Please enter at least 10 characters in the \"Telephone\" field.");
				myform.f_phone.focus();
				return (false);
			}				
			
            //Get the values Contact Time, time Zone, Day and Mission from the bottom form.
            //var day = document.getElementById("day");
            //var contacttime = document.getElementById("contacttime");
            //var timezone = document.getElementById("timezone");
            //var Mission = document.getElementById("Mission");
             
            //if (day.value == "1") {
            //	alert("Please select Day.");
            //	day.focus();
            //	return (false);
            //}		
			          
		    //if (contacttime.value == "1") {
            //	alert("Please select the Best Time to Contact.");
            //	contacttime.focus();
            //	return (false);
            //} 
            
            //if (timezone.value == "1") {
            //	alert("Please select your Time Zone.");
            //	timezone.focus();
            //	return (false);
            //} 
  
			// only allow numbers to be entered
	  		var checkOK = "0123456789-() .+";
	  		var checkStr = myform.f_phone.value;
	  		var allValid = true;
	  		var allNum = "";
	  
	  		for (i = 0;  i < checkStr.length;  i++) {
				ch = checkStr.charAt(i);
	
			    for (j = 0;  j < checkOK.length;  j++)
	  			if (ch == checkOK.charAt(j))
	  			break;
		  
	  		    if (j == checkOK.length) {
		    	allValid = false;
		    	break;
		  
		  		}
		  
		  		if (ch != ",")
		    	allNum += ch;
	  		}
		  
	  	  	 if (!allValid) {
		 	 	alert("Please only use numerical characters in the Telephone field. ");
		 		myform.f_phone.focus();
		 		return (false);
	  		 }
			 
			 return (true);
		}		
		
        function OpenNewNormalWindow(fileName,w,h) {
          		   var winl = (screen.width - w) / 2;
             	   var wint = (screen.height - h) / 2;
             	   winprops = 'height='+ h +',width='+ w +',top='+wint+',left='+winl+',resizable=1,directories=no,location=no,menubar=no,scrollbars=1,titlebar=0,status=0,toolbar=no'
           		   window.open(fileName,"", winprops)
        } 
		
		//Count the number of characters left in textboxes 
		function textCounter(field, countfield, maxlimit) {
			if ( field.value.length > maxlimit ) {
    		   field.value = field.value.substring( 0, maxlimit );
			   alert('Textarea value can only be 170 characters in length.');
    		   return false;
  		 	} else {
    	 	  countfield.value = maxlimit - field.value.length;
  			}
		}		  
