// JavaScript Document
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("Given E-Mail are Wrong., Given Proper E-Mail Id")
		return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
	{
		alert("Given E-Mail are Wrong., Given Proper E-Mail Id")
		return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
	{
		alert("Given E-Mail are Wrong., Given Proper E-Mail Id")
		return false
	}

	if (str.indexOf(at,(lat+1))!=-1)
	{
		alert("Given E-Mail are Wrong., Given Proper E-Mail Id")
		return false
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
	{
		alert("Given E-Mail are Wrong., Given Proper E-Mail Id")
		return false
	}

	if (str.indexOf(dot,(lat+2))==-1)
	{
		alert("Given E-Mail are Wrong., Given Proper E-Mail Id")
		return false
	}
		
	 if (str.indexOf(" ")!=-1)
	 {
		 alert("Given E-Mail are Wrong., Given Proper E-Mail Id")
		 return false
}
return true					
}

function Check()
{
	var contact = document.cForm;
	
	if (contact.posName.value == "") 
	{
		alert ("You Enter Name Must!!!");
		contact.posName.value == ""
		contact.posName.focus();
		return false;
	} 
	if (contact.posName.value.length > 25) 
	{
		alert ("You Enter Name Must, bt Only blow 25 Char!!!");
		contact.posName.value == ""
		contact.posName.focus();
		return false;
	} 
	if (contact.posName.value.length < 3) 
	{
		alert ("You Enter Name Must, bt More than 3 Char!!!");
		contact.posName.value == ""
		contact.posName.focus();
		return false;
	}
	
	if ((contact.posEmail.value==null)||(contact.posEmail.value==""))
	{
		alert("Please Enter your Email ID");
		contact.posEmail.focus();
		return false;
	}
	
	if (echeck(contact.posEmail.value)==false)
	{
		contact.posEmail.value=""
		contact.posEmail.focus();
		return false;
	}

	var stripped = contact.posPhone.value.replace(/[\(\)\.\-\ ]/g, '');     
	if (contact.posPhone.value == "") 
	{
		alert ("You Enter a Contact Number Include +91, but +91 is not Must!!!");
		contact.posPhone.value == ""
		contact.posPhone.focus();
		return false;
	} 
	else if (isNaN(parseInt(stripped))) 
	{
		alert ("The Contact Number Contains Illegal Characters");
		contact.posPhone.focus();
		return false;

	}
	else if ((stripped.length > 15)) 
	{
		alert ("The Contact Number is the Wrong Length.");
		contact.posPhone.focus();
		return false;
	}
	
	else if ((stripped.length < 10)) 
	{
		alert ("The Contact Number Must be 10 Digits.");
		contact.posPhone.focus();
		return false;
	}
	
	var stripped = contact.posMobile.value.replace(/[\(\)\.\-\ ]/g, '');     
	if (contact.posMobile.value == "") 
	{
		alert ("You Enter a Mobile Number Include +91, but +91 is not Must!!!");
		contact.posMobile.value == ""
		contact.posMobile.focus();
		return false;
	} 
	else if (isNaN(parseInt(stripped))) 
	{
		alert ("The Mobile Number Contains Illegal Characters");
		contact.posMobile.focus();
		return false;

	}
	else if ((stripped.length > 15)) 
	{
		alert ("The Mobile Number is the Wrong Length.");
		contact.posMobile.focus();
		return false;
	}
	
	else if ((stripped.length < 10)) 
	{
		alert ("The Mobile Number Must be 10 Digits.");
		contact.posMobile.focus();
		return false;
	}

	if (contact.posText.value == "")
	{
		alert ('Enter The Your Remarks');
		contact.posText.focus();
		return false;
	}

	if (contact.visitorAddr.value == "")
	{
		alert ('Enter The Your Address');
		contact.visitorAddr.focus();
		return false;
	}

	if (contact.visitorCity.value == "")
	{
		alert ('Enter The Your City');
		contact.visitorCity.focus();
		return false;
	}

	if (contact.visitorPincode.value == "")
	{
		alert ('Enter The Your Zip / Postel Code');
		contact.visitorPincode.focus();
		return false;
	}

	if (contact.visitorCountry.value == "")
	{
		alert ('Enter The Your Country');
		contact.visitorCountry.focus();
		return false;
	}

	return true;
}
