// JavaScript Document

// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}






function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var http2 = getXMLHTTPRequest();


function change_ftour(islocal) {
	
  var islocal = trim(islocal); 
  

if(islocal == "1"){

	window.location = 'additional_requirement.php';
	
}else{

//alert(uname);
  var myurl = 'change_ftour.php';
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand+"&islocal="+islocal+"&action=change_tour";
  http2.open("GET", modurl, true);
  http2.onreadystatechange = ftourResponse;
  http2.send(null);  
	  
}


function ftourResponse() {
   if (http2.readyState == 4) {
    if(http2.status == 200) {
       var mytext = http2.responseText;

		  	document.getElementById('d_ftour').innerHTML = mytext;
			document.getElementById('d_fprompt').innerHTML = "";
	   	  
    }
  } 
  
} 
	  

}//end of function change_ftour(islocal) {
	
	
	
	


function prompt_tour_date(tourID) {
	
  var tourID = trim(tourID); 
  

//alert(uname);
  var myurl = 'prompt_ftour_date.php';
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand+"&tour_id="+tourID;
  http2.open("GET", modurl, true);
  http2.onreadystatechange = promptDateResponse;
  http2.send(null);  
	  


function promptDateResponse() {
   if (http2.readyState == 4) {
    if(http2.status == 200) {
       var mytext = http2.responseText;

		  	document.getElementById('d_fprompt').innerHTML = mytext;
	   	  
    }
  } 
  
} 
	  

}//end of function change_ftour(islocal) {




function get_ftour_allotment(tour_id,fdate,basis) {
	
  var tour_id = trim(tour_id); 
  var fdate = trim(fdate);
  var basis = trim(basis);
  

//alert(uname);
  var myurl = 'change_ftour.php';
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand+"&tour_id="+tour_id+"&fdate="+fdate+"&basis="+basis+"&action=ftour_allotment";
  http2.open("GET", modurl, true);
  http2.onreadystatechange = ftour_allotment_Response;
  http2.send(null);  
	  


function ftour_allotment_Response() {
   if (http2.readyState == 4) {
    if(http2.status == 200) {
       var mytext = http2.responseText;

		  	document.getElementById('d_tour_allotment').innerHTML = mytext;
			document.getElementById('d_price').innerHTML = "";
	   	  
    }
  } 
  
} 
	  

}//end of function get_ftour_allotment(tour_id,fdate) {
	



function get_all_types_ftour(people,tour,fdate) {
	
  var people = trim(people); 
  var tour = trim(tour); 
  var fdate = trim(fdate); 
 

  var myurl = 'change_ftour.php';
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand+"&people="+people+"&tour="+tour+"&fdate="+fdate+"&action=get_all_types";
  http2.open("GET", modurl, true);
  http2.onreadystatechange = all_types_Response;
  http2.send(null);  
	  
	document.getElementById('d_price').innerHTML = "";

function all_types_Response() {
   if (http2.readyState == 4) {
    if(http2.status == 200) {
       var mytext = http2.responseText;

		  	document.getElementById('d_all_types').innerHTML = mytext;
			//document.getElementById('d_price').innerHTML = "";
	   	  
    }
  } 
  
} 
	  

}//end of function function get_all_types(people) {





function get_other_types_triple_ft(people,triple,tour,fdate) {
	
  var people = trim(people);
  var triple = trim(triple); 
  var tour = trim(tour); 
  var fdate = trim(fdate); 
 
 

//alert(uname);
  var myurl = 'change_ftour.php';
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand+"&people="+people+"&triple="+triple+"&tour="+tour+"&fdate="+fdate+"&action=get_other_types_triple";
  http2.open("GET", modurl, true);
  http2.onreadystatechange = other_types_triple_Response;
  http2.send(null);  
	  


function other_types_triple_Response() {
   if (http2.readyState == 4) {
    if(http2.status == 200) {
       var mytext = http2.responseText;

		  	document.getElementById('d_all_types').innerHTML = mytext;
			//document.getElementById('d_price').innerHTML = "";
	   	  
    }
  } 
  
} 
	  

}//end of function function get_other_types_triple(people,count,type) {




function get_other_types_double_ft(people,triple,double,tour,fdate) {
	
  var people 	= trim(people);
  var triple 	= trim(triple); 
  var double 	= trim(double); 
  var tour = trim(tour); 
  var fdate = trim(fdate); 
 

//alert(uname);
  var myurl = 'change_ftour.php';
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand+"&people="+people+"&triple="+triple+"&double="+double+"&tour="+tour+"&fdate="+fdate+"&action=get_other_types_double";
  http2.open("GET", modurl, true);
  http2.onreadystatechange = other_types_double_Response;
  http2.send(null);  
	  


function other_types_double_Response() {
   if (http2.readyState == 4) {
    if(http2.status == 200) {
       var mytext = http2.responseText;

		  	document.getElementById('d_all_types').innerHTML = mytext;
			//document.getElementById('d_price').innerHTML = "";
	   	  
    }
  } 
  
} 
	  

}//end of function function get_other_types_triple(people,count,type) {






function valid_tour(tour_id,button){
	
	var tour_id = tour_id;
	var button = button;
	
	if(button == 0){
		
		if(tour_id == "no"){
	  	
			alert("Select Tour Package!");
			return false;
		}else{
			window.location = 'viewfixed_tour.php?id='+tour_id;	
			return false;
		}
	
	}else{
		
		if(tour_id == "no"){
	  	
			alert("Select Tour Package!");
			return false;
		}else{
			
			return true;
		}
		
	}

}



