var child = null;// register child popup window

function openChild(winURL, winName, winFeatures)
{
	if((child != null) && (!child.closed))
	{
		child.close();
	}
	child = window.open(winURL, winName, winFeatures);
	return false;
}
function closeChild()
{
	if(child != null)
	{
		if(!child.closed)
		{
			child.close();
		}
		child = null;
	}
	return false;
}

function closeWithSubmitParentForm(){
	var parentDoc = window.opener.document;
	var hiddenFieldName = 'actionRefreshPage';
		if (window.opener.currentDataFormName != null) {
			var currentDataFormName = window.opener.currentDataFormName;
	 		var dataForm = parentDoc.getElementsByName(currentDataFormName)[0];
	 		if (dataForm != null) {
	 			if (parentDoc.getElementById(hiddenFieldName) != null) {
	 				parentDoc.getElementById(hiddenFieldName).innerHTML = '';
				}
			var reloadWithNoActions = parentDoc.createElement('input');
			reloadWithNoActions.setAttribute('type','hidden');
			reloadWithNoActions.setAttribute('id',hiddenFieldName);
			reloadWithNoActions.setAttribute('name',hiddenFieldName);
			reloadWithNoActions.setAttribute('value','');
			dataForm.appendChild(reloadWithNoActions);
			dataForm.submit();
		}
	}
	window.close();
}

