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').style.background = 'url(/images/left_arrow_grey.gif) transparent no-repeat scroll center center';
        }
        else
        {
            $('g_scroll_left').style.background = 'url(/images/left_arrow_orange.gif) transparent no-repeat scroll center center';
        }

        if(this.container.scrollLeft < ((this.pics_count * this.pic_size) - (this.pic_size * 7) - this.pic_size / 2))
        {
            $('g_scroll_right').style.background = 'url(/images/right_arrow_orange.gif) transparent no-repeat scroll center center';
        }
        else
        {
            $('g_scroll_right').style.background = 'url(/images/right_arrow_grey.gif) transparent no-repeat scroll center center';
        }
	}
	,
	goLeft: function()
	{
		this.container.scrollLeft -= this.pic_size;

		if (this.container.scrollLeft == 0)
        {
            $('g_scroll_left').style.background = 'url(/images/left_arrow_grey.gif) transparent no-repeat scroll center center';
        }
        else
        {
            $('g_scroll_left').style.background = 'url(/images/left_arrow_orange.gif) transparent no-repeat scroll center center';
        }

        if(this.container.scrollLeft < ((this.pics_count * this.pic_size) - (this.pic_size * 7) - this.pic_size / 2))
        {
            $('g_scroll_right').style.background = 'url(/images/right_arrow_orange.gif) transparent no-repeat scroll center center';
        }
        else
        {
            $('g_scroll_right').style.background = 'url(/images/right_arrow_grey.gif) transparent no-repeat scroll center center';
        }
	}
	,
	goRight: function()
	{
		this.container.scrollLeft = this.container.scrollLeft + this.pic_size;

		if (this.container.scrollLeft == 0)
        {
            $('g_scroll_left').style.background = 'url(/images/left_arrow_grey.gif) transparent no-repeat scroll center center';
        }
        else
        {
            $('g_scroll_left').style.background = 'url(/images/left_arrow_orange.gif) transparent no-repeat scroll center center';
        }

        if(this.container.scrollLeft < ((this.pics_count * this.pic_size) - (this.pic_size * 7) - this.pic_size / 2))
        {
            $('g_scroll_right').style.background = 'url(/images/right_arrow_orange.gif) transparent no-repeat scroll center center';
        }
        else
        {
            $('g_scroll_right').style.background = 'url(/images/right_arrow_grey.gif) transparent no-repeat scroll center center';
        }

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