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 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;
if(document.getElementById("children_ages1")){
	document.getElementById("children_ages1").innerHTML=xmlHttp.responseText;
}
}
}



function iti_details(iti_des_id, itinerary, depDate, Level, iti_id)
{
document.getElementById("div_city_description").style.display='';
/*xmlHttp_object = GetXmlHttpObject();
if(itinerary=='yes'){
	xmlHttp_object_url = "get_iti_description.php?iti_des_id="+iti_des_id+"&itinerary=yes&dep_date="+depDate+"&level="+Level+"&iti_id="+iti_id;
} else {
	xmlHttp_object_url = "get_iti_description.php?iti_des_id="+iti_des_id+"&dep_date="+depDate+"&level="+Level+"&iti_id="+iti_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) {

if(document.getElementById(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('td'+i).className="selectedtab";
		document.getElementById('div_iti_'+i).style.display = "";
		}
		else
		{
	document.getElementById('td'+i).className="nonselectedtab";	
	document.getElementById('div_iti_'+i).style.display = "none";
		
		
	
		
		}
	}
}

function show_div(ID){
	
	document.getElementById(ID).style.display = "block";
	
}

function show_form_div(form_div_id, tag)
{
	document.getElementById('reserve').style.display = "none";
	document.getElementById('question').style.display = "none";

for(i=1; i<=2 ; i++)
	{
	if(form_div_id==i)
		{
		document.getElementById('div_form'+i).style.display = "";
		document.getElementById(tag).style.display = "";
		
		}
		else
		{

		document.getElementById('div_form'+i).style.display = "none";
		document.getElementById(tag).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, startDate) {

	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+"&startDate="+startDate;
		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, startDate) {

	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+"&startDate="+startDate;
		//alert(url_city_list);
		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; }
if(document.getElementById(d)){
	document.getElementById(d).style.display = "none";
}

      }

     
function build_level_content(level) {	
		var strURL="buildLevelResult.php?level="+level;
		var req = getXMLHTTP();
		if (req) {
			//level_desc = "level_desc";
	
				
			document.getElementById('level_desc').style.display='';
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
	
	document.getElementById('level_desc_inner').innerHTML=req.responseText;						
					AssignPosition_build_new(level_desc);
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('level_desc_inner').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}



 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 reserveForm()
{
if(document.form_reserve.no_of_rooms.selectedIndex=='') {  alert('Please Select Room.');document.form_reserve.no_of_rooms.focus();   return false; }
no_of_room = document.form_reserve.no_of_rooms.value;
blank	= 0;
		
		for(i=1;i<=no_of_room;i++){
			val	= document.getElementById('occp['+i+']').value;
			if(val==' '){
				blank++;
				blank_id 	= document.getElementById('occp['+i+']');
			} 
		}
	if(blank>0){
		alert("Please  provide complete occupancy information.");
		blank_id.focus();
		 return false;
	}
//if(document.form_reserve.occp.selectedIndex=='') {  alert('Please Select Occupancy.');document.form_reserve.occp.focus();   return false; }
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.inquiry_phone.value=='') {
	alert('Please enter Phone number');
	document.form_reserve.inquiry_phone.focus();
	return false;
	}
if(document.form_reserve.accpt.checked==false) {  alert('Please check to accept the terms & conditions.');document.form_reserve.accpt.focus();   return false; }
if(document.form_reserve.source_of_info.value=="0")
{
alert("Please tell us from where did you first hear of us?");
document.form_reserve.source_of_info.focus();
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(number(document.inquiry_form.number_of_guests,1,2,1,25,'Number of Travelers',"Y")==false )
	{

return false;

	}



document.inquiry_form.submit();


}



//============== check validation on build ur own ==========

function chk_inquiry_build()
{
if(document.inquiry_form.tour_level.value=="")
{
alert("Please select Lodging from Step 2");
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;
}
//var start_date = document.form_change_calender.arrival_date.value;
	var year_form = document.inquiry_form.year.value;
	var month_form = document.inquiry_form.month.value;
	var day_form = document.inquiry_form.date.value;
	
	start_date	= year_form+'-'+month_form+'-'+day_form;
	var currentTime = new Date()
	var month = currentTime.getMonth() + 1
	var day = currentTime.getDate()
	var year = currentTime.getFullYear();
	date1	= start_date.replace(/-/, "/");
	date2	= date1.replace(/-/, "/");

	//alert(year + "/" + month + "/" + day)
	
	splitStart 	= start_date.split("-");
	splitYear	= splitStart[0];
	splitMonth	= splitStart[1];
	splitDay	= splitStart[2];
	
	//==================== If Year or month or day is blank=====================================================
	if((splitYear=='')||(splitMonth=='')||(splitDay=='')){
		alert('Invalid date.');
		return false;
	}
	
	//==================== If Year<>4 (1970)or month<>2 or day<>2 is blank=================================
	//if ((splitYear.length<4)||(splitMonth.length<2)||(splitDay.length<2)||(splitYear.length>4)||(splitMonth.length>2)||(splitDay.length>2)) {
       // alert('Invalid date.');
		//return false;
	//}
	
	//==================== If Year or month or day is not a number==============================================
	if ((isNaN(parseInt(splitYear)))|| (isNaN(parseInt(splitMonth)))||(isNaN(parseInt(splitDay)))) {
        alert('Invalid date.');
		return false;
		}
	
	
	//========================= If date is blank ===============================================================
	if(start_date==''){
		alert("Arrival date is required.");
		document.form_change_calender.arrival_date.focus();
		return false;
		
	}
	
	//========================= If date is older than current ==================================================
		if(Date.parse(year + "/" + month + "/" + day)>Date.parse(date2))
		{
		alert("Arrival date is old.");
			
			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,25,'Number of Travelers',"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, tour_level)
{
		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+"&tour_level="+tour_level;
		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)
{
	day = document.change_schedule_form.day.value;

city = document.change_schedule_form.city.value;
if(city=='0'){
	alert("Select City ");
	document.change_schedule_form.city.focus();
	return false;
}
HideContent('add_day');
	div_to_chng = div_to_change;
	city_tour 	= "";
	vehicle 	= "";
	guide 		= "";
	tour_level = document.change_schedule_form.tour_level.value;

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;
}



		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+"&tour_level="+tour_level;

		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)
		{
	var redirect_url	= window.location.href;
	redirect_url	= redirect_url.replace("#Question", " ");
	redirect_url	= redirect_url.replace("#Itinerary_detailed", " ");
	redirect_url	= redirect_url.replace("#pageTop", " ");
	redirect_url	= redirect_url.replace("#custom_inclusion", " ");
	//alert(redirect_url);
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_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)
		{
				var redirect_url	= window.location.href;
	redirect_url	= redirect_url.replace("#Question", " ");
	redirect_url	= redirect_url.replace("#Itinerary_detailed", " ");
	redirect_url	= redirect_url.replace("#pageTop", " ");
	redirect_url	= redirect_url.replace("#custom_inclusion", " ");
	//alert(redirect_url);
window.location = redirect_url;
		}

}



function save_tourid(tour_id,client_id,days, flag)
{
	
	clientid = client_id;
	tourid = tour_id;
	
	day = days;
xmlHttpsave_tour=GetXmlHttpObject();
if (xmlHttpsave_tour==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"+tour_id)){

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 = function() {
				if (xmlHttpsave_tour.readyState == 4) {
					// only if "OK"
					if (xmlHttpsave_tour.status == 200) {
							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);
									save_build_day(tourid,clientid, day);
										show_connected(tour_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_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);
	
	
	}

} else {
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);
}


/*setTimeout("draw_on_map("+client_id+");",555);*/
}


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);
	save_build_day(tourid,clientid, day);
}
}

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);
//show_selected_lodging(client_id);
document.getElementById("cat_des_div").style.display = "none";
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 {
			if(document.getElementById("plus_img"+selected_tour)){
				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";
			}
		}


	}
}

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 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)
{

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;
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 Travelers',"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 = "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)
	{
		//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 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					
	}

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 (echeck(document.booking_form.email.value)==false){
		
	}

document.booking_form.submit();
}
/************************* Submit download with ajax ***************************/
function submitDownload() {	
name 	= document.form_pda_download.pda_name.value;

tour_id 	= document.form_pda_download.sel_tour.value;

dep_date 	= document.form_pda_download.sel_tour_date.value;

level 	= document.form_pda_download.sel_tour_level.value;

emailID = document.form_pda_download.pda_email_address.value;

iti_id	= document.form_pda_download.sel_iti_id.value;

if(name==''){
	alert("Name required");
	document.form_pda_download.pda_name.focus();
	return false;
}
if ((emailID==null)||(emailID=="")){
		alert("Please Enter your Email ID")
		document.form_pda_download.pda_email_address.focus();
		return false;
	}
	if (echeck(emailID)==false){
		document.form_pda_download.pda_email_address.focus();
		return false;
	}
document.form_pda_download.reset();
var strURL="send_pda_link.php?tour_id="+tour_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').style.display='';
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;
						//alert(req.responseText);
					   //	window.location='../traveler/index.php?email='+emailID;		
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
/***********************************************************************/

//=============================== validate Date function ==============================================
function valid_arrival_date(){
			
	//var start_date = document.form_change_calender.arrival_date.value;
	var year_form = document.form_change_calender.year.value;
	var month_form = document.form_change_calender.month.value;
	var day_form = document.form_change_calender.day.value;
	
	start_date	= year_form+'-'+month_form+'-'+day_form;
	var currentTime = new Date()
	var month = currentTime.getMonth() + 1
	var day = currentTime.getDate()
	var year = currentTime.getFullYear();
	date1	= start_date.replace(/-/, "/");
	date2	= date1.replace(/-/, "/");

	//alert(year + "/" + month + "/" + day)
	
	splitStart 	= start_date.split("-");
	splitYear	= splitStart[0];
	splitMonth	= splitStart[1];
	splitDay	= splitStart[2];
	
	//==================== If Year or month or day is blank=====================================================
	if((splitYear=='')||(splitMonth=='')||(splitDay=='')){
		alert('Invalid date.');
		return false;
	}
	
	//==================== If Year<>4 (1970)or month<>2 or day<>2 is blank=================================
	//if ((splitYear.length<4)||(splitMonth.length<2)||(splitDay.length<2)||(splitYear.length>4)||(splitMonth.length>2)||(splitDay.length>2)) {
       // alert('Invalid date.');
		//return false;
	//}
	
	//==================== If Year or month or day is not a number==============================================
	if ((isNaN(parseInt(splitYear)))|| (isNaN(parseInt(splitMonth)))||(isNaN(parseInt(splitDay)))) {
        alert('Invalid date.');
		return false;
		}
	
	
	//========================= If date is blank ===============================================================
	if(start_date==''){
		alert("Arrival date is required.");
		document.form_change_calender.arrival_date.focus();
		return false;
		
	}
	
	//========================= If date is older than current ==================================================
		if(Date.parse(year + "/" + month + "/" + day)>Date.parse(date2))
		{
		alert("Arrival date is old.");
			
			return false;
		}
		return true;
}




/************************* This function is used to fetch Lodging in build your own ***************************/
function show_lodging(ID, sesID) {	
		var strURL="lodging_ajax.php?ID="+ID+"&sesID="+sesID;
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
	document.getElementById('getLodging').innerHTML=req.responseText;						
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('getLodging').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	
	/************************* This function is used to fetch Lodging in build your own ***************************/
function show_lodging_ajax(ID, sesID, BG, Total, dep_date ) {	

var strURL="lodging_per_ajax.php?ID="+ID+"&sesID="+sesID+"&BG="+BG+"&Total="+Total+"&dep_date="+dep_date;

		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
	document.getElementById('getLodgingPer').innerHTML=req.responseText;						
						//=========== first time click on the destinations show first tab with selected bg ===================
	//============ BG is the id of first bg ===============================================================
	//============= Total are the no of total tabs for looping so ======================================
		if(BG!=''){
				for(i=1; i<=Total; i++){
					divID	= 'desc_'+i;
					
					if(BG==i){
						document.getElementById('per_'+i).style.fontWeight="bold";
						document.getElementById('per_'+i).style.textDecoration="none";
						document.getElementById('perimg_'+i).style.display="";
					}else{
						if(document.getElementById('per_'+i)){
						document.getElementById('per_'+i).style.fontWeight="normal";
						document.getElementById('per_'+i).style.textDecoration="underline";
						document.getElementById('perimg_'+i).style.display="none";
						}
					}
			}
	
			
			}
			
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('getLodgingPer').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	/************************* This function is used to fetch Lodging in build your own ***************************/
function show_lodging_per(sesID, ID, Total, dep_date) {	
		var strURL="lodging_per_include.php?sesID="+sesID+"&ID="+ID+"&Total="+Total+"&dep_date="+dep_date;
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
				document.getElementById('p_div2').innerHTML=req.responseText;						
						show_lodging_ajax(ID, sesID, '1', Total, dep_date);
						
					} 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;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	//============ load lodging at first ===================================================
	
	
	//************************* This function is used to fetch Lodging in build your own ***************************/
function show_lodging_load(sesID) {	
		var strURL="lodging_load_ajax.php?client_id="+sesID;
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
				document.getElementById('p_div2').innerHTML=req.responseText;						
						
						
					} 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;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	//============== load content of duration include ================
	
	/************************* This function is used to fetch Lodging in build your own ***************************/
function show_duration_load(sesID) {	
		var strURL="duration_include.php?client_id="+sesID;
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
				document.getElementById('p_div3').innerHTML=req.responseText;						
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('p_div3').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);	 		
		}	
		
	}
	
	
	/************************* This function is used to fetch destinations in build your own ***************************/
function show_destination(ID, sesID, BG, Total) {	
		var strURL="build_ajax.php?ID="+ID+"&sesID="+sesID;
		
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
	document.getElementById('getDestination').innerHTML=req.responseText;		
	//=========== first time click on the destinations show first tab with selected bg ===================
	//============ BG is the id of first bg ===============================================================
	//============= Total are the no of total tabs for looping so ======================================
		if(BG!=''){
				for(i=1; i<=Total; i++){
					divID	= 'desc_'+i;
					
					if(BG==i){
						document.getElementById('desc_'+i).style.backgroundColor="#FFFFFF";
						document.getElementById('descimg_'+i).style.display="";
					}else{
						document.getElementById('desc_'+i).style.backgroundColor="#E6D2C7";
						document.getElementById('descimg_'+i).style.display="none";
					}
			}
	
			
			}
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
						
						
					}
				}	
				
				else {
	document.getElementById('getDestination').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	/************ This function is used to fetch content 0f level on tourmenu.php and independent_tour.php************/
function show_level_content(level) {	
		var strURL="getLevelResult.php?level="+level;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('outerLevelDiv').style.display='';
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
	
	document.getElementById('levelResult').innerHTML=req.responseText;						
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('levelResult').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}

/************ This function is used to fetch content 0f level on build your own************/


//====================== show selected destination and lodging on the div by ajax=============================



function show_selected_lodging(sesID) {	
		var strURL="build_selected_lodging.php?client_id="+sesID;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('selected_result').style.display='';
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
	
	document.getElementById('selected_result').innerHTML=req.responseText;
	count_char	= req.responseText;
	
	if(count_char.length<50){
		
		document.getElementById('select_build_own_desc').style.display='';
	} else{
		document.getElementById('select_build_own_desc').style.display='none';
	}
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('selected_result').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}


/************ This function is used to fetch content 0f hotels on build your own************/
function build_hotels_content(sesID, name, BG, total) {	
		var strURL="lodging_hotels.php?sesID="+sesID;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('lodging_hotel').style.display='';
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
	
	document.getElementById('lodging_hotel_inner').innerHTML=req.responseText;						
						show_lodging_hotels_list(name, sesID, BG, total );
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('lodging_hotel_inner').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}


//=================== get load hotel of first occured city of information lodging ==========================

/************ This function is used to fetch content 0f hotels on build your own************/
function info_hotels_content(ID, BG, total) {	
		var strURL="lodging_hotels.php?sesID="+sesID;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('lodging_hotel').style.display='';
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
	
	document.getElementById('lodging_hotel_inner').innerHTML=req.responseText;						
						show_lodging_hotels_list(ID, BG, total );
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('lodging_hotel_inner').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
//============ toggle div =========================

function toggleDiv(divID){
	display = document.getElementById(divID).style.display;
	if(display=='none'){
		document.getElementById(divID).style.display ='';
	} else{
		document.getElementById(divID).style.display = 'none';
	}
}
function showDiv(divID){
	
	
		document.getElementById(divID).style.display ='';
	
	
	
}
function hideDiv(divID){
	document.getElementById(divID).style.display = 'none';
}
/************************* This function is used to save Lodging for all prefernce in build your own ***************************/
function save_all_hotels(sesID) {
	

chk = document.all_pre.lodging_prefer;
		final_array  = '';
			for (i = 0; i < chk.length; i++){
				if(chk[i].checked == true){
						if((i>0)&&(final_array!='')){
							final_array +=':';
					} 
				final_array += chk[i].value;
			}
		}

		var strURL="save_all_hotels.php?client_id="+sesID+"&lodging="+final_array;
		

		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						
							show_selected_lodging(sesID);
							if(req.responseText!=''){
		if(document.getElementById('finished_result')){
							document.getElementById('finished_result').style.display ='';
							document.getElementById('finished_result').innerHTML=req.responseText;
							
							
								}			
								
							}
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('p_div3').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	
	/******************** This function is used to save Lodging level for all prefernce in build your own ************************/
function save_all_level(sesID) {	

chk = document.all_pre.lodging_level;
		final_array  = '';
			for (i = 0; i < chk.length; i++){
				if(chk[i].checked == true){
						if((i>0)&&(final_array!='')){
							final_array +=':';
					} 
				final_array += chk[i].value;
			}
		}

		var strURL="save_all_levels.php?client_id="+sesID+"&level="+final_array;
		

		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						
						show_selected_lodging(sesID);
							if(req.responseText!=''){
				if(document.getElementById('finished_result')){
							document.getElementById('finished_result').style.display ='';
							document.getElementById('finished_result').innerHTML=req.responseText;			
							
						}	
						
						
							}
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('p_div3').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}



//======== ========================== save hotels per destinations selection ================

/************************* This function is used to save Lodging for all prefernce in build your own ***************************/
function save_per_hotels(ID, sesID) {	

chk = document.all_pre.lodging_prefer;
		final_array  = '';
			for (i = 0; i < chk.length; i++){
				if(chk[i].checked == true){
						if((i>0)&&(final_array!='')){
							final_array +=':';
					} 
				final_array += chk[i].value;
			}
		}

		var strURL="save_per_hotels.php?ID="+ID+"&client_id="+sesID+"&lodging="+final_array;

		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
show_selected_lodging(sesID);	

responded	= req.responseText;

			if(responded.length>10){
			//document.getElementById('final_Result').innerHTML=req.responseText;							
		}
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('p_div3').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	
//******************** This function is used to save Lodging level for all prefernce in build your own ************************/
function save_per_level(ID, sesID) {	

chk = document.all_pre.lodging_level;
		final_array  = '';
			for (i = 0; i < chk.length; i++){
				if(chk[i].checked == true){
						if((i>0)&&(final_array!='')){
							final_array +=':';
					} 
				final_array += chk[i].value;
			}
		}

		var strURL="save_per_levels.php?ID="+ID+"&client_id="+sesID+"&level="+final_array;
		
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							show_selected_lodging(sesID);		
							
								if(req.responseText!=''){
			document.getElementById('final_Result').innerHTML=req.responseText;		
								}
								
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('p_div3').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}

//******************** save destinations's days ************************/
function save_build_day(ID, sesID, days) {	
		var strURL="save_build_destination.php?ID="+ID+"&client_id="+sesID+"&days="+days;
		//alert(strURL);
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
				show_selected_lodging(sesID);					
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('p_div3').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}


//******************** save destinations's days ************************/
function show_connected(ID, sesID, flag) {	
		var strURL="show_connected.php?ID="+ID+"&client_id="+sesID+"&flag="+flag;
		document.getElementById('linked_msg').style.display = 'none';
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						if(req.responseText!=''){
				document.getElementById('linked_msg').style.display = '';
				document.getElementById('linked_msg_inner').innerHTML=req.responseText;		
				}
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('linked_msg_inner').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}



//================== lodging for custom tours ==================================================
//==============================================================================================


	
	//============ list of hotes ============
	function show_lodging_hotels_list(name, sesID, BG, Total ) {

var strURL="build_lodging_hotels_list.php?name="+name+"&sesID="+sesID+"&total="+BG;
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
	document.getElementById('hotels_list').innerHTML=req.responseText;						
						//=========== first time click on the destinations show first tab with selected bg ===================
	//============ BG is the id of first bg ===============================================================
	//============= Total are the no of total tabs for looping so ======================================
		if(BG!=''){
				for(i=1; i<=Total; i++){
					divID	= 'desc_'+i;
					
					if(BG==i){
						document.getElementById('Hper_'+i).style.fontWeight="bold";
						document.getElementById('Hper_'+i).style.textDecoration="none";
						document.getElementById('Hperimg_'+i).style.display="";
					}else{
						document.getElementById('Hper_'+i).style.fontWeight="normal";
						document.getElementById('Hper_'+i).style.textDecoration="underline";
						document.getElementById('Hperimg_'+i).style.display="none";
					}
			}
	
			
			}
			
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('hotels_list').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	
	
	//============ list of hotels  for lodging  section of information ============
	function show_info_lodging_hotels_list(ID, BG, Total ) {

var strURL="info_lodging_hotels_list.php?ID="+ID+"&total="+BG;
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
	document.getElementById('hotels_list').innerHTML=req.responseText;						
						//=========== first time click on the destinations show first tab with selected bg ===================
	//============ BG is the id of first bg ===============================================================
	//============= Total are the no of total tabs for looping so ======================================
	if(req.responseText){
			if(BG!=''){
					for(i=1; i<=Total; i++){
							divID	= 'desc_'+i;
				
							if(BG==i){
								document.getElementById('Hper_'+i).style.fontWeight="bold";
								document.getElementById('Hper_'+i).style.textDecoration="none";
								document.getElementById('Hperimg_'+i).style.display="";
							}else{
								document.getElementById('Hper_'+i).style.fontWeight="normal";
								document.getElementById('Hper_'+i).style.textDecoration="underline";
								document.getElementById('Hperimg_'+i).style.display="none";
							}
						}
					}
    		   }
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('hotels_list').innerHTML="<table><tr><td  width='723'><img align='center' src='images/ajax-loader.gif' style='padding:55px;' ></td></tr></table>";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	//================================== custom lodging ===================================
	
	//************************* This function is used to fetch Lodging in build your own ***************************/
function show_custom_lodging_load(tourID, dep_date) {	
		var strURL="custom_lodging_load_ajax.php?tourID="+tourID+'&dep_date='+dep_date;
		
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
				document.getElementById('div_iti_4').innerHTML=req.responseText;						
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('div_iti_4').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	
	
	function save_custom_all_hotels(iti_id, dep_date) {	

chk = document.all_pre.lodging_prefer;
		final_array  = '';
			for (i = 0; i < chk.length; i++){
				if(chk[i].checked == true){
						if((i>0)&&(final_array!='')){
							final_array +=':';
					} 
				final_array += chk[i].value;
			}
		}

		var strURL="save_custom_all_hotels.php?iti_id="+iti_id+"&lodging="+final_array+"&dep_date="+dep_date;

		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						if(req.responseTex!=''){
						if(document.getElementById('finished_result')){
							document.getElementById('finished_result').style.display ='';
							document.getElementById('finished_result').innerHTML=req.responseText;				
						}
						}
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('p_div3').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	
	/******************** This function is used to save Lodging level for all prefernce in build your own ************************/
function save_custom_all_level(iti_id, dep_date) {	

chk = document.all_pre.lodging_level;
		final_array  = '';
			for (i = 0; i < chk.length; i++){
				if(chk[i].checked == true){
						if((i>0)&&(final_array!='')){
							final_array +=':';
					} 
				final_array += chk[i].value;
			}
		}

		var strURL="save_custom_all_levels.php?iti_id="+iti_id+"&level="+final_array+"&dep_date="+dep_date;
		

		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							if(req.responseTex!=''){
				if(document.getElementById('finished_result')){
							document.getElementById('finished_result').style.display ='';
							document.getElementById('finished_result').innerHTML=req.responseText;						
						}						
							}
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('p_div3').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}


/************************* This function is used to fetch Lodging in build your own ***************************/
function show_custom_lodging_ajax(city_id, iti_id, BG, Total, dep_date ) {	

var strURL="custom_lodging_per_ajax.php?city_id="+city_id+"&iti_id="+iti_id+"&BG="+BG+"&Total="+Total+"&dep_date="+dep_date;

		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
	document.getElementById('getLodgingPer').innerHTML=req.responseText;						
						//=========== first time click on the destinations show first tab with selected bg ===================
	//============ BG is the id of first bg ===============================================================
	//============= Total are the no of total tabs for looping so ======================================
		if(BG!=''){
				for(i=1; i<=Total; i++){
					divID	= 'desc_'+i;
					
					if(BG==i){
						document.getElementById('per_'+i).style.fontWeight="bold";
						document.getElementById('per_'+i).style.textDecoration="none";
						document.getElementById('perimg_'+i).style.display="";
					}else{
						document.getElementById('per_'+i).style.fontWeight="normal";
						document.getElementById('per_'+i).style.textDecoration="underline";
						document.getElementById('perimg_'+i).style.display="none";
					}
			}
	
			
			}
			
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('getLodgingPer').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}




function show_custom_lodging_per(iti_id, city_id, Total, dep_date) {	

		var strURL="custom_lodging_per_include.php?iti_id="+iti_id+"&city_id="+city_id+"&Total="+Total+"&dep_date="+dep_date;
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
				document.getElementById('div_iti_4').innerHTML=req.responseText;						
						show_custom_lodging_ajax(city_id, iti_id, '1', Total, dep_date);
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('div_iti_4').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	
	
	//******************** This function is used to save Lodging level for all prefernce in build your own ************************/
function save_cutom_per_level(city_id, iti_id, dep_date) {	

chk = document.all_pre.lodging_level;
		final_array  = '';
			for (i = 0; i < chk.length; i++){
				if(chk[i].checked == true){
						if((i>0)&&(final_array!='')){
							final_array +=':';
					} 
				final_array += chk[i].value;
			}
		}

		var strURL="save_custom_per_levels.php?city_id="+city_id+"&iti_id="+iti_id+"&level="+final_array+"&dep_date="+dep_date;
		
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						
							if(req.responseText!=''){
						document.getElementById('final_Result').innerHTML=req.responseText;						
							}
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('p_div3').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}

/************************* This function is used to save Lodging for all prefernce in build your own ***************************/
function save_custom_per_hotels(city_id, iti_id, dep_date) {	

chk = document.all_pre.lodging_prefer;
		final_array  = '';
			for (i = 0; i < chk.length; i++){
				if(chk[i].checked == true){
						if((i>0)&&(final_array!='')){
							final_array +=':';
					} 
				final_array += chk[i].value;
			}
		}

		var strURL="save_custom_per_hotels.php?city_id="+city_id+"&iti_id="+iti_id+"&lodging="+final_array+"&dep_date="+dep_date;

		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						if(req.responseText!=''){
							
				document.getElementById('final_Result').innerHTML=req.responseText;						
						}
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('p_div3').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	/************ This function is used to fetch content 0f hotels on build your own************/
function custom_hotels_content(iti_id, name, BG, total) {	
		var strURL="custom_lodging_hotels.php?iti_id="+iti_id;
		var req = getXMLHTTP();
		if (req) {
			document.getElementById('lodging_hotel').style.display='';
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
	
	document.getElementById('lodging_hotel_inner').innerHTML=req.responseText;						
						show_custom_lodging_hotels_list(name, iti_id, BG, total );
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('lodging_hotel_inner').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}



	//============ list of hotes ============
	function show_custom_lodging_hotels_list(name, iti_id, BG, Total ) {

var strURL="custom_lodging_hotels_list.php?name="+name+"&iti_id="+iti_id+"&total="+BG;
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
							
	document.getElementById('hotels_list').innerHTML=req.responseText;						
						//=========== first time click on the destinations show first tab with selected bg ===================
	//============ BG is the id of first bg ===============================================================
	//============= Total are the no of total tabs for looping so ======================================
		if(BG!=''){
				for(i=1; i<=Total; i++){
					divID	= 'desc_'+i;
					
					if(BG==i){
						document.getElementById('Hper_'+i).style.fontWeight="bold";
						document.getElementById('Hper_'+i).style.textDecoration="none";
						document.getElementById('Hperimg_'+i).style.display="";
					}else{
						document.getElementById('Hper_'+i).style.fontWeight="normal";
						document.getElementById('Hper_'+i).style.textDecoration="underline";
						document.getElementById('Hperimg_'+i).style.display="none";
					}
			}
	
			
			}
			
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('hotels_list').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	//============= disable right click -- copy content =========
	//====================================== 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;
	
}

window.onload = clickNS;
//window.onKeyDown=return disableCtrlModifer(event);

//onLoad=" clickNS();" onKeyPress="return disableCtrlModifer(event);" onKeyDown="return disableCtrlModifer(event);"

function mouseDowndisable (){
// Internet Explorer:
if (document.all)
  document.onselectstart =
    function () { return false; };

// Netscape 4:
if (document.layers) {
  document.captureEvents(Event.MOUSEDOWN);
  document.onmousedown =
    function (evt) { return false; };
}

// Netscape 6:
document.onmousedown = function () { return false; };

	
}

function hideAll(){
	document.getElementById('search_div_info').style.display='none';
	document.getElementById('search_div_tour_custom').style.display='none';
	document.getElementById('search_div_tour_group').style.display='none';
	document.getElementById('search_div_vacation').style.display='none';
	
}
function showCurrent(divID){
hideAll();
divID	= 'search_'+divID;
document.getElementById(divID).style.display ='';
}
	//============ list of hotes ============
	function show_search_main(PATH) {
		var strURL=PATH+"main_search.php";
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						
	document.getElementById('show_main_search').innerHTML=req.responseText;						
			//=========== first time click on the destinations show first tab with selected bg ===================

			
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('show_main_search').innerHTML='<img align="center" src='+PATH+'images/ajax-loader.gif style="padding:55px;" >';
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	//========== change the url========
	
					
					function change_level(server_url, levelID, tourID, depDate, tab){
					
					tabValue	= document.getElementById('tab_value').value;
					url	 = server_url+'grouptour_booking.php?tour_id='+tourID+'&dep_date='+depDate+'&tour_level='+levelID+'&open='+tabValue;
					window.location = url;
					//alert(depDate);
					}
					
					function change_level_custom(levelID, tourID, depDate){
					url	 ='customtour_booking.php?tour_type=C&tour_id='+tourID+'&dep_date='+depDate;
					
					window.location = url;
					}
					  
					  



	//============= preload images with javascript ==================================
	
//============ group_tour_calendar ============
	function load_date_group(tour_id, dep_date) {
		var strURL="group_calender_ajax.php?tour_id="+tour_id+"&dep_date="+dep_date;
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						//alert(req.responseText);
						document.getElementById('load_calendar_ajax').innerHTML=req.responseText;						
			//=========== first time click on the destinations show first tab with selected bg ===================

			
						
					} else {
						//alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	document.getElementById('load_calendar_ajax').innerHTML='<img align="center" src="images/ajax-loader.gif" style="padding:55px;" >';
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	
	
//=================== url functions for group tour ======================


function load_error_msg(formType){
  var errMsg = '';
  level		= document.getElementById('selected_level_hidden').value;
  depart_date	= document.getElementById('departure_date_hidden').value;
 
  if((level==0)&&(depart_date=='')){
    errMsg	= 'Please select tour level and departure date.';
    alert(errMsg);
    return false;
    }
   
  else if((level=='1')&&(depart_date=='')){ 
    errMsg	= 'Please select departure date.';
    if(document.form_pda_download){
	document.form_pda_download.reset();
    }
    alert(errMsg);
    return false;
  
  } else  if((level=='0')&&(depart_date!='')){
    errMsg	= 'Please select tour level.';
    alert(errMsg);
    return false;
  }
  if(formType=='download'){
	 submitDownload();
  } else if(formType=='reserve'){
	  show_div('div_reserve'); if(document.getElementById('div_form2')){ document.getElementById('div_form2').style.display='none' }; if(document.getElementById('div_city_description')){document.getElementById('div_city_description').style.display='none'}
	 
	 
	 
	 
	 
  }else {
	 chk_inquiry();    
  }
}


function select_departure_date(server_url, depart_date, tour_level, tour_id){
  document.getElementById('departure_date_hidden').value = depart_date;
  
  hidden_depart = document.getElementById('departure_date_hidden').value;
  level		= document.getElementById('selected_level_hidden').value;
  
  if(level=='1'){
    change_level(server_url, tour_level,tour_id, hidden_depart,'1');
  }
  
}


//============ group_tour_calendar ============
	function load_terms() {
		var strURL="read_terms.php";
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//	alert(req.responseText);
						if(document.getElementById('terms_area')){
						document.getElementById('terms_area').innerHTML=req.responseText;						
						}
			//=========== first time click on the destinations show first tab with selected bg ===================

			
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('load_calendar_ajax').innerHTML='<img align="center" src="images/ajax-loader.gif" style="padding:55px;" >';
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	
	//============ left column in information fetch through ajax =====================
	
	
	
//============ group_tour_calendar ============
	function load_left_info(cPath) {
		var strURL="information_box.php?cPath="+cPath;
	//	alert(strURL);
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						//alert(req.responseText);
						
						document.getElementById('information_left_div').innerHTML=req.responseText;						
			//=========== first time click on the destinations show first tab with selected bg ===================

			
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
	//document.getElementById('load_calendar_ajax').innerHTML='<img align="center" src="images/ajax-loader.gif" style="padding:55px;" >';
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}
	
	//============== alter form validation =================
	
	function FrontPage_Form1_Validator(theForm){

  if (theForm.Name.value == "")
  {
    alert("Please enter a value for the Name field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.E_mail.value == "")
  {
    alert("Please enter a value for the Email field.");
    theForm.E_mail.focus();
    return (false);
  }

  if (theForm.phone_number.value == "")
  {
    alert("Please enter a value for the Phone number field.");
    theForm.phone_number.focus();
    return (false);
  }
  return (true);
}

	
	
	
	
	
	
	
	//==============================Preview on custom tour booking==========================

function showCustomLodging(iti_id,dep_date) {

var strURL="show_custom_lodging.php?iti_id="+iti_id+"&dep_date="+dep_date;
//alert(strURL);
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						
						
						
						document.getElementById('custom_lodging').innerHTML=req.responseText;						
	
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				
				else {
					document.getElementById('custom_lodging').innerHTML="<img align='center' src='images/ajax-loader.gif' style='padding:55px;' >";
					
				}
					
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
		
	}



//==============================END=====================================================
	/***********************************************************************/

function change_bg_over(ID){

	document.getElementById(ID).style.backgroundColor='#880000';
}
function change_bg_out(ID){
	document.getElementById(ID).style.backgroundColor='#CB8585';
}
