/* brand tray */

function brandTray(dir)
	{
		if(brandTray != 0)
			{

				if(dir != 0)  //move left
					{
						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, -175, { beforeStart: function() { disableBrandTrayBtns(0); }, afterFinish: function() { disableBrandTrayBtns(1); }, duration:1} );
						Effect.MoveBy( 'brandLogosGroup2', 0, -175, {duration:1} );
						$$$('next').style.background = 'url(images/newarrow4_right_on.gif) no-repeat';
					}
				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, 175, { beforeStart: function() { disableBrandTrayBtns(0); }, afterFinish: function() { disableBrandTrayBtns(1); }, duration:1} );
						Effect.MoveBy( 'brandLogosGroup2', 0, 175, {duration:1} );
						$$$('prev').style.background = 'url(images/newarrow4_left_on.gif) no-repeat';
					}
			}
	}

//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;
				$$$('next').style.background = 'url(images/newarrow4_right_off.gif) no-repeat';
				$$$('prev').onclick =  new Function("brandTray("+0+")");
				$$$('prev').style.background = 'url(images/newarrow4_left_off.gif) no-repeat';
			}
	}
