
/*document.write("<div id=\"overlay\"><div>Een ogenblik geduld, de pagina word geladen...</div></div>");*/

$(document).ready(function(){
	/*verstop divs*/
	$("#menu_holder div").each(function(){
		$(this).css("marginLeft", "-200px");
	 });
	 
	/*Verwijder overlay bij no_html paginas
	if($("body").attr("id")!="template"){
		$("#overlay").fadeTo("fast", 0, function(){
			$("#overlay").css("display", "none");
		});
	}*/

	/*link menu items aan js*/
	$("#menu a, #menu_holder a").each(function(){
		var href= $(this).attr("href");
		if($(this).attr("rel")==""){
			$(this).click(function(){
				loadpage(href);
				return false;
			})
		}
	});

	/*init shadowbox */
	Shadowbox.setup();

	/*IE resize text boxes*/
	$("input").each(function(){
		var type = $(this).attr("type");
		if(type == "text" || type=="password"){
			$(this).css({"width" : "125px"});
		}	
	});
	
	/*verwijder overlay 
	$("#overlay").fadeTo("fast", 0, function(){ $("#overlay").css("display", "none");});*/
	
	/*klap menu uit*/
	show_menu_divs();
	
	if(!$.browser.msie){
		$('#header').corner();
		$('#content_layout').corner();
		$('#footer').corner();
		$('#weer').corner();
		$("#menu_holder div").each(function(){
			$(this).corner();
		});
	}

});



function check_if_animating(){
	var working = false;
	if($("#content_layout").is(':animated')){
		var working = true;	
	}
	$("#menu_holder div").each(function(){
		if($(this).is(':animated')){
			var working = true;	 
		}
	});
	return working;
}
 

function loadpage(href){
	if(!check_if_animating()){
		
		/*toon overlay
		elm = $("#overlay");
		elm.css("display", "block");
		elm.fadeTo("fast", 0.8);	*/
		
		/*klap menu in en stuur door*/
		$("#menu_holder").animate({ opacity:0, marginLeft: "-175px" }, 300, function(){ window.location.href = href; });
	}
}

function show_menu_divs(speed){
	if(!arguments.length) speed=650;
	$("#menu_holder div:eq(0)").animate({ opacity:1, marginLeft: "0" }, speed, "easeOutBounce", function(){
	        $(this).next().animate({ opacity:1, marginLeft: "0" }, speed, "easeOutBounce", arguments.callee); 
	 });
}
