function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function ilosc_zmienQ(id,v)
{
    q=document.oform['q'+id];
    if (v>0)
        q.value++;
    else
        q.value--;
    if ((''+q.value)=='NaN')
        q.value=0;
    if (q.value<0)
        q.value=0;
    return false;
}
function ilosc_zmien(id,v)
{
    q=document.oform['q'+id];
    if (v>0)
        q.value++;
    else
        q.value--;
    if ((''+q.value)=='NaN')
        q.value=0;
    if (q.value<0)
        q.value=0;
    rt.recalc(q);
    return false;
}
function shop_popup(id,event)
{
    var winWidth, winHeight;
    if (!DQbrowser("nn4"))
    {
        if (event!='')
        {
            winWidth = (document.all)?document.body.clientWidth:window.innerWidth;
            winHeight = (document.all)?document.body.clientHeight:window.innerHeight;
            if (DQbrowser("ie4"))
            {
                y = event.y+document.body.scrollTop;
                y = (winHeight - 330) / 2 + document.body.scrollTop;
            }
            if (DQbrowser("moz"))
            {
                y = event.pageY;
                y = (winHeight - 330) / 2 + document.body.scrollTop;
            }
            pop0.position.yoffset=y - 240;
            pop0.position.xoffset=pop0.position.xoffsetInit;
            pop0.position.reposition();
            popupclose=0;
        }
        else
        {
            pop0.position.yoffset=pop0.position.yoffsetInit;
            pop0.position.xoffset=pop0.position.xoffsetInit;
            pop0.position.reposition();
            popupclose=1;
        }
        window.frames['ibody'].location.href='/popup/'+id;
        window.frames['ibody'].document.eventfunction=alert;
        window.frames['ibody'].document.eventfunction=alert;
        window.frames['ibody'].window.opener=window;
        popupid=id;
        setTimeout(pop0.fullname+'.show()',1000);
        setTimeout(pop1.fullname+'.show()',1000);
    }
    else
    {
        window.open('/popup/'+id,'popup'+id,'directories=no,dependant=yes,innerHeight=500,innerWidth=570,width=570,height=500,location=no,scrollbars=no,status=no,titlebar=no,toolbar=no');
    }
    return false;
}
var pop0,pop1,pop2,popF0,popF1,popupid,popupclose,mainpos;
function shop_addtocart(id,add)
{
    o=document.oform['q'+id];
    o.value=parseInt(o.value)+parseInt(add);
    if (o.value<0)
        o.value=0;
    rt.recalc(o);
    if (popupclose)
    {
        pop0.realhide();
        pop1.realhide();
        pop2.realhide();
    }
}
function shop_initpopup()
{
    mainpos=new DQposition();
    mainpos.xrelative=0.5;
    mainpos.yoffset=156;
    mainpos.xoffset=0;
    mainpos.width=750;
    mainpos.ymin=224;
    mainpos.ymax=2048;

    pop0=new DQpopup();
    drag=new DQdrag();
    b='<TABLE WIDTH="552" BORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD BGCOLOR="#666666"><TABLE WIDTH="552" BORDER="0" CELLSPACING="1" CELLPADDING="0"><TR>';
    b+='<TD WIDTH="17" HEIGHT="27"><A HREF="#" ONCLICK="pop1.realtoggle();return false"><IMG SRC="/img/popup_zawin.gif" WIDTH="17" HEIGHT="27" BORDER="0" ALT="Schowaj okno"></A></TD>';
    b+='<TD WIDTH="478" HEIGHT="27">'+drag.dump('<IMG SRC="/img/popup_pasek.gif" WIDTH="478" HEIGHT="27" BORDER="0" ALT="Kliknij w celu przesuwania okna">')+'</TD>';
    b+='<TD WIDTH="17" HEIGHT="27"><A HREF="#" ONCLICK="shop_addtocart(popupid,1);return false"><IMG SRC="/img/popup_dodaj.gif" WIDTH="17" HEIGHT="27" BORDER="0" ALT="Dodaj do koszyka"></A></TD>';
    b+='<TD WIDTH="17" HEIGHT="27"><A HREF="#" ONCLICK="shop_addtocart(popupid,-1);return false"><IMG SRC="/img/popup_usun.gif" WIDTH="17" HEIGHT="27" BORDER="0" ALT="Usuń z koszyka"></A></TD>';
    b+='<TD WIDTH="17" HEIGHT="27"><A HREF="#" ONCLICK="pop0.realhide();pop1.realhide();return false"><IMG SRC="/img/popup_zamknij.gif" WIDTH="17" HEIGHT="27" BORDER="0" ALT="Zamknij okno"></A></TD>';
    b+='</TR></TABLE></TD></TR></TABLE>';
    pop0.body=b;
    pop0.showhide=0;
    pop0.position.width=552;
    pop0.position.yoffset=0;
    pop0.position.xrelative=0;
    pop0.position.xoffsetInit=44;
    pop0.position.yoffsetInit=200;
    pop0.position.xoffset=pop0.position.xoffsetInit;
    pop0.position.setparent(mainpos);
    pop0.position.xmin=0;
    pop0.position.xmax=44;
    drag.popup(pop0);
    pop1=new DQpopup();
    b='<TABLE WIDTH="552" BORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD BGCOLOR="#666666"><TABLE WIDTH="552" BORDER="0" CELLSPACING="1" CELLPADDING="0"><TR>';
    b+='<TD COLSPAN="3" WIDTH="550" HEIGHT="300" BGCOLOR="white"><IFRAME NAME="ibody" WIDTH="550" HEIGHT="300" FRAMEBORDER="0"></IFRAME></TD>';
    b+='</TR></TABLE></TD></TR></TABLE>';
    pop1.body=b;
    pop1.showhide=0;
    pop1.position.xoffset=0;
    pop1.position.yoffset=28;
    pop1.position.setparent(pop0.position);

    pop2=new DQpopup();
    b='<TABLE WIDTH="552" BORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD BGCOLOR="#666666"><TABLE WIDTH="552" BORDER="0" CELLSPACING="1" CELLPADDING="0"><TR>';
    b+='<TD COLSPAN="3" WIDTH="550" HEIGHT="300" BGCOLOR="white">&nbsp;</TD>';
    b+='</TR></TABLE></TD></TR></TABLE>';
    pop2.body=drag.dump(b);
    pop2.showhide=0;
    pop2.position.xoffset=0;
    pop2.position.yoffset=28;
    pop2.position.setparent(pop0.position);

    popF0=new DQpopup();
    b='<TABLE WIDTH="760" HEIGTH="100" CELLSPACING="0" CELLPADDING="0" BORDER="0"><TR><TD><img src="/img/intro_static.gif" width="760" height="100" border="0"></TD></TR></TABLE>';
    popF0.body=b;
    popF0.showhide=0;
    popF0.position.width=630;
    popF0.position.xrelative=0.5;
    popF0.position.xoffset=-66;
    popF0.position.yoffset=56;

    popF1=new DQpopup();
    b='<TABLE WIDTH="760" HEIGTH="100" CELLSPACING="0" CELLPADDING="0" BORDER="0"><TR><TD><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="630" height="100"><param name=movie value="/img/intro.swf"><param name=quality value=best><embed src="/img/intro.swf" quality=best pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="630" height="100"></embed></object></TD></TR></TABLE>';
    popF1.body=b;
    popF1.showhide=0;
    popF1.position.width=630;
    popF1.position.xrelative=0.5;
    popF1.position.xoffset=64;
    popF1.position.yoffset=56;

    drag.onbegin='pop1.realhide();pop2.show();popF1.realhide();popF0.show();';
    drag.onend='pop1.show();pop2.realhide();popF0.realhide();popF1.show();';

    drag.onbegin='pop1.realhide();pop2.show();';
    drag.onend='pop1.show();pop2.realhide();';
}

