function getCookie(cookieName) {
var allCookies = document.cookie.split(';'),
cookieCounter = 0,
currentCookie = '';
for (cookieCounter = 0; cookieCounter < allCookies.length; cookieCounter++) {
currentCookie = allCookies[cookieCounter];
while (currentCookie.charAt(0) === ' ') {
currentCookie = currentCookie.substring(1, currentCookie.length);
}
if (currentCookie.indexOf(cookieName + '=') === 0) {
return currentCookie.substring(cookieName.length + 1, currentCookie.length);
}
}
return false;
}