$(document).ready(function(){
	
	var rand = Math.floor(Math.random()*$("#slideshow IMG").length);
	$("#slideshow IMG").removeClass("active");
	$("#slideshow IMG").eq(rand).addClass("active");
	
	//links openen in nieuw venster
	$("a[@rel=external]").each(function(i){ this.target="_blank";});
	
	$("li:has(ul)").hover(function () {
		$(this).find("ul").css("display","block");
	}, function () {
		$("li").find("ul").css("display","none");
	});
    
	if($("#map").length > 0){
		$("#map").newGmap({zoomControl:true, maptypeControl:true, width:290, height:250, latitude:53.21718649927112, longitude:6.561026573181152});
		$("#map").gmapAddMarker({latitude: 53.21718649927112, longitude: 6.561026573181152});
	}
	
});

function slideSwitch(switchSpeed) {
	var $active = $('#slideshow IMG.active');

	var $next = $active.next('IMG').length ? $active.next('IMG') : $('#slideshow IMG:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0}, switchSpeed, function() {
		$active.removeClass('active last-active');
	});
}

$(function() {
	setInterval ( "slideSwitch(1000)", 30000 );
});