
var Profiler=new Class({Extends:Widget,cfg:{module:"Profiler",hasProfile:false},initialize:function(){this.data={};},registerWidget:function(widget){var profile=clone(widget.defaultProfile);if(this.data[widget.id]){for(var i in this.data[widget.id]){if(profile[i]!=undefined){profile[i]=this.data[widget.id][i];}}}
widget.profile=profile;},saveProfile:function(widget){var wkey=widget.id;if(widget.profile){act=this.data[wkey]?"update":"create";request.send({w:widget.cfg.module,act:act,wkey:wkey,data:encodeURI(toCode(widget.profile))},this,widget.cfg.saveMethod);}else{request.send({act:"delete",wkey:wkey},this);}
this.data[wkey]=widget.profile;},loadProfile:function(){profiler.data={};for(var i in _USER.data){try{profiler.data[i]=toValue(unescape(_USER.data[i]));}catch(e){profiler.data[i]={};}}
profiler.onLoad();},saveAllProfile:function(){request.send({act:"save_all"},this);},onLoad:function(){}});