/*thickbox*/
function pop(titolo,height,width,nome)
{
var param2 = "#TB_inline?height="+height+"&width="+width+"&inlineId="+nome;
tb_show(titolo,param2);
}
/*---*/

function checkIsEmpty(idCampo,nomeCampo)
{
	if(IsEmpty(document.getElementById(idCampo))) 
	{ 
      	alert(nomeCampo + ': il campo non pu&ograve; essere vuoto') 
      	document.getElementById(idCampo).focus(); 
      	return false; 
   	}
	return true;
}

function checkIsNumeric(idCampo,nomeCampo)
{
	if(!IsNumeric(document.getElementById(idCampo).value)) 
	{ 
      	alert(nomeCampo + ': il campo deve essere numerico') 
      	document.getElementById(idCampo).focus(); 
      	return false; 
   	}
	return true;
}

function checkIsDecimal(idCampo,nomeCampo)
{
	if(!IsDecimal(document.getElementById(idCampo).value)) 
	{ 
      	alert(nomeCampo + ': il campo deve essere decimale') 
      	document.getElementById(idCampo).focus(); 
      	return false; 
   	}
	return true;
}

function IsNumeric(sText)
{
alert(sText)
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;

	for (i = 0; i < sText.length && IsNumber == true; i++) 
    { 
    	Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
			IsNumber = false;
	}
	return IsNumber;
}

function IsEmpty(aTextField) {
	if ((aTextField.value.length==0) || (aTextField.value==null))
		return true;
   	else
		return false;
}

function IsDecimal(str)
{
	//mystring = str;
	if (str.match(/^\d+\.\d{2}$/ ))
		return true;
	else
		return false;
}

function addEvent(obj, evType, fn){    
 if (obj.addEventListener){    
   obj.addEventListener(evType, fn, false);    
   return true;    
 } else if (obj.attachEvent){    
   var r = obj.attachEvent("on"+evType, fn);    
   return r;    
 } else {    
   return false;    
 }    
}   

function riattivaRicercaAzienda()
{
	document.getElementById("fldRicerca").style.display = "block";
	document.getElementById("btnRicerca").style.display = "none";
}

function cambioPagina(pagina,idForm)
{
//document.getElementById(idForm).action="?page=" + pagina;
document.getElementById(idForm).action="?AZIONE=CERCA&page=" + pagina;
document.getElementById(idForm).submit();
}

//**************************************************************
//**************** POPUP CALENDAR - AR 14/06/2001 **************
//**************************************************************

var today = new Date();
//var day   = today.getDate();
//var month = today.getMonth();
//var year  = y2k(today.getYear());
// AR 27/01/2003 si dichiarano all'esterno ma si settano all'interno 
// di DatePopup perché si apra sempre con la data corrente
var day, month, year

function y2k(number)
{
	return (number < 1000) ? number + 1900 : number;
}

function padout(number)
{
	return (number < 10) ? '0' + number : number;
}

function GetMyDate(TheObj)
{
/*
	document.forma[TheObj].value = '' + padout(day) + '/' + padout(month - 0 + 1) + '/' + year;
	document.forma[TheObj].focus();
*/
	document.getElementById(TheObj).value = '' + padout(day) + '/' + padout(month - 0 + 1) + '/' + year;
	document.getElementById(TheObj).focus();

	mywindow.close();
}

function DatePopupCMS(TheObj)
{
	var CmdStr;

	// AR 27/01/2003 si dichiarano all'esterno ma si settano all'interno 
	// di DatePopup perché si apra sempre con la data corrente

	day = today.getDate();
	month = today.getMonth();
	year  = y2k(today.getYear());

	CmdStr = "common/cal.asp?OGGETTO="+TheObj+"&MONTH="+month+"&YEAR="+year+"&DAY="+day;

	mywindow = open(CmdStr,'Seleziona_una_data','resizable=no,width=350,height=270');
	mywindow.location.href = CmdStr;
	if (mywindow.opener == null)
		mywindow.opener = self;
}
//**************************************************************

