//====================================================================================
function bookingvalidation()
 {
//------------------------------------------------------------------------------------  
  if (!(validategeneralinfo())){return false;}
//------------------------------------------------------------------------------------  
  if (!(validatesngljnydetails())){return false;}
//------------------------------------------------------------------------------------  
  if (!(validateretnjnydetails())){return false;}
//------------------------------------------------------------------------------------  
  return true;
 }
//====================================================================================
function validategeneralinfo()
 {
//------------------------------------------------------------------------------------  
  if( document.getElementById('client_name').value == "" )
   {
	alert( "Please enter your full name" );
	document.getElementById('client_name').focus();
	return false;
   }
//------------------------------------------------------------------------------------  
  if(Validate(document.getElementById("client_name").value,"[^A-Za-z\\ ]") == true)
   {
	alert("Please enter a valid name");
	document.getElementById("client_name").focus();
	return false;
   }
//------------------------------------------------------------------------------------  
  if( document.getElementById('client_email').value == "" )
   {
	alert( "Please enter an email address" );
	document.getElementById('client_email').focus();
	return false;
   }
//------------------------------------------------------------------------------------  
/*
  if(Validate(document.getElementById("client_email").value,"[A-Za-z0-9_\\.][A-Za-z]*@[A-Za-z-]*\\.[A-Za-z0-9]") == false)
   {
	alert("Please enter a valid email address");
	document.getElementById("client_email").focus();
	return false;
   }
*/
//------------------------------------------------------------------------------------  
  if(InValidEmailAddress(document.getElementById("client_email").value) == true)
   {
	alert("Please enter a valid email address");
	document.getElementById("client_email").focus();
	return false;
   }
//------------------------------------------------------------------------------------  
  if (( document.getElementById('client_phone').value == "" ) && (document.getElementById('client_mobile').value == "" ))
   {
    alert( "Please enter a landline, or a mobile, phone number." );
	document.getElementById('client_phone').focus();
	return false;
   }
//------------------------------------------------------------------------------------  
  if (document.getElementById('client_phone').value != "")
   {
    if(checkInternationalPhone(document.getElementById("client_phone").value)==false)
	 {
	  alert("Please enter a valid landline phone number.");
	  document.getElementById("client_phone").focus();
	  return false
	 }
   }
//------------------------------------------------------------------------------------  
  if (document.getElementById('client_mobile').value != "")
   {
    if(checkInternationalPhone(document.getElementById("client_mobile").value)==false)
     {
	  alert("Please enter a valid mobile phone number.");
      document.getElementById("client_mobile").focus();
      return false
	 }
   }
//------------------------------------------------------------------------------------  
  return true;
 }
//====================================================================================
function getlocationtype(location)
 {
  var locationtype = 0;
  for (i=0;i<nlocations;i=i+1)
   {
	if (locations[i][1] == location){locationtype=locations[i][2];}  
   } 
   return locationtype;
 }
//====================================================================================
function InValidEmailAddress(In_String)
 {
  invalid = false;
  atCount = 0;
  atPos = 0;
  allowed_chars = '';
  allowed_chars = allowed_chars + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';  
  allowed_chars = allowed_chars + 'abcdefghijklmnopqrstuvwxyz';  
  allowed_chars = allowed_chars + '0123456789';  
  allowed_chars = allowed_chars + '_&*+-/.=?@^{}~'; 
  allowed_chars = allowed_chars + "'`$#|!%"; 
  lenallowedchars = allowed_chars.length ;
  leninstring = In_String.length;
  for (i = 0;i<leninstring;i++)
   {
    validChar = false;
	for (j=0;j<lenallowedchars;j++)
     {
	  if (In_String.charAt(i) == allowed_chars.charAt(j))
       {
		validChar = true;
		if (In_String.charAt(i) == '@')
		 {
		  atCount = atCount + 1;
		  atPos = i + 1;
		 }
	   }
	 }
	if (!(validChar)){invalid = true;}
    }
  if (!(invalid))
   {
	if ((atPos == 1) || (atPos == leninstring)){invalid = true;}
	if (!(atCount == 1)){invalid = true;}
   }
  
  return invalid
 }
//====================================================================================

