function mail()
 {
	
   var name=document.getElementById("name").value;
   var mail=document.getElementById("mail").value;
   var phone=document.getElementById("phone").value;
   var comments=document.getElementById("comments").value;
 
   if(name=="")
   {
   alert("Please enter  the name");
   document.getElementById("name").focus();
   return false;
   } 
    
   else if(mail==""||mail.indexOf('.')==-1||mail.indexOf('@')==-1||mail.indexOf('@')>mail.lastIndexOf('.')||
  mail.split('.@').length==2 || mail.split('@.').length==2)
  {
  alert("Please enter correct email address");
  document.getElementById("mail").focus();
  return false;
  }
  else if(phone==""||isNumeric(phone)==false)
  { alert("Please enetr the phone Numebr");
  document.getElementById("phone").focus();
  return false;
  }
  else if(comments=="")
   {
   alert("Please enter  the  comments");
   document.getElementById("comments").focus();
   return false;
   } 
   
   else
   {
	   
	   $.post("./mail.php",{name:name,mail:mail,phone:phone,comments:comments,},function(data)
	   {
	  if(data.length >0)
		{
			alert("Thanks");			
			document.getElementById("name").value="";
			document.getElementById("mail").value="";
			document.getElementById("phone").value="";
			document.getElementById("comments").value="";
			
			
		 
		}
		
	});
   }
 }


// ticket //
function ticket()
 {
	
   var name=document.getElementById("name").value;
   var address=document.getElementById("address").value;
   var email=document.getElementById("email").value;
   var phone=document.getElementById("phone").value;
   var ticet=document.getElementById("ticket").value;
   var date=document.getElementById("date").value;
  
 
   if(name=="")
   {
   alert("Please enter  the name");
   document.getElementById("name").focus();
   return false;
   } 
    else if(email==""||email.indexOf('.')==-1||email.indexOf('@')==-1||email.indexOf('@')>email.lastIndexOf('.')||
  email.split('.@').length==2 || email.split('@.').length==2)
  {
  alert("Please enter correct email address");
  document.getElementById("email").focus();
  return false;
  }
  else if(phone==""||isNumeric(phone)==false)
  { alert("Please enetr the phone Numebr");
  document.getElementById("phone").focus();
  return false;
  }
  else if(address=="")
   {
   alert("Please enter  the Address");
   document.getElementById("address").focus();
   return false;
   } 
    else if(ticket=="")
   {
   alert("Please enter  the No of Ticket");
   document.getElementById("ticket").focus();
   return false;
   } 
   
    else if(date=="")
   {
   alert("Please enter  the Preferred date and time");
   document.getElementById("date").focus();
   return false;
   } 
   
   else
   {
	  return true;
	  
   }
 }



// end of ticket //









function isNumeric(field)
{
 var number="0123456789";
  var m=0;
  for(i=0;i<field.length;i++)
  {
	for(j=0;j<number.length;j++)
	{
	  if(field.charAt(i)==number.charAt(j))
	  {
		  m=m+1;
	  }
	}
  }
  
  if(m==field.length)
  {
	  return true;
  }
  else
  {
	  return false;
  }
}

function cleartext()
 {
	 
	       document.getElementById("name").value="";
			document.getElementById("mail").value="";
			document.getElementById("phone").value="";
			
			
			
 }
