
scrollerSponsors_speed = 100;
scrollerSponsors_shift_interval = 0;
scrollerSponsors_speed_limit = 3;

function scrollerSponsors_over(event) {
	//start moving
	scroller_shift_interval = setInterval("scrollerSponsors_shift()",10);
}

function scrollerSponsors_move(event) {
	//reset speed
	var el = event.srcElement;
	if (!el) {
		//MOZILLA
		el = event.target;
	}
	var offsetCount=0;
	while (el.id != "scrollerSponsorscontainer") {
		offsetCount += el.offsetLeft;
		el = el.parentNode;
	}
	var mouseX = event.offsetX + offsetCount;
	if (typeof event.offsetX == "undefined") {
		if (event.target.id.match("scrollerSponsorsleft")) {
			mouseX = event.layerX;
		} else {
			if (event.target.id.match("scrollerSponsorsright")) {
				mouseX = event.layerX;
			} else {
				mouseX = event.layerX + parseInt(document.getElementById('scrollerSponsorstable').offsetLeft) + 40 ;
			}
		}
	}
	scrollerSponsors_speed = (mouseX - (700/2)) / (700/2) * 4;
	if (scrollerSponsors_speed > scrollerSponsors_speed_limit) scrollerSponsors_speed = scrollerSponsors_speed_limit;
}

function scrollerSponsors_out() {
	//stop movement
	clearInterval(scrollerSponsors_shift_interval);
}

function scrollerSponsors_shift() {
	//actually move the scrollerSponsors

	var actual_speed = Math.abs(scrollerSponsors_speed) - 2;
	if (actual_speed<0) actual_speed=0;
	if (scrollerSponsors_speed<0) actual_speed = -1 * actual_speed;
	
	var mytable = document.getElementById('scrollerSponsorstable'); 
	var myleft = document.getElementById('scrollerSponsorsleft');
	var myright = document.getElementById('scrollerSponsorsright');

	if (parseInt(mytable.offsetLeft)>=0 && actual_speed<0) {
		if (!myleft.src.match("stop")) myleft.src = myleft.src.replace("left.gif","left_stop.gif");
		return;
	} else {
		if (myleft.src.match("stop")) myleft.src = myleft.src.replace("left_stop.gif","left.gif");
	}
	if (parseInt(mytable.offsetLeft)<=(717-mytable.offsetWidth) && actual_speed > 0) {
		if (!myright.src.match("stop")) myright.src = myright.src.replace("right.gif","right_stop.gif");
		return;
	} else {
		if (myright.src.match("stop")) myright.src = myright.src.replace("right_stop.gif","right.gif");
	}
	mytable.style.left = (parseInt(mytable.offsetLeft) - actual_speed) + "px";
}
