loader = {
  boot: function() {
    dynamic.replacer();
  }
}

dynamic = {
  replacer: function() {
    // Replace guest screen resolution
    $$( '.dynamic.replacer.screenresolution' ).each( function( element ) {
      element.update( window.screen.width + 'x' + window.screen.height );
    } );
    // Replace guest aspect ratio
    $$( '.dynamic.replacer.aspectratio' ).each( function( element ) {
      ratios = new Array(
        ['17:9', 1.9],
        ['16:9', 1.8],
        ['5:3', 1.7],
        ['8:5', 1.6],
        ['3:2', 1.5],
        ['4:3', 1.3]
      );
      guestRatio = (window.screen.width/window.screen.height*10).round()/10;
      ratios.each( function( ratio ) {
        if ( guestRatio == ratio[1] )
        {
          element.update( ratio[0] );
        }
      } );
    } );
  }
};



Event.observe( window, 'load', loader.boot );


