function popUp(title, url, w, h) {
	if (typeof(w)=="undefined") { w=600; }
	if (typeof(h)=="undefined") { h=600; }
	var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
	var settings = "width="+w+",height="+h+",top="+wint+",left="+winl+",status=0,toolbar=0,menubar=0,scrollbars=1,resizable=1";
	eval(title+"=window.open(url,title,settings)");
	eval(title+".focus()");
}

function ShowCalendar(FormName, FieldName) {
	eval("document."+FormName+"."+FieldName+".value=''");
	var url = "calendar.cfm?FormName=" + FormName + "&FieldName=" + FieldName;
	popUp(FieldName, url, 220, 200);
}

function closeme() {
	this.window.opener.focus();
	this.window.close();
}

// This function is used by viewedit.cfm and viewedit50.cfm to validate text area field length
function textCount(field, maxlimit) {
	if (field.value.length > maxlimit) {field.value = field.value.substring(0, maxlimit);}
	return;
}

// field length validation (for any text area)
function CharacterCount(field, maxlimit) {
	if (field.value.length > maxlimit) {field.value = field.value.substring(0, maxlimit);}
	characters = maxlimit - field.value.length;
	document.getElementById("CharsRemaining_"+field.name).innerHTML = characters;
	document.getElementById("CharsRemaining_"+field.name).style.color = (characters < 50) ? "#FF0000" : "#000000";
	return;
}

