MugShotWidgetHillsborough = new function() {
  var hiBASE_URL = 'http://mugshots.s3.amazonaws.com/widget/';
  var hiSTYLESHEET = 'http://mugshots.s3.amazonaws.com/widget/widgetWide.css';
  var hiCONTENT_URL = 'http://mugshots.tampabay.com/widgethillsborough/';
  var hiROOT = 'tampabaymugs-hillsborough';

  function hirequestStylesheet(histylesheet_url) {
    histylesheet = document.createElement("link");
    histylesheet.rel = "stylesheet";
    histylesheet.type = "text/css";
    histylesheet.href = histylesheet_url;
    histylesheet.media = "all";
    document.lastChild.firstChild.appendChild(histylesheet);
  }

  function hirequestContent( local ) {
    var hiscript = document.createElement('script');
    // How you'd pass the current URL into the request
    // script.src = CONTENT_URL + '&url=' + escape(local || location.href);
    hiscript.src = hiCONTENT_URL;
    // IE7 doesnÍt like this: document.body.appendChild(script);
    // Instead use:
    document.getElementsByTagName('head')[0].appendChild(hiscript);
  }

  this.serverResponse = function( hidata ) {
    if (!hidata) return;
    var hidiv = document.getElementById(hiROOT);
    var hitxt = '';
    for (var hii = 0; hii < hidata.length; hii++) {
      if (hitxt.length > 0) { hitxt += " "; }
      hitxt += hidata[hii];
    }
    hidiv.innerHTML = hitxt;
    hidiv.style.display = 'block'; 
  }

  hirequestStylesheet(hiSTYLESHEET);
  document.write("<div id='" + escape(hiROOT) + "' ></div>");
  hirequestContent();
}
