function flight(dep_flight,arr_flight)
{
	$("#wait").show();
		$.ajax({
			   url:"get_city.php",
			   data:"dep_flight="+dep_flight+"&arr_flight="+arr_flight,
			   cache:false,
			   success:function(data)
			   {
				   $("#wait").hide();
				   if (data==1)
				   {
					   $("#destination").val();
					   $("#origin").val();
				   }
				   else
				   {
					   var str=new Array();
					   str=data.split(':');
					   $("#origin").val(str[0]);
					   $("#origincode").val(str[1]);
					   $("#originregioncode").val(str[2]);
					   $("#destination").val(str[3]);
					   $("#destcode").val(str[4]);
					   $("#destregioncode").val(str[5]);
					   
				   }
				   }
			   });
	}

/*$(document).ready(function(){
						  
		$.ajax({
				type:"POST",
				url:"xml1.php",
				cache: false,
				success: function(msg)
				{
				 $("#data").html(msg);
   				}
			   });
				$("#data").html("loading data...");
		
   });
*/
var browser=navigator.appVersion;
    $(document).ready(function(){
	$("#close").click(function()
	{
	$("#model").hide().fadeOut("slow");
	$("#show").hide().fadeOut("slow");	  
	});
						   
});

/*
 * Image preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.imagePreview = function(){	
	
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


function go_url(url)
{
var myWindow;
    var width = 930;
    var height = 630;
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
	top=top-25;
    var windowFeatures = "menubar=no,status=no, width=" + width + ",resizable=yes,scrollbars=1,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
    myWindow = window.open('top_cityflight.php?city='+url,"subWind", windowFeatures);
	
}

function show_img(city,lat,long)
{
	
		$.ajax({
				type:"POST",
				url:"send_mail.php",
				data:"lat="+lat+"&long="+long+"&city="+city,
				cache: false,
				success: function(msg)
				{
					
					$("#data_div").html("");
					$("#data_div").html(msg);
					$("#loader").hide().fadeOut("fast");
					if (browser.indexOf('MSIE 6.0')>0)
					$('html, body').animate({scrollTop:0}, 'slow');
   				}
		});
		$("#model").show().fadeIn("slow");
		$("#data_div").html("");
		$("#show").show().fadeIn("slow");
		$("#loader").show().fadeIn("fast");
}

function show_weather(city)
{
		$.ajax({
				type:"POST",
				url:"send_mail.php",
				data:"city_name="+city,
				cache: false,
				success: function(msg)
				{
					
					$("#data_div").html("");
					$("#data_div").html(msg);
					$("#loader").hide().fadeOut("fast");
					if (browser.indexOf('MSIE 6.0')>0)
					$('html, body').animate({scrollTop:0}, 'slow');
					
   				}
		});
		$("#model").show().fadeIn("slow");
		$("#data_div").html("");
		$("#show").show().fadeIn("slow");
		$("#loader").show().fadeIn("fast");
}


function show_terms()
{
var myWindow;
    var width = 350;
    var height = 150;
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
	top=top-30;
    var windowFeatures = "menubar=no,status=no, width=" + width + ",height="+height+",resizable=yes,scrollbars=1,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
    myWindow = window.open('terms.php',"subWind", windowFeatures);
	
}

