function Mover() {
    //Dom object attached to this object.;
    var i;
    var that;
    
    this.init = function(o, params) {
        this.id = o.id;
        this.o = o;
        this.o.p = this;
        this.moving = false;
        
        that = this;
        initParams(params);
        this.init2();
    }
    this.init2 = function() {
    }

    /*Lay out op params:
            var params = {
                style: {
                    property: ['left', 'padding', 'top'],
                    value: [100,2,20],
                    n: 3
                },
                property: ['innerHTML'],
                value: ['<p>Made by Harke</p>'],
                n: 1
            };
    */   

    function initParams(p) {
            //that.style = p.style.style;
            that.style = {};
            var value, property, i;
            for (i = 0; i < p.style.n; i++) {
                property = p.style.property[i];
                value    = p.style.value[i];
                that.o.style[property] = value;
                that.style[property] = value;
            }
            for (i = 0; i < p.n; i++) {
                property = p.property[i];
                value    = p.value[i];
                that.o[property] = value;
                that[property] = value;
            }
    }
    
    this.startMove = function() {
        if (!this.moving) {
            this.moving = true;
            this.step = 0;
            timer.add(this.id);
            this.startMove2();
            timer.start();
        }
    }
    this.startMove2 = function() {}
    
    this.endMove = function() {
        timer.remove(this.id);
        this.moving = false;
//        var cparams = params[0];
    
        this.endMove2();
    }
    this.endMove2 = function() {}
    
    this.move = function() {
        this.move2();
    }
    this.move2 = function() {}
    
    this.setParams = function() {
    }
    this.modifyParams = function() {
    }
    
    //supportive functions, private
    function bottomToTop(mp) {
        var i;
        var top = 0;
      
        for (i = 0; i < mp[0].length; i++) {
            switch (mp[0][i]) {
                case 'bottom':
                    top = top + mp[1][i];
                    break;
                case 'height':
                    top = top - mp[1][i];
                    break; 
                case 'padding':
                case 'border':
                    top = top - (2 * mp[1][i]);
                    break;
            }
        }
        return top; 
    }

    function rightToLeft(mp) {
        var i;
        var left = 0;
      
        for (i = 0; i < mp[0].length; i++) {
            switch (mp[0][i]) {
                case 'right':
                    left = left + mp[1][i];
                    break;
                case 'width':
                    left = left - mp[1][i];
                    break; 
                case 'padding':
                case 'border':
                    left = left - (2 * mp[1][i]);
                    break;
            }
        }
        return left; 
    }

    function calcvar(v0,v1,nv,n) {
        var r = 0;
        if (v0==v1) { 
            r = v0; 
        }
        else {        
            r = v0 + (v1-v0)*(n + 1)/(nv);
        }
        return Math.round(r);
    }
    function calcsin(v0,v1,nv,n) {
        var r = 0;
        pm = 1;
        if (v0 == v1) {
            r = v0;
        }
        else {
            r = v0 + (v1-v0)*(n + 1)/(nv) + pm*10*Math.sin(Math.PI*((n + 1)/(nv)));
        }
        return Math.round(r);
    }
    function calcsmooth(v0,v1,nv,n) {
        var r = 0;
        if (v0 == v1) {
            r = v0;
        }
        else {
            r = v0 + (v1-v0)*(0.5 - 0.5*Math.cos(Math.PI*((n + 1)/(nv))));
        }
        return Math.round(r);
    }
}
