(function() {

	Carousel = function() {
	
	}; // end function
	
	Carousel.prototype.start = function() {
		
		var self = this;
		
		$.post("/api/carousel",function(oResponse) {
		
			if(oResponse.length>0) {
				
				var images = [];
			
				for(var i=0; i<oResponse.length; i++) {
				
					images.push(["/files/carousel/"+oResponse[i],"","",""]);
				
				} // end for
				
				var mygallery = new simpleGallery({
					wrapperid: "carousel-content",
					dimensions: [529,210],
					imagearray: images,
					autoplay: [true,5000,999],
					persist: true,
					preloadfirst: false,
					fadeduration: 1000
				});
			
			}else{
			
				$("#carousel").hide();
			
			} // end if
		
		},"json"); // end post
	
	}; // end function

})(); // end class

$(document).ready(function() {

	new Carousel().start();

}); // end ready

