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()
{

//alert(act);

if(document.ContactUsFrm.fname.value=="")
{
 alert("Please enter your first name"); 
 document.ContactUsFrm.fname.focus();
 return false;
}
//if(document.ContactUsFrm.lname.value=="")
//{
// alert("Please enter your last name"); 
// document.ContactUsFrm.lname.focus();
// return false;
//}
if(document.ContactUsFrm.ComName.value=="")
{
 alert("Please enter company name"); 
 document.ContactUsFrm.ComName.focus();
 return false;
}
if(document.ContactUsFrm.address.value=="")
{
 alert("Please enter address"); 
 document.ContactUsFrm.address.focus();
 return false;
}

if(document.ContactUsFrm.email.value=="")
	{
     alert("Please mention email"); 
	 document.ContactUsFrm.email.focus();
	 return false;
	}


if (document.ContactUsFrm.email.value!="")
{		
	nwstl=document.ContactUsFrm.email.value;
	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.ContactUsFrm.email.focus();
	return false;
	}
}
if(document.ContactUsFrm.email.value !="")
{
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@_/,- \n\r";
	var checkStr = document.ContactUsFrm.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.ContactUsFrm.email.select();
    return false;
  }
}
if(document.ContactUsFrm.email.value!="")
{
	if(document.ContactUsFrm.email.value.length > 100)
	{
		alert("Email cannot be greater than 100 Characters");
		document.ContactUsFrm.email.focus();
		return false;
	}
	var str=document.ContactUsFrm.email.value;
	var valid=echeck(str);
	if(valid==0)
	{
		//alert('Invalid email id');
		document.ContactUsFrm.email.focus();
		return false;
	}
}	
if(document.ContactUsFrm.phone.value=="")
	{
     alert("Please mention phone"); 
	 document.ContactUsFrm.phone.focus();
	 return false;
	}
if (document.ContactUsFrm.phone.value!="")
{
	
	//check for name
	nwstl=document.ContactUsFrm.phone.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.ContactUsFrm.phone.focus();
	return false;
	}
}
if(document.ContactUsFrm.phone.value !="")
{
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@_/,- \n\r";
  var checkStr = document.ContactUsFrm.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 a-z 0-9 @ _ . , /   are allowed');
    document.ContactUsFrm.phone.select();
    return false;
  }
}
if(document.ContactUsFrm.phone.value!="")
{
	if(document.ContactUsFrm.phone.value.length > 100)
	{
		alert("Phone cannot be greater than 100 Characters");
		document.ContactUsFrm.phone.focus();
		return false;
	}
}
if(document.ContactUsFrm.security_code.value=="")
{
	alert("Please mention security code"); 
	document.ContactUsFrm.security_code.focus();
	return false;
}
if(document.ContactUsFrm.security_code.value!="")
{
	nwstl=document.ContactUsFrm.security_code.value;
	if(nwstl==0 || nwstl==null)
	{
		alert("Please enter proper value");
		document.ContactUsFrm.security_code.focus();
		return false;
	}
}





}
function form_valiate_soft_licensed()
{

//alert(act);

if(document.soft_licensed.company_name.value=="")
{
 alert("Please enter your company name"); 
 document.soft_licensed.company_name.focus();
 return false;
}
if(document.ContactUsFrm.Title.value=="")
{
 alert("Please enter title"); 
 document.ContactUsFrm.Title.focus();
 return false;
}
if(document.soft_licensed.fname.value=="")
{
 alert("Please enter your first name"); 
 document.soft_licensed.fname.focus();
 return false;
}
if(document.soft_licensed.lname.value=="")
{
 alert("Please enter your last name"); 
 document.soft_licensed.lname.focus();
 return false;
}
if(document.soft_licensed.ship_address.value=="")
{
 alert("Please enter your shipping address"); 
 document.soft_licensed.ship_address.focus();
 return false;
}
if(document.soft_licensed.ship_city.value=="")
{
 alert("Please enter your shipping city"); 
 document.soft_licensed.ship_city.focus();
 return false;
}
if(document.soft_licensed.state.value=="")
{
 alert("Please enter your state"); 
 document.soft_licensed.state.focus();
 return false;
}
if(document.soft_licensed.zip.value=="")
{
 alert("Please enter your zip code"); 
 document.soft_licensed.zip.focus();
 return false;
}

if(document.soft_licensed.email.value=="")
	{
     alert("Please mention email"); 
	 document.soft_licensed.email.focus();
	 return false;
	}


if (document.soft_licensed.email.value!="")
{		
	nwstl=document.soft_licensed.email.value;
	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.soft_licensed.email.focus();
	return false;
	}
}
if(document.soft_licensed.email.value !="")
{
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@_/,- \n\r";
	var checkStr = document.soft_licensed.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.soft_licensed.email.select();
    return false;
  }
}
if(document.soft_licensed.email.value!="")
{
	if(document.soft_licensed.email.value.length > 100)
	{
		alert("Email cannot be greater than 100 Characters");
		document.soft_licensed.email.focus();
		return false;
	}
	var str=document.soft_licensed.email.value;
	var valid=echeck(str);
	if(valid==0)
	{
		//alert('Invalid email id');
		document.soft_licensed.email.focus();
		return false;
	}
}	
if(document.soft_licensed.tel_no.value=="")
	{
     alert("Please mention phone"); 
	 document.soft_licensed.tel_no.focus();
	 return false;
	}
if (document.soft_licensed.tel_no.value!="")
{
	
	//check for name
	nwstl=document.soft_licensed.tel_no.value;

	if (nwstl==0 || nwstl==null)
	{
	alert("Please enter proper value");
	document.soft_licensed.tel_no.focus();
	return false;
	}
}
if(document.soft_licensed.tel_no.value !="")
{
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@_/,- \n\r";
  var checkStr = document.soft_licensed.tel_no.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.soft_licensed.tel_no.select();
    return false;
  }
}
if(document.soft_licensed.tel_no.value!="")
{
	if(document.soft_licensed.tel_no.value.length > 100)
	{
		alert("Phone cannot be greater than 100 Characters");
		document.soft_licensed.tel_no.focus();
		return false;
	}
}
}

