//  Distributed by http://www.hypergurl.com

// Scrollers width here (in pixels)
//var scrollerwidth="181px"; VAGR
var scrollerwidth="165px";

// Scrollers height here
var scrollerheight="120px";

// Scrollers speed here (larger is faster 1-10)
var scrollerspeed=1;

// Scrollers content goes here! Keep all of the message on the same line!
var scrollercontent= "";

var pauseit=1;

// Change nothing below!

scrollerspeed=(document.all)? scrollerspeed : Math.max(1, scrollerspeed-1) //slow speed down by 1 for NS
var copyspeed=scrollerspeed
var iedom=document.all||document.getElementById
var actualheight=''
var cross_scroller, ns_scroller
var pausespeed=(pauseit==0)? copyspeed: 0
var counttime = 0

function populate(){
    if (iedom){
        cross_scroller=document.getElementById? document.getElementById("iescroller") : document.all.iescroller
        cross_scroller.style.top=parseInt(scrollerheight)+8+"px"
        cross_scroller.innerHTML=scrollercontent        
        actualheight=cross_scroller.offsetHeight
    }
    else if (document.layers){
        ns_scroller=document.ns_scroller.document.ns_scroller2
        ns_scroller.top=parseInt(scrollerheight)+8
        ns_scroller.document.write(scrollercontent)
        ns_scroller.document.close()
        actualheight=ns_scroller.document.height
    }
    //lefttime=setInterval("scrollscroller()",30)
}



function scrollscroller(){
 
    if (iedom){
        if (parseInt(cross_scroller.style.top)>(actualheight*(-1)+8)){
            cross_scroller.style.top=parseInt(cross_scroller.style.top)-copyspeed+"px"
            
        }else{
            cross_scroller.style.top=parseInt(scrollerheight)+8+"px"
        }
    }
    else if (document.layers){
        if (ns_scroller.top>(actualheight*(-1)+8))
            ns_scroller.top-=copyspeed
        else{
            ns_scroller.top=parseInt(scrollerheight)+8
        }
    }
}

function cargarTabla(){    
	 ajax=nuevoAjax();
	 ajax.open("GET", "viewChat.asp",true);
	 ajax.onreadystatechange=function() {
	  if (ajax.readyState==4) {   
	   scrollercontent = ajax.responseText
	   populate()   
	  }
	 }
	 ajax.send(null)  
}

function control(){
	 if(scrollercontent!=""){
	  scrollscroller();
	  if(counttime > 30000){
	   cargarTabla();
	   counttime = 0;
	  }
	  
	  else
	   counttime = counttime + 40 
	  
	  /*if(counttime > 2000){
	   M();
		Ma();
	  }*/
	}
}

window.onload= function(){
 cargarTabla();
 lefttime=setInterval("control()",40);
//Muestra();
//Muestraa();
}




		/*var a=0;
		var nomb="";*/
		/*function Popup_DoFSCommand(command, args) {
			Cierra()
  		}*/
		/*function M(){
				var crea=document.getElementById("Popup");
				y=(screen.height<700&&crea.height>340)?520:document.body.clientHeight;
				t=(document.body.scrollTop==0)?document.documentElement.scrollTop:document.body.scrollTop;
				crea.style.top=(y-crea.height)/2+t;
			}*/

		/*function Muestra(){
			var crea=document.getElementById("Popup");
			//crea.style.left=(document.body.clientWidth-350)/2;
			crea.style.left=215;
			//M();

			//crea.style.visibility = 'visible';
			crea.style.visibility = 'visible';
		}*/
		/*function Cierra(){
			var crea=document.getElementById("Popup");
			crea.style.visibility = 'visible';
			//return false;
		}*/
		//window.onscroll=M;

	
	
	
	
	
		/*var aa=0;
		var nomba="";
		function Popup_DoFSCommand(command, args) {
			Cierra()
  		}
		function Ma(){
				var creaa=document.getElementById("Popupcambio");
				ya =(screen.height<500&&creaa.height>340)?520:document.body.clientHeight;
				ta=(document.body.scrollTop==0)?document.documentElement.scrollTop:document.body.scrollTop;
				creaa.style.top=(ya-creaa.height)/2+ta;
			}

		function Muestraa(){
			var creaa=document.getElementById("Popupcambio");
			//crea.style.left=(document.body.clientWidth-350)/2;
			creaa.style.right=250;
			Ma();

			//crea.style.visibility = 'visible';
			creaa.style.visibility = 'visible';
		}
		function Cierraa(){
			var creaa=document.getElementById("Popupcambio");
			creaa.style.visibility = 'visible';
			//return false;
		}
		window.onscroll=Ma;*/




