noweOkienko = null;
function galeria(src, w, h){
if(window.screen){
 aw=screen.availWidth;
 ah=screen.availHeight;
}else{
 aw=640;
 ah=450;
}
if(noweOkienko==null || noweOkienko.closed){
 ustawienia=
 "left=" + (aw-w)/2 + ","
 +"top=" + (ah-h)/2 + ","
 +"screenX=" + (aw-w)/2 + ","
 +"screenY=" + (ah-h)/2 + ","
 +"width=" + w + ","
 +"height=" + h + ","
 +"innerWidth=" + w + ","
 +"innerHeight=" + h + ","
 +"toolbar=no,"
 +"location=no,"
 +"directories=no,"
 +"status=yes,"
 +"menubar=no,"
 +"scrollbars=no,"
 +"resizable=no"
 noweOkienko = window.open("",'obrazek',ustawienia);
}
noweOkienko.document.open();
noweOkienko.document.clear();
noweOkienko.document.write(
"<html><head><title>Osiedle Zielona Wydma - Galeria</title>\n"
+"</head><BODY bgcolor=#F8FDFF>\n"
+"<div class=bgfoto id='wait' style='position:absolute; left:" + (w-120)/2 + "px; top:" + h/2 + "px; width:" + w + "; height=" + h + "; z-index:1'><font size='2' font color='#3C436C' face='sans-serif'><b><br>TRWA OTWIERANIE ZDJECIA...</b> </font></div>\n"
+"<div id='img' style='position:absolute; left:0; top:0; width:300; height:200px; z-index:2'><a href='javascript:window.close()'><img src="+ src +" width=" + w + " height=" + h + "  alt=' Zamknij ' border=0></a></div>\n"
+"</body></html>"
);
noweOkienko.document.close();
noweOkienko.focus();
}

  function validate() {
    document.emailForm.numer.value=document.emailForm._numer.value;
    var _email = document.emailForm.email.value;

    if ((document.emailForm.numer.value=="") ||
      (document.emailForm.nazwisko.value=="") ||
      (document.emailForm.telefon.value=="") ||
      (_email=="") || (_email.search("@")==-1) || (_email.search("[.*]")==-1)) {

      alert("Upewnij się, że formularz jest kompletny i poprawnie wypełniony.");
    }

    else if (_email.search("[;, ]")!=-1) {
      alert("Możesz podać tylko jeden adres e-mail.");
    }
    else document.emailForm.submit();
  }

function displayWindow(url, width, height) {
    window.open(url,"displayWindow",'width='+width+',height='+height+',resizable=no,scrollbars=no,menubar=no');
}

function Okno(id) {
    displayWindow("http://zielonawydma.pl/from_rezewacja.php?rezerwacja="+id,406,500);
}

function Okno2(id) {
    displayWindow("http://zielonawydma.pl/from_rezewacja_de.php?rezerwacja="+id,406,500);
}

function Okno3(id) {
    displayWindow("http://zielonawydma.pl/from_rezewacja_ang.php?rezerwacja="+id,406,500);
}





            function convert(sValue, sDataType) {
                switch(sDataType) {
                    case "int":
                        return parseInt(sValue);
                    case "float":
                        return parseFloat(sValue);
                    case "date":
                        return new Date(Date.parse(sValue));
                    default:
                        return sValue.toString();
                
                }
            }
        
            function generateCompareTRs(iCol, sDataType) {
        
                return  function compareTRs(oTR1, oTR2) {
                            var vValue1 = convert(oTR1.cells[iCol].firstChild.firstChild.nodeValue, sDataType);
                            var vValue2 = convert(oTR2.cells[iCol].firstChild.firstChild.nodeValue, sDataType);
        
                            if (vValue1 < vValue2) {
                                return -1;
                            } else if (vValue1 > vValue2) {
                                return 1;
                            } else {
                                return 0;
                            }
                        };
            }
           
            function sortTable(sTableID, iCol, sDataType) {
                var oTable = document.getElementById(sTableID);
                var oTBody = oTable.tBodies[0];
                var colDataRows = oTBody.rows;
                var aTRs = new Array;
        
                for (var i=0; i < colDataRows.length; i++) {
                    aTRs[i] = colDataRows[i];
                }
        
                if (oTable.sortCol == iCol) {
                    aTRs.reverse();
                } else {
                    aTRs.sort(generateCompareTRs(iCol, sDataType));
                }
        
                var oFragment = document.createDocumentFragment();
                for (var i=0; i < aTRs.length; i++) {
                    if(i%2==0)
                    aTRs[i].setAttribute('bgcolor','#e3edf8');
                    else 
		    aTRs[i].setAttribute('bgcolor','#FFFFFF');
                    oFragment.appendChild(aTRs[i]);
                }
       
                oTBody.appendChild(oFragment);
                oTable.sortCol = iCol;
            }

