// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function setStyle(the_style)
{
	//define expiration date as a long time from now
	var the_date = new Date("December 31, 2023");
	var the_cookie_date = the_date.toGMTString();

	//initialize cookie and add info to it
	var the_cookie = "rakehell_style=" + the_style;
	the_cookie = the_cookie + ";expires=" + the_cookie_date;

	//drop the cookie and refresh the page
	document.cookie = the_cookie;
	document.location.reload();
}

var rake_style = getCookie('rakehell_style');

//if the cookie hold one of the styles, document.write a call to that style
if (rake_style == "largeserif" || rake_style == "largesans" || rake_style == "mediumserif" || rake_style == "mediumsans" || rake_style == "smallsans")
document.write("<LINK rel=stylesheet href=style/" + rake_style + ".css type=text/css>");


function Swap(image_name,new_src)
{
	if(document.images){window.document.images[image_name].src = new_src;}
}
