/*
	THIS FUNCTION STARTS FIRST WHEN THE PAGE IS LOADED 
*/

window.onload = function()
{
    
	/*
		Loads appropriate images for apropriate image objects for initial view
	*/
	//loadImages() ;

	/*
		Creates global handlers for map form and map panel
	*/
	initMap() ;
    setInitTool();

}

var mapContainer = null;
var map = null;
var mapImage = null;
var mapForm = null;
var zmbTop = null, zmbLeft = null, zmbRight = null, zmbBottom = null ;
var loading = null;
	
function initMap() {
    mapForm = document.getElementById("mapForm") ;
    mapContainer = xGetElementById("MAP_PANEL_PANEL") ;
    map = xGetElementById("MAP_PANEL") ;
    mapImage = xGetElementById("MAP_IMAGE") ;
    //alert(map.id);
		
    zmbTop = xGetElementById("zoomboxTop") ;	
    zmbLeft = xGetElementById("zoomboxLeft") ;
    zmbRight = xGetElementById("zoomboxRight") ;
    zmbBottom = xGetElementById("zoomboxBottom") ;

    loading = xGetElementById("LOADING_PANEL") ;

}

/*
 * --- Set tool and it's image just after loading page ---
 */
function setInitTool() {
    if (mapForm)  {
        var actionCode = 0;
        try {
            actionCode = parseInt(mapForm.tool.value);
        } catch(e) {}
        
        var toolImageId = MAP_ACTIONS[actionCode];
        var toolImage = document.getElementById(toolImageId);
        
        doAction(actionCode, toolImage);
    }
}