var ie = ((document.all) && (window.offscreenBuffering));
var top_position=4;
var last_position=4;
function move_sticky() {
	if (getTop() > 70) {
		var top = getTop()+top_position-70;
		if (top == last_position) return;
	
		var diff = Math.abs(top - last_position);
		diff = Math.min(20, (diff/5));
	
		if (top > last_position) last_position += diff;
		else last_position -= diff;
	
		$('stickyad').style.top=last_position+'px';
		$('box14').style.top=last_position+'px';
	} else {
		$('stickyad').style.top='4px';
		$('box14').style.top='4px';
	}
}
var do_sticky;
function initSticky() {
	do_sticky = setInterval("move_sticky()", 25);
}
function uninitSticky()
{
	if (do_sticky) {
		clearInterval(do_sticky);
		do_sticky=false;
		$('stickyad').style.top='4px';
		$('box14').style.top='4px';
		top_position = 4;
		last_position = 4;

	}
}

function getTop() {
	if (typeof(window.pageYOffset) == 'number') {
		// Netscape compliant
		return window.pageYOffset;
	}
	if (document.body && document.body.scrollTop) {
		// DOM compliant
		return document.body.scrollTop;
	}
	if (document.documentElement && document.documentElement.scrollTop) {
		// IE6 standards compliant mode
		return document.documentElement.scrollTop;
	}
	return 0;
}

var bottom_position=-1;
var do_footer=false;
function initFooter() {
	$('footerad').style.top='842px';
	if (self.innerHeight) // all except Explorer
	{
		bottom_position = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict Mode
	{
		bottom_position = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		bottom_position = document.body.clientHeight;
	}
	bottom_position -= 192;	// der footerad ist 90px hoch
	if (!do_footer)
		do_footer = setInterval("move_footer()", 25);
	Event.observe(window, 'resize', function(e) { initFooter(); });
}

function move_footer() {
	var mytop=getTop()+bottom_position;
	$('footerad').style.top=mytop+'px';
	$('box15').style.top=(mytop - 300)+'px';
}

function uninitFooter()
{
	if (do_footer) {
		clearInterval(do_footer);
		do_footer=false;
	}
	$('footerad').style.top='842px';
	Event.stopObserving(window, 'resize');
}

var countx=-500;
var floatTimer=null;
var endPos=138;
function floatAd() {
	var dx = Math.max(8,(endPos-countx)/6);
	countx+=dx;
	dd.elements.floating_ad.moveTo(countx,233);
	if (countx >= endPos) {
		clearInterval(floatTimer);
		floatTimer=null;
	}
}


