function bannerHeaders(scrollId,imageContainers)
{
    this.scrollObject=$('#'+scrollId).get(0);
    this.bigImageContainer=$('#'+imageContainers).get(0);
    this.imagesCount=$('img',this.scrollObject).length;
    this.curr_index=0;
    this.observ=true;
    $('a:eq('+this.curr_index+')',$(this.scrollObject)).addClass('Selected');

    $('img',$(this.bigImageContainer)).hide();
    $('img:eq('+this.curr_index+')',$(this.bigImageContainer)).show();
    var proto=this;



 

    this.loadBanner= function (bannerIndex)
    {
      
        if(bannerIndex>this.imagesCount-1||bannerIndex<0||bannerIndex== this.curr_index)
            return false;

      

        $('img:eq('+this.curr_index+')',$(this.bigImageContainer)).fadeOut();
        $('img:eq('+bannerIndex+')',$(this.bigImageContainer)).fadeIn();


        $('a#banner_url').attr('href',$('a:eq('+bannerIndex+')',$(this.bigImageContainer)).attr('href'));


         $('a:eq('+this.curr_index+')',$(this.scrollObject)).removeClass('Selected');
        $('a:eq('+bannerIndex+')',$(this.scrollObject)).addClass('Selected');


        this.curr_index=bannerIndex;
        var obj;
        
        if(bannerIndex==0||bannerIndex-1==0)
        {
            proto.observ=false;
           $(this.scrollObject).animate({scrollLeft: 0}, 500,'',function (){proto.observ=true});
        }
        else if(bannerIndex==this.imagesCount-1||bannerIndex==this.imagesCount-2)
        {
            proto.observ=false;
            $(this.scrollObject).animate({scrollLeft: this.scrollObject.scrollWidth-$(this.scrollObject).width()}, 500,'',function (){proto.observ=true});
        }
        else if((obj=$('td:eq('+(bannerIndex+1)+')',$(this.scrollObject))).position().left+obj.width() > $(this.scrollObject).width() )
        {
            proto.observ=false;
            $(this.scrollObject).animate({scrollLeft: obj.width()+obj.position().left+this.scrollObject.scrollLeft-$(this.scrollObject).width() }, 500,'',function (){proto.observ=true});
        }
        else if((obj=$('td:eq('+(bannerIndex-1)+')',$(this.scrollObject))).position().left < 0 )
        {
            proto.observ=false;
            $(this.scrollObject).animate({scrollLeft: this.scrollObject.scrollLeft+obj.position().left }, 500,'',function (){proto.observ=true});
        }
    


    }


     

     
    this.moveNext = function()
    {
        this.loadBanner(this.curr_index+1);
    }

    this.movePrevious = function()
    {
        this.loadBanner(this.curr_index-1);
    }

    $('a',$(this.scrollObject)).each(function(i) { $(this).hover(function (){if(proto.observ) proto.loadBanner(i) },function(){})} );
    $('a',$(this.scrollObject)).each(function(i) { $(this).click(function (){proto.loadBanner(i) })} );



}





