var xmlHttp
var clientid="";
var vacationid ="";
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 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 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_vacationiti_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 reserveForm()
{


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

if(document.form_reserve.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.duration,1,2,1,35,'Duration',"Y")==false )
	{

return false;

	}
*/

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

return false;

	}
document.form_reserve.submit();

}


function chk_inquiry()
{

if(document.inquiry_form.lodginglevel.value=="") {
		alert('Please select Lodging.');
		//window.location.href="#";
		return false;
		
	}

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.inquiry_phone.value=='') {
	alert('Please enter phone number');
	document.inquiry_form.inquiry_phone.focus();
	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(document.inquiry_form.number_of_guests.value=='')
{
alert("Please eneter no. of guests.");
document.inquiry_form.number_of_guests.focus();
return false;
}

/*if(number(document.inquiry_form.duration,1,2,1,35,'Duration',"Y")==false )
	{

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();


}

//=======================Brochure form validation========================
function brochure()
{

if(document.brochureform.b_typ.selectedIndex=="0")
{
alert("Please Select Brochure Type.");
document.brochureform.b_typ.focus();
return false;
}


if(string_value2(document.brochureform.name,2,55,'Name','Y') == false) { return false }
if(email(document.brochureform.email,5,55,'Email','Y') == false) { return false }
if(phone_fax(document.brochureform.phone,3,25,'Phone number','Y')==false){ return false }

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




document.brochureform.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.vacation_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="vacation_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="vacation_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,url)
{
	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_vacation_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;
			var redirect_url = window.location.href;
			//================Replace Url in #====================
			redirect_url	= redirect_url.replace("#div_inquiry", " ");
			redirect_url	= redirect_url.replace("#Itinerary_detailed", " ");
			redirect_url	= redirect_url.replace("#top", " ");
			redirect_url	= redirect_url.replace("#vacation_iti_lodging", " ");
			window.location=redirect_url;
				
		}


}



function delete_day(iti_id, dep_date )
{
		AssignPosition(document.getElementById('del_day'));
		xmlHttp_delete_day=GetXmlHttpObject(); 
		var url_delete_day="delete_vacation_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_vacation_iti.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;
	
			var url = window.location.href;
			//================Replace Url in #====================
			var replaceurl=url.replace("#div_inquiry"," ");
			window.location.href=replaceurl;
		}

}





function save_vacationid(vacation_id,client_id,days)
{
	//alert(tour_id+"--"+client_id);
	clientid = client_id;
	vacationid = vacation_id;
	
	day = days;
	//alert(days);
xmlHttpsave_vacation=GetXmlHttpObject();

if (xmlHttpsave_vacation==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  //========== if selected destination tab is not selected======================
  //================== then only go for =========
if(document.getElementById("plus_img"+vacation_id)){

if(document.getElementById("plus_img"+vacation_id).title !="Selected")
	{
var urlsave_tour="vacation_duration.php?vacation_id="+vacationid+"&client_id="+clientid;

	
			xmlHttpsave_vacation.onreadystatechange = function() {
				if (xmlHttpsave_vacation.readyState == 4) {
					// only if "OK"
					if (xmlHttpsave_vacation.status == 200) {
							//alert('hi');
							if(xmlHttpsave_vacation.readyState==4|| xmlHttpsave_vacation.readyState=='complete'){
	
								document.getElementById("selection_div").innerHTML = xmlHttpsave_vacation.responseText;
								document.getElementById("header_div").style.display="none";
								document.getElementById("cat_des_div").style.display = "none";
								draw_on_map2(clientid);
									save_build_day(vacationid,clientid, day);
									//show_connected(vacation_id, client_id, flag);
									
							}
				
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('p_div2').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}	


xmlHttpsave_vacation.open("GET",urlsave_tour,true);
xmlHttpsave_vacation.send(null);
	document.getElementById("plus_img"+vacation_id).src ="images/click.gif";
	document.getElementById("plus_img"+vacation_id).style.cursor ="default";
	document.getElementById("plus_img"+vacation_id).title ="Selected";


	
	}
	else
	{
	delete_selected_vacations(vacation_id,client_id);
	
	
	}

} 
else {
var urlsave_tour="vacation_duration.php?vacation_id="+vacationid+"&client_id="+clientid;
xmlHttpsave_vacation.onreadystatechange=stateChangedsave_vacation;
xmlHttpsave_vacation.open("GET",urlsave_tour,true);
xmlHttpsave_vacation.send(null);
}

/*if (xmlHttpsave_vacation==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
	if(document.getElementById("plus_img"+vacationid)){
		if(document.getElementById("plus_img"+vacationid).title !="Selected")
			{
				var urlsave_tour="vacation_duration.php?vacation_id="+vacationid+"&client_id="+clientid;
				xmlHttpsave_vacation.onreadystatechange=stateChangedsave_vacation;
				xmlHttpsave_vacation.open("GET",urlsave_tour,true);
				xmlHttpsave_vacation.send(null);
				
				document.getElementById("plus_img"+vacationid).src ="images/click.gif";
				document.getElementById("plus_img"+vacationid).style.cursor ="default";
				document.getElementById("plus_img"+vacationid).title ="Selected";
				
			
			}
			else
			{
			delete_selected_vacations(vacation_id,client_id);
				
			
			}
	}else{
		var urlsave_tour="vacation_duration.php?vacation_id="+vacationid+"&client_id="+clientid;
		xmlHttpsave_vacation.onreadystatechange=stateChangedsave_vacation;
		xmlHttpsave_vacation.open("GET",urlsave_tour,true);
		xmlHttpsave_vacation.send(null);
		
	}*/
}


function stateChangedsave_vacation()
{ 
if(xmlHttpsave_vacation.readyState==4|| xmlHttpsave_vacation.readyState=='complete')
{

document.getElementById("selection_div").innerHTML = xmlHttpsave_vacation.responseText;
document.getElementById("header_div").style.display="none";
document.getElementById("cat_des_div").style.display = "none";

draw_on_map2(clientid);

save_build_day(vacationid,clientid, day);
}
}

function saveRecommendDays(vacation_id,client_id)
{
clientid = client_id;
var days= document.getElementById("recommend_day"+vacation_id).value;
xmlHttpsaveRecommendDays=GetXmlHttpObject();
if (xmlHttpsaveRecommendDays==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var urlsave="save_recommend_day.php?vacation_id="+vacation_id+"&client_id="+client_id+"&days="+days;
xmlHttpsaveRecommendDays.onreadystatechange=stateChangedxmlHttpsaveRecommendDays;
xmlHttpsaveRecommendDays.open("GET",urlsave,true);
xmlHttpsaveRecommendDays.send(null);

}


function stateChangedxmlHttpsaveRecommendDays() 
{ 
if(xmlHttpsaveRecommendDays.readyState==4|| xmlHttpsaveRecommendDays.readyState=='complete')
{
	document.getElementById("selection_div").innerHTML = xmlHttpsaveRecommendDays.responseText;
	document.getElementById("header_div").style.display="none";
	document.getElementById("cat_des_div").style.display = "none";

}
}


function delete_selected_vacations(selected_vacation,client_id){
clientid = client_id;
vacationid=selected_vacation;
confirm_str="";

if(selected_vacation=="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="save_recommend_day.php?selected_vacation="+selected_vacation+"&client_id="+client_id+"&action=delete";
xmlHttpdelete_tour.onreadystatechange = stateChangedelete_tour;

xmlHttpdelete_tour.open("GET",urldelete_tour,true);
xmlHttpdelete_tour.send(null);
//show_selected_lodging(client_id);
document.getElementById("cat_des_div").style.display = "none";

if(selected_vacation=="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_vacation).src ="images/plus.gif";
			document.getElementById("plus_img"+selected_vacation).style.cursor ="pointer";
			document.getElementById("plus_img"+selected_vacation).title ="Click to add";
		}
//setTimeout("draw_on_map("+client_id+");",555);

	}
//xmlHttpdelete_tour.onreadystatechange=function(){
//	
//	//if(xmlHttpdelete_tour.readyState==4){
////		document.getElementById("cat_des_div").style.display='none';
////		document.getElementById("selection_div").innerHTML = xmlHttpdelete_tour.responseText;
////		//if(selected_vacation=="all"){
//////			
//////			//document.location.href='build_your_vacation.php?pre_set=1';
//////		
//////		}
////		
////		
////	}
//draw_on_map2(clientid);	
////if(xmlHttpdelete_tour.responseText){
////	
////show_selected_lodging(xmlHttpdelete_tour.responseText);	
////}
//}

//xmlHttpdelete_tour.open("GET",urldelete_tour,true);
//xmlHttpdelete_tour.send(null);	

}

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";
}

if(xmlHttpdelete_tour.responseText){
	
show_selected_lodging(xmlHttpdelete_tour.responseText);	
}

}
draw_on_map2(clientid);
document.getElementById('select_build_own_desc').style.display='';
}






function delete_selected_vacation(selected_vacation,client_id)
{
clientid = client_id;
vacationid=selected_vacation;
confirm_str="";

if(selected_vacation=="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="delete_vacation_location.php?selected_vacation="+selected_vacation+"&client_id="+client_id;
xmlHttpdelete_tour.onreadystatechange=stateChangedelete_tour;
xmlHttpdelete_tour.open("GET",urldelete_tour,true);
xmlHttpdelete_tour.send(null);


if(selected_vacation=="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_vacation).src ="images/plus.gif";
		document.getElementById("plus_img"+selected_vacation).style.cursor ="pointer";
		document.getElementById("plus_img"+selected_vacation).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((vacationid!="all")&&(document.getElementById("cat_des_div").style.display==""))
	{
document.getElementById("cat_des_div").style.display=="none";
}
if(xmlHttpdelete_tour.responseText){
	
show_selected_lodging(xmlHttpdelete_tour.responseText);	
}
}
draw_on_map2(clientid);


}









function save_vacationid2(vacation_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?vacation_id="+vacation_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_vacation2(selected_vacation,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_vacation).checked=false;

var urldelete_tour="select_location_old.php?selected_vacation="+selected_vacation+"&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;
}
}



/*===============Hide div preview Section====================*/
function HidePreview(preview_div_1) {


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

}
/*===============Check date is select or not====================*/

function date_check()
{
	alert('Before Insert or Delete day you need to choose arrival date.');
	return false;
	
}
/*function date_checks()
{
	alert('Before Insert or Delete day you need a choose arrival date.');
	document.getElementById('lodging_per_finish').style.focus();
	return false;
}*/

/*===============Select duration ====================*/
function chk_duration() {
		if(document.search2.duration.selectedIndex==''){
				alert('Please Select duration');
				return false;
			}
	}



function sendenquiryform(client_id)
{

	xmlenquiryform=GetXmlHttpObject();
	if (xmlenquiryform==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	
	var urlenquiry_form="vacation_enquiry_form.php?client_id="+client_id;
	xmlenquiryform.onreadystatechange=stateChangedenquiry_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()
{
/*
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 from where did you first hear of us?");
document.inquiry_form.source_of_info.focus();
return false;
}

/*
if(number(document.inquiry_form.duration,1,2,1,35,'Duration',"Y")==false )
	{

return false;

	}

if(number(document.inquiry_form.number_of_guests,1,2,1,35,'Number of Guests',"Y")==false )
	{

return false;

	}
*/



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);
/*
x_draw = GetXmlHttpObject();
x_draw_url = "map.php?client_id="+client_id;
x_draw.onreadystatechange=stateChanged_draw_on_map;
x_draw.open("GET",x_draw_url,true);
x_draw.send(null);
*/
}


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 = "map2_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)
	{
		//alert(x_draw2.responseText);
		//alert(window.map_iframe.document.getElementById("map_highlights").innerHTML);
		
		window.map_iframe.document.getElementById("map_highlights").innerHTML= x_draw2.responseText;
		
		//alert(window.map_iframe.document.getElementById("map_highlights").innerHTML);
	//	window.frames['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";


    }


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;
    }

/************************* This function is used to fetch Enquiry Form ***************************/
function show_inquiry_form(filename) {	
		var strURL=filename+".php";
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
	document.getElementById('inquiry_form_div').innerHTML=req.responseText;						
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('inquiry_form_div').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
/***********************************************************************/

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					
	}


/************************* Submit download with ajax ***************************/
function submitDownload(vacation_id, dep_date, iti_id) {	
name 	= document.form_pda_download.pda_name.value;
emailID = document.form_pda_download.pda_email_address.value;

if(name==''){
	alert("Name required");
	return false;
}
if ((emailID==null)||(emailID=="")){
		alert("Please Enter your Email ID")
		return false;
	}
	if (echeck(emailID)==false){
		return false;
	}

var strURL="vacation_pda_link.php?tour_id="+vacation_id+"&dep_date="+dep_date+"&iti_id="+iti_id+"&pda_name="+name+"&pda_email_address="+emailID;
//alert(strURL);
document.getElementById('downloadForm').style.display='none';
document.getElementById('downloadResult').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:35px;' >";

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

function header_image(id) {	
		var strURL="build_header_image.php?id="+id;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('header_image_div').style.display='';			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
	
	                document.getElementById('header_image_div').innerHTML= req.responseText;								
					
					}
					else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('header_image_div').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";	
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}

function header_image_caption(id) {	
		var strURL="build_header_image_caption.php?id="+id;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('header_image_caption').style.display='';			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
	
	                document.getElementById('header_image_caption').innerHTML= req.responseText;									
					
					}
					else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('header_image_caption').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	
//==========================================Training information=======================

function header_caption(id) {	
		var strURL="trainig_content.php?id="+id;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('header_caption').style.display='';			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
			
			//alert(req.responseText);
	                document.getElementById('header_caption').innerHTML= req.responseText;									
					
					}
					else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('header_caption').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
//==========================================Demo video information=======================	

function demo_info(id) {	
		var strURL="demo_info.php?id="+id;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('demo_info').style.display='';			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
			
			//alert(req.responseText);
	                document.getElementById('demo_info').innerHTML= req.responseText;									
					
					}
					else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('demo_info').innerHTML="<img align='center' src='images/loading2.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}

//==========================================Demo text information=======================	

function demo_text_info(id) {	
		var strURL="demo_text.php?id="+id;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('demo_text').style.display='';			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
			
			//alert(req.responseText);
	                document.getElementById('demo_text').innerHTML= req.responseText;									
					
					}
					else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('demo_text').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
//==========================================Member text information=======================	

function member_info(id) {	
		var strURL="member_info_text.php?id="+id;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('member_info_text').style.display='';			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
			
			//alert(req.responseText);
	                document.getElementById('member_info_text').innerHTML= req.responseText;									
					
					}
					else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('member_info_text').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	//==========================================Member video information=======================	

function member_video_info(id) {	
		var strURL="member_info_video.php?id="+id;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('member_info_video').style.display='';			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
			
			//alert(req.responseText);
	                document.getElementById('member_info_video').innerHTML= req.responseText;									
					
					}
					else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('member_info_video').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	//==========================================Member video information=======================	

function holidaydetails(id) {	
		var strURL="holidaydetails.php?id="+id;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('div_holiday').style.display='';			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
			
			//alert(req.responseText);
	                document.getElementById('div_holiday').innerHTML= req.responseText;									
					
					}
					else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('div_holiday').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
