/* DYNAMIC STATIC NAV */
var navTx;
function wnNavReset(){
	clearTimeout(navTx);
	$wn(".wnLevel2:visible").hide();
	$wn(".cur").show();
}

function launchDynamicNav(){
	var h = 26;
	var t = 17;
	$wn(".wnMainMenu .wnHorizontal .wnStatic .wnSublevel").css({"z-index": "1000"});

	$wn(".wnStatic .wnLevel1 li:first").attr("rel", "1");
	$wn(".wnStatic .wnLevel1 li:first").siblings("li").each(function(){
		$wn(this).attr("rel", "1");
		if(!$wn(this).find("ul").length){
			$wn(this).append("<ul class='wnLevel2 wnSublevel' style='height: "+ h +"px; top: "+ t +"px; display: none;'><li class='wnFirstNode wnOn'><span><a href=''>&nbsp;</a></span></li></ul>");
		}
	});
	$wn(".wnStatic .wnLevel2 li:first").attr("rel", "2");
	$wn(".wnStatic .wnLevel2 li:first").siblings("li").each(function(){
		$wn(this).attr("rel", "2");
	});
	
	var subnavPos = $wn(".wnMenuSpacer").offset();
	if($wn(".wnLevel2:visible").attr("class") != null){
		//IF A SUB NAV IS PRESENT FOR THE CURRENT CATEGORY
		$wn(".wnLevel2:visible").addClass("cur");
		$wn(".wnLevel2").css({"height": h + "px", "top": t +"px"});
	}else{
		//IF A SUB NAV IS NOT PRESENT FOR THE CURRENT CATEGORY
		$wn("#WNMenuCol1 .wnMenuSpacer").height(h);
		$wn(".wnLevel2").css({"height": h +"px", "top": subnavPos.top +"px", "left": subnavPos.left +"px", "width": ($wn(".wnMenuSpacer").width()-2) +"px", "overflow": "hidden"});
	}
	//$wn("ul.wnLevel1 li.wnFirstNode .wnLeft").css("padding-left","3px");
	$wn("ul.wnLevel1 li[rel='1']").bind("mouseenter", function(){
		clearTimeout(navTx);
		$wn(".wnLevel2:visible").hide();
		$wn(this).find(".wnLevel2").addClass("wnOn").css({"display": "block"});
	});
	$wn("ul.wnLevel1 li[rel='2']").bind("mouseenter", function(){
		clearTimeout(navTx);
	});
	
	$wn("#WNMenuCol1").bind("mouseleave", function(){
		clearTimeout(navTx);
		navTx = setTimeout(function(){
			wnNavReset();
		}, 500);
	});	
}

$wn(document).ready(function(){
	launchDynamicNav();
});


// BEGIN WN LIFESTYLE PROMO RESTYLE //
$wn(document).ready(function(){
	if($wn("#WNAd44 table").html() != null){
		$wn("#WNAd44 table").css({"background": "none", "border": "none", "background-color": "#fff", "border-collapse": "collapse"});
		$wn("#WNAd44 table td:first").css({"background": "url('http://ftpcontent.worldnow.com/wrex/custom/2010/title_bg.gif') no-repeat -3px bottom"});
		$wn("#WNAd44 table td:first").html("<div>"+ $wn("#WNAd44 table td:first").html() +"</div>")
		$wn("#WNAd44 table td:first div").css({"margin-left": "10px", "margin-top": "0px", "color": "#000000", "font": "bold 14.667px Arial", "text-transform": "uppercase", "width": "270px"});
		$wn("#WNAd44 table tr:last td").css({"background-color": "#d8e4f0"});
		$wn("#WNAd44 table tr:last td:first").css({"width": "100px"});
		$wn("#WNAd44 table tr:last td:last").css({"width": "190px"});
	}
	
	if($wn(".wnPromo2C_300x150").html() != null);
		$wn(".wnPromo2C_300x150").css({"background": "url('http://ftpcontent.worldnow.com/wrex/custom/2010/wnPromo_bg.gif') top left no-repeat", "border": "0px solid rgb(255, 255, 255)"});
		$wn(".wnPromo2C_300x150 .wnPromoHeader").css({"margin-left": "10px", "color": "#000000", "font": "bold 14.667px Arial", "text-transform": "uppercase", "width": "270px", "height": "30px", "overflow": "hidden"});
		$wn(".wnPromo2C_300x150 a").css({"color": "#0a3e87"});
});
// END WN LIFESTYLE PROMO RESTYLE //
