
var PrintView = Class.create(
{
	element: null,
	
	uri: null,
	
	width: 1024,
	
	height: 768,
	
	settings: "location=no,status=no,toolbar=no,menubar=no,resizable=yes,screenX=0,screenY=0,top=0,left=0,scrollbars=yes,",
	
	initialize: function( element )
	{
		this.element = $( element );
		
		this.initOther();
		this.initEvents();
	},
	
	initOther: function()
	{
		this.uri = this.element.getAttribute( 'href' );
	},
	
	initEvents: function()
	{
		this.element.observe( "click", this.handleClick.bind( this ) );
	},
	
	handleClick: function( e )
	{
		Event.stop( e );		
		var settings = this.settings + "width=" + this.width + ",height=" + this.height;
		this.element.blur();
		var win = window.open( this.uri, "print_view_window", settings, true );
		win.focus();
		win.print();
	}
});

document.observe( "dom:loaded", function(){ $$( '.print-view' ).each( function( el ){ new PrintView( el ) } ) } );