var client = {

   getPage: function() {

      var pageWidth = 720;
      var pageHeight = 576;

      var scrollArr = this.getScroll();

      var winArr = this.getWindow();

      var documentArr = this.getDocument();

      pageWidth = winArr.width + scrollArr.left;
      pageHeight = winArr.height + scrollArr.top;

      return {

         scrollX: scrollArr.left,
         scrollY: scrollArr.top,
         winW: winArr.width,
         winH: winArr.height,
         pageW: documentArr.width,
         pageH: documentArr.height

      };

   },

   getDocument: function() {

      if( window.innerHeight && window.scrollMaxY ) {  // Firefox

         pageWidth = window.innerWidth + window.scrollMaxX;
         pageHeight = window.innerHeight + window.scrollMaxY;

      } else if( document.body.scrollHeight > document.body.offsetHeight ) { // all but Explorer Mac

         pageWidth = document.body.scrollWidth;
         pageHeight = document.body.scrollHeight;

      } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari

         pageWidth = document.body.offsetWidth + document.body.offsetLeft;
         pageHeight = document.body.offsetHeight + document.body.offsetTop;

      }

      return {

         width: pageWidth,
         height: pageHeight

      };

   },

   getScroll: function() { 

      return {

         left: this.scrollLeft(),
         top: this.scrollTop()

      };

   },

   getWindow: function() {

      return {

         width: this.windowWidth(),
         height: this.windowHeight()

      };

   },

   scrollLeft: function() { var xScroll = 0; if (self.pageXOffset) xScroll = self.pageXOffset; else if (document.documentElement && document.documentElement.scrollLeft) xScroll = document.documentElement.scrollLeft; else if (document.body) xScroll = document.body.scrollLeft; return xScroll; }, scrollTop: function() { var yScroll = 0; if (self.pageYOffset) yScroll = self.pageYOffset; else if (document.documentElement && document.documentElement.scrollTop) yScroll = document.documentElement.scrollTop; else if (document.body) yScroll = document.body.scrollTop; return yScroll; }, windowWidth: function() { var xWin = 720; if (self.innerHeight) xWin = self.innerWidth; else if (document.documentElement && document.documentElement.clientWidth) xWin = document.documentElement.clientWidth; else if (document.body) xWin = document.body.clientWidth; return xWin; }, windowHeight: function() { var yWin = 576; if (self.innerHeight) yWin = self.innerHeight; else if (document.documentElement && document.documentElement.clientHeight) yWin = document.documentElement.clientHeight; else if (document.body) yWin = document.body.clientHeight; return yWin; }

};

function overlayAppear() {

   var clientDimensions = client.getPage();

   document.getElementById('fade').style.height = clientDimensions.pageH + "px";
   document.getElementById('fade').style.display='block';
   document.getElementById('light').style.left = ((clientDimensions.pageW / 2) - 140) + "px";
   document.getElementById('light').style.top = (200 + clientDimensions.scrollY) + "px";
   document.getElementById('light').style.display='block';

}

function overlayDisappear(language) {

   document.getElementById('light').style.display='none';
   document.getElementById('fade').style.display='none';

   if (language == "de_DE") {

      parent.inner.location.href="/_system/_frames/deutsch/callback.php";

   } else {

      parent.inner.location.href="/_system/_frames/english/callback.php";

   }

}

function overlayAppearSuggest() {

   var clientDimensions = client.getPage();

   document.getElementById('fade').style.height = clientDimensions.pageH + "px";
   document.getElementById('fade').style.display='block';
   document.getElementById('light2').style.left = ((clientDimensions.pageW / 2) - 140) + "px";
   document.getElementById('light2').style.top = (200 + clientDimensions.scrollY) + "px";
   document.getElementById('light2').style.display='block';

}

function overlayDisappearSuggest(url) {

   document.getElementById('light2').style.display='none';
   document.getElementById('fade').style.display='none';

   parent.inner2.location.href="/_system/_frames/deutsch/suggest.php?s_url=" + url;

}
