/*
 * Author: Adomas L'?iauL'A;ys
 * E-mail: adomas@itp.lt
 * ICQ: 164089509
 * MSN: adomaz@msn.com
 * IRC NickName: ayman; IRC Server: irc.le.lt
 *
 *
 * Usage:
 *		<div id="<id>" style="overflow: hidden; width: x; height: y;"></div>
 * Control:
 *		<a href="#" onmouseover="scrollUp('<id>')" onmouseout="stopScroll()">UP</a>
 *		<a href="#" onmouseover="scrollDown('<id>')" onmouseout="stopScroll()">DOWN</a>
 *
 *
 * PraL'A;ome jL'T(sL'? neprisiimti autoriniL'? teisiL'? sau!
 * 
 * Modified 2007-09-07 by Mattthew Hipkin <mhipkin@matthewhipkin.co.uk> to include left & right scrolling
 */
 
 
  var speed = 25; // set scroll speed
  var step = 5; //set scroll step
  

  function scrollUp(id) {
    document.cycle=true;
    up(id);
  }

  function scrollDown(id) {
    document.cycle=true;
    down(id);
  }
  
  function sscrollLeft(id) {
    document.cycle=true;
    sleft(id);
  }

  function scrollRight(id) {
    document.cycle=true;
    sright(id);
  }

  function up(id) {
    if (document.cycle) {
        if (document.getElementById(id).scrollTop > 0) {
            scrollPos=document.getElementById(id).scrollTop;
            scrollPos=scrollPos-step;
            document.getElementById(id).scrollTop = scrollPos;
        }
    setTimeout("up('"+id+"')", speed);
    } else {
        stopScroll();
    }
  }

  function down(id) {
    if (document.cycle) {
        if (document.getElementById(id).scrollTop < document.getElementById(id).scrollHeight) {
            scrollPos=document.getElementById(id).scrollTop;
            scrollPos=scrollPos+step;
            document.getElementById(id).scrollTop = scrollPos;
        }
    setTimeout("down('"+id+"')", speed);
    } else {
        stopScroll();
    }
  }

  function sleft(id) {
    if (document.cycle) {
        if (document.getElementById(id).scrollLeft > 0) {
            scrollPos=document.getElementById(id).scrollLeft;
            scrollPos=scrollPos-step;
            document.getElementById(id).scrollLeft = scrollPos;
        }
    setTimeout("sleft('"+id+"')", speed);
    } else {
        stopScroll();
    }
  }
  
  function sright(id) {
    if (document.cycle) {
        if (document.getElementById(id).scrollLeft < document.getElementById(id).scrollWidth) {
            scrollPos=document.getElementById(id).scrollLeft;
            scrollPos=scrollPos+step;
            document.getElementById(id).scrollLeft = scrollPos;
        }
    setTimeout("sright('"+id+"')", speed);
    } else {
        stopScroll();
    }
  }

  function stopScroll() {
    document.cycle=false;
  }
