var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function printpages(win) {
	window.close();
	document.getElementById("printIcon1").style.visibility = "Hidden";
	document.getElementById("printIcon2").style.visibility = "Hidden";
	//alert(document.getElementById("printIcon").innerHTML); //= hidden;
	window.print();  
	};
	
function displayPrintTop(){
	if(document.all){
			}
		else
			{
			
			document.write('<div style="position:absolute; width:50px; height:30px; z-index:10; left:288px; top: 0px;"><img src="/images/blu_gradient_bg1.gif" width="370" height="72"></div>')
			}

if(!document.all)document.write("<div style='position:absolute; width:50px; height:30px; z-index:10; left: 580px; top: 10px;'><span id='printIcon1'><table border='0' cellspacing='0' cellpadding='0'><tr><td><a href='javascript:window.printpages()'><img src=/images/print_icon.gif' alt='Printable Version' width='23' height='20' border='0'></a></td><td><a href='javascript:printpages()' class='text-13'><font color='#000000'>Print</font></a></td></tr></table></span></div>");
}

function displayPrintBot(){
if(!document.all)document.write("<div style='position:absolute; width:50px; height:40px; z-index:10; left: 580px; '><span id='printIcon2'><table border='0' cellspacing='0' cellpadding='0'><tr><td><a href='javascript:window.printpages()'><img src='/images/print_icon.gif' alt='Printable Version' width='23' height='20' border='0'></a></td><td><a href='javascript:printpages()' class='text-13'><font color='#000000'>Print</font></a></td></tr></table></span></div>");
}


function printPage()
{

	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';
		
		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += "\n" + headTags[0].innerHTML;
			
		}
		html += '\n<link  rel="stylesheet" type="text/css" href="css/print.css"  />';
		html += '\n</HEAD><BODY>';
		html += '\n<div style="position:absolute; width:82%; z-index:1; left: 0px; top: 0px;">';
		html += '\n<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">';
 html += '\n<tr><td  align="left" valign="top"><a name="main"></a> ';
 html += '\n<img src="/images/alaska_org_logo1.gif" alt="Alaska.org logo" width="289" height="72"></td>';
   html += '\n <td align="left" valign="top"><img src="/images/blu_gradient_bg1.gif" width="445" height="72"><script>displayPrintTop();</script></td>';
  html += '\n</tr></table></div>';
html += '\n<br><br>';
		
		var printMeElem1 = document.getElementById("breadcrump");
		var printMeElem2 = document.getElementById("PrintMe");
		
		
		
		if (printMeElem2 != null)
		{
				html += "<br><span class='breadcrumb-org' >" + printMeElem1.innerHTML + "</span><br><br>";
				html += '\n<table width="700"  border="0" align="left" cellpadding="0" cellspacing="0" valign="top"><tr><td>';
				html +=  printMeElem2.innerHTML;
				html += '\n</td></tr>';
				
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
		
		
		html += '\n<TR>';
html += '\n<TD class=text-02 colSpan=2><table  width="100%" border="0" align="left" cellpadding="0" cellspacing="0">';
 html += '\n <tr class="blu-bg">';
    html += '\n<td width="3%"><img src="/images/transparent.gif" alt="Blank image" width="18" height="15"></td>';
    html += '\n<td width="3%"><img src="/images/phone_sml_icon.gif" alt="Phone icon" width="16" height="16"></td>';
    html += '\n<td width="93%"  class="text-04"><font color="#000000">1- (907) 777-7777 Call us to Plan or Book now!</font> </td>';
    html += '\n<td width="1%" valign="top" class="text-04"><script>displayPrintBot();</script></td>';
 html += '\n </tr>';
html += '\n</table></TD>';
html += '\n</TR>';
html += '\n<TR>';
  html += '\n<TD class=text-02 colSpan=2><table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">';
    html += '\n<tr >';
      html += '\n<td width="100%" height="45" colspan="4" align="center" valign="middle"  class="text-11">Copyright © Alaska Channel.<br>';
      html += '\nIt is illegal to copy or reproduce anything from this website without Alaska Channel’s written permission.</td>';
   html += '\n </tr>';
  html += '\n</table></TD>';
html += '\n</TR>';
html += '\n</TBODY></TABLE></TD></TR></TBODY></TABLE>';
html += '\n</td></tr></table>';

		html += '\n</BODY>\n</HTML>';
		
		

		//alert(printMeElem.innerHTML);
		var printWin = window.open("","printPage","resizable=no,scrollbars=yes,width=750,height=530,left=20,top=0,addressbar=no");
		if(document.all){
		printWin.document.open();
		}
		printWin.document.write(html)
		
		if(document.all){
		printWin.document.close();
		}
		if(document.all  ){
		if (gAutoPrint){
		//printWin.print();
		//setTimeout(printpages(printWin), 1000);
		//setInterval(printpages(printWin),2000);
		printWin.print();  
		
		}
		else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
	}
}
}

