var UUSize = readCookie("UUSize");
var UUScheme = readCookie("UUScheme");

/* read cookies */
function readCookie(name)
{
  var cookieValue = "";
  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;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

/* write cookies */
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}
/* select the style */
function fontSize(size)
{
	if(size >0 && size < 5)
	{
		if(size == 1)
		{
			writeCookie("UUSize", "1", "9999");
			window.location.reload();
		}
		if(size == 2)
		{
			writeCookie("UUSize", "2", "9999");
			window.location.reload();
		}
		if(size == 3)
		{
			writeCookie("UUSize", "3", "9999");
			window.location.reload();
		}
		if(size == 4)
		{
			writeCookie("UUSize", "4", "9999");
			window.location.reload();
		}
	}
}

if(readCookie("UUSize") == 1)
{
	document.write('<style type="text/css">body {font-size: 90%;}</style>');
}
if(readCookie("UUSize") == 2)
{
	document.write('<style type="text/css">body {font-size: 100%;}</style>');
}
if(readCookie("UUSize") == 3)
{
	document.write('<style type="text/css">body {font-size: 110%;}</style>');
}
if(readCookie("UUSize") == 4)
{
	document.write('<style type="text/css">body {font-size: 117%;}</style>');
}

function displays()
{
	if(readCookie("UUSize") == 1)
	{
		displaysText(1,0,0,0);
	}
	if(readCookie("UUSize") == 2)
	{
		displaysText(0,1,0,0);
	}
	if(readCookie("UUSize") == 3)
	{
		displaysText(0,0,1,0);
	}
	if(readCookie("UUSize") == 4)
	{
		displaysText(0,0,0,1);
	}
}

function displaysText(s, n, l, x)
{
	var so, no, lo, xo, output; 
	
	if(s==1){
		so = '<img src="images/small.gif" width="15" height="15" border="0" alt="Small Text" align="absmiddle" class="accessOn" />';
	}else{
		so = '<a href="#" onclick="javascript:fontSize(1);"><img src="images/small.gif" width="15" height="15" border="0" alt="Small Text" align="absmiddle" class="accessOff" /></a>';
	}
	if(n==1){
		no = '<img src="images/normal.gif" width="15" height="15" border="0" alt="Normal Text" align="absmiddle" class="accessOn" />';
	}else{
		no = '<a href="#" onclick="javascript:fontSize(2);"><img src="images/normal.gif" width="15" height="15" border="0" alt="Normal Text" align="absmiddle" class="accessOff" /></a>';
	}
	if(l==1){
		lo = '<img src="images/large.gif" width="15" height="15" border="0" alt="Large Text" align="absmiddle" class="accessOn" />';
	}else{
		lo = '<a href="#" onclick="javascript:fontSize(3);"><img src="images/large.gif" width="15" height="15" border="0" alt="Large Text" align="absmiddle" class="accessOff" /></a>';
	}
	if(x==1){
		xo = '<img src="images/xlarge.gif" width="15" height="15" border="0" alt="Extra Large Text" align="absmiddle" class="accessOn" />';
	}else{
		xo = '<a href="#" onclick="javascript:fontSize(4);"><img src="images/xlarge.gif" width="15" height="15" border="0" alt="Extra Large Text" align="absmiddle" class="accessOff" /></a>';
	}
	
	output = "Change page font" + so + no + lo + xo;
	document.getElementById('changefont').innerHTML = output;

}
