/** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * *//** * Create a cookie with the given name and value and other optional parameters. * * @example $.cookie('the_cookie', 'the_value'); * @desc Set the value of a cookie. * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); * @desc Create a cookie with all available options. * @example $.cookie('the_cookie', 'the_value'); * @desc Create a session cookie. * @example $.cookie('the_cookie', null); * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain *       used when the cookie was set. * * @param String name The name of the cookie. * @param String value The value of the cookie. * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted. *                             If set to null or omitted, the cookie will be a session cookie and will not be retained *                             when the the browser exits. * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will *                        require a secure protocol (like HTTPS). * @type undefined * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de *//** * Get the value of a cookie with the given name. * * @example $.cookie('the_cookie'); * @desc Get the value of a cookie. * * @param String name The name of the cookie. * @return The value of the cookie. * @type String * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */jQuery.cookie = function(name, value, options) {    if (typeof value != 'undefined') { // name and value given, set cookie        options = options || {};        if (value === null) {            value = '';            options.expires = -1;        }        var expires = '';        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {            var date;            if (typeof options.expires == 'number') {                date = new Date();                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));            } else {                date = options.expires;            }            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE        }        // CAUTION: Needed to parenthesize options.path and options.domain        // in the following expressions, otherwise they evaluate to undefined        // in the packed version for some reason...        var path = options.path ? '; path=' + (options.path) : '';        var domain = options.domain ? '; domain=' + (options.domain) : '';        var secure = options.secure ? '; secure' : '';        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');    } else { // only name given, get cookie        var cookieValue = null;        if (document.cookie && document.cookie != '') {            var cookies = document.cookie.split(';');            for (var i = 0; i < cookies.length; i++) {                var cookie = jQuery.trim(cookies[i]);                // Does this cookie string begin with the name we want?                if (cookie.substring(0, name.length + 1) == (name + '=')) {                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));                    break;                }            }        }        return cookieValue;    }};function lprod(){var kolce=$('#listaprod :selected').text();$("#lprod").val(kolce);}function fillroz(){var roz=$('#rozmiar :selected').text();$("#rozmiary").val(roz);}function fillkol(){var kol=$('#kolor :selected').text();$("#kolory").val(kol);}function typy(){$("#producent").removeAttr("disabled");		$.get("getmakes.php", {kategorie: $('#kategorie').val()}, 	function(data)	{   		$("#producent").html(data);   		 	});}function prod(){$("#rozmiar").removeAttr("disabled");		$.get("getmodels.php", {kategorie: $('#kategorie').val(), producent: $('#producent').val() }, 	function(data)	{   		$("#rozmiar").html(data); 	});	} function zard(){$("#kolor").removeAttr("disabled");			$.get("getuszk.php", {kategorie: $('#kategorie').val(), producent: $('#producent').val(), rozmiar: $('#rozmiar').val() }, 	function(data)	{   		$("#kolor").html(data);   		 	});}function suggestValues() { $("#suggest-form li.bar").autocomplete("www.sklep-bielizna.com/suggestions.php", { width: 260, selectFirst: false }); }$(document).ready(function(){ suggestValues();$("#zapisz").click(function(){					var adr	= $('#adres').attr('value'); 		$.ajax({			type: "POST",			url: "usunadr.php",			data: "adres=" +adr,			success: function(data){							$('div.successers').hide().html(data).fadeIn();							$("#adres").attr("value","");								 } 		});					});$("#kategorie").val("");$("#accordion").each(function(){  $("tr:odd", this).not(".even").addClass("odd");  $("tr:even", this).not(".odd").addClass("even");});//$('.go').bind({//  click: function() { //   var fraza  = $('#szukaj').attr('value');	 //alert('User clicked on "foo."'+fraza);//$.get("szukam.php", {fraza: $('#szukaj').val() }, //	function(data3)//	{ //  		$("#poszukane").html(data3); //	}); // }//});	var czyfirma = $("#czyfirma");	var inital = czyfirma.is(":checked");	var topics = $("#firmafld")[inital ? "removeClass" : "addClass"]("gray");	var topicInputs = topics.find("input").attr("disabled", !inital);	czyfirma.click(function() {		topics[this.checked ? "removeClass" : "addClass"]("gray");		topicInputs.attr("disabled", !this.checked);	});	var wysylka = $("#wysylka");	wysylka.click(function() {		if ($("input#wysylka").is(':checked'))         {             $("input#bzip").val($("input#zip").val());             $("input#badres1").val($("input#adres1").val());             $("input#badres2").val($("input#adres2").val()); 			$("input#bcity").val($("input#city").val());         }         else         {             $("input#bzip").val("");             $("input#badres1").val("");             $("input#badres2").val(""); 			$("input#bcity").val("");         } 									});	$("#zip").mask("99-999");	$('label.required').append('&nbsp;<strong style="color:#ff0000;">*</strong>&nbsp;');		var current = 0;	$.validator.addMethod("pageRequired", function(value, element) {	var $element = $(element)	function match(index) {			return current == index && $(element).parents((index + 1)).length;		}		if (match(0) || match(1) || match(2)) {			return !this.optional(element);		}		return "dependency-mismatch";	}, $.validator.messages.required)		var v = $("#cmaForm").validate({	submitHandler: function(form) {			form.submit();		},	invalidHandler: function(form, validator){         $(validator.invalidElements()[0]).focus();		      },     focusInvalid:false,		errorClass: "warning",		onkeyup: false,		onblur: false,//		debug:true,		messages: {			email2: {				required: "Wpisz adres email ",				email: "Wpisz prawidłowy adres email",				equalTo: "Wpisz adres taki sam jak powyej"				},			email: {				required: "Wpisz adres email",				email: "Wpisz prawidłowy adres email"							}					}	});			 //});$("#fbox a").fancybox();		$("#promo3 a").fancybox();$('#module_cart').load("inna.php");	$('ul.spy').simpleSpy('2','6000');				$('ul.spy li').reverseOrder(); });$(function(){				$('#tabs').tabs();				$("#check").button();					$( "#accordion" ).accordion({ autoHeight: false,alwaysOpen: false,active: false		});				$(".filtry").button(//{//icons: {//                primary: 'ui-icon-check' //           }//});				//$("a", "#add_to_cart").click(function() { return false; });				});												(function ($) {$.fn.reverseOrder = function() {	return this.each(function() {		$(this).prependTo( $(this).parent() );	});};    $.fn.simpleSpy = function (limit, interval) {    limit = limit || 4;    interval = interval || 4000;        return this.each(function () {        // 1. setup            // capture a cache of all the Interesting title s            // chomp the list down to limit li elements        var $list = $(this),            items = [], // uninitialised            currentItem = limit,            total = 0, // initialise later on            start = 0,//when the effect first starts            startdelay = 4000;            height = $list.find('> li:first').height();                    // capture the cache        $list.find('> li').each(function () {            items.push('<li>' + $(this).html() + '</li>');        });                total = items.length;                $list.wrap('<div class="spyWrapper" />').parent().css({ height : height * limit });        $list.find('> li').filter(':gt(' + (limit - 1) + ')').remove();        // 2. effect                function spy() {            // insert a new item with opacity and height of zero            var $insert = $(items[currentItem]).css({                height : 0,                opacity : 0,                display : 'none'            }).prependTo($list);                                    // fade the LAST item out            $list.find('> li:last').animate({ opacity : 0}, 1000, function () {                // increase the height of the NEW first item                 $insert.animate({ height : height }, 1000).animate({ opacity : 1 }, 1000);                                // AND at the same time - decrease the height of the LAST item                // $(this).animate({ height : 0 }, 1000, function () {                    // finally fade the first item in (and we can remove the last)                    $(this).remove();                // });            });                        currentItem++;            if (currentItem >= total) {                currentItem = 0;            }                        setTimeout(spy, interval)        }                if (start < 1) {               setTimeout(spy,startdelay);                start++;            } else {            spy();            }            });};    })(jQuery);				$( document ).ready( function() { $(".darksimplebtn").click(function(){		$(".error").hide();		var hasError = false;		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;		var emailToVal = $("#email4").val();		if(emailToVal == '') {			$("div.error").after('<br /><span class="error">Nie wpisałe adresu</span>');			hasError = true;		} else if(!emailReg.test(emailToVal)) {			$("div.error").after('<br /><span class="error">Wpisz poprawny adres.</span>');			hasError = true;		}if ($('#test').is(':checked')) {  		}else {			$("#test").after('<span class="error">&nbsp;Zaznacz. </span>');			hasError = true;}if(hasError == false) {			$('.newssign').hide().fadeOut(); var adres	= $('#email4').attr('value'); var nazwa	= $('#name').attr('value'); 		$.ajax({			type: "POST",			url: "dodajadr.php",			data: "adres=" +adres,			success: function(data){				$('div.success').hide().html(data).fadeIn();				$('div.success1').hide().html(data).fadeIn(); } 		});}		return false;	});//$("input[name='trans']:first").attr('checked','checked');var trala = $.cookie('tra');     if( trala ) { 	$("input[name='trans']:eq("+trala+")").attr('checked','checked');}else{$("input[name='trans']:first").attr('checked','checked');}radioClicks();$( "input[name='trans']" ).bind( "click", radioClicks );});function radioClicks (){var ztransa = $('input[name=trans]:checked').attr('rel');var trans =  $('input[name=trans]:checked').val();var tral = $('input[name=trans]:checked').index('input[name=trans]');if (tral=='-1'){}else{$.cookie('tra', tral );}var szt = $('#szt').attr('value');var wart = $('#wart').attr('value');$("input#shcost").val($('input[name=trans]:checked').attr('value'));$("input#shcost1").val($('input[name=trans]:checked').attr('value'));$("input#shname").val($('input[name=trans]:checked').attr('rel'));$("input#shname1").val($('input[name=trans]:checked').attr('rel'));$("input#shp24").val($('input[name=trans]:checked').attr('id'));$("input#szt1").val($('#szt').attr('value'));$("input#wart1").val($('#wart').attr('value'));$.ajax({			type: "POST",			url: "radek.php",						data: "szt="+ szt +"& wart="+ wart +"& shcost="+ trans +"& shname="+ ztransa,			success: function(data){$('#wynikowa').hide().html(data).fadeIn("slow");						}			});}function usun(num,forma,rozmiar,kolor){var a     = $('#a').attr('value');var p     = $('#p').attr('value');var r     = $('#r').attr('value');var k     = $('#k').attr('value'); 		$.ajax({			type: "post",			url: "showcart.php",			data: "a="+ a +"& p="+ num +"& r="+ r +"& k="+ k, 			success: function (data) {							$('#kosz').hide().html(data).fadeIn();							$('#module_cart .middle').hide().load("inna.php").fadeIn("slow");														$( "input[name='trans']" ).bind( "click", radioClicks );						radioClicks();							$( "input[name='trans1']" ).bind( "click", radioClicks );			                radioClicks();							//$('#dane').hide();		}	  		});}function wyczysc(){$.ajax({			type: 'post',			url: 'showcart.php',			data: "a=clear",			success: function (data) {							$('#kosz').hide().html(data).fadeIn();							$('#module_cart').hide().load("inna.php").fadeIn("slow");							$('#usunall').hide();							$('#ttle').hide();							$('#kasa').hide();radioClicks();$('#dane').hide();}})}function policz(num,forma){var a     = "update"; var i     = $('#i').attr('value'); var p     = $('#p').attr('value');var q     = $('#'+forma).attr('value');var sesa  = $('#ses').attr('value'); 		$.ajax({			type: "post",			url: "showcart.php",			data: "a="+ a +"& p="+ num +"& q="+ q +"&sesja="+ sesa, 			success: function (data) {							$('#kosz').hide().html(data).fadeIn();							$('#module_cart').hide().load("inna.php").fadeIn("slow");				//lade(sesa);$.get("paymenty.php", {sesja: $('#ses').val() }, 	function(data2)	{   		$("#koszt").html(data2);		$( "input[name='trans']" ).bind( "click", radioClicks );			 radioClicks();		 $( "input[name='trans1']" ).bind( "click", radioClicks );			 radioClicks(); 	});									$( "input[name='trans']" ).bind( "click", radioClicks );			                radioClicks();$( "input[name='trans1']" ).bind( "click", radioClicks );			                radioClicks();										var czyfirma = $("#czyfirma");	var inital = czyfirma.is(":checked");	var topics = $("#firmafld")[inital ? "removeClass" : "addClass"]("gray");	var topicInputs = topics.find("input").attr("disabled", !inital);	czyfirma.click(function() {		topics[this.checked ? "removeClass" : "addClass"]("gray");		topicInputs.attr("disabled", !this.checked);	});	var wysylka = $("#wysylka");	wysylka.click(function() {		if ($("input#wysylka").is(':checked'))         {             $("input#bzip").val($("input#zip").val());             $("input#badres1").val($("input#adres1").val());             $("input#badres2").val($("input#adres2").val()); 			$("input#bcity").val($("input#city").val());         }         else         {             $("input#bzip").val("");             $("input#badres1").val("");             $("input#badres2").val(""); 			$("input#bcity").val("");         } 									});	$("#zip").mask("99-999");	//$('label.required').append('&nbsp;<strong style="color:#ff0000;">*</strong>&nbsp;');	//var accordion = $("#stepForm").accordion(); 	var current = 0;	$.validator.addMethod("pageRequired", function(value, element) {	var $element = $(element)	function match(index) {			return current == index && $(element).parents((index + 1)).length;		}		if (match(0) || match(1) || match(2)) {			return !this.optional(element);		}		return "dependency-mismatch";	}, $.validator.messages.required)		var v = $("#cmaForm").validate({	submitHandler: function(form) {			form.submit();		},	invalidHandler: function(form, validator){         $(validator.invalidElements()[0]).focus();		      },     focusInvalid:false,		errorClass: "warning",		onkeyup: false,		onblur: false,//		debug:true,		messages: {			email2: {				required: "Wpisz adres email ",				email: "Wpisz prawidłowy adres email",				equalTo: "Wpisz adres taki sam jak powyej"				},			email: {				required: "Wpisz adres email",				email: "Wpisz prawidłowy adres email"							}					}	});				}	  		}); }
