/**
*
*	simpleTooltip jQuery plugin, by Marius ILIE
*	visit http://dev.mariusilie.net for details
*
**/
(function($){ $.fn.simpletooltip = function(){
	return this.each(function() {
		var text = $(this).find('.tooltiptext').html()
		if(text != undefined) {
			$(this).hover(function(e){
				var tipX = e.pageX + 3;
				var tipY = e.pageY + 10;
				$(this).attr("title", ""); 
				$("body").append("<div id='simpleTooltip' style='position: absolute; z-index: 100; display: none;'>" + text + "</div>");
				if($.browser.msie) var tipWidth = $("#simpleTooltip").outerWidth(true)
				else var tipWidth = $("#simpleTooltip").width()
				$("#simpleTooltip").width(tipWidth);
				$("#simpleTooltip").css("left", tipX).css("top", tipY).css("filter", "progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr=#ffffff, endColorstr=#f2f4f5)").fadeIn("medium");
			}, function(){
				$("#simpleTooltip").remove();
				$(this).attr("title", text);
			});
			$(this).mousemove(function(e){
				var tipX = e.pageX + 3;
				var tipY = e.pageY + 10;
				var tipWidth = $("#simpleTooltip").outerWidth(true);
				var tipHeight = $("#simpleTooltip").outerHeight(true);
				if(tipX + tipWidth > $(window).scrollLeft() + $(window).width()) tipX = e.pageX - tipWidth;
				if($(window).height()+$(window).scrollTop() < tipY + tipHeight) tipY = e.pageY - tipHeight;
				$("#simpleTooltip").css("left", tipX).css("top", tipY).fadeIn("slow");
			});
		}
	});
}})(jQuery);

function lehrpersonen() {
  if($('.lehrpersonen').length) {
	  $(".tooltip").simpletooltip();
	  var lehrpersonen = $('.lehrpersonen').find('a.tooltip img');
	  lehrpersonen.each(function() {
		$(this).hover(
			function() {
				$(this).stop().animate({'opacity':1},1200);
				},
			function() {
				$(this).stop().animate({'opacity':0},600);
				}
			);
		});
	}
}
// starting the scripts on page load
$(document).ready(function(){
	lehrpersonen();
// contactForm
$(".cF").fancybox({
	'titleShow'			: false,
	'transitionIn'		: 'fade',
	'transitionOut'		: 'fade',
	'autoScale'     	: false,
	'transitionIn'		: 'fade',
	'transitionOut'		: 'fade',
	'padding'           : 0,
	'width'				: 665,
	'height'			: 530,
	'type'				: 'iframe'
});
// anmeldungsForm
$(".aF").fancybox({
	'titleShow'			: false,
	'transitionIn'		: 'fade',
	'transitionOut'		: 'fade',
	'autoScale'     	: false,
	'transitionIn'		: 'fade',
	'transitionOut'		: 'fade',
	'padding'           : 0,
	'width'				: 645,
	'height'			: 660,
	'type'				: 'iframe'
});
// Select and 'Other language'
$("#sprachauswahl").change(function(){
if(this.value == 'other language' || this.value == 'Andere Sprache') {
	$(".showOtherLanguage label, .showOtherLanguage input").show("slow");
	} else {
	$(".showOtherLanguage input, .showOtherLanguage label").hide("slow");}
});
$("#sprachauswahl").change();

// Table tiger-stripe
	$(function(){
  $("table.tiger-stripe tr:even").css("background-color", "#F5F5F5");
  $("table.tiger-stripe tr:odd").css("background-color", "#FFFFFF");
  $("table.tiger-stripe tr td").css("padding", "2px");
  $("table.tiger-stripe tr td").css("border-bottom", "1px solid #DDDDDD");
});
});
