function confirmSubmit()
{
if (confirm('Czy chcesz usunac ten produkt?')) return true;
else return false;
}

var polecamy_right_next = 0;
var polecamy_right_current = 1;
function changeRightPolecamy(n) {
	if($('#polecamy_Right_'+n)) {
		$('#polecamy_Right_'+polecamy_right_current).fadeOut('slow', function() {
			$('#polecamy_Right_'+n).fadeIn('slow', function() {
				polecamy_right_current = n;
				if($('#polecamy_Right_'+(n+1)).length != 0) {
					setTimeout("changeRightPolecamy("+(n+1)+")", 15000);
				}
				else {
					setTimeout("changeRightPolecamy(1)", 15000);
				}
			});
		});
	}
}

var polecamy_left_next = 0;
var polecamy_left_current = 1;
function changeLeftPolecamy(n) {
	if($('#polecamy_Left_'+n)) {
		$('#polecamy_Left_'+polecamy_left_current).fadeOut('slow', function() {
			$('#polecamy_Left_'+n).fadeIn('slow', function() {
				polecamy_left_current = n;
				if($('#polecamy_Left_'+(n+1)).length != 0) {
					setTimeout("changeLeftPolecamy("+(n+1)+")", 15000);
				}
				else {
					setTimeout("changeLeftPolecamy(1)", 15000);
				}
			});
		});
	}
}

$(window).load(function() {
	if($('#polecamy_Right_2').length != 0) {
		setTimeout("changeRightPolecamy(2)", 15000);
	}
	if($('#polecamy_Left_2').length != 0) {
		setTimeout("changeLeftPolecamy(2)", 15000);
	}
						
$.Lightbox.construct({
		 "text": {
			// For translating
			 "image":        "Zdjęcie",
			 "of":           "z",
			 "close":        "Zamknij X",
			 "closeInfo":    "",
			 "download":     "Download.",
			 "help": {
				 "close":    "Kliknij aby zamknąć",
				 "interact": ""
			 },
			 "about": {
				 "text":     "",
				 "title":    "",
				 "link":     ""
			 }
		}
	});
	
	window.onresize			= arguments.callee;
  var MyScreenWidth		= window.screen.width;
  var MyScreenHeight	= window.screen.height;
	var MyWindowWidth		= $(window).width();	
  var MyWindowHeight	= $(window).height();
  

	// niestety info o nieobsÅ‚ugiwanej przegladarce - za duzo png w background
	if ( $.browser.msie && $.browser.version.substr(0,3) == "6.0" ) {
		InfoIE6 = '<div class="IntroBrowser">';
			InfoIE6 += '<img src="images/browser_info.png" alt="" border="0" style="display: block;" />';
			InfoIE6 += '<a href="http://www.mozilla-europe.org/pl/firefox"><img src="images/browser_firefox.png" alt="" border="0" style="margin-right: 10px;" /></a>';
			InfoIE6 += '<a href="http://pl.opera.com"><img src="images/browser_opera.png" alt="" border="0" style="margin-right: 10px;" /></a>';
			InfoIE6 += '<a href="http://www.google.pl/chrome"><img src="images/browser_chrome.png" alt="" border="0" style="margin-right: 10px;" /></a>';
			InfoIE6 += '<a href="http://www.apple.com/safari/"><img src="images/browser_safari.png" alt="" border="0" style="margin-right: 10px;" /></a>';
			InfoIE6 += '<a href="http://www.microsoft.com/poland/windows/downloads/ie/getitnow.mspx"><img src="images/browser_ie.png" alt="" border="0" style="margin-right: 0px;" /></a>';	
		InfoIE6 += '</div>';		
		$("body").html(InfoIE6);
	}
  

  // Max szerokosc 3 kolumn z trescia...
	TopContHeight = $(".TopContainer").height();
  TopMenuContHeight = $(".TopMenuContainer").height() - 50; // TopMenuContHeight - (ThreeColumns:paddingTop=64 lub top=64)
  HeightElements = MyWindowHeight - (TopContHeight + TopMenuContHeight);

  SprMiddleHeight = $(".ThreeColumns").height();
	
	if ( SprMiddleHeight < HeightElements) {
	  $(".MiddleColumn").height(HeightElements);
	  $(".BoxOzdobaPrawa").height(HeightElements);
	} else {
		$(".MiddleColumn").height(SprMiddleHeight);
		$(".BoxOzdobaPrawa").height(SprMiddleHeight);
	}

  	
	// Footer - show, hide
  if ( $.cookie("FooterHide") == "hide" ) {
  	$(".FooterContainer").css({bottom: "-130px"});
  	$(".FooterShow").show().css({top: "-20px"});
  }
  $(".FooterHide").click(function() {
		$.cookie("FooterHide", "hide");
  	$(".FooterContainer").animate({bottom: "-130px"}, {queue: false, duration: 350} );
		setTimeout('$(".FooterShow").show().animate({top: "-20px"}, {queue: false, duration: 350} );', 300);
  });
  $(".FooterShow").click(function() {
		$.cookie("FooterHide", "show");
  	$(".FooterShow").animate({opacity: "hide", top: "40px"}, {queue: false, duration: 350} );
  	setTimeout('$(".FooterContainer").animate({bottom: "0px"}, {queue: false, duration: 350} );', 300);
  });
  

	// Widok koszyka - show, hide
  if ( $('.BoxBigBasket').length != 0 ) {
		$(".BoxBigBasket .BigBasketContent").hide();
		
		$(".BasketToggle").click(function () {
		  ThisBasket = $(this).parents(".BoxBigBasket").find(".BigBasketContent");
			ThisId = $(this).parents(".BoxBigBasket").find(".BigBasketContent").attr("id");
			if ( ThisBasket.css("display") == "none" ) {
				$(this).css({	backgroundPosition: "0% 0%"});
				ThisBasket.show();
				$.cookie(ThisId, "show");
			} else {
				$(this).css({	backgroundPosition: "0% 100%"});
				ThisBasket.hide();
				$.cookie(ThisId, "hide");
			}
		});
		
		$(".BoxBigBasket .BigBasketContent").each(function() {
			FirstThisId = $(".BoxBigBasket .BigBasketContent").first().attr("id");
			if ( $.cookie(FirstThisId) == null ) { $.cookie(FirstThisId, "show"); }
			
			EachThisId = $(this).attr("id");
			if ($.cookie(EachThisId) == "show" ) {
				$("#"+EachThisId).show();
				$(this).parents(".BoxBigBasket").find(".BasketToggle").css({	backgroundPosition: "0% 0%"});
			}
		});
	}

  
  // Input - Szukaj
  if ( $(".InputSmallSearch").attr("value") == "" || $(".InputSmallSearch").attr("value") == undefined ) {
		$(".InputSmallSearch").attr("value", "Szukaj w serwisie ...");
  }
	$(".InputSmallSearch").focus( function() {
		if ( $(this).attr("value") == "Szukaj w serwisie ..." ) {
			$(this).attr("value", "");
		}
	});
	$(".InputSmallSearch").blur( function() {
		if ( $(this).attr("value") == "" || $(this).attr("value") == undefined ) {
			$(this).attr("value", "Szukaj w serwisie ...");
		}
	});

  // Input - Szukaj
  if ( $("#InputNazwa").attr("value") == "" || $("#InputNazwa").attr("value") == undefined ) {
		$("#InputNazwa").attr("value", "");
  }
	$("#InputNazwa").focus( function() {
		if ( $(this).attr("value") == "" ) {
			$(this).attr("value", "");
		}
	});
	$("#InputNazwa").blur( function() {
		if ( $(this).attr("value") == "" || $(this).attr("value") == undefined ) {
			$(this).attr("value", "");
		}
	});
	
  if ( $("#InputNazwa3").attr("value") == "" || $("#InputNazwa3").attr("value") == undefined ) {
		$("#InputNazwa3").attr("value", "");
  }
	$("#InputNazwa3").focus( function() {
		if ( $(this).attr("value") == "" ) {
			$(this).attr("value", "");
		}
	});
	$("#InputNazwa3").blur( function() {
		if ( $(this).attr("value") == "" || $(this).attr("value") == undefined ) {
			$(this).attr("value", "");
		}
	});
  if ( $("#InputNazwa4").attr("value") == "" || $("#InputNazwa4").attr("value") == undefined ) {
		$("#InputNazwa4").attr("value", "");
  }
	$("#InputNazwa4").focus( function() {
		if ( $(this).attr("value") == "" ) {
			$(this).attr("value", "");
		}
	});
	$("#InputNazwa4").blur( function() {
		if ( $(this).attr("value") == "" || $(this).attr("value") == undefined ) {
			$(this).attr("value", "");
		}
	});	
	
  // Input - Szukaj
  if ( $("#InputNazwa2").attr("value") == "" || $("#InputNazwa2").attr("value") == undefined ) {
		$("#InputNazwa2").attr("value", "");
  }
	$("#InputNazwa2").focus( function() {
		if ( $(this).attr("value") == "" ) {
			$(this).attr("value", "");
		}
	});
	$("#InputNazwa2").blur( function() {
		if ( $(this).attr("value") == "" || $(this).attr("value") == undefined ) {
			$(this).attr("value", "");
		}
	});
	
	// Input - Newsletter
  if ( $(".InputSubskrybcja").attr("value") == "" || $(".InputSubskrybcja").attr("value") == undefined ) {
		$(".InputSubskrybcja").attr("value", "podaj swÃ³j e-mail");
  }
	$(".InputSubskrybcja").focus( function() {
		if ( $(this).attr("value") == "podaj swÃ³j e-mail" ) {
			$(this).attr("value", "");
		}
	});
	$(".InputSubskrybcja").blur( function() {
		if ( $(this).attr("value") == "" || $(this).attr("value") == undefined ) {
			$(this).attr("value", "podaj swÃ³j e-mail");
		}
	});


  // Input - SzukajArtysty
  if ( $(".SzukajArtysty").attr("value") == "" || $(".SzukajArtysty").attr("value") == undefined ) {
		$(".SzukajArtysty").attr("value", "Szukaj artysty ...");
  }
	$(".SzukajArtysty").focus( function() {
		if ( $(this).attr("value") == "Szukaj artysty ..." ) {
			$(this).attr("value", "");
		}
	});
	$(".SzukajArtysty").blur( function() {
		if ( $(this).attr("value") == "" || $(this).attr("value") == undefined ) {
			$(this).attr("value", "Szukaj artysty ...");
		}
	});

	// zaokroglone ramki do obrazkow itp...
	$(".NewInGallery span.noborder").last().css({margin: "0px 0px 10px 0px"});	
	if ( !$.browser.msie ) {
		$(".NewsSmallImagBg").corner("10px");
		$(".NewsSmallImgFoto").corner("8px");
		$(".NewInGallery span").corner("4px");
		$(".PaintDetails").corner("8px");
	}

});
  // Input - Newsletter New
  if ( $(".InputSubskrybcjaNew").attr("value") == "" || $(".InputSubskrybcjaNew").attr("value") == undefined ) {
		$(".InputSubskrybcjaNew").attr("value", "podaj swój e-mail");
  }
	$(".InputSubskrybcjaNew").focus( function() {
		if ( $(this).attr("value") == "podaj swój e-mail" ) {
			$(this).attr("value", "");
		}
	});
	$(".InputSubskrybcjaNew").blur( function() {
		if ( $(this).attr("value") == "" || $(this).attr("value") == undefined ) {
			$(this).attr("value", "podaj swój e-mail");
		}
	});

// wyrownywanie wysokosci kontenerow z tytulem dziela
function wyrownaj() {

	}

//wyrownaj();

$(document).ready(function() {
		$(".ThumbnailsListWorks").each(function() {
				var maxHeight = 0;
				$(this).children(".ThumbItem").each(function() {
						var child = $(this).children(".ItemTitle");
						if(child.height() > maxHeight) {
								maxHeight = child.height();
							}
					});
				$(this).children(".ThumbItem").each(function() {
						var child = $(this).children(".ItemTitle");
						var currentHeight = child.height();
						child.css('padding', ((maxHeight - currentHeight) / 2) + 'px 0');
					});
			});
	});

