/**
/* utilities.js
/*
/* @copyright: 2007 by Thomas M. Stambaugh & Zeetix, LLC (http://www.zeetix.com)
/* All rights reserved.
/*
/* The contents of this file may not be copied, duplicated, or used without the
/* written consent of Zeetix, LLC.
**/

/**
 * This section handles the loading and json stuff.
 */
var _hasBodyOnLoadBeenCalled = false;

/**
 * Do this so that when the asynchronous query runs, it has an empty page to
 * put stuff in.
**/
window.document.vpage = '<?xml version="1.0"?><page></page>';

function isLoaded() {
    //Answer true if the onload handler has been called, else false.
    return _hasBodyOnLoadBeenCalled;
}

function _handleOnloadEventBasic(){
    // Record the firing of onload from the body
    _hasBodyOnLoadBeenCalled = true;
}

/**
 * Handle any pending load
 */
function _checkLoad() {
    if (window._pending) {
        var pending = window._pending;
        window._pending = null;
        window._formApplication.loadVPage.apply(window._formApplication, pending);}
}

/**
 * The doc is loaded, see if any deferred loads exist
 *
 * Resize the map as well.
 */
function onloadHandler() {
    // An onload event has been received from the body.
    _handleOnloadEventBasic();

    if (window._pending) {
        _checkLoad();
        }
}

/**
 * Do nothing
**/
function noOp() {
}
