function checkData(theValue,typeData) {
	document.getElementById('img_' + typeData).src = getIMG('LOADING');
	var params = 'mod=users&file=register&action=checkData&typeData=' + typeData + '&value=' + theValue;
	ajaxObj.call(params, ctrlData);
}
function ctrlData(resp) {
	if(resp) {
		if(resp.error) {
			//ERRORI
			document.getElementById('img_' + resp.typeData).src = getIMG('KO');
		} else {
			//NESSUN ERRORE
			document.getElementById('img_' + resp.typeData).src = getIMG('OK');
		}
		//Nuovo valore
		if(resp.newValue) {
			document.getElementById('input_' + resp.typeData).value = resp.newValue;
		}
		//Messaggi
		if(resp.message) {
			document.getElementById('message_' + resp.typeData).innerHTML = resp.message;
		}
	} else {
		alert('Errore imprevisto del server');
	}
}
/**
 * Controllo password
 */
function checkPassword(psw,isPsw2) {
	typePsw = isPsw2 ? 'password2' : 'password';
	if(psw.length < 5) {
		document.getElementById('img_' + typePsw).src = getIMG('KO');
		document.getElementById('message_' + typePsw).innerHTML = 'Password troppo corta';
		return false;
	} else if(psw.length > 30) {
		document.getElementById('img_' + typePsw).src = getIMG('KO');
		document.getElementById('message_' + typePsw).innerHTML = 'Password troppo lunga';
		return false;
	} else {
		document.getElementById('img_' + typePsw).src = getIMG('OK');
		document.getElementById('message_' + typePsw).innerHTML = 'Ok';
	}
	if(isPsw2) {
		//Controllo password di conferma
		if(psw != document.getElementById('input_password').value) {
			document.getElementById('img_' + typePsw).src = getIMG('KO');
			document.getElementById('message_' + typePsw).innerHTML = 'Le due password non corrispondono';
		} else {
			document.getElementById('img_' + typePsw).src = getIMG('OK');
			document.getElementById('message_' + typePsw).innerHTML = 'Ok';
		}
	}
}
/**
 * Recupero valore immagine
 * 
 */
function getIMG(imgName) {
	return document.getElementById('img' + imgName).src;
}
