/*
JSTarget function by Roger Johansson, www.456bereastreet.com
*/
var JSTarget = function () {
	// Default configuration
	var config = {
		strAtt: 'class', // The attribute to be examined
		strVal: 'new-window', // The value to match
		strWarning: ' (new window)' // Warning text
	};
	function init(props) {
		// Check for DOM support
		if (!document.getElementById || !document.createTextNode) {
			return;
		}
		// If any properties were supplied, apply them to the config object.
		for (var key in props) {
			if (config.hasOwnProperty(key)) {
				config[key] = props[key];
			}
		}
		var oWarning;
		var oLink;
		var arrLinks = document.getElementsByTagName('a');
		var oRegExp = new RegExp("(^|\\s)" + config.strVal + "(\\s|$)");
		for (var i = 0, len = arrLinks.length; i < len; i++) {
			oLink = arrLinks[i];
			// If the attribute is class, check for className
			if ((config.strAtt === 'class') && (oRegExp.test(oLink.className)) || (oRegExp.test(oLink.getAttribute(config.strAtt)))) {
				oWarning = document.createElement("em");
				oWarning.appendChild(document.createTextNode(config.strWarning));
				oLink.appendChild(oWarning);
				oLink.target = '_blank';
			}
		}
	}
	return {
		init: init
	};
}();

 $(document).ready(function() {
	(function($){
		$(".more_subcats").each(function(){
			$(".cat_clip").css({height:156});
			$(this).click(function(e){
				e.preventDefault();
				if(!$(this).hasClass("open")){
					var hg = $(this).parent().find(".cat_clip_content").height() + 50 - 0;
					$(this).parent().find(".cat_clip").animate({height:hg},500);
					$(this).html("Minder");
					$(this).addClass("open");
				}else{
					$(this).parent().find(".cat_clip").animate({height:156},500);
					$(this).html("Meer");
					$(this).removeClass("open");
				}
			})
		});
		$('#eduhubhidcopy').css('display','none');
		
		$('#eduhubhidcopyswitch').click(function(e){ 
			e.preventDefault();
			e.stopPropagation();
			var par = $("#eduhubhidcopy");
			
				if(par.css('display') == 'none'){
					par.fadeIn();
				}else{
					par.fadeOut('slow');
				}
		});
		JSTarget.init({strWarning:''});
	})(jQuery);
$('.faq_answer').each(function(){
        $(this).css({'display':'none'});
});

$('a[class="t_blank"]').click(function(e){
   window.open($(this).attr('href'));
   e.preventDefault();
});

$('.question').click(function(){ 
        if($($(this).attr('href')).css('display') == 'none'){
            $($(this).attr('href')).fadeIn();
            $(this).removeClass('question');
            $(this).addClass('questionOpen');
        }else{
            $($(this).attr('href')).fadeOut('slow');
            $(this).removeClass('questionOpen');
            $(this).addClass('question');
        }
        return false;
});
	// open th anchors with rel external in new window
	$('a[rel$="external"]').each(function(index){
		 $(this).attr('target', '_blank');
	});
 });
 function historySlider(mr){
 
	if($( "#slider" ).length > 0){
		var maxRange = mr;
		var slideValue = maxRange;
		var minRange = 1;
		// Slider
		$('#slider').slider({ 
			min: minRange,
			max: maxRange,
			orientation: 'vertical',
			animate: true,
			range: 'max',
			value: maxRange
		});
		 $('#slideNewsUp').click(function(){  
			if(slideValue < maxRange) slideValue = slideValue + 1 - 0;
			$('#slider').slider({ value: slideValue });
			scrollToValue(Math.abs(maxRange - slideValue));
			return false;
		}); 
		 $('#slideNewsDown').click(function(){  
			if(slideValue > minRange) slideValue -= 1;
			$('#slider').slider( { value: slideValue } );
			scrollToValue(Math.abs(maxRange - slideValue));
			return false;
		});  
		$( "#slider" ).slider({
		   slide: function(event, ui) { 
			slideValue = ui.value;  
			scrollToValue(Math.abs(maxRange - slideValue));
		   }
		}); 
		$( "#slider" ).slider({
		   stop: function(event, ui) { 
			slideValue = $( "#slider" ).slider( "option", "value" ); 
			
			scrollToValue(Math.abs(maxRange - slideValue));
		   }
		});
		function scrollToValue(value){ 
			$('#newsScrollBox').scrollTo('div:eq('+value+')',400);					
		}
	}
 }
