//<!--

/*
 * openMap
 *  opens the map on display side
 *
 *
 */
 var mapContainerHTML;
 
function openMap()
{
    //set the HTML for the close() function to update the container with
    mapContainerHTML = $('mapContainer').innerHTML;
      
    setupScreenCover();
    Element.show('screenCover');
    Element.show('mapContainer');
    Element.show('mapLoading');
};


/*
 * closeMap
 *  closes the map on display side
 *
 *
 */
function closeMap()
{
    $('mapContainer').update(mapContainerHTML);
    mapContainerHTML = null;
    $('mapContainer').hide();
    Element.hide('screenCover');
};


/*
 * openMapForPlotting
 *  opens a window with an instance of the map
 *
 * @param url       String - the url for the window.open call
 */
function openMapForPlotting(url)
{
    window.open(url, 'mapWindow', 'width=790,height=540,scrollbars=0');
};


/*
 * plotMapPointOfInterest
 *  catches the coords passed out from Flash onclick to plot an operation's x, y coordinate
 *
 * @param coords        Object({Number x, Number y})
 */
function plotMapPointOfInterest(coords)
{
    $('operation_map_x').value = coords[0]; 
    $('operation_map_y').value = coords[1]; 
};


/*
 * showMapPointInfo
 *  shows more information about a point of interest
 *
 * @param id        Number
 */
function showMapPointInfo(id)
{
    new Ajax.Updater
    (
        'infoContent', 
        '/map/getInfo?menu=map&id='+id,
        {
            asynchronous:true,
            method:'get',
            onLoading: function() { Element.show('loading') },
            onComplete: function() 
            {
                Element.show('infoWindow'); 
                Element.hide('loading');
                createWindowDrag();
            }
        }
    );
};


/*
 * showMapHelp
 *  opens a help window
 *
 *
 */
function showMapHelp()
{
    helpWin = window.open('/swf/map/help.html', 'mapHelp', 'width=335,height=390,scrollresizeable=no');
    helpWin.focus();
};


//-->

