
    var lngArr = new Array(32);

    function lngLine(aIndex, l1, l2)
    {
        aIndex = new Array(2);
        aIndex[0] = l1;
        aIndex[1] = l2;
        return aIndex;
    }

    function CreateLng()
    {
        lngArr[0] = lngLine(lngArr[0], "- chybne ste vyplnili [rodné číslo]\n", "- you have filled incorrect [personal identification number]\n");
        lngArr[1] = lngLine(lngArr[1], "- chybne ste vyplnili [e-mail]\n", "- you have filled incorrect [e-mail]\n");
        lngArr[2] = lngLine(lngArr[2], "- chybne ste vyplnili [meno]\n", "- you have filled incorrect [e-mail]\n");

        lngArr[3] = lngLine(lngArr[3], "- chybne ste vyplnili [priezvisko]\n", "- you have filled incorrect [surname]\n");
        lngArr[4] = lngLine(lngArr[4], "- chybne ste vyplnili [ulica]\n", "- you have filled incorrect [street]\n");
        lngArr[5] = lngLine(lngArr[5], "- chybne ste vyplnili [číslo ulice]\n", "- you have filled incorrect [street number]\n");
        lngArr[6] = lngLine(lngArr[6], "- chybne ste vyplnili [PSČ]\n", "- you have filled incorrect [ZIP]\n");
        lngArr[7] = lngLine(lngArr[7], "- chybne ste vyplnili [mesto]\n", "- you have filled incorrect [city]\n");
        lngArr[8] = lngLine(lngArr[8], "- chybne ste vyplnili [mobil]\n", "- you have filled incorrect [mobile]\n");
        lngArr[9] = lngLine(lngArr[9], "- chybne ste vyplnili [názov firmy]\n", "- you have filled incorrect [company]\n");
        lngArr[10] = lngLine(lngArr[10], "- chybne ste vyplnili [IČO]\n", "- you have filled incorrect [IČO]\n");
        lngArr[11] = lngLine(lngArr[11], "- chybne ste vyplnili [DIČ]\n", "- you have filled incorrect [DIČ]\n");


        lngArr[12] = lngLine(lngArr[12], "- chybne ste vyplnili [fakturačná adresa - ulica]\n", "- you have filled incorrect [Billing address street]\n");
        lngArr[13] = lngLine(lngArr[13], "- chybne ste vyplnili [fakturačná adresa - číslo ulice]\n", "- you have filled incorrect [Billing address street - number]\n");
        lngArr[14] = lngLine(lngArr[14], "- chybne ste vyplnili [fakturačná adresa - PSČ]\n", "- you have filled incorrect [Billing address - ZIP]\n");
        lngArr[15] = lngLine(lngArr[15], "- chybne ste vyplnili [fakturačná adresa - mesto]\n", "- you have filled incorrect [Billing address - city]\n");
        lngArr[16] = lngLine(lngArr[16], "- chybne ste vyplnili [poštová adresa - ulica]\n", "- you have filled incorrect [Postal address street]\n");
        lngArr[17] = lngLine(lngArr[17], "- chybne ste vyplnili [poštová adresa - čísloí ulice]\n", "- you have filled incorrect [Postal address street - numberr]\n");
        lngArr[18] = lngLine(lngArr[18], "- chybne ste vyplnili [poštová adresa - PSČ]\n", "- you have filled incorrect [Postal address ZIP]\n");

        lngArr[19] = lngLine(lngArr[19], "- chybne ste vyplnili [poštová adresa - mesto]\n", "- you have filled incorrect [Postal address city]\n");
        lngArr[20] = lngLine(lngArr[20], "- chybne ste vyplnili [firemný e-mail]\n", "- you have filled incorrect [company e-mail]\n");
        lngArr[21] = lngLine(lngArr[21], "- chybne ste vyplnili [firemný telefón]\n", "- you have filled incorrect [company phone]\n");
        lngArr[22] = lngLine(lngArr[22], "Vážený užívateľ, formulár nebude odoslaný pretože :\n\n", "Dear user, the form will not be sent because :\n\n");
        lngArr[23] = lngLine(lngArr[23], "Príspevok do charity musí obsahovať celé kladné číslo.\nSkontrolujte formulár a následneho ho odošlite.", "Contribution to the charity must include the whole positive number. Check the form and then send it.");
        lngArr[24] = lngLine(lngArr[24], "Card verification", "");
        lngArr[25] = lngLine(lngArr[25], "- chybne ste vyplnili [Poštová adresa psč]\n", "");
        lngArr[26] = lngLine(lngArr[26], "- chybne ste vyplnili [Poštová adresa psč]\n", "");
        lngArr[27] = lngLine(lngArr[27], "- chybne ste vyplnili [Poštová adresa psč]\n", "");
        lngArr[28] = lngLine(lngArr[28], "- chybne ste vyplnili [Poštová adresa psč]\n", "");
        lngArr[29] = lngLine(lngArr[29], "- chybne ste vyplnili [Poštová adresa psč]\n", "");
        lngArr[30] = lngLine(lngArr[30], "- chybne ste vyplnili [Poštová adresa psč]\n", "");

    }

    function LNG(i)
    {        
        var j = 0;
        if (lng == "EN")
            j = 1;
        return lngArr[i][j];
    }


    function TRegistracia()
    {
        this.PageIndex = 0;
        this.PageId = "";

        this.ErrorField = function(obj, label, IsError)
        {
            if (obj)
            {
                var field = obj.id.replace("ctl00_PageBody_", "");
                if (label == "")
                    getID("lbl" + field.substr(1, field.length)).className = (IsError ? "LabelError" : "Label");
                else
                    getID(label).className = (IsError ? "LabelError" : "Label");
            } else            
               getID(label).className = (IsError ? "LabelError" : "Label");
            return IsError;
        }

        this.Page1_Kontrola = function()
        {
            var tmp = getNETID("zREGISTRACIAFIRMY").checked;
            var over = true;
            var msg = "";
            if (this.ErrorField(getNETID("zEMAIL"), "", !check_email(getNETID("zEMAIL").value)))
            {
                over = false;
                msg += LNG(1);
            }
            if (this.ErrorField(getNETID("zRODNECISLO"), "", getNETID("zRODNECISLO").value.length < 10))
            {
                over = false;
                msg += LNG(0);
            }
            if (this.ErrorField(getNETID("zMENO"), "", getNETID("zMENO").value.length < 3))
            {
                over = false;
                msg += LNG(2);
            }
            if (this.ErrorField(getNETID("zPRIEZVISKO"), "", getNETID("zPRIEZVISKO").value.length < 3))
            {
                over = false;
                msg += LNG(3);
            }
            if (this.ErrorField(getNETID("zULICA"), "", getNETID("zULICA").value.length < 3))
            {
                over = false;
                msg += LNG(4);
            }
            else if (this.ErrorField(getNETID("zULICACISLO"), "lblULICA", getNETID("zULICACISLO").value.length < 1))
            {
                over = false;
                msg += LNG(5);
            }
            if (this.ErrorField(getNETID("zPSC"), "lblMESTO", getNETID("zPSC").value.length < 5))
            {
                over = false;
                msg += LNG(6);
            }
            else if (this.ErrorField(getNETID("zMESTO"), "", getNETID("zMESTO").value.length < 3))
            {
                over = false;
                msg += LNG(7);
            }
            if (this.ErrorField(getNETID("zMOBIL"), "", getNETID("zMOBIL").value.length < 5))
            {
                over = false;
                msg += LNG(8);
            }
            if (tmp)
            {
                if (this.ErrorField(getNETID("zFIRMA"), "", getNETID("zFIRMA").value.length < 3))
                {
                    over = false;
                    msg += LNG(9);
                }
                if (this.ErrorField(getNETID("zICO"), "", getNETID("zICO").value.length < 8))
                {
                    over = false;
                    msg += LNG(10);
                }
                if (this.ErrorField(getNETID("zDIC"), "", getNETID("zDIC").value.length < 8))
                {
                    over = false;
                    msg += LNG(11);
                }
                if (this.ErrorField(getNETID("zFAK_ULICA"), "", getNETID("zFAK_ULICA").value.length < 3))
                {
                    over = false;
                    msg += LNG(12);
                }
                else if (this.ErrorField(getNETID("zFAK_ULICACISLO"), "lblFAK_ULICA", getNETID("zFAK_ULICACISLO").value.length < 1))
                {
                    over = false;
                    msg += LNG(13);
                }
                if (this.ErrorField(getNETID("zFAK_PSC"), "lblFAK_MESTO", getNETID("zFAK_PSC").value.length < 5))
                {
                    over = false;
                    msg += LNG(14);
                }
                else if (this.ErrorField(getNETID("zFAK_MESTO"), "", getNETID("zFAK_MESTO").value.length < 3))
                {
                    over = false;
                    msg += LNG(15);
                }
                if (!getNETID("zPOSTOVAADRESA").checked)
                {
                    if (this.ErrorField(getNETID("zPOSTA_ULICA"), "", getNETID("zPOSTA_ULICA").value.length < 3))
                    {
                        over = false;
                        msg += LNG(16);
                    }
                    else if (this.ErrorField(getNETID("zPOSTA_ULICACISLO"), "lblPOSTA_ULICA", getNETID("zPOSTA_ULICACISLO").value.length < 1))
                    {
                        over = false;
                        msg += LNG(17);
                    }
                    if (this.ErrorField(getNETID("zPOSTA_PSC"), "lblPOSTA_MESTO", getNETID("zPOSTA_PSC").value.length < 5))
                    {
                        over = false;
                        msg += LNG(18);
                    }
                    else if (this.ErrorField(getNETID("zPOSTA_MESTO"), "", getNETID("zPOSTA_MESTO").value.length < 3))
                    {
                        over = false;
                        msg += LNG(19);
                    }
                }
                if (this.ErrorField(getNETID("zFIRMA_EMAIL"), "", !check_email(getNETID("zFIRMA_EMAIL").value)))
                {
                    over = false;
                    msg += LNG(20);
                }
                if (this.ErrorField(getNETID("zFIRMA_TELEFON"), "", getNETID("zFIRMA_TELEFON").value.length < 5))
                {
                    over = false;
                    msg += LNG(21);
                }
            }
            if (!over)
            {
                alert(LNG(22) + msg);
                return;
            }
            getNETID("btnPage1").click();
        }

        this.Page1_Watcher = function()
        {
            var tmp = getNETID("zREGISTRACIAFIRMY").checked;
            getNETID("zFIRMA").disabled = !tmp;
            getNETID("zICO").disabled = !tmp;
            getNETID("zDIC").disabled = !tmp;
            getNETID("zICDPH").disabled = !tmp;
            getNETID("zJEICDPH").disabled = !tmp;
            getNETID("zFAK_ULICA").disabled = !tmp;
            getNETID("zFAK_ULICACISLO").disabled = !tmp;
            getNETID("zFAK_PSC").disabled = !tmp;
            getNETID("zFAK_MESTO").disabled = !tmp;
            getNETID("zFAK_IDSTAT").disabled = !tmp;
            getNETID("zPOSTA_ULICA").disabled = !tmp;
            getNETID("zPOSTA_ULICACISLO").disabled = !tmp;
            getNETID("zPOSTA_PSC").disabled = !tmp;
            getNETID("zPOSTA_MESTO").disabled = !tmp;
            getNETID("zPOSTA_IDSTAT").disabled = !tmp;
            getNETID("zPOSTOVAADRESA").disabled = !tmp;
            getNETID("zFIRMA_EMAIL").disabled = !tmp;
            getNETID("zFIRMA_TELEFON").disabled = !tmp;
            getNETID("zFIRMA_FAX").disabled = !tmp;
            if (tmp)
            {
                getNETID("zICDPH").disabled = !getNETID("zJEICDPH").checked;
                tmp = !getNETID("zPOSTOVAADRESA").checked;                    
                getID("FirmaPostovaAdresa").className = (tmp ? "True" : "False");
                getNETID("zPOSTA_ULICA").disabled = !tmp;
                getNETID("zPOSTA_PSC").disabled = !tmp;
                getNETID("zPOSTA_MESTO").disabled = !tmp;
                getNETID("zPOSTA_IDSTAT").disabled = !tmp;
            } else
            {
                getID("lblFIRMA").className="Label";
                getID("lblICO").className="Label";
                getID("lblDIC").className="Label";
                getID("lblICDPH").className="Label";
                getID("lblFAK_ULICA").className="Label";
                getID("lblFAK_MESTO").className="Label";
                getID("lblFAK_IDSTAT").className="Label";
                getID("lblPOSTA_ULICA").className="Label";
                getID("lblPOSTA_MESTO").className="Label";
                getID("lblPOSTA_IDSTAT").className="Label";
                getID("lblFIRMA_EMAIL").className="Label";
                getID("lblFIRMA_TELEFON").className="Label";
                getID("lblFIRMA_FAX").className="Label";
            }
        }

        this.Page1_Run = function ()
        {
            if (!getNETID("Strana1"))
                return;
            if (getNETID("zREGISTRACIAFIRMY"))
            {
                getNETID("zREGISTRACIAFIRMY").onchange = Registracia.Page1_Watcher;
                getNETID("zREGISTRACIAFIRMY").onclick = Registracia.Page1_Watcher;
            }
            if (getNETID("zJEICDPH"))
            {
                getNETID("zJEICDPH").onchange = Registracia.Page1_Watcher;
                getNETID("zJEICDPH").onclick = Registracia.Page1_Watcher;
            }
            if (getNETID("zPOSTOVAADRESA"))
                getNETID("zPOSTOVAADRESA").onchange = Registracia.Page1_Watcher;
            this.Page1_Watcher();
        }

        this.ZakazWarmUp = false;

        this.Page2_OnRetrieveCisla = function (http)
        {
            AjaxLoading(false);
            getID("Cisla").innerHTML = http.responseText;
            getID("Cisla").className = "True";
            getID("ctl00_PageBody_zIDAKCIA_0").disabled = false;
            getID("ctl00_PageBody_zIDAKCIA_1").disabled = ZakazWarmUp;
            getID("ctl00_PageBody_zIDAKCIA_2").disabled = false;
        }

        this.Page2_GetCislaLoad = function ()
        {
            var ajax = ajax_call("/SiteTools/ajaxRegistracia.ashx");
            ajax.successCallback = Registracia.Page2_OnRetrieveCisla;
            ajax.post("l=" + lng + "&Strana=2&Akcia=1,2,3");
        }

        this.Page2_GetCisla = function () // Toto voláme cez Ajax - teda už to nie je trieda        
        {
            Registracia.Page2_Watcher();
            if (!getID("ctl00_PageBody_zIDAKCIA_0").checked)
            {
                getID("Cisla").className = "False";
                return;
            }
            if (getID("Cisla").innerHTML != "")
            {
                getID("Cisla").className = "True";
                return;
            }

            ZakazWarmUp = getID("ctl00_PageBody_zIDAKCIA_1").disabled;
            getID("ctl00_PageBody_zIDAKCIA_0").disabled = true;
            getID("ctl00_PageBody_zIDAKCIA_1").disabled = true;
            getID("ctl00_PageBody_zIDAKCIA_2").disabled = true;
            AjaxLoading(true);
            setTimeout("Registracia.Page2_GetCislaLoad()", 1500);
        }

        this.Page2_Run = function ()
        {
            if (!getID("ctl00_PageBody_zIDAKCIA_0"))
                return;
            getID("ctl00_PageBody_zIDAKCIA_0").onchange = this.Page2_GetCisla;
            getID("ctl00_PageBody_zIDAKCIA_1").onchange = this.Page2_Watcher;
            getID("ctl00_PageBody_zIDAKCIA_0").onclick = this.Page2_GetCisla;
            getID("ctl00_PageBody_zIDAKCIA_1").onclick = this.Page2_Watcher;
            this.Page2_Watcher();
        }

        this.Page2_Watcher = function ()
        {
            if ((getID("ctl00_PageBody_zIDAKCIA_0").checked) || (getID("ctl00_PageBody_zIDAKCIA_1").checked))
                getID("ctl00_PageBody_zIDAKCIA_2").disabled = false;
            else
            {            
                getID("ctl00_PageBody_zIDAKCIA_2").disabled = true;
                getID("ctl00_PageBody_zIDAKCIA_2").checked = false;
            }

            if ((getID("ctl00_PageBody_zIDAKCIA_0").checked) && (getID("ctl00_PageBody_zIDAKCIA_1").checked))
                getID("btnAkcia").className = (getNETID("zCISLO").value == "" ? "buttonDisabled" : "button");
            else if (getID("ctl00_PageBody_zIDAKCIA_0").checked)
                getID("btnAkcia").className = (getNETID("zCISLO").value == "" ? "buttonDisabled" : "button");
            else if (getID("ctl00_PageBody_zIDAKCIA_1").checked)
                getID("btnAkcia").className = "button";
            else
                getID("btnAkcia").className = "buttonDisabled";
        }

        this.Page2_Kontrola = function () // akcia a čísla submit
        {
            if (getID("ctl00_PageBody_zIDAKCIA_0").checked)
            {
                if (getNETID("zCISLO").value == "")
                    return;
            } else
                if (!getID("ctl00_PageBody_zIDAKCIA_1").checked)
                    return;
            getNETID("btnPage2").click();
        }

        this.Page3_Run = function () // podmienky
        {
            if (!getNETID("Strana3"))
                return;
            getNETID("zSUHLASIM").onclick = function () { getID("btnPodmienky").className = (!getNETID("zSUHLASIM").checked ? "buttonDisabled" : "button")};
            getNETID("zSUHLASIM").onchange = getNETID("zSUHLASIM").onclick;
            if (!getNETID("zSUHLASIM").checked)
            {
                getID("btnPodmienky").className = "buttonDisabled";
            }
            else
                getID("btnPodmienky").className = "button";    
        }

        this.Page3_Kontrola = function () // podmienky
        {
            if (!getNETID("zSUHLASIM").checked)
                return;
            getNETID("btnPage3").click();
        }

        this.Page4_Kontrola = function () // spolujazdci
        {
            var over = true;
            if (getNETID("zCHARITA"))
            {
                if (getNETID("zCHARITA").value != "")
                {
                    if (!check_integer(getNETID("zCHARITA").value))
                    {   
                        alert(LNG(23));
                        over = false;
                    }
                }
            }

            if (getNETID("zSPOLUJAZDECAFTERPARTY"))
            {
                if (getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_1").checked)
                {
                    if (!this.Page4_KontrolaSpolujazdec(5))
                        over = false;
                } else if (getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_2").checked)
                {
                    if (getID("ctl00_PageBody_zSPOLUJAZDEC_AFTERPARTY").value == "")
                        over = false;
                }
            }
            if (getNETID("zSPOLUJAZDECWARMUP"))
            {
                if (getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_1").checked)
                {
                    if (!this.Page4_KontrolaSpolujazdec(4))
                        over = false;
                } else if (getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_2").checked)
                {
                    if (getID("ctl00_PageBody_zSPOLUJAZDEC_WARMUP").value == "")
                        over = false;
                }
            }
            if (getNETID("zSPOLUJAZDECREDLINE"))
            {
                if ((getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_1").checked) || (getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_2").checked) || (getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_3").checked))
                {
                    if (!this.Page4_KontrolaSpolujazdec(1))
                        over = false;
                }
                if ((getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_2").checked) || (getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_3").checked))
                {
                    if (!this.Page4_KontrolaSpolujazdec(2))
                        over = false;
                }
                if (getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_3").checked)
                {
                    if (!this.Page4_KontrolaSpolujazdec(3))
                        over = false;
                }
                if (getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_4").checked)
                {
                    if (getID("ctl00_PageBody_zSPOLUJAZDEC_REDLINE").value == "")
                        over = false;
                }
            }
            if (!over)
                return;
            getNETID("btnPage4").click();
        }

        this.Page4DisabledControls = function(enabled)
        {
            if (getNETID("zSPOLUJAZDECAFTERPARTY"))
            {
                getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_0").disabled = !enabled;
                getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_1").disabled = !enabled;
                getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_2").disabled = !enabled;
            }
            if (getNETID("zSPOLUJAZDECWARMUP"))
            {
                getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_0").disabled = !enabled;
                getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_1").disabled = !enabled;
                getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_2").disabled = !enabled;
            }
            if (getNETID("zSPOLUJAZDECREDLINE"))
            {
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_0").disabled = !enabled;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_1").disabled = !enabled;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_2").disabled = !enabled;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_3").disabled = !enabled;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_4").disabled = !enabled;
            }
        }

        this.Page4_Run = function ()
        { 
            if (!getNETID("Strana4"))
                return;
            if (getNETID("zSPOLUJAZDECAFTERPARTY"))
            {
                getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_0").onchange = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_1").onchange = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_0").onclick = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_1").onclick = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_2").onclick = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_2").onclick = this.Page4_Watcher;
            }
            if (getNETID("zSPOLUJAZDECWARMUP"))
            {
                getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_0").onchange = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_1").onchange = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_0").onclick = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_1").onclick = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_2").onclick = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_2").onclick = this.Page4_Watcher;
            }
            if (getNETID("zSPOLUJAZDECREDLINE"))
            {
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_0").onchange = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_1").onchange = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_2").onchange = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_3").onchange = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_4").onchange = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_0").onclick = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_1").onclick = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_2").onclick = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_3").onclick = this.Page4_Watcher;
                getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_4").onclick = this.Page4_Watcher;
            }
            this.Page4_Watcher();
        }

        this.Page4_KontrolaSpolujazdec = function (Index)
        {
            var over = true;
            var name = "zJAZDEC" + Index.toString() + "_";
            if (this.ErrorField(getNETID(name + "MENO"), "", getNETID(name + "MENO").value.length < 3))
                over = false;
            if (this.ErrorField(getNETID(name + "PRIEZVISKO"), "", getNETID(name + "PRIEZVISKO").value.length < 3))
                over = false;
            if (this.ErrorField(getNETID(name + "ULICA"), "", getNETID(name + "ULICA").value.length < 3))
                over = false;
            else if (this.ErrorField(getNETID(name + "ULICACISLO"), "lbl" + name.substr(1, name.length) + "ULICA", getNETID(name + "ULICACISLO").value.length < 1))
                over = false;
            if (this.ErrorField(getNETID(name + "TELEFON"), "", getNETID(name + "TELEFON").value.length < 3))
                over = false;
            if (this.ErrorField(getNETID(name + "PSC"), "lbl" + name.substr(1, name.length) + "MESTO", getNETID(name + "PSC").value.length < 5))
                over = false;
            else if (this.ErrorField(getNETID(name + "MESTO"), "", getNETID(name + "MESTO").value.length < 3))
                over = false;
            if (this.ErrorField(getNETID(name + "RODNECISLO"), "", getNETID(name + "RODNECISLO").value.length < 10))
                over = false;
            if (this.ErrorField(getNETID(name + "EMAIL"), "", !check_email(getNETID(name + "EMAIL").value)))
                over = false;
            return over;
        }

    this.StiahniZoznamSpolujazdkin = function(i)
    {
        switch (i)
        {
            case 1:
                if (getID("spolujazdecRedline4").innerHTML != "") { Registracia.Page4DisabledControls(true); getID("spolujazdecRedline4").className = "True"; return; }
                AjaxLoading(true);
                var ajax = ajax_call("/SiteTools/ajaxRegistracia.ashx");
                ajax.successCallback = function(http) {AjaxLoading(false); Registracia.Page4DisabledControls(true); getID("spolujazdecRedline4").innerHTML = http.responseText; getID("spolujazdecRedline4").className = "True"}
                ajax.post("l=" + lng + "&Strana=4&IdAkcia=1");
                break;
            case 2:
                if (getID("spolujazdecWarmUp2").innerHTML != "") { Registracia.Page4DisabledControls(true); getID("spolujazdecWarmUp2").className = "True"; return; }
                AjaxLoading(true);
                var ajax = ajax_call("/SiteTools/ajaxRegistracia.ashx");
                ajax.successCallback = function(http) {AjaxLoading(false); Registracia.Page4DisabledControls(true); getID("spolujazdecWarmUp2").innerHTML = http.responseText; getID("spolujazdecWarmUp2").className = "True"}
                ajax.post("l=" + lng + "&Strana=4&IdAkcia=2");
                break;
            case 3:
                if (getID("spolujazdecAfterParty2").innerHTML != "") { Registracia.Page4DisabledControls(true); getID("spolujazdecAfterParty2").className = "True"; return; }
                AjaxLoading(true);
                var ajax = ajax_call("/SiteTools/ajaxRegistracia.ashx");
                ajax.successCallback = function(http) {AjaxLoading(false); Registracia.Page4DisabledControls(true); getID("spolujazdecAfterParty2").innerHTML = http.responseText; getID("spolujazdecAfterParty2").className = "True"}
                ajax.post("l=" + lng + "&Strana=4&IdAkcia=3");
                break;
        }
    }

        this.Page4_Watcher = function()
        {
            if (getNETID("zSPOLUJAZDECAFTERPARTY")) // vybral si aj after party
            {
                if (getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_1").checked)
                    getID("spolujazdecAfterParty1").className = "True";
                else
                    getID("spolujazdecAfterParty1").className = "False";
                if (getID("ctl00_PageBody_zSPOLUJAZDECAFTERPARTY_2").checked)
                {
                    Registracia.Page4DisabledControls(false);
                    Registracia.StiahniZoznamSpolujazdkin(3);
                } else
                    getID("spolujazdecAfterParty2").className = "False";
            } else
                 getID("SpolujazdecAfterParty").className = "False";

            if (getNETID("zSPOLUJAZDECWARMUP")) // vybral si aj warm up
            {
                if (getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_1").checked)
                    getID("spolujazdecWarmUp1").className = "True";
                else
                    getID("spolujazdecWarmUp1").className = "False";
                if (getID("ctl00_PageBody_zSPOLUJAZDECWARMUP_2").checked)
                {
                    Registracia.Page4DisabledControls(false);
                    Registracia.StiahniZoznamSpolujazdkin(2);
                } else
                    getID("spolujazdecWarmUp2").className = "False";
            } else
                getID("SpolujazdecWarmUp").className = "False";

            if (getNETID("zSPOLUJAZDECREDLINE")) // vybral si aj redline 2009
            {
                if ((getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_1").checked) || (getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_2").checked) || (getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_3").checked))
                    getID("spolujazdecRedline1").className = "True";
                else
                    getID("spolujazdecRedline1").className = "False";
                if ((getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_2").checked) || (getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_3").checked))
                    getID("spolujazdecRedline2").className = "True";
                else
                    getID("spolujazdecRedline2").className = "False";
                if (getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_3").checked)
                    getID("spolujazdecRedline3").className = "True";
                else
                    getID("spolujazdecRedline3").className = "False";
                if (getID("ctl00_PageBody_zSPOLUJAZDECREDLINE_4").checked)
                {
                    Registracia.Page4DisabledControls(false);
                    Registracia.StiahniZoznamSpolujazdkin(1);
                } else
                    getID("spolujazdecRedline4").className = "False";

            } else
                getID("SpolujazdecRedline").className = "False";
        }

        this.Page5_Kontrola = function () // vozidlo submit
        {
            var over = true;
            getNETID("zCENA").value = getNETID("zCENA").value.replace(/\s/ig, "");
            getNETID("zVYKON").value = getNETID("zVYKON").value.replace(/\s/ig, "");
            getNETID("zOBJEM").value = getNETID("zOBJEM").value.replace(/\s/ig, "");
            if (this.ErrorField(getNETID("zZNACKA"), "", getNETID("zZNACKA").value.length < 2))
                over = false;
            if (this.ErrorField(getNETID("zMODEL"), "", getNETID("zMODEL").value.length < 2))
                over = false;
            if (this.ErrorField(getNETID("zROKVYROBY"), "", getNETID("zROKVYROBY").value.length != 4))
                over = false;
            if (this.ErrorField(getNETID("zFARBA"), "", getNETID("zFARBA").value.length < 3))
                over = false;
            if (this.ErrorField(getNETID("zVYKON"), "", getNETID("zVYKON").value.length < 2))
                over = false;
            else if (this.ErrorField(getNETID("zVYKON"), "", !check_integer(getNETID("zVYKON").value)))
                over = false;
            if (this.ErrorField(getNETID("zSPZ"), "", getNETID("zSPZ").value.length < 4))
                over = false;
            if (this.ErrorField(getNETID("zOBJEM"), "", getNETID("zOBJEM").value.length < 4))
                over = false;
            else if (this.ErrorField(getNETID("zOBJEM"), "", !check_integer(getNETID("zOBJEM").value)))
                over = false;
            if (this.ErrorField(getNETID("zCENA"), "", getNETID("zCENA").value.length < 3))
                over = false;
            else if (this.ErrorField(getNETID("zCENA"), "", !check_integer(getNETID("zCENA").value)))
                over = false;
            if (!over)
                return;
            getNETID("btnPage5").click();
        }

        this.Page0_Kontrola_Karty = function ()
        {
            var over = true;
            if (this.ErrorField(getNETID("zKARTA_CISLO"), "", getNETID("zKARTA_CISLO").value.replace(/\s/ig, "").length != 16))
                over = false;
            else if (this.ErrorField(getNETID("zKARTA_CISLO"), "", !check_integer(getNETID("zKARTA_CISLO").value.replace(/\s/ig, ""))))
                over = false;
            if (this.ErrorField(getNETID("zKARTA_PIN"), "", getNETID("zKARTA_PIN").value.length != 4))
                over = false;
            else if (this.ErrorField(getNETID("zKARTA_PIN"), "", !check_integer(getNETID("zKARTA_PIN").value)))
                over = false;
            return over;
        }

        this.Page0_OnRetrieveKarta = function (http)
        {
            AjaxLoading(false);
            if (http.responseText.toLowerCase() == "true")
            {
                getID("KartaError1").className = "False";
                getID("KartaError2").className = "False";
                getNETID("btnPage0").click();
            }
            else
            {
                if (http.responseText.toLowerCase() == "false1")
                {
                    getID("KartaError1").className = "True";
                    getID("KartaError2").className = "False";
                } else
                {
                    getID("KartaError1").className = "False";
                    getID("KartaError2").className = "True";
                }
                getID("Page0Button").innerHTML = LNG(24);
                getID("Page0Button").style.display = "block";
            }
        }

        this.Page0_Kontrola_Karty_Ajax = function ()
        {
            var ajax = ajax_call("/SiteTools/ajaxRegistracia.ashx");
            ajax.successCallback = Registracia.Page0_OnRetrieveKarta;
            ajax.post("l=" + lng + "&Karta=" + (getID("ctl00_PageBody_zIDKARTA_1").checked ? "1" : "2") + "&zCISLOKARTY=" + getNETID("zKARTA_CISLO").value.replace(/\s/ig, "") + "&zPIN=" + getNETID("zKARTA_PIN").value);
        }

        this.Page0_Kontrola = function () // karty submit
        {
            if (!getID("ctl00_PageBody_zIDKARTA_0").checked)
            {
                if (!this.Page0_Kontrola_Karty())
                    return;
                AjaxLoading(true);
                getID("Page0Button").style.display = "none";
                setTimeout("Registracia.Page0_Kontrola_Karty_Ajax()", 1500);                
            } else
                getNETID("btnPage0").click();
        }

        this.Page0_Watcher = function ()
        {
            if (getID("ctl00_PageBody_zIDKARTA_1").checked)
            {
                getID("Page0Button").innerHTML = "OVERENIE KARTY";
                getID("KartaFormular").className = "True";
            }
            else if (getID("ctl00_PageBody_zIDKARTA_2").checked)
            {
                getID("KartaFormular").className = "True";
                getID("Page0Button").innerHTML = "OVERENIE KARTY";
            }
            else
            {
                getID("KartaError1").className = "False";
                getID("KartaError2").className = "False";
                getID("Page0Button").innerHTML = (lng == "EN" ? "CONTINUE" : "POKRAČOVAŤ");
                getID("KartaFormular").className = "False";
            }
        }

        this.Page0_Run = function ()
        {
            getID("ctl00_PageBody_zIDKARTA_0").onchange = Registracia.Page0_Watcher;
            getID("ctl00_PageBody_zIDKARTA_1").onchange = Registracia.Page0_Watcher;
            getID("ctl00_PageBody_zIDKARTA_2").onchange = Registracia.Page0_Watcher;
            getID("ctl00_PageBody_zIDKARTA_0").onclick = Registracia.Page0_Watcher;
            getID("ctl00_PageBody_zIDKARTA_1").onclick = Registracia.Page0_Watcher;
            getID("ctl00_PageBody_zIDKARTA_2").onclick = Registracia.Page0_Watcher;
            this.Page0_Watcher();
        }
    }

    function TdThisSelected(o)
    {
        var value = getNETID("zCISLO").value;
        if (value == "")
            o.className = "selected";
        else
        {
            getID("RadioAkciaTd1_" + value).className = "normal";
            o.className = "selected";
        }
        getID("btnAkcia").className = "button";
        getNETID("zCISLO").value = o.innerHTML;
        getID("Cislo").innerHTML = o.innerHTML;
    }
