	var speed = 30;
	var pic, numImgs, arrLeft, i, totalWidth, n, myInterval; 

$(window).load(function(){
	pic = $("#slider a").children("div");
	numImgs = pic.length; //jumlah
	arrLeft = new Array(numImgs);
	
	for (i=0;i<numImgs;i++){
		
		totalWidth=0;
		for(n=0;n<i;n++){
			totalWidth += $(pic[n]).height();
		}
		
		arrLeft[i] = totalWidth;
		$(pic[i]).css("top",totalWidth);
	}
	
	myInterval = setInterval("flexiScroll()",speed);
	$(pic).show();	
});

function flexiScroll(){

	for (i=0;i<numImgs;i++){
		arrLeft[i] -= 1;		

		if (arrLeft[i] == -($(pic[i]).height())){	
			totalWidth = 0;	
			for (n=0;n<numImgs;n++){
				if (n!=i){	
					totalWidth += $(pic[n]).height();
				}			
			}	
			arrLeft[i] =  totalWidth;	
		}					
		$(pic[i]).css("top",arrLeft[i]);
	}
}

$(document).ready(function(){
  $('#slider a div' )
    .hover(
      function(){
        $(this)
          .stop()
          .animate({
            'opacity': 1 ,
			'backgroundColor' : "#fffff" ,
			'borderColor ': '#333' ,
			'color' : '#0099FF'

          }, 350);
		clearInterval(myInterval);
      },
      function(){
        $(this)
          .stop()
          .animate({
            'opacity': 0.5 ,
			'backgroundColor' : '#fff' , 
			'borderColor ': '#fff' ,
			'color' : '#000'
          }, 750);
		myInterval = setInterval("flexiScroll()",speed);
      }
    );
});	

