(function ($) {
  $(document).ready(function () {
      if ($.browser.safari && $.browser.version < "500") {
          return;
      }
      var iframesetup = false;
      function setup() {
          if (iframesetup) return;
          iframesetup = true;
          $("#unobtrusiveiframe").each(function () {
              $(this).replaceWith('<iframe id="unobtrusiveiframe" name="unobtrusiveiframe" scrolling="no" frameborder="0" border="0" allowtransparency="true" style="border: 0 solid transparent; margin: 0px; paddding: 0; " width="' + $(this).width() + '" height="' + $(this).height() + '"></iframe>');
          });
          $("#unobtrusiveiframe").bind("load",function () {
              try {
                  // Firefox
                  $(this).height(this.contentDocument.body.scrollHeight);
              } catch(e) {
                  // IE
                  $(this).height(this.document.body.scrollHeight);
              }
          });
      }

      $("a.target_iframe")
        .click(setup)
        .attr("target","unobtrusiveiframe")
        .each(function () {
            $(this).attr("href", $(this).attr("href") + "?justcontent=yes");
        })
       .click(function () {
           window.location.hash="top";
       });
        
  });
})(jQuery);
