var cycleNews;

$(document).ready(function(){
});

function InitNewsTicker(){
	var $AlertItem = $('div#NewsReel div.alertTrue:first');

	if($AlertItem.size() > 0){
		$AlertItem
			.addClass("alertItem")
			;
		var AlertLink = $AlertItem.find('a').attr("href");
		$('div#NewsTicker a#AlertButtonLink')
			.attr("href",AlertLink)
			;
		$('div#NewsTicker div#AlertButton img')
			.show()
			;
		}
	
	/*	
		.each(function(){
			var dLocation = $(this).data("dLocation");
			var newLocation = "<li><a href='javascript:void(0)' class='aLocation' targetLoc='" + dLocation + "' imgsrc='/Style Library/SunDial/SunDial/Images/cubes_000009985878Small.jpg'>" + dLocation + "</a></li>";
			$('#ulLocationList').append(newLocation);
			})
		;
	*/
	
	MoveReel();
	}


function MoveReel(){
	if($('#NextNewsItem').size() < 1){
		$('#NewsTicker div.newsItem:first')
			.attr("id","NextNewsItem")
			.fadeTo(0,0)
			;
		}

	$("#ActiveNewsItem")
		.attr("id","ClosingNewsItem")
		;

	$("#ClosingNewsItem")
		.animate({
    	top: "0",
    	opacity: 0
  		}
  		,1000
  		,function(){
  			$(this)
  				.css("top","40px")
  				.attr("id","")
  				;
  			}
  		)
  	;

	$("#NextNewsItem")
		.animate({
    	top: "18",
    	opacity: 1
  		}
  		,1000
  		,function(){
  			$(this)
			  	.css('filter', 'none')
			  	.attr("id","ActiveNewsItem")
			  	.next()
			  	.attr("id","NextNewsItem")
				.fadeTo(0,0)
  				;
  			}
  		)
  	;

	cycleNews = window.setTimeout(function(){
		MoveReel();
		}, 5000);
	}// ^^MoveReel



