function HenryUnit (unitin,unitout,temp)
{
 var ucf = 1; 
 //molecular weight of water and air
  var mww = 18;
  var mwg = 29;
  //Units for densw are g/m3
  var densw = 1E6;
  //Units of the gas constant are atm m3/mol K
  var r = 8.206E-5;
  
  //convert hk to the specified output units
  //convert to K
  temp = temp + 273.15
  //determine the density of air given that the pressure is 1 atm.  
  var densg = mwg/r/temp

//Define the unit conversion factors
  if (unitin=="hcc")
  {
    if (unitout=="hcc") {ucf = 1;}
    if (unitout=="hyx") {ucf = (densw/mww) * (mwg/densg);}
    if (unitout=="hpx") {ucf = r*temp*(densw/mww);}
    if (unitout=="hpc") {ucf = r*temp;}
  }

  if (unitin=="hyx")
  {
    if (unitout=="hcc") {ucf = mww/densw*densg/mwg;}
    if (unitout=="hyx") {ucf = 1;}
    if (unitout=="hpx") {ucf = r*temp*(densg/mwg);}
    if (unitout=="hpc") {ucf = r*temp*densg/mwg*mww*densw;}
  }

   if (unitin=="hpx")
  {
    if (unitout=="hcc") {ucf = 1/r/temp*mww/densw;}
    if (unitout=="hyx") {ucf = 1/r/temp*mwg/densg;}
    if (unitout=="hpx") {ucf = 1;}
    if (unitout=="hpc") {ucf = mww*densw;}
  }

if (unitin=="hpc")
  {
    if (unitout=="hcc") ucf = 1/r/temp
    if (unitout=="hyx") ucf = 1/r/temp*mwg/densg*densw/mww 
    if (unitout=="hpx") ucf = densw/mww
    if (unitout=="hpc") ucf = 1
  }

return ucf;

}