<!-- 

// Scroll Gallery Javascript Utilities

/* ================================================================ 
** Updated by Maurice Brown 19 Feb 2009 **
=================================================================== */


var MAX_THUMBS = 5;

function galleryScrollMenu (sGalleryID) 
{
	var objGallery;
	var getImg;
	var getLi;
	var afnGetImage = new Array();
	var afnGetLi = new Array();

	//	getImg = document.getElementById(sGalleryID).getElementsByTagName("img");
	//	getLi = document.getElementById(sGalleryID).getElementsByTagName("li");

	objGallery = document.getElementById(sGalleryID);
	
	if (objGallery != null)
	{
		getImg = objGallery.getElementsByTagName("img");
		getLi = objGallery.getElementsByTagName("li");
	
		
		//if (getImg == null || getLi == null)
		//{
		//	return;
		//}
		
		

		if (getImg != null && getLi != null)
		{
			//var afnGetImage = new Array(getImg.length)
			for (var i=0; i<getImg.length; i++) 
			{
				//getImg[i].onclick=function() 
				afnGetImage[i]=function() 
				{
					if (this /*&& this.className != null*/ /*getImg != null && getLi != null &&*/ )
					{
						if ((this.className && this.className.indexOf('left'))!=-1) 
						{
							for (var x=getLi.length-1; x>0; x--) 
							{
								if ((getLi[x].className && getLi[x].className.indexOf('chosen'))!=-1)	
								{
									getLi[x].className=getLi[x].className.replace("chosen", "");
									x--;
									if (x>-1) 
									{
										getLi[x].className+=" chosen";
										if (x>-1 && x<getLi.length-MAX_THUMBS)
										{
											getLi[x].className=getLi[x].className.replace("hide", "");
											if ((getLi[x+MAX_THUMBS].className.indexOf('hide'))==-1)
											{
												getLi[x+MAX_THUMBS].className+=" hide";
											}
										}
									}
								}
							}
						}
	
						if ((this.className && this.className.indexOf('right'))!=-1) 
						{
							for (var x=0; x<getLi.length-1; x++) 
							{
								if ((getLi[x].className && getLi[x].className.indexOf('chosen'))!=-1)	
								{
									getLi[x].className=getLi[x].className.replace("chosen", "");
									x++;
									if (x<getLi.length) 
									{
										getLi[x].className+=" chosen";
										if (x>MAX_THUMBS-1 && x<getLi.length) 
										{
											getLi[x].className=getLi[x].className.replace("hide", "");
											if ((getLi[x-MAX_THUMBS].className.indexOf('hide'))==-1)
											{
												getLi[x-MAX_THUMBS].className+=" hide";
											}
										}
									}
								}
							}
						}
					}
				}
				// ** End Function Def
				addEvent(getImg[i], 'click', afnGetImage[i]);

				//if (getImg != null)
				//{
					//for (var i=0; i<getImg.length; i++) 
					//{
						//addEvent(getImg[i], 'click', fnGetImage);
					//}
				//}
				
			} // End FOR
		} // End IF
	
	
		if (getLi != null)
		{
			
			for (var i=0; i<getLi.length; i++) 
			{
				//getLi[i].onclick=function() 
				afnGetLi[i]=function() 
				{
					if (this != null /*&& this.className != null*/ /*getLi != null && */)
					{
						for (var x=0; x<getLi.length; x++) 
						{
							if ((getLi[x].className && getLi[x].className.indexOf('chosen'))!=-1)
							{
								getLi[x].className=getLi[x].className.replace("chosen", "");
							}
						}
		
						if (this.className)
						{
							this.className+=" chosen";
						}
						
						//if (this != null && this.className != null)
						//{
						//	this.className+=" chosen";		
						//}				
					}
				}
				// ** End Function Def
	
				addEvent(getLi[i], 'click', afnGetLi[i]);
				//addEvent(getLi[i], 'mouseover', fnGetLi);

				//if (getLi != null)
				//{
					//for (var i=0; i<getLi.length; i++) 
					//{
						//addEvent(getLi[i], 'click', fnGetLi);
						//addEvent(getLi[i], 'mouseover', fnGetLi);
					//}
				//}
			} //End For
		}
	}
}




// -->