﻿// JScript File
var winModalWindow = null; 

window.onblur = GetBlur;
function GetBlur() 
{ 
	if ( winModalWindow ) 
	{ 
		if ( !winModalWindow.closed ) 
			winModalWindow.focus(); 
	} 
}

function HandleFocus() 
{ 
	if ( winModalWindow ) 
	{ 
		if ( !winModalWindow.closed ) 
			winModalWindow.focus(); 
		else 
		{
			if (typeof(window.top.releaseEvents) != 'undefined' )
			{	
				window.top.releaseEvents ( Event.CLICK | Event.FOCUS ); 
				window.top.onclick = null; 
			} 
		} 
	} 
	return false; 
} 

function HandleBlur()
{
	if ( winModalWindow ) 
	{ 
		if ( ! winModalWindow.closed ) 
			winModalWindow.focus(); 
		else 
		{ 
			if (typeof(window.top.releaseEvents) != 'undefined' )
			{	
				window.top.releaseEvents ( Event.CLICK | Event.FOCUS ); 
				window.top.onclick = null; 
			}
		} 
	} 
	return false; 
}

function IgnoreEvents(e) 
{ return false; } 

function OpenLawyerWindow()
{
	var Width = 1000;
	var Height = 700;
	var Left = (screen.width - Width) / 2;
	var Top = (screen.height - Height) / 3;		
	var attributes = "menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=no, toolbar=no, width=" + Width + ", height=" + Height + ", left=" + Left + ", top=" + Top;
	var URL = "/lawyers/ChooseLawyer.aspx?Width="+Width+"&Height="+Height;
	
	window.top.onclick=IgnoreEvents; 
	window.top.onfocus=HandleFocus; 
	window.top.onblur=HandleBlur;
	
	winModalWindow = window.open(URL, "ModalChild", attributes);
	winModalWindow.focus();
}

function OpenDownloadWindow(IdDocumentPublish)
{
	var Width = 1000;
	var Height = 700;
	var Left = (screen.width - Width) / 2;
	var Top = (screen.height - Height) / 3;		
	var attributes = "menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=no, toolbar=no, width=" + Width + ", height=" + Height + ", left=" + Left + ", top=" + Top;
	var URL = "/modules/Download.aspx?Width="+Width+"&Height="+Height+"&IdDocumentPublish="+IdDocumentPublish;
	
	window.top.onclick=IgnoreEvents; 
	window.top.onfocus=HandleFocus; 
	window.top.onblur=HandleBlur;
	
	winModalWindow = window.open(URL, "ModalChild", attributes);
	winModalWindow.focus();
}




