﻿//document.write('<iframe frameborder=0 src="/CommonPages/s.aspx" style="display:none;width:110px;height:110px;"></iframe>');
document.write('<iframe id=IFLogin name=IFLogin scrolling=no frameborder=0 style="display:none;width:353px;height:308px;position:absolute;z-index:1000"></iframe>');
function _g(x){return document.getElementById(x);}
//strType 1：小页面，2：大页面
//Url 转向地址
//IsOpenNW 是否打开新页面
//CButton 点击按钮
//FormName  提交表单
//FormName  提交表单
var $Login_Url="";
var $Login_IsOpenNW="";
var $Login_CButton="";
var $Login_FormName="";
var $Login_ChildWin="";
function $SL(Type)
{
    var cf = _g("IFLogin"); cf.src = "/CommonPages/Login.aspx?Type=" + Type;
cf.style.display="";
//document.body.scroll="no";
if(Type==1){cf.style.width="853px";cf.style.height="325px";cf.style.left="80px";}else{cf.style.width="586px";cf.style.height="297px";cf.style.left="200px";}
var sT=document.body.scrollTop; var sH=window.screen.availHeight;
if(sT==0)sT=document.documentElement.scrollTop;
cf.style.top=(sT+sH/2-200)+"px";
hiddenSelect();if(_g("_bgDiv")){_g("_bgDiv").className="dis";return;}
var fullbg = document.createElement("DIV");
fullbg.id = "_fullbg";
fullbg.style.backgroundColor = "Gray";
fullbg.style.zIndex = 900;
fullbg.style.position = "absolute";
fullbg.style.left = "0px";
fullbg.style.top = "0px";
fullbg.style.filter = "Alpha(Opacity=30)";
if (fullbg.style.MozOpacity != undefined) {
    fullbg.style.MozOpacity = "0.4";
}
if (fullbg.style.opacity != undefined) {
    fullbg.style.opacity = "0.4";
}
var bH = document.body.offsetHeight;
var bW = document.body.offsetWidth;
document.body.appendChild(fullbg);
var bH = document.body.offsetHeight;
var bW = document.body.offsetWidth;
fullbg.style.width = bW + "px";
fullbg.style.height = bH + "px"; ;
}
function $HL() { var cf = _g("IFLogin"); cf.src = ""; cf.style.display = "none"; if (_g("_fullbg")) { document.body.removeChild(_g("_fullbg")); ShowSelect(); } }
function hiddenSelect(){ var selects=document.getElementsByTagName("select");  for(i=0;i<selects.length;i++) selects[i].style.display="none";}
function ShowSelect(){var selects=window.top.document.getElementsByTagName("select");for(i=0;i<selects.length;i++) selects[i].style.display="";}
function $SetUser(Usname)
{
$HL();
if(Usname=="RegSystem"){$Next();return;}
for (var Lx = 0; Lx < 99; Lx++) {
    var key = "";
    if (Lx < 10) {
        key = "0" + Lx.toString();
    }
    else {
        key = Lx.toString();
    }
    if (_g("ctl" + key + "_LoginFail")) {
        _g("ctl" + key + "_LoginFail").style.display = "none";
    }
    if (_g("ctl" + key + "_LoginSucess")) {
        _g("ctl" + key + "_LoginSucess").style.display = "";
    }
    if (_g("ctl" + key + "_H_UserName")) {
        _g("ctl" + key + "_H_UserName").innerHTML = Usname; 
        break;
    }
}
$Next();
}
function $CheckLogin(Type,Url,IsOpenNW,CButton,FormName,ChildName)
{ 
$Login_Url=Url;$Login_IsOpenNW=IsOpenNW;$Login_CButton=CButton;$Login_FormName=FormName;
if(ChildName)$Login_ChildWin=ChildName;
var cf=_g("IFLogin");
var d=new Date();
cf.src = "/CommonPages/Login.aspx?cx=" + d.toString() + "&Type=" + Type; 
}
function $Next()
{
  if($Login_Url)if($Login_Url.length>0)if($Login_IsOpenNW=="1"){ window.open($Login_Url);return false;}else{window.location.href=$Login_Url; return false;}
  if($Login_ChildWin)if($Login_ChildWin.length>0){var cw=_g($Login_ChildWin);cw.contentWindow.document.getElementById($Login_CButton).click();return false;}
  if($Login_CButton)if($Login_CButton.length>0){_g($Login_CButton).click();return false;}
  if($Login_FormName)if($Login_FormName.length>0)_g($Login_FormName).submit();return false;
}
function menuFix() {
if(!_g("nav"))return;
var sfEls = document.getElementById("nav").getElementsByTagName("li");
for (var i=0; i<sfEls.length; i++)
 {
   sfEls[i].onmouseover=function() {
   this.className="sfhover";
   }
   sfEls[i].onMouseDown=function() {
   this.className+=(this.className.length>0? " ": "") + "sfhover";
   }
   sfEls[i].onMouseUp=function() {
   this.className+=(this.className.length>0? " ": "") + "sfhover";
   }
   sfEls[i].onmouseout=function(){
   this.className="";
   }
   
}
$SetADNet(0);
}
window.onload=menuFix;

function GoGoogle()
{if(_g("H_KeyText").value=="")return;var url='http://www.google.com/cse?cx=017239783757484844030:fcdhq35-gyc&cof=L:http://Images1.chinatraveldepot.com/PubImages/images/ayLogo.jpg&ie=GB2312&q='+_g("H_KeyText").value
 var NewWindow=window.open(url);if(!NewWindow)window.location.href=url;}
function $SetADNet(x){if(!_g("ZQL"+x)){if(_g("ZQL0"))$zq(0);return false;}$zq(x);x++; window.setTimeout("$SetADNet("+x+")",2000);
}
//function $SKinfo(x){if(x==1)_g("KaiInfo").style.display=""; else _g("KaiInfo").style.display="none";}
function SetLT(x, y) { _g("S_List" + x).className = "hgtour" + y; }

function GetxmlHttpRequest() {
    var xmlhttp;
    try {
        xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
    }
    catch (e) {
        xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}
//判断页面是否已经登陆(静态页面用)
try {
    var xmlhttp = GetxmlHttpRequest();
    var d = new Date();
    xmlhttp.open('get', "/CommonPages/CheckLogInForHTML.ashx?d=" + d.getTime(), true);
    xmlhttp.send(null);
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4) {
            if (xmlhttp.status == 200) {
                var lgstr = xmlhttp.responseText;
                var lgArray = lgstr.split(',');
                if (lgArray.length > 1) {
                    if (lgArray[0] == "true") {
                        $SetUser(lgArray[1]);
                    }
                    else {
                        for (var Lx = 0; Lx < 99; Lx++) {
                            var key = "";
                            if (Lx < 10) {
                                key = "0" + Lx.toString();
                            }
                            else {
                                key = Lx.toString();
                            }
                            if (_g("ctl" + key + "_LoginFail")) {
                                _g("ctl" + key + "_LoginFail").style.display = "";
                            }
                            if (_g("ctl" + key + "_LoginSucess")) {
                                _g("ctl" + key + "_LoginSucess").style.display = "none";
                            }
                        }
                    }
                }
            }
        }
    }
}
catch (e) { }

//判断页面是否已经登陆(静态页面用)

if (document.getElementById("spanTele")) {
    var teleRequest = GetxmlHttpRequest();
    if (teleRequest != null) {
        var site = 1;
        if (this.location.href.indexOf("bj.aoyou.com") > -1) {
            site = 1;
        }
        else if (this.location.href.indexOf("sh.aoyou.com") > -1) {
            site = 210;
        }
        else if (this.location.href.indexOf("tj.aoyou.com") > -1) {
            site = 11;
        }
        else if (this.location.href.indexOf("nj.aoyou.com") > -1) {
            site = 222;
        }
        else if (this.location.href.indexOf("hz.aoyou.com") > -1) {
            site = 301;
        }
        else if (this.location.href.indexOf("gz.aoyou.com") > -1) {
            site = 838;
        }
        else if (this.location.href.indexOf("ty.aoyou.com") > -1) {
            site = 102;
        }
        else if (this.location.href.indexOf("xa.aoyou.com") > -1) {
            site = 1095;
        }
        else {
            site = 1;
        }
        var url = "/CommonPages/GetHeadTele.ashx?SiteFrom=" + site;
        teleRequest.open("post", url, true);
        teleRequest.onreadystatechange = function () {
            if (teleRequest.readyState == 4) {
                if (teleRequest.status == 200) {
                    var teleResponse = teleRequest.responseText;
                    document.getElementById("spanTele").innerHTML = teleResponse;
                }
            }
        }
        teleRequest.send(null);
    }
    else {
        alert("no xmlhttp");
    }
}




//判断登录状态
function $checkLoginStatue(func, CButton) {
    var request = GetxmlHttpRequest();
    var $Login_CButton = CButton;
    if (request != null) {
        var url = "/CommonPages/CheckLoginStatue.ashx";
        request.open("post", url, true);
        request.onreadystatechange = function () {
            if (request.readyState == 4) {
                if (request.status == 200) {
                    var response = request.responseText.split(',');
                    if (response[0] == "true") {
                        if (func) if (func.length > 0) { func(); return false; }
                        if ($Login_CButton) if ($Login_CButton.length > 0) { _g($Login_CButton).click(); return false; }
                    }
                    else {
                        var thisUrl = encodeURIComponent(location.href);
                        window.location.href = "/CommonPages/LoginIn.aspx?from=" + thisUrl;
                        //                        var adultNum = document.getElementById(AdultNum).innerHTML;
                        //                        var childNum = document.getElementById(ChildNum).innerHTML;
                        //                        var roomNum = document.getElementById(RoomNum).innerHTML;
                        //                        var parm = adultNum + "-" + childNum + "-" + roomNum; 
                        //                        window.location.href = "/CommonPages/LoginIn.aspx?from=" + thisUrl + "&parm=" + parm;
                    }
                }
            }
        }
        request.send(null);
    }
    else {
        alert("no xmlhttp");
    }
}

//把下一步按钮的$CheckLogin函数改为checkLoginStatue（GetContact），括号内为执行的函数名字
