
var gbl_flagFrameChanged;
	gbl_flagFrameChanged = 0; //<%=C_GEN_FRAME_NOCHANGED%>

function check_frame_changed()
{
	if (gbl_flagFrameChanged == 1)  //<%=C_GEN_FRAME_CHANGED%>
	{
		gbl_flagFrameChanged = 0;   //<%=C_GEN_FRAME_NOCHANGED%>
		if (confirm("Salvare i dati ?"))
			invia('Update')
	}
}

function chiedi_conferma(cosa,quale,dove,quale_campo,domanda)
{
	if (confirm(domanda))
	{
		//document.forma.action				= dove;
		document.forma[quale_campo].value	= quale;
		document.forma.AZIONE.value			= cosa;
		document.forma.submit();
	}
	else
	{

	}
}

function chiedi_conferma_tap(cosa,quale,quale2,quale_campo,quale_campo2,domanda)
{
	if (confirm(domanda))
	{
		document.forma[quale_campo].value = quale;
		document.forma[quale_campo2].value = quale2;
		document.forma.AZIONE.value = cosa;
		hument.forma.submit();
	}
	else
	{

	}
}

function DatePopup(TheObj)
{
	var CmdStr;

	CmdStr = "../COMMON/cal.asp?OGGETTO="+TheObj+"&MONTH="+month+"&YEAR="+year;

	mywindow = open(CmdStr,'Seleziona_una_data','resizable=no,width=260,height=270');
	mywindow.location.href = CmdStr;
	if (mywindow.opener == null)
		mywindow.opener = self;
}

function invia(azione)
{
	document.forma.AZIONE.value = azione;
	document.forma.submit();
}

function Scrivi_Testo(txt,id)
{
	document.forma.TXT_GRUPPO.value = txt;
	document.forma.ID_GRUPPO.value = id;
	document.forma.submit();
}


function scriviCheckBox(chekked,cboxhidden,controllo)
{
	var pippo;
	if(chekked== false )
		pippo = 0;
	else
		pippo = 1;
	document.forma[cboxhidden].value=pippo;
	document.forma[controllo].value="CHANGED";
}

function DoCheck(TheObj)
{
	var v;
	v = document.getElementById(TheObj.id);

	if (v.checked)
	{
		v.checked = true;
		document.forma[TheObj.name].value = true
	}
	else
	{
		v.checked = false;
		document.forma[TheObj.name].value = false;
	}
}

function DoCheckInt(TheObj)
{
	var v;
	v = document.getElementById(TheObj.id);

	if (v.checked)
	{
		v.checked = true;
		document.forma[TheObj.name].value = 1
	}
	else
	{
		v.checked = false;
		document.forma[TheObj.name].value = 0;
	}	
}


function pulisci_tutto(azione,pagina)
{
	document.forma.action = pagina;
	document.forma.hAZIONE.value = azione;		//Azione per ADO
	document.forma.submit();
}

function scrolla(Cosa)
{
	//	esempio di scroll verticale a 80 px dal bordo superiore
	//	document.all.menu.style.pixelTop = document.body.scrollTop + 80;
//		document.getElementById("menu").style.pixelLeft = document.body.scrollLeft;
		document.getElementById(Cosa).style.pixelLeft = document.body.scrollLeft;
}

function scrollav(Cosa)
{
		document.getElementById(Cosa).style.pixelTop = document.body.scrollTop;
}

function scrivi_dati(origineID,origineDescrizione,campoID,campoDescrizione,campoChiave)
{
	window.opener.document.forma[origineID].value = campoID;
	window.opener.document.forma[origineDescrizione].value = campoDescrizione;
    window.opener.document.forma[campoChiave].value = "";
	window.opener.document.forma[origineDescrizione].focus();
	self.close();
}

function scrivi_dati_frame(origineID,origineDescrizione,campoID,campoDescrizione,campoChiave)
{	
	window.opener.parent.frames[1].document.forma[origineID].value = campoID;	
	window.opener.parent.frames[1].document.forma[origineDescrizione].value = campoDescrizione;
    window.opener.parent.frames[1].document.forma[campoChiave].value = "";        
	window.opener.parent.frames[1].document.forma[origineDescrizione].focus();	
	self.close();
}


//***********************FUNZIONI PAGINAZIONE ******************
//**************************************************************
function Refresh()
{
	document.forma.submit();
}

function ReSort(SortString)
{
	document.forma.SortBy.value = SortString;
	document.forma.ReSort.value = "yes";
	Refresh();
}

// Aggiunte da AR 25/02/2002 per sort descrizioni campi con ID
function ReSortID(SortString)
{
	document.forma.SortBy.value = SortString;
	document.forma.ReSort.value = "yes";
	document.forma.hSortID.value = "";
	document.forma.hSortIDDir.value = "";
	Refresh();
}

function SortID(SortString)
{
	if (document.forma.hSortID.value != SortString)
		document.forma.hSortIDDir.value = "";
	document.forma.hSortID.value = SortString;
	if (document.forma.hSortIDDir.value == "" || document.forma.hSortIDDir.value == "DESC")
		document.forma.hSortIDDir.value = "ASC";
	else
		document.forma.hSortIDDir.value = "DESC";
	Refresh();
}
// Aggiunte da AR 25/02/2002 per sort campi con ID


function MoveToPageArr(iStart,PageCount)
{
	document.forma.lstPages.value= iStart;
	document.forma.txtPageSize.value= PageCount;
	Refresh();
}

function MoveToPage(PageNumber)
{
// Select the page number to go to, then submit the page.
	if (PageNumber != -1)
		{document.forma.lstPages[PageNumber].selected = true;}
		//document.frmOrders.ReSort.value = "no";}
	else
		{document.forma.lstPages[0].selected = true;}
	Refresh();
}

function MoveToPageFrame(PageNumber, Step, Size)
{
// Select the page number to go to, then submit the page.
	PageNumber = PageNumber + Step;
	if (PageNumber != -1)
		parent.frames[0].forma.lstPages[PageNumber].selected = true;
	else
		parent.frames[0].forma.lstPages[0].selected = true;
	parent.frames[1].forma.hStart.value = PageNumber * Size;
	RefreshFrames();
}

function RefreshFrames()
{
	parent.frames[0].forma.submit();
	parent.frames[1].forma.submit();
}

function ReSortFrames(SortString)
{
	parent.frames[1].forma.SortBy.value = SortString;
	parent.frames[1].forma.ReSort.value = "yes";
	parent.frames[1].forma.submit();
}

function TestAction()
{
	if (document.forma.hAZIONE.value == "")
		Chiudi_maschera();
}

var wnd = null

function MyDeadend() {
   if (wnd != null && !wnd.closed) {
      wnd.focus()
      return false
   }
}

/*
function findFrame(what) {
    for (var i=0;i<parent.frames.length;i++) {
         if (parent.frames[i].name == what)
             return true;
    }
    return false;
}
*/

function openNewWindow(fileName,windowName,theWidth,theHeight)
{
	window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=1,left=0, top=0,width="+theWidth+",height="+theHeight)
	self.close;
}

function openNewNoSCrollWindow(fileName,windowName,theWidth,theHeight)
{
	window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,left=0, top=0,width="+theWidth+",height="+theHeight)
	self.close;
}


function openNewScrollWindow(fileName,windowName,theWidth,theHeight)
{
	if (windowName == "newAddressWindow")
	{
		uniqueName = new Date();
		windowName = uniqueName.getTime();
	}
	window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,left=100, top=20,width="+theWidth+",height="+theHeight)
}

function message(DisplayText)
{
	window.status = DisplayText;
	setTimeout("remove_message()",2500);
}
function remove_message()
{
	window.status="";
}

//**************************************************************
//*****************FUNZIONI GRAFICHE ***************************
//**************************************************************

function cambia_immagine()
{
Img_Salva = document.getElementById("BTN_SALVA");
Img_Salva.src = "../images/pulsanti/multiple-save.jpg"
}

function switchia(intPallino)
{
//	var RCount = "<%=Conta_pallini%>";

//	for (i = 0; i < RCount; i++)
	for (i = 0; i < 100; i++)
	{
		try
		{
			eval("document.voce" + i + ".src='../images/spunta-trasparente.gif'" );
		}
		catch(exception)
		{}
	}
	eval("document.voce" + intPallino + ".src='../images/spunta.gif'");
}



//**************************************************************
//**************** POPUP CALENDAR - AR 14/06/2001 **************
//**************************************************************

var today = new Date();
var day   = today.getDate();
var month = today.getMonth();
var year  = y2k(today.getYear());

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();
	mywindow.close();
}

//Utilizzata per aprire una PopUp (relativa alle foto) da una finestra già aperta come popup
//utilizzando la OpenNewWindo.
function OpenPopup(TheObj,W,H)
{
	var CmdStr = "pop.asp?immagine="+TheObj

	mywindow = open(CmdStr,'Foto','resizable=no,width='+W+',height='+H);
	mywindow.location.href = CmdStr;
	if (mywindow.opener == null)
		mywindow.opener = self;
}

//Utilizzata per aprire una PopUp  per l'Edit da una finestra già aperta come popup
//utilizzando la OpenNewWindo.
function OpenPopupDett(TheObj,W,H)
{
	var CmdStr = TheObj

	mywindow = open(CmdStr,'Edit','resizable=no,width='+W+',height='+H);
	mywindow.location.href = CmdStr;
	if (mywindow.opener == null)
		mywindow.opener = self;
}

function addDays(myDate,days)
{
    return new Date(myDate.getTime() + days*24*60*60*1000);
}

function FormatDate(d)
{
/*	var day,month
	day = d.getDate();
	month = d.getMonth() + 1;
		
	if (day <= 9) 
		day = "0" + day;
	day = day + "/";
	
	if (month <= 9) 
		month = "0" + month;
	month = month + "/";
	
    var s = day + month + d.getYear();	
    return s;*/
}

function StringToDate(TheObj)
{
	var TheDate = new Date(TheObj.substring(6,10),
                            TheObj.substring(3,5)-1,
                            TheObj.substring(0,2));
	return TheDate;
}

function DateToString(TheObj)
{
	return padout(TheObj.getDate()) + '/' + padout(TheObj.getMonth() + 1) + '/' + y2k(TheObj.getYear());
}

//**********************************************************
//**************** DECIMAL - AR 25/06/2001 *****************
//**********************************************************

/*************** CARET ***************************/
function ReturnCaretPOS(myobject) {
	// copy current value
	var txt = myobject.value;
	// create textrange
	//myobject.caretPos = document.selection.createRange().duplicate();
	// insert my char
	myobject.caretPos.text = "|";
	// find index of my char
	var i = myobject.value.indexOf("|");
	// return old value string
	myobject.value = txt;
	// return i as the caretPOS
	return i;
}

function storeCaret (textEl) {
	if (textEl.createTextRange) {
		textEl.caretPos = document.selection.createRange().duplicate();
	}
     }


function SelectRange(input, selectionStart, selectionEnd) {
	if (input.setSelectionRange) {
		input.focus();
		input.setSelectionRange(selectionStart, selectionEnd);
	}
	else if (input.createTextRange) {
		var range = input.createTextRange();
		range.collapse(true);
		range.moveEnd('character', selectionEnd);
		range.moveStart('character', selectionStart);
		range.select();
	}
}

function setCaretToEnd (input) {
	SelectRange(input, input.value.length, input.value.length);
}

function setCaretToBegin (input) {
	SelectRange(input, 0, 0);
}

function setCaretToPos (input, pos) {
	SelectRange(input, pos, pos);
}

function selectString (input, string) {
	var match = new RegExp(string, "i").exec(input.value);
	if (match) {
		SelectRange (input, match.index, match.index + match[0].length);
	}
}

function replaceSelection (input, replaceString) {
	if (input.setSelectionRange) {
		var selectionStart = input.selectionStart;
		var selectionEnd = input.selectionEnd;
		input.value = input.value.substring(0, selectionStart)
			+ replaceString
			+ input.value.substring(selectionEnd);
		if (selectionStart != selectionEnd) // has there been a selection
			SelectRange(input, selectionStart, selectionStart + replaceString.length);
		else // set caret
			setCaretToPos(input, selectionStart + replaceString.length);
	}
	else if (document.selection) {
		var range = document.selection.createRange();
		if (range.parentElement() == input) {
			var isCollapsed = range.text == '';
			range.text = replaceString;
			if (!isCollapsed)  { // there has been a selection
			//it appears range.select() should select the newly
			//inserted text but that fails with IE
				range.moveStart('character', -replaceString.length);
				range.select();
			}
		}
	}
}
/*************** CARET ***************************/

//formatDecimal function
//Print the floating point number with certain decimal point.
//
//Syntax
//formatDecimal(number, boolean, decimal)
//number is the floating point number which will be formatted.
//boolean is used to decide whether add "0" at the end of the
//floating point number or not.
//decimal is how many decimal point you wnat. (Default is 2)
//
//Description
//This function will print the floating point number passed in with the decimal
//point that users need.
//
//Examples
//formatDecimal("123.2333", true, 2);	will return "123.23".
//formatDecimal("123", true, 2);	will return "123.00".
//formatDecimal("123", false, 2);	will return "123".
//formatDecimal("123.2", true, 2);	will return "123.20".
//formatDecimal("123.2", false, 2);	will return "123.2".
//formatDecimal("123.456", true, 2);	will return "123.46".
//formatDecimal(".235", true, 2);	will return "0.24".
//formatDecimal("0.9999", true, 2);	will return "1.00".
//formatDecimal("0.9999", false, 2);	will return "1".


function formatDecimal(argvalue, addzero, decimaln) {
	var numOfDecimal = (decimaln == null) ? 2 : decimaln;
	var number = 1;

	number = Math.pow(10, numOfDecimal);

	argvalue = Math.round(parseFloat(argvalue) * number) / number;
	// If you're using IE3.x, you will get error with the following line.
	// argvalue = argvalue.toString();
	// It works fine in IE4.
	argvalue = "" + argvalue;

	if (argvalue.indexOf(".") == 0)
		argvalue = "0" + argvalue;

	if (addzero == true) {
		if (argvalue.indexOf(".") == -1)
			argvalue = argvalue + ".";

		while ((argvalue.indexOf(".") + 1) > (argvalue.length - numOfDecimal))
			argvalue = argvalue + "0";
	}
	return argvalue;
}


//formatValue function
//Print a number according to the format specified. Used for currency format.
//
//Syntax
//formatValue(argvalue, format)
//argvalue is the number which will be formatted.
//format is the format of the result.
//
//Description
//The number passed in will be formatted according to the format specified by the user.
//This function is written for formatting a currency number.
//formatDecimal function is needed.
//
//Examples
//formatValue(1223.434, "$##.###,##")		will return "$1.223,43"
//formatValue(1223.43, "$##.###,##")		will return "$1.223,43"
//formatValue(1223., "$##.###,##")		will return "$1.223,00"
//formatValue(1223, "$##.###,##")		will return "$1.223,00"
//formatValue(23., "$##.###,##")		will return "$23,00"
//formatValue(23.3, "$##.###,##")		will return "$23,30"
//formatValue(23.3, "$##.###")			will return "$23"
//formatValue(23, "$##.###")			will return "$23"
//formatValue(124343423.3, "$###.###.###,##")	will return "$124.343.423,30"


function formatValue(argvalue, format) {
//AR
	if(argvalue == "")
		argvalue = "0.00"
//AR

	var TheMinus = argvalue.substring(0,1);
	if (TheMinus == "-")
		argvalue = argvalue.substring(1,argvalue.length);

	var numOfDecimal = 0;
	if (format.indexOf(",") != -1) {
		numOfDecimal = format.substring(format.indexOf(",") + 1, format.length).length;
		argvalue = formatDecimal(argvalue, true, numOfDecimal);
		strBeforeDot = format.substring(0, format.indexOf(","));
	}
	else
	{
		argvalue = formatDecimal(argvalue, false, numOfDecimal);
		strBeforeDot = format;
	}

	argvalueBeforeDot = argvalue.substring(0, argvalue.indexOf("."));

	retValue = argvalue.substring(argvalue.indexOf("."), argvalue.length);
	if (retValue.length != 0)
		if (navigator.appName == "Microsoft Internet Explorer")
			retValue = retValue.replace(".",",");
		if (navigator.appName == "Netscape")
			retValue = retValue.replace("[.]",",");

	if (argvalueBeforeDot.length == 0)
	{
		argvalueBeforeDot = retValue;
		retValue = "";
	}

	for (var n = strBeforeDot.length - 1; n >= 0; n--) {
		oneformatchar = strBeforeDot.substring(n, n + 1);
		if (oneformatchar == "#") {
			if (argvalueBeforeDot.length > 0) {
				argvalueonechar = argvalueBeforeDot.substring(argvalueBeforeDot.length - 1, argvalueBeforeDot.length);
				retValue = argvalueonechar + retValue;
				argvalueBeforeDot = argvalueBeforeDot.substring(0, argvalueBeforeDot.length - 1);
			}
		}
		else {
			if (argvalueBeforeDot.length > 0 || n == 0)
				retValue = oneformatchar + retValue;
		}
	}

	if (TheMinus == "-")
		retValue = TheMinus + retValue;

	return retValue;
}


function ConvertToDecimal(TheName)
{
	var str, lstr, hidden, dec, oldstr;

	stringFilter(TheName);

	str = document.forma[TheName].value;
	lstr = str.length

	hidden = TheName;
	hidden = hidden.replace("dec","");

	if (lstr != 0)
	{
		if (navigator.appName == "Microsoft Internet Explorer")
			dec = str.replace(".","");
		if (navigator.appName == "Netscape")
			dec = str.replace("[.]","");

		while (dec.search("[.]") != -1)
		{
			if (navigator.appName == "Microsoft Internet Explorer")
				dec = dec.replace(".","");
			if (navigator.appName == "Netscape")
				dec = dec.replace("[.]","");
		}
		document.forma[TheName].value = dec;

		if (navigator.appName == "Microsoft Internet Explorer")
			dec = dec.replace(",",".");
		if (navigator.appName == "Netscape")
			dec = dec.replace("[,]",".");

		document.forma[hidden].value = dec;
	}
	else
	{
		document.forma[TheName].value = "";
		document.forma[hidden].value = "";
	}
}


function ShowThousands(TheName)
{
	var str, pos, dec;

	str = document.forma[TheName].value;

	pos = str.search("[,]");

	if (pos == -1)
		pos = str.length;

	if (pos > 3)
	{
		while (pos > 3)
		{
			pos -= 3;
			str = str.substr(0,pos) + "." + str.substr(pos);
			pos = str.search("[.]");
		}
	}

	if (navigator.appName == "Microsoft Internet Explorer")
		str = str.replace("-.","-");
	if (navigator.appName == "Netscape")
		str = str.replace("[-.]","[-]");

	document.forma[TheName].value = str;
}


function AddComma(TheName)
{
	var str;
	str = document.forma[TheName].value;
	if (str.substr(str.length-1) == ".")
	{
		str = str.substr(0,str.length-1) + ",";
		document.forma[TheName].value = str;
	}
}


function stringFilter (TheName)
{
	var TheStr = document.forma[TheName].value;
	var filteredValues = "1234567890,-";     // Characters to be not stripped out
	var i;
	var returnString = "";

	// Search through string and append to unfiltered values to returnString.
	for (i = 0; i < TheStr.length; i++)
	{
		var c = TheStr.charAt(i);
		if (filteredValues.indexOf(c) != -1)
			returnString += c;
	}
	document.forma[TheName].value = returnString;
}


function innerFilter (TheName,TheFormat)
{
	var TheStr = document.forma[TheName].value;
	var filteredValues;  // Characters to be not stripped out
	var i;
	var returnString = "";
	var booComma, booMinus;

	if (TheFormat.search("[,]") != -1)
		filteredValues = "1234567890.,-";
	else
		filteredValues = "1234567890.-";

	// Search through string and append to unfiltered values to returnString.
	booComma = false;
	booMinus = false;
	for (i = 0; i < TheStr.length; i++)
	{
		var c = TheStr.charAt(i);
		if (filteredValues.indexOf(c) != -1)
		{
			if (	(c != "," && c != "-" ) ||
				(c == "," && !booComma && i != 0) ||
				(c == "-" && !booMinus && i == 0) )
					returnString += c;
		}
		if (c == "," && !booComma)
			booComma = true;
		if (c == "-" && !booMinus)
			booMinus = true;
	}

	document.forma[TheName].value = returnString;
}


function tastoPermesso(e)
{
	var tmp;

	if (navigator.appName == "Microsoft Internet Explorer")
	{
		tmp = window.event.keyCode;
		// FrecciaSinistra(37), FrecciaDestra(39), Tab(9), Shift(16)
		// Home(36), End(35)
		if((tmp == 37) || (tmp == 39)|| (tmp == 9) || (tmp == 16) || (tmp == 36)|| (tmp == 35))
			return false;
	}
	return true;
}


function DoMyDec(TheName,booThousand,TheFormat)
{
	// Se sto inserendo, cambia il punto decimale con una virgola
	if (booThousand)
		AddComma(TheName);
	// Cancella dall'input anche la virgola se il formato non prevede decimali
	if (tastoPermesso() || (navigator.appName == "Netscape"))
		innerFilter(TheName,TheFormat);
	// La stringa in input
	var argvalue = document.forma[TheName].value;
	// Se c'è un meno davanti, non lo devo conteggiare nel formato
	var TheMinus = false;
	
	if (tastoPermesso() && booThousand && argvalue.substring(0,1) == "-")
	{
		TheMinus = true;
		argvalue = argvalue.substring(1,argvalue.length);
		document.forma[TheName].value = argvalue;
	}

	// Se il formato prevede la virgola, è la parte intera dell'input
	var argvalueInt = argvalue.substring(0,argvalue.indexOf(","));
	// Se il formato prevede la virgola, è la parte decimale dell'input,
	// altrimenti ne è la parte intera
	var argvalueDec = argvalue.substring(argvalue.indexOf(","), argvalue.length);

	if (argvalueInt.length == 0)
	{
		argvalueInt = argvalueDec;
		argvalueDec = "";
	}

	// Se il formato prevede la virgola, ne è la parte intera
	var intPart = TheFormat.substring(0, TheFormat.indexOf(","));
	// Se il formato prevede la virgola, ne è la parte decimale (compresa la virgola),
	// altrimenti ne è la parte intera
	var decPart = TheFormat.substring(TheFormat.indexOf(","), TheFormat.length);

	if (intPart.length == 0)
	{
		intPart = decPart;
		decPart = "";
	}

	// Se nell'input c'è una virgola, ne è la posizione, altrimenti vale -1
	var commaPresent = argvalue.search("[,]");
	// Se nell'input c'è un punto, ne è la posizione, altrimenti vale -1
	var dotPresent = argvalue.search("[.]");

	var dec = intPart;

	// Se nella stringa non ci sono punti devo confrontare
	// con un formato senza punti
	if (dotPresent == -1)
	{
		if (navigator.appName == "Microsoft Internet Explorer")
			dec = dec.replace(".","");
		if (navigator.appName == "Netscape")
			dec = dec.replace("[.]","");

		while (dec.search("[.]") != -1)
		{
			if (navigator.appName == "Microsoft Internet Explorer")
				dec = dec.replace(".","");
			if (navigator.appName == "Netscape")
				dec = dec.replace("[.]","");
		}
	}

	if (tastoPermesso() && booThousand)
	{
		if (argvalueInt.length > dec.length)
		{
			argvalue = argvalueInt.substring(0, argvalueInt.length-1)+argvalueDec;
			document.forma[TheName].value = argvalue;
		}
		else if ((argvalue.length > TheFormat.length) ||
		    (commaPresent != -1 && argvalueDec.length > decPart.length))
		{
			argvalue = argvalue.substring(0, argvalue.length-1);
			if (TheMinus)
				argvalue = "-" + argvalue;
			document.forma[TheName].value = argvalue;
			return;
		}
	}

	if (tastoPermesso() || (navigator.appName == "Netscape"))
	{
		ConvertToDecimal(TheName);
		if (booThousand)
		{
			ShowThousands(TheName);
			argvalue = document.forma[TheName].value;
			if (commaPresent == -1 && argvalue.length > 0 && decPart != "")
			{
				if (argvalue.length == intPart.length)
				{
					if (argvalue.substring(argvalue.length - 1, argvalue.length) != ",")
						document.forma[TheName].value = argvalue + ",";
				}
			}
			argvalue = document.forma[TheName].value;
			if (TheMinus)
				argvalue = "-" + argvalue;
			document.forma[TheName].value = argvalue;
		}
	}
	else if (tastoPermesso() && TheMinus)
	{
		argvalue = "-" + argvalue;
		document.forma[TheName].value = argvalue;
	}
}