function onRegisterPressed()
{
    $("formRegistration").style.display = "block";
    $("txName").focus();
}

function doLogin()
{
    var errors = "";
    
    if ((trim($("txEmail").value) == "") || (!isEmail($("txEmail").value)))
    {
        errors += getJSPH("EmailValid");
    }
    
    if (trim($("txPassword").value) == "")
    {
        errors += getJSPH("IntroducetiParola"); 
    }
    
    if (errors.length > 0)
    {
		alert(getJSPH("RemediatiProblemele")+" \n" + errors);
		
    }
    else
    {
        $("hAction").value = "Login";
        $("frmMain").submit();
    }
}

function doSubscribe()
{
    var errors = "";
    var string = document.getElementById("txName").value;
	var character = " ";
	var pos = string.indexOf(character);
    
    if ((trim($("txName").value).length == 0) || (pos<=0) || (pos>=string.length))
    {
        errors += getJSPH("IntroducetiNume");
    }
    
    if (trim($("txAddress").value).length == 0) 
    {
        errors += getJSPH("IntroducetiAdresa");
    }
    
    if ($("txCounty").selectedIndex == 0)
    {
        errors += getJSPH("AlegetiJudet");
    }
    
    if (trim($("txCity").value).length == 0) 
    {
        errors += getJSPH("CompletatiLocalitate");
    }
    
    if ((trim($("txPhone").value).length == 0) || (!isPhoneValid(trim($("txPhone").value))))
    {
        errors += getJSPH("TelefonValid");
    }
    
    if ((trim($("txFormEmail").value) == "") || (!isEmail($("txFormEmail").value)))
    {
        errors += getJSPH("EmailValid");
    }
    
    if (trim($("txFormPassword").value).length < 6)
    {
        errors += getJSPH("Minim6Caractere");
    }
    
    if (trim($("txFormPasswordCheck").value) == "")
    {
        errors += getJSPH("ParolaDinNou");
    }
    
    if (trim($("txFormPassword").value) != trim($("txFormPasswordCheck").value))
    {
        errors += "- introduceti acelasi text in campurile \"Parola\" si \"Parola, din nou\"; \n";
    }
	
	if(!document.getElementById('ckTermeni').checked)
    {
        errors += ' - Trebuie sa fiti de acord cu termenii si conditiile;\n';
    } 
    
    if (errors.length > 0)
    {
        alert(getJSPH("RemediatiProblemele")+" \n" + errors);
    }
    else
    {
        $("hAction").value = "Subscribe";
        $("frmMain").submit();
    }
}

function showDiv(element)
{
    $(element).style.display = "block";
}

function hideDiv(element)
{
    $(element).style.display = "none";
}


