﻿function shuffle(e) {               // pass the divs to the function
    var replace = $('<div>');
    var size = e.size();

    while (size >= 1) {
       var rand = Math.floor(Math.random() * size);
       var temp = e.get(rand);      // grab a random div from our set
       replace.append(temp);        // add the selected div to our new set
       e = e.not(temp); // remove our selected div from the main set
       size--;
    }
    $('#imgboxwrapper').html(replace.html() );     // update our container div with the
                                             // new, randomized divs
}


shuffle( $('#imgboxwrapper div') );


jQuery(document).ready(function(){
	$("#imgboxwrapper div").hover(function(){
	 	
	 	$(this).find("span").attr({	"style": 'display:block'});
			
		}, 
		function(){
		
			$(this).find("span").animate({opacity: 0}, {queue:false, duration:500}, "linear",
				function(){
					$(this).find("span").attr({"style": 'display:none'});			
				}
			);
		});
});

