function imgSwap(xx){
	var $tmp = $("#" + xx + " .content a");
	$tmp.each(function(){
		$(this).hover(function(){
			$(this).find("img").attr("src","http://ftpcontent.worldnow.com/kswt/custom/" + $(this).attr("rel") + "_on.jpg");
		},	function(){
			$(this).find("img").attr("src","http://ftpcontent.worldnow.com/kswt/custom/" + $(this).attr("rel") + ".jpg");
		})			
	});
}

$(document).ready(function () {
	//$("#WNHeader #WNBranding #WNBrandingImage").attr("src","http://ftpcontent.worldnow.com/kswt/custom/hdr_branding.jpg");

	//FORMS, POLLS, QUICK SIGNUP HEADER
	$(".wnDVQuickForm, .wnDVQuickSignup").each(function () {
		$(this).find(".wnDSItems-standard:first h4").wrapInner("<span class='wrap' />");
	});
	$(".wnMoreLink").text("More");
	/* OPTIMUS V1 CODE */
	//$(".feature .more .text").text("More");

	// REMOVE BOTTOM BORDER
	$("#WNCol2 .wnDSItems-standard, #WNCol3 .wnDSItems-standard, #WNCol4 .wnDSItems-standard").each(function () {
		if ($(this).find(".wnDVSummary").length > 1) {
			$(this).find(".wnDVSummary:last").addClass("last");
		}
	})
	$(".wnDS-4, #WNCol2 .wnDVPromoBox").each(function () {
		if ($(this).find(".wnDSItemsRow").length > 1) {
			$(this).find(".wnDSItemsRow:last .wnDVSummary.wnOdd, .wnDSItemsRow:last .wnDVSummary.wnEven").addClass("last");
		}
	})

	/*BREAKING NEWS */
	if ($("#WNDS-30").length) {
		$("#WNDS-30").append("<div style='clear:both;'></div>");
		$("#WNDS-30 .wnDSHeader").height($("#WNDS-30 .wnDSItems-standard").height() + 5);
	}
	/* OPTIMUS V1 CODE */
	if ($("#DisplaySizeId-30").length) {
		var $bn = $wn("#DisplaySizeId-30");
		$bn.append("<div style='clear:both;'></div>").show();
		var h = 0;
		for (var ii = 0; ii < $bn.find(".feature").length; ii++) {
			h = h + $bn.find(".feature").height();
		}
		if (h >= $bn.find(".header").height()) {
			$bn.find(".header").height(h + 10)
		}
	}

	//Lifestyle
	$("#WNAd44 table tr:first td:first").wrapInner("<div class='ribbonText'></div>");

	//Move Image
	$(".wnDVHeadlineBox .wnDVSummary").each(function () {
		$(this).find(".wnImage").insertBefore($(this).find("h4"));
	});

	$(".wnDVNestedCategory .wnDVSummary").each(function () {
		$(this).find(".wnImage").insertBefore($(this).find("h4"));
	});

	$("#WNHorizontals .wnDVSummary").each(function () {
		$(this).find(".wnImage").insertBefore($(this).find("h4"));
	});

	/* OPTIMUS UPDATE */
	//Move Image
	if ($wn("#DisplaySizeId-4").length) {
		$wn("#DisplaySizeId-4").find(".feature").each(function () {
			$wn(this).find(".summaryImage").insertBefore($wn(this).find(".headline"));
		});
	}
	if ($wn("#DisplaySizeId-7").length) {
		$wn("#DisplaySizeId-7").find(".feature").each(function () {
			$wn(this).find(".summaryImage").insertBefore($wn(this).find(".headline"));
		});
	}
})
