$(document).ready(function() { 
/*
    $("table.quicklinks a.help").mouseover( function() { 
	$('table.quicklinks #help span').html($(this).attr("title")).show(); 
    }); 
    $("table.quicklinks").mouseout( function() {
	$('table.quicklinks #help span').html(' ').hide();
    }); 
*/
    var zebra = function() { 
	$(".zebra li:nth-child(odd)").addClass("z1"); 
	$(".zebra li:nth-child(even)").addClass("z2"); 
	$(".zebra tbody tr:nth-child(odd)").addClass("z1"); 
	$(".zebra tbody tr:nth-child(even)").addClass("z2"); 
    }; 
    zebra(); 
    $('a.email').nospam();
/*
    $('<a href="/login/">Login & Neuanmeldung</a>').prependTo('#loginlink');
*/
    $(document.body).ajaxStart(function(){ 
	$('<div id="loading"><img src="/src/img/loading.gif" alt="load" /></div>').appendTo(document.body); 
    }).ajaxStop(function(){ 
    	$('#loading').fadeOut('slow',function(){ $(this).remove(); }); 
    }); 
    $("#tkurs").click( function() {$("#kurs").toggle("slow");}); 
    $("form *").autohelp("#autohelp"); 
	new jqRollover("p.rollover a");
}); 
$.fn.autohelp = function(t, o) { t = $(t); o = o || {}; var h; this.focus(function() { h = t.html(); (o.hide ? t.show() : t).html(this.title); }) .blur(function() { (o.hide ? t.hide() : t).html(h); }); return this; }; 
(function($){
	jqRollover = function(selector)
	{
		this.selector = selector;
		this.elemSets = [];
		var self = this;
		$(function(){ self.setup(); });
	}
	jqRollover.prototype.setup = function()
	{
		this.prepareSets();
		if(!this.elemSets) return;
		this.preploadImgs();
		this.setEvents();
	}
	jqRollover.prototype.prepareSets = function()
	{
		var self = this;
		var $elems = $(self.selector);
		if(!$elems) return;
		$elems.each(function(){ 
			var img = $(this).find("img").eq(0).get(0);
			var imgSrc = img.src;
			if(imgSrc.indexOf("/off/")==-1) return;
			var srcOff = imgSrc;
			var srcOn = imgSrc.replace(/\/off\//,"/on/");
			self.elemSets.push({
				anchor: this,
				img: img,
				srcOff: srcOff,
				srcOn: srcOn
			});
		});
	}
	jqRollover.prototype.setEvents = function()
	{
		var self = this;
		for(var i=0,set; set=this.elemSets[i]; i++){
			$(set.anchor)
				.mouseover(function(){ toOn(this); })
				.focus(function(){ toOn(this); })
				.mouseout(function(){ toOff(this); })
				.blur(function(){ toOff(this); });
		}
		function toOn(anchor){
			var elemSet = self.getElemSetFromAnchor(anchor);
			elemSet.img.src = elemSet.srcOn;
		}
		function toOff(anchor){
			var elemSet = self.getElemSetFromAnchor(anchor);
			elemSet.img.src = elemSet.srcOff;
		}
	}
	jqRollover.prototype.preploadImgs = function()
	{
		for(var i=0,set; set=this.elemSets[i]; i++){
			(new Image).src = set.srcOn;
		}
	}
	jqRollover.prototype.getElemSetFromAnchor = function(anchor)
	{
		for(var i=0,set; set=this.elemSets[i]; i++){
			if(set.anchor==anchor) return set;
		}
	}
})(jQuery);
jQuery.fn.nospam = function(settings) {
	settings = jQuery.extend({
		replaceText: false,
		filterLevel: 'normal'
	}, settings);
	return this.each(function(){
		e = null;
		if(settings.filterLevel == 'low') { // Can be a switch() if more levels added
			if($(this).is('a[rel]')) {
				e = $(this).attr('rel').replace('//', '@').replace(/\//g, '.');
			} else {
				e = $(this).text().replace('//', '@').replace(/\//g, '.');
			}
		} else { // 'normal'
			if($(this).is('a[rel]')) {
				e = $(this).attr('rel').split('').reverse().join('').replace('//', '@').replace(/\//g, '.');
			} else {
				e = $(this).text().split('').reverse().join('').replace('//', '@').replace(/\//g, '.');
			}
		}
		if(e) {
			if($(this).is('a[rel]')) {
				$(this).attr('href', 'mailto:' + e);
				if(settings.replaceText) {
					$(this).text(e);
				}
			} else {
				$(this).text(e);
			}
		}
	});
};
