$(document).ready(function() {
	
	// Maximale Z-index ophalen
	$(function(){
		var maxZ = Math.max.apply(null,$.map($('#plattegrondwrapper > *'), function(e,n){
			   if($(e).css('position')=='absolute')
					return parseInt($(e).css('z-index'))||1 ;
			   })
		);

	});


    var hoverid;
	$("#plattegrondmap area").hover(function() {
			hoverid=$(this).attr("id")+"_hover";
	
			$("#"+hoverid).stop().css({"opacity":"0"}).show().fadeTo(500,1)
			
		}, function() {
			$("#"+hoverid).stop().fadeOut(500)
			
		}).css({"cursor" : "pointer"}); 
	
	$("#plattegrondmap area").bind("click",function() {
			return false;
    });

	$(".plattegrondblok").bind("click", function() {
		window.location=$(this).find("a").attr("href");
	}).css({"cursor":"pointer"});

    /* Maps */
    if ($("#locatiemaps").length == 1) {
        var address = document.getElementById("mapsadres").innerHTML;
        geocoder = new google.maps.Geocoder();
        geocoder.geocode({ 'address': address }, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                map.setCenter(results[0].geometry.location);
                var marker = new google.maps.Marker({
                    map: map,
                    position: results[0].geometry.location
                })
            } 
        });
        var latlng = new google.maps.LatLng(52.004125,4.208935);
        var myOptions = {
            zoom: 15,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
    
        };
        var map = new google.maps.Map(document.getElementById("locatiemaps"), myOptions);
    }		
});
