/**
 * @author hedgehog
 */

//  @import com.hedgehoglab.application.service.FlashMessageService;
//  @import com.hedgehoglab.application.model.FlashMessageModel;
//  @import com.hedgehoglab.application.controller.FlashMessageController;
//  @import com.hedgehoglab.application.view.FlashMessageView;
//  @import com.hedgehoglab.utils.noConsole;

/**
*	Implements base functionality to execute and pass resources through the inheritance chain
*/
function BaseApplication(scope){
	
	//	Check for ie6 and fail!
	if ( $.browser.msie && $.browser.version=="6.0") {
		//	Show support message

		return false;
	}
		$('.browser-not-supported').remove();	
  var _this = this;
  var _resource = $.extend({},scope);  
  


	// var event_flag=false;
	// var is_logged_in=$("meta[name='server_timeout']").attr("content");
	// 
	// if(is_logged_in!=null){
	// 
	// 	var _server_timeout = ((parseInt($("meta[name='server_timeout']").attr("content"))/60)-1)*1000*60;
	// 	var _http_host = $("meta[name='http_host']").attr("content");
	// 	var _interval=null;
	// 
	// 
	// //	_server_timeout=10000;
	// 
	// 	function ping(){
	// 		//	Make the request
	// 		if(event_flag==false){
	// 			event_flag=true;
	// 			$.ajax({ url: "http://"+_http_host,type:"HEAD",success: function(){}});
	// 
	// 
	// 			//	Set an interval to not worry about making the request until 
	// 			clearInterval(_interval);
	// 			_interval=setInterval(function(e){
	// 				event_flag=false;
	// 			},_server_timeout);
	// 		}
	// 	}
	// 
	// 	$(document).bind('keydown', ping); 
	// 	$(document).bind('mousemove', ping);
	// 	$(document).bind('mousedown', ping);
	// 
	// }






  //	Create Resources any resources
  $(function(){
    try
    {
	  _resource.message_service = new FlashMessageService();
	  
	  var message_model = new FlashMessageModel();
	  var message_view = new FlashMessageView({element:$('#iFlashMessage'),model:message_model,template:'general/flash-message'});
	  var message_controller = new FlashMessageController({service:_resource.message_service,model:message_model});
      
	//	Sub classed Applications, if implementing the main method, will be passed the application resources
	  _this.main(_resource);

	//	Check for valid licence
	  
    }
    catch (exception) {};
  });
  
	this.add_resouce=function(){
		//	Todo	-	Implement add resource method so that subclass's can pass resources through the stack
	};
};