var loginLang = new Array();
loginLang['ws_user'] = "Benutzername";
loginLang['pwd'] = "Passwort";

$(document).ready(function(){
    $("a#topLink").click(function(event){
        $('html, body').animate({
            scrollTop: 0
        }, 'slow');
        event.preventDefault();
    });
	$("#login input").bind("focus", function(event){
		if($(this).val() == loginLang['ws_user'] || $(this).val() == loginLang['pwd'])
		{
			$(this).val("");
		}
	});
	$("#login input").bind("blur", function(event){
		if($(this).val() == "")
		{
			$(this).val(loginLang[$(this).attr('name')]);
		}
	});
	
	$('.shorten').each(function() {
		if ($(this).height() > 102) {
			$(this).attr('rel', $(this).height() + 26);
			$(this).height(102);
			$(this).find('img').hide();
			$(this).append('<div class="close">&nbsp;...&nbsp;&nbsp;<img class="expand" src="'+$("#goToTop").attr("src")+'" alt="mehr lesen" /><div>');
		}
	});
	
	$('.shorten .close .expand').live('click', function() {
		var theShorten = $(this).parents('.shorten');
		theShorten.animate({"height": theShorten.attr('rel')});
		theShorten.find('img').show();
		theShorten.find('.close').height(26);
		theShorten.find('.close').html('<a class="contract right">x schliessen</a>');
	});
	$('.shorten .close .contract').live('click', function() {
		var theShorten = $(this).parents('.shorten');
		theShorten.find('img').hide();
		theShorten.find('.close').height(17);
		theShorten.animate({"height": 102}, function() {
			theShorten.find('.close').html('<span class="contract">&nbsp;...&nbsp;&nbsp;<img class="expand" src="'+$("#goToTop").attr("src")+'" alt="mehr lesen" /></span>');
		});
	});
	
	$("#n"+$("#navigation a.selected").find("img").attr("alt")).show();
	$("#navigation a").mouseover(function() {
		$(".subNavi").hide();
		$("#navigation a").removeClass('selected');
		$(this).addClass('selected');
		$("#n"+$(this).find("img").attr("alt")).show();
	});
	
	/* Livestream online status */
	$(".livestream_online").each(function(index, value) {
		var new_data = '';
		$.get('livestreams.php?retrieveStatus=' + $(this).html(), function(data) {
			$(".livestream_online:eq(" + index + ")").html(data).show();
		});
	});
	
	$("img.skillung").tooltip({
		showURL: false
	});
});
