Adapted some popups to be able to open them as MDI popups:
authorDavid Baz Fayos <david.baz@openbravo.com>
Fri, 29 Oct 2010 23:05:42 +0200
changeset 8778 28cb24e774cc
parent 8777 a71bc77a4fc9
child 8779 3835fb615788
Adapted some popups to be able to open them as MDI popups:
- Instance Purpose
- Heartbeat
- Registration
- MMC related popups (browse file system, module info, rebuild popup, show log, ...)
- Help
- Help edit
- About
src/org/openbravo/base/secureApp/AdvisePopUpRefresh.html
src/org/openbravo/erpCommon/ad_forms/Heartbeat.html
src/org/openbravo/erpCommon/ad_forms/InstancePurpose.html
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java
src/org/openbravo/erpCommon/ad_forms/ModuleManagementAdd.html
src/org/openbravo/erpCommon/ad_forms/ModuleManagementDetails.html
src/org/openbravo/erpCommon/ad_forms/ModuleManagementInstalled.html
src/org/openbravo/erpCommon/ad_forms/ModuleManagement_ErrorCommercial.html
src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallLocal.html
src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallP1.html
src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallP2.html
src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallP4.html
src/org/openbravo/erpCommon/ad_forms/Registration.html
src/org/openbravo/erpCommon/ad_forms/ShowLogFile.html
src/org/openbravo/erpCommon/ad_help/DisplayHelp.html
src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Element_F1.html
src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Element_F2.html
src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_F1.html
src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_F2.html
src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Field_F1.html
src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Field_F2.html
src/org/openbravo/erpCommon/ad_process/ApplyModules.html
src/org/openbravo/erpCommon/ad_process/HeartbeatRedirect.html
src/org/openbravo/erpCommon/security/Login_F1.html
src/org/openbravo/erpCommon/utility/VerticalMenu.html
web/js/shortcuts.js
web/js/utils.js
--- a/src/org/openbravo/base/secureApp/AdvisePopUpRefresh.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/base/secureApp/AdvisePopUpRefresh.html	Fri Oct 29 23:05:42 2010 +0200
@@ -37,12 +37,15 @@
 	}
 
 	function closeThisPage() {
-		var refreshButton = opener.document.getElementById('buttonRefresh');
-		if(refreshButton)
-			refreshButton.onclick();	
-		top.close();
-		return true;
-	}
+    if (opener) {
+      var refreshButton = opener.document.getElementById('buttonRefresh');
+      if (refreshButton) {
+        refreshButton.onclick();
+      }
+    }
+    closePage();
+    return true;
+  }
 </script>
 </head>
 
--- a/src/org/openbravo/erpCommon/ad_forms/Heartbeat.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/Heartbeat.html	Fri Oct 29 23:05:42 2010 +0200
@@ -32,9 +32,13 @@
   <script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
   <script language="JavaScript" type="text/javascript">
   function openRegistration() {
-    var w = window.opener;
-    if(w) {
-      w.setTimeout("openRegistration();",100);
+    if (!isWindowInMDIContext) {
+      var w = window.opener;
+      if(w) {
+        w.setTimeout("openRegistration();",100);
+      }
+    } else {
+      getFrame('LayoutMDI').OB.Layout.ClassicOBCompatibility.Popup.openRegistration();
     }
     return true;
   }
@@ -54,7 +58,7 @@
     if (document.frmMain.showRegistration.value == 'Y') {
       openRegistration();
     }
-    window.close();
+    closePage();
   }
   </script>
 
--- a/src/org/openbravo/erpCommon/ad_forms/InstancePurpose.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/InstancePurpose.html	Fri Oct 29 23:05:42 2010 +0200
@@ -31,18 +31,26 @@
   <script language="JavaScript" src="../../../../../web/js/appStatus.js" type="text/javascript"></script>
   <script language="JavaScript" type="text/javascript">
   function openRegistration() {
-    var w = window.opener;
-    if(w) {
-      w.setTimeout("openRegistration();",100);
+    if (!isWindowInMDIContext) {
+      var w = window.opener;
+      if(w) {
+        w.setTimeout("openRegistration();",100);
+      }
+    } else {
+      getFrame('LayoutMDI').OB.Layout.ClassicOBCompatibility.Popup.openRegistration();
     }
     return true;
   }
   </script>
   <script language="JavaScript" type="text/javascript">
   function openHeartbeat() {
-    var w = window.opener;
-    if(w) {
-      w.setTimeout("openHeartbeat();",100);
+    if (!isWindowInMDIContext) {
+      var w = window.opener;
+      if(w) {
+        w.setTimeout("openHeartbeat();",100);
+      }
+    } else {
+      getFrame('LayoutMDI').OB.Layout.ClassicOBCompatibility.Popup.openHeartbeat();
     }
     return true;
   }
@@ -56,7 +64,7 @@
     } else {
       getFrame('LayoutMDI').OB.Layout.ViewManager.openView("ClassicOBWindow",  {viewId: "ClassicOBWindow", obManualURL: '/ad_forms/InstanceManagement.html', id: '/ad_forms/InstanceManagement.html', formId: '8D6282279F464B1696B0EE3E23023B65', command: "DEFAULT", tabTitle: 'Instance Activation'});
     }
-    window.close();
+    closePage();
   }
   function buttonOK() {
     var purpose = document.frmMain.instancePurpose;
@@ -79,16 +87,16 @@
         if (appFrame.document.getElementById('buttonRefresh')) {
           appFrame.document.getElementById('buttonRefresh').onclick();
         } else {
-          window.close();
+          closePage();
         }
       } else if (appFrame) {
         appFrame.updatePurposeImage(purpose.value);
-        window.close();
+        closePage();
       } else {
-        window.close();
+        closePage();
       }
     } else {
-      window.close();
+      closePage();
     }
 
   }
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java	Fri Oct 29 23:05:42 2010 +0200
@@ -288,13 +288,13 @@
         rt = total
             + "&nbsp;"
             + Utility.messageBD(this, "ApplyModules", lang)
-            + ", <a id=\"rebuildNow\" class=\"LabelLink_noicon\" href=\"#\" onclick=\"openServletNewWindow('DEFAULT', false, '../ad_process/ApplyModules.html', 'BUTTON', null, true, 700, 900);return false;\">"
+            + ", <a id=\"rebuildNow\" class=\"LabelLink_noicon\" href=\"#\" onclick=\"openServletNewWindow('DEFAULT', false, '../ad_process/ApplyModules.html', 'BUTTON', null, true, 700, 900, null, null, null, null, true);return false;\">"
             + Utility.messageBD(this, "RebuildNow", lang) + "</a>";
       }
       String restartTomcat = ModuleManagementData.selectRestartTomcat(this);
       // Check if last build was done but Tomcat wasn't restarted
       if (!restartTomcat.equals("0")) {
-        rt = "<a class=\"LabelLink_noicon\" href=\"#\" onclick=\"openServletNewWindow('TOMCAT', false, '../ad_process/ApplyModules.html', 'BUTTON', null, true, 650, 900);return false;\">"
+        rt = "<a class=\"LabelLink_noicon\" href=\"#\" onclick=\"openServletNewWindow('TOMCAT', false, '../ad_process/ApplyModules.html', 'BUTTON', null, true, 650, 900, null, null, null, null, true);return false;\">"
             + Utility.messageBD(this, "Restart_Tomcat", lang) + "</a>";
         return rt;
 
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagementAdd.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagementAdd.html	Fri Oct 29 23:05:42 2010 +0200
@@ -46,13 +46,13 @@
 <script language="JavaScript" type="text/javascript">
   function viewDetails(id) {
     document.frmMain.inpcRecordId.value = id;
-    openServletNewWindow('DETAIL', false, 'ModuleManagement.html', 'BUTTON', null, true, 600, 900);
+    openServletNewWindow('DETAIL', false, 'ModuleManagement.html', 'BUTTON', null, true, 600, 900, null, null, null, null, true);
     return false;
   }
   
   function installNow(id) {
     document.frmMain.inpcRecordId.value = id;
-    openServletNewWindow('INSTALL', false, 'ModuleManagement.html', 'BUTTON', null, true, 600, 900);
+    openServletNewWindow('INSTALL', false, 'ModuleManagement.html', 'BUTTON', null, true, 600, 900, null, null, null, null, true);
     return false;
   }
   
@@ -71,6 +71,10 @@
     setProcessingMode('window',false);
   }
   
+  function browseFileSystem() {
+    openServletNewWindow('LOCAL', false, 'ModuleManagement.html', 'BUTTON', null, true, 600, 900, null, null, null, null, true);
+    return true;
+  }
 
 </script>
   <script language="JavaScript" type="text/javascript">
@@ -313,7 +317,7 @@
                       <button type="button" 
                         id="buttonScan" 
                         class="ButtonLink" 
-                        onclick="openServletNewWindow('LOCAL', false, 'ModuleManagement.html', 'BUTTON', null, true, 600, 900);return false;" 
+                        onclick="browseFileSystem();return false;" 
                         onfocus="buttonEvent('onfocus', this); window.status='Browse File System'; return true;" 
                         onblur="buttonEvent('onblur', this);" 
                         onkeyup="buttonEvent('onkeyup', this);" 
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagementDetails.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagementDetails.html	Fri Oct 29 23:05:42 2010 +0200
@@ -34,14 +34,9 @@
   var baseDirectory="../../../../../web/";
   </script>
   <script language="JavaScript" type="text/javascript" id="fieldWindowIDArray">
-  function closeThisPage() {
-    window.close();
-    return true;
-  }
-
   function viewModule(id) {
     document.frmMain.inpcRecordId.value = id;
-    openServletNewWindow('DETAIL', false, 'ModuleManagement.html', 'Details', null, true, 600, 900,null,null,false);
+    openServletNewWindow('DETAIL', false, 'ModuleManagement.html', 'Details', null, true, 600, 900,null, null, false, null, true);
     return false;
   }
   </script>
@@ -173,7 +168,7 @@
                   <button type="button" 
                     id="buttonOK" 
                     class="ButtonLink" 
-                    onclick="closeThisPage();return false;" 
+                    onclick="closePage();return false;" 
                     onfocus="buttonEvent('onfocus', this); window.status='Accept'; return true;" 
                     onblur="buttonEvent('onblur', this);" 
                     onkeyup="buttonEvent('onkeyup', this);" 
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagementInstalled.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagementInstalled.html	Fri Oct 29 23:05:42 2010 +0200
@@ -143,7 +143,7 @@
   
   function installUpdate(id){
     frmMain.inpcUpdate.value = id;
-    openServletNewWindow('UPDATE', false, 'ModuleManagement.html', 'Update', null, true, 700, 900);
+    openServletNewWindow('UPDATE', false, 'ModuleManagement.html', 'Update', null, true, 700, 900, null, null, null, null, true);
   }
 
   function uninstallModule(){
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_ErrorCommercial.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_ErrorCommercial.html	Fri Oct 29 23:05:42 2010 +0200
@@ -32,13 +32,6 @@
   var baseDirectory="../../../../../web/";
   </script>
   <script language="JavaScript" type="text/javascript">
-  function closeThisPage() {
-    window.close();
-    return true;
-  }
-
-  </script>
-  <script language="JavaScript" type="text/javascript">
   function onLoadDo(){
     this.windowTables = new Array(
       new windowTableId('client', 'buttonCancel')
@@ -262,7 +255,7 @@
                   <button type="button" 
                     id="buttonCancel" 
                     class="ButtonLink" 
-                    onclick="closeThisPage();return false;" 
+                    onclick="closePage();return false;" 
                     onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;" 
                     onblur="buttonEvent('onblur', this);" 
                     onkeyup="buttonEvent('onkeyup', this);" 
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallLocal.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallLocal.html	Fri Oct 29 23:05:42 2010 +0200
@@ -44,11 +44,6 @@
   var baseDirectory="../../../../../web/";
   </script>
   <script language="JavaScript" type="text/javascript" id="fieldWindowIDArray">
-  function closeThisPage() {
-    window.close();
-    return true;
-  }
-
   function viewModule(id) {
     document.frmMain.inpcRecordId.value = id;
     submitCommandForm('DETAIL', false, null, 'ModuleManagement.html', '_self', null, true);return false;
@@ -281,7 +276,7 @@
                   <button type="button" 
                     id="buttonCancel" 
                     class="ButtonLink" 
-                    onclick="closeThisPage();return false;" 
+                    onclick="closePage();return false;" 
                     onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;" 
                     onblur="buttonEvent('onblur', this);" 
                     onkeyup="buttonEvent('onkeyup', this);" 
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallP1.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallP1.html	Fri Oct 29 23:05:42 2010 +0200
@@ -33,13 +33,6 @@
   <script language="JavaScript" type="text/javascript" id="paramDirectory">
   var baseDirectory="../../../../../web/";
   </script>
-  <script language="JavaScript" type="text/javascript" id="fieldWindowIDArray">
-  function closeThisPage() {
-    window.close();
-    return true;
-  }
-
-  </script>
   <script language="JavaScript" type="text/javascript">
   function onLoadDo(){
     this.windowTables = new Array(
@@ -57,8 +50,7 @@
   
   function viewModule(id) {
     document.frmMain.inpcRecordId.value = id;
-
-    openServletNewWindow('DETAIL', false, 'ModuleManagement.html', 'Details', null, false, 600, 900,null,null,false);
+    openServletNewWindow('DETAIL', false, 'ModuleManagement.html', 'Details', null, false, 600, 900, null, null, false, null, true);
     return false;
   }
   </script>    
@@ -306,7 +298,7 @@
                   <button type="button" 
                     id="buttonCancel" 
                     class="ButtonLink" 
-                    onclick="closeThisPage();return false;" 
+                    onclick="closePage();return false;" 
                     onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;" 
                     onblur="buttonEvent('onblur', this);" 
                     onkeyup="buttonEvent('onkeyup', this);" 
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallP2.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallP2.html	Fri Oct 29 23:05:42 2010 +0200
@@ -34,11 +34,6 @@
   
   <script language="JavaScript" type="text/javascript" id="paramDirectory"></script>
   <script language="JavaScript" type="text/javascript">
-  function closeThisPage() {
-    window.close();
-    return true;
-  }
-
   function viewModule(id) {
     document.frmMain.inpcRecordId.value = id;
     submitCommandForm('DETAIL', false, null, 'ModuleManagement.html', '_self', null, false);return false;
@@ -350,7 +345,7 @@
                   <button type="button" 
                     id="buttonCancel" 
                     class="ButtonLink" 
-                    onclick="closeThisPage();return false;" 
+                    onclick="closePage();return false;" 
                     onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;" 
                     onblur="buttonEvent('onblur', this);" 
                     onkeyup="buttonEvent('onkeyup', this);" 
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallP4.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement_InstallP4.html	Fri Oct 29 23:05:42 2010 +0200
@@ -32,11 +32,6 @@
 <script language="JavaScript" src="../utility/DynamicJS.js" type="text/javascript"></script>
   <script language="JavaScript" type="text/javascript" id="paramDirectory"></script>
   <script language="JavaScript" type="text/javascript">
-  function closeThisPage() {
-    window.close();
-    return true;
-  }
-
   function viewModule(id) {
     document.frmMain.inpcRecordId.value = id;
     submitCommandForm('DETAIL', false, null, 'ModuleManagement.html', '_self', null, false);return false;
@@ -219,7 +214,7 @@
                   <button type="button" 
                     id="buttonOK" 
                     class="ButtonLink" 
-                    onclick="window.opener.submitCommandForm('DEFAULT', false, null, 'ModuleManagement.html', '_self', null, false);closeThisPage();return false;" 
+                    onclick="window.opener.submitCommandForm('DEFAULT', false, null, 'ModuleManagement.html', '_self', null, false);closePage();return false;" 
                     onfocus="setWindowElementFocus(this); window.status='Accept'; return true;" 
                     onblur="buttonEvent('onblur', this);" 
                     onkeyup="buttonEvent('onkeyup', this);" 
--- a/src/org/openbravo/erpCommon/ad_forms/Registration.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/Registration.html	Fri Oct 29 23:05:42 2010 +0200
@@ -33,16 +33,20 @@
   function configure() {
 	var regURL = typeof url === 'undefined' ? 'http://www.openbravo.com/embedreg/form' : url;
   	submitCommandForm('REGISTER', false, null);
-  	window.opener.submitCommandForm('DEFAULT', false, null, regURL, '_blank', null, false);
-  	self.close();
+    if (!isWindowInMDIContext) {
+      window.opener.submitCommandForm('DEFAULT', false, null, regURL, '_blank', null, false);
+    } else {
+      submitCommandForm('DEFAULT', false, null, regURL, '_blank', null, false);
+    }
+  	closePage();
   }
   function disable() {
   	submitCommandForm('DISABLE', false, null);
-  	window.close();
+  	closePage();
   }
   function postpone() {
   	submitCommandForm('POSTPONE', false, null);
-  	window.close();
+  	closePage();
   }
   </script>
 
--- a/src/org/openbravo/erpCommon/ad_forms/ShowLogFile.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ShowLogFile.html	Fri Oct 29 23:05:42 2010 +0200
@@ -37,6 +37,13 @@
   <script language="JavaScript" type="text/javascript" id="paramDirectory">
     var baseDirectory="../../../../../web/";
   </script>
+  <script language="JavaScript" type="text/javascript">
+    function onLoadDo() {
+    }
+
+    function onUnloadDo() {
+    }
+  </script>
 </head>
 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"  onload="onLoadDo();" onunload="onUnloadDo();" id="paramMessage">
   <form id="form" method="post" action="ApplyModules.html" name="frmMain" target="hiddenFrame">
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp.html	Fri Oct 29 23:05:42 2010 +0200
@@ -135,7 +135,7 @@
                           <td class="FieldGroupContent"></td>
                           <td class="FieldGroupTitle_Left"><img class="FieldGroupTitle_Left_bg" border="0" src="../../../../../web/images/blank.gif"></img></td>
                           <td class="FieldGroupTitle" style="padding-top:4px;" id="discardEdit">
-                            <a href="#" onclick="editHelp('DisplayHelp_Edit_FS.html', 'xx', 'paramWindowHelp', 'yy');return false;" onmouseover="window.status='Edit Help';return true;" onmouseout="window.status='';return true;" id="paramWindowId" class="Popup_Client_Help_Icon_LabelLink"><img class="Popup_Client_Help_Icon_edit" border="0" src="../../../../../web/images/blank.gif"></img></a>
+                            <a href="#" onclick="editHelp('DisplayHelp_Edit_FS.html', 'xx', 'paramWindowHelp', 'yy', null, null, true);return false;" onmouseover="window.status='Edit Help';return true;" onmouseout="window.status='';return true;" id="paramWindowId" class="Popup_Client_Help_Icon_LabelLink"><img class="Popup_Client_Help_Icon_edit" border="0" src="../../../../../web/images/blank.gif"></img></a>
                             <!--a href="#"><img class="Popup_Client_Help_Icon_top" border="0" src="../../../../../web/images/blank.gif"></img></a-->
                           </td>
                           <td class="FieldGroupTitle_Right"><img class="FieldGroupTitle_Right_bg" border="0" src="../../../../../web/images/blank.gif"></img></td>
@@ -159,7 +159,7 @@
                           <td class="FieldGroupContent"></td>
                           <td class="FieldGroupTitle_Left"><img class="FieldGroupTitle_Left_bg" border="0" src="../../../../../web/images/blank.gif"></img></td>
                           <td class="FieldGroupTitle" style="padding-top:4px;">
-                            <span id="discardEdit"><a href="#" onclick="editHelp('DisplayHelp_Edit_FS.html','TAB', 'paramTabxxHelp', 'yy');return false;" onmouseover="window.status='Edit help';return true;" onmouseout="window.status='';return true;" id="fieldTabIdDescription" class="Popup_Client_Help_Icon_LabelLink"><img class="Popup_Client_Help_Icon_edit" border="0" src="../../../../../web/images/blank.gif"></img></a></span>
+                            <span id="discardEdit"><a href="#" onclick="editHelp('DisplayHelp_Edit_FS.html','TAB', 'paramTabxxHelp', 'yy', null, null, true);return false;" onmouseover="window.status='Edit help';return true;" onmouseout="window.status='';return true;" id="fieldTabIdDescription" class="Popup_Client_Help_Icon_LabelLink"><img class="Popup_Client_Help_Icon_edit" border="0" src="../../../../../web/images/blank.gif"></img></a></span>
                             <a href="#WindowName" onmouseover="window.status='Go to the top';return true;" onmouseout="window.status='';return true;" class="Popup_Client_Help_Icon_LabelLink"><img class="Popup_Client_Help_Icon_top" border="0" src="../../../../../web/images/blank.gif"></img></a>
                           </td>
                           <td class="FieldGroupTitle_Right"><img class="FieldGroupTitle_Right_bg" border="0" src="../../../../../web/images/blank.gif"></img></td>
@@ -192,7 +192,7 @@
                           <td class="FieldGroupContent"></td>
                           <td class="FieldGroupTitle_Left"><img class="FieldGroupTitle_Left_bg" border="0" src="../../../../../web/images/blank.gif"></img></td>
                           <td class="FieldGroupTitle" style="padding-top:4px;">
-                            <!--a href="#" onclick="editHelp('DisplayHelp_Edit_FS.html','TAB', 'paramTabxxHelp', 'yy');return false;" onmouseover="window.status='Edit help';return true;" onmouseout="window.status='';return true;" id="fieldTabIdDescription"><img class="Popup_Client_Help_Icon_edit" border="0" src="../../../../../web/images/blank.gif"></img></a-->
+                            <!--a href="#" onclick="editHelp('DisplayHelp_Edit_FS.html','TAB', 'paramTabxxHelp', 'yy', null, null, true);return false;" onmouseover="window.status='Edit help';return true;" onmouseout="window.status='';return true;" id="fieldTabIdDescription"><img class="Popup_Client_Help_Icon_edit" border="0" src="../../../../../web/images/blank.gif"></img></a-->
                             <a href="#WindowName" onmouseover="window.status='Go to the top';return true;" onmouseout="window.status='';return true;" class="Popup_Client_Help_Icon_LabelLink"><img class="Popup_Client_Help_Icon_top" border="0" src="../../../../../web/images/blank.gif"></img></a>
                           </td>
                           <td class="FieldGroupTitle_Right"><img class="FieldGroupTitle_Right_bg" border="0" src="../../../../../web/images/blank.gif"></img></td>
@@ -214,7 +214,7 @@
                           <td class="FieldGroupContent"></td>
                           <td class="FieldGroupTitle_Left"><img class="FieldGroupTitle_Left_bg" border="0" src="../../../../../web/images/blank.gif"></img></td>
                           <td class="FieldGroupTitle" style="padding-top:4px;">
-                            <span id="discardEdit"><a href="#" onclick="editHelp('DisplayHelp_Edit_Field_FS.html', 'FIELD', 'paramFieldxx', 'yy');return false;" onmouseover="window.status='Edit help';return true;" onmouseout="window.status='';return true;" id="fieldFieldIdDesc" class="Popup_Client_Help_Icon_LabelLink"><img class="Popup_Client_Help_Icon_edit" border="0" src="../../../../../web/images/blank.gif"></img></a></span>
+                            <span id="discardEdit"><a href="#" onclick="editHelp('DisplayHelp_Edit_Field_FS.html', 'FIELD', 'paramFieldxx', 'yy', null, null, true);return false;" onmouseover="window.status='Edit help';return true;" onmouseout="window.status='';return true;" id="fieldFieldIdDesc" class="Popup_Client_Help_Icon_LabelLink"><img class="Popup_Client_Help_Icon_edit" border="0" src="../../../../../web/images/blank.gif"></img></a></span>
                             <a href="#Tabxx" id="fieldTabGoTo" onmouseover="window.status='Go to the top';return true;" onmouseout="window.status='';return true;" class="Popup_Client_Help_Icon_LabelLink"><img class="Popup_Client_Help_Icon_top" border="0" src="../../../../../web/images/blank.gif"></img></a>
                           </td>
                           <td class="FieldGroupTitle_Right"><img class="FieldGroupTitle_Right_bg" border="0" src="../../../../../web/images/blank.gif"></img></td>
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Element_F1.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Element_F1.html	Fri Oct 29 23:05:42 2010 +0200
@@ -68,9 +68,6 @@
       document.frmMain.inpHelp.value = xinha_editors.idfieldHelp.getHTML();
       return true;
     }
-    function closeWindow() {
-      top.close();
-    }
   </script>
   <script language="JavaScript" type="text/javascript">
     function onLoadDo() {
@@ -296,7 +293,7 @@
                 <button type="button" 
                   id="buttonCancel" 
                   class="ButtonLink" 
-                  onclick="closeWindow();return false;" 
+                  onclick="closePage();return false;" 
                   onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;" 
                   onblur="buttonEvent('onblur', this);" 
                   onkeyup="buttonEvent('onkeyup', this);" 
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Element_F2.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Element_F2.html	Fri Oct 29 23:05:42 2010 +0200
@@ -27,7 +27,7 @@
 <script language="JavaScript" src="../../../../../web/js/windowKeyboard.js" type="text/javascript"></script>
 <script language="JavaScript" type="text/javascript" id="discardClose">
 function cerrarHelpEditor(){
-  top.close();
+  closePage();
   return true;
 }
 </script>
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_F1.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_F1.html	Fri Oct 29 23:05:42 2010 +0200
@@ -69,9 +69,6 @@
       document.frmMain.inpHelp.value = xinha_editors.idfieldHelp.getHTML();
       return true;
     }
-    function closeWindow() {
-      top.close();
-    }
   </script>
   <script language="JavaScript" type="text/javascript">
     function onLoadDo() {
@@ -289,7 +286,7 @@
                 <button type="button" 
                   id="buttonCancel" 
                   class="ButtonLink" 
-                  onclick="closeWindow();return false;" 
+                  onclick="closePage();return false;" 
                   onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;" 
                   onblur="buttonEvent('onblur', this);" 
                   onkeyup="buttonEvent('onkeyup', this);" 
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_F2.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_F2.html	Fri Oct 29 23:05:42 2010 +0200
@@ -32,10 +32,10 @@
   var key = frm.inpClave.value;
   if (type=="Window") key = "";
   var name=frm.inpName.value;
-  top.opener.layer('param' + type + 'Name' + key, name, true);
+  parent.opener.layer('param' + type + 'Name' + key, name, true);
   var help=frm.inpHelp.value;
-  top.opener.layer('param' + type + 'Help' + key, help, true);
-  top.close();
+  parent.opener.layer('param' + type + 'Help' + key, help, true);
+  closePage();
   return true;
 }
 </script>
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Field_F1.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Field_F1.html	Fri Oct 29 23:05:42 2010 +0200
@@ -68,9 +68,6 @@
       document.frmMain.inpHelp.value = xinha_editors.idfieldHelp.getHTML();
       return true;
     }
-    function closeWindow() {
-      top.close();
-    }
   </script>
   <script language="JavaScript" type="text/javascript">
     function onLoadDo() {
@@ -294,7 +291,7 @@
                 <button type="button" 
                   id="buttonCancel" 
                   class="ButtonLink" 
-                  onclick="closeWindow();return false;" 
+                  onclick="closePage();return false;" 
                   onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;" 
                   onblur="buttonEvent('onblur', this);" 
                   onkeyup="buttonEvent('onkeyup', this);" 
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Field_F2.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp_Edit_Field_F2.html	Fri Oct 29 23:05:42 2010 +0200
@@ -32,10 +32,10 @@
   var key = frm.inpClave.value;
   if (type=="Window") key = "";
   var name=frm.inpName.value;
-  top.opener.layer('param' + type + 'Name' + key, name, true);
+  parent.opener.layer('param' + type + 'Name' + key, name, true);
   var help=frm.inpHelp.value;
-  top.opener.layer('param' + type + 'Help' + key, help, true);
-  top.close();
+  parent.opener.layer('param' + type + 'Help' + key, help, true);
+  closePage();
   return true;
 }
 </script>
--- a/src/org/openbravo/erpCommon/ad_process/ApplyModules.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/ApplyModules.html	Fri Oct 29 23:05:42 2010 +0200
@@ -33,12 +33,6 @@
   <script language="JavaScript" src="../../../../../web/js/windowKeyboard.js" type="text/javascript"></script>
   <script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
   <script language="JavaScript" type="text/javascript" id="paramDirectory"></script>
-  <script language="JavaScript" type="text/javascript">
-    function closeThisPage() {
-      window.close();
-      return true;
-    }
-  </script>
   <script language="JavaScript" type="text/javascript" id="jsparam">
 
   </script>
@@ -216,15 +210,15 @@
       if (document.frmMain.option[0].checked) {
         window.opener.submitCommandForm('RESTART', false, null, '../ad_process/ApplyModules.html', '_self', null, false);
         restarting=true;
-        closeThisPage();
+        closePage();
         return false;
       } else if (document.frmMain.option[1].checked) {
         window.opener.submitCommandForm('RELOAD', false, null, '../ad_process/ApplyModules.html', '_self', null, false);
         restarting=true;
-        closeThisPage();
+        closePage();
         return false;
       } else if (document.frmMain.option[2].checked) {
-        closeThisPage();
+        closePage();
         return;
       }
     } 
@@ -461,7 +455,7 @@
             var frm = document.frmMain;
             startLocalTimer('localTimer');
             processing = true;
-            top.opener.setProcessingMode('window', true, false);
+            window.opener.setProcessingMode('window', true, false);
             displayLogicElement('confirmation',false);
             displayLogicElement('rebuildTable',true);
             return submitXmlHttpRequest(endProcess, frm, "STARTAPPLY", "ApplyModules.html", false, null, null);
@@ -495,7 +489,7 @@
     }
     
     function onUnloadDo() {
-      top.opener.setProcessingMode('window', false);
+      window.opener.setProcessingMode('window', false);
       if(!restarting){
         reloadOpener();
       }
@@ -705,7 +699,7 @@
                 <button type="button" 
                   id="buttonCancel" 
                   class="ButtonLink" 
-                  onclick="closeThisPage();return false;" 
+                  onclick="closePage();return false;" 
                   onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;" 
                   onblur="buttonEvent('onblur', this);" 
                   onkeyup="buttonEvent('onkeyup', this);" 
@@ -747,13 +741,13 @@
               </td></tr>
               <tr><td height="10"></td></tr>
               <tr>
-                <td colspan="4"><span class="Radio_container_NOT_focused"><input name="option" required="true" value="restart" type="radio" checked></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Restart servlet container now &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#restart">learn more</a></span></td>
+                <td colspan="4"><span class="Radio_container_NOT_focused"><input name="option" required="true" value="restart" type="radio" checked></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Restart servlet container now &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1', true);return false;" target="_blank" href="#restart">learn more</a></span></td>
               </tr>
               <tr>
-                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="reload" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Reload the Openbravo application now &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#reload">learn more</a></span></td>
+                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="reload" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Reload the Openbravo application now &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1', true);return false;" target="_blank" href="#reload">learn more</a></span></td>
               </tr>
               <tr>
-                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="doNothing" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Don't do anything now. I will reload the Openbravo application manually later &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1');return false;" target="_blank" href="#nothing">learn more</a></span></td>
+                <td colspan="4"><span class="Radio_container_NOT_Focused"><input name="option" required="true" value="doNothing" type="radio"></span><span class="PlainText_normal" style="padding: 0 0 0 10;">Don't do anything now. I will reload the Openbravo application manually later &nbsp;<a onclick="openHelp(null, '../ad_help/DisplayHelp.html', 'HELP', false, null, null, 'X', '25C886DA08E947F29AAC1D30D8B753A1', true);return false;" target="_blank" href="#nothing">learn more</a></span></td>
               </tr>
 
               <tr><td height="20"></td></tr>
@@ -829,7 +823,7 @@
               <tr>
                 <td colspan="4">
                   <div>
-                    <button type="button" id="buttonLog" class="ButtonLink" onclick="openServletNewWindow('DEFAULT', false, '../ad_forms/ShowLogFile.html?filePath=xx', 'Show Log', null, false, 600, 900,null,null,false);" onfocus="buttonEvent('onfocus', this); window.status='Show log'; return true;" onblur="buttonEvent('onblur', this);" onkeyup="buttonEvent('onkeyup', this);" onkeydown="buttonEvent('onkeydown', this);" onkeypress="buttonEvent('onkeypress', this);" onmouseup="buttonEvent('onmouseup', this);" onmousedown="buttonEvent('onmousedown', this);" onmouseover="buttonEvent('onmouseover', this); window.status='Show log'; return true;" onmouseout="buttonEvent('onmouseout', this);">
+                    <button type="button" id="buttonLog" class="ButtonLink" onclick="openServletNewWindow('DEFAULT', false, '../ad_forms/ShowLogFile.html?filePath=xx', 'Show Log', null, false, 600, 900, null, null, false, null, true);" onfocus="buttonEvent('onfocus', this); window.status='Show log'; return true;" onblur="buttonEvent('onblur', this);" onkeyup="buttonEvent('onkeyup', this);" onkeydown="buttonEvent('onkeydown', this);" onkeypress="buttonEvent('onkeypress', this);" onmouseup="buttonEvent('onmouseup', this);" onmousedown="buttonEvent('onmousedown', this);" onmouseover="buttonEvent('onmouseover', this); window.status='Show log'; return true;" onmouseout="buttonEvent('onmouseout', this);">
                       <table class="Button">
                         <tr>
                           <td class="Button_left"><img class="Button_Icon" alt="Show log" title="Show log" src="../web/images/blank.gif" border="0"/></td>
--- a/src/org/openbravo/erpCommon/ad_process/HeartbeatRedirect.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/HeartbeatRedirect.html	Fri Oct 29 23:05:42 2010 +0200
@@ -28,10 +28,14 @@
   <script language="JavaScript" src="../../../../../web/js/shortcuts.js" type="text/javascript"></script> 
   <script language="JavaScript" src="../../../../../web/js/utils.js" type="text/javascript"></script> 
   <script language="JavaScript" src="../../../../../web/js/windowKeyboard.js" type="text/javascript"></script>
-  <script language="JavaScript" type="text/javascript">    
-  function redirect() {  
-	  openLink('../HeartbeatConfiguration/HeartbeatConfiguration_Relation.html', 'appFrame');
-	  window.close();
+  <script language="JavaScript" type="text/javascript">
+  function redirect() {
+    if (!isWindowInMDIContext) {
+      openLink('../HeartbeatConfiguration/HeartbeatConfiguration_Relation.html', 'appFrame');
+    } else {
+      getFrame('LayoutMDI').OB.Layout.ViewManager.openView("ClassicOBWindow",  {viewId: "ClassicOBWindow", tabId: '1005400006', id: '1005400006', windowId: '1005400002', command: "DEFAULT", tabTitle: 'Heartbeat Configuration'});
+    }
+    closePage();
   }
   </script>
 </head>
--- a/src/org/openbravo/erpCommon/security/Login_F1.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/security/Login_F1.html	Fri Oct 29 23:05:42 2010 +0200
@@ -76,7 +76,7 @@
 }
 
 function redirectWhenInsideMDI() {
-  if (isWindowInMDITab) {
+  if (isWindowInMDIPage) {
     var LayoutMDI = getFrame('LayoutMDI');
     if (LayoutMDI && typeof parent.document.getElementById('framesetMenu') === "object") {
       LayoutMDI.location.href = parent.window.location.href;
@@ -121,7 +121,7 @@
       clearForm();
     } catch (e) {}
     setWindowElementFocus('firstElement');
-    if ((!revisionControl('8742')) || (isOpsInstance() != isOpsInstanceCached())) {
+    if ((!revisionControl('8778')) || (isOpsInstance() != isOpsInstanceCached())) {
       alert(cacheMsg);
     }
 
--- a/src/org/openbravo/erpCommon/utility/VerticalMenu.html	Fri Oct 29 09:22:41 2010 +0200
+++ b/src/org/openbravo/erpCommon/utility/VerticalMenu.html	Fri Oct 29 23:05:42 2010 +0200
@@ -102,7 +102,7 @@
       function updateAlert()
       {
           setMDIEnvironment();
-          if(isWindowInMDITab || isWindowInMDIContext) {
+          if(isWindowInMDIContext) {
             return;
           }
 
--- a/web/js/shortcuts.js	Fri Oct 29 09:22:41 2010 +0200
+++ b/web/js/shortcuts.js	Fri Oct 29 23:05:42 2010 +0200
@@ -149,7 +149,7 @@
       );
   } else if (type=='popupSpecificKeys') {
       this.keyArray.splice(keyArray.length-1, 0,
-        new keyArrayItem("ESCAPE", "parent.window.close();", null, null, false, 'onkeydown'),
+        new keyArrayItem("ESCAPE", "closePage();", null, null, false, 'onkeydown'),
         new keyArrayItem("ENTER", "xx();", null, "shiftKey", false, 'onkeydown')
       );
   }
--- a/web/js/utils.js	Fri Oct 29 09:22:41 2010 +0200
+++ b/web/js/utils.js	Fri Oct 29 23:05:42 2010 +0200
@@ -26,16 +26,21 @@
  * Code that will be executed once the file is parsed
 */
 function utilsJSDirectExecution() {
+  isWindowInMDIPopup = checkWindowInMDIPopup();
   isWindowInMDITab = checkWindowInMDITab();
+  isWindowInMDIPage = checkWindowInMDIPage();
   isWindowInMDIContext = checkWindowInMDIContext();
   if (isWindowInMDITab) {
     adaptSkinToMDIEnvironment();
   }
 }
 
+var isWindowInMDIPopup = false;
 var isWindowInMDITab = false;
+var isWindowInMDIPage = false;
 var isWindowInMDIContext = false;
 var isMDIEnvironmentSet = false;
+var MDIPopupId = null;
 
 var baseFrameServlet = "../security/Login_FS.html";
 var gColorSelected = "#c0c0c0";
@@ -89,7 +94,7 @@
 * Return a number that would be checked at the Login screen to know if the file is cached with the correct version
 */
 function getCurrentRevision() {
-  var number = '8742';
+  var number = '8778';
   return number;
 }
 
@@ -904,6 +909,7 @@
   return text;
 }
 
+var openPopUpMDICheck = false;
 /**
 * Opens a pop-up window and adds custom properties to it 
 * @param {String} url This is the URL to be loaded in the newly opened window.
@@ -923,7 +929,7 @@
 * @see #getArrayValue 
 * @see #submitCommandForm
 */
-function openPopUp(url, _name, height, width, top, left, checkChanges, target, doSubmit, closeControl, parameters, hasLoading) {
+function openPopUp(url, _name, height, width, top, left, checkChanges, target, doSubmit, closeControl, parameters, hasLoading, openInMDIPopup) {
   var appUrl = getAppUrl();
   var adds = "";
   var isPopup = null;
@@ -974,6 +980,22 @@
   if (doSubmit && (getArrayValue(parameters, "debug", false)==true)) {
     if (!depurar_validate_wrapper(getArrayValue(parameters, "Command", "DEFAULT"), null, "")) return false;
   }
+
+  if (isWindowInMDIPage && openInMDIPopup && isPopup == true) {
+    if (getFrame('LayoutMDI') && getFrame('LayoutMDI').OB && getFrame('LayoutMDI').OB.Layout && getFrame('LayoutMDI').OB.Layout.ClassicOBCompatibility && getFrame('LayoutMDI').OB.Layout.ClassicOBCompatibility.Popup && getFrame('LayoutMDI').OB.Layout.ClassicOBCompatibility.Popup.open) {
+      if (!openPopUpMDICheck) {
+        getFrame('LayoutMDI').OB.Layout.ClassicOBCompatibility.Popup.open(_name, width, height, "", "", window);
+        openPopUpMDICheck = true;
+      }
+
+      if (!getFrame('LayoutMDI').OB.Layout.ClassicOBCompatibility.Popup.isLoaded(_name)) {
+        setTimeout(function() { openPopUp(url, _name, height, width, top, left, checkChanges, target, doSubmit, closeControl, parameters, hasLoading, openInMDIPopup); }, 50);
+        return true;
+      }
+      openPopUpMDICheck = false;
+    }
+  }
+
   if (isPopup == true && hasLoading == true) {
     isPopupLoadingWindowLoaded=false;
     var urlLoading = appUrl + '/utility/PopupLoading.html';
@@ -1162,14 +1184,14 @@
 * @see #openPopUp 
 * @see #addArrayValue
 */
-function openHelp(windowId, url, _name, checkChanges, height, width, windowType, windowName) {
+function openHelp(windowId, url, _name, checkChanges, height, width, windowType, windowName, openInMDIPopup) {
   if (height==null) height = 450;
   if (width==null) width = 700;
   var parameters = new Array();
   parameters = addArrayValue(parameters, "inpwindowId", windowId, true);
   parameters = addArrayValue(parameters, "inpwindowType", windowType, true);
   parameters = addArrayValue(parameters, "inpwindowName", windowName, true);
-  return openPopUp(url, _name, height, width, null, null, checkChanges, null, null, true, parameters);
+  return openPopUp(url, _name, height, width, null, null, checkChanges, null, null, true, parameters, null, openInMDIPopup);
 }
 
 /**
@@ -1183,7 +1205,7 @@
 * @see #openPopUp 
 * @see #addArrayValue
 */
-function openServletNewWindow(Command, bolValidation, url, _name, processId, checkChanges, height, width, resizable, hasStatus, closeControl, hasLoading) {
+function openServletNewWindow(Command, bolValidation, url, _name, processId, checkChanges, height, width, resizable, hasStatus, closeControl, hasLoading, openInMDIPopup) {
   if (height==null) height = 350;
   if (width==null) width = 500;
   if (closeControl==null) closeControl = true;
@@ -1192,11 +1214,10 @@
   parameters = addArrayValue(parameters, "debug", bolValidation, false);
   if (processId!=null && processId!="") parameters = addArrayValue(parameters, "inpProcessId", processId, true);
   if (Command!=null && Command!="") parameters = addArrayValue(parameters, "Command", Command, false);
-
   if (navigator.userAgent.toUpperCase().indexOf("MSIE") != -1) {
-    setTimeout(function() {return openPopUp(url, _name, height, width, null, null, checkChanges, null, true, closeControl, parameters, hasLoading);},10);
+    setTimeout(function() {return openPopUp(url, _name, height, width, null, null, checkChanges, null, true, closeControl, parameters, hasLoading, openInMDIPopup);},10);
   } else {
-    return openPopUp(url, _name, height, width, null, null, checkChanges, null, true, closeControl, parameters, hasLoading);
+    return openPopUp(url, _name, height, width, null, null, checkChanges, null, true, closeControl, parameters, hasLoading, openInMDIPopup);
   }
 }
 
@@ -1228,13 +1249,13 @@
 * @see #openPopUp 
 * @see #addArrayValue
 */
-function editHelp(url, type, id, value, height, width) {
+function editHelp(url, type, id, value, height, width, openInMDIPopup) {
   if (height==null) height = 500;
   if (width==null) width = 600;
   var parameters = new Array();
   parameters = addArrayValue(parameters, "Command", type, true);
   parameters = addArrayValue(parameters, "inpClave", value, true);
-  return openPopUp(url, "HELP_EDIT", height, width, null, null, null, null, false, true, parameters);
+  return openPopUp(url, "HELP_EDIT", height, width, null, null, null, null, false, true, parameters, null, openInMDIPopup);
 }
 
 /**
@@ -1594,8 +1615,13 @@
 * Put the focus on the Menu frame
 */
 function putFocusOnMenu() {
-  if (parent.appFrame.selectedArea == 'tabs') parent.appFrame.swichSelectedArea();
-  parent.frameMenu.focus();
+  if (parent && parent.appFrame && parent.appFrame.selectedArea == 'tabs') {
+    parent.appFrame.swichSelectedArea();
+  }
+  if (parent && parent.frameMenu) {
+    parent.frameMenu.focus();
+  }
+
   return true;
 }
 
@@ -3088,6 +3114,29 @@
       }
 
       if (success == false) {
+        try {  //some typical cases to avoid go into the logic loop. try-catch to avoid security issues when executing Openbravo inside a frame or iframe
+          if (opener && opener.parent && opener.parent.frameMenu) {
+            targetFrame = window.opener.parent;
+            success = true;
+          } else if (parent && parent.opener && parent.opener.parent && parent.opener.parent.frameMenu) {
+            targetFrame = window.parent.opener.parent;
+            success = true;
+          } else  if (opener && opener.opener && opener.opener.parent && opener.opener.parent.frameMenu) {
+            targetFrame = window.opener.opener.parent;
+            success = true;
+          } else  if (opener && opener.opener && opener.opener.opener && opener.opener.opener.parent && opener.opener.opener.parent.frameMenu) {
+            targetFrame = window.opener.opener.opener.parent;
+            success = true;
+          } else  if (opener && opener.opener && opener.opener.opener && opener.opener.opener.opener && opener.opener.opener.opener.parent && opener.opener.opener.opener.parent.frameMenu) {
+            targetFrame = window.opener.opener.opener.opener.parent;
+            success = true;
+          }
+        } catch (e) {
+          success = false;
+        }
+      }
+
+      if (success == false) {
         targetFrame = 'window';
         var targetFrame_parent = 'window.parent';
         var targetFrame_opener = 'window.opener';
@@ -3155,12 +3204,27 @@
         targetFrame = null;
       }
     } else {
-      try {
-        targetFrame = top.opener;
-        while (targetFrame !== null && !LayoutMDICheck(targetFrame)) {
-          targetFrame = targetFrame.top.opener;
+      if (targetFrame === null) {  // For case of classic ob popups opened from a MDI tab
+        try {
+          targetFrame = top.opener;
+          while (targetFrame !== null && !LayoutMDICheck(targetFrame)) {
+            targetFrame = targetFrame.top.opener;
+          }
+        } catch (e) {
+          targetFrame = null;
         }
-      } catch (e) {
+      }
+      if (targetFrame === null) {  // For case of classic ob windows/popups opened inside a MDI modal popup
+        try {
+          targetFrame = parent;
+          while (targetFrame !== null && targetFrame !== targetFrame.parent && !LayoutMDICheck(targetFrame)) {
+            targetFrame = targetFrame.parent;
+          }
+        } catch (e) {
+          targetFrame = null;
+        }
+      }
+      if (!LayoutMDICheck(targetFrame)) {
         targetFrame = null;
       }
     }
@@ -4266,8 +4330,7 @@
 */
 function goToPreviousPage() {
   setMDIEnvironment();
-  var inMDIEnvironment = (isWindowInMDITab || isWindowInMDIContext); 
-  if (inMDIEnvironment) {
+  if (isWindowInMDIPage) {
     var appFrame = getFrame("appFrame");
     appFrame.history.back();
     return;
@@ -5274,6 +5337,16 @@
   return newString;
 }
 
+function closePage() {
+  if (isWindowInMDIPopup) {
+    getFrame('LayoutMDI').OB.Layout.ClassicOBCompatibility.Popup.close(MDIPopupId);
+  } else if (isWindowInMDITab) {
+  } else {
+    top.window.close();
+  }
+  return true;
+}
+
 /**
 * Start of functions to communicate with 3.0 tabbed interface
 */
@@ -5297,9 +5370,37 @@
   }
   isMDIEnvironmentSet = true;
 
-  if (isWindowInMDITab && typeof sendWindowInfoToMDI === "function") {
-    sendWindowInfoToMDI();
-  }
+  try {  // To avoid unhandled exceptions suchs a MDI modal popup
+    if (isWindowInMDITab && typeof sendWindowInfoToMDI === "function") {
+      sendWindowInfoToMDI();
+    }
+  } catch (e) {
+  }
+}
+
+/*
+ * Function that checks if the rendered html is contained inside a OB 3.0 popup or not.
+ */
+function checkWindowInMDIPopup(target) {
+  var result = true;
+
+  if (!target || target === "null" || target === "") {
+    target = window;
+  }
+
+  try {
+    while ((target.document !== target.parent.document) && (!target.document.getElementById('MDIPopupContainer'))) {
+      target = target.parent;
+    }
+  } catch (e) {
+  }
+
+  if (!target.document.getElementById('MDIPopupContainer')) {
+    result = false;
+  } else {
+    MDIPopupId = target.document.getElementById('MDIPopupContainer').name;
+  }
+  return result;
 }
 
 /*
@@ -5308,19 +5409,34 @@
 function checkWindowInMDITab(target) {
   var result = true;
 
-  if (!target || target === "null" || target === "") {
-    target = window;
-  }
-
-  try {
-    while ((target.document !== target.parent.document) && (!LayoutMDICheck(target))) {
-      target = target.parent;
+  if (isWindowInMDIPopup === true) {
+    result = false;
+  } else {
+    if (!target || target === "null" || target === "") {
+      target = window;
     }
-  } catch (e) {
-  }
-
-  if (!LayoutMDICheck(target)) {
-    result = false;
+
+    try {
+      while ((target.document !== target.parent.document) && (!LayoutMDICheck(target))) {
+        target = target.parent;
+      }
+    } catch (e) {
+    }
+
+    if (!LayoutMDICheck(target)) {
+      result = false;
+    }
+  }
+  return result;
+}
+
+/*
+ * Function that checks if the rendered html is contained inside a OB 3.0 page or not.
+ */
+function checkWindowInMDIPage(target) {
+  var result = false;
+  if (isWindowInMDIPopup === true || isWindowInMDITab === true) {
+    result = true;
   }
   return result;
 }
@@ -5335,7 +5451,7 @@
     target = window;
   }
 
-  if (isWindowInMDITab) {
+  if (isWindowInMDIPage) {
     result = true;
   } else {
     var LayoutMDI = getFrame('LayoutMDI');