function getDynamicHTML(dynObj, dynURL) {
        console.log(dynObj + " - " + dynURL)
        dojo.xhrGet({
            sync: true,
            url: dynURL,
            preventCache: true,
            handleAs: "text",
            timeout: 5000,
            // Time in milliseconds
            // The LOAD function will be called on a successful response.
            load: function(response, ioArgs) {
                a = (response.indexOf("<form"));
                if (a == -1) {
                    console.log('no form tags..')
                    dojo.byId(dynObj).innerHTML = response;
                } else {
                    console.log('contains <FORM> tags...');
                    b = (response.indexOf("</form>"));
                    p1 = (response.slice(a, b))
                    c = (p1.indexOf(">") + 1);
                    p2 = (p1.slice(c, b))
                    frm = (p1.slice(0, c))
                    dojo.byId(dynObj).innerHTML = (p2);
                    frmAction = (frm.slice(frm.indexOf(' action="') + 9))
                    frmAction = (frmAction.slice(0, frmAction.indexOf('"')))
                    frmMethod = (frm.slice(frm.indexOf(' method="') + 9))
                    frmMethod = (frmMethod.slice(0, frmMethod.indexOf('"')))
                    frmName = (frm.slice(frm.indexOf(' name="') + 7))
                    frmName = (frmName.slice(0, frmName.indexOf('"')))
                    document.forms[0].method = frmMethod;
                    document.forms[0].action = frmAction;
                    document.forms[0].name = frmName;
                }
                return response;
            },
            // The ERROR function will be called in an error case.
            error: function(response, ioArgs) {
                console.error("HTTP status code: ", ioArgs.xhr.status);
                return response;
            }
        });
    };
function loadPage(dkey) {
var currURL = document.location.href 
var currHTMLPage = currURL.split(".html")
window.location.href = currHTMLPage[0] +".html?open&loaddoc=" + dkey
}
function reloadPage() {
var currURL = document.location.href 
var currHTMLPage = currURL.split(".html")
window.location.href = currHTMLPage[0] +".html"
}
function doOnload() {
if (loaddoc=="") {
 getDynamicHTML(dynamicDivId, dynamicURL)
} else {
if (matchkey=="") {
 getDynamicHTML(dynamicDivId, fullArticlePath + loaddoc +"?OpenDocument")
} else { 
getDynamicHTML(dynamicDivId, fullArticlePath + loaddoc +"?OpenDocument&matchkey="+matchkey);
 
}
}
};
  dojo.addOnLoad(
    function() { 
       doOnload()
    });