/*
 *  UGANDA PROJECT  -  Javascript
 *  
 * Copyright (c) 2008 ServerMX Online (servermxonline.com)
 * $Date: 2008-12-13 $
 */


 
	var vfrm = 0;
	var vto = 0;
	var vluggage=0;
	
 
	function check_babyrequired() {
	
		if ( document.getElementById('passenger_babyseatrequired').checked==true ) alert(" Additional USD 5.00 Is Added For Baby Seat");
	
	}
	
	function SubmitInstantQ() {
	
		if  ( (vfrm>0) && (vto>0) && (vluggage>0) ) {  
			
			window.location="bookings.php?f="+vfrm+"&t="+vto+"&l="+vluggage;
		
		}
		else alert("Please complete the form!");
		
	} 
	
	function fromChange() {
	
		var vfrm =$("#fairport").attr("value");
		 
		if ((vto==1)) return false; 
		
		if (vfrm>1) {
			
			vto = 0;
			
			$.ajax({
			  url: "to.option.php",
			  type:'GET', 
			  data: 'istrue=1',
			  cache: false,
			  beforeSend: function(html) {
				$("#to_container").html('<br/><img src="images/loading.gif" border=0><br/><br/>'); 
			  },
			  success: function(html) {
				
				$("#to_container").html(' '+html+' ');
				
			  }		  
			});			
		
		}  else { 
		
			 
			vto = 0;
			
			$.ajax({
			  url: "to.option.php",
			  type:'GET', 
			  data: 'istrue=0',
			  cache: false,
			  beforeSend: function(html) {
				$("#to_container").html('<br/><img src="images/loading.gif" border=0><br/><br/>'); 
			  },
			  success: function(html) {
				
				$("#to_container").html(' '+html+' ');
				
			  }		  
			});	
			
		} 
		
	}
 
	function check_data() {

		vfrm =  $("#fairport").attr("value");
		vto =   $("#tairport").attr("value");
		vluggage =  $("#luggage").attr("value");
		
		

		if  ( (vfrm>0) && (vto>0) && (vluggage>0) ) { 
		
			if (vfrm==vto) { alert("Destination To Same Area is not yet allowed"); document.getElementById("tairport").focus(); $("#display_price").html('USD 0.00');  
			
			
				$.ajax({
				  url: "noairport.option.php",
				  type:'GET', 
				  data: 'istrue=0',
				  cache: false,
				  beforeSend: function(html) {
					$("#to_container").html('<br/><img src="images/loading.gif" border=0><br/><br/>'); 
				  },
				  success: function(html) {
					
					$("#to_container").html(' '+html+' ');
					
				  }		  
				});			
			
			return false; }
			
			get_price();
		
		}

	} 
	
	function get_price() {
	
		var fpara ='t='+vto+'&f='+vfrm+'&l='+vluggage;
		
			
		$.ajax({
		  url: "fetch.cost.php",
		  type:'GET', 
		  data: fpara,
		  cache: false,
		  beforeSend: function(html) {
			$("#display_price").html('<br/><img src="images/loading.gif" border=0><br/><br/>'); 
		  },
		  success: function(html) {
			
			$("#display_price").html(' '+html+' ');
			
		  }		  
		});
		
		
	}
