$(document).ready(function() {
		var image = document.getElementById("mapa");
		var area = document.getElementById("ziptest");
		
		

	//alert("Achtung! Ausnahmezustand bei MacLeo.\n\nSehr geehrte Kunden! MacLeo ist bis zum 20. Juli f\xfcr das Theater Festival Impulse exklusiv in Köln tätig und kann daher bis zu diesem Termin nur eingeschränkt Fernsupport leisten. Ab 20. Juli geht es dann aber wie gewohnt weiter.wie gewohnt weiter. Sommerliche Grüße Leo Lipp");
		
	$("#macleo a").hover(function() {
		$("#iks").css({"-webkit-transform": "rotate(359deg)",
					   "-moz-transform": "rotate(359deg)",
					   "-o-transform": "rotate(359deg)"
					 });
	}, function(){
		$("#iks").css({"-webkit-transform": "rotate(0deg)",
					   "-moz-transform": "rotate(0deg)",
					   "-o-transform": "rotate(0deg)"
					 });
	});
	
	$("#iks").hover(function() {
		$("#iks").css({"-webkit-transform": "rotate(359deg)",
					   "-moz-transform": "rotate(359deg)",
					   "-o-transform": "rotate(359deg)"
					 });
	}, function(){
		$("#iks").css({"-webkit-transform": "rotate(0deg)",
					   "-moz-transform": "rotate(0deg)",
					   "-o-transform": "rotate(0deg)"
					 });
	});

	$("#scrollable").scrollable({size: 1, clickable: false}).navigator();
	
	api = $('div#scrollable').scrollable();

	api.onBeforeSeek(function(event,index){
		
		if(api.getIndex() == 1) {
			$("div#slider a.nextPage").fadeOut("normal");
		} else {
			$("div#slider a.nextPage").fadeIn("normal");
		}
		 
		if(api.getIndex() == 0) {
			$("div#slider a.prevPage").hide();
		} else {
			$("div#slider a.prevPage").show();
		}
		
		// Use a recursive* function approach here, if the image is faded out
		//	 * we will allow advancing to the next slide, which will trigger the
		//	 * onSeek event to fade the slides back in 
		var element = jQuery("div#scrollable");
		if (element.css('opacity') == 0) {
			return true;
		}
	
		// The slide has not yet started fading out, so we will fade the item
		//	 * out 
		element.fadeTo("normal", 0, function(){
		//		 Once the fade is complete we will call api.seekTo() to trigger
		//		 * the onBeforeSeek event again, which will now advance the slide
		//		 * because we will be returning true instead of false 
			api.seekTo(index);
	});

	// Prevent advancing the slide on the first call to onBeforeSeek
	return false;

	}).onSeek(function(){

		// Fade the item back in
		jQuery("div#scrollable").fadeTo('normal', 1);
		
		if(api.getIndex() == 1) {
			$("div#slider a.nextPage").fadeOut("normal");
		} else {
			$("div#slider a.nextPage").fadeIn("normal");
		}
		 
		if(api.getIndex() == 0) {
			$("div#slider a.prevPage").hide();
		} else {
			$("div#slider a.prevPage").show();
		}
	
	});
	
	$("#scrollable2").scrollable({size: 1, clickable: false}).navigator();
	
	api2 = $('div#scrollable2').scrollable();

	api2.onBeforeSeek(function(event,index){
		
		if(api2.getIndex() == 4) {
			$("div#slider2 a.nextPage").fadeOut("normal");
		} else {
			$("div#slider2 a.nextPage").fadeIn("normal");
		}
		 
		if(api2.getIndex() == 0) {
			$("div#slider2 a.prevPage").hide();
		} else {
			$("div#slider2 a.prevPage").show();
		}
		
		// Use a recursive* function approach here, if the image is faded out
		//	 * we will allow advancing to the next slide, which will trigger the
		//	 * onSeek event to fade the slides back in 
		var element = jQuery("div#scrollable2");
		if (element.css('opacity') == 0) {
			return true;
		}
	
		// The slide has not yet started fading out, so we will fade the item
		//	 * out 
		element.fadeTo("normal", 0, function(){
		//		 Once the fade is complete we will call api.seekTo() to trigger
		//		 * the onBeforeSeek event again, which will now advance the slide
		//		 * because we will be returning true instead of false 
			api2.seekTo(index);
			
		if(api2.getIndex() == 0) {
			$("#company-people ul li").removeClass("active");
			$("#company-people ul li.company1").addClass("active");
			$(".quote").hide();
			$("div#quote8").fadeIn();
		}
		if(api2.getIndex() == 1) {
			$("#company-people ul li").removeClass("active");
			$("#company-people ul li.company2").addClass("active");
			$(".quote").hide();
			$("div#quote21").fadeIn();
		}
		if(api2.getIndex() == 2) {
			$("#company-people ul li").removeClass("active");
			$("#company-people ul li.company3").addClass("active");
			$(".quote").hide();
			$("div#quote23").fadeIn();
		}
		if(api2.getIndex() == 3) {
			$("#company-people ul li").removeClass("active");
			$("#company-people ul li.company4").addClass("active");
			$(".quote").hide();
			$("div#quote26").fadeIn();
		}
		if(api2.getIndex() == 4) {
			$("#company-people ul li").removeClass("active");
			$("#company-people ul li.company5").addClass("active");
			$(".quote").hide();
			$("div#quote18").fadeIn();
		}
	});

	// Prevent advancing the slide on the first call to onBeforeSeek
	return false;

	}).onSeek(function(){

		// Fade the item back in
		jQuery("div#scrollable2").fadeTo('normal', 1);
		
		if(api2.getIndex() == 4) {
			$("#slider2 a.nextPage").fadeOut("normal");
		} else {
			$("#slider2 a.nextPage").fadeIn("normal");
		}
		 
		if(api2.getIndex() == 0) {
			$("#slider2 a.prevPage").hide();
		} else {
			$("#slider2 a.prevPage").fadeIn();
		}
	
	});
	
	$("a.company-de").click(function() {
		$("#private-people").hide();
		$("#company-people").fadeIn("normal");
		
		if($("#langswitch").hasClass("de")) {
			$(this).css("background", "url(../images/company-active-de.png) no-repeat");
			$("a.private-de").css("background", "url(../images/private-de.png) no-repeat");
		} else {
			$(this).css("background", "url(../images/company-active.png) no-repeat");
			$("a.private").css("background", "url(../images/private.png) no-repeat");
		}
		$("#company-people ul li").removeClass("active");
		$("#company-people ul li.company1").addClass("active");
		$(".quote").hide();
		$("div#quote8").fadeIn();
	});
	
	$("a.private-de").click(function() {
		$("#company-people").hide();
		$("#private-people").fadeIn("normal");
		if($("#langswitch").hasClass("de")) {
			$(this).css("background", "url(../images/private-active-de.png) no-repeat");
			$("a.company-de").css("background", "url(../images/company-de.png) no-repeat");
		} else {
			$(this).css("background", "url(../images/private-active.png) no-repeat");
			$("a.company").css("background", "url(../images/company.png) no-repeat");
		}
	});
	
	$("#slider a.nextPage").css("opacity", "0.45");
	$("#slider a.prevPage").css("opacity", "0.45");
	
	$("a.prevPage").hover(function() {
		$(this).animate({opacity: 1});
	}, function(){
		$(this).animate({opacity: 0.45});
	});
	
	$("a.nextPage").hover(function() {
		$(this).animate({opacity: 1});
	}, function(){
		$(this).animate({opacity: 0.45});
	});
	
	if(api.getIndex() == 0) {
		$("#slider a.prevPage").hide();
	} else {
		$("#slider a.prevPage").show();
	}
	if(api2.getIndex() == 0) {
		$("#slider2 a.prevPage").hide();
	} else {
		$("#slider2 a.nextPage").hide();
	}
	

	
	$("a.map").fancybox({
		'transitionIn'	:	'easeInBounce',
		'transitionOut'	:	'easeInBounce',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});
	
	$(".home-baloon").hide();
	$(".prices-baloon").hide();
	$(".references-baloon").hide();
	$(".legalstuff-baloon").hide();
	$(".download-baloon").hide();
	$(".contact-baloon").hide();
	$(".home-baloon-de").hide();
	$(".prices-baloon-de").hide();
	$(".references-baloon-de").hide();
	$(".legalstuff-baloon-de").hide();
	$(".download-baloon-de").hide();
	$(".contact-baloon-de").hide();
	
	$("li.home a").hover(function(){
		$(".home-baloon-de").fadeIn("fast");
	}, function() {
		$(".home-baloon-de").fadeOut("fast");
	});
	
	$("li.prices a").hover(function(){
		$(".prices-baloon-de").fadeIn("fast");
	}, function() {
		$(".prices-baloon-de").fadeOut("fast");
	});
	
	$("li.references a").hover(function(){
		$(".references-baloon-de").fadeIn("fast");
	}, function() {
		$(".references-baloon-de").fadeOut("fast");
	});
	
	$("li.legalstuff a").hover(function(){
		$(".legalstuff-baloon-de").fadeIn("fast");
	}, function() {
		$(".legalstuff-baloon-de").fadeOut("fast");
	});
	
	$("li.download a").hover(function(){
		$(".download-baloon-de").fadeIn("fast");
	}, function() {
		$(".download-baloon-de").fadeOut("fast");
	});
	
	$("li.contact a").hover(function(){
		$(".contact-baloon-de").fadeIn("fast");
	}, function() {
		$(".contact-baloon-de").fadeOut("fast");
	});
	

	
	
	$("#home").fadeIn();
	$("#prices").hide();
	$("#legalstuff").hide();
	$("#contact").hide();
	$("#references").css("visibility", "hidden");
	$("#download").css("visibility", "hidden");
	$("li.home a").addClass("active");
	$("#leo-hover").hide();
	$("#leo").hover(function(){
		$(this).css("background", "../images/leo-hover.png");
		$("#leo-hover").fadeIn("fast");
	}, function() {
		$(this).css("background", "../images/leo.png");
		$("#leo-hover").fadeOut("fast");
	});
	
	$("a.need-help").click(function(){
		$("li.home a").removeClass("active");
		$("li.references a").removeClass("active");
		$("li.legalstuff a").removeClass("active");
		$("li.download a").removeClass("active");
		$("li.contact a").addClass("active");
		$("li.prices a").removeClass("active");
		$("#references").hide();
		$("#prices").hide();
		$("#legalstuff").hide();
		$("#home").hide();
		$("#download").hide();		
		$("#contact").fadeIn("slow");
	});
	$("a.view-prices").click(function(){
		$("li.home a").removeClass("active");
		$("li.references a").removeClass("active");
		$("li.legalstuff a").removeClass("active");
		$("li.download a").removeClass("active");
		$("li.contact a").removeClass("active");
		$("li.prices a").addClass("active");
		$("#references").hide();
		$("#legalstuff").hide();
		$("#contact").hide();
		$("#home").hide();
		$("#download").hide();		
		$("#prices").fadeIn("slow");
		$("#bill").hide();
	});
	
	$("li.home a").click(function(){
		$("li.prices a").removeClass("active");
		$("li.references a").removeClass("active");
		$("li.legalstuff a").removeClass("active");
		$("li.download a").removeClass("active");
		$("li.contact a").removeClass("active");
		$(this).addClass("active");
		$("#references").hide();
		$("#prices").hide();
		$("#legalstuff").hide();
		$("#contact").hide();
		$("#download").hide();
		$("#home").fadeIn("slow");
	});
	
	$("li.prices a").click(function(){
		$("li.home a").removeClass("active");
		$("li.references a").removeClass("active");
		$("li.legalstuff a").removeClass("active");
		$("li.download a").removeClass("active");
		$("li.contact a").removeClass("active");
		$(this).addClass("active");
		$("#references").hide();
		$("#legalstuff").hide();
		$("#contact").hide();
		$("#home").hide();	
		$("#download").hide();	
		$("#prices").fadeIn("slow");
		$("#bill").hide();
		//$("#bill").slideDown(3000);
	});
	
	$("li.references a").click(function(){
		$("li.home a").removeClass("active");
		$("li.prices a").removeClass("active");
		$("li.legalstuff a").removeClass("active");
		$("li.download a").removeClass("active");
		$("li.contact a").removeClass("active");
		$(this).addClass("active");
		$("#prices").hide();
		$("#legalstuff").hide();
		$("#contact").hide();
		$("#home").hide();
		$("#download").hide();	
		$("#references").css("visibility", "visible");
		$("#references").fadeIn("slow");
		$("#slider").show();
	});
	
	$("li.legalstuff a").click(function(){
		$("li.home a").removeClass("active");
		$("li.references a").removeClass("active");
		$("li.prices a").removeClass("active");
		$("li.download a").removeClass("active");
		$("li.contact a").removeClass("active");
		$(this).addClass("active");
		$("#prices").hide();
		$("#references").hide();
		$("#contact").hide();
		$("#home").hide();		
		$("#download").hide();
		$("#legalstuff").fadeIn("slow");
	});
	
	$("li.download a").click(function(){
		$("li.home a").removeClass("active");
		$("li.references a").removeClass("active");
		$("li.prices a").removeClass("active");
		$("li.download a").addClass("active");
		$("li.contact a").removeClass("active");
		$("li.legalstuff a").removeClass("active");
		$("#prices").hide();
		$("#legalstuff").hide();
		$("#contact").hide();
		$("#home").hide();
		$("#legalstuff").hide();
		$("#references").hide();
		$("#download").css("visibility", "visible");
		$("#download").fadeIn("slow");	
	});
	
	$("li.contact a").click(function(){
		$("li.home a").removeClass("active");
		$("li.references a").removeClass("active");
		$("li.legalstuff a").removeClass("active");
		$("li.download a").removeClass("active");
		$("li.prices a").removeClass("active");
		$(this).addClass("active");
		$("#references").hide();
		$("#prices").hide();
		$("#legalstuff").hide();
		$("#home").hide();		
		$("#download").hide();
		$("#contact").fadeIn("slow");
	});	
	
	// corners
	$("img.quote").corner("5px");
	$(".box1").corner("5px");
	$(".box2").corner("5px");
	$(".item").corner("5px");
	$("li.vcard").corner("5px");
	$(".noshop").corner("5px");
	$("#dragger").corner("5px");
	
	// legalstuff map 
	$("a.map").hover(function() {
		$("span.overlay").animate({opacity: 0.35}, 500);
	}, function() {
		$("span.overlay").animate({opacity: 0}, 500);
	});
	
	// prices balloons
	$("#call-out-balloon-de").hide();
	$("#hour-balloon-de").hide();
	$("#shop-balloon-de").hide();
	$("#phone-balloon-de").hide();
	
	$("li.call-out-de").hover(function() {
		$("#call-out-balloon-de").fadeIn("fast");
		}, function() {
			$("#call-out-balloon-de").fadeOut("fast");
	});
	$("li.hour-de").hover(function() {
		$("#hour-balloon-de").fadeIn("fast");
		}, function() {
			$("#hour-balloon-de").fadeOut("fast");
	});
	$("li.shop-de").hover(function() {
		$("#shop-balloon-de").fadeIn("fast");
		}, function() {
			$("#shop-balloon-de").fadeOut("fast");
	});
	$("li.phone-de").hover(function() {
		$("#phone-balloon-de").fadeIn("fast");
		}, function() {
			$("#phone-balloon-de").fadeOut("fast");
	});
	
	$("#pricebar-de").hide();
	
	$("#private-people ul li").addClass("inactive");
	$("#private-people ul li.first").removeClass("inactive").addClass("active");
	
	
	$("#private-people ul li").hover(function() {
		$(this).animate({opacity: 1}, 500);
	}, function() {
		if(!$(this).hasClass("active"))
			$(this).animate({opacity: 0.45}, 500);
	});
	
	$("#private-people ul li").click(function() {
		$("#private-people ul li").removeClass("active");
		$("#private-people ul li").css("opacity", "0.45");
		$(this).addClass("active");
		$(this).css("opacity", "1");
	});
	
	$("#company-people ul li").addClass("inactive");
	$("#company-people ul li.first").removeClass("inactive").addClass("active");
	
	
	$("#company-people ul li").hover(function() {
		$(this).animate({opacity: 1}, 500);
	}, function() {
		if(!$(this).hasClass("active"))
			$(this).animate({opacity: 0.45}, 500);
	});
	
	$("#company-people ul li").click(function() {
		$("#company-people ul li").removeClass("active");
		$("#company-people ul li").css("opacity", "0.45");
		$(this).addClass("active");
		$(this).css("opacity", "1");
	});

	
	$(".quote").hide();
	$("#quote1").fadeIn("slow");
		
	$(".slide a").click(function() {
		var klasa = $(this).attr("class");
		$(".quote").hide();
		$("#" + klasa).fadeIn(2250);
	});
	$(".slide2 a").click(function() {
		var klasa = $(this).attr("class");
		$(".quote").hide();
		$("#" + klasa).fadeIn(2250);
	});
			
	// form submission 
	
	var clicked = false;
	
	$("a.viewer").click(function() {
		if(!clicked) {
			$("#viewer").animate({'height':'155px'}, 600);
			$("#viewer-content").fadeIn("slow");
			clicked = true;
		} else {
			$("#viewer").animate({'height':'0'}, 600);
			$("#viewer-content").fadeOut("slow");
			clicked = false;
		}
	});
	
});




















