/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright Â© 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

var API = (function ( $, window, undefined ) {
	
	var oPublicMethods = {
		
		fnExist : function( fnName ){
			return $.isFunction($[fnName]);
		},
		
		shufflePortfolio : function() {
			
			if( $portfolio.length > 0 ) {
				$portfolio.isotope('shuffle');
			} else {
				alert('You are not on the portfolio!');
			}
		}, 
		
		getData : function( dataUrl, dataType, async, callback ) {
			
			var responseData;
			
			$.ajax({ url : dataUrl, async : async, dataType : dataType, success : function( response ){
				
				responseData = response;
						
				if( typeof callback  === 'function') {
					callback.call( oPrivateMethods.Portfolio, arguments );
				} 
			}});

			return responseData;
		},
		
		drawGoogleMap : function() {
			var centerPos = new google.maps.LatLng(51.921375,4.479087),
			addresPos = new google.maps.LatLng(51.921375,4.479087),

			oGmapOptions = {
				
				zoom     : 15,
				center   : centerPos,
				disableDefaultUI : true,
				mapTypeId: google.maps.MapTypeId.ROADMAP
			},

			myGmap = new google.maps.Map(document.getElementById('js-googleMap'), oGmapOptions),

			myMarker = new google.maps.Marker({
			      position  : addresPos,
				  title     : '0to9',
				  icon      : webGlobals.baseUrl + 'assets/img/gmap_marker_bg.png',
			      map       : myGmap
			});
		}
	},
	
	oPrivateMethods = {
		
		quickExpressions : {

			name      : /^([a-zA-Z0-9\.\'\`\/\\\- \u00c0-\u0233])+$/,
			email      : /^[a-zA-Z0-9\!\#\$\%\&\'\.\*\+\/\=\?\^\_\`\{\|\}\~\-\[\]]+@([a-zA-Z0-9\-\.]*\.)?[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]\.[a-zA-Z]{2,6}$/,
			message : /^.*$/m	
		},
		
		Pageintro : { 
		
			prep : function() {
				
				if( ! oPublicMethods.fnExist('liteAccordion') ) {
					
					$.ajax({ url : webGlobals.baseUrl + 'assets/js/jquery.liteaccordion.js', async : false, dataType : 'script', success : function() {
						oPrivateMethods.Pageintro.init();
					}});

				} else {
					this.init();
				}	
			},
			
			init : function() {
				
				var $pageIntroAnchors = $('.slideHeading', $pageIntroductions);
				
				$pageIntroAnchors.bind('click', function() {
					return false;
				});
								
				$pageIntroductions.liteAccordion({ 
					containerWidth : 1140,         
					containerHeight : 435,          
					headerWidth : 10,               
					firstSlide : 1,   
					onInit : function( firstSlide ) {
						
						$('.accordionPagination a').eq(firstSlide-1)
							.addClass('activePager');
					},          
					onActivate : function() {
						
					},     
					slideSpeed : 800,               
					slideCallback : function( index ) {
						
					}, 
					autoPlay : true,               
					pauseOnHover : true,           
					cycleSpeed : 6000,              
					enumerateSlides : false
				});
			}
		},
		
		setAddThis : function() { 
			
			if( ! window.addthis ) {
				
				var elmScript = document.createElement('script');
					elmScript.src = 'http://s7.addthis.com/js/250/addthis_widget.js?domready=1';
		    	document.body.appendChild( elmScript );
			}
		},	

		
		Carousel : {
			
			prep : function() {
				
				if( ! oPublicMethods.fnExist('carousel') ) {
					
					$.ajax({ url : webGlobals.baseUrl + 'assets/js/jquery.carousel.js', async : false, dataType : 'script', success : function() {
						oPrivateMethods.Carousel.init();
					}});

				} else {
					this.init();
				}	
			}, 
			
			init : function() {
								
				var $jcarousel = $('#js-partnersCarousel');
				
				$jcarousel.jcarousel({
					scroll		:	1,
					auto        :   1.5,
					animation	:	"slow",
					wrap		:	"circular"
				});
			}
		},
		
		Collage : {
			
			prep : function() {
				
				if( ! oPublicMethods.fnExist('isotope') ) {
					
					$.ajax({ url : webGlobals.baseUrl + 'assets/js/jquery.slider.0.1.js', async : false, dataType : 'script', success : function() {
						
						var sBgUrl = $('#js-collageWrap').attr('data-background-url');

						if( sBgUrl !== '' || typeof sBgUrl !== 'undefined') {
							oPrivateMethods.Collage.preloadAsset(sBgUrl);
						}
					}});

				} else {
					
					var sBgUrl = $('#js-collageWrap').attr('data-background-url');

					if( sBgUrl !== '' || typeof sBgUrl !== 'undefined') {
						oPrivateMethods.Collage.preloadAsset(sBgUrl);
					}
				}
			},
			
			init : function( sBgImageUrl ) {
				
				var $breadCrumb = $('#js-dynamicBreadCrumb');
				
				$breadCrumb.find('.breadCrumbEntry')
					.bind({
						
						mouseenter : function() {
							
							var $subMenu = $('.bCdropDown', this);

							$subMenu.show(0);
						},
						
						mouseleave : function() {
							
							var $subMenu = $('.bCdropDown', this);

							$subMenu.hide(0);
						}
					});
				
				$(window).load(function() {
					
					$('.collageSlide', $collage).eq(0)
						.css({
							'margin-right' : $(window).width()  -  ($('.collageSlide', $collage).eq(0).position().left + $('.collageSlide', $collage).eq(0).width())
						});
					
					var $audio = $('.jPlayer', $collage);

					if( $audio.length > 0 ) {
						oPrivateMethods.Audioplayer.prep();
					}
					
					$collage.slider({

						isNavigationEnabled : true,
						isPaginationEnabled : true,
						isKeyBoardNavigationEnabled : true,

						slideDuration  : 500,
						slideEasing : 'linear',

						slideDirection : 'ltr',

						selectors : {

							selectorDeck : '.collageDeck',
							selectorClip : '.collageClip',
							selectorSlides : '.collageSlide'
						},
						
						elements : {
							
							navButtonPrevious : {

								domElement : '<a href="#">Vorige</a>',

								domID : 'js-chaptersPrev',
								domClass : 'collageSectionNavBtn collagePrev',

								styles : {}
							},

							navButtonNext : {

								domElement : '<a href="#">Volgende</a>',

								domID : 'js-chaptersNext',
								domClass : 'collageSectionNavBtn collageNext',

								styles : {}
							},
							
							navPaginationWrap : {

								domElement : '<div />',

								domID : 'js-collagePagination',
								domClass : 'collagePagination',

								styles : {}
							},

							navPaginationAnchor : {

								domElement : '<a href="#"></a>',

								domID : '',
								domClass : 'collagePager',

								domClassActive : 'active',

								styles : {}
							}
						},

						hooks : {

							onInit : function() {

								var oSettings = this.data('settings'), 
								
								$this = $(this),
								
								$deck = $(oSettings.selectors.selectorDeck, this),
								$collageRow = $('.collageRow'),
								$overviewProps = $('a.collageProp', this), 
								$slides = this.find(oSettings.selectors.selectorSlides),
								$subSliders = $('.boxCaseEntry', this),
								$collageProps = $('.collageElement', this),
								
								i,
								iTotalSlides = this.find(oSettings.selectors.selectorSlides).length,
								iTotalSubSlides = $subSliders.length;
								
								$(oSettings.selectors.selectorClip).css({
									'overflow-x' : 'visible',
									'overflow-y' : 'visible',
									'z-index'    : '0'
								});
								
								if( $collage.data('activeSlide') === 0 ) {
									$('#'+oSettings.elements.navButtonPrevious.domID).hide(0);
								} else if ( $collage.data('activeSlide') <= (iTotalSlides - 1) ) {
										$('#'+oSettings.elements.navButtonNext.domID).hide(0);
								}
								
								$('#js-collagePagination a').eq($collage.data('activeSlide'))
									.addClass('activePager');
								
								$overviewProps.each(function(index, element) {
									
									var $elm = $(element);
									
									$elm.bind('click.collageslideto', function() {	
										
										var sHref = $(this).attr('href'), iSlideNr = getCorrectSlide( sHref.slice(1, sHref.length) );
										$collage.slider('slideTo', iSlideNr);
										
										return false;
									});
								});
								
								function getCorrectSlide( sHref ) {
									
									var $slides = $(oSettings.selectors.selectorSlides, $this), iSlideNr = 0;
									
									$slides.each(function(index,element) {
										
										var sId = $(element).attr('id').slice(1, $(element).attr('id').length);
										
										if( sId === sHref) {
											iSlideNr = index;
										}
										
									});
									
									return iSlideNr;
								};
								
								for( var i = 0; i < iTotalSubSlides; i++ ) {
									
									$subSliders.eq(i)
										.slider({
											
											isNavigationEnabled : false,
											isPaginationEnabled : true,
											isKeyBoardNavigationEnabled : false,

											slideDuration  : 500,
											slideEasing : 'linear',

											slideDirection : 'ltr',

											selectors : {

												selectorDeck : '.subCollageDeck',
												selectorClip : '.subCollageClip',
												selectorSlides : '.subCollageSlide'
											},

											elements : {

												navPaginationWrap : {

													domElement : '<div />',

													domID : 'js-subCollagePagination',
													domClass : 'subCollagePagination',

													styles : {}
												},

												navPaginationAnchor : {

													domElement : '<a href="#"></a>',

													domID : '',
													domClass : 'subCollagePager',

													domClassActive : 'active',

													styles : {}
												}
											},
											
											hooks : {
												
												onInit : function() {
													
													var iCurrentActiveItem = this.data('activeSlide'), 
													oSettings = this.data('settings'), 
													$subSlides = this.find(oSettings.selectors.selectorSlides),
													$parentSlide = this,
													iTotalSlides = $subSlides.length,
													
													$play = $('.jp-play'), $stop = $('.jp-stop');

													$('#js-subCollagePagination a', this).removeClass('activePager')
														.eq(iCurrentActiveItem)
															.addClass('activePager');
													
													$subSlides.each(function(i,e) {

														var $slide = $(e);

														$slide.css({
															'margin-left' : ($parentSlide.width() - $slide.find('img, iframe').width()) / 2,
															'margin-right' : ($parentSlide.width() - $slide.find('img, iframe').width()) / 2
														}).find('.collageElementDetails')
															.css({
																'margin-left' : - (($parentSlide.width() - $slide.find('img, iframe').width()) / 2)
															});
														
													});
													
													$('#js-subCollagePagination .subCollagePager').bind('click', function() {
														
														if( oPublicMethods.fnExist('jPlayer') ) {
															$('.jPlayer').jPlayer('stop');
														}
														
														$play.removeClass('activeControl');
														$stop.removeClass('activeControl');
													});
												},
												
												onSlideComplete : function() {
													
													var iCurrentActiveItem = this.data('activeSlide'), 
													oSettings = this.data('settings'), 
													iTotalSlides = this.find(oSettings.selectors.selectorSlides).length;

													$('#js-subCollagePagination a', this).removeClass('activePager')
														.eq(iCurrentActiveItem)
															.addClass('activePager');
												}
											}
										});
									
								}
							},
							
							onSlideComplete : function() {
								
								var iCurrentActiveItem = this.data('activeSlide'), 
								oSettings = this.data('settings'), 
								iTotalSlides = this.find(oSettings.selectors.selectorSlides).length;
								
								$('#js-collagePagination a').removeClass('activePager')
									.eq(iCurrentActiveItem)
										.addClass('activePager');
							
									if( $collage.data('activeSlide') === 0 ) {
										$('#'+oSettings.elements.navButtonPrevious.domID).hide(0);
									} else if ( $collage.data('activeSlide') === (iTotalSlides - 1) ) {
											$('#'+oSettings.elements.navButtonPrevious.domID).show(0);
											$('#'+oSettings.elements.navButtonNext.domID).hide(0);
									} else {
										$('#'+oSettings.elements.navButtonPrevious.domID).show(0);
										$('#'+oSettings.elements.navButtonNext.domID).show(0);
									}
							}
						}
					}).parent()
						.removeClass('ajaxLoading')
							.find('div')
								.animate({
									opacity : 1
								}, {
									duration : 300,
									complete : function() {
										$('#js-collageWrap').css({
											'background-image' : 'url('+sBgImageUrl+')'
										});
									}
								});
				});
			},
			
			preloadAsset : function( sAssetUrl ) {
				
				var img = new Image();
				img.src = sAssetUrl;
				
				img.onLoad = oPrivateMethods.Collage.init.call( oPrivateMethods.Collage, sAssetUrl );
			}
		},
		
		News : {
			
			init : function() {
				
				var $rows = $('.newsRow', $newsArchive),
				$mediaFeed = $('#js-mediaFeed');
				
				if( $rows.length > 1 ) {
					
					$(window).load(function() {
						oPrivateMethods.News.setArticleHeights.call(this, $rows);
					});
				}
				
				if( $mediaFeed.length > 0 ) {
					oPrivateMethods.News.feedSwitch();	
				}
			},
			
			feedSwitch : function() {

				$('.mediaFeedNav li a').click(function() {
					var curChildIndex = $(this).parent().prevAll().length + 1;
					$(this).parent().parent().children('.active').removeClass('active');
					$(this).parent().addClass('active');
					$('.mediaFeedNavLink').toggleClass('active');
					$(this).parent().parent().next('.mediaFeedTabContainer').children('.current').fadeOut('fast',function() {
						$(this).removeClass('current');
						$(this).parent().children('div:nth-child('+curChildIndex+')').fadeIn('normal',function() {
							$(this).addClass('current');
						});
					});
					return false;
				});			
			},
			
			setArticleHeights : function( $rows ) {
				
				$.each($rows, function(index, element){
					
					var aHeightArray = [], $articles = $(element).find('.newsArticle');
					
					$articles.each(function() {
						aHeightArray.push($(this).height());
					});
					
					aHeightArray.sort(function(a,b){
						return a-b;
					});
					
					$articles.css({
						'height' : aHeightArray[aHeightArray.length-1]
					});
				});
			}
		},
		
		ColorBox : {
			
			prep : function(){
							
				if( ! oPublicMethods.fnExist('colorbox') ){
					$.ajax({ url : webGlobals.baseUrl + 'assets/js/jquery.colorbox.min.js', async : false, dataType : 'script', success : function() {
						oPrivateMethods.ColorBox.init();
					}});
					
				} else {
					this.init();
				}
			},
			
			init : function(){
				$(".picture-popup").colorbox({width:"80%", height:"80%"});	
			}		
		},
		
		Audioplayer : {
			
			prep : function() {
				
				if( ! oPublicMethods.fnExist('jPlayer') ) {
					
					$.ajax({ url : webGlobals.baseUrl + 'assets/js/jquery.jplayer.min.js', async : false, dataType : 'script', success : function() {
						oPrivateMethods.Audioplayer.init();
					}});

				} else {
					this.init();
				}
			},
			
			init : function() {
				
				var $audioPlayers = $('.jPlayer'), $play = $('.jp-play'), $stop = $('.jp-stop');
				
				$audioPlayers.each(function( index, element ) {
					
					var sAudioFile = webGlobals.baseUrl + $(this).attr('data-audio-url'), sIdentifier = $(this).attr('data-audio-id');
					
					$(this).jPlayer({
						
						ready : function() {
							
							$(this).jPlayer('setMedia', {
								mp3: decodeURIComponent((sAudioFile+'').replace(/\+/g, '%20'))
							});
						},
						
						play : function() {
							$(this).jPlayer('pauseOthers');
						},
						
						ended : function() {
							$play.removeClass('activeControl');
							$stop.removeClass('activeControl');
						},
						
						solution : 'flash,html',
						supplied : 'mp3',
						swfPath  : '/assets/swf',
						backgroundColor : 'transparent',
						volume   : 0.4,
						cssSelectorAncestor : '#jp-audio-' + sIdentifier
					});
				});
				
				$play.bind('click', function() {
					
					var $elm = $(this);
					
					$elm.parent()
						.find('.activeControl')
							.removeClass('activeControl');
							
					$elm.addClass('activeControl');
					
					return false;
				});
				
				$stop.bind('click', function() {
					
					var $elm = $(this);
					
					$elm.parent()
						.find('.activeControl')
							.removeClass('activeControl');
							
					$elm.addClass('activeControl');
					
					return false;
				});
			}
		},		
		
		Portfolio : {
			
			originalThumb : '',
			originalThumbParent : '',
			originalThumbWidth : '',
			originalThumbHeight : '',
			largeThumb : '',
			
			prep : function() {
				
				if( ! oPublicMethods.fnExist('isotope') ) {
					
					$.ajax({ url : webGlobals.baseUrl + 'assets/js/jquery.isotope.1.4.min.js', async : false, dataType : 'script', success : function() {
						oPrivateMethods.Portfolio.init();
					}});

				} else {
					this.init();
				}
			},
			
			init : function() {
				
				var $mediaThumbs = $('.media', $portfolio), 
				$mediaBoxes = $('.box', $portfolio),
				$breadCrumb = $('#js-dynamicBreadCrumb');
				
				$(window).load(function() {
					
					addMediaThumbEvents();
					
					$portfolio.isotope({

						animationEngine   : 'jquery',
						itemSelector      : '.box',
						layoutMode        : 'masonry',
						masonry           : { 
							columnWidth: $portfolio.width() / 12 
						}
					}).removeClass('ajaxLoading')
						.find('.box')
							.animate({
								opacity : 1
							}, {
								duration : 300
							});
				});
				
				function addMediaThumbEvents() {
					
					$breadCrumb.find('.breadCrumbEntry')
						.bind({
							
							mouseenter : function() {
								
								var $subMenu = $('.bCdropDown', this);

								$subMenu.show(0);
							},
							
							mouseleave : function() {
								
								var $subMenu = $('.bCdropDown', this);

								$subMenu.hide(0);
							}
						});
					
					$mediaThumbs.bind('mouseenter', function() {

						var $elm = $(this), $overlay = $elm.find('.campaignOverlay'), $contents = $elm.find('img'), iHeight = $overlay.find('header').outerHeight();
						
						if( $overlay.length > 0 ) {

							$overlay.css({'height' : '25px'})
								.stop()
									.animate({
										height : iHeight
									},{
										duration: 200,
										easing : 'linear'
									});
						}
						
						$contents.animate({
							opacity : 0.6
						}, {
							duration : 200
						});
						
						
					}).bind('mouseleave', function() {

						var $elm = $(this), $overlay = $elm.find('.campaignOverlay'), $contents = $elm.find('img');

						if( $overlay.length > 0 ) {

							$overlay.stop()
								.animate({
									height : 25
								},{
									duration: 200,
									easing : 'linear'
								});
						}
						
						$contents.animate({
							opacity : 1
						}, {
							duration : 200
						});

					}).live('click', function() {
						
						var $elm = $(this), $parent = $elm.parents('.box'), $overlay = $elm.find('.campaignOverlay'),
						sType = $elm.attr('data-entry'), sUrl = $elm.attr('href');
						iEntryHeight = $elm.attr('data-large-height'), iEntryWidth = $elm.attr('data-large-width');
						
						if( $overlay.length > 0 ) {

							$overlay.stop()
								.animate({
									height : 25
								},{
									duration: 300,
									easing : 'easeInOutBack'
								});
						}
						
						switch ( sType ) {
							
							case 'single':
								
								if( oPrivateMethods.Portfolio.originalThumb !== '' ) {
								
									if( oPublicMethods.fnExist('jPlayer') ) {
										$('.jPlayer').jPlayer('destroy');
									}
								
									var tmpOriginalThumb = oPrivateMethods.Portfolio.originalThumb;
							
									oPrivateMethods.Portfolio.animateEntry( oPrivateMethods.Portfolio.originalThumbParent, oPrivateMethods.Portfolio.originalThumbWidth, oPrivateMethods.Portfolio.originalThumbHeight, 300, 'linear', function() {
									
										$(this).html( tmpOriginalThumb );
									
										$portfolio.isotope('reLayout');
									});
								
									oPrivateMethods.Portfolio.largeThumb = oPublicMethods.getData( sUrl, 'html', false );
									oPrivateMethods.Portfolio.originalThumb = $elm;
									oPrivateMethods.Portfolio.originalThumbParent = $elm.parent();
									oPrivateMethods.Portfolio.originalThumbWidth = $elm.width();
									oPrivateMethods.Portfolio.originalThumbHeight = $elm.height();
									
									oPrivateMethods.Portfolio.animateEntry( $elm.parent(), $elm.attr('data-large-width'), $elm.attr('data-large-height'), 300, 'linear', function() {
									
										$(this).html( oPrivateMethods.Portfolio.largeThumb );
									
										$portfolio.isotope('reLayout');
									
										var $audio = $('.jPlayer', this), $slider = $('#subSlider');
										
										if( $audio.length > 0 ) {
											oPrivateMethods.Audioplayer.prep();
										}
										
										if( $slider.length > 0 ) {
											oPrivateMethods.Portfolio.initSlider.call( oPrivateMethods.Portfolio, $slider );
										}
									});
								
								} else {
								
									oPrivateMethods.Portfolio.largeThumb = oPublicMethods.getData( sUrl, 'html', false );
									oPrivateMethods.Portfolio.originalThumb = $elm;
									oPrivateMethods.Portfolio.originalThumbParent = $elm.parent();
									oPrivateMethods.Portfolio.originalThumbWidth = $elm.width();
									oPrivateMethods.Portfolio.originalThumbHeight = $elm.height();
									
									oPrivateMethods.Portfolio.animateEntry( $elm.parent(), $elm.attr('data-large-width'), $elm.attr('data-large-height'), 300, 'linear', function() {
									
										$(this).html( oPrivateMethods.Portfolio.largeThumb );
									
										$portfolio.isotope('reLayout');
									
										var $audio = $('.jPlayer', this), $slider = $('#subSlider');

										if( $audio.length > 0 ) {
											oPrivateMethods.Audioplayer.prep();
										}
										
										if( $slider.length > 0 ) {
											oPrivateMethods.Portfolio.initSlider.call( oPrivateMethods.Portfolio, $slider );
										}
									});
								}
								
								return false;
								
							break;
							
							case 'multiple':
								
							break;
							
							default:

						}
					});
					
				};
			},
			
			initSlider : function( $slider ) {
				
				if( ! oPublicMethods.fnExist('isotope') ) {
					
					$.ajax({ url : webGlobals.baseUrl + 'assets/js/jquery.slider.0.1.js', async : false, dataType : 'script', success : function() {
						initSlider();
					}});

				} else {
					initSlider();
				}
				
				function initSlider() {
					
					$slider.slider({

						isNavigationEnabled : false,
						isPaginationEnabled : true,
						isKeyBoardNavigationEnabled : false,

						slideDuration  : 500,
						slideEasing : 'linear',

						slideDirection : 'ltr',

						selectors : {

							selectorDeck : '.subCollageDeck',
							selectorClip : '.subCollageClip',
							selectorSlides : '.subCollageSlide'
						},

						elements : {

							navPaginationWrap : {

								domElement : '<div />',

								domID : 'js-subCollagePagination',
								domClass : 'subCollagePagination',

								styles : {}
							},

							navPaginationAnchor : {

								domElement : '<a href="#"></a>',

								domID : '',
								domClass : 'subCollagePager',

								domClassActive : 'active',

								styles : {}
							}
						},

						hooks : {

							onInit : function() {

								var iCurrentActiveItem = this.data('activeSlide'), 
								oSettings = this.data('settings'), 
								$subSlides = this.find(oSettings.selectors.selectorSlides),
								$parentSlide = this,
								iTotalSlides = $subSlides.length;
								
								$('#js-subCollagePagination a', this).removeClass('activePager')
									.eq(iCurrentActiveItem)
										.addClass('activePager');

								
							},

							onSlideComplete : function() {

								var iCurrentActiveItem = this.data('activeSlide'), 
								oSettings = this.data('settings'), 
								iTotalSlides = this.find(oSettings.selectors.selectorSlides).length;

								$('#js-subCollagePagination a', this).removeClass('activePager')
									.eq(iCurrentActiveItem)
										.addClass('activePager');
							}
						}
					});
					
				};
			},
			
			animateEntry : function( $elm, iWidth, iHeight, iDuration, sEasing, callback ) {
				
				$elm.animate({
					width : iWidth,
					height: iHeight
				}, {
					duration: iDuration,
					easing : sEasing,
					complete : function() {
						
						if( typeof callback === 'function' ) {
							callback.call( $elm );
						}
					}
				});
			},
			
			checkUserActivity : function() {
				
				var intervalId;
				
				$.idleTimer(650000);
				
				$(document).bind('idle.idleTimer', function() {

					intervalId = setInterval(function() {
						oPublicMethods.shufflePortfolio();
					}, '2000');
				});
				
				$(document).bind('active.idleTimer', function() {
					clearInterval(intervalId);
				});
			}
		},
		
		validateForm : function( $form ) {
			
			var $formElements = $('input, textarea', $form);

			$form.bind('submit', function(){

				 var  i, 
				 max = $formElements.length, 
				 aErrorElements = [];

				  for( var i = 0; i < max; i++ ) {
					  var isValid = validateFormElement( $formElements[i] );

					  if( ! isValid ) {
						  aErrorElements.push( $formElements[i] );
					  }
				  }

				  if( aErrorElements.length > 0 ) {
					
						var j, maxErrors = aErrorElements.length;

						for( j = 0; j < maxErrors; j++ ) {
							$(aErrorElements[j]).addClass('errorMessage')
								.unbind('aftererror')
									.bind('focus.aftererror', function(){
										$(this).removeClass('errorMessage');
									});
						}
						
						return false;
						
				  } else {
					
					if( this.getAttribute('data-ajax') === 'true' ) {
					
						var sData = $form.serialize();

						$.ajax({ url : this.getAttribute('action'), type : this.getAttribute('method'), data : sData, success : function(){
							
							var $response = $('<p>Dank u voor uw  inschrijving.</p>');
							
							$form.parent()
								.html($response);
							
						}});
						
						return false;
						
					} else {
						return true;
					}
				}
			 });

			 function validateFormElement( elFormElement ) {

				 var sRequired =  elFormElement.getAttribute('data-required'),
				 sRegEx = elFormElement.getAttribute('data-regex'),
				 sValue = elFormElement.value,
				 sBaseValue = elFormElement.getAttribute('data-placeholder');

				 if( sRequired === 'true' ) {

					 if( sValue !== sBaseValue && sValue !== '' ) {

						if( ! oPrivateMethods.quickExpressions[sRegEx].test(sValue) ) {
							return false;
						} else {
							return true;	
						}
					} else {
						return false;	
					}
				 }
			};
		}
	};
	
	var $portfolio = $('#js-portfolio'),
	$collage = $('#js-collage'),
	$slideBox = $('#js-slideBox'),
	$pageIntroductions = $('#js-pageIntro'),
	$partnersCarousel = $('#js-partnersCarousel'),
	$googleMap = $('#js-googleMap'),
	$newsArchive = $('#js-newsArticlesWrap'),
	$navigation = $('#js-mainNav'),
	$footerNewsletterSignUpForm = $('#js-newsletterSignUp form'),
	$colorBox = $('#js-showImage'),
	$fs36 = $('.fs36'),
	$addThis = $('#js-addThis');
	
	if( $addThis.length > 0 ) {
		oPrivateMethods.setAddThis();	
	}
	
	if( $fs36.length > 0 ) {
		
		$('#nav_sub_nieuws').addClass("active");
		
	}
	
	if( $portfolio.length > 0 ) {
		
		$portfolio.find('.box')
			.animate({
				opacity : 0
			}, {
				duration : 0
			});
		
		oPrivateMethods.Portfolio.prep();
	}
	
	if( $footerNewsletterSignUpForm.length > 0 ) {

		oPrivateMethods.validateForm( $footerNewsletterSignUpForm );
	}
	
	if( $newsArchive.length > 0 ) {
		oPrivateMethods.News.init();
	}
	
	if( $collage.length > 0 ) {
		oPrivateMethods.Collage.prep();
	}
	
	if( $colorBox.length > 0 ) {
		oPrivateMethods.ColorBox.prep();	
	}
	
	if( $slideBox.length > 0 ) {
		oPrivateMethods.Slidebox.prep();
	}
	
	if( $pageIntroductions.length > 0 ) {
		oPrivateMethods.Pageintro.prep();
	}
	
	if( $partnersCarousel.length > 0 ) {
		oPrivateMethods.Carousel.prep();	
	}
	
	if( $googleMap.length > 0 ) {
		
		if( ! window.google ) {
			
			var elmScript = document.createElement('script');
			elmScript.src = "http://maps.google.com/maps/api/js?sensor=false&region=NL&language=nl&callback=API.drawGoogleMap";
	    	document.body.appendChild( elmScript );
	
		} else { 
			oPublicMethods.drawGoogleMap(); 
		}	
	}
	
	return oPublicMethods;
	
}( jQuery, this ));
