//  @import com.hedgehoglab.application.model.BaseModel;

function ActivityModel(scope){
	BaseModel.call(this,scope);
    var _model=null;
    var _model_lookup={activity:{}};
	var _agg_lookup=[];
	
	this.model=function(model){
        if(arguments.length>0){
			_model=model;
			this.raise_event('model_changed',{
				model: _model
			});
		}
		return _model;
	};
	
	this.aggregate=function(model){
		//	Return only the top 10
		// var _agg_lookup={activity:{}};
		if(model){
			_agg_lookup=$.makeArray(model.activity);//[];	
						
			_agg_lookup=_agg_lookup.sort(function(a,b){
				var da=Date.parse(a.createdAt);
				var db=Date.parse(b.createdAt);

				//	Conver to UTC
				// var da_u=da.getTime();
				// 			var db_u=db.getTime();
				// 			


				// alert(db.compareTo(da));
	            return (db.compareTo(da)!=1);
			});

		}
		
		return _agg_lookup;
	};
	
}