(function() {

	Carousel = function() {
	
	}; // end function
	
	Carousel.prototype.start = function() {
		
		var self = this;
		
		$.post("/api/carousel",function(oResponse) {
		
			if(oResponse.length>0) {
			
				var ul = $("<ul>");
			
				for(var i=0; i<oResponse.length; i++) {
				
					var li = $("<li>").appendTo(ul);
					var img = $("<img>").attr("src","/files/carousel/"+oResponse[i]).attr("width","538").attr("height","176").attr("border","0").appendTo(li);
				
				} // end for
			
				$("#carousel").append(ul);			
				$("#carousel").infiniteCarousel({
					displayTime: 6000,
					textholderHeight: .25,
					iconLocation: "/images/carousel",
					thumbnailBorder: "#F9A22E",
					thumbnailWidth: "13px",
					thumbnailHeight: "13px"
				});
			
			}else{
			
				$("#carousel").hide();
			
			} // end if
		
		},"json"); // end post
	
	}; // end function

})(); // end class

$(document).ready(function() {

	new Carousel().start();
	
}); // end ready

