jQuery(document).ready(function () {  
    
    // jquery-ui datepicker    
    $('#date').datepicker({inline: false, altFormat: 'yy-mm-dd'});
    
    // CHECKBOX LINKS
    $('input:checkbox + label')
    	.css('cursor', 'pointer')
    	.click(function(){
    		$(this).prev('input').attr('checked', !$(this).prev('input').attr('checked'));
    	});
    
	// FORUM LINKS
	$('.level2').hover(function(){
		$(this).addClass('active');
	}, function(){
		$(this).removeClass('active');
	});
	$('.level2').click(function(){
		location = $(this).find('span.first a').attr('href');
	});
	
	
	// TOP NAVI LANGUAGES
	$('.topnavi li.language').click(function(){
		$('ul#languages').toggleClass('active');
		$(this).toggleClass('active');
	});
	
	//focus in input-form bei klick auf label
	$('.absolute_label').click(function(){
		$(this).next('input').focus();
	});
        $('.logform label.absolute_label').click(function(){
            onfocus($(this), $(this).next('input'));
            $(this).next('input').focus()
        });
        $('.logform input#signin_username, .logform input#signin_password').focus(function(){
            onfocus($(this).prev('label'), $(this));
        });
        
        $('.logform input').blur(function(){
            if($(this).attr('type')=='password') var labeltext = 'Passwort:';
            else var labeltext = 'Benutzername:';
            if ($(this).val()=='') $(this).prev('label').html(labeltext);
        });
        function onfocus(label, input){
            $(label).html('');
            $(input).css('text-indent', '0px');
            $(input).val('');
        }

        $('.mainnavi a.facebook').click(function(event){
            u=location.href;
            t=document.title;
            window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),' sharer', 'toolbar=0, status=0, width=626, height=436');
            event.preventDefault();
        });

        $('.mapmarker').hover(function(){
            $('#clear').addClass($(this).attr('id'));
            $('.info#'+$(this).attr('id')).addClass('active');
        }, function(){
            $('#clear').removeClass();
            $('.info.active').removeClass('active');
        });

        // Forum Navi
        $('ul.arrowbar li a').hover(function(){
           $(this).parent('li').prev().find('a').css('background-position', 'right -120px').addClass('arrowbarover');
        }, function(){
           $('.arrowbarover').css('background-position', '').removeClass();
        });
        
        // Award Index Tabelle
        $('table.plans tr.link').hover(function(){
          $(this).find('a').addClass('active');
        }, function(){
          $(this).find('a').removeClass('active');
        });
	
});
