function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function notEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}
	else{
	return true;
	}
}





function formregister(){
var sfname = document.getElementById('sfname');	
var slname = document.getElementById('slname');
var saddr = document.getElementById('saddr');
var scity = document.getElementById('scity');
var sstate = document.getElementById('sstate');
var sph_no = document.getElementById('sph_no');
var szip = document.getElementById('szip');
var email = document.getElementById('email');
var footage = document.getElementById('footage');
if(notEmpty(sfname, "Textbox marked with an * cannot be left blank")){ 
 if(notEmpty(slname, "Textbox marked with an * cannot be left blank")){ 
  if(notEmpty(saddr, "Textbox marked with an * cannot be left blank")){ 
   if(notEmpty(scity, "Textbox marked with an * cannot be left blank")){
	if(notEmpty(sstate, "Textbox marked with an * cannot be left blank")){
	 if(notEmpty(sph_no, "Textbox marked with an * cannot be left blank")){	 
      if(notEmpty(szip, "Textbox marked with an * cannot be left blank")){	 
	   if(notEmpty(email, "Please enter a Email-ID")){ 
	    if(emailValidator(email, "Please enter a valid email address")){
		 if(notEmpty(footage, "Textbox marked with an * cannot be left blank")){ 
         	return true;
         }
        }
	   }
	  }
	 }
    }                    
   }
  }
 }
} 
 return false;
}
