jQuery.fn.supersleight = function(settings) {
	settings = jQuery.extend({
		imgs: true,
		backgrounds: true,
		shim: 'x.gif',
		apply_positioning: true
	}, settings);
	
	return this.each(function(){
		if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4) {
			jQuery(this).find('*').andSelf().each(function(i,obj) {
				var self = jQuery(obj);
				// background pngs
				if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) {
					var bg = self.css('background-image');
					var src = bg.substring(5,bg.length-2);
					var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale');
					var styles = {
						'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')",
						'background-image': 'url('+settings.shim+')'
					};
					self.css(styles);
				};
				// image elements
				if (settings.imgs && self.is('img[src$=png]')){
					var styles = {
						'width': self.width() + 'px',
						'height': self.height() + 'px',
						'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')"
					};
					self.css(styles).attr('src', settings.shim);
				};
				// apply position to 'active' elements
				if (settings.apply_positioning && self.is('a, input') && (self.css('position') === '' || self.css('position') == 'static')){
					self.css('position', 'relative');
				};
			});
		};
	});
};

(function($) {
	$(function() { //on DOM ready
		$("#przewijanie_lista").simplyScroll({
			speed: 8
		});
	});
})(jQuery);



$(document).ready(function() {
     
$('body').supersleight();




	 
	$('#slideshow #slider').innerfade({	
		speed:1500,
		timeout:5000,
		type:'sequence',
		containerheight:'325px' });
	
	$('#slide_text #slide_text_lista').innerfade({	
		speed:1500,
		timeout:5000,
		type:'sequence',
		containerheight:'25px' });



    });
	
	$(document).ready(function(){
	$("a[rel*=lightbox]").lightBox();

		   $(".cart_remove img").hover(function() {
     $(this).attr("src", $(this).attr("src").split(".").join("-hover."));
   }, function() {
     $(this).attr("src", $(this).attr("src").split("-hover.").join("."));
 });

					//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'100px'},{queue:false,duration:360});
				}, function() {
					$(".cover", this).stop().animate({top:'112px'},{queue:false,duration:360});
				});
});

$(document).ready(function()
		{
			$('#wpisz_sie').ajaxForm({						
					target: 		'#list',
					beforeSubmit: 	validateForm2,
					success:       koniec

			});	
			
			//hide error containers

			$("#mail_error").hide();
			

		});
		
		function koniec() {
	
		$("#wpisz_sie").hide();
		
		}
		
		
function validateForm2()
		{

			$("#mail_error").empty().hide();
			
			

			var mail = $("#zapisz_sie").val();
			
			var errors 				= 0;
			

			

	
			if (mail == null || mail == '' ||   mail  <= '2')   
			{
				$("#mail_error").show().append("Proszę podać adres email.");
				errors++;
			}
			
		if(!(isValidEmailAddress(mail)))
				{ errors++;}
			
	
			
			if (errors > 0)
			{
				alert ("Błędny adres email!");
				return false;
			}

		}		
		
	function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
}

