	var galleryContainer;
	var currentSet;
	var imageSets;
	var $j = jQuery.noConflict();
	$j(document).ready(function() {
	
		// size the copy area dynamically depending on
		// the header height (with and w/o the nav) and
		// if the gallery is there or not
		$j("#copyArea").height(	$j("#content").height() - 
								$j("#pageHead").height() - 
								parseInt($j("#pageHead").css("marginBottom")) - 
								($j("#gallery").height() | 0) -
								(parseInt($j("#gallery").css("marginTop")) | 0)
							);
		
		
	
		// assign the variable currentImage to the first image
		$j.scrollTo.defaults.axis = 'x';
		galleryContainer = $j("#galleryImages");
		galleryContainer.scrollTo({top: '0px', left: '0px'});
		imageSets = $j("#galleryImages div.imageSet"); 
		currentSet = 0;
	
		// assign functionality to the arrows and hide them at first
		$j("#leftArrow").click(function() {
			if(currentSet > 0) {
				var last = imageSets.eq(currentSet-1);
				galleryContainer.scrollTo( last, 500);
				currentSet--;
				updateArrows();
			}
		});
		
		$j("#rightArrow").click(function() {
			if(currentSet < imageSets.length-1) {
				var next = imageSets.eq(currentSet+1);
				galleryContainer.scrollTo( next, 500);
				currentSet++;
				updateArrows();
			}
			
		});
	
		// add the rollover capability (cross browser compatible
		$j("#gallery div.arrow").hover(function() { $j(this).addClass("hover"); }, function() { $j(this).removeClass("hover");});
	
	
		// update the arrows initially
		updateArrows();
		
	});
		function updateArrows() {
		if(currentSet < imageSets.length - 1) {
			$j("#rightArrow").css("visibility", "visible");
		} else {
			$j("#rightArrow").css("visibility", "hidden");
		}
		if(currentSet > 0) {
			$j("#leftArrow").css("visibility", "visible");
		} else {
			$j("#leftArrow").css("visibility", "hidden");
		}
	}
	
