/******************************************************************************
Copyright (C) Matteo Lucarelli - matteolucarelli@altervista.org

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
******************************************************************************/

// cross browser javascript code to scroll a div content

// NOTE: 
//
// probably you need to changed the div id, here is "scrolldiv":
//      <div id="scrolldiv">
//
// the div content must be hide by css:
//      style="overflow: hidden;"
//
// the two functions can be called by a link:
//      <a href="javascript:divScrollUp(140)">scroll up</a>

var time=50; // less is faster
var step=20; // more is lighter for host cpu
  
function divScrollUp(amount) {

	document.getElementById("scrolldiv").scrollTop -= step;
	amount -= step;
	if (amount>0) setTimeout('divScrollUp('+amount+')',time)
}

function divScrollDown(amount) {
		
	document.getElementById("scrolldiv").scrollTop += step;
	amount -= step;
	if (amount>0) setTimeout('divScrollDown('+amount+')',time)
}