var context = location.href.replace(/http:\/\/[^\/]*(\/[\w]+).*/, '$1'); if (context == location.href) {
            context = location.href.replace(/https:\/\/[^\/]*(\/[\w]+).*/, '$1'); } 
			
			sessionmanagement = function() {
    var dialog, loginBtn, passBtn, loginNd, form, topDiv, user, pass, fpBtn, frmNode;
            var uEmail = "";


    return {
        init : function() {

                                    var mssge = Ext.getDom('success').innerHTML;
                                    var msgfail = Ext.getDom('failure').innerHTML;



                                    if(mssge != 'null'){
                                    Ext.MessageBox.confirm('Concurrent Session Alert.', 'You or someone else is currently logged in with these credentials. Do you want to login and automatically logoff the other session?', this.doAddProject);
                                    }

                                    if(msgfail != 'null'){
										Ext.MessageBox.buttonText.yes='LOGIN';
                                        Ext.MessageBox.buttonText.no='SUBSCRIBE';
										Ext.MessageBox.buttonText.cancel='DO NOTHING';
										Ext.MessageBox.show({
										   title:'Concurrent Session Alert.',
										   msg: 'Another user using same credentials has logged your session off. To resume using the site and access paid content, please, login again or purchase another subscription.',
										   buttons: Ext.Msg.YESNOCANCEL,
										   fn: this.doAddProject1
										   
										   
										});

                                    }
                        },

            doAddProject : function(btn) {
            if(btn=="yes")
            {
                        document["emeta.SignupForm"].action = context + '/subscribe/login/loginauth.do?action=doLogin';
                        document["emeta.SignupForm"].submit();


            }

},

doAddProject1 : function(btn) {
            if(btn=="yes")
            {
                document["emeta.SignupForm"].action = context + '/subscribe/login/loginauth.do?action=doLogin';
                document["emeta.SignupForm"].submit();

            }
            if(btn=="no")
			{
				document["emeta.SignupForm"].action = context + '/subscribe/login/loginauth.do?action=doRemoveSessionKey&pageShow=subscribe';
				document["emeta.SignupForm"].submit();
			}
            if(btn=="cancel")
            {
                document["emeta.SignupForm"].action = context + '/subscribe/login/loginauth.do?action=doRemoveSessionKey&pageShow=home';
				document["emeta.SignupForm"].submit();

            }

}


    };
}
();

Ext.EventManager.onDocumentReady(sessionmanagement.init, sessionmanagement, true);