function zTable(){
	return "<form name='ccform'><table><tr><td><font face='Arial' size='2'>Critical Pressure (Pc)</font></td><td><font face='Arial' size='2'><input type=text name=Pc size=6></font></td><td> <font face='Arial' size='2'> PSIA</font></td></tr><tr><td><font face='Arial' size='2'>Critical Temperature (Tc)</font></td><td><font face='Arial' size='2'><input type=text name=Tc size=6></font></td><td> <font face='Arial' size='2'> Deg. F</font></td></tr><tr><td><font face='Arial' size='2'>Process Gas Pressure</font></td><td><font face='Arial' size='2'><input type=text name=P size=6></font></td><td> <font face='Arial' size='2'> PSIA</font></td></tr><tr><td><font face='Arial' size='2'>Process Gas Temperature</font></td><td><font face='Arial' size='2'><input type=text name=T size=6></font></td><td> <font face='Arial' size='2'> Deg. F</font></td></tr><tr><td><font face='Arial' size='2'><input type=button value='Calculate' onClick='calculateConstants()'></font><td><hr></td></tr><tr><td><font face='Arial' size='2'>Reduced Pressure (Pr)</font></td><td><font face='Arial' size='2'><input type=text name=Pr size=6></font></td></tr><tr><td><font face='Arial' size='2'>Reduced Temperature (Tr)</font></td><td><font face='Arial' size='2'><input type=text name=Tr size=6></font></td></tr></table></form>Use the Reduced Pressure (Pr), Reduced Temperature (Tr) and <a href='JavaScript:showGraph()'> this graph </a>to estimate the Compressibility Factor Z, and enter it into the 'Calculator.'";
}

function calculateConstants() {

   var Tc = document.ccform.Tc.value * 1 + 460;
   var Pc = document.ccform.Pc.value;
   var T = document.ccform.T.value * 1 + 460;
   var P = document.ccform.P.value;
   var Tr = T / Tc;
   var Pr = P / Pc;

   if (!isNaN(Pr) && (Pr != Number.POSITIVE_INFINITY) && (Pr != Number.NEGATIVE_INFINITY) &&
       !isNaN(Tr) && (Tr != Number.POSITIVE_INFINITY) && (Tr != Number.NEGATIVE_INFINITY)) {
         document.ccform.Pr.value = round(Pr);
         document.ccform.Tr.value = round(Tr);
   }
   else {
         document.ccform.Pr.value = "error";
         document.ccform.Tr.value = "error";
   }

}

function round(x){
   return Math.round(x*100)/100;
}

function showGraph() {

   var Pr = document.ccform.Pr.value;
   var Tr = document.ccform.Tr.value;
   var graph1, graph2, graph3, graph4;

   if (screen.width < 950){
      graphWin= open("", "displayWindow", 
         "width=700,height=530,status=no,toolbar=no,menubar=no");

      graph1="<img src=images/z1small.gif width=654 height=439 alt=graph><br />";
      graph2="<img src=images/z2small.gif width=657 height=440 alt=graph><br />";
      graph3="<img src=images/z3small.gif width=639 height=448 alt=graph><br />";
      graph4="<img src=images/z4small.gif width=656 height=445 alt=graph><br />";
   }
   else{
      graphWin= open("", "displayWindow", 
         "width=845,height=680,status=no,toolbar=no,menubar=no");

      graph1="<img src=images/z1.gif width=803 height=539 alt=graph><br />";
      graph2="<img src=images/z2.gif width=803 height=533 alt=graph><br />";
      graph3="<img src=images/z3.gif width=772 height=539 alt=graph><br />";
      graph4="<img src=images/z4.gif width=803 height=539 alt=graph><br />";
   }

  graphWin.document.open();
  
  graphWin.document.write("<html><head><title>Compresability Factor Chart");
  graphWin.document.write("</title></head><body>");
  if ((Pr <= 0.10) && (Tr <= 2.0)){
     graphWin.document.write(graph1);
  }
  else if ((Pr <= 1.0) && (Tr <= 5.0)){
     graphWin.document.write(graph2);
  }
  else if ((Pr <= 10.0) && (Tr <= 3.5)){
     graphWin.document.write(graph3);
  }
  else {
     graphWin.document.write(graph4);
  }

  graphWin.document.write("The Reduced Temperature (Tr) is represented by a trace on the graph. The Reduced Pressure (Pr) is represented by a vertical line. Locate the spot on the graph where the Tr Trace and the Pr line intersect, and then follow the corresponding horizontal line to the left to obtain the Compressibility Factor Z."); 
  graphWin.document.write("</body></html>");

  graphWin.document.close();  
}