var Thumbs = Class.create
({
	initialize: function(container, left, right, pic_size, pics_count)
	{
	    this.pic_size = pic_size;
	    this.pics_count = pics_count;
		var images = $(container).getElementsByTagName('a');

		this.go_left = this.goLeft.bindAsEventListener(this);
		this.go_right = this.goRight.bindAsEventListener(this);

		this.container = $(container);
		$(left).observe('click', this.go_left);
		$(right).observe('click', this.go_right);

		if (this.container.scrollLeft == 0) {
            $('g_scroll_left').hide();
        } else {
            $('g_scroll_left').show();
        }

        if (this.container.scrollLeft < ((this.pics_count * this.pic_size) - (this.pic_size * 7) - this.pic_size / 2)){
            $('g_scroll_right').show();
        } else {
            $('g_scroll_right').hide();
        }
	}
	,
	goLeft: function()
	{
		this.container.scrollLeft -= this.pic_size;

		if (this.container.scrollLeft == 0) {
            $('g_scroll_left').hide();
        } else {
            $('g_scroll_left').show();
        }

        if (this.container.scrollLeft < ((this.pics_count * this.pic_size) - (this.pic_size * 7) - this.pic_size / 2)) {
            $('g_scroll_right').show();
        } else {
            $('g_scroll_right').hide();
        }
	}
	,
	goRight: function()
	{
		this.container.scrollLeft = this.container.scrollLeft + this.pic_size;

		if (this.container.scrollLeft == 0) {
            $('g_scroll_left').hide();
        } else {
            $('g_scroll_left').show();
        }

        if (this.container.scrollLeft < ((this.pics_count * this.pic_size) - (this.pic_size * 7) - this.pic_size / 2)) {
            $('g_scroll_right').show();
        } else {
            $('g_scroll_right').hide();
        }

//		this.container.scrollTop = '10px';
//		alert(this.container);
	}
})
