  // Original JavaScript code by Duncan Crombie: dcrombie at chirp.com.au

function cookieSupported(){
	/* var testCookieName = "testCookie";
	deleteCookie(testCookieName);
	setCookie(testCookieName,"true",getExpDate(0,0, 1),contextPath+"/");
	if (getCookie(testCookieName) == null) {
		alert('Cookies are not enabled. Please allow cookies from this site');
		return false;
	} */
	return true;
}
function getCookie(name) // use: getCookie("name");
{
	var cookies = document.cookie;
    var index = cookies.indexOf(name + "=");
    if (index == -1) return null;
    index = cookies.indexOf("=", index) + 1;
    var endstr = cookies.indexOf(";", index);
    if (endstr == -1) endstr = cookies.length;
    var value = cookies.substring(index, endstr);
    if (value.startsWith("\"")){
    	value = value.substring(1,value.length-1);
    }
    return unescape(value);
}
// utility function to retrieve an expiration date in proper
// format; pass three integer parameters for the number of days, hours,
// and minutes from now you want the cookie to expire (or negative
// values for a past date); all three parameters are required,
// so use zeros where appropriate
function getExpDate(days, hours, minutes) {
    var expDate = new Date( );
    if (typeof days == "number" && typeof hours == "number" &&
        typeof hours == "number") {
        expDate.setDate(expDate.getDate( ) + parseInt(days));
        expDate.setHours(expDate.getHours( ) + parseInt(hours));
        expDate.setMinutes(expDate.getMinutes( ) + parseInt(minutes));
        return expDate.toGMTString( );
    }
}

// store cookie value with optional details as needed
function setCookie(name, value, expires, path, domain, secure) {
    document.cookie = name + "=" + escape (value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

// remove the cookie by setting ancient expiration date
function deleteCookie(name,path,domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}
;
