var bikky = document.cookie;

  function getCookie(name) { // use: getCookie("name");
    var index = bikky.indexOf(name + "=");
    if (index == -1) return null;
    index = bikky.indexOf("=", index) + 1;
    var endstr = bikky.indexOf(";", index);
    if (endstr == -1) endstr = bikky.length;
    return unescape(bikky.substring(index, endstr));
  }

  var today = new Date();
  var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000); // plus 28 days
  var expired = new Date(today.getTime() - 28 * 24 * 60 * 60 * 1000); // less 28 days
  
  function setTransientCookie(name,value)
  {
    if(value != null && value != "")
      document.cookie=name + "=" + escape(value);
    bikky = document.cookie;
    return getCookie(name) != null;
  }

  function setCookie(name, value) { // use: setCookie("name", value);
    if (value != null && value != "")
      document.cookie=name + "=" + escape(value) + "; expires=" + expiry.toGMTString();
    bikky = document.cookie; // update bikky
    return getCookie(name) != null; // return false if the cookie was refused
  }

  function deleteCookie(name) { // use: deleteCookie("name");
    document.cookie=name + "=null; expires=" + expired.toGMTString(); // delete cookie
    bikky = document.cookie; // update bikky
    //document.forms[0].cookieContent.value = formatCookie(); // display cookie content
  }

  function makeCookie() { // make sure the cookie is set
    var form = document.forms[0];
    while (!setCookie(form.targetcookie.value, form.content.value)) {
      if (!confirm('The cookie was not accepted by your browser\nYou must allow cookies to use this page')) {
        alert('By refusing our harmless cookie strings\nyou are preventing this page from operating correctly\nPlease adjust your browser settings');
        history.back(); // take them out of the page
        break;
      }
    }
    form.cookieContent.value = formatCookie(); // display cookie content
  }
  
  function formatCookie() {
    var retValue = "";
    with (bikky) {
      for (var i=0; i < length; i++)
        retValue += (charAt(i) != " ") ? charAt(i) : "\n";
    }
    return retValue;
  }

function makeArray() {
     for (i = 0; i<makeArray.arguments.length; i++)
         this[i] = makeArray.arguments[i];
 }
 
function getFullYear(d) {
    var y = d.getYear();
    if (y < 1000) {y += 1900};
    return y;
}
var days = new makeArray("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var months = new makeArray("January","February","March","April","May","June","July","August","September","October","November","December");

function formatTime(t) {
 
   var Day = t.getDay();
    var Date = t.getDate();
    var Month = t.getMonth();
    var Year = getFullYear(t);
    timeString = "";
    timeString += days[Day];
    timeString += " ";
    timeString += months[Month];
    timeString += " ";
    timeString += Date;
    timeString += ", ";
    timeString += Year;
   return timeString;
  
}