window.onscroll = scroll;
	
var DvMsgBxW = 500;
var DvMsgBxH= 300;

// JavaScript Document
function ShowDv(DvName)
{
var DvMain, DvMsgBx, DvName;

DvIfrm=document.getElementById('Ifrm');
DvMain=document.getElementById('DvMain'); //Greyed background
DvMsgBx=document.getElementById('DvMsgBx'); //Popup
/*For Height and width of greyed background*/
	if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) 
	{	
		yScroll = window.innerHeight + window.scrollMaxY;
		xScroll = window.innerWidth + window.scrollMaxX;
		var deff = document.documentElement;
		var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
		var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
		xScroll -= (window.innerWidth - wff);
		yScroll -= (window.innerHeight - hff);
	}
	else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth)
	{ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
		xScroll = document.body.scrollWidth;
	} 
	else 
 { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
		xScroll = document.body.offsetWidth;
  }

//Styles for greyed background


DvMain.style.height=yScroll + 'px';
DvMain.style.width=100 + '%';
DvIfrm.style.height=yScroll + 'px';
DvIfrm.style.width=100 + '%';

	var arrayPageScroll=TB_getPageScrollTop();
	var pagesize = TB_getPageSize();	
	var arrayPageScroll = TB_getPageScrollTop();
	

DvMsgBx.style.left='50%';
DvMsgBx.style.marginLeft = -(DvMsgBxW/2)+'px';

//DvMsgBx.style.top=(arrayPageScroll[1] + (pagesize[1]-DvMsgBxH)/2) + 'px';
DvMsgBx.style.top=50 + 'px';
//DvMsgBx.style.height=DvMsgBx.clientHeight + 'px';
DvMsgBx.style.width=DvMsgBxW + 'px';

DvIfrm.style.display='block';
DvMain.style.display='block';
DvMsgBx.style.display='block';

//DvMsgBxW = DvMsgBx.clientWidth;
//DvMsgBxH = DvMsgBx.clientHeight;
//alert((arrayPageScroll[1] + (pagesize[1]-DvMsgBxH)/2)-100)
//DvMsgBx.style.top=(arrayPageScroll[1] + (pagesize[1]-DvMsgBxH)/2 - 200) + 'px';

if (DvName)
{
DvName=document.getElementById(DvName); //inner content Div
DvName.style.display='block';
}

}


function scroll()
{
var DvMsgBx;
DvMsgBx=document.getElementById('DvMsgBx'); 
if (DvMsgBx.style.display == 'block')
 {
	if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) {	
		yScroll = window.innerHeight + window.scrollMaxY;
		xScroll = window.innerWidth + window.scrollMaxX;
		var deff = document.documentElement;
		var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
		var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
		xScroll -= (window.innerWidth - wff);
		yScroll -= (window.innerHeight - hff);
	} else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
		xScroll = document.body.scrollWidth;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
		xScroll = document.body.offsetWidth;
  	}
	var arrayPageScroll=TB_getPageScrollTop();
	var pagesize = TB_getPageSize();	
	var arrayPageScroll = TB_getPageScrollTop();

DvMsgBxW = DvMsgBx.clientWidth;
DvMsgBxH = DvMsgBx.clientHeight;

DvMsgBx.style.marginLeft = -(DvMsgBxW/2)+'px';
DvMsgBx.style.top=(arrayPageScroll[1] + (pagesize[1]-DvMsgBxH)/2) + 'px';
//DvMsgBx.style.height=DvMsgBxH + 'px';
DvMsgBx.style.width=DvMsgBxW + 'px';
}

	
 // note: you can use window.innerWidth and window.innerHeight to access the width and height of the viewing area
}

function TB_getPageSize(){

	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight
	arrayPageSize = new Array(w,h) 
	return arrayPageSize;
}
function TB_getPageScrollTop(){

	var yScrolltop;
	var xScrollleft;
	if (self.pageYOffset || self.pageXOffset) {
		yScrolltop = self.pageYOffset;
		xScrollleft = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){	 // Explorer 6 Strict
		yScrolltop = document.documentElement.scrollTop;
		xScrollleft = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScrolltop = document.body.scrollTop;
		xScrollleft = document.body.scrollLeft;
	}
 
	arrayPageScroll = new Array(xScrollleft,yScrolltop) 
	return arrayPageScroll;
}
