#!/usr/bin/haserl
# Copyright (C) 2008 OpenRB.com
content-type: text/html

(function(){
  var ifName = '<? echo -n $FORM_data ?>';

  // no ifname specified
  if (!ifName) {
    return;
  }

  var moduleId = 'interfaces_usage_' + ifName;
  if (!FlashSYS.getCache( moduleId )) {
    var window = FlashSYS.newWindow({
      id: moduleId,
      title: $TR('interfaces_usage') + ifName,
      width: 500,
      height: 275,
      padding: 5,
      canReload: false
    });

    var graph = new Element('embed', {
      'src': FlashSYS.requestUrl({
        'module': 'stats',
        'action': 'ifgraph'
      }) + '?' + ifName,
      'width': 500,
      'height': 260,
      'type': 'image/svg+xml'
    }).inject(window.contentEl);

    elems = FlashSYS.setCache(moduleId, window);
  }
})();
