﻿//网站地址
var webdns="http://"+location.host;

/******************************************** 定购单客户信息操作 ********************************************/
function iniOrderUserInfoForm(container,template,count)
{  
    container.innerHTML="";
    var reg=new RegExp("#num","g");
    for(var i=0;i<count;i++)
    {
        var tempTemplate=template;
        tempTemplate=tempTemplate.replace(reg,i);
        container.innerHTML+=tempTemplate;
    }
}
/******************************************** 定购单客户信息操作 ********************************************/


/******************************************** 首页js ********************************************/

/**控制搜索(右 1)内容的显示和隐藏,并且控制按钮的样式**/
function indexShowSelect(type)
{
    var tabPicDivArray= ['div_group','div_hotel','div_ticket','div_freeline'];
    ShowSingleElement(tabPicDivArray,'div_'+type);
    var tabArray=['li_group','li_hotel','li_ticket','li_freeline'];
    ModifySingleElementClass(tabArray,'li_'+type,'','active');
}

/**控制经典线路(中 2)部分的显示和隐藏,并且控制按钮的样式**/
function indexShowJdianXianlu(type)
{
    var tabPicDivArray= ['div_1','div_2','div_3','div_4'];
    ShowSingleElement(tabPicDivArray,'div_'+type);
    var tabArray=['span_1','span_2','span_3','span_4'];
    ModifySingleElementClass(tabArray,'span_'+type,'','active');
}

/**自动控制经典线路(中 2)部分的显示和隐藏,并且控制按钮的样式**/
function loopShowJdianXianlu(sequence)
{
    if(sequence>4)
        sequence=1;
    var divId="div_"+sequence;
    if($(divId)!=null)
    {
        ShowSingleElement(['div_1','div_2','div_3','div_4'],divId);
        btnDivId="span_"+sequence;
        ModifySingleElementClass(['span_1','span_2','span_3','span_4'],btnDivId,'','active');
    }
    sequence=sequence+1;
    setTimeout("loopShowJdianXianlu("+sequence+")",3000);   
}

//用户注销
function indexLogout()
{
    var url="Common/syns-logout.aspx";
    new Ajax.Request(url ,{ method: 'post',postBody:'data=',onSuccess:function(req)
        {
            var text=req.responseText.strip();
            if(text==1)
            {
//                $("span_menu").show();
//                $("span_user").innerHTML="";
                location.href=location.href;
            }
        }
    });
}
/******************************************** 首页js ********************************************/


/******************************************** 签证部分 开始 ********************************************/
function visaOrderSumitValiate()
{
    return true;
}
function visaOrderSubmit()
{
    if(visaOrderSumitValiate())
    {
        document.getElementById("form1").method="post";
        document.getElementById("form1").action="order-detail.aspx";
        document.getElementById("form1").submit();
    }
}
/******************************************** 签证部分 结束********************************************/


/******************************************** 会员服务部分 开始 ********************************************/
function memberZoneloginValidate()
{
    return true;
}
function memberZoneRecoverPassword()
{
    return true;
}
function memberZonelogin()
{
    if(memberZoneloginValidate())
    {
        //发送数据并跳转
    }
}
function memberZoneRegister()
{
    location.href="../Register/signup.aspx";
}
function orderTravelNews(type)
{
    if(ValidateLength($("txt_email").value,1,100)&&ValidateEmail($("txt_email").value))
    {
        var email=$("txt_email").value;
        var url="syns-orderenews.aspx?email="+email+"&type="+type;
        new Ajax.Request(url ,{ method: 'post',postBody:'data=',onSuccess:function(req)
            {
                alert("订阅成功!");
                location.href='default.aspx';
            }
        });
    }
    else
        alert("请输入正确的邮箱地址!");
}
/******************************************** 会员服务部分 结束 ********************************************/


/******************************************** 礼品兑换 开始 ********************************************/

//兑换礼品
function exchangeGift(giftid,score)
{
    var bln=window.confirm("兑换该礼品将扣除您"+score+"积分,请确认!");
    if(bln)
    {
        var url="syns-exchangegift.aspx?giftid="+giftid;
        new Ajax.Request(url ,{ method: 'post',postBody:'data=',onSuccess:function(req)
            {
                var text=req.responseText.strip();
                if(text==0)
                    alert("您的积分不足,不能兑换该礼品!");
                else if(text==-1)
                    alert("请登录之后再进行操作!");
                else
                    alert("兑换成功!");
            }
        });
    }
}

/******************************************** 礼品兑换 结束 ********************************************/


/******************************************** 用户注销 开始 ********************************************/

//用户注销
function logout()
{
    var url=webdns+"/Common/syns-logout.aspx";
    new Ajax.Request(url ,{ method: 'post',postBody:'data=',onSuccess:function(req)
        {
            var text=req.responseText.strip();
            if(text=="1")
            {
//                $("span_menu").show();
//                $("span_user").innerHTML="";
                location.href=location.href;
            }
        }
    });
}

/******************************************** 用户注销 结束 ********************************************/
