
function setCookie(name, value, permanent) 
{
  var expires = '';
  if (permanent) 
  {
    expires = '; expires=' + (new Date()).toGMTString().replace(/20\d\d/, 2020);
  }
  document.cookie = name+"="+value+expires+"; path=/";
}

function getCookie(name) 
{
  var i, crumbs, crumb;
  crumbs = document.cookie.split(';');

  for (var i=0; i<crumbs.length; i++) 
  {
    //crumb = crumbs[i].trim();
    crumb = crumbs[i];

    if (crumb.indexOf(name + "=") == 0) 
    {
      return crumb.substring((name + "=").length);
    }
  }
  return '';
}


function loadPreferences() 
{
  var color = getCookie('keratoconusopenshaw');
  if (color == '') 
  {
    color = 'silver';
  }  
  // alert(cookie);
  //document.getElementById('tblMenu').className = color + '_menu_bg';
  document.getElementById('spnHeader').className = color + '_banner';
  document.getElementById('spnSubHeader').className = color + '_subtitle';  
  document.getElementsByTagName('body')[0].className = color + '_body';
  document.getElementById('tdFooter').className = color + '_footer';  
  document.getElementById('tblFontSizer').className = color + '_font_sizer';      
}

function setBackgroundColor(color)
{
	document.getElementsByTagName('BODY')[0].className = color + '_body';	   	
	//document.getElementById('tblMenu').className = color + '_menu_bg';
	document.getElementById('spnHeader').className = color + '_banner';
    document.getElementById('spnSubHeader').className = color + '_subtitle'; 
    document.getElementById('tdFooter').className = color + '_footer';   
	document.getElementById('tblFontSizer').className = color + '_font_sizer';     	
	setCookie('keratoconusopenshaw', color, true);
}

window.onload = function() 
{    
	var menu_class = document.getElementById('spnHeader').className;
	var menu_class_text = new Array();
	    menu_class_text = menu_class.split('_');
	var color = menu_class_text[0];	
	setCookie('keratoconusopenshaw', color, true);
    return false;
}

	if(document.images) 
	{					
			home_on = new Image();
			home_on.src = "images/menu_images/home_over.gif";
			home_off = new Image();
			home_off.src = "images/menu_images/home.gif";
	
			anatomy_on = new Image();
			anatomy_on.src = "images/menu_images/anatomy_over.gif";
			anatomy_off = new Image();
			anatomy_off.src = "images/menu_images/anatomy.gif";
			
			keratoconus_on = new Image();
			keratoconus_on.src = "images/menu_images/keratoconus_over.gif";
			keratoconus_off = new Image();
			keratoconus_off.src = "images/menu_images/keratoconus.gif";

			treatment_on = new Image();
			treatment_on.src = "images/menu_images/treatment_over.gif";
			treatment_off = new Image();
			treatment_off.src = "images/menu_images/treatment.gif";

			fund_on = new Image();
			fund_on.src = "images/menu_images/fund_over.gif";
			fund_off = new Image();
			fund_off.src = "images/menu_images/fund.gif";

			goal_on = new Image();
			goal_on.src = "images/menu_images/goal_over.gif";
			goal_off = new Image();
			goal_off.src = "images/menu_images/goal.gif";

			team_on = new Image();
			team_on.src = "images/menu_images/team_over.gif";
			team_off = new Image();
			team_off.src = "images/menu_images/team.gif";

			participation_on = new Image();
			participation_on.src = "images/menu_images/participation_over.gif";
			participation_off = new Image();
			participation_off.src = "images/menu_images/participation.gif";

			study_on = new Image();
			study_on.src = "images/menu_images/study_over.gif";
			study_off = new Image();
			study_off.src = "images/menu_images/study.gif";

			link_on = new Image();
			link_on.src = "images/menu_images/link_over.gif";
			link_off = new Image();
			link_off.src = "images/menu_images/link.gif";

			dform_on = new Image();
			dform_on.src = "images/menu_images/form_over.gif";
			dform_off = new Image();
			dform_off.src = "images/menu_images/form.gif";
			
			xlink_on = new Image();
			xlink_on.src = "images/menu_images/cross_over.gif";
			xlink_off = new Image();
			xlink_off.src = "images/menu_images/cross.gif";

			contact_on = new Image();
			contact_on.src = "images/menu_images/contact_over.gif";
			contact_off = new Image();
			contact_off.src = "images/menu_images/contact.gif";
			
	}
	function swapOn(img) 
	{
		if(document.images) 
		{
			document.images[img].src = eval(img + "_on.src");
		}
	}
	function swapOff(img) 
	{
		if(document.images) 
		{
		    document.images[img].src = eval(img + "_off.src");
		}
	}
	

