$(document).ready(function() {
	$("#QuickLinks .QuickLinks").click(function(e) {
		e.preventDefault();
		$(this).addClass("Active");
		$("#QuickLinksContainer").fadeIn(); //.fadeTo("", 0.9);
	});
	$("#QuickLinks .QuickLinks, #QuickLinksContainer").mouseleave(function() {
		t1 = window.setTimeout("HideQuickLinks()", 500);
	}).mouseenter(function() {
		clearTimeout(t1);
	});
	
	// Simple Gallery: table cellspacing, cellpadding
	$(".ModuleContent .ModSimpleGalleryC table").attr("cellpadding", 0).attr("cellspacing", 0);
	$(".ModuleContent .ModSimpleGalleryC .View > tbody > tr > td").attr("align", "left").has(".Normal:empty").css("padding-bottom", "17px");
	//$(".ModSimpleGalleryC table.View .Normal:empty")
	
	/* References Lightbox */
	$(".EffectLightboxReferences").fancybox({ 'type':'iframe', 'width':420, 'height':325 });
	
	//$(".Facebook").attr("href", "http://www.facebook.com/share.php?u=" + encodeURI(location.href) + "&t=" + encodeURI(document.title));
	
	/*Equalize();*/
	window.setTimeout("Equalize()",500);
	$(window).load(function() {
		Equalize();
	});
	
	$(".Tab449 .DNN_Documents .BezeichnungHeader").width("249px");
	$(".Tab449 .DNN_Documents .KategorieHeader").width("158px");
	$(".Tab449 .DNN_Documents .amHeader").width("151px");
	$(".Tab449 .DNN_Documents .DownloadHeader").width("115px");
	
	$(".FacebookThis").click(function(e) {
		e.preventDefault();
		window.open("http://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(window.location.href) + "&t=" + encodeURIComponent(window.document.title), "FacebookShare", "menubar=0,resizable=1,width=550,height=350");
	});
	
	$(".TwitterThis").click(function(e) {
		e.preventDefault();
		window.open("http://www.twitter.com/share?url=" + encodeURIComponent(window.location.href) + "&text=" + window.location.href, "FacebookShare", "menubar=0,resizable=1,width=550,height=350");
	});
});

function HideQuickLinks()
{
	$("#QuickLinksContainer").fadeOut("", function() { $("#QuickLinks .QuickLinks").removeClass("Active"); });
}

function Equalize()
{
	$(".ColumnsHome .c25l, .c50r .DnnModule, .c50l .DnnModule, .c25r .DnnModule, .c75l .DnnModule").height("auto");
		/* Equal Height Boxes on Home Page */
	
	var maxHeight = Math.max($(".ColumnsHome .c25l:eq(0)").height(), $(".ColumnsHome .c25l:eq(1)").height());
	maxHeight = Math.max(maxHeight, $(".ColumnsHome .c25l:eq(2)").height());
	$(".ColumnsHome .c25l .subcl").height(maxHeight);
	
		// Spaltenanordnung: Module im 50% / 50% Layout jeweils immer gleich hoch
	$(".c50l .DnnModule").each(function(i,e) {
		var maxHeight = Math.max($(".c50r .DnnModule").eq(i).height(), $(".c50l .DnnModule").eq(i).height());
		$(".c50r .DnnModule:eq(" + i + "), .c50l .DnnModule:eq(" + i + ")").css("height", maxHeight);
	});
	
	// Spaltenanordnung: Module im 75% / 25% Layout jeweils immer gleich hoch
	$(".c75l .DnnModule").each(function(i,e) {
		var maxHeight = Math.max($(".c25r .DnnModule").eq(i).height(), $(".c75l .DnnModule").eq(i).height());
		$(".c25r .DnnModule:eq(" + i + "), .c75l .DnnModule:eq(" + i + ")").css("height", maxHeight);
	});
}
