var GB_ANIMATION = true;
$(document).ready(function() { 

	// Anmeldeformular
	if ($('.fehlt').length) {
		$(this).find(':input:not([value=""])').removeClass('leer');
		var fehlendeEingaben = $(this).find(':input[value=""][rel="pflicht"]');
		$(fehlendeEingaben).addClass('leer');
	}		

	// Layer-Box für die Terminübersicht
	$("a.greybox").click(function(){
		var t = this.title || $(this).text() || this.href;
		GB_show(t,this.href,560,850);
		return false;
	});

	// Navigation
	function auf(){ $(this).addClass('hover').children('ul').show(); }
	function zu(){ $(this).removeClass('hover').children('ul').hide(); }
	$('#nav li:has(>ul)').hoverIntent({
	   sensitivity: 1, 
	   interval: 30, 
	   over: auf, 
	   timeout: 400, 
	   out: zu 
	});
	
	// Tabellen
	$('table tr:even').addClass('wechsel');
	
	// Links
	var $last = $([]);
	$.localScroll({
		target: '#inhalt', 
		queue: true,
		duration: 400,
		hash: true,
		onBefore:function(e, anchor, $target){ 
			$last.removeClass('scrolling');
			$last = $(this).addClass('scrolling');
			if(this.blur)
				this.blur();
		},
		onAfter:function(anchor){
			$last.removeClass('scrolling');
		}
	});
	
	// Veranstaltungsorte-Tabellen
	if($('table.vo').length) { 
		$('table tr:even').addClass('wechsel');
		$('table tr td:first-child').find('a').each(function() { 
			var ort = $('table.vo').find('tr:first-child th').text();
			var schwerpunkt = $(this).parent().next().find('a').text();
			var datum = $(this).text();
			$(this).attr({ target: '_parent', href: this.href+'?seminar='+encodeURI(schwerpunkt)+'&datum='+encodeURI(datum)+'&ort='+encodeURI(ort) });
		});
	};	
	
	// Tierarzt im Spiegel
 	$('<div class="spiegelbox"></div>').insertBefore('#footer').load('spiegel.htm');
	$('#footer li.link02 a').click(function() { 
		$('.spiegelbox').slideToggle(600);
		return false;
	});

});
