(function($){
	
	$.randomImage = {
		defaults: {
			
			//you can change these defaults to your own preferences.
			path: 'images/', //change this to the path of your images
			myImages: ['righttab2_top.png', 'righttab2_top_2.png', 'righttab2_top_3.png', 'righttab2_top_4.png', 'righttab2_top_6.png', 'righttab2_top_7.png', 'righttab2_top_8.png', 'righttab2_top_9.png', 'righttab2_top_10.png'] //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);
/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch() {
    var $active = $('#peslideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#peslideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#peslideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}
$(document).ready(function() {
	$('.shuffle').randomImage({path: 'images/'});
	$('.shuffleleft').randomImage({path: 'images/', myImages: ['left_box1PE.png', 'left_box1PE_2.png', 'left_box1PE_3.png', 'left_box1PE_4.png', 'left_box1PE_3.png', 'left_box1PE_3.png', 'left_box1PE_5.png', 'left_box1PE_6.png', 'left_box1PE_6.png' ]});
	setInterval( "slideSwitch()", 5000 );
});
