
function rozwin(x){
    x = document.getElementById(x);
    if (x.style.display == "block") {
        x.style.display = "none";
    }
    else {
        x.style.display = "block";
    }
}


function sprawdz(formularz, element){
    if (formularz.elements[element].length == undefined) // nie jest tablica (tylko jeden rozmiar)
    {
        if (formularz.elements[element].checked) 
            return formularz.elements[element].value;
    }
    else // tablica (wiele rozmiarów)
    {
        for (i = 0; i < formularz.elements[element].length; i++) 
            if (formularz.elements[element][i].checked == true) 
                return formularz.elements[element][i].value;
    }
    alert('Wybierz rozmiar');
    return false;
}

//Miniaturka
function Foto(img){
    foto1 = new Image();
    foto1.src = (img);
    Controlla(img);
}

function Controlla(img){
    if ((foto1.width != 0) && (foto1.height != 0)) {
        viewFoto(img);
    }
    else {
        funzione = "Controlla('" + img + "')";
        intervallo = setTimeout(funzione, 20);
    }
}

function viewFoto(img){
    largh = foto1.width + 44;
    altez = foto1.height + 24;
    extras = "";
    if (altez > 550) {
        altez = 550;
        extras = ", scrollbars=yes";
    }
    stringa = "width=" + largh + ",height=" + altez + extras;
    finestra = window.open(img, "", stringa);
    with (finestra.document) {
        open();
        write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title>Podgląd obrazka</title><meta http-equiv="content-type" content="text/html; charset=utf-8"><link rel="stylesheet" href="pliki/styl.css" type="text/css"><style>body{margin:2px;}</style></head><body style="margin:10px;"  onselectstart="return false" ondragstart="return false" oncontextmenu="return false"><table width="100%" height="100%" ><tr><td align="center" height="100%"><img src="' + img + '"   onclick="window.close();"/></td></tr></table></body></html>');
        close();
    }
}

//  Miniaturka -->

function openWindow(dest, param){
    Win = window.open(dest, 'NoweOkno', param);
    Win.focus();
}

function gallery(product){
    var oNewWin = window.open("about:blank", "newwindow", "height=569,width=569,top=10,left=10,resizable=yes");
    oNewWin.document.open();
    oNewWin.document.write('<html>');
    oNewWin.document.write('<head>');
    oNewWin.document.write('<title>jeans-shopping.pl - GALERIA</title>');
    oNewWin.document.write('<style type="text/css">html,body{margin:0;padding:0;}</style>');
    oNewWin.document.write('</head>');
    oNewWin.document.write('<body>');
    oNewWin.document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="569" height="569" id="americanos" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="FlashVars" value="zm=' + product + '">    <param name="movie" value="americanos.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="americanos.swf" quality="high" bgcolor="#ffffff" width="569" height="569" name="americanos" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="zm=' + product + '" /> </object>');
    oNewWin.document.write('</body>');
    oNewWin.document.write('</html>');
    oNewWin.document.close();
}

function zamknij(){
    document.getElementById("reklamaPojemnik").style.display = "none";
    
}

function szerokosc(){
    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;
            myWidth=0;
        }
        else 
            if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
                //IE 4 compatible
                myWidth = document.body.clientWidth;
                myHeight = document.body.clientHeight;
            }
    return myWidth;
    //window.alert('Height = ' + myHeight);
}

function wysokosc(){
    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 myHeight;
    //window.alert('Height = ' + myHeight);
}

function chkObject(theVal){

    if (document.getElementById(theVal) != null) {
    
        return true;
        
    }
    
    else {
    
        return false;
        
    }
    
}

function wyposrodkuj(){

    if (chkObject("reklama")) {
        //alert(Math.round((szerokosc() - getImgWidth('pliki/reklama/reklama.jpg')) / 2));
        document.getElementById("reklama").style.marginLeft = Math.round((szerokosc() - getImgWidth('pliki/reklama/reklama.jpg')) / 2) + "px";
        document.getElementById("reklama").style.marginTop = "5%";
        document.getElementById("reklama").style.display = "block";
    }
    
    
}

function getImgWidth(imgSrc){
    var newImg = new Image();
    newImg.src = imgSrc;
    var height = newImg.height;
    var width = newImg.width;
    
    return width;
}