// ATTACH Object

TAttach=new Object();
TAttach.current=-1;
TAttach.count=0;

TAttach.Assign=function(name) {
	this.name=name;
	this.obj=document.getElementById(this.name);
}

TAttach.Add=function() {
	this.current++;
	this.count++;
	var e=document.createElement('div');
	var res='<input type="file" name="r[new_file_'+this.current+']" class="attach">';
	res+='<img src="'+TAttach.path+'img/spacer.gif" width="10" height="1" border="0">';
	res+='<a href="#" onclick="TAttach.Delete('+this.current+'); onResize(); return false;">'+TAttach.ActionDelete+'</a>';
	e.id=this.name+'_'+this.current;
	e.className='item';
	e.innerHTML=res;
	this.obj.appendChild(e);
	return false;
}

TAttach.Delete=function(n) {
	if (this.count>0) {
		var e=document.getElementById(this.name+'_'+n);
		this.obj.removeChild(e);
		this.count--;
	}
	return false;
}
