var currSS = 0;
var timerAdvance = 0;
var autoAdvance = 5000;

function styleVal(e,p) {
	e=typeof e=='object'?e:$(e);
	return e.currentStyle?e.currentStyle[p]:document.defaultView.getComputedStyle(e,null).getPropertyValue(p)
}

function set(e,a,s) {
	e=typeof e=='object'?e:$(e); var o=e.style.opacity||styleVal(e,'opacity'),
	d=a>o*100?1:-1; e.style.opacity=o; clearInterval(e.ai); e.ai=setInterval(function(){tw(e,a,d,s)},20)
}

function tw(e,a,d,s) {
	var o=Math.round(e.style.opacity*100);
	if (o==a) {
		clearInterval(e.ai);
		var old = document.getElementById('ss_pane_'+currSS);
		old.style.zIndex=0;
		currSS=e.num;
	} else {
		var n=o+Math.ceil(Math.abs(a-o)/s)*d; e.style.opacity=n/100; e.style.filter='alpha(opacity='+n+')';
	}
}

function ss_switch(num) {
	clearTimeout(timerAdvance);
	if (num == currSS) return;
	var old = document.getElementById('ss_pane_'+currSS);
	old.style.zIndex=1;
	var oldlink = document.getElementById('ss_link_'+currSS);
	oldlink.className = 'ss_linkoff';
	var newlink = document.getElementById('ss_link_'+num);
	newlink.className = 'ss_linkon';
	var e = document.getElementById('ss_pane_'+num);
	e.num=num;
	e.style.opacity=0; e.style.filter='alpha(opacity=0)';
	e.style.zIndex=2;
	set(e, 100, 5);
	timerAdvance = setTimeout('nextWindow()', autoAdvance);
}

function nextWindow(num) {
	ss_switch(document.getElementById('ss_pane_'+(currSS+1))?currSS+1:0);
}

timerAdvance = setTimeout('nextWindow()', autoAdvance);
