/////////////////////////////////////////// BASIC FUNCTIONS, DON'T EDIT ///////////////////////////////////////////

/*
 * Starts executing the initializing functions when the DOM structure of the page has been loaded.
 * 
 * @author CSD (clientsidedevelopers[AT]efocus.nl)
 * @uses Mootools 1.2.1 JavaScript Library
 */
window.addEvent('domready', function() {
	initExternalLinks();
//	initRemoveLinkLines();

	f02_pushboxSlideShow();
	f04_reportRecipeForm();
	f05_recipeQuickSearch();
	f06_informationSearch();	
	f07_recipeSearchButtons();
	f15_captureAreaToolTips();
	f19_searchfiltersubmit();
	f19_searchResultsBgColorToggle();
	f22_signuprecipeform();
	f23_fishSpeciesToolTips();
	f24_captureAreaToolTips();
	f26_faqAccordion();

	f27_newsHighlightHoverIE6and7();
	f28_newsHighlightHoverIE6and7();
	f31_productListHoverIE6();

	initSlidingOverlayClosed();
	initSlidingOverlayOpened();
	initMainNavHover();
	initRatingSelector();
	initPaginatorCentering();
	initOverlayShadowHeightIE6();
	initLightBoxSubmitButton();
	
	if ($defined(Shadowbox)) {
		Shadowbox.init();
	}
});

/*
 * Starts executing the initializing functions when the entire page has been loaded.
 * 
 * @author CSD (clientsidedevelopers[AT]efocus.nl)
 * @uses Mootools 1.2.1 JavaScript Library
 */
window.addEvent('load', function() {
	initContentHeight();
	addRelToLightboxClass();	
});


/*
 * initExternalLinks
 * Used in order for certain links to open in a new window without the direct target attribute (so it validates properly).
 * 
 * @author CSD (clientsidedevelopers[AT]efocus.nl)
 * @uses <a href="http://www.efocus.nl/" rel="external">eFocus site</a>
 */
function initExternalLinks() {
	if (!document.getElementsByTagName) return; 
	var arrAnchors = document.getElementsByTagName("a"); 
	for (var i=0; i<arrAnchors.length; i++) { 
		var elAnchor = arrAnchors[i]; 
		if (elAnchor.getAttribute("href") && elAnchor.getAttribute("rel") == "external") {
			elAnchor.target = "_blank";
		}
	}
}

/*
 * initRemoveLinkLines
 * Removes the dotted lines around links, but breaks the Tab button on the keyboard: less accessability.
 * 
 * @author CSD (clientsidedevelopers[AT]efocus.nl)
 */
function initRemoveLinkLines() {
	$$('a').addEvent('focus', function(){this.blur()});
}

function response()
{
		initContentHeight();
}


function clearSearchTerm(el){
	switch (el.value) {
		case 'Zoek op trefwoorden':
		case 'Zoek informatie':
		case 'Zoek recepten':
		case 'Zoek recept op zoekterm':
			el.value = '';
	}
}

function clearFooterInputs(el){
	if(el.value=='Naam'){
		el.value='';
	}else if(el.value=='Emailadres'){
		el.value='';
	}
}

function searchInformation(){
	if($('information').value){
		var value = $('information').value;
		
		if(value!='Zoek informatie' && value!=''){
			 location.href='/zoeken/?tx_visrecepten_pi24[sTerm]='+value;
		}
	}else{
		
		alert('Search box not defined');
	}
}





/////////////////////////////////////////// CLIENT-SIDE JAVASCRIPT FUNCTIONS ///////////////////////////////////////////

/**
 * f02_pushboxSlideShow
 * Animates the header slideshow on the homepage and defines the interaction.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @param arrSlides, intStartSlide, blnLoop, intInterval, blnAutoPlay, blnPlaying
 * @param strOutEffectProperty, intOutEffectStartValue, intOutEffectEndValue, intOutEffectDuration
 * @param strInEffectProperty, intInEffectStartValue, intInEffectEndValue, intInEffectDuration
 * @param elNav, strLabelPrev, strLabelNext, strLabelFirst, strLabelLast, strLabelPlay, strLabelPause
 * @return EfxNavSlideShow Class instance
 */
function f02_pushboxSlideShow(){
	arrF02 = $$('.f02_pushbox');
	if (arrF02.length == 0) return;
	
	var elMySs = arrF02[0];
	var arrMySlides = elMySs.getElements('.slide');
	var elMyNav = elMySs.getElement('.slideshow_nav');

	var objSlideShow = new EfxNavSlideShow({
		arrSlides: arrMySlides,
		elNav: elMyNav,
		intInterval: 4000
	});
}



/*
 * f04_reportRecipeForm
 * Submits the F04 form when clicking on the submitbutton.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return
 */
function f04_reportRecipeForm() {
	var arrF04 = $$('.report_recipe_form');
	if (arrF04.length == 0) return;
	
	arrF04.each(function(elF04){
		elF04SubmitButton = elF04.getElement('.component_button');
		elF04SubmitButton.addEvent('click', function(){
			elF04.submit();
		});
	});
}



/*
 * f05_recipeQuickSearch
 * Submits the F05 form when clicking on the submitbutton.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return
 */
function f05_recipeQuickSearch() {
	var arrF05 = $$('.f05_recipe_quick_search');
	if (arrF05.length == 0) return;
	
	arrF05.each(function(elF05){
		elF05SubmitButton = elF05.getElement('.component_button');
		elF05SubmitButton.addEvent('click', function(){
			elF05.submit();
		});
	});
}



/*
 * f06_informationSearch
 * Submits the F06 form when clicking on the submitbutton.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return
 */
function f06_informationSearch() {
	var arrF06 = $$('.f06_information_search');
	if (arrF06.length == 0) return;
	
	arrF06.each(function(elF06){
		elF06SubmitButton = elF06.getElement('.component_button');
		elF06SubmitButton.addEvent('click', function(){
			elF06.submit();
		});
	});
}



/*
 * f07_recipeSearchButtons
 * Submits the F07 form when clicking on the resultsbutton or searchbutton.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 */
function f07_recipeSearchButtons() {
	var arrF07 = $$('.f07_recipe_search');
	if (arrF07.length == 0) return;
	
	arrF07.each(function(elF07){
		var arrF07SubmitButtons = elF07.getElements('.component_button');
		arrF07SubmitButtons.each(function(elF07SubmitButton){
			elF07SubmitButton.addEvent('click', function(){
				elF07.submit();
			});
		});
	});
}



function f19_searchfiltersubmit() {
	var arrF19 = $$('.searchfilterchange');
	var arrF07 = $$('.f07_recipe_search');

	arrF07.each(function(elF07){
		var arrF07SubmitButtons = elF07.getElements('.component_button');
		arrF07SubmitButtons.each(function(){
			arrF19.addEvent('change', function(){
				elF07.submit();
			});
		});
	});

}


function f22_signuprecipeform() {
	var arrF22 = $$('.signuprecipeform');
	if (arrF22.length == 0) return;
	
	arrF22.each(function(elF22){
		elF22SubmitButton = elF22.getElement('.component_button');
		elF22SubmitButton.addEvent('click', function(){
			elF22.submit();
		});
	});
}




/*
 * f15_captureAreaToolTips
 * Shows and hides a custom tooltip for each item in the capture area list within F15.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return
 */
function f15_captureAreaToolTips(){
	var arrF15 = $$('.f15_fish_information_extended');
	if (arrF15.length == 0) return;
	
	if (Browser.Engine.trident4) { // IE6
		var intToolTipOffsetY = -45;
	} else if (Browser.Engine.trident5) { // IE7
		var intToolTipOffsetY = -50;
	} else {
		var intToolTipOffsetY = -45;
	}
	
	if($('worldmap') == null) return;
	var arrCaptureAreaToolTips = $('worldmap').getElements('a');
	
	
	var objCaptureAreaToolTips = new Tips(arrCaptureAreaToolTips, {offsets: {'x': 2, 'y': intToolTipOffsetY}});
	
	var arrTips = $$('.tip');
	if (arrTips.length == 0) return;
	
	arrTips[0].setStyles({
		'height': 40,
		'padding-top': 10,
		'padding-bottom': 10
	});
	
	objCaptureAreaToolTips.addEvent('show', function(captureAreaToolTip){
		captureAreaToolTip.fade('show');
	});
	
	objCaptureAreaToolTips.addEvent('hide', function(captureAreaToolTip){
		captureAreaToolTip.fade('hide');
	});
}

/*
 * f19_searchResultsBgColorToggle
 * Adds a class for coloring every even listitem within the searchresults list.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return
 */
function f19_searchResultsBgColorToggle() {
	var arrF19 = $$('.f19_searchresults');
	if (arrF19.length == 0) return;
	
	elSearchResultsList = arrF19[0].getElement('ul');
	elSearchResultsListItemsEven = elSearchResultsList.getElements('li:even');
	elSearchResultsListItemsEven.each(function(){
		elSearchResultsListItemsEven.addClass('even');
	});
}



/*
 * f23_fishSpeciesToolTips
 * Shows and hides a custom tooltip for each item in the fish species list.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return
 */
function f23_fishSpeciesToolTips(){
	var arrF23 = $$('.f23_fish_species_overview');
	if (arrF23.length == 0) return;
	
	arrFishSpeciesToolTips = $$('.fish_species_list')[0].getElements('a');
	var objFishSpeciesToolTips = new Tips(arrFishSpeciesToolTips, {offsets: {'x': 30, 'y': -82}});
	
	objFishSpeciesToolTips.addEvent('show', function(fishSpeciesToolTip){
		fishSpeciesToolTip.fade('show');
	});
	
	objFishSpeciesToolTips.addEvent('hide', function(fishSpeciesToolTip){
		fishSpeciesToolTip.fade('hide');
	});
}



/*
 * f24_captureAreaToolTips
 * Shows and hides a custom tooltip for each item in the capture area list.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return
 */
function f24_captureAreaToolTips(){
	var arrF24 = $$('.f24_capture_area_overview');
	if (arrF24.length == 0) return;
	
	if (Browser.Engine.trident4) { // IE6
		var intToolTipOffsetY = -45;
	} else if (Browser.Engine.trident5) { // IE7
		var intToolTipOffsetY = -50;
	} else {
		var intToolTipOffsetY = -45;
	}
	
	var arrCaptureAreaToolTips = $('worldmap').getElements('a');
	var objCaptureAreaToolTips = new Tips(arrCaptureAreaToolTips, {offsets: {'x': 2, 'y': intToolTipOffsetY}});
	
	var arrTips = $$('.tip');
	if (arrTips.length == 0) return;
	
	arrTips[0].setStyles({
		'height': 40,
		'padding-top': 10,
		'padding-bottom': 10
	});
	
	objCaptureAreaToolTips.addEvent('show', function(captureAreaToolTip){
		captureAreaToolTip.fade('show');
	});
	
	objCaptureAreaToolTips.addEvent('hide', function(captureAreaToolTip){
		captureAreaToolTip.fade('hide');
	});
}



/**
 * f26_faqAccordion
 * Adds the accordion functionality to the FAQ lists.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return void
 */
function f26_faqAccordion() {
	arrF26 = $$('.f26_faq');
	if (arrF26.length == 0) return;
	
	var elFaq = arrF26[0];
	var arrFaqAccordions = elFaq.getElements('ul.accordion');
	
	arrFaqAccordions.each(function(elFaqAccordion, n){
		var objFaqAccordion = new Accordion(elFaqAccordion.getElements('.question'), elFaqAccordion.getElements('.answer'), {
			show: -1,
			onActive: function(){
				//close all panels also of other accordions
				closeF26AccordionPanels(arrFaqAccordions, elFaqAccordion);
			},
			alwaysHide: true
		});
	});
}

/**
 * closeF26AccordionPanels
 * Closes all open panels in all accordions.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return void
 */
function closeF26AccordionPanels(arrTheseFaqAccordions) {
	arrTheseFaqAccordions.each(function(elThisFaqAccordion){
		arrTheseFaqAccordionAnswers = elThisFaqAccordion.getElements('div.answer');
		
		arrTheseFaqAccordionAnswers.each(function(elTheseFaqAccordionAnswer){
			if (elTheseFaqAccordionAnswer.getHeight() != 0) {
				twTheseFaqAccordionAnswerTween = new Fx.Tween(elTheseFaqAccordionAnswer);
				twTheseFaqAccordionAnswerTween.start('height', 0);
			}
		});
		
	});
}



/**
 * f27_newsHighlightHoverIE6and7
 * Enables the rollover effect over the news highlight and listitems in IE6 and IE7.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return void
 */
function f27_newsHighlightHoverIE6and7() {
	arrF27 = $$('.f27_news_overview');
	if (arrF27.length == 0 || !(Browser.Engine.trident4 || Browser.Engine.trident5)) return;
	
	var arrF27NewsHighlights = arrF27[0].getElements('.news_highlight');
	arrF27NewsHighlights.each(function(elF27NewsHighlight){
		elF27NewsHighlight.addEvents({
			'mouseenter': function(){
				elF27NewsHighlight.addClass('hover');
			},
			'mouseleave': function(){
				elF27NewsHighlight.removeClass('hover');
			}
		});
	});
	
	var arrF27ListItems = arrF27[0].getElements('li');
	arrF27ListItems.each(function(elF27ListItem){
		elF27ListItem.addEvents({
			'mouseenter': function(){
				elF27ListItem.addClass('hover');
			},
			'mouseleave': function(){
				elF27ListItem.removeClass('hover');
			}
		});
	});
}



/**
 * f28_newsHighlightHoverIE6and7
 * Enables the rollover effect over the news highlight and listitems in IE6 and IE7.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return void
 */
function f28_newsHighlightHoverIE6and7() {
	arrF28 = $$('.f28_activity_agenda');
	if (arrF28.length == 0 || !(Browser.Engine.trident4 || Browser.Engine.trident5)) return;
	
	var arrF28NewsHighlights = arrF28[0].getElements('.news_highlight');
	arrF28NewsHighlights.each(function(elF28NewsHighlight){
		elF28NewsHighlight.addEvents({
			'mouseenter': function(){
				elF28NewsHighlight.addClass('hover');
			},
			'mouseleave': function(){
				elF28NewsHighlight.removeClass('hover');
			}
		});
	});
	
	var arrF28ListItems = arrF28[0].getElements('li');
	arrF28ListItems.each(function(elF28ListItem){
		elF28ListItem.addEvents({
			'mouseenter': function(){
				elF28ListItem.addClass('hover');
			},
			'mouseleave': function(){
				elF28ListItem.removeClass('hover');
			}
		});
	});
}



/**
 * f31_productListHoverIE6
 * Enables the rollover effect over listitems in IE6.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return void
 */
function f31_productListHoverIE6() {
	arrF31 = $$('.f31_product_list');
	if (arrF31.length == 0 || !Browser.Engine.trident4) return;
	
	var arrProductListItems = $$('.product_list li');
	arrProductListItems.each(function(elProductListItem){
		elProductListItem.addEvents({
			'mouseenter': function(){
				elProductListItem.addClass('hover');
			},
			'mouseleave': function(){
				elProductListItem.removeClass('hover');
			}
		});
	});
}



/*
 * initSlidingOverlayClosed
 * Starts with the overlay closed, which slides open on rollover over the left column.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return
 */
function initSlidingOverlayClosed() {
	var elContent = $('content');

	if (!elContent) return;

	var elCol3Left = elContent.getElement('.col3_left');
	var elCol3Center = elContent.getElement('.col3_center');
	var elCol3Right = elContent.getElement('.col3_right');

	if (!elCol3Left || !$('page_outerwrapper').hasClass('recipes')) return;

	var elCol3LeftViewport = elCol3Left.getElement('.col3_left_viewport');
	var elCol3LeftOverlayIndicator = elCol3LeftViewport.getElement('.overlay_indicator');
	
	if (!elCol3LeftViewport) return;
	
	var intOverlayDelay = 500;
	var intCol3LeftWidth = elCol3Left.getSize().x;
	var intCol3CenterWidth = elCol3Center.getSize().x;
	var intCol3LeftViewportPaddingLeft = elCol3LeftViewport.getStyle('padding-left').toInt();
	var intCol3LeftViewportMinWidth = elCol3LeftViewport.getStyle('width').toInt();
	var intCol3LeftViewportMaxWidth = intCol3LeftWidth + intCol3CenterWidth - intCol3LeftViewportPaddingLeft;
	elCol3LeftViewport.set('tween', {transition: Fx.Transitions.Cubic.easeOut, duration: 300});

	var fxShowOverlay = function(){
		elCol3LeftViewport.tween('width', intCol3LeftViewportMaxWidth);
		if (elCol3LeftOverlayIndicator) elCol3LeftOverlayIndicator.addClass('overlay_indicator_close');
	}

	var objShowOverlay = function(){
		fxShowOverlayDelayed = fxShowOverlay.delay(intOverlayDelay);
	}
	
	var fxHideOverlay = function(){
		elCol3LeftViewport.tween('width', intCol3LeftViewportMinWidth);
		if (elCol3LeftOverlayIndicator) elCol3LeftOverlayIndicator.removeClass('overlay_indicator_close');
	}
	
	var objHideOverlay = function(){
		fxHideOverlayDelayed = fxHideOverlay.delay(intOverlayDelay);
	}
	
	objHideOverlay();

	elCol3LeftViewport.addEvents({
		'mouseenter': function(){
			$clear(fxHideOverlayDelayed);
			objShowOverlay();
		},
		'mouseleave': function(){
			$clear(fxShowOverlayDelayed);
		}
	});
	
	elCol3Right.addEvent('mouseenter', function(){
		objHideOverlay();
	});
	
	elContent.addEvent('mouseleave', function(){
		objHideOverlay();
	});
	
	if (elCol3LeftOverlayIndicator) {
		elCol3LeftOverlayIndicator.addEvent('click', function(){
			objHideOverlay();
		});
	}
}



/*
 * initSlidingOverlayOpened
 * Starts with the overlay opened, which closes sliding on rollover over the right column.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return
 */
function initSlidingOverlayOpened() {
	var elContent = $('content');
	
	if (!elContent) return;

	var elCol3Left = elContent.getElement('.col3_left');
	var elCol3Center = elContent.getElement('.col3_center');
	var elCol3Right = elContent.getElement('.col3_right');

	if (!elCol3Left || !$('page_outerwrapper').hasClass('recipe')) return;

	var elCol3LeftViewport = elCol3Left.getElement('.col3_left_viewport');
	var elCol3LeftOverlayIndicator = elCol3LeftViewport.getElement('.overlay_indicator');
	
	if (!elCol3LeftViewport) return;
	
	var intOverlayDelay = 500;
	var intCol3LeftWidth = elCol3Left.getSize().x;
	var intCol3CenterWidth = elCol3Center.getSize().x;
	var intCol3LeftViewportPaddingLeft = elCol3LeftViewport.getStyle('padding-left').toInt();
	var intCol3LeftViewportMinWidth = elCol3LeftViewport.getStyle('width').toInt();
	var intCol3LeftViewportMaxWidth = intCol3LeftWidth + intCol3CenterWidth - intCol3LeftViewportPaddingLeft;
	elCol3LeftViewport.set('tween', {transition: Fx.Transitions.Cubic.easeOut, duration: 300});
	elCol3LeftViewport.setStyle('width', intCol3LeftViewportMaxWidth);

	var fxShowOverlay = function(){
		elCol3LeftViewport.tween('width', intCol3LeftViewportMaxWidth);
		if (elCol3LeftOverlayIndicator) elCol3LeftOverlayIndicator.addClass('overlay_indicator_close');
	}

	var objShowOverlay = function(){
		fxShowOverlayDelayed = fxShowOverlay.delay(intOverlayDelay);
	}
	
	var fxHideOverlay = function(){
		elCol3LeftViewport.tween('width', intCol3LeftViewportMinWidth);
		if (elCol3LeftOverlayIndicator) elCol3LeftOverlayIndicator.removeClass('overlay_indicator_close');
	}
	
	var objHideOverlay = function(){
		fxHideOverlayDelayed = fxHideOverlay.delay(intOverlayDelay);
	}
	
	objHideOverlay();
	objShowOverlay();

	elCol3LeftViewport.addEvents({
		'mouseenter': function(){
			$clear(fxHideOverlayDelayed);
			objShowOverlay();
		},
		'mouseleave': function(){
			$clear(fxShowOverlayDelayed);
		}
	});
	
	elCol3Right.addEvent('mouseenter', function(){
		$clear(fxShowOverlayDelayed);
		objHideOverlay();
	});
	
	elContent.addEvents({
		'mouseenter': function(){
			$clear(fxShowOverlayDelayed);
		},
		'mouseleave': function(){
			$clear(fxHideOverlayDelayed);
			objShowOverlay();
		}
	});
	
	if (elCol3LeftOverlayIndicator) {
		elCol3LeftOverlayIndicator.addEvent('click', function(){
			objHideOverlay();
		});
	}
}



/*
 * initMainNavHover
 * Adds hovering functionality to the main navigation while memorizing the active menuitem.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return
 */
function initMainNavHover() {
	if (!$('f16_navigation_bar')) return;

	var elMainNav = $('f16_navigation_bar');
	var arrMainNavListItems = elMainNav.getChildren('li');
	var elMainNavListItemActive = null;

	function getActiveMainNavListItem() {
		arrMainNavListItems.each(function(elMainNavListItem){
			if (elMainNavListItem.hasClass('active')) {
				elMainNavListItemActive = elMainNavListItem;
			}
		});
	}
	
	arrMainNavListItems.each(function(elMainNavListItem){
		elMainNavListItem.addEvents({
			'mouseenter': function(){
				elMainNavListItem.addClass('hover');
				getActiveMainNavListItem();
				if (elMainNavListItem != elMainNavListItemActive) elMainNavListItemActive.removeClass('active');
			},
			'mouseleave': function(){
				elMainNavListItem.removeClass('hover');
				getActiveMainNavListItem();
				elMainNavListItemActive.addClass('active');
			}
		});
	});
}



/*
 * initContentHeight
 * Calculates and sets the height for the content container based on the longest column.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return
 */
function initContentHeight() {
	if (!$('content')) return;
	
	var elContent = $('content');
	var elCol3Left = elContent.getElement('.col3_left');
	var elCol3Center = elContent.getElement('.col3_center');
	var elCol3Right = elContent.getElement('.col3_right');
	var elCol3CenterRight = elContent.getElement('.col3_center_right');
	
	if (!elCol3Left) return;
	
	var elCol3LeftViewport = elCol3Left.getElement('.col3_left_viewport');
	
	var intCol3MaxHeight = 0;
	
	if (elCol3LeftViewport) {
		if (elCol3LeftViewport.getSize().y > intCol3MaxHeight) {
			intCol3MaxHeight = elCol3LeftViewport.getSize().y;
		}
	}

	if (elCol3Center) {
		if (elCol3Center.getSize().y > intCol3MaxHeight) {
			intCol3MaxHeight = elCol3Center.getSize().y;
		}
	}
	
	if (elCol3Right) {
		if (elCol3Right.getSize().y > intCol3MaxHeight) {
			intCol3MaxHeight = elCol3Right.getSize().y;
		}
	}
	
	if (elCol3CenterRight) {
		if (elCol3CenterRight.getSize().y > intCol3MaxHeight) {
			intCol3MaxHeight = elCol3CenterRight.getSize().y;
		}
	}
	
	elContent.setStyle('height', intCol3MaxHeight + 10);
	if (elCol3LeftViewport) {
		elCol3LeftViewport.setStyle('height', intCol3MaxHeight);
	}
	if (elCol3Center) {
		elCol3Center.setStyle('height', intCol3MaxHeight);
	}
	if (elCol3Right) {
		elCol3Right.setStyle('height', intCol3MaxHeight);
	}
	if (elCol3CenterRight) {
		elCol3CenterRight.setStyle('height', intCol3MaxHeight);
	}
}



/**
 * initRatingSelector
 * Defines the interaction of the rating selector.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return void
 */
function initRatingSelector() {
	var arrCompRatingSelectors = $$('.component_rating_selector');
	if (arrCompRatingSelectors.length == 0 || !$('rating_selector') || !$('rating_field')) return;
	
	elRatingField = $('rating_field');
	elRatingSelector = $('rating_selector');
	arrRatingSelectorLinks = elRatingSelector.getElements('a');
			
	arrRatingSelectorLinks.each(function(elRatingSelectorLink, n){
		elRatingSelectorLink.addEvents({
			'click': function(){
				intRatingSelectorNumber = ((n) * 5);
				if (intRatingSelectorNumber == 0 || intRatingSelectorNumber == 5) intRatingSelectorNumber = '0' + intRatingSelectorNumber;
				elRatingSelector.className = 'rating' + intRatingSelectorNumber;
				elRatingField.value = intRatingSelectorNumber / 10;
			},
			'focus': function(){
				this.blur();
			}
		});
	});

}



/**
 * initPaginatorCentering
 * Centers any paginator with a paginatorcontainer.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return void
 */
function initPaginatorCentering(){
	var arrComponentPaginators = $$('.component_paginator');
	if (arrComponentPaginators.length == 0) return;
	
	arrComponentPaginators.each(function(elComponentPaginator){
		elComponentPaginatorList = elComponentPaginator.getElement('ul');
		intComponentPaginatorWidth = elComponentPaginator.getSize().x;
		intComponentPaginatorListWidth = elComponentPaginatorList.getSize().x;
		intComponentPaginatorListOffset = (intComponentPaginatorWidth / 2) - (intComponentPaginatorListWidth / 2);
		elComponentPaginatorList.setStyle('left', intComponentPaginatorListOffset);
	});
}



/**
 * initOverlayShadowHeightIE6
 * Fixes the full height of the overlayshadow in IE6; style gets reset after pagerendering.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return void
 */
function initOverlayShadowHeightIE6() {
	arrOverlayShadows = $$('.overlay_shadow');
	if (!Browser.Engine.trident4 || arrOverlayShadows.length == 0) return;
	
	arrOverlayShadows[0].setStyle('height', '100%');
}



/**
 * initLightBoxSubmitButton
 * Checks for a form withan a lightbox and adds an event on the submitbutton of that form.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @return void
 */
function initLightBoxSubmitButton() {
	arrLightboxes = $$('.lightbox');
	if (arrLightboxes.length == 0) return;
	
	arrLightboxes.each(function(elLightbox){
		elLightboxForm = elLightbox.getElement('form');
		arrLightboxComponentButtons = elLightbox.getElements('.component_button');
		arrLightboxComponentButtons.each(function(elLightboxComponentButton){
			elThisLightboxForm = elLightboxForm;
			if (elLightboxComponentButton.getProperty('rel') == 'submit') {
				elLightboxSumbitButton = elLightboxComponentButton;
			}
		});
		elLightboxSumbitButton.addEvent('click', function(){
			elThisLightboxForm.submit();
		});
	});
}



/**
 * EfxBaseSlideShow Class
 * Reusable slideshow class.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @param arrSlides, intStartSlide, blnLoop, intInterval, blnAutoPlay, blnPlaying
 * @param strOutEffectProperty, intOutEffectStartValue, intOutEffectEndValue, intOutEffectDuration
 * @param strInEffectProperty, intInEffectStartValue, intInEffectEndValue, intInEffectDuration
 * @return EfxBaseSlideShow
 */
var EfxBaseSlideShow = new Class({
	Implements: [Options, Events, Chain],
	options: {
		arrSlides: [],
		intStartSlide: 0,
		blnLoop: true,
		intInterval: 2500,
		blnAutoPlay: true,
		blnPlaying: false,
		
		strOutEffectProperty: 'opacity',
		intOutEffectStartValue: 1,
		intOutEffectEndValue: 0,
		intOutEffectDuration: 'long',
		
		strInEffectProperty: 'opacity',
		intInEffectStartValue: 0,
		intInEffectEndValue: 1,
		intInEffectDuration: 'long'
	},
	initialize: function(options) {
		var that = this;
		this.setOptions(options);
		this.addSlides(this.options.arrSlides);
		this.options.arrSlides.each(function(slide){
			slide.setStyle('visibility', 'hidden');
		});
		this.showSlide(this.options.intStartSlide);
		if (this.options.blnAutoPlay == true && this.options.blnPlaying == false) {
			this.playSlideShow();
		}
		this.intSlideCount = 0;
	},
	arrSlideCollection: [],
	addSlides: function(arrSlides){
		arrSlides.each(function(slide){
			this.arrSlideCollection.include(slide);
		}, this);
	},
	addSlide: function(slide){
		this.addSlides($splat(slide));
	},
	cycleForwards: function(){
		if ($chk(this.intCurrentSlideNumber) && this.intCurrentSlideNumber < this.arrSlideCollection.length-1) {
			this.showSlide(this.intCurrentSlideNumber+1);
		} else if ((this.intCurrentSlideNumber) && this.options.blnLoop) {
			this.showSlide(0);
		} else if (!defined(this.intCurrentSlideNumber)) {
			this.showSlide(this.options.intStartSlide);
		}
	},
	cycleBackwards: function(){
		if (this.intCurrentSlideNumber > 0) {
			this.showSlide(this.intCurrentSlideNumber-1);
		} else if (this.options.blnLoop) {
			this.showSlide(this.arrSlideCollection.length-1);
		}
	},
	showSlide: function(intSlideNumberToShow){
		if (this.arrSlideCollection[intSlideNumberToShow]) {
			var that = this;
			if (this.arrSlideCollection[this.intCurrentSlideNumber]) {
				var intPreviousSlideNumber = this.intCurrentSlideNumber;
				if (that.options.strOutEffectProperty != that.options.strInEffectProperty) {
					this.arrSlideCollection[intSlideNumberToShow].setStyle(that.options.strOutEffectProperty, that.options.intOutEffectStartValue);
				}
				this.arrSlideCollection[this.intCurrentSlideNumber].get('tween', {property: that.options.strOutEffectProperty, duration: that.options.intOutEffectDuration}).start(that.options.intOutEffectStartValue, that.options.intOutEffectEndValue).chain(function(){
					that.arrSlideCollection[intPreviousSlideNumber].setStyle(that.options.strInEffectProperty, that.options.intInEffectStartValue);
				});
			}
			this.arrSlideCollection[intSlideNumberToShow].get('tween', {property: that.options.strInEffectProperty, duration: that.options.intInEffectDuration}).start(that.options.intInEffectStartValue, that.options.intInEffectEndValue);
			this.intCurrentSlideNumber = intSlideNumberToShow;
		}
		this.fireEvent('slideShown', this);
	},
	runSlideShow: function(){
		var that = this;
		
		if (that.intCurrentSlideNumber != this.intSlideCount) {
			this.intSlideCount = that.intCurrentSlideNumber;
		}
		this.intSlideCount++;
		if (this.intSlideCount >= that.arrSlideCollection.length) {
			this.intSlideCount = 0;
		}			
		this.showSlide(this.intSlideCount);
	},
	playSlideShow: function(){
		this.options.blnPlaying = true;
		this.slideShowTimer = this.runSlideShow.periodical(this.options.intInterval, this);
	},
	resetTimer: function(){
		if ($chk(this.slideShowTimer)) {
			this.slideShowTimer = $clear(this.slideShowTimer);
			this.playSlideShow();
		}
	},
	name: 'EfxBaseSlideShow'
});



/**
 * EfxNavSlideShow Class
 * Customized slideshow class.
 *
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 * @param elNav, strLabelPrev, strLabelNext, strLabelFirst, strLabelLast, strLabelPlay, strLabelPause
 * @return EfxNavSlideShow
 */
var EfxNavSlideShow = new Class({
	Extends: EfxBaseSlideShow,
	options: {
		elNav: $('slideshow_nav'),
		strLabelPrev: 'Previous',
		strLabelNext: 'Next',
		strLabelFirst: 'First',
		strLabelLast: 'Last',
		strLabelPlay: 'Play',
		strLabelPause: 'Pause'
	},
	initialize: function(options){
		this.parent(options);
		if ($defined(this.options.elNav)) {
			this.arrNavLinkNumbers = [];
			this.populateNav();
			this.arrNavListItems = this.options.elNav.getElements('li');
			this.intNavLinksNotNumbers = 0;
			this.arrNavLinks = this.options.elNav.getElements('a');
			this.initNav();
			if (this.arrNavLinkNumbers.length != 0) {
				this.activateNavLink(this.arrNavLinkNumbers[this.options.intStartSlide]);
			}
			this.addEvent('slideShown', function(){
				if (this.arrNavLinkNumbers.length != 0) {
					this.activateNavLink(this.arrNavLinkNumbers[this.intCurrentSlideNumber]);
				}
			});
		}
	},
	populateNav: function(){
		var that = this;
		var elNavListItemNumber = null;
		this.options.elNav.getElements('li').each(function(elNavListItem, n){
			switch(elNavListItem.getElement('a').className){
				case 'prev': break;
				case 'next': break;
				case 'first': break;
				case 'last': break;
				case 'play': break;
				case 'pause': break;
				default: elNavListItemNumber = elNavListItem;
			};
		});
		
		if ($chk(elNavListItemNumber)) {
			this.arrSlideCollection.each(function(elSlide, n){
				elNavListItemNumberNew = elNavListItemNumber.clone();
				elNavListItemNumberNew.getElement('a').innerHTML = n+1;
				elNavListItemNumberNew.getElement('a').setProperty('title', n+1);
				elNavListItemNumberNew.injectBefore(elNavListItemNumber);
				that.arrNavLinkNumbers.include(elNavListItemNumberNew.getElement('a'));
			});
			elNavListItemNumber.dispose();
		}
	},
	initNav: function(){
		var that = this;
		this.arrNavLinks.each(function(elNavLink, n){
			switch(elNavLink.className){
				case 'pause':
					if (that.options.blnPlaying != true) {
						var strNavLinkLabel = that.options.strLabelPlay;
					} else {
						var strNavLinkLabel = that.options.strLabelPause;
					}
					elNavLink.innerHTML = strNavLinkLabel;
					elNavLink.setProperty('title', strNavLinkLabel);
					elNavLink.toggleClass('play');
					elNavLink.toggleClass('pause');
					
					elNavLink.addEvent('click', function(){
						if ($chk(that.slideShowTimer)) {
							var strNavLinkLabel = that.options.strLabelPlay;
							that.slideShowTimer = $clear(that.slideShowTimer);
						} else {
							var strNavLinkLabel = that.options.strLabelPause;
							that.playSlideShow();
						}
						elNavLink.innerHTML = strNavLinkLabel;
						elNavLink.setProperty('title', strNavLinkLabel);
						elNavLink.toggleClass('play');
						elNavLink.toggleClass('pause');
					});
					that.intNavLinksNotNumbers++;
					break;
				case 'play':
					if (that.options.blnPlaying != true) {
						var strNavLinkLabel = that.options.strLabelPlay;
					} else {
						var strNavLinkLabel = that.options.strLabelPause;
					}
					elNavLink.innerHTML = strNavLinkLabel;
					elNavLink.setProperty('title', strNavLinkLabel);
					elNavLink.toggleClass('play');
					elNavLink.toggleClass('pause');
					
					elNavLink.addEvent('click', function(){
						if ($chk(that.slideShowTimer)) {
							var strNavLinkLabel = that.options.strLabelPlay;
							that.slideShowTimer = $clear(that.slideShowTimer);
						} else {
							var strNavLinkLabel = that.options.strLabelPause;
							that.playSlideShow();
						}
						elNavLink.innerHTML = strNavLinkLabel;
						elNavLink.setProperty('title', strNavLinkLabel);
						elNavLink.toggleClass('play');
						elNavLink.toggleClass('pause');
					});
					that.intNavLinksNotNumbers++;
					break;
				case 'first': 
					if (!elNavLink.innerHTML) elNavLink.innerHTML = that.options.strLabelFirst;
					if (!elNavLink.getProperty('title')) elNavLink.setProperty('title', that.options.strLabelFirst);
					elNavLink.addEvent('click', function(){
						that.intSlideCount = 0;
						that.showSlide(that.intSlideCount);
						that.resetTimer();
					});
					that.intNavLinksNotNumbers++;
					break;
				case 'prev': 
					if (!elNavLink.innerHTML) elNavLink.innerHTML = that.options.strLabelPrev;
					if (!elNavLink.getProperty('title')) elNavLink.setProperty('title', that.options.strLabelPrev);
					elNavLink.addEvent('click', function(){
						that.cycleBackwards();
						that.resetTimer();
					});
					that.intNavLinksNotNumbers++;
					break;
				case 'next': 
					if (!elNavLink.innerHTML) elNavLink.innerHTML = that.options.strLabelNext;
					if (!elNavLink.getProperty('title')) elNavLink.setProperty('title', that.options.strLabelNext);
					elNavLink.addEvent('click', function(){
						that.cycleForwards();
						that.resetTimer();
					});
					that.intNavLinksNotNumbers++;
					break;
				case 'last': 
					if (!elNavLink.innerHTML) elNavLink.innerHTML = that.options.strLabelLast;
					if (!elNavLink.getProperty('title')) elNavLink.setProperty('title', that.options.strLabelLast);
					elNavLink.addEvent('click', function(){
						that.intSlideCount = that.arrSlideCollection.length-1;
						that.showSlide(that.intSlideCount);
						that.resetTimer();
					});
					that.intNavLinksNotNumbers++;
					break;
				default:
					var intNavLinksOffset = that.intNavLinksNotNumbers;
					elNavLink.addEvent('click', function(){
						that.intSlideCount = n-intNavLinksOffset;
						that.showSlide(that.intSlideCount);
						that.resetTimer();
						that.activateNavLink(elNavLink);
					});
			};
		});
	},
	activateNavLink: function(elNavLink){
		this.arrNavListItems.each(function(elNavListItem){
			elNavListItem.removeClass('active');
		});
		elNavLink.getParent().addClass('active');
	},
	name: 'EfxNavSlideShow'
});



/*
 * addRelToLightboxClass
 * Adds a shadowboxlink.
 * 
 * @author Ralph Meeuws (ralph.meeuws[AT]efocus.nl)
 */
function addRelToLightboxClass() {
	var arrParagraphLightBoxes = $$('p.lightbox');
	arrParagraphLightBoxes.each(function(elParagraphLightBox){
		elParagraphLightBoxLink = elParagraphLightBox.getElement('a');
		elParagraphLightBoxLink.setProperty('rel', 'shadowbox;width=450;height=460');
		strParagraphLightBoxLinkNewHref = '/' + elParagraphLightBoxLink.getProperty('href') + 'lightbox2.html';
		elParagraphLightBoxLink.setProperty('href', strParagraphLightBoxLinkNewHref);
	});

	var arrParagraphLightBoxes = $$('p.lightbox_prijs');
	arrParagraphLightBoxes.each(function(elParagraphLightBox){
		elParagraphLightBoxLink = elParagraphLightBox.getElement('a');
		elParagraphLightBoxLink.setProperty('rel', 'shadowbox;width=450;height=460');
		strParagraphLightBoxLinkNewHref = '/' + elParagraphLightBoxLink.getProperty('href') + 'lightbox5.html';
		elParagraphLightBoxLink.setProperty('href', strParagraphLightBoxLinkNewHref);
	});
	
	Shadowbox.init();
}



 
/////////////////////////////////////////// SERVER-SIDE JAVASCRIPT FUNCTIONS ///////////////////////////////////////////

