 /* included in /locations/latin_america_overview files */
 
 /**
	 *	allows the enter key to work as the submit button for the ldap search
	 */
	function submitenter(obj,e){
		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		else return true;
		
		if(keycode == 13){
			document.getElementById("form1").submit();
		   	return false;
		}else{			
		   return true;
		}
	}
 
 function hide(divid){ 	
 	document.getElementById(divid).style.display="none";
 }
 
 function checkemail(emailobj){
	hide("emailerror");
	var email = emailobj.value;
	var currentdisplay = document.getElementById("emailinvalid").style.display;
	if(currentdisplay == "block"){
		if (!(/(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/.test(emailobj.value)) && (/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(emailobj.value))){
			hide("emailinvalid");
		} else {
			document.getElementById("emailinvalid").style.display="block";				
		}
	}
 }
 
 function preSubmitEmail(){
	
 	var oForm = document.form1;
	var err = false;
	
	//email
	if(!oForm.email.value){
		document.getElementById("emailerror").style.display="block";
		return false;
	}else {
		if (!(/(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/.test(oForm.email.value)) && (/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(oForm.email.value))){
		} else {
			document.getElementById("emailinvalid").style.display="block";
			return false;		
		}
	}
	return true;	
 }
  
 function preSubmit(){
 	var oForm = document.form1;
	var err = false;
	
	//first name
	if(!oForm.specificText1.value){
		document.getElementById("firstnameerror").style.display="block";
		err = true;
	}
	
	//last name
	if(!oForm.specificText2.value){
		document.getElementById("lastnameerror").style.display="block";
		err = true;
	}
	
	//title
	if(!oForm.specificText3.value){
		document.getElementById("titleerror").style.display="block";
		err = true;
	}
	
	//company
	if(!oForm.specificText4.value){
		document.getElementById("companyerror").style.display="block";
		err = true;
	}
	
	//email
	if(!oForm.specificText5.value){
		document.getElementById("emailerror").style.display="block";
		err = true;
	}else {
		if (!(/(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/.test(oForm.specificText5.value)) && (/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(oForm.specificText5.value))){
		} else {
			document.getElementById("emailinvalid").style.display="block";
			err = true;			
		}
	}
	
	//phone number
	if(!oForm.specificText6.value){
		document.getElementById("phoneerror").style.display="block";
		err = true;
	}
	 	
	if(err){
		document.getElementById("errortext").style.display="block";
		return false;	
	}else{
		return true;
	}
 }
 
  function preSubmitSignUp(){
 	var oForm = document.form1;
	var err = false;
	
	//first name
	if(!oForm.specificText1.value){
		document.getElementById("firstnameerror").style.display="block";
		err = true;
	}
	
	//last name
	if(!oForm.specificText2.value){
		document.getElementById("lastnameerror").style.display="block";
		err = true;
	}
	
	//email
	if(!oForm.specificText3.value){
		document.getElementById("emailerror").style.display="block";
		err = true;
	}else {
		if (!(/(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/.test(oForm.specificText3.value)) && (/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(oForm.specificText3.value))){
		} else {
			document.getElementById("emailinvalid").style.display="block";
			err = true;			
		}
	}
	
	//company
	if(!oForm.specificText4.value){
		document.getElementById("companyerror").style.display="block";
		err = true;
	}		
	
	//phone number
	if(!oForm.specificText5.value){
		document.getElementById("phoneerror").style.display="block";
		err = true;
	}
	
	//phone number
	if(!oForm.specificText6.value){
		document.getElementById("cityerror").style.display="block";
		err = true;
	}
	
	//state
	if(oForm.specificText7.selectedIndex == 0 && !oForm.specificText8.value){
		document.getElementById("uscanadastateerror").style.display="block";
		err = true;
	}		
	 	
	if(err){
		document.getElementById("errortext").style.display="block";
		return false;	
	}else{
		return true;
	}
 }