

var iv_scriptletIncluded_cookies = 1;




function iv_getCookie(Name) {
    var tCookie = document.cookie; if (tCookie.length == 0) { return null; }
    var search = Name + "=";
    offset = tCookie.indexOf(search); if (offset == -1) { return null; }
    offset += search.length;
    end = tCookie.indexOf(";", offset);
    if (end == -1) { end = tCookie.length; }
    return unescape(tCookie.substring(offset, end));
}


function iv_setIntervalCookie (name, value, interval, mode) {
    var now = new Date();
    var aDay = 86400000
    var aHour = 3600000
    var aMinute = 60000
    var aSec = 1000
  
    if (mode == "days") {
        //this gets the precise seconds to set the cookie, calculating the days (not 24hours)
        now.setTime(now.getTime() + ((interval-1)*aDay) + (24-now.getHours())*aHour+aMinute)
    } else if (mode == "hours") {
        now.setTime(now.getTime() + interval * aHour)
    }
 
    //now set the cookie
    document.cookie = name + "=" + escape(value) + "; expires=" + now.toGMTString() + "; path=/";
}


function iv_deleteCookie (name, path, domain) {
    if (iv_getCookie(name)) {
        document.cookie = name + "=" + "; path=" + ((path) ? path : "/") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-1970 00:00:01 GMT";
    }
}


function iv_setCookie (name, value, expires, path, domain) {
    // expires represents a value in days
    var ckToday = new Date();
    if (expires != null) { var exp = new Date(ckToday.getTime() + expires * 24 * 60 * 60 * 1000); }
    document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + exp.toGMTString() : "") + "; path=" + ((path) ? path : "/") + ((domain) ? "; domain=" + domain : "");
}

