// form focus
function setFormFocus(frmName) {
	// set focus on first form input field
	focusSet = false
	if (document.forms[frmName]) {
		for (elix=0; elix < document.forms[frmName].elements.length && !focusSet; elix++) {
			FormField = document.forms[frmName].elements[elix]
			if (FormField.disabled == false && ((FormField.tagName == "INPUT") && (FormField.type == "text")) || ((FormField.tagName == "TEXTAREA") && (FormField.type == "textarea") && (FormField.id != "dhtmleditor")))	{
				FormField.focus()
				focusSet = true
			}
		}
	}
}

var newWin
function openPopup(url) {
	if (newWin) newWin.close()
	newWin = window.open(url, 'fixedPopup', "width=640,height=480,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no", true)
	newWin.focus()
	return newWin
}

var newCustomWin
function openCustomPopup(url, width, height, scrollable) {
	if (newCustomWin) newCustomWin.close()
	if(!scrollable) scrollable = "no"
	newCustomWin = window.open(url, 'customPopup', "width=" + width + ",height=" + height +",location=no,menubar=no,resizable=no,scrollbars=" + scrollable + ",status=no,titlebar=no,toolbar=no", true)
	newCustomWin.focus()
	return newCustomWin
}

function redirect(url) {
	document.location.href = url
}