// Cookie Handler javascript modified 2003-02-10 by Geoff Hoffman

// sets a cookie (
function setCookie(strname, ivalue, idays){  
    var ck = document.cookie;   
    if (ck.indexOf(strname)==-1) {
        // Set the cookie;   
        var d = new Date();   
        var e = new Date(d.valueOf()+(idays*24*60*60*1000));   
        // Create a cookie that expires after idays days   
        document.cookie = strname + "=" + ivalue +"; expires=" + e.toGMTString();   
    }
}
  
// returns the value stored in the cookie named strname or null if not present
function getCookie(strname){ 
    var ck = document.cookie;
    var idx = ck.indexOf(strname);
    if(idx == -1){
        return null;
    }
    idx = ck.indexOf("=", idx) + 1;
    var endstr = ck.indexOf(";", idx);
    if(endstr == -1){
        endstr = ck.length;
    }
    return unescape(ck.substring(idx, endstr));
}
 
//returns true if the cookie exists, false if not  
function checkCookie(strname) {
   var temp = getCookie(strname);
   if(temp==null) {
       return false;
   } else {
       return true; 
   }
}

