// JavaScript Document
function recipe_valid() {
	if (document.frm2.nme.value == "") {	
		alert("Enter the Name");
		document.frm2.nme.focus();
		return false;
	}
	if (document.frm2.add.value == "") {	
		alert("Enter the Address");
		document.frm2.add.focus();
		return false;
	}
	if (document.frm2.door.value == "") {	
		alert("Enter the Door Number");
		document.frm2.door.focus();
		return false;
	}
	if (document.frm2.street.value == "") {	
		alert("Enter the Street");
		document.frm2.street.focus();
		return false;
	}
	if (document.frm2.city.value == "") {	
		alert("Enter the City");
		document.frm2.city.focus();
		return false;
	}
	if (document.frm2.country.value == "") {	
		alert("Enter the Country");
		document.frm2.country.focus();
		return false;
	}
	if (document.frm2.pin.value == "") {	
		alert("Enter the Pincode");
		document.frm2.pin.focus();
		return false;
	}
	if (document.frm2.email.value == "") {	
		alert("Enter the Email ID");
		document.frm2.email.focus();
		return false;
	}
	if(document.frm2.email.value!="")
	{
		var pos=0;
		pos=document.frm2.email.value.indexOf("@");
		if( pos ==-1)
		{alert("Enter Email in correct format");document.frm2.email.focus();document.frm2.email.select();return false;}
		else if(pos==0)
		{alert("Enter Email in correct format");document.frm2.email.focus();document.frm2.email.select();return false;}
		var p7= 0;
		var p6 = document.frm2.email.value
		p7=p6.length;
		var p8=p7-1;var p9=0;
		p9=p6.charAt(p8);
		if(p9=="@")
		{alert("Enter Email in correct format");document.frm2.email.focus();document.frm2.email.select();return false;}
		var posb=0;
		posb=document.frm2.email.value.indexOf(".");
		if( posb ==-1)
		{alert("Enter Email in correct format");document.frm2.email.focus();document.frm2.email.select();return false;}
		else if(posb==0)
		{alert("Enter Email in correct Format");document.frm2.email.focus(); document.frm2.email.select();return false;}
		var p7b= 0;
		var p6b = document.frm2.email.value
		p7b=p6b.length;
		var p8b=p7b-1;
		var p9b=0;
		p9b=p6b.charAt(p8b);
		if(p9b==".")
		{alert("Enter Email in correct format");document.frm2.email.focus();document.frm2.email.select();return false;	}
	} 
	if (document.frm2.recipe.value == "") {	
		alert("Enter the Recipe");
		document.frm2.recipe.focus();
		return false;
	}
}
function feed_valid() {
	if (document.frm2.nme.value == "") {	
		alert("Enter the Name");
		document.frm2.nme.focus();
		return false;
	}
	if (document.frm2.dsg.value == "") {	
		alert("Enter the Designation");
		document.frm2.dsg.focus();
		return false;
	}
	if (document.frm2.cmpy.value == "") {	
		alert("Enter the Company");
		document.frm2.cmpy.focus();
		return false;
	}
	if (document.frm2.address.value == "") {	
		alert("Enter the Address");
		document.frm2.address.focus();
		return false;
	}
	if (document.frm2.country.value == "") {	
		alert("Enter the Country");
		document.frm2.country.focus();
		return false;
	}
	if (document.frm2.zip.value == "") {	
		alert("Enter the Zip Code");
		document.frm2.zip.focus();
		return false;
	}
	if (document.frm2.phone.value == "") {
		alert("Enter the valid Phone Number");
		document.frm2.phone.focus();
		return false;
	} 
	if(document.frm2.phone.value!="")
	{
		var k1=ph_valid(document.frm2.phone.value);
		if(k1==2)
		{document.frm2.phone.focus();document.frm2.phone.select();return false;}
	}
	if (document.frm2.fax.value == "") {
		alert("Enter the valid Fax Number");
		document.frm2.fax.focus();
		return false;
	} 
	if(document.frm2.fax.value!="")
	{
		var k1=ph_valid(document.frm2.fax.value);
		if(k1==2)
		{document.frm2.fax.focus();document.frm2.fax.select();return false;}
	}
	if (document.frm2.email.value == "") {	
		alert("Enter the Email ID");
		document.frm2.email.focus();
		return false;
	}
	if(document.frm2.email.value!="")
	{
		var pos=0;
		pos=document.frm2.email.value.indexOf("@");
		if( pos ==-1)
		{alert("Enter Email in correct format");document.frm2.email.focus();document.frm2.email.select();return false;}
		else if(pos==0)
		{alert("Enter Email in correct format");document.frm2.email.focus();document.frm2.email.select();return false;}
		var p7= 0;
		var p6 = document.frm2.email.value
		p7=p6.length;
		var p8=p7-1;var p9=0;
		p9=p6.charAt(p8);
		if(p9=="@")
		{alert("Enter Email in correct format");document.frm2.email.focus();document.frm2.email.select();return false;}
		var posb=0;
		posb=document.frm2.email.value.indexOf(".");
		if( posb ==-1)
		{alert("Enter Email in correct format");document.frm2.email.focus();document.frm2.email.select();return false;}
		else if(posb==0)
		{alert("Enter Email in correct Format");document.frm2.email.focus(); document.frm2.email.select();return false;}
		var p7b= 0;
		var p6b = document.frm2.email.value
		p7b=p6b.length;
		var p8b=p7b-1;
		var p9b=0;
		p9b=p6b.charAt(p8b);
		if(p9b==".")
		{alert("Enter Email in correct format");document.frm2.email.focus();document.frm2.email.select();return false;	}
	} 
	if (document.frm2.sug.value == "") {	
		alert("Enter the Query / Suggestion");
		document.frm2.sug.focus();
		return false;
	}
}
function ph_valid(jj)
{
	var p = jj;
	var checkOK1 = "0123456789-+ ";
	var allValid1 = true;
	var decPoints1 = 0;
	var allNum1 = "";
	for (i = 0;  i < p.length;  i++)
	{
		ch1 = jj.charAt(i);
		for (j = 0;  j < checkOK1.length;  j++)
		if (ch1 == checkOK1.charAt(j))
		 break;
		 if (j == checkOK1.length)
 		{
			allValid1 = false;
			 break;
		}
		 if (ch1 == "-")
		 {
			 allNum1 += "-";
			  decPoints1++;
  		 }
		 else
			allNum1 += ch1;
	}
	if (!allValid1)
 	{alert("Enter only numeric characters");return(2);}
 	if (decPoints1 > 2)
	{alert("Enter a valid Phone Number");return (2);}
}
