$(document).ready(function(){
	// SWITCH LOGO ON MOUSE OVER
	$(".logo_img").hover(
		function() {
			$("#logo_home").stop().animate({"opacity": "1"}, "200");
		},
		function() {
			$("#logo_home").stop().animate({"opacity": "0"}, "200");
	 });

	$(".gewerke_menu_img").hover( 
    		function () {
	    		$(this).animate( { opacity: 1}, "200" );
    		}, 
	    	function () {
    			$(this).animate( { opacity: 0.5}, "200" );
	    	}
	);	
    

	// SHOW "TOP LINK" ON PAGE END
	$(function () {
        	var $win = $(window);
	        $win.scroll(function () {
	            if ($win.scrollTop() == 0) {
	            }
        	    else if ($win.height() + $win.scrollTop() == $(document).height()) {
	                $(".page_footer_toplink").stop().animate({"opacity": "1"}, "200");
	                $("#backToTopLink").stop().animate({"margin-top": "0px"}, "200");
	            }
	            else if ($win.height() + $win.scrollTop() < $(document).height() - 5) {
	                $(".page_footer_toplink").stop().animate({"opacity": "0"}, "200");
	                $("#backToTopLink").stop().animate({"margin-top": "50px"}, "200");
	            }
	        });
	});	
    
	// GO TO TOP ON TOP LINK CLICK
	$('#backToTopLink').click( function() {
	    	var target_top = $('#page_wrapper').offset();
	    	$('html, body').animate({scrollTop:target_top}, 500);
	})
    
	// SET NEWSLETTER-EMAIL-INPUT-FIELD VALUE FOR FOOTER-INPUT
	$(".textinput").focus( function () {
	    	$(this).val("");
	    	$(this).css("color", "#000");
	})	
	$(".textinput").blur( function () {
	    	if ($(this).val() == "") {
    			$(this).val("Bitte hier Ihre Email-Adresse eintragen");
    			$(this).css("color", "");
	    	};
	})
	
	// SET NEWSLETTER-EMAIL-INPUT-FIELD VALUE FOR NEWSLETTER-TEMPLATE
	$(".sub_textinput").focus( function () {
	    	if ($(this).val() == "Bitte hier Ihre Email-Adresse eintragen") {
    			$(this).val("");    			
	    	};
	    	$(this).css("color", "#000");
	})	
	$(".sub_textinput").blur( function () {
	    	if ($(this).val() == "") {
    			$(this).val("Bitte hier Ihre Email-Adresse eintragen");
    			$(this).css("color", "");
	    	};
	})  

	$(".navi a").live ("click", function () {
		this.blur();
	})
});
