

function setFontFamily(font) {

document.body.style.fontFamily = font;

createCookie("font", font, 365);

}



function getFontFamily() 

{

  if (!document.body)

  {

    return 0;

  }



  var font;

  var body = document.body;



  if (body.style && body.style.fontFamily)

  {
    font = body.style.fontFamily;

  }

  else if (typeof(getComputedStyle) != 'undefined')

  {
    font = getComputedStyle(body,'').getPropertyValue('font-family');

  }
  else if (body.currentStyle)

  {

    font = body.currentStyle.fontFamily;

  }

  else
  {

    var font = "georgia, ms sans serif, tahoma, verdana, arial, helvetica, sans-serif";

  }

  return font;

}



function createCookie(name,value,days) {

  if (days) {

    var date = new Date();

    date.setTime(date.getTime()+(days*24*60*60*1000));

    var expires = "; expires="+date.toGMTString();

  }

  else expires = "";

  document.cookie = name+"="+value+expires+"; path=/; domain=www.beckes.org;";

}



function readCookie(name) {

  var nameEQ = name + "=";

  var ca = document.cookie.split(';');

  for(var i=0;i < ca.length;i++) {

    var c = ca[i];

   while (c.charAt(0)==' ') c = c.substring(1,c.length);

    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);

  }
  return null;

}



var cookie = readCookie("font");

var font = cookie ? cookie : getFontFamily();

setFontFamily(font);
