function fixDate1($el){
	var tDate = $el;
	$(tDate).find("script").remove();
	$(tDate).find("noscript").remove();
	$(tDate).html($(tDate).text());
}

$(document).ready(function(){
	$("a.wnMoreLink").text("Read More >>");
	$("a.wnSummaryLink").text("Read More");
	$("#WNDS-30 .wnDSHeader h3 span").text("Breaking News:");
	$("#WNDS-30 .wnDSItems-standard .wnDVSummary .wnDate").each(function(){
		fixDate1($(this));
	});
	$("#WNDS-30 .wnDVSummary h4 a .wnVideoIncluded").attr("src","http://ftpcontent.worldnow.com/kndu/custom/2011/icon_video.png");
	$("#WNDS-30 .wnDVSummary h4 a").append("<span class='more'>Full Story >></span>");	
	$("#WNDS-30").append("<div style='clear:both;'></div>").show();
	if ($("#WNDS-30 .wnDSItems-standard").height() >= $("#WNDS-30 .wnDSHeader").height()){
		$("#WNDS-30 .wnDSHeader").height($("#WNDS-30 .wnDSItems-standard").height() + 1)
	}	

/* OPTIMUS V1 CODE */
	if($("#DisplaySizeId-30").length){
		$("#DisplaySizeId-30 a.more .text").text("Read More >>");
		$("#DisplaySizeId-30 .header h3 span").text("Breaking News:");
		$("#DisplaySizeId-30 .headline").append("<span class='more'>Full Story >></span>");	
		$("#DisplaySizeId-30").append("<div style='clear:both;'></div>").show();
		var h = 0;
		for(var ii = 0; ii < $("#DisplaySizeId-30 .feature").length; ii++){
			h = h + $("#DisplaySizeId-30 .feature").height();	
		}
		if (h >= $("#DisplaySizeId-30 .header").height()){
			$("#DisplaySizeId-30 .header").height(h + 1)
		}	
	}
})

// BEGIN DYNAMIC STATIC NAV //
var navTx;
function wnNavReset(){
	clearTimeout(navTx);
	$(".wnLevel2:visible").hide();
	$(".cur").show();
}
$(document).ready(function(){
	var h = 26;
	var t = 35;
	$(".wnMainMenu .wnHorizontal .wnStatic .wnSublevel").css({"z-index": "1000"});
	$("#menu54 .wnHorizontal .wnStatic .wnSublevel li").css({ "background-position" : "left 8px" });

	$(".wnStatic .wnLevel1 li:first").attr("rel", "1")
	$(".wnStatic .wnLevel1 li:first").siblings("li").each(function(){
		$(this).attr("rel", "1");
		if(!$(this).find("ul").length){
			$(this).append("<ul class='wnLevel2 wnSublevel' style='height: "+ h +"px; top: "+ t +"px; display: none;'><li class='wnFirstNode wnOn'><span></span></li></ul>");
		}
	});	$(".wnStatic .wnLevel2 li:first").attr("rel", "2")
	$(".wnStatic .wnLevel2 li:first").siblings("li").each(function(){
		$(this).attr("rel", "2");
	});
	
	var subnavPos = $(".wnMenuSpacer").offset();
	if($(".wnLevel2:visible").attr("class") != null){
		//IF A SUB NAV IS PRESENT FOR THE CURRENT CATEGORY
		$(".wnLevel2:visible").addClass("cur");
		$(".wnLevel2").css({"height": h + "px", "top": t+"px"});
	}else{
		//IF A SUB NAV IS NOT PRESENT FOR THE CURRENT CATEGORY
		$(".wnLevel1 li").height($(".wnLevel1 li").height() + t);
		$(".wnLevel1 li ul li").height(h);
		$(".wnLevel1 .wnFirstNode").append("<ul class='wnLevel2 wnSublevel' rel='cur'><li class='wnFirstNode'><span><a href=''>&nbsp;</a></span></li></ul>");
		$(".wnLevel2").css({"height": h+"px", "top": subnavPos.top+"px", "left": (subnavPos.left) +"px", "width": ($(".wnMenuSpacer").width()-2) +"px", "overflow": "hidden"});
	}	$("ul.wnLevel1 li[rel='1']").bind("mouseenter", function(){
		clearTimeout(navTx);
		$(".wnLevel2:visible").hide();
		$(this).find(".wnLevel2").addClass("wnOn").css({"display": "block"});
	});
	
	$("ul.wnLevel1 li[rel='2']").bind("mouseenter", function(){
		clearTimeout(navTx);
	});
	
	$("#WNMenuCol1").bind("mouseleave", function(){
		clearTimeout(navTx);
		navTx = setTimeout(function(){
			wnNavReset();
		}, 500);
	});
	
});
// END DYNAMIC STATIC NAV //
