  /* 
  ######################################################
  # XMF v3.0b  --  neotek <savvas.dimitriou@gmail.com> #
  ######################################################
  # Release: Private       #                           #
  # Version: 3.0           # My work is a game, a very #
  # Date   : 4/Mar/2007    # serious game. -- Escher   #
  # Time   : 1:41pm (AEST) #                           #
  ######################################################
  */

  /**************************************************/
  /* darksky.js - window overlay for various things */
  /* note: this code is modified for XOMF.com from  */
  /* the original lightbox.js                       */
  /**************************************************/

  function getPageScroll() {
    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;
  }

  function getPageSize() {
    var xScroll, yScroll;
    if (window.innerHeight && window.scrollMaxY) {  
      xScroll = document.body.scrollWidth;
      yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight) {
      xScroll = document.body.scrollWidth;
      yScroll = document.body.scrollHeight;
    } else {
      xScroll = document.body.offsetWidth;
      yScroll = document.body.offsetHeight;
    }

    var windowWidth, windowHeight;
    if (self.innerHeight) {
      windowWidth = self.innerWidth;
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
      windowWidth = document.documentElement.clientWidth;
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) {
      windowWidth = document.body.clientWidth;
      windowHeight = document.body.clientHeight;
    }  

    if(yScroll < windowHeight) pageHeight = windowHeight;
    else pageHeight = yScroll;

    if(xScroll < windowWidth) pageWidth = windowWidth;
    else pageWidth = xScroll;

    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
    return arrayPageSize;
  }

  function darkSky() {
    var pageSize = getPageSize();
    var overLayer = document.getElementById("darksky");
    overLayer.style.width = '100%';
    overLayer.style.height = pageSize[1] + 'px';
    overLayer.style.display='block';
  }

  function sendFriend(vid) {
    darkSky();
    var pageScroll = getPageScroll();
    var pageSize = getPageSize();
    sendFriend = document.getElementById("sendfriend");
    sendFriendId = document.getElementById("sfid");
    sendFriend.style.top = (pageScroll + (pageSize[3] / 2) - 50) + 'px';
    sendFriend.style.left = ((pageSize[0] / 2) - 200) + 'px';
    sendFriend.style.display = 'block';
    sendFriendId.value = vid;
  }

  function newUser() {
    darkSky();
    var pageScroll = getPageScroll();
    var pageSize = getPageSize();
    var newUser = document.getElementById("newuser");
    newUser.style.top = (pageScroll + (pageSize[3] / 2) - 50) + 'px';
    newUser.style.left = ((pageSize[0] / 2) - 200) + 'px';
    newUser.display='block';
  }

  function lightSky() {
    document.getElementById("darksky").style.display = "none";
    document.getElementById("sendfriend").style.display = "none";
  }

  function sendToFriend() {
    email = document.getElementById("femail").value;
    id = document.getElementById("sfid").value;
    sndReq('sendfriend',id,email);
    lightSky();
  }