﻿        var oPopupWindow;
        function jsClosePopupWindow() 
        {
              var sWindowProperties,sToolbar,sMenubar,PopupHeight,PopupWidth,iWindowTopPosition,iWindowLeftPosition,sScrollable,sResizable ;
              sWindowProperties = 'toolbar='+sToolbar+',menubar='+sMenubar+',height='+PopupHeight+',width='+PopupWidth+',top='+iWindowTopPosition+',left='+iWindowLeftPosition+',scrollbars='+sScrollable+',resizable='+sResizable;
                
              if (oPopupWindow != null) 
              {            
                    if ((oPopupWindow.closed) || (oPopupWindow.WindowIsClosing)) 
                    {
                        oPopupWindow = null;
                        return;
                    }
                    
                    if (oPopupWindow.IsModalWindow()) 
                    {
                        oPopupWindow.focus();
                        return;
                    }
                    else 
                    {
                        if (oPopupWindow.closed == false)
                        oPopupWindow.close();    
                        oPopupWindow = null;
                    }
              }
        }  
        
        /*
        function jsMessageSend22() 
        {
          //for (int i = 0; i < 
          var oThisForm = document.forms[0];
          //for (var i = 0; i < oThisForm.length; i++)
            //  alert(oThisForm[i].name + "-->" + oThisForm[i].value);
          //return false;
          var PopupURL = "/Message/fMessageSend.asp?hdUID=rgdeveloper";          
          var PopupWidth = 800;
          var PopupHeight = 400;
          var PopupScrollable = true;
          var PopupResizable = true;
          var PopupShowToolbar = false;
          var PopupShowMenubar = false;
          var PopupShowRGMenubar = false;
          var iWindowLeftPosition = (screen.width - PopupWidth) / 2;
          var iWindowTopPosition = (screen.height - PopupHeight) / 2;          
          var sWindowProperties = 'toolbar=false,menubar=false,height=400,width=800,top='+iWindowTopPosition+',left='+ iWindowLeftPosition+',scrollbars=true,resizable=true';
          window.open(PopupURL,"",sWindowProperties); 
         }
         */
         
         function jsMessageSend2() 
         {
              var oThisForm = document.forms[0];
              PopupURL = "/Message/fPendingMessage.asp";
              //PopupWidth = screen.width - 400;
              //PopupHeight = screen.height - 200;
              PopupWidth = 800;
              PopupHeight = 400;
              PopupScrollable = true;
              PopupResizable = true;
              PopupShowToolbar = false;
              PopupShowMenubar = false;
              PopupShowRGMenubar = false;
              jsSetKeyName("MessageID");
              jsSetSelectOption("equals");
              jsSetMessageID(oThisForm.MessageID.value);
              jsSetPopupMode("Edit");
              jsRunPopup();
        }
      
      function jsRunPopup() 
      {
          if (jsIsBlank(PopupURL)) 
          {
            alert("A valid URL is expected in order for the popup window to work.")
            return false;
          }
          var oForm = document.forms[0];
          var sResizable,sToolbar,sMenubar;
          var iWindowLeftPosition = (screen.width - PopupWidth) / 2;
          var iWindowTopPosition = (screen.height - PopupHeight) / 2;
          var sPopupShowToolbar, sPopupShowMenubar;

          if (PopupResizable) 
            sResizable = 'yes';
          else
            sResizable = 'no';
            
          if (PopupShowToolbar) 
            sToolbar = 'yes';
          else
            sToolbar = 'no';
            
          if (PopupShowMenubar)
            sMenubar = 'yes';
          else
            sMenubar = 'no';
            
          if (PopupScrollable)
            sScrollable = 'yes';
          else
            sScrollable = 'no';

         sWindowProperties = 'toolbar='+sToolbar+',menubar='+sMenubar+',height='+PopupHeight+
                              ',width='+PopupWidth+',top='+iWindowTopPosition+',left='+
                             iWindowLeftPosition+',scrollbars='+sScrollable+',resizable='+sResizable; 

         oPopupWindow = window.open('','',sWindowProperties)
         
         oPopupWindow.document.write('<html><head><title>Window Is Openning...</title></head>\n');
         oPopupWindow.document.write('<body><form method="POST" name="NewForm" action="' + PopupURL + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdUID" value="' + oForm.hdUID.value + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdClientName" value="' + oForm.hdClientName.value + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdClientID" value="' + oForm.hdClientID.value + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdDBName" value="' + oForm.hdDBName.value + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdSessionID" value="' + oForm.hdSessionID.value + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdDateFormat" value="' + oForm.hdDateFormat.value + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdIsPopup" value="' + "true" + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdCallerPageName" value="' + oForm.hdPageName.value + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdCallerURL" value="' + oForm.hdCallerURL.value + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdPageName" value="' + oForm.hdPageName.value + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="SelectBy" value="' + sPopupKeyName + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="PopupKeyName" value="' + sPopupKeyName + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="SelectOption" value="' + sPopupSelectOption + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="PopupSelectOption" value="' + sPopupSelectOption + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="SearchString" value="' + sPopupKeyValue + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="PopupString" value="' + sPopupKeyValue + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdSearchMode" value="' + sPopupSearchMode + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="hdSortField" value="' + sPopupKeyName + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="SortBy" value="' + sPopupKeyName + '">\n');
         oPopupWindow.document.write('<input type="hidden" name="MessageID" value="' + oForm.MessageID.value + '">\n');
         if (PopupIsModal) 
           oPopupWindow.document.write('<input type="hidden" name="ModalWindow" value="' + "1" + '">\n');
         else
           oPopupWindow.document.write('<input type="hidden" name="ModalWindow" value="' + "0" + '">\n');
         PopupIsModal = false;
         if (!PopupShowRGMenubar) oPopupWindow.document.write('<input type="hidden" name="hdDisableMenu" value="' + "1" + '">\n');
         oPopupWindow.document.write("</form></body></html>");
         
         oPopupWindow.document.write('<script language="JavaScript">');
         oPopupWindow.document.write('document.NewForm.submit();');
         oPopupWindow.document.write('</script>');
         PopupIsModal = false;
         //InitializePopup();
    }


     


