/* <![CDATA[ */
$(document).ready(function () {
							
	// Login Tab
	$("#kundenlogin").hide();
	$("ul.box236_tabs li:first").addClass("tab_aktiv").show();
	$("div.tab_inhalt:first").show();
	
	$("ul.box236_tabs li").click(function() {
		$("ul.box236_tabs li").removeClass("tab_aktiv"); 
		$(this).addClass("tab_aktiv"); 
		$(".tab_inhalt").hide();

		var activeTab = $(this).find("a").attr("href");
		$(activeTab).fadeIn(); 
		return false;
	});
	
	// Infotool
	$("#infotool").FormValidate({
		phpFile: "",
		ajax: false,
		validCheck: true
	});		
	
	$("#infotool a").tooltip({
		bodyHandler: function() {
			return $($(this).attr("href")).html();
		},
		showURL: false
	});
	
	
	// Form Login
	$("#anmeldung").FormValidate({
		ajax: false,
		validCheck: true
	});	
	
	// Fussnote
	$(function(){  
		$("#fussnote_exp").click(function(event) {  
			$("#fussnote").betterSlide("#fussnote_exp");
			//event.preventDefault();  
			//$("#fussnote").slideToggle();  
		});  
		$("#fussnote a").click(function(event) {  
			event.preventDefault();  
			$("#fussnote").slideUp();  
		});  
	});
	
	// Bildzoom	
	$("a.bild").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'titlePosition' : 'inside'
	});
	
	// Popup	
	$("a.popup").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'autoDimensions' : false,
		'width' : 560,
		'height' : 400,
		'titleShow' : false
	});
	
});

// Showing an element an scroll to it
$.fn.betterSlide = function(destination) {
	// where in px from top is the element?
    var dest = $(destination).offset().top;
	// show the element and as callback scroll it into the viewport (if not animated)
    jQuery(this).show(1, function() {
		$("html:not(:animated),body:not(:animated)").animate({ scrollTop: dest}, 2000, "swing" );
	});
};

// Fenster öffnen
function fenster (url, breite) {
	window.open(url, "Fenster", "height = 510, width = " + breite + ", scrollbars = yes, resizable = yes");
}

// Link href
function link (link) {
	location.href = link;
}

// Ebene (Login) aus-/einblenden
function anzeigeAus (id, id2) {
	document.getElementById(id).style.display = 'none';
	if (id2) {
		document.getElementById(id2).style.display = '';
	}
}

function anzeigeAn (id, id2) {
	document.getElementById(id).style.display = '';
	if (id2) {
		document.getElementById(id2).style.display = 'none';
	}
}

/* ]]> */
