Edit in JSFiddle

var object = decorateObject(document.createElement('div'));
document.body.appendChild(object);

window.setTimeout(function () {
    object.move({
        right: 20,
        down: 50
    });

    object.draw();
}, 1000);

function decorateObject(obj) {
    obj.style.position = 'fixed';

    obj.move = function (dir) {
        dir = dir || {};
        dir.left = dir.left || 0;
        dir.right = dir.right || 0;
        dir.up = dir.up || 0;
        dir.down = dir.down || 0;

        this.set('top', this.get('top') + dir.down - dir.up);
        this.set('left', this.get('left') + dir.right - dir.left);
    }

    obj.set = function (variable, value) {
        this.dataset[variable] = value;
    }

    obj.get = function (variable) {
        return parseInt(this.dataset[variable] || 0);
    }

    obj.draw = function () {
        var px = ['top', 'left'];
        for (var o in px) {
            obj.style[px[o]] = this.dataset[px[o]] + 'px';
        }
    }

    return obj;
}