	var imageAdd = document.createElement("img");
	imageAdd.src = "images/add.png";
	var imageRemove = document.createElement("img");
	imageAdd.src = "images/remove.png";
	
	var attachmentsLastIndex = new Number(1);

	function $(elementId)
	{
		return document.getElementById(elementId);
	}
	
	function addCommentAttachmentField()
	{
		var div = document.createElement("div");
		attachmentsLastIndex ++;
		$("attached_files_count").value = attachmentsLastIndex;
		div.innerHTML = '<input type="file" name="attached_file_' + attachmentsLastIndex + '" style="font-family:Arial, Helvetica, sans-serif; font-size:13px;" />&nbsp;&nbsp;&nbsp;<img src="images/add.png" alt=" Add new file field " title=" Add new file field " style="cursor:pointer;" onClick="addCommentAttachmentField(this)" />&nbsp;&nbsp;<img src="images/remove.png" alt=" Remove curent file field " title=" Remove curent file field " style="cursor:pointer;" onClick="removeCommentAttachmentField(this)" />';
		$("attachments").appendChild(div);
	}
	
	function removeCommentAttachmentField(element)
	{
		$("attachments").removeChild(element.parentNode);
	}

	function resetOrder()
	{
		$("attachments").innerHTML = '<input type="file" style="font-family:Arial, Helvetica, sans-serif; font-size:13px;" />&nbsp;&nbsp;&nbsp;<img src="images/add.png" alt=" Add new file field " title=" Add new file field " style="cursor:pointer;" onClick="addCommentAttachmentField()" />';
	}
