function printfriend()
{
//***********************************************************************
//*
//* Function  printfriend - opens new window with printer-friendly version of report
//*
//* Language:  JavaScript1.1
//*
//* Inputs:
//*   object   form object
//*
//* Returns:
//*   none
//*
//* Limitations:
//*   
//*   
//*
//* Author:
//*  Dr. Fred Tillman
//*  National Research Council Research Associate
//*  Regulatory Support Branch
//*  Ecosystems Research Division
//*  National Exposure Research Laboratory
//*  United States Environmental Protection Agency
//*  960 College Station Road
//*  Athens, Georgia 30605
//*  tillman.fred@epa.gov
//* 
//*
//* Reference:
//*  Flanagan, D., 1997, JavaScript: The Definitive Guide, 2ed, O'Reilly and Associates
//*
//* Created: 4-14-2004
//*
//* Required functions: none
//*
//* Required scripts: none
//*
//***********************************************************************
  

     var f = document.vaporsite;

//* Pull necessary variable values from HTML form (not from Tables as user may have changed inputs)

     var sitename = f.sitename.value;
     var btype = f.btype.options[f.btype.selectedIndex].value;
     var coc = f.coc.options[f.coc.selectedIndex].value;
     var cname = cont(coc,'cname');
     var MCL = cont(coc,'MCL');
     var temp = Input(f.temp.value);
     var tempunits = f.tempunits.options[f.tempunits.selectedIndex].value;

     var soiltype = f.soiltype.options[f.soiltype.selectedIndex].value;
     var sname = soil(soiltype,'sname');

     var CAS = Input(f.CAS.value);
     var MW = Input(f.MW.value);
     var H = Input(f.H.value);
     var Da = f.Da.value;
     var Dw = f.Dw.value;
     var URF = Input(f.URF.value);
     var RfC = Input(f.RfC.value);
     
     var n = Input(f.n.value);
     var thetaw = new Array();
     thetaw[3] = Input(f.thetawl.value);
     thetaw[2] = Input(f.thetaw.value);
     thetaw[1] = Input(f.thetawh.value);
     var thetawcap = Input(f.thetawcap.value);
     var capht = Input(f.capht.value);
     var Qsoil = Input(f.Qsoil.value);
     var TCR = f.TCR.options[f.TCR.selectedIndex].value;

     var btype = f.btype.options[f.btype.selectedIndex].value;
     var bname = build(btype,'bname');
     var Eb = Input(f.Eb.value);
     var Hb = Input(f.Hb.value);
     var Fb = Input(f.Fb.value);
     var Ab = Input(f.Ab.value);
     var eta = Input(f.eta.value);
     var Lcrack = Input(f.Lcrack.value);

     var L = Input(f.LT.value);
     var Lunits = f.Lunits.options[f.Lunits.selectedIndex].value;
     var LTr = Input(f.LTr.value);
     var Lrunits = f.Lunits.options[f.Lunits.selectedIndex].value;

     var EFC = Input(f.EFC.value);
     var EFNC = Input(f.EFNC.value);
     var EDC = Input(f.EDC.value);
     var EDNC = Input(f.EDNC.value);
     var ATC = Input(f.ATC.value);
     var ATNC = Input(f.ATNC.value);
     var THQ = Input(f.THQ.value);

     var deff = Input(f.deff.value);
     var deffT = Input(f.deffT.value);
     var A = Input(f.A.value);
     var Acap = Input(f.Acap.value);
     var B = Input(f.B.value);
     var C = Input(f.C.value);
     var text1 = f.text1.value;
     var alpha = Input(f.alpha.value);
     var alphacap = Input(f.alphacap.value);
     var cflag = f.cflag.value;
     var Cc = Input(f.Cc.value);
     var CcV = Input(f.CcV.value);
     var SG1 = f.SG1.value;
     var SGV1 = f.SGV1.value;
     var GW1 = f.GW1.value;
     var SG2 = f.SG2.value;
     var SGV2 = f.SGV2.value;
     var GW2 = f.GW2.value;
     var SG3 = f.SG3.value;
     var SGV3 = f.SGV3.value;
     var GW3 = f.GW3.value;
     var thetafl = f.thetafl.value;
     var depthfl = f.depthfl.value;
     var thetafh = f.thetafh.value;
     var depthfh = f.depthfh.value;

//*  NOTE:  REMOVING <MCL FLAG PER HENRY SCHUVER RECOMMENDATION
//*     var gwflag1=0;var gwflag2=0;var gwflag3=0;
//*     if (GW1<=MCL & GW1!=0) {gwflag1=1;}
//*     if (GW2<=MCL & GW2!=0) {gwflag2=1;}
//*     if (GW3<=MCL & GW3!=0) {gwflag3=1;}


     var w = window.open('','printwindow','menubar=yes,width=750,height=800,scrollbars=yes');
     var d = w.document;
     d.write('<img src=images/EPAseal.gif align=right width=100 height=100>');
     d.write('<H3>TARGET MEDIA CONCENTRATION RESULTS</H3>');
     d.write('<H4>Screening-Level Johnson and Ettinger Model</H4>');
     d.write('<font size=3><code>');
     d.write('Site Name: &nbsp ',sitename);
     d.write('<br>Report Date: &nbsp ',new Date());
     d.write('<br>Report Generated From: http://www.epa.gov/athens/learn2model/part-two/onsite/JnE_lite.htm ');
     d.write('<br>Depth to contamination from bottom of foundation: &nbsp ',L,Lunits,'&nbsp +/- ',LTr,Lrunits);
     d.write('<br>Average ground water temperature: &nbsp ',temp , tempunits);
     
     d.write('<p><code><strong>CHEMICAL PROPERTIES</strong>');
        d.write('<br>Chemical of Concern: ',cname, '&nbsp &nbsp CAS Number: ',coc);
        d.write('<br>Molecular Weight: ',MW, '[g/mole]', '&nbsp &nbsp Henrys Constant: ',H,'[unitless]');
        d.write('<br>Diffusivity in Air: ',Da,'[cm<sup>2</sup>/sec]', '&nbsp &nbsp Diffusivity in Water: ',Dw,'[cm<sup>2</sup>/sec]');
        d.write('<br>Unit Risk Factor: ',URF,'[(&#956g/m<sup>3</sup>)<sup>-1</sup>]', '&nbsp &nbsp Reference Concentration: ',RfC,'[mg/m<sup>3</sup>]');
     
     d.write('<p><code><strong>SOIL PROPERTIES</strong>');
       d.write('<br>Soil Type: ',sname, '&nbsp &nbsp Total Porosity: ',n);
       d.write('<br>Unsaturated Zone Moisture Content:'); 
       d.write('<br>&nbsp &nbsp low= ',thetaw[3], '&nbsp &nbsp best estimate= ',thetaw[2], '&nbsp &nbsp high= ', thetaw[1]);
       d.write('<br>Capillary Zone Moisture Content: ',thetawcap, '&nbsp &nbsp Height of Capillary Rise: ',capht,'[m]');
       d.write('<br>Soil-Gas Flow Rate into Building: ',Qsoil,' [L/min]');
    
     d.write('<p><code><strong>BUILDING PROPERTIES</strong>');
       d.write('<br>Building Type: ',bname, '&nbsp &nbsp Air Exchange Rate: ',Eb,'[hr<sup>-1</sup>]');
       d.write('<br>Building Mixing Height: ',Hb, '[m]','&nbsp &nbsp Building Footprint Area: ',Fb,'[m<sup>2</sup>]');
       d.write('<br>Subsurface Foundation Area: ',Ab,'[m<sup>2</sup>]', '&nbsp &nbsp Building Crack Ratio: ',eta, '[unitless]');
       d.write('<br>Foundation Slab Thickness: ',Lcrack,'[m]');

     d.write('<p><code><strong>EXPOSURE PARAMETERS</strong>');
       d.write('<br>Exposure Duration: carcinogens ',EDC,' [years] &nbsp &nbsp non-carcinogens: ',EDNC,' [years]');
       d.write('<br>Exposure Frequency: carcinogens ',EFC,' [days/year] &nbsp &nbsp non-carcinogens: ',EFNC,' [days/year]');
       d.write('<br>Averaging Time: carcinogens ',ATC,' [years] &nbsp &nbsp non-carcinogens: ',ATNC,' [years]');
       d.write('<br>Risk Factor for carcinogens: ',TCR,'&nbsp &nbsp Target Hazard Quotient for non-carcinogens: ',THQ);
 
     d.write('<p><code><strong>JOHNSON & ETTINGER SIMULATION RESULTS</strong>');
       d.write('<br>Effective Diffusion Coefficients:');
       d.write('<br>&nbsp &nbsp Unsaturated Zone(D<sub>eff</sub>): ',deff,'[cm<sup>2</sup>/s]');
       d.write('<br>&nbsp &nbsp Unsaturated Zone + Capillary Zone (D<sup>T</sup><sub>eff</sub>): ',deffT,'[cm<sup>2</sup>/s]');
     d.write('<br>');
       d.write('<br>Soil Gas Attenuation Factor (<big>&#945</big><sub><small>SG</small></sub>): &nbsp ',alpha);
       d.write('<br>Ground Water Attenuation Factor (<big>&#945</big><sub><small>GW</small></sub>): &nbsp ',alphacap);
       d.write('<br>Target Concentrations are based on ',cflag,' risk.');
       d.write('<br>Target Indoor Air Concentration: ',Cc,'[&#956g/m<sup>3</sup>] or &nbsp ',CcV,'[ppbv]');
     d.write('<p><code><sup>1</sup><u>Less Protective Target Concentrations</u>');
       d.write('<code><br>Soil Gas: &nbsp ',SG1,'[&#956g/m<sup>3</sup>] or &nbsp ',SGV1,'[ppbv]; ','&nbsp Ground Water: &nbsp ',GW1,'[&#956g/L]');
     d.write('<p><code><u>Best Estimate Target Concentrations</u>');
       d.write('<code><br>Soil Gas: &nbsp ',SG2,'[&#956g/m<sup>3</sup>] or &nbsp ',SGV2,'[ppbv]; ','&nbsp Ground Water: &nbsp ',GW2,'[&#956g/L]');
     d.write('<p><code><sup>2</sup><u>More Protective Target Concentrations</u>');
       d.write('<code><br>Soil Gas: &nbsp ',SG3,'[&#956g/m<sup>3</sup>] or &nbsp ',SGV3,'[ppbv]; ','&nbsp Ground Water: &nbsp ',GW3,'[&#956g/L]');
     d.write('<br>');
       d.write('<p>');

     d.write('<TABLE width = 90%>');
       d.write('<TR><TD align=center bgcolor=#000000 height=1></TD>');
       d.write('</TR></TABLE>');

     d.write('<p><p><code><small>',text1);
     if (LTr==0 & (thetaw[3]!=thetaw[2] | thetaw[2]!=thetaw[1])) {d.write('<p><p><code><sup>1</sup>"Less Protective" concentrations produced with ',thetafl,' moisture content.');
                                                                  d.write('<br><sup>2</sup>"More Protective" concentrations produced with ',thetafh,' moisture content.');}
     if (LTr!=0 & (thetaw[3]==thetaw[2] & thetaw[2]==thetaw[1])) {d.write('<p><p><code><sup>1</sup>"Less Protective" concentrations produced with ', depthfl,' depth to contamination.');
                                                                   d.write('<br><sup>2</sup>"More Protective" concentrations produced with ',depthfh,' depth to contamination.');}

     if (LTr!=0 & (thetaw[3]!=thetaw[2] | thetaw[2]!=thetaw[1])) {d.write('<p><p><code><sup>1</sup>"Less Protective" concentrations produced with ',thetafl,' moisture content and ',depthfl,' depth to contamination.');
                                                                   d.write('<br><sup>2</sup>"More Protective" concentrations produced with ',thetafh,' moisture content and ',depthfh,' depth to contamination.');}
     if (LTr==0 & (thetaw[3]==thetaw[2] & thetaw[2]==thetaw[1])) {d.write('<p><p><code>No range of moisture content or depth to contamination was entered, therefore no range of results is produced.');}

//*     d.write('<br><code>');
//*  NOTE: REMOVING <MCL FLAG PER HENRY SCHUVER'S RECOMMENDATION
//*     if (gwflag1==1){d.write('<br>"Less Protective" groundwater concentration set at MCL.');}
//*     if (gwflag2==1){d.write('<br>"Best Estimate" groundwater concentration set at MCL.');}
//*     if (gwflag3==1){d.write('<br>"More Protective" groundwater concentration set at MCL.');}
//*    d.write('</code>');

    d.write('<p><p>');

//* Alert if moisture content values are outside of OSWER reasonable range
    soiltype = f.soiltype.options[f.soiltype.selectedIndex].value;
    thetawtl = soil(soiltype,'thetawl');
    thetawth = soil(soiltype,'thetawh');

    if ((thetaw[1]<thetawtl) | (thetaw[2]<thetawtl) | (thetaw[3]<thetawtl) | (thetaw[1]>thetawth) | (thetaw[2]>thetawth) | (thetaw[3]>thetawth)) {d.write('<br><code> A moisture content value is outside the recommended range for this soil type.');}

//* Alert if Qsoil value is outside of OSWER reasonable range
    if ((Qsoil<1) | (Qsoil>10)) {d.write('<br><code> Qsoil is outside the recommended range for this parameter.');}
                                
//* Alert if Eb (air exchange) value is outside of OSWER reasonable range
    if ((Eb<0.1) | (Eb>1.5)) {d.write('<br><code> Building Air Exchange is outside the recommended range for this parameter.');}

//* Alert if Hb (building mixing height) value is outside of OSWER reasonable range
    if (((btype=='base') & ((Hb<2.44)|(Hb>4.88))) | ((btype=='slab') & ((Hb<2.13)|(Hb>3.05)))) 
       {d.write('<br><code> Building Mixing Height is outside the recommended range for this building type.');}

//* Alert if Fb (building footpring area) value is outside of OSWER reasonable range
    if (((btype=='base') & ((Fb<80)|(Fb>200))) | ((btype=='slab') & ((Fb<80)|(Fb>200)))) 
       {d.write('<br><code> Building Footpring Area is outside the recommended range for this building type.');}

//* Alert if Ab (subsurface foundation area) value is outside of OSWER reasonable range
    if (((btype=='base') & ((Ab<152)|(Ab>313))) | ((btype=='slab') & ((Ab<85)|(Ab>208)))) 
       {d.write('<br><code> Subsurface Foundation Area is outside the recommended range for this building type.');}

//* Alert if eta (crack ratio) value is outside of OSWER reasonable range
    if (((btype=='base') & ((eta<0.0001)|(eta>0.001))) | ((btype=='slab') & ((eta<0.00019)|(eta>0.0019)))) 
       {d.write('<br><code> Building Crack Ratio is outside the recommended range for this building type.');}    

//* Alert if GW temperature is outside of reasonable range
    if (((tempunits=='C') & ((temp<0)|(temp>25))) | ((tempunits=='F') & ((temp<32)|(temp>77)))) 
       {d.write('<br><code> Ground Water Temperature is outside the typical range for this parameter.');}

//* Alert if any of the exposure values are different than OSWER defaults
    if (ATC != 70) 
       {d.write('<br><code> Averaging Time for carcinogens has been changed from default value of 70 years.');}

    if (EFC != 350) 
       {d.write('<br><code> Exposure Frequency for carcinogens has been changed from default value of 350 days/year.');}

    if (EDC != 30) 
       {d.write('<br><code> Exposure Duration for carcinogens has been changed from default value of 30 years.');}

    if (ATNC != EDNC) 
       {d.write('<br><code> OSWER draft guidance recommends averaging time = exposure duration for non-carcinogens.');}

    if (EFNC != 365) 
       {d.write('<br><code> Exposure Frequency for non-carcinogens has been changed from default value of 365 days/year.');}

//* Alert if Target Hazard Quotient is different than OSWER default
    if (THQ != 1) 
       {d.write('<br><code> Target Hazard Quotient has been changed from default value of 1.');}

d.close();
}


