var xmlhttp = false;
var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline=0;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
	xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp = false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp = false;
	}
}

function PostContent() {
  	if(xmlhttp.readyState == 4 && xmlhttp.status == 200){	//div content has loaded, start scrolling
  	
  		var txt = xmlhttp.responseText;
  		var obj = document.getElementById('scrollup');
  		
  		//alert(txt);
		obj.innerHTML=txt;
		
		headline_count = $("div.headline").size();
  		$("div.headline:eq("+current_headline+")").css('top','5px');
  		headline_interval = setInterval(headline_rotate,5000); //time in milliseconds
	}}

function runAnnouncement(isRooot) {
	if (xmlhttp) {
		tmp = new Date();
		tmp = "?"+tmp.getTime()+ "&isRoot=" + isRooot;
		//xmlhttp.open("GET", "annoucement.txt"+tmp);
		if (isRooot == 1){
			xmlhttp.open("GET", "Included.aspx"+tmp);
		}
		else{
			xmlhttp.open("GET", "../Included.aspx"+tmp);
		}
		
		xmlhttp.onreadystatechange=PostContent;
		xmlhttp.send(null);
	}
}

function headline_rotate() {
  current_headline = (old_headline + 1) % headline_count; //remainder will always equal old_headline until it reaches headline_count - at which point it becomes zero. clock arithmetic
  $("div.headline:eq(" + old_headline + ")").animate({top: -205},"slow", function() {
    $(this).css('top','210px');
    });
  $("div.headline:eq(" + current_headline + ")").show().animate({top: 5},"slow");  
  old_headline = current_headline;
}
