Ma scusa...non deve essere così?

codice:
var max = 4;				// maximum # of attachments allowed
var currentUploads = 0;		// current # of attachment sections on the web page
var nameDesc = '';			// Name property for the Description Input field
var nameFile = '';			// Name property for the File Input field
var scrollPosVert = 0;		// stores the current scroll position on the form

// for some reason when a div is taken out, the form
// will scroll to the top on both Firefox and IE

// SCROLL FUNCTIONS
function saveScrollPos(offset){
	scrollPosVert=(document.all)?document.body.scrollTop:window.pageYOffset-offset;
}

function setScrollPos(){
	window.scrollTo(0, scrollPosVert);
	setTimeout('window.scrollTo(0, scrollPosVert)',1);
}


// This function adds a new attachment section to the form
// It is called when the user clicks the "Attach a file" button...
// It takes three arguments:
//      maxUploads			- the maximum number of attachments allowed
//		descFieldName		- the field name for the Description Input field
//		fileFieldName		- the field name for the File Input field
function addUpload(fileFieldName){
  if (max == 0 || currentUploads <= max) {
	nameFile=fileFieldName;
	currentUploads++;
	if (currentUploads>0)
		document.getElementById('addupload').childNodes[0].data='Aggiungi file';
	// First, clone the hidden attachment section
	var newFields = document.getElementById('attachment').cloneNode(true);
	newFields.id = '';
	// Make the new attachments section visible
	newFields.style.display = 'block'; 
	// loop through tags in the new Attachment section
	// and set ID and NAME properties
	//
	// NOTE:	the control names for the Description Input
	//			field and the file input field are created
	//			by appending the currentUploads variable
	//			value to the nameFile and nameDesc values
	//			respectively
	//
	//			In terms of Xaraya, this means you'll need to name your
	//			DD properties will need names like the following:
	//				"AttachmentDesc1"
	//				"AttachmentFile1"
	//				"AttachmentDesc2"
	//				"AttachmentFile2"
	//				"AttachmentDesc3"
	//				"AttachmentFile3"
	//				et cetera...
	var newField = newFields.childNodes;
	for (var i=0;i<newField.length;i++){
		if (newField[i].name==nameFile){
			newField[i].id=nameFile+currentUploads;
			newField[i].name=nameFile+'[]';
			//newField[i].name=nameFile+currentUploads;
		}
	}
	// Insert our new Attachment section into the Attachments Div
	// on the form...
	var insertHere = document.getElementById('attachmentmarker');
	insertHere.parentNode.insertBefore(newFields,insertHere);
  } // chiudo l'if aperto all'inizio
}