﻿function openDoc(UniqueID)
{
    window.open('LoadDocument.ashx?id=' + UniqueID, 'getDocument', 'status=0,toolbar=0,height=30,width=100');
}
function stop()
{
    var i = 5;
}
function showPopup(objID)
{
    var obj = document.getElementById(objID);
    var objHidden = document.getElementById(obj.getAttribute('hdn'));
    var objBack = document.getElementById(obj.getAttribute('bck'));
    
    objBack.style.display = '';
    obj.style.display = '';
    
    objHidden.value = 'true';
}

function hidePopup(objID)
{
    var obj = document.getElementById(objID);
    var objHidden = document.getElementById(obj.getAttribute('hdn'));
    var objBack = document.getElementById(obj.getAttribute('bck'));
    
    objBack.style.display = 'none';
    obj.style.display = 'none';
    
    objHidden.value = 'false';
}

var popupItems = new Array();
var popupBacks = new Array();

function setPopupsPositions()
{
    var _windowTop = 0;
    var _windowLeft = 0;
    
     if( typeof( window.pageYOffset ) == 'number' ) {
        //Netscape compliant
        _windowTop = window.pageYOffset;
        _windowLeft = window.pageXOffset;
      } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
        //DOM compliant
        _windowTop = document.body.scrollTop;
        _windowLeft = document.body.scrollLeft;
      } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
        //IE6 standards compliant mode
        _windowTop = document.documentElement.scrollTop;
        _windowLeft = document.documentElement.scrollLeft;
      }

    var _windowWidth = 0;
    var _windowHeight = 0;
    
      if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        _windowWidth = window.innerWidth;
        _windowHeight = window.innerHeight;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        _windowWidth = document.documentElement.offsetWidth;
        _windowHeight = document.documentElement.offsetHeight;
      } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        _windowWidth = document.body.clientWidth;
        _windowHeight = document.body.clientHeight;
      }
    
    for(var i = 0; i < popupItems.length; i++)
    {
        var vv = document.getElementById(popupItems[i]);
        vv.style.top = '' + (_windowTop + Math.round((_windowHeight - vv.clientHeight) / 2)) + 'px';
        vv.style.left = '' + (_windowLeft + Math.round((_windowWidth - vv.clientWidth) / 2)) + 'px';
    }
    
    for(var i = 0; i < popupBacks.length; i++)
    {
        var vv = document.getElementById(popupBacks[i]);
        var vv2 = document.getElementById(popupBacks[i] + "_frm");
        vv.style.top = 
            vv2.style.top = '' + _windowTop + 'px';
        vv.style.left = 
            vv2.style.left = '' + _windowLeft + 'px';
        
        vv.style.width = 
            vv2.style.width = '' + _windowWidth + 'px';
        vv.style.height =
            vv2.style.height = '' + _windowHeight + 'px';
    }
}

function initPopupBackground(popupID, backID)
{
    popupItems[popupItems.length] = popupID;
    popupBacks[popupBacks.length] = backID;
}

window.onresize = setPopupsPositions;
window.onscroll = setPopupsPositions;

var loadingPanels = new Array();

function showLoadingPanels()
{
    for(x in loadingPanels)
        document.getElementById(loadingPanels[x]).style.display = '';
}

function hideLoadingPanels()
{
    for(x in loadingPanels)
      document.getElementById(loadingPanels[x]).style.display = 'none';
}

function initLoadingPanel(objID)
{
    loadingPanels[loadingPanels.length] = objID;
}

function testForAjax(objName)
{
   if(document.getElementById(objName).getElementsByTagName("INPUT")[0].value)
        EnableAjaxGlobal = false;
}
