var baner_load_timeout=60000;

function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
  if (nDays==null || nDays==0) nDays=1;
    expire.setTime(today.getTime() + 3600000*24*nDays);
    document.cookie = cookieName+"="+escape(cookieValue)
    + ";expires="+expire.toGMTString();
}

function show_baner() {
	SetCookie('Wesolych','yes',1);
	document.getElementById('AdFloater').style.visibility='visible';
	StartFloat();
	Float();
}


function hide_baner() {
	document.getElementById('AdFloater').style.visibility='hidden';
	document.getElementById('AdFloater').innerHTML="";
}


var Type = 'Z';
function StartFloat() {
	if(document.all) {
		Type = 'A';
	} else if(document.layers) {
		Type = 'B';
	} else if(document.getElementById) {
		Type = 'C';
	}

	if (document.all) { window.onscroll = Float; } else { setInterval('Float()', 100); }
}

function Float() {
	if (Type == 'A') { document.all.AdFloater.style.pixelTop = document.body.scrollTop; }
	else if (Type == 'B') { document.AdFloater.top = window.pageYOffset; }
	else if (Type == 'C') { document.getElementById('AdFloater').style.top = window.pageYOffset + 'px'; }
}

function get_window_width() {
	if(parseInt(navigator.appVersion)>3) {
		winW=window.innerWidth-20;
		if(navigator.appName=="Netscape") winW = window.innerWidth-25;
		if(navigator.appName.indexOf("Microsoft")!=-1)  winW = document.body.offsetWidth-35;
	}
	return winW;
}
window.onload=function() { 
	var w=get_window_width();
	document.getElementById('AdFloater').style.width=w+"px";
	show_baner();
	setTimeout("hide_baner()",baner_load_timeout);
}

