/***********************************************/
/* COPYRIGHT 2006 by LOMA consulting - INFDATA */
/* www.infdata.com                             */
/* initial coding : Jani Pusenjak              */
/* ARPIL 2006                                  */
/***********************************************/

var timer = -1;
var closeTime=500;

var headOnImg = new Array()
headOnImg[0] = new Image();
headOnImg[1] = new Image();
headOnImg[0].src = "slike/domov_over.png";
headOnImg[1].src = "slike/kontakt_over.png";

var headOffImg = new Array()
headOffImg[0] = new Image();
headOffImg[1] = new Image();
headOffImg[0].src = "slike/domov.png";
headOffImg[1].src = "slike/kontakt.png";



var subIdName = 'subId';
var openSubInx = -1;
var subOffset = 170;


var browser = 0;

var idprefix = ["getElementById('",""];
var stil = ["').style",""];
var idpostfix = ["')",""];

function setBrowser(){
    if (document.layers){
        browser = 1;
    }
}

function headIn(ix){
    document.headImg[ix].src = headOnImg[ix].src;
}

function headOut(ix){
    document.headImg[ix].src = headOffImg[ix].src;
}


function lastModify(){
   return "zadnja osvežitev strani: 20.3.2006";
}



function openSubMenu(inx){
    stopTimer();

    if (openSubInx != -1 && openSubInx != inx){
        objold = eval("document."+idprefix[browser]+"subMenu"+openSubInx+stil[browser]);
        objold.visibility = 'hidden';
    }

    obj = eval("document."+idprefix[browser]+"subMenu"+inx+stil[browser]);
    refObj = eval("document."+idprefix[browser]+"menuLabel"+idpostfix[browser]);
    obj.left = findPosX(refObj) + subOffset;
    obj.visibility = 'visible';
    openSubInx = inx;
    if (browser == 1){
        resetTimer();
    }
}

function findPosX(obj)
{
    var curleft = 0;
    if (obj.offsetParent)
    {
        while (obj.offsetParent)
        {
            curleft += obj.offsetLeft
            obj = obj.offsetParent;
        }
    }
    else if (obj.x)
        curleft += obj.x;
    return curleft;
}


function stopTimer(){
    if (timer != -1){
        clearTimeout(timer);
    }
}

function resetTimer(){
    stopTimer();
    timer = setTimeout("clrSubMenu()", browser==1 ? 2000 : closeTime);
}

function clrSubMenu(){
    if (openSubInx != -1){
        obj = eval("document."+idprefix[browser]+"subMenu"+openSubInx+stil[browser]);
        obj.visibility='hidden';
    }
    openSubInx = -1;
}







function gremo(x){
    x ? poslji() : document.prijava.reset();
}


function poslji(){
    var go = true;
    if (document.prijava.prii.value == ''){
        go=false;
        alert("prosimo izpolnite polje priimek!");
    }
    else if (document.prijava.ime.value == ''){
        go=false;
        alert("prosimo izpolnite polje ime!");
    }
    else if (document.prijava.eposta.value == '' && document.prijava.tel.value == ''){
        go=false;
        alert("prosimo izpolnite vsaj eno kontaktno informacijo (e-pošta ali telefon)!");
    }
    else if (document.prijava.eposta.value != ''){
        if (document.prijava.eposta.value.indexOf('@') == -1 || document.prijava.eposta.value.indexOf('.') == -1){
            go=false;
            alert("kaže, da je prišlo do napake pri vpisu e-poštnega naslova!\nProsimo popravite vpis");
        }
    }

    if (go) {
        document.prijava.submit();
    }
}

var reset = true;
function resetArea(){
    if (reset) {
        document.sporocilo.tekst.value = '';
        reset = false;
    } // if
}
function sendMsg(){
    var send = true;
    if (document.sporocilo.ime.value == '') {
        send = false;
        alert("prosimo vpišite vaše ime in priimek!");
        document.sporocilo.ime.focus();
    } // if
    else if (document.sporocilo.email.value == '') {
        send = false;
        alert("prosimo vpišite vaš elektronski poštni naslov!");
        document.sporocilo.email.focus();
    } // if
    else {
        if (document.sporocilo.email.value.indexOf('@') == -1 || document.sporocilo.email.value.indexOf('.') == -1){
            send=false;
            alert("Kaže, da je prišlo do napake pri vpisu e-poštnega naslova!\nProsimo popravite vpis!");
            document.sporocilo.email.focus();
        }
    }

    if (send){
        document.sporocilo.submit();
    } // if
}








