(function() {
  if (typeof AboutUsWidget != "undefined") { return; }
  
  AboutUsWidget = {
    // Cross-browser XMLHTTPRequest object
    crossXHR: function() {
      var crossxhr = false;
      
      if (window.XMLHttpRequest) {
        crossxhr = new XMLHttpRequest();
        if (crossxhr.overrideMimeType) {
          crossxhr.overrideMimeType('text/xml');
        }
      } else if (window.ActiveXObject) {
        try {
          crossxhr = new ActiveXObject('Msxml2.XMLHTTP');
        } catch(e) {
          try {
            crossxhr = new ActiveXObject('Microsoft.XMLHTTP');
          } catch(e) {
            crossxhr = false;
          }
        }
      }
      
      return crossxhr;
    },
  
    // Inject the <link> tag containing our styles into the DOM
    addStyles: function(domain){
      if (!this.stylesLoaded) {
        var url = 'http://www.aboutus.org/' + domain + '?format=widget_styles';
        document.write('<link type="text/css" rel="stylesheet" href="'+url+'"/>');
        this.stylesLoaded = true;
      }
    },
    
    widgetCount: 0,
    
    add: function(domain) {
      this.addStyles(domain);
      
      this.widgetCount += 1;
      
      var url       = 'http://www.aboutus.org/' + domain + '?format=widget_html',
          id        = 'aboutus-widget-' + this.widgetCount,
          style     = "border: none; padding: 0px; margin: 0px;",
          container = '<div class="aboutus-widget-container" id="' + id + '"></div>';
      
      document.write(container);
      
      // Begin HTTP request for page-specific content
      var xhr = AboutUsWidget.crossXHR();
      xhr.onreadystatechange = function(){
        if(xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 304)){
          document.getElementById(id).innerHTML= xhr.responseText;
        }
      };
      xhr.open('GET', url, true);
      xhr.send();
    }
  };
})();
AboutUsWidget.add("OpenSourceBridge.org");