﻿
function getByid(id)
{
    if (document.getElementById) {
        return document.getElementById(id);
    } 
    else if (document.all) 
    {
        return document.all[id];
    } 
    else if (document.layers)
    {
        return document.layers[id];
    } 
    else {
        return null;
    }
}
function GetUrl() {
    var CurPath = window.document.location.pathname.toLowerCase();
    var id;
    id = CurPath.replace(/^\/([^\.\/]+)[\/\.]{1}.+$/, "$1");
    if (id == '/' || id == '')
        id = "index";
    if (document.getElementById(id))
        document.getElementById(id).className = "cs_nav02 cs_navlink";
}
 window.onload = function(){GetUrl(); };


 

    // childname内容的id，childshow内容显示样式，childhide内容不可见样式，cursel当前数字，n总数字
    // columnname栏目的id, colshow栏目显示的样式, colhide栏目隐藏的样式
function setTab(cur, show, hide) {

   var num =0;
   var childid;
   var fatherli;
   for (num = 0; num < 7; num++) {
       childid = document.getElementById("div_" + num);
       fatherli = document.getElementById("li_" + num);
       if (childid && fatherli) {
           if (num == cur) {
               childid.className = (childid.className == show) ? hide : show;
               fatherli.className = "lxcont02_t01";
           }
           else {
               childid.className = hide;
               fatherli.className = "lxcont02_t0202";
           }
 
       }

   }
 
}

function ShowScenery(cur, show, hide) {

    var num = 0;
    var id;
    for (num = 0; num < 5; num++) {
        id = document.getElementById("div" + num);
        if (id) {
            if (num == cur)
                id.className = (id.className == show) ? hide : show;
            else
                id.className = hide;

        }

    }

}

 
    function showhide(idchild, childshow, childhide, i, idcol, colshow, colhide) {

        var childmenu = document.getElementById(idcol + i);
        var childcon = document.getElementById(idchild + i);
        var hide = document.getElementById("Hidden" + i);
        if (childcon) {
            if (childcon.className == childshow) {
                childcon.className = childhide;
                childmenu.className = colhide;

            }
            else {
                childcon.className = childshow;
                childmenu.className = colshow;

            }

        }
    }

    // childname内容的id，childshow内容显示样式，childhide内容不可见样式，cursel当前数字，n总数字
    // columnname栏目的id, colshow栏目显示的样式, colhide栏目隐藏的样式
    function setssTab(childname, childshow, childhide, cursel, n, txtid, message, url) {
        for (i = 1; i <= n; i++) {
            var childmenu = document.getElementById(childname + i);
            var childcon = document.getElementById(childname + i);
            var columnmenu = document.getElementById(txtid);
            var columncon = document.getElementById(txtid);
            if (childcon) {
                childmenu.className = i == cursel ? childshow : childhide;
                //  childcon.style.display = i == cursel ? "block" : childhide;
                document.getElementById("formsearch").action = url;
            }
            if (columncon) {
                columnmenu.value = message;
            }
        }
    }

    function IsNull(id) {
        var v = document.getElementById(id).value;
        if (v == "") {
            alert("关键字不能为空！");
            document.getElementById(id).focus();
            return false;
        }
        else
            return true;
    }

    function ShowTab(conid, conclass, i, colid, colclass) {
        var contentid = document.getElementById(conid + i);
        var columid = document.getElementById(colid + i);


        if (contentid)
            contentid.className = conclass;
        if (columid)
            columid.className = colclass;

    }


    function getCookie(objName) {//获取指定名称的cookie的值
        var arrStr = document.cookie.split("; ");

        for (var i = 0; i < arrStr.length; i++) {
            var temp = arrStr[i].split("=");
            if (temp[0] == objName)
                return unescape(temp[1]);
        }

    }



  

    function ChClassID(fid, cid) {


        controlValue[controlValue.selectedIndex].innerText

        var f = document.getElementById(fid);
        var c = document.getElementById(cid);

        if (f[f.selectedIndex].value == 1 || f[f.selectedIndex].value == 2 || f[f.selectedIndex].value == 3) {
            c.Visible = true;

        }
        else {
            c.Visible = false;
        }
    }


    function car_check() {
        var myday = new Date();
        if (document.getElementById("StartDate").value.length == 0) {
            alert("请选择开始租用时间!");
            document.getElementById("StartDate").focus(); return false;
        }

        if (document.getElementById("OutDate").value.length == 0) {
            alert("请选择结束租用时间!");
            document.getElementById("OutDate").focus(); return false;
        }



        if (!isDateString(document.getElementById("StartDate").value)) {
            alert("开始租用时间不符合格式规范或为无效的日期!");
            document.getElementById("StartDate").focus();
            return false;
        }

        if (stringToDate(document.getElementById("StartDate").value, true) <= myday) {
            alert("开始租用时间不能早于或等于今天!");
            document.getElementById("StartDate").focus(); return false;
        }
        if (document.getElementById("OutDate").value.length == 0) {
            alert("请选择结束租用时间!");
            document.getElementById("OutDate").focus(); return false;
        }

        if (!isDateString(document.getElementById("OutDate").value)) {
            alert("结束租用时间不符合格式规范或为无效的日期!");
            document.getElementById("OutDate").focus();
            return false;
        }


        if (stringToDate(document.getElementById("OutDate").value, true) < stringToDate(document.getElementById("StartDate").value, true)) {

            alert("结束租用时间不能早于开始租用时间!");
            document.getElementById("OutDate").focus(); return false;
        }

        /*
        if (document.carform.texi_type.value.length==0)
        {alert("请选择开始租用方式!");
        document.carform.texi_type.focus();return false;}
	
if (document.carform.useaddres.value.length==0)
        {alert("请选择接车地点!");
        document.carform.useaddres.focus();return false;}	
        */
    }

    function stringToDate(sDate, bIgnore) {
        var bValidDate, year, month, day
        var iaDate = new Array(3)

        if (bIgnore) bValidDate = true
        else bValidDate = isDateString(sDate)

        if (bValidDate) {
            iaDate = sDate.toString().split("-")
            year = parseFloat(iaDate[0])
            month = parseFloat(iaDate[1]) - 1
            day = parseFloat(iaDate[2])
            return (new Date(year, month, day))
        }
        else return (new Date(1900, 1, 1))
    }

    function isDateString(sDate) {
        var iaMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
        var iaDate = new Array(3)
        var year, month, day

        if (arguments.length != 1) return false
        iaDate = sDate.toString().split("-")
        if (iaDate.length != 3) return false
        if (iaDate[1].length > 2 || iaDate[2].length > 2) return false
        if (isNaN(iaDate[0]) || isNaN(iaDate[1]) || isNaN(iaDate[2])) return false

        year = parseFloat(iaDate[0])
        month = parseFloat(iaDate[1])
        day = parseFloat(iaDate[2])

        if (year < 1900 || year > 2100) return false
        if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) iaMonthDays[1] = 29;
        if (month < 1 || month > 12) return false
        if (day < 1 || day > iaMonthDays[month - 1]) return false
        return true
    }
    function countprice(Price, UnitNum, All) {

        var allprice = document.getElementById(Price).value * document.getElementById(UnitNum).value;
        document.getElementById(All).value = allprice;
        //  document.getElementById('span_Moneys').innerHTML = "￥" + allprice + "元";

    }

    function Search(txtStr, Url) {
        if (IsNull(txtStr)) {

            var keyword = escape(document.getElementById(txtStr).value);
            Url = Url + "?" + txtStr + "=" + keyword;
            window.open(Url);
        }
    }
    
    function ReSet(ControlIdStr) {

        if (ControlIdStr) {
            var arr = new Array();
            arr = ControlIdStr.split(",");

            if (arr.length == 0)

                document.getElementById(ControlIdStr).value = "";
            else
                for (var i = 0; i < arr.length; i++) {
                if (document.getElementById(arr[i]))
                    document.getElementById(arr[i]).value = "";
            }
        }
    }
    function ReSetServer(ControlIdStr, head) {

        if (ControlIdStr) {
            var arr = new Array();
            arr = ControlIdStr.split(",");

            if (arr.length == 0)

                document.getElementById(head + ControlIdStr).value = "";
            else
                for (var i = 0; i < arr.length; i++) {

                if (document.getElementById(head + arr[i]))
                    document.getElementById(head + arr[i]).value = "";
            }
        }
    }
 
    function TourOrder(lineid, url) {
        var myday = new Date();
        if (stringToDate(document.getElementById("StartDate").value, true) <= myday) {
            alert("开始租用时间不能早于或等于今天!");
            document.getElementById("StartDate").focus();
            return false;
        }
        var num = document.getElementById("CF_Nums").value;
        if (num == "" || num == 0) {
            alert("旅游人数不能为空！");
            return false;
        }
        var time = document.getElementById("StartDate").value;
        if (time == "") {
            alert("出行日期不能为空！");
            return false;
        }
        if (lineid || url) {
            url = url + "?PeopleNum=" + num + "&StartDate=" + escape(time) + "&LineID=" + lineid;
            window.open(url);
        }
        else {
            alert("线路ID获取失败，请重试！");
            return false;
        }


    }
 function DateWeek()
        {
       tmpDate = new Date();
       date = tmpDate.getDate();
    month= tmpDate.getMonth() + 1;
    year= tmpDate.getYear();
    document.write(year);
    document.write("年");
    document.write(month);
    document.write("月");
    document.write(date);
    document.write("日 ");
    
    myArray=new Array(6);
    myArray[0]="星期日"
    myArray[1]="星期一"
    myArray[2]="星期二"
    myArray[3]="星期三"
    myArray[4]="星期四"
    myArray[5]="星期五"
    myArray[6]="星期六"
    weekday=tmpDate.getDay();
    if (weekday==0 | weekday==6)
    {
    document.write(myArray[weekday]);
    }
    else
    {document.write(myArray[weekday]);
    };
    }
function NowTime(conid)
{

var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
 
if(minutes<=9)
minutes="0"+minutes
if(seconds<=9)
seconds="0"+seconds
myclock=hours+":"+minutes+":"+seconds
if(document.layers){document.layers.conid.document.write(myclock)
document.layers.conid.document.close()
}else if(document.all)
document.getElementById(conid).innerHTML=myclock
setTimeout("NowTime('"+conid+"')",1000)
}


function getFileSize(filePath)    
{    
   var image=new Image();    
   image.dynsrc=filePath;    
   alert(image.fileSize);    
} 

window["MzBrowser"]={};(function() {
    if (MzBrowser.platform) return;
    var ua = window.navigator.userAgent;
    MzBrowser.platform = window.navigator.platform;

    MzBrowser.firefox = ua.indexOf("Firefox") > 0;
    MzBrowser.opera = typeof (window.opera) == "object";
    MzBrowser.ie = !MzBrowser.opera && ua.indexOf("MSIE") > 0;
    MzBrowser.mozilla = window.navigator.product == "Gecko";
    MzBrowser.netscape = window.navigator.vendor == "Netscape";
    MzBrowser.safari = ua.indexOf("Safari") > -1;
    var re;
    if (MzBrowser.firefox)  re = /Firefox(\s|\/)(\d+(\.\d+)?)/;
    else if (MzBrowser.ie)  re = /MSIE( )(\d+(\.\d+)?)/;
    else if (MzBrowser.opera)  re = /Opera(\s|\/)(\d+(\.\d+)?)/;
    else if (MzBrowser.netscape)  re = /Netscape(\s|\/)(\d+(\.\d+)?)/;
    else if (MzBrowser.safari)  re = /Version(\/)(\d+(\.\d+)?)/;
    else if (MzBrowser.mozilla)  re = /rv(\:)(\d+(\.\d+)?)/;
    if ("undefined" != typeof (re) && re.test(ua))
        MzBrowser.version = parseFloat(RegExp.$2);
})();

function IsIe()
{
    if(MzBrowser.ie)
    {
    return true;
    }
}
function SearchForm(CurNum, Url) {

    if (document.getElementById("SearchForm")) {
        document.getElementById("SearchForm").action = Url;
    }
    for (var i = 1; i < 5; i++) {
        if (document.getElementById("lis" + i)) {
            if (i == CurNum)
                document.getElementById("lis" + i).className = "search_m_t01";
            else
                document.getElementById("lis" + i).className = "search_m_t02";
        }
    }
}
function CityMoveIn(id,inclass) {
    if (id) {
    document.getElementById(id).className=inclass;
    }
}
function CityMoveOut(id,outclass) {
    if (id) {
        document.getElementById(id).className = outclass;
    }
}
function SearchTab(id,num,showclassname,sum) {
   // var conid=
    for (var i = 1; i <= sum; i++) {
    
        switch (num) {
            case 1: document.getElementById("txtKeyWord").value = "Rellena el lugar de interés o la ciudad que usted quiere saber"; break;
            case 2: document.getElementById("txtKeyWord").value = "Rellena la ciudad dónde está el hotel que usted quiere saber"; break;
            case 3: document.getElementById("txtKeyWord").value = "Rellena las ciudades del línea que le gusta"; break;
            default:document.getElementById("txtKeyWord").value = "Rellena el lugar de interés o la ciudad que usted quiere saber"; break;
        }

    if (document.getElementById(id + i)) {
        if (i == num) {
            document.getElementById(id + i).className = showclassname;
            document.getElementById("txthidden").value = showclassname;
             
        }
        else
            document.getElementById(id + i).className = "none";
 
    }
}
}
function trim(str) {
    str = str.replace(/(^\s*)|(\s*$)/g, "");
    return str;
}



function CheckCustomize(style) {
    var ConIdStr;
     if (style.toString()=="1")//这是线路预订
         ConIdStr = "txtFullName,txtNationality,txtPassportNo,txtPassportExpiryDate,txtMailAddress,txtEmail,txtEntryFlight,txtEntryFlightTime,txtExitFlight,txtExitFlightTime,txtRoomsNumber,txtNumberofAdults,txtNumberofChildren,txtNumberofBabies"; //必填字段ID字符串
     else //这是量身定制订单页
         ConIdStr = "txtFullName,txtNationality,txtPassportNo,txtPassportExpiryDate,txtMailAddress,txtEmail,txtStayFor,txtEntryCity,txtEntryFlight,txtEntryFlightTime,txtExitCity,txtExitFlight,txtExitFlightTime,txtPrice,txtRoomType,txtRoomsNumber,txtNumberofAdults,txtNumberofChildren,txtNumberofBabies,txtBudget"; //必填字段ID字符串
   
    var arr=new Array();
    arr = ConIdStr.split(",");
    var conid;
    
    for (var i = 0; i < arr.length; i++) {
        conid = document.getElementById("ctl00_ContentPlaceHolder1_" + arr[i]);
    /*======================================================================*/        
        if (conid && (trim(conid.value) == "")) {   
   /*------------------------------------------------------------*/              
            if (document.getElementById("span_" + arr[i])) {
                document.getElementById("span_" + arr[i]).className = "ShowSpan";
                AddEvent(conid, document.getElementById("span_" + arr[i]))
            }
    /*------------------------------------------------------------*/            
            conid.focus(); 
            return false;
        }
     /*======================================================================*/         
 
    }

    return true;
}
function AddEvent(objctconid, objctControlID) {
    if (objctconid.attachEvent) {
        objctconid.attachEvent("onblur", function() { AddBlur(objctconid, objctControlID); });
    } else if (objctconid.addEventListener) {
        objctconid.addEventListener("blur", function() { AddBlur(objctconid, objctControlID); }, false);
    }
   // return true;
}

function AddBlur(objctconid, objctControlID) {
    if (trim(objctconid.value) != "")
        objctControlID.className = "none";
    else
        objctControlID.className = "ShowSpan";
}






/*天气预报 城市ID获取http://service.weather.com.cn/plugin/forcast.shtml?id=pn4#*/
var ArrNum = 1;
var CityNum = 0;

function ShowWeacher(CityIdStr) {

    var i = 0;
    var strHtml = "";
    var myArray = new Array();
    myArray = CityIdStr.split(",");
    CityNum = myArray.length
    if (CityNum == 0)
        return;
    else { 
    
        strHtml=strHtml+"<iframe id=\"iframe_W_" + i.toString() + "\" src=\"http://m.weather.com.cn/m/pn10/weather.htm?id=";
        strHtml=strHtml+myArray[0] + " \" width=\"260\" height=\"100\" marginwidth=\"0\"  ";        
        strHtml=strHtml+" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=\"no\"  ";
        strHtml=strHtml+"onmouseover=\"javascript:clearTimeout(setID);\" onmouseout=\"javascript:fnToggle();\"";
        strHtml=strHtml+"></iframe>";

        for (i = 1; i < myArray.length; i++) { 
             strHtml=strHtml+"<iframe id=\"iframe_W_" + i.toString() + "\" src=\"http://m.weather.com.cn/m/pn10/weather.htm?id=";
             strHtml=strHtml+myArray[i] + " \" width=\"260\" height=\"100\" marginwidth=\"0\" class=\"none\"  ";
            strHtml=strHtml+" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=\"no\"></iframe>";
        }
        if (document.getElementById("p_tianqi")) {
            document.getElementById("p_tianqi").innerHTML = strHtml;
            setID = setTimeout("fnToggle()", 117000);
        }
    }
}

function fnToggle() {
    var conid;
    for (var j = 0; j < CityNum; j++) {
        conid = document.getElementById("iframe_W_" + j);
        if (conid) {
            if (j == ArrNum) {
                conid.className = "";
            }
            else {
                conid.className = "none";
            }
        }
    }
    ArrNum++;
    if (ArrNum >= CityNum)
        ArrNum = 0;
    setID = setTimeout("fnToggle()", 225000);
}
function stopCount() {
    clearTimeout(setID);
}
function CheckGuest() {
    if (trim(document.getElementById("ctl00_ContentPlaceHolder1_txtTitle").value) == "") {
        document.getElementById("span_txtTitle").className = "fontred";
        document.getElementById("ctl00_ContentPlaceHolder1_txtTitle").focus();
        AddEvent(document.getElementById("ctl00_ContentPlaceHolder1_txtTitle"), document.getElementById("span_txtTitle"));
        return false;
    }
    else if (trim(document.getElementById("ctl00_ContentPlaceHolder1_txtcontent").value) == "") {
    document.getElementById("span_txtcontent").className = "fontred";
    document.getElementById("ctl00_ContentPlaceHolder1_txtcontent").focus();
        AddEvent(document.getElementById("ctl00_ContentPlaceHolder1_txtcontent"), document.getElementById("span_txtcontent"));
        return false;
    }
    else
    {return true;}




}
lastScrollY = 0;
//滚动 js
function heartBeat() {
    var diffY;
    var re = /^[1-9]+.?[0-9]*[px]?$/;
    if (document.documentElement && document.documentElement.scrollTop)
        diffY = document.documentElement.scrollTop;
    else if (document.body)
        diffY = document.body.scrollTop
    else
    { /*Netscape stuff*/ }
    percent = .1 * (diffY - lastScrollY);
    if (percent > 0) percent = Math.ceil(percent);
    else percent = Math.floor(percent);
    
    if (document.getElementById("lovexin12"))
        if (document.getElementById("lovexin12").style.top)
            document.getElementById("lovexin12").style.top = parseInt(document.getElementById("lovexin12").style.top) + percent + "px";

        if (document.getElementById("lovexin14"))
            if (document.getElementById("lovexin14").style.top)
            document.getElementById("lovexin14").style.top = parseInt(document.getElementById("lovexin14").style.top) + percent + "px";
        
    lastScrollY = lastScrollY + percent;
}

