//--------------------------------------------------

$(function () {

	Setup();	


	$('a.zoom').fancybox({
		zoomSpeedIn 	: 300,
		zoomSpeedOut 	: 200,
		zoomOpacity 	: true,
		overlayOpacity 	: 0.5
	});

	
});

//--------------------------------------------------

function Setup(){
	
	$(document).pngFix();
	
	//------ leftmargin weghalen bij eerste colom	
	$('div.col:first').addClass('nomarg');
	
	$('div.wrapper').each(function(){					   
		$('div.col:first',this).addClass('nomarg');
	});

	SetHeights($('.fixcol'));
	
	//------ kolommen maken
	$('.splitcol').columnize({ 
			width : 416
	});		

	//--------
	SetForm(); 
}

//--------------------------------------------------

function loadimg(image,wrap) {		
	var img = new Image();
	$(img).load(function () {   
		$(this).hide();
		wrap.find('.imgholder').append(this);
		$(this).fadeIn(600);
	})
	.attr('src', image);
 }

//--------------------------------------------------

function SetForm() {
	$('input:text').clearingInput();
	$('textarea').clearingInput();
}

//--------------------------------------------------

function SetHeights(wrap) {

	$(".midwrap img").load(function() {    
    	var count;
    	var noImages = $(".midwrap img").length;
		
		for ( count=1 ; count<=noImages ; count++) {
		
			if(count === noImages) { 
			//-------------------------------------------
				tallest = 0;
				wrap.each(function() {
					
					hg = $(this).height();
					//alert(hg);
					if(hg > tallest) {
						tallest = hg;
					}
				});				
				wrap.height(tallest);
			//-------------------------------------------
			}
		};
		
	}());

}

//--------------------------------------------------

(function($) {
	
	$.fn.clearForm = function() {
	  return this.each(function() {
		var type = this.type, tag = this.tagName.toLowerCase();
		if (tag == 'form')
		  return $(':input',this).clearForm();
		if (type == 'text' || type == 'password' || tag == 'textarea')
		  this.value = '';
		else if (type == 'checkbox' || type == 'radio')
		  this.checked = false;
		else if (tag == 'select')
		  this.selectedIndex = -1;
	  });
	};	
	
})(jQuery);

