
/* brand tray */

function brandTray(dir) {	 
if(brandTray != 0) {

	//move left
	if(dir != 0) {
		if(brandTrayCounter == 0) { $('brandLogosGroup2').style.left = brandTrayWidth }
		//reset the photo containers and the counter 
		if(brandTrayCounter == (brandTrayTotal-(brandTrayTotal*2))) { 
			$('brandLogosGroup1').style.left = '0px'; 
			$('brandLogosGroup2').style.left = brandTrayWidth;
			brandTrayCounter = 0}	
				brandTrayCounter = brandTrayCounter -1;
				Effect.MoveBy( 'brandLogosGroup1', 0, -130, { 
				beforeStart: function() { disableBrandTrayBtns(0); }, afterFinish: function() { disableBrandTrayBtns(1); }, duration:1} ); 
				Effect.MoveBy( 'brandLogosGroup2', 0, -130, {duration:1} );
							
		} else { 
		
		//move right
		if(brandTrayCounter == 0) { $('brandLogosGroup2').style.left = brandTrayWidthRight; }
		//reset the photo containers and the counter 
		if(brandTrayCounter == brandTrayTotal) { 
			$('brandLogosGroup1').style.left = '0px'; 
			$('brandLogosGroup2').style.left = brandTrayWidthRight;
			brandTrayCounter = 0}
				brandTrayCounter = brandTrayCounter +1;
				Effect.MoveBy( 'brandLogosGroup1', 0, 130, { 
				beforeStart: function() { disableBrandTrayBtns(0); }, afterFinish: function() { disableBrandTrayBtns(1); }, duration:1} ); 
				Effect.MoveBy( 'brandLogosGroup2', 0, 130, {duration:1} ); 
		}
	}
}	

//this function deactivates button while photo gallery is moving
function disableBrandTrayBtns(active) {	
	if(active == 0) { 
		$('next').onclick =  null;
		$('prev').onclick =  null;
	  }
	if(active == 1) { 
		$('next').onclick =  brandTray;
		$('prev').onclick =  new Function("brandTray("+0+")");
		}
}

