(function($){
	
	$.randomImage = {
		defaults: {
			path: 'images/', 
			myImages: ['index/advance_xp_1.png', 'index/cdm_1.png', 'index/cdm_2.png', 'index/empi_1.png', 'index/empi_2.png', 'index/identix_1.png', 'index/identix_2.png', 'index/Kayak_1.png', 'index/Kayak_2.png', 'index/Organ Transplant_1.png', 'index/q37_1.png', 'index/q37_2.png', 'index/security_camera_1.png', 'index/security_camera_2.png', 'index/thunderbolt_2.png', 'index/xr6_1.png', 'index/xr6_2.png']			
		}			
	}
	
	$.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);
