/* JavaScript Cookies Library Usage
** ================================
** To create a Cookie object:
**   myCookie = new Cookie(name [, expires] [, domain] [, path] [, isSecure]);
** To retrieve data from a cookie:
**   myCookie = new Cookie("myCookie");
**   cookieInfo = myCookie.get();
** To store data in a cookie:
**   myCookie = new Cookie("myCookie" [, expires]);
**   myInfo = "Hi there!";
**   myCookie.store(myInfo [, new Date(2010, 11, 1)]);
** To delete a cookie:
**   myCookie = new Cookie("myCookie");
**   myCookie.del();
*/

function Cookie(name, expires, domain, path, isSecure)
  {
  this.name     = name;
  this.expires  = expires;
  this.domain   = domain;
  this.path     = path;
  this.isSecure = isSecure;

  if (this.expires)  // adjust cookie date to fix Mac Netscape 2.x bug
    fixCookieDate(this.expires);
  }


function fixCookieDate(theDate)
  {
  var testDate = new Date(0); 
  var skew = testDate.getTime();
  if (skew > 0)
    theDate.setTime(theDate.getTime() - skew);
  }


function Cookie_get()
  {
  // Get the document cookie.
  var theWholeCookie = document.cookie;

  // Look for the name of the cookie in the document's cookie.
  var cookieStart = theWholeCookie.indexOf(this.name);

  if (cookieStart == -1)
    return "";  // The cookie wasn't found, so we return an empty string.
  else
    cookieStart += this.name.length + 1;  /* Add the length of the
                                           ** cookie name to the starting
                                           ** value. The extra 1 is to
                                           ** accomodate the "=" character
                                           ** in the cookie syntax
                                           ** name=value. */

  // Find the ";" that marks the end of our cookie.
  var cookieEnd = theWholeCookie.indexOf(";", cookieStart);
   
  if (cookieEnd == -1)
    cookieEnd = theWholeCookie.length;     /* In the event that a semicolon
                                           ** isn't found, we'll return the
                                           ** remaining length of our cookie. */
   
  // Grab the actual cookie from the entire cookie string.
  var theCookie = theWholeCookie.substring(cookieStart, cookieEnd);

  // Return the decoded cookie.
  return unescape(theCookie);
  }



function Cookie_store(string)
  {
  document.cookie = 
    this.name + "=" + escape(string) + 
    ((this.expires) ? "; expires=" + this.expires.toGMTString() : "") + 
    ((this.path) ? "; path=" + this.path : "") + 
    ((this.domain) ? "; domain="  + this.domain : "") + 
    ((this.isSecure) ? "; secure" : "");
  }



function Cookie_del()
  {
  document.cookie = 
    this.name + "=" +
    ((this.expires) ? "; expires=" + (new Date(0)).toGMTString() : "") + 
    ((this.path) ? "; path=" + this.path : "") + 
    ((this.domain) ? "; domain=" + this.domain : "");
  }



new Cookie();  // need to create a "dummy" Cookie object first
Cookie.prototype.store = Cookie_store;
Cookie.prototype.get   = Cookie_get;
Cookie.prototype.del   = Cookie_del;


// personalized settings defaults

var dmmArray = new Array();
dmmArray[0]  = 0;  // detail: full = bold
dmmArray[1]  = 0;  // condensed = normal
dmmArray[2]  = 0;  // underline: on
dmmArray[3]  = 1;  // off
dmmArray[4] = 1;  // font face: arial
dmmArray[5] = 0;  // times
dmmArray[6] = 0;  // comic
dmmArray[7] = 0;  // courier
dmmArray[8] = 0;  // verdana
dmmArray[9]  = 0;  // font size: smallest
dmmArray[10]  = 1;  // small
dmmArray[11]  = 0;  // medium
dmmArray[12]  = 0;  // large
dmmArray[13]  = 0;  // larger

dmmArray[14]  = 0;
dmmArray[15]  = 0;
dmmArray[16]  = 0;
dmmArray[17]  = 0;
dmmArray[18]  = 0;
dmmArray[19]  = 0;


var d = document;

var BOLD = 1;
var NORMAL = 0;
var SMALL = 2;
var MEDIUM = 3;
var LARGE = 4;
var ARIAL = 5;
var TIMES = 6;
var COMIC = 7;
var COURIER = 8;
var VERDANA = 9;
var ON = 10;
var OFF = 11;


function fontit()
	{
if (dmmArray[0] == 1)
  document.write("<b>");


if (dmmArray[4] == 1)
  document.write("<font face=arial>");
else if (dmmArray[5] == 1)
  document.write('<font face="Times Roman">');
else if (dmmArray[6] == 1)
  document.write('<font face="Comic Sans MS">');
else if (dmmArray[7] == 1)
  document.write("<font face=courier>");
else if (dmmArray[8] == 1)
  document.write("<font face=verdana>");


if (dmmArray[9] == 1)
  document.write("<font size=1>");
else if (dmmArray[10] == 1)
  document.write("<font size=2>");
else if (dmmArray[11] == 1)
  document.write("<font size=3>");
else if (dmmArray[12] == 1)
  document.write("<font size=4>");
else if (dmmArray[13] == 1)
  document.write("<font size=5>");

 }


function openPopupWin(urlToOpen)
  {
 if (dmmArray[13] == 1)
    popupWin = window.open(urlToOpen, "pw", "scrollbars,toolbar,menubar,location,resizable,width=260,height=440");
  else
    popupWin = window.open(urlToOpen, "pw", "scrollbars,toolbar,menubar,location,resizable,width=240,height=400");

    popupWin.focus();  
  }


