
var MediaLink = Class.create(
{
	element: null,
	
	uri: null,
	
	width: 1024,
	
	height: 768,
	
	settings: "location=0,status=0,toolbar=0,menubar=0,resizable=1,screenX=0,screenY=0,top=0,left=0,",
	
	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();
		window.open( this.uri, "media_link_window", settings, true ).focus();
	}
});

document.observe( "dom:loaded", function(){ $$( '.media-link' ).each( function( el ){ new MediaLink( el ) } ) } );