﻿// JScript File
var divZindex = 9999;
var divColor = 'white';
var divOpacity = 90;  

document.write('<div id="dimmer" class="dimmer" style=" text-align:center; vertical-align:middle;'
    + ' opacity:' + divOpacity/100 + '; filter:alpha(opacity=' + divOpacity + '); position:absolute; left:0px; top:0px; visibility:hidden; width:'+
    window.screen.width + 'px; height:' + window.screen.height +'px"><img id="waitImg" src="/images/please_wait.png"/></div>');

document.write('<div id="dimmer2" class="dimmer" style="text-align:center; vertical-align:middle;'
    + ' opacity:' + divOpacity/100 + '; filter:alpha(opacity=' + divOpacity + '); position:absolute; left:0px; top:0px; visibility:hidden; width:'+
    window.screen.width + 'px; height:' + window.screen.height +'px"><img id="waitImg2" src="/images/please_wait.png"/></div>');

if (navigator.appName == 'Opera')
{
    history.navigationMode='compatible';
    opera.setOverrideHistoryNavigationMode = 'compatible';
}

function getPos(el,sProp) {
	var iPos = 0
	while (el!=null) {
		iPos+=el["offset" + sProp]
		el = el.offsetParent
	}
	return iPos
}
    
function showDimmerDiv()
{
    dss = document.getElementById('divSearchSide');
    divDimmer = document.getElementById('dimmer');

    //alert(getPos(dss,"Left") + "px");
    //alert(getPos(dss,"Top") + "px");
    //alert(document.getElementById('divSearchSide').offsetHeight);
    //alert(document.getElementById('divSearchSide').offsetWidth);
    
    if (dss != null)
    {
    divDimmer.style.left = getPos(dss,"Left") + "px";
    divDimmer.style.top = getPos(dss,"Top") + "px";
    divDimmer.style.height = dss.offsetHeight + "px";
    divDimmer.style.width = dss.offsetWidth + "px";
    
    divImg = document.getElementById('waitImg');
    if (parseFloat(divImg.height) > parseFloat(divDimmer.style.height)) {divImg.style.height = dss.offsetHeight + "px"};
    if (parseFloat(divImg.width) > parseFloat(divDimmer.style.width)) {divImg.width = dss.offsetWidth + "px"};
    
    }
    else
    {
    var pageSize = getPageSizeWithScroll();
    divDimmer.style.height=pageSize[1]+"px";
    divDimmer.style.width=pageSize[0]+"px";
    }
    
    divDimmer.style.visibility="visible";
    divDimmer.style.zIndex=divZindex;
    divDimmer.style.backgroundColor=divColor;
    
    gr = document.getElementById('ctl00_mainContentPlaceHolder_gridResults');
    if (gr != null) showDimmerDiv2();
}

function showDimmerDiv2()
{
    gr = document.getElementById('ctl00_mainContentPlaceHolder_gridResults');
    divDimmer = document.getElementById('dimmer2');
    pn = document.getElementById('ctl00_mainContentPlaceHolder_pnlShowResults');
    
    //alert(getPos(dss,"Left") + "px");
    //alert(getPos(dss,"Top") + "px");
    //alert(document.getElementById('divSearchSide').offsetHeight);
    //alert(document.getElementById('divSearchSide').offsetWidth);
    
    if (gr != null) 
    {
        if (pn != null)
        {
        divDimmer.style.left = getPos(pn,"Left") + "px";
        divDimmer.style.width = pn.offsetWidth + "px";
        }
        else
        {
        divDimmer.style.left = getPos(gr,"Left") + "px";
        divDimmer.style.width = gr.offsetWidth + "px";
        }
        
    divDimmer.style.top = getPos(gr,"Top") + "px";
    divDimmer.style.height = gr.offsetHeight + "px";
    
    }
    else
    {
    var pageSize = getPageSizeWithScroll();
    divDimmer.style.height=pageSize[1]+"px";
    divDimmer.style.width=pageSize[0]+"px";
    }
    
    divDimmer.style.visibility="visible";
    divDimmer.style.zIndex=divZindex;
    divDimmer.style.backgroundColor=divColor;
}

function getPageSizeWithScroll()
{
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}

	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}