/*-------------------------------------------------------------------- 
 * JQuery Plugin: "EqualHeights"
 * by:	Scott Jehl, Todd Parker, Maggie Costello Wachs (http://www.filamentgroup.com)
 *
 * Copyright (c) 2008 Filament Group
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Description: Compares the heights or widths of the top-level children of a provided element 
 		and sets their min-height to the tallest height (or width to widest width). Sets in em units 
 		by default if pxToEm() method is available.
 * Dependencies: jQuery library, pxToEm method	(article: 
		http://www.filamentgroup.com/lab/retaining_scalable_interfaces_with_pixel_to_em_conversion/)							  
 * Usage Example: $(element).equalHeights();
  		Optional: to set min-height in px, pass a true argument: $(element).equalHeights(true);
 * Version: 2.0, 08.01.2008
--------------------------------------------------------------------*/

$.fn.equalHeights = function(px) {
	$(this).each(function(){
		var currentTallest = 0;
		$(this).children().each(function(i){
			if ($(this).outerHeight() > currentTallest) { currentTallest = $(this).outerHeight(); }
		});
		///**/if (!px || !Number.prototype.pxToEm) currentTallest = currentTallest.pxToEm(); //use ems unless px is specified
		// for ie6, set height since min-height isn't supported
		if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); }
		$(this).children().css({'min-height': currentTallest});
	});
	return this;
};

/*-------------------------------------------------------------------- 
 * jQuery plugins: toEm() and toPx()
 * by Scott Jehl (scott@filamentgroup.com), http://www.filamentgroup.com
 * Copyright (c) Filament Group
 * Dual licensed under the MIT (filamentgroup.com/examples/mit-license.txt) and GPL (filamentgroup.com/examples/gpl-license.txt) licenses.
 * Article: http://www.filamentgroup.com/lab/update_jquery_plugin_for_retaining_scalable_interfaces_with_pixel_to_em_con/
 * Options:  	 								
 		scope: string or jQuery selector for font-size scoping		  
 * Usage Example: $(myPixelValue).toEm(); or $(myEmValue).toPx();
--------------------------------------------------------------------*/

$.fn.toEm = function(settings){
	settings = jQuery.extend({
		scope: 'body'
	}, settings);
	var that = parseInt(this[0],10);
	var scopeTest = jQuery('<div style="display: none; font-size: 1em; margin: 0; padding:0; height: auto; line-height: 1; border:0;">&nbsp;</div>').appendTo(settings.scope);
	var scopeVal = scopeTest.height();
	scopeTest.remove();
	return (that / scopeVal).toFixed(8) + 'em';
};


$.fn.toPx = function(settings){
	settings = jQuery.extend({
		scope: 'body'
	}, settings);
	var that = parseFloat(this[0]);
	var scopeTest = jQuery('<div style="display: none; font-size: 1em; margin: 0; padding:0; height: auto; line-height: 1; border:0;">&nbsp;</div>').appendTo(settings.scope);
	var scopeVal = scopeTest.height();
	scopeTest.remove();
	return Math.round(that * scopeVal) + 'px';
};

// END PLUGINS



var HintForm = function (str_id)
{
	var str_wrapper_id = null;
	var initiate = function (str_id)
	{
		str_wrapper_id = str_id;
	}
	var construct = function ()
	{
		enhanceInputs();
	};
	var enhanceInputs = function ()
	{
		var obj_wrapper = document.getElementById(str_wrapper_id);
		if (!obj_wrapper) { throw new Error('Could not find the element!'); }
		var arr_labels = obj_wrapper.getElementsByTagName('label');
		var int_labels_count = arr_labels.length;
		for (int_i = 0; int_i < int_labels_count; int_i++)
		{
			var str_label_target_id = arr_labels[int_i].getAttribute('for');
			var str_label_text = arr_labels[int_i].innerText || arr_labels[int_i].textContent;
			var obj_label_target = document.getElementById(str_label_target_id);
			if (obj_label_target) {
				obj_label_target.value = str_label_text;
				obj_label_target.onfocus = function (str_label_text)
				{
					return function () {
						if (str_label_text === this.value) { this.value = ''; }
					}
				}(str_label_text);
				obj_label_target.onblur = function (str_label_text)
				{
					return function () {
						if ('' === this.value) { this.value = str_label_text; }
					}
				}(str_label_text);
			}
		}
	}
	initiate(str_id);
	construct();
};

var jSlideshow = function (str_id)
{
	var obj_wrapper = null;
		var str_wrapper_id = null;

	var obj_controls = null;
		var str_controls_id = null;
		var obj_control_previous = null;
		var obj_control_next = null;
			var str_control_previous_id = 'previous';
			var str_control_next_id = 'next';

	var obj_slidelist = null;
		var str_slidelist_id = null;
			var str_slide_active_classname = 'active';
			
	var int_viewport_width = 0;
	var bln_slideshow_circle = true;
	var bln_slideshow_stopped = false;
	var int_slideshow_changed = 0;
	var int_slideshow_delay = 5000;
	var int_slideshow_effect = 3000;
	
	var initiate = function (str_id)
	{
		str_wrapper_id = str_id;
		str_controls_id = str_wrapper_id + '_' + 'controls';
			str_control_previous_id = str_controls_id + '_' + 'previous';
			str_control_next_id = str_controls_id + '_' + 'next';
		str_slidelist_id = str_wrapper_id + '_' + 'slidelist';
	};
	
	var construct = function ()
	{
		initiateWrapper();
		initiateSlidelist();
		renderControls();
		initiateControls();
		activateControls();
		initiateSlideshow();
		checkAdvanceSlideshow();
	};
	
	// Initiate the wrapper
	var initiateWrapper = function ()
	{
		if (!document.getElementById(str_wrapper_id)) { throw new Error('Could not find the element!'); }
		obj_wrapper = document.getElementById(str_wrapper_id);
		return true;
	};
	
	// Initiate the slides
	var initiateSlidelist = function ()
	{
		if (!document.getElementById(str_slidelist_id)) { throw new Error('Could not find the element!'); }
		obj_slidelist = document.getElementById(str_slidelist_id);
		return true;
	};
	
	// Render the controls
	var renderControls = function ()
	{
		if (!obj_wrapper) { throw new Error('Could not find the element!'); }
		
		if (0 === obj_wrapper.getElementsByTagName('*').length) { return false; }
		
		var tmp_controls = document.createElement('ul');
		tmp_controls.id = str_controls_id;
			var tmp_control_previous = document.createElement('li');
				var tmp_control_previous_link = document.createElement('a');
				tmp_control_previous_link.id = str_control_previous_id;
				tmp_control_previous_link.href = '#previous';
					var tmp_control_previous_text = document.createTextNode('vorige');
					tmp_control_previous_link.appendChild(tmp_control_previous_text);
				tmp_control_previous.appendChild(tmp_control_previous_link);
			tmp_controls.appendChild(tmp_control_previous);
			var tmp_control_next = document.createElement('li');
				var tmp_control_next_link = document.createElement('a');
				tmp_control_next_link.id = str_control_next_id;
				tmp_control_next_link.href = '#next';
					var tmp_control_next_text = document.createTextNode('volgende');
					tmp_control_next_link.appendChild(tmp_control_next_text);
				tmp_control_next.appendChild(tmp_control_next_link);
			tmp_controls.appendChild(tmp_control_next);
		obj_wrapper.insertBefore(tmp_controls, obj_wrapper.getElementsByTagName('*').item(0));
		
		return true;
	};
	
	// Initiate the controls
	var initiateControls = function ()
	{
		if (!document.getElementById(str_controls_id)) { throw new Error('Could not find the element!'); }
		obj_controls = document.getElementById(str_controls_id);
		
		if (!document.getElementById(str_control_previous_id)) { throw new Error('Could not find the element!'); }
		obj_control_previous = document.getElementById(str_control_previous_id);
		if (!document.getElementById(str_control_next_id)) { throw new Error('Could not find the element!'); }
		obj_control_next = document.getElementById(str_control_next_id);
		
		return true;
	};
	
	// Activate the controls, using jQuery
	var activateControls = function ()
	{
		if ((!obj_control_previous) || (!obj_control_next)) { throw new Error('Could not find the controls!'); }
		$(obj_control_previous).bind('click', function (event) { showPrevious(event); event.preventDefault(); } );
		$(obj_control_next).bind('click', function (event) { showNext(event); event.preventDefault(); } );
	};

	// Initiate the slideshow
	var initiateSlideshow = function ()
	{
		int_viewport_width = $(obj_slidelist).width();
		if (0 === $(obj_slidelist).find('li.active').length)
		{
			$(obj_slidelist).find('li:first').addClass('active');
		}
		
		$(obj_slidelist).find('li:not(.active)').hide();
		$(obj_slidelist).find('li').css({
			//'position': 'absolute', 'top': 0, 'left': 0, 'z-index': 0
		});
		$(obj_slidelist).bind('mouseover', function (event) {
			bln_slideshow_stopped = true;
			int_slideshow_changed = 0;
		});
		$(obj_slidelist).bind('mouseout', function (event) {
			bln_slideshow_stopped = false;
			int_slideshow_changed = (new Date()).getTime();
		});
		$(obj_controls).bind('mouseover', function (event) {
			bln_slideshow_stopped = true;
			int_slideshow_changed = 0;
		});
		$(obj_controls).bind('mouseout', function (event) {
			bln_slideshow_stopped = false;
			int_slideshow_changed = (new Date()).getTime();
		});
	};
	
	// Show previous slide
	var showPrevious = function (event)
	{
		if (!obj_slidelist) { throw new Error('Could not find the slides!'); }
		var jobj_slide_active = $(obj_slidelist).find('li.active');
		var jobj_slide_previous = jobj_slide_active.prev();
		if (0 === jobj_slide_previous.length)
		{
			if (true !== bln_slideshow_circle) { console.info('No previous slide found'); return false; }
			else
			{
				jobj_slide_previous = $(obj_slidelist).find('li:last:not(.active)');
				if (0 === jobj_slide_previous.length) { console.info('No previous slide found'); return false; }
			}
		}
		/*jobj_slide_active.stop(true, true).css({'z-index': 0}).removeClass('active').show();
		jobj_slide_previous.addClass('active')
						.css({'position': 'absolute', 'top': 0, 'left': -1 * int_viewport_width, 'z-index': 1})
						.show()
						.animate({'top': 0, 'left': 0}, int_slideshow_effect, 'easeOutCubic', function () {
							jobj_slide_active.hide();
							jobj_slide_previous.css({'position': 'relative'});
						});*/
		$(obj_slidelist).parent().css('height', $(obj_slidelist).parent().css('height'));
		$(obj_slidelist).find('li').hide();
		jobj_slide_active.removeClass('active').hide();
		jobj_slide_previous.addClass('active').show('fade', 1000);
		$(obj_slidelist).parent().css('height', 'auto');
	};
	
	// Show next slide
	var showNext = function ()
	{
		if (!obj_slidelist) { throw new Error('Could not find the slides!'); }
		var jobj_slide_active = $(obj_slidelist).find('li.active');
		var jobj_slide_next = jobj_slide_active.next();
		if (0 === jobj_slide_next.length)
		{
			if (true !== bln_slideshow_circle) { console.info('No next slide found'); return false; }
			else
			{
				jobj_slide_next = $(obj_slidelist).find('li:first:not(.active)');
				if (0 === jobj_slide_next.length) { console.info('No next slide found'); return false; }
			}
		}
		/*jobj_slide_active.stop(true, true).css({'z-index': 0}).removeClass('active').show();
		jobj_slide_next.addClass('active')
						.css({'position': 'absolute', 'top': 0, 'left': int_viewport_width, 'z-index': 1})
						.show()
						.animate({'top': 0, 'left': 0}, int_slideshow_effect, 'easeOutCubic', function () {
							jobj_slide_active.hide();
							jobj_slide_next.css({ 'position': 'relative' }); // Added: relative positioning
						});*/
		$(obj_slidelist).parent().css('height', $(obj_slidelist).parent().css('height'));
		$(obj_slidelist).find('li').hide();
		jobj_slide_active.removeClass('active').hide();
		jobj_slide_next.addClass('active').show('fade', 1000);
		$(obj_slidelist).parent().css('height', 'auto');
	};

	// Check advanced slideshow
	var checkAdvanceSlideshow = function ()
	{
		if (false === bln_slideshow_stopped)
		{
			if (0 <= int_slideshow_changed)
			{
				var int_time = (new Date()).getTime();
				if (0 === int_slideshow_changed)
				{
					int_slideshow_changed = int_time - int_slideshow_delay/2;
				}
				if (int_time > int_slideshow_changed + int_slideshow_delay)
				{
					showNext();
					int_slideshow_changed = int_time;
				}
			}
		}
		setTimeout(function () { checkAdvanceSlideshow(); }, int_slideshow_delay/3);
	};
	
	initiate(str_id);
	construct(str_id);
};

// TODO check all label after adding active states from url -> create function to check all label
var jFilter = function (str_id)
{
	var obj_wrapper = null;
		var str_wrapper_id = null;
		
	var str_elementlist_id = null;
	var str_labellist_id = null;
	var str_label_id_start = null;
	var str_label_separator = '&';
	
	var bln_all_default = false;
	var bln_all_exclusive = false;
	var bln_selection_required = false;
	
	var initiate = function (str_id)
	{
		str_wrapper_id = str_id;
		str_elementlist_id = str_wrapper_id + '_' + 'elementlist';
		str_labellist_id = str_wrapper_id + '_' + 'labellist';
		str_label_id_start = str_wrapper_id + '_' + 'label' + '_';
		bln_all_default = false;
		bln_all_exclusive = true;
		bln_selection_required = true;
	};
	
	var construct = function ()
	{
		var obj_elementlist = document.getElementById(str_elementlist_id);
		var obj_labellist = document.getElementById(str_labellist_id);
		if (!obj_elementlist) { return; }
		if (!obj_labellist) { return; }
		
		$(obj_elementlist).equalHeights();
		
		$(window).hashchange(function () { updateLabelsByHash(); filterElements(); });
		$(window).hashchange();
		activateLabels();
	};
	
	// Activate the labels
	var activateLabels = function ()
	{
		var obj_labellist = document.getElementById(str_labellist_id);
		if (!obj_labellist) { return; }

		$(obj_labellist).find('li').bind('click', function () {
			toggleLabel(this);
			updateHash();
			return false;
		});
	}
	
	// Toggle the label
	var toggleLabel = function (obj_label)
	{
		var jobj_label = $(obj_label);
		var jobj_parent = jobj_label.parent();
		// Is last active label
		if (true === bln_selection_required)
		{
			if ((jobj_label.hasClass('active')) && (1 >= jobj_parent.find('li.active').length)) { return false; }
			if ((jobj_label.hasClass('active')) && jobj_label.hasClass('all')) { return false; }
		}
		// Is all label
		if (true === jobj_label.hasClass('all'))
		{
			// Is active all label
			if (true === jobj_label.hasClass('active'))
			{
				jobj_parent.find('li').removeClass('active');
			}
			// Is inactive all label
			else
			{
				if (true === bln_all_exclusive) 	{ jobj_parent.find('li').removeClass('active'); }
				else 								{ jobj_parent.find('li').addClass('active'); }
				jobj_label.addClass('active');
			}
		}
		// Is normal label
		else
		{
			// Is active normal label
			if (true === jobj_label.hasClass('active'))
			{
				jobj_label.removeClass('active');
				jobj_parent.find('li.all').removeClass('active');
			}
			// Is inactive normal label
			else
			{
				if (true === bln_all_exclusive) 	{ jobj_parent.find('li.all').removeClass('active'); }
				jobj_label.addClass('active');
			}
		}
		// Check all label
		if (true !== bln_all_exclusive)
		{
			if (0 < jobj_parent.find('li.all').length)
			{
				if (jobj_parent.find('li:not(.all)').length
						=== jobj_parent.find('li.active:not(.all)').length)
				{
					jobj_parent.find('li.all').addClass('active');
				}
				else
				{
					jobj_parent.find('li.all').removeClass('active');
				}
			}
		}
	}
	
	// Update hash
	var updateHash = function ()
	{
		// Get labellist
		var obj_labellist = document.getElementById(str_labellist_id);
		if (!obj_labellist) { return; }
		
		// Create hash from labels
		var str_hash = '';
		$(obj_labellist).find('li.active').each(function () {
			str_hash += $(this).attr('id') + str_label_separator;
		});
		str_hash = str_hash.substring(0, str_hash.length-1);
		
		// Update hash
		document.location.hash = '#' + str_hash;
	}
	
	// Update labels by hash
	var updateLabelsByHash = function ()
	{
		// Get labellist
		var obj_labellist = document.getElementById(str_labellist_id);
		if (!obj_labellist) { return false; }

		// Activate labels from hash		
		var str_hash = document.location.hash.replace(/^#/, '');
		var arr_hash_labels = str_hash.split('&');
		var int_hash_labels_count = arr_hash_labels.length;
		$(obj_labellist).find('li').removeClass('active');
		for (var int_i = 0; int_i < int_hash_labels_count; int_i++)
		{
			var obj_label = document.getElementById(arr_hash_labels[int_i]);
			if (obj_label)
			{
				$(obj_label).addClass('active');
			}
		}
		
		// Activate label all if nothing present
		if ((true === bln_all_default) && (true === bln_selection_required))
		{
			$(obj_labellist).find('li.all:not(.active)').each(function ()
			{
				if (0 === $(this).parent().find('li.active').length)
				{
					toggleLabel(this);
				}
			});
		}
	}
	
	// Filter elements
	var filterElements = function ()
	{
		// Get labellist and elementlist
		var obj_labellist = document.getElementById(str_labellist_id);
		var obj_elementlist = document.getElementById(str_elementlist_id);
		if (!obj_labellist) { return; }
		if (!obj_elementlist) { return; }
		
		// Get category labels
		var int_categories_count = 0;
		var arr_categories_labels_check = [];
		$(obj_labellist).find('ul, ol').each(function ()
		{
			int_categories_count++;
			arr_categories_labels_check[int_categories_count] = '';
			if (0 < $(this).find('li.all.active').length)
			{
				$(this).find('li:not(.all)').each(function ()
				{
					if ('' !== arr_categories_labels_check[int_categories_count]) { arr_categories_labels_check[int_categories_count] += ', '; }
					arr_categories_labels_check[int_categories_count] += '.' + ($(this).attr('id'));
				});
			}
			else
			{
				$(this).find('li.active:not(.all)').each(function ()
				{
					if ('' !== arr_categories_labels_check[int_categories_count]) { arr_categories_labels_check[int_categories_count] += ', '; }
					arr_categories_labels_check[int_categories_count] += '.' + ($(this).attr('id'));
				});
			}
		});
		
		$(obj_elementlist).find('li').addClass('active').each(function ()
		{
			for (var int_i = 0; int_i < int_categories_count; int_i++)
			{
				if (true !== $(this).is(arr_categories_labels_check[int_i+1]))
				{
					$(this).removeClass('active');
				}
			}
		});
		
		//$(obj_elementlist).find('li.active').animate({'width': 'show', 'opacity': 'show'}, 3000);
		//$(obj_elementlist).find('li:not(.active)').animate({'width': 'hide', 'opacity': 'hide'}, 3000);
		$(obj_elementlist).find('li.active').show();
		$(obj_elementlist).find('li:not(.active)').hide();
		
		// TODO REWRITE: add empty functionality
 		if (0 === $('#filter_empty').length)
		{
			var obj_empty_container = document.createElement('div');
			obj_empty_container.className = 'text';
			obj_empty_container.id = 'filter_empty';
			var obj_empty = document.createElement('p');
			obj_empty.appendChild(document.createTextNode('Oops!'));
			obj_empty_container.appendChild(obj_empty);
			$(obj_empty_container).insertBefore(obj_elementlist).hide();
		}
		$('#filter_empty').hide();
		if (0 === $(obj_elementlist).find('li.active').length) { $('#filter_empty').show(); }
		if ((1 === $('#contactlenzen').parent().find('.active').length) && $('#contactlenzen').hasClass('active')) { $('#filter_empty').hide(); }
		if ((1 === $('#glazen').parent().find('.active').length) && $('#glazen').hasClass('active')) { $('#filter_empty').hide(); }
		
		// TODO REWRITE: add title functionality
		$('.mood').hide();
		var jobj_mood_labels = $('#all2').parent();
		if (1 === jobj_mood_labels.find('li.active').length)
		{
			var str_mood_classname = jobj_mood_labels.find('li.active').attr('id');
			if (1 === $('.mood.' + str_mood_classname).length)
			{
				$('.mood.' + str_mood_classname).show();
			}
		}
		$('.cat4').hide();
		var jobj_cat4_labels = $('#all4').parent();
		if (1 === jobj_cat4_labels.find('li.active').length)
		{
			var str_cat4_classname = jobj_cat4_labels.find('li.active').attr('id');
			if (1 === $('.cat4.' + str_cat4_classname).length)
			{
				$('.cat4.' + str_cat4_classname).show();
			}
		}
	}

	initiate(str_id);
	construct(str_id);
}

$(document).ready(function ()
{
	// Add fancybox
	$("a.pictureviewer").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
	
	// Add collection menu behavior
	var jobj_link_collection = $('.action_show_collection');
	var jobj_list_collection = $('#nav-sub-collectie');
	if ((0 < jobj_link_collection.length) && (0 < jobj_list_collection.length))
	{
		jobj_link_collection.bind('mouseover', function () {
			jobj_list_collection.addClass('active');
			setTimeout(function () { if (true === jobj_list_collection.hasClass('active')) { jobj_list_collection.show(); }}, 0);
		});
		jobj_link_collection.bind('mouseout', function () {
			jobj_list_collection.removeClass('active');
			setTimeout(function () { if (false === jobj_list_collection.hasClass('active')) { jobj_list_collection.hide(); }}, 50);
		});
		jobj_list_collection.bind('mouseover', function () {
			jobj_list_collection.addClass('active');
			setTimeout(function () { if (true === jobj_list_collection.hasClass('active')) { jobj_list_collection.show(); }}, 0);
		});
		jobj_list_collection.bind('mouseout', function () {
			jobj_list_collection.removeClass('active');
			setTimeout(function () { if (false === jobj_list_collection.hasClass('active')) { jobj_list_collection.hide(); }}, 50);
		});
	}
	
	// Add call to action behavior
	var jobj_cta = $('#call-to-actions');
	if (0 < jobj_cta.length)
	{
		jobj_cta.find('li').find('p').hide();
		jobj_cta.find('li').hover(function () {
			$(this).find('p').stop(true, true).toggle();
		});
	}
	
	// Add hintforms
	if (0 < $('#newsletter').length)	{ var obj_form 		= new HintForm('newsletter'); }
	
	// Enhance contact form
	if (0 < $('#datum').length)
	{
		$.datepicker.regional['nl'] = {
			closeText: 'Sluiten',
			prevText: '<Vorige',
			nextText: 'Volgende>',
			currentText: 'Vandaag',
			monthNames: ['Januari','Februari','Maart','April','Mei','Juni',
			'Juli','Augustus','September','Oktober','November','December'],
			monthNamesShort: ['Jan','Feb','Maa','Apr','Mei','Jun',
			'Jul','Aug','Sep','Okt','Nov','Dec'],
			dayNames: ['Zondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag'],
			dayNamesShort: ['Zo','Ma','Di','Wo','Do','Vr','Za'],
			dayNamesMin: ['Zo','Ma','Di','Wo','Do','Vr','Za'],
			weekHeader: 'We',
			dateFormat: 'dd/mm/yy',
			firstDay: 1,
			isRTL: false,
			showMonthAfterYear: false,
			yearSuffix: ''
		};
		$.datepicker.setDefaults($.datepicker.regional['nl']);
		$('#datum').datepicker({
			'constrainInput': true,
			'defaultDate': null,
			'minDate': +1
		});
	}
	if (0 < $('#tijdstip').length)
	{
		$.timepicker.regional['nl'] = {
			timeOnlyTitle: 'Tijdstip',
			timeText: 'Tijd',
			hourText: 'Uur',
			minuteText: 'Minuut',
			secondText: 'Seconde',
			currentText: 'Vandaag',
			closeText: 'Sluiten',
			ampm: false
		};
		$.timepicker.setDefaults($.timepicker.regional['nl']);
		$('#tijdstip').timepicker({
			timezoneText: 'Tijdzone',
			timeFormat: 'hh:mm tt',
			hourMin: 7,
			hourMax: 21
		});
	}
	
	// Add slideshow
	if (0 < $('#slideshow').length)
	{
		var obj_slider = new jSlideshow('slideshow');
	}
	
	// Add filter system
	if (0 < $('#filter').length)
	{
		document.getElementById('filter').style.display = 'block';
		document.getElementById('filter_loader').style.display = 'none';
		var obj_filter = new jFilter('filter');
	}
});

