define(['Global', 'Text!../html/templates/sessionExpired.html'],
	function(Global, template){
		'use strict';

		return Backbone.Marionette.ItemView.extend({
			id: "session-expired-dialog",
            template: _.template(template),
            attributes: {
                "data-role": "dialog",
                "data-corners": "false",
                "data-overlay-theme": "d",
                "data-close-btn": "none"
            },
			events: {
				'click #re-login': 'login',
				'click #launchpad': 'launchpad'
			},
            onRender: function () {
            	$("#main").html("");
            	Global.getUtilities().logout({preventLogoutLocation: true});
                var $container = $('body'),
                    that = this;

                $container
                    .append(this.$el);

                $(window).resize();

                return this.$el;
            },
			launchpad: function(e){
				e.preventDefault();
				Global.getUtilities().eventAggregator.trigger("do:launchpad");
			},
			login: function(e){
				e.preventDefault();
				Global.getUtilities().eventAggregator.trigger("do:login");
			}
		});
	}
);