// JavaScript Document
;(function($){
		   $.fn.jFlightInfo=function(options){
			   var settings={};
			   var op=$.extend(settings,options);
			   var $this=$(this);
			   var windowid="flightinfo";
			   var checkExternalClick=function(event){
				   var $target = $(event.target);
				   if ($target.parents('#' + windowid).length==0){
					   $("#"+windowid).remove();
					   }
				   }
			   
			   var initFlightInfo=function(){
				   $(document).mousedown(function(event){checkExternalClick(event)});
				   }
			   initFlightInfo();	 
			   
			   
			   var showPopWin=function(obj){
				   var $container_right=$(obj).parents("#container_right");
				   var objwidth=348;
				   var offsetleft=$(obj).offset().left;//$container_right.offset().left+$container_right.width()-15-348+30;
				   if (offsetleft+objwidth>$container_right.offset().left+$container_right.width()-15 || offsetleft<0){offsetleft=$container_right.offset().left+$container_right.width()-15-348+30}
				   var offsettop=$(obj).offset().top+$(obj).innerHeight();
				   //alert($container_right.offset().left)
				   $.get(
						 "../images/flightinfo.html",
						 function(data){
							 
							 var $popwin=$.msgbox.popupwin(windowid,348,100,$(obj).attr("plain"),data).css({"top":offsettop+4+"px","left":offsetleft+"px"}).addClass("popwin_"+windowid);
							 $popwin.find("#close").html("关闭");
//							 $popwin.find(".button").click(function(){//点击绑定状态
//																	$(this).parent().parent().parent().find("tr:last").find("td").html("谢谢你定制短消息")//写提示消息
//																	$(this).parent().parent().parent().find("tr:first").remove();//吧输入框去掉
//																	//$popwin.find("#mobilephone").val($(obj).attr("value")+"ssss")
//																	})
							 }
						 )				   
				   }
			   
			   return $(this).click(function(){showPopWin(this);return false;})
			   
			   
			   }
		   
		   
		   
		   
		   })( jQuery );
