function loadDynamic (src,type){
    var node=document.createElement(type?"link":"script");
    node = document.getElementsByTagName("head")[0].appendChild(node);

    if(type){
	node.setAttribute("rel","stylesheet");
	node.setAttribute("media","all")
    }
    node.setAttribute("type","text/"+(type?"css":"javascript"));
    node.setAttribute(type?"href":"src",src)
}
(function(){
/*
немного модифицированная версия обработчика http://webo.in/articles/habrahabr/05-delayed-loading/
*/
    function combinedWindowOnload(){
	if(arguments.callee.done){return}
	arguments.callee.done=true;
	if(document.getElementsByTagName){

/* если не Safari, то загружаем CSS с фоновыми изображениями динамически */
	    if(!/WebKit/i.test(navigator.userAgent)){
		/*
		для обхода IE добавляем псевдо-задержку
		*/
		setTimeout('loadDynamic("http://s.newslab.ru/informers/css/base.css?v2",1)',0);
	    }
	
	    loadDynamic("http://s.newslab.ru/jslib.axd?d=/informers/nl_news_informer.js&amp;v2");		

        }
    }
	
	/* for Mozilla */
	if (document.addEventListener) {
		document.addEventListener("DOMContentLoaded", init, false);
	}
	
	/* for Internet Explorer */
	/*@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 @*/
	
	/* for Safari */
	if (/WebKit/i.test(navigator.userAgent)) { // sniff
		var _timer = setInterval(function() {
			if (/loaded|complete/.test(document.readyState)) {
				init(); // call the onload handler
			}
		}, 10);
	}
	
	/* for other browsers */
	window.onload = init;
/* 
навешиваем на window обработчик по событию Onload, спасибо lusever за компактный вид
http://webo.in/articles/livejournal/01-native-browser-events/
*/
    window[/*@cc_on !@*/0?'attachEvent':'addEventListener'](/*@cc_on 'on'+@*/'load',function(){
/* 
если Safari, то загружаем наконец этот CSS
*/
        if(/WebKit/i.test(navigator.userAgent)){
            loadDynamic("http://s.newslab.ru/informers/css/base.css?v2",1);
        }
/*
добавочный вызов WindowOnload для "старых" браузеров
*/
        combinedWindowOnload()
    },false)
})()

function init() {
		// quit if this function has already been called
		if (arguments.callee.done) return;
		
		// flag this function so we don't do the same thing twice
		arguments.callee.done = true;
	};
