function xmlhttp(){
 var x = null;
 if (window.ActiveXObject) {
   x = new ActiveXObject("Msxml2.XMLHTTP");
   if (!x) {     x = new ActiveXObject("Microsoft.XMLHTTP");
   }
 } else if(window.XMLHttpRequest) {
   x = new XMLHttpRequest();
 }
 return x;
}

function _sendx(url, div_id) {
  var x = xmlhttp();
  x.open("GET", url, true);
  x.onreadystatechange = function() {
    if (x.readyState == 4) {
      document.getElementById(div_id).innerHTML = x.responseText;
    }
  };
  x.send(null);
}

// Scrollers speed here (larger is faster 1-10)
var scrollerspeed=1
var pauseit=1
var isIE = (navigator.userAgent.indexOf('MSIE') > 0);

// Change nothing below!
scrollerspeed=(document.all)? scrollerspeed : Math.max(1, scrollerspeed-1);
//slow speed down by 1 for NS
var copyspeed=scrollerspeed;
var actualheight='';
var pausespeed=(pauseit==0)? copyspeed: 0;

function initScroll(id, width, height, realheight) {
  var scrolling_div=document.getElementById(id);
  var scrolling_div_container = scrolling_div.parentNode;
  if (isIE) {
    scrolling_div_container.style.position = 'relative';
    scrolling_div.style.position = 'absolute';
    scrolling_div.style.left = scrolling_div_container.style.left;
  } else {
    scrolling_div.style.position = 'relative';
    scrolling_div.style.left = '0px';
  }
  scrolling_div.style.width = width;//'100%';
  scrolling_div.style.height = height;//'100%';
  scrolling_div_container.style.width = width;
  scrolling_div_container.style.height = height;
  scrolling_div_container.style.display = 'block';
  scrolling_div_container.style.overflow = 'hidden';
  //scrolling_div_container.style.border = '1px solid lightgrey';
  //scrolling_div_container.style.padding = '10 10 10 10';
  actualheight = realheight || scrolling_div.offsetHeight;
  scrolling_div.style.top = height;
  scrolling_div_container.onmouseover = function() {
    copyspeed = pausespeed;
  };
  scrolling_div_container.onmouseout = function() {
    copyspeed = scrollerspeed;
  }
  setInterval(function() {
    scroll(scrolling_div, actualheight);
  }, 20)
}

function scroll(scrolling_div, height){
  var top = parseInt(scrolling_div.style.top);
  if (top > (height*(-1) + 8)) {
    scrolling_div.style.top = (top - copyspeed) + 'px';
  } else {
    scrolling_div.style.top = (height + 1) + 'px';
  }
}
