// JavaScript Document

function validation()
{
   var tname=document.form1.txtName.value;
   if (tname == "" || tname.length==0)
   {
	   alert("Please Enter your Name");
	   document.form1.txtName.focus();
	   return false;
   }
   var tadd=document.form1.txtAddress.value;
   if (tadd == "" || tadd.length==0)
   {
	   alert("Please Enter your Address");
	   document.form1.txtAddress.focus();
	   return false;
   }
   var tcity=document.form1.txtCity.value;
   if (tcity == "" || tcity.length==0)
   {
	   alert("Please Enter your City");
	   document.form1.txtCity.focus();
	   return false;
   }
   if(document.form1.lstService.selectedIndex == 0)
   {
	  alert("Please Select our Services");
	  document.form1.lstService.focus();
	  return false;
   }
   var temail=document.form1.txtEmail.value;
   if (temail == "" || temail.length==0 || !ValidateEmail(temail))
   {
	   alert("Please Enter your E-mail ID");
	   document.form1.txtEmail.focus();
	   return false;
   }
   
   var tmsg=document.form1.txtMsg.value;
   if (tmsg == "" || tmsg.length==0)
   {
	   alert("Please Enter your Message");
	   document.form1.txtMsg.focus();
	   return false;
   }
  return true;
}

function ValidateEmail( Email )
{
		var atCharPresent = false;
		var dotPresent = false;
		for ( var Idx = 0; Idx < Email.length; Idx++ )
		{
			if ( Email.charAt ( Idx ) == '@' )
				atCharPresent = true;
			if ( Email.charAt ( Idx ) == '.' )
				dotPresent = true;
		}
		if ( !atCharPresent || !dotPresent )
			return false;

	return true;
}