      function InitializeHiddenVars(){
        if (document.CTReportsEditPage.CloseAndExit!=null){
          if (document.CTReportsEditPage.CloseAndExit.value=="true")
              DoClosePage();
        }
        //alert("on load");
        if (document.CTReportsEditPage.ReportAction!=null){
          if (document.CTReportsEditPage.ReportAction.value=="clone"){
            var AURL;
            AURL="RepRTMFname=" + document.CTReportsEditPage.RepRTMFName.value;
            if (document.CTReportsEditPage.UserDirName!=null)
              AURL = AURL + "&UserDirName=" + document.CTReportsEditPage.UserDirName.value;
            AURL = AURL + "&CustomRep=" + document.CTReportsEditPage.CustomRep.value;
            if (window.opener!=null)
            window.opener.DoRemAddCloneReport(AURL);
          }
        }
        window.focus();
      }

    function DoEditReportPart(aReportEditURL, AHeight, AWidth){
      aReportEditURL = aReportEditURL + "RepRTMFname=" + document.CTReportsEditPage.RepRTMFName.value;
      if (document.CTReportsEditPage.UserDirName!=null)
        aReportEditURL = aReportEditURL + "&UserDirName=" + document.CTReportsEditPage.UserDirName.value;
      aReportEditURL = aReportEditURL + "&CustomRep=" + document.CTReportsEditPage.CustomRep.value;
      if (document.CTReportsEditPage.CreateNewStdReport!=null)
        aReportEditURL = aReportEditURL + "&CreateNewStdReport=" + document.CTReportsEditPage.CreateNewStdReport.value;
      var FeatureStr = "scrollbars=yes, resizable=yes, toolbar=yes, menubar=yes, statusbar=yes, ";
      //var AWidth=screen.availWidth-50;
      //var AHeight=screen.availHeight-165;
      FeatureStr = FeatureStr + "width=" + AWidth + ", height=" + AHeight + ", top=25, left=20";
      //alert(aReportEditURL+FeatureStr);
      EditPageWinHandle = window.open(aReportEditURL, "RepEditWindow", FeatureStr);
      EditPageWinHandle.focus();
      return false;
      //window.location=aReportEditURL;
    }

    function RunCustomReport(){
      var TheURL;
      TheURL="CTReportsMainEntryPage?RepRTMFName=" +document.CTReportsEditPage.NewRepRTMFName.value;
      TheURL=TheURL+"&CustomRep=" + document.CTReportsEditPage.IsThisCustomRep.value;
      TheURL=TheURL+"&RepDesc=" + document.CTReportsEditPage.NewRepDesc.value;
      if (document.CTReportsEditPage.UserDirName!=null)
        TheURL=TheURL+"&UserdirName=" + document.CTReportsEditPage.UserDirName.value;
      window.location=TheURL;
    }

    function ValidateNewRepDesc(){
      var TempDesc=RemoveBlanks(document.CTReportsEditPage.NewRepDesc.value)
      if (TempDesc==''){
        alert("Please enter a valid Report Description.");
        document.CTReportsEditPage.NewRepDesc.focus();
        return(1);
      }
    }

    function ValidateNewRepFileName(){
      var iNewRepFName=document.CTReportsEditPage.NewRepRTMFName.value;
      //alert(iNewRepFName+"x"+document.CTReportsEditPage.txtOrigRepName.value+"x"+document.CTReportsEditPage.txtOrigCustomRep.value);
      iNewRepFName=RemoveBlanks(iNewRepFName);
      if (iNewRepFName==""){
        alert("Please enter a unique name for the report.");
        document.CTReportsEditPage.NewRepRTMFName.focus();
        return(1);
      }

      arrayObjectName = new Array()
      arrayObjectName=iNewRepFName.split(".");
      if (arrayObjectName.length<2)
        iNewRepFName=iNewRepFName+".rtm";
      else{
        if (arrayObjectName[1]!="rtm")
          iNewRepFName=iNewRepFName+".rtm";
      }

      if (iNewRepFName==document.CTReportsEditPage.txtOrigRepName.value){
        if (document.CTReportsEditPage.txtOrigCustomRep.value!="true" || document.CTReportsEditPage.txtOrigCustomRep.value=="false"){
          alert("You are editing a standard report supplied by Captools that cannot be overwritten. You must save it with a different and unique name.");
          document.CTReportsEditPage.NewRepRTMFName.focus();
          return(1);
        }
        else{
            var UserResult=1;
          //var UserResult = confirm('Are you sure you want to overwrite exisitng custom report?');
          alert(UserResult);
          if(UserResult=="0"){
            document.CTReportsEditPage.NewRepRTMFName.focus();
            return(1);
          }
        }
      }

      var InValidChar=false;
      for(var Idx=0;Idx<iNewRepFName.length;++Idx){
        var c=iNewRepFName.charAt(Idx);
        if (c=="\\" || c=="/" || c==":" || c=="*" || c=="?" || c=="\"" || c=="<" || c==">" || c=="|"){
          InValidChar=true;
              break;
        }
      }

      if (InValidChar==true){
        alert("Report FileName cannot contain the following characters- \ / : * ? \" < > |");
        document.CTReportsEditPage.NewRepRTMFName.focus();
        return(1);
      }
      //__doPostBack('SaveRepBtn', 'CLICK');
      //alert("After DoPost");
    }
