
var foo = null; // object
var maxspd=35;
var ramp=4;
var start=0;
var d=612;  // This should be the same width as the scrolled area
var a;

function doMove(direction,distance)
{
   var remain;
//   opera.postError(distance);
   if(distance<d)
   {
      if(distance<(d/2))
      {
	 remain=distance;
      }
      else
      {
	 remain=d-distance;
      }

      a=Math.round((remain/ramp))+1;   

      if(a>maxspd) a=maxspd;

      distance+=a;
      if(distance>d) distance=d;

      foo.style.left = Math.round((start+(distance*direction)))+'px';
 
      setTimeout("doMove("+direction+","+distance+")",20); // call doMove in 20msec.
      return 0
   }
//   foo.style.left = (start+direction*d) +'px';
}

function initl() 
{
   foo = document.getElementById('slider'); // get the "foo" object
   document.getElementById('rarrow').style.visibility='hidden';
   document.getElementById('larrow').style.visibility='visible';
   start=parseInt(foo.style.left); // set its initial position to 0px
   doMove(-1,0); // start animating
//   foo.style.left = d+'px';
}

function initr() 
{
   foo = document.getElementById('slider'); // get the "foo" object
   document.getElementById('larrow').style.visibility='hidden';
   document.getElementById('rarrow').style.visibility='visible';
   start=parseInt(foo.style.left); // set its initial position to 0px
   doMove(1,0); // start animating
//   foo.style.left ='0px';
}

function clientSideInclude(id, url) {
  var req = false;
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
 var element = document.getElementById(id);
 if (!element) {
  alert("Bad id " + id + 
   "passed to clientSideInclude." +
   "You need a div or span element " +
   "with this id in your page.");
  return;
 }
  if (req) {
    // Synchronous request, wait till we have it all
    req.open('GET', url, false);
    req.send(null);
    element.innerHTML = req.responseText;
  } else {
    element.innerHTML =
   "Sorry, your browser does not support " +
      "XMLHTTPRequest objects. This page requires " +
      "Internet Explorer 5 or better for Windows, " +
      "or Firefox for any system, or Safari. Other " +
      "compatible browsers may also exist.";
  }
 element.style.visibility='visible';
}

