/*! Respond.js v1.0.1pre: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
(function(e,h){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=h;if(h){return}var u=e.document,r=u.documentElement,i=[],k=[],p=[],o={},g=30,f=u.getElementsByTagName("head")[0]||r,b=f.getElementsByTagName("link"),d=[],a=function(){var B=b,w=B.length,z=0,y,x,A,v;for(;z<w;z++){y=B[z],x=y.href,A=y.media,v=y.rel&&y.rel.toLowerCase()==="stylesheet";if(!!x&&v&&!o[x]){if(y.styleSheet&&y.styleSheet.rawCssText){m(y.styleSheet.rawCssText,x,A);o[x]=true}else{if(!/^([a-zA-Z]+?:(\/\/)?)/.test(x)||x.replace(RegExp.$1,"").split("/")[0]===e.location.host){d.push({href:x,media:A})}}}}t()},t=function(){if(d.length){var v=d.shift();n(v.href,function(w){m(w,v.href,v.media);o[v.href]=true;t()})}},m=function(G,v,x){var E=G.match(/@media[^\{]+\{([^\{\}]+\{[^\}\{]+\})+/gi),H=E&&E.length||0,v=v.substring(0,v.lastIndexOf("/")),w=function(I){return I.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+v+"$2$3")},y=!H&&x,B=0,A,C,D,z,F;if(v.length){v+="/"}if(y){H=1}for(;B<H;B++){A=0;if(y){C=x;k.push(w(G))}else{C=E[B].match(/@media ([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1;k.push(RegExp.$2&&w(RegExp.$2))}z=C.split(",");F=z.length;for(;A<F;A++){D=z[A];i.push({media:D.match(/(only\s+)?([a-zA-Z]+)(\sand)?/)&&RegExp.$2,rules:k.length-1,minw:D.match(/\(min\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1),maxw:D.match(/\(max\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1)})}}j()},l,q,j=function(E){var v="clientWidth",x=r[v],D=u.compatMode==="CSS1Compat"&&x||u.body[v]||x,z={},C=u.createDocumentFragment(),B=b[b.length-1],w=(new Date()).getTime();if(E&&l&&w-l<g){clearTimeout(q);q=setTimeout(j,g);return}else{l=w}for(var y in i){var F=i[y];if(!F.minw&&!F.maxw||(!F.minw||F.minw&&D>=F.minw)&&(!F.maxw||F.maxw&&D<=F.maxw)){if(!z[F.media]){z[F.media]=[]}z[F.media].push(k[F.rules])}}for(var y in p){if(p[y]&&p[y].parentNode===f){f.removeChild(p[y])}}for(var y in z){var G=u.createElement("style"),A=z[y].join("\n");G.type="text/css";G.media=y;if(G.styleSheet){G.styleSheet.cssText=A}else{G.appendChild(u.createTextNode(A))}C.appendChild(G);p.push(G)}f.insertBefore(C,B.nextSibling)},n=function(v,x){var w=c();if(!w){return}w.open("GET",v,true);w.onreadystatechange=function(){if(w.readyState!=4||w.status!=200&&w.status!=304){return}x(w.responseText)};if(w.readyState==4){return}w.send(null)},c=(function(){var v=false;try{v=new XMLHttpRequest()}catch(w){v=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return v}})();a();respond.update=a;function s(){j(true)}if(e.addEventListener){e.addEventListener("resize",s,false)}else{if(e.attachEvent){e.attachEvent("onresize",s)}}})(this,(function(f){if(f.matchMedia){return true}var e,i=document,c=i.documentElement,g=c.firstElementChild||c.firstChild,h=!i.body,d=i.body||i.createElement("body"),b=i.createElement("div"),a="only all";b.id="mq-test-1";b.style.cssText="position:absolute;top:-99em";d.appendChild(b);b.innerHTML='_<style media="'+a+'"> #mq-test-1 { width: 9px; }</style>';if(h){c.insertBefore(d,g)}b.removeChild(b.firstChild);e=b.offsetWidth==9;if(h){c.removeChild(d)}else{d.removeChild(b)}return e})(this));;
jQuery(document).ready((function(){
	
	var $ = jQuery;
	
    /*  BOF : CSS3 PIE
     *
     *	@see 			http://css3pie.com/
     *	@version		1.0beta5
     */
    if(typeof(PIE) !== 'undefined') {
        myPie = {
            selector : '',
            
            Init : (function(){
                if(jQuery.trim(myPie.selector.length) > 0) {
                    jQuery(myPie.selector).each(function(){
                        PIE.attach(this);				
                    });
                }
            })	
        }; myPie.Init();
    } /* EOF : CSS3 PIE */
    
    // Init slideshow
	$('#slideshow').each(function()
	{
		var $box = $(this);
		var $slides = $box.find('> *');
		var slideCount = $slides.length;
		var index = 0;
		
		var slide = function()
		{		
			var $this = $slides.eq(index).css('z-index', 0);			
						
			++index >= slideCount && (index = 0);						
									
			$slides.eq(index).hide().css('z-index', 1).delay(5000).fadeIn(1000, function()
			{									
				$this.css('z-index', 0).hide();				
				slide();	
			});					
		};	
					
		// Start on more than 1 slide		 
		slideCount > 1 
		&& $slides.not(':first').hide()
		&& slide();		
	});
    
    /* BOF : Menu */
    MainMenu = {
    	
    	menu : jQuery('#block-system-main-menu'),
    		
    	Init :  (function(){
    		
    		/* List items een vaste breedte geven zodat het menu niet verspringt bij een hover */
    		this.menu.find('li').each(function(){
    			jQuery(this).css({ 'width': jQuery(this).width() });
    			jQuery(this).find('a:first').css({
    				'padding' : 0
    			});
    		});
    		
    		/* Active item de klasse hover geven */
    		this.menu.find('li.active-trail a, li a.active').addClass('hover');
    		
    		/* Wanneer je met de muis over een menu-item gaat */
    		this.menu.find('li a').hover(
    				/* onMouseOver */
    				(function(){ 
    					jQuery(this).addClass('hover'); 
    				}),
    				
    				/* onMouseOut */
    				(function(){ 
    					if(!jQuery(this).hasClass('active')) {
    						jQuery(this).removeClass('hover'); 
    					}
    				})
    		);
    	})
    }; MainMenu.Init();
	
	// Fix: if the LI doesn't have a child node the text matches the theme color.
	// This wraps the text in a SPAN so the text color stays black.  
	jQuery('.field-content li:not(> span)').wrapInner('<span />');
    	
}));;

