( 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(target) {
    var theScripts = document.getElementsByTagName('SCRIPT');
    for (var i = 0; i < theScripts.length; i++) {
     if (theScripts[i].src.match(target)) {
      $.w = document.createElement('DIV');
      is_ie = false;
      $.w.setAttribute("style","background-image:url(http://www.dramafever.com/st/img/badge_bg.png);height:60px;width:180px;background-repeat:none;color:#b1b1b1;font-size:10px;font-family:Arial, Helvetica,sans-serif;");
      if (navigator.userAgent.indexOf('MSIE')) {
         if ($.w.style && $.w.style.setAttribute) {
         is_ie = true;
         $.w.style.setAttribute('cssText', "background-image:url(http://www.dramafever.com/st/img/badge_bg.png);height:60px;width:180px;background-repeat:none;color:#b1b1b1;font-size:10px;font-family:Arial, Helvetica,sans-serif;");
         }
      }
      
      
      html = "<div style=\"";
      if (!is_ie) {
         html += "margin:8px 8px 8px 8px;";
      } else { 
         html += "margin-left:8px;";
      }
      html += "padding-top:8px;\"><div style=\"float:left;width:50px;\"><img src=\"http://www.dramafever.comhttp://media.dramafever.com/st/img/thumbs/onair_thumb.jpg\" alt=\"thumb\" height=\"36\" width=\"50\"/></div> <div style=\"margin-left:50px;padding-left:8px;\">I watched <a style=\"color:#b4101d;font-weight:bold;text-decoration:none;\" href=\"http://www.dramafever.com/drama/106/4/\">On Air Ep.4</a> on DramaFever.com</div></div>";

      $.w.innerHTML = html;
      
      
      $.a = {};
      if (theScripts[i].innerHTML) {
       $.a = $.f.parseJson(theScripts[i].innerHTML);
      }
      if ($.a.err) {
       alert('bad json!');
      }
      if ($.a.color) {
       $.w.style.color = $.a.color;
      }
      theScripts[i].parentNode.insertBefore($.w, theScripts[i]);
      theScripts[i].parentNode.removeChild(theScripts[i]);
      break;
     }
    }
   },
   parseJson : function(json) {
    this.parseJson.data = json;
    if ( typeof json !== 'string') {
     return {"err":"trying to parse a non-string JSON object"};
    }
    try {
     var f = Function(['var document,top,self,window,parent,Number,Date,Object,Function,',
      'Array,String,Math,RegExp,Image,ActiveXObject;',
      'return (' , json.replace(/<\!--.+-->/gim,'').replace(/\bfunction\b/g,'function-') , ');'].join(''));
       return f();
    } catch (e) {
     return {"err":"trouble parsing JSON object"};
    }
   }
  };
 }();
 var thisScript = /badge\/flair\/a7cee0c3-8e89-4c05-bd36-81d7d346932d\.js/;
 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); });
 }
})();
