var bIsIE =( window.ActiveXObject != null );

function ShowDialog( strURL, iWidth, iHeight )
{
	var iWndHeight = -1;
	var iWndWidth = -1;

	if( window.innerHeight )
	{
		// FF knows document.body.offsetHeight -> but correctly the result is height of real body and not available window...
		iWndHeight = window.innerHeight;
		iWndWidth = window.innerWidth;
	}
	else if( document.body && document.body.offsetHeight )
	{
		// IE don't know window.innerHeight
		iWndHeight = document.body.offsetHeight - 4;
		iWndWidth = document.body.offsetWidth - 4;
	}

//	iWndHeight = document.body.clientHeight;
//	iWndWidth = document.body.clientWidth;
	
	if( iWndHeight < 0 || iWndWidth < 0 )
	{
		return false;
	}
	
	var strOpacity = '		opacity: 0.4;  ';
	if( bIsIE )
	{
		// OK, we're running in IE :-(
		strOpacity = '		filter:alpha(opacity=40);  ';
	}
	
	var iLeft = ( iWndWidth - iWidth	) / 2;
	var iTop = ( iWndHeight - iHeight	) / 2;
	if( iLeft < 0 ) iLeft = 0;
	if( iTop < 0 ) iTop = 0;
	// alert( 'URL: ' + strURL + '\nWidth: ' + iWidth + '\nHeight: ' + iHeight );
	if( strURL != '' && iWidth > 0 && iHeight > 0 )
	{
		var strBckGnd = '<div 	style="	border: 0pt none ; ' +
						'		margin: 0pt; ' +
						'		padding: 0pt;  ' +
						'		background-color: rgb(255, 255, 255);  ' +
						'		background-image: none;  ' +
						'		position: absolute;  ' +
						strOpacity +
						'		z-index: 11000;  ' +
						'		top: ' + document.body.scrollTop + 'px; ' + 
						'		left: ' + document.body.scrollLeft + 'px; ' +
						'		width: ' + iWndWidth + 'px;  ' +
						'		height: ' + iWndHeight + 'px;"> ' +
						'</div> ';
						
		iTop += document.body.scrollTop;
		iLeft += document.body.scrollLeft;
						
		var strIFrame = '<iframe src="' + strURL + '" ' +
						'		style="	border: 1pt solid ; ' +
						'		margin: 0pt; ' +
						'		padding: 0pt; ' +
						'		background-color: transparent; ' +
						'		background-image: none; ' +
						'		position: absolute; ' +
						'		top: ' + iTop + 'px; ' +
						'		left: ' + iLeft + 'px; ' +
						'		width: ' + iWidth + 'px; ' +
						'		height: ' + iHeight + 'px; ' +
						'		z-index: 11001;" ' +
						'	frameborder="0">' +
						'</iframe>';
		
		var dlg = document.getElementById( 'dialog' );
		if( dlg != null )
		{
			// alert( 'Test' );
			dlg.innerHTML = strBckGnd + strIFrame;
		}
	}

	return false;
}

