		$(document).ready(function(){
		
			$("html").css({overflowY: 'scroll'});
	
			$("a[@rel=external]").each(function(i){ this.target="_blank"; });
	
			/*
			*	TOP NAVIGATION
			*
			*	Hanteert menu functions
			*
			**/
			
			$("#sub-navigation ul").hide();
			
			var title = $("#top-navigation li.active a").attr('title');
			
			$("#sub-navigation ul#" + title).show();
			
			$("#top-navigation a").mouseover(function(){
	
				$(this).parent().css({ backgroundPosition:"100% -150px" });
			
			}).mouseout(function(){
				
				// Only not:class(active) get background reset
				if($(this).parent().attr('class') != 'active') $(this).parent().css({ backgroundPosition:"100% -100px" });
	
			});
			
			$("#slogans").innerfade({speed: 'slow', timeout: 8000, type: 'sequence', containerheight: '203px'}); 

			if($("#recent-list").length > 0) {
				$('#recent-list').jcarousel({
					auto: 5,
					wrap: 'last',
					initCallback: mycarousel_initCallback
				});
			}
			
			/*
			*	OBJECT SPECIFICATIES
			*
			**/
			
			if($("#object-specs").length > 0) {
				
				var from = 4;
				
				var items = $("#object-specs tbody tr").length;

				if(items > from) {
				
					for(var i = from; i <= items; i++) {
						
						$("#object-specs tbody tr#" + i + "").hide();

					}

					$("#object-specs").after("<a href=\"#\" id=\"toggle-specs\" class=\"show\">Alle kenmerken (" + items + ")</a>");
	
					$("#toggle-specs").bind("click", function(e) {
	
						if($(this).attr('class') == 'show') {
							
							for(var i = 1; i <= items; i++) {
								
								$("#object-specs tbody tr#" + i + "").fadeIn('fast');
		
							}	
							
							$(this).attr("class","hide");
							
							$(this).text("Verberg kenmerken");

						} else if($(this).attr('class') == 'hide') {
	
							for(var i = from; i <= items; i++) {
								
								$("#object-specs tbody tr#" + i + "").fadeOut('fast');
		
							}
							
							$(this).attr("class","show");
							$(this).text("Alle kenmerken (" + items + ")");
						
						}

						return false;
									  
					});
					
				}
				
			}

		});





		/*
		*	jCarousel / thickBox functions
		*
		**/

		function mycarousel_initCallback(carousel)
		{
			// Disable autoscrolling if the user clicks the prev or next button.
			carousel.buttonNext.bind('click', function() {
				carousel.startAuto(0);
			});
		
			carousel.buttonPrev.bind('click', function() {
				carousel.startAuto(0);
			});
		
			// Pause autoscrolling if the user moves with the cursor over the clip.
			carousel.clip.hover(function() {
				carousel.stopAuto();
			}, function() {
				carousel.startAuto();
			});
		};

							
		function mycarousel_itemLoadCallback(carousel, state) {
			
			for (var i = carousel.first; i <= carousel.last; i++) {
				
				if (carousel.has(i)) {
					continue;
				}
		
				if (i > mycarousel_itemList.length) {
					break;
				}
		
				// Create an object from HTML
				var item = jQuery(mycarousel_getItemHTML(mycarousel_itemList[i-1])).get(0);
		
				// Apply thickbox
				tb_init(item);
		
				carousel.add(i, item);
			}
			
		};
		
		 
		function mycarousel_getItemHTML(item) {
			
			var url_m = item.url.replace(/thumb_/g, 'large_');
			return '<a href="' + url_m + '" title="' + item.title + '"><img src="' + item.url + '" border="0" alt="' + item.title + '"/></a>';
			
		};

		

		/*
		*	Popup Functions
		*
		**/

		var popupProfiles = { printObject: { height:700,width:700,scrollbars:1,toolbar:0,status:0,resizable:0,top:100,left:300,center:1 } };
	
		$(function() { $(".popup").popupwindow(popupProfiles); });

