//___________________ jQuery

$(document).ready(function(){

	//zebra striping for tables
	$("table tr:odd").addClass("odd");

	//show inactive navigation sub-pages
	$("nav li.active ul").show();
	
	//toggle "Suche …" string on searchform
	$("nav .sisea-search-form input").focus(function() {
		if ($(this).attr("value") == "Suche ...")
			$(this).attr("value", "");
	});
	$("nav .sisea-search-form input").blur(function() {
		if ($(this).attr("value") == "")
			$(this).attr("value", "Suche ...");
	});
	
	//show/hide facebook newsstream
	$("#fb-stream-toggle-button").click(function () {
		var fb_likebox = $("#fb-likebox");
		if (fb_likebox.css("display") == "none") {
			$("#fb-likebox-cover").fadeIn();
			$("#fb-stream-toggle-button").text("– News verbergen");
		}
		else {
			$("#fb-likebox-cover").fadeOut();
			$("#fb-stream-toggle-button").text("– News anzeigen");
		}
			
		$("#fb-likebox").slideToggle("slow");
    });
    $("#fb-close").click(function() {
    	$("#fb-likebox-cover").fadeOut();
		$("#fb-stream-toggle-button").text("– News anzeigen");
		$("#fb-likebox").slideUp("slow");
    });
	$("#fb-likebox-cover").click(function() {
    	$("#fb-likebox-cover").fadeOut();
		$("#fb-stream-toggle-button").text("– News anzeigen");
		$("#fb-likebox").slideUp("slow");
    });	
    
    //newsticker
    animateNewsTicker();
});

function animateNewsTicker() {
	var width = $("#newsticker").outerWidth();
	var pos = "-" + width + "px";
	$("#newsticker").css('margin-left', '300px');
	$("#newsticker").animate({marginLeft: pos}, 45000, 'linear', animateNewsTicker);
}
