var DEBUG_LEVEL=0;var VALIDATE_MSG_CAMPI_NON_CORRETTI = "<b>Attenzione!</b><br>i seguenti campi non sono stati compilati correttamente:";function arrayContains(myArray, arg) {	for(var k=0; k<myArray.length; k++){		if(myArray[k]==arg) return true;	}	return false;}function arrayGetPosOf(myArray, arg) {	for(var k=0; k<myArray.length; k++){		if(myArray[k]==arg) return k;	}	return -1;}function validateValuta(arg){		if(arg==null || arg.length==0) return "KO";		arg = arg.replace(/,/gi, ".");		if(isNaN(arg)) return "KO";	return arg;	}function formattaCampoValuta(idCampo){		var field = document.getElementById(idCampo);	if(field==null || field==undefined) return;	var valore = field.value;	if(valore==null || valore.length==0) {		field.value="0,00";		return;		}	valore= valore.replace(/\./gi, ",");			field.value=valore;	}// ----------------------------------------------------------------------------------------------------//								richiesta XML asincrona// ----------------------------------------------------------------------------------------------------function XMLAsyncRequest(url, method, qs){		var xmlhttp = null;	var xmlDoc = null;//console.print(	"XMLAsyncRequest " + "url:" + url);	xmlhttp = new XMLHttpRequest();	if (method == null || method == 'undefined' || method=='') method = 'GET';		if (qs == null || qs == 'undefined') qs = '';		if(method.toUpperCase()=="GET") {		var sepQs = "&";			if(url.indexOf("?") == -1) sepQs= "?";			url = url +sepQs+ qs;	}	if(DEBUG_LEVEL>0) 	console.print(" XMLAsyncRequest:" + url + " method:" + method);			xmlhttp.open(method, url, false);		xmlhttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );	xmlhttp.setRequestHeader("Pragma", "no-cache");	xmlhttp.setRequestHeader("Cache-Control","no-cache");	xmlhttp.setRequestHeader("expires","0");	if (method.toUpperCase()=='POST') xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		if(DEBUG_LEVEL>0) 		console.print ('Caricamento dati...' + url);	xmlhttp.send(qs);			// modalit\u00E0 sincrona		// controlla lo stato della risposta	// se 200 = OK altrimenti stampa un messaggio di errore e restituisce null	if (xmlhttp.status!=200) {		console.print("-----------------------------------------------------------------");		console.print("Global.js XMLRequest()" + " Problem retrieving XML data");		console.print(" ");		console.print("error: " + xmlhttp.status+ " "+ xmlhttp.statusText);		console.print("-----------------------------------------------------------------");		return null;	}else {		if(DEBUG_LEVEL>0)  console.print("OK retrieving XML data xmlhttp.status: "+ xmlhttp.status);	}	if(DEBUG_LEVEL>5) {		var serializer = new XMLSerializer();		console.print(serializer.serializeToString(xmlhttp.responseXML));	}	return xmlhttp.responseXML;	}//-----------------------------------------------------//	funzione per leggere da codice XML//-----------------------------------------------------function getNoteTextValue(nodeElem, argNodeName){	try {		return handleEmptyVal(nodeElem.getElementsByTagName(argNodeName)[0].childNodes[0].nodeValue);		}catch(e){		return "";	}}function handleEmptyVal(str){		return (str == null || str == "null" ? "NULLO" : str);}//-----------------------------------------------------//	funzioni per listbox//-----------------------------------------------------function global_selectListBoxOption(tagId, val){	var objListBox = document.getElementById(tagId);		if (objListBox == null || objListBox == 'undefined' || objListBox.tagName!="SELECT" )return;		for (var z = 0; z < objListBox.options.length; z++) {		if(objListBox.options[z].value == val) {			objListBox.options[z].selected = true;			return;		}	}}function global_getSelectedListBoxOption(tagId){	var objListBox = document.getElementById(tagId);		if (objListBox == null || objListBox == 'undefined' || objListBox.tagName!="SELECT" )return;		for (var z = 0; z < objListBox.options.length; z++) {		if(objListBox.options[z].selected == true) {			return objListBox.options[z].value;		}	}}//-----------------------------------------------------//	funzioni per radio//-----------------------------------------------------function global_selectRadio(nameRadio, val){	var objRadio = document.getElementsByName(nameRadio);		if (objRadio == null || objRadio == 'undefined' )return;		for (var z = 0; z < objRadio.length; z++) {		if(objRadio[z].value.toUpperCase() == val.toUpperCase()) {			objRadio[z].checked = true;			return;		}	}}function global_getRadio(nameRadio){	var objRadio =  document.getElementsByName(nameRadio);		if (objRadio == null || objRadio == 'undefined') return null;				for (var z=0; z < objRadio.length; z++) {		if( objRadio[z].type.toLowerCase()=="radio"  && objRadio[z].checked == true) {			//alert(z + " val=" + objRadio[z].value);			return objRadio[z].value;		}	}	return null;}