function Void() {}function fnLoad() {	var sArray=SaveHistory.getAttribute("sPersistState");	oArray=sArray.split("^");	document.all.IDDL.innerHTML = oArray[0];	document.all.LinkedDocs.value = oArray[1];}function fnSave() {	var sArray="";	sArray = document.all.IDDL.innerHTML;	sArray = sArray + "^" + document.all.LinkedDocs.value;	SaveHistory.setAttribute("sPersistState",sArray);}function writeBreadcrumb(sep1, L1, sep2, L2, sep3, L3) {	var levels = 'Home' + sep1 + L1 + sep2 + L2  + sep3 + L3;	document.all.BCrumb.innerText = levels;}function forwardSubmit(change) {	form = window.document.forms[0];	form.ProcessState.value = parseInt(form.ProcessState.value) + parseInt(change);	form.submit();}function validate(field, fieldLabel) {	if (field.value == "") {		alert ("Il campo " + fieldLabel+ " \u00E8 obbligatorio");		field.focus();		return true;	}	return false;}function validateNumber(field) {	if (isNaN(parseInt(field.value))) {		return false;	} else {		return true; 	}}function GetDate(field) {	var d = field.substr(3, 2) + "/" + field.substr(0, 2) + "/" + field.substr(6, 4);	return Date.parse(d);}function validateDate(field) {	var date = field.value	if (date.length!=10) {		return false;	} else {		dd = date.substring(0,2);		mm = date.substring(3,5);		yy = date.substring(6,10);		if (isNaN(dd)) {			return false;		} else {			if (dd=='08') dd=8;			if (dd=='09') dd=9;		}		dd = parseInt(dd);		if (isNaN(mm)) {			return false;		} else {			if (mm=='08') mm=8;			if (mm=='09') mm=9;		}		mm = parseInt(mm);		if (isNaN(yy)) {			return false;		}else {			yy = parseInt(yy);		}		if ((mm<1) || (mm>12)) { return false; }		if ((dd<1) || (dd>31)) {return false; }		if (mm==2) {			if ((yy%4!= 0) && ((yy%100==0) || (yy%400!=0)) && (dd>28)) {				return false;			}		if ((yy%4== 0) && ((yy%100!=0) || (yy%400==0)) && (dd>29)) {				return false;			}		}		if ((mm==4) || (mm==6) || (mm==9) || (mm==11)) {			if (dd>30) return false;		}		return true;	}}function validateListbox(field, fieldLabel) { var index = field.selectedIndex; if (field[index].text == "") {  alert ("E' necessario scegliere " + fieldLabel);  field.focus();  return true; } return false;}  function validateRadio(field, fieldLabel) {	checkNaN = (isNaN(parseInt(field.length)));	// if there is only one option field.length returns 'undefined'	if (checkNaN) {											// only one option		if (field.checked) {			return false;		}	} else {													// more than one option		for (i=0; i<field.length; i++) {			if (field[i].checked) {				return false;			}		}	}			alert( "E' necessario scegliere " + fieldLabel);	return true;}function resetFields() {	form = window.document.forms[0];	var coll = form.getElementsByTagName('input');	 if (coll!=null) {		for (q=0; q<coll.length; q++) {			if(coll[q].type != 'hidden') coll(q).value = "";		}	}	var coll = form.getElementsByTagName('select');	 if (coll!=null) {		for (q=0; q<coll.length; q++) {			coll(q).selectedIndex = 0;		}	}}function tagsA() {	form = window.document.forms[0];	var coll = form.getElementsByTagName('a');	if (coll!=null) {		for (i=0; i<coll.length; i++) {			if (coll(i).name == '_RM_') {				coll(i).style.visibility = 'hidden';			}		}	}}function tagsCBox() {	form = window.document.forms[0];	var coll = window.document.all.tags("div");	if (coll!=null) {		for (i=0; i<coll.length; i++) {			if (coll(i).name == 'cBox') {				coll(i).disabled = true;			}		}	}}function tagsSelect() {	form = window.document.forms[0];	var coll = form.getElementsByTagName('select');	if (coll!=null) {		for (i=0; i<coll.length; i++) {			if (coll(i).name != 'DocLinks') {				idx=coll(i).selectedIndex;				coll(i).className='frmDispFld';				for (var  k=coll(i).length; k>=0; k--) {					if (idx != k) {						coll(i).remove(k);					}				}			}		}	}}function expcoll() {	form = window.document.forms[0];	var x = form.getElementsByTagName('TD');	var y = form.getElementsByTagName('DIV');	 for (var i=0;i<x.length;i++) {		if (x[i].style.display == 'none') x[i].style.display = 'inline'	}	for (var i=0;i<y.length;i++) {		if (y[i].id.substring(10,0) == 'shCriteria') y[i].style.display = 'none'		if (y[i].id.substring(10,0) == 'hdCriteria') y[i].style.display = 'inline'	}}function collexp() {	form = window.document.forms[0];	var x = form.getElementsByTagName('TD');	var y = form.getElementsByTagName('DIV');	 for (var i=0;i<x.length;i++) {		if (x[i].style.display == 'inline') x[i].style.display = 'none'	}	for (var i=0;i<y.length;i++) {		if (y[i].id.substring(10,0) == 'shCriteria') y[i].style.display = 'inline'		if (y[i].id.substring(10,0) == 'hdCriteria') y[i].style.display = 'none'	}}function CompareOptionText(a, b){	return(a.text.toLowerCase() < b.text.toLowerCase()?-1:(a.text.toLowerCase() > b.text.toLowerCase()?1:0));}function SortOptions(oSelect){	var oOpts, aOpts, SelVal, i;	oOpts = oSelect.options;	for (i = 0; i < oOpts.length; i++)		if (oOpts[i].value == "")			oOpts[i].value = oOpts[i].text;	SelVal = oSelect[oSelect.selectedIndex].value;	oOpts = oSelect.options;	aOpts = new Array(oOpts.length);	for (i = 0; i < oOpts.length; i++)		aOpts[i] = oOpts[i];	aOpts = aOpts.sort(CompareOptionText);	oOpts.length = 0;	for (i = 0; i < aOpts.length; i++) {		oOpts.add(aOpts[i]);		if (aOpts[i].value == SelVal) {			oSelect.selectedIndex = i;		}	}}function handlePublication(unid){	form = window.document.forms[0];//	if (form.Status.value > 30) {//		if (confirm("You are changing data during an opened workflow. The workflow will restart from the beginning. Are you sure you want to continue?")) {//		} else {//			return;//		}//	}	if (confirm("Si conferma la pubblicazione di questo preventivo?")) {		var dbName = form.currentDb.value;		var winloc = dbName + "/HandlePublication?OpenAgent&login&docunid=" + unid;		window.location = winloc;	}}function suspendPublication(unid){	form = window.document.forms[0];	if (confirm("Si conferma la sospensione di questa pubblicazione?")) {		var dbName = form.currentDb.value;		var winloc = dbName + "/SuspendPublication?OpenAgent&login&docunid=" + unid;		window.location = winloc;	}}function resendConfirm(unid){	form = window.document.forms[0];	if (confirm("Si conferma il reinvio della messaggio di conferma ricezione dati ?")) {		var dbName = form.currentDb.value;		var winloc = dbName + "/ResendConfirm?OpenAgent&login&docunid=" + unid;		window.location = winloc;	}}function ControllaCF(cf){    var validi, i, s, set1, set2, setpari, setdisp;    if( cf == '' )  return '';    cf = cf.toUpperCase();    if( cf.length != 16 )        return "La lunghezza del codice fiscale non e'\n"        +"corretta: il codice fiscale dovrebbe essere lungo\n"        +"esattamente 16 caratteri.\n";    validi = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";    for( i = 0; i < 16; i++ ){        if( validi.indexOf( cf.charAt(i) ) == -1 )            return "Il codice fiscale contiene un carattere non valido `" +                cf.charAt(i) +                "'.\nI caratteri validi sono le lettere e le cifre.\n";    }    set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";    set2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ";    setpari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";    setdisp = "BAKPLCQDREVOSFTGUHMINJWZYX";    s = 0;    for( i = 1; i <= 13; i += 2 )        s += setpari.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));    for( i = 0; i <= 14; i += 2 )        s += setdisp.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));    if( s%26 != cf.charCodeAt(15)-'A'.charCodeAt(0) )        return "Il codice fiscale non e' corretto:\n"+            "il codice di controllo non corrisponde.\n";    return "";}function ControllaPIVA(pi){    if( pi == '' )  return '';    if( pi.length != 11 )        return "La lunghezza della partita IVA non \u00E8 \n" +            "corretta: la partita IVA dovrebbe essere lunga\n" +            "esattamente 11 caratteri.\n";    validi = "0123456789";    for( i = 0; i < 11; i++ ){        if( validi.indexOf( pi.charAt(i) ) == -1 )            return "La partita IVA contiene un carattere non valido `" +                pi.charAt(i) + "'.\nI caratteri validi sono le cifre.\n";    }    s = 0;    for( i = 0; i <= 9; i += 2 )        s += pi.charCodeAt(i) - '0'.charCodeAt(0);    for( i = 1; i <= 9; i += 2 ){        c = 2*( pi.charCodeAt(i) - '0'.charCodeAt(0) );        if( c > 9 )  c = c - 9;        s += c;    }    if( ( 10 - s%10 )%10 != pi.charCodeAt(10) - '0'.charCodeAt(0) )        return "La partita IVA non e' valida:\n" +            "il codice di controllo non corrisponde.\n";    return '';}function ControllaTel(numero){ if(numero.length<1){  return false; } for(i=0;i<numero.length;i++){  codiceA = numero.charCodeAt(i);  if (numero.charAt(i)!="+" && numero.charAt(i)!="-" && numero.charAt(i)!=" " && codiceA<48 || codiceA>57){   return false;  } } return true; };function goNext(Action) {	form = window.document.forms[0];		switch (Action)	{		case "Request":			var UrlToGo =  "/psp/home.nsf/F14?OpenForm&Type=U";		  	break;    		case "CopyRequest":			var UrlToGo =  "/psp/home.nsf/F04?OpenForm&Type=U&CopyFrom=" + form.RefNo.value;		  	break;    		case "New":			var UrlToGo =  "/psp/home.nsf/F07?OpenForm&Type=" + form.TipoServizioProfessionale.value;		  	break;    		case "UtLogon":			var UrlToGo = "/psp/home.nsf?OpenDatabase&login&UNID=profile";						  	break;    		case "SpLogon":			var UrlToGo = "/psp/home.nsf?OpenDatabase&login&UNID=profile";						  	break;    		default:			var UrlToGo = "/psp/home.nsf?OpenDatabase&login&Type=" + form.TipoServizioProfessionale.value+"&UNID=" + Action;			//alert (UrlToGo);			break;	}    	location.href =  UrlToGo ;	}function OpenNewFields(InputField) {	switch (InputField)	{		case "TipoServizioProfessionale":			var ProfessionistaSelezionato = "";			for(i=0; i<=window.document.forms[0].TipoServizioProfessionale.length-1;i++)			{				if(window.document.forms[0].TipoServizioProfessionale[i].checked)				{					var ProfessionistaSelezionato = window.document.forms[0].TipoServizioProfessionale[i].value;					break;				} 			} 			if (window.document.forms[0].RegisteredUsername.value == "")			{				if (ProfessionistaSelezionato == "N")				{					AltreProvinceDiv.style.display = "block";					AliasRequest.style.display = "block";												}				else				{					AltreProvinceDiv.style.display = "none";					AliasRequest.style.display = "none";					}			}			break;	}}