// JavaScript Document

function handleKeyPress(e,form,flag)
	{
		var key=e.keyCode || e.which;
		if (key==13)
			{
				if (flag==1)
				{
					subscribe();
				}
				if (flag==2)
				{
					login_validate();		
				}
				if (flag==3)
				{
					forget_email();		
				}
				
			}
	}
	
	
function subscribe(path)
{

	em=document.getElementById("email").value;
	if(em=="")
	{
		alert("Please enter your email");
		document.getElementById("email").focus();
		return(false);
	}		
	 if(document.getElementById("email").value.indexOf("@")<1)
	{
		alert("I'm sorry. This email address seems wrong. Please" +"check the prefix and '@' sign.");
		document.getElementById("email").focus();
				return(false);
	}
			window.open(path+"?emvalue="+em+" ", "Subscribe", "marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=400, height=280, top=200, right=200");
		document.getElementById("email").value = "";
				
	
}

/*
Add-to-favorites Script
Created by Saurabh Kawatra 
No warranty of any kind comes with this script!
Permission granted to Dynamic Drive (http://Ramitainfotech.com) 
to post and feature this script on their DHTML archive
*/

//configure the two variables below to match yoursite's own info
var bookmarkurl="http://www.indiarajendra.com"
var bookmarktitle="India Rajendra"

function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}



function tellfriend(path)
{

	em=document.getElementById("email_fr").value;
	if(em=="")
	{
		alert("Please enter your email");
		document.getElementById("email_fr").focus();
		return(false);
	}		
	 if(document.getElementById("email_fr").value.indexOf("@")<1)
	{
		alert("I'm sorry. This email address seems wrong. Please" +"check the prefix and '@' sign.");
		document.getElementById("email_fr").focus();
				return(false);
	}
	var url = window.location
			window.open(path+"?emvalue="+em+"&url="+url, "Subscribe", "marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=400, height=280, top=200, right=200");
		document.getElementById("email_fr").value = "";
				
	
}

function handleKeyPress(e,form,flag)
	{
		var key=e.keyCode || e.which;
		if (key==13)
			{
				if (flag == 1)
					subscribe();
				if (flag ==2)
					tellfriend();
				
				
			}
	}
	
	function book_now(path)
	{
		if(document.getElementById("name").value=="")
			{
				alert("Please Insert your name");
				document.getElementById("name").focus();
				return(false);
			}
			
			if(document.getElementById("country").value=="")
			{
				alert("Please Insert country");
				document.getElementById("country").focus();
				return(false);
			}
			if(document.getElementById("phone").value=="")
			{
				alert("Please Insert Phone No");
				document.getElementById("phone").focus();
				return(false);
			}		
			
			if(document.getElementById("email_book").value=="")
			{
				alert("Please Insert email address");
				document.getElementById("email_book").focus();
				return(false);
			}	
			
			if(document.getElementById("email_book").value.indexOf("@")<1)
			{
				alert("I'm sorry. This email address seems wrong. Please" +"check the prefix and '@' sign.");
				document.getElementById("email_book").focus();
				return(false);
			}			
				
			if(document.getElementById("month").value=="0")
			{
				alert("Please Select Month of Travel");
				document.getElementById("month").focus();
				return(false);
			}
			if(document.getElementById("year").value=="0")
			{
				alert("Please Select Year of Travel");
				document.getElementById("year").focus();
				return(false);
			}	
			if(document.getElementById("query").value=="")
			{
				alert("Please Insert Query");
				document.getElementById("query").focus();
				return(false);
			}
			if(document.getElementById("budget").value=="0")
			{
				alert("Please Select Budget");
				document.getElementById("budget").focus();
				return(false);
			}
			url = path;
			url = url + "?name=" + document.getElementById("name").value;	
			url = url + "&country=" + document.getElementById("country").value;
			url = url + "&phone=" + document.getElementById("phone").value;
			url = url + "&email=" + document.getElementById("email_book").value;
			url = url + "&month=" + document.getElementById("month").value;
			url = url + "&year=" + document.getElementById("year").value;
			url = url + "&rooms=" + document.getElementById("rooms").value;
			url = url + "&adult=" + document.getElementById("adult").value;
			url = url + "&child=" + document.getElementById("child").value;
			url = url + "&budget=" + document.getElementById("budget").value;
			url = url + "&duration=" + document.getElementById("duration").value;
			url = url + "&query=" + document.getElementById("query").value;
			url = url + "&path=" + window.location
			window.location = url
	}
	
	
	
	//script for distance calculater
	function handleHttpResponse() 
		{    
        	if (http.readyState == 4) 
		{ 
            	  if(http.status==200) 
		{ 
	                  var results=http.responseText; 
              		document.getElementById('display_city').innerHTML = results; 
              } 
              } 
        } 
		function getHTTPObject() 
	{ 
  		var xmlhttp; 

  		if(window.XMLHttpRequest)
		{ 
  		 xmlhttp = new XMLHttpRequest(); 
 		 } 
	  else 
	  if (window.ActiveXObject)
	  { 
	    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    	if (!xmlhttp){ 
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    	} 
    } 
  	return xmlhttp; 
} 
var http = getHTTPObject(); // We create the HTTP Object 
function distance_calc()
	{
	
							
				url = "distance_calc.asp";
				url=url+"?start="+document.getElementById("start").value;
				url=url+"&destination="+document.getElementById("destination").value;
				http.open("GET",url, true); 
        		http.onreadystatechange = handleHttpResponse; 
        		http.send(null); 
	}
	function distance(start1)
	{
	
							
				url = "distance_calc.asp";
				url=url+"?start="+start1;
				url=url+"&destination="+document.getElementById("start").value;
				http.open("GET",url, true); 
        		http.onreadystatechange = handleHttpResponse; 
        		http.send(null); 
	}
	
	
	//check validiy for hotel booking
	
	function checkbooking()
{
	
		var valid=false;
		if(frmhtl.name.value=="")
 		{
		  alert("Enter Your Name");
		  frmhtl.name.focus();
		 }
		else if(frmhtl.address.value =="")
		{
		 alert("Enter Your Address");
		 frmhtl.address.focus();
		}
		else if(frmhtl.phone.value =="")
		{
		 alert("Invalid Phone Value");
		 frmhtl.phone.focus();
		}
		else if (isNaN(frmhtl.phone.value))
		{
		 alert("Invalid Phone Value");
		 frmhtl.phone.focus();
		}
		else if(frmhtl.country.value =="")
		{
		 alert("Select Your Country");
		 frmhtl.country.focus();
		}
		else if(frmhtl.email.value=="")
		 {
		  alert("Enter Valid Email Address");
		  frmhtl.email.focus();
		 }
		else if(frmhtl.email.value.indexOf('@')<1)
		{
		 alert("Invalid Email Address");
		 frmhtl.email.focus();
		}
		else if(frmhtl.email.value.indexOf('.')<2)
		{
		 alert("Invalid Email Address");
		 frmhtl.email.focus();
		}
		
		else if(frmhtl.requirement.value=="")
		 {
		  alert("Enter Other Preferences & Services Required");
		  frmhtl.requirement.focus();
		 }
		else
		{
		 valid=true;
		}
		return valid;
}

//refres hotel booking
function refreshhtlfrm()
{
	frmhtl.name.value = "";
	frmhtl.address.value = "";
	frmhtl.phone.value = "";
	frmhtl.requirement.value = "";
	frmhtl.ar_date.value = "";
	frmhtl.dp_date.value = "";
	frmhtl.email.value = "";
	frmhtl.no_of_rooms.value = "";
	frmhtl.single.checked = false;
	frmhtl.double.checked = false;
	frmhtl.triple.checked = false;
	frmhtl.standard.checked = false;
	frmhtl.suite.checked = false;
	frmhtl.executive.checked = false;
}

//check data before registration
function checkTravelRegister()
{
	
 var valid=false;
 
 if(frm1.ag_name.value=="")
 {
  alert("Enter Agency Name");
  frm1.ag_name.focus();
 }
 else if(frm1.doe.value=="")
 {
  alert("Enter Date of EstablishMent");
  frm1.doe.focus();
 }
 else if(frm1.address.value=="")
 {
 alert("Enter Address");
  frm1.address.focus();
 }
 
 else if(frm1.city.value=="")
 {
 alert("Enter city");
  frm1.city.focus();
 }
 
 else if(frm1.state.value=="")
 {
 alert("Enter state");
  frm1.state.focus();
 }
 
 else if(frm1.email.value=="")
 {
  alert("Enter Valid Email Address");
  frm1.email.focus();
 }
else if(frm1.email.value.indexOf('@')<1)
{
 alert("Invalid Email Address");
 frm1.email.focus();
}
else if(frm1.email.value.indexOf('.')<2)
{
 alert("Invalid Email Address");
 frm1.email.focus();
}


else if (frm1.cphone.value=="" )
{
 alert("Invalid Country Code");
 frm1.cphone.focus();
}

else if (isNaN(frm1.cphone.value))
{
 alert("Invalid Country Code");
 frm1.cphone.focus();
}
else if (frm1.sphone.value=="" )
{
 alert("Invalid State Code");
 frm1.sphone.focus();
}

else if (isNaN(frm1.sphone.value))
{
 alert("Invalid State Code");
 frm1.sphone.focus();
}
else if (frm1.phone.value=="" )
{
 alert("Invalid Phone");
 frm1.phone.focus();
}
else if (isNaN(frm1.phone.value))
{
 alert("Invalid Phone");
 frm1.phone.focus();
}
else if (isNaN(frm1.cfax.value))
{
 alert("Invalid Country Fax Code");
 frm1.cfax.focus();
}
else if (isNaN(frm1.sfax.value))
{
 alert("Invalid State Fax Code");
 frm1.sfax.focus();
}
else if (isNaN(frm1.fax.value))
{
 alert("Invalid fax");
 frm1.fax.focus();
}
else if(frm1.rep_name.value=="")
 {
  alert("Enter Agency Name");
  frm1.rep_name.focus();
 }
 else if(frm1.address.value=="")
 {
 alert("Enter Address");
  frm1.address.focus();
 }
 else if(frm1.rep_email.value=="")
 {
  alert("Enter Valid Email Address");
  frm1.rep_email.focus();
 }
else if(frm1.rep_email.value.indexOf('@')<1)
{
 alert("Invalid Email Address");
 frm1.rep_email.focus();
}
else if(frm1.rep_email.value.indexOf('.')<2)
{
 alert("Invalid Email Address");
 frm1.rep_email.focus();
}


else if (frm1.rep_cphone.value=="" )
{
 alert("Invalid Country Code");
 frm1.rep_cphone.focus();
}

else if (isNaN(frm1.rep_cphone.value))
{
 alert("Invalid Country Code");
 frm1.rep_cphone.focus();
}
else if (frm1.sphone.value=="" )
{
 alert("Invalid State Code");
 frm1.rep_sphone.focus();
}

else if (isNaN(frm1.rep_sphone.value))
{
 alert("Invalid State Code");
 frm1.rep_sphone.focus();
}
else if (frm1.rep_phone.value=="" )
{
 alert("Invalid Phone");
 frm1.rep_phone.focus();
}
else if (isNaN(frm1.rep_phone.value))
{
 alert("Invalid Phone");
 frm1.rep_phone.focus();
}
else if (isNaN(frm1.rep_cfax.value))
{
 alert("Invalid Country Fax Code");
 frm1.rep_cfax.focus();
}
else if (isNaN(frm1.rep_sfax.value))
{
 alert("Invalid State Fax Code");
 frm1.rep_sfax.focus();
}
else if (isNaN(frm1.rep_fax.value))
{
 alert("Invalid fax");
 frm1.rep_fax.focus();
}
else 
 {
  valid=true;
 } 
 return valid;
}

function openFestivalWin()
{
 window.open('calendario-feste-e-fiere.html','Fetival_Window','width=1003,height=582');
}