function checktext(which) {
//var badchars = '/\:%&$#~<>^*+=;(){}[]'; // invalid characters in text box
var badchars = ''; // invalid characters in text box
var name = which.value;
for (var x=0; x < name.length; x++) {
if (badchars.indexOf(name.charAt(x))!=-1) {
alert ("Ati introdus caractere nepermise! - /\:%&$#~<>^*+=;(){}[] -  Incercati din nou!");
which.value=""; // clear the textbox - if required
which.focus(); // set the focus back to the textbox
which.select();
return false;
}
}
}


function checknumar(which) {
var numbers = '0123456789'; // cifre
var allValid = true;
var name = which.value;

for (i = 0;  i < name.length;  i++)
{
    ch = name.charAt(i);
    for (j = 0;  j < numbers.length;  j++)
        if (ch == numbers.charAt(j))
        break;
        if (j == numbers.length)
        {
           allValid = false;
           break;
        }
}
if (!allValid)
{
alertsay = "Trebuie sa introduceti doar cifre. Incercati din nou! ";

alert(alertsay);
which.value=""; // clear the textbox - if required
which.focus(); // set the focus back to the textbox
which.select();
return (false);

}

}
