function checkRegisterNEW(objForm,step,area) {
	var err="";
	var step = objForm.STEP.value;
	
	//---------------------------------------------------
	if(step=="1") {		
		//indCellPrefix = objForm.indCellPrefix.options[objForm.indCellPrefix.selectedIndex].value;	
		if (isEmpty(objForm.indFirstName.value))			err += "Il campo \"nome\" è obbligatorio.\r\n";
		if (isEmpty(objForm.indLastName.value))				err += "Il campo \"cognome\" è obbligatorio.\r\n";
		if (objForm.indCellPrefix.selectedIndex<1)			err += "Il campo \"prefisso cellulare\" è obbligatorio.\r\n";
		if (isEmpty(objForm.indCellNumber.value))			err += "Il campo \"numero cellulare\" è obbligatorio.\r\n";
		else if (!isAllDigit(objForm.indCellNumber.value))	err += "Il campo \"numero cellulare\" deve essere composto da soli numeri.\r\n";
		if(objForm.CheckPassword) {
			if (isEmpty(objForm.CheckPassword.value))			err += "Il campo \"password\" è obbligatorio.\r\n";
			else if ((objForm.CheckPassword.value).length < 6)	err += "Il campo \"password\" deve essere almeno di 6 caratteri.\r\n";
		}
			
		if (err== "") 
			objForm.STEP.value=2;
	}
	//---------------------------------------------------
	if(step=="2") {
		var indWebPassword1 = objForm.indWebPassword1.value;
		var indWebPassword2 = objForm.indWebPassword2.value;
		
		if(objForm.FCCPgroupLabel) {
			if (isEmpty(objForm.FCCPgroupLabel.value))		err += "Il campo \"squadra\" è obbligatorio.\r\n";	
		}
		
		if (isEmpty(objForm.indFirstName.value))			err += "Il campo \"nome\" è obbligatorio.\r\n";
		if (isEmpty(objForm.indLastName.value))				err += "Il campo \"cognome\" è obbligatorio.\r\n";
		if (isEmpty(objForm.indWebUser.value))				err += "Il campo \"username\" è obbligatorio.\r\n";
		
		if (isEmpty(indWebPassword1))						err += "Il campo \"password\" è obbligatorio.\r\n";
		else if (indWebPassword1.length < 6)				err += "Il campo \"password\" deve essere almeno di 6 caratteri.\r\n";
		if (isEmpty(indWebPassword2))						err += "Il campo \"conferma password\" è obbligatorio.\r\n";
		else if (indWebPassword1 != indWebPassword2)		err += "Le password non sono uguali.\r\n";		
		
		if(objForm.indBirthday) {
			if (isEmpty(objForm.indBirthday.value))				err += "Il campo \"data di nascita\" è obbligatorio.\r\n";
			else if (!isDate(objForm.indBirthday.value))		err += "Il campo \"data di nascita\" deve essere una data valida.\r\n";
		}

		if (isEmpty(objForm.indEmail.value))				err += "Il campo \"e-mail\" è obbligatorio.\r\n";
		else if (!isEmail(objForm.indEmail.value))			err += "Il campo \"e-mail\" deve essere un indirizzo valido.\r\n";
		
		if (objForm.indCellPrefix.selectedIndex<1)			err += "Il campo \"prefisso cellulare\" è obbligatorio.\r\n";
		if (isEmpty(objForm.indCellNumber.value))			err += "Il campo \"numero cellulare\" è obbligatorio.\r\n";
		else if (!isAllDigit(objForm.indCellNumber.value))	err += "Il campo \"numero cellulare\" deve essere composto da soli numeri.\r\n";
/*
		if(objForm.indAddress) {
			if (isEmpty(objForm.indAddress.value))				err += "Il campo \"indirizzo personale\" è obbligatorio.\r\n";
		}
		if(objForm.indZip) {
			if (isEmpty(objForm.indZip.value))					err += "Il campo \"cap personale\" è obbligatorio.\r\n";
			else if (!isAllDigit(objForm.indZip.value))			err += "Il campo \"cap personale\" deve essere composto da soli numeri.\r\n";
		}
		if(objForm.indCity) {
			if (isEmpty(objForm.indCity.value))					err += "Il campo \"città personale\" è obbligatorio.\r\n";
		}
		if(objForm.indProvince) {
			if (isEmpty(objForm.indProvince.value))				err += "Il campo \"provincia personale\" è obbligatorio.\r\n";
		}
	*/
		if (isEmpty(objForm.pvRagSoc.value))				err += "Il campo \"negozio\" è obbligatorio.\r\n";
		if (isEmpty(objForm.pvAddress.value)) 				err += "Il campo \"indirizzo negozio\" è obbligatorio.\r\n";
		if (isEmpty(objForm.pvZip.value))					err += "Il campo \"cap negozio\" è obbligatorio.\r\n";
		else if (!isAllDigit(objForm.pvZip.value))			err += "Il campo \"cap negozio\" deve essere composto da soli numeri.\r\n";
		if (isEmpty(objForm.pvCity.value))					err += "Il campo \"città negozio\" è obbligatorio.\r\n";
		if (isEmpty(objForm.pvProvince.value)) 				err += "Il campo \"provincia negozio\" è obbligatorio.\r\n";

		if(objForm.indPhonePrefix) {
			if (isEmpty(objForm.indPhonePrefix.value))			err += "Il campo \"prefisso negozio\" è obbligatorio.\r\n";
			else if (!isAllDigit(objForm.indPhonePrefix.value))	err += "Il campo \"prefisso negozio\" deve essere composto da soli numeri.\r\n";
		}			
		if(objForm.indPhoneNumber) {
			if (isEmpty(objForm.indPhoneNumber.value))			err += "Il campo \"numero negozio\" è obbligatorio.\r\n";
			else if (!isAllDigit(objForm.indPhoneNumber.value))	err += "Il campo \"numero negozio\" deve essere composto da soli numeri.\r\n";
		}
		
		if (objForm.info[0].checked == false)				err += "E' obbligatorio aderire al trattamento dei dati.\r\n";
		
		if (err== "")  
			objForm.STEP.value=3;
	}
	
	//-----------------------------------------------
	if (err!= "") {
		alert(err);
		return false;
	} else {
		return true;
	}
}


function checkRegister(type)
{

	var err = "";
	var indFirstName = document.mainForm.indFirstName.value;
	var indLastName = document.mainForm.indLastName.value;
	var indWebUser = document.mainForm.indWebUser.value;
	var indWebPassword1 = document.mainForm.indWebPassword1.value;
	var indWebPassword2 = document.mainForm.indWebPassword2.value;
	var indBirthday = document.mainForm.indBirthday.value;
	var indCellPrefix = document.mainForm.indCellPrefix.value;
	var indCellNumber = document.mainForm.indCellNumber.value;
	
	var indEmail = document.mainForm.indEmail.value;
	var info = document.mainForm.info[0].checked;
	
	if (isEmpty(indFirstName))
		err += "Il campo \"nome\" è obbligatorio.\r\n";

	if (isEmpty(indLastName))
		err += "Il campo \"cognome\" è obbligatorio.\r\n";

	if (isEmpty(indWebUser))
		err += "Il campo \"username\" è obbligatorio.\r\n";

	if (isEmpty(indWebPassword1))
		err += "Il campo \"password\" è obbligatorio.\r\n";
	else if (indWebPassword1.length < 6)
		err += "Il campo \"password\" deve essere almeno di 6 caratteri.\r\n";

	if (isEmpty(indWebPassword2))
		err += "Il campo \"conferma password\" è obbligatorio.\r\n";
		
	if (indWebPassword1 != indWebPassword2)
		err += "Le password non sono uguali.\r\n";

	if (isEmpty(indBirthday))
		err += "Il campo \"data di nascita\" è obbligatorio.\r\n";
	else if (!isDate(indBirthday))
		err += "Il campo \"data di nascita\" deve essere una data valida.\r\n";
	

	if (isEmpty(indCellPrefix))
		err += "Il campo \"prefisso cellulare\" è obbligatorio.\r\n";

	if (isEmpty(indCellNumber))
		err += "Il campo \"numero cellulare\" è obbligatorio.\r\n";
	else if (!isAllDigit(indCellNumber))
		err += "Il campo \"numero cellulare\" deve essere composto da soli numeri.\r\n";
	

	if (isEmpty(indCellNumber))
		err += "Il campo \"e-mail\" è obbligatorio.\r\n";
	else if (!isEmail(indEmail))
		err += "Il campo \"e-mail\" deve essere un indirizzo valido.\r\n";

	if (type == "FC" || type == "FCCP") 
	{
		var indCellType = 0;
		if (type == "FC")
			indCellType = document.mainForm.indCellType.value;

		if (indCellType.length == 0 && type == "FC")
			err += "Il campo \"tipo cellulare\" è obbligatorio.\r\n";
		var indAddress = document.mainForm.indAddress.value;
		var indZip = document.mainForm.indZip.value;
		var pvZip = document.mainForm.pvZip.value;
		var indCity = document.mainForm.indCity.value;
		var indProvince = document.mainForm.indProvince.value;

		/* ale: disabilitata obbligatorietà come da richiesta siemens 09/10/2008
		if (indAddress.length == 0)
			err += "Il campo \"indirizzo personale\" è obbligatorio.\r\n";

		if (indZip.length == 0 || !isAllDigit(indZip))
			err += "Il campo \"cap personale\" è obbligatorio e deve essere numerico.\r\n";

		if (indCity.length == 0)
			err += "Il campo \"città personale\" è obbligatorio.\r\n";

		if (indProvince.length == 0)
			err += "Il campo \"provincia personale\" è obbligatorio.\r\n";
		*/
			
		if (!isEmpty(pvZip) && !isAllDigit(pvZip))
			err += "Il campo \"cap negozio\" deve essere numerico.\r\n";




		var pvRagSoc = document.mainForm.pvRagSoc.value;
		if (pvRagSoc.length == 0)
			err += "Il campo \"negozio\" è obbligatorio.\r\n";

		if (type == "FCCP")
		{
			var indPhonePrefix = document.mainForm.indPhonePrefix.value;
			if (indPhonePrefix.length == 0)
				err += "Il campo \"prefisso del negozio\" è obbligatorio.\r\n";
			
			var indPhoneNumber = document.mainForm.indPhoneNumber.value;
			if (indPhoneNumber.length == 0)
				err += "Il campo \"numero del negozio\" è obbligatorio.\r\n";
		}
		
		var pvAddress = document.mainForm.pvAddress.value;
		if (pvAddress.length == 0)
			err += "Il campo \"indirizzo negozio\" è obbligatorio.\r\n";
			
		pvZip = document.mainForm.pvZip.value;
		if (pvZip.length == 0)
			err += "Il campo \"cap negozio\" è obbligatorio.\r\n";
		
		var pvCity = document.mainForm.pvCity.value;
		if (pvCity.length == 0)
			err += "Il campo \"città negozio\" è obbligatorio.\r\n";
		
		var pvProvince = document.mainForm.pvProvince.value;
		if (pvProvince.length == 0)
			err += "Il campo \"provincia negozio\" è obbligatorio.\r\n";
		
		var indWorkFromYear = document.mainForm.indWorkFromYear.value;
		if (indWorkFromYear.length == 0)
			err += "indica da quando lavori nel campo della telefonia.\r\n";
		
		var indWorkInPVYear = document.mainForm.indWorkInPVYear.value;
		if (indWorkInPVYear.length == 0)
			err += "indica l'anno di inizio collaborazione.\r\n";



	} 
	else 
	{
		if (type == "MP") 
		{
			var societa = document.mainForm.societa.value;
			var agenzia = document.mainForm.agenzia.value;
			if (societa.length == 0)
				err += "Il campo \"societa\" è obbligatorio.\r\n";
			if (agenzia.length == 0)
				err += "Il campo \"agenzia\" è obbligatorio.\r\n";
		}
		var areacommerciale = document.mainForm.areacommerciale.value;
		if (areacommerciale.length == 0)
			err += "Il campo \"area commerciale\" è obbligatorio.\r\n";
	}
	
	if (info == false)
		err += "E' obbligatorio aderire al trattamento dei dati.\r\n";
		
	if (err.length > 0)
	{
		alert(err);
		return false;
	} else {
		document.mainForm.mode.value=1;
		return true;
	}
	//document.mainForm.submit();
}

function checkCode()
{
	var err = "";
	var sCode = document.codeForm.activationCode.value;

	if (sCode.length == 0)
		err += "Inserire il codice di attivazione.\r\n";
	
	if (err.length > 0)
	{
		alert(err);
		return false;
	} else {
		//document.codeForm.mode.value = 2;
		var iWidth = 482;
		var iHeight = 550;
		var iX = (window.screen.availWidth - iWidth) >> 1;
		var iY = (window.screen.availHeight - iHeight) >> 1;
		var objNewWindow = window.open("registerFC.asp?activationCode=" + sCode + "&a=FCCP",
					   "register",
					   "toolbar=no,directories=no,menubar=no,scrollbars=yes,left=" + iX + ",top=" + iY + ",width=" + iWidth + ",height=" + iHeight,
					   false);
		return true;
	}
}

function checkLogin()
{
	var err = "";
	var sUsername = document.frmLogin.username.value;
	var sPassword = document.frmLogin.password.value;
	
	if (sUsername.length == 0)
		err += "Inserire il nome utente.\r\n";
	if (sPassword.length == 0)
		err += "Inserire la password.\r\n";
	
	if (err.length > 0)
	{
		alert(err);
		return false;
	} else {
		document.frmLogin.mode.value = 1;
		return true;
	}
}

function checkChgPwd()
{
	var err = "";
	var sOldPassword = document.frmChgPwd.sOldPassword.value;
	var sPassword = document.frmChgPwd.sPassword.value;
	var sConfPassword = document.frmChgPwd.sConfPassword.value;
	
	if (sOldPassword.length == 0)
		err += "Inserire la vecchia password.\r\n";
	if (sPassword.length == 0)
		err += "Inserire la nuova password.\r\n";
	if (sConfPassword.length == 0)
		err += "Conferma la nuova password.\r\n";
	if (sPassword != sConfPassword)
		err += "La nuova password differisce da quella della conferma.\r\n";		
	
	if (err.length > 0)
	{
		alert(err);
		return false;
	} 
	else 
	{
		document.frmChgPwd.mode.value = 1;
		return true;
	}
}
