/*******script for kerala made by Er. pradeep Singh*****/

/********enquiry form********/


function checkenquiry_form()
{	
	docf=document.getElementById("frm");
	if(docf.name.value=="")
	{
		alert("Enter your Name");
		docf.name.focus();
		return false;
	}
	
	if(docf.address.value=="")
	{
		alert("Enter your Address");
		docf.address.focus();
		return false;
	}
	
if(docf.phone.value=="")
	{
		alert("Enter your phone");
		docf.phone.focus();
		return false;
	}

	
	if(docf.email.value=="")
	{
		alert("Enter your Email Id");
		docf.email.focus();
		return false;
	}	

if(docf.city.value=="")
	{
		alert("Pleace enter the city");
		docf.city.focus();
		return false;
	}

if(docf.country.value=="NA")
	{
		alert("Pleace Select Your Country");
		docf.country.focus();
		return false;
	}


	if(docf.date.value=="")
	{
		alert("Pleace enter the date");
		docf.date.focus();
		return false;
	}
	if(docf.hotelCategory.value=="0")
	{
		alert("Select Hotel Category");
		docf.hotelCategory.focus();
		return false;
	}

	if(docf.norooms.value=="")
	{
		alert("Enter the Number of Rooms");
		docf.norooms.focus();
		return false;
	}

	if(docf.typeofroom.value=="0")
	{
		alert("Select Type of Rooms");
		docf.typeofroom.focus();
		return false;
	}
	if(docf.code_field.value=="")
	{
		alert("Enter the code");
		docf.code_field.focus();
		return false;	
	}
	return validate_form(docf);	
}


function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
  		{
  			alert(alerttxt);
  			return false;
  		}
		else 
		{
			return true;
		}
	}
	
}


function validate_form(thisform)
{
	with (thisform)
	{
		if (validate_email(email,"Not a valid e-mail address!")==false)
  		{
  			email.focus();
  			return false;
  		}
	}
	
}


//////////////////THIS FUNCTION CHECK ANY GIVEN PHONE NO.
function isValidPhone(phone){
var numstr="1234567890+-, ";
var intctr,intLen;
    intLen=phone.length;
        for(intCtr=0;intCtr <= intLen && numstr.indexOf(phone.charAt(intCtr))>=0 ;intCtr++);
        if(intCtr > intLen)
              return true;
        else
              return false;
      
}
///////////////////////////////////////////////////////////////////

/*********booking function******************/

function checkenquiry_form1()
{	
	docf=document.frm;
	if(docf.name.value=="")
	{
		alert("Enter your Name");
		docf.name.focus();
		return false;
	}
	
	if(docf.address.value=="")
	{
		alert("Enter your Address");
		docf.address.focus();
		return false;
	}

if(docf.city.value=="")
	{
		alert("Pleace enter the city");
		docf.city.focus();
		return false;
	}	
	if(docf.country.value=="NA")
	{
		alert("Pleace Select Your Country");
		docf.country.focus();
		return false;
	}	


	if(docf.email.value=="")
	{
		alert("Enter your Email Id");
		docf.email.focus();
		return false;
	}

	if(docf.phone.value=="")
	{
		alert("Enter your Contact No.");
		docf.phone.focus();
		return false;
	}
	if(docf.date.value=="")
	{
		alert("Enter your date of tour");
		docf.date.focus();
		return false;
	}
	
	if(docf.code_field.value=="")
	{
		alert("Please Enter the Code");
		docf.code_field.focus();
		return false;
	}	

	
	return validate_form(docf);
	
}




function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
  		{
  			alert(alerttxt);
  			return false;
  		}
		else 
		{
			return true;
		}
	}
	
}


function validate_form(thisform)
{
	with (thisform)
	{
		if (validate_email(email,"Not a valid e-mail address!")==false)
  		{
  			email.focus();
  			return false;
  		}
	}
	
}


///////////////////////////////////////////////////////