var AOLwait=150;
var AOLon,roimg,origsrc=null;
function AOLattachListHover(baseName) {
	var navRoot = document.getElementById(baseName).getElementsByTagName("UL")[0];
	if(navRoot!=null){
		for (i=0;i<navRoot.childNodes.length;i++) {
			var node = navRoot.childNodes[i];
			if (node.nodeName=="LI"){
				AOLattachHover(node);
				var images=node.getElementsByTagName("IMG");
				if(images.length>0){
					node.arrow=images[0];
					if(!roimg){
						origsrc=node.arrow.src;
						roimg=new Image();
						roimg.src=origsrc.substring(0,origsrc.indexOf(".gif"))+"_ro.gif";
					}
				}
			}
		}
	}
}
function AOLattachHover(node){
	if(node!=null){
		if(!node.id){
			node.id="AOLnode_"+Math.random();
			node.isNav=true;
		}
		node.onmouseover=AOLmenuOn;
		node.onmouseout=AOLmenuOff;
	}
}
function clear(node){if(node.timeout!=null){clearTimeout(node.timeout);node.timeout=null;}}
function AOLmenuOn(e){
	clear(this);
	if(AOLon!=null&&AOLon!=this)
		AOLturnOff(AOLon);
	if(AOLon!=this){
		AOLon=this;
		this.className+=" hover";
		toggleArrow(this,true);
	}
}
function AOLmenuOff(e){
	if(this.timeout) clearTimeout(this.timeout);
	this.timeout=setTimeout("AOLclose('"+this.id+"')",AOLwait);
}
function AOLclose(id){
	var node=document.getElementById(id);
	AOLturnOff(node);
	clear(node);
}
function AOLturnOff(node){
	var hoverIndex=node.className.indexOf("hover");
	if(hoverIndex!=-1){
		node.className=node.className.substring(0,hoverIndex);
		toggleArrow(node,false);
		if(AOLon==node) AOLon=null;
	}
}
function toggleArrow(node,on){
	if(node.isNav&&node.arrow){
		var path=node.arrow.src;
		if(on&&path.indexOf("_ro.gif")==-1) path=roimg.src;
		else if(path.indexOf("_ro.gif")!=-1) path=origsrc;
		node.arrow.src=path;
	}
}
function initAOLHeader(){
	AOLattachListHover("AOLmenu");
	AOLattachHover(document.getElementById("AOLlivingLink"));
}
setTimeout("initAOLHeader()",0);

if(document.getElementById("AOLlivingLink")){
	var windowLocation = location.toString();
	var AOLliving = document.getElementById("AOLlivingLink")
	var AOLlivingParent = AOLliving.parentNode
	var throwawayNode = AOLlivingParent.removeChild(AOLliving);
	var htmlBefore = AOLlivingParent.innerHTML;
	if(windowLocation.indexOf("/people/")>-1){
		htmlBefore = "<div id='AOLlivingLink' class='AOLflyoutGuide'>Entertainment&nbsp;Guide <img src='http://img.timeinc.net/web/shared/aol/i/arrow_down_white.gif' /><ul id='AOLlivingGuide'><li><a href='http://people.aol.com/people/ataol/'>Celebrities</a></li><li><a href='http://aolsvc.digitalcity.com/'>CityGuide</a></li><li><a href='http://epg.channel.aol.com/'>Entertainment</a></li><li><a href='http://aolsvc.aol.com/onlinegames/index.adp'>Games</a></li><li><a href='http://movies.channel.aol.com/'>Movies</a></li><li><a href='http://music.channel.aol.com/'>Music</a></li><li><a href='http://tv.channel.aol.com/'>Television</a></li><li><a href='http://comedy.aol.com/'>Comedy</a></li></ul></div>" + htmlBefore;
	}else{
		htmlBefore = "<div id='AOLlivingLink' class='AOLflyoutGuide'>Living&nbsp;Guide <img src='http://img.timeinc.net/web/shared/aol/i/arrow_down_white.gif' /><ul id='AOLlivingGuide'><li><a href='http://living.aol.com/aolliving/beauty_style'>Beauty &amp; Style</a></li><li><a href='http://diets.aol.com/'>Diet &amp; Fitness</a></li><li><a href='http://foodchannel.aol.com/food/channel/'>Food</a></li><li><a href='http://health.aol.com/'>Health</a></li><li><a href='http://homechannel.aol.com/aolhome/decorating'>Home</a></li><li><a href='http://aolsvc.womens.tarot.aol.com/aol/index2.php'>Horoscopes</a></li><li><a href='http://content.living.aol.com/coaches'>Life Coaches</a></li><li><a href='http://living.aol.com'>Living</a></li><li><a href='http://living.aol.com/aolliving/organizing'>Organizing</a></li><li><a href='http://parenting.aol.com/parenting/onlyonaol/'>Parenting</a></li></ul></div>" + htmlBefore;
	}
	AOLlivingParent.innerHTML = htmlBefore;
}