/*  Acquisition Finance - Cube
 *  (c) 2008 Patrice Poulin
 *
 *  Make the Cube moves on click
 *
/*--------------------------------------------------------------------------*/

var amount = 734;
var scrollAmount = 0;

//Function to move the block to the right side 
//SET ONCLICK WITHIN THE HTML  - NO EVENT.OBSERVE !

function switchGalleryRight() {
	switch(scrollAmount) {
		case 0:
		$('arrowLeft').style.backgroundImage = "url('img/arrowLeft-on.jpg')";
		new Effect.Move('thumb_content', {x: -amount, y:0, duration:0.3, mode:'relative', beforeStart:function(){$('arrowRight').onclick='';}, afterFinish:function(){$('arrowRight').onclick=switchGalleryRight;} });
		scrollAmount = 1;
		break;
		
		case 1:
		$('arrowLeft').style.backgroundImage = "url('img/arrowLeft-on.jpg')";
		new Effect.Move('thumb_content', {x: -amount, y:0, duration:0.3, mode:'relative', beforeStart:function(){$('arrowRight').onclick='';}, afterFinish:function(){$('arrowRight').onclick=switchGalleryRight;} });
		scrollAmount = 2;
		break;
		
		case 2:
		//alert(scrollAmount);		
		$('arrowLeft').style.backgroundImage = "url('img/arrowLeft-on.jpg')";
		new Effect.Move('thumb_content', {x: -amount, y:0, duration:0.3, mode:'relative', beforeStart:function(){$('arrowRight').onclick='';}, afterFinish:function(){$('arrowRight').onclick=switchGalleryRight;} });
		scrollAmount = 3;
		break;
		
		case 3:
		//alert(scrollAmount);		
		$('arrowLeft').style.backgroundImage = "url('img/arrowLeft-on.jpg')";
		new Effect.Move('thumb_content', {x: -amount, y:0, duration:0.3, mode:'relative', beforeStart:function(){$('arrowRight').onclick='';}, afterFinish:function(){$('arrowRight').onclick=switchGalleryRight;} });
		scrollAmount = 4;
		$('arrowRight').style.backgroundImage = "url('img/arrowRight-off.jpg')";
		break;
	}
	
}

/* Function to move the block to the left side */
function switchGalleryLeft() {
	switch(scrollAmount) {
		case 1:
		$('arrowLeft').style.backgroundImage = "url('img/arrowLeft-off.jpg')";
		new Effect.Move('thumb_content', {x: amount, y:0, duration:0.3, mode:'relative', beforeStart:function(){$('arrowLeft').onclick='';}, afterFinish:function(){$('arrowLeft').onclick=switchGalleryLeft;} });
		scrollAmount = 0;
		$('arrowRight').style.backgroundImage = "url('img/arrowRight-on.jpg')";  /* Satuts arrow -  To change if you've got an other set of new logos */
		break;
				
		case 2:
		$('arrowRight').style.backgroundImage = "url('img/arrowRight-on.jpg')";
		new Effect.Move('thumb_content', {x: amount, y:0, duration:0.3, mode:'relative', beforeStart:function(){$('arrowLeft').onclick='';}, afterFinish:function(){$('arrowLeft').onclick=switchGalleryLeft;} });
		scrollAmount = 1;
		break;
		
		case 3:
		$('arrowRight').style.backgroundImage = "url('img/arrowRight-on.jpg')";
		new Effect.Move('thumb_content', {x: amount, y:0, duration:0.3, mode:'relative', beforeStart:function(){$('arrowLeft').onclick='';}, afterFinish:function(){$('arrowLeft').onclick=switchGalleryLeft;} });
		scrollAmount = 2;
		break;
		
		case 4:
		$('arrowRight').style.backgroundImage = "url('img/arrowRight-on.jpg')";
		new Effect.Move('thumb_content', {x: amount, y:0, duration:0.3, mode:'relative', beforeStart:function(){$('arrowLeft').onclick='';}, afterFinish:function(){$('arrowLeft').onclick=switchGalleryLeft;} });
		scrollAmount = 3;
		break;
			
	}	
}


Event.observe(window, 'load', function() {
	$$('div#thumb_content ul li').each(function(i){
		Event.observe(i, 'mouseover',function(){
			i.addClassName('on');
		});
		
		Event.observe(i, 'mouseout', function(){
			i.removeClassName('on');
		});
	});
});

