function trimString (str) {
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function getCookieValue(cookieName) {
	//alert("getCookieValue(" + cookieName + ")");
	var theCookie = document.cookie;
	var allCookies = theCookie.split(";");
	for (a=0; a < allCookies.length; a++) {
		var thisCookie = allCookies[a].split("=");
		thisCookie[0] = trimString(thisCookie[0]);
		if (thisCookie[0] == cookieName) {
			return thisCookie[1];
		}
	}
	return "";
}
