( function() {
 var trueName = '';
 for (var i = 0; i < 16; i++) {
  trueName += String.fromCharCode(Math.floor(Math.random() * 26) + 97);
 }
 window[trueName] = {};
 var $ = window[trueName];
  $.f = function() {
   return {
    init : function(scriptSrc) {
    
    // add the css style info to the document
    var sCss = 'div.fixx_badge {width:45px; height:45px;}';
    sCss = sCss + ' div.fixx_badge a.icon{display:block;width:45px;height:45px;background-repeat:no-repeat;background-image:url(\'http://soxfixx.com/images/redsox/fixxthis.gif\');} ';
    sCss = sCss + ' div.fixx_badge a.icon,div.fixx_badge a.icon:hover {text-decoration:none;} ';
    var oHead = document.getElementsByTagName('head')[0];
	var oCssStyle = document.createElement('style');
	oCssStyle.setAttribute('type', 'text/css');
	if (oCssStyle.styleSheet) {
		oCssStyle.styleSheet.cssText = sCss;
	} else {
		oCssStyle.appendChild(document.createTextNode(sCss));
	}
	oHead.appendChild(oCssStyle);

    var theScripts = document.getElementsByTagName('SCRIPT');
    for (var i = 0; i < theScripts.length; i++) {
     if (theScripts[i].src.match(scriptSrc)) {
      $.d = document.createElement('DIV');
      $.d.setAttribute('class', 'fixx_badge');
      $.a = document.createElement('A');
      $.a.setAttribute('class', 'icon');
      var href = 'http://soxfixx.com/submitstory.html';
      var url = '';
      if (typeof fixx_url == 'undefined') {
      	url = window.location.href;
      } else {
      	url = fixx_url;
      }
      $.a.setAttribute('href', href + '?url=' + escape(url));
      $.a.setAttribute('target', '_blank');

      $.d.appendChild($.a);
      theScripts[i].parentNode.insertBefore($.d, theScripts[i]);
      theScripts[i].parentNode.removeChild(theScripts[i]);
      break;
     }
    }
    }
   };
  }();
  var thisScript = /fixxbutton.html/;  
  
 if (typeof window.addEventListener !== 'undefined') {
  window.addEventListener('load', function() { $.f.init(thisScript); }, false);
 } else if (typeof window.attachEvent !== 'undefined') {
  window.attachEvent('onload', function() { $.f.init(thisScript); });
 }
})();