var agt = navigator.userAgent.toLowerCase();
var ie7 = false;
var ie = false;

if(agt.indexOf("msie") != -1 && agt.substr(agt.indexOf("msie")+5,1) == '7')
	ie7 = true;
if(agt.indexOf("msie") != -1)
    ie = true;

//-------
var showing = 1;
function changeTxt(show, bypassStop)
    {
	if(!bypassStop)
		stopTxt();

	document.getElementById('midTxt' + showing).style.display = 'none';
	document.getElementById('linkCont' + showing).className = '';
	if(!ie7 && document.getElementById('linkCont' + showing).runtimeStyle)
		document.getElementById('linkCont' + showing).runtimeStyle.filter = null;

	document.getElementById('txt' + showing).style.display = 'none';
    document.getElementById('link' + showing).style.display = 'inline';

	if(ie)
	   document.getElementById('midTxt' + show).style.display = 'block';
	else
	   document.getElementById('midTxt' + show).style.display = 'table';
	document.getElementById('linkCont' + show).className = "curr cn";
	if(!ie7 && document.getElementById('linkCont' + show).runtimeStyle)
		{
		document.getElementById('linkCont' + show).style.background = 'none';
		document.getElementById('linkCont' + show).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/i/switch-bg.png',sizingMethod='scale')";
		}

	document.getElementById('link' + show).style.display = 'none';
	document.getElementById('txt' + show).style.display = 'inline';

	showing = show;
    }

//---------
var running = false;
var runningTimer = null;
var period = 8000;

function runTxt()
	{
	if(!running)
		{
		running = true;
		changeTxt(1, true);
		runningTimer = window.setTimeout(txtTick, period);
		}
	}

function stopTxt()
	{
	if(running)
		{
		window.clearTimeout(runningTimer);
		running = false;
		}
	}

function txtTick()
	{
	if(!running)
		return;

	changeTxt((showing % 3) + 1, true);
	runningTimer = window.setTimeout(txtTick, period);
	}
