﻿
function openPopupTeam() {


    var pageSize = GetHeight();
    fadeScreenObj.style.height = pageSize.pageHeight + 'px';
    fadeScreenObj.style.width = pageSize.pageWidth + 'px';


}
function GetHeight() {
    var scrollX, scrollY, windowX, windowY, pageX, pageY;
    if (window.innerHeight && window.scrollMaxY) {
        scrollX = document.body.scrollWidth;
        scrollY = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
        scrollX = document.body.scrollWidth;
        scrollY = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        scrollX = document.body.offsetWidth;
        scrollY = document.body.offsetHeight;
    }

    if (self.innerHeight) {	// all except Explorer
        windowX = self.innerWidth;
        windowY = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowX = document.documentElement.clientWidth;
        windowY = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowX = document.body.clientWidth;
        windowY = document.body.clientHeight;
    }

    pageY = (scrollY < windowY) ? windowY : scrollY; // for small pages with total height less then height of the viewport
    pageX = (scrollX < windowX) ? windowX : scrollX; // for small pages with total width less then width of the viewport
    return { pageWidth: scrollX, pageHeight: scrollY, winWidth: windowX, winHeight: windowY };
}
//open HTML popUp
var newwindow;
function openHTMLPopup(url, name, width, height) {

    //newwindow = window.open(url, name, 'height=' + height + ',width=' + width +  ',scrollbars=yes');
    // newwindow = window.open(url, name, 'width = 800, height = 600, scrollbars = yes');
    newwindow = window.open(url, name, 'width = ' + width + ', height = ' + height + ', scrollbars = yes');

    if (window.focus) { newwindow.focus() }
}

function GetScreenHeight() {

    var y = 0;

    if (self.innerHeight) {

        y = self.innerHeight;

    }

    else if (document.documentElement && document.documentElement.clientHeight) {

        y = document.documentElement.clientHeight;

    }

    else if (document.body) {

        y = document.body.clientHeight;

    }

    return y;

}
// returns the size of the document
function f_documentSize() {

    var n_scrollX = 0,
	n_scrollY = 0;

    if (typeof (window.pageYOffset) == 'number') {
        n_scrollX = window.pageXOffset;
        n_scrollY = window.pageYOffset;
    }
    else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
        n_scrollX = document.body.scrollLeft;
        n_scrollY = document.body.scrollTop;
    }
    else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
        n_scrollX = document.documentElement.scrollLeft;
        n_scrollY = document.documentElement.scrollTop;
    }

    if (typeof (window.innerWidth) == 'number')
        return [window.innerWidth, window.innerHeight, n_scrollX, n_scrollY];
    if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
        return [document.documentElement.clientWidth, document.documentElement.clientHeight, n_scrollX, n_scrollY];
    if (document.body && (document.body.clientWidth || document.body.clientHeight))
        return [document.body.clientWidth, document.body.clientHeight, n_scrollX, n_scrollY];
    return [0, 0];
}

function f_putScreen(e_message,e_screen,closeButton, b_show)
 {
     if (b_show) {
         e_message.className = 'dialogWindow';
         e_message.style.display = '';


         // set properties
         
         var a_docSize = f_documentSize();
         var pageSize = GetHeight();
        // alert(pageSize.pageWidth);
         if (e_message.id == 'eMessagePopupSendFriend') {

                 e_screen.style.left ='0px';
                 e_screen.style.top = '0px';
                 e_screen.style.width = pageSize.winWidth + 'px';
                 e_screen.style.height = pageSize.winHeight + 'px';      
         }
         else {
             e_screen.style.top = 0 + 'px';
             e_screen.style.height = pageSize.pageHeight + 'px';
             e_screen.style.width = pageSize.pageWidth + 'px';
             e_screen.style.left = 0 + 'px';
         }     
         e_screen.style.display = 'block';
         e_screen.className = 'lightbox';
         var n_height = e_message.clientHeight;
         var n_width = e_message.clientWidth;
         e_message.style.left = ((a_docSize[0] - n_width) / 2) + a_docSize[2] + 'px';
         e_message.style.top = ((a_docSize[1] - n_height) / 2) + a_docSize[3] + 'px';
         closeButton.focus();         
     }
     else {
         e_screen.style.display = 'none';
         e_message.className = '';
         e_message.style.display = 'none';         
     }
}
     
