// JavaScript Document
function onsubmit1()
{
 document.contactus.submit();

}
function onsubmit2()
{
 document.contactus_b.submit();

}
function onsubmit10ld()
{ 

	var alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var digit="+-0123456789";
	var specialchar="~!@#$%^&*_+|\?/<>';:`[]{}=";
	var emailchar="~!#$%^&*()+|\?/<>';:`[]{}=,";
	
	//alert("javascript");
	
	/*Validations for username*/

	var name=document.getElementById('txtname').value;
	//alert(name);
	if(name.length==0)
	{
		alert("Please enter Name.");
		document.getElementById('txtname').focus();
		return false;
	}
	else
	{
		document.getElementById('txtname').value = name;
		for(i=0; i<name.length; i++)
		{  			
			if(specialchar.indexOf(name.charAt(i))!=-1||digit.indexOf(name.charAt(i))!=-1)
			{ 
				alert("Please enter correct Name.");
				document.getElementById('txtname').focus();
				return false;
			}					
		}
	}
	

	/*Validations for Email Id.	*/

	var mail=document.getElementById('txtemail').value;
	//alert(mail);
	if(mail.length==0)
	{
		alert("Please enter Email Id.")
		document.getElementById('txtemail').focus();
		return false;
	}
	else
	{	
		document.getElementById('txtemail').value = mail;
		lat=mail.indexOf('@');
		ldot=mail.indexOf('.');
		for(i=0; i<mail.length;i++)
		{  			
			if(emailchar.indexOf(mail.charAt(i))!=-1)
			{		
				alert("Special characters except '@' and '.' are not allowed.");
				document.getElementById('txtemail').focus();
				return false;
			}
			if(mail.indexOf('@')==-1||mail.indexOf('.')==-1||
			mail.indexOf('@',(lat+1))!=-1||/*comapare @ with next index of @*/
			mail.indexOf('.',(ldot+1))!=-1|| /*comapare . with next index of .*/
			mail.substring((lat-1),lat)=='.'|| /*check . present in previous index of @ */
			mail.substring((lat+1),(lat+2))=='.') /*check . present 3 positions after @  */
			{
				alert("Please enter valid Email-Id.");
				document.getElementById('txtemail').focus();
				return false;
			}
		}
	}	

	var phone=document.getElementById('txtphone').value;
		//alert(phone);

	if(phone.length==0)
	{
		alert("Please enter Phone No.");
		document.getElementById('txtphone').focus();
		return false;
	}
	else
	{	
		document.getElementById('txtphone').value = phone;
		for(i=0; i<phone.length;i++)
		{  			
			if(specialchar.indexOf(phone.charAt(i))!=-1||alpha.indexOf(phone.charAt(i))!=-1)
			{		
				alert("Please enter valid Phone No.");
				document.getElementById('txtphone').focus();
				return false;
			}
			if(digit.indexOf(phone.charAt(i))==-1)
			{
				alert("Please enter valid Phone No.");
				document.getElementById('txtphone').focus();
				return false;
			}
		}
	}	

	/*Validations for address*/	

	var desc=document.getElementById('txtsituation').value;
	//alert(desc);
	if(desc.length==0)
	{
		alert("Please enter valid data.");
		document.getElementById('txtsituation').focus();
		return false;
	}
	else
	{	
		document.getElementById('txtsituation').value = desc;
		for(i=0; i<desc.length; i++)
		{  			
			if(specialchar.indexOf(desc.charAt(i))!=-1)
			{
				alert("Please enter correct data.");
				document.getElementById('txtsituation').focus();
				return false;
			}					
		}
	}
	 document.contactus.submit();
}	

function onsubmit2old()
{ 
	var alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var digit="+-0123456789";
	var specialchar="~!@#$%^&*_+|\?/<>';:`[]{}=";
	var emailchar="~!#$%^&*()+|\?/<>';:`[]{}=,";
	
	//alert("javascript");
	
				/*Validations for username*/

	var name=document.getElementById('txtname2').value;
	//alert(name);
	if(name.length==0)
	{
		alert("Please enter Name.");
		document.getElementById('txtname2').focus();
		return false;
	}
	else
	{
		for(i=0; i<name.length; i++)
		{  			
			if(specialchar.indexOf(name.charAt(i))!=-1||digit.indexOf(name.charAt(i))!=-1)
			{ 
				alert("Please enter correct Name.");
				document.getElementById('txtname2').focus();
				return false;
			}					
		}
	}
	
	/*Validations for contact No.*/	
	/*Validations for Email Id.	*/

	var mail=document.getElementById('txtemail2').value;
	//alert(mail);
	if(mail.length==0)
	{
		alert("Please enter Email Id.")
		document.getElementById('txtemail2').focus();
		return false;
	}
	else
	{	
		lat=mail.indexOf('@');
		ldot=mail.indexOf('.');
		for(i=0; i<mail.length;i++)
		{  			
			if(emailchar.indexOf(mail.charAt(i))!=-1)
			{		
				alert("Special characters except '@' and '.' are not allowed.");
				document.getElementById('txtemail2').focus();
				return false;
			}
			if(mail.indexOf('@')==-1||mail.indexOf('.')==-1||
			mail.indexOf('@',(lat+1))!=-1||/*comapare @ with next index of @*/
			mail.indexOf('.',(ldot+1))!=-1|| /*comapare . with next index of .*/
			mail.substring((lat-1),lat)=='.'|| /*check . present in previous index of @ */
			mail.substring((lat+1),(lat+2))=='.') /*check . present 3 positions after @  */
			{
				alert("Please enter valid Email-Id.");
				document.getElementById('txtemail2').focus();
				return false;
			}
		}
	}	


	var phone=document.getElementById('txtphone2').value;
		//alert(phone);

	if(phone.length==0)
	{
		alert("Please enter Phone No.");
		document.getElementById('txtphone2').focus();
		return false;
	}
	else
	{	
		for(i=0; i<phone.length;i++)
		{  			
			if(specialchar.indexOf(phone.charAt(i))!=-1||alpha.indexOf(phone.charAt(i))!=-1)
			{		
				alert("Please enter valid Phone No.");
				document.getElementById('txtphone2').focus();
				return false;
			}
			if(digit.indexOf(phone.charAt(i))==-1)
			{
				alert("Please enter valid Phone No.");
				document.getElementById('txtphone2').focus();
				return false;
			}
		}
	}	

	/*Validations for address*/	

	var desc=document.getElementById('txtsituation2').value;
	//alert(desc);
	if(desc.length==0)
	{
		alert("Please enter valid data.");
		document.getElementById('txtsituation2').focus();
		return false;
	}
	else
	{	
		for(i=0; i<desc.length; i++)
		{  			
			if(specialchar.indexOf(desc.charAt(i))!=-1)
			{
				alert("Please enter correct data.");
				document.getElementById('txtsituation2').focus();
				return false;
			}					
		}
	}
	 
	 document.contactus_b.submit();
	
}	


function restme()
{
	document.getElementById('txtname2').value = "";
	document.getElementById('txtemail2').value = "";
	document.getElementById('txtphone2').value = "";
	document.getElementById('txtsituation2').value = "";
}
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



//-->