var Core =
{
    init: function()
    {
        $$( document.links ).each( function( item ) {
            if( item.rel == 'codeparser' )
            {
                item.addEvent( 'click', Core.getCode.bind( Core ) );
            }
        } );
    },
    
    getCode: function( e )
    {
        e = new Event( e );
        
            var text = e.target.getParent().getParent().getNext().getText();
            
		    var sWin = window.open('', '_blank', 'width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1');
		    
		    text = text.replace(/</g, '&lt;');
		    text = text.replace(/>/g, '&gt;');
		    
		    sWin.document.write( '<pre>' + text + '</pre>' );
		    sWin.document.close();
        
        e.stop();
    }
}
window.addEvent( 'domready', Core.init.bind( Core ) );