﻿$(function(){
	var a="";
	var b="";
	$(".hasSub").click(function(){
		if(a!=""){
			$(a).removeClass("on");
			$(b).css("height","0px")
		}
		a = $(this);
		var bid = "#" + $(this).attr("rel");
		b = $(bid);
		var bheight = bid + " > div.getHeight";
		$(a).addClass("on");
		$(b).animate({height:parseInt($(bheight).height()+5)+"px"},500,function(){});
		return false
	});
	$("#content").mouseenter(function(){
		$(b).animate({height:"0px"},500);
		$(a).removeClass("on")
	});
	$(".mapper").maphilight({strokeColor: "003c78", fillColor: "f29901", fillOpacity: 1});
	$("area, .activityIcon, .resultIcon").easyTooltip();
	
	$(".pic_small").click(function(){
		var f = $(this).attr("src").replace("/small/","/full/");
		var e = $(this).attr("title");
		$("#picfade").animate({opacity:"0"}, 500, function(){
			if(e){
				$("#imgtext").html(e);
				$("#imgtext").show();
			}
			else{
				$("#imgtext").hide();
			}
			$("<img />").attr("src",f).load(function(){
				$("#bigsizepic").prepend($(this));
				$(".last").remove();
				$(this).addClass("last");
				$("#picfade").animate({opacity:"1"},500,function(){});
			});		
		});
	});
	
	var actReise = 0;
	var allReisen = $(".searchrow").length - 1;
	$(".next").click(function(){
		actReise++;
		var ziel = "#reihe_" + actReise.toString();
		$(ziel).animate({left:"0px"},500,function(){});
		if(actReise>0)
			$(".prev").show();
		if(actReise>=allReisen)
			$(".next").hide();
		return false;
	});
	$(".prev").click(function(){
		var ziel = "#reihe_" + actReise.toString();
		$(ziel).animate({left:"900px"},500,function(){});
		actReise--;
		if(actReise<=0)
			$(".prev").hide();
		if(actReise<allReisen)
			$(".next").show();
		return false;
	});
	$.datepicker.regional['de'] = {
		closeText: 'schließen',
		prevText: '&#x3c;zurück',
		nextText: 'Vor&#x3e;',
		currentText: 'heute',
		monthNames: ['Januar','Februar','März','April','Mai','Juni',
		'Juli','August','September','Oktober','November','Dezember'],
		monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
		'Jul','Aug','Sep','Okt','Nov','Dez'],
		dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
		dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
		dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
		dateFormat: 'dd.mm.yy',
		firstDay: 1,
		isRTL: false,
		buttonImage: 'img/icons/kalender.png',
		showOn: 'both',
		showButtonPanel: true,
		buttonImageOnly: true};
	$.datepicker.setDefaults($.extend({showMonthAfterYear: false}, $.datepicker.regional['de']));
	$(".datum input").datepicker();
	if($.fancybox)
	{
		$("area.stepmap_big").fancybox({
			hideOnContentClick:true,
			titleShow: false
		});
		$("a.stepmap_big").fancybox({
			hideOnContentClick:true,
			titleShow: false
		});
		$("a.fback").fancybox({
			hideOnContentClick:true,
			titleShow: false
		});
	}
	$("#redinfo_first").mouseover(function(){
		$("#redinfo_first").hide();
		$("#redinfo_second").show()
	});
	$("#redinfo_second").mouseover(function(){
		$("#redinfo_first").hide();
		$("#redinfo_second").show()
	});
	$("#redinfo_first").mouseout(function(){
		$("#redinfo_first").show();
		$("#redinfo_second").hide()
	});
	$("#redinfo_second").mouseout(function(){
		$("#redinfo_first").show();
		$("#redinfo_second").hide()
	});
	$("#request_back").click(function(){
		$("#Req_Form").submit();
		return false;
	});
});
