$(document).ready(function(){
		$("#pikame").PikaChoose();
		$("#fotowrapke").removeClass("hide4load");
		$("#pikame").removeClass("hideit");

	$(".vorigePIDK").click(function(){
		//$("#innergallWrapperke").animate({top:-624}, "normal");
		$(this).addClass("NOTVIS"); 
	});
	$("#panelPlan").addClass("up");
	
	$(".technischDownUp").click(function(){
		$("#panelPlan").animate({top:-380}, "normal");
		$("#panelContact").slideUp();
		$("#panelTechnisch").slideToggle();
		$(this).toggleClass("active"); return false;
	});
	$(".planDownUp").click(function(){
		$("#panelTechnisch").slideUp();
		$("#panelContact").slideUp();
		if (goingUp) {
			$("#panelPlan").animate({top:0}, "normal");
			goingUp = false;
		}
		else {
			$("#panelPlan").animate({top:-380}, "normal");
			goingUp = true
		}
		$(this).toggleClass("active"); return false;
	});
	$(".contactDown").click(function(){
		//$("#panelTechnisch").slideUp();
		//$("#panelPlan").animate({top:-380}, "normal");
		$("#toonverbergcontact").animate({left:-265}, "normal");
		$("#contact").slideToggle();
		$(this).toggleClass("active"); return false;
	});
	$(".contactUp").click(function(){
		//$("#panelTechnisch").slideUp();
		//$("#panelPlan").animate({top:-380}, "normal");
		$("#toonverbergcontact").animate({left:0}, "normal");
		$("#contact").slideToggle();
		$(this).toggleClass("active"); return false;
	});
	$(".bodDown").click(function(){
		//$("#panelTechnisch").slideUp();
		//$("#panelPlan").animate({top:-380}, "normal");
		$("#toonverbergbod").animate({left:-265}, "normal");
		$("#bod").slideToggle();
		$(this).toggleClass("active"); return false;
	});
	$(".bodUp").click(function(){
		//$("#panelTechnisch").slideUp();
		//$("#panelPlan").animate({top:-380}, "normal");
		$("#toonverbergbod").animate({left:0}, "normal");
		$("#bod").slideToggle();
		$(this).toggleClass("active"); return false;
	});
	$("#fotoUp1").click(function(){
		$("#fotoUp1").addClass("dendeze");
		$("#fotoUp2").removeClass("dendeze");
		$("#fotoUp3").removeClass("dendeze");
		$("#pikame").animate({top:0}, "normal");
		return false;
	});
	$("#fotoUp2").click(function(){
		$("#fotoUp1").removeClass("dendeze");
		$("#fotoUp2").addClass("dendeze");
		$("#fotoUp3").removeClass("dendeze");
		$("#pikame").animate({top:-465}, "normal");
		return false;
	});
	$("#fotoUp3").click(function(){
		$("#fotoUp1").removeClass("dendeze");
		$("#fotoUp2").removeClass("dendeze");
		$("#fotoUp3").addClass("dendeze");
		$("#pikame").animate({top:-934}, "normal");
		return false;
	});
	
	// voor detail
	
	var gegevenswrapper_height = $("#gegevensWrapper").height()+30+"px";
	var beschrijving_height = $("#beschrijving").height()+30+"px";
	var prijzenoverzicht_height = $("#prijzenoverzicht").height()+30+"px";
	var technisch_height = $("#technisch").height()+30+"px";
	var kaart_height = $("#kaart").height()+"px";
	var buurt_height = $("#buurt").height()+30+"px";
	var detailInfoBar_height = $(".detailInfoBar").height()+30+"px"
	//alert (detailInfoBar_height + " - " + beschrijving_height);
	
	if (detailInfoBar_height < beschrijving_height){
		$("#gegevensContainer").animate({ height: beschrijving_height}, "normal");
	} 
	/*
	else {
		$("#gegevensContainer").animate({ height: detailInfoBar_height}, "normal");
	}
	*/
	//$("#gegevensWrapper").animate({ height: $beschrijving_height}, "normal");
	//$('#gegevensContainer').animate({ height: $('#beschrijving').css('height') }, "fast");
	//$('#gegevensWrapper').animate({ height: $('#beschrijving').css('height') }, "fast");
	$("#detailSNbg").addClass("detailSNbgzelf");
	//$(".beschrijvingSubnav span").mouseover(function(){
 		//$(this).addClass("detailSNbgzelf-h");
	//});
	//$(".beschrijvingSubnav span").mouseout(function(){
 		//$(this).removeClass("detailSNbgzelf-h");
	//});

	$("#subnav-beschrijving-test").click(function(){
		$("#subnav-beschrijving").removeClass("activeSubNav");
		$("#subnav-technisch").removeClass("activeSubNav");
		$("#subnav-kaart").removeClass("activeSubNav");
		$("#subnav-buurt").removeClass("activeSubNav");
		$("#subnav-beschrijving").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:0}, "normal");
		
		if (detailInfoBar_height > beschrijving_height){
			$("#gegevensContainer").animate({ height: beschrijving_height}, "normal");
		} else {
			$("#gegevensContainer").animate({ height: detailInfoBar_height}, "normal");
		}

		//$("#gegevensContainer").animate({ height: $beschrijving_height}, "normal");
		$("#detailSNbg").animate({left:0}, "normal");
		//$('#gegevensContainer').animate({ height: $('#beschrijving').css('height')}, "normal");
	});
	$("#subnav-beschrijving-BU").click(function(){
		$("#subnav-beschrijving").removeClass("activeSubNav");
		$("#subnav-technisch").removeClass("activeSubNav");
		$("#subnav-kaart").removeClass("activeSubNav");
		$("#subnav-buurt").removeClass("activeSubNav");
		$("#subnav-beschrijving").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:0}, "normal");
		
		if (detailInfoBar_height < beschrijving_height){
			$("#gegevensContainer").animate({ height: beschrijving_height}, "normal");
		} else {
			$("#gegevensContainer").animate({ height: detailInfoBar_height}, "normal");
		}

		//$("#gegevensContainer").animate({ height: $beschrijving_height}, "normal");
		$("#detailSNbg").animate({left:0}, "normal");
		//$('#gegevensContainer').animate({ height: $('#beschrijving').css('height')}, "normal");
	});
	$("#subnav-beschrijvingDet").click(function(){
		$("#subnav-beschrijving").removeClass("activeSubNav");
		$("#subnav-technisch").removeClass("activeSubNav");
		$("#subnav-kaart").removeClass("activeSubNav");
		$("#subnav-buurt").removeClass("activeSubNav");
		$("#subnav-beschrijving").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:0}, "normal");
		/*		*/

		if (parseInt(detailInfoBar_height) <  parseInt(beschrijving_height)){
			$("#gegevensContainer").animate({ height: beschrijving_height}, "normal");
		} else {
			$("#gegevensContainer").animate({ height: detailInfoBar_height}, "normal");
		}
		//$("#gegevensContainer").animate({ height: $beschrijving_height}, "normal");
		$("#detailSNbg").animate({left:0}, "normal");
		//$('#gegevensContainer').animate({ height: $('#beschrijving').css('height')}, "normal");
	});
	$("#subnav-kaartDet").live("click",function(){
		$("#subnav-beschrijving").removeClass("activeSubNav");
		$("#subnav-technisch").removeClass("activeSubNav");
		$("#subnav-kaart").removeClass("activeSubNav");
		$("#subnav-buurt").removeClass("activeSubNav");
		$("#subnav-technisch").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:-665}, "normal");
		//alert (detailInfoBar_height + " - " + technisch_height);
		if (parseInt(kaart_height) > parseInt(detailInfoBar_height)){
			$("#gegevensContainer").animate({ height: kaart_height}, "normal");
		
		} else {
			$("#gegevensContainer").animate({ height: detailInfoBar_height}, "normal");
		}/**/
		
		//$("#gegevensContainer").animate({ height: $technisch_height}, "normal");
		$("#detailSNbg").animate({left:155}, "normal");
		
		//$('#gegevensContainer').animate({ height: $('#technisch').css('height')}, "normal");
	});
	$("#subnav-beschrijving").click(function(){
		$("#subnav-beschrijving").removeClass("activeSubNav");
		$("#subnav-technisch").removeClass("activeSubNav");
		$("#subnav-kaart").removeClass("activeSubNav");
		$("#subnav-buurt").removeClass("activeSubNav");
		$("#subnav-beschrijving").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:0}, "normal");
		
		if (parseInt(detailInfoBar_height) < parseInt(beschrijving_height)){
			$("#gegevensContainer").animate({ height: beschrijving_height}, "normal");
		} else {
			$("#gegevensContainer").animate({ height: detailInfoBar_height}, "normal");
		}

		//$("#gegevensContainer").animate({ height: $beschrijving_height}, "normal");
		$("#detailSNbg").animate({left:0}, "normal");
		//$('#gegevensContainer').animate({ height: $('#beschrijving').css('height')}, "normal");
	});
	$("#subnav-technisch").live("click",function(){
		$("#subnav-beschrijving").removeClass("activeSubNav");
		$("#subnav-technisch").removeClass("activeSubNav");
		$("#subnav-kaart").removeClass("activeSubNav");
		$("#subnav-buurt").removeClass("activeSubNav");
		$("#subnav-technisch").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:-665}, "normal");
		//alert (detailInfoBar_height + " - " + technisch_height);
		if ( parseInt(technisch_height) > parseInt(detailInfoBar_height)){
			$("#gegevensContainer").animate({ height: technisch_height}, "normal");
		
		} /*else {
			$("#gegevensContainer").animate({ height: detailInfoBar_height}, "normal");
		}*/
		
		//$("#gegevensContainer").animate({ height: $technisch_height}, "normal");
		$("#detailSNbg").animate({left:155}, "normal");
		
		//$('#gegevensContainer').animate({ height: $('#technisch').css('height')}, "normal");
	});
	$("#subnav-kaart").click(function(){
		$("#subnav-beschrijving").removeClass("activeSubNav");
		$("#subnav-technisch").removeClass("activeSubNav");
		$("#subnav-kaart").removeClass("activeSubNav");
		$("#subnav-buurt").removeClass("activeSubNav");
		$("#subnav-kaart").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:-1330}, "normal");
		
		if (parseInt(detailInfoBar_height) < parseInt(kaart_height)){
			$("#gegevensContainer").animate({ height: kaart_height}, "normal");
		} else {
			$("#gegevensContainer").animate({ height: detailInfoBar_height}, "normal");
		}
		
		//$("#gegevensContainer").animate({ height: $kaart_height}, "normal");
		$("#detailSNbg").animate({left:310}, "normal");
		//$('#gegevensContainer').animate({ height: $('#kaart').css('height')}, "normal");
	});
	$("#subnav-buurt").click(function(){
		$("#subnav-beschrijving").removeClass("activeSubNav");
		$("#subnav-technisch").removeClass("activeSubNav");
		$("#subnav-kaart").removeClass("activeSubNav");
		$("#subnav-buurt").removeClass("activeSubNav");
		$("#subnav-buurt").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:-1392}, "normal");
		
		if ($detailInfoBar_height < $buurt_height){
			$("#gegevensContainer").animate({ height: $buurt_height}, "normal");
		} else {
			$("#gegevensContainer").animate({ height: $detailInfoBar_height}, "normal");
		}
		
		//$("#gegevensContainer").animate({ height: $buurt_height}, "normal");
		//$('#gegevensContainer').animate({ height: $('#buurt').css('height')}, "normal");
	});
	$("#subnav-contact").click(function(){
		$("#subnav-beschrijving").removeClass("activeSubNav");
		$("#subnav-technisch").removeClass("activeSubNav");
		$("#subnav-kaart").removeClass("activeSubNav");
		$("#subnav-buurt").removeClass("activeSubNav");
		$("#gegevensWrapper").animate({left:-1856}, "normal");
	});
	// voor nbdetail
	
	$(".onloadNBP").animate({ height: prijzenoverzicht_height}, "normal");

	$("#subnavNBP-beschrijving").click(function(){
		$("#subnavNBP-beschrijving").removeClass("activeSubNav");
		$("#subnavNBP-prijzenoverzicht").removeClass("activeSubNav");
		$("#subnavNBP-technisch").removeClass("activeSubNav");
		$("#subnavNBP-kaart").removeClass("activeSubNav");
		$("#subnavNBP-buurt").removeClass("activeSubNav");
		$("#subnavNBP-beschrijving").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:0}, "normal");
		$("#gegevensContainer").animate({ height: $beschrijving_height}, "normal");
		//$('#gegevensContainer').animate({ height: $('#beschrijving').css('height')}, "normal");
	});
	$("#subnavNBP-prijzenoverzicht").click(function(){
		$("#subnavNBP-beschrijving").removeClass("activeSubNav");
		$("#subnavNBP-prijzenoverzicht").removeClass("activeSubNav");
		$("#subnavNBP-technisch").removeClass("activeSubNav");
		$("#subnavNBP-kaart").removeClass("activeSubNav");
		$("#subnavNBP-buurt").removeClass("activeSubNav");
		$("#subnavNBP-prijzenoverzicht").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:0}, "normal");
		$("#gegevensContainer").animate({ height: $prijzenoverzicht_height}, "normal");
		//$('#gegevensContainer').animate({ height: $('#prijzenoverzicht').css('height')}, "normal");
	});
	$("#subnavNBP-technisch").click(function(){
		$("#subnavNBP-beschrijving").removeClass("activeSubNav");
		$("#subnavNBP-prijzenoverzicht").removeClass("activeSubNav");
		$("#subnavNBP-technisch").removeClass("activeSubNav");
		$("#subnavNBP-kaart").removeClass("activeSubNav");
		$("#subnavNBP-buurt").removeClass("activeSubNav");
		$("#subnavNBP-technisch").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:-464}, "normal");
		$("#gegevensContainer").animate({ height: $technisch_height}, "normal");
		//$('#gegevensContainer').animate({ height: $('#technisch').css('height')}, "normal");
	});
	$("#subnavNBP-kaart").click(function(){
		$("#subnavNBP-beschrijving").removeClass("activeSubNav");
		$("#subnavNBP-prijzenoverzicht").removeClass("activeSubNav");
		$("#subnavNBP-technisch").removeClass("activeSubNav");
		$("#subnavNBP-kaart").removeClass("activeSubNav");
		$("#subnavNBP-buurt").removeClass("activeSubNav");
		$("#subnavNBP-kaart").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:-928}, "normal");
		$("#gegevensContainer").animate({ height: $kaart_height}, "normal");
		//$('#gegevensContainer').animate({ height: $('#kaart').css('height')}, "normal");
	});
	$("#subnavNBP-buurt").click(function(){
		$("#subnavNBP-beschrijving").removeClass("activeSubNav");
		$("#subnavNBP-prijzenoverzicht").removeClass("activeSubNav");
		$("#subnavNBP-technisch").removeClass("activeSubNav");
		$("#subnavNBP-kaart").removeClass("activeSubNav");
		$("#subnavNBP-buurt").removeClass("activeSubNav");
		$("#subnavNBP-buurt").addClass("activeSubNav");
		$("#gegevensWrapper").animate({left:-1392}, "normal");
		//-1856
		$("#gegevensContainer").animate({ height: $buurt_height}, "normal");
		//$('#gegevensContainer').animate({ height: $('#buurt').css('height')}, "normal");
	});

});

