﻿
function addLoadEvent(func) 
{    
   func();    
}



function loadjs()
{
   // document.
jsJSNode = document.createElement('script');
jsJSNode.type = 'text/javascript';
jsJSNode.src = 'http:// den-01/Default.aspx';
document.body.appendChild(jsMyNode);

//document.body.childNodes("script")
//document.body.childNodes[1]

//document.childNodes[1].childNodes[1].childNodes[1].  HTMLScriptElement
//document.childNodes[1].childNodes[0] head
//document.childNodes[1].childNodes[1] body
   
}


var headerNode;
var arrScript = new Array();
var idx = 0;

function findScriptNodes(parent) 
{
    if (parent.nodeName == "HEAD") {
        headerNode = parent;
    }
    else if (parent.nodeName == "SCRIPT") 
    {
        arrScript[idx] = parent;
        idx++;
    }

    if (parent.childNodes.length>0)
    {
        for (var i = 0; i < parent.childNodes.length; i++) 
        {
            var node = parent.childNodes[i];
            findScriptNodes(node);  
        }
    }
}


function addLoadEvent_QQQQ(func) 
{
    var bn = navigator.appName;
    if (bn == 'Netscape') 
    {
        arrScript = new Array();
        idx = 0;
        findScriptNodes(document)
        if (arrScript.length > 0 && headerNode) {
            for (var i = 0; i < arrScript.length; i++) 
            {
                var node = arrScript[i];
                node.parentNode.removeChild(node);
                headerNode.appendChild(node);
            }
        }
        


        /*
                function x() {
        if(document.getElementById('...')) {
        // do operations
        } else {
        //if we still dont have our DOM, wait and try again.
        setTimeout('x()', 200);
        }
        }
        */
        //alert("addLoadEvent - setTimeout");    
        //setTimeout(alert(func), 5500);
        setTimeout(func, 5500);
    }
    else 
    {    
          //alert("addLoadEvent - func");    
        func();                        
    }
}


function addLoadEvent_YYYY(func) {
    if (window.attachEvent) { window.attachEvent('onload', func); }
    else if (window.addEventListener) { window.addEventListener('load', func, false); }
    else { document.addEventListener('load', func, false); }
}


function addLoadEvent_XXX(func) {
    var bn = navigator.appName;
    if (bn == 'Netscape') {
        if (document.addEventListener) // For Firefox 
        {
            document.addEventListener("DOMContentLoaded", func, false); // Call init function in Firefox 
        } 
    }
    else {
        if (typeof window.onload != 'function')
            window.onload = func;
        else {
            var oldLoad = window.onload;

            window.onload = function () {
                if (oldLoad) oldLoad();
                func();
            }
        }
    }
}


//alert("jsSiteMaster");

/*
if (window.pageLoad) {
    4203             window.pageLoad(this, args);
    4204         }


    "eventHandlerInvalid":"Handler was not added through the Sys.UI.DomEvent.addHandler method.",

    */


