//Controlla che il campo di un form contenga un valore, se è vuoto mostra
//una finestra contenente il messaggio passato da parametro
function checkCampo(ObjCampo, nomecampo)
{
	var res;
	res=true;
	if (ObjCampo.value=="")
	{
		alert(nomecampo + ": Il campo e' obbligatorio");
		res=false;
	}
	return res;
}

function apriImmagine(nomeFile)
{
	var w;
	var imm;
	var larg,altez;
	imm = new Image();
	imm.src=nomeFile;
	larg = imm.width;
	altez = imm.height;//
	w = window.open("apriImmagine.asp?nome_img=" + nomeFile, "wndImmagine", "Height=" + altez + ", Width=" + larg + ", top=50, left=50, resizable=yes, location=no, menubar=no, scrollbars=no, status=no, titlebar=no, toolbar=no");
	delete imm;
	imm=null;
}

function Internaz(valore, IMP_INTERNAZ)
{
    if (IMP_INTERNAZ=="IT") 
		Internaz = valore.toString();
    else
	{	
		var st; 
		st = valore.toString();
		st = st.replace(".","_");
		st = st.replace(",",".");
		st = st.replace("_",",");
		return st;
	}
}

//Controlla che il campo di un form contenga un valore numerico
function checkCampoNumerico(ObjCampo, nomecampo)
{
	var res;
	res=true;
	if (ObjCampo.value!="" && isNaN(Internaz(ObjCampo.value,"EN")))
	{
		alert(nomecampo + ": il campo deve contenere un numero");
		ObjCampo.focus();
		res=false;
	}
	return res;
}

function checkData(dta){
	var v,i;
	
	v=dta.split("/");
	//il vettore deve avere le tre componenti gg mm aaaa	
	if (v.length!=3)return false;
	
	for (i=0;i<3;i++) 
	{
		if (isNaN(v[i])) return false;
	}

	//gg deve essere fra 1 e 31
	if (v[0]<"01" || v[0]>"31" || v[0].length!=2)return false;

	//mm deve essere fra 1 e 12
	if (v[1]<"01" || v[1]>"12" || v[1].length!=2)return false;

	//aaaa deve essere >0 
	if (parseInt(v[2])<0 || v[2].length != 4) return false;

	return true;
}