function wndSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return [ myWidth, myHeight ];
}
function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}
function ZapalTlo(targetId,filename){
 if (document.getElementById){
  target = document.getElementById( targetId );
  document.images[targetId].src=filename;
 }
}
function ZgasTlo(targetId,filename){
 if (document.getElementById){
  target = document.getElementById( targetId );
  document.images[targetId].src=filename;
 }
}
function wysun(id)
{
document.getElementById(id).style.display = (document.getElementById(id).style.display == 'none') ? 'block' : 'none';
}
function wysun2(id)
{
var kid="k"+id
document.getElementById(kid).style.display = (document.getElementById(kid).style.display == 'none') ? 'block' : 'none';
document.getElementById(kid).style.fontWeight = (document.getElementById(kid).style.fontWeight == 'normal') ? 'bold' : 'normal';
}
function pokarz_bird(id)
{
var iid="i"+id;
document.getElementById(iid).style.display = (document.getElementById(iid).style.display == 'none') ? 'inline' : 'none';
}
function wysun_kategorie(kategorie)
  {
  if (kategorie !="")
    {
    var tablica=new Array();
    tablica=kategorie.split("_");
    var ilosc=tablica.length-1;
    for(var i = 0; i <=ilosc ; i++)
       {
       if ( i<ilosc )wysun2(tablica[i]);
       if ( i<=ilosc )pokarz_bird(tablica[i]);
       }
    }
  }
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=no,scrollbars=no,menubar=no,left=0,top=0');
}
function displayWindowS(url, width, height) {
       var Win = window.open(url,"displayWindowS",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=no' );
}
function displayWindowSS(url, width, height) {
       //var sts = window.open(url','newwin','');
       var Win = window.open(url,"displayWindowS",'width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes,menubar=no' );
}
function rowOverEffect(object) {
  if (object.className == "katRow") object.className ="modulekatOver";
}
function rowOutEffect(object) {
  if (object.className == "modulekatOver") object.className = "katRow";
}
function przepisz_ulice()
  {
  document.getElementById("a_ulica").value=document.getElementById("k_ulica").value;
  }
function przepisz_kod()
  {
  document.getElementById("a_kod").value=document.getElementById("k_kod").value;
  }
function przepisz_miasto()
  {
  document.getElementById("a_miasto").value=document.getElementById("k_miasto").value;
  }
function przepisz_telefon()
  {
  document.getElementById("a_telefon").value=document.getElementById("k_telefon").value;
  }
  
  
function sprawdz_pola_paragon()
  {
  var formularz=document.getElementById("kasa");
  if (document.getElementById("sposob_platnosci1").checked==false && document.getElementById("sposob_platnosci2").checked==false)
    {
    formularz.action='paragon.php#x1';
    }
  else if (
   document.getElementById("k_ulica").value=="" ||
   document.getElementById("k_kod").value=="" ||
   document.getElementById("k_miasto").value=="" ||
   document.getElementById("k_telefon").value=="")
    {
    formularz.action='paragon.php#x2';
    }
  else if (
   document.getElementById("a_ulica").value=="" ||
   document.getElementById("a_kod").value=="" ||
   document.getElementById("a_miasto").value=="" ||
   document.getElementById("a_telefon").value=="")
    {
    formularz.action='paragon.php#x3';
    }
  else if (document.getElementById("regulamin").checked==false)
    {
    formularz.action='paragon.php#x4';
    }
  }
function sprawdz_pola_faktura()
  {
  var formularz=document.getElementById("kasa");
  if (document.getElementById("sposob_platnosci1").checked==false && document.getElementById("sposob_platnosci2").checked==false)
    {
    formularz.action='faktura_imienna.php#x1';
    }
  else if (
   document.getElementById("k_ulica").value=="" ||
   document.getElementById("k_kod").value=="" ||
   document.getElementById("k_miasto").value=="" ||
   document.getElementById("k_telefon").value=="")
    {
    formularz.action='faktura_imienna.php#x2';
    }
  else if (
   document.getElementById("a_ulica").value=="" ||
   document.getElementById("a_kod").value=="" ||
   document.getElementById("a_miasto").value=="" ||
   document.getElementById("a_telefon").value=="")
    {
    formularz.action='faktura_imienna.php#x3';
    }
  else if (document.getElementById("regulamin").checked==false)
    {
    formularz.action='faktura_imienna.php#x4';
    }             //f_imie_nazwisko,f_ulica_numer,f_kod,f_miasto
  else if (
    document.getElementById("f_imie_nazwisko").value=="" ||
   document.getElementById("f_ulica_numer").value=="" ||
   document.getElementById("f_kod").value=="" ||
   document.getElementById("f_miasto").value=="")
    {
    formularz.action='faktura_imienna.php#x5';
    }
    
  }
  
  
function sprawdz_pola_vat()
  {
  var formularz=document.getElementById("kasa");
  if (document.getElementById("sposob_platnosci1").checked==false && document.getElementById("sposob_platnosci2").checked==false)
    {
    formularz.action='faktura_vat.php#x1';
    }
  else if (
   document.getElementById("k_ulica").value=="" ||
   document.getElementById("k_kod").value=="" ||
   document.getElementById("k_miasto").value=="" ||
   document.getElementById("k_telefon").value=="")
    {
    formularz.action='faktura_vat.php#x2';
    }
  else if (
   document.getElementById("a_ulica").value=="" ||
   document.getElementById("a_kod").value=="" ||
   document.getElementById("a_miasto").value=="" ||
   document.getElementById("a_telefon").value=="")
    {
    formularz.action='faktura_vat.php#x3';
    }
  else if (document.getElementById("regulamin").checked==false)
    {
    formularz.action='faktura_vat.php#x4';
    }
  else if (
    document.getElementById("f_imie_nazwisko").value=="" ||
   document.getElementById("f_ulica_numer").value=="" ||
   document.getElementById("f_kod").value=="" ||
   document.getElementById("f_miasto").value=="" ||
   document.getElementById("f_nip").value==""
   )
    {
    formularz.action='faktura_vat.php#x5';
    }
  }
function odznacz_pojedyncze()
  {
  document.getElementById("nowosc").checked=false;
  document.getElementById("promocja").checked=false;
  document.getElementById("popularne").checked=false;
  document.getElementById("polecane").checked=false;
  document.getElementById("na_prezent").checked=false;
  }
  
function odznacz()
  {
  document.getElementById("wszystkie").checked=false;
  }
  
function sprawdz_dlugosc()
  {
  var tekst=document.getElementById('slowo').value;
  if (tekst.length<3)
    document.getElementById('tekst').style.display='block';
  else
    document.formularz.submit();
  }
function podglad_zdjecia(id,opis)
  {
   $("nw_tytul").innerHTML=opis;
   $("nw_zawartosc").innerHTML = "";
   
  pwidth=750; pheight=550;
  $("nw_popup").style.width=pwidth+"px";
  $("nw_popup").style.height=pheight+"px";
  $("nw_zawartosc").style.width="96%";
  $("nw_zawartosc").style.height="83%";
  var scrl=getScrollXY();
  var wSize=wndSize();
  $("nw_popup").style.left=Math.round(scrl[0]+(wSize[0]-pwidth)/2)+"px";
  $("nw_popup").style.top=Math.round(scrl[1]+(wSize[1]-pheight)/2)+"px";
  var req = mint.Request();
   req.AddParam("id", id);
    req.OnTimeout=function() {
	alert("Serwer ma problemy z odebraniem zapytania. Spróbuj za chwilę.");
    }
  req.OnLoading =
    function()
    {
    $("nw_popup").style.display="block";
    $("nw_zawartosc").innerHTML = "<table width='99%'><tr><td align='center'><img src='images/ajax-loader.gif' border='0' alt=''> Ładuję ...</td></tr></table>";
    }
    
   req.OnSuccess= function()
     {
     $("nw_popup").style.left=($("strona").style.width-$("nw_popup").style.width)/2;
     $("nw_popup").style.display="block";
     }
     
   req.Send("powieksz_zdjecie.php","nw_zawartosc");
  }
function porownanie(zakladka,id,opis)
  {
  $("nw_tytul").innerHTML=opis;
  $("nw_zawartosc").innerHTML = "";
  pwidth=750; pheight=550;
  if (zakladka != 'usun')	
  {
  $("nw_popup").style.width=pwidth+"px";
  $("nw_popup").style.height=pheight+"px";
  var scrl=getScrollXY();
  var wSize=wndSize();
  $("nw_popup").style.left=Math.round(scrl[0]+(wSize[0]-pwidth)/2)+"px";
  $("nw_popup").style.top=Math.round(scrl[1]+(wSize[1]-pheight)/2)+"px";
  }
  var req = mint.Request();
  req.OnLoading =
    function()
    {
    $("nw_popup").style.display="block";
    $("nw_zawartosc").innerHTML = "<table width='99%'><tr><td align='center'><img src='images/ajax-loader.gif' border='0' alt=''> Ładuję ...</td></tr></table>";
    }
   req.AddParam("products_id", id);
   req.AddParam("zakladka", zakladka);
   req.Send("dodaj_do_porownania.php","nw_zawartosc");
  }
function zaladuj(strona)
  {
  var req = mint.Request();
  req.OnLoading =
    function()
    {
    $("nw_zawartosc").innerHTML = "<table width='99%'><tr><td align='center'><img src='images/ajax-loader.gif' border='0' alt=''> Ładuję ...</td></tr></table>";
    }
  req.Send(strona,"nw_zawartosc");
  }
  
function nw_popup(strona,opis,pwidth,pheight)
  {
  $("nw_popup").style.display="block";
  $("nw_popup").style.width=pwidth+"px";
  $("nw_popup").style.height=pheight+"px";
  var scrl=getScrollXY();
  var wSize=wndSize();
  $("nw_popup").style.left=Math.round(scrl[0]+(wSize[0]-pwidth)/2)+"px";
  $("nw_popup").style.top=Math.round(scrl[1]+(wSize[1]-pheight)/2)+"px";
  $("nw_zawartosc").style.height=Math.round(pheight*0.83)+"px";
  $("nw_tytul").innerHTML=opis;
  var req = mint.Request();
  req.OnTimeout=function() {
	alert("Serwer ma problemy z odebraniem zapytania. Spróbuj za chwilę.");
	}
  req.OnLoading =
    function()
    {
    $("nw_zawartosc").innerHTML = "<table width='99%'><tr style='height:100%;'><td align='center'><img src='images/ajax-loader.gif' border='0' alt=''> Ładuję ...</td></tr></table>";
    }
   req.Send(strona,"nw_zawartosc");
  }
function popup(id,str,opis,pwidth,pheight)
  {
  $("nw_popup").style.display="block";
  $("nw_popup").style.width=pwidth+"px";
  $("nw_popup").style.height=pheight+"px";
  var scrl=getScrollXY();
  var wSize=wndSize();
  $("nw_popup").style.left=Math.round(scrl[0]+(wSize[0]-pwidth)/2)+"px";
  $("nw_popup").style.top=Math.round(scrl[1]+(wSize[1]-pheight)/2)+"px";
  $("nw_zawartosc").style.height=Math.round(pheight*0.83)+"px";
  $("nw_tytul").innerHTML=opis;
  $("nw_zawartosc").innerHTML = "";
  var req = mint.Request();
  
  req.AddParam("id", id);
  req.AddParam("str", str);
  req.OnLoading =
    function()
    {
    $("nw_zawartosc").innerHTML = "<table width='99%'><tr style='height:100%;'><td align='center'><img src='images/ajax-loader.gif' border='0' alt=''> Ładuję ...</td></tr></table>";
    }
   req.Send('popupy.php',"nw_zawartosc");
  }
  
function nw_close()
  {
  var req = mint.Request();
  req.Send('pasek_klienta.php',"pasek_klienta");
  var req2 = mint.Request();
  req2.Send('zaloguj_wyloguj.php',"zaloguj_wyloguj");
  $("nw_popup").style.display="none";
  }
function SendRequest(formularz,parametr1,parametr2) {
    var req = mint.Request();
    req.AddParam("akcja", parametr1);
    req.AddParam("akcja2", parametr2);
    req.OnSuccess = function() {
        $("nw_zawartosc").innerHTML = this.responseText;
    }
    req.SendForm(formularz);
}
function do_koszyka(formularz,parametr1) {
  $("nw_popup").style.display="block";
  pwidth=750; pheight=550;
  $("nw_popup").style.width=pwidth+"px";
  $("nw_popup").style.height=pheight+"px";
  var scrl=getScrollXY();
  var wSize=wndSize();
  $("nw_popup").style.left=Math.round(scrl[0]+(wSize[0]-pwidth)/2)+"px";
  $("nw_popup").style.top=Math.round(scrl[1]+(wSize[1]-pheight)/2)+"px";
  $("nw_zawartosc").style.height=Math.round(pheight*0.83)+"px";
  $("nw_tytul").innerHTML="panel klienta";
  $("nw_zawartosc").innerHTML = "";
    var req = mint.Request();
    req.AddParam("akcja", parametr1);
    req.OnSuccess = function() {
        $("nw_zawartosc").innerHTML = this.responseText;
    }
    req.SendForm(formularz);
}
function powiadom(strona)
  {
  var req = mint.Request();
  req.Send(strona,"powiadom");
  }
  
function zarejestruj(formularz,parametr1)
  {
    var req = mint.Request();
    req.AddParam("akcja", parametr1);
    req.OnSuccess = function() {
        $("nw_zawartosc").innerHTML = this.responseText;
    }
    req.SendForm(formularz,"zaloguj_sie.php", "POST");
  }
function zaloguj(formularz,parametr1)
  {
    var req = mint.Request();
    req.AddParam("akcja", parametr1);
    req.OnSuccess = function() {
        $("nw_zawartosc").innerHTML = this.responseText;
    }
    req.SendForm(formularz,"zaloguj_sie.php", "POST");
  }
