
// username - 2-30 chars, uc, lc, and underscore only.

function checkUsername1 (strng) {
var error = "";
if (strng == "") {
   error = "-- Nu ati introdus Numele titularului.\n";
}

    if (strng.length > 30) {
       error = "-- Numele titularului este prea lung (maxim 30 caractere).\n";
    }

return error;
}       

function checkUsername2 (strng) {
var error = "";
if (strng == "") {
   error = "-- Nu ati introdus Prenumele titularului.\n";
}

    if (strng.length > 30) {
       error = "-- Prenumele titularului este prea lung (maxim 30 caractere).\n";
    }

return error;
}   

// valid selector from dropdown list

function checkDropdown(choice, index) {
var categorie = window.document.formular.select_1.options[window.document.formular.select_1.options.selectedIndex].value;
var error = "";
    if (choice == 0 & index==1) {
    error = "-- Nu ati selectat o Categorie de modele de carti de vizita.\n";
    }
    if (choice == 0 & index==2 & categorie!='model_propriu') {
    error = "-- Nu ati selectat un Model de carte de vizita.\n";
    }
		if (choice == 0 & index==3) {
    error = "-- Nu ati selectat Modul de Livrare.\n";
    }
		if (choice == 0 & index==4) {
    error = "-- Nu ati selectat Modul de Plata.\n";
    }
return error;
}    

function checkEmpty (strng) {
var error = "";
if (strng == "")
   return true;
}

function checkEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formular.email_bt.value)){
return (true)
}
}
function RadioChecked(radios) {
         // This function makes it easy to check if a radio button field has been clicked
         message = false;	
         for (i=0, n=radios.length; i<n; i++) {
            if (radios[i].checked) {
               message = true;
            }
        }
         return message;
      }
