// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
sfHover = function() {
	var sfEls = document.getElementById("navigation").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

window.onload = function() {
	sfHover();
	if (document.getElementById('news-ticker')) startScroll();
};

var auto_direction=1;
function autoScroll(amount) {
	var div=document.getElementById('news-ticker');
	div.scrollLeft += (amount*auto_direction);
	if ((div.scrollWidth-div.scrollLeft==div.offsetWidth && auto_direction > 0)  || (div.scrollLeft == 0 && auto_direction < 0 )) {
		auto_direction=auto_direction*-1;
	}
}

function startScroll() {
	i=document.getElementById('news-ticker');
	i.scrollLeft=0;
	setInterval('autoScroll(1)',50);
}