function MapObject(mapId, width, height, ext) {

    this.element = document.createElement('div');
    this.element.style.width = width + 'px';
    this.element.style.height = height + 'px';
    this.element.id = mapId.replace('m_', 'mapObject_');
    this.element.map = document.getElementById(mapId);
    this.element.imageRoute = 'custom/images/graphics/';
    this.element.links = [];
    this.element.ext = ext;

    this.element.placeItem = function(map) {
        coords = map.coords.split(",");
        el = createElement(this.id + map.alt, "img");
        el.src = this.imageRoute + map.alt + this.ext;
        el.name = map.alt;
        el.style.position = 'absolute';
        if (map.shape == "poly") {
            el.setDimensions((coords[2] - coords[0]) + 'px', (coords[5] - coords[3]) + 'px');
            el.setCoords(coords[0] + 'px', coords[1] + 'px');
        } else if (map.shape == "rect") {
            el.setDimensions(coords[2] + 'px', coords[3] + 'px');
            el.setCoords(coords[0] + 'px', coords[1] + 'px');
        }
        value = ('' + map.href).split('/');
        value = value[value.length - 1];
        if (value === 'true') {
            el.style.cursor = 'pointer';
            el.oSrc = el.src;
            el.superParent = this;
            el.aSrc = this.imageRoute + map.alt + '_f2' + this.ext;
            this.links[map.alt] = el;
            if (System.page === map.alt) {
                el.src = el.aSrc;
            }
            el.onmouseover = function() {
                if (System.page !== this.name) {
                    this.src = this.aSrc;
                }
            };
            el.onmouseout = function() {
                if (System.page !== this.name) {
                    this.src = this.oSrc;
                }
            };
            el.onmousedown = function() {
                this.superParent.links[System.page].src = this.superParent.links[System.page].oSrc;
                System.setPage(this.name);
            };
        }
        this.appendChild(el);
    };

    for (var i = 0; i < this.element.map.childNodes.length; i++) {
        curChild = this.element.map.childNodes[i];
        if (curChild.alt) {
            this.element.placeItem(curChild);
        }
    }

    return this.element;

}