instruct = "0";
function setPrices(type,el)
{
    
	var xmlHttp
	var sw
	//used in confirm_booking.php
    
	val = "";
	
	
	if (type == 'airport_transfer'){
		
		val = el.options[el.selectedIndex].value;
		transfer_type = document.getElementById("my_transfer_type").value;
		//alert(transfer_type);
		sw = 2;
	}
	
	if (type == 'tours'){
		val = el.value;
		sw = 3;
	}
	
	//alert(val)
	
	
	if (val == "")
		return false;
	
	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null){
 		alert ("Browser does not support HTTP Request")
 	return
 	}

	var url="includes/ajaxresponse.php"
	url=url+"?sw="+sw+"&q="+val+"&transfer_type="+transfer_type
	url=url+"&sid="+Math.random()
	
	xmlHttp.onreadystatechange=function(){
		stateChangedPrice(xmlHttp);
		
		
		 if(val == -1){
			 
		 document.express_booking.iprvbus.style.display = "none"
		 document.express_booking.iprvcar.style.display = "none"

	     }
		 
	   //check the value of the private car and bus totals
	   var thiscarcost = parseFloat(document.getElementById('hid_iprvcar').value);
       var thisbuscost = parseFloat(document.getElementById('hid_iprvbus').value);
	   
	   //private car and bus check box values
	   var thiscarcheck = document.express_booking.vipcarupgrade.checked;
	   var thisbuscheck = document.express_booking.vipbusupgrade.checked;
	   
	   //disable check boxes if no value
	   if(thiscarcost < 1 )
		document.express_booking.vipcarupgrade.disabled=true;
		document.express_booking.vipcarupgrade.checked=false;

	   if(thisbuscost < 1)
		  
		document.express_booking.vipbusupgrade.disabled=true;
		document.express_booking.vipbusupgrade.checked=false;
		
	  
	   //enable check boxes if there is a value
	   if(thiscarcost > 0 )

		document.express_booking.vipcarupgrade.disabled=false;
		 if(thiscarcheck == true)
		  document.express_booking.vipcarupgrade.checked=true;
	  

	   
	   if(thisbuscost > 0)
		  
		document.express_booking.vipbusupgrade.disabled=false;
		if(thisbuscheck == true)
		  document.express_booking.vipbusupgrade.checked=true;
		
		
		}
		
		
		if(transfer_type == "One Way" && document.getElementById('arrivaldate').value == "" && document.getElementById('departuredate').value == "")
		{
			document.getElementById('my_submit_botton').style.display="none";
			if(instruct == "0"){
				
			  alert('Please enter either Arrival or Departure flight details!');
			  instruct++;
			  
			}
		}
		else if(transfer_type == "One Way" && document.getElementById('arrivaldate').value != "" && document.getElementById('departuredate').value != ""){
			
			document.getElementById('my_submit_botton').style.display="none";
			alert('You cannot enter both Arrival and Departure flight details for a "One Way" transfer!!');
		}
		else
		{
			document.getElementById('my_submit_botton').style.display="block";
		}
		
		
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function setPrices_transfer(type,el)
{
    
	var xmlHttp
	var sw
	//used in confirm_booking.php
    
	val = "";
	
	if (type == 'airport_transfer'){
		val = el.options[el.selectedIndex].value;
		sw = 8;
		
	}
	

	
	//alert(val)
	
	
	if (val == "")
		return false;
	
	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null){
 		alert ("Browser does not support HTTP Request")
 	return
 	}

	var url="includes/ajaxresponse.php"
	url=url+"?sw="+sw+"&q="+val
	url=url+"&sid="+Math.random()
	
	
	
	xmlHttp.onreadystatechange=function(){
		stateChangedPrice(xmlHttp);
		
		
		 if(val == -1){
			 
		 document.express_booking.iprvbus.style.display = "none"
		 document.express_booking.iprvcar.style.display = "none"

	     }
		 
	   //check the value of the private car and bus totals
	   var thiscarcost = parseFloat(document.getElementById('hid_iprvcar').value);
       var thisbuscost = parseFloat(document.getElementById('hid_iprvbus').value);
	   
	   //private car and bus check box values
	   var thiscarcheck = document.express_booking.vipcarupgrade.checked;
	   var thisbuscheck = document.express_booking.vipbusupgrade.checked;
	   
	   //disable check boxes if no value
	   if(thiscarcost < 1 )
		document.express_booking.vipcarupgrade.disabled=true;
		document.express_booking.vipcarupgrade.checked=false;

	   if(thisbuscost < 1)
		  
		document.express_booking.vipbusupgrade.disabled=true;
		document.express_booking.vipbusupgrade.checked=false;
		
	  
	   //enable check boxes if there is a value
	   if(thiscarcost > 0 )

		document.express_booking.vipcarupgrade.disabled=false;
		 if(thiscarcheck == true)
		  document.express_booking.vipcarupgrade.checked=true;
	  

	   
	   if(thisbuscost > 0)
		  
		document.express_booking.vipbusupgrade.disabled=false;
		if(thisbuscheck == true)
		  document.express_booking.vipbusupgrade.checked=true;
		
		
	}
		
		
	//alert(url);
		
		
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function setPrices_run_transfer(type,el,aff)
{


   
	var xmlHttp
	var sw
	
	
	val = "";
	affiliate = "";
	
	if (type == 'airport_transfer'){
		val = el;
		affiliate = aff;
		sw = 8;
		
	}
	
	if (type == 'tours'){
		val = el.value;
		sw = 3;
	}
	
	//alert(val)
	
	
	if (val == "")
		return false;
	
	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null){
 		alert ("Browser does not support HTTP Request")
 	return
 	}

	var url="includes/ajaxresponse.php"
	url=url+"?sw="+sw+"&q="+val+"&aff="+affiliate
	url=url+"&sid="+Math.random()
	
	xmlHttp.onreadystatechange=function(){
		stateChangedPrice(xmlHttp);
		
		
		 if(val == -1){
		 document.express_booking.iprvbus.style.display = "none"
		 document.express_booking.iprvcar.style.display = "none"

	     }
		 
	   //check the value of the private car and bus totals
	   var thiscarcost = parseFloat(document.getElementById('hid_iprvcar').value);
       var thisbuscost = parseFloat(document.getElementById('hid_iprvbus').value);
	   
	   //private car and bus check box values
	   var thiscarcheck = document.express_booking.vipcarupgrade.checked;
	   var thisbuscheck = document.express_booking.vipbusupgrade.checked;
	   
	   //disable check boxes if no value
	   if(thiscarcost < 1 )
		document.express_booking.vipcarupgrade.disabled=true;
		document.express_booking.vipcarupgrade.checked=false;

	   if(thisbuscost < 1)
		  
		document.express_booking.vipbusupgrade.disabled=true;
		document.express_booking.vipbusupgrade.checked=false;
		
	  
	   //enable check boxes if there is a value
	   if(thiscarcost > 0 )

		document.express_booking.vipcarupgrade.disabled=false;
		 if(thiscarcheck == true)
		  document.express_booking.vipcarupgrade.checked=true;
	  

	   
	   if(thisbuscost > 0)
		  
		document.express_booking.vipbusupgrade.disabled=false;
		if(thisbuscheck == true)
		  document.express_booking.vipbusupgrade.checked=true;
		
		
		}
		
		
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}




function setPrices1(type,el)
{
	var xmlHttp
	var sw
	
    
	
	val = "";
	
	

	
	if (type == 'tours'){
		val = el.options[el.selectedIndex].value;
		
		sw = 7;
	}
	
	if (val == "")
		return false;
	
	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null){
 		alert ("Browser does not support HTTP Request")
 	return
 	}
    
	
	var url="includes/ajaxresponse.php"
	url=url+"?sw="+sw+"&q="+val
	url=url+"&sid="+Math.random()
	
	xmlHttp.onreadystatechange=function(){
		stateChangedPrice1(xmlHttp);
	   if(val == "-1"){
		 document.getElementById('show_add_to_cart').style.display = "none"	
		 //private car and bus prices
		 document.getElementById('iprvcar1').style.display = "none"
		 document.getElementById('iprvbus1').style.display = "none"
		 //tour days
		 document.getElementById('tour_days').style.display = "none"
		 document.getElementById('get_cost').style.display = "none"
	   } else{
		 //show get cost button
	    document.getElementById('get_cost').style.display = "block"  
	   }
	   
	   
	   
	   
	   //check the value of the child and infant
	   var thischildcost = parseFloat(document.getElementById('hid_cprice1').value); 
	   var thisinfantcost = parseFloat(document.getElementById('hid_iprice1').value); 
	   //alert(thischildcost+" "+thisinfantcost)
	   
	   //check the value of the private car and bus totals
	   var thiscarcost = parseFloat(document.getElementById('hid_iprvcar1').value);
       var thisbuscost = parseFloat(document.getElementById('hid_iprvbus1').value); 
	   
	   
	   	
	   
	   //private car and bus check box values
	   var thiscarcheck = document.confirmForm.vipcarupgrade1.checked;
	   var thisbuscheck = document.confirmForm.vipbusupgrade1.checked;
	   
	   
	   //disable child text box if no value
	   if(thischildcost < 1)
	   document.confirmForm.ChildrenCount1.disabled=true;
	  
	  
	   //disable infant text box if no value
	   if(thisinfantcost < 1)
	   document.confirmForm.InfantCount1.disabled=true;
	  
	   
	      //enable child text box if  value
	   if(thischildcost > 0)
	   document.confirmForm.ChildrenCount1.disabled=false;
	  
	  
	   //enable infant text box if  value
	   if(thisinfantcost > 0)
	   document.confirmForm.InfantCount1.disabled=false;
	   
	   
	   
	   //disable check boxes if no value
	   if(thiscarcost < 1 )
		document.confirmForm.vipcarupgrade1.disabled=true;
		document.confirmForm.vipcarupgrade1.checked=false;

	   if(thisbuscost < 1)
		  
		document.confirmForm.vipbusupgrade1.disabled=true;
		document.confirmForm.vipbusupgrade1.checked=false;
		
	  
	   //enable check boxes if there is a value
	   if(thiscarcost > 0 ){

		document.confirmForm.vipcarupgrade1.disabled=false;
		  if(thiscarcheck == true)
		  document.confirmForm.vipcarupgrade1.checked=true;
		
	   }

	   
	   if(thisbuscost > 0){
		  
		document.confirmForm.vipbusupgrade1.disabled=false;
		 if(thisbuscheck == true)
		  document.confirmForm.vipbusupgrade1.checked=true;
	  
	   }
		
		
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}










function setPrices_run(type,el)
{
	var xmlHttp
	var sw
	
    
	
	val = "";
	
	

	
	if (type == 'tours'){
		val = el;
		
		sw = 7;
	}
	
	if (val == "")
		return false;
	
	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null){
 		alert ("Browser does not support HTTP Request")
 	return
 	}
    
	
	var url="includes/ajaxresponse.php"
	url=url+"?sw="+sw+"&q="+val
	url=url+"&sid="+Math.random()
	
	xmlHttp.onreadystatechange=function(){
		stateChangedPrice1(xmlHttp);
	   if(val == "-1"){
		 document.getElementById('show_add_to_cart').style.display = "none"	
		 //private car and bus prices
		 document.getElementById('iprvcar1').style.display = "none"
		 document.getElementById('iprvbus1').style.display = "none"
		 //tour days
		 document.getElementById('tour_days').style.display = "none"
		 document.getElementById('get_cost').style.display = "none"
	   } else{
		 //show get cost button
	    document.getElementById('get_cost').style.display = "block"  
	   }
	   
	   
	   
	   
	   //check the value of the child and infant
	   var thischildcost = parseFloat(document.getElementById('hid_cprice1').value); 
	   var thisinfantcost = parseFloat(document.getElementById('hid_iprice1').value); 
	   //alert(thischildcost+" "+thisinfantcost)
	   
	   //check the value of the private car and bus totals
	   var thiscarcost = parseFloat(document.getElementById('hid_iprvcar1').value);
       var thisbuscost = parseFloat(document.getElementById('hid_iprvbus1').value); 
	   
	   
	   	
	   
	   //private car and bus check box values
	   var thiscarcheck = document.confirmForm.vipcarupgrade1.checked;
	   var thisbuscheck = document.confirmForm.vipbusupgrade1.checked;
	   
	   
	   //disable child text box if no value
	   if(thischildcost < 1)
	   document.confirmForm.ChildrenCount1.disabled=true;
	  
	  
	   //disable infant text box if no value
	   if(thisinfantcost < 1)
	   document.confirmForm.InfantCount1.disabled=true;
	  
	   
	      //enable child text box if  value
	   if(thischildcost > 0)
	   document.confirmForm.ChildrenCount1.disabled=false;
	  
	  
	   //enable infant text box if  value
	   if(thisinfantcost > 0)
	   document.confirmForm.InfantCount1.disabled=false;
	   
	   
	   
	   //disable check boxes if no value
	   if(thiscarcost < 1 )
		document.confirmForm.vipcarupgrade1.disabled=true;
		document.confirmForm.vipcarupgrade1.checked=false;

	   if(thisbuscost < 1)
		  
		document.confirmForm.vipbusupgrade1.disabled=true;
		document.confirmForm.vipbusupgrade1.checked=false;
		
	  
	   //enable check boxes if there is a value
	   if(thiscarcost > 0 ){

		document.confirmForm.vipcarupgrade1.disabled=false;
		  if(thiscarcheck == true)
		  document.confirmForm.vipcarupgrade1.checked=true;
		
	   }

	   
	   if(thisbuscost > 0){
		  
		document.confirmForm.vipbusupgrade1.disabled=false;
		 if(thisbuscheck == true)
		  document.confirmForm.vipbusupgrade1.checked=true;
	  
	   }
		
		
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}




/* ******************** * ************************* */
function getResults(el,sw,tget,sel)
{
	var xmlHttp
	var target;
	switch(tget){
		case 1:
			target = "arivalfight_1";
		break;
		
		case 2:
			target = "departurefight_1";
		break;
	}
	
	val = el.options[el.selectedIndex].value;

	if (val == ""){
		return;
	}
	
	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null){
 		alert ("Browser does not support HTTP Request")
 	return
 	}

	var url="includes/ajaxresponse.php"
	url=url+"?sw="+sw
	url=url+"&q="+val
	url=url+"&t="+tget
	url=url+"&sel="+sel
	url=url+"&sid="+Math.random()
	
	xmlHttp.onreadystatechange=function(){stateChanged(target,tget,xmlHttp);}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function clearOptions(el){
	var x=el.options.length;
	for(x=el.options.length;x >0;x--){
		el.remove(x);
	}
}

function stateChanged(t,t2,el){
	if (el.readyState==4 || el.readyState=="complete"){ 
	 	
		var field = document.getElementById("flights_"+t2);
	 	var val_array = el.responseText.split("|");
	
		if (val_array.length)
			field.disabled = false;
		else
			field.disabled = true;
		
		clearOptions(field)
		
		for(x=0;x<val_array.length-1;x++){
			vals = val_array[x].split("-");
			if(vals.length > 1){
				var o = document.createElement("option");
					o.innerText =  vals[0]
					o.text =  vals[0]
					o.value =  vals[0]
					o.selected = 'selected'
					
					field.add(o);
			}else{
				var o = document.createElement("option");
					o.innerText =  vals[0]
					o.text =  vals[0]
					o.value =  vals[0]
					
					field.appendChild(o);
			}
			
			vals = null;
		}
	}
}

function stateChangedPrice(el){ 
if (el.readyState==4 || el.readyState=="complete"){ 
 	
	price_array = el.responseText.split('|')

	document.getElementById('aprice').innerHTML=price_array[0] 
	document.getElementById('cprice').innerHTML=price_array[1]  
	document.getElementById('iprice').innerHTML=price_array[2] 
	
	document.getElementById('iprvcar').innerHTML=price_array[3]
	document.getElementById('iprvbus').innerHTML=price_array[4]
	updateCost();
 } 
}

function stateChangedPrice1(el){ 
if (el.readyState==4 || el.readyState=="complete"){ 
 	
	price_array = el.responseText.split('|')

	document.getElementById('aprice1').innerHTML=price_array[0] 
	document.getElementById('cprice1').innerHTML=price_array[1]  
	document.getElementById('iprice1').innerHTML=price_array[2] 
	
	document.getElementById('iprvcar1').innerHTML=price_array[3]
	document.getElementById('iprvbus1').innerHTML=price_array[4]
	document.getElementById('days_not_offered_sunday').innerHTML=price_array[5]
	document.getElementById('days_not_offered_monday').innerHTML=price_array[6]
	document.getElementById('days_not_offered_tuesday').innerHTML=price_array[7]
	document.getElementById('days_not_offered_wednesday').innerHTML=price_array[8]
	document.getElementById('days_not_offered_thursday').innerHTML=price_array[9]
	document.getElementById('days_not_offered_friday').innerHTML=price_array[10]
	document.getElementById('days_not_offered_saturday').innerHTML=price_array[11]
	document.getElementById('tour_days').innerHTML=price_array[12]
	
	
	updateCost1();
 } 
}

function updateCost(){
	
	var total2 = "0";
	var total = "";
	
	var acost = parseFloat(document.getElementById('hid_aprice').value);
	var ccost = parseFloat(document.getElementById('hid_cprice').value);
	var icost = parseFloat(document.getElementById('hid_iprice').value);
	
	var aamount = parseFloat(document.express_booking.AdultCount.value);
	var camount = parseFloat(document.express_booking.ChildrenCount.value);
	var iamount = parseFloat(document.express_booking.InfantCount.value);
	
	
	//alert (acost+'acost '+ccost+'ccost '+icost+'icost '+aamount +'aamount  '+camount+'camount '+iamount+'iamount !')
	
	//private car and bus prices
	var pcarcost = parseFloat(document.express_booking.hid_iprvcar.value);
    var pbuscost = parseFloat(document.express_booking.hid_iprvbus.value);
   

    
	//private car and bus check box values
	var prvcar1 = document.express_booking.vipcarupgrade.checked;
	var prvbus1 = document.express_booking.vipbusupgrade.checked;
	
	//work out total amount of people
	var totalcount = aamount + camount + iamount;
	//alert ('total passengers: '+totalcount+' checked value for car: '+prvcar1+' checked value for the bus: '+prvbus1)
	
	//show the private car and bus text
	document.getElementById('iprvcar').style.display = "block"
	document.getElementById('iprvbus').style.display = "block"
	
	
	if(aamount > "0"){
	total2 = (acost * aamount) + (ccost * camount) + (icost * iamount);
	
	if(total2 < 1){
		total = "0";
		
		document.getElementById('toggleButton').style.display = "none"	
		
	} else {
	//work out private car and bus depending on the total numbe of people 3 for car , 6 for bus
	  if((prvcar1 != true || prvbus1 != true)){
		 if(totalcount <=2){
			 
			  
			  //check if there is a value in the pcarcost1 variable then hide or show respectivley
			   if(pcarcost < 1)
			  document.express_booking.vipcarupgrade.disabled=true;
			    else
			  document.express_booking.vipcarupgrade.disabled=false;	
			  
			  if(prvcar1 == true ){
				  
			   total2 = pcarcost;
			   //check if there is a value in the pcarcost1 variable then hide or show respectivley
			  if(pcarcost < 1)
			  document.express_booking.vipcarupgrade.disabled=true;
			    else
			  document.express_booking.vipcarupgrade.disabled=false;		
			  
			   } 
			   
			 } else if(totalcount > 2){
			   document.express_booking.vipcarupgrade.disabled=true;
			   document.express_booking.vipcarupgrade.checked=false;
			   if(prvcar1 == true){
			   total2 = total2;
			   document.express_booking.vipcarupgrade.disabled=true;
			   document.express_booking.vipcarupgrade.checked=false;
			  
			   } 
		  } 
		  
	
			if(totalcount <=6){
				
					
		  //check if there is a value in the pbuscost1 variable then hide or show respectivley
			  if(pbuscost < 1)
			  document.express_booking.vipbusupgrade.disabled=true;
			    else
			  document.express_booking.vipbusupgrade.disabled=false;		
				
				
				if(prvbus1 == true ){
				 total2 = pbuscost;
				 document.express_booking.vipbusupgrade.disabled=false;
				 
				 if(pbuscost < 1)
					document.express_booking.vipbusupgrade.disabled=true;
					  else
					document.express_booking.vipbusupgrade.disabled=false;		
				
				 } 
				 
			   } else if(totalcount > 6){
				   
				 document.express_booking.vipcarupgrade.disabled=true;
				 document.express_booking.vipbusupgrade.disabled=true;
				 document.express_booking.vipbusupgrade.checked=false;
				 document.express_booking.vipcarupgrade.checked=false;
				 
				 if(prvbus1 == true){
				 total2 = total2;
				 document.express_booking.vipcarupgrade.disabled=true;
				 document.express_booking.vipbusupgrade.disabled=true;
				 document.express_booking.vipbusupgrade.checked=false;
				 document.express_booking.vipcarupgrade.checked=false;
				
				 } 
				
			}
	  } else if((prvcar1 == true && prvbus1 == true)){
		  
		alert('Sorry! You cannot upgrade to both private car and private bus at the same time!'); 
		document.express_booking.vipbusupgrade.checked=false;
		document.express_booking.vipcarupgrade.checked=false;
		  
	  }
	total = total2;	
	//document.getElementById('toggleButton').style.display = "block"	
	}
	
	if (document.getElementById("total") && !isNaN(total))
		document.getElementById("total").innerHTML = "US$"+Math.round(total*100)/100;
		
     } else {
	 
	total = "0";
	//document.getElementById('toggleButton').style.display = "none" 
	
     }

}


function updateCost1(){
	var total2 = "0";
	var total = "";
	var acost1 = parseFloat(document.getElementById('hid_aprice1').value);
	var ccost1 = parseFloat(document.getElementById('hid_cprice1').value);
	var icost1 = parseFloat(document.getElementById('hid_iprice1').value);
	
	var aamount1 = parseFloat(document.getElementById('AdultCount1').value);
	var camount1 = parseFloat(document.getElementById('ChildrenCount1').value);
	var iamount1 = parseFloat(document.getElementById('InfantCount1').value);
	
	//private car and bus prices
	var pcarcost1 = parseFloat(document.getElementById('hid_iprvcar1').value);
    var pbuscost1 = parseFloat(document.getElementById('hid_iprvbus1').value);
	
	//private car and bus check box values
	var prvcar = document.confirmForm.vipcarupgrade1.checked;
	var prvbus = document.confirmForm.vipbusupgrade1.checked;
	
	//work out total amount of people
	var totalcount = aamount1 + camount1 + iamount1;
	//alert ('total passengers: '+totalcount+' checked value for car: '+prvcar+' checked value for the bus: '+prvbus)
	
	 //check if this is an ie webbrowser
	var is_this_ie = document.getElementById('is_ie').value;
	//alert(is_this_ie);
	if(is_this_ie == 'ie'){
	//alert(is_this_ie)
	//document.getElementById('ie_table').style.position = "relative"
	//document.getElementById('ie_table').style.bottom = "420px";
		
	}
	
	//show the private car and bus text
	document.getElementById('iprvcar1').style.display = "block"
	document.getElementById('iprvbus1').style.display = "block"
	document.getElementById('tour_days').style.display = "block"
	
	
	
	if(aamount1 > "0"){
	total2 = (acost1 * aamount1) + (ccost1 * camount1) + (icost1 * iamount1);
	

	
	if(total2 < 1){
		total = "0";
		
		document.getElementById('show_add_to_cart').style.display = "none"	
		
	} else {
	//work out private car and bus depending on the total numbe of people 2 for car , 6 for bus
	  if((prvcar != true || prvbus != true)){
		 if(totalcount <=2){
			 //check if there is a value in the pcarcost1 variable then hide or show respectivley
			  if(pcarcost1 < 1)
			  document.confirmForm.vipcarupgrade1.disabled=true;
			    else
			  document.confirmForm.vipcarupgrade1.disabled=false;	
				
			  if(prvcar == true ){
			   total2 = pcarcost1;
			   
			  //check if there is a value in the pcarcost1 variable then hide or show respectivley
			  if(pcarcost1 < 1)
			  document.confirmForm.vipcarupgrade1.disabled=true;
			    else
			  document.confirmForm.vipcarupgrade1.disabled=false;
				
			  
			   } 
			   
			 } else if(totalcount > 2){
			   document.confirmForm.vipcarupgrade1.disabled=true;
			   document.confirmForm.vipcarupgrade1.checked=false;
			   if(prvcar == true){
			   total2 = total2;
			   document.confirmForm.vipcarupgrade1.disabled=true;
			   document.confirmForm.vipcarupgrade1.checked=false;
			  
			   } 
		  } 
		  
	
			if(totalcount <=6){
				
				
				 //check if there is a value in the pbuscost1 variable then hide or show respectivley
			  if(pbuscost1 < 1)
			  document.confirmForm.vipbusupgrade1.disabled=true;
			    else
			  document.confirmForm.vipbusupgrade1.disabled=false;		
				
				
				if(prvbus == true ){
				 total2 = pbuscost1;
				 //check if there is a value in the pbuscost1 variable then hide or show respectivley
					if(pbuscost1 < 1)
					document.confirmForm.vipbusupgrade1.disabled=true;
					  else
					document.confirmForm.vipbusupgrade1.disabled=false;		
				
				 } 
				 
			   } else if(totalcount > 6){
				   
				 document.confirmForm.vipcarupgrade1.disabled=true;
				 document.confirmForm.vipbusupgrade1.disabled=true;
				 document.confirmForm.vipbusupgrade1.checked=false;
				 document.confirmForm.vipcarupgrade1.checked=false;
				 
				 if(prvbus == true){
				 total2 = total2;
				 document.confirmForm.vipcarupgrade1.disabled=true;
				 document.confirmForm.vipbusupgrade1.disabled=true;
				 document.confirmForm.vipbusupgrade1.checked=false;
				 document.confirmForm.vipcarupgrade1.checked=false;
				
				 } 
				
			}
	  } else if((prvcar == true && prvbus == true)){
		  
		alert('Sorry! You cannot upgrade to both private car and private bus at the same time!'); 
		document.confirmForm.vipbusupgrade1.checked=false;
		document.confirmForm.vipcarupgrade1.checked=false;
		  
	  }
	total = total2;	
	document.getElementById('show_add_to_cart').style.display = ""	
	}
	
	if (document.getElementById("total") && !isNaN(total))
		document.getElementById("total").innerHTML = "US$"+Math.round(total*100)/100;
		
     } else {
	 
	total = "0";
	document.getElementById('show_add_to_cart').style.display = "none" 
	
     }
	 
	

}

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 completeAT(b){
	url = 'confirm_booking.php?type=airport_transfer&ac='+document.express_booking.AdultCount.value
	url += '&cc='+document.express_booking.ChildrenCount.value
	url += '&ic='+document.express_booking.InfantCount.value
	url += '&ad='+document.express_booking.arrivaldate.value
	url += '&vipcarupgrade='+document.express_booking.vipcarupgrade.checked
	url += '&vipbusupgrade='+document.express_booking.vipbusupgrade.checked
	url += '&prvcarcost='+document.express_booking.hid_iprvcar.value
	url += '&prvbuscost='+document.express_booking.hid_iprvbus.value
	url += '&ht='+val+'&transfer_type='+transfer_type
	
	if (parseInt(document.express_booking.AdultCount.value) <= 0)
		return false;
	
	if (val <= 0)
		return false;

	Shadowbox.open({player:'iframe', content:''+url+'',height:560,width:500});

    return true;
}



function bookItem(pk_sequence_number,type){
	url = 'confirm_booking.php?itemid='+pitem_id+'&type='+type;
	
	Shadowbox.open({player:'iframe', content:''+url+'',height:560,width:600});
}


function addToBag(type, incomplete){
	url = 'display_bag.php?'
	
	if(document.forms[0].AdultCount)
		url += 'ac='+$("#AdultCount").val()
	
	if(document.forms[0].ChildrenCount)
		url += '&cc='+$("#ChildrenCount").val()
	
	if(document.forms[0].InfantCount)
		url += '&ic='+$("#InfantCount").val()
	
	if(document.forms[0].vipcarupgrade)
		url += '&vipcarupgrade='+ document.forms[0].vipcarupgrade.checked
		
	if(document.forms[0].vipbusupgrade)
		url += '&vipbusupgrade='+ document.forms[0].vipbusupgrade.checked
		
	
	if (type == "hotels"){
		url += 'ad='+ $("#checkindate").val()
		url += '&dd='+ $("#checkoutdate").val()
		url += '&ac='+ document.forms[0].adultcount.options[document.forms[0].adultcount.selectedIndex].value
		url += '&cc='+ document.forms[0].childrencount.options[document.forms[0].childrencount.selectedIndex].value
		url += '&rm='+ document.forms[0].roomscount.options[document.forms[0].roomscount.selectedIndex].value
	}
	
	if (type == "airport_transfer" && incomplete){
		url += '&ad='+document.forms[0].arrivaldate.value
		url += '&dd='+document.forms[0].departuredate.value
		url += '&ht='+document.forms[0].hotels.options[document.forms[0].hotels.selectedIndex].value
		url += '&aa='+document.forms[0].airlines_1.options[document.forms[0].airlines_1.selectedIndex].value
		url += '&af='+document.forms[0].flights_1.options[document.forms[0].flights_1.selectedIndex].value
		url += '&da='+document.forms[0].airlines_2.options[document.forms[0].airlines_2.selectedIndex].value
		url += '&df='+document.forms[0].flights_2.options[document.forms[0].flights_2.selectedIndex].value
	}
	if (type == "airport_transfer" && !incomplete){
		url += '&ht='+document.forms[0].hotels.options[document.forms[0].hotels.selectedIndex].value
	}
	
	if (type == "tours"){
		url += '&bd='+document.forms[0].bookingdate.value
	}
	
	url += '&key=i'
	url += '&type='+type
	
	if (document.getElementById("item"))
		url += '&itemid='+document.forms[0].item.value
	else
		url += '&itemid=-1'
	
	window.parent.location.href=url;
}

function addToBag1(type){
	
	
	url = 'display_bag.php?'
	
	
	url += 'ac='+$("#AdultCount1").val()
	
	if(document.forms[0].ChildrenCount1)
		url += '&cc='+$("#ChildrenCount1").val()
	
	if(document.forms[0].InfantCount1)
		url += '&ic='+$("#InfantCount1").val()
	url += '&bd='+document.forms[0].bookingdate1.value
	url += '&key=i'
	url += '&type='+type
	url += '&itemid='+document.forms[0].item.value
	window.parent.location.href=url;
	
}


function checkout(a){
	document.forms[0].action = a;
	document.forms[0].submit();	
}

function SetAllCheckBoxes(master)
{
	CheckValue = master.checked;
	if(!document.forms[0])
		return;
		
	var objCheckBoxes = document.forms[0].elements["CartItems[]"];
	
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	
	
	
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}

function validateremove(){

	var objCheckBoxes = document.forms[0].elements["CartItems[]"];
	
	var countCheckBoxes = objCheckBoxes.length;
	
	if(!countCheckBoxes)
		return objCheckBoxes.checked;
	else
		for(var i = 0; i < countCheckBoxes; i++)
				if (objCheckBoxes[i].checked)
					return true;
	
	return false;
}

function postSearch(){
	if((document.getElementById("search_origin").value == "-1")||(document.getElementById("search_origin").value == null))
		return false
}
function sendall(){

	url = 'display_bag.php?ad='+document.forms[0].arrivaldate.value
	url += '&dd='+document.forms[0].departuredate.value
	url += '&ht='+document.forms[0].hotels.options[document.forms[0].hotels.selectedIndex].value
	url += '&aa='+document.forms[0].airlines_1.options[document.forms[0].airlines_1.selectedIndex].value
	url += '&af='+document.forms[0].flights_1.options[document.forms[0].flights_1.selectedIndex].value
	url += '&da='+document.forms[0].airlines_2.options[document.forms[0].airlines_2.selectedIndex].value
	url += '&df='+document.forms[0].flights_2.options[document.forms[0].flights_2.selectedIndex].value
	url += '&com=update_flight'
	
	window.parent.location.href=url;

}


