var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22002860-1']);
_gaq.push(['_trackPageview']);

var minPos, bnr, scrollMax, targetPos, currentPos, previousTargetPos, stationaryCount = 0, framesUntilSlide = 5;

function AdReposition()
{
	currentPos = parseInt(bnr.style.top.replace('px', ''));
	targetPos = minPos + (AdPos() > minPos + 141 ? AdPos() - minPos - 141 : 0);
	if (targetPos > scrollMax) targetPos = scrollMax;
	
	if (previousTargetPos == targetPos)
	{
		if (stationaryCount < framesUntilSlide) stationaryCount++;
	}
	else stationaryCount = 0;
	
	if (currentPos != targetPos)
	{
		if (stationaryCount == framesUntilSlide) bnr.style.top = parseInt(currentPos + (targetPos - currentPos) / 8) + 'px';
	}
	
	previousTargetPos = targetPos;
	setTimeout('AdReposition()', 20);
}

function AdScrollInit()
{
	//bnr = document.getElementById('bnr');
	//minPos = bnr.offsetTop;
	//bnr.style.top = minPos + 'px';
	//scrollMax = document.getElementById('mainContent').offsetHeight - bnr.offsetHeight;
	//AdReposition();
}
	
function AdPos()
{
	if (window.innerHeight) return window.pageYOffset;
	else if (document.documentElement && document.documentElement.scrollTop) return document.documentElement.scrollTop;
	else if (document.body) return document.body.scrollTop;
}

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
