
// GENERIC COOKIE FUNCTIONS
function getCookieVal(offset) {
 var endstr=document.cookie.indexOf(";",offset);
 if (endstr==-1)
 endstr=document.cookie.length;
 return unescape(document.cookie.substring(offset,endstr));
}
function GetCookie(cname) {
 var arg=cname+"="; var alen=arg.length;
 var clen=document.cookie.length; var i=0;
 while (i<clen) {
        var j=i+alen;
        if (document.cookie.substring(i,j)==arg) return getCookieVal (j); i=document.cookie.indexOf("",i)+ 1;
        if (i==0) break;
 } return null;
}
function SaveCookie(cname,cvalue,cdays,cpath) {
        ex = new Date; ex.setTime(ex.getTime() + (cdays*86400000));
        if (cpath == null) { cpath = "/" } else { cpath = "; path=" + cpath }
        sitedom=location.hostname.replace(/www\./,"");
        document.cookie=cname + '=' + cvalue + '; expires=' + ex.toGMTString() + cpath + "; domain="+sitedom;
}
// Member links: sets styles to "hide" links based on membership status
var insitecookie="adn_user_auth";
if (GetCookie(insitecookie)) {
        document.write("<style>#nonmember{display:none;}</style>");
        //Resets threshold page counter to zero as soon as we see you are logged in
        if (GetCookie('pagecount')) { SaveCookie('pagecount',0,.005,'/')} ;
} else {
        document.write("<style>#member{display:none;}</style>");
}


