
function setFont(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) 
		{
			if(a.getAttribute("title").indexOf("font") != -1)
			{
			//alert(a.getAttribute("title").indexOf("font"));
			   a.disabled = true;
			   if(a.getAttribute("title") == title) a.disabled = false;
			}
		 }
   }
}
function getActiveColor() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("title")
       && !a.disabled) 
	   if(a.getAttribute("title").indexOf("color") != -1)
			{
				return a.getAttribute("title");
			}
  }
  return null;
}
function setColor(title, hover, notCookie) {
   if (homepage)
   {
   hoverColor = hover;
   }
   else 
   {
   	styleLoaded = true;
   }
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) 
		{
			if(a.getAttribute("title").indexOf("color") != -1)
			{
			//alert(a.getAttribute("title").indexOf("font"));
			   a.disabled = true;
			   if(a.getAttribute("title") == title) a.disabled = false;
			}
		 }
   }
   if (notCookie)
   {
   loadBlockText(true);
   }
}
var currentSize = "12px";
function setSize(size, id) {
  if (currentSize == "12px")
  {
  	if(size == "minus")
	{
		title = "size:10px";
		currentSize = "10px";
	}
	else
	{
		title = "size:14px";
		currentSize = "14px";
	}
   }
   else if (currentSize == "10px")
   {
   	 if (size == "plus")
	 {
	 	title = "size:12px";
		currentSize = "12px";
	 }
	}
	else if (currentSize == "14px")
	{
	 if (size == "minus")
	 {
	 	title = "size:12px";
		currentSize = "12px";
	 }
	}
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) 
		{
			if(a.getAttribute("title").indexOf("size") != -1)
			{
			//alert(a.getAttribute("title").indexOf("font"));
			   a.disabled = true;
			   if(a.getAttribute("title") == title) a.disabled = false;
			}
		 }
   }
}
 function getActiveFont() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("title")
       && !a.disabled) 
	   if(a.getAttribute("title").indexOf("font") != -1)
			{
				return a.getAttribute("title");
			}
  }
  return null;
}
 
 function getActiveSize() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("title")
       && !a.disabled) 
	   if(a.getAttribute("title").indexOf("size") != -1)
			{
				return a.getAttribute("title");
			}
  }
  return null;
}
function readCookie(name) {
var pieces = document.cookie.split("/");
	var colorToSet = pieces[3];
	var fontToSet = pieces[1];
	var sizeToSet = pieces[2];
	//Avoids errors when no cookie present
	if (colorToSet == fontToSet)
	{
		colorToSet = "color:blue";
		fontToSet = "font:arial";
		sizeToSet = "size:12px";
	}

	//End initialize values
	if (colorToSet.indexOf("blue") != -1)
	{
		if (homepage)
		{	
			setColor(colorToSet, blueHover, false);
		}
		else
		{
			setColor(colorToSet, null, false);
			menuColor = "Blue";
		}
	}
	else 
	{
	if (homepage)
		{
		setColor(colorToSet, purpleHover, false);
		}
		else 
		{
			setColor(colorToSet, null, false);
			menuColor = "Purple";
		}
	}
	setFont(fontToSet);
	var size = sizeToSet;
	if (size.indexOf("14px") != -1)
	{
		setSize("plus", "large");
		
	}
	else if (size.indexOf("10px") != -1) 
	{
		setSize("minus", "small");
		
	}
	else if (size.indexOf("12px") != -1) 
	{
		currentSize = "10px";
		setSize("plus", "small");
	}
}



readCookie("style");
