		function galleryForward()
		{
			$(".promoContainer"+galleryCurrentItem).animate({opacity: "hide"}, "medium");			

			galleryCurrentItem++;				
			if (galleryCurrentItem>galleryNumItems)
				galleryCurrentItem=1;		

			$(".promoContainer"+galleryCurrentItem).animate({opacity: "show"}, "medium");
			
			$("#current_page").text(galleryCurrentItem);
		}	                      	 
		
		function galleryBack() 
		{
			$(".promoContainer"+galleryCurrentItem).animate({opacity: "hide"}, "medium");			

			galleryCurrentItem--;				
			if (galleryCurrentItem<1)
				galleryCurrentItem=galleryNumItems;		

			$(".promoContainer"+galleryCurrentItem).animate({opacity: "show"}, "medium");	
			$("#current_page").text(galleryCurrentItem);
		}                    
			
		$(document).ready(function() {
			
			promoStopped=0;
			
			$(".promoContainer img").click(function (){
				promoStopped=1;
				galleryForward();
			});
			
			$("#arrow_backward").click(function() {
				promoStopped=1;
				galleryBack();
			})
			
			$("#arrow_forward").click(function() {
				promoStopped=1;
				galleryForward();
			})
			
			if (galleryTimerPeriod>0)
			{
				$.timer(galleryTimerPeriod, function (timer) {
					if (promoStopped==1)
						timer.stop();
					else
						galleryForward();
				});
			}
  			
			
		});
