//=================

function printView()
{
  if (document.getElementById != null)
  {

    //    var html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n\n';
    var html = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';    
    html += '<html>\n';
    html += '<HEAD>';      
    
      html += '\n<style type="text/css">\n';   

      // CSS for CSS for Print Preview Popup 
      html += 'html {min-height: 100%; height: auto;}\n';         
      html += 'body {color: #000000; font-size: 12px; font-family: arial, tahoma, helvetica, sans-serif; text-align: left; margin: 0; padding: 0;}\n';         
      html += 'img {border: 0;}\n';
      html += 'tr {vertical-align: top; text-align: left;}\n';
      html += 'th {font-size: 13px; font-weight: bold; text-align: left;}\n';        
      html += 'td {font-size: 12px; text-align: left;}\n';      
      html += 'p {font-size: 12px;}\n';            
      html += 'form {padding: 0; margin: 0;}\n';      
       
      html += '#printPgHeader {color: #ffffff; font-size: 18px; padding:10px 20px; background: #8f0000 url(/images/icon_printpage.gif) no-repeat left center;}\n';  
      html += '.printFacilityName, .printFacilityName2 {color: #636363; font-size: 16px; font-weight: bold; padding: 4px 10px; border-bottom: 1px solid #d0d0d0; vertical-align: middle;}\n';  
      html += '.printButtons, .printButtons2 {color: #000000; font-size: 10px; text-align: right; padding: 8px 10px; border-bottom: 1px solid #d0d0d0;}\n';  
      html += '.printFacilityName2, .printButtons2 {border-bottom: 0px; border-top: 1px solid #d0d0d0;}\n';  
      html += '.printFacilityName2 {font-size: 11px; font-weight: normal;}\n';        
      html += '.printWindow {padding: 10px 10px 20px 10px;}\n';        
      html += '.noprint, td.noprint {display: none;}\n';  
      html += '.remove, td.remove {display: none;}\n';        

      // Thses are needed as the REL LINK to main.css is not loaded by the print functionality becuase the Print Preview Window is created by code
      // Any change to psstyle.css should be mirrored here      
      html += '.clearFloat {clear: both; float: none; height: 1px; overflow: hidden; display: inline;}\n';       
            
      html += '#headerContainer {display: none;}\n'; 
      html += '#globalNavContainer {display: none;}\n'; 
      html += '#homeFlashContainer {display: none;}\n';       
      html += '#homeContentContainer h2 {font-size: 16px; font-weight: bold; padding: 0; margin: 10px 0 4px 0; padding: 0; border-bottom: 1px solid #999999;}'; 
      html += '#homeContentContainer h3 {font-size: 14px; font-weight: bold; padding: 0; margin: 10px 0 4px 0; padding: 0;}';   
      html += '#homeContentContainer h4 {font-size: 12px; font-weight: bold; padding: 0; margin: 10px 0 2px 0; padding: 0;}';               
      
      html += '#homeleftColumn {}\n';             
      html += '#homerightColumn {}\n';                   
      html += '.homeFeatureStory {/* */}\n'; 
      html += '.homeFeatureStory .homeFeatureStoryImg {width: 245px; float: left; padding-bottom: 14px;}\n'; 
      html += '.homeFeatureStory .homeFeatureStorytxt {margin-left: 245px; padding-top: 2px; padding-bottom: 14px;}\n'; 
      html += '.homeFeatureStory .homeFeatureStorytxt h3 {font-size: 14px; font-weight: bold; color: #000000; padding: 0; margin: 0 0 5px 0;}\n'; 
      html += '.homeFeatureStory .homeFeatureStorytxt p {padding: 0; margin: 0 0 3px 0;}\n'; 
      html += '.homeFeatureStory .homeFeatureStorytxt p.more {font-weight: bold;}\n'; 

      html += '#newsTable {margin-bottom: 20px; margin-left: 10px;}\n'; 
      html += '#newsTable td {font-size: 12px; padding: 5px; border-bottom: 1px dashed #cccccc;}\n'; 
      html += '#newsTable td.date {width: 10%;}\n'; 
      html += '#newsTable td.moreLink {display: none;}\n'; 
                
      html += '#homerightColumn .tabOn, .tabOff {display: none;}\n'; 
      html += '#homerightColumn .tabContentContainer .topContainer {padding: 0 0 15px 0;}\n'; 
      html += '#homerightColumn .tabContentContainer .bottomContainer  {padding: 0 0 15px 0;}\n'; 
      html += '#homerightColumn .tabContentContainer h4 {margin-left: 10px;}\n';       
      html += '#homerightColumn .tabContentContainer ul {margin-top: 0;}\n'; 
      html += '#homerightColumn .tabContentContainer li {margin: 0 0 2px 0;}\n'; 
      html += '#homerightColumn .tabContentContainer p {font-weight: normal; line-height: 1.1em; padding: 0; margin: 0 0 5px 0;}\n'; 
      html += '#homerightColumn .tabContentContainer p.more {font-weight: bold;}\n'; 
                 
                
      

  // CSS for Print Preview Popup      
  html += '@media screen {\n';  
  html += '}\n';  


  // CSS for Printed Page Formatting
  html += '@media print {\n';  
    html += 'body {color: #000000; font-family: arial; font-size: 11px; background-image: none; background-color: #ffffff;}\n';  
    html += '#printPgHeader {display: none;}\n';    
    html += '.printFacilityName, .printFacilityName2 {color: #666666; font-size: 12px; font-weight: bold; padding: 8px 0px; border-bottom: 1px solid #d0d0d0; vertical-align: middle;}\n';  
    html += '.printButtons, .printButtons2 {display: none;}\n';  
    html += '.printFacilityName2, .printButtons2 {border-bottom: 0px; border-top: 1px solid #d0d0d0;}\n';  
    html += '.printFacilityName2 {font-size: 11px; font-weight: normal;}\n';         
    html += '.printWindow {padding: 10px 0 20px 0;}\n';     
  html += '}\n';  

       
       
      html += '\n</style>\n';                    

// Set the standed HTML BODY elements and config to call DetailPageFix on load
    html += '\n</HE' + 'AD>\n<BODY >\n';

// Creates the plum banner with the page title
    html += '<div id="printPgHeader">Print This Page</div>\n';      
    
// Add in print and close button/link at top of page
    html += '<table width="100%" border="0" cellpadding="0" cellspacing="0">\n<tr>\n<td align="left" width="65%" class="printFacilityName">PerotSystems<sup>&reg;</sup></td>';
    html += '<td width="35%" align="right" class="printButtons">';    
    html += '\n<form><input type="button" value="Print this page" onClick="window.print();">&nbsp;&nbsp;';
    html += '<input type="button" value="Close Window" onClick="self.close();">\n</form></td>\n</tr>\n';		
    html += '<tr>\n<td colspan="2" class="printWindow">\n';
        
    
// Find the required PrintArea element		
    var printPageElem = document.getElementById("PrintArea");		
    if (printPageElem != null)
    {
      // Get the HTML inside the PrintArea Element
	    str = printPageElem.innerHTML;

    // Run HTML thru Regexp to convert links to call dummy javascript routine 
    // We do not want the links to work on the print view
//     str = str.replace(/<a.*?>/gi,'<u>'); 
//     str = str.replace(/<\/a>/gi, "</u>");   
     str = str.replace(/<input/gi,'<input disabled="disabled"'); 
     str = str.replace(/<select/gi,'<select disabled="disabled"'); 
     str = str.replace(/<textarea/gi,'<textarea disabled="disabled"');       

// Run HTML thru Regexp to remove any target=blank settings on links 
// to prevent them from trying to open new windows.
	BlankMatch = /target=_blank/g;
	str = str.replace(BlankMatch, ' ');
        html += str;
        
    }
    else
    {
        alert("Could not find the printView section in the HTML");
	return;
    }


    
// Add in print and close button/link and Copyright at Bottom of page
    html += '</td>\n</tr><tr>\n'
    html += '<td align="left" class="printFacilityName2">&copy;2008 Perot Systems. All Rights Reserved</td>';
    html += '<td align="right" class="printButtons2">';    
    html += '\n<form><input type="button" value="Print this page" onClick="window.print();">&nbsp;&nbsp;';
    html += '<input type="button" value="Close Window" onClick="self.close();">\n</form></td>\n';		
    html += '</tr></table>\n'

    
    
// Wrap up standard HTML for page
    html += '\n</BO' + 'DY>\n</HT' + 'ML>';

// Set window parameters then call open routing to open new browser window passing our changed HTML
		
    var winParms = "width=740, scrollbars=yes, resizable=yes, toolbar=no, menubar=yes, location=no, directories=no";
    var printWin = window.open("","PrintPagePreview", winParms);
    printWin.document.open();
    printWin.document.write(html);
    printWin.document.close();

  }
  else
  {
    alert("Sorry, the print view feature works\nonly in javascript enabled browsers.");
  }
}
