/*Check to see if we have the gallery wrapper */
// When the page loads, set up the Spans
//addLoadEvent(function() {

function loadGallery() {
	Count= 0
	/*Check to see if we are in the gallery Section*/
	if (!document.getElementById("gallery-wrapper")) return false;
	if (!document.getElementById("Gallery-left-Arrow")) return false;
	if (!document.getElementById("Gallery-right-Arrow")) return false;
	
	var GalleryImagesSpan = getElementsByClass('gallimages',document,'span') 
	
	
	var rightPaging = document.getElementById("Gallery-right-Arrow");
	var leftPaging = document.getElementById("Gallery-left-Arrow");
	
	if (GalleryImagesSpan.length > 1){rightPaging.style.display = 'block';}else{rightPaging.style.display = 'none';};
	
	
	
	if ( Count == 0  ) {
		leftPaging.style.display = 'none';
		};
		
	rightPaging.onclick = function(){
		
		if ( Count < 0  ) 
			{
				Count = 0;
			}
		else 
			{
				GalleryImagesSpan[Count].style.display = 'none'
				
				leftPaging.style.display = 'block';
				Count++;
				
				if(Count == GalleryImagesSpan.length-1  )
					{
						rightPaging.style.display = 'none';
					};
					
			};
		};
		
		/*End right paging*/


	leftPaging.onclick = function(){
				
				if ( Count > 0 ) {
					
					rightPaging.style.display = 'block';
					};
		
				Count--;
				GalleryImagesSpan[Count].style.display = 'block';
				
				if ( Count == 0 ) {
					leftPaging.style.display = 'none';
					};
		};
};
//)};


