var CastTV = {
  LoadWidget: function(query) {
    var iframe = document.createElement('iframe');
    iframe.id = 'casttv_iframe';
    iframe.frameBorder = 0;
    iframe.src = 'http://www.casttv.com/widgets/r?initial_q=' + encodeURIComponent(query);
    document.getElementById('casttv_iframe_target').appendChild(iframe);
  }
};
(function(){
  var addCssToHead = function(cssStr) {
    var head = document.getElementsByTagName('head')[0];
    var style = document.createElement('style'); // new Element('style', { type: 'text/css' });
    style.type = 'text/css';
    if (style.styleSheet) { // IE
      style.styleSheet.cssText = cssStr;
    } else { // Other browsers
      var cssText = document.createTextNode(cssStr);
      style.appendChild(cssText);
    }
    head.appendChild(style);
  };
  addCssToHead(" \
  #casttv_iframe_target iframe { \
    margin: 10px 0pt 0pt; \
    padding: 0pt; \
    width: 616px; \
    height: 240px; \
  } \
  #casttv_container .ft_attribution { \
    clear: both; \
    float: right; \
    margin: 0; \
    padding: 0; \
    height: 20px; \
    font-family: sans-serif; \
    font-size: 10px; \
    color:#666666; \
    line-height: 20px; \
  } \
  #casttv_container .ft_attribution img { \
    vertical-align: middle; \
  } \
  #casttv_container .ft_attribution a { \
    font-size: 10px; \
    color:#336699; \
    line-height: 20px; \
  } \
  #casttv_container .ft_attribution a:hover { \
    color:#000; \
  } \
  ");
})();
