
var galleryarray=new Array();var gallerywidths=new Array();galleryarray[0]="useruploads/images/scroller/004.jpg";gallerywidths[0]="286";galleryarray[1]="useruploads/images/scroller/005.jpg";gallerywidths[1]="293";galleryarray[2]="useruploads/images/scroller/006.jpg";gallerywidths[2]="146";galleryarray[3]="useruploads/images/scroller/007.jpg";gallerywidths[3]="155";galleryarray[4]="useruploads/images/scroller/008.jpg";gallerywidths[4]="293";galleryarray[5]="useruploads/images/scroller/009.jpg";gallerywidths[5]="281";galleryarray[6]="useruploads/images/scroller/023.jpg";gallerywidths[6]="165";galleryarray[7]="useruploads/images/scroller/028.jpg";gallerywidths[7]="328";galleryarray[8]="useruploads/images/scroller/031.jpg";gallerywidths[8]="165"; 

$('.frame').empty();
$('#main-section').css('width','100%');


//setup
var current = 0;
var Interval;
for(image in galleryarray)
{
$('.frame').append("<a href='index.php/photos.html'><img title='View All Art' class='image' border='0' src='" + galleryarray[image] + "' /></a>");
//insert image

$('.image').last().css({'left': current,'position':'absolute'});
//set position

current = current + parseInt(gallerywidths[image]);
//increment position
}
var length = current;

function animate(){
       
        for(image in galleryarray){
            //get left
            var left = parseInt($('.image').eq(image).css('left'));
            //get width        
            var width = parseInt(gallerywidths[image]);
            if(left == -(width)){
                left = length - width;
            }
            left = left - 1;
            
            //set new left
            $('.image').eq(image).css('left',left);
         }
 }
 


$('.frame').after("<img id='ff' style='float:right' src='/ff.jpg' />");

$(function() {//dom ready
var speed = 50;

//animate();
Interval = setInterval(" animate()", speed)


$('#ff').mouseover(function(){
    window.clearInterval(Interval);
    Interval = setInterval(" animate()", 10)
});

$('#ff').mouseout(function(){
    window.clearInterval(Interval);
    Interval = setInterval(" animate()", speed)
});


})
