/*

Chris Hargett
06/15/2005

This script allows you to print individual articles from a list of articles by 
using the document id to uniquely identify each record.  The document content must 
be contained within DIV tags. The ID property of the DIV should begin with the string
ContentStart with a unique identifier appended (ex. ContentStart2132).

The URL calling this JS would be written as follows:

<a ID="PrintableLink" class="PrintLink" href="javascript:PrintableVersion(<cfoutput>2132</cfoutput>);" target="">(Printable Version)</a>

Because unique identifiers are used, the user can select any single article from a
list of multiple articles.

*/

function PrintableVersion(id)
{
  
  /* Check for unique indentifier. */
  if (id == 0)
	{
		var ContentStart = "ContentStart";
	}
  else
  	{
		var ContentStart = 'ContentStart' + id.toString();
	}

  /* Don't display the "(Printable Version)" link */
  PrintLink = document.getElementById("PrintableLink");
  PrintLink.style.visibility = "hidden";
    
  /* Don't display the help bar at the top of pub ordering pages */  
  if (document.getElementById("HelpBar"))
  {  
    HelpImage = document.getElementById("HelpBar");
    HelpImage.style.display = "none";  
  }
     
  /* Grab the HTML within the ContentStart DIV */	  
  var sWinHTML = document.getElementById(ContentStart).innerHTML; 
   
  /* Write a new page of the HTML, adding a header to the page */   
  document.open();  
  document.write('<html><head><title></title></head><LINK href=/styles/tb.css rel=Stylesheet>');
  //document.write('<a href=mailto:info@cdcnpin.org><img src=/images/howbar.gif></a>');

  document.write('<table align=center width=600 border=0 cellpadding=0 cellspacing=0>');
  document.write('<tr><td valign="bottom"><a>');
  document.write('<img src="/images/header_left.gif" alt="Find TB Resources - TB Education &amp; Training Banner" border="0"></a></td>');
  document.write('<td valign="bottom">');
  document.write('<a href="/scripts/index.cfm">');
  document.write('<img src="/images/header_main.gif" width="463" alt="Find TB Resources - TB Education &amp; Training Banner" border="0"></a></td>');
  document.write('</tr>');
  document.write('<tr>');
  document.write('</tr>');
  document.write('</table>');
  document.write(sWinHTML);
  document.write('<P align=center><a href=/scripts/index.cfm?FuseAction=IntSearch><img src=/images/back_search.gif border=0></a>')
  document.write('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;')
  document.write('<a href=javascript:history.go(-2);><img src=/images/back_results.gif border=0></a></P>')
  
  document.write('</body></html>');    
  document.close(); 
}


