function CompassControl(routeId, mapId) {
    if(typeof mapId == "undefined"){
        mapId = "";
    }
    this.mapId = mapId;
    if(typeof routeId == "undefined"){
        routeId = "";
    }
    this.routeId = routeId;
}

CompassControl.prototype = new GControl();

CompassControl.prototype.initialize = function(map) {
    var container = document.createElement("div");
    var images = new Object();
    var image = new Image();
    image.src = "images/Compass.png";
    image.useMap = "#map1-" + this.routeId + "-" + this.mapId;
    image.id="imgCompass";
    image.style.border=0;
    images.compass = image;
    container.appendChild(images.compass);
    var map1 = document.createElement("MAP");
    map1.id = "map1-" + this.routeId + "-" + this.mapId;
    map1.name = "map1-" + this.routeId + "-" + this.mapId;

    var area = document.createElement("area");
    area.title = bqc.locale.compass.north;
    area.shape = "poly";
    area.coords = "29,3, 21,14, 37,14";
    area.onclick = function(){map.panDirection(0, 1); return false;};
    area.href = "#"
    map1.appendChild(area);
    area = document.createElement("area");
    area.title = bqc.locale.compass.east;
    area.shape = "poly";
    area.coords = "44,20, 55,27, 44,36";
    area.onclick = function(){map.panDirection(-1, 0); return false;};
    area.href = "#"
    map1.appendChild(area);
    area = document.createElement("area");
    area.title = bqc.locale.compass.south;
    area.shape = "poly";
    area.coords = "22,42, 37,42, 29,53";
    area.onclick = function(){map.panDirection(0, -1); return false;};
    area.href = "#"
    map1.appendChild(area);
    area = document.createElement("area");
    area.title = bqc.locale.compass.west;
    area.shape = "poly";
    area.coords = "14,20, 14,36, 4,27";
    area.onclick = function(){map.panDirection(1, 0); return false;};
    area.href = "#"
    map1.appendChild(area);
    area = document.createElement("area");
    area.title = bqc.locale.compass.center;
    area.shape = "rect";
    area.coords = "21,20, 38,37";
    area.onclick = function(){map.returnToSavedPosition(); return false;};
    area.href = "#"
    map1.appendChild(area);

    container.appendChild(map1);
    map.getContainer().appendChild(container);

    return container;
}

CompassControl.prototype.getDefaultPosition = function() {
    if (this.routeId.length == 0) {
        return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(12, 10));
    } else {
        return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(2, 0));
    }
}



