arw="<img src='./images/arr_B.gif' border='0' alt='' valign='top' style='padding-bottom:2px;'>&nbsp; ";


function contact()
{		


	var msg='';
	var msg1="";i=0;

	//alert("vimal");
	
	//Name
   	if(document.aphCont.aphname.value=="")
		{
			msg+=arw+"Name"+"<br>";
			if(i!=1){i=1;
			msg1="document.aphCont.aphname";
			}	 
		}else if(document.aphCont.aphname.value!="")
		{
			if(document.aphCont.aphname.value!=""){
				var regnext= /^[A-Za-z]+[A-Za-z\s\.]+$/;
				if((document.aphCont.aphname.value.indexOf(".")==0) || (document.aphCont.aphname.value.indexOf(" ")==0)){
					msg+=arw+"First character of  Name should be alphabet character"+"<br>";
					if(i!=1){i=1;
					msg1="document.aphCont.aphname";
						}	 
				}else if(regnext.test(document.aphCont.aphname.value) == false){	
					msg+=arw+"Name should be alphabet character"+"<br>";
					if(i!=1){i=1;
					msg1="document.aphCont.aphname";
					}	 
				}
			}
		}
	
	
	//Email 
	if(document.aphCont.aphemail.value=="")
   	{ 
		//if(msg==''){msg1="document.regist.email";}
		msg+=arw+" Email "+"<br>";
		if(i!=1){i=1;
			msg1="document.aphCont.aphemail";
		}
	}
	if(document.aphCont.aphemail.value!="")
	{
		
		var reg = /^[A-Za-z0-9]+([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		var address =document.aphCont.aphemail.value;
		if(reg.test(address) == false) 
		{
		  msg+=arw+'Enter valid Email'+"<br>";
		 if(i!=1){i=1;
			msg1="document.aphCont.aphemail";
			}
		}
	}

//Telephone 
	if(document.aphCont.aphtele.value=="")
   	{ 
		//if(msg==''){msg1="document.regist.email";}
		msg+=arw+" Telephone "+"<br>";
		if(i!=1){i=1;
			msg1="document.aphCont.aphtele";
		}
	}
	
//Message 
	if(document.aphCont.aphmes.value=="")
   	{ 
		//if(msg==''){msg1="document.regist.email";}
		msg+=arw+" Message "+"<br>";
		if(i!=1){i=1;
			msg1="document.aphCont.aphmes";
		}
	}

	//Dialog
	if(msg1!='')
	{
	
		document.getElementById('dialog').innerHTML=msg;	//alert("msg");
		//document.getElementById('focus12').value=msg1;
        $('#dialog').dialog('open');
		return false;
	}
}

function contactnumbonly(e){
	var unicode=e.charCode? e.charCode : e.keyCode
		if (unicode==8||unicode==9){ }
		else{
			if(unicode!=9 && unicode!=13 && unicode!=32 &&  unicode!=39  && unicode!=43 && unicode!=45 && unicode!=46){
			if (unicode<48||unicode>57 || unicode==94){ 
			msg="Please enter numbers only.";
			document.getElementById('dialog').innerHTML=msg;
			$('#dialog').dialog('open');

			return false
			}
			}
		}
	}


function characteronly(e){
	var unicode=e.charCode? e.charCode : e.keyCode
	if(unicode!=9 && unicode!=13 &&  unicode!=39 &&  unicode!=46){
	//if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
		if ((unicode<65||unicode>122)&&(unicode!=32)&&(unicode!=8) || (unicode==94)){ //if not a number
		msg="Please enter only the alphabetic characters and space.";
		document.getElementById('dialog').innerHTML=msg;
		$('#dialog').dialog('open');
		return false //disable key press
		}
	}
}
