 function iemail(str) {
	    var error = "";
  var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){  
		document.getElementById("iemail").style.backgroundColor = '#d9e2f1';	
		
		   error = "please enter your e-mail\n";
		   return error;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){  
		document.getElementById("iemail").style.backgroundColor = '#d9e2f1';	
	
		   error = "Invalid E-mail\n";
		   return error;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		document.getElementById("iemail").style.backgroundColor = '#d9e2f1';	
	
		       error = "Invalid E-mail\n";
		   return error;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		document.getElementById("iemail").style.backgroundColor = '#d9e2f1';	

		     error = "Invalid E-mail\n";
		   return error;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){	 
		document.getElementById("iemail").style.backgroundColor = '#d9e2f1';	

		      error = "Invalid E-mail\n";
		   return error;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){	
		document.getElementById("iemail").style.backgroundColor = '#d9e2f1';	

		   error = "Invalid E-mail\n";
		   return error;
		 }
		
		 if (str.indexOf(" ")!=-1){
		     error = "Invalid E-mail\n";
		document.getElementById("iemail").style.backgroundColor = '#d9e2f1';	

		   return error;
		 }

		   return error; 
}

function validate_formTwo() {
var reason = "";


	reason += iemail(document.infopack.iemail.value);
	reason += validateiname();	
	reason += validateiphone();
	reason += validatecompany();
	reason += validateaddress();
	
  if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }
else
{
   document.infopack.submit();
   }


}
function validateiname() {
    var error = "";
 
    if (document.infopack.iname.value == "Enter Full Name..") 
	{	
		document.getElementById("iname").style.backgroundColor = '#d9e2f1';
        error = "Please specify your full name.\n";
    } 
    return error;  

}


function validateiphone() {
    var error = "";
 
    if (document.infopack.iphone.value == "Enter Phone Number..") 
	{	
		document.getElementById("iphone").style.backgroundColor = '#d9e2f1';
        error = "Please specify your telephone number.\n";
    } 
    return error;  
}

function validatecompany() {
    var error = "";
 
    if (document.infopack.company.value == "Enter Company Name..") 
	{	
		document.getElementById("company").style.backgroundColor = '#d9e2f1';
        error = "Please specify your company name.\n";
    } 
    return error;  
}

function validateaddress() {
    var error = "";
 
    if (document.infopack.address.value == "Enter Address..") 
	{	
		document.getElementById("address").style.backgroundColor = '#d9e2f1';
        error = "Please specify your address.\n";
    } 
    return error;  
}
