// ¹é±×¶ó¿îµå ·¹ÀÌ¾î
if(typeof(_isIE) == 'undefined') var _isIE = (navigator.userAgent.match(/Gecko/)) ? false : true;

var bgLayer = {
   bgdiv: null,
   bgifrm: null,
   resizecheck: function () {
      var layerHeight = (document.body.offsetHeight > document.body.scrollHeight) ? document.body.offsetHeight : document.body.scrollHeight;
      var layerWidth = document.body.scrollWidth;

      bgLayer.bgdiv.style.height = layerHeight + "px";
      bgLayer.bgdiv.style.width = layerWidth + "px";

      bgLayer.bgifrm.style.height = layerHeight + "px";
      bgLayer.bgifrm.style.width = layerWidth + "px";
   },
   init: function() {
      var obj = document.getElementById("bgLayer");
      var obj2 = document.getElementById("bgIframe");

      try {obj.style.opacity = 0.5;} catch(e) {}
      try {obj.style.MozOpacity = 0.5;} catch(e) {}
      try {obj.style.filter = "alpha(opacity=50)";} catch(e) {}
      try {obj.style.KhtmlOpacity = 0.5;} catch(e) {}

      try {obj2.style.opacity = 0;} catch(e) {}
      try {obj2.style.MozOpacity = 0;} catch(e) {}
      try {obj2.style.filter = "alpha(opacity=0)";} catch(e) {}
      try {obj2.style.KhtmlOpacity = 0;} catch(e) {}

      this.bgdiv = obj;
      this.bgifrm = obj2;

      if(_isIE) window.attachEvent("onresize", bgLayer.resizecheck);
      else window.addEventListener("resize", bgLayer.resizecheck, false);

      var layerHeight = (document.body.offsetHeight > document.body.scrollHeight) ? document.body.offsetHeight : document.body.scrollHeight;
      var layerWidth = document.body.scrollWidth;

      this.bgdiv.style.height = layerHeight + "px";
      this.bgdiv.style.width = layerWidth + "px";

      this.bgifrm.style.height = layerHeight + "px";
      this.bgifrm.style.width = layerWidth + "px";
   },
   show: function () {
      var result = this.init();

      this.bgifrm.style.display = "block";
      this.bgdiv.style.display = "block";
   },
   hide: function() {
      this.bgifrm.style.display = "none";
      this.bgdiv.style.display = "none";

      if(_isIE) window.detachEvent("onresize", bgLayer.resizecheck);
      else window.removeEventListener("resize", bgLayer.resizecheck, false);
   }
};
