
//增加广告 add by minjiang 09-8-17
var ap_header = new function() {
    var hostname = document.location.host.toLowerCase();
    if (hostname.indexOf("secure.elong") > -1) {
        hostname = hostname.replace("secure.elong", "travel.elong");
    }

    var headerimagepath = "http://" + hostname + "/flights";
    var leagueoperation = JS_CONST_HEAD.LEAGUEOPERATION;
    var card_no = JS_CONST_HEAD.CARD_NO;
    var default_card_no = JS_CONST_HEAD.DEFAULT_CARD_NO;
    var hotel_ad_display = JS_CONST_HEAD.HOTELADDISPLAY;
    var air_ad_display = JS_CONST_HEAD.AIRADDISPLAY;
    //Public
    this.imagepath = headerimagepath;
    var hotel_ad = (hotel_ad_display & 16) == 16; //是否显示酒店头广告
    var air_ad = (air_ad_display & 16) == 16; //是否显示机票头广告

    this.lable_list = function() {
        var url, focus = 0, focuses = 0;
        var hotel = 2, flight = 4, tour = 8,ihotel=16;
        var result = "";
        url = document.location.href.toLowerCase();
		  if ((hotel | leagueoperation) == leagueoperation)	//
        {
            //if ( focuses==0 ) focus=1;
            //else focus=0;
            focus = (focus == 0 && url.indexOf("/hotels/") >= 0 ? 1 : 0); focuses += focus;
            result += lable_item(focus, "国内酒店", "http://" + hostname + "/hotel/index_cn.html?campaign_id=" + card_no);
        }
        if ((hotel | leagueoperation) == leagueoperation)	//如果可以有酒店，就可以有点评
        {
            focus = (focus == 0 && url.indexOf("/hotelreviews/") >= 0 ? 1 : 0); focuses += focus;
            result += lable_item(focus, "酒店点评", "http://" + hostname + "/hotelreviews/default.aspx?campaign_id=" + card_no);
        }
        if ((flight | leagueoperation) == leagueoperation)	//
        {
            focus = (focus == 0 && url.indexOf("/flights/default.aspx") >= 0 ? 1 : 0); focuses += focus;
            result += lable_item(focus, "国内机票", "http://" + hostname + "/flight/index_cn.html?campaign_id=" + card_no);
        }
        if ((flight | leagueoperation) == leagueoperation)	//
        {
            focus = (focus == 0 && url.indexOf("/flights/default2.aspx") >= 0 ? 1 : 0); focuses += focus;
            result += lable_item(focus, "国际机票", "http://" + hostname + "/iflight/cn/index.aspx?campaign_id=" + card_no);
        }
        /*	度假暂时关闭
        if ( (tour|leagueoperation) == leagueoperation )	//
        {
        focus = ( focus==0&&url.indexOf("/tours/")>=0 ? 1:0); focuses +=focus;
        result += lable_item(focus,"度&nbsp;假","http://travel.elong.com/tours/index.aspx?campaign_id=" + card_no);
        }
        */
      
		if ((ihotel | leagueoperation) == leagueoperation)	//
        {
            //if ( focuses==0 ) focus=1;
            //else focus=0;
            focus = (focus == 0 && url.indexOf("/globalhotel/") >= 0 ? 1 : 0); focuses += focus;
            result += lable_item(focus, "国际酒店", "http://" + hostname + "/globalhotel/index.html?campaign_id=" + card_no) ;
        }
        //确保联盟网站只少有一项功能，一项都没有，转到elong的网站。
        if (result == "") document.location.href = document.location.href + "?campaign_id=" + defaultcardno;
        else return result;
        return result;
    }
    this.ad_show = function() {
        var url, focus = 0, focuses = 0;
        var hotel = 2, flight = 4, tour = 8,ihotel=16;
        var result = "";
        url = document.location.href.toLowerCase();
//        if (((flight | leagueoperation) == leagueoperation) && url.indexOf("/flights") >= 0)	//机票广告
//        {
//            if (air_ad) {
//                //result += "<script type='text/javascript' src='http://elong.allyes.com/main/adfshow?user=Elong|air|banner_468x60&db=elong&border=0&local=yes&js=ie'></script>";
//                result += "<iframe marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" width=\"468\" height=\"60\" scrolling=\"no\" src=\"http://elong.allyes.com/main/adfshow?user=Elong|xiaofen|banner468X60_h&db=elong&border=0&local=yes\">";
//                result += "<noscript><a href=\"http://elong.allyes.com/main/adfclick?user=Elong|xiaofen|banner468X60_h&db=elong\"><img src=\"http://elong.allyes.com/main/adfshow?user=Elong|xiaofen|banner468X60_h&db=elong\" width=\"468\" height=\"60\" border=\"0\"></a></noscript></iframe>";
//            }
//            else {
//                result += "";
//            }
//        }
//        if (((hotel | leagueoperation) == leagueoperation) && url.indexOf("/hotels/") >= 0)	////酒店 广告
//        {
//            if (hotel_ad) {

//                //result += "<script type='text/javascript' src='http://elong.allyes.com/main/adfshow?user=Elong|hotel|banner_468x60&db=elong&border=0&local=yes&js=ie'></script>";
//                result += "<iframe marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" width=\"468\" height=\"60\" scrolling=\"no\" src=\"http://elong.allyes.com/main/adfshow?user=Elong|xiaofen|banner468X60_h&db=elong&border=0&local=yes\">";
//                result += "<noscript><a href=\"http://elong.allyes.com/main/adfclick?user=Elong|xiaofen|banner468X60_h&db=elong\"><img src=\"http://elong.allyes.com/main/adfshow?user=Elong|xiaofen|banner468X60_h&db=elong\" width=\"468\" height=\"60\" border=\"0\"></a></noscript></iframe>";
//            }
//            else {
//                result += "";
//            }
        //        }
      //  result += "<iframe marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" width=\"468\" height=\"60\" scrolling=\"no\" src=\"http://elong.allyes.com/main/adfshow?user=Elong|xiaofen|banner468X60_h&db=elong&border=0&local=yes\"></iframe>";
        result += "<iframe marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" width=\"468\" height=\"60\" allowtransparency=\"true\" style=\"background-color=transparent\" scrolling=\"no\" src=\"http://elong.allyes.com/main/adfshow?user=Elong|xiaofen|banner468X60_h&db=elong&border=0&local=yes\"></iframe>";
        //result += "<noscript><a href=\"http://elong.allyes.com/main/adfclick?user=Elong|xiaofen|banner468X60_h&db=elong\"><img src=\"http://elong.allyes.com/main/adfshow?user=Elong|xiaofen|banner468X60_h&db=elong\" width=\"468\" height=\"60\" border=\"0\"></a></noscript></iframe>";
 	//result += "</iframe>";

        return result;
    }
    //Private
    function lable_item(focus, text, url) {

        var lable;
        var imagename, style;
        if (focus == 1) {
            imagename = "focus.jpg";
            style = " font-size:12px; text-decoration:none; ";
        }
        else {
            imagename = "blur.jpg";
            style = "color:#fff; font-size:12px; text-decoration:none;";
        }
        //		lable="<td width=\"2\" background=\"" + headerimagepath + "\/images\/left_" + imagename + "\"><\/td>\n" +
        //			"<td width=\"45\" background=\"" + headerimagepath + "\/images\/bg_" + imagename + "\"><a href=\"" + url + "\" style=\"" + style + "\">" + text + "<\/a><\/td>\n" +
        //			"<td width=\"10\" background=\"" + headerimagepath + "\/images\/right_" + imagename + "\"><\/td>\n" +
        //			"<td width=\"2\"><\/td>";	
        lable = "<td width=\"64\"  background=\"" + headerimagepath + "\/images\/" + imagename + "\" style=\"no-repeat;width:65px;height:26px;text-align:center;\"><a href=\"" + url + "\" style=\"" + style + "\">" + text + "</a></td>"
        return lable;
    }
}
document.writeln("<center>");
document.writeln("<table width=\"960\" border=\"0\"  cellpadding=\"0\" cellspacing=\"0\">");
document.writeln("<tr>");
document.writeln("<td width=\"276\"  bgcolor=\"#004183\"><img src=\"" + ap_header.imagepath + "\/images\/logo.gif\"  width=\"276\" height=\"76\" border=\"0\"/></td>");

document.writeln("<td style=\"background:url(" + ap_header.imagepath + "\/images\/logoground.gif) repeat-x;width:800px;height:76px;text-align:center;\" valign=\"top\" align=\"right\">");
document.writeln("<table width=\"100%\"><tr><td align=\"right\">");
document.writeln("<!--AdForward Begin:-->");
document.writeln(ap_header.ad_show());
document.writeln("<!--AdForward End--> ");
document.writeln("</td>");
document.writeln("<td width=\"15\">");
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
document.writeln("<table width=\"960\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
document.writeln("<tr align='left'>");
document.writeln("<td style=\"background:url(" + ap_header.imagepath + "\/images\/tdgroud.gif) repeat-x;width:776px;height:26px;\"><table width=\"300\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
document.writeln("<tr>");
document.writeln("<td width=\"15\"></td>");
document.writeln(ap_header.lable_list());
document.writeln("<td>&nbsp;</td>");
document.writeln("</tr>");
document.writeln("</table></td>");
document.writeln("</tr>");
document.writeln("</table>");
document.writeln("</center>")
