/*
Content Scroller v1.0.0 (c) leytman.design 2007
*/

var scrolleroffset = 4500; /* scroller timer interval, ms */
var scrolltimer = 0;
var scroller;

function $(id){
   return document.getElementById(id);
}

function repeatswitchscroller(switchnum) {
	var switches = scroller.getElementsByTagName("A");
	if (switchnum < switches.length) {
		switchscroller(switches[switchnum]); }
	else {
		switchscroller(switches[0]);
	}
}

function switchscroller(srctag) {
	if (srctag.tagName == "DIV") {
		var switches = srctag.getElementsByTagName("A");
		for ( var i = 0; i < switches.length; i+=1 ) { 
			if (switches[i].className == "active") { switchscroller(switches[i]); }
		}
		for ( var i = 0; i < switches.length; i+=1 ) { 
			if (switches[i].id == "defaultswitch") { switchscroller(switches[i]); }
		}
	}
	else {
		var switches = srctag.parentNode.getElementsByTagName("A"); var switchindex;
		for ( var i = 0; i < switches.length; i+=1 ) {
			switches[i].className = ""; $(srctag.parentNode.id + "_content" + (i+1)).className = "switchcontent";
			if (switches[i] == srctag) { switchindex = i+1; }
		}
		srctag.className = "active";
		$(srctag.parentNode.id + "_content" + switchindex).className = "switchcontent_active";
		if (scrolltimer != 0) { self.clearTimeout(scrolltimer); }
		scroller = srctag.parentNode;
		newindex = switchindex;
		scrolltimer = setTimeout("repeatswitchscroller(" + newindex + ")", scrolleroffset);
	}
}