var MixGrav //Double
var MixCorr //Boolean
var MixName //String
var iUnit = 0   //Integer
//For emulating modal popup
var newWindow
//For checking singe selectins in mulpipleselect
var tubeSelectedItem
var floatSelectedItem



function txtMaxFT_Text(){
  return document.frmFlow.txtMaxFT.value
}
function txtFlowRate_Text(){
  return document.frmFlow.txtFlowRate.value
}
function txtA_Text(){
  return document.frmFlow.txtA_Text.value
}
function txtB_Text(){
  return document.frmFlow.txtB.value
}
function txtSpecGrav_Text(){
  return document.frmFlow.txtSpecGrav.value
}
function txtTemp_Text(){
  return document.frmFlow.txtTemp.value
} 
function txtPress_Text(){
  return document.frmFlow.txtPress.value
} 
function txtCon_Text(){
  return document.frmFlow.txtCon.value
} 
function cmbCon_Text(){
  a = document.frmFlow.cmbCon.options.selectedIndex
  return document.frmFlow.cmbCon.options[a].value
}
function cmbFrame_Text(){
  a = document.frmFlow.cmbFrame.options.selectedIndex
  return document.frmFlow.cmbFrame.options[a].value
}
function cboGases_Text(){
  a = document.frmFlow.cboGases.options.selectedIndex
  return document.frmFlow.cboGases.options[a].value
}
function txtC_Text(){
  return document.frmFlow.txtC.value
}
function txtD_Text(){
  return document.frmFlow.txtD.value
}
function cmbSeries_Text(){
  a = document.frmFlow.cmbSeries.options.selectedIndex
  return document.frmFlow.cmbSeries.options[a].value
}
function txtSeries_Text(){
  return document.frmFlow.txtSeries.value
}
function cmbValve_Text(){
  a = document.frmFlow.cmbValve.options.selectedIndex
  return document.frmFlow.cmbValve.options[a].value
} 
function lstTube_Text(){
  a = document.frmFlow.lstTube.options.selectedIndex
  return document.frmFlow.lstTube.options[a].value
}

//To emulate modal popup window

function checkPopup() {
  if (newWindow && !newWindow.closed) {
    //alert('Please complete the required information');
    newWindow.focus();
  }
}

 
function UpdateMaxGas() {
   var Conv //Double

   G = Number(document.frmFlow.txtSpecGrav.value)
   T = Number(document.frmFlow.txtTemp.value) + 460
   P = Number(document.frmFlow.txtPress.value) + 14.7
   Q = Number(document.frmFlow.txtMaxFT.value)

//   alert(G + " "+ T + " "+P+" "+Q)

   Conv = Math.sqrt((G * T / 530 * 14.7 / P))
   
   document.frmFlow.txtMaxGas.value = Q / Conv
}

function UpdateFlow(){
   var Conv //Double

   G = Number(document.frmFlow.txtSpecGrav.value);
   T = Number(document.frmFlow.txtTemp.value) + 460;
   P = Number(document.frmFlow.txtPress.value) + 14.7;

   //alert(G + " "+ T + " "+P)

   
   Conv = Math.sqrt((G * T / 530 * 14.7 / P))

   //alert(Conv)
   
   document.frmFlow.txtMax.value = Conv * Number(txtFlowRate_Text());
}   

function cboGases_Click(){
   if (document.frmFlow.cboGases.selectedIndex != (document.frmFlow.cboGases.length - 1)) {
        // txtSpecGrav.locked = true
   }

   if (document.frmFlow.cboGases.selectedIndex > -1 && document.frmFlow.cboGases.selectedIndex != (document.frmFlow.cboGases.length - 2)) { 
      MixCorr = false 
   }

   a = cboGases_Text();
   switch (a) {
        case 'Acetylene':
          document.frmFlow.txtSpecGrav.value = "0.9073"; 
          break;
        case 'Air':
          document.frmFlow.txtSpecGrav.value = "1";
          break;
        case 'Ammonia':
          document.frmFlow.txtSpecGrav.value = "0.5963";
          break;
        case 'Argon':
          document.frmFlow.txtSpecGrav.value = "1.3796";
          break;
        case 'Butane':
          document.frmFlow.txtSpecGrav.value = "2.0854";
          break;
        case 'Carbon dioxide':
          document.frmFlow.txtSpecGrav.value = "1.529";
          break;
        case 'Chlorine':
          document.frmFlow.txtSpecGrav.value = "2.486";
          break;
        case 'Ethane':
          document.frmFlow.txtSpecGrav.value = "1.0493";
          break;
        case 'Ethylene':
          document.frmFlow.txtSpecGrav.value = "0.9749";
          break;
        case 'Helium':
          document.frmFlow.txtSpecGrav.value = "0.138";
          break;
        case 'Hydrogen':
          document.frmFlow.txtSpecGrav.value = "0.0659";
          break;
        case 'Methane':
          document.frmFlow.txtSpecGrav.value = "0.5544";
          break;
        case 'Nitrogen':
          document.frmFlow.txtSpecGrav.value = "0.9762";
          break;
        case 'Nitrous oxide':
          document.frmFlow.txtSpecGrav.value = "1.5297";
          break;
        case 'Oxygen':
          document.frmFlow.txtSpecGrav.value = "1.1053";
          break;
        case 'Propane':
          document.frmFlow.txtSpecGrav.value = "1.562";
          break;
        case 'Sulphur dioxide':
          document.frmFlow.txtSpecGrav.value = "2.2638";
          break;
        case 'Mixture...':
            MixGrav="0"
            GetMix()
            break; 
        case 'Other...':
            document.frmFlow.txtSpecGrav.value = 1;
            //txtSpecGrav.Locked = False;
            alert("Please enter a specific gravity for the gas.");
            document.frmFlow.txtSpecGrav.focus();
            //txtSpecGrav.SelStart = 0;
            //txtSpecGrav.SelLength = Len(txtSpecGrav.Text);
            break;
        case '':
            document.frmFlow.txtSpecGrav.value = "";
            break;
         
      }   
    if ((cmbFrame_Text == "Black anodized brass") && ((cboGases_Text == "Chlorine") || (cboGases_Text == "Ammonia") || (cboGases_Text == "Sulphur dioxide") || (MixCorr))){
        alert("You may not use a black anodized brass frame with a corrosive gas!");
        document.frmFlow.cmbFrame.selectedIndex = 2
        document.frmFlow.txtC.value = "2"
    }
    
    ClearIt()

    if ((document.frmFlow.txtFlowRate.value != "") && (cboGases_Text != "")){
      UpdateFlow()
    }
}         

//New function due to differences of VB and JS
function GetResultsFromPopup(){
  if (MixGrav != 0) {
      document.frmFlow.txtSpecGrav.value = MixGrav
  } else {
      document.frmFlow.cboGases.selectedIndex = 1
      cboGases_Click()
  }    
  UpdateFlow()
}

function cmbCon_Click() {

    var localTxtCon = document.frmFlow.txtCon

    if (cmbFrame_Text() == "No frame (tube & float only)" && cmbCon_Text() != "No Connection") {
        alert ('You cannot have a connection without a frame');
        document.frmFlow.cmbCon.selectedIndex = 0
        localTxtCon.value = "000"
    }
    if (cmbCon_Text() == "1/8 FPT") 
        localTxtCon.value = "000"
    else if (cmbCon_Text() == "1/4 Tube Fitting") 
        localTxtCon.value = "TF4" 
    else if (cmbCon_Text() == "1/8 Tube Fitting") 
        localTxtCon.value = "TF2" 
    else if (cmbCon_Text() == "1/4 Hose Barb") 
        localTxtCon.value = "HB4"
    else if (cmbCon_Text() == "1/8 Hose Barb") 
        localTxtCon.value = "HB8"
}          
  
function cmbFrame_Click() {
//      var localcmbFrame =
    if (cmbFrame_Text() == "Black anodized brass" && 
       (cboGases_Text() == "Chlorine" 
        || cboGases_Text() == "Ammonia" 
        || cboGases_Text() == "Sulphur dioxide" 
        || MixCorr)) {
        alert ('You may not use a black anodized brass frame with a corrosive gas!')
        document.frmFlow.cmbFrame.selectedIndex = 2;
        document.frmFlow.txtC.value = "2"
    }

    if (cmbFrame_Text() == "Black anodized brass") {
        document.frmFlow.txtC.value = "1"
        if (document.frmFlow.cmbCon.selectedIndex == 4) {
            document.frmFlow.cmbCon.selectedIndex = 0
           // cmbCon.RemoveItem (4)
        }
    } else if (cmbFrame_Text() == "316 Stainless steel") {
        document.frmFlow.txtC.value = "2"
        if (document.frmFlow.cmbCon.selectedIndex == 4) {
          document.frmFlow.cmbCon.selectedIndex = 0 
          //   cmbCon.RemoveItem (4)  
        }
    } else {
        document.frmFlow.txtC.value = "0"
        document.frmFlow.txtD.value = "0"
        document.frmFlow.txtCon.value = "000" 
        document.frmFlow.cmbValve.selectedIndex = 0
        document.frmFlow.cmbCon.selectedIndex = 0
    }
} 


function cmbSeries_Click(){
    if (cmbSeries_Text() == "150 mm") {
        document.frmFlow.txtSeries.value = "560";
        if (document.frmFlow.lstTube.length == 9){ 
          document.frmFlow.lstTube.options[8] = null
        }
    } else {
      document.frmFlow.txtSeries.value = "565"
      if (document.frmFlow.lstTube.length == 8){ 
           document.frmFlow.lstTube.options[8] = new Option("9","9")
      }
    }
}

function cmbValve_Click(){
    if (cmbFrame_Text() == "No frame (tube & float only)" && 
      cmbValve_Text() != "No valve") {
      alert ('You cannot have a valve without a frame');
      document.frmFlow.cmbValve.selectedIndex = 0
    }
    if (cmbValve_Text() == "Standard valve") {
      document.frmFlow.txtD.value = "1"
    }
    else if (cmbValve_Text() == "No valve"){
      document.frmFlow.txtD.value = "0"
    }
    else{ 
      document.frmFlow.txtD.value = "2"
    }
}


function cmdCalc_Click(){

    

    var Top //Integer
    
    Tube = new Array(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9)
    Float = new Array(1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5)
    
    SL = new Array(0.051, 0.078, 156, 0.28, 0.31, 0.1, 0.15, 0.255, 0.475, 0.52, 0.4, 0.545, 0.845, 1.275, 1.37, 0.9, 1.175, 1.78, 2.6, 2.75, 2.5, 3.36, 5.0, 7.2, 7.6, 4.0, 5.2, 7.65, 11.0, 11.575, 6.0, 7.24, 11.42, 16.275, 17.35, 10.0, 12.97, 18.8, 26.665, 28.285, 24.5, 31.9, 44.425, 63.6, 64.2)
    SM = new Array(51, 78, 156, 280, 310, 100, 150, 255, 475, 520, 400, 545, 845, 1275, 1370, 900, 1175, 1780, 2600, 2750, 2500, 3360, 5000, 7200, 7600, 4000, 5200, 7650, 11000, 11575, 6000, 7240, 11420, 16275, 17350, 10000, 12970, 18800, 26665, 28285, 24500, 31900, 44425, 63600, 64200)
    SS = new Array(0.11, 0.17, 0.33, 0.59, 0.66, 0.21, 0.32, 0.54, 1.01, 1.1, 0.85, 1.16, 1.79, 2.7, 2.9, 1.91, 2.49, 3.77, 5.51, 5.83, 5.3, 7.12, 10.6, 15.3, 16.1, 8.48, 11.0, 16.2, 23.3, 24.5, 12.7, 15.3, 24.2, 34.5, 36.8, 21.2, 27.5, 39.86, 56.53, 59.96, 51.94, 67.63, 94.18, 134.83, 136.1)
  
    BL = new Array(0.05, 0.078, 0.152, 0.281, 0.315, 0.1, 0.155, 0.295, 0.49, 0.53, 0.4, 0.55, 0.85, 1.275, 1.375, 0.85, 1.15, 1.75, 2.48, 2.73, 2.3, 2.95, 4.45, 6.375, 6.825, 3.5, 4.55, 6.8, 9.73, 10.3, 10.2, 13.025, 19.05, 27.0, 28.5, 25.0, 32.5, 46.2, 65.7, 72.6)
    BM = new Array(50, 78, 152, 281, 315, 100, 155, 295, 490, 530, 400, 550, 850, 1275, 1375, 850, 1150, 1750, 2480, 2730, 2300, 2950, 4450, 6375, 6825, 3500, 4550, 6800, 9730, 10300, 10200, 13025, 19050, 27000, 28500, 25000, 32500, 46200, 65700, 72600)
    BS = new Array(0.11, 0.17, 0.32, 0.6, 0.67, 0.21, 0.33, 0.63, 1.04, 1.12, 0.85, 1.17, 1.8, 2.7, 2.92, 1.8, 2.44, 3.71, 5.26, 5.79, 4.88, 6.25, 9.43, 13.5, 14.5, 7.42, 9.65, 14.4, 20.6, 21.8, 21.6, 27.6, 40.4, 57.2, 60.4, 53.0, 68.9, 97.9, 139.3, 153.9)
    
    holder = new Array()    


    X = 0

    if (document.frmFlow.txtMax.value == ""){
      alert("You must select a gas and flow rate!")
      return
    }
        
    Flow = Number(document.frmFlow.txtMax.value)
    
    if (cmbSeries_Text() == ""){
      alert("You must select a flowmeter size!")
      return
    }

    if (cmbSeries_Text() == "150 mm"){
        Top = 39
        switch (iUnit){
            case 0:
                holder = BM
                break
            case 1:
                holder = BS
                break
            case 2:
                holder = BL
                break
            case 3:
                holder = BM
                break
        }
    }else if (cmbSeries_Text() == "65 mm"){
        Top = 44
        switch (iUnit){
            case 0:
                holder = SM
                break
            case 1:
                holder = SS
                break
            case 2:
                holder = SL
                break
            case 3:
                holder = SM
                break
        }
    }
        
    if (holder[Top] < Flow){
        alert("The flow requirements exceed the maximum possible for flowmeter.")
        document.frmFlow.txtFlowRate.focus()
        //txtFlowRate.SelStart = 0
        ///txtFlowRate.SelLength = Len(txtFlowRate.Text)
        return
    }
    
    Diff = holder[Top] - holder[0]
    
    
    for (i = 0; i <= Top; i++){
      if ((holder[i] > Flow) && ((holder[i] - Flow) < Diff)){
        Diff = holder[i] - Flow
        X = i
      }
    }
        
    document.frmFlow.txtA.value = Tube[X]
    document.frmFlow.txtB.value = Float[X]
   
    document.frmFlow.lstTube.selectedIndex = Tube[X] - 1
    lstTube_Click()
    document.frmFlow.lstFloat.selectedIndex = Float[X] - 1
    lstFloat_Click()
    
    document.frmFlow.txtMaxFT.value = holder[X]
    UpdateMaxGas()
    //cmdCalc.Default = True
    
}


function cmdFlow_Click(){
    var Top // Integer
    
    Tube = new Array(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9)
    Float = new Array(1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5)
    SL = new Array(0.051, 0.078, 156, 0.28, 0.31, 0.1, 0.15, 0.255, 0.475, 0.52, 0.4, 0.545, 0.845, 1.275, 1.37, 0.9, 1.175, 1.78, 2.6, 2.75, 2.5, 3.36, 5.0, 7.2, 7.6, 4.0, 5.2, 7.65, 11.0, 11.575, 6.0, 7.24, 11.42, 16.275, 17.35, 10.0, 12.97, 18.8, 26.665, 28.285, 24.5, 31.9, 44.425, 63.6, 64.2)
    SM = new Array(51, 78, 156, 280, 310, 100, 150, 255, 475, 520, 400, 545, 845, 1275, 1370, 900, 1175, 1780, 2600, 2750, 2500, 3360, 5000, 7200, 7600, 4000, 5200, 7650, 11000, 11575, 6000, 7240, 11420, 16275, 17350, 10000, 12970, 18800, 26665, 28285, 24500, 31900, 44425, 63600, 64200)
    SS = new Array(0.11, 0.17, 0.33, 0.59, 0.66, 0.21, 0.32, 0.54, 1.01, 1.1, 0.85, 1.16, 1.79, 2.7, 2.9, 1.91, 2.49, 3.77, 5.51, 5.83, 5.3, 7.12, 10.6, 15.3, 16.1, 8.48, 11.0, 16.2, 23.3, 24.5, 12.7, 15.3, 24.2, 34.5, 36.8, 21.2, 27.5, 39.86, 56.53, 59.96, 51.94, 67.63, 94.18, 134.83, 136.1)
    BL = new Array(0.05, 0.078, 0.152, 0.281, 0.315, 0.1, 0.155, 0.295, 0.49, 0.53, 0.4, 0.55, 0.85, 1.275, 1.375, 0.85, 1.15, 1.75, 2.48, 2.73, 2.3, 2.95, 4.45, 6.375, 6.825, 3.5, 4.55, 6.8, 9.73, 10.3, 10.2, 13.025, 19.05, 27.0, 28.5, 25.0, 32.5, 46.2, 65.7, 72.6)
    BM = new Array(50, 78, 152, 281, 315, 100, 155, 295, 490, 530, 400, 550, 850, 1275, 1375, 850, 1150, 1750, 2480, 2730, 2300, 2950, 4450, 6375, 6825, 3500, 4550, 6800, 9730, 10300, 10200, 13025, 19050, 27000, 28500, 25000, 32500, 46200, 65700, 72600)
    BS = new Array(0.11, 0.17, 0.32, 0.6, 0.67, 0.21, 0.33, 0.63, 1.04, 1.12, 0.85, 1.17, 1.8, 2.7, 2.92, 1.8, 2.44, 3.71, 5.26, 5.79, 4.88, 6.25, 9.43, 13.5, 14.5, 7.42, 9.65, 14.4, 20.6, 21.8, 21.6, 27.6, 40.4, 57.2, 60.4, 53.0, 68.9, 97.9, 139.3, 153.9)

    holder = new Array()    

    if (cmbSeries_Text() == ""){
      alert("You must select a flowmeter size!")
      return
    }
    
    if (cmbSeries_Text() == "150 mm"){
        Top = 39
        switch (iUnit){
            case 0:
                holder = BM
                break
            case 1:
                holder = BS
                break
            case 2:
                holder = BL
                break
            case 3:
                holder = BM
                break
        }
    }else if (cmbSeries_Text() == "65 mm"){
        Top = 44
        switch (iUnit){
            case 0:
                holder = SM
                break
            case 1:
                holder = SS
                break
            case 2:
                holder = SL
                break
            case 3:
                holder = SM
                break
        }
    }
    
    if ((document.frmFlow.txtA.value == "") || (document.frmFlow.txtB.value == "")){
        alert("You must select a tube and float!")
        return
    }

    for (i = 0; i<=Top; i++){
      if ((Tube[i] == (document.frmFlow.lstTube.selectedIndex + 1)) 
         && (Float[i] == (document.frmFlow.lstFloat.selectedIndex + 1))){

            //alert(holder[i])
            document.frmFlow.txtMaxFT.value = holder[i]

      }  
    }
    
    UpdateMaxGas()
    //cmdFlow.Default = True
}

function Form_Load(){
  document.frmFlow.cboGases.selectedIndex = 1
  iUnit = 0
}



function lstFloat_Click() {
    //Checking for single selection in multipleselect
    tmpFloatSelectedItem=-1
    for (i=0; i<document.frmFlow.lstFloat.length; i++){
      
      if (document.frmFlow.lstFloat.options[i].selected == true){
        if (i == floatSelectedItem) {
          document.frmFlow.lstFloat.options[i].selected = false
        }else{
          if (tmpFloatSelectedItem>-1){
            document.frmFlow.lstFloat.options[i].selected = false
          }else{
            tmpFloatSelectedItem=i
          }
        }
      }
    }     
    
    if(tmpFloatSelectedItem == -1){
      document.frmFlow.lstFloat.options[floatSelectedItem].selected = true
    }else{
      floatSelectedItem=tmpFloatSelectedItem
    }
    
    /////////////////////////////////////////////////////
    document.frmFlow.txtB.value = (document.frmFlow.lstFloat.selectedIndex + 1)
    document.frmFlow.txtMaxFT.value = ""
    document.frmFlow.txtMaxGas.value = ""
}
function lstTube_Click() {

    //Checking for single selection in multipleselect
    tmpTubeSelectedItem=-1
    for (i=0; i<document.frmFlow.lstTube.length; i++){
      
      if (document.frmFlow.lstTube.options[i].selected == true){
        if (i == tubeSelectedItem) {
          document.frmFlow.lstTube.options[i].selected = false
        }else{
          if (tmpTubeSelectedItem>-1){
            document.frmFlow.lstTube.options[i].selected = false
          }else{
            tmpTubeSelectedItem=i
          }
        }
      }
    }     

    if(tmpTubeSelectedItem == -1){
      document.frmFlow.lstTube.options[tubeSelectedItem].selected = true
    }else{
      tubeSelectedItem=tmpTubeSelectedItem
    }
    /////////////////////////////////////////////////////



    document.frmFlow.txtA.value = (document.frmFlow.lstTube.selectedIndex + 1)
    document.frmFlow.txtMaxFT.value = ""
    document.frmFlow.txtMaxGas.value = ""
}


function optUnit_Click(Index){
    document.frmFlow.lstTube.selectedIndex = -1
    document.frmFlow.lstFloat.selectedIndex = -1
    document.frmFlow.txtA.value = ""
    document.frmFlow.txtB.value = ""
    iUnit = Index
}

function txtFlowRate_LostFocus(){
    UpdateFlow()
    if (Number(document.frmFlow.txtMax.value) < 0){
      alert("You cannot enter a negative flow rate!")
      document.frmFlow.txtFlowRate.focus()
      //txtFlowRate.SelStart = 0
      //txtFlowRate.SelLength = Len(txtFlowRate.Text)
    }
}

function txtPress_LostFocus(){
    if ((Number(document.frmFlow.txtPress.value) > 200) || (Number(document.frmFlow.txtPress.value) < 0)){
        alert("The pressure must be between 0 and 200.")
        document.frmFlow.txtPress.focus()
        //txtPress.SelStart = 0
        //txtPress.SelLength = Len(txtPress.Text)
    } else{
        UpdateFlow()
    }
}

function txtSpecGrav_LostFocus(){
    UpdateFlow()
}

function txtTemp_LostFocus(){
    if (Number(document.frmFlow.txtTemp.value) > 250) {
        alert ("The temperature must be greater than 250.")
        document.frmFlow.txtTemp.focus()
        //txtTemp.SelStart = 0
        //txtTemp.SelLength = Len(txtTemp.Text)
    }else{
      UpdateFlow()
    }
}

function GetMix(){
  newWindow=open("./html/FlowMeterMix.html",'Mixture',"menubar=no,scrollbars=no,status=no,resizable=no,location=no,width=505,height=370");
  newWindow.focus();
}

function ClearIt(){
    
    tubeSelectedItem=-1
    floatSelectedItem=-1

    document.frmFlow.cmbSeries.selectedIndex = 0
    document.frmFlow.cmbFrame.selectedIndex = -1
    document.frmFlow.cmbValve.selectedIndex = -1
    document.frmFlow.cmbCon.selectedIndex = -1
    document.frmFlow.lstTube.ListIndex = -1
    document.frmFlow.lstFloat.ListIndex = -1
    
    document.frmFlow.txtSeries.value = ""
    document.frmFlow.txtA.value = ""
    document.frmFlow.txtB.value = ""
    document.frmFlow.txtC.value = ""
    document.frmFlow.txtD.value = ""
    document.frmFlow.txtCon.value = ""
    document.frmFlow.txtMaxFT.value = ""
    document.frmFlow.txtMaxGas.value = ""

}

