// Шаблон:
function JsTemplate(html,id,type,Attributes,className){
	this.html=html;
	this.id=id;
	this.type=type;
	this.Attributes=Attributes;
	this.className=className;
}

JsTemplate.prototype.getDelegate= function(){
	var self=this;
	return function(Item,uid){		
		return DOM_Create(self.type, self.id.replace('{id}',Item['id']).replace('{uid}',uid), self.Render(Item), self.className, self.Attributes);
	}	
}

JsTemplate.prototype.Render= function(Item){
	ret= this._Render(this.html, Item, '').replace(new RegExp('\{[\w|.]+\}','g'),'');
	
	return ret;
}

JsTemplate.prototype._Render= function(html, Item, Path){
	for (key in Item){
		if (typeof(Item[key])=='object'){
			html=this._Render(html, Item[key],Path+key+'.');
		}
		else {
			html=html.replace(new RegExp('\{'+Path+key+'\}','g'), Item[key]);
		}
	}
	//alert(html);
	
	//if (!Path) alert(html);
	return html;
}



