$(document).ready(function(){
	$.preloadCssImages();

	Cufon.replace('.bigReadMore', {hover:true, fontFamily: 'Arial Rounded MT Bold'});
	Cufon.replace('.mainMenu span, .subMenu span, h1, .footer li, .interactionblock span, .block .blockTitle, .twitter .blockTitle, .block .blockTitleHover, .slideColumn .slideColumnTitle, .contactColumn .contactColumnTitle', { fontFamily: 'Arial Rounded MT Bold' });

	$(".content").delay(1500).fadeIn('slow');


	//cufon works only on parent a tags thats why this problem is solved with two elements
	$(".block").hover(
	  
	  function () {
		$(".blockTitle", this).css("display", "none");
		$(".blockTitleHover", this).css("display", "block");
	  }, 
	  function () {
		$(".blockTitle", this).css("display", "block");
		$(".blockTitleHover", this).css("display", "none");
	  }
	);

	$update = false;
 	$('.interactionblock').hover(function(){
 		Cufon.replace('.interactionblock span', { fontFamily: 'Arial Rounded MT Bold'});
 		$update=true;
 	});

 	$("body").mousemove(function(e){
 		if($update==true){
			Cufon.replace('.interactionblock span', { fontFamily: 'Arial Rounded MT Bold' });
 		}
 	}); 
	

	//slidetoggle
	$(".open", this).css("display", "none");
	$(".slide").hide();
    $(".bigReadMore").click(function()
	  {
	  	//voor enkel ie ander volgorde omdat hij anders de verkeerde woorden pakte.
	  	if ($.browser.msie) {
			var thisUrl = window.location.href;
			if (thisUrl.search("relaties") > 0) {
			    $(this).text($(this).text() == 'Verberg onze relaties' ? 'Verberg onze relaties' : 'Bekijk onze relaties');
			}
			else if (thisUrl.search("nieuws") > 0) {
			    $(this).text($(this).text() == 'Verberg overig nieuws' ? 'Verberg overig nieuws' : 'Bekijk overig nieuws');
			}
			else if (thisUrl.search("contact") > 0) {
			    $(this).text($(this).text() == 'Verberg de kaart' ? 'Verberg de kaart' : 'Bekijk de kaart');
			}
		}else

		  	var thisUrl = window.location.href;
			if (thisUrl.search("relaties") > 0) {
			    $(this).text($(this).text() == 'Bekijk onze relaties' ? 'Verberg onze relaties' : 'Bekijk onze relaties');
			}
			else if (thisUrl.search("nieuws") > 0) {
			    $(this).text($(this).text() == 'Bekijk overig nieuws' ? 'Verberg overig nieuws' : 'Bekijk overig nieuws');
			}
			else if (thisUrl.search("contact") > 0) {
			    $(this).text($(this).text() == 'Bekijk de kaart' ? 'Verberg de kaart' : 'Bekijk de kaart');
			}
		
		
		$(this).prev(".slide").slideToggle(500);

		//if page is contact reload maps because else the popup isn't centered
		if (thisUrl.search("contact") > 0) {
			var iframe = document.getElementById('contactFrame');
			iframe.src = iframe.src;
		}
		
		Cufon.refresh('.bigReadMore, .slideColumnTitle');
	  });
	 
	//check if slide has to be open  
	var url = window.location.href;
	if (url.search("slide=open") > 0) {
	    $(".slide").slideToggle(0);
		
		if (url.search("relaties") > 0) {
		    $(".bigReadMore").text('Verberg onze relaties');
		}
		else if (url.search("nieuws") > 0) {
		    $(".bigReadMore").text('Verberg overig nieuws');
		}
		else if (url.search("contact") > 0) {
		    $(".bigReadMore").text('Verberg de kaart');
		}

		Cufon.refresh('.bigReadMore');
	}   
	  
  
});
