<!--

$(function(){ 

	$("#email").blur(
					   function(){
						     if ($(this).val()){
						  if (IsEmail($(this).val())){
								$("#mailError").fadeOut('fast');	  
						  }else{
			       			 $("#mailError").fadeIn('fast');
						  }  }}).keyup(function(){
							  if (IsEmail($(this).val())){
											$("#mailError").fadeOut('fast');
		}});
	$("#zip").blur(
					   function(){
						     if ($(this).val()){
						  if (IsZipCode($(this).val())){
								$("#zipError").fadeOut('fast');	  
						  }else{
			       			 $("#zipError").fadeIn('fast');
						  }  }}).keyup(function(){
							  if (IsZipCode($(this).val())){
											$("#zipError").fadeOut('fast');
		}});					 
	});
function IsZipCode(zipCode) {
            var regex = /^\d{5}$/;
            if (regex.test(zipCode)) return true;
            else return false;
        } 
function IsEmail(email) {
            var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
            if (regex.test(email)) return true;
            else return false;
        } 
function validateForm(){
	msg='Please fill the following fields:\n';
	 rt=true; 
	$(".req").each(function() {
							
							  if (!$(this).val()||($(this).attr("title")=="Email"&&!IsEmail($(this).val()) )||($(this).attr("title")=="Zip"&&!IsZipCode($(this).val()) )){
								 rt=false; 
							    fName=$(this).attr("title");
								msg+=fName;
								if ($(this).attr("title")=="Zip"&&!IsZipCode($(this).val()) &&$(this).val() )  msg+=' - not a valid zip code'
								if ($(this).attr("title")=="Email"&&!IsEmail($(this).val()) &&$(this).val() )  msg+=' - not a valid email address';
								msg+="\n";
							  }
					 })
	if(!rt)alert(msg);
	return rt;
}

   // -->