﻿//''' <summary>
//''' JavaScript file for the storm shelter web application.
//''' </summary>
//''' <author></author>
//''' <datecreated>12/22/2008</datecreated>
//''' <remarks></remarks>

// Get an object's style object by its id 
function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if (document.getElementById && document.getElementById(objectId)) {
        // W3C DOM
        return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
        // MSIE 4 DOM
        return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
        // NN 4 DOM.. note: this won't find nested layers
        return document.layers[objectId];
    } else {
        return false;
    }
} // getStyleObject

// change an object's visibility style by its id
function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if (styleObject) {
        styleObject.visibility = newVisibility;
        return true;
    } else {
        // we couldn't find the object, so we can't change its visibility
        return false;
    }
} // changeObjectVisibility

// Open the system help document in a new window
function showHelp() {
    window.open('SystemHelp.htm', 'SystemHelp', 'width=450,height=400,scrollbars=yes');
} // showHelp

// Open the shelter location image in a new window
function showLocation() {
    window.open('../Images/LocationQuadrant.gif', 'LacationDiagram', 'width=450,height=400,scrollbars=yes');
} // showLocation

// Open popup window
function openPopWin(winURL, scrollBar, resizable, winWidth, winHeight) {
    var winOptions = 'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=' + scrollBar + ',resizable=' + resizable + ',width=' + winWidth + ',height=' + winHeight;
    popwin = window.open(winURL, 'popwin', winOptions);
} // Open popup window

// Display the searching address message in the given object
function doSearchAddress(id) {

    /* disable buttons */
    //document.getElementById(id).disabled = true;

    /* display the progress message */
    document.getElementById(id).value = "Searching ...";

    /* call the button click event */
    document.getElementById(id).click();

    return true;

} // doSearchAddress
