	$(document).ready(function() {
		$('#clipregion').clipregion({
				'itemHeight':700,
				'itemWidth':1000,
				'totalItems':$('ul > li',$('#clipregion')).size(),
				'itemsToShow':1,
				'itemStep':true
			});
			
		$(".zoomOutCursor").live("click", function(){
			zoomOut();
	    });
		
		 $(".zoomInCursor").live("click", function(){
			var srclen = $(this).attr('src').length-4;
			var imgUrl = $(this).attr('src').substring(0,srclen) + "-big.jpg";
			zoomIn(imgUrl);
	    });			

			
		var current = $(document).getUrlParam("pid");
		$.clipregion.setPos(current);
		positionIt();
		
		checkButtons();
		
		$('#footer #previous').click(function() {
			$.clipregion.prev();
			checkButtons();
			positionIt();
		});
		
		$('#footer #next').click(function() {
			$.clipregion.next();
			checkButtons();
			positionIt();
		});
	});
	
	
	function positionIt() {
		if (jQuery.browser.msie) return;
		var imgId = "#graphic"+($.clipregion.getIdx()+1);
		var imgW = $(imgId).attr('width');
		if(imgW==0) {
			switch (imgId)
			{
			case '#graphic1': 
				imgW = '436px';
				break;
			case '#graphic2': 
				imgW = '604px';
				break;	
			case '#graphic3': 
				imgW = '450px';
				break;
			case '#graphic4': 
				imgW = '643px';
				break;
			case '#graphic5': 
				imgW = '632px';
				break;
			case '#graphic6': 
				imgW = '631px';
				break;
			case '#graphic7': 
				imgW = '287px';
				break;
			case '#graphic8': 
				imgW = '461px';
				break;
			case '#graphic9': 
				imgW = '563px';
				break;			
			case '#graphic10': 
				imgW = '500px';
				break;
			case '#graphic11': 
				imgW = '564px';
				break;
			case '#graphic12': 
				imgW = '674px';
				break;
			case '#graphic13': 
				imgW = '686px';
				break;
			case '#graphic14': 
				imgW = '564px';
				break;
			case '#graphic15': 
				imgW = '500px';
				break;
			}
		}
		$('#mainGraphic').css({ width: imgW }); 
	}

