// JavaScript Document
function galleryScroll(scrollname, div_name, up_name, down_name)
{
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 5;
    this.timeoutID = 0;
    this.div_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;

	if (document.getElementById) {
		div_obj = document.getElementById(this.div_name);
		if (div_obj) {
			this.div_obj = div_obj;
			this.div_obj.style.overflow = 'hidden';
		}
		div_up_obj = document.getElementById(this.up_name);
		div_dn_obj = document.getElementById(this.dn_name);
		if (div_up_obj && div_dn_obj) {
			div_up_obj.onmouseover = function() { eval(scrollname + ".scrollLeft();") };
			div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
			
			div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollRight();") };
			div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
		}
	}

	this.stopScroll = function() {
        clearTimeout(this.timeoutID);
    }

	this.scrollLeft = function() {
        if (this.div_obj) {            
            this.div_obj.scrollLeft = (div_obj.scrollLeft - this.speed);
            this.timeoutID = setTimeout(this.name + ".scrollLeft()", 30);
        }
    }

	this.scrollRight = function() {
        if (this.div_obj) {
            this.div_obj.scrollLeft = (div_obj.scrollLeft + this.speed);
            this.timeoutID = setTimeout(this.name + ".scrollRight()", 30);
        }
    }

	this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }
}

function initGallery()
{
	gallery = new galleryScroll('gallery', 'gallery', 'scroll_left', 'scroll_right');
}

var gallery;
window.addOnloadEvent(initGallery);
