//window.onLoadListeners.push( init_printing );

function init_printing()  {
	var old_printer;
	
	if( old_printer = document.getElementById( 'printer' ) )  {
	    var new_printer = document.createElement( 'span' );
	    new_printer.setAttribute( 'id', 'printer' );
	    new_printer.innerHTML = old_printer.innerHTML;
	    new_printer.onclick = print_page;
	    
		document.getElementById( 'body_content' )
		    .replaceChild( new_printer, old_printer );
	}
}

function do_print()  {
    var 
        location = ( window.location + ( ( window.location.toString().indexOf( '?' ) > 0 ) ? '&' : '?' ) + 'print=true' ),
        printer = window.open( location, 'broadwaycalendarprint', 'width=585,height=' + ( Browser.isIE ? '650' : '600' ) );

    printer.focus();
    printer.print();
    
    if( ! Browser.isIE )
        printer.close();
}

function print_page()
{
	var sd = document.getElementById('start_date').value;
//	var prtContent = window.location = 'print_cal.php';
	WinPrint = window.open('print_cal.php?start_date='+sd,'','left=0,top=0,width=100,height=100,toolbar=0,scrollbars=0,status=0,resizable=1,menubar=1');
//	WinPrint.document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><title>BROADWAY THEATRE CALENDAR</title><link href='print_styles.css' rel='stylesheet' type='text/css' /></head><body>");
//	WinPrint.document.write(prtContent.innerHTML);
//	WinPrint.document.write("</body></html>");
//	WinPrint.document.close();
//	WinPrint.focus();
	
//	WinPrint.close();
}

