/* NEWSTICKER */

var first = 0;
var speed = 700;
var pause = 3000;

$(document).ready(function(){
	
	//if id newsTicker exists init 
	if($('ul#newsTicker').length){
		initNewsTicker();
	}
	
});

function initNewsTicker(){
	interval = setInterval(removeFirst, pause);
}

//REMOVE FIRST LI
function removeFirst(){
	first = $('ul#newsTicker li:first').html();
	$('ul#newsTicker li:first').hide().remove();
	/*.animate({opacity: 0}, speed)
	.fadeOut('slow', function() {$(this).remove();});*/
	addLast(first);
}

//ADD LAST LI
function addLast(first){
	last = '<li class="areaText" style="display:none">'+first+'</li>';
	$('ul#newsTicker').append(last)
	$('ul#newsTicker li:last').show();
	/*.animate({opacity: 1}, speed)
	.fadeIn('slow')*/
}

/*
html usage

<ul id="newsTicker">
	<li class="areaText">1</li>
	<li class="areaText">2</li>
	<li class="areaText">3</li>
	<li class="areaText">4</li>
</ul>

*/
