  function SelectAllDestList(){
    //alert('here');
    var destlist=document.BatchMainPage.SelectedFilterFieldValues;
    if (destlist==null)
      return;
    var i=0;
    var len=destlist.length;
    for(i=0 ; i<len;        i++)
      destlist.options[i].selected=true;}

   function testfunc(){
     alert(document.getElementById("testcol").innerText);
     return;
     alert(document.getElementById("RepRTMFName").innerText);
     document.getElementById("RepRTMFName").innerText="fff";
     alert(document.getElementById("RepRTMFName").innerText);
     return;
     alert(document.getElementById("testdiv").innerHTML);
     document.getElementById("testdiv").innerHTML="hhhhh";
     alert(document.getElementById("testdiv").innerHTML);
   }

   function SetCheckAllAccounts(val) {
    len=document.BatchMainPage.elements.length;
    var elename;
    var i=0;
    for( i=0 ; i<len;      i++){
      elename=document.BatchMainPage.elements[i].name;
          elename=elename.substring(0,3);
          if(elename=="row")
        document.BatchMainPage.elements[i].checked=document.BatchMainPage.checkuncheckall.checked;}}

  function DoEditFilter(FilterNo){
    document.BatchMainPage.CurrFilterNo.value=FilterNo;
    __doPostBack('ChangeFilterBtn', 'CLICK');
  }

  function DoDeleteFilter(FilterNo){
    document.BatchMainPage.CurrFilterNo.value=FilterNo;
    __doPostBack('DeleteFilterBtn', 'CLICK');
  }

  function ValidateDate() {
    var dateStart = new Date(document.BatchMainPage.StartDateCalEditor.value);
    var dateEnd = new Date(document.BatchMainPage.EndDateCalEditor.value);
    dateToday = new Date();
    var dateDifference = dateToday - dateStart;
    if (dateDifference < 0){
     alert(dateDifference + " Start Date should be less than Today's Date.");
     return 0;}
    dateDifference = dateToday - dateEnd;
    if (dateDifference < 0){
     alert(dateDifference + " End Date should be less than Today's Date.");
     return 0;}
    dateDifference = dateEnd - dateStart;
    if (dateDifference < 0){
     alert(dateDifference + " Start Date should be less than the End Date.");
     return 0;}
    return 1;
  }

  function ValidateAccountSel(){
    len=document.BatchMainPage.elements.length;
    var elename;
    var AccountSelected=new Boolean(false);
    for(var i=0 ; i<len;      i++){
      elename=document.BatchMainPage.elements[i].name;
          elename=elename.substring(0,3);
          if(elename=="row"){
        if(document.BatchMainPage.elements[i].checked){
              AccountSelected=true;
                  break;}
          }
    }
    if (AccountSelected)
      return 1
    else{
      alert("Please select atleast one account number before generating report.");
      return 0;
    }
  }

  function callTest(){
    document.BatchMainPage.onSubmit="SelectAllDestList()"
  }

    function SetThisDate(StartYear,StartMonth,StartDay,StartDateWanted){
      var StartYearWanted = StartDateWanted.getFullYear();
      var StartMonthWanted = StartDateWanted.getMonth();
      var StartDayWanted = StartDateWanted.getDate();
      for (var i = 0; i < StartYear.length; i++){
        if (StartYear.options[i].value==StartYearWanted)
          StartYear.options[i].selected = true;
      }
      for (var i = 0; i < StartMonth.length; i++){
        if (i==StartMonthWanted)
          StartMonth.options[i].selected = true;
      }
      for (var i = 0; i < StartDay.length; i++){
        if (i==(StartDayWanted-1))
          StartDay.options[i].selected = true;
      }
    }

    function AdjustDate(DateType, DateValue){
       var CurrentValue=DateValue.value;
       if((DateType=="Months") || (DateType==2)){
       var dateStart = new Date(document.BatchMainPage.StartDateCalEditor.value);
       var dateEnd = new Date(document.BatchMainPage.EndDateCalEditor.value);
       dateStart = dateEnd;
       var CurrMonth=dateEnd.getMonth()
                     alert(CurrMonth+" "+CurrentValue);
       dateStart.setMonth(CurrMonth - CurrentValue);
              alert(dateStart);
       document.BatchMainPage.StartDateCalEditor.value=dateStart.getMonth()+"/"+dateStart.getDate()+"/"+dateStart.getFullYear();
       }
       if((DateType=="Weeks") || (DateType==3)){
         CurrentValue=CurrentValue*7*86400000;
         var CurrentBoxDate =
         new Date(document.BatchMainPage.cmbEndYear.options[document.BatchMainPage.cmbEndYear.selectedIndex].value,
                  document.BatchMainPage.cmbEndMonth.selectedIndex,
                  document.BatchMainPage.cmbEndDate.options[document.BatchMainPage.cmbEndDate.selectedIndex].value);
        var Temp = CurrentBoxDate-CurrentValue;
        var dateStartWanted = new Date(Temp);
        }
        if((DateType=="Days") || (DateType==1)){
          CurrentValue=CurrentValue*86400000;
          var CurrentBoxDate =
          new Date(document.BatchMainPage.cmbEndYear.options[document.BatchMainPage.cmbEndYear.selectedIndex].value,
                   document.BatchMainPage.cmbEndMonth.selectedIndex,
                   (document.BatchMainPage.cmbEndDate.options[document.BatchMainPage.cmbEndDate.selectedIndex].value));
         var Temp = CurrentBoxDate-CurrentValue;
         var dateStartWanted = new Date(Temp);
        }
       SetThisDate(document.BatchMainPage.cmbStartYear,document.BatchMainPage.cmbStartMonth,
                   document.BatchMainPage.cmbStartDate,dateStartWanted)
    }

  function EnableAndAdjustDate(rdDateType,txtDateEnValue,txtDateDis1Value,txtDateDis2Value){
    alert(document.BatchMainPage.txtNoMonths.value)
    txtDateEnValue.disabled=false;
    txtDateDis1Value.disabled=true;
    txtDateDis2Value.disabled=true;
    if (txtDateEnValue.value!="")
      AdjustDate(rdDateType.value, txtDateEnValue.value)
  }

