var isPrintCalled = false;
function formHeader(s_Head)
	{
		var sHeader = "<table border=\"0\" width=\"100%\"><tr ><td valign=\"middle\" width=\"160px\" ><img src=\"//files.namecheap.com/graphics/nslogo.gif\" border=\"0\" title=\"Namecheap.com\" /></td><td width=\"10px\" >&nbsp;</td>"
		sHeader = sHeader + "<td align=\"center\" nowrap=\"nowrap\" width=\"100%\" ><b><font size=\"3px\" > " + s_Head + "</font></b></td><td width=\"50px\" class=\"printclose\" > <a href=\"#\" onclick=\"Javascript:callPrinter()\" ><img src=\"//files.namecheap.com/graphics/printer.gif\"  border=\"0\" alt=\"Print\" /></a></td><td align=\"right\" class=\"printclose\" ><a href=\"#\" onclick=\"Javascript:return closePrint()\" ><img src=\"//files.namecheap.com/graphics/closegreen.gif\" border=\"0\" alt=\"close\" /></a></td></tr></table>"
		return sHeader;
	}
	function closePrint()
	{
		var sPrintdiv
		sPrintdiv = document.getElementById('printme');
		isPrintCalled = false;
		sPrintdiv.style.display="none";
		sPrintdiv.style.width = "0px";
		if (navigator.appName == "Microsoft Internet Explorer" )
		{
			P7_hideSelect(0);
			enablePrintCss(0);
			hideGoogleBar(0);
		}
	}
	function showPrint()
	{
		var sPrintdiv
		isPrintCalled = true;
		sPrintdiv = document.getElementById('printme');
		sPrintdiv.style.display="block";
		sPrintdiv.style.width="100%";
		sPrintdiv.style.height=""+document.body.offsetHeight+"" + "px";
		if (navigator.appName == "Microsoft Internet Explorer" )
		{
			P7_hideSelect(1);
			enablePrintCss(1)
			hideGoogleBar(1);
		}
		
	}
	function printListing()
	{
		var sPrintdiv
		var sHtml
		var pat
		var patTxt
		var repTxt
		pat = new RegExp("<div.*id=.?listActionDiv.?" , "i" );
		repTxt = "<div id=\"listActionDiv\" style=\"display:none\" ";
		sPrintdiv = document.getElementById('printme');
		sHtml = document.getElementById('listingDiv').innerHTML;
		sHtml = sHtml.replace(pat,repTxt);
		pat = new RegExp("type=.?submit.?" , "i" );
		repTxt = "type=\"hidden\" ";
		sHtml = sHtml.replace(pat,repTxt);
		pat = new RegExp("type=.?checkbox.?" , "ig" );
		repTxt = "type=\"hidden\" ";
		sHtml = sHtml.replace(pat,repTxt);
		sPrintdiv.innerHTML = formHeader(window.document.title) + sHtml;

		showPrint();
		return (false);
	}
	function P7_hideSelect(a)
	{ //v1.0 by PVII
		var g,h=(a==1)?"hidden":"visible";
	  	if(document.getElementsByTagName){
	  	g=document.getElementsByTagName("select");
	  	if(g){for(var i=0;i<g.length;i++){
	  	g[i].style.visibility=h;}}}
		
	}
	function callPrinter()
	{

		window.print();
	}
	
	function resizePrintDiv()
	{
		var sPrintdiv
		sPrintdiv = document.getElementById('printme');
		if (isPrintCalled)
		{
			if (document.body.clientWidth < 800 )
				sPrintdiv.style.width = "800px";
			else
				sPrintdiv.style.width = "100%";
			sPrintdiv.style.right = "0px";
		}
	}
	addEvent(window, 'resize', resizePrintDiv);
	
	function hideGoogleBar(a)
	{
		if (a == 1)
			cornerAdShow (false);
		else 
			cornerAdShow (true);
	}
	
	function enablePrintCss(a)
	{
		var g,h=(a==1)?"/css/content-print.css":"/css/blank.css";
		if(document.getElementsByTagName)
		{
			g=document.getElementsByTagName("link");
			if (g)
			{
				for (var i = g.length - 1; i >= 0; i--)
				{
					if ( g[i].getAttribute('rel').indexOf('style') > -1 && g[i].getAttribute('title'))
					{
						if (g[i].getAttribute('title') == "printcss" )
						{
							g[i].href = h;
						}
					}
				}
			}
		}
		
	}