
function Validate()
	{
		if(document.custcomp.pro_unit.value == "")
		{
			alert("Production Unit/Railway is Manadatory")
			document.custcomp.pro_unit.focus();
			return false;
		}

		punit=document.custcomp.pro_unit.value;

		if (punit==0 || punit==null)
		{
		alert("Please enter proper value");
		document.custcomp.pro_unit.focus();
		return false;
		}


		if(document.custcomp.shop.value == "")
		{
			alert("Shed/Shop is Manadatory")
			document.custcomp.shop.focus();
			return false;
		}

		pshop=document.custcomp.shop.value;

		if (pshop==0 || pshop==null)
		{
		alert("Please enter proper value");
		document.custcomp.shop.focus();
		return false;
		}


		if(document.custcomp.contperson.value == "")
		{
			alert("Contact Person is Manadatory")
			document.custcomp.contperson.focus();
			return false;
		}

		cperson=document.custcomp.contperson.value;

		if (cperson==0 || cperson==null)
		{
		alert("Please enter proper value");
		document.custcomp.contperson.focus();
		return false;
		}

		if(document.custcomp.assly.value == "")
		{
			alert("Failed Main Unit / Assly is Manadatory")
			document.custcomp.assly.focus();
			return false;
		}

		caay=document.custcomp.assly.value;

		if (caay==0 || caay==null)
		{
		alert("Please enter proper value");
		document.custcomp.assly.focus();
		return false;
		}


		if(document.custcomp.serial.value == "")
		{
			alert("Serial No is Manadatory")
			document.custcomp.serial.focus();
			return false;
		}


		srl=document.custcomp.serial.value;

		if (srl==0 || srl==null)
		{
		alert("Please enter proper value");
		document.custcomp.serial.focus();
		return false;
		}


		if(document.custcomp.email.value == "")
		{
			alert("Please mention Email")
			document.custcomp.email.focus();
			return false;
		}

		if(document.custcomp.email.value!="")
		{
			if(echeck(document.custcomp.email.value)==false)
			{
			document.custcomp.email.focus();
			return false; 
			}
		}
 


		if(document.custcomp.cap_number.value=="")
		{
			alert("Validation code is Manadatory")
			document.custcomp.cap_number.focus();
			return false;
		}

		
		
		
	}	
		function OnlyNumber()
		{
			jv_keyCode = window.event.keyCode
			if(!(jv_keyCode >= 48 && jv_keyCode <= 57))
			{
				window.event.keyCode = 0
			}
		}


function echeck(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("Invalid E-mail ID")
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail ID")
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("Invalid E-mail ID")
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		alert("Invalid E-mail ID")
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("Invalid E-mail ID")
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		alert("Invalid E-mail ID")
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		alert("Invalid E-mail ID")
		return false
	 }
	 return true					
}