function submitOnEnter(e) {
	if (window.event && window.event.keyCode == 13) {
		doLogin();
	}
	else if (e.keyCode == 13) {
		doLogin();
	}
}

function onRegisterPressed()
{
    $("formRegistration").style.display = "block";
    $("txUsername").focus();
}

function doLogin()
{
    var errors = "";
    
    if (trim($("txEmail").value) == "")
    {
        errors += "-introduceti un nume de user \n";
    }
    
    if (trim($("txPassword").value) == "")
    {
        errors += getJSPH("Login_introduceti o parola")+" \n";
    }
    
    if (errors.length > 0)
    {
        alert(getJSPH("Contact_RemediatiProblemele")+" \n" + errors);
    }
    else
    {
        $("hAction").value = "Login";
        $("frmMain").submit();
    }
}

function doSubscribe()
{
    var errors = "";
    
    try{
        if (trim($("txUsername").value) == "")
        {
            errors += "- introduceti un nume de utilizator \n";
        }
    }catch(Ex){}
    try{
        if ((trim($("txFormEmail").value) == "") || (!isEmail($("txFormEmail").value)))
        {
            errors += getJSPH("Login_introduceti o adresa de e-mail valida")+" \n";
        }
    }catch(Ex){}
    try{    
        if (trim($("txFormPassword").value).length < 6)
        {
            errors += getJSPH("Login_campul Parola trebuie sa aiba minim 6 caractere")+" \n";
        }
    }catch(Ex){}
    try{     
        if (trim($("txFormPasswordCheck").value) == "")
        {
            errors += getJSPH("Login_completati campul Parola, din nou")+" \n";
        }
    }catch(Ex){}
    try{    
        if (trim($("txFormPassword").value) != trim($("txFormPasswordCheck").value))
        {
            errors += getJSPH("Login_introduceti acelasi text in campurile Parola si Parola, din nou")+"\n";
        }
    }catch(Ex){}
    try{     
        if (trim($("txName").value).length == 0) 
        {
            errors += getJSPH("Login_completati campul Nume si prenume")+" \n";
        }
    }catch(Ex){}
    try{    
        if (trim($("txAddress").value).length == 0) 
        {
            errors += getJSPH("Login_completati campul Adresa")+" \n";
        }
    }catch(Ex){}
    try{     
        if ($("ddDomeniu").selectedIndex == 0)
        {
            errors += getJSPH("Login_alegeti un domeniu")+" \n";
        }
    }catch(Ex){}
    try{     
        if (trim($("txCity").value).length == 0) 
        {
            errors += getJSPH("Login_completati campul Localitate, judet")+" \n";
        }
    }catch(Ex){}
    try{     
        if (trim($("txPhone").value).length == 0)
        {
            errors += getJSPH("Login_completati campul Telefon cu un numar de telefon valid")+" \n"; 
        }
    }catch(Ex){}
    
    if (errors.length > 0)
    {
        alert(getJSPH("Contact_RemediatiProblemele")+" \n" + errors);
    }
    else
    {
        $("hAction").value = "Subscribe";
        $("frmMain").submit();
    }
}

function changeTx()
{
    if ($("ckAltceva").checked)
    {
        $("txAltceva").disabled = false;
    }
    else
    {
        $("txAltceva").value="";
        $("txAltceva").disabled = true;
    }
}
function showDiv(element)
{
    $(element).style.display = "block";
}

function hideDiv(element)
{
    $(element).style.display = "none";
}

