var docOnLoadFunc=[];
function addOnLoad(func) {
	docOnLoadFunc[docOnLoadFunc.length]=func;
}
function docOnLoad(){
	var func=null;
	for(var i=0;i<docOnLoadFunc.length;i++){
		func=docOnLoadFunc[i];
		if(func)func();
	}
}

function docOnLoad_Init(func){
	init();
	if(func)func();
}

function init() {
	if(arguments.callee.done) return;
	arguments.callee.done = true;
	docOnLoad();
}

if(document.addEventListener){document.addEventListener("DOMContentLoaded",init,false);}

// for Internet Explorer (using conditional comments)
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
    if (this.readyState=="complete") {
        init(); // call the onload handler
    }
};
/*@end @*/

winOnLoad=window.onload;
window.onload=function(){docOnLoad_Init(winOnLoad)};

if (/WebKit/i.test(navigator.userAgent)) { // sniff
    var _timer = setInterval(function() {
        if (/loaded|complete/.test(document.readyState)) {
            clearInterval(_timer);
            init(); // call the onload handler
        }
    }, 10);
}


