$(document).ready( function() {
	var imgGallery = new ImageGallery();
});


function ImageGallery() {
	
	// CLASS VARS
	
	this.imgDir = "graphics/";
	this.imgHandle = $('#roddavis_gig .img_container img');
	this.infoHandle = $('#roddavis_gig .img_container .info');
    this.gallery = [
	    { src: this.imgDir + "rod1.jpg", title: " ROD DAVIS: from John Lennon's original quarrymen" }, 
	    { src: this.imgDir + "rod2.jpg", title: " QUARRYMEN" },
	    { src: this.imgDir + "rod3.jpg", title: " ROD DAVIS: from John Lennon's original quarrymen" }
	];
    this.galleryLength = this.gallery.length;
    this.currentImg = 0;
    
    mythis = this; // alias for this, to be used in event listeners
    
    
    
    
    // EVENT LISTENERS  
    this.imgHandle.click( function() {
    	
    	// Set index of next image
    	if( mythis.currentImg == mythis.galleryLength-1 ) {
    		mythis.currentImg = 0;
    	} else {
    		mythis.currentImg++;
    	}
    	
    	// Assign the image to the ui
    	//alert(mythis.gallery[mythis.currentImg].src);
    	mythis.imgHandle.attr( 'src', mythis.gallery[mythis.currentImg].src );
    	mythis.infoHandle.html("<p>"+ mythis.gallery[mythis.currentImg].title + "</p>");
    });
    
//    this.imgHandle.bind('mousemove', function() {
//    	
//    });
//    
//    this.imgHandle.bind('hover', function() {
//    	$('#roddavis_gig img.cursor').toggleClass('show');
//    });
   
    
    // CLASS METHODS
    
}

