$(function() {

	/**///nadaję klasę body, mówiącą, że jest obsługa js
	$("body").addClass("js-enabled");

	/**///selektory css3 dla IE lte 8
	if ($.browser.msie && $.browser.version < 9) {
		$("table tbody tr:odd").addClass("odd");
		$(".module:last-child, .products:last-child li:last-child, .products-showcase:last-child").addClass("last-child");
		$(".products-showcase li:nth-child(3n)").addClass("nth-child");
	}

	$("#focus-on-login").click(function() {
		$("#login-mail").focus();
	})
	
	/**///piętnuję operę
	if ($.browser.opera) {
		$("body").addClass("opera");
	}
	
	$(".kolor").click(function() {
		id = $(this).attr("id");					   	
		$("#"+id+" input").attr("checked","checked");
    })
	
	$("#pokaz_haslo").change(function() {
		var id = $(this).attr("id");									 
		var val = $("#"+id).val();
		if(val == 1){
			$("#"+id).val(0);
			$("#dwahasla").show();	
		}else{
			$("#"+id).val(1);	
			$("#dwahasla").hide();	
		}
	})
	
	$("#faktura").change(function() {
		var id = $(this).attr("id");									 
		var val = $("#"+id+":checked").val();
		if(val == 1){
			$("#chcefakture").show();	
		}else{
			$("#chcefakture").hide();	
		}
	})
	
});

$(document).ready(function(){
			//Examples of how to assign the ColorBox event to elements
			$("a[rel='lightbox1']").colorbox();
						
			//Example of preserving a JavaScript event for inline calls.
			$("#click").click(function(){ 
				$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
				return false;
			});
			
			$("#produkt_ilosc").change( function() {
				$("#produkt_wartosc").html($("#produkt_ilosc").val()*cena);
			});
			
			$(".kolor").click( function() {
				var id = $(this).attr("id");		
				$(".button").show();
				$(".pseudo_button").hide();
				$(".parametr_dla_koloru").hide();
				$("#p_"+id).show();
			});
			
			$(".pseudo_button").click( function() {
				alert('Przed dodaniem do koszyka należy wybrać kolor');
			});
			
			$('#slideshow').cycle({ 
			  fx: 'fade', 
			  speed: 3000, 
			  timeout: 6000, 
			  pause: 1,
			  prev: '#prev-slide', 
			  next: '#next-slide'
			});
			
});
