$(document).ready(function() {						Cufon.now();										//artist icon tooltip										$(".artist-tooltip > a[title]").tooltip({						tip: '#tooltip',						position: 'center right',						offset: [0, 0],						delay: 0,						opacity: 0.92					});															// button fadeout										$(".fadeout").fadeTo(0, 0.99); 					$(".fadeout").hover(						function(){							$(this).stop().fadeTo("fast", 0.49); 						},						function(){							$(this).stop().fadeTo("fast", 0.99); 					});					// button fadein										$(".fadein").fadeTo(0, 0); 					$(".fadein").hover(						function(){							$(this).stop().fadeTo("fast", 0.35); 						},						function(){							$(this).stop().fadeTo("fast", 0); 					});					$(".fadeInContent").children().fadeTo(0, 0); 					$(".fadeInContent").hover(							function(){								$(this).children().stop().fadeTo("fast", 0.35); 							},							function(){								$(this).children().stop().fadeTo("fast", 0); 					});													$("#catalog-table tr[rel]").hover(						function(){							$(this).css('background-color','#f2f2f2');												},						function(){							$(this).css('background-color','transparent');													}					);	 					  					$("#catalog-table tr[rel]").click(function(){						  window.location = $(this).attr('rel');					});									 $('a[rel="lightbox"]').lightBox();										// Drop menu	 																										setTimeout("setMenu()",200);										$('.drop-menu-link > a').hover(							function(){								$(this).css('background', 'url(../img/bg_drop_menu_link.png) 0 0');							},							function(){								$(this).css('background', 'none');							}							);									var activeLink = $('#header-links > li.active');					var hoverLink = null;					var keeper = false;					$(".header-menu-link > a").hover(						function(){							$('#'+$(this).attr('id')+'-drop').css('z-index',10);							$('#'+$(this).attr('id')+'-drop').stop().fadeTo(50, 1.0, function(){$(this).css('display','block');}); 							activeLink.removeClass('active');							hoverLink = $('#'+$(this).attr('id').substring(0,$(this).attr('id').length-5));							hoverLink.addClass('active');														keeper = true;						},						function(){							$('#'+$(this).attr('id')+'-drop').css('z-index',5);							$('#'+$(this).attr('id')+'-drop').stop().fadeTo("slow", 0, function(){$(this).css('display','none');});							hoverLink.removeClass('active');							keeper = false							if (activeLink.attr('id') != $(this).attr('id')) {								setTimeout(function(){									if (!keeper) 										activeLink.addClass('active');								}, 300);							}else activeLink.addClass('active');																});												$('.menu-drop').hover(							function(){								$(this).stop().fadeTo(0, 1, function(){$(this).css('display','block');});								activeLink.removeClass('active');								hoverLink.addClass('active');								keeper = true							},							function(){                                                            if($('.menu-drop input:focus').length == 0 ){								$('#'+$(this).attr('id')+'-drop').css('z-index',5);								$(this).stop().fadeTo('slow', 0, function(){$(this).css('display','none');});								hoverLink.removeClass('active');								keeper = false;								if (activeLink.attr('id') != hoverLink.attr('id')) {									setTimeout(function(){										if (!keeper) 											activeLink.addClass('active');									}, 300);								}else activeLink.addClass('active');                                                            }							}						);											var active = null //$('#play');					//$('#play').css('background-position','center -8px');															$("#player > a").click(function(){						if($(this).attr('id') == 'stop'){ 							$('#stop').css('background-position','center -8px');							$('#play').css('background-position','center 0px');						}						else if($(this).attr('id') == 'play') {							$('#stop').css('background-position','center 0px');							$('#play').css('background-position','center -8px');						}					});																	//sendAction('play');										$("#contact-submit").click( function () {						$(".error").html('');						var flag = 0;						var err = '';						$(".required").each(function() {							if($(this).val() == '')							{								flag = 1;								err = 'Uzupełnij wymagane pola.';							}						});						if(!validate($("#email").val()))						{							if(!err)								err = 'Nieprawidłowy adres e-mail.';							else								err += '<br />Nieprawidłowy adres e-mail.';							flag = 1;						}						if(flag == 0)							getContactResponse();							else						{							$(".error").html(err);						}								return false;					});															$('input[rel], textarea[rel]').each(function(){						if($(this).val() == '') $(this).val($(this).attr('rel'));											});										$('input[rel], textarea[rel]').focus(function(){						if($(this).val() == $(this).attr('rel')) $(this).val('');											});										$('input[rel], textarea[rel]').focusout(function(){						if($(this).val() == '') $(this).val($(this).attr('rel'));											});										//scrollable for below-calendar events					var api = $("#events").scrollable({vertical: true, mousewheel: true, items: '.event-items', next: '.event-next', prev: '.event-prev', api: true});										$(".event-next").click(function(){						if(api.getIndex() == api.getSize()-1 && api.getIndex() > 0)						{							var count = $(".event").size();							if(count % 4 != 0)							{								$("#event-controls").animate({'margin-top': '-'+( (4 - count % 4) * 51 )+'px'},600);							}													}					});					$(".event-prev").click(function(){						$("#event-controls").animate({'margin-top': '0px'},300);						});                                        $("#content .shopSearch select").jgdDropdown();				});			function showArtistPanel(ArtistArray){		var itemNum = 18;					var artistcode = ''; // '<div class="img_4" id="artist-0-0"  style="background: url(img/img_artist_kayah.jpg) center center no-repeat;"><a href=""></a></div>';	var globaldimension = 4;	var dimension = 0;	var id = 0;	var i = 0;	var artist = new Array(null, null, null, new Array(), new Array(), new Array(), new Array());	var rowlimit = 0;				for(var row = 0; row <=rowlimit; row++){		globaldimension = 0;		dimension = 0;		id = 0;		artist = new Array(null, null, null, new Array(), new Array(), new Array(), new Array());				while(ArtistArray[i] && globaldimension < 35){			dimension = Math.floor(ArtistArray[i]['width']/28);			if(dimension >= 3) 			{				if(dimension > 6) dimension = 6;				//dimension = Math.ceil(Math.random()*4+2);				globaldimension += dimension;				if((row == 0 && i!==0) || row > 0 ) artist[dimension].push(id);				var artistcode = artistcode + '<div class="img_'+dimension+' fadeout" id="artist-'+row+'-'+id+'" style="background: url('+ArtistArray[i]['img']+') center center no-repeat;"><a href="'+ArtistArray[i]['url']+'" title="'+ArtistArray[i]['name']+'"></a></div>';				id++;			}			i++;		}		if(ArtistArray[i]) rowlimit++;				if(globaldimension > 34){			if(globaldimension-34 == 1 && dimension > 3){				artistcode = artistcode.replace('class="img_'+(dimension)+' fadeout" id="artist-'+row+'-'+(id-1), 'class="img_'+(dimension-1)+' fadeout" id="artist-'+row+'-'+(id-1));									}else{														var j = globaldimension-34;				var col = 0;				var size = 6;				var counter = 0;								while(j > 0 && counter < 50){					if(artist[size][col] === 0 || artist[size][col]){						artistcode = artistcode.replace('class="img_'+size+' fadeout" id="artist-'+row+'-'+artist[size][col], 'class="img_'+(size-1)+' fadeout" id="artist-'+row+'-'+artist[size][col]);						j--;						artist[size-1].push(artist[size][col]);						artist[size][col] = null;												globaldimension--;					}					size--;					if(size == 3){						size = 6;						col++;						if(counter%artist.length === 0)	col = 0;													counter++;													}				}			}										}		}				$('#artist-panel > div.fullbox-middle').height((rowlimit+1)*84-12);		$('#artist-images').html(artistcode);                $('#newsletter-form').submit(function(){            $(this).parent().find('p.error').html('trwa dodawanie adresu...');            $(this).find('input[name=mail]').focus();            if(!validate($(this).find('input[name=mail]').val())){                $(this).parent().find('p.error').html('Adres email jest niepoprawny.');				var h = 50 + $(this).parent().find('p.error').height();				$(this).parent().height(h);				$(this).parent().parent().find('.drop-menu-left').height(h);				$(this).parent().parent().find('.drop-menu-right').height(h);				return false;            }            $.post('/index.php?menu=subscribe&ajax=1', {email: $(this).find('input[name=mail]').val()}, function(data) {                     $('#newsletter-form').parent().find('p.error').html(data);					 var h = 50 + $('#newsletter-form').parent().find('p.error').height();					 $('#newsletter-form').parent().height(h);					$('#newsletter-form').parent().parent().find('.drop-menu-left').height(h);					$('#newsletter-form').parent().parent().find('.drop-menu-right').height(h);            });                        return false;        });}	var mem = null;function openPopup(url, name, arg) {	if(arg == null) arg = 'menubar=no, toolbar=no, location=no, scrollbars=no, resizable=no, status=no, width=385, height=210';	NewWindow = window.open(url, name, arg);	return NewWindow; }function addTrack(track, url, name){	 if(typeof(NewWindow) == 'undefined' || NewWindow.closed){			NewWindow = openPopup(url, name);			mem = track;		//	setTimeout("NewWindow.sendToActionScript(mem)",1000);	 }else NewWindow.sendToActionScript(track);	 	 return false;}function sendAction(action){	if(action == 'play'){		if((typeof(NewWindow) == 'undefined' || NewWindow.closed))	addTrack(trackList,'player.html','global_player');	}	if(!(typeof(NewWindow.sendButtonAction) == 'undefined' || NewWindow.closed)){		NewWindow.sendButtonAction(action,'action');	}	return false;} function switchButton(value){	switch(value){	case 'stop':		$('#play').css('background-position','center 0px');	break;	case 'play':		$('#stop').css('background-position','center 0px');		 	break;	}	$('#'+value).css('background-position','center -8px');}function getContactResponse() {			var content_show = '';			$(".contactform").each(function (i) {				if(i!=0)					content_show += '&';				content_show += $(this).attr("name") + '=' + $(this).val();			});			$.ajax({  				type: "post",				url: "index.php?menu=kontakt",				data: content_show,  				cache: false, 				beforeSend: function(){				},				success: function(data){					$(".ok").html('Wiadomość została wysłana. Dziękujemy!');							$("#contact-submit").css('display','none');								},				error: function() {					$(".error").html('Nie udało się wysłać wiadomości, spróbuj ponownie.');					}			}); }function setMenu(){	$('#header-links > li').each(function(index){		//if($('#header-menu-newsletter-link').length > 0) alert($(this).position().left);		$('#'+$(this).attr('id')+'-link').parent().css('left',($(this).position().left)+'px');		$('#'+$(this).attr('id')+'-link').width($(this).width());										$('#'+$(this).attr('id')+'-link-drop').width(($('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-content').width()+24));		$('#'+$(this).attr('id')+'-link-drop').height($('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-content').height()+28);		$('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-top').width($('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-content').width());		$('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-bottom').width($('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-content').width());		$('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-left').height($('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-content').height());		$('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-right').height($('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-content').height());		$('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-content').height($('#'+$(this).attr('id')+'-link-drop').children('.drop-menu-content').height());		$('#'+$(this).attr('id')+'-link-drop').css('display','none');		if($('#'+$(this).attr('id')+'-link-drop').hasClass('right'))		{			/*if($.browser.opera == true) $('#'+$(this).attr('id')+'-link-drop').css('left',(($(this).position().left)+$(this).width()-$('#'+$(this).attr('id')+'-link-drop').width()+48)+'px');			else */			$('#'+$(this).attr('id')+'-link-drop').css('left',(($(this).position().left)+$(this).width()-$('#'+$(this).attr('id')+'-link-drop').width()+5)+'px');		}		else $('#'+$(this).attr('id')+'-link-drop').css('left',(($(this).position().left)-1)+'px');	});			$('#newsletter-form').ready(function(){            if($('#header-menu-newsletter-link-drop p.error').html() !== ''){                $('#header-menu-newsletter-link-drop').stop().fadeTo(0, 1, function(){$(this).css('display','block');});                $(this).find('input[name=mail]').focus();                $(this).find('input[name=mail]').blur(function(){                    $('#header-menu-newsletter-link-drop').stop().fadeTo('slow', 0, function(){$(this).css('display','none');});                    $(this).blur();                });            }    });	}	function validate(email) {   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;   var address = email;   if(reg.test(address) == false) {      return false;         }   else   	return true;}//######################     INPOST MODULE ###############################$(document).ready(function() {      // Gdy wybrany INPOST zablokuj możliwość podania innego adresu. (bo paczkomaty mają swoje adresy) $("#shipment_type").change(function() {   if(($("#shipment_type").val())==3 || $("#shipment_type").val()==4)   {            $(".inpost_module").show();       $(".toggle_addr").attr("disabled", "disabled");   }   else   {       $(".inpost_module").hide();       $(".toggle_addr").attr("disabled", "");   }        //Zmiana ceny w widoku    if($("#shipment_type").val()==4)   {            $("#cena_uslugi").html($("#cena_ubezpieczenie").val());   }   else   {       $("#cena_uslugi").html($("#cena_uslugi_bez_ubezpieczenia").val());   }       if($("#inpost_no_register").val()==1 && ($("#shipment_type").val()==3 || $("#shipment_type").val()==4)) {         $(".send_inpost").attr("disabled", true);          $(".send_inpost").attr("title","Wybierz inny rodzaj przesyłki aby kupić."); } else {  $(".send_inpost").attr("disabled", false);    $(".send_inpost").attr("title",""); }              });   //Pokaż opcje ubezpieczenia $("#ubez").click (              function()       {                        if($("#ubez").val()!=1)             {                 $("#box_ubezpieczenie").show();                 $("#ubez").val(1);                             }             else             {                 $("#box_ubezpieczenie").hide();                 $("#ubez").val(2);             }       }                ); // Przy odpowiednim ubezpieczeniu ustaw odpowiednią wysyłkę -> standard z tym co obecnie.   $(".ubezpieczenie_paczki").click(function() {     if($(this).val()==5000){$("#shipment_type").val(4);}     if($(this).val()==10000){$("#shipment_type").val(5);}     if($(this).val()==20000){$("#shipment_type").val(6);}      });});//######################     INPOST MODULE ###############################
