var xmlHttp
var clientid="";
var tourid ="";
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}
function ajax_child_ages(no_of_children)
{
	
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url;
url="getchildren.php?no_of_children="+no_of_children;
xmlHttp.onreadystatechange=stateChangedchild;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 


function stateChangedchild() 
{ 
if(xmlHttp.readyState==3)
{ 
document.getElementById("children_ages").innerHTML="Loading...";
}

if(xmlHttp.readyState==4)
{ 
document.getElementById("children_ages").innerHTML=xmlHttp.responseText;
document.getElementById("children_ages1").innerHTML=xmlHttp.responseText;

}
}

/*     Load contact Us form form by ajax Neelam Gahlyan 1 Aug                  */



	function load_contact()
{
	
xmlHttpsave=GetXmlHttpObject();
if (xmlHttpsave==null)
  {
  alert ("Your browser does not support AJAX!, Please call us or send email at sales@tourindia.travel");
  return;
  } 

var url="load_contact.php";
		xmlHttpsave.onreadystatechange = function() {
				if (xmlHttpsave.readyState == 4) {
					// only if "OK"
					if (xmlHttpsave.status == 200) {
							
						document.getElementById('contact_us').innerHTML=xmlHttpsave.responseText;						
						
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + xmlHttpsave.statusText);
					}
				}	
				
				else {
					
				}
			}
xmlHttpsave.open("GET",url,true);
xmlHttpsave.send(null);
}

function load_guests_request()
{
	
xmlHttpsave=GetXmlHttpObject();
if (xmlHttpsave==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url="guests_contact_form.php";
		xmlHttpsave.onreadystatechange = function() {
				if (xmlHttpsave.readyState == 4) {
					// only if "OK"
					if (xmlHttpsave.status == 200) {
							
						document.getElementById('contact_us').innerHTML=xmlHttpsave.responseText;						
						
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + xmlHttpsave.statusText);
					}
				}	
				
				else {
					
				}
			}
xmlHttpsave.open("GET",url,true);
xmlHttpsave.send(null);
}





/*                          End contact us form load                              */

function iti_details(iti_des_id)
{

xmlHttp_object = GetXmlHttpObject();
xmlHttp_object_url = "get_iti_description.php?iti_des_id="+iti_des_id;
xmlHttp_object.onreadystatechange=stateChanged_object;
xmlHttp_object.open("GET",xmlHttp_object_url,true);
xmlHttp_object.send(null);

}
 


function stateChanged_object()
{

if(xmlHttp_object.readyState==1)
	{
	dd = document.getElementById("div_city_description");


	  
dd.style.display ="";

	}

if(xmlHttp_object.readyState==4)
	{
	document.getElementById("div_city_description").innerHTML = xmlHttp_object.responseText;


	}

}





   function HideContentitidiv(d) {


document.getElementById(d).style.display="none";

/*
Effect.SlideUp(d,{queue:{scope:'myscope', position:'end', limit: 1}});
*/

      }

 





function show_acc_div(acc_div_id)
{
for(i=1; i<=4 ; i++)
	{
	if(acc_div_id==i)
		{
		document.getElementById('div_iti_'+i).style.display = "";
		document.getElementById('td'+i).className="selectedtab";
		}
		else
		{

		document.getElementById('div_iti_'+i).style.display = "none";
		
		document.getElementById('td'+i).className="nonselectedtab";	
		
		}
	}
}



function show_form_div(form_div_id)
{
for(i=1; i<=2 ; i++)
	{
	if(form_div_id==i)
		{
		document.getElementById('div_form'+i).style.display = "";
		
		}
		else
		{

		document.getElementById('div_form'+i).style.display = "none";

		/*
		
		document.getElementById('td_form'+i).className="nonselectedthistour";

		document.getElementById('td_form'+i).rowSpan="1";


		*/
		
		}
	}
}


		var cX = 0; var cY = 0; var rX = 0; var rY = 0;

      function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}

      function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}

      if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }

      else { document.onmousemove = UpdateCursorPosition; }





      function AssignPosition(d) {
      if(self.pageYOffset) {

      rX = self.pageXOffset;

      rY = self.pageYOffset;

      }

      else if(document.documentElement && document.documentElement.scrollTop) {

      rX = document.documentElement.scrollLeft;

      rY = document.documentElement.scrollTop;

      }

      else if(document.body) {

      rX = document.body.scrollLeft;

      rY = document.body.scrollTop;

      }

      if(document.all) {

      cX += rX;

      cY += rY;

      }

      d.style.left = (cX-535) + "px";
      d.style.top = (cY-155) + "px";

      }

	   
	   function ShowContent(d,tour_id,selected_day) {

	selected_day = parseInt(selected_day)+1;
	
		d = "uniquename3"
		 var dd = document.getElementById(d);

         AssignPosition(dd);
		
	
		xmlHttp_show_schedule_day=GetXmlHttpObject(); 

		var url_city_list="show_day.php?tour_id="+tour_id+"&selected_day="+selected_day;
		
		xmlHttp_show_schedule_day.onreadystatechange=stateChanged_show_day;
		xmlHttp_show_schedule_day.open("GET",url_city_list,true);
		xmlHttp_show_schedule_day.send(null);

    
      }
	  

function stateChanged_show_day()
{
if (xmlHttp_show_schedule_day.readyState==1)
	{
	document.getElementById("uniquename3").innerHTML = "<div align='center'  ><img src='images/ajax-loader.gif' >"+
"</div>";
     document.getElementById("uniquename3").style.display = "";

	}

if (xmlHttp_show_schedule_day.readyState==4)
		{ 
	
		document.getElementById("uniquename3").innerHTML=xmlHttp_show_schedule_day.responseText;
		}


}


/***************************************************************************************************/

	   function ShowContent2(d,tour_id,selected_day,itinerary_id) {

	selected_day = parseInt(selected_day)+1;
	
		d = "uniquename3"
		 var dd = document.getElementById(d);

         AssignPosition(dd);
		
	
		xmlHttp_show_schedule_day=GetXmlHttpObject(); 

		var url_city_list="show_day2.php?tour_id="+tour_id+"&selected_day="+selected_day+"&itinerary_id="+itinerary_id;
		
		xmlHttp_show_schedule_day.onreadystatechange=stateChanged_show_day2;
		xmlHttp_show_schedule_day.open("GET",url_city_list,true);
		xmlHttp_show_schedule_day.send(null);

    
      }
	  

function stateChanged_show_day2()
{

if (xmlHttp_show_schedule_day.readyState==1)
		{ 
	document.getElementById("uniquename3").innerHTML = "<div align='center' ><img src='images/ajax-loader.gif' >"+
"</div>";
	document.getElementById("uniquename3").style.display = "";
		
		}

if (xmlHttp_show_schedule_day.readyState==4)
		{ 

		document.getElementById("uniquename3").innerHTML=xmlHttp_show_schedule_day.responseText;
		}


}

/******************************************************************************/

	     function HideContent(d) {

      if(d.length < 1) { return; }

      document.getElementById(d).style.display = "none";

      }

     



 function show_all_content(city_id) {

	
		d = "uniquename3"
		 var dd = document.getElementById(d);

         AssignPosition(dd);
		
	
		xmlHttp_show_schedule_day=GetXmlHttpObject(); 

		var url_city_list="show_all_day.php?city_id="+city_id;
		
		xmlHttp_show_schedule_day.onreadystatechange=stateChanged_show_all_day;
		xmlHttp_show_schedule_day.open("GET",url_city_list,true);
		xmlHttp_show_schedule_day.send(null);

    
      }
	  

function stateChanged_show_all_day()
{

if (xmlHttp_show_schedule_day.readyState==1)
		{ 
document.getElementById("uniquename3").innerHTML="<div align='center' ><img src='images/ajax-loader.gif' >"+
"</div>";

      document.getElementById("uniquename3").style.display = "";
		}

if (xmlHttp_show_schedule_day.readyState==4)
		{ 

		document.getElementById("uniquename3").innerHTML=xmlHttp_show_schedule_day.responseText;
		}

}


function show_any_content(d)
{

AssignPosition_change_date(document.getElementById(d));

document.getElementById(d).style.display = "";

}


 function AssignPosition_change_date(d) {

      if(self.pageYOffset) {

      rX = self.pageXOffset;

      rY = self.pageYOffset;

      }

      else if(document.documentElement && document.documentElement.scrollTop) {

      rX = document.documentElement.scrollLeft;

      rY = document.documentElement.scrollTop;

      }

      else if(document.body) {

      rX = document.body.scrollLeft;

      rY = document.body.scrollTop;

      }

      if(document.all) {

      cX += rX;

      cY += rY;

      }

      d.style.left = (cX-415) + "px";

      d.style.top = (cY-233) + "px";

      }




function show_reserve_link()
{
if(document.reserve_form.Electronic_Contract_Acceptance.checked==true)
	{
	

document.getElementById("div_form1").style.display="none";

document.getElementById("increase_height").height ="175";

document.getElementById("div_reserve").style.display="";
	}

	else
	{

alert("Please check the given check box to accept the terms and conditions");

	}

}




/*
function chk_inquiry()
{

if(string_value2(document.inquiry_form.inquiry_name,2,55,'Name','Y') == false) { return false }
if(email(document.inquiry_form.inquiry_email,5,55,'Email','Y') == false) { return false }
if(phone_fax(document.inquiry_form.inquiry_phone,3,25,'Phone number','Y')==false){ return false }

if(document.inquiry_form.source_of_info.value=="0")
{
alert("Please tell us from where did you first hear of us?");
document.inquiry_form.source_of_info.focus();
return false;
}



if(number(document.inquiry_form.number_of_guests,1,1,1,25,'Number of Guests',"Y")==false ){
return false;

}
document.inquiry_form.submit();

}*/

function reserve_tour()
{

	document.form_reserve.submit();

}


 function AssignPosition_small_calendar(d) {

      if(self.pageYOffset) {

      rX = self.pageXOffset;

      rY = self.pageYOffset;

      }

      else if(document.documentElement && document.documentElement.scrollTop) {

      rX = document.documentElement.scrollLeft;

      rY = document.documentElement.scrollTop;

      }

      else if(document.body) {

      rX = document.body.scrollLeft;

      rY = document.body.scrollTop;

      }

      if(document.all) {

      cX += rX;

      cY += rY;

      }

      d.style.left = (cX+205) + "px";

      d.style.top = (cY-1) + "px";
//drawDatePicker(d,cX+105,cY-5 );
    }


 function AssignPosition_build_old(d) {

	if(self.pageYOffset) {

      rX = self.pageXOffset;

      rY = self.pageYOffset;

      }

      else if(document.documentElement && document.documentElement.scrollTop) {

      rX = document.documentElement.scrollLeft;

      rY = document.documentElement.scrollTop;

      }

      else if(document.body) {

      rX = document.body.scrollLeft;

      rY = document.body.scrollTop;

      }

      if(document.all) {

      cX += rX;

      cY += rY;

      }

      d.style.left = (cX-255) + "px";

      d.style.top = (cY+5) + "px";


    }


function show_small_calendar(div_id)
{
	AssignPosition_small_calendar(document.getElementById(div_id));
	document.getElementById(div_id).style.display="";
}


function chk_cal_validation(dt)
{
	
	
if(document.submit_tour.tour_id.value=="")
	{
	alert("Please select a tour");
	return false;
	}

	var date_now_chk = new Array(3);

	date_now_chk = dt.split("-", 3);

	var num_date_now = parseInt(date_now_chk[0]+date_now_chk[1]+date_now_chk[2]);

	
	var date_sel_chk = new Array(3);

	date_sel_chk = (document.submit_tour.dep_date.value).split("-", 3);

	var num_date_sel = parseInt(date_sel_chk[0]+date_sel_chk[1]+date_sel_chk[2]);

	
	if(num_date_now >= num_date_sel)
	{
	alert("Please select a valid date");
	return false;
	}




	if(document.submit_tour.dep_date.value=="")
	{
	alert("Please select tour date");
	return false;
	}


}








function show_cat_description(cat_id,client_id)
{
	xmlHttp_show_cat_des=GetXmlHttpObject(); 
	AssignPosition_build_new(document.getElementById("cat_des_div"));
		var url_cat_des="show_cat_des.php?categories_id="+cat_id+"&client_id="+client_id;
		xmlHttp_show_cat_des.onreadystatechange=stateChanged_cat_des;
		xmlHttp_show_cat_des.open("GET",url_cat_des,true);
		xmlHttp_show_cat_des.send(null);
	 
}



function stateChanged_cat_des()
{
if (xmlHttp_show_cat_des.readyState==1)
{
	
		document.getElementById("cat_des_div").style.display ="";
		document.getElementById("cat_des_div").innerHTML='<div class="borderline_day_des_div" ><img src="images/ajax-loader.gif" align="middle"   /></div>';
		
}


if (xmlHttp_show_cat_des.readyState==4)
		{ 
		document.getElementById("cat_des_div").innerHTML=xmlHttp_show_cat_des.responseText;

		}


}


function show_cat_description2(cat_id,client_id)
{
	xmlHttp_show_cat_des=GetXmlHttpObject(); 
	AssignPosition_build_old(document.getElementById("cat_des_div"));

		var url_cat_des="show_cat_des2.php?categories_id="+cat_id+"&client_id="+client_id;
		xmlHttp_show_cat_des.onreadystatechange=stateChanged_cat_des2;
		xmlHttp_show_cat_des.open("GET",url_cat_des,true);
		xmlHttp_show_cat_des.send(null);
	 
}



function stateChanged_cat_des2()
{
if (xmlHttp_show_cat_des.readyState==1)
{	

//AssignPosition_build_old(document.getElementById("cat_des_div"));
document.getElementById("cat_des_div").style.display ="";
document.getElementById("cat_des_div").innerHTML='<img src="images/ajax-loader.gif" align="middle"   />';

}

if (xmlHttp_show_cat_des.readyState==4)
		{ 

		document.getElementById("cat_des_div").innerHTML=xmlHttp_show_cat_des.responseText;


		}


}







function ShowActivities( iti_id, dep_date  )
{
		AssignPosition(document.getElementById('add_day'));
		xmlHttp_show_act=GetXmlHttpObject(); 
		var url_act_des="show_activities_des.php?&iti_id="+iti_id+"&dep_date="+dep_date;
		xmlHttp_show_act.onreadystatechange=stateChanged_activites_des;
		xmlHttp_show_act.open("GET",url_act_des,true);
		xmlHttp_show_act.send(null);
}




function stateChanged_activites_des()
{

if (xmlHttp_show_act.readyState==4)
		{ 
	
		document.getElementById("add_day").innerHTML=xmlHttp_show_act.responseText;

		document.getElementById("add_day").style.display ="";

		}


}


div_to_chng="";
function update_schedule(iti_id,div_to_change)
{
	div_to_chng = div_to_change;
city_tour = "";
vehicle = "";
guide ="";

if(document.change_schedule_form.city_tour.checked==true)
	{

city_tour = document.change_schedule_form.city_tour.value;

	}


if(document.change_schedule_form.vehicle.checked==true)
	{

vehicle = document.change_schedule_form.vehicle.value;

	}

if(document.change_schedule_form.guide.checked==true)
	{

guide = document.change_schedule_form.guide.value;

	}


day = document.change_schedule_form.day.value;

city = document.change_schedule_form.city.value;

		xmlHttp_sch_upd=GetXmlHttpObject(); 

		var url_sch_upd="change_schedule.php?&iti_id="+iti_id+"&day="+
			day+"&city_tour="+city_tour+"&vehicle="+vehicle+"&guide="+guide+"&city="+city;


		xmlHttp_sch_upd.onreadystatechange=stateChanged_schedule_upd;

		xmlHttp_sch_upd.open("GET",url_sch_upd,true);

		xmlHttp_sch_upd.send(null);


}


function stateChanged_schedule_upd()
{

if (xmlHttp_sch_upd.readyState==4)
		{ 

window.location.href = window.location.href;
		}


}




function delete_day(iti_id, dep_date )
{
		AssignPosition(document.getElementById('del_day'));
		xmlHttp_delete_day=GetXmlHttpObject(); 
		var url_delete_day="delete_day.php?iti_id="+iti_id+"&dep_date="+dep_date;
		xmlHttp_delete_day.onreadystatechange=stateChanged_delete_day;
		xmlHttp_delete_day.open("GET",url_delete_day,true);
		xmlHttp_delete_day.send(null);

}


function stateChanged_delete_day()
{
if (xmlHttp_delete_day.readyState==4)
		{ 

		document.getElementById("del_day").innerHTML=xmlHttp_delete_day.responseText;

		document.getElementById("del_day").style.display ="";

		}


}




function delete_day_schedule(iti_id)
{
		day = document.delete_form.day.value;
		xmlHttp_delete_upd=GetXmlHttpObject(); 
		var xmlHttp_delete_url="delete_day_upd.php?iti_id="+iti_id+"&day="+day;
		xmlHttp_delete_upd.onreadystatechange=stateChanged_delete_upd;
		xmlHttp_delete_upd.open("GET",xmlHttp_delete_url,true);
		xmlHttp_delete_upd.send(null);


}


function stateChanged_delete_upd()
{

if (xmlHttp_delete_upd.readyState==4)
		{ 
	window.location.href = window.location.href;
		}

}



function save_tourid(tour_id,client_id)
{
	clientid = client_id;
xmlHttpsave_tour=GetXmlHttpObject();
if (xmlHttpsave_tour==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

if(document.getElementById("plus_img"+tour_id).title !="Selected")
	{
var urlsave_tour="select_location.php?tour_id="+tour_id+"&client_id="+client_id;
xmlHttpsave_tour.onreadystatechange=stateChangedsave_tour;
xmlHttpsave_tour.open("GET",urlsave_tour,true);
xmlHttpsave_tour.send(null);
document.getElementById("plus_img"+tour_id).src ="images/click.gif";
document.getElementById("plus_img"+tour_id).style.cursor ="default";
document.getElementById("plus_img"+tour_id).title ="Selected";
	}
	else
	{
	delete_selected_tour(tour_id,client_id);
	
	}




}


function stateChangedsave_tour() 
{ 
if(xmlHttpsave_tour.readyState==4|| xmlHttpsave_tour.readyState=='complete')
{
	
document.getElementById("selection_div").innerHTML = xmlHttpsave_tour.responseText;
document.getElementById("header_div").style.display="none";
document.getElementById("cat_des_div").style.display = "none";
draw_on_map2(clientid);
}
}

function delete_selected_tour(selected_tour,client_id)
{
clientid = client_id;
tourid=selected_tour;
confirm_str="";

if(selected_tour=="all")
	{

	confirm_str ="Are you sure you want to delete all the selected options";

	

	}
	else
	{
		confirm_str = "Are you sure you want to delete ! ";
	   

	}


var confirm_del = confirm(confirm_str);

if(confirm_del==false)
	{
	return false;
	}
	else
	{

xmlHttpdelete_tour=GetXmlHttpObject();
if (xmlHttpdelete_tour==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var urldelete_tour="select_location.php?selected_tour="+selected_tour+"&client_id="+client_id;
xmlHttpdelete_tour.onreadystatechange=stateChangedelete_tour;
xmlHttpdelete_tour.open("GET",urldelete_tour,true);
xmlHttpdelete_tour.send(null);
if(selected_tour=="all")
		{
		for(i=0; i<1555; i++)
			{
			if(document.getElementById("plus_img"+i)!=null)
				{
		document.getElementById("plus_img"+i).src ="images/plus.gif";
		document.getElementById("plus_img"+i).style.cursor ="pointer";
		document.getElementById("plus_img"+i).title ="Click to add";
				}	
			}
		}

		else
		{
		document.getElementById("plus_img"+selected_tour).src ="images/plus.gif";
		document.getElementById("plus_img"+selected_tour).style.cursor ="pointer";
		document.getElementById("plus_img"+selected_tour).title ="Click to add";
		}
//setTimeout("draw_on_map("+client_id+");",555);

	}
}

function stateChangedelete_tour() 
{ 

if(xmlHttpdelete_tour.readyState==4)
{
document.getElementById("selection_div").innerHTML = xmlHttpdelete_tour.responseText;

if((tourid!="all")&&(document.getElementById("cat_des_div").style.display==""))
	{
document.getElementById("cat_des_div").style.display=="none";
}
}
draw_on_map2(clientid);


}









function save_tourid2(tour_id,client_id)
{
	
xmlHttpsave_tour=GetXmlHttpObject();
if (xmlHttpsave_tour==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var urlsave_tour="select_location_old.php?tour_id="+tour_id+"&client_id="+client_id;
xmlHttpsave_tour.onreadystatechange=stateChangedsave_tour2;
xmlHttpsave_tour.open("GET",urlsave_tour,true);
xmlHttpsave_tour.send(null);
}


function stateChangedsave_tour2() 
{ 
if(xmlHttpsave_tour.readyState==4|| xmlHttpsave_tour.readyState=='complete')
{
document.getElementById("selection_div").innerHTML = xmlHttpsave_tour.responseText;
}
}

function delete_selected_tour2(selected_tour,client_id)
{
	var confirm_delete = confirm("Are you sure to delete");
	
	if(confirm_delete==false)
	{
		return false;
	}
	else
	{
	
	
xmlHttpdelete_tour=GetXmlHttpObject();
if (xmlHttpdelete_tour==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 


document.getElementById("tourselection_" + selected_tour).checked=false;

var urldelete_tour="select_location_old.php?selected_tour="+selected_tour+"&client_id="+client_id;
xmlHttpdelete_tour.onreadystatechange=stateChangedelete_tour2;
xmlHttpdelete_tour.open("GET",urldelete_tour,true);
xmlHttpdelete_tour.send(null);
	}
}

function stateChangedelete_tour2() 
{ 
if(xmlHttpdelete_tour.readyState==4)
{
document.getElementById("selection_div").innerHTML = xmlHttpdelete_tour.responseText;
}
}





function sendenquiryform(client_id)
{
	alert("kjh");
alert(client_id);
xmlenquiryform=GetXmlHttpObject();
if (xmlenquiryform==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var urlenquiry_form="enquiry_form.php?client_id="+client_id;
xmlenquiryform.onreadystatechange=stateChangedenquiry_form;
alert(urlenquiry_form);
xmlenquiryform.open("GET",urlenquiry_form,true);
xmlenquiryform.send(null);





}



function stateChangedenquiry_form()
{

if(xmlenquiryform.readyState==1)
	{
document.getElementById("enquiry_div").style.display = "";
document.getElementById("enquiry_div").innerHTML = "<img src='images/ajax-loader.gif' >";

	}

if(xmlenquiryform.readyState==4)
{
document.getElementById("enquiry_div").innerHTML = xmlenquiryform.responseText;
}
}


function chk_inquiry2()
{


document.inquiry_form.submit();


}



function draw_on_map(client_id)
{
	document.getElementById('map_iframe').src=document.getElementById('map_iframe').src;

document.frames['map_iframe'].location.reload(true);
}


function stateChanged_draw_on_map()
{
if(x_draw.readyState==4)
	{
/*document.getElementById('test_div').innerHTML = x_draw.responseText;*/

document.getElementById('map_iframe').src=document.getElementById('map_iframe').src;

document.frames['map_iframe'].location.reload(true);

}

}



function draw_on_map2(client_id)
{
x_draw2 = GetXmlHttpObject();
x_draw_url2 = "map_blink_div.php?client_id="+client_id;
x_draw2.onreadystatechange=stateChanged_draw_on_map2;
x_draw2.open("GET",x_draw_url2,true);
x_draw2.send(null);

}


function stateChanged_draw_on_map2()
{
if(x_draw2.readyState==4)
	{
		window.map_iframe.document.getElementById("map_highlights").innerHTML= x_draw2.responseText;
		


}

}





function check_booking()
{
	
if(document.booking_form.name.value=="")
	{
	alert("Please enter your name");
	return false;
	}


if(document.booking_form.email.value=="")
	{
	alert("Please enter your email address");
	return false;
	}




}



function get_iti_menu(category_id)
{
	
x_menu = GetXmlHttpObject();
x_menu_url = "get_menu.php?category_id="+category_id;
x_menu.onreadystatechange=stateChanged_menu;
x_menu.open("GET",x_menu_url,true);
x_menu.send(null);
}


function stateChanged_menu()
{
if(x_menu.readyState==4)
	{
	
document.getElementById('itinerary_list').innerHTML = x_menu.responseText;


}



}

function AssignPosition_build_new(d) {

	if(self.pageYOffset) {

      rX = self.pageXOffset;

      rY = self.pageYOffset;

      }

      else if(document.documentElement && document.documentElement.scrollTop) {

      rX = document.documentElement.scrollLeft;

      rY = document.documentElement.scrollTop;

      }

      else if(document.body) {

      rX = document.body.scrollLeft;

      rY = document.body.scrollTop;

      }

      if(document.all) {

      cX += rX;

      cY += rY;

      }

   //   d.style.left = (cX-255) + "px";

      d.style.top = (cY+5) + "px";


    }
	
	
	
	
	//============= Random Comments==================================
	
	
	function ranComments() {		
		//alert(productID);
		var strURL="get_random_comment.php";
		var req = GetXmlHttpObject();
		alert(strURL);
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
						document.getElementById('random_comments').innerHTML=req.responseText;						
						
						
						
					} else {
						//alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
					
				}
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
		
		//setTimeout('ranComments()', 1000);
	}

	function comments()
{
	
xmlHttpsave_tour=GetXmlHttpObject();
if (xmlHttpsave_tour==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url="get_random_comments.php";
		xmlHttpsave_tour.onreadystatechange = function() {
				if (xmlHttpsave_tour.readyState == 4) {
					// only if "OK"
					if (xmlHttpsave_tour.status == 200) {
							
						document.getElementById('random_comments').innerHTML=xmlHttpsave_tour.responseText;						
						
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + xmlHttpsave_tour.statusText);
					}
				}	
				
				else {
					
				}
			}
xmlHttpsave_tour.open("GET",url,true);
xmlHttpsave_tour.send(null);
//setInterval('comments()', 1000)
}


//====================================== Disble Right Click----Copy ================================
function disableCtrlModifer(evt)
{
var disabled = {a:0, u:0, c:0, x:0, v:0};
var ctrlMod = (window.event)? window.event.ctrlKey : evt.ctrlKey;
var key = (window.event)? window.event.keyCode : evt.which;
key = String.fromCharCode(key).toLowerCase();
return (ctrlMod && (key in disabled))? false : true;
}






function notAllowed (nKeyCode)
 {
     if ( (78 == nKeyCode) && (event.ctrlKey) ) {
         alert ("Sorry, not allowed!");
     }
 }







             
function disableCtrlModifer(evt)
{
var disabled = {a:0, u:0, c:0, x:0, v:0};
var ctrlMod = (window.event)? window.event.ctrlKey : evt.ctrlKey;
var key = (window.event)? window.event.keyCode : evt.which;
key = String.fromCharCode(key).toLowerCase();
return (ctrlMod && (key in disabled))? false : true;
}



function getKeyCode(a)
{
 if (window.event)
    return window.event.keyCode;
 else if (a)
    return a.which;
 else
    return null;
}








function keyRestrict(e, validchars) {
 var key='', keychar='';
 key = getKeyCode(e);
 if (key == null) return true;
 keychar = String.fromCharCode(key);
 keychar = keychar.toLowerCase();
 validchars = validchars.toLowerCase();
 if (validchars.indexOf(keychar) != -1)
  return true;
 if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
  return true;
 return false;
}




//Disable right click script

var message="";
///////////////////////////////////
function clickIE() {
if (document.all) {
(message);
return false;
}}

function clickNS(e) {

if(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}

}
if (document.layers){
	
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS;

}else{
document.onmouseup=clickNS;document.oncontextmenu=clickIE;

}

}

document.oncontextmenu=new Function("return false");


			
function disableCtrlModifer(evt)
{
	
var disabled = {a:0, c:0, x:0, v:0};
var ctrlMod = (window.event)? window.event.ctrlKey : evt.ctrlKey;
var key = (window.event)? window.event.keyCode : evt.which;
key = String.fromCharCode(key).toLowerCase();
return (ctrlMod && (key in disabled))? false : true;
	
}


//================== Contact Form JS ==========================================


function chk_inquiry(){
	if(string_value2(document.inquiry_form.inquiry_name,2,55,'Name','Y') == false) { return false }
	if(email(document.inquiry_form.inquiry_email,5,55,'Email','Y') ==false) { return false }
	if(phone_fax(document.inquiry_form.inquiry_phone,3,25,'Phone number','Y')==false){ return false }
	
	
	if(document.inquiry_form.tour_package_id.value=="0"){
		alert("Please select a tour");
		document.inquiry_form.tour_package_id.focus();
		return false;
	}
	
	if(document.inquiry_form.comp_source_of_info.value=="0"){
		alert("Please tell us from from where did you first hear of us?");
		document.inquiry_form.comp_source_of_info.focus();
		return false;
	}
	if(phone_fax(document.inquiry_form.duration,0,25,'Tour Duration','Y')==false){ return false }
	
	if(document.inquiry_form.duration.value=="0"){
		alert("Duration cannot be NULL");
		document.inquiry_form.duration.focus();
		return false;
	}
	
	if(document.inquiry_form.day.value==""){
		alert("Please fill arrival day ");
		document.inquiry_form.day.focus();
		return false;
	}
	if(document.inquiry_form.month.value==""){
		alert("Please fill arrival month");
		document.inquiry_form.month.focus();
		return false;
	}
	
	if(document.inquiry_form.year.value==""){
		alert("Please fill arrival year");
		document.inquiry_form.year.focus();
		return false;
	}
	var currentTime = new Date()
	var filled_day		= document.inquiry_form.day.value;
	var filled_month	= document.inquiry_form.month.value;
	var filled_year		= document.inquiry_form.year.value;

	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate() + 1;
	var year = currentTime.getFullYear();
	
	if(Date.parse(year + "/" + month + "/" + day)>Date.parse(filled_year + "/" + filled_month + "/" + filled_day)){
		alert("Invalid date of arrival date");
		document.inquiry_form.day.focus;
		return false;
	} 
	

}
function chk_build_inquiry(){
	if(string_value2(document.inquiry_form.inquiry_name,2,55,'Name','Y') == false) { return false }
	if(email(document.inquiry_form.inquiry_email,5,55,'Email','Y') ==false) { return false }
	if(phone_fax(document.inquiry_form.inquiry_phone,3,25,'Phone number','Y')==false){ return false }
	
	
	
	
	if(document.inquiry_form.month.value==""){
		alert("Please fill arrival month");
		document.inquiry_form.month.focus();
		return false;
	}
	
	
	if(document.inquiry_form.date.value==""){
		alert("Please fill arrival day ");
		document.inquiry_form.date.focus();
		return false;
	}
	
	if(document.inquiry_form.year.value==""){
		alert("Please fill arrival year");
		document.inquiry_form.year.focus();
		return false;
	}
	var currentTime = new Date()
	var filled_day		= document.inquiry_form.date.value;
	var filled_month	= document.inquiry_form.month.value;
	var filled_year		= document.inquiry_form.year.value;

	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate() + 1;
	var year = currentTime.getFullYear();
	
	if(Date.parse(year + "/" + month + "/" + day)>Date.parse(filled_year + "/" + filled_month + "/" + filled_day)){
		alert("Invalid date of arrival date");
		document.inquiry_form.date.focus;
		return false;
	} 
	
if(document.inquiry_form.source_of_info.value=="0"){
		alert("Please tell us from from where did you first hear of us?");
		document.inquiry_form.source_of_info.focus();
		return false;
	}
	if(phone_fax(document.inquiry_form.duration,0,25,'Tour Duration','Y')==false){ return false }
	
	if(document.inquiry_form.duration.value=="0"){
		alert("Duration cannot be NULL");
		document.inquiry_form.duration.focus();
		return false;
	}
}
//===========================  ====================================

function chk_inquiry()
{
if(string_value2(document.inquiry_form.inquiry_name,3,55,'Name','Y') == false) { return false }
if(email(document.inquiry_form.inquiry_email,5,55,'Email','Y') ==false) { return false }
if(phone_fax(document.inquiry_form.inquiry_phone,6,25,'Phone number','Y')==false){ return false }


if(document.inquiry_form.tour_package_id.value=="0")
{
alert("Please select a tour");
document.inquiry_form.tour_package_id.focus();
return false;
}

if(document.inquiry_form.comp_source_of_info.value=="0")
{
alert("Please tell us from from where did you first hear of us?");
document.inquiry_form.comp_source_of_info.focus();
return false;
}
if(phone_fax(document.inquiry_form.duration,1,25,'Tour Duration','Y')==false){ return false }
if(document.inquiry_form.day.value=="")
{
alert("Please select a day of arrival");
document.inquiry_form.day.focus();
return false;
}
if(document.inquiry_form.month.value=="")
{
alert("Please select a month of arrival");
document.inquiry_form.month.focus();
return false;
}
if(document.inquiry_form.year.value=="")
{
alert("Please select year of arrival");
document.inquiry_form.year.focus();
return false;
}




}




/*----------------------Product details--------------------*/

function cellImg(id) {
			  
			   
}  


	function highlight_links2(acc_div_id)
{
 
for(i=1; i<=5 ; i++)
	{
	if(acc_div_id=='tab_div_'+i)
		{
		
		document.getElementById(acc_div_id).className="on2";
		if(document.getElementById("pro_div_tab_div_"+i)!=null)
		{
		document.getElementById("pro_div_tab_div_"+i).style.display="";
		}
		
}
		else
		{
		
			document.getElementById('tab_div_'+i).className="off";	
		if(document.getElementById("pro_div_tab_div_"+i)!=null)
		{
		document.getElementById("pro_div_tab_div_"+i).style.display="none";
		}
		}
		
		
	}
	
}

	function highlight_links3(acc_div_id)
{
 
for(i=1; i<=7 ; i++)
	{
	if(acc_div_id=='tab_div_'+i)
		{
		//alert("got");
			if(document.getElementById('tab_div_'+i).className!="on2")
			{
			document.getElementById('tab_div_'+i).className="on";
			}
		}
		else
		{
//alert('tab_div_'+i);
			if(document.getElementById('tab_div_'+i).className!="on2")
			{
			document.getElementById('tab_div_'+i).className="off";	
			}
		}
	}
	
}


	function highlight_links4(acc_div_id)
{
 
for(i=1; i<=7 ; i++)
	{
	if(acc_div_id=='tab_div_'+i)
		{
		
		if(document.getElementById('tab_div_'+i).className!="on2")
		{
		document.getElementById('tab_div_'+i).className="off";	
		}
		}
		else
		{

		if(document.getElementById('tab_div_'+i).className!="on2")
		{
		document.getElementById('tab_div_'+i).className="off";	
		}
		}
	}
	
}



function toggleDiv(divid){
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
	  document.getElementById(divid+"img").src = "images/closed_tab.gif";
    }else{
      document.getElementById(divid).style.display = 'none';
	  document.getElementById(divid+"img").src = "images/open_tab.gif";
    }
  }
  
  
  
  function openDiv(divid){
      document.getElementById(divid).style.display = 'block';
	 
  }
  
  function highlightLinks(divname_show) {
   
if(divname_show=="photo")
{
	document.getElementById('photo').style.display="";
	document.getElementById('b_itinerary').style.display="none";
	document.getElementById('hotel').style.display="none";
	document.getElementById('inclusion').style.display="none";
	document.getElementById('terms_and_conditions').style.display="none";
	}
	
	
	if(divname_show=="b_itinerary")
{
	document.getElementById('b_itinerary').style.display="block";
	document.getElementById('photo').style.display="none";
	document.getElementById('hotel').style.display="none";
	document.getElementById('inclusion').style.display="none";
	document.getElementById('terms_and_conditions').style.display="none";
	}
	
	
	if(divname_show=="hotel")
	{
document.getElementById('photo').style.display="none";
	document.getElementById('b_itinerary').style.display="none";
	document.getElementById('hotel').style.display="";
	document.getElementById('inclusion').style.display="none";
	document.getElementById('terms_and_conditions').style.display="none";
	}
	if(divname_show=="inclusion")
	{
	document.getElementById('photo').style.display="none";
	document.getElementById('b_itinerary').style.display="none";
	document.getElementById('hotel').style.display="none";
	document.getElementById('inclusion').style.display="";
	document.getElementById('terms_and_conditions').style.display="none";
	}
	if(divname_show=="terms_and_conditions")
	{
	document.getElementById('photo').style.display="none";
	document.getElementById('b_itinerary').style.display="none";
	document.getElementById('hotel').style.display="none";
	document.getElementById('inclusion').style.display="none";
	document.getElementById('terms_and_conditions').style.display="";

	}
	

   
}

function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				req = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
function products_image(productID) {		
		//alert(productID);
		var strURL="get_product_image.php?pID="+productID;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					
							document.getElementById('product_image').scrollLeft	= 0;
								document.getElementById('product_image').scrollTop	= 0;
						document.getElementById('product_image').innerHTML=req.responseText;						
						
						
						
					 
				}	else {
				}
				
				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		}	// JavaScript Document
		
//=========================== Products caption===========================


function products_image_caption(productID) {		
		//alert(productID);
		var strURL="get_product_image_caption.php?pID="+productID;
		var req = getXMLHTTP();
		//alert(strURL);
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
						document.getElementById('caption').innerHTML=req.responseText;						
					 
				}	else {
						
				}
				
				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		}	// JavaScript Document
		
		function GetHandle(sImgID){
				if(document.all){
					elmImgID	= document.all(sImgID);
				} 
				if(document.getElementById){
					elmImgID	= document.getElementById(sImgID);
				}		
				return elmImgID;
			} 
			function clear_fade(imgID){
			//alert(imgID);
			GetHandle(imgID).className = '';
			}
			function fade(imgID){
			//alert(imgID);
			GetHandle(imgID).className = 'fade';
			}
			
			
			
			
			//===================================
			
			function chk_inquiry()
{
if(string_value2(document.inquiry_form.inquiry_name,2,55,'Name','Y') == false) { return false }
if(email(document.inquiry_form.inquiry_email,5,55,'Email','Y') ==false) { return false }
if(phone_fax(document.inquiry_form.inquiry_phone,3,25,'Phone number','Y')==false){ return false }


if(document.inquiry_form.tour_package_id.value=="0")
{
alert("Please select a tour");
document.inquiry_form.tour_package_id.focus();
return false;
}

if(document.inquiry_form.comp_source_of_info.value=="0")
{
alert("Please tell us from from where did you first hear of us?");
document.inquiry_form.comp_source_of_info.focus();
return false;
}
//if(phone_fax(document.inquiry_form.duration,1,25,'Tour Duration','Y')==false){ return false }


if(document.inquiry_form.day.value=="")
{
	alert("Please fill arrival day ");
	document.inquiry_form.day.focus();
	return false;
}
if(document.inquiry_form.month.value=="")
{
	alert("Please fill arrival month");
	document.inquiry_form.month.focus();
	return false;
}
if(document.inquiry_form.year.value=="")
{
	alert("Please fill arrival year");
	document.inquiry_form.year.focus();
	return false;
}


arrivalDay = document.inquiry_form.day.value;
if(arrivalDay<10){
arrivalDay = 0+arrivalDay;	
}
arrivalMonth = document.inquiry_form.month.value;
if(arrivalMonth<10){
arrivalMonth = 0+arrivalMonth;	
}
arrivalYear = document.inquiry_form.year.value;

var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear();
	
		if(Date.parse(year + "/" + month + "/" + day)>Date.parse(arrivalYear + "/" + arrivalMonth + "/" + arrivalDay)){
			alert("Invalid arrival date.");
			return false;
		}
	


}

/*=============Custom Tour=====================*/
function check_booking()
{

if(document.booking_form.name.value=="")
	{
	alert("Please enter your name");
	document.booking_form.name.focus();
	return false;
	}


if(document.booking_form.email.value=="")
	{
	alert("Please enter your email address");
	document.booking_form.email.focus();
	return false;
	}
if(document.booking_form.phone.value=="")
	{
	alert("Please enter your phone no");
	document.booking_form.phone.focus();
	return false;
	}
if(document.booking_form.arrival_date.value=="")
	{
	alert("Please enter your arrival date");
	document.booking_form.arrival_date.focus();
	return false;
	}
if(document.booking_form.duration.value=="")
	{
	alert("Please enter your duration");
	document.booking_form.duration.focus();
	return false;
	}
if(document.booking_form.source.value=="")
	{
	alert("Please enter your source");
	document.booking_form.source.focus();
	return false;
	}

if(document.booking_form.information.value=="")
	{
	alert("Please enter your enquiry");
	document.booking_form.information.focus();
	return false;
	}


return true;
}


function chkitout(){

}

