// JavaScript Document

function setName(name)
{
  // Set cookie to expire in 30 days.
  var expDate = new Date();
  var days = 30;
  expDate.setTime(expDate.getTime() + (24 * 60 * 60 * 1000 * days));

  // Set cookie.
  setCookie("name", name, expDate);
}

function setNameNavigate(name, url)
{
  // Set cookie to expire in 30 days.
  var expDate = new Date();
  var days = 30;
  expDate.setTime(expDate.getTime() + (24 * 60 * 60 * 1000 * days));

  // Set cookie.
  setCookie("name", name, expDate);
  //window.open(url,"_top");
  location.href = url;
  return false;
}


function getName()
{
  // Get Cookie.
  var name = getCookie("name");
  if (name == "")
  {
     name = "John";
  }
  return name;
}

function setCookie(name, value, expire)
{
  if(name != null && value != null)
  {
    document.cookie = name + "=" + escape(value)
      + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));
  }
}

function getCookie(name)
{
  var search = name + "=";

  if(document.cookie.length > 0)
  {
    offset = document.cookie.indexOf(search);

    if(offset != -1)
    {
      offset += search.length;
      end = document.cookie.indexOf(";", offset);

      if(end == -1)
        end = document.cookie.length;

      return unescape(document.cookie.substring(offset, end));
    }
  }

  return "";
}

function MakeArray(n) {
this.length = n
return this
}

function ReadyDate() {
monthNames = new MakeArray(12)
monthNames[1] = "January"
monthNames[2] = "February"
monthNames[3] = "March"
monthNames[4] = "April"
monthNames[5] = "May"
monthNames[6] = "June"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "October"
monthNames[11] = "November"
monthNames[12] = "December"

var oneDay = 60 * 1000 * 60 * 24
var readyDate = new Date()
var dateInMs = readyDate.getTime() + 42 * oneDay
readyDate.setTime(dateInMs);
var theMonth = monthNames[readyDate.getMonth() + 1]
var theYear = readyDate.getYear()
if (theYear < 2000) theYear += 1900
return theMonth + " " + readyDate.getDate() + ", " + theYear
}
