//alert("JavaScript activated")

//Which Web Browser is Being Used?
isNav = (navigator.appName == "Netscape")
isIE = (navigator.appName == "Microsoft Internet Explorer")

var monthList = new Array(" ", "January", "February", "March", "April", "May",
                          "June", "July", "August", "September", "October",
                          "November", "December", "Cold Season(Oct-Mar)",
                          "Warm Season(Apr-Sep)", "Calendar Year(Jan-Dec)",
                          "Fiscal Year(Oct-Sep)")

//List of Variables for each RFC
var rfcList = new Array("ABRFC", "CBRFC", "CNRFC", "LMRFC", "MARFC", "MBRFC", 
                        "NCRFC", "NERFC", "NWRFC", "OHRFC", "SERFC", "WGRFC",
                        "CONUS")
//var firstYearList = new Array (2000, 2000, 2000, 2000, 2000, 2000, 
//                               2000, 2000, 2001, 2000, 2000, 2000,
//                               2001)
//var firstMonthList = new Array (8, 11, 11, 8, 8, 8,
//                                8, 8, 1, 8, 8, 8,
//                                1)
var firstYearList = new Array (2003, 2003, 2003, 2003, 2003, 2003, 
                               2003, 2003, 2003, 2003, 2003, 2003,
                               2003)
var firstMonthList = new Array (1, 1, 1, 1, 1, 1,
                                1, 1, 1, 1, 1, 1,
                                1)
var rfcRegionList = new Array ("east", "west", "west", "east", "east", "east",
                               "east", "east", "west", "east", "east", "east",
                               "all")                            

var OptTypeValue = new Array ("me", "rmse", "contd", "cvbias", "mae",
                             "bias", "pod", "far", "catd", "ets", "ts",
                             "ngm", "nam", "gfs", "hpc", "hpcmm", "rfc")

var OptTypeName = new Array ("Mean Error", "Root Mean Square Error", "Interval Distribution", "Volumetric Bias", "Mean Absolute Error",
                             "Bias Score", "Probability of Detection", "False Alarm Rate", "Threshold Distribution", "Equitable Threat Score", "Threat Score",
                             "NGM", "Eta/NAM", "AVN/GFS", "HPC", "HPC-MM", "RFC")

var ForValue = new Array ( "f006", "f012", "f018", "f024", 
                           "day1", "day2", "day3")

var ForName = new Array ( "F006 (12z-18z)", "F012 (18z-00z)", "F018 (00z-06z)", "F024 (06z-12z)",
                          "Day 1 (12z-12z)", "Day 2 (12z-12z)", "Day 3 (12z-12z)")

var currentCheck = new Array (true, false)
var currentRFC = new Array ("ABRFC", "ABRFC")
var currentRFCindex = new Array (0, 0)
var lastYear = new Array (lastYear32, lastYear32)
var currentYear = new Array (lastYear32, lastYear32)
var lastMonth = new Array (lastMonth32, lastMonth32)
var currentMonth = new Array (lastMonth32, lastMonth32)
var currentType = new Array ("32km-grd", "32km-grd")
var currentIntType = new Array ("b", "b")
var currentStatType = new Array ("cont", "cont")
var oldStatType = new Array ("cont", "cont")
var currentDur = new Array ("06h", "06h")
var currentFor = new Array ("day1", "day1")
var currentForIndex = new Array (5, 5)
var currentDisp = new Array ("graphic", "graphic")
var oldDisp = new Array ("graphic", "graphic")
var currentOptType = new Array ("mae", "mae")
var currentOTindex = new Array (4, 4)
var textAvail = true
var textShow = true

function graphicOnly(clm){
//alert ("graphicOnly"+clm)
  var mySelect = new Array (document.qpfv.clm0, document.qpfv.clm1)
  currentCheck[0]  = (mySelect[0].checked)
  currentCheck[1]  = (mySelect[1].checked)
  if ( currentCheck[0] && currentCheck[1] ) {
    if ( currentDisp[0] == "text" || currentDisp[1] == "text") {
      var okay = confirm("You can only display one text file.\n Do you want to change both display options to Graphic?")
      if ( ! okay ) {
        mySelect[clm].checked = false
        currentCheck[clm] = mySelect[clm].checked
        return
      }
    }
  }
  dispOptions(0)
  dispOptions(1)
}

function selectCheck(clm){
//alert ("selectCheck"+clm)
  var mySelect = new Array (document.qpfv.clm0, document.qpfv.clm1)
  if ( !currentCheck[clm] ) {
    mySelect[clm].checked = true
    currentCheck[clm] = mySelect[clm].checked
    if ( clm == 0 ) var otherClm = 1
    if ( clm ==1 ) var otherClm = 0
    graphicOnly(otherClm)
  }
}

function rfcChoice(rfc) {
//alert ("rfcChoice"+rfc)
  var pastRFC = currentRFC[0]
  var mySelect = document.qpfv.rfc0
  for ( var i=0; i<13; ++i) {
    if (rfc == rfcList[i]) {
      currentRFC[0] = rfc
      currentRFCindex[0] = i
      yearOptions(0)
      if (rfc == "CONUS") {
        mySelect.options[i] = new Option("All RFC's", "CONUS", false, true)
        mySelect.selectedIndex = i
      } else {
        mySelect.options[i] = new Option(rfcList[i], rfcList[i], false, true)
        mySelect.selectedIndex = i
      }
    }
  }
selectCheck(0)
}

function setCurrentRFC (clm) {
//alert("setCurrentRFC"+clm)
  var mySelect = new Array (document.qpfv.rfc0, document.qpfv.rfc1)
  currentRFC[clm] = mySelect[clm].options[mySelect[clm].selectedIndex].value
  for (var i=0; i<13; ++i) {
    if (currentRFC[clm] == rfcList[i]) {
      currentRFCindex[clm] = i
      yearOptions(clm)
    }
  }
}

function yearOptions(clm) {
//alert("yearOptions"+clm)
  var Year = firstYearList[currentRFCindex[clm]] 
  if ( currentType[clm] == "4km-grd" ) { Year = 2004 }
  var mySelect = new Array (document.qpfv.year0, document.qpfv.year1)
  mySelect[clm].options.length = 0;
  var wantYear = currentYear[clm]
  if ( wantYear < Year ) {
    alert (wantYear+" not avaliable for "+currentRFC[clm]+" setting Year to "+lastYear[clm]+" for Column "+(clm+1))
    wantYear = lastYear[clm]
  }
  for ( var j=0; j<=(lastYear[clm]-Year); ++j) {
    var printYear = Year+j
    if (printYear == wantYear) {
      currentYear[clm] = printYear
      mySelect[clm].options[j] = new Option(printYear, printYear, false, true)
      myIndex = j
    } else {
      mySelect[clm].options[j] = new Option(printYear, printYear, false, false)
    }
  }
  mySelect[clm].selectedIndex = myIndex
  monthOptions(clm)
}

function setCurrentYear (clm) {
//alert("setCurrentYear"+clm)
  var mySelect = new Array (document.qpfv.year0, document.qpfv.year1)
  currentYear[clm] = mySelect[clm].options[mySelect[clm].selectedIndex].value
  monthOptions(clm)
}

function monthOptions(clm) {
//alert("monthOptions("+clm+")")
  var firstMonth = firstMonthList[currentRFCindex[clm]]
  var firstYear = firstYearList[currentRFCindex[clm]]
  if ( currentType[clm] == "4km-grd" ) { 
    firstMonth = 10 
    firstYear = 2004
  }
  mySelect = new Array (document.qpfv.month0, document.qpfv.month1)
  mySelect[clm].options.length = 0
  var wantMonth = currentMonth[clm]
  var mySindex = 99
  if (currentYear[clm] == firstYear) {
    var endMonth = 13
    if (firstMonth == 1) { endMonth = 15 }
    if (wantMonth < firstMonth || wantMonth > endMonth) {
      alert(monthList[wantMonth]+" not available for "+currentYear[clm]+". Setting Month to "+monthList[firstMonth]+" for Column "+(clm+1))
      wantMonth = firstMonth
    }
    for (var i=firstMonth; i<=endMonth; ++i) {
      var myIndex = i - firstMonth
      if ( wantMonth == i ) {
        currentMonth[clm] = i
        var mySindex = myIndex
      }
      if (i == endMonth) {
        mySelect[clm].options[myIndex] = new Option("Cold Season(Nov-Mar)", i, false, true)
      } else {
        mySelect[clm].options[myIndex] = new Option(monthList[i], i, false, false)
      }
    }
  } else if (currentYear[clm] == lastYear[clm]) {
    var myIndex = 0
    for ( var i=1; i<= lastMonth[clm]; ++i) {
      if ( wantMonth == i) {
        currentMonth[clm] = i
        var mySindex = myIndex
      }
      mySelect[clm].options[myIndex] = new Option(monthList[i], i, false, false)
      myIndex = myIndex+1;
    }
    if ( lastMonth[clm] >= 9 ) {
      if ( wantMonth == 14 ) {
        currentMonth[clm] = 14
        mySindex = myIndex
      }
      mySelect[clm].options[myIndex] = new Option(monthList[14],14,false,false)
      myIndex = myIndex+1
      if ( wantMonth == 16 ) {
        currentMonth[clm] = 16
        mySindex = myIndex
      }
      mySelect[clm].options[myIndex] = new Option(monthList[16],16,false,false)
      myIndex = myIndex+1
    }
    if ( lastMonth[clm] == 12 ) {
      if ( wantMonth == 15 ) {
        currentMonth[clm] = 15
        mySindex = myIndex
      }
      mySelect[clm].options[myIndex] = new Option(monthList[15],15,false,false)
      myIndex = myIndex+1
    }
  } else if (currentYear[clm] == (lastYear[clm] - 1) && lastMonth[clm] < 3){
    if ( wantMonth == 13 ) {
      alert (monthList[wantMonth]+" not available for "+currentYear[clm]+".  Setting Month to "+monthList[1]+" for Column "+(clm+1))
      wantMonth = 1
    }
    if ( currentYear[clm] >= 2004 ) {
       lasti = 17
       lastm = 16
    } else {
       lasti = 16
       lastm = 15
    }
    for (var i=1; i<lasti; ++i) {
      if (i != 13) {
        if ( i > 13 ){
          var myIndex = i-2
        } else {
          var myIndex = i-1
        }
        if ( wantMonth == i ) {
          currentMonth[clm] = wantMonth
          var mySindex = myIndex
        }
        if (i == lastm) {
          mySelect[clm].options[myIndex] = new Option(monthList[i], i, false, true)
        } else {
          mySelect[clm].options[myIndex] = new Option(monthList[i], i, false, false)
        }
      }
    }
  } else {
    if ( currentYear[clm] >= 2004 ) {
       lasti = 17
       lastm = 16
    } else {
       lasti = 16
       lastm = 15
    }
    for (var i=1; i<lasti; ++i) {
      var myIndex = i-1
      if ( wantMonth == i ) {
        currentMonth[clm] = wantMonth
        var mySindex = myIndex
      }
      if (i == lastm) {
        mySelect[clm].options[myIndex] = new Option(monthList[i], i, false, true)
      } else {
        mySelect[clm].options[myIndex] = new Option(monthList[i], i, false, false)
      }
    }
  }
  if ( mySindex == 99 ) {
    var myMonthI = mySelect[clm].options.length - 1
    var myMonth  = mySelect[clm].options[myMonthI].value
    alert(monthList[wantMonth]+" is not available.  Setting Month to "+monthList[myMonth])
    mySindex = myMonthI
  }
  mySelect[clm].selectedIndex = mySindex
  durOptions(clm)
}

function setCurrentMonth(clm) {
//alert ("setCurrentMonth"+clm)
  var mySelect = new Array (document.qpfv.month0,  document.qpfv.month1)
  currentMonth[clm] = mySelect[clm].options[mySelect[clm].selectedIndex].value
  forOptions(clm)
  typeOptions(clm)
  selectCheck(clm)
}

function setCurrentType(clm){
  var mySelect = new Array (document.qpfv.type0, document.qpfv.type1)
  currentType[clm] = mySelect[clm].options[mySelect[clm].selectedIndex].value
  if ( currentType[clm] == "32km-grd" ) {
    lastYear[clm] = lastYear32
    lastMonth[clm] = lastMonth32
  }
  if ( currentType[clm] == "4km-grd" ) {
    lastYear[clm] = lastYear4
    lastMonth[clm] = lastMonth4
  }
  yearOptions(clm)
  selectCheck(clm)
}

function setCurrentIntType(clm){
//alert ("setCurrentIntType"+clm)
  var mySelect = new Array (document.qpfv.inter0, document.qpfv.inter1)
  currentIntType[clm] = mySelect[clm].options[mySelect[clm].selectedIndex].value
  typeOptions(clm)
  selectCheck(clm)
}

function setCurrentStatType(clm) {
//alert ("setCurrentStatType"+clm)
  var mySelect = new Array (document.qpfv.stat0, document.qpfv.stat1)
  oldStatType[clm] = currentStatType[clm]
  currentStatType[clm] = mySelect[clm].options[mySelect[clm].selectedIndex].value
  typeOptions(clm)
  selectCheck(clm)
}

function durOptions(clm) {
//alert ("durOptions"+clm)
  mySelect = new Array (document.qpfv.duration0, document.qpfv.duration1)
  mySelect[clm].options.length = 0
  wantDur = currentDur[clm]
  var myIndex = 0
  if ( currentYear[clm] > 2009 || (currentYear[clm] == 2009 && currentMonth[clm] >= 9 )) {
    mySelect[clm].options[0] = new Option('6hr', '06h', false, false)
    mySelect[clm].options[1] = new Option('24hr', '24h', false, false)
  } else {
    mySelect[clm].options[0] = new Option('6hr', '06h', false, false)
  }
  if ( wantDur == "24h" ) {
    if (mySelect[clm].options.length == 2 ) {
      myIndex = 1
    } else {
      alert("24hr duration statistics are not available prior to Sept 2009.  Setting duration to 6hr for Column "+(clm+1))
    }
  }
  mySelect[clm].selectedIndex = myIndex
  setCurrentDur(clm)
}

function setCurrentDur(clm) {
//alert ("setCurrentDur"+clm)
  var mySelect = new Array (document.qpfv.duration0, document.qpfv.duration1)
  currentDur[clm] = mySelect[clm].options[mySelect[clm].selectedIndex].value
  forOptions(clm)
}

function forOptions(clm) {
//alert("forOptions"+clm)
   var rfcRegion = rfcRegionList[currentRFCindex[clm]] 
   mySelect = new Array ( document.qpfv.period0, document.qpfv.period1)
   mySelect[clm].options.length = 0 
   wantFor = currentFor[clm]
   printFor = ForName[currentForIndex[clm]]
   var myIndex = 0
   var mySindex = -99
   if ( currentDur[clm] == "06h" ) {
     for ( var i=0; i<7; i++ ) {
       if ((currentYear[clm] == 2000 && (currentMonth[clm] == 8 || currentMonth[clm] == 9)) && ForValue[i] != 'day1') { continue }
       if ((rfcRegion == "east" || currentRFCindex[clm] == 12) && (ForValue[i] == 'day2' || ForValue[i] == 'day3' )) { continue }
       if ((rfcRegion == "west" && !(((currentMonth[clm] <= 05 || (currentMonth[clm] >= 10 && currentMonth[clm] <= 14)) && currentYear[clm] <=2002) || currentYear[clm] >=2003)) && ForValue[i] == 'day3') { continue }
       if (currentRFCindex[clm] == 12 && (currentYear[clm] < 2009 || (currentYear[clm] == 2009 && currentMonth[clm] <= 8)) && ForValue[i] != 'day1') { continue }
       mySelect[clm].options[myIndex] = new Option(ForName[i], ForValue[i], false, false)
       if ( wantFor == ForValue[i] ) { mySindex = myIndex }
       if ( i == 4 ) { var myDay1 = myIndex }
       myIndex++
     }
   } else {
     mySelect[clm].options[0] = new Option("Day 1 (12z-12z)", "day1", false, false)
     if ( wantFor == "day1" ) { 
       mySindex = 0  
     }
     var myDay1 = 0
   }
     if ( mySindex == -99 ) {
       alert ( printFor+" is not avaliable for current Settings.  Setting Forecast Period to "+ForName[4]+" for Column "+(clm+1))
       mySindex = myDay1
     }
  mySelect[clm].selectedIndex = mySindex
  setCurrentFor(clm)
}

function setCurrentFor(clm) {
//alert("setCurrentFor"+clm)
  var mySelect = new Array (document.qpfv.period0, document.qpfv.period1)
  currentFor[clm] = mySelect[clm].options[mySelect[clm].selectedIndex].value
  for ( var i=0; i<7; i++) {
    if ( currentFor[clm] == ForValue[i] ) { currentForIndex[clm] = i }
  }
  typeOptions(clm)
  selectCheck(clm)
}

function dispOptions(clm) {
//alert ("dispOptions"+clm)
  var mySelect = new Array (document.qpfv.option0, document.qpfv.option1)
  mySelect[clm].options.length = 0
  var wantDisp = currentDisp[clm]
  if ( currentCheck[0] &&  currentCheck[1] ) {
    mySelect[clm].options[0] = new Option ("Graphic", "graphic", true, true)
    currentDisp[clm] = "graphic"
    var myIndex = 0
    textAvail=false
    textShow=true
    //if (clm == 0) {alert("If you want to view a text product you will need to first uncheck one column")}
  } else {
    mySelect[clm].options[0] = new Option ("Text file", "text", false, false)
    if ( wantDisp == 'text' ) { var myIndex = 0 }
    mySelect[clm].options[1] = new Option ("Graphic", "graphic", true, true)
    if ( wantDisp == 'graphic' ) { var myIndex = 1 }
    textAvail=true
  }
  mySelect[clm].selectedIndex = myIndex
  typeOptions(clm)
}

function warnText() {
  if (!textAvail && textShow) {
    alert("If you want to view a text product you will need to first uncheck one column")
    textShow=false
  }
}

function setCurrentDisp(clm) {
//alert ("setCurrentDisp"+clm)
  var mySelect = new Array (document.qpfv.option0, document.qpfv.option1)
  oldDisp[clm] = currentDisp[clm]
  currentDisp[clm] = mySelect[clm].options[mySelect[clm].selectedIndex].value
  typeOptions(clm)
  if ( ! currentCheck[clm] ) selectCheck(clm)
}

function typeOptions(clm) {
//alert ("typeOptions"+clm)
  var mySelect = new Array (document.qpfv.opttype0, document.qpfv.opttype1)
  mySelect[clm].options.length = 0
  var wantOptType = OptTypeValue[currentOTindex[clm]]
  var printOptType = OptTypeName[currentOTindex[clm]]
  var mySindex = -99
  if (currentDisp[clm] == "graphic") {
    if (currentStatType[clm] == "cont") {
      var myIndex = 0
      for ( var i=0; i<5; i++ ) {
        if (!(currentYear[clm] > 2002 || (currentYear[clm] == 2002 && currentMonth[clm] >= 7)) && i==3 ) { continue }
        mySelect[clm].options[myIndex] = new Option(OptTypeName[i], OptTypeValue[i], false, false)
        if (wantOptType == OptTypeValue[i]) { mySindex = myIndex }
        if ( i == 4 ) { var myMae = myIndex }
        myIndex++
      }
      if ( mySindex == -99 ) {
        if ( oldDisp[clm] == 'graphic' && oldStatType[clm] == 'cont') { alert (printOptType+" not available for "+monthList[currentMonth[clm]]+" "+currentYear[clm]+".  Setting Score to "+OptTypeName[4]+" for Column "+(clm+1))}
        mySindex = myMae
      }
      oldDisp[clm] = 'graphic'
      oldStatType[clm] = 'cont'
    } else {
      var myIndex = 0
      for ( var i=5; i<11; i++ ) {
        mySelect[clm].options[myIndex] = new Option(OptTypeName[i], OptTypeValue[i], false, false)
        if (wantOptType == OptTypeValue[i]) { mySindex = myIndex }
        if ( i == 10 ) { var myTS = myIndex }
        myIndex++
      }
      if ( mySindex == -99 ) {
        if ( oldDisp[clm] == 'graphic' && oldStatType[clm] == 'cat') { alert(printOptType+" is not available for current settings.  Setting Score to "+OptTypeName[10]+" for Column "+(clm+1))}
        mySindex = myTS
      }
      oldDisp[clm] = 'graphic'
      oldStatType[clm] = 'cat'
    }
  } else {
    var myIndex = 0
    for ( var i=11; i<17; i++) {
      if ((currentFor[clm] == "day2" || currentFor[clm] == "day3") && i == 11 ) { continue }
      if ((currentFor[clm] == "day3" && currentYear[clm] <= 2001 && currentMonth[clm] < 10) && i == 12) { continue }
      if ( !((currentRFC[clm] == "CBRFC" || currentRFC[clm] == "CNRFC" || currentRFC[clm] == "NWRFC") && currentYear[clm] >= 2003 ) && OptTypeValue[i] == "hpcmm") { continue }
      if ( OptTypeValue[i] == 'rfc' ) { 
        if ( currentRFC[clm] == 'CONUS') { 
          mySelect[clm].options[myIndex] = new Option("All RFC's", currentRFC[clm], false, false)
        } else {
          mySelect[clm].options[myIndex] = new Option(OptTypeName[i], currentRFC[clm], false, false)
        }
        var myRFC = myIndex
      } else {
      mySelect[clm].options[myIndex] = new Option(OptTypeName[i], OptTypeValue[i], false, false)
      }
      if ( wantOptType == OptTypeValue[i]) { mySindex = myIndex}
      myIndex++
    }
    if (mySindex == -99 ) {
      if ( oldDisp[clm] == 'text') { alert (printOptType+" not available for current settings.  Setting QPF product to RFC for Column "+(clm+1))}
      currentOptType[clm] = currentRFC[clm]
      mySindex = myRFC
    }
    oldDisp[clm] = 'text'
  }
  mySelect[clm].selectedIndex = mySindex
  currentOptType[clm] = mySelect[clm].options[mySelect[clm].selectedIndex].value
  if ( currentOptType[clm] == currentRFC[clm] ) { currentOTindex[clm] = 16 }
  for (var i=0; i<16; i++ ) {
    if ( currentOptType[clm] == OptTypeValue[i] ) { currentOTindex[clm] = i }
  }
}

function setCurrentOptType(clm) {
//alert ("setCurrentOptType"+clm)
  var mySelect = new Array (document.qpfv.opttype0, document.qpfv.opttype1)
  currentOptType[clm] = mySelect[clm].options[mySelect[clm].selectedIndex].value
  if ( currentOptType[clm] == currentRFC[clm] ) { currentOTindex[clm] = 16 }
  for (var i=0; i<16; i++ ) {
    if ( currentOptType[clm] == OptTypeValue[i] ) { currentOTindex[clm] = i }
  }
  if ( !currentCheck[clm] ) selectCheck(clm)
}

function checkMM() {
//alert("In checkMM()")
  var myHidden = new Array (document.qpfv.mm0, document.qpfv.mm1)
  for (var i=0; i<2; ++i) {
    if ( ((currentRFC[i] == "CBRFC" || currentRFC[i] == "CNRFC" || currentRFC[i] == "NWRFC") && currentYear[i] == 2003) && currentMonth[i] != 13 ) {
      myHidden[i].value="yes"
    } else {
      myHidden[i].value="no"
    }
  }
}

function checkForm() {
  //document.qpfv.action="http://www.hpc.ncep.noaa.gov/cgi-bin/npvu.qpfv.rfc.cgi"
  //document.qpfv.target="_blank"
  if ( ! currentCheck[0] && ! currentCheck[1] ) {
    alert("You must Select at least one column to submit.")
    return false;
  }
  if ( currentCheck[0] && currentCheck[1] ) {
   if ( currentRFC[0] == currentRFC[1] ) {
    if ( currentYear[0] == currentYear[1] ) {
     if ( currentMonth[0] == currentMonth[1] ) {
      if ( currentType[0] == currentType[1] ) {
       if ( currentIntType[0] == currentIntType[1] ) {
        if ( currentStatType[0] == currentStatType[1] ) {
         if ( currentDur[0] == currentDur[1] ) {
          if ( currentFor[0] == currentFor[1] ) {
           if ( currentOptType[0] == currentOptType[1] ) {
            return confirm("You are submitting a request for two of the same graph.\nAre you sure you want to do this?")
           }
          }
         }
        }
       }
      }
     }
    }
   }
  }
  return true;
}

function printWarn() {
  alert("Don't forget to change your printer's orientation to landscape")
  return true
}

function checkSelect() {
  alert ("currentRFC: "+currentRFC+"\ncurrentYear: "+currentYear+"\ncurrentMonth: "+currentMonth+"\ncurrentIntType: "+currentIntType+"\ncurrentStatType: "+currentStatType+"\ncurrentFor: "+currentFor+"\ncurrentDisp: "+currentDisp)

  myRFC = new Array ( document.qpfv.rfc0.options[document.qpfv.rfc0.selectedIndex].value, document.qpfv.rfc1.options[document.qpfv.rfc1.selectedIndex].value)
  myYEAR = new Array ( document.qpfv.year0.options[document.qpfv.year0.selectedIndex].value, document.qpfv.year1.options[document.qpfv.year1.selectedIndex].value)
  myMONTH = new Array ( document.qpfv.month0.options[document.qpfv.month0.selectedIndex].value, document.qpfv.month1.options[document.qpfv.month1.selectedIndex].value)
  myTYPE = new Array ( document.qpfv.type0.options[document.qpfv.type0.selectedIndex].value, document.qpfv.type1.options[document.qpfv.type1.selectedIndex].value)
  myINTER = new Array ( document.qpfv.inter0.options[document.qpfv.inter0.selectedIndex].value, document.qpfv.inter1.options[document.qpfv.inter1.selectedIndex].value)
  mySTAT = new Array ( document.qpfv.stat0.options[document.qpfv.stat0.selectedIndex].value, document.qpfv.stat1.options[document.qpfv.stat1.selectedIndex].value)
  myPERIOD = new Array ( document.qpfv.period0.options[document.qpfv.period0.selectedIndex].value, document.qpfv.period1.options[document.qpfv.period1.selectedIndex].value)
  myOPTION = new Array ( document.qpfv.option0.options[document.qpfv.option0.selectedIndex].value, document.qpfv.option1.options[document.qpfv.option1.selectedIndex].value)
  myOPTTYPE = new Array ( document.qpfv.opttype.options[document.qpfv.opttype.selectedIndex].value, document.qpfv.opttype.options[document.qpfv.opttype0.selectedIndex].value)

  alert ("myRFC: "+myRFC+"\nmyYEAR: "+myYEAR+"\nmyMONTH: "+myMONTH+"\nmyTYPE: "+myTYPE+"\nmyINTER: "+myINTER+"\nmySTAT: "+mySTAT+"\nmyPERIOD: "+myPERIOD+"\nmyOPTION: "+myOPTION+"\nmyOPTTYPE: "+myOPTTYPE)
}
