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

function ContactModel(scope){
    BaseModel.call(this,scope);
    var _model=null;
    var _revserse_lookup=null;
	var _this=this;
	
    this.model=function(model,dont_notify){
        if(arguments.length>0){
			_model=model;
			if(!dont_notify) _this.raise_event('model_changed',{
				model: _model
			});
		}
		return _model;
	};

    this.contact_by_id=function(id,model){
        if(!_revserse_lookup){
            _revserse_lookup={};
        }
        $.each(_model.contact,function(i,n){
            _revserse_lookup[n.id]={index:i,item:n};
        });

        return _revserse_lookup[id].item;
    };

    this.update=function(){
        _this.raise_event('model_changed',{
				model: _model
			});
    };
};