/*
 * @(#)jQuery.CEA.flightinfo.js
 *       
 * 系统名称：东航电子商务国内B2C系统
 * 版本号：1.0
 * 
 * Copyright (c)  TravelSky
 * All Rights Reserved.
 * 
 * 作者：bjiang
 * 创建日期：Nov 2, 2009
 * 
 * 功能描述：显示机型信息
 * 公用方法描述：
 *      $(".a_flightnumber").jFlightInfo()        
 *    
 * 修改人：
 * 修改日期：
 * 修改原因：
 * 
 * 
 */
;
(function($)
{
    var info = new Array();
    info['737'] = 'B737-300(2)';
    info['AB6'] = 'A300-600';
    info['738'] = 'B737-800(1)';
    info['777'] = 'none';
    info['M82'] = 'none';
    info['340'] = 'A340-600';
    info['300'] = 'A300-600';
    info['CRJ'] = 'none';
    info['346'] = 'A340-600';
    info['321'] = 'A321';
    info['772'] = 'none';
    info['77W'] = 'none';
    info['320'] = 'A320';
    info['73C'] = 'B737-300(1)';
    info['70C'] = 'none';
    info['733'] = 'B737-300(2)';
    info['M90'] = 'MD-90';
    info['767'] = 'none';
    info['JET'] = '机型未定';
    info['310'] = 'A319';
    info['319'] = 'A319';
    info['739'] = 'none';
    info['EMB'] = 'none';
    
    $.fn.jFlightInfo = function(options)
    {
        var $this = $(this);
        var windowid = "flightinfo";
        var outtime=null;
        var _show=false;
        var show = function(obj)
        {
            var $img;
            if(info[$.trim($(obj).text().toUpperCase())]=='none'||typeof info[$.trim($(obj).text().toUpperCase())]==='undefined')
            {
                return false;
            }
            else
            {
               $img = $('<img src="/mu/images/ac_family_' + info[$.trim($(obj).text().toUpperCase())] + '.jpg"></img>');
            }
            var objwidth = 348;
            var offsetleft = $(obj).offset().left-148;
            var offsettop = $(obj).offset().top + $(obj).innerHeight();
            var $popwin = $.msgbox.msgbox(windowid, 500, 200, null, $img);
            $popwin.bind('mouseenter',function()
            {
                clearTimeout(outtime);
                outtime=null;
            });
            $popwin.bind('mouseleave',function()
            {
                $("#" + windowid).remove();
            });
            $popwin.css({
                "top": offsettop + 4 + "px",
                "left": offsetleft + "px"
            }).addClass("popwin_" + windowid);
            $popwin.find("#close").html("关闭");
        }
        
        $(this).live('click',function()
        {
            show(this);
            return false;
        });

        $(this).live('mouseout',function()
        {
            outtime = setTimeout(function()
            {
                $("#" + windowid).remove();
            },
            100);
        });
    }
})(jQuery);
