$(document).ready(function() {
	$(".NewsMessages, .AgendaMessages").each(function(i,e) {
		if($(this).height() > 134)
		{
			var Shadow = $("<div class='ShadowNewsBox'></div>");
			//$(Shadow).css({ " });
			$(this).parent().parent().parent().append(Shadow);
		}
	});
	
	$(".ContainerAgenda").css("cursor", "pointer").click(function() { window.location = "/Agenda.aspx"; });
	$(".ContainerNews").css("cursor", "pointer").click(function() { window.location = "/News.aspx"; });
	
	ShadowPageHeight = 0;
	if($("#PageBottomBackground").offset().top + 24 < $("#dnn_FacebookBox").offset().top + $("#dnn_FacebookBox").height() + $("#dnn_TwitterBox").height())
	{
		ShadowPageHeight = $("#dnn_FacebookBox").offset().top + $("#dnn_FacebookBox").height() + $("#dnn_TwitterBox").height() - ($(".ContainerShopProducts").offset().top + 58);
	}
	else
	{
		ShadowPageHeight = $("#PageBottomBackground").offset().top - $(".ContainerShopProducts").offset().top + 24 - $("#page-wrapper").offset().top;
	}
	
	$(".ShadowPage").css({
		"top":$(".ContainerShopProducts").offset().top + 57,
		"display":"block",
		"left":$(".ContainerShopProducts").offset().left - $("#page-wrapper").offset().left,
		"height":ShadowPageHeight
	});
	$(".ContainerSearchBox table").attr("cellpadding", "0").find("td").css({ "vertical-align":"top", "padding-bottom":"10px" });
	$(".ContainerSearchBox input[id$='SearchInput_txtSearch']").addClass("SearchField");
	
	// Formatting the Search Results
	$("table[id$='SearchResults_dgResults']")
		.addClass("SearchResultsTable")
		.find("tr").click(function() { window.location = $(this).find("a").attr("href"); });
	$("table[id$='SearchResults_dgResults']").find("td:eq(0)").width("40px");
	$("span[id*='SearchResults_dgResults_lblRelevance'], span[id*='SearchResults_dgResults_lblPubDate']").css("display", "none");
	$("table[id$='SearchResults_dgResults'] td").contents().filter(function () {
        return this.nodeType != 1;
    }).replaceWith("");

});
