(function($) {
	
	// For the mainstage, you need to provide an images.json file which is located
	// at _ryerson/data/images.json. This is the best way to handle the slideshow
	// due to the fact that it's set up so any page can have a slideshow if you want it to.

	Mainstage = Backbone.Model.extend({
		defaults: {
			slideshow: false
			,speed: 5
		}

		,initialize: function initialize () {
			if ( this.get('slideshow') ) {
				this.getImageData();
			} else {
				this.createView();	
			}
		}

		,getImageData: function getImageData () {
			
			var self = this;

			// Make a call to the slideshow json file
			$.ajax({
			    url: '/json/homepageslides'
				,dataType: 'json'
				,success : function success (data) {
					self.set({ images: data });

					// After we get the data, create the view
					self.createView();
				}
			});

		}

		,createView: function createView () {
			var mainstageView = new MainstageView({model:this});
		}
	});
	
}(jQuery));
