// CH-Advertiser; (c) 2009 Eric Kurzhals
var IE = (navigator.appName=="Microsoft Internet Explorer") ? true : false;
var advTimer = null;
var advIdleTime = 300000;

function ADVinit()
{
	var windowW = document.body.offsetWidth;
	
	var windowH = (!IE) ? window.innerHeight : document.documentElement.clientHeight;
	document.getElementById ("adv_box").style.left = (windowW/2-234)+"px";
	document.getElementById ("adv_box").style.top = (windowH/2-40)+"px";
	
	document.onmousemove = ADVResetIdleTime;
	advTimer = window.setTimeout ("ADVShow()", advIdleTime);
}

function ADVShow ()
{
	var opacity=20;
	var obj = document.getElementById("chBody");
	opacityValue=""+opacity/100;
	obj.style.MozOpacity = opacityValue;
	obj.style.opacity = opacityValue;
	obj.style.filter = "alpha(opacity:" + ( opacity ) + ")";
	obj.style.KhtmlOpacity=opacityValue;
	var advobj = document.getElementById("adv_box");
	advobj.style.display = "block";
}

function ADVResetIdleTime ()
{
	window.clearTimeout(advTimer);
	advTimer = window.setTimeout ("ADVShow()", advIdleTime);
}

function ADVClear ()
{
	var opacity=100;
	var obj = document.getElementById("chBody");
	opacityValue=""+opacity/100;
	obj.style.MozOpacity = opacityValue;
	obj.style.opacity = opacityValue;
	obj.style.filter = "alpha(opacity:" + ( opacity ) + ")";
	obj.style.KhtmlOpacity=opacityValue;
	var advobj = document.getElementById("adv_box");
	advobj.style.display = "none";
	advTimer = window.setTimeout ("ADVShow()", advIdleTime);
}