(function($){
	
	$.randomImage = {
		defaults: {
			
			//you can change these defaults to your own preferences.
			path: 'media/img/banner-left/', //change this to the path of your images
			myImages: ['sx_21.jpg', 'sx_22.jpg', 'sx_23.jpg', 'sx_24.jpg', 'sx_25.jpg', 'sx_26.jpg', 'sx_27.jpg', 'sx_28.jpg', 'sx_29.jpg', 'sx_30.jpg', 'sx_31.jpg', 'sx_32.jpg', 'sx_33.jpg', 'sx_34.jpg', 'sx_35.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);









(function($){
	
	$.randomImage2 = {
		defaults: {
			
			//you can change these defaults to your own preferences.
			path: 'media/img/banner-left/', //change this to the path of your images
			myImages: ['dx_21.jpg', 'dx_22.jpg', 'dx_23.jpg', 'dx_24.jpg', 'dx_25.jpg', 'dx_26.jpg', 'dx_27.jpg', 'dx_28.jpg', 'dx_29.jpg', 'dx_30.jpg', 'dx_31.jpg', 'dx_32.jpg', 'dx_33.jpg', 'dx_34.jpg', 'dx_35.jpg' ] //put image names in this bracket. ex: 'harold.jpg', 'maude.jpg', 'etc'
			
		}			
	}
	
	$.fn.extend({
			randomImage2:function(config) {
				
				var config = $.extend({}, $.randomImage2.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 randomImage2
						// alt tag will be image filename.
						$(this).attr( {
										src: fullPath,
										alt: winnerImage
									});
				
						
				});	
			}
			
	});
	
	
	
})(jQuery);



$(document).ready(function(){
		$('A[rel="zoom"]').click( function() { //JQUERY POPUP
		window.open( $(this).attr('href'),'nome','menubar=yes,scrollbars=yes,resizable=yes,width=850,height=420');
	return false;
	});	
	$('A[rel="dettaglio"]').click( function() { //JQUERY POPUP
   		var w = 750;
   		var h = 600;
   		var l = Math.floor((screen.width-w)/2);
   		var t = Math.floor((screen.height-h)/2);
   		var opzioni="width=" + w + ",height=" + h + ",top=" + t + ",left=" + l;
		window.open( $(this).attr('href'),'nome',opzioni);
		return false;
	});		
});	
