var sFieldCount = "field_count";

Field = function(form) {
	this.oForm = form;

	// field_count
	this.nCount = 0;
	this.oCount = document.createElement("<input type='hidden'>");
	this.oCount.name = sFieldCount;
	this.oCount.value = 0;
	this.oForm.insertAdjacentElement("afterBegin", this.oCount);
}

Field.prototype.add = function(sName) {
	// increase count.
	this.oCount.value = ++this.nCount;

	// field<num>_name
	var oInput = document.createElement("<input type='hidden'>");
	oInput.name = "field" + this.nCount + "_name";
	oInput.value = sName;
	this.oForm.children(this.nCount-1).insertAdjacentElement("afterEnd", oInput);
}

Field.prototype.addList = function(sList) {
	var arrName = sList.split(",");

	for(var i = 0; i < arrName.length; i++)
		this.add(arrName[i]);
}
	

