﻿function chghelp(id) {
    var obj = document.getElementById(id);
    if (obj.style.display == "") {
        obj.style.display = "none";
    }
    else {
        obj.style.display = "";
    }
}

//showmap('airportmap','sichuan')        
function showmap(id,provincename) {
var mapairport = new Array();
mapairport="beijing,beijing,北京,首都,北京市|beijing,beijing,北京,,北京市|xianggang,hongkong,香港,,香港特别行政区|shanghai,shanghai,上海,虹桥,上海市|shanghai,shanghai,上海,浦东,上海市|guangdong,guangzhou,广州,白云,广东省|shanxi,xian,西安,咸阳,陕西省|guangdong,shenzhen,深圳,宝安,广东省|yunnan,kunming,昆明,巫家坝,云南省|sichuan,chengdu,成都,双流,四川省|chongqing,chongqing,重庆,江北,重庆市|shanxi,xian,西安,咸阳,陕西省|zhejiang,hangzhou,杭州,萧山,浙江省|fujian,xiamen,厦门,高崎,福建省|shandong,qingdao,青岛,流亭,山东省|jiangsu,nanjing,南京,禄口,江苏省|hunan,changsha,长沙,黄花,湖南省|hubei,wuhan,武汉,天河,湖北省|shandong,jinan,济南,遥墙,山东省|liaoning,dalian,大连,周水子,辽宁省|liaoning,shenyang,沈阳,桃仙,辽宁省|xinjiang,wulumuqi,乌鲁木齐,地窝铺,新疆维吾尔自治区|tianjin,tianjin,天津,滨海,天津市|henan,zhengzhou,郑州,新郑,河南省|aomen,macao,澳门,,澳门特别行政区|heilongjiang,haerbin,哈尔滨,太平国际,黑龙江省|hainan,sanya,三亚,凤凰,海南省|hainan,haikou,海口,美兰,海南省|guangxi,nanning,南宁,吴墟,广西壮族自治区|guizhou,guiyang,贵阳,龙洞堡,贵州省|fujian,fuzhou,福州,长乐,福建省|sanxi,taiyuan,太原,武宿,山西省|zhejiang,wenzhou,温州,永强,浙江省|neimenggu,huhehaote,呼和浩特,白塔,内蒙古自治区|jilin,changchun,长春,龙嘉,吉林省|jiangxi,nanchang,南昌,昌北,江西省|anhui,hefei,合肥,骆岗,安徽省|zhejiang,ningbo,宁波,栎社,浙江省|ningxia,yinchuan,银川,河东,宁夏回族自治区|shandong,yantai,烟台,莱山,山东省|gansu,lanzhou,兰州,中川,甘肃省|hebei,shijiazhuang,石家庄,正定,河北省|guangxi,guilin,桂林,两江,广西壮族自治区|jiangsu,wuxi,无锡,硕放,江苏省|beijing,beijing,北京,南苑,北京市|yunnan,jinghong,景洪,嘎洒,云南省|fujian,jinjiang,晋江,泉州,福建省|yunnan,lijiang,丽江,三义,云南省|qinghai,xining,西宁,曹家堡,青海省|guangdong,zhuhai,珠海,三灶,广东省|guangdong,shantou,汕头,外砂,广东省|sichuan,jiuzhaigou,九寨沟,九寨黄龙,四川省|neimenggu,eerduosi,鄂尔多斯,,内蒙古自治区|xizang,lasa,拉萨,贡嘎,西藏自治区|shanxi,yulin,榆林,榆阳,陕西省|neimenggu,baotou,包头,,内蒙古自治区|jiangsu,changzhou,常州,奔牛,江苏省|xinjiang,kuerle,库尔勒,,新疆维吾尔自治区|shandong,weihai,威海,大水泊,山东省|jiangsu,xuzhou,徐州,观音,江苏省|zhejiang,huangyan,黄岩,台州路桥,浙江省|jiangsu,lianyungang,连云港,白塔阜,江苏省|hubei,yichang,宜昌,三峡,湖北省|jilin,yanji,延吉,朝阳川,吉林省|hunan,zhangjiajie,张家界,荷花,湖南省|xinjiang,akesu,阿克苏,温宿,新疆维吾尔自治区|yunnan,tengchong,腾冲,驼峰,云南省|xinjiang,nalati,那拉提,,新疆维吾尔自治区|shandong,linyi,临沂,,山东省|neimenggu,chifeng,赤峰,,内蒙古自治区|guangdong,zhanjiang,湛江,,广东省|xinjiang,Yining,伊宁,,新疆维吾尔自治区|shandong,dongying,东营,,山东省|guangxi,beihai,北海,福城,广西壮族自治区|xinjiang,kashen,喀什,,新疆维吾尔自治区|sichuan,jinyang,绵阳,南郊,四川省|neimenggu,hailaer,海拉尔,东山,内蒙古自治区|sanxi,yuncheng,运城,关公,山西省|anhui,huangshan,黄山,屯溪,安徽省|fujian,nanping,南平,武夷山,福建省|zhejiang,yiwu,义乌,,浙江省|yunnan,diqing,迪庆,香格里拉,云南省|zhejiang,zhoushan,舟山,普陀山,浙江省|heilongjiang,mudanjiang,牡丹江,海浪,黑龙江省|sichuan,yibin,宜宾,莱坝,四川省|sichuan,xichang,西昌,青山,四川省|neimenggu,xilinhaote,锡林浩特,,内蒙古自治区|sichuan,luzhou,泸州,兰田坝,四川省|shandong,jining,济宁,,山东省|sanxi,changzhi,长治,王村,山西省|heilongjiang,daqing,大庆,萨尔图,黑龙江省|xinjiang,hetian,和田,,新疆维吾尔自治区|gansu,jiayuguan,嘉峪关,,甘肃省|henan,luoyang,洛阳,北郊,河南省|guangxi,liuzhou,柳州,白莲,广西壮族自治区|heilongjiang,qiqihaer,齐齐哈尔,三家子,黑龙江省|henan,nanyang,南阳,姜营,河南省|hebei,qinhuangdao,秦皇岛,山海关,河北省|jiangsu,nantong,南通,兴东,江苏省|yunnan,mangshi,芒市,德宏,云南省|jiangxi,ganzhou,赣州,黄金,江西省|jiangxi,jinggangshan,井岗山,井冈山,江西省|yunnan,dali,大理,,云南省|neimenggu,Wuhai,乌海,,内蒙古自治区|chongqing,wanzhou,万州,,重庆市|hubei,xiangfan,襄樊,刘集,湖北省|jiangxi,jingdezhen,景德镇,罗家,江西省|hebei,handan,邯郸,,河北省|hubei,enshi,恩施,许家坪,湖北省|shanxi,yanan,延安,二十里铺,陕西省|zhejiang,quzhou,衢州,,浙江省|jiangxi,jiujiang,九江,庐山,江西省|heilongjiang,jixi,鸡西,兴凯湖,黑龙江省|anhui,fuyang,阜阳,,安徽省|neimenggu,wulanhaote,乌兰浩特,,内蒙古自治区|gansu,dunhuang,敦煌,,甘肃省|sanxi,datong,大同,倍加造,山西省|anhui,anqing,安庆,大龙山,安徽省|shandong,weifang,潍坊,二十里堡,山东省|jiangsu,yancheng,盐城,,江苏省|ningxia,zhongwei,中卫,香山,宁夏回族自治区|shanxi,ankang,安康,五里铺,陕西省|yunnan,baoshan,保山,云端,云南省|liaoning,dandong,丹东,浪头,辽宁省|gansu,qingyang,庆阳,,甘肃省|shanxi,hanzhong,汉中,西关,陕西省|liaoning,jinzhou,锦州,小岭子,辽宁省|neimenggu,manzhouli,满洲里,西郊,内蒙古自治区|yunnan,simao,思茅,普洱,云南省|xinjiang,tacheng,塔城,,新疆维吾尔自治区|hebei,tangshan,唐山,三女河,河北省|neimenggu,tongliao,通辽,,内蒙古自治区|jilin,changbaishan,长白山,,吉林省|xinjiang,kuche,库车,,新疆维吾尔自治区|hunan,huaihua,怀化,芷江,湖南省|heilongjiang,jiamusi,佳木斯,东郊,黑龙江省|sichuan,daxian,达县,达川河市坝,四川省|hunan,changde,常德,斗姆湖,湖南省|xizang,changdu,昌都,,西藏自治区|guizhou,Xingyi,兴义,,贵州省|xinjiang,qiemo,且末,,新疆维吾尔自治区|heilongjiang,heihe,黑河,,黑龙江省|guangdong,foshan,佛山,沙堤,广东省|qinghai,geermu,格尔木,,青海省|sichuan,guangyuan,广元,,四川省|heilongjiang,yichuan,伊春,林都,黑龙江省|hunan,yongzhou,永州,零陵,湖南省|yunnan,lincang,临沧,,云南省|xizang,linzhi,林芝,米林,西藏自治区|guangdong,meixian,梅县,,广东省|sichuan,nanchong,南充,南茺,四川省|sichuan,panzhihua,攀枝花,,四川省|qinghai,yushu,玉树,巴塘,青海省|guangxi,wuzhou,梧州,长州岛,广西壮族自治区|yunnan,wenshan,文山,普者黑,云南省|yunnan,zhaotong,昭通,,云南省|heilongjiang,mohe,漠河,,黑龙江省|gansu,tianshui,天水,,甘肃省|guizhou,tongren,铜仁,大兴,贵州省|hubei,Shashi,沙市,,湖北省|neimenggu,Linxi,林西,,内蒙古自治区|guizhou,libo,荔波,,贵州省|chongqing,LiangPing,梁平,,重庆市|sichuan,kangding,康定,,四川省|xinjiang,Kanasi,喀纳斯,,新疆维吾尔自治区|xinjiang,kelamayi,克拉玛依,,新疆维吾尔自治区|fujian,longyan,龙岩,连城冠豸山,福建省|neimenggu,erlianhaote,二连浩特,赛乌苏,内蒙古自治区|xinjiang,hami,哈密,,新疆维吾尔自治区|guizhou,LIPING,黎平,,贵州省|jilin,Jilin,吉林,二台子,吉林省|guangxi,Baise,百色,,广西壮族自治区|xinjiang,aletai,阿勒泰,,新疆维吾尔自治区|guizhou,Anshun,安顺,,贵州省|liaoning,anshan,鞍山,,辽宁省|xinjiang,bole,博乐,阿拉山口,新疆维吾尔自治区|liaoning,chaoyang,朝阳,,辽宁省".split('|');
var displaystring="";
var jishu=0;
for (i = 0; i < mapairport.length; i++)
{
    var onemapairport=mapairport[i].toString().split(',');
    if(onemapairport[0]==provincename)
    {   
        if(jishu==0)
        {
            displaystring=displaystring+'<b>'+onemapairport[4]+'主要机场</b><ol>';
        }
        displaystring=displaystring+'<li><a href=\"http://jipiao.oklx.com/'+onemapairport[1]+'\" target=\"_blank\" title=\"点击进入'+onemapairport[2]+onemapairport[3]+'机场\">'+onemapairport[2]+onemapairport[3]+'机场</a></li>';
        jishu++;
    }
}
displaystring=displaystring+'</ol>';
document.getElementById(id).innerHTML = displaystring;
}



function show(id) {
document.getElementById(id).style.display = 'block';
}
function hide(id) {
document.getElementById(id).style.display = 'none';
}
function changediv(id, content) {
document.getElementById(id).innerHTML = content;
}

function HotelSearchSubit() {
var returnresult=false;
var category;
var   obj   =   eval("jipiaoform.radio");        
for (j = 0; j < obj.length; j++) {
    if (obj[j].checked) {
        category = obj[j].value;
    }
}

    if (category == 'oneway') {
        if (document.forms["jipiaoform"].CnFirstCity.value != '中文/拼音') {
            if (document.forms["jipiaoform"].CnSecondCity.value != '中文/拼音') {
                if (isDate(document.forms["jipiaoform"].CnFirstCityDate.value)) {
                    if (document.forms["jipiaoform"].CnFirstCity.value != document.forms["jipiaoform"].CnSecondCity.value) {
                        returnresult= true;
                    }
                    else {
                        alert('“出发城市”不能与“目的城市”重名');
                    }
                }
                else {
                    alert('请选择“出发日期”，或者输入出发日期 参数格式要求：yyyy-mm-dd  如2009-12-08');
                }
            }
            else {
                alert('请输入选择“目的城市”名称，再搜索');
            }
        }
        else {
            alert('请输入选择“出发城市”名称，再搜索');
        }
    }

    if (category == 'airreturn') {
        if (document.forms["jipiaoform"].CnFirstCity.value != '中文/拼音') {
            if (document.forms["jipiaoform"].CnSecondCity.value != '中文/拼音') {
                if (isDate(document.forms["jipiaoform"].CnFirstCityDate.value)) {
                    if (isDate(document.forms["jipiaoform"].CnSecondCityDate.value)) {
                        if (document.forms["jipiaoform"].CnFirstCity.value != document.forms["jipiaoform"].CnSecondCity.value) {
                            returnresult= true;
                        }
                        else {
                            alert('“出发城市”不能与“目的城市”重名');
                        }
                    }
                    else {
                        alert('请选择“返程日期”，或者输入返程日期 参数格式要求：yyyy-mm-dd  如2009-12-08');
                    }   
                }
                else {
                    alert('请选择“出发日期”，或者输入出发日期 参数格式要求：yyyy-mm-dd  如2009-12-08');
                }
            }
            else {
                alert('请输入选择“目的城市”名称，再搜索');
            }
        }
        else {
            alert('请输入选择“出发城市”名称，再搜索');
        }
    }

    if (category == 'muti') {
        if (document.forms["jipiaoform"].CnFirstCity.value != '中文/拼音') {
            if (document.forms["jipiaoform"].CnSecondCity.value != '中文/拼音') {
                if (isDate(document.forms["jipiaoform"].CnFirstCityDate.value)) {
                    if (document.forms["jipiaoform"].CnThreeCity.value != '中文/拼音') {
                        if (isDate(document.forms["jipiaoform"].CnSecondCityDate.value)) {
                            if (document.forms["jipiaoform"].CnThreeCity.value != document.forms["jipiaoform"].CnSecondCity.value) {
                                if (document.forms["jipiaoform"].CnFirstCity.value != document.forms["jipiaoform"].CnSecondCity.value) {
                                    returnresult= true;
                                }
                                else {
                                    alert('“出发城市”不能与“中转城市”重名');
                                }
                            }
                            else {
                                alert('“中转城市”不能与“目的城市”重名');
                            }
                        }
                        else {
                            alert('请选择“中转日期”，或者输入中转日期 参数格式要求：yyyy-mm-dd  如2009-12-08');
                        }
                    }
                    else {
                        alert('请输入选择“目的城市”名称，再搜索'); ;
                    }   
                }
                else {
                    alert('请选择“出发日期”，或者输入出发日期 参数格式要求：yyyy-mm-dd  如2009-12-08');
                }
            }
            else {
                alert('请输入选择“中转城市”名称，再搜索');
            }
        }
        else {
            alert('请输入选择“出发城市”名称，再搜索');
        }
    }
    return returnresult;

}


//验证给定的日期是否合法   ,参数格式要求：yyyy-mm-dd 可以根据情况更改正则表达式
function isDate(oStartDate) {
    //对日期格式进行验证 要求为2000-2099年  格式为 yyyy-mm-dd 并且可以正常转换成正确的日期
    var pat_hd = /^20\d{2}-((0[1-9]{1})|(1[0-2]{1}))-((0[1-9]{1})|([1-2]{1}[0-9]{1})|(3[0-1]{1}))$/;

    try {
        if (!pat_hd.test(oStartDate)) { throw "日期非法！"; }
        var arr_hd = oStartDate.split("-");
        var dateTmp;
        dateTmp = new Date(arr_hd[0], parseFloat(arr_hd[1]) - 1, parseFloat(arr_hd[2]));
        if (dateTmp.getFullYear() != parseFloat(arr_hd[0]) || dateTmp.getMonth() != parseFloat(arr_hd[1]) - 1 || dateTmp.getDate() != parseFloat(arr_hd[2])) {
            throw "日期非法！";
        }
    }
    catch (ex) {
        if (ex.description)
        { return false; }
        else
        { return false; }
    }
    return true;
}

function JipiaoSearchSubit() {
var returnresult=false;
var category;
var   obj   =   eval("jipiaoform.radio");        
for (j = 0; j < obj.length; j++) {
    if (obj[j].checked) {
        category = obj[j].value;
    }
}

    if (category == 'oneway') {
        if (document.forms["jipiaoform"].CnFirstCity.value != '中文/拼音') {
            if (document.forms["jipiaoform"].CnSecondCity.value != '中文/拼音') {
                if (isDate(document.forms["jipiaoform"].CnFirstCityDate.value)) {
                    if (document.forms["jipiaoform"].CnFirstCity.value != document.forms["jipiaoform"].CnSecondCity.value) {
                        returnresult= true;
                    }
                    else {
                        alert('“出发城市”不能与“目的城市”重名');
                    }
                }
                else {
                    alert('请选择“出发日期”，或者输入出发日期 参数格式要求：yyyy-mm-dd  如2009-12-08');
                }
            }
            else {
                alert('请输入选择“目的城市”名称，再搜索');
            }
        }
        else {
            alert('请输入选择“出发城市”名称，再搜索');
        }
    }

    if (category == 'airreturn') {
        if (document.forms["jipiaoform"].CnFirstCity.value != '中文/拼音') {
            if (document.forms["jipiaoform"].CnSecondCity.value != '中文/拼音') {
                if (isDate(document.forms["jipiaoform"].CnFirstCityDate.value)) {
                    if (isDate(document.forms["jipiaoform"].CnSecondCityDate.value)) {
                        if (document.forms["jipiaoform"].CnFirstCity.value != document.forms["jipiaoform"].CnSecondCity.value) {
                            returnresult= true;
                        }
                        else {
                            alert('“出发城市”不能与“目的城市”重名');
                        }
                    }
                    else {
                        alert('请选择“返程日期”，或者输入返程日期 参数格式要求：yyyy-mm-dd  如2009-12-08');
                    }   
                }
                else {
                    alert('请选择“出发日期”，或者输入出发日期 参数格式要求：yyyy-mm-dd  如2009-12-08');
                }
            }
            else {
                alert('请输入选择“目的城市”名称，再搜索');
            }
        }
        else {
            alert('请输入选择“出发城市”名称，再搜索');
        }
    }

    if (category == 'muti') {
        if (document.forms["jipiaoform"].CnFirstCity.value != '中文/拼音') {
            if (document.forms["jipiaoform"].CnSecondCity.value != '中文/拼音') {
                if (isDate(document.forms["jipiaoform"].CnFirstCityDate.value)) {
                    if (document.forms["jipiaoform"].CnThreeCity.value != '中文/拼音') {
                        if (isDate(document.forms["jipiaoform"].CnSecondCityDate.value)) {
                            if (document.forms["jipiaoform"].CnThreeCity.value != document.forms["jipiaoform"].CnSecondCity.value) {
                                if (document.forms["jipiaoform"].CnFirstCity.value != document.forms["jipiaoform"].CnSecondCity.value) {
                                    returnresult= true;
                                }
                                else {
                                    alert('“出发城市”不能与“中转城市”重名');
                                }
                            }
                            else {
                                alert('“中转城市”不能与“目的城市”重名');
                            }
                        }
                        else {
                            alert('请选择“中转日期”，或者输入中转日期 参数格式要求：yyyy-mm-dd  如2009-12-08');
                        }
                    }
                    else {
                        alert('请输入选择“目的城市”名称，再搜索'); ;
                    }   
                }
                else {
                    alert('请选择“出发日期”，或者输入出发日期 参数格式要求：yyyy-mm-dd  如2009-12-08');
                }
            }
            else {
                alert('请输入选择“中转城市”名称，再搜索');
            }
        }
        else {
            alert('请输入选择“出发城市”名称，再搜索');
        }
    }
    return returnresult;

}


function nav(thisObj,Num){
if(thisObj.className == "at")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
  if (i == Num)
  {
   thisObj.className = "at"; 
      document.getElementById(tabObj+"_c_"+i).style.display = "block";
      try{
      document.getElementById(tabObj+"_m_"+i).style.display = "block";}
      catch(e){}
  }else{
   tabList[i].className = "not"; 
   document.getElementById(tabObj+"_c_"+i).style.display = "none";
      try{
   document.getElementById(tabObj+"_m_"+i).style.display = "none";}
      catch(e){}
  }
} 
}

function nav1(thisObj,Num){
if(thisObj.className == "at")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
  if (i == Num)
  {
   thisObj.className = "at"; 
      document.getElementById(tabObj+"_c_"+(i+2)).style.display = "block";
      try{
      document.getElementById(tabObj+"_m_"+(i+2)).style.display = "block";}
      catch(e){}
  }else{
   tabList[i].className = "not"; 
   document.getElementById(tabObj+"_c_"+(i+2)).style.display = "none";
      try{
   document.getElementById(tabObj+"_m_"+(i+2)).style.display = "none";}
      catch(e){}
  }
} 
}
