      function DoMoveUpRecord(ActionType, CurrRecIndex){
        document.ReportEditBodyPage.CurrEditRecIndex.value=CurrRecIndex;
        document.ReportEditBodyPage.RptFldActionType.value=ActionType;
        __doPostBack('MoveUpBtn', 'CLICK');
      }

      function DoMoveDownRecord(ActionType, CurrRecIndex){
        document.ReportEditBodyPage.CurrEditRecIndex.value=CurrRecIndex;
        document.ReportEditBodyPage.RptFldActionType.value=ActionType;
        __doPostBack('MoveDownBtn', 'CLICK');
      }

      function DoSelectField(CurrRecIndex){
        SetHiddenVars();      
        document.ReportEditBodyPage.CurrEditRecIndex.value=CurrRecIndex;
        //alert(document.ReportEditBodyPage.CurrEditRecIndex.value);
        __doPostBack('SelectFldBtn', 'CLICK');
      }


      function DoWarnNoGroup(CurrRecIndex){
        var GpSelName="ST_row" + CurrRecIndex + "sel";
        var AEle = document.getElementById(GpSelName);
        if (AEle != null)
          if (AEle.checked)
            alert("Sub-Total field will not be saved as there are no groups. Please add atleast one group first.");
      }

      function ChangeSortOrder(CurrRecIndex, NeWOrder){
        document.ReportEditBodyPage.CurrEditRecIndex.value=CurrRecIndex;
        document.ReportEditBodyPage.RptFldActionType.value=NeWOrder;
        SetHiddenVars();      
        __doPostBack('ChangeSortBtn', 'CLICK');
      }

      function ChangeGroupDesc(CurrRecIndex, NewDesc){
        document.ReportEditBodyPage.CurrEditRecIndex.value=CurrRecIndex;
        document.ReportEditBodyPage.RptFldActionType.value=NewDesc;
        SetHiddenVars();      
        __doPostBack('ChangeGroupBtn', 'CLICK');
      }

      function DoSortField(CurrRecIndex){
        document.ReportEditBodyPage.CurrEditRecIndex.value=CurrRecIndex;
        __doPostBack('SortFldBtn', 'CLICK');
      }

      function DoGroupField(CurrRecIndex){
        document.ReportEditBodyPage.CurrEditRecIndex.value=CurrRecIndex;
        __doPostBack('GroupFldBtn', 'CLICK');
      }

      function DoSaveRecord(CurrRecIndex){
        SetFieldHiddenVars();
        document.ReportEditBodyPage.CurrEditRecIndex.value=CurrRecIndex;
        __doPostBack('SaveReportBtn', 'CLICK');
      }

      function DoRemoveRecord(ActionType, CurrRecIndex){
        document.ReportEditBodyPage.CurrEditRecIndex.value=CurrRecIndex;
        if (ActionType==1){
        __doPostBack('RemoveFldBtn', 'CLICK');}
        if (ActionType==2){
        __doPostBack('RemoveGroupBtn', 'CLICK');}
        if (ActionType==3){
        __doPostBack('RemoveSortBtn', 'CLICK');}
      }

      function DoEditAndSaveRec(CurrRecIndex){
        DoEditRecord(CurrRecIndex);
        DoSaveRecord(CurrRecIndex);
      }

      function DoEditRecord1(ARptFldName){
        alert(ARptFldName);
      }

        function whatToDo() {
          //alert ("Delay time has ended. Any code could be executed at this point")
        }

        function pause(howManySeconds) {
          myTimer=setTimeout("whatToDo()",howManySeconds*1000)
        }
   
      function DoEditRecord(ARptFldName, ARptFieldOrder){
        SetHiddenVars();
        document.ReportEditBodyPage.CurrEditRecIndex.value=ARptFieldOrder;
        __doPostBack('SaveReportBtn', 'CLICK');
        myTimer=setTimeout("whatToDo()",3*1000);

        var TheURL="ReportFieldAdvEditPage";
        TheURL=TheURL + "?RepRTMFname=" + document.ReportEditBodyPage.RepRTMFName.value;
        if (document.ReportEditBodyPage.UserDirName != null)
          TheURL=TheURL + "&UserDirName=" + document.ReportEditBodyPage.UserDirName.value;
        TheURL=TheURL + "&CustomRep=" + document.ReportEditBodyPage.CustomRep.value;
        TheURL=TheURL + "&RptFieldName=" + ARptFldName;
        if (document.ReportEditBodyPage.CreateNewStdReport != null)
          TheURL=TheURL + "&CreateNewStdReport=" + document.ReportEditBodyPage.CreateNewStdReport.value;
        TheURL=TheURL + "&RptFieldOrder=" + ARptFieldOrder; 

        var FeatureStr = "scrollbars=yes, resizable=yes, toolbar=no, menubar=yes, statusbar=yes, ";
        FeatureStr = FeatureStr + "width=1100, height=730, top=200, left=100";
        //alert(TheURL+FeatureStr);
        var EditRptFldWinHandle = window.open(TheURL, "EditRptFld", FeatureStr);
      }

      function DoSTGTEdit(STGTType){
        var TheURL="ReportSTGTEditPage";
        TheURL=TheURL + "?RepRTMFname=" + document.ReportEditBodyPage.RepRTMFName.value;
        if (document.ReportEditBodyPage.UserNewRepFileName != null)
          TheURL=TheURL + "&UserNewRepFileName=" + document.ReportEditBodyPage.UserNewRepFileName.value;
        TheURL=TheURL + "&CustomRep=" + document.ReportEditBodyPage.CustomRep.value;
        if (document.ReportEditBodyPage.UserDirName != null)
          TheURL=TheURL + "&UserDirName=" + document.ReportEditBodyPage.UserDirName.value;
        if (document.ReportEditBodyPage.CreateNewStdReport != null)
          TheURL=TheURL + "&CreateNewStdReport=" + document.ReportEditBodyPage.CreateNewStdReport.value;
        TheURL=TheURL + "&STGTType=" + STGTType;
        var FeatureStr = "scrollbars=yes, resizable=yes, toolbar=yes, menubar=no, statusbar=yes, ";
        FeatureStr = FeatureStr + "width=1100, height=730, top=200, left=100";
        //alert(TheURL+FeatureStr);
        //var EditRptFldWinHandle = window.open(TheURL, "STGTEdit", FeatureStr);
        window.location = TheURL;
      }

      function InitializeHiddenVars(){
        if (document.ReportEditBodyPage.CloseAndExit!=null){
          if (document.ReportEditBodyPage.CloseAndExit.value=="true"){
	    window.close();
	    return;
	  }		 	
        }

        DetailFontCallerDiv.style.backgroundColor=document.ReportEditBodyPage.DetailAlterBandColor.value;
        DetailFontCallerDiv.innerText=document.ReportEditBodyPage.DetailAlterBandColor.value;
        DetailFontCallerDiv.style.fontFamily=document.ReportEditBodyPage.DetailFontNames.value;
        DetailFontCallerDiv.style.fontSize=document.ReportEditBodyPage.DetailFontSize.value;
        DetailFontCallerDiv.style.color=document.ReportEditBodyPage.DetailFontColors.value;
        DetailFontCallerDiv.style.fontWeight=(document.ReportEditBodyPage.DetailFontfsBold.value=="True") ? "bold" : "normal";
        DetailFontCallerDiv.style.textDecoration=(document.ReportEditBodyPage.DetailFontfsUnderline.value=="True") ? "underline" : "none";
        DetailFontCallerDiv.style.fontStyle=(document.ReportEditBodyPage.DetailFontfsItalic.value=="True") ? "italic" : "normal";
        DetailFontCallerDiv.style.borderWidth=document.ReportEditBodyPage.DetailBorderWidth.value;
        DetailFontCallerDiv.style.borderColor=document.ReportEditBodyPage.DetailBorderColor.value;
        DetailFontCallerDiv.style.borderStyle=document.ReportEditBodyPage.DetailBorderStyle.value;

        HeaderFontCallerDiv.style.backgroundColor=document.ReportEditBodyPage.HeaderBGColor.value;
        HeaderFontCallerDiv.innerText=document.ReportEditBodyPage.HeaderBGColor.value;
        HeaderFontCallerDiv.style.fontFamily=document.ReportEditBodyPage.HeaderFontNames.value;
        HeaderFontCallerDiv.style.fontSize=document.ReportEditBodyPage.HeaderFontSize.value;
        HeaderFontCallerDiv.style.color=document.ReportEditBodyPage.HeaderFontColors.value;
        HeaderFontCallerDiv.style.fontWeight=(document.ReportEditBodyPage.HeaderFontfsBold.value=="True") ? "bold" : "normal";
        HeaderFontCallerDiv.style.textDecoration=(document.ReportEditBodyPage.HeaderFontfsUnderline.value=="True") ? "underline" : "none";
        HeaderFontCallerDiv.style.fontStyle=(document.ReportEditBodyPage.HeaderFontfsItalic.value=="True") ? "italic" : "normal";
        HeaderFontCallerDiv.style.borderWidth=document.ReportEditBodyPage.HeaderBorderWidth.value;
        HeaderFontCallerDiv.style.borderColor=document.ReportEditBodyPage.HeaderBorderColor.value;
        HeaderFontCallerDiv.style.borderStyle=document.ReportEditBodyPage.HeaderBorderStyle.value;
      }

      function SetHiddenVars(){
        //alert(document.ReportEditBodyPage.DetailBorderShape.value);
        document.ReportEditBodyPage.DetailAlterBandColor.value=DetailFontCallerDiv.style.backgroundColor;
        document.ReportEditBodyPage.DetailFontNames.value=DetailFontCallerDiv.style.fontFamily;
        document.ReportEditBodyPage.DetailFontSize.value=DetailFontCallerDiv.style.fontSize;
        document.ReportEditBodyPage.DetailFontColors.value=DetailFontCallerDiv.style.color;
        document.ReportEditBodyPage.DetailFontfsBold.value=(DetailFontCallerDiv.style.fontWeight=="bold") ? "True" : "False";
        document.ReportEditBodyPage.DetailFontfsUnderline.value=(DetailFontCallerDiv.style.textDecoration=="underline") ? "True" : "False";
        document.ReportEditBodyPage.DetailFontfsItalic.value=(DetailFontCallerDiv.style.fontStyle=="italic") ? "True" : "False";
        document.ReportEditBodyPage.DetailBorderWidth.value=DetailFontCallerDiv.style.borderWidth;
        document.ReportEditBodyPage.DetailBorderColor.value=DetailFontCallerDiv.style.borderColor;
        document.ReportEditBodyPage.DetailBorderStyle.value=DetailFontCallerDiv.style.borderStyle;

        document.ReportEditBodyPage.HeaderBGColor.value=HeaderFontCallerDiv.style.backgroundColor;
        document.ReportEditBodyPage.HeaderFontNames.value=HeaderFontCallerDiv.style.fontFamily;
        document.ReportEditBodyPage.HeaderFontSize.value=HeaderFontCallerDiv.style.fontSize;
        document.ReportEditBodyPage.HeaderFontColors.value=HeaderFontCallerDiv.style.color;
        document.ReportEditBodyPage.HeaderFontfsBold.value=(HeaderFontCallerDiv.style.fontWeight=="bold") ? "True" : "False";
        document.ReportEditBodyPage.HeaderFontfsUnderline.value=(HeaderFontCallerDiv.style.textDecoration=="underline") ? "True" : "False";
        document.ReportEditBodyPage.HeaderFontfsItalic.value=(HeaderFontCallerDiv.style.fontStyle=="italic") ? "True" : "False";
        document.ReportEditBodyPage.HeaderBorderWidth.value=HeaderFontCallerDiv.style.borderWidth;
        document.ReportEditBodyPage.HeaderBorderColor.value=HeaderFontCallerDiv.style.borderColor;
        document.ReportEditBodyPage.HeaderBorderStyle.value=HeaderFontCallerDiv.style.borderStyle;
      }
