function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		} else return "false";
	}
	return(setStr);
}

function include(src) {
    var script = document.createElement("script");
    script.type="text/javascript";
    script.src = src;
    document.getElementsByTagName('head')[0].appendChild(script);
}
var ufanet_funclist=[];
function docisready() {
	if (timeint) clearTimeout(timeint);
	for(i in ufanet_funclist) {
		local_f=ufanet_funclist[i];
		if(typeof(local_f)=='function'){			if(local_f.toString().indexOf("forEach()")==-1)local_f.call();
//			console.log(local_f.name);
			}
	}

}
function loadbanner(id)
{
 ufanet_funclist.push(function(){
 	if(document.getElementById('b_'+id))
	{
	    include("http://s1.hypo.ufanet.ru/"+id+"/"+getCookie("b_id"));
	}
 	 });
}
var timeint=setTimeout("docisready()",1000);
window.onload=function(){ docisready(); };
