MugShotWidgetPasco = new function() {
  var pcoBASE_URL = 'http://mugshots.s3.amazonaws.com/widget/';
  var pcoSTYLESHEET = 'http://mugshots.s3.amazonaws.com/widget/widgetWide.css';
  var pcoCONTENT_URL = 'http://mugshots.tampabay.com/widgetpasco/';
  var pcoROOT = 'tampabaymugs-pasco';

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

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

  this.serverResponse = function( pcodata ) {
    if (!pcodata) return;
    var pcodiv = document.getElementById(pcoROOT);
    var pcotxt = '';
    for (var pcoi = 0; pcoi < pcodata.length; pcoi++) {
      if (pcotxt.length > 0) { pcotxt += " "; }
      pcotxt += pcodata[pcoi];
    }
    pcodiv.innerHTML = pcotxt;
    pcodiv.style.display = 'block'; 
  }

  pcorequestStylesheet(pcoSTYLESHEET);
  document.write("<div id='" + escape(pcoROOT) + "' ></div>");
  pcorequestContent();
}
