$(document).ready(function(){
	
	{
	$('#main, #main_contact').hide();
    $('#main, #main_contact').fadeIn({ duration: 2000 });
	}

// Random image controls
$.randomImage = {
		defaults: {
			//you can change these defaults to your own preferences.
			path: 'wp-content/themes/fresh/content/homeimages/',
			myImages: ['random.jpg','random1.jpg','random2.jpg','random3.jpg','random4.jpg','random5.jpg','random6.jpg','random7.jpg','random8.jpg','random9.jpg','random10.jpg','random11.jpg','random13.jpg','random14.jpg']
		}			
	}
	
	$.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
									});
				
						
				});	
			}
			
	});


$('.shuffle').randomImage({path: 'wp-content/themes/fresh/content/homeimages/'});
	$('a:first').click(function() {
		location.reload();
		return false;
	});
	
	
	/********************************************************************************************************************
	SIMPLE ACCORDIAN STYLE MENU FUNCTION
	********************************************************************************************************************/	
	$('div.accordionButton').click(function() {
		$('div.accordionContent').slideUp('normal');	
		$(this).next().slideDown('normal');
	});
	
	/********************************************************************************************************************
	CLOSES ALL DIVS ON PAGE LOAD
	********************************************************************************************************************/	
	$("div.accordionContent").hide();
	$("#firstAccordionItem").show();
	
	//mailchimp controls
	$(".chimplaunch").colorbox({width:300, inline:true, href:"#chimp"});

});

function SwapPortfolio(img)
{
    $(".shuffle").hide().attr('src',img).load(function() { $(this).fadeIn(2000); });
}

