function SaveContact()
{
    errors = "";
    
    if (trim($("txMessage").value).length <= 0)
    {
        errors += " - completati campul \"Mesaj\";\n";
    }
    
    if (trim($("txName").value).length <= 0)
    {
        errors += " - completati campul \"Nume\";\n";
    }
    
    /*if (((trim($("txPhone").value).length <= 0)||(!isPhoneValid( $("txPhone").value)))&&((trim($("txEmail").value).length <= 0)||(!isEmail( $("txEmail").value))))
    {
        errors +=  " - introduceti valori valide in unul din campurile \"Telefon\" sau \"Email\";\n";
    }*/
    
    if (((trim($("txEmail").value).length <= 0)||(!isEmail( $("txEmail").value))))
    {
        errors +=  " - introduceti o valoare valida in campul \"Email\";\n";
    }
    
    if (trim($("txPhone").value).length > 0 && (!isPhoneValid($("txPhone").value)))
    {
        errors += " - introduceti o valoare valida in campul \"Telefon\";\n";
    }                
    
    if ($("ddAddressees").value == "0")
    {
        errors += " - alegeti un destinatar;\n";
    }   
    else
    {
        var val = $("ddAddressees").value;  
        document.getElementById("hAddresseeID").value = val.split('^')[0];
        document.getElementById("hAddresseeEmail").value = val.split('^')[1];
    } 
    
   
    if (errors.length > 0)
    {
        alert("Va rugam sa remediati urmatoarele probleme:\n" +errors);  
        return false;      
    }
    else
    {
        document.getElementById("hAction").value = "SaveContact";             
//        document.getElementById("frmMain").submit();
        return true;
    }
}

function focusOn(element)
{
    $(element).className = "b1pc3";
}

function focusOff(element)
{
    $(element).className = "b1pc9";
}

function setFocus(elem)
{
	document.getElementById(elem).focus();
}
