var $j = jQuery.noConflict();
     
$j(document).ready(function(){
	// set all links that are marked with rel="external" to target="_blank" (standard compliant!)
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
		}
	}
	
	// Hover-Effekt Forumübersicht
	$j("div.forum-topic-new").hover(
		function(){
			$j("div.details", this).addClass("highlighted");
		},
		function(){
			$j("div.details", this).removeClass("highlighted");
		}
	);
	
	// Hover-Effekt LinkedContent
	$j("div.linked-content a").hover(
		function(){	
			$j(this).parent().addClass("hover");
		},
		function(){
			$j(this).parent().removeClass("hover");
		}
	);
	
	// Hover-Effekt LinkedThreads
	$j("div#col-linked-threads li").hover(
		function(){	
			$j(this).addClass("hover");
		},
		function(){
			$j(this).removeClass("hover");
		}
	);
	
	// promotion lightboxes
	$j("#overlay").css("height", $j("body").height()+30);
	$j("a[rel=lb-hhpc]").click(function() {
		showLightbox('hhpc');
	});
	$j("a[rel=lb-sebastian]").click(function() {
		showLightbox('sebastian');
	});
	$j("a[rel=lb-kalender]").click(function() {
		showLightbox('kalender');		
	});
	$j("a[rel=lb-buch]").click(function() {
		showLightbox('buch');
	});
	
	
	// SEMINARS
	$j("table#seminars-list tr.details a.open").click(function() {
	    // slide down div with details
	    parentTd = $j(this).parent().get(0);
	    $j("div.details-container", parentTd).slideDown();
	    
	    // remove padding-bottom, because there is a space because auf top: -12px
	    $j(parentTd).css("padding-bottom", "0");
	    
	    // avoid going to top on click
	    return false;
	});
	$j("table#seminars-list tr.details a.close").click(function() {
		// slide up div with details
	    innerContainer = $j(this).parent().get(0);
	    $j(innerContainer).slideUp();
	    
	    // add padding-bottom again
	    parentTd = $j(innerContainer).parent().get(0);
	    $j(parentTd).css("padding-bottom", "12px");
	    
	    // avoid going to top on click
	    return false;
	});
});
