var sel = false;

$(document).ready(function() {
	$(".slidetext").hide()
	$("p.slideanker").focus(function() {
		this.blur();
	})
	$("p.slideanker").click(function() {
		$(this).next().slideToggle();
		if (sel != this && sel != false) {
			$(sel).next().slideUp();
		}
		sel = this;
		return false
	})
	$("ul#menu_footer").prepend('<li><a href="javascript:window.print()" class="drucken"><img src="/img/misc/print.gif" width="20" height="16" alt="Salvia Drucken-Icon" /></a></li>')
	$('form').submit(function() {
		var foc = false;
		$(':input',this).each(function() {
			if ($(this).is(':visible')) {
				var prev = $(this).prev();
				if (prev.attr('alt') == 'pflicht') {
					var err = false;
					if ($(this).val() == false) { err = true }
					else if (this.name == 'teilnehmer') {
						var tl = this.value.split("\n");
						var c=0;
						for(var i=0;i<tl.length;i++) {
							if (tl[i]) { c++ }
						}
						if (c > 4) {
							err = true
						}
					}
					if (err == true) { if (foc == false) { this.focus(); foc = true } prev.attr('class','error') }
					else { prev.attr('class',''); }
				}
				var v = this.value;
			}
		})
		return foc == false ? true : false;
	})
	if ($("td.info").length > 0) {
		$('input.eingabefeld').css('width','32em');
		$("td.info").show()
		$('body').prepend('<div id="infobox">asdf</div>');
		$("td.info img").mouseover(function(e) {
			$('div#infobox').html($(this).attr('alt'));
			$('div#infobox').show();
			var top = e.pageY - 10;
			var left = e.pageX + 15;
			$('div#infobox').css('left',left+'px');
			$('div#infobox').css('top',top+'px');
		})
		$("td.info img").mouseout(function() {
			$('div#infobox').hide();
		})
	}
})


