var configuratorScrollTop = 0;
var configuratorBTopMarg = 0;
var configuratorTopMarg = 0;

$(document).ready(function(){
	$("a.configurator_link").fancybox({
		'padding' : 1, /* Padding around content */
		'imageScale' : false, /* If true, images are scaled to fit in viewport */
		'zoomOpacity' : false, /* If true, changes content transparency when animating */
		'zoomSpeedIn' : 0, /* Speed in miliseconds of the zooming-in animation (no animation if 0) */
		'zoomSpeedOut' : 0, /* Speed in miliseconds of the zooming-out animation (no animation if 0) */
		'zoomSpeedChange' : 0,  /* Speed in miliseconds of the animation when changing gallery items (no animation if 0) */
		'frameWidth' : 800, /*  Default width for iframed and inline content */
		'frameHeight' : 600, /*  Default height for iframed and inline content */
		'overlayShow' : true, /* If true, shows the overlay (false by default) Overlay color is defined in CSS file */
		'overlayOpacity' : .8, /* Opacity of overlay (from 0 to 1) */
		'hideOnContentClick': false, /* Hides FancyBox when cliked on opened item */
		'centerOnScroll' : false, /*  If true, content is centered when user scrolls page */
		'callbackOnStart' : onConfiguratorStart, /* Optional, called on start */
		'callbackOnShow' : null, /* Optional, called on displaying content */
		'callbackOnClose' : onConfiguratorClose /* Optional, called on close */
	}); 
});
function closeConfigurator() {
	$.fn.fancybox.close();
	self.location.reload();
}

function onConfiguratorStart() {
	if(!$.browser.opera) {
		configuratorScrollTop = $(document).scrollTop();
		//$(document).scrollTop(0);
		configuratorBTopMarg = $("body").css('margin-top');
		configuratorTopMarg = $("#outerwrapper").css('margin-top');
		$("#outerwrapper").css({
			'height':($(window).height()-2)+'px',
			'overflow':'hidden',
			'margin-top':'0px'
		});
		$("#footer").css('display','none');
		$("body").css('margin-top','0px');
		$("#outerwrapper").scrollTop(configuratorScrollTop);
	}
}
function onConfiguratorClose() {
	if(!$.browser.opera) {
		$("#outerwrapper").css({
			'height':'auto',
			'overflow':'auto',
			'margin-top':configuratorTopMarg
		});
		$("#footer").css('display','block');
		$("body").css('margin-top',configuratorBTopMarg);
		$(document).scrollTop(configuratorScrollTop);
	}
}


