/*  Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    ToolsRel: 8.51.10 */
// JScript File
/* Constructor */
function PT_popup(form)
{this.Initialized = false;}

PT_popup.prototype = {
init:function(URL1,sT1,URL2,sT2,URL3,sT3,URL4,URL5,sT5,sT6)
{
    this.popMaskScrollWidth=0;       // save mask scrollwidth
    this.popMaskScrollHeight=0;      // save mask scrollheight
    this.stateNumName = "ICStateNum";
    this.elemNumName ="ICElementNum";
    this.okbutton = "#ICOK";
    this.cancelbutton = "#ICCancel";
    this.bmainSearchpage=false;       // main page is search page or not
    this.selectvalues = new Array();
    this.initResizeCounter = -1;
    this.moveCounter = -1;
    this.startEventPos = new Array();
    this.startPosWindow = new Array();
    this.startWindowSize = new Array();
    this.windowMinSize = [160,150];
    this.msg = null;
    this.fid=null;
    this.mouseOffset=0;     // distance between mouse and the container of the dragable object 
    this.popupDragFrame = null; // a div used in the process of moving the modal window before mouse is up. 
    this.popMask = null;
    this.popup = null;
    this.popupFocus = null;
    this.popContainer = null;
    this.popContent = null;
    this.popInner = null;
    this.popFrame = null;
    this.popShadow = null;
    this.currWidth = 450;
    this.currHeight = 300;
    this.returnFunc = null;
    this.isShown = false;
    this.hideSelects = false;
    this.tabIndexes = new Array();
    this.msgArr = new Array();
//    this.tabbableTags = new Array("SELECT","A","BUTTON","TEXTAREA","IMG","INPUT","IFRAME");
    this.tabbableTags = new Array("INPUT","SELECT","TEXTAREA","BUTTON");
    this.url_closeimg = (typeof URL1 =="undefined" || !URL1) ? null: URL1;
    this.alt_close = (typeof sT1 =="undefined" || !sT1) ? '': sT1;
    this.url_minimg = (typeof URL2 =="undefined" || !URL2) ? null: URL2;
    this.alt_min = (typeof sT2 =="undefined" || !sT2) ? '': sT2;
    this.url_maximg = (typeof URL3 =="undefined" || !URL3) ? null: URL3;
    this.alt_max = (typeof sT3 =="undefined" || !sT3) ? '': sT3;
    this.url_iframe_processing = (typeof URL4 =="undefined" || !URL4) ? null: URL4;
    this.url_resizeimg = (typeof URL5 =="undefined" || !URL5) ? null: URL5;
    this.alt_resize = (typeof sT5 =="undefined" || !sT5) ? '': sT5;
    this.alt_move = (typeof sT6 =="undefined" || !sT6) ? '': sT6;
    if (browserInfoObj.version <= 6 && browserInfoObj.isIE)
        this.hideSelects = true;
    this.popup = document.getElementById("popup");
    if (this.popup == null){
        var div = document.createElement("div");
        div.innerHTML = "<div id='popup'></div>";
        document.body.appendChild(div.firstChild);
        this.popup = document.getElementById("popup");
    }
    if (typeof(bPromptPage_win0) != "undefined" && bPromptPage_win0)
        this.setResizeEvent_win0(document.documentElement);
    this.Initialized = true;
    
    ptEvent.add(window,"resize",this.setMaskSize);

    
    this.bshowMin = true;
    this.bshowMax = true;
    this.bshowClose = true;
    
    this.closeEvent = null;
    
    this.modalHeight = 0;
    this.modalWidth = 0;
    this.modalTitle = null;
    this.modalContent = null;
    this.modalContentID = null;
    
    this.bmodaliFrame = false;
    
    this.modalHTML = null;
    
   
    this.nMinHeight=140;  // default minimum height for grid zoom
    this.deferPromptScript = null;
    
    this.isModalWidget = false;
	this.hyperLinkAction = false;
    this.launchedFromModal = false;
    this.modalResendClose = false;
    this.sizeModalOnLoad = false;

    
    this.isModalElement = false;
    this.modalContentID = null;
    this.gridToolBar = null;
    this.gridFirstRowID = null;
    this.gridScrollID = null;
    this.gridName = null;
    this.gridScrollableAreaID = null;
    this.gridScrollableAreaHdrID = null;
    this.gridFrozenAreaID = null;
    this.gridWScrollContainerTopID = null;  // grid scrollable container id
    this.gridWScrollBodyTopID = null;       // grid scrollable body id
    this.gridOccurences = new Array();
    this.isSaveWarn = false; 

    this.nChildPrompts = 0;  
    this.updatePromptActn = false;  
    this.bPromptPageOpen = false;
    this.bPromptMessageOpen = false;   // message box displayed flag

    //oineza, 1877981000
    this.modalOccName = null;  

    
    this.isSwanSS = ((typeof(ptStyleSheet) == "undefined") || (ptStyleSheet.indexOf("SWAN") != -1)) ? true : false;
},

addMsg:function(msg)
{
    this.msgArr.push(msg);
},

showMsg:function(msg)
{
    if (this.isShown == true)
        return true;
    if (!msg){
        if (this.msgArr.length>0)
           msg = this.msgArr.shift();
        else
           return true;
    }

    var imsgTitleStart = 17;
    var imsgTitleEnd = msg.indexOf("</div>");
    var smsgTitle = "&nbsp";
    var contentMsg = msg;
    if (msg.indexOf("id=msgTitle") >= 0){
        smsgTitle = msg.substring(imsgTitleStart,imsgTitleEnd);
        contentMsg = msg.substr(imsgTitleEnd+6);
    }

    var popupPrompt = document.getElementById("popupPrompt");
    if (popupPrompt)
    {
    popupPrompt.style.display = "none";
    document.getElementById("popupMin").style.display = "none";
    document.getElementById("popupMax").style.display = "none";
    }
    var popTitle = document.getElementById("popupTitle");
    popTitle.innerHTML  = "<span id='PTPOPUP_TITLE' class='PTPOPUP_TITLE'>"+ smsgTitle+"</span></div>";
    var popMsg = document.getElementById("popupMsg");
    popMsg.innerHTML  = contentMsg;
    this.bPromptMessageOpen = true;   // flag message box is opened
    
    
    if (browserInfoObj.isIE)
    {
       var strArr= contentMsg.split("<br />");
       if (strArr.length > 12)
       {
       var ObjMsg= document.getElementById("alertmsg");
       if (ObjMsg)
          ObjMsg.style.height='300px';
       }
    }

    popMsg.style.display = "block";
    this.popMask = document.getElementById("popupMask");
    this.popContainer = document.getElementById("popupContainer");
    this.popInner = document.getElementById("popupInner");
    this.popShadow = document.getElementById("popupShadow");
    this.popContent = document.getElementById('popupContent');
    this.popContent.style.height="";
    this.isShown = true;
    this.prepFadeModal();
    this.popMask.style.display = "block";
    this.currWidth = 450;
    this.currHeight = 300;
    this.popContainer.style.width = this.currWidth;
    this.popContainer.style.height = this.currHeight;
    this.popContainer.style.display = "block";

    /** ICE 1877591000 **/
    var eAlertMsg = document.getElementById("alertmsg");
    var bWidthSet = false;
    var bHeightSet = false;
    if (popMsg.scrollWidth > this.currWidth) {
         if (typeof eAlertMsg != 'undefined') {
       if (browserInfoObj.isIE)
        eAlertMsg.style.width = this.currWidth + "px";
       popMsg.style.width = this.currWidth + "px";

       if (!browserInfoObj.isIE)
        this.currWidth += 3;

       bWidthSet = true;
       }
      }
    if (popMsg.scrollHeight > this.currHeight) {
      if (typeof eAlertMsg != 'undefined') {
       eAlertMsg.style.height = eAlertMsg.style.maxHeight;
       bHeightSet = true;
       }
      }
    //make room for the horizontal scroll if the width was set but not the height
    if (bWidthSet && !bHeightSet)
      eAlertMsg.style.height = (eAlertMsg.offsetHeight + 20) + "px";

    var oAB = document.getElementById('alertbutton');
    if (oAB && oAB.childNodes.length>0 && oAB.childNodes[0].childNodes.length>0 &&
        oAB.childNodes[0].childNodes[0].childNodes.length>0)
        ptCommonObj.tryFocus0(oAB.childNodes[0].childNodes[0].childNodes[0]);
    else if (oAB && oAB.childNodes.length>0 )
            ptCommonObj.tryFocus0(oAB.childNodes[0]);
    else {
        oAB = document.getElementById('okbutton');
        if (oAB && oAB.childNodes.length>0)
              ptCommonObj.tryFocus0(oAB.childNodes[0]);
    }


if (oAB && oAB.childNodes.length>0)
{
    var anchorEl = oAB.getElementsByTagName("A");
    if (anchorEl.length == 1 )
    {
    oAB.style.margin = "0 " + (oAB.parentNode.offsetWidth - anchorEl[0].offsetWidth)/2 + "px";
    if (!browserInfoObj.isIE)
    this.popContent.style.height = (this.popContent.offsetHeight   + 20) + "px";
    else
    this.popContent.style.height = (this.popContent.offsetHeight   + 15) + "px";
    }
 }


    this.popInner.style.width = this.currWidth + 'px';

    this.centerPromptWin(this.currWidth, this.currHeight);
    this.setMaskSize();
    this.popShadow.style.height = (this.popInner.offsetHeight + 4) + 'px';
    this.popShadow.style.width = (this.popInner.offsetWidth + 2) + 'px';
    
    if (!browserInfoObj.isIE)
        this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.popInner.offsetWidth + 1);
    else
        this.sizeShadowImageContainers(this.popInner.offsetHeight,this.popInner.offsetWidth);

    
    this.sizeTitle(this.popInner.offsetWidth);

    
    if (!browserInfoObj.isIE)
        document.getElementById("popupContent").style.height = (this.popInner.offsetHeight - 19) + 'px';
    if (this.hideSelects == true){
       this.hideSelectBoxes();
    }
    //window.setTimeout("setPromptTitle();", 600);
    this.initWindows_win0();
    this.fadeInModal();

    // set focus
    var elem = document.getElementById('popupMsg');
    if (elem) {
        var tagElements = elem.getElementsByTagName('*');
        this.popupFocus = this.setFocus(tagElements);
    } else {
        // if document has more than one form, set focus to first tabbable element of the last form
        var fID = document.forms.length - 1;
        if (fID > 0) {
            var f = document.forms[fID];
            this.popupFocus = this.setFocus(f.elements);
        }
    }

    
    if ((browserInfoObj.isIE) && ('ltr'=='rtl')) {
        var scLeft = parseInt((document.body.scrollWidth - document.body.clientWidth- document.body.scrollLeft),10);   // scrollleft
        if (scLeft > 500)
           document.body.scrollLeft=2000;  // set horizontal scroll to the right
    }

    return true;
},


showPrompt:function(name, form, url, ef)
{
this.bPromptPageOpen=true;
form.ICAction.value=name;
form.ICXPos.value=getScrollX();
form.ICYPos.value=getScrollY();
if (typeof form.ICTypeAheadID!='undefined'&& form.ICTypeAheadID.value!='') {
var flag = form.ICActionPrompt.value;
form.ICActionPrompt.value='false';
var ret =aAction_win0(form, name, "", true, true);
form.ICActionPrompt.value = flag;
return ret;
}
else {
form.ICActionPrompt.value='true';
return aAction_win0(form, name, "", true, true);
}
},

launchPrompt:function(name, form, url, ef)
{
    
    this.nChildPrompts = 0;
    this.bPromptPageOpen = true;

    this.form = form;
    if (typeof(bSearchDialog_win0)!="undefined" && bSearchDialog_win0)   // main page is a search page
       this.bmainSearchpage = true;
    else
       this.bmainSearchpage = false;
    var popupMsg = document.getElementById("popupMsg");
    popupMsg.style.display = "none";

    
    var popTitle = document.getElementById("popupTitle");
    popTitle.innerHTML  = "<span id='PTPOPUP_TITLE' class='PTPOPUP_TITLE'>" + 'Look Up' +"</span>";

    
    document.getElementById("popupBottom").style.height = "14px";
    document.getElementById("popupBottom").style.width = "100%";

    var popupPrompt = document.getElementById("popupPrompt");
    popupPrompt.style.display = "block";
    document.getElementById("popupMin").style.display = "none";
    document.getElementById("popupMax").style.display = "none";
    document.getElementById("popupClose").style.display = "block";

    document.getElementById("popupClose").innerHTML =
        "<IMG id=#MODALCLOSE title='" + this.alt_close + "' onclick=ptCommonObj.updatePrompt(); alt='" + this.alt_close + "'src='" + this.url_closeimg + "'>";

    this.isShown = true;

    
    document.getElementById("popupWidget").style.display = "none";

    this.popMask = document.getElementById('popupMask');
    this.popContent = document.getElementById('popupContent');
    this.popContainer = document.getElementById('popupContainer');
    this.popInner = document.getElementById('popupInner');
    this.popFrame = document.getElementById("popupFrame");
	this.popupFocus = this.popFrame;
    this.popShadow = document.getElementById("popupShadow");
    this.prepFadeModal();
    this.popMask.style.display = "block";
    this.popContainer.style.display = "block";
    document.getElementById("divpopupFrame").style.display = "block";
    this.currWidth = 500;
    this.currHeight = 400;
    this.centerPromptWin(this.currWidth, this.currHeight);
    this.setMaskSize();
    this.popFrame.style.dislay='block';
    if (browserInfoObj.isSafari && this.isSwanSS)
        this.popFrame.style.width = (this.currWidth - 4) + "px";
    else
        this.popFrame.style.width = (this.currWidth) + "px";
    this.popFrame.style.height = (this.currHeight) + "px";

	
	if (browserInfoObj.isIE)
		window.frames["popupFrame"].scrollTo(0,0);                

    
    if('ltr' == 'rtl')
      {
         this.popShadow.style.height = (this.popInner.offsetHeight + 7) + 'px';
         this.popShadow.style.width = (this.currWidth + 3) + 'px';
      }
    else
      {
         this.popShadow.style.height = (this.popInner.offsetHeight + 7) + 'px';
         if (browserInfoObj.isIE)  {
             if(this.isSwanSS)
               this.popShadow.style.width = (this.currWidth + 7) + 'px';
             else
               this.popShadow.style.width = (this.currWidth + 5) + 'px';
         }
         else  {
            if (browserInfoObj.isSafari)  {
              if(this.isSwanSS)
                 this.popShadow.style.width = (this.currWidth + 3) + 'px';
              else
                 this.popShadow.style.width = (this.currWidth + 5) + 'px';
            }
            else {
              if(this.isSwanSS)
                 this.popShadow.style.width = (this.currWidth + 7) + 'px';
              else
                 this.popShadow.style.width = (this.currWidth + 5) + 'px';
            }
         }
      }

    
    if('ltr' == 'rtl')
       {
         if (!browserInfoObj.isIE)
            this.sizeShadowImageContainers(this.popInner.offsetHeight + 2, this.currWidth + 2);
         else
            this.sizeShadowImageContainers(this.popInner.offsetHeight, this.currWidth + 1);
       }
    else
       {
         if (browserInfoObj.isIE)  {
            if(this.isSwanSS)
                this.sizeShadowImageContainers(this.popInner.offsetHeight, this.currWidth + 5);
            else
                this.sizeShadowImageContainers(this.popInner.offsetHeight, this.currWidth + 3);
         }
         else  {
            if (browserInfoObj.isSafari) {
              if(this.isSwanSS)
                  this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.currWidth + 2);
              else
                  this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.currWidth + 4);
            }
            else {
              if(this.isSwanSS)
                  this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.currWidth + 6);
              else
                  this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.currWidth + 4);
            }
         }
       }

    
    if (!browserInfoObj.isSafari && this.isSwanSS)
        this.sizeTitle(this.currWidth + 4);
    else
        this.sizeTitle(this.currWidth);

    //gReturnFunc = returnFunc;
    if (this.hideSelects == true)
        this.hideSelectBoxes();
    ptCommonObj.tryFocus0(this.popInner);
    this.initWindows_win0();
    this.fadeInModal();
},

prepFadeModal:function(){
  if (browserInfoObj.isIE){
    this.popMask.style.filter = "alpha(opacity=0)";
    this.popInner.style.filter = "alpha(opacity=0)";
    this.popShadow.style.display = "none";
  }
  else {
    this.popMask.style.opacity = 0;
    this.popContainer.style.opacity = 0;
  }
},

fadeInModal:function(bModalElement){
if (typeof bModalElement == 'undefined')    {
  ptCommonObj.fadeElement("popupMask", 0, 40, 50, 20, 10);   
  if (browserInfoObj.isIE)  {
    var t = ptCommonObj.fadeElement("popupInner", 0, 90, 100, 20, 10);  
    setTimeout("popupObj_win0.popShadow.style.display = 'block'", t*40);
  }
  else
     ptCommonObj.fadeElement("popupContainer", 0, 90, 100, 20, 10);  
}
else {
  ptCommonObj.fadeElement("popupMaskModal", 0, 40, 50, 20, 10);  
  if (browserInfoObj.isIE)  {
    var t = ptCommonObj.fadeElement("popupInnerModal", 0, 90, 100, 20, 10);  
    setTimeout("popupModalObj_win0.popShadow.style.display = 'block'", t*40);
  }
  else
     ptCommonObj.fadeElement("popupContainerModal", 0, 90, 100, 20, 10);  
}
},

showModal:function(url, optionsarray)
{
this.showModalCntrl(null, null, url, optionsarray);
},

clearModalContent: function(bMove) {
if (this.popupContent) {     
	if (bMove)
		this.form.ICZoomGridRt.value = '1';
	else {
            this.form.ICZoomGridRt.value = '';
            this.popupContent.innerHTML = "";
         }
    }
},

hideModalElement: function() {
    HelppopupObj_win0.StopPopup(); 
    if (!this.isShown) return;
    if (this.popMask)
        this.popMask.style.display = "none";
    if (this.popContainer) {
        this.popContainer.style.width = "";
        this.popContainer.style.display = "none";
	}
    popupModalObj_win0.isModalElement = false;
    this.isModalWidget = false;
    this.form.ICModalWidget.value = '';
    this.form.ICZoomGrid.value = '';
    this.form.ICZoomGridRt.value = '1';
    this.isShown = false;
    bModalPage_win0 = false;
    var theBody = document.getElementsByTagName("BODY")[0];
    theBody.style.overflow = "auto";
 },

sizeModal:function()
{
    
    
    
    var okbuttonHeight = document.getElementById("popupOkButtonModal").offsetHeight;
    var okbuttonOffsetTop = document.getElementById("popupOkButtonModal").offsetTop;
    var contentModalOffsetTop = document.getElementById("popupContentModal").offsetTop;
    var contentContainerModalOffsetTop = document.getElementById("popupContentContainerModal").offsetTop;
    var elementHeight = okbuttonHeight + okbuttonOffsetTop + contentModalOffsetTop + contentContainerModalOffsetTop;
    if (!browserInfoObj.isIE) 
        var elementWidth = this.popupContent.offsetWidth;
    else 
        var elementWidth = this.popupContent.firstChild.firstChild.offsetWidth;
        
    var viewportHeight = ptCommonObj.getViewportHeight();
    var viewportWidth = ptCommonObj.getViewportWidth();
    if ((elementHeight + 10) > viewportHeight) {
        if (!browserInfoObj.isIE) 
            this.currHeight = viewportHeight - 80;
        else
            this.currHeight = viewportHeight - 75;
        document.getElementById("popupContentContainerModal").style.height = this.currHeight + "px";
        }
    else  {
        this.currHeight = elementHeight;
        document.getElementById("popupContentContainerModal").style.height = this.currHeight + "px";
        }

    if (elementWidth > viewportWidth) {
         this.currWidth = viewportWidth - 50;
         document.getElementById("popupContentContainerModal").style.width = this.currWidth + "px";
         if(this.isSwanSS && !browserInfoObj.isIE) {
            document.getElementById("popupContentContainerModal").style.width = (this.currWidth - 4) + "px";
            document.getElementById("popupBottomModal").style.width = (this.currWidth - 4) + "px";
          }
        }
    else
        {
          this.currWidth = elementWidth + 25;
          document.getElementById("popupContentContainerModal").style.width = this.currWidth + "px";
          if(this.isSwanSS && !browserInfoObj.isIE) {
            document.getElementById("popupContentContainerModal").style.width = this.currWidth - 4 + "px";
            document.getElementById("popupBottomModal").style.width = this.currWidth - 4 + "px";
          }
        }

    
    if (browserInfoObj.isIE)
       this.windowMinSize = [this.currWidth,this.currHeight];
    else
       this.windowMinSize = [this.currWidth - 4 ,this.currHeight - 10];

    
    this.sizeTitle(this.currWidth, true);

    
    if (browserInfoObj.isIE) {
        if('ltr' == 'ltr')    {
             this.popShadow.style.height = (this.popInner.offsetHeight + 7) + 'px';
             this.popShadow.style.width = (this.popInner.offsetWidth + 3) + 'px';
             this.sizeShadowImageContainers(this.popInner.offsetHeight,this.popInner.offsetWidth + 1, true);
             }
        else {
             this.popShadow.style.height = (this.popInner.offsetHeight + 7) + 'px';
             if(this.isSwanSS) {
                this.popShadow.style.width = (this.popInner.offsetWidth + 3) + 'px';
                this.sizeShadowImageContainers(this.popInner.offsetHeight , this.popInner.offsetWidth + 1, true);
              }
             else {
                this.popShadow.style.width = (this.popInner.offsetWidth + 1) + 'px';
                this.sizeShadowImageContainers(this.popInner.offsetHeight , this.popInner.offsetWidth - 1, true);
             }
        }
    }
    else {
       if (browserInfoObj.isSafari) {
         if('ltr' == 'ltr') {
           this.popShadow.style.height = (this.popInner.offsetHeight + 7) + 'px';
           this.popShadow.style.width = (this.popInner.offsetWidth + 3) + 'px';
           this.sizeShadowImageContainers(this.popInner.offsetHeight + 2, this.popInner.offsetWidth + 2, true);
         }
         else   {
           this.popShadow.style.height = (this.popInner.offsetHeight + 7) + 'px';
           if(this.isSwanSS)  {
             this.popShadow.style.width = (this.popInner.offsetWidth + 3) + 'px';
             this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.popInner.offsetWidth + 2, true);
           }
           else {
             this.popShadow.style.width = (this.popInner.offsetWidth + 1) + 'px';
             this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.popInner.offsetWidth, true);
           }
         }
       }
       else {
         if('ltr' == 'ltr') {
           this.popShadow.style.height = (this.popInner.offsetHeight + 7) + 'px';
           this.popShadow.style.width = (this.popInner.offsetWidth + 3) + 'px';
           this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.popInner.offsetWidth + 2, true);
         }
         else   {
           this.popShadow.style.height = (this.popInner.offsetHeight + 7) + 'px';
           if(this.isSwanSS)  {
              this.popShadow.style.width = (this.popInner.offsetWidth + 3) + 'px';
              this.sizeShadowImageContainers(this.popInner.offsetHeight + 2, this.popInner.offsetWidth + 2, true);
           }
           else {
              this.popShadow.style.width = (this.popInner.offsetWidth + 1) + 'px';
              this.sizeShadowImageContainers(this.popInner.offsetHeight + 2, this.popInner.offsetWidth, true);
           }
         }
       }
    }
},

sizeGridZoomElement:function()
{

    
    var popupContentContainerModal = document.getElementById('popupContentContainerModal');  // modal container
    var viewportHeight = ptCommonObj.getViewportHeight();
    var viewportWidth = ptCommonObj.getViewportWidth();
    var popupContentModal = document.getElementById('popupContentModal');                    // modal content residing in the container
    var popupBottomModal = document.getElementById('popupBottomModal');                      // modal return button area

    
    popupContentContainerModal.scrollLeft=500;  
    if (popupContentContainerModal.scrollLeft>0 && (this.currWidth+popupContentContainerModal.scrollLeft)<viewportWidth)  {  
        this.currWidth=this.currWidth+popupContentContainerModal.scrollLeft;
        popupContentContainerModal.style.width = this.currWidth + "px";          // popup width
        if(this.isSwanSS && !browserInfoObj.isIE) {
            popupContentContainerModal.style.width = (this.currWidth - 4) + "px";
            popupBottomModal.style.width = (this.currWidth - 4) + "px";
        }
    }
    popupContentContainerModal.scrollLeft=0;   // reset modal's horizonal scrollbar to the beginning
    
    
    popupContentContainerModal.scrollTop=500;  
    var i_newHeight=this.currHeight - 150;   // new height for grid later
    
    if (popupContentContainerModal.scrollTop>0 && (this.currHeight+popupContentContainerModal.scrollTop+20)<viewportHeight)  {  
        this.currHeight=this.currHeight+popupContentContainerModal.scrollTop;
        popupContentContainerModal.style.height = this.currHeight + "px";
        var oScroll = document.getElementById(this.gridScrollID);
        if (oScroll) 
            popupContentModal.style.height = oScroll.offsetHeight + "px";
    }
    
    else if (popupContentContainerModal.scrollTop>0 && i_newHeight > 90 && this.isVScrollVisible_win0())  // modal window and grid verticalbars exist.  Reduce grid height
    {
        
        var modalElementRight = document.getElementById(this.gridScrollableAreaID);        // grid scrollable area's unfrozen section
        var modalElementRightHdr = document.getElementById(this.gridScrollableAreaHdrID);
        if (modalElementRight)
            modalElementRight.style.height = i_newHeight + 'px';
        
        var oScroll = document.getElementById(this.gridScrollID);
        if (oScroll) 
            oScroll.style.height =  i_newHeight + 'px';
       
        
        var modalElementLeft = document.getElementById(this.gridFrozenAreaID);  // grid scrollable area's frozen section
        if (modalElementLeft) 
            modalElementLeft.style.height = i_newHeight + 'px';
            
        
        var modalElementToolBar = document.getElementById(this.gridToolBar);
        if (modalElementToolBar && modalElementLeft)
            modalElementToolBar.style.width = (modalElementLeft.offsetWidth + modalElementRight.offsetWidth) + 'px';
        
        
        var gridContainerTop = document.getElementById(this.gridWScrollContainerTopID);   
        var iHeight =  i_newHeight + 39;
        if (browserInfoObj.isIE) 
            {
            var iH100 = iHeight - 100;
            var iH50 = iHeight - 50;
            if (iH100>100)
                iHeight = iH100;
            else if (iH50>75)
                iHeight = iH50;
            }
        if (gridContainerTop)
           gridContainerTop.style.height = iHeight + "px";

        
        var gridWScrollBodyTop = document.getElementById(this.gridWScrollBodyTopID); 
        if (gridWScrollBodyTop)
            gridWScrollBodyTop.style.height = iHeight + "px";

        
        var gridScroll = document.getElementById(this.gridScrollID); 
        if (gridScroll)
            gridScroll.style.height = iHeight + "px";
        
        
        popupContentModal.style.height = this.currHeight - 63 + "px";
        
    }
    else if (popupContentContainerModal.scrollTop>0 && i_newHeight > 90)  // modal window and grid verticalbars don't exist.  Increase grid height
        {
        var oScroll = document.getElementById(this.gridScrollID);
        if (oScroll) 
            popupContentModal.style.height = oScroll.offsetHeight + "px";
        }
    
    popupContentContainerModal.scrollTop=0; 

    
    if (browserInfoObj.isIE)
       this.windowMinSize = [this.currWidth,this.currHeight];
    else
       this.windowMinSize = [this.currWidth - 4 ,this.currHeight - 10];

    
    this.sizeTitle(this.currWidth, true);
},


showModalElement:function(form, name, url, optionsarray)
{
    HelppopupObj_win0.StopPopup(); 
    
    this.form = form;
    this.isShown = true;

    //flag this as a modal other than a prompt
    this.isModalWidget = true;

    //opening content in a modal pop-up, set this form variable to true so that the app server
    //knows that the content is in a modal pop-up
    //this is for page generation stuff and quite possibly pcode
    if (this.form != null)
        {
        this.form.ICModalWidget.value = '1';
        this.form.ICZoomGrid.value = '1'
        bModalPage_win0 = true;
        }

    //setup caller options
    if (optionsarray) {
        this.bshowMin = optionsarray[0];
        this.bshowMax = optionsarray[1];
        this.bshowClose = optionsarray[2];
        this.closeEvent = optionsarray[3];
        this.modalHeight = optionsarray[4];
        this.modalWidth = optionsarray[5];
        this.modalTitle = optionsarray[6];
        this.modalTitle = "";        // set empty title for grid zoom title due to its interference with grid zoom move in IE browser
        this.modalContent = optionsarray[7];
        this.modalContentID = optionsarray[8];
        }

    
    if (this.modalContentID) {
        //var elementName = this.modalContentID;
        var exp = "win0" + "div";  //assuming that the overall grid content id is always win0divGridName$index
        var gridNameParts = this.modalContentID.split(exp);
        this.gridToolBar = "win0" + "divG" + gridNameParts[1];

        var gridScrollParts = gridNameParts[1].split("$");
        this.gridName = gridScrollParts[0];
        this.gridScrollID = gridScrollParts[0] + "$scrolli$" + gridScrollParts[1];
        this.gridScrollableAreaID = "divgbr" + gridNameParts[1]; //assuming that divgbrGridName$index is the scrollable area if the grid
        this.gridScrollableAreaHdrID = "divghrc" + gridNameParts[1];
        this.gridFrozenAreaID = "divgbl" + gridNameParts[1]; //assuming that divgblGridName$index is the scrollable area if the grid
        this.gridWScrollContainerTopID = "divgc" + gridNameParts[1]; // get the grid scrollable container name from the C++ function "CRTGridFieldOccursHTML::GenerateWScrollContainerTop" 
        this.gridWScrollBodyTopID = "divgb" + gridNameParts[1]; // get the grid scrollable body name from the C++ functionCRTGridFieldOccursHTML::GenerateWScrollBodyTop
        
        
	for ( var g = 0; g < gridList_win0.length; g++ ) {
	    
	    
	    if ( gridList_win0[g][0] == gridNameParts[1] ) {
	        
		this.gridFirstRowID = "tr" + gridNameParts[1] + "_row" + ( gridList_win0[g][1] + 1 ); //id of the first data row, needed for resizing
		break;
		}
	    }
        }


    this.popup = document.getElementById("popupModal");

    this.popMask = document.getElementById("popupMaskModal");
    this.popMask.style.display = 'block';

    this.popContainer = document.getElementById("popupContainerModal");
    this.popContainer.style.display = 'block';

    this.popInner = document.getElementById("popupInnerModal");
    this.popInner.className = 'PTPOPUP_INNER';

    this.popShadow = document.getElementById("popupShadowModal");
    this.prepFadeModal();
    this.popMask.style.display = 'block';
    this.popContainer.style.display = 'block';

    this.popupTitleBar = document.getElementById("popupTitleBarModal");
    this.popupTitleBar.className = 'PTPOPUP_HEADER';

    this.popupTitle = document.getElementById("popupTitleModal");

    
    document.getElementById("PTPOPUP_TITLEModal").innerHTML = this.modalTitle;

    this.popupTitle.alt = this.alt_move;
    this.popupTitle.title = this.alt_move;

    //setup minimize button
    this.popupMin = document.getElementById("popupMinModal");
    this.popupMin.style.display = "none";

    //setup maximize button
    this.popupMax = document.getElementById("popupMaxModal");
    this.popupMax.style.display = "none";

    //setup close button
    this.popupClose = document.getElementById("popupCloseModal");
    this.popupClose.style.display = "none";

    
	this.popupContent = document.getElementById("popupContentModal");
	this.oldnode = document.getElementById(this.modalContentID);   
	this.oldnode.innerHTML = "";
	var modalElement = document.createElement("div");
	modalElement.innerHTML = this.modalContent.firstChild.data;
	this.popupContent.innerHTML = "";
	this.popupContent.appendChild(modalElement);

    this.popupBottom = document.getElementById("popupBottomModal");
    this.popupBottom.style.display = 'block';
    this.popupBottom.onmousedown = 'this.initResizeWindow';

    document.getElementById("popupBottomModal").style.height = "14px";
    document.getElementById("popupBottomModal").style.width = "100%";

    var resizeImg = document.getElementById('popupResizeImgModal');
    if (resizeImg) {
            resizeImg.src=this.url_resizeimg;
            resizeImg.alt=this.alt_resize;
            resizeImg.title=this.alt_resize;
            if (browserInfoObj.isIE)
               resizeImg.style.styleFloat='right';
            else
               resizeImg.style.cssFloat='right';
            if('ltr' == 'rtl')
               resizeImg.style.cursor = 'ne-resize';
    }

    
    this.sizeModal();
    
    this.sizeGridZoomElement();    

    
    this.centerPromptWin(this.currWidth, this.currHeight, true);
    this.setMaskSize(true);

    if (this.hideSelects == true)
        this.hideSelectBoxes();

    this.initElementWindows_win0();
    this.fadeInModal(true);
},


showModalHyperLink:function(form, name, url, optionsarray)
{
	this.hyperLinkAction = true;

	if (optionsarray) {
		this.bshowMin = optionsarray[0];
		this.bshowMax = optionsarray[1];
		this.bshowClose = optionsarray[2];
		this.closeEvent = optionsarray[3];
		this.modalHeight = optionsarray[4];
		this.modalWidth = optionsarray[5];
		this.modalTitle = optionsarray[6];
		this.bmodaliFrame = optionsarray[7];
		this.modalHTML = optionsarray[8];	
	} 

	if (typeof url != 'undefined' && url == null) {
		
		this.isModalWidget = false;
		document.getElementById("ICModalWidget").value = "0";
		this.sizeModalOnLoad = true;
	}
	else {
		
		this.isModalWidget = true;
		document.getElementById("ICModalWidget").value = 1; 
		
		if (typeof window.parent.popupObj_win0 != "undefined" && window.parent.popupObj_win0 
					&& window.parent.popupObj_win0.isShown) {

			
			this.sizeModalOnLoad = true;
			resizeVar = document.getElementById("ICSizeModalOnLoad");
			if (resizeVar) {
				resizeVar.value = 1;
				document.getElementById("ICModalHeight").value = this.modalHeight;
				document.getElementById("ICModalWidth").value = this.modalWidth;
			}
		}
		else {
			
			this.hyperLinkAction = false;
			return this.showModalCntrl(form, name, url, optionsarray, this.hyperLinkAction);
		}
		
	}
	
	return submitAction_win0(form, name);

},

showModalCntrl:function(form, name, url, optionsarray, bHyperlink)
{
    HelppopupObj_win0.StopPopup(); 
    this.isModalWidget = true;
    this.form = form;

    //this window is opened from a modal window
    if (document.getElementById("ICModalWidget").value == "1")
       this.launchedFromModal = true;
    else
       this.launchedFromModal = false;

    //opening content in a modal pop-up, set this form variable to true so that the app server
    //knows that the content is in a modal pop-up
    //this is for page generation stuff and quite possibly pcode
    if (this.form != null)
        this.form.ICModalWidget.value = '1';

    //oineza, 1877981000
    
    if (typeof name != 'undefined' && name != null) {
        var occParts = name.split("$");
        if (occParts.length == 3)
            this.modalOccName = occParts[0] + "$" + occParts[2];
        else
            this.modalOccName = occParts[0];
        }

    //setup caller options
    if (optionsarray) {
        this.bshowMin = optionsarray[0];
        this.bshowMax = optionsarray[1];
        this.bshowClose = optionsarray[2];
        this.closeEvent = optionsarray[3];
        this.modalHeight = optionsarray[4];
        this.modalWidth = optionsarray[5];
        this.modalTitle = optionsarray[6];
        this.bmodaliFrame = optionsarray[7];
        this.modalHTML = optionsarray[8];

        if (typeof optionsarray[9] != 'undefined')
            this.sizeModalOnLoad = optionsarray[9];
        else
            this.sizeModalOnLoad = false;
        }

    if (typeof(bSearchDialog_win0)!="undefined" && bSearchDialog_win0)   // main page is a search page
       this.bmainSearchpage = true;

    
    if (this.form != null) {
        var cObj = this.getChangedObj();
        if (cObj && this.deferPromptScript==null){
            this.deferPromptScript = "mAction_"+this.form.name+"(document."+this.form.name+",'"+name+"',"+this.modalHeight+","+this.modalWidth+",'"+this.modalTitle+"');";
            var sScript = "aAction_"+this.form.name+"(document."+this.form.name+",'"+cObj.id+"');";
            eval(sScript);
            return;
            }
        }

    this.isShown = true;

    
    document.getElementById("popupBottom").style.height = "14px";
    document.getElementById("popupBottom").style.width = "100%";

    document.getElementById("popupPrompt").style.display = 'block';
    document.getElementById("popupMsg").style.display = 'none';

    this.popup = document.getElementById("popup");
    this.popMask = document.getElementById("popupMask");
    this.popContainer = document.getElementById("popupContainer");
    this.popInner = document.getElementById("popupInner");
    this.popShadow = document.getElementById("popupShadow");
    this.prepFadeModal();
    this.popMask.style.display = 'block';
    this.popContainer.style.display = 'block';

    
    document.getElementById("divpopupFrame").style.display = "none";

    this.popupTitleBar = document.getElementById("popupTitleBar");
    this.popupTitleBar.className = 'PTPOPUP_HEADER';

    var popTitle = document.getElementById("popupTitle");

    
    popTitle.innerHTML  = "<span id='PTPOPUP_TITLE' class='PTPOPUP_TITLE'>"+ "" +"</span>";
    this.popupTitle = document.getElementById("PTPOPUP_TITLE");
    this.popupTitle.alt = this.alt_move;
    this.popupTitle.title = this.alt_move;

    
    this.popupMin = document.getElementById("popupMin");
    if (!this.bshowMin)
        this.popupMin.style.display = "none";
    else {
        this.popupMin.style.display = "";
        this.popupMin.className = 'titleButton';
        var minImg = document.getElementById('#MODALMIN');
        if (minImg) {
            minImg.src=this.url_minimg;
            minImg.alt=this.alt_min;
            minImg.title=this.alt_min;
            ptEvent.add(minImg, "click", popupObj_win0.minmax);
            }
    }

    
    this.popupMax = document.getElementById("popupMax");
    if (!this.bshowMax)
        this.popupMax.style.display = "none";
    else {
        this.popupMax.style.display = "";
        this.popupMax.className = 'titleButton';
        var maxImg = document.getElementById('#MODALMAX');
        if (maxImg) {
            maxImg.src=this.url_maximg;
            maxImg.alt=this.alt_max;
            maxImg.title=this.alt_max;
            ptEvent.add(maxImg, "click", popupObj_win0.minmax);
            }
        }

    
    this.popupClose = document.getElementById("popupClose");
    if (!this.bshowClose)
        this.popupClose.style.display = "none";
    else
        this.popupClose.innerHTML = "<img id='#MODALCLOSE' src='"+this.url_closeimg+"'onclick=javascript:ptCommonObj.endModalCntrl() alt='"+this.alt_close+"'title='"+this.alt_close+"' />";

    
    this.popupContent = document.getElementById("popupWidget");
    this.popupContent.style.display = 'block';

    this.popupBottom = document.getElementById("popupBottom");
    this.popupBottom.style.display = 'block';
    this.popupBottom.onmousedown = 'this.initResizeWindow';
    var resizeImg = document.getElementById('popupResizeImg');
        if (resizeImg) {
            resizeImg.src=this.url_resizeimg;
            resizeImg.alt=this.alt_resize;
            resizeImg.title=this.alt_resize;
            if('ltr' == 'rtl')
               resizeImg.style.cursor = 'ne-resize';
            }

    
    var viewportHeight = ptCommonObj.getViewportHeight();
    var viewportWidth = ptCommonObj.getViewportWidth();

    if (this.modalWidth > 0) {
        if (this.modalWidth > viewportWidth - 75)
            this.currWidth = viewportWidth - 75;
        else
            this.currWidth = this.modalWidth;
        }
    else
        this.currWidth = viewportWidth - 75;

    if (this.modalHeight > 0) {
        if (this.modalHeight > viewportHeight - 75)
            this.currHeight = viewportHeight - 75;
        else
            this.currHeight = this.modalHeight;
        }
    else
        this.currHeight = viewportHeight - 75;

    
    if (form != null && name != null) { // build the query string

        var params = "&ICModalHeight=";
        if (this.sizeModalOnLoad) {
            params += "0";
            params += "&ICModalWidth=0";
        }
        else {
            params += this.currHeight;
            params += "&ICModalWidth=";
            params += this.currWidth;
	}

	
	
	params += "&ICSizeModalOnLoad=1";
	this.sizeModalOnLoad = true;		

        
        if (form != null) {
            params += "&";
            for (var i=0; i < form.elements.length; i++) {
            if (form.elements[i].name != null)
            {
            if ((form.elements[i].name.indexOf("ICResubmit")==-1) && (form.elements[i].name.indexOf("IC")!=-1))
                    params +=ptCommonObj.getNV(form.elements[i]);
             }
            }
        }

	// % retrieve the cached html from webServer for hyperlink action
	resubmitParams = "&" + this.elemNumName + "=" + document.getElementById(this.elemNumName).value;
	resubmitParams += "&" + this.stateNumName + "=" + document.getElementById(this.stateNumName).value;
	resubmitParams += "&ICResubmit=1";

	
	if (optionsarray == null)
	    url +="?"+resubmitParams;
	else if (params)
            url +="?"+params;
        }

    this.deferPromptScript = null;

    if (!this.bmodaliFrame) {
        if (this.modalHTML != null)
            document.getElementById("popupWidget").innerHTML= this.modalHTML;
        }
    else
		{
        this.popFrame = document.getElementById("popupFrameWidget");
		this.popupFocus= this.popFrame;	
		}

    this.centerPromptWin(this.currWidth, this.currHeight);
    this.setMaskSize(true);

    if (this.bmodaliFrame) {
        this.popFrame.style.dislay='block';
        if (browserInfoObj.isSafari && this.isSwanSS)
           this.popFrame.style.width = (this.currWidth - 4) + 'px';
        else
           this.popFrame.style.width = (this.currWidth) + 'px';
        this.popFrame.style.height = (this.currHeight) + 'px';
        this.popFrame.src = url;
        }

    
    this.popShadow = document.getElementById("popupShadow");
    if (browserInfoObj.isIE)
      {
        if('ltr' == 'ltr')
           {
             this.popShadow.style.height = (this.popInner.offsetHeight + 1) + 'px';
             if(this.isSwanSS)
                 this.popShadow.style.width = (this.popInner.offsetWidth + 3) + 'px';
             else
                 this.popShadow.style.width = (this.popInner.offsetWidth + 5) + 'px';
           }
        else
           {
             this.popShadow.style.height = (this.popInner.offsetHeight + 1) + 'px';
             if(this.isSwanSS)
                this.popShadow.style.width = (this.popInner.offsetWidth - 1) + 'px';
             else
                this.popShadow.style.width = (this.popInner.offsetWidth + 1) + 'px';
           }
      }
    else
       if (browserInfoObj.isSafari)
       {
        if('ltr' == 'ltr')
           {
             this.popShadow.style.height = (this.popInner.offsetHeight + 1) + 'px';
             this.popShadow.style.width = (this.popInner.offsetWidth + 3) + 'px';
           }
        else
           {
             this.popShadow.style.height = (this.popInner.offsetHeight + 1) + 'px';
             if(this.isSwanSS)
                this.popShadow.style.width = (this.popInner.offsetWidth + 3) + 'px';
             else
                this.popShadow.style.width = (this.popInner.offsetWidth + 1) + 'px';
           }
       }
       else
       {
        if('ltr' == 'ltr')
           {
             this.popShadow.style.height = (this.popInner.offsetHeight + 1) + 'px';
             if(this.isSwanSS)
                this.popShadow.style.width = (this.popInner.offsetWidth + 3) + 'px';
             else
                this.popShadow.style.width = (this.popInner.offsetWidth + 5) + 'px';
           }
        else
           {
             this.popShadow.style.height = (this.popInner.offsetHeight + 1) + 'px';
             if(this.isSwanSS)
                this.popShadow.style.width = (this.popInner.offsetWidth - 1) + 'px';
             else
                this.popShadow.style.width = (this.popInner.offsetWidth + 1) + 'px';
           }
      }


    
    if (browserInfoObj.isIE)
        {
          if('ltr' == 'ltr') {
              if(this.isSwanSS)
                  this.sizeShadowImageContainers(this.popInner.offsetHeight, this.popInner.offsetWidth + 1);
              else
                  this.sizeShadowImageContainers(this.popInner.offsetHeight, this.popInner.offsetWidth + 3);
          }
          else  {
              if(this.isSwanSS)
                  this.sizeShadowImageContainers(this.popInner.offsetHeight, this.popInner.offsetWidth - 3);
              else
                  this.sizeShadowImageContainers(this.popInner.offsetHeight, this.popInner.offsetWidth - 1);
          }
        }
    else
        if (browserInfoObj.isSafari)
        {
          if('ltr' == 'ltr')
             this.sizeShadowImageContainers(this.popInner.offsetHeight + 1, this.popInner.offsetWidth + 2);
          else {
             if(this.isSwanSS)
                  this.sizeShadowImageContainers(this.popInner.offsetHeight + 2, this.popInner.offsetWidth + 2);
             else
                  this.sizeShadowImageContainers(this.popInner.offsetHeight + 2, this.popInner.offsetWidth );
          }
        }
        else
        {
          if('ltr' == 'ltr') {
              if(this.isSwanSS)
                  this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.popInner.offsetWidth + 2);
              else
                  this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.popInner.offsetWidth + 4);
          }
          else  {
             if(this.isSwanSS)
                  this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.popInner.offsetWidth - 2);
             else
                  this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.popInner.offsetWidth );
          }
        }

    
    this.sizeTitle(this.popInner.offsetWidth);


    if (this.hideSelects == true)
        this.hideSelectBoxes();

    ptCommonObj.tryFocus0(this.popInner);
    this.centerPromptWin(this.currWidth, this.currHeight);
    this.setMaskSize();
    if (!(typeof(bHyperlink) != "undefined" && !bHyperlink))   // avoid calling initWindows_win0() more than once
         this.initWindows_win0();
    if (!this.sizeModalOnLoad)
        this.fadeInModal();
},

sizeModalWinOnLoad:function(theDocument, theHeight, theWidth)  
{
    
    var viewportHeight = ptCommonObj.getViewportHeight();
    var viewportWidth = ptCommonObj.getViewportWidth();

    if (theHeight <= 0 || theWidth <= 0) {
        
        this.modalHeight = theDocument.win0.offsetHeight + 25;

        
        this.modalWidth = theDocument.getElementById("ACE_width").offsetWidth + 25;
        }
    else {
        this.modalHeight = theHeight;	
        this.modalWidth = theWidth;	
        }

    
    if (this.modalWidth < viewportWidth) {
        if (this.modalWidth > viewportWidth - 75)
            this.currWidth = viewportWidth - 75;
        else
            this.currWidth = this.modalWidth;
        }
    else
        this.currWidth = viewportWidth - 75;

    if (this.modalHeight < viewportHeight) {
        if (this.modalHeight > viewportHeight - 75)
            this.currHeight = viewportHeight - 75;
        else
            this.currHeight = this.modalHeight;
        }
    else
        this.currHeight = viewportHeight - 75;

    
    
    if ( theWidth == 0 || theHeight == 0) {

        
        document.getElementById("popupFrameWidget").style.height = this.currHeight + 'px';
        document.getElementById("popupFrameWidget").style.width = this.currWidth + 'px';

        
        this.currHeight = theDocument.body.scrollHeight;
        this.currWidth = theDocument.body.scrollWidth;
        }

    
    if (this.currHeight >= viewportHeight - 75) {
        if ((this.currWidth + 15) > (viewportWidth - 75))
            this.currWidth = viewportWidth - 75;
        else
            this.currWidth += 15;
        this.currHeight = viewportHeight - 75;
    }
    else if (this.currWidth >= viewportWidth - 75) {
        if ((this.currHeight + 15) > (viewportHeight - 75))
            this.currHeight = viewportHeight - 75;
        else
            this.currHeight += 15;
        this.currWidth == viewportWidth - 75
    }
	
    
    document.getElementById("popupFrameWidget").style.height = this.currHeight + 'px'; 
    document.getElementById("popupFrameWidget").style.width = this.currWidth + 'px';

    
    this.centerPromptWin(this.currWidth, this.currHeight);
    this.setMaskSize(true);

    
    this.sizeTitle(this.currWidth + 4);

    
    this.popShadow = document.getElementById("popupShadow");
    this.popShadow.style.height = (this.popInner.offsetHeight + 1) + 'px';
    this.popShadow.style.width = (this.popInner.offsetWidth + 3) + 'px';

    
    if (!browserInfoObj.isIE)
        this.sizeShadowImageContainers(this.popInner.offsetHeight + 2,this.popInner.offsetWidth + 2);
    else
        this.sizeShadowImageContainers(this.popInner.offsetHeight, this.popInner.offsetWidth + 1);

    if (this.hideSelects == true)
        this.hideSelectBoxes();

    this.centerPromptWin(this.currWidth, this.currHeight);
    this.setMaskSize();

    this.initWindows_win0();

    this.fadeInModal();
},

sizeTitle:function(offsetWidth, bModalElement)
{
if (typeof bModalElement == 'undefined') 
    {
    document.getElementById("popupTitleBar").style.width = offsetWidth;
    document.getElementById("popupTitle").style.width = (offsetWidth-45); // ICE 1837274000
    document.getElementById("popupTitleBarMiddle").style.width = (offsetWidth - 8) + 'px';
    }
else
    {
    document.getElementById("popupTitleBarModal").style.width = offsetWidth;
    document.getElementById("popupTitleBarMiddleModal").style.width = (offsetWidth - 8) + 'px';
    }
},

sizeShadowImageContainers:function(offsetheight, offsetwidth, bModalElement)
{// for pop-out grid
if (typeof bModalElement == 'undefined') {
    var popShadowTopRightCorner     = document.getElementById("popupShadowTopRightCorner");
    var popShadowTop                = document.getElementById("popupShadowTop");
    var popShadowBottom             = document.getElementById("popupShadowBottom");
    var popShadowBottomLeftCorner   = document.getElementById("popupShadowBottomLeftCorner");
    var popShadowBottomMiddle       = document.getElementById("popupShadowBottomMiddle");
    var popShadowBottomRightCorner  = document.getElementById("popupShadowBottomRightCorner");
    }
else  {
    var popShadowTopRightCorner     = document.getElementById("popupShadowTopRightCornerModal");
    var popShadowTop                = document.getElementById("popupShadowTopModal");
    var popShadowBottom             = document.getElementById("popupShadowBottomModal");
    var popShadowBottomLeftCorner   = document.getElementById("popupShadowBottomLeftCornerModal");
    var popShadowBottomMiddle       = document.getElementById("popupShadowBottomMiddleModal");
    var popShadowBottomRightCorner  = document.getElementById("popupShadowBottomRightCornerModal");
    }

if (popShadowTop != null && popShadowBottom != null) {
    if (!browserInfoObj.isIE) {

        popShadowTopRightCorner.style.height = "10px";

        popShadowTop.style.height = (offsetheight - 17) + 'px';

        popShadowBottom.style.height = "10px";

        popShadowBottomLeftCorner.style.height = "10px";
        popShadowBottomLeftCorner.style.width = "10px";

        popShadowBottomRightCorner.style.height = "10px";
        popShadowBottomRightCorner.style.width = "10px";

        popShadowBottomMiddle.style.height = "10px";

        popShadowBottomMiddle.style.width = (offsetwidth - 19) + 'px';
        }
    else {
        popShadowTopRightCorner.style.height = "10px";

        if (document.compatMode && document.compatMode == "CSS1Compat")
            popShadowTop.style.height = (offsetheight - 13) + 'px';
        else
            popShadowTop.style.height = (offsetheight - 23) + 'px';

        popShadowBottom.style.height = "10px";

        popShadowBottomLeftCorner.style.height = "10px";
        popShadowBottomLeftCorner.style.width = "10px";

        popShadowBottomRightCorner.style.height = "10px";
        popShadowBottomRightCorner.style.width = "10px";

        popShadowBottomMiddle.style.height = "10px";
        popShadowBottomMiddle.style.width = (offsetwidth - 18) + 'px';
        }
    }

},

getChangedObj:function()
{
    for (var j = 0; j < this.form.length; ++j){
        if (this.isChanged(this.form.elements[j], null))
       return this.form.elements[j];
    }
    return null;
},

isChanged:function(obj, objFrame)
{
if (obj.type == "checkbox"  || obj.type == "radio")
  return (obj.checked != obj.defaultChecked);
else if (obj.type == "select-one" && obj.selectedIndex > -1)
{
  if (obj.id == "#ICDataLang")
    return false;

  else if (obj.id == "rcMenuOnTC")
    return false;
  else
    return !(obj.options[obj.selectedIndex].defaultSelected);
}
else if (obj.type == "select-multiple")
{
  for (var i =0; i < obj.options.length; ++i)
  {
     if (obj.options[i].defaultSelected != obj.options[i].selected)
        return !ignoreChg(obj, objFrame);
  }
  return false;
}
else if (obj.type == "hidden" || obj.type == "button")
  return false;
else
  return (obj.value != obj.defaultValue);
},

deferPrompt:function()
{
    if (this.deferPromptScript!=null){
        var dscript = this.deferPromptScript;
        eval(dscript);
    }
},

endModalCntrl:function(form, icAction, bModalElement) {
HelppopupObj_win0.StopPopup(); 
if (typeof this.closeEvent == "function") {
  this.closeEvent.apply();
  this.closeEvent = null;
}

if (typeof bModalElement == 'undefined') {
   if (typeof icAction == "undefined" || !icAction) {
        popupObj_win0.hidePopup();
		popupObj_win0.isModalWidget = false;
        return;
        }

    var oStateNum = document.getElementById(popupObj_win0.stateNumName);
    var oElemNum = document.getElementById(popupObj_win0.elemNumName);
    if (typeof oStateNum != "undefined")
        oStateNum.value = form[popupObj_win0.stateNumName].value;
    if (typeof oElemNum != "undefined")
        oElemNum.value = form[popupObj_win0.elemNumName].value;

    //oineza, 1877981000
    //closing a modal long edit, signal the app server that it needs to run the pcode in a subsequent servce
    if (typeof form.ICModalWidgetName != 'undefined' &&
        form.ICModalLongClosed != 'undefined' &&
        icAction == '#ICSave') {
        form.ICModalLongClosed.value = this.modalOccName;
        }

    aAction_win0(form, icAction, "", false);

    
    }
else {
    var oStateNum = document.getElementById(popupModalObj_win0.stateNumName);
    var oElemNum = document.getElementById(popupModalObj_win0.elemNumName);
    if (typeof oStateNum != "undefined")
        oStateNum.value = form[popupModalObj_win0.stateNumName].value;
    if (typeof oElemNum != "undefined")
        oElemNum.value = form[popupModalObj_win0.elemNumName].value;

    aAction_win0(form, icAction, "", false);

    popupModalObj_win0.hidePopup();
    }

},

centerPromptWin:function(width, height, bModalElement)
{
    if (this.isShown == true) {
        if (width == null || isNaN(width))
            width = this.popContainer.offsetWidth;
        if (height == null)
            height = this.popContainer.offsetHeight;
        var theBody = document.getElementsByTagName("BODY")[0];
        var scTop = parseInt(theBody.scrollTop,10);
        var scLeft=0;
        /* ICE -1756436000 Modal Lookup Prompt - Modal Lookup Prompt does not work in BIDI */
        if ((browserInfoObj.isIE) && ('ltr'=='rtl'))
            {
            scLeft= parseInt((theBody.clientWidth - theBody.scrollWidth),10);
            if (scLeft <0)
               scLeft = 1;
            }
        else
            scLeft= parseInt(theBody.scrollLeft,10);
        this.popMask.style.top = 0 + "px";
        if('ltr' == 'rtl')
            this.popMask.style.left = scLeft + "px";
        else
            this.popMask.style.left = 0 + "px";
        this.setMaskSize(bModalElement);
        var titleBarHeight = 0;

        if (typeof bModalElement == 'undefined')
            var oPopTitleBar = (typeof document.getElementById("popupTitleBar") =="undefined" || !document.getElementById("popupTitleBar")) ? null: document.getElementById("popupTitleBar");
        else
            var oPopTitleBar = (typeof document.getElementById("popupTitleBarModal") =="undefined" || !document.getElementById("popupTitleBarModal")) ? null: document.getElementById("popupTitleBarModal");

        if (oPopTitleBar)
           titleBarHeight = parseInt(oPopTitleBar.offsetHeight, 10);
        var fullHeight = ptCommonObj.getViewportHeight();
        var fullWidth = ptCommonObj.getViewportWidth();
        scTop = scTop + ((fullHeight - (height+titleBarHeight)) / 2);
        scLeft =  scLeft + ((fullWidth - width) / 2);
        if (scTop < 0)
            scTop = 0;

        if (scLeft < 0 && browserInfoObj.isIE && 'ltr' == 'rtl' && typeof bModalElement == 'undefined')  
            scLeft = scLeft + theBody.scrollLeft;
        else if (scLeft < 0 && browserInfoObj.isIE && 'ltr' == 'rtl')
            scLeft = parseInt((theBody.clientWidth - theBody.scrollWidth),10)+ ((fullWidth - width) / 2); 
        else if (scLeft < 0 && 'ltr'=='rtl') 
            parseInt((theBody.clientWidth - theBody.scrollWidth),10);
        else if (scLeft < 0)
            scLeft = 0;

        this.popContainer.style.top = scTop + "px";
        this.popContainer.style.left =  scLeft + "px";
        this.popContainer.style.width = width;
        this.popContainer.style.height = height;
    }
},

setMaskSize:function(bModalElement)
{
    var nMaxMaskHeight = 10266;  // maximum mask height for IE browser.  Exceeding it will cause mask not to be displayed in IE browser.
    if (typeof bModalElement == 'undefined')
        var thePopMask = document.getElementById('popupMask');
    else
        var thePopMask = document.getElementById('popupMaskModal');

    if (thePopMask){
        var theBody = document.getElementsByTagName("BODY")[0];
        var fullHeight = ptCommonObj.getViewportHeight();
        var fullWidth = ptCommonObj.getViewportWidth();
        // Determine what's bigger, scrollHeight or fullHeight / width
        if (fullHeight > theBody.scrollHeight)
            popHeight = fullHeight;
        else
            popHeight = theBody.scrollHeight;
      
        if (popHeight > nMaxMaskHeight)
            popHeight = nMaxMaskHeight;

        thePopMask.style.height = popHeight + "px";

        if (fullWidth > theBody.scrollWidth)
            thePopMask.style.width = fullWidth + "px";
        else
            thePopMask.style.width = theBody.scrollWidth + "px";
            
        this.popMaskScrollWidth=parseInt(thePopMask.style.width,10);
        this.popMaskScrollHeight=parseInt(popHeight,10);                           

    }
},

updatePrompt:function(form, value)
{
    if (typeof value =="undefined" || !value||( value == "#ICOK" && this.bPromptMessageOpen == true && form.ICChanged.value==1) 
            ||( value == "#ICCancel" && this.bPromptMessageOpen == true && form.ICChanged.value==-1)) {
      
      this.hidePopup();
      return;
    }
   if (typeof value != 'undefined' && value == "#ICCancel" && this.bPromptMessageOpen == true && form.ICChanged.value==1)
         form = document.getElementById("popupFrame").contentWindow.document.win0;
    var sRow = null;
    var oStateNum = document.getElementById(this.stateNumName);
    var oElemNum = document.getElementById(this.elemNumName);
    if (typeof oStateNum != "undefined")
        oStateNum.value = form[this.stateNumName].value;
    if (typeof oElemNum != "undefined")
        oElemNum.value = form[this.elemNumName].value;
    // for multiple select prompt
    if ((this.selectvalues).length >0){
        for (x in this.selectvalues){
            if (this.selectvalues[x] != null){
                if (sRow == null)
                    sRow = this.selectvalues[x];
                else
                    sRow += ("&" + this.selectvalues[x]);
            }
        }
     }
     var sScript ="";

     
     // if (document.getElementById("popupFrame").contentWindow.popupObj_win0.nChildPrompts <= 0) {
     if (this.nChildPrompts <= 0) {
        if (value == this.okbutton) {  // multiple select prompt page
            sScript = 'aAction_'+ this.form.name+'(this.form, value, sRow, 1);';
        }
        else if (value == this.cancelbutton){  // cancel button is clicked
            sScript = 'aAction_'+ this.form.name+'(this.form, value, null, 1);';
        }
        else  // single select prompt page
        sScript = 'submitAction_'+ this.form.name+'(this.form, value);';
        eval(sScript);
        this.hidePopup();
        }
     
     
     else {
        
        
        theForm = document.getElementById("popupFrame").contentWindow.document.win0;

        if (value == this.okbutton) {  // multiple select prompt page
            
            
            
            
            sScript = 'submitAction_'+ this.form.name+'(theForm, value);';
            }
        else { // single select prompt page or the cancel button
            
            
            
            
            
            sScript = 'aAction_'+ this.form.name+'(theForm, value, sRow, false, true);';
            }

         
         this.updatePromptActn = true;

         eval(sScript);

        
        

        //document.getElementById("popupFrame").contentWindow.popupObj_win0.nChildPrompts--;
        this.nChildPrompts--;

        
        this.updatePromptActn = false;
     }

},

// update selected value array to be passed to the main PIA page later in updatePrompt function
updateMultiSelectValues:function(value)
{
   if (typeof value =="undefined" || !value)
       return;
   var len = (this.selectvalues).length;
   var bDone = false;
   var sTmp = escape(value.substr(0,1)) + value.substr(1);
   for (x in this.selectvalues){
       if (this.selectvalues[x] == sTmp){
           bDone = true;
           this.selectvalues[x] = null;
           break;
       }
   }
   if (!bDone)
      this.selectvalues[len] = sTmp;
},

setSaveWarn:function(val) {
  this.isSaveWarn = val;
},

closePopupMsg:function ()
{
 var div = document.getElementById("popupMsg");  //look for 'popupMsg' div that is used for popup message
 if (!div || (div && div.tagName != "DIV")) {
    popupObj_win0.hidePopup();
    return;
 }
 var elms = div.getElementsByTagName("form");   //look for form control in popup message
 var formElm=null;
 for(var i = 0, maxI = elms.length; i < maxI; ++i) { 
   switch(elms[i].tagName) {          
     case "FORM":          
          formElm=elms[i];
          break;
   }     
   if (formElm)
       break; 
 }
 if (formElm) //need to submit the form if there is a form control in popup message.  See ICE 1941361000.
    submitAction_win0(formElm, '#ICCancel');
 else 
    popupObj_win0.hidePopup();
},


hidePopup:function (callReturnFunc)
{
   
   if (typeof this.closeEvent == "function") {
      this.closeEvent.apply();
      this.closeEvent = null;
   }

   
   if ((typeof ptalPage != 'undefined') && (ptalPage)) setTimeout("ptalPage.fixPageletGroupTabs();", 50);


   
   this.nChildPrompts = 0;
   
   var oMainPopupObject = getMainPopupObject();
   if (oMainPopupObject != null && this.bPromptMessageOpen && oMainPopupObject.bPromptPageOpen) {
      
      oMainPopupObject.nChildPrompts--;
   }   
   
   // to reset the multi-selected values
   this.selectvalues = new Array();
   //oineza, 1877981000
   this.modalOccName = null;

   var oField = document.getElementById(this.fid);
   if (oField) tryFocus(oField);
       this.isShown = false;
       
   var bPopupFrame = this.isModalWidget ? top.document.getElementById('popupFrame') : document.getElementById('popupFrame');
   if (!this.isModalWidget && !this.bPromptMessageOpen && (bPopupFrame != null && bPopupFrame != "undefined"))
   {
      try {
          var oDoc = bPopupFrame.contentWindow.document;
      	}
      catch(err) {
          var oDoc = bPopupFrame.document;
      	}
      var obj = oDoc.getElementById('win0divSEARCHABOVE');
      if (obj) {obj.innerHTML=""; obj.style.display = "none";}
      obj = oDoc.getElementById('win0divSEARCHADV');
      if (obj) {obj.innerHTML=""; obj.style.display = "none";}
      obj = oDoc.getElementById('win0divSEARCHBELOW');
      if (obj) {obj.innerHTML=""; obj.style.display = "none";}
      obj = oDoc.getElementById('win0divSEARCHRESULT');
      if (obj) {obj.innerHTML=""; obj.style.display = "none";}
   }

   
   this.updatePromptActn = false;
   this.bPromptPageOpen = false;
   this.bPromptMessageOpen = false;  // reset message box displayed flag

   var theBody = document.getElementsByTagName("BODY")[0];
   theBody.style.overflow = "";
   if (this.bmodaliFrame) {
       document.getElementById("popupFrameWidget").src="";
       processing_win0(0);
       this.bmodaliFrame = false;
   }
    if (this.popMask)
        this.popMask.style.display = "none";
    if (this.popContainer)
        this.popContainer.style.display = "none";
   if (this.popFrame) {
     this.popFrame.style.height="";
     this.popFrame.style.width="";
   }
   var popTitleBar = document.getElementById("popupTitleBar");
   if (popTitleBar) {
     popTitleBar.style.height="";
     popTitleBar.style.width="";
     document.getElementById("popupTitle").style.width="";
   }
   if (this.popShadow) {
     this.popShadow.style.height="";
     this.popShadow.style.width="";
   }

document.getElementById("popupInner").style.height = "";
document.getElementById("popupInner").style.width = "";
document.getElementById("popupContent").style.height = "";
document.getElementById("popupContent").style.width = "";

this.isSaveWarn = false;

   if (callReturnFunc == true && this.returnFunc != null)
       this.returnFunc(window.frames["popupFrame"].returnVal);
   if (this.hideSelects == true)
       this.displaySelectBoxes();
   if (gFocusObj){
       ptCommonObj.tryFocus(gFocusObj);
       gFocusObj = null;
   }
   if (this.msgArr.length>0)
      this.showMsg();
},

moveToBottomLeft:function(){
    var winFullHeight = ptCommonObj.getViewportHeight();
    var theBody = document.getElementsByTagName("BODY")[0];
    var scTop = parseInt(theBody.scrollTop,10);
    var oPopTitleBar = (typeof document.getElementById("popupTitleBar") =="undefined" || !document.getElementById("popupTitleBar")) ? null: document.getElementById("popupTitleBar");
    if (oPopTitleBar)
        titleBarHeight = parseInt(oPopTitleBar.offsetHeight, 10);
    this.popContainer.style.position = "absolute";
    this.popContainer.style.left =  "0px";
    this.popContainer.style.top =  (scTop + (winFullHeight - titleBarHeight)) + "px";
},

minmax:function()
{
    var eb = document.getElementById("popupBottom");
    var emin = document.getElementById("popupMin");
    var emax = document.getElementById("popupMax");

    if (this.id == "#MODALMIN"){
        eb.style.display="none";
        popupObj_win0.popShadow.style.display = "none";
        emax.style.display = "block";
        emin.style.display = "none";
        popupObj_win0.moveToBottomLeft();
    }
    else{
        eb.style.display="block";
        popupObj_win0.popShadow.style.display = "block";
        emax.style.display = "none";
        emin.style.display = "block";
        popupObj_win0.centerPromptWin(popupObj_win0.currWidth, popupObj_win0.currHeight);
    }
},

minPrompt:function()
{
    var eb = document.getElementById("popupBottom");
    var emin = document.getElementById("popupMin");
    var emax = document.getElementById("popupMax");
    if (!this.popFrame)
        return;
    if (this.popFrame.style.visibility != "hidden"){
        this.popFrame.style.visibility = "hidden";
        this.popFrame.style.height="0px";
        eb.style.display="none";
        this.popShadow.style.display = "none";
        emax.style.display = "block";
        emin.style.display = "none";
        this.moveToBottomLeft();
    }
    else{
        this.popFrame.style.visibility="visible";
        this.popFrame.style.height = (this.currHeight) + "px";
        eb.style.display="block";
        this.popShadow.style.display = "block";
        emax.style.display = "none";
        emin.style.display = "block";
        this.centerPromptWin(this.currWidth, this.currHeight);
    }
},
// Tab key trap
keyDownHandler:function(e)
{
    if (this.isShown && e.keyCode == 9)
       return false;
},

// set focus to the first tabbale element
setFocus:function(elements)
{
    for (var i = 0; i < elements.length; i++) {
        for (var j = 0; j < this.tabbableTags.length; j++) {
            var elem = elements[i];
            if (elem.tagName == this.tabbableTags[j]) {
                if ((elem.type != 'hidden') && (elem.disabled != 'true') &&
                        (((elem.id != 'undefined') && (elem.id != '')) ||
                        ((elem.name != 'undefined') && (elem.name != '')))) {

                    // on firefox, if first focussable item is 'file' type then set the focus to container
                    // firfox bug: cannot give to file type field if it the first focussable field.
                    if ((browserInfoObj.isFF) && (elem.type == 'file')) {
                        elem = document.getElementById('popupMsg');
                    }
                    else {
                        if (document.activeElement != null && document.activeElement.tagName != null && document.activeElement.tagName.indexOf("BODY") <0) {
                            this.focusElem = document.activeElement;            // save focused control to be restored when popup page is hidden
                            if (this.focusElem != null)
                                this.focusElem.blur();
                        }
                        else {
                            this.focusElem=null;
                        }
                    }
                    if (elem) {
                        try {
                           elem.focus();
                        }
                        catch(err){}
                        return elem;
                    }
                }   // not hidden, not disabled etc
                break;
            } // if elem tagname matches with tabbableTag
        } // loop thru tabbableTags
    } // loop thru all elements

return null;
},

hideSelectBoxes:function()
{
    for(var i = 0; i < document.forms.length; i++) {
        for(var e = 0; e < document.forms[i].length; e++){
            if(document.forms[i].elements[e].tagName == "SELECT")
                document.forms[i].elements[e].style.visibility="hidden";
        }
    }
},

displaySelectBoxes:function()
{
    for(var i = 0; i < document.forms.length; i++) {
        for(var e = 0; e < document.forms[i].length; e++){
            if(document.forms[i].elements[e].tagName == "SELECT")
                document.forms[i].elements[e].style.visibility="visible";
        }
    }
},

initWindows_win0:function(){
    var state = '1';
    if(!this.windowPositionArray)
        this.windowPositionArray = new Array();
    this.windowPositionArray[0] = Math.max(0,this.popContainer.style.left.replace('px','')); //left
    this.windowPositionArray[1] = Math.max(0,this.popContainer.style.top.replace('px','')); //top

    this.windowPositionArray[2] = Math.max(0,this.popContainer.style.width.replace('px','')); //width
    this.windowPositionArray[3] = Math.max(0,this.popContainer.style.height.replace('px','')); //height
    var resizeImg = document.getElementById('popupResizeImg');  // modal window resize image
    if (resizeImg) {
        ptEvent.add(resizeImg,"mousedown",this.initResizeWindow_win0);
        if('ltr' == 'rtl')
               resizeImg.style.cursor = 'ne-resize';
    }
    var popupTitle = document.getElementById('popupTitle');     // modal window move title bar
    if (popupTitle) {
        ptEvent.add(popupTitle,"mousedown",this.initMove_win0);
        popupTitle.style.cursor = "move";
    }
 
    if (resizeImg) {
        this.setResizeEvent_win0(resizeImg);       // set resize events for resize image
        if('ltr' == 'rtl')
               resizeImg.style.cursor = 'ne-resize';
    }

    return;
},

setResizeEvent_win0:function(obj)
{
    ptEvent.add(obj,"mouseup",popupObj_win0.stopMove_win0);
    ptEvent.add(obj,"mousemove",popupObj_win0.moveWindow_win0);
    ptEvent.add(obj,"dragstart",popupObj_win0.cancelEvent_win0);
    ptEvent.add(obj,"selectstart", popupObj_win0.cancelEvent_win0);
},

removeResizeEvent_win0:function(obj)
{
    ptEvent.remove(obj,"mouseup",popupObj_win0.stopMove_win0);
    ptEvent.remove(obj,"mousemove",popupObj_win0.moveWindow_win0);
    ptEvent.remove(obj,"dragstart",popupObj_win0.cancelEvent_win0);
    ptEvent.remove(obj,"selectstart", popupObj_win0.cancelEvent_win0);
},


initMove_win0:function(e)
{
    e = e || window.event;

    popupObj_win0.moveCounter = 0; // modal window move flag
    popupObj_win0.mouseOffset = ptCommonObj.getMouseOffset(popupObj_win0.popContainer, e); // mouse distance from modal window
    popupObj_win0.moveCounter++;    // indicate start of move, i.e. mouse-down for modal window's move
    document.body.style.cursor = "move";
    popupObj_win0.popInner=document.getElementById('popupInner');   // modal window content
    popupObj_win0.popupDragFrame = document.getElementById('popupDragFrame');   // frame to be dragged
    
    if (popupObj_win0.popupDragFrame)    
       {
        popupObj_win0.popupDragFrame.style.width= popupObj_win0.popInner.offsetWidth;
        popupObj_win0.popupDragFrame.style.height= popupObj_win0.popInner.offsetHeight;
        var XYposition = ptCommonObj.getPosition(popupObj_win0.popInner);
        popupObj_win0.popupDragFrame.style.top= XYposition.y;
        if('ltr' == 'rtl' && XYposition.x >= 1)
           {
           popupObj_win0.popupDragFrame.style.left= XYposition.x - 1;
           if (browserInfoObj.isIE)
               popupObj_win0.popupDragFrame.style.width= popupObj_win0.popInner.offsetWidth -3;
           else
               popupObj_win0.popupDragFrame.style.width= popupObj_win0.popInner.offsetWidth - 7;
           }
        else  
           popupObj_win0.popupDragFrame.style.left= XYposition.x;
        popupObj_win0.popupDragFrame.style.display="block"; 
  	    popupObj_win0.popupDragFrame.style.zIndex="999";
       }
    
    popupObj_win0.setResizeEvent_win0(document);
},

stopMove_win0:function(e)
{

    e = e || window.event;
    
    
    if (popupObj_win0.moveCounter > 0)
       {
       var XYposition = ptCommonObj.getPosition(popupObj_win0.popupDragFrame);
       popupObj_win0.popContainer.style.top= XYposition.y;
       popupObj_win0.popContainer.style.left = XYposition.x;
       popupObj_win0.popupDragFrame.style.zIndex=-1;
       popupObj_win0.popupDragFrame.style.display="none";
       popupObj_win0.popupDragFrame.style.width= 0+'px';
       popupObj_win0.popupDragFrame.style.height= 0+'px';
       popupObj_win0.popupDragFrame.style.top= 0;
       popupObj_win0.popupDragFrame.style.left= 0;
       }
    
    
    if (popupObj_win0.initResizeCounter > 0)
       {
       if('ltr' =='rtl')
           {
           popupObj_win0.currWidth = popupObj_win0.popupDragFrame.offsetWidth;
           popupObj_win0.popContainer.style.left = popupObj_win0.popupDragFrame.style.left;
           }
       else 
           popupObj_win0.currWidth = popupObj_win0.popupDragFrame.offsetWidth - 12;
       popupObj_win0.currHeight = popupObj_win0.popupDragFrame.offsetHeight - 40;
       popupObj_win0.popContainer.style.width = popupObj_win0.currWidth;
       popupObj_win0.popContainer.style.height = popupObj_win0.currHeight;
       popupObj_win0.resizeTitlebarAndShadow_win0();
       popupObj_win0.popupDragFrame.style.zIndex=-1;
       popupObj_win0.popupDragFrame.style.display="none";
       popupObj_win0.popupDragFrame.style.width= 0+'px';
       popupObj_win0.popupDragFrame.style.height= 0+'px';
       popupObj_win0.popupDragFrame.style.top= 0;
       popupObj_win0.popupDragFrame.style.left= 0;
       }
       
    popupObj_win0.removeResizeEvent_win0(document);
    
    
    if (popupObj_win0.popFrame)
        { 
        var popupIframeDoc = popupObj_win0.popFrame.contentWindow.document;
        if (popupIframeDoc) 
            popupObj_win0.removeResizeEvent_win0(popupIframeDoc);
        }

    popupObj_win0.moveCounter=-1;
    popupObj_win0.initResizeCounter=-1;
    document.body.style.cursor = "auto";

    
    //window.status="stopMove: popupObj_win0.moveCounter=" + popupObj_win0.moveCounter;  //debug
},

moveWindow_win0:function(e)
{

    
    e = e || window.event;
    if (!e)
       {
       popupObj_win0.stopMove_win0(e);
       e.cancelBubble = true;
       return false;
       }

    
    
    
    
    if (popupObj_win0.moveCounter >= 1)
        {
        var nPopupWidth = popupObj_win0.popupDragFrame.offsetWidth;
        var nPopupHeight = popupObj_win0.popupDragFrame.offsetHeight;
        var mousePos = ptCommonObj.getMouseCoords(e);            // get mouse coordinates
        var mx = mousePos.x - popupObj_win0.mouseOffset.x;  // new left coordinate 
        
        
        if (mx <= 0)
            mx = 0;
        else if ('ltr'=='rtl')
            {
            if ((mx+nPopupWidth) >= (document.body.clientWidth - 40))
               mx = document.body.clientWidth - nPopupWidth;
            }
        else
            {
            if ((mx+nPopupWidth) >= (popupObj_win0.popMaskScrollWidth - 40))
               mx = popupObj_win0.popMaskScrollWidth - nPopupWidth - 20;
            }

        popupObj_win0.popupDragFrame.style.left  = mx + 'px';

        var my = mousePos.y - popupObj_win0.mouseOffset.y;  // new top coordinate 
        if (my <= 0)
            my = 0;
        else if ((my+nPopupHeight) >= (popupObj_win0.popMaskScrollHeight - 40))
            my = popupObj_win0.popMaskScrollHeight - nPopupHeight - 20;
        
        popupObj_win0.popupDragFrame.style.top = my + 'px'; 
        
        //window.status="moveWindow:("+ mousePos.x + "," + mousePos.y + ")" + '('+mx+','+my+')' ;   // debug
        //window.status="moveWindow:("+ popupObj_win0.popupDragFrame.style.left + "," + popupObj_win0.popupDragFrame.style.top + ")" + ":w="+ptCommonObj.getViewportWidth()+"h="+ptCommonObj.getViewportHeight();   // debug

        return false;
        }  

    
    
    
    
    if(popupObj_win0.initResizeCounter>=1)
        {
        var nPopupWidth = popupObj_win0.popupDragFrame.offsetWidth;
        var nPopupHeight = popupObj_win0.popupDragFrame.offsetHeight;
        var newWidth=0;
        var newHeight=0;
        var mousePos = ptCommonObj.getMouseCoords(e);            // get mouse coordinates
        var mx = mousePos.x;
        var my = mousePos.y;
       
        if('ltr'=='rtl')
           {
             if (mx > 0 && Math.abs(popupObj_win0.startEventPos[0] - mx) < 5) 
                 return;
             if (mx <=2) return;   
             if (mx > 2)
                {
                //if (browserInfoObj.isIE && mx < popupObj_win0.startEventPos[0] && (popupObj_win0.startEventPos[0] - mx) > 50 && e.srcElement && e.srcElement.ownerDocument && e.srcElement.ownerDocument.parentWindow && e.srcElement.ownerDocument.parentWindow.name && e.srcElement.ownerDocument.parentWindow.name == "popupFrame")
                // For IE browser, adjust x and y coordinates in case the mouse is inside the content frame.
                var nSaveX = mx;
                if (browserInfoObj.isIE && e.srcElement && e.srcElement.ownerDocument && e.srcElement.ownerDocument.parentWindow && e.srcElement.ownerDocument.parentWindow.name && e.srcElement.ownerDocument.parentWindow.name == "popupFrame")
                   {
                   mx = mx + popupObj_win0.startEventPos[0];
                   if (mx <0 || mx > 800)
                       mx = nSaveX;
                   if (my < popupObj_win0.startEventPos[1] && (popupObj_win0.startEventPos[1] - my)> 150)
                       my = my + 180;
                   }

                popupObj_win0.popupDragFrame.style.left  = mx - 5 + 'px';
                if (browserInfoObj.isIE)
                    newWidth = popupObj_win0.startWindowSize[0] + popupObj_win0.startEventPos[0] - mx -18;
                else
                    newWidth = popupObj_win0.startWindowSize[0] + popupObj_win0.startEventPos[0] - mx -10;
//window.status="moveWindow:(newX="+ mx+",oldX=" + popupObj_win0.startEventPos[0]+ "newY=" + my+ "oldY=" + popupObj_win0.startEventPos[1]+ ",oldWidth=" + popupObj_win0.startWindowSize[0] + ",newWidth=" +newWidth +")";   // debug
                if (newWidth < popupObj_win0.windowMinSize[0])
                   {
                   newWidth = popupObj_win0.windowMinSize[0];
                   popupObj_win0.startEventPos[0] = mx;
                   }
                
                }
           }  
        else    // not 'rtl'
           {
           newWidth = popupObj_win0.startWindowSize[0] + mx - popupObj_win0.startEventPos[0];
           if (newWidth < popupObj_win0.windowMinSize[0])
               {
               newWidth = popupObj_win0.windowMinSize[0];
               popupObj_win0.startWindowSize[0] = newWidth;
               popupObj_win0.startEventPos[0] = mx;
               }
           }
              
        newHeight = popupObj_win0.startWindowSize[1] + my - popupObj_win0.startEventPos[1];
        if (newHeight < popupObj_win0.windowMinSize[1])
            {
            newHeight = popupObj_win0.windowMinSize[1];
            popupObj_win0.startWindowSize[1] = newHeight;
            popupObj_win0.startEventPos[1] = my;
            }
  
        if (browserInfoObj.isSafari && popupObj_win0.isSwanSS)
            popupObj_win0.popupDragFrame.style.width =  newWidth + 5 + 'px';
        else
            popupObj_win0.popupDragFrame.style.width =  newWidth + 'px';


        popupObj_win0.popupDragFrame.style.height = newHeight  + 'px';

        
        popupObj_win0.currWidth = newWidth;
        popupObj_win0.currHeight = newHeight;
//window.status="moveWindow:("+ newWidth + "," + newHeight + ")" + ":e:x="+mx+"e:y="+my + " ("+(popupObj_win0.startWindowSize[0] + mx - popupObj_win0.startEventPos[0]) +"," +(popupObj_win0.startWindowSize[1] + my - popupObj_win0.startEventPos[1])+")";   // debug
        }  // end of if(popupObj_win0.initResizeCounter>=1)
    if(!document.all)
        return false;
},

resizeTitlebarAndShadow_win0:function()
{
    
    var newWidth = popupObj_win0.currWidth;
    var newHeight = popupObj_win0.currHeight;
    var popupTitle = document.getElementById('popupTitle');
    var popupTitleBarMiddle = document.getElementById('popupTitleBarMiddle');
    if (browserInfoObj.isSafari && !popupObj_win0.isSwanSS)
        popupObj_win0.sizeTitle(newWidth);
    else if('ltr'=='rtl')
        popupObj_win0.sizeTitle(newWidth +1 );
    else
        popupObj_win0.sizeTitle(newWidth + 5);
    popupTitle.style.width = (popupTitleBarMiddle.offsetWidth - 45) + 'px';

    if(popupObj_win0.popFrame){
        popupObj_win0.popFrame.style.width = (newWidth) + 'px';
        popupObj_win0.popFrame.style.height = (newHeight) + 'px';
    }

    if(popupObj_win0.popShadow){
        
        if('ltr'=='rtl') {
            if (browserInfoObj.isSafari)  {
                if(popupObj_win0.isSwanSS)
                   popupObj_win0.popShadow.style.width = (newWidth) + 8 +  'px';
                else
                   popupObj_win0.popShadow.style.width = (newWidth) + 3 +  'px';
            }
            else
               popupObj_win0.popShadow.style.width = (newWidth) + 3 +  'px';
            popupObj_win0.popShadow.style.height = (newHeight) + 'px';
        }  // end of if('ltr'=='rtl')
        else   {
           if (browserInfoObj.isSafari) {
               if(popupObj_win0.isSwanSS)
                    popupObj_win0.popShadow.style.width = (newWidth) + 8 +  'px';
                 else
                    popupObj_win0.popShadow.style.width = (newWidth) + 5 +  'px';
           }
           else {
                if (browserInfoObj.isIE) {
                   if(popupObj_win0.isSwanSS)
                      popupObj_win0.popShadow.style.width = (newWidth) + 8 +  'px';
                   else
                      popupObj_win0.popShadow.style.width = (newWidth) + 10 +  'px';
                }
                else {
                   if(popupObj_win0.isSwanSS)
                      popupObj_win0.popShadow.style.width = (newWidth) + 8 +  'px';
                   else
                      popupObj_win0.popShadow.style.width = (newWidth) + 10 +  'px';
                }
          }
          popupObj_win0.popShadow.style.height = (newHeight) + 40 + 'px';
        }  // end of else

        
        if('ltr'=='rtl')  {
           if (browserInfoObj.isIE)
              popupObj_win0.sizeShadowImageContainers(newHeight + 35, newWidth + 1 );
           else {
              if ( browserInfoObj.isSafari) {
                if(popupObj_win0.isSwanSS)
                   popupObj_win0.sizeShadowImageContainers(newHeight + 37, newWidth+ 7);
                else
                   popupObj_win0.sizeShadowImageContainers(newHeight + 37, newWidth+ 2);
              }
              else
                popupObj_win0.sizeShadowImageContainers(newHeight + 37, newWidth + 2);
           }
         }  // end if('ltr'=='rtl') 
         else  {
            if (browserInfoObj.isIE) {
                if(popupObj_win0.isSwanSS)
                    popupObj_win0.sizeShadowImageContainers(newHeight + 35, newWidth+ 6);
                else
                   popupObj_win0.sizeShadowImageContainers(newHeight + 35, newWidth+ 8);
            }
            else  {
                if ( browserInfoObj.isSafari) {
                  if(popupObj_win0.isSwanSS)
                      popupObj_win0.sizeShadowImageContainers(newHeight + 44 - 7, newWidth + 7);
                  else
                      popupObj_win0.sizeShadowImageContainers(newHeight + 44 - 8, newWidth + 4);
                }
                else  {
                  if(popupObj_win0.isSwanSS)
                     popupObj_win0.sizeShadowImageContainers(newHeight + 44 - 7, newWidth + 7);
                  else
                     popupObj_win0.sizeShadowImageContainers(newHeight + 44 - 7,newWidth + 9);
                }
            }  // end of else
         }  // end of else
     }  // end of if(popupObj_win0.popShadow)
},

cancelEvent_win0:function(e)
{
    if( !e ) { e = window.event; }
    return (popupObj_win0.moveCounter==-1 && popupObj_win0.initResizeCounter==-1)?true:false;
},

initResizeWindow_win0:function(e)
{
    if(document.all)
        e = event;
    popupObj_win0.setResizeEvent_win0(document);
    
    if (popupObj_win0.popFrame)
        { 
        var popupIframeDoc = popupObj_win0.popFrame.contentWindow.document;
        if (popupIframeDoc) 
            popupObj_win0.setResizeEvent_win0(popupIframeDoc);
        }

    popupObj_win0.popInner=document.getElementById('popupInner');   // modal window content
    popupObj_win0.popupDragFrame = document.getElementById('popupDragFrame');   // frame to be dragged
    popupObj_win0.startWindowSize = [popupObj_win0.popInner.offsetWidth,popupObj_win0.popInner.offsetHeight];
    var mousePos = ptCommonObj.getMouseCoords(e);            // get mouse coordinates
    popupObj_win0.startEventPos = [mousePos.x, mousePos.y];
    
    if (popupObj_win0.popupDragFrame)    
       {
        popupObj_win0.popupDragFrame.style.width= popupObj_win0.popInner.offsetWidth;
        popupObj_win0.popupDragFrame.style.height= popupObj_win0.popInner.offsetHeight;
        var XYposition = ptCommonObj.getPosition(popupObj_win0.popInner);
        popupObj_win0.popupDragFrame.style.top= XYposition.y;
        if('ltr' == 'rtl' && XYposition.x >= 1)
           {
           popupObj_win0.popupDragFrame.style.left= XYposition.x - 1;
           if (browserInfoObj.isIE)
               popupObj_win0.popupDragFrame.style.width= popupObj_win0.popInner.offsetWidth -3;
           else
               popupObj_win0.popupDragFrame.style.width= popupObj_win0.popInner.offsetWidth - 7;
           }
        else  
           popupObj_win0.popupDragFrame.style.left= XYposition.x;
        popupObj_win0.popupDragFrame.style.display="block"; 
  	    popupObj_win0.popupDragFrame.style.zIndex="999";
       }
       
    popupObj_win0.initResizeCounter = 1;
    popupObj_win0.initResizeRestY = true;
    return false;
},

initElementWindows_win0:function(){
    var state = '1';
    if(!this.windowPositionArray)
        this.windowPositionArray = new Array();
    this.windowPositionArray[0] = Math.max(0,this.popContainer.style.left.replace('px','')); //left
    this.windowPositionArray[1] = Math.max(0,this.popContainer.style.top.replace('px','')); //top
    this.windowPositionArray[2] = Math.max(0,this.popContainer.style.width.replace('px','')); //width
    this.windowPositionArray[3] = Math.max(0,this.popContainer.style.height.replace('px','')); //height
    var resizeImg = document.getElementById('popupResizeImgModal');
    if (resizeImg) {
        ptEvent.add(resizeImg,"mousedown",this.initResizeElementWindow_win0);
        if('ltr' == 'rtl')
               resizeImg.style.cursor = 'ne-resize';
    }

    var popupTitle = document.getElementById('popupTitleModal');
    if (popupTitle) {
        ptEvent.add(popupTitle,"mousedown",this.initElementMove_win0);
        popupTitle.style.cursor = "move";
    }
    
    this.setResizeElementEvent_win0(this.popContainer);
    if (resizeImg) {
        this.setResizeElementEvent_win0(resizeImg);
        if('ltr' == 'rtl')
               resizeImg.style.cursor = 'ne-resize';
    }
    
    
    
    
    if ( !document.getElementById(popupModalObj_win0.gridFirstRowID) ) {
	
	
    	this.nMinHeight = document.getElementById(popupModalObj_win0.gridFirstRowID).offsetHeight * 5;    
    }        
    
    var popupMaskModal = document.getElementById('popupMaskModal');
    if (popupMaskModal)
       this.setResizeElementEvent_win0(popupMaskModal);  // to make grid zoom move work when mouse is outside of the grid zoom area
    return;
},

setResizeElementEvent_win0:function(obj)
{
    ptEvent.add(obj,"mouseup",popupModalObj_win0.stopElementMove_win0);
    ptEvent.add(obj,"mousemove",popupModalObj_win0.moveElementWindow_win0);
    
    
    ptEvent.add(obj,"dragstart",popupModalObj_win0.cancelElementEvent_win0);   
    ptEvent.add(obj,"selectstart", popupModalObj_win0.cancelElementEvent_win0);
},

initElementMove_win0:function(e)
{
    if(document.all)
        e = event;
    var nLeft=parseInt(popupModalObj_win0.popContainer.style.left+0);                  // grid zoom modal window's left coordinate
    var nTop=parseInt(popupModalObj_win0.popContainer.style.top+0);                   // grid zoom modal window's top coordinate
 
    popupModalObj_win0.moveCounter = 0; // grid zoom move flag
    popupModalObj_win0.startEventPos = [e.clientX,e.clientY];  // mouse starting position
    popupModalObj_win0.startPosWindow = [nLeft,nTop]; // grid zoom modal window starting position
    popupModalObj_win0.moveCounter++;    // indicate start of move, i.e. mouse-down for grid zoom window's move
    document.body.style.cursor = "move";
},

stopElementMove_win0:function(e)
{
    popupModalObj_win0.moveCounter=-1;
    popupModalObj_win0.initResizeCounter=-1;
    document.body.style.cursor = "auto";
},

isVScrollVisible_win0:function()
{
    var modalElementRight = document.getElementById(popupModalObj_win0.gridScrollableAreaID);
    var modalElementRightHdr = document.getElementById(popupModalObj_win0.gridScrollableAreaHdrID);
    var bIsVScrollVisible = false;
    if (modalElementRight && modalElementRightHdr) {
        
        oColHeader = modalElementRightHdr.childNodes[0].childNodes[0].childNodes[0].childNodes[0];
        oLastColHeader = oColHeader.childNodes[oColHeader.childNodes.length - 1];
        if (oLastColHeader.childNodes[0].tagName == 'SPAN' && (oLastColHeader.childNodes[0].innerHTML == '<NOBR>&nbsp;</NOBR>') || (oLastColHeader.childNodes[0].innerHTML == '<nobr>&nbsp;</nobr>'))
                bIsVScrollVisible = true;
    }
    return bIsVScrollVisible;
},

moveElementWindow_win0:function(e)
{
    if(document.all)
        e = event;

    if(browserInfoObj.isIE && e.button == 0 )
        popupModalObj_win0.stopElementMove_win0(e);         

    // grid zoom move event
    if(popupModalObj_win0.moveCounter>=1)  
    {
        var mx = e.clientX;
        var my = e.clientY;
        mx = popupModalObj_win0.startPosWindow[0] + mx - popupModalObj_win0.startEventPos[0];     // new left
        my = popupModalObj_win0.startPosWindow[1] + my - popupModalObj_win0.startEventPos[1];     // new top
        var oPopup = document.getElementById("popupInnerModal");
        var nPopupWidth = oPopup.offsetWidth;
        var nPopupHeight =oPopup.offsetHeight;
        
        if (mx <=0)
            mx = 0;
        else if ((mx+nPopupWidth) >= (popupModalObj_win0.popMaskScrollWidth - 40))
	    mx = popupModalObj_win0.popMaskScrollWidth - nPopupWidth - 20;

        popupModalObj_win0.popContainer.style.left = mx + 'px';
        
        if (my <= 0)
	   my = 0;
	else if ((my+nPopupHeight) >= (popupModalObj_win0.popMaskScrollHeight - 40))
	   my = popupModalObj_win0.popMaskScrollHeight - nPopupHeight - 20;

        popupModalObj_win0.popContainer.style.top = my + 'px';

        //window.status= "moveElementWindow: (Top,Left)="+popupModalObj_win0.popContainer.style.top +"," + popupModalObj_win0.popContainer.style.left;
    }

    // grid zoom resize event
    if(popupModalObj_win0.initResizeCounter>=1)  
    {
        
        var oldHeight = popupModalObj_win0.currHeight;
        var oldWidth = popupModalObj_win0.currWidth;

        var newWidth=0;
        var newHeight = Math.max(popupModalObj_win0.windowMinSize[1],popupModalObj_win0.startWindowSize[1] + e.clientY - popupModalObj_win0.startEventPos[1]);
        if('ltr'=='rtl')
           {
             var mx = e.clientX;
             if ((mx > 0) && (mx < (ptCommonObj.getViewportWidth()-10)))
                {
                 newWidth = Math.max(popupModalObj_win0.windowMinSize[0],popupModalObj_win0.startWindowSize[0] - mx + popupModalObj_win0.startEventPos[0]);
                 
                 if (Math.abs(oldWidth-newWidth) < 10 && Math.abs(oldHeight - newHeight) < 10)
                    {
                    if(!document.all)
                       return false;
                    return;
                    }
                 if(newWidth > popupModalObj_win0.windowMinSize[0])
                   {
                     if (browserInfoObj.isIE)
                       popupModalObj_win0.popContainer.style.right = mx + newWidth + 'px';
                     else
                       popupModalObj_win0.popContainer.style.left = mx + 'px';
                   }
                }
              else
                newWidth = oldWidth;
           }
        else
            newWidth = Math.max(popupModalObj_win0.windowMinSize[0],popupModalObj_win0.startWindowSize[0] + e.clientX - popupModalObj_win0.startEventPos[0]);
        
        
        if (Math.abs(oldWidth-newWidth) < 10 && Math.abs(oldHeight - newHeight) < 10)
           {
           if(!document.all)
              return false;
           return;
           }

        popupModalObj_win0.popContainer.style.width =  newWidth + 'px';
        popupModalObj_win0.popContainer.style.height = newHeight  + 'px';
        
        popupModalObj_win0.currWidth = newWidth;
        popupModalObj_win0.currHeight = newHeight;

        var popupInnerModal = document.getElementById('popupInnerModal');
        popupInnerModal.style.width =  (newWidth + 5) + 'px';

        var popupContentContainerModal = document.getElementById('popupContentContainerModal');
        if (!browserInfoObj.isIE && popupObj_win0.isSwanSS)
            popupContentContainerModal.style.width =  (newWidth + 1) + 'px';
        else
            popupContentContainerModal.style.width =  (newWidth + 5) + 'px';
        popupContentContainerModal.style.height =  (newHeight + 7) + 'px';

        var popupBottomModal = document.getElementById('popupBottomModal');
        if (!browserInfoObj.isIE && popupObj_win0.isSwanSS)
            popupBottomModal.style.width =  (newWidth + 1) + 'px';
        else
            popupBottomModal.style.width =  (newWidth + 5) + 'px';

        
        var pxHeightChange = newHeight - oldHeight;
        var pxWidthChange = newWidth - oldWidth;
        
        var modalElementRight = document.getElementById(popupModalObj_win0.gridScrollableAreaID);
        var modalElementRightHdr = document.getElementById(popupModalObj_win0.gridScrollableAreaHdrID);
        if (modalElementRight && modalElementRightHdr) 
            {
            
            var bIsVScrollVisible = popupObj_win0.isVScrollVisible_win0();
            
            
            
            var nMaxHeight = modalElementRight.childNodes[0].offsetHeight;

            
            
            
            var oScroll = document.getElementById(popupModalObj_win0.gridScrollID);  // grid table id
            if (pxHeightChange > 0 && bIsVScrollVisible && (modalElementRight.offsetHeight + pxHeightChange) <  nMaxHeight) 
                {
                if (browserInfoObj.isIE)
                    modalElementRight.style.height =  (modalElementRight.offsetHeight + pxHeightChange) + 'px';
                else if (browserInfoObj.isSafari)  
                    {
                    var nGridHeight=modalElementRight.offsetHeight + pxHeightChange;
                    modalElementRight.style.height = nGridHeight+ 'px';
                    oScroll.style.height = (oScroll.offsetHeight + pxHeightChange+29) + 'px';
                    }
                else
                    {
                    var nGridHeight=modalElementRight.offsetHeight + pxHeightChange;
                    modalElementRight.style.height = nGridHeight+ 'px';
                    oScroll.style.height = (oScroll.offsetHeight + pxHeightChange+14) + 'px';
                    }
                }
            
            
            
            
            else if (pxHeightChange < 0 && bIsVScrollVisible) {
                    if (browserInfoObj.isIE)
                        modalElementRight.style.height =  Math.max(popupModalObj_win0.nMinHeight, (modalElementRight.offsetHeight + pxHeightChange)) + 'px';
                    else if (browserInfoObj.isSafari)
                        {
                        modalElementRight.style.height =  Math.max(popupModalObj_win0.nMinHeight, (modalElementRight.offsetHeight + pxHeightChange-50)) + 'px';
                        oScroll.style.height =  Math.max(popupModalObj_win0.nMinHeight, (modalElementRight.offsetHeight + 102)) + 'px';
                        }
                    else {
                        modalElementRight.style.height =  Math.max(popupModalObj_win0.nMinHeight, (modalElementRight.offsetHeight + pxHeightChange-50)) + 'px';
                        oScroll.style.height =  Math.max(popupModalObj_win0.nMinHeight, (modalElementRight.offsetHeight + 88)) + 'px';
                        }
                }
        }

        
        var modalElementLeft = document.getElementById(popupModalObj_win0.gridFrozenAreaID);
        if (modalElementLeft) {
            modalElementLeft.style.height =  (modalElementRight.offsetHeight) + 'px';
            }

        
        var modalElementToolBar = document.getElementById(popupModalObj_win0.gridToolBar);
        if (modalElementToolBar)
            modalElementToolBar.style.width = (modalElementLeft.offsetWidth + modalElementRight.offsetWidth) + 'px';

        
        var popupTitle = document.getElementById('popupTitleModal');
        var popupTitleBarMiddle = document.getElementById('popupTitleBarMiddleModal');
        popupModalObj_win0.sizeTitle(newWidth + 5, true);
        popupTitle.style.width = (popupTitleBarMiddle.offsetWidth - 45) + 'px';

        if(popupModalObj_win0.popFrame){
            popupModalObj_win0.popFrame.style.width = (newWidth) + 'px';
            popupModalObj_win0.popFrame.style.height = (newHeight) + 'px';
        }

        if(popupModalObj_win0.popShadow){
            
            if (browserInfoObj.isIE) {
                 if('ltr' == 'ltr')
                    {
                       if(popupObj_win0.isSwanSS)
                          popupModalObj_win0.popShadow.style.width = (newWidth) + 8 +  'px';
                       else
                          popupModalObj_win0.popShadow.style.width = (newWidth) + 10 + 'px';
                       popupModalObj_win0.popShadow.style.height = (newHeight) + 40 + 'px';
                    }
                 else
                    {
                       popupModalObj_win0.popShadow.style.width = (newWidth) + 3 +  'px';
                       popupModalObj_win0.popShadow.style.height = (newHeight) + 40 + 'px';
                    }
            }
            else {
                if (browserInfoObj.isSafari) {
                    if('ltr' == 'ltr') {
                       if(popupObj_win0.isSwanSS)
                           popupModalObj_win0.popShadow.style.width = (newWidth) + 8 + 'px';
                       else
                           popupModalObj_win0.popShadow.style.width = (newWidth) + 10 + 'px';
                       popupModalObj_win0.popShadow.style.height = (newHeight) + 40 + 'px';
                    }
                    else  {
                       popupModalObj_win0.popShadow.style.width = (newWidth) + 3 +  'px';
                       popupModalObj_win0.popShadow.style.height = (newHeight) + 40 + 'px';
                    }
                }
                else {
                    if('ltr' == 'ltr') {
                       if(popupObj_win0.isSwanSS)
                           popupModalObj_win0.popShadow.style.width = (newWidth) + 8 + 'px';
                       else
                           popupModalObj_win0.popShadow.style.width = (newWidth) + 10 + 'px';
                       popupModalObj_win0.popShadow.style.height = (newHeight) + 40 + 'px';
                    }
                    else  {
                       popupModalObj_win0.popShadow.style.width = (newWidth) + 3 +  'px';
                       popupModalObj_win0.popShadow.style.height = (newHeight) + 40 + 'px';
                    }
                }
            }

            
            if (browserInfoObj.isIE)  {
                 if('ltr' == 'ltr')  {
                    if(popupObj_win0.isSwanSS)
                         popupModalObj_win0.sizeShadowImageContainers(newHeight + 40, newWidth + 6, true);
                    else
                         popupModalObj_win0.sizeShadowImageContainers(newHeight + 42, newWidth + 8, true);
                 }
                 else  {
                    if(popupObj_win0.isSwanSS)
                         popupModalObj_win0.sizeShadowImageContainers(newHeight + 43, newWidth + 1, true);
                    else
                         popupModalObj_win0.sizeShadowImageContainers(newHeight + 42, newWidth + 1, true);
                 }
            }
            else {
                 if (browserInfoObj.isSafari)  {
                    if('ltr' == 'ltr')  {
                      if(popupObj_win0.isSwanSS)
                         popupModalObj_win0.sizeShadowImageContainers(newHeight + 44 , newWidth + 7, true);
                      else
                         popupModalObj_win0.sizeShadowImageContainers(newHeight + 44 , newWidth + 9, true);
                    }
                    else
                      popupModalObj_win0.sizeShadowImageContainers(newHeight + 44 , newWidth + 2, true);
                 }
                 else {
                    if('ltr' == 'ltr') {
                      if(popupObj_win0.isSwanSS)
                         popupModalObj_win0.sizeShadowImageContainers(newHeight + 44 , newWidth + 7, true);
                      else
                         popupModalObj_win0.sizeShadowImageContainers(newHeight + 44 , newWidth + 9, true);
                    }
                    else
                      popupModalObj_win0.sizeShadowImageContainers(newHeight + 44 , newWidth + 2, true);
                 }
            }
        }
    }
    if(!document.all)
        return false;
},

cancelElementEvent_win0:function(e)
{
    return (popupModalObj_win0.moveCounter==-1 && popupModalObj_win0.initResizeCounter==-1)?true:false;
},

initResizeElementWindow_win0:function(e)
{
    if(document.all)
        e = event;
    popupModalObj_win0.initResizeCounter = 0;
    popupModalObj_win0.startWindowSize = [popupModalObj_win0.popContainer.offsetWidth,popupModalObj_win0.popContainer.offsetHeight];
    popupModalObj_win0.startEventPos = [e.clientX,e.clientY];
    setTimeout('popupModalObj_win0.startResizeElementWindow_win0()',1);
    document.body.style.cursor = "ne-resize";
    return false;
},

startResizeElementWindow_win0:function()
{
     if(popupModalObj_win0.initResizeCounter>=0 && popupModalObj_win0.initResizeCounter<=1)
        popupModalObj_win0.initResizeCounter++;
}

}

/* PT_MOpopup Constructor for mouse-over popup  */
function PT_MOpopup()
{}

PT_MOpopup.prototype = {
init:function()
{
this.focusElem = null;             // onfocus element
this.bFocus=true;                  // run focus code or not
this.bIs_shown = false;            // popup is visible or not flag; true - visible; false - invisible
this.nOpenDelay = 1;               // time in seconds before popup opens
this.nCloseDelay = 0.6;            // time in seconds before popup closes
this.tHandle=null;                 // timer handle
this.nDefWidth = 250;              // popup default width
this.nDefHeight = 200;             // popup default height
this.nMinHeight = 40;              // popup minimum height
this.nMinWidth = 60;               // popup minimum width
this.MOcurrWidth = this.nDefWidth;    // final popup width
this.MOcurrHeight = this.nDefHeight;  // final popup height
this.MOpop="MOpopupContainer";     // popup container id
this.x=0;                          // popup left coordinate
this.y=0;                          // popup top coordinate
this.hoverId=null;                 // mouse-overed control id
this.hoverpopupId=null;            // popup page div id to retrieve popup page content to be displayed
this.bNetscp=0;                    // Netscape browser
this.bSafari=0;                    // Safari browser
this.bIE=0;                        // IE browser
this.fontW=7;                      // browser font width 
this.fontW2=9;                     // our message catalog style font width
this.fontH=18;                     // brower font height
this.agt=navigator.userAgent.toLowerCase();
if(this.agt.indexOf("safari")!=-1)
  this.bSafari=1;
else if(navigator.appName=="Netscape")
  this.bNetscp=1;
else
  this.bIE=1;
},

GetElementTop:function(object)    // get object's offsetTop
{
var nTop=object.offsetTop;
var MyParent=object.offsetParent;
while(MyParent!=null)
{
   nTop+=MyParent.offsetTop;
   MyParent=MyParent.offsetParent;
}
return nTop;
},

GetElementleft:function(object)  // get object's offsetLeft
{
var nLeft=object.offsetLeft;
var MyParent;
  MyParent=object.offsetParent;

while(MyParent!=null)
{
   nLeft+=MyParent.offsetLeft-MyParent.scrollLeft;
   if(this.bSafari)
        MyParent=MyParent.parentNode;
  else
    MyParent=MyParent.offsetParent;
}

nLeft+=document.body.scrollLeft; //for IE
return nLeft;
},

SetIEDivSize:function(hPop)   // For IE browser, set width and height of div for static text 
{
var viewportWidth = ptCommonObj.getViewportWidth()*0.9;      // viewable width
var nMaxChars = viewportWidth/this.fontW;                    // maximun number of characters per line
var nExtraLines=0;                                           
var nCharPerLine=hPop.offsetWidth/this.fontW+1;              // 7 pixel width per character for the smallest browser font
var nLines=hPop.offsetHeight/this.fontH+1;                   // 18 pixel height for browser font
if (nCharPerLine > nMaxChars) {                          // allow only 40 characters per line
    nExtraLines = nCharPerLine/nMaxChars+1;              // extra lines if width > 50 characters 
    this.nDefWidth=nMaxChars*this.fontW2;                // 9 pixels width per character 
    this.nDefHeight = (nLines + nExtraLines)*this.fontH ;
}
else {   
    this.nDefWidth= hPop.offsetWidth+this.fontW2;
    this.nDefHeight = hPop.offsetHeight+this.fontH;
}  
},

SetDivSize:function(hPop)   // set width and height of div for static text 
{
    var viewportWidth = ptCommonObj.getViewportWidth()*0.9;              // viewable width
	// set popup width according to viewable area
	if (browserInfoObj.isIE && (viewportWidth-30) > 60)
	    viewportWidth = viewportWidth - 30;                          // adjust viewable width for IE

    if (browserInfoObj.isIE && hPop.offsetWidth > viewportWidth)     // limit IE width since max-width is not available in IE
        this.SetIEDivSize(hPop);
    else {                        
        this.nDefWidth= hPop.offsetWidth+this.fontW2;
        this.nDefHeight = hPop.offsetHeight+this.fontH;
    }
},

// for accessibility, display popup
StartAccess:function(event, hoverId,popupId, nWidth, nHeight)
{
this.StartPopup(hoverId,popupId, nWidth, nHeight);
cancelBubble(event);
return false; // cancel event
},

// for accessibility, hide popup
StopAccess:function(event)
{
this.StopPopup();
cancelBubble(event);
return false; // cancel event
},

StartAccessibilityPopup:function(hoverId,popupId, nWidth, nHeight)   // called by an html control's ENTER press key event to display popup
{
  //window.status="StartPopup:hoverID="+hoverId +", "+ hoverId.length + ";this.MOpop="+this.MOpop +", "+ (this.MOpop).length ;       // debug
  if (hoverId.length == 0)   // popup is in display
      return;

  var hPop = document.getElementById(popupId);      // get popup page control     
  this.hoverId=hoverId;
  this.hoverpopupId=popupId;
  this.tHandle = null;
  this.ShowAccessibilityPopup();
},

ShowAccessibilityPopup:function()   // display popup page; called by StartPopup function
{
  this.tHandle = null;
  if (this.hoverpopupId == null || this.hoverpopupId=="" ) return;

  var hPop = document.getElementById(this.hoverpopupId);  // get popup content div
  var hp = document.getElementById(this.MOpop);        // get popup container - <table>
  var popupFrame = document.getElementById("MOdivpopupFrame");     // get popup content - <div>
  hp.style.display = "block";
  popupFrame.innerHTML=hPop.innerHTML;
  popupFrame.style.dislay='block';

  if (popupFrame)
      popupFrame.style.cursor = "Pointer";                 // set cursor for popup content frame
  this.bIs_shown = true;
  this.bFocus = true;
  hp.style.top=1+"px";    // position at top-left
  hp.style.left=1+"px";
  hp.style.visibility = "Visible";
  hp.style.zIndex="1";
  if (document.activeElement != null && document.activeElement.tagName != null && document.activeElement.tagName.indexOf("BODY") <0) {
      this.focusElem = document.activeElement;            // save focused control to be restored when popup page is hidden      
      if (this.focusElem != null)
          this.focusElem.blur();
  }
  else
      this.focusElem=null;

  bMOPopupDisplay_win0=true;
  for (var i=0; i<document.forms.length; i++)
      {
      document.forms[i].style.visibility="hidden";
      if (!this.bIE)
          document.forms[i].style.display="none";
      }

  if (this.bIE)
      popupFrame.childNodes[0].focus();  // set focus on the image indicating the start of the popup
  else
      popupFrame.children[0].focus();  // set focus on the image indicating the start of the popup
     
},

StartPopup:function(hoverId,popupId, nWidth, nHeight)   // called by an html control's mouse-over event to display popup
{
  //window.status="StartPopup:hoverID="+hoverId +", "+ hoverId.length + ";this.MOpop="+this.MOpop +", "+ (this.MOpop).length ;       // debug
  if (bAccessibility_win0)     // if it is in accessibility mode, display accessibility popup
      {
      this.StartAccessibilityPopup(hoverId,popupId, nWidth, nHeight);
      return;
      }

  
  if ((hoverId.toLowerCase()).indexOf((this.MOpop).toLowerCase()) == 0 && hoverId.length == (this.MOpop).length)
  {
     if (this.tHandle != null)
        clearTimeout(this.tHandle);
     if (this.bIs_shown == true)
         return;
     this.ShowPopup();
  }
  else  // mouse-over a control on an non-popup page
  {
     this.nDefWidth = 250;              // popup default width
     this.nDefHeight = 200;             // popup default height
     if (this.tHandle != null)
         clearTimeout(this.tHandle);
     if (hoverId != null && hoverId != "") {
         var hItem = document.getElementById(hoverId);      // get mouse-overed control
         if (hItem)
            hItem.style.cursor = "Pointer";                 // set cursor for mouse-overed control
     }
     
     var hPop = document.getElementById(popupId);      // get popup page control     
     
     
     
     var MOpopupDiv = document.getElementById("MOpopupDiv");     // get the temporary popup html holder - <div>
     MOpopupDiv.innerHTML=hPop.innerHTML;
     
     
     
     if ((nWidth== 0 || nHeight==0) && popupId != null && popupId != "") {
         if (hPop)   {       // set default popup width/height for message catalog message
            this.SetDivSize(MOpopupDiv);
            this.MOcurrHeight=this.nDefHeight;
            this.MOcurrWidth=this.nDefWidth;
         }   
     }
     else {   // regular popup page, i.e. non-catalog popup

         if (hPop) {                                       // set popup page height and width
            this.MOcurrHeight = MOpopupDiv.offsetHeight;
            this.MOcurrWidth = MOpopupDiv.offsetWidth;
         }
     }
     
     MOpopupDiv.innerHTML='t';         // reset the temporary popup content holder - <div>
     this.hoverId=hoverId;
     this.hoverpopupId=popupId;
     if (this.MOcurrWidth <=20)        // popup width <= 20 pixels
         this.MOcurrWidth = this.nDefWidth;                 // take popup default width

     if (this.MOcurrHeight <= 20)    // popup height <= 20 pixels
         this.MOcurrHeight = this.nDefHeight;               // take popup default height
     this.tHandle=setTimeout("MOpopupObj_win0.ShowPopup()",this.nOpenDelay * 1000);
  }
},

SetFocusFlag:function(bValue)   // set focus flag
{
  if (!bAccessibility_win0)  // not accessibility mode
     this.bFocus = bValue;
},

ShowPopup:function()   // display popup page; called by StartPopup function
{
  this.tHandle = null;
  if (this.hoverpopupId == null || this.hoverpopupId=="" ) return;
  var hp = document.getElementById(this.hoverpopupId);  // get popup content div
  this.UpdatePopup(hp.innerHTML);             // use popup content to update popup container.
  hp = document.getElementById(this.MOpop);             // get popup container
  var popupFrame = document.getElementById('MOdivpopupFrame');  // get popup content frame div
  if (popupFrame)
      popupFrame.style.cursor = "Pointer";                 // set cursor for popup content frame
  this.bIs_shown = true;
  this.bFocus = true;
  hp.style.top=this.y+"px";
  hp.style.left=this.x+"px";
  hp.style.visibility = "Visible";
  hp.style.zIndex="1";
  if (document.activeElement != null && document.activeElement.tagName != null && document.activeElement.tagName.indexOf("BODY") <0) {

      this.focusElem = document.activeElement;            // save focused control to be restored when popup page is hidden      
      if (this.focusElem != null)
          this.focusElem.blur();
  }
  else
      this.focusElem=null;

},


//StopPopup:function()   // called by an html control's mouse-out event to close popup
StopPopup:function(bNoDelay)   // called by an html control's mouse-out event to close popup, bNoDely is passed, Hides popup immediately
{
  if (this.tHandle != null)
      clearTimeout(this.tHandle);
  if (this.hoverId != null || this.hoverId != "") {
      var hItem = document.getElementById(this.hoverId);  // get mouse-overed control
      if (hItem)
          hItem.style.cursor = "";                 // reset cursor for mouse-overed control
  }
  this.tHandle = null;
  if ((bAccessibility_win0) || (typeof bNoDelay !="undefined"))  // accessibility mode
     this.HidePopup();
  else
     this.tHandle=setTimeout("MOpopupObj_win0.HidePopup()", 1000 * this.nCloseDelay);
},

HidePopup:function()  // called by StopPopup function to close popup
{
  var hp = document.getElementById(this.MOpop);      // get popup container to hide it
  var MOpopFrame = document.getElementById("MOdivpopupFrame");     // get popup content - <div>
  hp.style.visibility = "Hidden";
  this.bIs_shown = false;
  if (bAccessibility_win0)   // unhide form elements in accessiblity mode
     {
     for (var i=0; i<document.forms.length; i++)
         {
         document.forms[i].style.visibility="visible"
         if (!this.bIE)
             document.forms[i].style.display="block";
         }   
     }
  if (this.focusElem != null && this.bFocus)  {                   // restore focus 
     try {
         this.focusElem.focus(); 
     }
     catch(err){}
  }

},

UpdatePopup:function(sHTML)  // update popup with html content and set position and size of popup
{
    var MOpopContainer = document.getElementById(this.MOpop);        // get popup container - <table>
    var MOpopupInner = document.getElementById("MOpopupInner");      // get popup inner - <td>
    var MOpopFrame = document.getElementById("MOdivpopupFrame");     // get popup content - <div>
    MOpopFrame.scrollTop=0;                                          // reset scrollbar position
    MOpopFrame.scrollLeft=0;                                         // reset scrollbar position
    MOpopContainer.style.display = "block";
    MOpopupInner.style.display = "block";
    hItem=document.getElementById(this.hoverId);                     // get mouse-over item
	var viewportHeight = ptCommonObj.getViewportHeight();            // viewable height
	var viewportWidth = ptCommonObj.getViewportWidth();              // viewable width
	// set popup width according to viewable area
	if (this.bIE && (viewportWidth-30) > 60)
	    viewportWidth = viewportWidth - 30;                          // adjust viewable width for IE
    else if (!this.bIE && (viewportWidth-50) > 60)
	    viewportWidth = viewportWidth - 50;                          // adjust viewable width for non-IE

	if (this.MOcurrWidth > 0)  {
	   if (this.MOcurrWidth > viewportWidth)
	  	  this.MOcurrWidth = viewportWidth;
    }
    else
	   this.MOcurrWidth = viewportWidth;

    // set popup left coordinate
    var nLeft1=this.GetElementleft(hItem);                               // hovered item leftoffset
    var nLeft=nLeft1 - document.body.scrollLeft;                         // hovered item visible left coordinate
    var nSaveLeft = 0;
    if (nLeft<0)  {                                                      // scroll was moved to the right
        nSaveLeft = nLeft;
        nLeft=-nLeft;
    }
    var nRight = nLeft + this.MOcurrWidth;                               // right coordinate based on visible area
    var nDiff = viewportWidth - nRight; // difference between the right-end of the visible area and the popup right coordinate

    if (nDiff >0)       // popup width is not too big for the visible area
        this.x = nLeft1;
    else {              // popup width is too big for the visible area
        this.x = nLeft1+nDiff;
        if (this.x <0)     
            this.MOcurrWidth = this.MOcurrWidth + this.x;  // reduce popup width
    }

     if (this.MOcurrWidth <this.nMinWidth)
        this.MOcurrWidth = this.nMinWidth;       // give it a minimum width

    if (this.x <=0) {
        if (nSaveLeft <0)
            this.x = document.body.scrollLeft + 1;
        else
            this.x = 1;
    }

    // set popup height according to viewable area and its top coordinate
    var nHtop1=this.GetElementTop(hItem);                                // hovered item topoffset coordinate
    var nHtop=nHtop1 - document.body.scrollTop;                          // hovered item visible top coordinate
    var nAbHeight = nHtop - 41;                                          // height when display above mouse-over item
    var nBelHeight = viewportHeight - (nHtop + hItem.offsetHeight)-40;   // height when display below mouse-over item
    if (!this.bIE) {                                                     // adjust viewable height for non-IE browsers
        nAbHeight = nAbHeight - 15;
        nBelHeight = nBelHeight -15;
    }
    if (this.MOcurrHeight > nAbHeight && this.MOcurrHeight > nBelHeight) {
       if (nAbHeight > nBelHeight) {
          this.MOcurrHeight = nAbHeight;
          this.y = nHtop1 - this.MOcurrHeight-40;           // y when displayed above hovered item
       }
       else {
          this.MOcurrHeight = nBelHeight;
          this.y = nHtop1 + hItem.offsetHeight+9;           // y when displayed below hovered item
       }

    }
    else if (this.MOcurrHeight <= nAbHeight)
          this.y = nHtop1 - this.MOcurrHeight-36;           // y when displayed above hovered item
    else if (this.MOcurrHeight <= nBelHeight)
          this.y = nHtop1 + hItem.offsetHeight+9;           // y when displayed below hovered item

    if (this.y<0) {
        this.MOcurrHeight = this.MOcurrHeight + this.y;     // reduce popup height
        this.y = 0;
    }

    if (this.MOcurrHeight < this.nMinHeight)
        this.MOcurrHeight = this.nMinHeight;                // give it a minimum height

    MOpopContainer.style.width = this.MOcurrWidth;          // popup width
    MOpopupInner.style.width = this.MOcurrWidth;            // popup width
    MOpopupInner.style.height = this.MOcurrHeight;          // popup height
    MOpopFrame.innerHTML=sHTML;
    MOpopFrame.style.dislay='block';
    MOpopFrame.style.width = (this.MOcurrWidth) + "px";
    
    
    MOpopFrame.scrollLeft=500;  
    
    if (MOpopFrame.scrollLeft>0 && (this.MOcurrWidth+MOpopFrame.scrollLeft)<viewportWidth)  {  
        this.MOcurrWidth=this.MOcurrWidth+MOpopFrame.scrollLeft;
        MOpopFrame.innerHTML=sHTML;
        MOpopContainer.style.width = this.MOcurrWidth;          // popup width
	    MOpopupInner.style.width = this.MOcurrWidth;            // popup width
        MOpopFrame.style.width = (this.MOcurrWidth) + "px";
    }

    MOpopFrame.scrollLeft=0; 
    if (!this.bIE && !browserInfoObj.isSafari)
        MOpopFrame.style.height = "100%";
    else
        MOpopFrame.style.height = (this.MOcurrHeight) + "px";
//window.status="h="+this.MOcurrHeight+";w="+this.MOcurrWidth;  //debug

}
}

/* PT_Helppopup Constructor for Embedded Help popup  */
function PT_Helppopup()
{}

PT_Helppopup.prototype = {
init:function()
{
this.focusElem = null;             // onfocus element
this.bFocus=true;                  // run focus code or not
this.bIs_shown = false;            // popup is visible or not flag; true - visible; false - invisible
this.nOpenDelay = 1;               // time in seconds before popup opens
this.nCloseDelay = 0.6;            // time in seconds before popup closes
this.tHandle=null;                 // timer handle
this.nDefWidth = 250;              // popup default width
this.nDefHeight = 200;             // popup default height
this.minWidth  = 341;
this.minHeight = 150; 
this.HelpcurrWidth = this.nDefWidth;    // final popup width
this.HelpcurrHeight = this.nDefHeight;  // final popup height
this.Helppop="HelppopupContainer";     // popup container id
this.x=0;                          // popup left coordinate
this.y=0;                          // popup top coordinate
this.hoverId=null;                 // mouse-overed control id
this.hoverpopupId=null;            // popup page div id to retrieve popup page content to be displayed
this.bFirefox=0;                   // Firefox browser
this.bSafari=0;                    // Safari browser
this.bIE=0;                        // IE browser
this.fontW=7;                      // browser font width
this.fontW2=9;                     // our message catalog style font width
this.fontH=18;                     // brower font height
this.moveCounter = -1;
this.isSwanSS = ((typeof(ptStyleSheet) == "undefined") || (ptStyleSheet.indexOf("SWAN") != -1)) ? true : false;
this.startEventPos = new Array();
this.startPosWindow = new Array();
this.startWindowSize = new Array();
this.agt=navigator.userAgent.toLowerCase();
if(this.agt.indexOf("safari")!=-1)
  this.bSafari=1;
else if(this.agt.indexOf("firefox")!=-1)
  this.bFirefox=1;
else
  this.bIE=1;
this.haslabel="false";
this.isSwanSS = ((typeof(ptStyleSheet) == "undefined") || (ptStyleSheet.indexOf("SWAN") != -1)) ? true : false;
},

GetElementTop:function(evt, object)    // get object's offsetTop
{
//return evt.clientY;
if(evt.pageY) return evt.pageY;
else if (evt.clientY)
   return evt.clientY + (document.documentElement.scrollTop ?  document.documentElement.scrollTop : document.body.scrollTop);
else return null;
},

GetElementleft:function(evt, object)  // get object's offsetLeft
{
//return evt.clientX;
if(evt.pageX) return evt.pageX;
else if (evt.clientX)
   return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft);
else return null;
},

SetDivSize:function(hPop)   // set width and height of div for static text
{
   var tempw = this.minWidth;
   var temph = 0;
   var maxWidth  = ptCommonObj.getViewportWidth()*0.8;
   var maxHeight  = ptCommonObj.getViewportHeight()*0.8;
   var pos=0;	
   while(pos != -1) {
      if (this.bIE) {
          pos = hPop.innerHTML.indexOf("<BR>", pos + 4);	
          if(pos != -1)	
             temph += this.fontH;		
          }
      else {
          pos = hPop.innerHTML.indexOf("<br>", pos + 4);
          if(pos != -1)
             temph += this.fontH*1.01;			
          }
   }
   while((hPop.innerHTML.length * this.fontW *  this.fontH > tempw * temph) && (tempw != maxWidth || temph != maxHeight)) //increase the size
   {
      if(tempw < maxWidth)  tempw = tempw + this.minWidth * 0.1;
      else tempw = maxWidth;
      if(temph < maxHeight) temph = temph + this.minHeight * 0.1;	
      else temph = maxHeight;   	
   } 
   if(temph < this.minHeight)
      temph = this.minHeight;
   if(temph > maxHeight)
      temph = maxHeight;

   this.nDefWidth = tempw;
   this.nDefHeight = temph;	
},

StartAccessibilityPopup:function(hoverId,popupId, nWidth, nHeight)   // called by an html control's ENTER press key event to display popup
{
  //window.status="StartPopup:hoverID="+hoverId +", "+ hoverId.length + ";this.MOpop="+this.MOpop +", "+ (this.MOpop).length ;       // debug
  if (hoverId.length == 0)   // popup is in display
      return;

  var hPop = document.getElementById(popupId);      // get popup page control     
  this.hoverId=hoverId;
  this.hoverpopupId=popupId;
  this.tHandle = null;
  this.ShowAccessibilityPopup();
},

ShowAccessibilityPopup:function()   // display popup page; called by StartPopup function
{
  this.tHandle = null;
  if (this.hoverpopupId == null || this.hoverpopupId=="" ) return;

  var hPop = document.getElementById(this.hoverpopupId);  // get popup content div
  var hp = document.getElementById(this.Helppop);        // get popup container - <table>
  var popupFrame = document.getElementById("HelpdivpopupFrame");     // get popup content - <div>
  hp.style.display = "block";
  popupFrame.innerHTML=hPop.innerHTML;
  popupFrame.style.dislay='block';

  if (popupFrame)
      popupFrame.style.cursor = "Pointer";                 // set cursor for popup content frame
  this.bIs_shown = true;
  this.bFocus = true;
  hp.style.top=1+"px";    // position at top-left
  hp.style.left=1+"px";
  hp.style.visibility = "Visible";
  hp.style.zIndex="1";
  if (document.activeElement != null && document.activeElement.tagName != null && document.activeElement.tagName.indexOf("BODY") <0) {
      this.focusElem = document.activeElement;            // save focused control to be restored when popup page is hidden      
      if (this.focusElem != null)
          this.focusElem.blur();
  }
  else
      this.focusElem=null;

  bHelpPopupDisplay_win0=true;
  for (var i=0; i<document.forms.length; i++)
      {
      document.forms[i].style.visibility="hidden";
      if (!this.bIE)
          document.forms[i].style.display="none";
      }

  if (this.bIE)
      popupFrame.childNodes[0].focus();  // set focus on the image indicating the start of the popup
  else
      popupFrame.children[0].focus();  // set focus on the image indicating the start of the popup
     
},

// for accessibility, display popup
StartAccess:function(event, hoverId,popupId, nWidth, nHeight,labeltext)
{
this.StartAccessibilityPopup(hoverId,popupId, nWidth, nHeight);
cancelBubble(event);
return false; // cancel event
},

// for accessibility, hide popup
StopAccess:function(event)
{
this.StopPopup();
cancelBubble(event);
return false; // cancel event
},

StartPopup:function(evt,hoverId,popupId, nWidth, nHeight, labeltext, helptext)   // called by an html control's onclick event to display popup
{
  evt = evt || window.event;
  this.isSwanSS = ((typeof(ptStyleSheet) == "undefined") || (ptStyleSheet.indexOf("SWAN") != -1)) ? true : false;
  if ((hoverId.toLowerCase()).indexOf((this.Helppop).toLowerCase()) == 0 && hoverId.length == (this.Helppop).length)
  {
     if (this.tHandle != null)
        clearTimeout(this.tHandle);
     if (this.bIs_shown == true)
         return;
     this.ShowPopup(evt);
  }
  else  
  {
     this.nDefWidth = 250;              // popup default width
     this.nDefHeight = 200;             // popup default height
     if (this.tHandle != null)
         clearTimeout(this.tHandle);
     if (hoverId != null && hoverId != "") {
         var hItem = document.getElementById(hoverId);      // get mouse-overed control         
     }
    var HelppopTitleBarMiddle = document.getElementById("HelppopupTitleBarMiddle");
    if (HelppopTitleBarMiddle) {        
        ptEvent.add(HelppopTitleBarMiddle,"mousedown",HelppopupObj_win0.InitMovePopup);       
        ptEvent.add(document,"mouseup",HelppopupObj_win0.StopMovePopup);
        ptEvent.add(document,"mousemove",HelppopupObj_win0.MovePopup);
     }
     var HelppopTitle = document.getElementById("HelppopupTitle");     
     if(HelppopTitle && (labeltext != "undefined" && labeltext != "")) {         
         HelppopTitle.innerHTML="<span class='PTPOPUP_TITLE'>" + helptext +" - " + labeltext+"</span>";
         this.haslabel="true";
     }
    

     var hPop = document.getElementById(popupId);      // get popup page control
     
     
     
     var HelppopupDiv = document.getElementById("HelppopupDiv");     // get the temporary popup html holder - <div>
     HelppopupDiv.innerHTML=hPop.innerHTML;
     
     
     
     if ((nWidth== 0 || nHeight==0) && popupId != null && popupId != "") {
         if (hPop)   {       // set default popup width/height for message catalog message
            this.SetDivSize(HelppopupDiv);
            this.HelpcurrHeight=this.nDefHeight;
            this.HelpcurrWidth=this.nDefWidth;
         }
     }
     else {   // regular popup page, i.e. non-catalog popup

         if (hPop) {                                       // set popup page height and width
            this.HelpcurrHeight = HelppopupDiv.offsetHeight;
            this.HelpcurrWidth = HelppopupDiv.offsetWidth;
         }
     }

     HelppopupDiv.innerHTML='t';         // reset the temporary popup content holder - <div>
     this.hoverId=hoverId;
     this.hoverpopupId=popupId;
     if (this.HelpcurrWidth <=20)        // popup width <= 20 pixels
         this.HelpcurrWidth = this.nDefWidth;                 // take popup default width

     if (this.HelpcurrHeight <= 20)    // popup height <= 20 pixels
         this.HelpcurrHeight = this.nDefHeight;               // take popup default height
     HelppopupObj_win0.ShowPopup(evt);     
  }
},

SetFocusFlag:function(bValue)   // set focus flag
{
     this.bFocus = bValue;
},

ShowPopup:function(evt)   // display popup page; called by StartPopup function
{
  this.tHandle = null;
  if (this.hoverpopupId == null || this.hoverpopupId=="" ) return;
  var hp = document.getElementById(this.hoverpopupId);  // get popup content div
  this.UpdatePopup(evt,hp.innerHTML);             // use popup content to update popup container.
  hp = document.getElementById(this.Helppop);             // get popup container
  var popupFrame = document.getElementById('HelpdivpopupFrame');  // get popup content frame div
  this.bIs_shown = true;
  this.bFocus = true;
  hp.style.top=this.y+"px";
  hp.style.left=this.x+"px";
  hp.style.visibility = "Visible";
  hp.style.zIndex=300;
  if (document.activeElement != null && document.activeElement.tagName != null && document.activeElement.tagName.indexOf("BODY") <0) {

      this.focusElem = document.activeElement;            // save focused control to be restored when popup page is hidden
      if (this.focusElem != null)
          this.focusElem.blur();
  }
  else
      this.focusElem=null;
  HelppopupObj_win0.SetHeader();  
  HelppopupObj_win0.SetShadow(); 
  var HelppopContainer = document.getElementById("HelppopupContainer");
  var HelppopFrame = document.getElementById("HelpdivpopupFrame");  
  HelppopFrame.focus();
  ptEvent.add(HelppopContainer,"keypress",HelppopupObj_win0.HandleEscapeKey);
  cancelBubble(evt); 
},

SetHeader:function() {
var HelppopTitleBar = document.getElementById("HelppopupTitleBar");
var HelppopupTitleBarMiddle = document.getElementById("HelppopupTitleBarMiddle");
var HelppopupTitle = document.getElementById("HelppopupTitle");
HelppopTitleBar.style.width = this.nDefWidth;
if (this.bIE) {
  if(this.isSwanSS)
     HelppopupTitleBarMiddle.style.width = this.nDefWidth - 6;
  else
     HelppopupTitleBarMiddle.style.width = this.nDefWidth - 4;
}
else
{
  if(this.isSwanSS)
    HelppopupTitleBarMiddle.style.width = this.nDefWidth - 8;
  else {
    if('ltr' == 'ltr')
       HelppopTitleBar.style.width = this.nDefWidth - 2;
    else
       HelppopTitleBar.style.width = this.nDefWidth + 1;
  }
}
HelppopupTitle.style.width = this.nDefWidth - 43;
},

SetShadow:function() {
var HelppopShadow = document.getElementById("HelppopupShadow");
var HelppopShadowTop = document.getElementById("HelppopupShadowTop");
var HelppopShadowBottom = document.getElementById("HelppopupShadowBottom");
var HelppopShadowBottomMiddle = document.getElementById("HelppopupShadowBottomMiddle");

if(!this.bIE && !this.isSwanSS && 'ltr' == 'rtl') {
  HelppopShadowBottom.style.width = this.HelpcurrWidth + 1;
  HelppopShadowBottomMiddle.style.width = this.HelpcurrWidth - 19;
}
else {
  HelppopShadowBottom.style.width = this.HelpcurrWidth + 2;
  HelppopShadowBottomMiddle.style.width = this.HelpcurrWidth - 18;
}
if(!this.bIE) 
  HelppopShadowTop.style.height = this.HelpcurrHeight - 11;     
else
  HelppopShadowTop.style.height = this.HelpcurrHeight - 1;
},

HandleEscapeKey:function(evt) {  
  if(evt.type=="keypress") {
    var kC=keyPressHandler(evt); 
    if (kC!=27) return;
  }
  var hp = document.getElementById("HelppopupContainer"); 
  if(hp)
    ptEvent.remove(hp,"keypress",HelppopupObj_win0.HandleEscapeKey);
  cancelBubble(evt);
  HelppopupObj_win0.StopPopup(); 
},

StopPopup:function()   // called by an html control's mouse-out event to close popup
{ 
  var hp = document.getElementById("HelppopupContainer");      // get popup container to hide it
  var HelppopupInner = document.getElementById("HelppopupInner");      // get popup inner - <td>
  var HelppopFrame = document.getElementById("HelpdivpopupFrame");     // get popup content - <div>
  if (hp) 
      hp.style.visibility = "Hidden"; 
  if (this.hoverId != null || this.hoverId != "") {
      var hItem = document.getElementById(this.hoverId);  // get mouse-overed control
      if (hItem)
          hItem.style.cursor = "";                 // reset cursor for mouse-overed control
  }
  if ((typeof bAccessibility_win0 != 'undefined') && (bAccessibility_win0))   // unhide form elements in accessiblity mode
     {
     for (var i=0; i<document.forms.length; i++)
         {
         document.forms[i].style.visibility="visible"
         if (!this.bIE)
             document.forms[i].style.display="block";
         }   
     }

  if (this.focusElem != null && this.bFocus)  {                   // restore focus
     try {
         this.focusElem.focus();
     }
     catch(err){}
  }
  this.bIs_shown = false;   
  
},

InitMovePopup:function(e){    
    var HelppopContainer = document.getElementById("HelppopupContainer");        // get popup container - <table>    
    if(document.all) e = event;    
    HelppopupObj_win0.moveCounter = 1;
    HelppopupObj_win0.startEventPos = [e.clientX,e.clientY];
    HelppopupObj_win0.startPosWindow = [HelppopContainer.offsetLeft,HelppopContainer.offsetTop];    
},

StopMovePopup:function(e) {
HelppopupObj_win0.moveCounter=0;
},

MovePopup:function(e) {    
    if(document.all)
        e = event;    

    if(browserInfoObj.isIE && e.button == 0) {       
        HelppopupObj_win0.StopMovePopup(e);
        return;
    } 

    if(HelppopupObj_win0.moveCounter>=1){        
        var mx = e.clientX;
        var my = e.clientY;  
        var HelppopContainer = document.getElementById("HelppopupContainer");        // get popup container - <table>    
        var HelppopShadow = document.getElementById("HelppopupShadow"); 
        if ((mx > 0) && (mx < (ptCommonObj.getViewportWidth()-10))) 
            HelppopContainer.style.left = HelppopupObj_win0.startPosWindow[0] + mx - HelppopupObj_win0.startEventPos[0] + 'px';       
        if ((my > 10) && (my < (ptCommonObj.getViewportHeight()-10))) 
            HelppopContainer.style.top = HelppopupObj_win0.startPosWindow[1] + my - HelppopupObj_win0.startEventPos[1] + 'px';
            
    }
},

UpdatePopup:function(evt,sHTML)  // update popup with html content and set position and size of popup
{
    var HelppopContainer = document.getElementById(this.Helppop);        // get popup container - <table>
    var HelppopupInner = document.getElementById("HelppopupInner");      // get popup inner - <td>
    var HelppopFrame = document.getElementById("HelpdivpopupFrame");     // get popup content - <div>
       
    HelppopFrame.scrollTop=0;                                          // reset scrollbar position
    HelppopFrame.scrollLeft=0;                                         // reset scrollbar position
    //HelppopContainer.style.display = "block";
    //HelppopupInner.style.display = "block";
    hItem=document.getElementById(this.hoverId);                     // get mouse-over item
    var viewportHeight = ptCommonObj.getViewportHeight();            // viewable height
    var viewportWidth = ptCommonObj.getViewportWidth();              // viewable width
    // set popup width according to viewable area
    if (this.bIE && (viewportWidth-30) > 60)
        viewportWidth = viewportWidth - 30;                          // adjust viewable width for IE
    else if (!this.bIE && (viewportWidth-50) > 60)
        viewportWidth = viewportWidth - 50;                          // adjust viewable width for non-IE

    if (this.HelpcurrWidth > 0)  {
       if (this.HelpcurrWidth > viewportWidth)
          this.HelpcurrWidth = viewportWidth;
    }
    else
       this.HelpcurrWidth = viewportWidth;

    // set popup left coordinate
    var nLeft=this.GetElementleft(evt, hItem);                               // hovered item leftoffset
    if('ltr' == 'ltr') {    
        nLeft = nLeft + 20; 
    } 
    else {  
        if(this.bIE)         
          nLeft = nLeft - 2*this.HelpcurrWidth - 20; 
        else
          nLeft = nLeft - this.HelpcurrWidth - 20; 
    }  
    this.x = nLeft;     
    
    // set popup top coordinate
    var nTop=this.GetElementTop(evt, hItem);     
    
    this.y = nTop + 20;  

    if (this.HelpcurrHeight < this.nMinHeight)
        this.HelpcurrHeight = this.nMinHeight;                // give it a minimum height

    HelppopContainer.style.width = this.HelpcurrWidth;          // popup width
    HelppopupInner.style.width = this.HelpcurrWidth;            // popup width
    HelppopupInner.style.height = this.HelpcurrHeight;          // popup height
    HelppopFrame.innerHTML=sHTML;
    //HelppopFrame.style.dislay='block';
    if (this.bIE)
        HelppopFrame.style.width = (this.HelpcurrWidth) + "px";
    else
        HelppopFrame.style.width = (this.HelpcurrWidth) - 25 + "px";
    
    
    HelppopFrame.scrollLeft=500;
    
    if (HelppopFrame.scrollLeft>0 && (this.HelpcurrWidth+HelppopFrame.scrollLeft)<viewportWidth)  {
        this.HelpcurrWidth=this.HelpcurrWidth+HelppopFrame.scrollLeft;
        HelppopFrame.innerHTML=sHTML;
        HelppopContainer.style.width = this.HelpcurrWidth;          // popup width
        HelppopupInner.style.width = this.HelpcurrWidth;            // popup width
        HelppopFrame.style.width = (this.HelpcurrWidth) - 10 + "px";
    }
    else if(!this.bIE && !this.isSwanSS)
        HelppopupInner.style.width = this.HelpcurrWidth - 3;
    HelppopFrame.scrollLeft=0;
    if (!this.bIE)
        HelppopFrame.style.height = (this.HelpcurrHeight) - 45 + "px";
    else
        HelppopFrame.style.height = (this.HelpcurrHeight) + "px";
//window.status="h="+this.MOcurrHeight+";w="+this.MOcurrWidth;  //debug

}
}

var popupObj_win0 = new PT_popup();
var popupModalObj_win0 = new PT_popup(); 
var MOpopupObj_win0 = new PT_MOpopup();   // create mouse-over popup object
MOpopupObj_win0.init();
var HelppopupObj_win0 = new PT_Helppopup();   // create mouse-over popup object
HelppopupObj_win0.init();
