

function PreLoadZ()
{
picAA1= new Image(); picAA1.src="http://www.musicimport.pl/gfx/tabs/AA1.gif";
picAA2= new Image(); picAA2.src="http://www.musicimport.pl/gfx/tabs/AA2.gif";
picAA3= new Image(); picAA3.src="http://www.musicimport.pl/gfx/tabs/AA3.gif";

}







//************SuperBaner******************************************************************
var nrSB_tmp=0;
var CzasSB=2000;
var tSB;
var LiczSekundy=0;

function GetSB(nr, UserClick)
{
 //gasimy wszystkie
 for(i=1;i<=MaxSuperBanerSlides;i++) { theobj= $("#Slide"+i);  theobj.hide(); }

 //odpla tylko kliknieta
 theobjActive= $("#Slide"+nr);
 if(SBtyp[nr]=='swf') {  eval("hot"+nr+".write('Slide"+nr+"')"); }
 theobjActive.fadeIn(800);



 //wylacz btn OFF
 for(i=1;i<=MaxSuperBanerSlides;i++)
 {
 $("#btnSB"+i).attr('src','ico/superbaner/'+i+'off.gif');
 }

 //aktuwny napis
 $("#btnSB"+nr).attr('src','ico/superbaner/'+nr+'on.gif');


 nrSB_tmp=nr;
 if(UserClick==1) {  sb_next=parseInt(nr);}
 LiczSekundy=0;
}

//-------------------

//--ruch-------------------------------------------
var sb_next=0;
var ActiveMove=1;

function MoveSB()
{
 sb_next=sb_next+1;

 if(sb_next>MaxSuperBanerSlides) { sb_next=1; }


  if(sb_next==1) {CzasSB=2000;}
  if(sb_next==2) {CzasSB=5000;}
  if(sb_next==3) {CzasSB=10000;}

 //var tSB=setTimeout("MoveSB()",CzasSB);
 GetSB(sb_next,0);
}










function Sekundy()
{
 var tSB=setTimeout("Sekundy()",1000);
 LiczSekundy++;

 if(LiczSekundy>SBczas[nrSB_tmp]) {  MoveSB(); }
 //$('#Test').text(LiczSekundy+' '+SBczas[nrSB_tmp]);
}
//---------------------------------------------

//************END SuperBaner******************************************************************



















//dodaj komentarz
function addComment(id_foto)
{
$('#SaveProcess').show();

$.post("inc/ajax_komentarz.php", { id_foto: id_foto, komentarz: $('#komentarz').val(), action: 'add' },
    function(data)
    {
     if(data.status==99)
     {
     $('#komentarz').val('');
     $('#SaveProcess').html(data.info);
     window.location.reload();
     }else{
          $('#SaveProcess').html(data.info);
          }
    },
    "json"
  );
}








//wyslij kontakt
function SendKontakt()
{


if($('#emailK').val()!='' && $('#imieK').val()!='' && $('#trescK').val()!='')
{
$('#PopUpLoader').show();

$.post("inc/ajax_wyslij_kontakt.php", { email:$('#emailK').val(), imie:$('#imieK').val(), tresc:$('#trescK').val(), action: 'kontakt' },
    function(data)
    {
    $('#kontaktBox').text(data);
    }
  );
}else{
     alert('proszę wypełnić formularz');
     }


}
//---------------------













//baner top layer-----------
function close_baner()
{
var theobj= eval ('document.getElementById("Reklama")');
theobj.innerHTML='';
theobj.style.display='none';
}

//close po x sec.
function CloseAfter(sec)
{
 var tgx=setTimeout("close_baner()",sec*1000);
}
//----------------------






function ChClass(divid,newclass)
{
 theobj= eval ('document.getElementById("'+divid+'")');
 theobj.className= newclass;
}














//dodaj do porownania
function addToCompare(id_towar,id_struktura_www)
{
if(id_towar>0)
{
$('#Compare'+id_towar).text('proszę czekać...');

$.post("inc/ajax_compare.php", { id_towar:id_towar, id_struktura_www:id_struktura_www, action: 'add' },
    function(data)
    {
    $('#Compare'+id_towar).html(data);
    }
  );
}

}




//usun z porownania
function delFromCompare(id_towar,id_struktura_www)
{
if(id_towar>0)
{
$('#Compare'+id_towar).text('proszę czekać...');

$.post("inc/ajax_compare.php", { id_towar:id_towar, id_struktura_www:id_struktura_www, action: 'del' },
    function(data)
    {
    $('#Compare'+id_towar).html(data);
    }
  );
}

}












//zapytaj
function SendPytanie(id_towar,rodzaj)
{

if($('#emailZ').val()!='' && $('#imieZ').val()!='' && $('#trescZ').val()!='')
{

 if($('#ok:checked').val()==1)
 {
  $('#PopUpLoader').show();
  $.post("inc/ajax_zapytaj.php", { id_towar: id_towar, email:$('#emailZ').val(), imie:$('#imieZ').val(), tresc:$('#trescZ').val(), action: rodzaj },
    function(data)
    {
    $('#zapytanieBox').text(data);
    }
  );
 }else{
      alert('Prosimy o wyrażenie zgody na przetwarzanie danych')
      }

}else{
     alert('proszę wypełnić formularz');
     }

}

































function sprintf()
{
   if (!arguments || arguments.length < 1 || !RegExp)
   {
      return;
   }
   var str = arguments[0];
   var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
   var a = b = [], numSubstitutions = 0, numMatches = 0;
   while (a = re.exec(str))
   {
      var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4];
      var pPrecision = a[5], pType = a[6], rightPart = a[7];

      numMatches++;
      if (pType == '%')
      {
         subst = '%';
      }
      else
      {
         numSubstitutions++;
         if (numSubstitutions >= arguments.length)
         {
            alert('Error! Not enough function arguments (' + (arguments.length - 1)
               + ', excluding the string)\n'
               + 'for the number of substitution parameters in string ('
               + numSubstitutions + ' so far).');
         }
         var param = arguments[numSubstitutions];
         var pad = '';
                if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1);
           else if (pPad) pad = pPad;
         var justifyRight = true;
                if (pJustify && pJustify === "-") justifyRight = false;
         var minLength = -1;
                if (pMinLength) minLength = parseInt(pMinLength);
         var precision = -1;
                if (pPrecision && pType == 'f')
                   precision = parseInt(pPrecision.substring(1));
         var subst = param;
         switch (pType)
         {

         case 'b':
            subst = parseInt(param).toString(2);
            break;
         case 'c':
            subst = String.fromCharCode(parseInt(param));
            break;
         case 'd':
            subst = parseInt(param) ? parseInt(param) : 0;
            break;
         case 'u':
            subst = Math.abs(param);
            break;
         case 'f':
            subst = (precision > -1)
             ? Math.round(parseFloat(param) * Math.pow(10, precision))
              / Math.pow(10, precision)
             : parseFloat(param);
            break;
         case 'o':
            subst = parseInt(param).toString(8);
            break;
         case 's':
            subst = param;
            break;
         case 'x':
            subst = ('' + parseInt(param).toString(16)).toLowerCase();
            break;
         case 'X':
            subst = ('' + parseInt(param).toString(16)).toUpperCase();
            break;
         }
         var padLeft = minLength - subst.toString().length;
         if (padLeft > 0)
         {
            var arrTmp = new Array(padLeft+1);
            var padding = arrTmp.join(pad?pad:" ");
         }
         else
         {
            var padding = "";
         }
      }
      str = leftpart + padding + subst + rightPart;
   }
   return str;
}

//---------------------------------------------































//----sortowanie
function SetSort(typ)
{
$.post("inc/ajax_sort.php", { typ:typ, action: 'sesort' },
    function(data)
    {
     window.location.reload();
    }
  );


}












//kontakt
function SendEmailKontakt() {

$('#KomunikatKontakt').text('proszę czekać...').fadeIn(400);

if($('#k_email').val()!='' && $('#k_temat').val()!='' && $('#k_pytanie').val()!='')
{
$.post("inc/ajax_email_kontakt.php", { firma:$('#k_firma').val(), imie:$('#k_imie').val(), telefon:$('#k_telefon').val(), email:$('#k_email').val(), miasto:$('#k_miasto').val(), temat:$('#k_temat').val(), priorytet:$('#k_priorytet').val(), pytanie:$('#k_pytanie').val(), action: 'kontakt' },
    function(data)
    {
    $('#KomunikatKontakt').text(data);
    }
  );
}else{
      $('#KomunikatKontakt').text('proszę wypełnić formularz');
      $('#KomunikatKontakt').fadeOut(3000);
     }

}








//--------------------------------------------------------
var nr_tmp=0;
var t;
var stop=0;
var IdDivG=0;
var ColorOn='#ff0000';
var ColorOff='#A8A8A8';
var ClassOn='On';
var ClassOff='Off';

//typ A B C
//zakladki-------
function GetZ(elem,nr,typ,max,url)
{
 //gasimy wszystkie
 for(i=1;i<=max;i++) { theobj= $("#"+elem+i);  theobj.hide(); }

 //odpla tylko kliknieta
 theobjActive= $("#"+elem+nr);  theobjActive.fadeIn(800);
 //theobjActive= $("#"+elem+nr);  theobjActive.show();


 //tlo zakladek
 $("#dzial_"+elem).css({'background' : '#ffffff url(/gfx/tabs/'+typ+nr+'.gif) no-repeat'});


 if(nr==1) { $('#see_more').html('<a href="aktualnosci,0,1.html">zobacz wszystkie</a>'); }
 if(nr==2) { $('#see_more').html('<a href="artykuly,0,1.html">zobacz wszystkie</a>'); }
 if(nr==3) { $('#see_more').html('<a href="testy,0,1.html">zobacz wszystkie</a>'); }


 //wylacz napisy OFF ustaw odpowiednie
 for(i=1;i<=max;i++)
 {
 //$("#img_"+elem+i).attr('src','gfx/tabs/btn'+i+typ+tlo[i]+'.gif');
 }


 //aktuwny napis
 //$("#img_"+elem+nr).attr('src','gfx/tabs/btn'+nr+typ+'on.gif');



 if(nr_tmp==nr && typ_tmp==typ) //adres kategorii
 {
 var urlgo='';
 if(url!='') {  top.location.href = url; }
 if(nr==1 && elem=='zak') { urlgo='#';}
 if(nr==2 && elem=='zak') { urlgo='#';}
 if(nr==3 && elem=='zak') { urlgo='#';}
 //if(urlgo!='') { top.location.href = urlgo; }
 }
 nr_tmp=nr; typ_tmp=typ; t=0;
}

//-------------------








//zakladki-------
function Zakladki6000(elem,nr,tlo,typ,max,url)
{
 //gasimy wszystkie
 for(i=1;i<=max;i++) { theobj= $("#"+elem+i);  theobj.hide(); }

 //odpla tylko kliknieta
 theobjActive= $("#"+elem+nr);  theobjActive.fadeIn(800);
 //theobjActive= $("#"+elem+nr);  theobjActive.show();


 //tlo zakladek
 //$("#dzial_"+elem).css({'background' : '#ffffff url(/gfx/tabs/'+typ+nr+'.gif) no-repeat'});



 //wylacz napisy OFF ustaw odpowiednie
 for(i=1;i<=max;i++)
 {
 statusBtn=parseInt(i-1);
 //if(i==1){alert(statusBtn+' '+tlo.indexOf(statusBtn))}
 $("#img_"+typ+i).attr('src','gfx/tabs/btn'+i+typ+tlo.charAt(statusBtn)+'.gif');
 }

 nr_tmp=nr; typ_tmp=typ; t=0;
}

//-------------------












//--zakladki home - ruch-------------------------------------------
var tab_next=0;
var MaxTab=3;
var ActiveMove=1;

function MoveTab()
{
 if(ActiveMove==1) { tab_next=tab_next+1; }
 var t=setTimeout("MoveTab()",CzasTab);
 if(ActiveMove==1) { GetZ('zakA',tab_next,'AA',3,'#'); }
 if(tab_next>=MaxTab) { tab_next=0; }
}

//---------------------------------------------








function NewsletterGo()
{
 if($('#ok:checked').val()==1)
 {
 $('#formularzn').submit();
 }else{
      alert('Prosimy o wyrażenie zgody na przetwarzanie danych')
      }
}















//--wiadomosc ------------------------------
function setProducent(URLparam, URLkat, URLproducent) {

if($('#IDproducent').val()>=0)
{
var url=URLparam+',0,'+URLkat+','+$('#IDproducent').val()+',0,P,produkty.html';
$('#FormProducent').text('Proszę czekać...');
top.location.href = url;
}

}
//-----------------------------------------------
































//wyslij znajomemu
function SendZnajomy()
{

if($('#emailnWZ').val()!='' && $('#emailoWZ').val()!='' && $('#trescWZ').val()!='')
{
$('#PopUpLoader').show();

$.post("inc/ajax_wyslij_znajomemu.php", { emailn:$('#emailnWZ').val(), emailo:$('#emailoWZ').val(), tresc:$('#trescWZ').val(), action: 'znajomy' },
    function(data)
    {
    $('#znajomyBox').text(data);
    }
  );
}else{
     alert('proszę wypełnić formularz');
     }

}

















//dodaj skllep
function AddSklep()
{

if($('#emailS').val()!='' && $('#sklepS').val()!='' && $('#adresS').val()!='' && $('#kod_pocztowyS').val()!='' && $('#miastoS').val()!='' && $('#id_wojewodztwoS').val()!='' && $('#telefonS').val()!=''  && $('#wwwS').val()!='' )
{
$('#PopUpLoader').show();

$.post("inc/ajax_dodaj_sklep.php", { email:$('#emailS').val(), sklep:$('#sklepS').val(), adres:$('#adresS').val(), kod_pocztowy:$('#kod_pocztowyS').val(), miasto:$('#miastoS').val(), id_wojewodztwo:$('#id_wojewodztwoS').val(), telefon:$('#telefonS').val(), www:$('#wwwS').val(), action: 'sklep' },
    function(data)
    {
    $('#znajomyBox').text(data);
    }
  );
}else{
     alert('proszę wypełnić formularz');
     }

}














//zmien logo na activ
function FireLogo(IdImg,SrcImg)
{





 $("#"+IdImg).attr('src','gfx/'+SrcImg);
 //$("#"+IdImg).animate({ opacity: 0.5 }, 1000);

}
//---------------