function listCookies(){
var items = new Array();
var cookies = document.cookie.split(";");
for(var i = 0; i < cookies.length; i++){
var pairs = cookies[i].split("=");
items[pairs[0]] = pairs[1];
}
return items;
}
function getCookie(key){
var regExp = new RegExp(key + "=([^=;]+)");
if(regExp.exec(document.cookie)){
return RegExp.$1;
}else{
return "";
}
}
function printArr(arr){
for(var e in arr){
document.write(e + ":" + arr[e] + "<br />");
}
}
printArr(listCookies());
document.write(getCookie("today"));