function setCookie(cookie_name, value, expiredays)
{
    var exdate = new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie = cookie_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
 
function getCookie(cookieName)
{
   if (document.cookie == undefined) return "";
   
   var theCookie=""+document.cookie;
   var ind=theCookie.indexOf(cookieName);
  
   if (ind==-1 || cookieName=="") return "";
   
   var ind1=theCookie.indexOf(';',ind);
   if (ind1==-1) ind1=theCookie.length;
   return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}
