/*

PETRA CLASS

Global JavaScript Actions

Version 1.0
Author: futurepruf.com

*/


$(function() {
// 	$(window).resize(updateBackgroundContainer);
// 	$(window).ready(updateBackgroundContainer);
// 	$('#backgroundcontainer img').imagesLoaded(updateBackgroundContainer);

$('a.fancybox').fancybox({
	margin: 0,
	padding: 0,
	overlayColor: '#000',
	overlayOpacity: .4,
	scrolling: 'no',
	centerOnScroll: true,
	onComplete: $.fancybox.center
});

});

function updateBackgroundContainer() {
	var siteHeight = $('#wrapper').height();
	var windowHeight = $(window).height();
	var windowWidth = $(window).width();
	
	$('#backgroundcontainer').show();
	
	$('#backgroundcontainer').height(siteHeight);
	$('#backgroundcontainer').width(windowWidth);
	
	$('#backgroundcontainer img').removeAttr('width').attr('height', windowHeight);
	if ($('#backgroundcontainer img').width() < windowWidth) $('#backgroundcontainer img').removeAttr('height').attr('width', windowWidth);
}
