
var rssUpdateInterval = 5; //Sekunden
function test1() {
	new Effect.Shake($('art1'), {duration:0.9});
	hideLoading();
}
function test() {
	window.setTimeout("test1()", 1000); 
}
function test2() {
		new Effect.DropOut("art14", { duration: 0.8 });
	//hideLoading();
}
function test3() {
	window.setTimeout("test2()", 1000); 
}

function showLoading(latency) {
	document.getElementById('ajaxLoading').style.display='block';
	//window.setTimeout(hideLoading() ,latency);
}
function hideLoading() {
	document.getElementById('ajaxLoading').style.display='none';
}
function initAjaxRSSTicker() 
{

 var myAjax = new Ajax.PeriodicalUpdater(
  'art1',
  '/livein1.php', 
  {
	  method: 'get',
    frequency: rssUpdateInterval,
	decay:1,
onSuccess: function(xhr) {

		if(myAjax.lastText == "undefined" || myAjax.lastText == undefined || xhr.responseText.substring(0, 310) != myAjax.lastText.substring(0, 310)) {
			showLoading(1500);
			if (navigator.userAgent.indexOf('MSIE') != -1) {
			test();
			} 
			document.getElementById('art1').style.opacity="0";
	        for( i=11; i>0; i-- ) { 
				document.getElementById('art'+(i+1).toString()).innerHTML=document.getElementById('art'+i.toString()).innerHTML;
			}
           window.setTimeout( firstDiv(xhr.responseText),0);
		   
		}
	}
  })
}

function firstDiv(transport){
	document.getElementById('art1').innerHTML=transport;
	if (navigator.userAgent.indexOf('MSIE') != -1) {
		test();
	} else {
		window.setTimeout( blendingLi(0), 0);
	}
}

function blendingLi(appear){
	appear=appear+0.1;
    document.getElementById('art1').style.opacity=appear.toString();
    if(appear<1) {
		window.setTimeout("blendingLi("+appear+")",65);
		
	} else {
	hideLoading();
	}
}

Event.observe(document, 'dom:loaded', function(){
		initAjaxRSSTicker();
	});


