// Flag for whether or not to automatically call the print function
var gAutoPrint = true;

function printSpecial(print_id, design_id)
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';
		
		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
			{
				html += headTags[0].innerHTML;
			}
		}
		html += '\n</HE' + 'AD>\n<BODY style=\"background-color: #FFFFFF; background-image: none; text-align:left;\">\n<p><img src="/images/design' + design_id + '/logo_small.jpg"><hr size="1" color="#CCCCCC">\n';

		var printReadyElem = document.getElementById(print_id);
				
		if (printReadyElem != null)
		{
			html += printReadyElem.innerHTML;
			html += '\n</p>';
		}
		else
		{
			alert("Could not find the printable section");
			return;
		}	
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
				
		var printWin = window.open("","printSpecial","height=500,width=600,screenX=0,left=0,screenY=0,top=0,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
		{		
			printWin.print();
		}
	}
	else
	{
		alert("Sorry, the print feature is only available in modern browsers.");
	}
}