/**
 * External JS dependencies:
 * AjaxMap
 *
 * External var dependencies:
 * none!
 */

/**
 * Ajax callback-method for pan tool (that return a new map image URL that shall be updated).
 */
function panCallback(newMapData) {
    setMapData(newMapData);
}

/**
 * Enabeles the click-and-drag tool, and sets up events for sending panorate-command when map image is moved
 */
function panOnButtonClick(e) {
    getFrame('mapframe').enableClickAndDragTool(panOnClickAndDragged);
}

/**
 * Panorates the specified pixels in the x and y directions (in pixel coordinates)
 */
function panOnClickAndDragged(deltaX, deltaY) {
    //alert('panorate: dx=' + deltaX + ', dy=' + deltaY);
    AjaxMap.pan(deltaX, deltaY, getMapWidthInPixels(), getMapHeightInPixels(), panCallback);
}
