$(document).ready(function() {
	if ($("#content").height()>$("#aside").height()) {$("#aside").height($("#content").height()+30);};
	
	var imgelement;
	var imgurl;
	var imgreplace;
	var imgurlsplit;
	var imagelist=new Array();

	$(".home_blok ").bind("click", function() {
        window.location = $(this).find("a").attr("href"); return false;
    }).css({ "cursor": "pointer" });
	
	function relselect(selector) {
		$(selector).hover(function() {
			$(".home_blok"+selector).addClass("hover");
			$("#navigation a"+selector).addClass("relselect");
		}, function() {
			$(".home_blok"+selector).removeClass("hover");
			$("#navigation a"+selector).removeClass("relselect");
		}).focus(function () {
			// zelfde als 1e hover
			$(".home_blok"+selector).addClass("hover");
			$("#navigation a"+selector).addClass("relselect");
		}).blur(function () {
			// zelfde als 2e hover
			$(".home_blok"+selector).removeClass("hover");
			$("#navigation a"+selector).removeClass("relselect");
		})
	};
	
	// Vervanging voor het onderstaande: 
	$(".home_blok").hover(function() {$(this).addClass("hover");}, function() {$(this).removeClass("hover");});
	
/*	relselect(".inleven");
	relselect(".beleven");
	relselect(".realiseren");
	$(".home_blok h2 a").focus(function() {$(this).parent().mouseover();});
	$(".home_blok h2 a").blur(function() {$(this).parent().mouseout();});
*/
		
	
	
	$("form").formtytwo();
	$("#projectcarrousel li a").ellipsis();
	
	$("#projectcarrousel li ").bind("click", function() {
        window.location = $(this).find("a").attr("href");
		return false;
    }).css({ "cursor": "pointer" });

	$("#projectcarrousel li img").each(function() {
		//imgurlsplit=$(this).attr("src").split('.');
		//imgreplace=imgurlsplit[0]+'_hover.png';
		
		//imagelist.push(imgreplace);
	})
	
	if ($("#projectcarrousel").hasClass("pngfixactive")) {var pngfixactive=1;}
	$("#projectcarrousel li").hover(function() {
		//$(this).addClass("hover");
		//imgelement=$(this).find("img");
		//imgurl=imgelement.attr("src");
		
		//imgurlsplit=imgurl.split('.');
		//imgreplace=imgurlsplit[0]+'_hover.png';
		//imgelement.attr("src",imgreplace);
		//if (pngfixactive==1) {
		//	$("#projectcarrousel li shape").show();
		//	$("#projectcarrousel li.hover img").css({"visibility":"hidden"});
		//	DD_belatedPNG.fix('#projectcarrousel li.hover img');

	    //}


	    imgelement = $(this).find("img.carrousel_hover");
	    imgelement.attr("style", "visibility:visible");
		
	}, function() {
		//$(this).removeClass("hover");
		//$(this).find("img").attr("src",imgurl);
		
		//if (pngfixactive==1) {
		//	$("#projectcarrousel li shape").hide();
		//	$("#projectcarrousel li img").css({"visibility":"visible"});
		//}
		
		//imgurl="";
	    //imgreplace="";

	    imgelement = $(this).find("img.carrousel_hover");
	    imgelement.attr("style", "visibility:hidden");		
		
	})

	
	jQuery.preloadImages = function(images)
		{
		  for(var i = 0; i<images.length; i++)
		  {
			jQuery("<img>").attr("src", images[i]);
		  }
		}
	

	$.preloadImages(imagelist);

	$("#imgslideshow div").easySlider();

	/* 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(-34.397, 150.644);
		var myOptions = {
		  zoom: 15,
		  center: latlng,
		  mapTypeId: google.maps.MapTypeId.ROADMAP
		};
		var map = new google.maps.Map(document.getElementById("locatiemaps"), myOptions);
	  }


	
	
	$("#imgslideshow div li a:not(.downloadlink)").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayColor': '#ffffff'}); 
	
});



