// JavaScript Document
var isDOM = (document.getElementById) ? true : false;
var isIE = (document.all) ? true : false;
var isNS4 = (document.layers) ? true : false;

var popUp;

function openPopUp(URL, name, props)
{
	var	width = getValueFromString(props, 'width', ',');
	var	height = getValueFromString(props, 'height', ',');
	var center = getValueFromString(props, 'center', ',');
	
	var centerStr = (center == 'yes') ? ','+getCenterParam(width, height) : '';

	popUp = window.open(URL, name, 'width='+width+',height='+height+',scrollbars=yes,directories=no,location=no,menubar=no,status=yes,resizable=yes,toolbar=no,personalbar=no,modal=yes'+centerStr);
	window.onfocus = checkModal;
}

function closePopUp()
{
	window.opener.location.reload(true);
	window.opener.onfocus = null;
	window.close();
}

function checkModal()
{
	if (!popUp.closed) {
		popUp.focus();
	}
}

function getCenterParam(width, height)
{
	var left = (screen.availWidth / 2) - (width / 2);
	var top = (screen.availHeight / 2) - (height / 2);
	
	if (isNS4)
		return 'screenX='+left+',screenY='+top;
	else
		return 'left='+left+',top='+top;
}

function getValueFromString(str, varName, sep)
{
	var parts = str.split(sep);
	
	for (var i=0; i<parts.length; i++) {
		var subParts = parts[i].split('=');
		if (subParts[0].small() == varName.small()) {
			return subParts[1];
		}
	}
	
	return '';
}

function walkForm(formName, formElementName, step)
{
	document.forms[formName][formElementName].value = step; 
	document.forms[formName].submit();
}