Array.prototype.shuffle = function() {
	var s = [];
	while (this.length) s.push(this.splice(Math.random() * this.length, 1));
	while (s.length) this.push(s.pop());
	return this;
} 

$(document).ready(function(){	
	var vContainer = $('.ag_slideshow');	
	
	if(_slideshow){
		//build slideshow
		_slideshow.shuffle();

		for(i = 0; i<SLIDESHOW_LENGTH; i++)
		{
			if(i < _slideshow.length)
			{
				vContainer.append("<div style=\"background-image:url('"+_slideshow[i]+"');\">&nbsp;</div>");
			}
		}
	}

	vContainer.diaporama({
		animationSpeed: 2000,
		delay:15,
		controls:false
	});
});
