<!--//
$(document).ready(function() {
    $("#wait").dialog({
        autoOpen: false,
        modal:true,
        height: 35,
        width: 200,
        draggable: false,
        resizable: false
    });    
});

function Trim()
{
    var newstr = this + "";
    while(newstr.charAt(0) == " ") 
        newstr = newstr.substring(1, newstr.length); 
    while(newstr.charAt(newstr.length) == " ") 
        newstr = newstr.substring(0, newstr.length-1);      
    return newstr;
}

String.prototype.Trim = Trim;


function controlla_alfanum(campo,valori){
	var checkStr=campo.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < valori.length;  j++)
			if (ch == valori.charAt(j))
			   break;
		if (j == valori.length)
		{
			allValid = false;
			break;
		}
	}
	return allValid;
}

function controlla_specialchar(campo,valori){ 
	var checkStr=campo;
	var allValid = false;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < valori.length;  j++)
			if (ch == valori.charAt(j))
			{
				allValid = true;
				break;
			}
		if(allValid)
			break;
	}
	return allValid;
}

function ValidEmail(item){
    var mail
	var lsAT;
	var lsDOT;
	mail = item.value.Trim();
	lsAT = mail.indexOf("@");
	lsDOT = mail.indexOf(".");
	if (lsAT == -1 || lsDOT == -1 || mail.indexOf(" ") != -1) {
		return false;
	}
	return true;
}
//-->
