function okno (sciezka, szer, wys) 
{
    lewo=Math.round((screen.width-szer)/2)
    gora=Math.round((screen.height-wys)/2)
    wind=window.open (sciezka,'','left='+lewo+',top='+gora+',width='+szer+',height='+wys+', toolbar=0')
	wind.onclick = wclose
	wind.onblur = wclose

}

function okno_noclick (sciezka, szer, wys) 
{
    lewo=Math.round((screen.width-szer)/2)
    gora=Math.round((screen.height-wys)/2)
    wind=window.open (sciezka,'','left='+lewo+',top='+gora+',width='+szer+',height='+wys+', toolbar=0')
//	wind.onclick = wclose
	wind.onblur = wclose

}

function wclose()
{
	this.window.close()
}

function upewnij () 
{
    return confirm ("Czy jesteś pewny/a? \nTa operacja jest nieodwracalna!")
}


function sprawdzform (form, wymagane) 
{
    var poprawny = true
    
    for (i=0;i<wymagane.length;i++) {
        if (document.forms[form].elements[wymagane[i]].value == '') {
            document.forms[form].elements[wymagane[i]].style.borderColor = "#FF0000"
            poprawny = false
        }
        else
            document.forms[form].elements[wymagane[i]].style.borderColor = "#666666"
    }

    if (poprawny == false) {
        alert ("Uzupełnij wszystkie zaznaczone pola")
        return false
    }
    else 
        return true
}

function fieldclear(pole,wartosc)
{
    if (pole.value==wartosc)
        pole.value=''
}

function displayWindow(url, width, height) {
    lewo=Math.round((screen.width-width)/2)
    gora=Math.round((screen.height-height)/2)

 var Win = window.open(url,"displayWindow",'toolbar=no,menubar=no,scrollbars,resizable, left=' +lewo+ ',top=' +gora+ ',width=' + width + ',height=' + height );
 }

