function Util()
{
    
}
Util.prototype=
{
    getFcnRef:function(ob_,fcn_)
    {
        return( function(){ob_[ fcn_]()});
    }
}
//class Im
//procure des foncions avancée pour la gestion des images

function Im()
{
    this.element = new Image();
    this.util = new Util();
    this.w=0;
    this.h=0;
    this.callBack = function()
    {
        
    };
    
}
Im.prototype =
{
    setSrc: function(src){
        this.element.src=src;
        
    },
    registerCallBack: function(cb)
    {
        this.callBack = cb; 
    },
    clearCallBack: function()
    {
        this.callBack = function()
        {
        
        };
    },
    waitForLoadComplete: function(){
        if (!this.element.complete) { setTimeout(this.util.getFcnRef(this,'waitForLoadComplete'), 1000); return; }
        //si chargée
        this.h=this.element.height;
        this.w=this.element.width;
        this.callBack();
    },
    getH:function(){
        return this.h;
    },
    getW:function(){
        return this.w;
    }
}


