/**
*	Application
*/
var Application = AbstractView.extend(
	{
		/**
		*   init
		*
		*   Constructs the application
		*
		*	@param	p - site prefix
		*/
		init: function(p)
		{
			// create all application elements
			
			//alert( "initiating..." );
			
			// define internal instance
			var obj = this;
			
			// object properties
			this.jsReady = false;
			
			// @@ model
			this.core = new Core( p );
			
			// @@ controls
			this.generalControl = new GeneralControl( this.core );
			this.photosControl = new PhotosControl( this.core );
			this.forumControl = new ForumControl( this.core );
			this.commentsControl = new CommentsControl( this.core );
			this.advertsControl = new AdvertsControl( this.core );
			this.creditControl = new CreditControl( this.core );
			this.ancmtsControl = new AnnouncementsControl( this.core );
			this.newsControl = new NewsControl( this.core );
			this.purchasesControl = new PurchasesControl( this.core );
			this.productsControl = new ProductsControl( this.core );
			this.castingsControl = new CastingsControl( this.core );
			this.requestsControl = new RequestsControl( this.core );
			
			// @@ manager
			this.generalManager = new GeneralManager( this.core );
			this.generalManager.addControl( "GeneralControl", this.generalControl );
			this.generalManager.addControl( "PhotosControl", this.photosControl );
			this.generalManager.addControl( "ForumControl", this.forumControl );
			this.generalManager.addControl( "CommentsControl", this.commentsControl );
			this.generalManager.addControl( "AdvertsControl", this.advertsControl );
			this.generalManager.addControl( "CreditControl", this.creditControl );
			this.generalManager.addControl( "AnnouncementsControl", this.ancmtsControl );
			this.generalManager.addControl( "NewsControl", this.newsControl );
			this.generalManager.addControl( "PurchasesControl", this.purchasesControl );
			this.generalManager.addControl( "ProductsControl", this.productsControl );
			this.generalManager.addControl( "CastingsControl", this.castingsControl );
			this.generalManager.addControl( "RequestsControl", this.requestsControl );
			
			// listen to applicable events
			$(document).ready(function() { obj.initInterface(); });
		},
		
		/**
		*   isReady
		*
		*   Returns wheteher the js has been initialised
		*/
		isReady: function() 
		{
			return this.jsReady;
		},
		
		/**
		*   initInterface
		*
		*   Initialises the external interface
		*/
		initInterface: function() 
		{
			//alert( "initiating interface" );
			
			this.jsReady = true;
		}
	}
);