//cross browser fade
function GetOpacity(obj){
	var opValue;
	
	if(obj.filters){
		alphaStr = obj.style.filter.split("=");
		
		opValue = 0;
		if(alphaStr[1]){
			opValue = parseInt(alphaStr[1].substring(0, alphaStr[1].length-1));
		}
	}
	else{
		opValue = Math.round(parseFloat(obj.style.MozOpacity)*100);
		if(isNaN(opValue)){
			opValue = 0;
		}
	}
	
	
	return opValue;
}

function IncreaseOpacity(obj, opValue){
	opNewValue = opValue + FadeInStep;
	if(obj.filters){
		obj.style.filter = "alpha(opacity=" + opNewValue + ")";
	}
	else{
		obj.style.MozOpacity = opNewValue / 100;
	}
}

function DecreaseOpacity(obj, opValue){
	opNewValue = opValue - FadeOutStep;
	if(obj.filters){
		obj.style.filter = "alpha(opacity=" + opNewValue + ")";
	}
	else{
		obj.style.MozOpacity = opNewValue / 100;
	}
}

function FadeIn(){
	oldOpValue = GetOpacity(TickerContainerObj);
	if(oldOpValue < 100){
		IncreaseOpacity(TickerContainerObj, oldOpValue);
	}
	else{
		clearInterval(FadingIntervalObj);
	}
}

function FadeOut(){
	oldOpValue = GetOpacity(TickerContainerObj);
	if(oldOpValue > 0){
		DecreaseOpacity(TickerContainerObj, oldOpValue);
	}
	else{
		clearInterval(FadingIntervalObj);
		TickerContainerObj.innerHTML = TickerContent[TickerCurrentIndex];
		FadingIntervalObj = setInterval("FadeIn()", 1);
	}
}

function RunTicker(){
	TickerCurrentIndex++;
	if(TickerCurrentIndex >= TickerContent.length){
		TickerCurrentIndex = 0;
	}
	
	FadingIntervalObj = setInterval("FadeOut()", 1);
}

function StartTicker(){
	TickerContainerObj = document.getElementById(TickerContainerObjName);
	TickerCurrentIndex = -1;
	
	RunTicker();
	setInterval("RunTicker()", TickerShowTime*1000);
}

var FadingIntervalObj;
var TickerContainerObj;
var TickerContainerObjName;
var TickerCurrentIndex;

var FadeOutStep = 4;
var FadeInStep = 2;
var TickerShowTime = 7;