$(document).ready(function(){
//NAVIGATION STYLES
	$("ul.wnSublevel").css({"background": "none"});
	$("ul.wnSublevel .wnFirstNode").css({"border-top": "0px solid #fff"});
	$("ul.wnSublevel li").css({"background": "url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/menu_bg.png)"});
	$("ul.wnSublevel a").css({"border-top": "0px solid #fff", "border-bottom": "0px solid #fff", "border-left": "1px solid #1f1f1f",  "border-right": "1px solid #1f1f1f" });
	$("ul.wnLevel1 li ul.wnLevel2").width(225);
	for(var ii = 0; ii < $("ul.wnLevel1 li ul.wnLevel2").length; ii++){
		$("ul.wnLevel1 li ul.wnLevel2 li").css({"position": "relative", "top": "-7px"});
		$("ul.wnLevel1 li ul.wnLevel2:eq("+ ii +")").children("li:last").after("<div style='position:relative; top:-7px; height:8px; background:none;'><div style='width:8px; height:8px; background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/menu_corner_left.png) no-repeat; float:left'></div><div style='background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/menu_bottom.png) repeat-x; float:left; width:"+ ($("ul.wnLevel1 li ul.wnLevel2:eq("+ ii +")").width() - 16) +"px; height:8px;'></div><div style='width:8px; height:8px; background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/menu_corner_right.png) no-repeat; float:right'></div><div style='clear:both'></div></div>");
		$("ul.wnLevel1 li ul.wnLevel2:eq("+ ii +")").children("li:first").before("<div style='position:relative; top:-7px; height:18px; width:225px; background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/menu_shadow_top.png) repeat-x;'></div>");
	};

//NAVIGATION ON STATE
	if(document.location.toString().indexOf("http://") != -1){
		var loc = document.location.toString();
	}else{
		var loc = "http://managewncorp.managemdev.worldnow.com/Global/category.asp?C=163715&amp;nav=menu104_5";
	}
	if(loc.indexOf("lobal/") == -1){
		$(".wnMainMenu ul.wnLevel1 .wnFirstNode .wnLeft a img").attr("src", $(this).find(".wnLeft a img").attr("onsrc"));
	}else{
		loc = loc.substring(loc.indexOf("nav=")+4, loc.length);
		$(".wnMainMenu ul.wnLevel1").children("li").each(function(){
			var cLoc = $(this).attr("id");
			cLoc = cLoc.substring(0, cLoc.indexOf("-"));
			if(loc.indexOf(cLoc) != -1){
				$(this).find(".wnLeft a img").attr("src", $(this).find(".wnLeft a img").attr("onsrc"));
			}
		});
	}
});

//GLOBAL MORE LINK STYLING
$(document).ready(function(){
	$(".wnSummaryLink").each(function(){
		var mLink = $(this).text();
//alert(mLink);
		mLink = mLink.substring(0, mLink.indexOf(">"));
		$(this).text(mLink);
	})
});

//ROUNDED CORNERS AND GRADIENT FOR COL2 and COL3 ELEMENTS
function roundBox($el, h, c){
	$el.each(function(){
		$(this).children().wrapAll("<div id='wrapper' style='float:left; width:"+ ($(this).width() - 32) +"px'></div>");
		if(!h){
			var elHeight = $(this).height();
		}else{
			var elHeight = h;
		}
		if(c != "dark"){
			c = "";
		}else{
			c = "_dark";
			$("#wrapper").css({"background": "#f9f9f9"});
			$(this).css({"background": "#f9f9f9"});
		}
		$(this).prepend("<div style='float:left; width:16px; height:16px; overflow:hidden; background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/fh_corner_tl"+ c +".png)'></div><div style='float:left; width:"+ ($(this).width() - 32) +"px; height:16px; overflow:hidden; background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/fh_top"+ c +".png) repeat-x'></div><div style='float:left; width:16px; height:16px; overflow:hidden; background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/fh_corner_tr"+ c +".png)'></div><div style='clear:both; width:0px; height:0px; overflow:hidden;'></div><div class='roundSide' style='float:left; width:16px; height:"+ (elHeight) +"px; background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/fh_left"+ c +".png) repeat-y'></div>");
		$(this).append("<div class='roundSide' style='float:left; width:16px; height:"+ (elHeight) +"px; overflow:hidden; background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/fh_right"+ c +".png) repeat-y'></div><div style='clear:both; width:0px; height:0px; overflow:hidden;'></div><div style='float:left; width:16px; height:16px; overflow:hidden; background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/fh_corner_bl"+ c +".png)'></div><div style='float:left; width:"+ ($(this).width() - 32) +"px; height:16px; overflow:hidden; background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/fh_bottom"+ c +".png) repeat-x'></div><div style='float:left; width:16px; height:16px; overflow:hidden; background:url(http://ftpcontent.worldnow.com/wncorp/custom/redesign2010/images/fh_corner_br"+ c +".png)'></div>");
	});
}
