﻿    function GetCookie(sName)   
    {     
        var aCookie = document.cookie.split("; ");       
        for(var i=0; i < aCookie.length; i++)   
        {      
            var aCrumb = aCookie[i].split("=");
            if (sName == aCrumb[0])     
            {
                return   decodeURIComponent(aCrumb[1]);   
            }      
        } 
        return null;
    } 
    function getUserStatus()
    {
        if(GetCookie("UserName")==null || GetCookie("UserName")=="")
            document.write('<li id="login"><a href="/User/UserLogin.aspx">登录</a></li><li id="login1"><a href="/User/Register.aspx">注册</a></li>');
        else
            document.write('<li id="loginnow">欢迎您,<a href="/User/Default.aspx"><font class="color1">' + GetCookie("UserName") + '</font></a></li><li id="loginnow1"><a href="/user/UserExit.aspx">退出</a></li>');
    }
    function addFav()
    { 
        var url = 'http://www.tugexing.com'; 
        var title = '电子请柬 电子请帖及喜帖、生日图片在线制作 - 图个性网'; 
        try
        { 
            window.external.addFavorite(url, title); 
        }
        catch (e)
        { 
            try
            { 
                window.sidebar.addPanel(title, url, ""); 
            }
            catch (e)
            { 
                alert("加入收藏失败，请使用Ctrl+D进行添加。"); 
            } 
        } 
    }
    function InfoAct()
    {
        alert("请在充值过程中不要关闭页面，充值完成后页面会自动关闭。");
    }

    var secs =5; //倒计时的秒数     
    function CloseHtml()
    {   
        for(var i=secs;i>=0;i--)   
        {   
            window.setTimeout('doUpdate(' + i + ')', (secs-i) * 1000);   
        }   
    }   
    function doUpdate(num)   
    {
        document.getElementById('ShowTime').innerHTML=num+'秒';   
        if(num == 0)
        { 
            var isIE = navigator.appName == "Microsoft Internet Explorer";
             //alert(isIE);
            if(isIE)
            {
                window.opener = "";
                window.open("","_self");
                window.close();
            }
            else
            {
                /*FF 还要在 about:config 允许脚本脚本关闭窗口*/
                window.close();
            }
 	    }   
    }


    /*发布到手机*/
    function SendPhone(subject,filename)
    {
        window.open("http://send.aajoy.com/Send/Interface.aspx?f=1028&Subject="+subject+"&MMSFile=http://www.tugexing.com"+filename,"","width=455,height=370");
    }
