	function submitNewsLatterForm(){	
	   if(validateNewsLatForm("newsLat")){
			url = "admin/process.php";
			var params=new Object();
			params["val"]="getNewsletterEmailStatus";
			params["email"]=document.getElementById("newsLatEmail").value;
			var ajax=new js_ajax_Object("Sending Email data", url, params, js_callback_newsletterCheckEmail, "json");
			ajax.js_ajax_Post();
	   }	
	}

	function js_callback_newsletterCheckEmail(response){
		var emailExists = null;
		emailExists =eval('(' +response + ')');
		if(emailExists[0]){
			alert("The email address is already in the database. You may have already registerd.");
			document.getElementById("newsLatEmail").focus();
			document.getElementById("newsLatEmail").select();
		}
		else{
		    document.getElementById("newsLat").action = "admin/process.php?val=newsLat";
		    document.getElementById("newsLat").submit();		
		}
	}
	
	function validateNewsLatForm(form){
		
	       var form = document.getElementById(form);
		
		   if(form.newsLatName.value.length <=2){
			   	   alert("Please enter your name");
				   document.getElementById("newsLatName").focus();
			       return false;
			   }
			   
		   if(!isValidEmail(form.newsLatEmail.value)) {
		           alert("Enter valid email address");
				   form.newsLatEmail.focus();
				   return (false);
			}
			
		   if(!form.newsLatCheck.checked){
			   	   alert("click check box to confirm");
				   form.newsLatCheck.focus();
			       return false;
			   }		   
		  				 			
			return true;
		}
		
		function isValidEmail(email){
		
			var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
			if(RegExp.test(email)){
				return true;
			}else{
				return false;
			}
		
		}
