var wopen; 

function closeWindow()
{
	if (window.opener.progressWindow)
	{
		window.opener.progressWindow.close();
	}
	window.close();
}

function new_window(url, iWidth, iHeight) 
{   
	iLeft = (screen.availWidth-10 - iWidth) / 2;
	iTop = (screen.availHeight-20 - iHeight) / 2;

	if(wopen == null || wopen.closed)
	{
		wopen = window.open(url,"_blank","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,width=" + iWidth + ",height=" + iHeight + ",left=" + iLeft + ",top=" + iTop);
		if(wopen != null)
		{
			wopen.dependent = true;
		}
	}
	else
	{  
		wopen.close();
		wopen = window.open(url,"_blank","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=" + iWidth + ",height=" + iHeight + ",left=" + iLeft + ",top=" + iTop);
	}
}

function new_window_scroll(url, iWidth, iHeight) 
{   
	iLeft = (screen.availWidth-10 - iWidth) / 2;
	iTop = (screen.availHeight-20 - iHeight) / 2;

	if(wopen == null || wopen.closed)
	{
		wopen = window.open(url,"_blank","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=" + iWidth + ",height=" + iHeight + ",left=" + iLeft + ",top=" + iTop);
		if(wopen != null)
		{
			wopen.dependent = true;
		}
	}
	else
	{  
		wopen.close();
		wopen = window.open(url,"_blank","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=" + iWidth + ",height=" + iHeight + ",left=" + iLeft + ",top=" + iTop);
	}
}

function open_newWindowJoinQuery(f,q,url)
{
	if(document.getElementById)
	{
		var obj = document.getElementById(f);
		if (obj!=null)
		{
			new_window(url + q + obj.value);
		}
	}
}

function refreshParent()
{
	sURL = window.opener.location.href;
	window.opener.location.href = sURL;
	closeWindow();
}

function submitParentForm()
{
	window.opener.document.forms[0].submit();
	closeWindow();
}

function changeParent(sURL)
{
	window.opener.location.href = sURL;
	closeWindow();
}

function changeURL(sURL)
{
	window.location.href = sURL;
}
