hasLMS = (getLocalCookie("RWD-hasLMS") == "true"? true: false);

function setLocalCookie(theName, theValue, curDays, thePath) {
	theName += "=";
	theValue = escape(theValue) + ";";

	if (typeof(thePath) == "undefined") thePath = "/";
	thePath = " path=" + thePath + ";"
	toExpire = getExpire(curDays);
	toExpire = " expires=" + toExpire.toGMTString();
	cookieValue = theName + theValue + thePath + toExpire
	document.cookie = cookieValue;
}

function getLocalCookie(theName) {
	theName = theName + "=";
	theCookie = document.cookie;

	if (theCookie.length > 0) {
		startString = theCookie.indexOf(theName);

		if (startString != -1) {
			startString += theName.length;
			endString = theCookie.indexOf(";", startString);

			if (endString == -1) {
				endString = theCookie.length;	
			}

			theValue=theCookie.substring(startString,endString);
			theValue=unescape(theValue);

			return theValue;
		}
	}

	return "";
}

function deleteLocalCookie(theName, thePath) {
	if (typeof(thePath) == "undefined") thePath = "/";
	document.cookie = theName + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=" + thePath;
}

function getExpire(curDays) {
	var toExpire = new Date();                                   

	toExpire.setTime(toExpire.getTime() + (1000 * 60 * 60 * 24 * curDays));
	return toExpire;
}

function getBookmark(theName) {
	var szValue = getCookie(theName);

	if (szValue == "") {
		szValue = getCookie(theName + "-AT");
		if (szValue != "") {
			szValue += "-AT";
			deleteCookie(theName + "-AT", "/");
		}
	}

	return szValue;
}