﻿var _LoadCommandQueue = new Array();

function OnEndAsyncRequestHandler(sender, args) 
{
    ProcessLoadEventQueue();
}

function callOnLoad(callback) {
    _LoadCommandQueue.push(callback);
}

function ProcessLoadEventQueue() {

    for (i = 0; i < _LoadCommandQueue.length; i++) {
        log.info("Calling event queue function '" + _LoadCommandQueue + "'");
        _LoadCommandQueue[i](); 
    }

}

$().ready(function() { ProcessLoadEventQueue(); });
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(OnEndAsyncRequestHandler);

function SetUniqueRadioButton(nameregex, current) {
    re = new RegExp(nameregex);
    for (i = 0; i < document.forms[0].elements.length; i++) {
        elm = document.forms[0].elements[i]
        if (elm.type == 'radio') {
            if (re.test(elm.name)) {
                elm.checked = false;
            }
        }
    }
    current.checked = true;
}
