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					
}


function form_valiate()
{

myOption = -1;
for (i=cntct_us.hear_site.length-1; i > -1; i--) {
if (cntct_us.hear_site[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("Please mention how did you first hear about our internet site.");
return false;
}

//alert(act);

if(document.cntct_us.ur_name.value=="")
	{
     alert("Please mention name"); 
	 document.cntct_us.ur_name.focus();
	 return false;
	}


if (document.cntct_us.ur_name.value!="")
{
	
	//check for name
	nwstl=document.cntct_us.ur_name.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.cntct_us.ur_name.focus();
	return false;
	}
}


if(document.cntct_us.ur_name.value !="")
	{
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@_/,- \n\r";
  var checkStr = document.cntct_us.ur_name.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert('Data are invalid.Only a-z 0-9 @ _ . , /   are allowed');
    document.cntct_us.ur_name.select();
    return false;
  }
}

if(document.cntct_us.ur_name.value!="")
	{

		if(document.cntct_us.ur_name.value.length > 100)
		{
					alert("Name cannot be greater than 100 Characters");
					document.cntct_us.ur_name.focus();
					return false;
		}
	}	


myOption1 = -1;
for (i=cntct_us.associated.length-1; i > -1; i--) {
if (cntct_us.associated[i].checked) {
myOption1 = i; i = -1;
}
}
if (myOption1 == -1) {
alert("Please mention what you are associated with");
return false;
}
	

if(document.cntct_us.specify.value=="")
	{
     alert("Please specify"); 
	 document.cntct_us.specify.focus();
	 return false;
	}


if (document.cntct_us.specify.value!="")
{
	
	//check for name
	nwstl=document.cntct_us.specify.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.cntct_us.specify.focus();
	return false;
	}
}


if(document.cntct_us.specify.value !="")
	{
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@_/,- \n\r";
  var checkStr = document.cntct_us.specify.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert('Data are invalid.Only a-z 0-9 @ _ . , /   are allowed');
    document.cntct_us.specify.select();
    return false;
  }
}

if(document.cntct_us.specify.value!="")
	{

		if(document.cntct_us.specify.value.length > 100)
		{
					alert("specification cannot be greater than 100 Characters");
					document.cntct_us.specify.focus();
					return false;
		}
	}	



if(document.cntct_us.addr.value=="")
	{
     alert("Please mention address"); 
	 document.cntct_us.addr.focus();
	 return false;
	}


if (document.cntct_us.addr.value!="")
{
	
	//check for name
	nwstl=document.cntct_us.addr.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.cntct_us.addr.focus();
	return false;
	}
}


if(document.cntct_us.addr.value !="")
	{
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789()&#.@_/,- \n\r";
  var checkStr = document.cntct_us.addr.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert('Data are invalid.Only a-z 0-9 @ _ . , /   are allowed');
    document.cntct_us.addr.select();
    return false;
  }
}

if(document.cntct_us.addr.value!="")
	{

		if(document.cntct_us.addr.value.length > 250)
		{
					alert("Address cannot be greater than 250 Characters");
					document.cntct_us.addr.focus();
					return false;
		}
	}	


if(document.cntct_us.city.value=="")
	{
     alert("Please mention city"); 
	 document.cntct_us.city.focus();
	 return false;
	}


if (document.cntct_us.city.value!="")
{
	
	//check for name
	nwstl=document.cntct_us.city.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.cntct_us.city.focus();
	return false;
	}
}


if(document.cntct_us.city.value !="")
	{
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789()&#.@_/,- \n\r";
  var checkStr = document.cntct_us.city.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert('Data are invalid.Only a-z 0-9 @ _ . , /   are allowed');
    document.cntct_us.city.select();
    return false;
  }
}

if(document.cntct_us.city.value!="")
	{

		if(document.cntct_us.city.value.length > 100)
		{
					alert("City cannot be greater than 100 Characters");
					document.cntct_us.city.focus();
					return false;
		}
	}	



if(document.cntct_us.phone.value=="")
	{
     alert("Please mention phone"); 
	 document.cntct_us.phone.focus();
	 return false;
	}


if (document.cntct_us.phone.value!="")
{
	
	//check for name
	nwstl=document.cntct_us.phone.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.cntct_us.phone.focus();
	return false;
	}
}


if(document.cntct_us.phone.value !="")
	{
var checkOK = "0123456789()+ ";
  var checkStr = document.cntct_us.phone.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert('Data are invalid.Only 0-9 () + are allowed');
    document.cntct_us.phone.select();
    return false;
  }
}

if(document.cntct_us.phone.value!="")
	{

		if(document.cntct_us.phone.value.length > 20)
		{
					alert("Phone cannot be greater than 20 Characters");
					document.cntct_us.phone.focus();
					return false;
		}
	}	




if(document.cntct_us.state.value=="")
	{
     alert("Please mention state"); 
	 document.cntct_us.state.focus();
	 return false;
	}


if (document.cntct_us.state.value!="")
{
	
	//check for name
	nwstl=document.cntct_us.state.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.cntct_us.state.focus();
	return false;
	}
}


if(document.cntct_us.state.value !="")
	{
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789()&#.@_/,- \n\r";
  var checkStr = document.cntct_us.state.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert('Data are invalid.Only a-z 0-9 @ _ . , /   are allowed');
    document.cntct_us.state.select();
    return false;
  }
}

if(document.cntct_us.state.value!="")
	{

		if(document.cntct_us.state.value.length > 100)
		{
					alert("State cannot be greater than 100 Characters");
					document.cntct_us.state.focus();
					return false;
		}
	}	





if(document.cntct_us.country.value=="")
	{
     alert("Please mention country"); 
	 document.cntct_us.country.focus();
	 return false;
	}


if (document.cntct_us.country.value!="")
{
	
	//check for name
	nwstl=document.cntct_us.country.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.cntct_us.country.focus();
	return false;
	}
}


if(document.cntct_us.country.value !="")
	{
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789()&#.@_/,- \n\r";
  var checkStr = document.cntct_us.country.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert('Data are invalid.Only a-z 0-9 @ _ . , /   are allowed');
    document.cntct_us.country.select();
    return false;
  }
}

if(document.cntct_us.country.value!="")
	{

		if(document.cntct_us.country.value.length > 200)
		{
					alert("Country cannot be greater than 200 Characters");
					document.cntct_us.country.focus();
					return false;
		}
	}	




if(document.cntct_us.email.value=="")
	{
     alert("Please mention email"); 
	 document.cntct_us.email.focus();
	 return false;
	}


if (document.cntct_us.email.value!="")
{
	
	//check for name
	nwstl=document.cntct_us.email.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.cntct_us.email.focus();
	return false;
	}
}


if(document.cntct_us.email.value !="")
	{
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@_/,- \n\r";
  var checkStr = document.cntct_us.email.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert('Data are invalid.Only a-z 0-9 @ _ . , /   are allowed');
    document.cntct_us.email.select();
    return false;
  }
}

if(document.cntct_us.email.value!="")
	{

		if(document.cntct_us.email.value.length > 100)
		{
					alert("Email cannot be greater than 100 Characters");
					document.cntct_us.email.focus();
					return false;
		}
	
		var str=document.cntct_us.email.value;
		var valid=echeck(str);

		if (valid==0)
		{
			//alert('Invalid email id');
			document.cntct_us.email.focus();
			return false;
		}

	
	}	



if(document.cntct_us.msg.value=="")
	{
     alert("Please mention message"); 
	 document.cntct_us.msg.focus();
	 return false;
	}


if (document.cntct_us.msg.value!="")
{
	
	//check for name
	nwstl=document.cntct_us.msg.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.cntct_us.msg.focus();
	return false;
	}
}


if(document.cntct_us.security_code.value=="")
	{
     alert("Please mention security code"); 
	 document.cntct_us.security_code.focus();
	 return false;
	}


if (document.cntct_us.security_code.value!="")
{
	
	//check for name
	nwstl=document.cntct_us.security_code.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.cntct_us.security_code.focus();
	return false;
	}
}	




}
