/* SHADOWBOX
-------------------------*/
Shadowbox.init({
	language: "nl",
	overlayColor: "#000",
	overlayOpacity: "0.7",
	handleOversize: "none",
	displayNav: "false",
	viewportPadding: "0",
	players: ['html', 'iframe']
});

jQuery(function() {
	jQuery('.logo img').hide();
	
	var img = jQuery('.logo img');
	var cont = jQuery('.companylogo');
	
	var time = 0;
	if (img.height() == 0) {
		time = 500;
	}
	
	setTimeout(function() {
		var diff = cont.height() - img.height();
		var diffHor = cont.width() - img.width();
		img.css('margin-top', + diff/2 + "px");
		img.css('margin-left', + diffHor/2 + "px");
		jQuery('.logo img').show();
	}, time);

	// http://stackoverflow.com/questions/3038898/ipad-iphone-hover-problem-causes-the-user-to-double-click-a-link
	$('a').live('touchend', function(e) {
	    var el = $(this);
	    var link = el.attr('href');
	    window.location = link;
	});
	
	applyMasonry();
	
	$(".submitbutton").hover(function() {
		$(this).addClass("hover");
	}, function(){
		$(this).removeClass("hover");
	}).click(function(){
		$(this).parents("form:first").submit();
	});
	
	// message effect
	setTimeout(function() {
		$(".message.slideup").slideUp();
	}, 5000);
	
//	haal alle titles in het rechter menu weg 
//	want deze geeft als tooltip dezelfde tekst weer
//	als het menu item zelf
	$("ul.mainMenu a").attr('title', '');
	
	$(".companylogo").click(function(){
		window.location.href = "/";
	})
	
	$("a[rel=fancyfotoprev]").click(function() {
		$("#tabItem_Media").click();
		$("a[href=" + $(this).attr("href") + "][rel=fancyfoto]").click();
		return false;
	});
	$("a[rel=fancyfoto]").fancybox({
		'type' : 'image'
	});
});

function applyMasonry() {
	jQuery('.kenmerken').masonry({
		itemSelector: '.kenmerken_type'
	});
}

