
	sfHover = function() {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	
	sfSize = function() {
			
		var h1=parseInt(document.getElementById("content").offsetHeight);
		var h2=parseInt(document.getElementById("navAlpha").offsetHeight);
		var nh=0;
		
		if (h1>h2) nh=h1;
		if (h1<h2) nh=h2;
		
//		document.getElementById("logo").style.top=parseInt(h1-29)+'px';
//		document.getElementById("logo").style.left=parseInt(document.body.offsetWidth-84)+'px';
//		document.getElementById("logo").style.display='block';
	}

	if (window.attachEvent) window.attachEvent("onload", sfHover); // kun i IE
	
	if (window.addEventListener) window.addEventListener("load", sfSize, false); // i Firefox
	else if (window.attachEvent) window.attachEvent("onload", sfSize); // i IE
	
	


	
	
	function setActiveStyleSheet(title, reset) {
		var i, a, main;
		for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
				a.disabled = true;
				if(a.getAttribute("title") == title) a.disabled = false;
			}
		}
		if (reset == 1) {
			createCookie("wstyle", title, 365);
		}
	}

	function setStyle() {
		var style = readCookie("wstyle");
		if (style != null) {
			setActiveStyleSheet(style, 0);
		}
	}


// ----------------------------------------------
// Cookie functions
// ----------------------------------------------

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+";domain=.wired.com;path=/;";
}

// ----------------------------------------------

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;
}	
	
