$(function() {
	//
	middleBox();

	//
	$(window).resize(function() {
		middleBox();
	});

	//
	Shadowbox.init({
	  //handleOversize: "drag",
		//modal: false
	});

	//
	$('.bgContainer img').maxImage({
		isBackground: true
		//overflow: 'auto'
	});

	//
	$(".GadzetyTable img").css({opacity: 0.45});
	$(".GadzetyTable .ramka").css({opacity: 0});
	
  $(".GadzetyTable img").mouseenter(function() {
    $(this).animate( {opacity: 1}, {queue: true, duration: 250} );
    $(this).parents(".imgContainer").find(".ramka").animate( {opacity: 1}, {queue: true, duration: 400} );
    $(this).parents("td").find(".link").animate( {opacity: "hide"}, {queue: true, duration: 300} );
  }).mouseleave(function(){
    $(this).animate( {opacity: 0.45}, {queue: true, duration: 250} );
    $(this).parents(".imgContainer").find(".ramka").animate( {opacity: 0}, {queue: true, duration: 450} );
    $(this).parents("td").find(".link").animate( {opacity: "show"}, {queue: true, duration: 300} );
  });

	//
  $(".GadzetyTable td .link").mouseenter(function() {
  	$(this).parents("td").find("img").animate( {opacity: 1}, {queue: true, duration: 400} );
  }).mouseleave(function(){
  	$(this).parents("td").find("img").animate( {opacity: 0.45}, {queue: true, duration: 400} );
  });

});


middleBox = function() {
  winH = $(window).height();
  MyMiddlePage = (winH - 600) / 2;
  $(".middleBox").css({marginTop: MyMiddlePage});
}
