/**
 *  @author dan entous <contact@pennlinepublishing.com>
 *  @version 2011-11-11 11:54 GMT +1
 */
(function(window,document,jQuery){'use strict';var default_page='page-1',current_page='',page_to_show='',pagination=false,hash_check_interval=300;function preloadImages(){var preload=[],img=document.createElement('img');preload.push('/images/backvoet.jpg');preload.push('/images/backbil.jpg');preload.push('/images/backknieen.jpg');preload.push('/images/backhiel.jpg');preload.push('/images/backbend.jpg');preload.push('/images/backvhoofd.jpg');preload.push('/images/backvoethand.jpg');preload.push('/images/korte_prinsengracht.jpg');preload.push('/images/ceintuurbaan.jpg');jQuery(img).bind('load',function(){if(preload[0]){this.src=preload.shift();}}).trigger('load');}function addExternalLinkHandler(){jQuery("a[rel='external']").click(function(evt){evt.preventDefault();window.open(this);});}function addEmailHandler(){jQuery('span.addr').each(function(){jQuery(this).attr("id","addr0");var $span=jQuery("#"+jQuery(this).attr("id")),title=jQuery(this).attr('title'),addr=$span.text().replace(/ \[at\] /,"@").replace(/ \[\.\] /g,".");if(!title.length){title=addr;}$span.after('<a href="mailto:'+addr+'">'+title+'</a>');$span.remove();});}function getHash(){return document.location.hash.substring(1);}function fadeInPage(){jQuery('#'+page_to_show).fadeIn('slow',function(){current_page=page_to_show;});}function handlePaginationPages(){var $current_page,$page_to_show=jQuery('#'+page_to_show);if(!current_page){fadeInPage();return;}if(page_to_show===current_page){if($page_to_show.is(':hidden')){fadeInPage();}return;}else{$current_page=jQuery('#'+current_page);if($current_page.is(':visible')){$current_page.fadeOut('fast',function(){fadeInPage();});}}}function fadeOutPage(){if(pagination){handlePaginationPages();}else{fadeInPage();}}function setActiveMenu(){var pathname=document.location.pathname,target=pathname+'#'+page_to_show,$menu=jQuery('#menu a');$menu.each(function(index,value){var $elm=jQuery(value);if(target===$elm.attr('href')){$elm.addClass('selected');}else{if(pathname!==$elm.attr('href')){$elm.removeClass('selected');}}});}function checkHash(){page_to_show=getHash();pagination=false;if(!page_to_show.length){current_page=default_page;page_to_show=current_page;}if(jQuery('#page-2').length){pagination=true;}setActiveMenu();fadeOutPage();}function init(){preloadImages();addExternalLinkHandler();addEmailHandler();setInterval(function(){checkHash();},hash_check_interval);}init();}(window,document,window.jQuery));
