$(document).ready(function(){
	// initialize flash content
	if(window.so) so.write("photosholder");
	
	// colapsing expandable items
	$('a.expand + div').hide();
	// adding click functionality to expandable items
	$('a.expand').click(function() {
		this.blur();
		$(this).next('div').toggle();
		var pos = ($(this).next('div').css('display') == 'block')? '0px -19px':'0px 0px';
		$(this).css('backgroundPosition',pos);
		$('div.scroll-pane').jScrollPane({scrollbarWidth:16, showArrows:true });
	});
	
	// horizontal positioning of menu2
	if($('div.menu1 a.active').length > 0 && $('div.menu2 a').length > 0){
		var leftOffset = $('div.menu1 a.active').get(0).offsetLeft - $('div.menu2 a').get(0).offsetLeft + 16;
		$('div.menu2').find('div').css('marginLeft',leftOffset);
	}

	// form functionality
	//$("input[@type='text']").not( $("input[@name='aanhef']") ).focus(function() {
	//	if($(this).attr("value") == $(this).attr("title")) $(this).attr("value","");						 
	//});
	
	//$("input[@type='text']").not( $("input[@name='aanhef']") ).blur(function() {
	//	if(!$(this).attr("value")) $(this).attr("value",$(this).attr("title"));						 
	//});
	// aanhef toggle (2 values)
	$("input[@name='aanhef']").click(function() {
		var temp = $(this).attr("value");
		$(this).attr("value",$(this).attr("title"));
		$(this).attr("title",temp);
	});
	$("input[@name='aanhef']").keydown(function() {
		return false;
	});
	// checkbox toggle (yes/no)
	$("input.checkbox").click(function() {
		var val = ($(this).attr("title")=='yes')? 'no':'yes';
		$(this).attr("title",val);
		var pos = (val=='yes')? '0px 0px':'0px -20px';
		$(this).css('backgroundPosition',pos);
		this.blur();
	});
	
	// disclaimer popup
	$("a#disclaimer").click(function() {
		$("div.popup").show();								
	});
	$("a.close").click(function() {
		$("div.popup").hide();
	});
	var pageHeight = $("div.head").get(0).offsetHeight+$("div.meta").height()+$("div.foot").get(0).offsetHeight;
	var popHeight = ($("body").height() > pageHeight)? '100%' : pageHeight+'px';
	$("div.popup").css('height',popHeight);
	$("div.popup").hide();
	
	// initializing custom scrollbar
	$('div.scroll-pane').jScrollPane({scrollbarWidth: 16, showArrows:true });
	
});

// imagemap functionality
function showMap(coords) {
	var target = document.getElementById('kaart');
	var pos = (coords==undefined)? '0px 0px':coords;
	target.style.backgroundPosition = pos;
}