// Printable Content Area Function - Park Board Template

var gAutoPrint = false; // Flag for whether or not to automatically call the print function

function printContent()
{
	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 bgcolor="#ffffff" style="background:white">\n';
// 2005-07-11 fix body font when wrapper removed in printable page
		html += '<div style="width: 626;">\n';
		html += '<p style="border-bottom-width: 1px; border-bottom: solid;"><b>Vancouver Board of Parks and Recreation</b></p>';
		
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '<p class="text10px" style="border-top-width: 1px; border-top: solid;">Copyright © 2003-';
    html += new Date().getFullYear();
    html += ' Vancouver Board of Parks and Recreation,<br>';
//		html += '<p class="text10px" style="border-top-width: 1px; border-top: solid;">' + '<SCR' + 'IPT>writeCopyright();</SCR' + 'IPT>,<br>';
		html += '2099 Beach Avenue, Vancouver, British Columbia, Canada V6G 1Z4<br>';
		html += 'Telephone: 3-1-1 (Vancouver), 604-257-8400 (outside Vancouver), TTY service: 7-1-1, <u>vancouverparks.ca</u></p>';

		html += '<p></p></div>' + '\n</BO' + 'DY>\n</HT' + 'ML>';

// Code adapted from Connie Zelter, modified Feb 27, 2004 Stanley Mok
// so print window has no navigation
// remove all start anchors - leave link content 
		html = html.replace(/<a[^<]+href=[^<]+>/gi,'');
		html = html.replace(/<a[^<]+name=[^<]+>/gi,'');
// remove all end anchors
		html = html.replace(/<[\/]a>/gi,''); 
// disable form inputs 
		html = html.replace(/<select[^<]/gi,'<select disabled ');
		html = html.replace(/<input[^<]/gi,'<input readonly ');
		html = html.replace(/type=\"*checkbox\"*/gi,'type="checkbox" disabled ');
		html = html.replace(/type=\"*button\"*/gi,'type="button" disabled ');
		html = html.replace(/type=\"*submit\"*/gi,'type="submit" disabled ');
		html = html.replace(/type=\"*reset\"*/gi,'type="reset" disabled ');
// disable mouse click action
		html = html.replace(/onClick=/gi,'oc=');

		var printWin = window.open("","printContent");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("The printable page feature is only available in modern browsers.");
	}
}

