/**********************************************************
	Scroller
	Author: Fred Snyder
	Company: Castwide Technologies
	URL: http://castwide.com
	Client: ilovegoodwork on www.rentacoder.com
	Date Created: March 26, 2006
	Date Modified: March 27, 2006

**********************************************************/


function CWScroller(ulId, speed) {

	this.container = document.getElementById(ulId);
	this.container.Scroller = this;
	this.speed = speed;

	this.scroll = function() {
			var c = this.container.firstChild;
			var first = null;
			while (c) {
				if (c.tagName == 'LI') {
					first = c;
					break;
				}
				c = c.nextSibling;
			}
			var nodeSize = 78;	// Default
			var px = 0;
			nodeSize = first.clientWidth;
			if (first.style.marginLeft != '') {
				px = parseInt(first.style.marginLeft);
			}
			first.style.marginLeft = ( px - 1 ) + 'px';
			if ( parseInt(first.style.marginLeft) <= -(nodeSize) ) {
				first.style.marginLeft = '0px';
				this.container.removeChild(first);
				this.container.appendChild(first);
			}
		setTimeout('document.getElementById(\'' + this.container.id + '\').Scroller.scroll()', this.speed);	
	}

	setTimeout('document.getElementById(\'' + ulId + '\').Scroller.scroll()', this.speed);

}

function addLoadEvent(func) {
   var oldonload = window.onload;
   if (typeof window.onload != 'function') {
      window.onload = func;
   }
   else {
      window.onload = function() {
      oldonload();
      func();
      }
    }
}

function IEHoverPseudo() { // by nick rigby
	var navItems = document.getElementById("mainnav").getElementsByTagName("li");
	
	for (var i=0; i<navItems.length; i++) {
		if(navItems[i].className == "firstl") {
			navItems[i].onmouseover=function() { this.className += " over"; }
			navItems[i].onmouseout=function() { this.className = "firstl"; }
		}
	}
}
window.onload = IEHoverPseudo;
