function preventEmbedding() {
  if(top != self) {
    var pth = location.pathname.split('/');
    if(pth.length > 0) {
      top.location.href = location.href.substring(0, location.href.length - pth[pth.length - 1].length - 1);
      return;
    }
    top.location.href = location.href;
  }
  return;
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  }
  else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

    function getWindowHeight() {
      var windowHeight = 0;
      if (typeof(window.innerHeight) == "number") {
        windowHeight = window.innerHeight;
      }
      else {
        if (document.documentElement && document.documentElement.clientHeight) {
          windowHeight = document.documentElement.clientHeight;
        }
        else {
          if (document.body && document.body.clientHeight) {
            windowHeight = document.body.clientHeight;
          }
        }
      }
      return windowHeight;
    }
    function setFooter() {
      if (document.getElementById) {
        var windowHeight = getWindowHeight();
        if (windowHeight > 0) {
          var contentHeight = document.getElementById("content").offsetHeight;
          var footerElement = document.getElementById("footer");
          var footerHeight  = footerElement.offsetHeight;
          if(contentHeight > windowHeight)
          {
           footerElement.style.bottom = (-window.pageYOffset) + 'px';
          } else {
           footerElement.style.bottom = '0px';
          }
        }
      }
    }

