if (jQuery) {  

	//initializes the list of drawings, puts the list into an array which we can easlily iterate through
	var drawingList = [
		{title: "WRITE NOTHING", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/6-write-nothing.jpg"},
		{title: "ALWAYS", medium: "Print", size: "18 x 24 inches on archival paper", path: "images/1-always.jpg"},
		{title: "BIRDSBELL", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/19-birdsbell.jpg"},
		{title: "THE BLUE SOCKET", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/13-the-blue-socket.jpg"},
		{title: "SECOND FIN", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/15-2nd-fin.jpg"},
		{title: "OCCITAN", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/2-occitan.jpg"},
		{title: "FOURHER EXIT", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/3-fourher-exit.jpg"},
		{title: "KISS", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/4-kiss.jpg"},
		{title: "BLACK NUDE WHITE", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/7-black-nude-white.jpg"},
		{title: "VERTEBRATA", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/8-vertebrata.jpg"},
		{title: "INTERMITTENT BOTTICELLI", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/10-intermittent-botticelli.jpg"},
		{title: "RENAHOUSE", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/11-renahouse.jpg"},
		{title: "TO DNA YOU", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/12-to-dna-you.jpg"},
		{title: "MATOES FIN", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/16-matoes-fin.jpg"},
		{title: "FIN THREE", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/17-fin-three.jpg"},	
		{title: "ALPHA BETA", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/18-alpha-beta.jpg"},
		{title: "BIRDSBELL RED!!", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/20-birdsbell-red.jpg"},
		{title: "CLOCK 2A", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/21-clock-2a.jpg"},
		{title: "SPIRA", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/22-spira.jpg"},
		{title: "WOODCOCK DOUBLE", medium: "Print", size: "18 x 24 to 40 x 60 inches on archival paper", path: "images/23-woodcock-double.jpg"}
		
	];

	$(document).ready( function(){
		
		var drawingContainer = $("#drawing");
		
		//initialize the index holder
		drawingContainer.data("cur",0);
		
		//hide the back button because we are on the first element
		$("div#back").hide();
		
		//this is triggered when a client clicks the prev button
		$("#btnPrev").click( function(){
			var currentIndex = drawingContainer.data("cur");
			if( currentIndex > 0){			
				LoadDrawing(currentIndex - 1);
			}		
			if( (currentIndex -1) == 0 ){
				$("div#back").hide();
			}		
			
			$("div#next").show();
			
			return false;
		});
		
		// this triggers when a client clicks the next button
		$("#btnNext").click( function(){
			var currentIndex = drawingContainer.data("cur");
			if( currentIndex < drawingList.length - 1){			
				LoadDrawing(currentIndex + 1);
			}
			if( ( currentIndex + 2 ) == drawingList.length){
				$("div#next").hide();
			}
			
			$("div#back").show();
			
			return false;
		});
		
		function LoadDrawing(index){
			drawingContainer.data("cur", index);
			
			//load the image
			$("#image", drawingContainer).attr("src", drawingList[index].path);
			
			//load the title
			$("#title", drawingContainer).html(drawingList[index].title);
			
			//load the medium
			$("#medium", drawingContainer).html(drawingList[index].medium);
			
			//load the size
			$("#size", drawingContainer).html(drawingList[index].size);
		}
		
	});
}
