Type.registerNamespace("EFGStorage");

EFGStorage.StageItem = function(imgRef) {
    this._imgRef = imgRef;
    this.id='';
    this.stage=null;
    this.configId=0;
}

EFGStorage.StageItem.prototype = {

    createOnServer: function() {
        EFGStorage.WebServices.StorageService.UpdateStageItem(this.stage.id,this.id,this.configId,this.x,this.y,this.onSucceededWithContext);
    },
    updateOnServer: function() {
        EFGStorage.WebServices.StorageService.UpdateStageItem(this.stage.id,this.id,0,this.x,this.y,this.onSucceededWithContext);
    },

    deleteFromServer: function()
    {
        EFGStorage.WebServices.StorageService.DeleteStageItem(this.stage.id,this.id,this.onSucceededWithContext);
    }
    ,
    onSucceededWithContext : function(result, userContext, methodName)
    {
        switch(methodName)
        {
            case "UpdateStageItem":
                this.id=result;
                break;
            case "DeleteStageItem":
                //pItem.stage.removeItem(pItem);
                
                break;
        } 
    }    
    ,
    dispose: function() {
        alert('bye ' + this.getName());
    }
}

EFGStorage.StageItem.registerClass('EFGStorage.StageItem', null, Sys.IDisposable);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();