var floatmenu = false;
var activeLocation = false;
$(document).ready(function() {
	h = $(".main").height();
	
	$(".kolom2").css("height", h + "px");
	$(".kolom5").css("height", h + "px");
	$(".kolom6").css("height", h + "px");
	
	$("#locations a").click(function() {
		activeLocation = this;
		$(".location2_kolom").hide();
		$(".location_picture").hide();
		$(".locimage").hide();
		$(".information").hide();

		str = "#pop" + $(activeLocation).attr("id");
		$(str).fadeIn("slow");
		str = "#img" + $(activeLocation).attr("id");
		$(str).fadeIn("slow");
		str = "#text" + $(activeLocation).attr("id");
		$(str).fadeIn("slow");
		str = "#popimg" + $(activeLocation).attr("id");
		
		$(str).fadeIn("slow");
		return false;
	});
	
	if(document.getElementById("header")) {
		doAnimate();
	}
	//if(floatmenu) {
	//	checkMenu();
	//} else {
	//	checkMenuBack();
	//}
	
	$("#search").click(function() {
		if ($(this).val() == "Zoeken") {
			$(this).val("");
		}
	});
	// if(this.value == "Zoeken") this.value="";

	$("a.flowplayer").each(function(i) {
		if(i == 0) {
			f = flowplayer(this.id, "/flash/flowplayer.commercial-3.1.5.swf", { 
	    	key: '#@6d9f6a14dc368f1d8d5',
	    	clip:  {
		       		autoPlay: false
		       	},
				plugins:  { 
			      controls: { 
						/*
						backgroundGradient: 'none', 
				        backgroundColor: '#666666', 
				        volume: false,
				        mute: false,
				        time : false,
				        scrubber: false,
				        fullscreen: true,
				        buttonColor: '#222222',
				        buttonOverColor: '#333333'
				        */
					}
				}
	   		});
	   		f.load();
	   		if($(this).attr("autoplay") == "true") {
	   			f.play();
	   		}
	   	} else {
			flowplayer(this.id, "/flash/flowplayer.commercial-3.1.5.swf", {
				key: '#@6d9f6a14dc368f1d8d5',
				clip:  {
					autoPlay: false
				}, 
				plugins:  { 
			      controls: { 
						/*
						backgroundGradient: 'none', 
				        backgroundColor: '#666666', 
				        volume: false,
				        mute: false,
				        time : false,
				        scrubber: false,
				        fullscreen: true,
				        buttonColor: '#222222',
				        buttonOverColor: '#333333'
				        */
					}
				}
			});
	   	}
   	})	
	checkBanner();
	
	
	$(".initWereld").click(function() {
		$(this).wereldvlucht();
	});
});

function initVlucht() {
	$('#vogelvlucht').vogelvlucht();
}

function initWereld() {
	$('#wereldvlucht').wereldvlucht();
}

function doAnimate() {
	$("#nicblauw").animate({"left": "220px"}, 5000);
	setTimeout("dowit()", 3000);
	
	
	//$("#nicwit").hide();
	//$("#blad").show();
	//$("#blad").css("opacity", "1");
	//$("#blad").css("margin", "10px");
	//$("#blad").css("width", "68px");
	//$("#blad").animate({"width":"88px", "margin":"0px"}, 600);
}
function dowit() {
	$("#nicwit").animate({"opacity": "0"}, 2000);
	//$("#blad").animate({"left": "616px","top":0,"width":"88px","opacity":".99"}, 2000);
	$("#blad").animate({"opacity":"0.99"}, 3000);
}
function checkMenuBack() {
	$(".kolom_2_menu").children().each(function(ev) {
		$(this).find("a:first").each(function() {
			$(this).click(function(ev) {
				var goUrl = $(this).attr("href");
				$(".kolom4").animate({"opacity":"0"}, 800);
				$(".kolom5").animate({"opacity":"0"}, 800);
		
				$(".kolom6").css("position", "absolute");
				$(".kolom6").css("left", "704px");
				$(".kolom6").css("zIndex", "1000");
						
				$(".kolom6").animate({"left":"485px","width":"218px"}, 800, function() { 
					document.location.href = goUrl;
				});
				return false;
			});
		});
	});
}
function checkMenu() {
	$(".kolom_2_menu ul li a").click(function(ev) {
		var goUrl = $(this).attr("href");
		
		$(".kolom3").css("position", "absolute");
		$(".kolom3").css("left", "704px");
		
		$(".kolom2").css("position", "absolute");
		$(".kolom2").css("left", "485px");
		$(".kolom2").css("zIndex", "1000");
		
		$(".kolom1").animate({"opacity":"0"}, 800);
		$(".kolom2").animate({"left":"704px","width":"218px"}, 800, function() { 
			document.location.href = goUrl;
		});
		
		return false;
	});
}
var banners, bnum, bmax;
function checkBanner() {
	var banners = Array();
	bmax = $("#banners div").length;
	if(bmax > 1) {
		$("#banners div").each(function(i) {
			banners[i] = this;
			if(i > 0) {
				$(this).hide();
			}
		});
		bnum = 0;
		setTimeout("dobBanner();", 5000);
	}
}

function dobBanner() {
	$("#banners div").eq(bnum).fadeOut("slow")
	bnum++;
	if(bnum >= bmax) {
		bnum = 0;
	}
	$("#banners div").eq(bnum).fadeIn("slow", function() {	
		setTimeout("dobBanner();", 5000);
	});
}



