$(function() {
	
	$(".imgscroll").jCarouselLite({
  		visible: 6,
		auto: 800,
    	speed: 2000
 
    });
});





function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;



$(document).ready(function(){


// post # url to subscribe url rightbottom
$("#subscribenow a").attr("href", ($(".btn3 a").attr("href")));



// add fieldname to newsletter form

$(".newsletter table tr th").last().html("Interessegebied:");
$(".newsletter table tr th").last().css("vertical-align","top");
$(".newsletter table tr td").last().css("padding-left","200px");



	
// adds class current in quick menu
var linkTarget = $("#breadcrumb ul li.last a").attr("href");
var nestedUl = $("#quickmenu li ul");
var childLinks = $("#quickmenu li ul li a");
					
$("#quickmenu li a").each(function(){
			
	if ($(this).attr("href") == linkTarget){
		$(this).addClass("current");		
	};		
});


// opens nested ul's and keeps them open when clicked on links within
$(nestedUl).each(function() {	
	 		
	if ($(this).prev("a").attr("href") == linkTarget) {
		
		$(this).css("display","block");
		$(this).prev("a").removeClass("current");		
						
	}  
	
});

$(childLinks).each(function() {

	if ($(this).attr("href") == linkTarget) {
	
		$(this).parents("ul").css("display","block");
		$(this).parents("ul").prevAll("span").html("&darr;&nbsp;");
	}
});
	

// kill border in wordpress tables
$(".easy-table-creator").attr("border","0");

	
// effect on divs
$('.fader').css("display", "none");
$('.fader').fadeIn("slow");

// pushdown centercol if opendaybanner is shown
$(function($) {
	if ($("#openday").hasClass("show")) {		
		$("#centercol").css("marginTop","220px");
		}	
	});


// show/hide divs  
	$('.showhide').hide();
	$('.showhide:first').show();
	
	
	$('.showdiv').click(function(){				
		var wich = $(this).text();				
		
		$('.showhide').hide();
		$("#" + wich).show();			
	});
	

// shrink images that are to big on newspages
if ($(".entry-content img").width() > 460) {		
		$(".entry-content img").css("width","460px");
		}		


// time and date
$(function($) {
	$('.jclock').jclock();
	});

 
$(function($) {
	// blocks corrective	
	if ($(".darkgreyblock").width() > 200) {		
		$(".darkgreyblock").css("marginBottom","0px");
		}	
	
	if ($(".greenblock").width() > 200) {		
		$(".greenblock").css("marginBottom","0px");
		}
		
	if ($(".footnote").width() > 400) {		
		$(".footnote").css("marginTop","0px");
		}	
	});
	

	// hide forms if js is off
	$(function($) {
		$(".forms").show();
		$(".jswarning").hide();
	});	

	// show second option choice
	$('.option1').change(function() {
		if ($(this).val() == '') { 
		 $(".option2").hide("slow");
		}
		else { 
		 $(".option2").show("slow");
		}
	});
	
	// expand text on testimonials page	
	$('.readmore').click(function(){
	  
	  $(this).prev("span").toggle();
	  var moretext = $(this).text() == 'lees meer...' ? 'lees minder...' : 'lees meer...';
	  $(this).text(moretext);
	 
  	});
	
	
	
	// archives page
	$('.newsitemfull').hide();
	$('.newsitemshort').click(function(){
	  
	  $('.newsitemfull').hide();	 
	  $(this).next(".newsitemfull").show();
	  $('.newsitemshort').show();
	  $(this).hide();	 
	 
  	});



	// hover color state menu  ####### KASPER EN SIMON #######	
	
	var colorClass;
	var newClass;
	var button;	
	
	$("ul#nav li ul.submenu li").mouseover(function(){
		
		button = $(this).parents("li, ul").prev("a");
		colorClass = button.attr('class');
			
		if (colorClass.indexOf("2") == -1) {
			
			newClass = colorClass;		
			newClass += "2";						
			button.removeClass(colorClass).addClass(newClass);			
			// alert(newClass)			
		}	
		
    }).mouseout(function(){			
		
		button = $(this).parents("li, ul").prev("a");
		newClass = newClass.replace("2","");		
		var defClass = button.attr('class');		
		button.removeClass(defClass).addClass(newClass);
		//	alert(newClass)			
		
    });
	
	  // Get all textareas that have a "maxlength" property. Now, and when later adding HTML using jQuery-scripting:
    $('textarea[maxlength]').live('keyup blur', function() {
        // Store the maxlength and value of the field.
        var maxlength = $(this).attr('maxlength');
        var val = $(this).val();

        // Trim the field if it has content over the maxlength.
        if (val.length > maxlength) {
            $(this).val(val.slice(0, maxlength));
        }
    });
	
});
			
	




















/*
 * jQuery jclock - Clock plugin - v 1.2.0
 * http://plugins.jquery.com/project/jclock
 *
 * Copyright (c) 2007-2008 Doug Sparling <http://www.dougsparling.com>
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */
(function($) {

  $.fn.jclock = function(options) {
    var version = '1.2.0';

    // options
    var opts = $.extend({}, $.fn.jclock.defaults, options);
         
    return this.each(function() {
      $this = $(this);
      $this.timerID = null;
      $this.running = false;

      var o = $.meta ? $.extend({}, opts, $this.data()) : opts;

      $this.timeNotation = o.timeNotation;
      $this.am_pm = o.am_pm;
      $this.utc = o.utc;
      $this.utc_offset = o.utc_offset;

      $this.css({
        fontFamily: o.fontFamily,
        fontSize: o.fontSize,
        backgroundColor: o.background,
        color: o.foreground
      });

      $.fn.jclock.startClock($this);

    });
  };
       
  $.fn.jclock.startClock = function(el) {
    $.fn.jclock.stopClock(el);
    $.fn.jclock.displayTime(el);
  }
  $.fn.jclock.stopClock = function(el) {
    if(el.running) {
      clearTimeout(el.timerID);
    }
    el.running = false;
  }
  $.fn.jclock.displayTime = function(el) {
    var time = $.fn.jclock.getTime(el);
    el.html(time);
    el.timerID = setTimeout(function(){$.fn.jclock.displayTime(el)},1000);
  }
  $.fn.jclock.getTime = function(el) {
    var now = new Date();
	var dayNames = new Array("Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag");
	var monNames = new Array("januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december");
    var dayNames, monNames, hours, minutes, seconds;

    if(el.utc == true) {
      var localTime = now.getTime();
      var localOffset = now.getTimezoneOffset() * 60000;
      var utc = localTime + localOffset;
      var utcTime = utc + (3600000 * el.utc_offset);
      now = new Date(utcTime);
    }
    hours = now.getHours();
    minutes = now.getMinutes();
    seconds = now.getSeconds();

    var am_pm_text = '';
    (hours >= 12) ? am_pm_text = " P.M." : am_pm_text = " A.M.";

    if (el.timeNotation == '12h') {
      hours = ((hours > 12) ? hours - 12 : hours);
    } else if (el.timeNotation == '12hh') {
      hours = ((hours > 12) ? hours - 12 : hours);
      hours   = ((hours <  10) ? "0" : "") + hours;
    } else {
      hours   = ((hours <  10) ? "0" : "") + hours;
    }

    minutes = ((minutes <  10) ? "0" : "") + minutes;
    seconds = ((seconds <  10) ? "0" : "") + seconds;

    var timeNow = dayNames[now.getDay()] + " " + now.getDate() + " " + monNames[now.getMonth()] + " " + now.getFullYear() + ", " + hours + ":" + minutes + ":" + seconds;
    if ( (el.timeNotation == '12h' || el.timeNotation == '12hh') && (el.am_pm == true) ) {
     timeNow += am_pm_text;
    }

    return timeNow;
  };
       
  // plugin defaults
  $.fn.jclock.defaults = {
    timeNotation: '24h',
    am_pm: false,
    utc: false,
    fontFamily: '',
    fontSize: '',
    foreground: '',
    background: '',
    utc_offset: 0
  };


// hides the unwanted _promo option in inschrijven.php

$("#categorie:last-child").hide();


})(jQuery);











// scrollen van images Lightversie

(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);
