
function GetCookie(name) //
{
    var pos = document.cookie.indexOf(name + "=");
    if(pos<0)
        return "";
    else{
        var endstr = document.cookie.indexOf(";", pos);
        if(endstr<0)
            return unescape(document.cookie.substr(pos+name.length+1));
        else
            return unescape(document.cookie.substring(pos+name.length+1,endstr));
    }
}

function SetCookie(name, value) //
{
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (argc  > 2) ? argv[2] : null;
    var path    = (argc  > 3) ? argv[3] : null;
    var domain  = (argc  > 4) ? argv[4] : null;
    var secure  = (argc  > 5) ? argv[5] : false;
    document.cookie = name + "=" + escape (value) 
        +((expires == null) ? "" : ("; expires="+ expires.toGMTString()))
        +((path    == null) ? "" : ("; path="   + path))
        +((domain  == null) ? "" : ("; domain=" + domain))
        +((secure  == true) ? "; secure" : "");
}

function DelCookie(name)
{
    var exp = new Date();
    exp.setTime (exp.getTime() - 1);
    document.cookie = name + "=;expires="+ exp.toGMTString();
}

var zcfUrl, zgzUrl, zrcUrl;

zcfUrl = "/Hunter/Index.aspx";
zgzUrl = "/Person/Index.aspx";
zrcUrl = "/Enterprise/Index.aspx";

var cookieName = "demouserfavorite";

function setuserfavorite(value)
{
    var expires = new Date()
    expires.setFullYear(expires.getFullYear() + 1);
    SetCookie(cookieName, value, expires, "/") ;
}

function setAreaCookie(cname,value){
    var expires = new Date()
    expires.setFullYear(expires.getFullYear() + 1);
    SetCookie(cname, value, expires, "/") ;
}


function EnterIndex()
{
    var cookievalue = GetCookie(cookieName) + "";
    
    //alert(cookievalue)
    if (cookievalue == "zcf" )
    {
        window.location.href = zcfUrl;
    }
    if (cookievalue == "zgz" )
    {
        window.location.href = zgzUrl;
    }
    if (cookievalue == "zrc" )
    {
        window.location.href = zrcUrl;
    }
}

function EnterChannelIndex(value, name)
{
    
    var cookievalue = GetCookie(cookieName) + "";
    
    //alert(cookievalue)
    
    if (cookievalue == "")        
    {
        showNotice(value, name);
    }
}

function EnterChannelIndex1(value, name)
{
    
    var cookievalue = GetCookie(cookieName) + "";
    
    //alert(cookievalue)
    
    if (cookievalue == "")        
    {
        showNotice1(value, name);
    }
}


function selectaction()
{
    if (document.getElementById("rdzgz").checked )
    {
        setuserfavorite(document.getElementById("rdzgz").value);    
    }
    if  (document.getElementById("rdzrc").checked )
    {
        setuserfavorite(document.getElementById("rdzrc").value);    
    }
    
    var dv = document.getElementById('invitationLayer');
    
    hiddenit(dv);

}

function clearCookie()
{
    DelCookie(cookieName);
    
    var dv = document.getElementById('clearLayer');
    
    hiddenit(dv);
        
}