function ControlloLunghezza(strForm, strCampo, valCampo, iLunghezza)
{
	if (valCampo != '' && valCampo.length != iLunghezza)
	{
		alert('Il campo non risulta valorizzato correttamente\nValorizzare con ' + iLunghezza + ' caratteri alfanumerici');
		eval(strForm + '.' + strCampo + '.focus()');
	}
}

function ControlloCampoNumerico(strForm, strCampo, valCampo)
{
	if (isNaN(valCampo))
	{
		alert('Il campo non risulta valorizzato correttamente\nValorizzare con valori numerici');
		eval(strForm + '.' + strCampo + '.focus()');
	}
}
	
function ControllaEmail(strForm, strEmail)
{
	// alert(strEmail);

	var inputEmail;
	inputEmail = eval(strForm + '.' + strEmail + '.value');
	
	if (inputEmail.length > 6)
	{
		var intPosizione;
		var intPosizionePunto;
		intPosizione = inputEmail.indexOf("@");

		if ( (intPosizione >= (inputEmail.length-3) ) || (intPosizione < 2) )
		{
			//eval('frmInvioDati.' + strEmail + '.focus()');
			return (false);
		}

		intPosizione = intPosizione + 1;
		intPosizionePunto = inputEmail.indexOf(".", intPosizione);

		if (intPosizionePunto > (inputEmail.length-3) )
		{
			//eval('frmInvioDati.' + strEmail + '.focus()');
			return (false);
		}

		inputEmail = inputEmail.substr(intPosizione);

		if ( (inputEmail.length < 5) || (intPosizionePunto <= 0) )
		{
			//eval('frmInvioDati.' + strEmail + '.focus()');
			return (false);
		}
	}
	else
	{
		//eval('frmInvioDati.' + strEmail + '.focus()');
		return (false);
	}
	return true;
}

function VerificaEmail(strForm, strEmail)
{
	if (eval(strForm + '.' + strEmail + '.value != ""'))
	{
		var blnEmail = ControllaEmail(strForm, strEmail);
		if (blnEmail == false)
		{
			alert('Il campo non risulta valorizzato correttamente\nValorizzare con un indirizzo email');
			eval(strForm + '.' + strEmail + '.focus()');
			return (false);
		}
	}
}

function SwitchImg()
{
var rem, keep=0, store, obj, switcher=new Array, history=document.Data;
for (rem=0; rem < (SwitchImg.arguments.length-2); rem+=3) {
	store = SwitchImg.arguments[(navigator.appName == 'Netscape')?rem:rem+1];
	if ((store.indexOf('document.layers[')==0 && document.layers==null) ||
	(store.indexOf('document.all[')==0 && document.all==null))
	store = 'document'+store.substring(store.lastIndexOf('.'),store.length);
	obj = eval(store);
	if (obj != null) {
		switcher[keep++] = obj;
		switcher[keep++] = (history==null || history[keep-1]!=obj)?obj.src:history[keep];
		obj.src = SwitchImg.arguments[rem+2];
	} }
	document.Data = switcher;
}

function RestoreImg()
{
	if (document.Data != null)
	for (var rem=0; rem<(document.Data.length-1); rem+=2)
	document.Data[rem].src=document.Data[rem+1];
}