// Operacje wykonywane po zaladowaniu strony
function init()
{
    // Ustawienie potwierdzenia
    if(document.getElementById('comment'))
    {
        var form_link = document.getElementById('comment');

        //var action = form_link.getAttribute('action') + '&confirm=1';
        var onsubmit = 'return verReg(this);';

        //form_link.setAttribute('action',action);
        form_link.setAttribute('onsubmit',onsubmit);
    }

    if(document.getElementsByTagName)
    {
        var linki = document.getElementsByTagName('a');

        for(i=0; i < linki.length; i++)
        {
            if (linki[i].className == 'open')
            {
                var href = linki[i].getAttribute('href');
                var click = "openWinPar('" + href + "');return false;";

                linki[i].setAttribute('onclick',click);
            }

            if (linki[i].className == 'close')
            {
                var click = 'window.close();';
                linki[i].setAttribute('onclick',click);
            }
        }
    }
}

// Sprawdzanie czy wszystkie pola sa wypelnione
function verReg (form)
{
    var Popraw = 'Wypełnij wszystkie wymagane pola';
    var Zatwierdz = 'Czy na pewno dodać ten komentarz?';

    if (
            ( form.commnick.value == '' )
        ||  ( form.commtitle.value == '' )
       )

        {
            alert(Popraw);
            return false;
        }

    else
    {
        if ( !confirm (Zatwierdz) )
            return false;
    }
}


function openWinPar(url)
{
    var Window = window.open(url,"openWinPar",'width=450,height=500,top=50,left=50,resizable=0,scrollbars=yes,menubar=no');
}
