/*-------------------------------------------------------------------- 
 * JQuery Plugin: "EqualHeights"
 * by:	Scott Jehl, Todd Parker, Maggie Costello Wachs (http://www.filamentgroup.com)
 *
 * Copyright (c) 2008 Filament Group
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Description: Compares the heights or widths of the top-level children of a provided element 
 		and sets their min-height to the tallest height (or width to widest width). Sets in em units 
 		by default if pxToEm() method is available.
 * Dependencies: jQuery library, pxToEm method	(article: 
		http://www.filamentgroup.com/lab/retaining_scalable_interfaces_with_pixel_to_em_conversion/)							  
 * Usage Example: $(element).equalHeights();
  		Optional: to set min-height in px, pass a true argument: $(element).equalHeights(true);
 * Version: 2.0, 08.01.2008
--------------------------------------------------------------------*/

$.fn.equalHeights = function(px) {
	$(this).each(function(){
		var currentTallest = 0;
		$(this).children().each(function(i){
			if ($(this).height() > currentTallest) { currentTallest = $(this).height(); }
		});
		if (!px) currentTallest = currentTallest; //
		// for ie6, set height since min-height isn't supported
		if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); }
		$(this).children().css({'min-height': currentTallest}); 
	});
	return this;
};


var autoPopulate={sInputClass:'autopopulate',init:function(){if(!document.getElementById||!document.createTextNode){return;}
var arrInputs=jQuery('input.'+autoPopulate.sInputClass);var iInputs=arrInputs.length;var oInput;for(var i=0;i<iInputs;i++){oInput=arrInputs[i];if(oInput.type!='text'){continue;}
if((oInput.value=='')&&(oInput.title!='')){oInput.value=oInput.title;jQuery(oInput).addClass('defaultInput');}
if(oInput.value==oInput.title){jQuery(oInput).addClass('defaultInput');}
jQuery('input.autopopulate').focus(function(){if(this.value==this.title){this.value='';this.select();jQuery(this).val('').removeClass('defaultInput');}});jQuery('input.autopopulate').blur(function(){if(!this.value.length){this.value=this.title;jQuery(this).addClass('defaultInput');}
else{if(this.value!=this.title){jQuery(this).removeClass('defaultInput');}}});}}};autoPopulate.init();



// EQUALHEIGHTS ALGEMEEN
$(".equalheight").equalHeights();


// BIJ KLIKBAAR OBJECT CLASS HOVER TOEVOEGEN ZODAT DUIDELIJK WORDT MIDDELS CSS DAT JE KAN KLIKKEN
$(".bloklink").hover(
  	function () {
    		$(this).addClass("over");
  		},
  	function () {
    		$(this).removeClass("over");
  		}
);



// EVENT DELEGATION, NEW AND BETTER SETUP SINCE JQUERY 1.4

$('body').delegate('.bloklink','click', function(){

		var e = $(this).find("a:first").attr("href");
		window.location=e;

		return false;
});

$('body').delegate('.popup','click', function(){

		var uri = $(this).attr('href');

		var height = $(this).classValue('h') || '600';
		var width = $(this).classValue('w') || '800';
		var video = $(this).classValue('v') || '';
		
		// INDIEN DE POPUP NAAR ZELFDE CONTENT GAAT IN POPUP DAN DE ORGINELE SPELER STOPZETTEN
		if ( video != '') { player = document.getElementById(video); player.sendEvent('STOP'); }

		window.open(uri,'RH', "width="+width+", height="+height);

		return false;
});

$('body').delegate('a.newWindow','click',function(){
	window.open(this.getAttribute('href'));
	return false;
});

$('body').delegate('.js-print','click', function(){

		window.print();

		return false;
});

$('body').delegate('.js-open','click',function(){

	$(this).next().toggleClass('show').parent().toggleClass('open');

	return false;
});


// FREQUENTLY ASKED QUESTIONS
$('body').delegate('dl.faq dt','click', function(){

	var a = $(this).next('dd');

	$(this).toggleClass('active').next('dd').toggleClass('active');

	if ( $(this).hasClass('active')) { $(a).slideDown('700'); } else { $(a).slideUp('700'); }

});

// FOCUS FORM ELEMENT
$('.formulier input, .formulier textarea').focus(function() {  
		$(this).parent().addClass("focus");  
	});  
	$('.formulier input, .formulier textarea').blur(function() {  
		$(this).parent().removeClass("focus");  
	});  

// QUICK FIX (implement this next revision in backend)
$("form label:contains('e-mailadres')").next().addClass('email');
	
	
	
	
