
function validation(){
String.prototype.trim = function() {
		return this.replace(/^\s+|\s+$/g,"");
	}
	String.prototype.ltrim = function() {
		return this.replace(/^\s+/,"");
	}
	String.prototype.rtrim = function() {
		return this.replace(/\s+$/,"");
	}
if(document.form1.name.value.trim()=='')
		{
		  alert("Please Enter Your  Name");
		  document.form1.name.focus();
		  return false;
		}
		
		if(document.form1.phone.value.trim()=='')
		{
		  alert("Please Enter Phone");
		  document.form1.phone.focus();
		  return false;
		}
		
		var emailID=document.form1.email
	
		if ((emailID.value==null)||(emailID.value=="")){
			alert("Please Enter your Email Address");
			emailID.focus();
			return false;
		}
		if (echeck(emailID.value)==false){
			emailID.value="";
			emailID.focus();
			return false;
		}
		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 Email Address");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid Email Address");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			alert("Invalid Email Address");
			return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
			alert("Invalid Email Address");
			return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			alert("Invalid Email Address");
			return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
			alert("Invalid Email Address");
			return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
			alert("Invalid Email Address");
			return false;
		 }

		 return true;					
	  }

}
function checkChar(e)
{
	evt=e || window.event;
	var keypressed=evt.which || evt.keyCode;
	//alert(keypressed);
	if(keypressed!="48" &&  keypressed!="49" && keypressed!="50" && keypressed!="51" && keypressed!="52" && keypressed!="53" && keypressed!="54" && keypressed!="55" && keypressed!="8" && keypressed!="56" && keypressed!="57" && keypressed!="45" && keypressed!="46" && keypressed!="37" && keypressed!="39" && keypressed!="9")
	{
 		return false;
	}

}


