$(document).ready(function(){

	function showBigPic() {
		$("#centerStagePictureWrap660").css('z-index','3');
		
			$("#infolabel-hersteller-1, #infolabel-hersteller-2, #infolabel-hersteller-3, #infolabel-hersteller-4").unbind('mouseenter');
			$("#infolabel-hersteller-1, #infolabel-hersteller-2, #infolabel-hersteller-3, #infolabel-hersteller-4").unbind('mouseleave');
			
		$("#centerStagePictureWrap660").stop().animate({
		    width: '990'
		}, 800, function() {
			showOverlay();
			
		});
		$(".quickcontent h2, .quickcontent p").fadeOut(500);
		//$('#infolabel-holder').fadeOut();
		$("#centerStagePictureWrap660").unbind("mouseenter mouseleave");
	}
		
	function hideBigPic() {
		//$("#infolabel-holder").fadeIn();
			
		$("#centerStagePictureWrap660").stop().animate({
		    width: '500'
		}, 800, function() {
					$("#centerStagePictureWrap660").css('z-index','1');
					$("#centerStagePictureWrap660").hover( showOverlay, hideOverlay );
		});	
		$('.pictureOverlay').delay(300).fadeIn(500);
		$(".quickcontent h2, .quickcontent p").fadeIn(800);
	}

	$("#centerStagePictureWrap660").click(function(){
		if ( $("#centerStagePictureWrap660").css('z-index') == '1' ) {
			showBigPic();
		} else {
			hideBigPic();
			
			
		}
	});

	$("#infolabel-hersteller-1").hover(showDetails1,showMainLabels);
	$("#infolabel-contentbtn-1").hover(showDetails1,showMainLabels);
	
	$("#infolabel-hersteller-2").hover(showDetails2,showMainLabels);
	$("#infolabel-contentbtn-2").hover(showDetails2,showMainLabels);
	
	$("#infolabel-hersteller-3").hover(showDetails3,showMainLabels);
	$("#infolabel-contentbtn-3").hover(showDetails3,showMainLabels);
	
	$("#infolabel-hersteller-4").hover(showDetails4,showMainLabels);
	$("#infolabel-contentbtn-4").hover(showDetails4,showMainLabels);

	
	
	function showDetails1() {
		$("#picOnCenterStage-1").fadeIn();
		//hideAll
		$("#infolabel-hersteller-2").fadeOut(400);
		$("#infolabel-hersteller-3").fadeOut(400);
		$("#infolabel-hersteller-4").fadeOut(400);
		//showRelevant
		$("#infolabel-hersteller-1").fadeIn(100);
		$("#infolabel-hersteller-1-2").fadeIn(100);
		$("#infolabel-hersteller-1-3").fadeIn(100);
		$("#infolabel-hersteller-1-4").fadeIn(100);
		
	}
	function showDetails2() {
		$("#picOnCenterStage-2").fadeIn();
		//hideAll
		$("#infolabel-hersteller-1").fadeOut(400);
		$("#infolabel-hersteller-3").fadeOut(400);
		$("#infolabel-hersteller-4").fadeOut(400);
		//showRelevant
		$("#infolabel-hersteller-2").fadeIn();
		$("#infolabel-hersteller-2-4").fadeIn();
		$("#infolabel-hersteller-2-3").fadeIn();
		$("#infolabel-hersteller-2-1").fadeIn();
		
	}
	function showDetails3() {
		$("#picOnCenterStage-3").fadeIn();
		//hideAll
		$("#infolabel-hersteller-1").fadeOut(400);
		$("#infolabel-hersteller-2").fadeOut(400);
		$("#infolabel-hersteller-4").fadeOut(400);
		//showRelevant
		$("#infolabel-hersteller-3").fadeIn(100);
		$("#infolabel-hersteller-3-1").fadeIn(100);
		$("#infolabel-hersteller-3-2").fadeIn(100);		
		$("#infolabel-hersteller-3-4").fadeIn(100);
		
	}	
	function showDetails4() {
		$("#picOnCenterStage-4").fadeIn(100);		
		//hideAll
		$("#infolabel-hersteller-1").fadeOut(400);
		$("#infolabel-hersteller-2").fadeOut(400);
		$("#infolabel-hersteller-3").fadeOut(400);
		//showRelevant
		$("#infolabel-hersteller-4").fadeIn(100);
		$("#infolabel-hersteller-4-3").fadeIn(100);
		$("#infolabel-hersteller-4-1").fadeIn(100);		
		$("#infolabel-hersteller-4-2").fadeIn(100);
	};
	
	
	$("#infolabel-hersteller-1,#infolabel-hersteller-2,#infolabel-hersteller-3,#infolabel-hersteller-4").click(function(){
		//return false;
	});
	
	function showMainLabels() {
			$("#infolabel-hersteller-1").fadeIn(100);
			$("#infolabel-hersteller-2").fadeIn(100);
			$("#infolabel-hersteller-3").fadeIn(100);
			$("#infolabel-hersteller-4").fadeIn(100);
			$(".kc-grey-bg").hide();
			$("#picOnCenterStage-1,#picOnCenterStage-2,#picOnCenterStage-3,#picOnCenterStage-4").fadeOut();
	};
	
	function showOverlay(){
		$('.pictureOverlay').fadeOut(500);
		showMainLabels();
		$("#infolabel-hersteller-1").hover(showDetails1,showMainLabels);
		$("#infolabel-contentbtn-1").hover(showDetails1,showMainLabels);
	
		$("#infolabel-hersteller-2").hover(showDetails2,showMainLabels);
		$("#infolabel-contentbtn-2").hover(showDetails2,showMainLabels);
	
		$("#infolabel-hersteller-3").hover(showDetails3,showMainLabels);
		$("#infolabel-contentbtn-3").hover(showDetails3,showMainLabels);
	
		$("#infolabel-hersteller-4").hover(showDetails4,showMainLabels);
		$("#infolabel-contentbtn-4").hover(showDetails4,showMainLabels);
	}
	
	function hideOverlay(){
		$('.pictureOverlay').fadeIn(500);
		showMainLabels();
	}
	
	function doNothing(){
		alert('closed');
	}
	
	$("#centerStagePictureWrap660").hover( showOverlay, hideOverlay );
	
	/*
	$("#kc-tagline").hoverIntent( function(){
		$(".kc-tagline-first").fadeOut(200,function(){
			$(".kc-tagline-second").fadeIn(200);		
		});

	}, function(){
		$(".kc-tagline-second").fadeOut(200,function(){
			$(".kc-tagline-first").fadeIn(200);
		});	
	} );
	*/
	
	var iWebkit;if(!iWebkit){iWebkit=window.onload=function(){function fullscreen(){var a=document.getElementsByTagName("a");for(var i=0;i<a.length;i++){if(a[i].className.match("noeffect")){}else{a[i].onclick=function(){window.location=this.getAttribute("href");return false}}}}function hideURLbar(){window.scrollTo(0,0.9)}iWebkit.init=function(){fullscreen();hideURLbar()};iWebkit.init()}}
	
	$(".kc-studiobtn, .kc-showroombtn").click(function(){
		//return false;
	});
	
	$("#infolabel-hersteller-7, #infolabel-hersteller-8").click(function(){
		return false;
	});
	
	
});
