YUI({combine: true, timeout: 10000}).use("event", "node", "anim", function(Y) {
  
  var togglePg = function(e) {
      e.preventDefault();
      var elem = e.target.get("parentNode").get("parentNode");
      var height = elem.getStyle("height");
      if (height == "138px" || height == "22px") {
        elem.setStyle("height", "auto");
      } else {
        if (elem.getAttribute("class").indexOf("pgTop") != -1) {
          elem.setStyle("height", "138px");
        } else {
          elem.setStyle("height", "22px");
        }
      }
      Y.get(".outerBorder").setStyle("height","auto");
  };
  
  Y.on("domready", function () {
    if (document.URL.indexOf("showallcomp=true") != -1) {
      hbo_stat_pi (document.referrer, document.URL, hbo_timestamp, 500002);
    } else {
      hbo_stat_pi (document.referrer, document.URL, hbo_timestamp, 500001);
    }
    Y.all(".pg").setStyle("height", "22px");
    Y.all(".pgTop").setStyle("height", "138px");
    Y.one(".newContentSection").setStyle("display", "none");
    if (document.URL.indexOf("showallcomp=true") == -1) {
      Y.one(".companySection").setStyle("display", "none");
    } else {
      var content = Y.get("#companyLogoData").get("value");
      content = content.replace("&lt;", "<");
      content = content.replace("&gt;", ">");
      Y.get("#companyLogos").setContent(content);
    }
    if (document.URL.indexOf("showallpg=true") != -1) {
      Y.all(".pg").setStyle("height", "auto");
      Y.get(".outerBorder").setStyle("height","auto");
    }
    Y.on("click", togglePg, ".openPg");
    Y.on("click", function(e) { 
      e.preventDefault();
      Y.one(".newContentSection").setStyle("display", "block");
      Y.get(".outerBorder").setStyle("height","auto");
    }, ".showNewContent");
  });
  
});

