
$(document).ready(function() {

	$('h1').click(function(){
		location.href='index.php';
		return false;
	})		

	$('#mainnav a:first').addClass('nobrdl');

	//$(document).pngFix();
	SetForm();
	SetZoom();
	
	//---------------------------------------

	$('.wdgeffects blockquote').hide();

	$('.wdgeffects li').hover(function() {
	  $(this).find('blockquote').fadeIn(400);
	  $(this).find('h3').fadeOut(400);
	}, function() {
	  $(this).find('blockquote').fadeOut(800);
	  $(this).find('h3').fadeIn(800);
	});

	$('.wdgeffects li').bind('click',function(){
										  
		var lnk = $(this).find('a').attr('href')
		window.location = lnk;	
		
	})

	//---------------------------------------
	
	$('#mlr-alert').hide();

	$('input.subm').hover(function() {
	  $(this).addClass('hover');
	}, function() {
	  $(this).removeClass('hover');
	});

	$('#frm_cnt').ajaxForm({
			beforeSubmit: BeforeSendCnt,
			success		: SendSuccesCnt,
			clearForm	: false
	});

	function BeforeSendCnt(resp, stat)  {
		$('#loader').addClass('loading');
		$('#frm_cnt input[value=]').addClass('empt');
	}	
	
	function SendSuccesCnt(resp, stat)  {
		
		$('#loader').removeClass('loading');
		
		var json = eval('(' + resp + ')');
		
		if (json.send=='yes') {
			//--- als bericht verzonden is melding geven en alles resetten
			$('#inline_alert').html(json.msg);
			$('a#mlr-alert').trigger('click');
			//$('#mlr-alert').html(json.msg).fadeIn('slow', function(){ setTimeout( "$('#mlr-alert').fadeOut('slow')" ,3000)  });
			$('#frm_cnt input').removeClass('empt');
			$('#frm_cnt').resetForm();
			SetForm();
		}else{
			//--- als er een error is deze zichtbaar maken
			$('#frm_cnt input.empt').clearingInput();
			$('#frm_cnt input').removeClass('empt');
			$('#inline_alert').html(json.msg);
			$('a#mlr-alert').trigger('click');
		}		
		
	}

	//---------------------------------------	
	
});

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

function SetZoom() {
	$('a.zoom').append('<em>zoom</em>').colorbox({opacity:0.8});
	$("a#mlr-alert").colorbox({opacity:1, width:"350px", inline:true, href:"#inline_alert"});
}

function SetForm() {
	$('input:text:[value=""]').clearingInput();
	$('textarea').clearingInput();
}

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

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

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