// This script written by Abdul Hafeez and Khaleequu-ur-Rehman.
// AHK Soft have copyright of this script.
// URL: http://www.ahksoft.com
// JavaScript Document for Multiheathrowcars.

//Name validation =====================================================================
	function val_name(var_name)
	{
		if ( var_name.value.length<2 || var_name.value.length>40 )
		{
			alert("Please, enter correct name");
			var_name.focus();
			return false;
		}
		else
			return true;
	}
//Email validation =====================================================================
	function val_email(var_email)
	{
		if (
			var_email.value.length < 6 || 
			var_email.value.indexOf("@") == -1 || 
			var_email.value.indexOf(".") == -1  ||
			var_email.value.indexOf(" ") != -1 
			)
		{
			alert("Please, enter valid email address. ");
			var_email.focus();
			return false;    
		}
		else if (var_email.value.indexOf("@")<3)
		{
			alert("This email address seems wrong. Please,"
			+" check the prefix and '@' sign.");
			var_email.focus();
		}
		else
			return true;
	}
//Any Numbers validation =====================================================================
	function isNumberFloat(inputString)	{  return (!isNaN(parseInt(inputString))) ? false : true;	}
//Mobile validation =====================================================================
	function val_mob(var_mobile)
	{
		if (var_mobile.value.length < 8 ||  var_mobile.value.length > 18)
		{
			alert("Please, enter valid mobile mumber.");
			var_mobile.focus();
			return false;    
		}
		else if (isNumberFloat(var_mobile.value) )
		{	alert("You must be enter in numeric form only.");
			var_mobile.focus();
			return false;
		}
		else
		{	return true;}
	}

//Comments validation =====================================================================
	function val_comm(var_comm)
	{
		if ( var_comm.value.length > 5 && var_comm.value.length <= 150 )
		{
			return true;
		}
		else
		{
			alert("Please, type valid comments within 150 characters.");
			var_comm.focus();
			return false;
		}
	}

//Min to Max Character validation ==================================
	function val_minmaxchar(AHK_String, Min, Max, Field_Name)
	{
		if ( AHK_String.value.length<Min || AHK_String.value.length>Max )
		{
			alert("Invalid " + Field_Name);
			AHK_String.focus();
			return false;
		}
		else
			return true;
	}
//Only Max Character validation ==================================
	function val_maxchar(AHK_String, Max, Field_Name)
	{
		if ( AHK_String.value.length>Max )
		{
			alert("Invalid " + Field_Name);
			AHK_String.focus();
			return false;
		}
		else
			return true;
	}

//General Combo Box value test AHK_ComboVal validation ==================================
	function val_Gen_ComboBox(AHK_ComboVal, Field_Name, NoneValue)
	{
		if ( AHK_ComboVal.value == NoneValue )
		{
			alert("Invalid " + Field_Name);
			AHK_ComboVal.focus();
			return false;
		}
		else
			return true;
	}
