
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 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;
	}
}

        //scroller width
        //var swidth=200;

        //scroller height
        var sheight=200;
		
        //background color
        var sbcolor='';

        //scroller's speed
        var sspeed=3;

        var msg='';
		
		var resumesspeed=sspeed;
		var threads = 0;
		var newsTemplate = null;
		
		function start(tipoNews)
		{                
			//	xmlhttp.setRequestHeader("Content-Type","text/x-json");
			xmlhttp.open("GET", "/newsscroller/newsscroller.asp?tipoNews=" + tipoNews,true);
			xmlhttp.onreadystatechange=function() {
			  if (xmlhttp.readyState==4)
			  {
				var objJason = eval(xmlhttp.responseText);
				msg = '';
				
				if(newsTemplate == null)
				{
					newsTemplate = document.getElementById('ticker').innerHTML;
				}
				
				for(var i = 0; i < objJason.length; i++)
				{	
					msg += newsTemplate.replace(/class=\"?template\"?/g, '').replace(/#link#/g, objJason[i].link).replace(/#target#/g, objJason[i].target).replace(/#title#/g, objJason[i].title).replace(/#message#/g, objJason[i].message);
					//msg += '<ul><li><a href="' + objJason[i].link + '" target="' + objJason[i].target + '" title="' + objJason[i].title + '">'
					//		+ objJason[i].title + '</a></li><li>' + objJason[i].message + '</li></ul>';
				}
				
				threads++;
				//if(sheight == sheight - 50)
				//	sheight += 50;
				
				if (document.all)
					iemarquee(ticker);
				else if (document.getElementById)
					ns6marquee(document.getElementById('ticker'));
			  }
			 }
			 xmlhttp.send(null);
        }
		
		function printNews(tipoNews)
		{
        	//	xmlhttp.setRequestHeader("Content-Type","text/x-json");
			xmlhttp.open("GET", "/newsscroller/newsscroller.asp?tipoNews=" + tipoNews,true);
			xmlhttp.onreadystatechange=function() {
			  if (xmlhttp.readyState==4)
			  {
				var objJason = eval(xmlhttp.responseText);
				msg = '';
				
				if(newsTemplate == null)
				{
					newsTemplate = document.getElementById('ticker').innerHTML;
				}
				
				for(var i = 0; i < objJason.length; i++)
				{	
					msg += newsTemplate.replace(/class=\"?template\"?/g, '').replace(/#link#/g, objJason[i].link).replace(/#target#/g, objJason[i].target).replace(/#title#/g, objJason[i].title).replace(/#message#/g, objJason[i].message);
					//msg += '<ul><li><a href="' + objJason[i].link + '" target="' + objJason[i].target + '" title="' + objJason[i].title + '">'
					//		+ objJason[i].title + '</a></li><li>' + objJason[i].message + '</li></ul>';
				}
				
				document.getElementById('ticker').innerHTML = msg;
			  }
			 }
			 xmlhttp.send(null);
        }
		
        function iemarquee(whichdiv)
		{
                iediv=eval(whichdiv);
                iediv.style.pixelTop=sheight;
                iediv.innerHTML=msg;
                sizeup=iediv.offsetHeight;
				if(threads == 1)
                	ieslide();
        }
        
        function ieslide()
		{
			if (iediv.style.pixelTop>=sizeup*(-1))
			{
				iediv.style.pixelTop-=sspeed;
				setTimeout("ieslide()",100);
			}
			else
			{
				iediv.style.pixelTop=sheight;
				ieslide();
			}
        }
        
        function ns6marquee(whichdiv)
		{
			ns6div=eval(whichdiv);
			ns6div.style.top=sheight + "px";
			ns6div.innerHTML=msg;
			sizeup=ns6div.offsetHeight;
			if(threads == 1)
				ns6slide();
        }
        function ns6slide()
		{
			if (parseInt(ns6div.style.top)>=sizeup*(-1))
			{
				theTop = parseInt(ns6div.style.top)-sspeed;
				ns6div.style.top = theTop + "px";
				setTimeout("ns6slide()",100);
			}
			else
			{
				ns6div.style.top = sheight + "px";
				ns6slide();
			}
        }