﻿/*script document*/
/*
 * csair.com v0.1
 * http://csair.com/
 *
 * Copyright (c) 2009 csair.com
 * 
 * Date: 2009-05-18 11:14:14 (GMT+08:00)
 * Revision: 1
 */

/*定义全局路径*/
var thisUrl = document.URL + window.location.search;
var thisdomain = document.domain;
var domain="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://";
var rooturl = domain+"www.csair.com/";
var haiwai = domain+"www.flychinasouthern.com";
var b2curl = domain+"ec.csair.com";
var b2cmiao = domain+"miao.csair.com";
if(thisdomain == "www.test.csair.com" || thisdomain == "ec.test.csair.com" || thisdomain.indexOf("10.")>=0 || thisdomain == "www.qa.flychinasouthern.com") {
	rooturl = domain+"www.test.csair.com:8081/";
	haiwai = domain+"www.qa.flychinasouthern.com";
	b2curl = domain+"ec.test.csair.com";
	b2cmiao = domain+"10.108.108.73";
}else if(thisdomain == "big5.csair.com"){
	rooturl = domain+"big5.csair.com/SuniT/www.csair.com/";
}else{}
function webPath(url) {
	var allstr = rooturl + url;
	return allstr;
}
function webPath_b2c(url) {
	var allstr = b2curl + url;
	return allstr;
}
function webPath_haiwai(url) {
	var allstr = haiwai + url;
	return allstr;
}
function webPath_b2cmiao(url) {
	var allstr = b2cmiao + url;
	return allstr;
}
/*end定义全局路径*/

/*节日背景图片*/
var bodybg = "background:#fff url('"+webPath('topAndFoot/bg_festival.jpg')+"') no-repeat top center;";
/*header节日背景图片*/
var header_bg = webPath('topAndFoot/logo_festival.jpg');

/*非节日背景*/
//var bodybg = "background:#fff url('"+webPath('topAndFoot/bg.jpg')+"') no-repeat top center;";
/*header背景图片*/
//var header_bg = webPath('topAndFoot/logoo.jpg');

var header_bg = webPath('');

/*头部菜单背景*/
//var menu_bg = "#D7F4F9 url("+webPath('cn/img/asia/bg_menu_0.jpg')+") left center repeat-x";
var menu_bg = "#D7F4F9 url("+webPath('cn/img/asia/bg_menu_0.jpg')+") left center repeat-x";

/*语言菜单链接颜色 深蓝色：#001D55 白色：#fff 深红色：#E60021 黑色：#333*/
var language_links = "#fff";

/*繁体版隐藏*/
ihost = window.location.host;
ibig5 = "big5.csair.com";

/*打开IE6页面缓存*/
(function(){
    try{
        var userAgent = navigator.userAgent.toLowerCase();
        var env = null;
        var ver = 0;
        env = userAgent.match(/msie ([\d.]+)/);ver = env ? parseInt(env[1], 10) : 0;
        if(ver == 6){
            try{ 
            	document.execCommand("BackgroundImageCache", false, true);
            }catch(e){}
        }
    }catch(e){}
})();

if(!(typeof($C) == "function")){
	function $C(ele){
		return document.createElement(ele);	
	}
}
if (!(typeof(addCssClass) == "function")) {
	function addCssClass(htmlEl,iclssName){//对元素添加class样式
		try{
	    htmlEl.className += " "+iclssName;
		}catch(e){}
	}
}

var iHeaderMenu = {
		menus_A : [
			{iText_A : "Home", id_A : "order", iLink_A : webPath("en/index.shtml")},
			{iText_A : "Booking and Services", id_A : "booking_id", iLink_A : webPath("en/index.shtml"), menus_B : [
				{iId_B:"1",iText_B : "Flights",tInfo : "Book CSN flights, fly smoothly all over the country" ,iLink_B : webPath("en/index.asp")},
				{iId_B:"2",iText_B : "Hotels",tInfo : "Book CSN Hotel, make your travel as warm as you are at home",iLink_B : "http://hotel.csair.com/modules/hotelen/hotelen_index.jsp"},
				{iId_B:"3",iText_B : "Vacations",tInfo : "CSN accompanies you to spend a relaxed holiday",iLink_B : "http://hotel.csair.com/vacation/indexEn.jsp"},
				{iId_B:"5",iText_B : "Online Check-in",tInfo : "Boarding check is handled online, making your travel easier and more convenient",iLink_B : "http://airport.csair.com/cki/app?language=en"},
				{iId_B:"6",iText_B : "Flight Status",tInfo : "Inquire the dynamics of flight that you are concerned about",iLink_B : webPath("en/booking_services/flight_dynamic_inquires.html")},
				{iId_B:"9",iText_B : "Baggage Inquire ",tInfo : "Your baggage position can be checked online" ,iLink_B : "http://airport.csair.com/outbaggage/app?service=external/OutWebHomeEn"}
			]},
			{iText_A : "Special Offers", id_A : "favourable_id", iLink_A : webPath("en/special_offers/index.html")},
			{iText_A : "Travel Information", id_A : "tour_id", iLink_A : webPath("en/travel_guide/index.html"), menus_B : [
			    {postion_b:"1",iId_B:"1",iText_B : "Pre-trip Preparation",tInfo : "Special Assistance、Payment Guide 、Car Rental 、Destination Information and others",iLink_B : webPath("en/travel_guide/pre-trip_preparation/index.asp")}, 
				{postion_b:"2",iId_B:"2",iText_B : "Airport Services",tInfo : "Lounge、Information on Airports、Boarding Procedures、Arrivals Procedures",iLink_B : webPath("en/travel_guide/airport_service/index.asp")},
				{postion_b:"3",iId_B:"3",iText_B : "On-board Service",tInfo : "Meals、Entertainment、Passenger Cabin Features 、Seat Map、Duty-Free Catalog and others",iLink_B : webPath("en/travel_guide/on-broad_service/index.asp")},
				{postion_b:"4",iId_B:"4",iText_B : "Baggage Service",tInfo : "Carry-on Baggage 、Checked Baggage 、Delayed, Lost, or Damaged",iLink_B : webPath("en/travel_guide/baggage_service/index.asp")
				 },
				{postion_b:"5",iId_B:"5",iText_B : "Flight Information",tInfo : "Online ticket booking、Booking hotline: 95539 、E-travel insurance ",iLink_B : webPath("en/travel_guide/flight_info/index.asp")},
				{postion_b:"6",iId_B:"6",iText_B : "Check-In Options",tInfo : "Online Check-in、SMS Check-in、Airport Self Check-in Kiosk",iLink_B : webPath("en/travel_guide/check-in_options/index.asp")},
				{postion_b:"7",iId_B:"7",iText_B : "Experience CSN",tInfo : "Enjoy perfect experiences that China Southern Airlines brings you",iLink_B : webPath("en/travel_guide/experience/index.html")}//體驗南航  
			]},
			{iText_A : "Sky Pearl Club", id_A : "skypearl_id", iLink_A : "http://skypearl.csair.com/en/"},
			{iText_A : "About Us", id_A : "abouccsn_id", iLink_A : webPath("en/about_csn/index.html"), menus_B : [
				{iId_B:"1",iText_B : "Company Profile",tInfo : "China Southern Airlines Company Limited is a member of SkyTeam Alliance" ,iLink_B : webPath("en/about_csn/profiles/profiles.html")},
				{iId_B:"2",iText_B : "Investor Relations",tInfo : "CSN-related stocks, monthly report, production data, performance reports and other information",iLink_B : webPath("en/investor/index.asp")},
				{iId_B:"3",iText_B : "CSN Cargo",tInfo : "Tangyi cargo system independently developed by CSN Cargo",iLink_B : webPath("en/about_csn/cargo/cargo.html")},
				{iId_B:"5",iText_B : "Social Responsibility Report ",tInfo : "Fully show CSN's social responsibility philosophy and practice to the society",iLink_B : webPath("en/about_csn/social_responsibility/social_res.html")},
				{iId_B:"6",iText_B : "Contact Us",tInfo : "Contact information of offices and sales agencies",iLink_B : webPath("en/about_csn/contact_us/index.html")}
			]}
		]
	}

/*判断网站宽度*/
function checkWidth(){
	this.width=function(){
		var ww1=777;
		if(thisUrl.toLowerCase().indexOf("skypearl.cs")>-1){ww1=960} //skypearl
		if(thisUrl.toLowerCase().indexOf("airport.csair.com/cki")>-1){ww1=900} //airport
		if(thisUrl.toLowerCase().indexOf("sp.cs")>-1){ww1=960} //sp 2009-09-21
		return ww1;
	}
	//return width;
	this.world=function(){
		var ww2=530;
		if(thisUrl.toLowerCase().indexOf("skypearl.cs")>-1){ww2=695} //skypearl
		if(thisUrl.toLowerCase().indexOf("airport.csair.com/cki")>-1){ww2=650} //airport
		if(thisUrl.toLowerCase().indexOf("sp.cs")>-1){ww2=710} //sp 2009-09-21
		return ww2;
	}
	
}
var topWidth=new checkWidth;


/*创建header头部*/
function header(){
	var hdDiv_id = $C("div");
	hdDiv_id.id = "headerId";
	hdDiv_id.style.cssText="width:"+topWidth.width()+"px;padding:0;line-height:1.5;font-size:12px;font-family:Arial, Helvetica, sans-serif;";
	
	var hdDiv = $C("div");
	addCssClass(hdDiv,"header");
	hdDiv.style.background = "url("+header_bg+")";
	hdDiv.style.height="78px"; 
	hdDiv.style.width=topWidth.width()+"px";
	hdDiv.style.position = "relative";
	hdDiv.style.margin="0 auto";
	hdDiv.style.zIndex = 5000;
	hdDiv.style.backgroundRepeat="no-repeat";
	
	var langDiv = $C("div");
	langDiv.id = "languages";
	//alert(topWidth.world())
	langDiv.style.cssText = "padding:5px 0px 5px 0;position:absolute;top:5px;right:0px;z-index:5001;";
	var a="h",b="ttp://www.",c="csair.com",gbUrl=a+b+c
	
	var langul = $C("ul");
	 langul.style.cssText="list-style:none; margin:0;padding:0;position:relative;z-index:5002;";
	 var langli = $C("li");
	 langli.style.cssText="cursor:pointer;margin:0;padding:0;position:absolute;text-align:center;position:relative;font-weight:normal;z-index:5003;";
	 
	 var langcn = $C("a");
	 langcn.href="#";
	 langcn.style.cssText="padding:3px 5px 3px 25px;float:left;position:relative;color:"+language_links+";display:block;z-index:5004;"
	 langcn.innerHTML = "<span style=''>English<img style='margin-left: 2px;vertical-align: middle;' src='"+webPath('topAndFoot/more_top.gif')+"'></span>";
	 langli.appendChild(langcn);
	 langli.onmouseover = function (){
		 if(!document.getElementById("langCont")){
		 var langContainer = $C("div");
		 langContainer.id = "langCont";
		 langContainer.style.zIndex = 5005;
		 //langContainer.style.cssText="z-index:5103";
		 langContainer.className = "langCont";
         langContainer.innerHTML = "<div class='leftPanel'><label class='panelTitle'>Your country</label><form name='langForm' id='langForm' method='POST' action='"+haiwai+"/index.php?SO_SITE_OFFICE_ID=HKGCZ12TK'><input name='lang' type='hidden' value=''/><select style='z-index:6103' name='country' id='country' onchange='countryClick(this);' size='6'><option value='Australia'>Australia</option><option value='Austria'>Austria</option><option value='Azerbaijan'>Azerbaijan</option><option value='Belgium'>Belgium</option><option value='Cambodia'>Cambodia</option><option value='China' selected='selected'>China</option><option value='Denmark'>Denmark</option><option value='Finland'>Finland</option><option value='France'>France</option><option value='Germany'>Germany</option><option value='Greece'>Greece</option><option value='Italy'>Italy</option><option value='Iran'>Iran</option><option value='India'>India</option><option value='Indonesia'>Indonesia</option><option value='Japan'>Japan</option><option value='Krygyzstan'>Krygyzstan</option><option value='Malaysia'>Malaysia</option><option value='Myanmar'>Myanmar</option><option value='Netherlands'>Netherlands</option><option value='Nigeria'>Nigeria</option><option value='Pakistan'>Pakistan</option><option value='peru'>Peru</option><option value='Philippines'>Philippines</option><option value='Poland'>Poland</option><option value='Portugal'>Portugal</option><option value='Russia'>Russia</option><option value='Saudi Arabia'>Saudi Arabia</option><option value='Scotland'>Scotland</option><option value='Singapore'>Singapore</option><option value='South Korea'>South Korea</option><option value='Spain'>Spain</option><option value='Sweden'>Sweden</option><option value='Switzerland'>Switzerland</option><option value='Tajikistan'>Tajikistan</option><option value='Thailand'>Thailand</option><option value='Turkmenistan'>Turkmenistan</option><option value='United Arab Emirates'>United Arab Emirates</option><option value='United States'>United States</option><option value='United Kingdom'>United Kingdom</option><option value='Uzberkistan'>Uzberkistan</option><option value='Vietnam'>Vietnam</option></select></form></div><div class='langspacer' ><!--tt-->&nbsp;</div><div class='rightPanel'><label class='panelTitle'>Your language</label><div style='height: 120px;'><ul class='sublangul'><li><a href='#' id='enlang' onclick='langClick(this)'>English</a></li><li style='display:none;' ><a href='#' id='frlang' onclick='langClick(this)'>Français</a></li><li style='display:none;' ><a href='#' id='nllang' onclick='langClick(this)'>Netherlands</a></li><li style='display:none;' ><a href='#' id='krlang' onclick='langClick(this)'>&#54620;&#44397;&#50612;</a></li><li style='display:none;' ><a href='#' id='jplang' onclick='langClick(this)'>日本語</a></li><li><a href='#' id='scnlang' onclick='langClick(this)'>简体中文</a></li><li><a href='#' id='tcnlang' onclick='langClick(this)'>繁體中文</a></li></ul></div></div>";
	 	 langli.appendChild(langContainer);
		 }else{
			 document.getElementById("langCont").style.display = "";
	     }
		 //langcn.style.cssText="border-top:1px solid #6BADE1;border-left:1px solid #6BADE1;border-right:1px solid #6BADE1;top:1px;padding:3px 5px 3px 25px;position:relative;color:"+language_links+";display:block;z-index:5006;background:#fff url("+webPath('topAndFoot/world.gif')+") no-repeat 5px scroll;"
		 langcn.style.cssText="border-top:1px solid #6BADE1;border-left:1px solid #6BADE1;border-right:1px solid #6BADE1;top:1px;padding:3px 5px 3px 25px;position:relative;color:"+language_links+";display:block;z-index:5006;"
	 }
	 langli.onmouseout = function (){
		 try{
		 document.getElementById("langCont").style.display = "none";
		 //langcn.style.cssText="padding:3px 5px 3px 25px;float:left;position:relative;color:"+language_links+";display:block;z-index:5004;background: url("+webPath('topAndFoot/world.gif')+") no-repeat 5px scroll;"
		 langcn.style.cssText="padding:3px 5px 3px 25px;float:left;position:relative;color:"+language_links+";display:block;z-index:5004;"
		 }catch(err){}
	 }
	 langul.appendChild(langli);
	 langDiv.appendChild(langul);
	 hdDiv.appendChild(langDiv);
	
	var logoLinkDiv = $C("div");
	logoLinkDiv.id = "logoLink";
	logoLinkDiv.style.cssText = "height:42px;border:0px solid #c1c1c1;position:absolute;top:24px;left:0px;width:266px;";
	logoLinkDiv.innerHTML = "<a href='"+webPath("en/index.asp")+"'><span style='width:266px;height:42px;display:block;cursor:pointer;'></span></a>";
	hdDiv.appendChild(logoLinkDiv);
	
	var Main_menu = $C("div");
	Main_menu.id = "Main_menu";
	addCssClass(Main_menu,"clearfix");
	Main_menu.style.background = menu_bg;
	Main_menu.style.borderBottom = "#C9DEE1 1px solid";
	Main_menu.style.padding = "1px 5px 2px 20px";
	Main_menu.style.height = "18px";
	Main_menu.style.margin = "5px 0 0 0";
	
	var iM_ul = $C("ul");
	iM_ul.id = "iM_ul_id";
	iM_ul.style.listStyle = "none"; 
	iM_ul.style.margin = "0"; 
	iM_ul.style.padding = "0";
	iM_ul.style.styleFloat  = "left"; //for IE
	iM_ul.style.cssFloat  = "left"; //for FF
	iM_ul.style.position = "relative";
	iM_ul.style.zIndex = 2000;
	
	var ileft =0;
	ihost==ibig5?ileft = 0:'';
	
	var subleft = -175;
	
	/*未加入企业客户之前*/
	//var ileft =-628;
	//ihost==ibig5?ileft = -580:'';

	
	for(i=0;i<iHeaderMenu.menus_A.length;i++){//一级菜单
		if(iHeaderMenu.menus_A[i].id_A=="help_id"){}else{
		var iM_li = $C("li");
		iM_li.style.styleFloat  = "left"; //for IE
		iM_li.style.cssFloat  = "left"; //for FF
		iM_li.style.cursor = "pointer";
		iM_li.style.margin = "0";
		iM_li.style.padding = "0";
		iM_li.style.textAlign="center";
		iM_li.style.position = "relative";
		//iM_li.style.lineHeight = "21px";
		iM_li.style.left = ileft+"px";
		iM_li.style.zIndex = 1800;
		
		
		if(iHeaderMenu.menus_A[i].id_A=="booking_id"){
			ileft = ileft+160;
		}else if(iHeaderMenu.menus_A[i].id_A=="favourable_id"){
			ileft = ileft+130;
		}else if(iHeaderMenu.menus_A[i].id_A=="tour_id"){
			ileft = ileft+150;
		}else if(iHeaderMenu.menus_A[i].id_A=="skypearl_id"){
			ileft = ileft+110;
		}else{ileft = ileft+100;}
		
		
		//ileft = ileft+100;
		iM_li.style.top = "0";
		iM_li.id = iHeaderMenu.menus_A[i].id_A;
		
		var iM_a = $C("a");
		iM_a.innerHTML = iHeaderMenu.menus_A[i].iText_A;
		if(iHeaderMenu.menus_A[i].id_A=="onlineserver"){
			iM_a.href = iHeaderMenu.menus_A[i].iLink_A;
		}else{
			//iM_a.href = iHeaderMenu.menus_A[i].iLink_A+"?par_1="+iHeaderMenu.menus_A[i].id_A;	
			iM_a.href = iHeaderMenu.menus_A[i].iLink_A;	
		}
		iM_a.id = iHeaderMenu.menus_A[i].id_A+"BL";
		if(iHeaderMenu.menus_A[i].id_A=="booking_id"){
			iM_a.style.cssText = "width:150px;text-align:center;display:block;position:absolute;height:20px;";
		}else if(iHeaderMenu.menus_A[i].id_A=="favourable_id"){
			iM_a.style.cssText = "width:120px;text-align:center;display:block;position:absolute;height:20px;";
		}else if(iHeaderMenu.menus_A[i].id_A=="tour_id"){
			iM_a.style.cssText = "width:120px;text-align:center;display:block;position:absolute;height:20px;";
		}else{iM_a.style.cssText = "width:100px;text-align:center;display:block;position:absolute;height:20px;";}
		
		if(iHeaderMenu.menus_A[i].id_A=="onlineserver"&&ihost==ibig5){iM_a.style.display='none';iM_a.style.width ="0";}
		iM_li.appendChild(iM_a );
		
		iM_li.onmouseover = function (){//显示二级菜单
			if(!document.getElementById(this.id + "_b")){
			for(n=0;n<iHeaderMenu.menus_A.length;n++){
				if(iHeaderMenu.menus_A[n].id_A == this.id){
					if(iHeaderMenu.menus_A[n].menus_B){
						var iM_ul_b = $C("ul");
						iM_ul_b.id = this.id +"_b";
						iM_ul_b.style.cssText = "display:block;margin:0;padding:10px 0px 0px 10px;border:1px solid #6BADE1;background:#fff;position:absolute;top:20px;z-index:1100;cursor:default; background:url("+webPath('topAndFoot/bg-menu-skytrax.jpg')+") repeat-x;";
						if(n==2){
						   subleft = -280;
						}else if(n==3){
						   subleft = -410;
						}else if(n==4){
						   subleft = -480;
						}else if(n==5){
						   subleft = -670;		
						}else{subleft = -120;}
						iM_ul_b.style.left = subleft+"px";
						iM_ul_b.style.width = "765px"; 
						iM_ul_b.style.zIndex = 1100;
						for(k=0;k<iHeaderMenu.menus_A[n].menus_B.length;k++){
							var iM_li_b = $C("li");
							iM_li_b.style.styleFloat  = "left"; //for IE
							iM_li_b.style.cssFloat  = "left"; //for FF
							iM_li_b.style.cssText="display:inline;height:60px;line-height:16px;cursor:default;margin:0;padding:0 15px;text-align:left;width:160px;float:left; background:url("+webPath('topAndFoot/pagelink_hover.gif')+") no-repeat left 5px;"
							var iM_a_b = $C("a");
							iM_a_b.innerHTML = iHeaderMenu.menus_A[n].menus_B[k].iText_B;
							//iM_a_b.href = iHeaderMenu.menus_A[n].menus_B[k].iLink_B+"?par_1="+iHeaderMenu.menus_A[n].id_A+"&par_2="+iHeaderMenu.menus_A[n].menus_B[k].iId_B;
							iM_a_b.href = iHeaderMenu.menus_A[n].menus_B[k].iLink_B;
							iM_a_b.style.cssText="font-weight:bold;";
							if(iHeaderMenu.menus_A[n].menus_B[k].iText_B=="联盟伙伴"){
								iM_a_b.target = "_blank";	
							}
							
							if(iHeaderMenu.menus_A[n].menus_B[k].iText_B=="业绩发布会"){
								iM_a_b.target = "_blank";	
							}
							
							iM_li_b.appendChild(iM_a_b );
							
							/*if(iHeaderMenu.menus_A[n].menus_B[k].iText_B=="体验南航"){
								new_s = $C("span");
								new_s.style.color="red";
								new_s.innerHTML=" New"
								iM_li_b.appendChild(new_s);
							}*/
							
							var iM_p_b = $C("p");
							iM_p_b.innerHTML = iHeaderMenu.menus_A[n].menus_B[k].tInfo;
							iM_p_b.style.cssText="font-weight:normal; color:#333;margin:0;padding:0;text-align:left;text-indent:0;font-size:9px;line-height:12px;";
							iM_a_b.appendChild(iM_p_b);
							
							iM_ul_b.appendChild(iM_li_b);
						}

						if(!window.XMLHttpRequest){//IE6
							var menuIframe = $C('iframe');
							menuIframe.id = this.id+"ifra";
							menuIframe.name = this.id+"ifra";
							menuIframe.setAttribute('frameborder', '0', 0);
							if(n==2){
							   subleft = -185;
							}else if(n==3){
							   subleft = -335;	
							}else if(n==4){
							   subleft = -395;	
							}else if(n==5){
							   subleft = -580;		
							}else{subleft = -85;}
							menuIframe.style.left = subleft+"px";
							menuIframe.style.top = "20px";
							if(n==0){
								menuIframe.height = "0px";
								menuIframe.width = "0px"
							}else{
								menuIframe.height = "130px";
								menuIframe.width = "680px"
							}
							menuIframe.style.position = "absolute";
							menuIframe.style.index = 1090;
							document.getElementById(this.id).appendChild(menuIframe);
						}
						document.getElementById(this.id+"BL").style.border = "1px solid #6BADE1";
						document.getElementById(this.id+"BL").style.borderBottom = "none";
						document.getElementById(this.id+"BL").style.background = "url("+webPath('topAndFoot/bg-menu-skytrax.jpg')+") repeat-x";
						document.getElementById(this.id+"BL").style.display = "block";
						document.getElementById(this.id+"BL").style.color = "#D9242B";
						document.getElementById(this.id+"BL").style.zIndex = "1111";
						document.getElementById(this.id).appendChild(iM_ul_b);
					}
				}
			}
			}else{
				document.getElementById(this.id + "_b").style.display = "";	
				document.getElementById(this.id+"BL").style.border = "1px solid #6BADE1";
				document.getElementById(this.id+"BL").style.borderBottom = "none";
				document.getElementById(this.id+"BL").style.background = "url("+webPath('topAndFoot/bg-menu-skytrax.jpg')+") repeat-x";
				document.getElementById(this.id+"BL").style.display = "block";
				document.getElementById(this.id+"BL").style.color = "#D9242B";
				document.getElementById(this.id+"BL").style.zIndex = "1111";
				if(!window.XMLHttpRequest){//IE6
						document.getElementById(this.id+"ifra").style.display = "block";
				}
			}
		}
		};
		iM_li.onmouseout = function (){//隐藏子菜单
			if(document.getElementById(this.id + "_b")){
					document.getElementById(this.id + "_b").style.display = "none";
					document.getElementById(this.id+"BL").style.border = "none";
					document.getElementById(this.id+"BL").style.background = "none";
					document.getElementById(this.id+"BL").style.display = "block";
					document.getElementById(this.id+"BL").style.color = "#fff";
					if(!window.XMLHttpRequest){//IE6
						document.getElementById(this.id+"ifra").style.display = "none";
					}
			}
		};
		
		
		iM_ul.appendChild(iM_li);
		
	}
	
	Main_menu.appendChild(iM_ul);
	
	hdDiv_id.appendChild(hdDiv);
	hdDiv_id.appendChild(Main_menu);
	
	if(bodybg){
		document.body.style.cssText = bodybg;
	}
	
	return hdDiv_id;
	
}

/*pop提示信息 2010-12-24*/
function closepop(){document.getElementById("poptips_id").style.display = "none";}

/*创建footer内容*/
function footer(){
	var ftDiv = $C("div");
	addCssClass(ftDiv,"footer");
	ftDiv.id = "footerId";
	ftDiv.style.cssText="text-align:center;padding:13px 10px 10px;font-family:Arial, Helvetica, sans-serif;font-size:12px;";
	if(thisUrl.toLowerCase().indexOf("www.csair.com/cn/index.asp")>0||thisUrl.toLowerCase().indexOf("csair.com:8081/cn/index.asp")>0){salephone="95539";hotline="销售";}else{salephone="4006695539";hotline="网站";} 
	//ftDiv.style.width=topWidth.width();
	//ftDiv.style.background = "#EFF4F8 url("+webPath("/img/bg.jpg")+") 0 -553px"
	ftDiv.innerHTML = "<div class='footer'><a href="+webPath('en/investor/stock/index.asp')+">Investor</a> | <a href="+webPath('en/help/book/index.asp')+">Notes for Ticket Purchase</a> | <a href="+webPath('en/help/book/ticket_02.asp')+" target='_blank'>Terms of Service </a> | <a href="+webPath('en/help/faq/index.asp')+" target='_blank'>FAQ</a>| <a href="+webPath('/en/about_csn/contact_us/index.html')+" target='_blank'>Contact Us</a><br />Website:<a href='http://www.csair.com/enurlResponse.asp?url=029' target='_blank'>www.csair.com</a> | E-Mail:webmaster@csair.com | Hotline:+86-20-95539<br />Copyright (C) 1997-2012 China Southern Airlines Company Limited All rights reserved.<br /> ICP License Code for Management: Guangdong Province B2-20030328";
	return ftDiv;
}
function onlineService(){
	window.open('http://b.qq.com/webc.htm?new=0&sid=800095539&o=中国南方航空&q=7', '_blank', 'height=502, width=644,toolbar=no,scrollbars=no,menubar=no,status=no');
}
function onlineService2(){//网友交谈
  window.open('http://b4.qq.com/webc.htm?new=0&sid=800095539&o=www.csair.com&q=1', '_blank', 'height=502, width=644,toolbar=no,scrollbars=no,menubar=no,status=no');
}
 
/*创建城市IFrame*/
function cityList(){
			if (!document.getElementById("showCityIframe")){
				var cityIframe=$C("iframe");
				cityIframe.id="showCityIframe";
				cityIframe.name="showCityIframe";
				cityIframe.className="iframeTextDropdown";
				cityIframe.style.padding = "0";
				cityIframe.style.display = "none";
				cityIframe.style.left = "0";
				cityIframe.style.top = "0";
				cityIframe.style.overflow = "hidden";
				cityIframe.style.position = "absolute";
				cityIframe.style.width = "222px";
				cityIframe.style.zIndex = 1010;
				cityIframe.src=webPath("citylist/city_en.html");
				cityIframe.setAttribute('frameborder','0',0); 
				document.body.appendChild(cityIframe);
			}
}

//----------------------------------------------------------

function setP(){
	if($("#middlerId").length<=0){
		var ibody = $("body").children();
		$("<div></div>").attr({"class":"middler clearfix","id":"middlerId"}).appendTo("body");
		ibody.appendTo("#middlerId");
	}
	var wrapperId = $("<div></div>").attr({"id":"wrapper"}).appendTo("body");
	publicTop();
	publicFoot();
	$("#publicTop").appendTo("#wrapper");
	$("#middlerId").appendTo("#wrapper");
	$("#publicBot").appendTo("#wrapper");
}

function publicTop(){
		var headDiv=document.getElementsByTagName('HEAD').item(0);
		var styleDiv=document.createElement('link');
		styleDiv.href=webPath('css/iMenu.css');
		styleDiv.rel='stylesheet';
		styleDiv.type='text/css';
		headDiv.appendChild(styleDiv);
	
		var topDiv = $C("div");
		topDiv.id = "publicTop";
		topDiv.style.width=topWidth.width()+"px";
		topDiv.style.marginRight="auto";
		topDiv.style.marginLeft="auto";
		document.body.appendChild(topDiv);
		
		var headhtml=new header();
		//alert(headhtml.hdDiv.style.width);
		topDiv.appendChild(headhtml);
		document.getElementById("headId")
}

function publicFoot(){
		var footHtml=new footer();
		footHtml.id = "publicBot";
		footHtml.style.marginRight="auto";
		footHtml.style.marginLeft="auto";
		footHtml.style.fontSize="12px";
		footHtml.style.width=topWidth.width()-20+"px";
		document.body.appendChild(footHtml);
}


/******************* online Server************************/
var IPCheck = "";

function ActiveAgent_Launch(question)
{
	var x = 744;
    var y = 50;
    var height = 2000;
    var width = 280;
    var parentHeight = 20000;
    var parentWidth = 744;
	var ActiveAgent_PageName = 'http://sms.csair.com/robot/OnlineAgent.html';

    var agentAlign = 'Right';
    
    if(question=='Save yourself a call and type your question here.')
    {
        question = null;
    }
    
	x = screen.availWidth - width;
	var ActiveAgent_AgentWindow = window.open(ActiveAgent_PageName, 'ActiveAgentCS', 'width='+width+'px,height='+height+'px,left='+x+',top='+y+',yes,scrollbars=no,menubar=no,resizable=yes,location=no,status=yes,titlebar=no,toolbar=no');
	
	LayoutParent(screen.availWidth - width, parentHeight, width, agentAlign);
	ActiveAgent_AgentWindow.focus();
};


function LayoutParent(agentParentWidth, agentParentHeight, agentWidth, agentAlign)
{
	var win = window;
	var w;
	var h;
	
	// set parent width
	if (agentParentWidth > 0 && agentParentWidth < screen.availWidth)
	{		
		w = agentParentWidth;
	}
	else
	{
		w = screen.availWidth-agentWidth;
	}
	
	// set parent height
	if (agentParentHeight > 0)
	{
		h = agentParentHeight;
		if (h > screen.availHeight)
		{
			h = screen.availHeight;
		}
	}
	else
	{
		h = screen.availHeight;
	}
	
	
	var left;
	if (agentAlign == 'Right') // Leave space on left or right side?
	{
		left = 0;
	}
	else
	{
		// figure agent window overlap if there's not enough width for both
		if (agentWidth + parseInt(w) > screen.availWidth)
		{
			left = screen.availWidth - w;
		}
		else
		{
			left = agentWidth;
		}
	}
	try
	{
		win.moveTo(0,0); // This helps it work better when it's maximized... (IE seems to get confused sometimes)
		win.resizeTo(w,h);
		win.moveTo(left, 0);

	}
	catch(e) // Permission denied? Happens if we change out of our domain, we should make sure it doesn't happen in any other situation, or comment out throw below
	{
		//if (e.message.indexOf('denied') == -1) // if not permission denied, throw the error
		if ( e.message )
		{
			if(e.message.indexOf('denied') == -1)
			{
				throw e;
			}
		}
		else
		{
			if( e.toString().indexOf('denied') == -1 )
			{
				throw e;
			}
		}
	}
};

function setCookie(sName, sValue, oExpires, sPath, sDomain, bSecure) {
	/*
	sName:cookie名
	sValue:cookie值
	oExpires:cookie保存天数，即多少天过期
	sPath:cookie保存路径
	sDomain:cookie域名
	bSecure:
	*/
	var sCookie = sName + "=" + encodeURIComponent(sValue);
	if(oExpires){
		var Days = oExpires;   //cookie 将被保存天数
    	var iepx  = new Date();//获得当前时间
    	iepx.setTime(iepx.getTime()+Days*24*60*60*1000);//换成毫秒
		sCookie+=";expires="+iepx.toGMTString();
	}else{
		var Days = 180;   //cookie 将被保存天数
    	var iepx  = new Date();//获得当前时间
    	iepx.setTime(iepx.getTime()+Days*24*60*60*1000);//换成毫秒
		sCookie+=";expires="+iepx.toGMTString();
	}
	if(sPath){sCookie+=";path="+sPath;}
	if(sDomain){sCookie+=";domain="+sDomain;}
	if(bSecure){sCookie+=";secure";}
	document.cookie = sCookie;
}

function getCookie(sName){
	var sRE = "(?:; )?" + sName + "=([^;]*);?";
	var oRE = new RegExp(sRE);
	if (oRE.test(document.cookie)){
		return decodeURIComponent(RegExp["$1"]);
	}else{
		return null;
	}
}

function setCookieHrefUrl(this_a){
	var ithis_a = this_a.id;
	if(ithis_a=="jianti_w"){
	setCookie("mycsairsite", "jianti", "", "/", "csair.com", "");
	window.location.href=webPath('cn/index.asp');
	}
	if(ithis_a=="fanti_w"){
	setCookie("mycsairsite", "fanti", "", "/", "csair.com", "");
	window.location.href='http://big5.csair.com/SuniT/www.csair.com/cn/index.asp';
	}
	if(ithis_a=="english_w"){
	setCookie("mycsairsite", "english", "", "/", "csair.com", "");
	window.location.href='http://www.csair.com/urlResponse.asp?url=Languages01';
	}
	if(ithis_a=="world_w"){
	setCookie("mycsairsite", "world", "", "/", "csair.com", "");
	window.location.href=webPath("world/index.html");
	}
}

// when user visit www.csair.com, we'll need this function to set the language choosen by user
function setLang(lang){
	var xmlhttp;
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
  	}
	else
  	{// code for IE6, IE5
  	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
  	xmlhttp.open('GET',"/setlang.aspx?lang="+lang, false);
  	xmlhttp.send();
        //alert(xmlhttp.responseText);
}

function callSetLang(i){
    if(i==1){
      setLang('cn');
    }
    if(i==2){
      setLang('tw');
    }
    if(i==3){
      setLang('den');
    }
}

function countryClick(obj){
    var country = obj.value;
    if(!country){
      return;
    }
    
    var cnt = country.toLowerCase();
    var frlang = document.getElementById('frlang');
    var enlang = document.getElementById('enlang');
    var nllang = document.getElementById('nllang');
    var jplang = document.getElementById('jplang');
    var krlang = document.getElementById('krlang');
    frlang.parentNode.style.display = "";
    enlang.parentNode.style.display = "";
    nllang.parentNode.style.display = "";
    jplang.parentNode.style.display = "";
    krlang.parentNode.style.display = "";
    if(cnt=="japan"){
      frlang.parentNode.style.display = "none";
      nllang.parentNode.style.display = "none";
      krlang.parentNode.style.display = "none";    
    }else if(cnt=="south korea"){
      frlang.parentNode.style.display = "none"; 
      jplang.parentNode.style.display = "none"; 
      nllang.parentNode.style.display = "none"; 
    }else if(cnt=="france"){
      nllang.parentNode.style.display = "none"; 
      jplang.parentNode.style.display = "none"; 
      krlang.parentNode.style.display = "none"; 
    }else if(cnt=="netherlands"){
      jplang.parentNode.style.display = "none"; 
      krlang.parentNode.style.display = "none"; 
      frlang.parentNode.style.display = "none"; 
    }else{
      frlang.parentNode.style.display = "none";
      nllang.parentNode.style.display = "none";
      krlang.parentNode.style.display = "none"; 
      jplang.parentNode.style.display = "none"; 
    }
}
function langClick(obj){
	var country = document.getElementById("country").value;
	var url = "";
    var lang = obj.id;
    var langInput = document.getElementsByName("lang")[0];
    if(!lang){
      return;
    }
    if(lang=="enlang"){
      langInput.value = "en";
	  if(country && country == "China"){
		//url = "http"+"://"+"www.csair.com/en/index.asp";
		url = webPath('en/index.shtml');
	  }
    }
    if(lang=="frlang"){
      langInput.value = "fr";
    }
    if(lang=="jplang"){
      langInput.value = "jp";
    }
    if(lang=="nllang"){
      langInput.value = "nl";
    }
    if(lang=="krlang"){
      langInput.value = "kr";
    }
    if(lang=="scnlang"){
      langInput.value = "scn";
	  if(country && country == "China"){
		url = "http"+"://"+"www.csair.com/cn/index.shtml";
	  }
    }
    if(lang=="tcnlang"){
      langInput.value = "tcn";
	  if(country && country == "China"){
		url = "http"+"://"+"big5.csair.com/SuniT/www.csair.com/cn/index.shtml";
	  }
    }
	if(country && country == "China"){
		window.location.href = url;
	}else{
		document.getElementById("langForm").submit();  
	}
}
function showLangsBox(obj){
	var lang_cont = document.getElementById("langCont");
	if(lang_cont.style.display && lang_cont.style.display!="none"){
		lang_cont.style.display="none";
	}else{
		lang_cont.style.display="block";
	}
}


/*webtrends analytics*/
setTimeout('setwtid()',3500);
    function setwtid(){
    if (typeof(initime) != "undefined") var initime = new Date().getTime();
    
    var gDomain="sdc.csair.com";	// SDC Production Mode Domain
    var gDcsId="dcs82b9ujitigdu3gaykxw0hn_5p6b";
    var gFpc="WT-FPC";
    var gConvert=true;
    var gWTIDJS=window.document.createElement("script"); 
    window.document.getElementsByTagName("head")[0].appendChild(gWTIDJS); 
    if ((typeof(gConvert)!="undefined")&&gConvert&&(document.cookie.indexOf(gFpc+"=")==-1)&&(document.cookie.indexOf("WTLOPTOUT=")==-1)){
      gWTIDJS.src="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+gDomain+"/"+gDcsId+"/wtid.js"; 
    }
     }
    
setTimeout('setsdcjs()',4000);
    function setsdcjs(){
      var jDomain="www.csair.com"; //地址应该为js文件的域名
      var js_path="/topAndFoot/sdc_gd.js"; //地址应该为js文件的路径
      var domain="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+jDomain;
      var SDC_js=document.createElement("script");
      SDC_js.src=domain+js_path;
      var headElem=document.getElementsByTagName("head")[0];
      headElem.appendChild(SDC_js);
     }
