function validateformSubmit(){
	if ((validateNames_pop()==true) && (emailLength_pop()==true) && (emailValid_pop(document.submit1.from.value)==true)){
		return true;
	}else{
		return false;
	}
}

function validateNames_pop(){
	var fullname=document.submit1.name.value;
	
	if (fullname==null || fullname==""){
		alert ("Please enter your Name");
		document.submit1.name.focus();
		return false;
	}
	return true;
}

function emailLength_pop(){
  var emailID=document.submit1.from.value;

  if ((emailID==null)||(emailID=="")){
	  alert("Please enter your Email address.");
	  document.submit1.from.focus();
	  return false;
  }
  
  if ((emailID.length < 5)){
	  alert("Email address should be a valid one and more than 5 characters.");
	  document.submit1.from.focus();
	  return false;
  }
  return true;
}


function emailValid_pop(str){
    var at="@"
    var dot="."
    var lat=str.indexOf(at)
    var lstr=str.length
    var ldot=str.indexOf(dot)
  
	if (str.indexOf(at)==-1){
	   alert("OOPS! The e-mail you entered is not valid. Please edit and try again. Thanks");
	   document.submit1.from.focus();
	   return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		alert("OOPS! The e-mail you entered is not valid. Please edit and try again. Thanks");
		document.submit1.from.focus();
		return false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("OOPS! The e-mail you entered is not valid. Please edit and try again. Thanks");
		document.submit1.from.focus();
		return false;
	}

	if (str.indexOf(at,(lat+1))!=-1){
		alert("OOPS! The e-mail you entered is not valid. Please edit and try again. Thanks");
		document.submit1.from.focus();
		return false;
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("OOPS! The e-mail you entered is not valid. Please edit and try again. Thanks");
		document.submit1.from.focus();
		return false;
	}

	if (str.indexOf(dot,(lat+2))==-1){
		alert("OOPS! The e-mail you entered is not valid. Please edit and try again. Thanks");
		document.submit1.from.focus();
		return false;
	}
		
	if (str.indexOf(" ")!=-1){
		alert("OOPS! The e-mail you entered is not valid. Please edit and try again. Thanks");
		document.submit1.from.focus();
		return false;
	}
	
	if (str.indexOf(dot)==lstr-1){
		alert("OOPS! The e-mail you entered is not valid. Please edit and try again. Thanks");
		document.submit1.from.focus();
		return false;
	}
	
 	return true;
}