var SecurityNumber = ((100*10*20) / 20).toString() + "a" + "b" + String.fromCharCode(65) + String.fromCharCode(54) + String.fromCharCode((65/2)*3);
var CookieExpires = 7*3;
var NakupnyKosik_Async = false;
var FormDetail_Async = false;
var FormHodnotenie_Async = false;
var FormNastavenie_Async = false;
var DocumentOverlayOnClick;
var OverlayVisible = false;
var NakupnyKosik_Id;
var NakupnyKosik_Position = new Array(2);
var NakupnyKosik_To = new Array(4);
var NakupnyKosik_owner;
var NakupnyKosik_IdTovar;

function NakupnyKosik_Blink()
{
    if (NakupnyKosik_Id) return;
    var obj = NakupnyKosik_owner;
    var n = "nakupnykosikzvyraznenie";
    var o = getID(n);
    if (!o)
    {
        o = document.createElement("img");
        o.setAttribute("id", n);
//        o.setAttribute("src", "/SiteData/Design/dokosika.gif");
        o.style.position = "absolute";
        o.style.border = "3px solid black";
        document.body.appendChild(o);
    }    
    o.setAttribute("src", "/SiteTools/Obrazok.ashx?i=" + NakupnyKosik_IdTovar + "&t=1&w=150&h=100")
    var toX = getPositionX(getID("ctl00_PageNakupnyKosik"));
    var toY = getPositionY(getID("ctl00_PageNakupnyKosik"));
    o.style.display = "block";
    NakupnyKosik_Position[0] = getPositionX(obj);
    NakupnyKosik_Position[1] = getPositionY(obj);
    o.style.left = NakupnyKosik_Position[0] + "px";
    o.style.top = NakupnyKosik_Position[1] + "px";
    o.style.width = "150px";
    o.style.height = "100px";
    SetOpacity(o, 80);
    NakupnyKosik_To[0] = toX;
    NakupnyKosik_To[1] = toY;
    NakupnyKosik_To[2] = (Math.abs(toX - NakupnyKosik_Position[0]) / 100) * 2;
    NakupnyKosik_To[3] = (Math.abs(toY - NakupnyKosik_Position[1]) / 100) * 2;
    NakupnyKosik_Id = setInterval(function() {
        var o = getID("nakupnykosikzvyraznenie");
        if ((NakupnyKosik_Position[0] + parseInt(o.style.width.replace("px","")) >= NakupnyKosik_To[0] + 80) || (NakupnyKosik_Position[1] + parseInt(o.style.height.replace("px","")) <= NakupnyKosik_To[1]))
        {
            o.style.display = "none";
            clearInterval(NakupnyKosik_Id);
            NakupnyKosik_Id = null;
        }
        NakupnyKosik_Position[0] += NakupnyKosik_To[2];
        NakupnyKosik_Position[1] -= NakupnyKosik_To[3];
        o.style.width = (parseInt(o.style.width.replace("px","")) - 1) + "px";
        o.style.height = (parseInt(o.style.height.replace("px","")) - 1) + "px";
        o.style.left = NakupnyKosik_Position[0] + "px";
        o.style.top = NakupnyKosik_Position[1] + "px";
    }, 10);
}

function NakupnyKosik_PridajTovar(obj,i,n)
{
    if (NakupnyKosik_Async) return;
    NakupnyKosik_Async = true;
    NakupnyKosik_owner = obj;
    NakupnyKosik_IdTovar = i;
    var o = Ajax("/SiteTools/FormAsync.ashx", null, null, function(h){NakupnyKosik_Blink(); getID("ctl00_PageNakupnyKosik").innerHTML=h.responseText; NakupnyKosik_Async = false}, function(){NakupnyKosik_Async = false});
    var p = new Array(4);
    var v = new Array(4);
    p[0] = "t"; v[0] = "NakupnyKosik";
    p[1] = "i"; v[1] = i.toString();
    p[2] = "p"; v[2] = n.toString();
    p[3] = "o"; v[3] = SecurityNumber;
    AjaxSend(o, "post", p, v);
}

function Tovar_Informacie(i)
{
    Redirect("/tovar/" + i.toString() + "/");
}

function FormHodnotenie_Submit(i,z)
{
    if (FormHodnotenie_Async) return;
    FormHodnotenie_Async = true;
    var o = Ajax("/SiteTools/FormAsync.ashx", null, null, function(h){getID("Hodnotenie").innerHTML = h.responseText;FormHodnotenie_Async = false}, function(){FormHodnotenie_Async = false});
    var p = new Array(4);
    var v = new Array(4);
    p[0] = "t"; v[0] = "Hodnotenie";
    p[1] = "i"; v[1] = i.toString();    
    p[2] = "z"; v[2] = z.toString();
    p[3] = "o"; v[3] = SecurityNumber;
    AjaxSend(o, "post", p, v);    
}

function FormDetail_Submit(i,t,m,e,s)
{
    if (FormDetail_Async) return;
    FormDetail_Async = true;
    //var o = Ajax("/SiteTools/FormAsync.ashx", null, null, function(h){alert("OK");}, null);
    var p = new Array(7);
    var v = new Array(7);
    p[0] = "t"; v[0] = "FormDetail" + ((t == 1) ? "Predavac" : "Znamy");
    p[1] = "i"; v[1] = i.toString();    
    p[2] = "m"; v[2] = m;
    p[3] = "e"; v[3] = e;
    p[4] = "s"; v[4] = s;
    p[5] = "o"; v[5] = SecurityNumber;
    p[6] = "u"; v[6] = window.location.pathname;
    //AjaxSend(o, "post", p, v);
    SubmitForm("/SiteTools/FormData.aspx",true,p,v)
}

function VisibleOverlayOnDocumentClick()
{    
    if (OverlayVisible)
        VisibleOverlay(false);
}

function VisibleOverlay(v)
{
    if (!DocumentOverlayOnClick)
        document.body.onclick = VisibleOverlayOnDocumentClick;
    CreateOverlay("orange", 80, 100, v);
    if (IsMSIE6()) {HiddenDropDownList(!v)};
    if (!v) getID("Image$Preview").style.display = "none";
}

function VisibleImage(url,w,h)
{
    VisibleOverlay(true);
    var name = "Image$Preview";
    var ps = getPageSize();
    if (!getID(name))
    {
        var o=document.createElement("IMG");
        o.setAttribute("id", name);
        o.setAttribute("src", url);
        o.setAttribute("width", w.toString() + "px");
        o.setAttribute("height", h.toString() + "px");
        o.style.position = "absolute";
        o.style.zIndex = "150";
        o.style.border = "10px solid #FF3300";
        o.style.display = "block";
        o.style.left = ((ps[2] / 2) - (400 / 2)).toString() + "px";
        o.style.top = (((ps[3] / 2) - (400 / 2)) + getPageScroll()[1]).toString() + "px";
        o.onclick = VisibleOverlayOnDocumentClick;
        document.body.appendChild(o);
    } else
    {
        var o=getID(name);
        o.src = url;
        o.style.display = "block";
        o.style.top = (((ps[3] / 2) - (400 / 2)) + getPageScroll()[1]).toString() + "px";
    }    
    OverlayVisible = false;
    setTimeout(function(){OverlayVisible=true;}, 100);
}

function CookieCreateItem(cn,i,t,m,r)
{
    var s = CookieRead(cn,"");
    if (s != "")
    {
        var over = false;
        var sp = s.split("$");
        var c = "";
        for (var j = 0; j < sp.length; j++)
        {
            if (sp[j].replace(/\s/ig, "") == "") continue;
            var d=sp[j].split("=");            
            if (d[0]==i.toString()) return;
            if (m) if (j < m + 1) c += sp[j] + "$";
        }
        if (m)
        {
            if ((!r) && (m >= sp.length))
                return;
            else
            {
                c = i.toString() + "=" + escape(t) + (c != "" ? "$" : "") + c;
                CookieCreate(cn,c,7*3);
                CookieDrawItem(cn,getID(cn));
                return;
            }            
        }
    }
    s = i.toString() + "=" + escape(t) + (s != "" ? "$" : "") + s;
    CookieCreate(cn,s,7*3);
    CookieDrawItem(cn,getID(cn));
}

function CookieRemoveItem(cn,i)
{
    var s = CookieRead(cn,"");
    var n = "";
    if (s != "")
    {
        var over = false;
        var sp = s.split("$");
        for (var j = 0; j < sp.length; j++)
        {
            var d=sp[j].split("=");
            if (d[0]!=i.toString()) n += (n != "" ? "$" : "") + sp[j];
        }
    } 
    if (n != "") CookieCreate(cn,n,CookieExpires); else CookieRemove(cn);
    CookieDrawItem(cn,getID(cn));    
}

function CookieRemoveAll(cn)
{
    if (!confirm("Naozaj chcete vymazať všetky položky?")) return;
    CookieRemove(cn);
    CookieDrawItem(cn,getID(cn));    
}

function CookieDrawItem(cn,o)
{
    var s = CookieRead(cn,"");
    if (s != "")
    {    
        var sp = s.split("$");
        var str = "";
        for (var j = 0; j < sp.length; j++)
        {
            if (sp[j].replace(/\s/ig, "") == "") continue;
            var d=sp[j].split("=");
            var reg = /(<([^>]+)>)/gi;
            d[0] = d[0].replace(reg, ""); d[1] = d[1].replace(reg, "");
            d[0] = d[0].replace(/\"/ig, ''); d[1] = d[1].replace(/\"/ig, '');
            d[0] = d[0].replace(/\'/ig, ""); d[1] = d[1].replace(/\'/ig, "");
            str += '<a href="/tovar/'+d[0]+'/" class="CookieItem">' + StrNumeric(j+1,2) + '.' + unescape(d[1]) + '</a><a href="#none" onclick="javascript:CookieRemoveConfirm(\''+cn+'\','+d[0]+')" class="CookieItemRemove">vymazať</a>';
        }
        if ((cn == "compare") && (sp.length > 1))
            str += '<a href="#none" class="CookieItemCompare">POROVNANIE TOVAROV</a>';
        o.innerHTML = str + '<a href="#none" onclick="javascript:CookieRemoveAll(\''+cn+'\')" class="CookieItemRemoveAll">Všetky položky vymazať</a>';
        o.style.display = "block";
        getID(o.id + "_").style.display = "block";
    } else
    {
        o.style.display = "none";    
        getID(o.id + "_").style.display = "none";
    }
}

function CookieRemoveConfirm(cn,i)
{
    if (!confirm("Naozaj chcete vymazať vybranú položku?")) return;
    CookieRemoveItem(cn,i);
}

function Initialization()
{
   DisableKeyPress();
   CookieDrawItem("bookmark", getID("bookmark"));
   CookieDrawItem("compare", getID("compare"));
   
   var s = CookieRead("zobrazenie", "");
   if (s != "") {if (s.lastIndexOf("uloz1") != -1) CookieDrawItem("zobrazene", getID("zobrazene"));}   
   
   var u = window.location.pathname.toLowerCase();     
   if ((u.lastIndexOf("/akcie") != -1) || (u.lastIndexOf("/akcia") != -1))
        getID("mnuAkcie").className = "MenuDown";
   if ((u.lastIndexOf("/mimoriadna-akcia") != -1))
        getID("mnuNovinky").className = "MenuDown";
   /*
   if ((u.lastIndexOf("/kategorie") != -1) || (u.lastIndexOf("/kategoria") != -1))
        getID("mnuKatalog").className = "MenuDown";*/
   if (u == "/")
        getID("mnuHome").className = "MenuDown";
   if ((u.lastIndexOf("/znacky") != -1) || (u.lastIndexOf("/znacka") != -1))
        getID("mnuZnacky").className = "MenuDown";
   if (u.lastIndexOf("/ako-nakupovat") != -1)
        getID("mnuNakupovat").className = "MenuDown";
   if (u.lastIndexOf("/podmienky") != -1)
        getID("mnuPodmienky").className = "MenuDown";
   if (u.lastIndexOf("/o-nas") != -1)
        getID("mnuOnas").className = "MenuDown";
   if (u.lastIndexOf("/kontakt") != -1)
        getID("mnuKontakt").className = "MenuDown";   
}

function FormZnacka()
{
    var o = document.getElementsByTagName("INPUT");
    var s = "";
    for (var i = 0; i < o.length; i++)
    {
        if (o[i].id.substring(0, 6).toLowerCase() == "znacka")
            if (o[i].checked) s += o[i].value + ",";
    }
    if (s == "")
    {
        getID("ZnackaChyba").style.display = "block";
        return;
    }
    else
        getID("ZnackaChyba").style.display = "none";
//    Redirect(window.location.pathname + "?z=" + s + "#sem");
    Redirect(window.location.pathname + "?z=" + s);
}


function FormNastavenie(g)
{
    if (g)
    {
        if (FormNastavenie_Async) return;
        if (getID("Nastavenie").innerHTML != "")
        {
            getID("Nastavenie").style.display = getID("Nastavenie").style.display == "none" ? "block" : "none";
            getID("ZobrazenieNastavenia").className = getID("Nastavenie").style.display == "block" ? "Prelinking2" : "Prelink2";
            return;
        }
        var c = IsCookie();
        if (!c)
        {
            getID("ZobrazenieNastavenia").className = "Prelinking2";
            getID('Nastavenie').innerHTML = '<div style="padding:5px; font-weight:bold; color:red; background-color:#F0F0F0; text-align:center">Ľutujeme, ale Váš prehladiač nepodporuje rozšírené funkcie webovej stránky.</div>';
            return;
        }       
        getID("AjaxLoading").style.visibility = "visible";
        FormNastavenie_Async = true;
        var o = Ajax("/SiteTools/FormAsync.ashx", null, null, function(h){getID("ZobrazenieNastavenia").className = "Prelinking2"; getID("AjaxLoading").style.visibility = "hidden"; getID("Nastavenie").innerHTML = h.responseText;FormNastavenie_Async = false}, function(){getID("AjaxLoading").visibility = "hidden"; FormNastavenie_Async = false});
        var p = new Array(2);
        var v = new Array(2);        
        
        p[0] = "t"; v[0] = "ZobrazenieNastavenia";
        p[1] = "c"; v[1] = (c ? "1" : "0");
        AjaxSend(o, "post", p, v);    
    } else 
    {
        var v = "";
        if (getID("prehlad_pocet10").checked) v="pocet10";
        else if (getID("prehlad_pocet20").checked) v="pocet20";
        else if (getID("prehlad_pocet30").checked) v="pocet30";
        v += (v == "" ? "" : "$");
        if (getID("prehlad_zobrazenie1").checked) v+="zobrazenie1"; else v+="zobrazenie2";
        v += (v == "" ? "" : "$");
        if (getID("prehlad_kategorie").checked) v+="kategorie1"; else v+="kategorie2";
        v += (v == "" ? "" : "$");
        if (getID("prehlad_znacky").checked) v+="znacky1"; else v+="znacky2";
        v += (v == "" ? "" : "$");
        if (getID("prehlad_uloz").checked)
            v+="uloz1"
        else
        {
            v+="uloz2";
            CookieRemove("zobrazene");
        }
        CookieCreate("zobrazenie", v, CookieExpires);
        getID("ZobrazenieNastavenia").className = "Prelink2";
        getID("Nastavenie").style.display = "none";
//        Redirect(window.location.pathname + "?t=s#sem");
        Redirect(window.location.pathname + "?t=s");
    }
}

function Hodnotenie_OnClick(i) {FormHodnotenie_Submit(i$,i);}
       
function Hodnotenie_OnOver(i)
{
    var n = "Hodnotenie";
    for (var j = 1; j < (i == 0 ? 0 : i + 1); j++) getID(n+j.toString()).src = "/SiteData/Design/Hodnotenie/m1.gif";
    for (var j = (i == 0 ? 1 : i + 1); j < 6; j++) getID(n+j.toString()).src = "/SiteData/Design/Hodnotenie/m0.gif";
}

function FormZnackaView(o) {if (o.selectedIndex == 0) return; Redirect("/znacka/" + o[o.selectedIndex].value + "/");}
function FormZnackaNastav(v)
{
    var o = getID("PageZnacky");
    for (var i = 0; i < o.length; i++)
    {
        if (o[i].value == v)
        {
            o[i].selected = true;
            return;
        }
    }
}

function Printer()
{
    WindowOpen("/Printer.html", 700, 400, "scrollbars=no,toolbar=no,resizable=no,status=no,location=no");
}

function SearchSubmit(myfield,e)
{
    var keycode = 0;

    if (window.event)
        keycode = window.event.keyCode;
    else
    {
        if (e)
            keycode = e.which;
        else 
            return true;
    }
    if (keycode == 13)
    {
        return SearchSubmitButton();
    } 
    else return true;
}

function SearchSubmitButton()
{
    var myfield = getID("SearchForm");
    if (myfield.value.length < 3)
    {
        myfield.style.backgroundColor = "#FFCC99";
        return false;
    }
    var params = new Array(2);
    var values = new Array(2);
    params[0] = "t"; values[0] = "searchquick";
    params[1] = "s"; values[1] = myfield.value;
    SubmitForm("/SiteTools/FormData.aspx",true,params,values);
}

function LogOff()
{
    var params = new Array(1);
    var values = new Array(1);
    params[0] = "t"; values[0] = "logoff";
    SubmitForm("/SiteTools/FormData.aspx",true,params,values);
}

function PageSubmit(myfield,e)
{
    var keycode = 0;

    if (window.event)
        keycode = window.event.keyCode;
    else
    {
        if (e)
            keycode = e.which;
        else 
            return true;
    }
    if (keycode == 13)
    {
        if (!IsNumeric(myfield.value))
        {
            myfield.style.backgroundColor = "#FFCC99";
            return true;
        }
        else
        {
            var strana = parseInt(myfield.value);
            if (strana <= 0)
            {
                myfield.style.backgroundColor = "#FFCC99";
                return true;
            } else if (strana > parseInt(getID("ctl00_PageBody_Prehlad1_ctlStranaPocet").value))
            {
                myfield.style.backgroundColor = "#FFCC99";
                return true;
            }
            else
                Redirect(window.location.pathname + "?page=" + strana.toString());
        }
    } 
    else return true;
}

function ObjednavkaStorno(g)
{
    if (!confirm("Naozaj chcete stornovať objednávku?\n\nPokračovať?"))
        return;
    var params = new Array(2);
    var values = new Array(2);
    params[0] = "t"; values[0] = "objednavkaStorno";
    params[1] = "g"; values[1] = g;
    SubmitForm("/SiteTools/FormData.aspx",true,params,values);
}

function ObjednavkaIB(g,i)
{
    var params = new Array(3);
    var values = new Array(3);
    params[0] = "t"; values[0] = "objednavkaIB";
    params[1] = "g"; values[1] = g;
    params[2] = "i"; values[2] = i;
    SubmitForm("/SiteTools/FormData.aspx",true,params,values);
}

/* ======================================================= */

function Detail_ThisInitialization()
{
    var s = CookieRead("zobrazenie", "");
    var o = true;
    if (s != "") {if (s.lastIndexOf("uloz1") == -1) o = false;}
    if (o) setTimeout(function(){CookieCreateItem('zobrazene',i$,t$,8,true)}, 100);
    if (!IsCookie())
    {
        getID("CookieBookmark").style.color = "gray";
        getID("CookieCompare").style.color = "gray";
    }
    if (QueryString("r") == "1")
        setTimeout(function(){alert("Formulár bol úspešne odoslaný.\nĎakujeme za využitie našich služieb.")}, 1000);
}
       
function Detail_Kontrola(i)
{
    var message = "";
    if (getID("Form" + i.toString() + "Meno").value == "")
        message += "- nevyplnili ste meno.\n";
    if (getID("Form" + i.toString() + "Email").value == "")
        message += "- nevyplnili ste e-mailovú adresu.\n";
    else if (!check_email(getID("Form" + i.toString() + "Email").value))
        message += "- chybne ste vyplnili e-mailovú adresu.\n";            
    if (getID("Form" + i.toString() + "Sprava").value == "")
        message += "- nevyplnili správu.\n"; 
    if (message != "")
        alert("Formulár nebude odoslaný pretože : \n\n" + message)
    else
    {
        FormDetail_Submit(i$,i,getID("Form" + i.toString() + "Meno").value,getID("Form" + i.toString() + "Email").value,getID("Form" + i.toString() + "Sprava").value);
        getID("Form" + i.toString() + "Meno").value = "";
        getID("Form" + i.toString() + "Email").value = "@";
        getID("Form" + i.toString() + "Sprava").value = "";
    }
}

function Detail_Podobne()
{
    if (getID("Podobne").innerHTML != "")
    {            
        getID("Podobne").style.display = (getID("Podobne").style.display != "block" ? "block" : "none"); 
        return;
    }
    var o = Ajax("/SiteTools/FormAsync.ashx", null, null, function(h){getID("Podobne").innerHTML=h.responseText; getID("Podobne").style.display = "block"}, null);
    var p = new Array(2);
    var v = new Array(2);
    p[0] = "t"; v[0] = "Podobne";
    p[1] = "i"; v[1] = i$;
    AjaxSend(o, "post", p, v);
}

function Kontakt_Kontrola()
{
    var Message = "";
    var Over = false;
    if (getNETID("zMENO").value == "") Message += "- nevyplnili ste [Vaše meno]\n";
    if (getNETID("zEMAIL").value == "") Message += "- nevyplnili ste [Váš e-mail]\n"; else if (!check_email(getNETID("zEMAIL").value)) Message += "- chybne ste vyplnili [Váš e-mail]\n";
    if (getNETID("zSPRAVA").value == "") Message += "- nevyplnili ste [správu pre nás]\n";
    if (Message != "") alert("Formulár nebude odoslaný, pretože :\n\n" + Message); else {getNETID("zOVER").value = SecurityNumber;getNETID("btnSubmit").click();}
}

function Objednavka_IB(o)
{
    if (o.selectedIndex == 0)
        getID("IB").className = "True";
    else
        getID("IB").className = "False";
}

function Objednavka_SetUpFirma()
{
    if (getNETID("zFIRMA").checked)
    {
        getID("ctlFakturacnaText").innerHTML = "FAKTURAČNÁ";
        getID("ctlPostovaText").innerHTML = "POŠTOVÁ";
        getID("ctlFirma").className = "True";
        if (!getNETID("zPOSTOVAFAKTURACNA").checked)               
            getID("ctlPostova").className = "True";
        else
            getID("ctlPostova").className = "False";
    } else
    {
        getID("ctlFakturacnaText").innerHTML = "";
        getID("ctlPostovaText").innerHTML = "";            
        getID("ctlFirma").className = "False";
        getID("ctlPostova").className = "False";
    }
}

function Objednavka_ThisInitialization()
{
    Objednavka_IB(getNETID("zSPOSOBPLATBY"));
    Objednavka_SetUpFirma();
}        

function Objednavka_Kontrola()
{
    var Message = "";
    var Over = false;
    if (!getNETID("zPREHLASENIE").checked) Message += "- nezadali ste či súhlasíte s objednaním tovarov\n";
    if (getNETID("zMENO").value == "") Message += "- nevyplnili ste [Vaše meno]\n";
    if (getNETID("zPRIEZVISKO").value == "") Message += "- nevyplnili ste [Vaše priezvisko]\n";
    if (getNETID("zEMAIL").value == "") Message += "- nevyplnili ste [Váš e-mail]\n"; else if (!check_email(getNETID("zEMAIL").value)) Message += "- chybne ste vyplnili [Váš e-mail]\n";
    if (getNETID("zFIRMA").checked)
    {
        if (getNETID("zNAZOV").value == "") Message += "- nevyplnili ste [názov firmy]\n";
        if (getNETID("zICO").value == "") Message += "- nevyplnili ste [IČO]\n";
        if (getNETID("zFAKTURACNA_ULICA").value == "") Message += "- nevyplnili ste [fakturačná adresa - ulica]\n";
        if (getNETID("zFAKTURACNA_ULICACISLO").value == "") Message += "- nevyplnili ste [fakturačná adresa - číslo]\n";
        if (getNETID("zFAKTURACNA_PSC").value == "") Message += "- nevyplnili ste [fakturačná adresa - PSČ]\n";
        if (getNETID("zFAKTURACNA_MESTO").value == "") Message += "- nevyplnili ste [fakturačná adresa - mesto]\n";
        if (!getNETID("zPOSTOVAFAKTURACNA").checked)
        {
            if (getNETID("zPOSTOVA_ULICA").value == "") Message += "- nevyplnili ste [poštová adresa - ulica]\n";
            if (getNETID("zPOSTOVA_ULICACISLO").value == "") Message += "- nevyplnili ste [poštová adresa - číslo]\n";
            if (getNETID("zPOSTOVA_PSC").value == "") Message += "- nevyplnili ste [poštová adresa - PSČ]\n";
            if (getNETID("zPOSTOVA_MESTO").value == "") Message += "- nevyplnili ste [poštová adresa - mesto]\n";
        }
    } else
    {
        if (getNETID("zFAKTURACNA_ULICA").value == "") Message += "- nevyplnili ste [adresa - ulica]\n";
        if (getNETID("zFAKTURACNA_ULICACISLO").value == "") Message += "- nevyplnili ste [adresa - číslo]\n";
        if (getNETID("zFAKTURACNA_PSC").value == "") Message += "- nevyplnili ste [adresa - PSČ]\n";
        if (getNETID("zFAKTURACNA_MESTO").value == "") Message += "- nevyplnili ste [adresa - mesto]\n";            
    }
    if (getNETID("zMOBIL").value == "") Message += "- nevyplnili ste [mobilné číslo]\n";
    if (Message != "") alert("Formulár nebude odoslaný, pretože :\n\n" + Message); else {getNETID("zOVER").value = SecurityNumber;getNETID("btnSubmit").click();}
}

function Prihlasenie_Kontrola()
{
    var Message = "";
    if (getNETID("zEMAIL").value == "") Message += "- nevyplnili ste [Váš e-mail]\n"; else if (!check_email(getNETID("zEMAIL").value)) Message += "- chybne ste vyplnili [Váš e-mail]\n";
    if (getNETID("zLOGINPASSWORD").value == "") { Message += "- nevyplnili ste [prihlasovacie heslo]\n"; Over = true}
    if (Message != "") alert("Formulár nebude odoslaný, pretože :\n\n" + Message); else {getNETID("zOVER").value = SecurityNumber;getNETID("btnSubmit").click();}
}

function Registracia_SetUpFirma()
{
    if (getNETID("zFIRMA").checked)
    {
        getID("ctlFakturacnaText").innerHTML = "FAKTURAČNÁ";
        getID("ctlPostovaText").innerHTML = "POŠTOVÁ";
        getID("ctlFirma").className = "True";
        if (!getNETID("zPOSTOVAFAKTURACNA").checked)               
            getID("ctlPostova").className = "True";
        else
            getID("ctlPostova").className = "False";
    } else
    {
        getID("ctlFakturacnaText").innerHTML = "";
        getID("ctlPostovaText").innerHTML = "";            
        getID("ctlFirma").className = "False";
        getID("ctlPostova").className = "False";
    }
}

function Registracia_ThisInitialization()
{
    if (getNETID("upd").value == "1")
    {
        getID("btnSubmitText").innerHTML = "Aktualizácia &raquo;";
        getID("FirmaRegistraciaText").innerHTML = "V prípade, že nie ste registrovaný ako firma, môžete doplniť Vaše firemné údaje a Vaša aktualizácia bude už firemná.";
    }
    Registracia_SetUpFirma();
}        

function Registracia_Kontrola()
{
    var Message = "";
    var Over = false;
    if (getNETID("zMENO").value == "") Message += "- nevyplnili ste [Vaše meno]\n";
    if (getNETID("zPRIEZVISKO").value == "") Message += "- nevyplnili ste [Vaše priezvisko]\n";
    if (getNETID("zEMAIL").value == "") Message += "- nevyplnili ste [Váš e-mail]\n"; else if (!check_email(getNETID("zEMAIL").value)) Message += "- chybne ste vyplnili [Váš e-mail]\n";

    Over = false;
    if (getNETID("zLOGINPASSWORD").value == "") { Message += "- nevyplnili ste [prihlasovacie heslo]\n"; Over = true}
    if (getNETID("zOVERPASSWORD").value == "") { Message += "- nevyplnili ste [prihlasovacie heslo (overenie)]\n"; Over = true}
    
    if (!Over) if (getNETID("zLOGINPASSWORD").value != getNETID("zOVERPASSWORD").value) Message += "- prihlasovacie heslá sa nezhodujú\n";            

    if (getNETID("zFIRMA").checked)
    {
        if (getNETID("zNAZOV").value == "") Message += "- nevyplnili ste [názov firmy]\n";
        if (getNETID("zICO").value == "") Message += "- nevyplnili ste [IČO]\n";
        if (getNETID("zFAKTURACNA_ULICA").value == "") Message += "- nevyplnili ste [fakturačná adresa - ulica]\n";
        if (getNETID("zFAKTURACNA_ULICACISLO").value == "") Message += "- nevyplnili ste [fakturačná adresa - číslo]\n";
        if (getNETID("zFAKTURACNA_PSC").value == "") Message += "- nevyplnili ste [fakturačná adresa - PSČ]\n";
        if (getNETID("zFAKTURACNA_MESTO").value == "") Message += "- nevyplnili ste [fakturačná adresa - mesto]\n";
        if (!getNETID("zPOSTOVAFAKTURACNA").checked)
        {
            if (getNETID("zPOSTOVA_ULICA").value == "") Message += "- nevyplnili ste [poštová adresa - ulica]\n";
            if (getNETID("zPOSTOVA_ULICACISLO").value == "") Message += "- nevyplnili ste [poštová adresa - číslo]\n";
            if (getNETID("zPOSTOVA_PSC").value == "") Message += "- nevyplnili ste [poštová adresa - PSČ]\n";
            if (getNETID("zPOSTOVA_MESTO").value == "") Message += "- nevyplnili ste [poštová adresa - mesto]\n";
        }
    } else
    {
        if (getNETID("zFAKTURACNA_ULICA").value == "") Message += "- nevyplnili ste [adresa - ulica]\n";
        if (getNETID("zFAKTURACNA_ULICACISLO").value == "") Message += "- nevyplnili ste [adresa - číslo]\n";
        if (getNETID("zFAKTURACNA_PSC").value == "") Message += "- nevyplnili ste [adresa - PSČ]\n";
        if (getNETID("zFAKTURACNA_MESTO").value == "") Message += "- nevyplnili ste [adresa - mesto]\n";            
    }
    if (getNETID("zMOBIL").value == "") Message += "- nevyplnili ste [mobilné číslo]\n";      
    if (Message != "") alert("Formulár nebude odoslaný, pretože :\n\n" + Message); else {getNETID("zOVER").value = SecurityNumber;getNETID("btnSubmit").click();}
}

function Zabudnute_Kontrola()
{
    var Message = "";
    if (getNETID("zEMAIL").value == "") Message += "- nevyplnili ste [Váš e-mail]\n"; else if (!check_email(getNETID("zEMAIL").value)) Message += "- chybne ste vyplnili [Váš e-mail]\n";
    if (Message != "") alert("Formulár nebude odoslaný, pretože :\n\n" + Message); else {getNETID("zOVER").value = SecurityNumber;getNETID("btnSubmit").click();}
}
