// http://www.alistapart.com/articles/printtopreviewaddLoadEvent (function() {	/* more code to run on page load */	if (document.getElementById){        //add extra functions to page tools list        var print_page = document.getElementById('printBox');                                                                //create print link        // var print_function = document.createElement('p');			        // print_function.setAttribute('class', 'print');        //IE doesn't like this        var print_function_link = document.createElement('a');		print_function_link.setAttribute ("class","rolloverPrint");		print_function_link.setAttribute ("title","mostly text only printer friendly page");			print_function_link.onclick = function() { 			print_preview(); 			return false;			}		print_function_link.setAttribute('href', '#');		var print_function_link_text = document.createTextNode('print');		print_function_link.appendChild (print_function_link_text);            print_page.appendChild (print_function_link);            			// use if calling 'var print_function = document.createElement('p');'			// print_function.appendChild (print_function_link);                        // print_page.appendChild(print_function);                }});function print_preview() {	// Switch the stylesheet	setActiveStyleSheet('print preview');	// Create preview message	add_preview_message();	// Print the page	window.print();}function add_preview_message() {	var main_content = document.getElementById('mainContainer');	var main_body = main_content.parentNode;	if (document.getElementById) {		var preview_message = document.createElement('div');		preview_message.id = 'preview-message';		// Create Heading		var preview_header = document.createElement('h3');		var preview_header_text = document.createTextNode('print preview');		preview_header.appendChild (preview_header_text);				// Create paragraph		var preview_para = document.createElement('p');		var preview_para_text = document.createTextNode('');				var cancel_function_link = document.createElement('a');			cancel_function_link.onclick = function() {				cancel_print_preview();				return false; 				};			cancel_function_link.setAttribute('href', '#');			var cancel_function_link_text = document.createTextNode('return to screen view');		cancel_function_link.appendChild (cancel_function_link_text);		preview_para.appendChild (preview_para_text); //		preview_para.appendChild (cancel_function_link);				// Put it all toegether		preview_message.appendChild (preview_header); 		preview_message.appendChild (preview_para);		main_body.insertBefore (preview_message, main_content);	}}function cancel_print_preview() {	// Destroy the preview message	var print_preview = document.getElementById('preview-message');	var main_body = print_preview.parentNode;	main_body.removeChild(print_preview);	// Switch back stylesheet	setActiveStyleSheet('default');}function setActiveStyleSheet(title) {   var i, a, main;   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {     if(a.getAttribute("rel").indexOf("style") != -1        && a.getAttribute("title")) {       a.disabled = true;       if(a.getAttribute("title") == title) a.disabled = false;     }   }}