// banery banery banery banery banery banery banery banery banery banery banery banery banery banery banery banery  
//swfobject.embedSWF("/data/include/cms/glowna/main/druzyna.swf?clickTag=http%3A%2F%2Fwww.neosport.pl%2Finfo.php%3Fpage%3D183", "bDruzyna", "324", "162", "9.0.0");   
//swfobject.embedSWF("/data/include/cms/glowna/main/4B_main_bezpiecznie.swf", "b4B", "323", "81", "9.0.0");

$(document).ready(function(){

     _duration = 300;

     $("div.layout_right").height($("div.layout_wrapper").height());

     $(window).scroll(function(){
     	if ($(window).height() > $("form#filter2").height())
               {         
     	     if ( $(window).scrollTop() < 140 )
                    {
                    $('form#filter2')
          			.css('position', 'absolute')
          			.css("top", (140) + "px");               
                    }
                    else if ( $(window).scrollTop() > 140 && $(window).scrollTop() < (160 + $("div.layout_right").height() - $("form#filter2").height() ) )
          		{
                    $('form#filter2')
          			.stop()
          			.css('position', 'fixed')
          			.css("top", (0) + "px");
                    }
                    else if ($(window).scrollTop() > (160 + $("div.layout_right").height() - $("form#filter2").height() )) 
                    {
                    $('form#filter2')
          			.stop()
          			.css('position', 'absolute')
          			.css("top", (160 + $("div.layout_right").height() - $("form#filter2").height()) + "px");             
                    }
                    else
                    {
                    $('form#filter2')
          			.stop()
          			.css('position', 'absolute')
          			.css("top", (140) + "px");
                    }
               }
               else
               {
               $('form#filter2')
     			.stop()
     			.css('position', 'absolute')
     			.css("top", (140) + "px");
               }               
          });
          

     $('<div id="time_bg"><span id="time_txt"></span><span id="time_hour"></span></div>').appendTo($('div.layout_top'));
     $('<p id="karta_time"></p>').insertAfter("a#projector_button_observe");
     $("a#projector_button_observe").hide();
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////

// WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA  

     $('#wizualizacja_free input[name=submit]').bind('click', function(){
          if ($("#wizualizacja_free input[name=cena]:checked").val() === undefined 
          || $("#wizualizacja_free input[name=nazwa]").val().length < 3
          || $("#wizualizacja_free input[name=adres]").val().length < 3
          || $("#wizualizacja_free input[name=przedstawiciel]").val().length < 3
          || $("#wizualizacja_free input[name=telefon]").val().length < 3
          || $("#wizualizacja_free input[name=szt_koszulka]").val().length < 1
          || $("#wizualizacja_free input[name=szt_spodenki]").val().length < 1
          || $("#wizualizacja_free input[name=szt_getry]").val().length < 1
          || ($("#wizualizacja_free input[name=email]").val().length > 3 && !isValidEmailAddress($("input[name='email']").val())))
               {
               alert('Proszę wypełnić formularz.');
               return false;
               }
               else
               {
               return true;
               }
     });


// WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA WIZUALIZACJA koniec

// WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI

     $('#wydruki input[name=submit]').bind('click', function(){
          if ($("#wydruki input[name=nazwa]").val().length < 3
          || $("#wydruki input[name=adres]").val().length < 3
          || $("#wydruki input[name=przedstawiciel]").val().length < 3
          || $("#wydruki input[name=telefon]").val().length < 3
          || $("#wydruki input[name=kol_koszulka]").val().length < 3
          || ($("#wizualizacja_free input[name=email]").val().length > 3 && !isValidEmailAddress($("input[name='email']").val()))
          || liczSume() < 1)
               {
               alert('Proszę wypełnić formularz.');
               return false;
               }
               else
               {
               return true;
               }
     });

     $("#wydruki input.radio").change(function() { suma = liczSume();});
     $("#wydruki input.lib").keyup(function() { suma = liczSume();});

     function liczSume() {
          _liczba = $("#wydruki input[name=liczba]").val();
          _A = 0; _B = 0; _C = 0; _D = 0; _E = 0; _F = 0; _G = 0; _grafika = 0; _promo = 0;
          if ($("input[name='Ab']:checked").val() == 'tak')
               {
               if (_liczba < 10) { _A = _liczba * 6; cyfrA = _liczba; $("input[name='A']").val(cyfrA); }
               else { _A = 9 * 6 + (_liczba -9) * 2 * 6; cyfrA = 9 + (_liczba -9) * 2; }
               }
               else
               {
               $("input[name='A']").val('');
               }
          if ($("input[name='Bb']:checked").val() == 'tak')
               {
               if (_liczba < 10) { _B = _liczba * 3; cyfrB = _liczba; $("input[name='B']").val(cyfrB); }
               else { _B = 9 * 3 + (_liczba -9) * 2 * 3; cyfrB = 9 + (_liczba -9) * 2; }
               }
               else
               {
               $("input[name='B']").val('');
               }
          if ($("input[name='C']:checked").val() == 'tak')
               {
               _C = 6 * _liczba;
               }
          if ($("input[name='D']:checked").val() == '1')
               {
               _D = 6 * _liczba;
               }
               else if ($("input[name='D']:checked").val() == '2')
               {
               _D = 6 * 2 * _liczba;
               }               
          if ($("input[name='E']:checked").val() == 'tak')
               {
               _E = 12 * _liczba;
               }
               else if ($("input[name='E']:checked").val() == 'neo')
               {
               _A = 0;
               _promo = 1;
               }
          if ($("input[name='F']:checked").val() == 'tak')
               {
               _F = 10 * _liczba;
               }
          if ($("input[name='G']:checked").val() == 'tak')
               {
               _G = 10 * _liczba;
               }
          if ($("input[name='grafika']:checked").val() == 'tak' && _liczba > 0)
               {
               _grafika = 50;
               }
                                                                                                              
          _koszt = _A + _B + _C + _D + _E + _F + _G + _grafika;
          
          if (_koszt > 0 || _promo > 0)
               {
               $("#koszt").html('<strong>' + _koszt + '<strong> zł').removeClass('mini');
               $("input[name='wyceniono']").val(_koszt);
               }
               else
               {
               $("#koszt").html('wypełnij formularz').addClass('mini');
               }
          return _koszt;
     };

// WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI WYDRUKI KONIEC

     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);
	    }


/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////


     $('.slideshuffle').show();
     $('.slideshuffle').cycle({  
         speed: 300,
         timeout: 2800,
         pause: 1 
     });

     $('.slideshuffle1').show();
     $('.slideshuffle1').cycle({  
         speed: 400,
         timeout: 3000,
         pause: 1 
     });

     $('.slideshuffle2').show();
     $('.slideshuffle2').cycle({  
         speed: 600,
         timeout: 3200,
         pause: 1 
     });

     $('.slideshuffle3').show();
     $('.slideshuffle3').cycle({  
         speed: 700,
         timeout: 3400,
         pause: 1 
     });
     
     $('#sliderTOP').show();
     $('#sliderTOP').cycle({  
         fx: 'scrollDown',
         speed: 500,
         timeout: 10000,
         pause: 1,
         random: 1 
     });
     
     
     /*
     $('#turn').show();
     $('#turn').fold({side: 'right', directory: '/data/include/cms/'});
     $('#turn_fold').click(function(){
          var turnurl = $('#turnhref').attr('href');
          $(location).attr('href',turnurl);
          });
          
     if ($('#ticker').length > 0) $("#ticker").jStockTicker({interval: 20});
     if ($('#ticker2').length > 0) $("#ticker2").jStockTicker({interval: 20});     
     */

//$('div.n33024_links2').append('<li class="menu_item menu_mod_stroje"><a href="/info.php?page=228"><img alt="Stroje Piłkarskie" src="/data/include/cms/stroje_off.png" /></a></li>');
//$('div.n33024_links2').append('<li class="menu_item menu_mod_wyprzedaz"><a href="/Przecena-sdiscount-pol.html"><img alt="Wyprzedaż!" src="/data/include/cms/wyprzedaz_off.png" /></a></li>');
    
// SEOS

/*
if ($("div.n56245_breadcrumb").length > 0)
     {
     $("div.n56245_breadcrumb").children('a').each(function(){
          if ($(this).text() == 'Buty zimowe')
               {
               $('p#baner_pakolo_dostawa a img').attr('src', '/data/include/cms/podstrony/platnosc_wysylka/dostawa_pakolo_0.gif');
               } 
     });
     }
*/
_przedsprzedaz = false;

var tresc = document.title;
var opis = document.getElementsByName('description')[0].getAttribute('content');
var dane = tresc.split(' | ');
var link = location.href;
var dlugosc = dane.length;
var output;

if (document.domain.search("neosport") > 0)
     {


     if (tresc.search("Trampki Converse") >= 0 || tresc.search("Buty Converse") >= 0 || tresc.search("Obuwie Converse") >= 0
         //tresc.search("Obuwie Caterpillar") >= 0 || tresc.search("Buty Caterpillar") >= 0 ||
         //tresc.search("Obuwie Merrell") >= 0 || tresc.search("Buty Merrell") >= 0 ||
         //tresc.search("Buty Heavy Duty") >= 0 || tresc.search("Obuwie Heavy Duty") >= 0
         )
          {
          $('p#baner_pakolo_dostawa a img').attr('src', '/data/include/cms/podstrony/platnosc_wysylka/dostawa_pakolo_0.gif');
          }
    

     if (link.search("PILKARSKA") >= 0 || link.search("pilkarskie") >= 0 || link.search("Treningowe") >= 0 || link.search("Odziez-sportowa") >= 0 || link.search("reprezentacji") >= 0 )
          {
          $('#seos p#banerSEO').html('<a href="/Stroje-pilkarskie-NIKE-cinfo-pol-228.html"><img src="/data/include/cms/bannery/stroje_belka.jpg" border="0" /></a>');
          }
     
     if (tresc.search("PIŁKARSKA") >= 0 || tresc.search("piłkarskie") >= 0)
          {
          $('#seos p#banerSEO').html('<a href="/Stroje-pilkarskie-NIKE-cinfo-pol-228.html"><img src="/data/include/cms/bannery/stroje_belka.jpg" border="0" /></a>');
          $('.menu_buttons2_container_sub').append('<a href="/Stroje-pilkarskie-NIKE-cinfo-pol-228.html"><img src="/data/include/cms/bannery_stroje_pilkarskie/stroje_150x150.jpg" border="0" /></a>');
          
          }          
               
     if ($('button#projector_button_observe2.projector_buttons_no_s').length > 0)
          { 
          _nazwa = $('h1').html();
          _found = link.match('pol-([0-9]+)-');
          _podobne_text = '<p class="alert_no_s">Towar ' + _nazwa + ' nie jest w tej chwili dostępny.</p>';
          $('div.layout_content').prepend('<div class="pg1201"></div>');
          $.getJSON('http://neosport.home.pl/podobne/json.php?towar=' + _found[1] + '&name=' + _nazwa + '&callback=?', function(json) {
               _podobne_text += '<p class="alert_no_s">Zobacz wszystkie towary w kategorii: <strong><a href="' + json.menu.link + '">' + json.menu.name + '</a></strong>.</p>';                    
               _podobne_text += '<table class="search_results_mainpage2" cellspacing="0" cellpadding="0" align="left">';
               _podobne_text += '<tbody><tr>';
               $.each(json.towary, function(key, value) {
                    _podobne_text += '<td class="search_results_mainpage2_1" style="width: 25%;">';
                    _podobne_text += '<div class="n53716_main_search">';
                    _podobne_text += '<div></div>';
                    _podobne_text += '<div class="delivery_days_1"></div>';
                    _podobne_text += '<a href="' + value.url + '" title="' + value.nazwa + '" class="n53716_img">';
                    _podobne_text += '<img class="n53716" src="' + value.icon + '" border="0" alt="' + value['nazwa'] + '" /></a>';
                    _podobne_text += '<div class="n53716_prices2">';
                    _podobne_text += '<span class="n56221_price_txt">&nbsp;</span><span class="n56221_price_value">' + value.retail_price + 'zł</span>';
                    if (value.distinguished > 0) { _podobne_text += '<span class="n56221_price_dist">&nbsp;</span><span class="n56221_price_dist_val">' + value.distinguished + 'zł</span></div>'; }
                    _podobne_text += '<a href="' + value.url + '" target="_parent" title="' + value.nazwa + '" class="n53685_name2">' + value.nazwa + '</a></div>';
                    _podobne_text += '</td>';    
                    });               
               _podobne_text += '</tr></tbody></table><p style="clear:both;"><!-- --></p>';
               $('div.layout_content div.pg1201').html(_podobne_text);
               $("div.layout_content div.pg1201").animate({height: "270px"}, 1000 );
               });          
          
          }
     else if ($('div.amaunt_disable.amaunt_days_').length > 0)
          { 
          _nazwa = $('h1').html();
          _found = link.match('pol-([0-9]+)-');
          _podobne_text = '<p class="alert_no_s">Towar ' + _nazwa + ' będzie wkrótce dostępny.</p>';
          $('div.layout_content').prepend('<div class="pg1201"></div>');
          $.getJSON('http://neosport.home.pl/podobne/json.php?towar=' + _found[1] + '&name=' + _nazwa + '&callback=?', function(json) {
               _podobne_text += '<p class="alert_no_s">Zobacz dostępne towary w kategorii: <strong><a href="' + json.menu.link + '">' + json.menu.name + '</a></strong>.</p>';                    
               _podobne_text += '<table class="search_results_mainpage2" cellspacing="0" cellpadding="0" align="left">';
               _podobne_text += '<tbody><tr>';
               $.each(json.towary, function(key, value) {
                    _podobne_text += '<td class="search_results_mainpage2_1" style="width: 25%;">';
                    _podobne_text += '<div class="n53716_main_search">';
                    _podobne_text += '<div></div>';
                    _podobne_text += '<div class="delivery_days_1"></div>';
                    _podobne_text += '<a href="' + value.url + '" title="' + value.nazwa + '" class="n53716_img">';
                    _podobne_text += '<img class="n53716" src="' + value.icon + '" border="0" alt="' + value['nazwa'] + '" /></a>';
                    _podobne_text += '<div class="n53716_prices2">';
                    _podobne_text += '<span class="n56221_price_txt">&nbsp;</span><span class="n56221_price_value">' + value.retail_price + 'zł</span>';
                    if (value.distinguished > 0) { _podobne_text += '<span class="n56221_price_dist">&nbsp;</span><span class="n56221_price_dist_val">' + value.distinguished + 'zł</span></div>'; }
                    _podobne_text += '<a href="' + value.url + '" target="_parent" title="' + value.nazwa + '" class="n53685_name2">' + value.nazwa + '</a></div>';
                    _podobne_text += '</td>';    
                    });               
               _podobne_text += '</tr></tbody></table><p style="clear:both;"><!-- --></p>';
               $('div.layout_content div.pg1201').html(_podobne_text);
               $("div.layout_content div.pg1201").animate({height: "270px"}, 1000 );
               });          
          
          }
        
     var _karuzela = '<p style="text-align: center; margin: 10px 0 20px;"><img src="/data/include/cms/podstrony/karuzela/carousel_napis2.jpg" border="0" /></p><div id="rozmiary" class="rozmiary_podstrona"><a id="mniejsze" href="/tra-pol-1235035137-Wiosna-2010.html" title="mniejsze rozmiary"></a><div id="slids"><div id="slidser"><a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=S">20</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=Q">21</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=I">22</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=M" class="half">22.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=L">23</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=J" class="half">23.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=391">24</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=D" class="half">24.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=368">25</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=369" class="half">25.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=371">26</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=372" class="half">26.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=373">27</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=370" class="half">27.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=374">28</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=375" class="half">28.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=81">29</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=376" class="half">29.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=377">30</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=378">31</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=379" class="half">31.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=380">32</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=10" class="half">32.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=381">33</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=382" class="half">33.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=383">34</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=365" class="half">34.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=366">35</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=388" class="half">35.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=76">36</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=77" class="half">36.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=367">37</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=78" class="half">37.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=79">38</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=80" class="half">38.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=318">39</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=386" class="half">39.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=319">40</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=88" class="half">40.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=89">41</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=91">42</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=92" class="half">42.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=93">43</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=94">44</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=95" class="half">44.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=96">45</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=97" class="half">45.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=98">46</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=384" class="half">46.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=99">47</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=287" class="half">47.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=T">48</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=385" class="half">48.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=V">49</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=389" class="half">49.5</a> <a href="/tra-pol-1217920972-Buty-sportowe.html?filter_sizes=P">50</a></div></div><a id="wieksze" href="/tra-pol-1235035137-Wiosna-2010.html" title="większe rozmiary"></a></div><p style="clear:both; margin-bottom: 10px;"><!-- --></p>';

     $('div#page_searching div.projector_help').prepend(_karuzela);
     $('div#page_wishesedit div.projector_help').prepend(_karuzela);



     // PRZEDSPRZEDAŻ

     if (link.search("product-pol-21280") >= 0 
      || link.search("product-pol-21281") >= 0
      || link.search("product-pol-21282") >= 0
      || link.search("product-pol-21295") >= 0
      || link.search("product-pol-21294") >= 0)
          {
          _przedsprzedaz = true;
          //$('div.layout_content').prepend('<div id="przespPG1">przedsprzedaż!</div>');
          $('div.amaunt_icons').html('<div id="przespPG2"><img src="/data/include/cms/euro2012/przedsprzedaz_euro_logo.png"></div>');
          $('p#baner_pakolo_dostawa a img').attr('src', '/data/include/cms/euro2012/dostawa_pakolo_euro.gif');
          $('object#linkicon').remove(); 
          }     
     }
     // PRZEDSPRZEDAŻ koniec     
     
if (document.domain.search("neosport") > 0 || document.domain.search("futbolowo") > 0)
     {
     
     if (link.search("pol-393") >= 0)
          {
          $('#seos p#banerSEO').html('<a href="/pol_m_Marki_sklep-REPREZENTACJI-POLSKI-7245.html"><img src="/data/include/cms/euro2012/euro_baner.jpg" border="0" /></a>');
          }
     
     if (link.search("product-pol-23948") >= 0 
      || link.search("product-pol-23949") >= 0
      || link.search("product-pol-23950") >= 0)
          {     
          $('p#baner_pakolo_dostawa a img').attr('src', '/data/include/cms/podstrony/platnosc_wysylka/dostawa_pakolo_0.gif');
          }     
     }   




 
// zegar zegar zegar zegar zegar zegar zegar zegar zegar zegar zegar zegar zegar zegar zegar zegar zegar zegar zegar  

var StopHour = 14;
var StopMinute = 00;

// ustawienie tej zmiennej na true powoduje przestawienie wysyłki na poniedziałek 14.00, normalna wartość to false
var holiday = false;

var magTime = {};
magTime[1] = "najbliższa wysyłka dziś, za";
magTime[2] = "najbliższa wysyłka już za";
magTime[3] = "wysyłka w poniedziałek, o";

var textDay = new Array("niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota");

PrintTime();
function PrintTime() 
     {
     var time = new Date();
     
     var d_day = time.getDate();
     if (d_day < 10) { d_day = "0" + d_day; }
     var d_month = time.getMonth() + 1;
     if (d_month < 10) { d_month = "0" + d_month; }
     var d_year = time.getFullYear();
     
     var day = time.getDay();
     var hour = time.getHours();
     var minute = time.getMinutes();
     var second = time.getSeconds();
     var sm = StopMinute-1;
     var sh = StopHour;
     ss = 60 - second;
  
     if (ss == 60) 
          {
          sm = sm + 1;
          ss = 0;
          }
     if (minute > sm) 
          {
          sm = sm + 60;
          sh = sh-1;
          }
          
     var toDeliverH = sh - hour;
     var toDeliverM = sm - minute;
   
     if ((toDeliverH < 0) || day ==6 || day==0) 
          {
          // nie wysylamy
          var txt = magTime[2];
          if (day ==5 || day==6 || day == 0 || holiday) 
               {
               txt = magTime[3];
               if (day == 5) { toDeliverH = toDeliverH + 48; } 
               else if (day == 6) { toDeliverH = toDeliverH + 24; }
               }
          toDeliverH = toDeliverH + 24;
          if (ss < 10) { ss = "0" + ss; }
          if (toDeliverM < 10) { toDeliverM = "0" + toDeliverM; }
          if (toDeliverH < 10) { toDeliverH = "0" + toDeliverH; }
          $("#time_hour").html(toDeliverH + ":" + toDeliverM + ":" + ss);
          
          if (day ==5 || day==6 || day == 0 || holiday) 
               {
               $("#time_hour").html("14:00:00");
               }
          $("#time_txt").html(txt);
          }
          else
          {
          // wysylamy
          if (ss < 10) { ss = "0" + ss; }
          if (toDeliverM < 10) { toDeliverM = "0" + toDeliverM; }
          if (toDeliverH < 10) { toDeliverH = "0" + toDeliverH; }
          $("#time_hour").html(toDeliverH + ":" + toDeliverM + ":" + ss);
          $("#time_txt").html(magTime[1]);
          }
     
     if ($('#karta_time').length > 0)
          {
          _karta_kiedy = 'dziś';
          if (toDeliverH >= StopHour && ($('.amaunt_days_0').length > 0 || $('.amaunt_days_1').length > 0)) { _karta_kiedy = '24h'; }
          
          if ($('.amaunt_days_2').length > 0) _karta_kiedy = '48h';
          if ($('.amaunt_days_3').length > 0) _karta_kiedy = '72h';
          if ($('.amaunt_days_5').length > 0) _karta_kiedy = '5 dni';
          if ($('.amaunt_days_14').length > 0) _karta_kiedy = '14 dni';
          
          if (_karta_kiedy == 'dziś' && toDeliverH >= 1)
               {
               _karta_kiedy = 'za ' + toDeliverH + 'h';
               if (toDeliverH[0] == 0) _karta_kiedy = 'za ' + toDeliverH[1] + 'h';
               }
          if (_karta_kiedy == 'dziś' && toDeliverH < 1 && toDeliverM > 1)
               {
               _karta_kiedy = 'za ' + toDeliverM + ' min.';
               if (toDeliverM[0] == 0) _karta_kiedy = 'za ' + toDeliverM[1] + ' min.';
               }
          
          //_karta_time = 'stan na ' + textDay[day] + ' ' + d_day + '.' + d_month + '.' + d_year;
          _karta_time = 'stan na <strong>dziś</strong> ' + d_day + '.' + d_month + '.' + d_year;
          if ($('.amaunt_new_collection').length != 1 && $('.amaunt_disable').length != 1) _karta_time += '<br><strong style="font-size: 10px;">wysyłka ' + _karta_kiedy + ' <span>Zamów teraz!</span></strong>';
          if (_przedsprzedaz == true)
               {
               $("p#karta_time").html('<div id="przespPG4"><strong style="color: #cc1130;">PRZEDSPRZEDAŻ!</strong><br><strong style="color: black;">dostawa styczeń 2012</strong></div>');
               }
               else
               {
               $("p#karta_time").html(_karta_time);
               }
          
          }
     setTimeout(PrintTime, 250);
     }

}); 
