(function($){
	
	$.randomImage = {
		defaults: {
			
			//you can change these defaults to your own preferences.
			path: '/wp-content/uploads/2011/10/', //change this to the path of your images
			myImages: ['homepx_01.jpg', 'homepx_02.jpg', 'homepx_03.jpg', 'homepx_04.jpg', 'homepx_05.jpg', 'homepx_06.jpg', 'homepx_07.jpg', 'homepx_08.jpg', 'homepx_09.jpg', 'homepx_10.jpg', 'homepx_11.jpg', 'homepx_12.jpg', 'homepx_13.jpg', 'homepx_14.jpg', 'homepx_15.jpg', 'homepx_16.jpg', 'homepx_17.jpg', 'homepx_18.jpg', 'homepx_19.jpg', 'homepx_20.jpg', 'homepx_21.jpg', 'homepx_22.jpg', 'homepx_23.jpg', 'homepx_24.jpg', 'homepx_25.jpg', 'homepx_26.jpg', 'homepx_27.jpg', 'homepx_28.jpg', 'homepx_29.jpg', 'homepx_30.jpg' ] //put image names in this bracket. ex: 'harold.jpg', 'maude.jpg', 'etc'
			
		}			
	}
	
	$.fn.extend({
			randomImage:function(config) {
				
				var config = $.extend({}, $.randomImage.defaults, config); 
				
				 return this.each(function() {
						
						var imageNames = config.myImages;
						
						//get size of array, randomize a number from this
						// use this number as the array index

						var imageNamesSize = imageNames.length;

						var lotteryNumber = Math.floor(Math.random()*imageNamesSize);

						var winnerImage = imageNames[lotteryNumber];

						var fullPath = config.path + winnerImage;
						
						
						//put this image into DOM at class of randomImage
						// alt tag will be image filename.
						$(this).attr( {
										src: fullPath,
										alt: winnerImage
									});
				
				});	
			}
			
	});
	
	
	
})(jQuery);
