// +----------------------------------------------------------------------+
// | OpenConf                                                             |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002-2011 Zakon Group LLC.  All Rights Reserved.       |
// +----------------------------------------------------------------------+
// | This source file is subject to the OpenConf License, available on    |
// | the OpenConf web site: www.OpenConf.com                              |
// +----------------------------------------------------------------------+


// popup - displays an informational blurb
var popupObj;
function popup(fldId) {
	if (document.getElementById) {
		var field;
		if (popupObj) { popupObj.close(); }
		if (field = document.getElementById(fldId)) {
			popupObj = window.open('','info','width=300,height=300,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no');
			popupObj.document.write('<html><head><title>Click to Close</title></head><body style="margin:10px; padding:0; font-family: Arial, Helvetica, sans-serif; white-space: pre;" onclick="self.close()"><pre>' + field.innerHTML + '</pre></body></html>');
			popupObj.focus();
		}
	}
}

// oc_checkWordNum - checks textarea field length for # of words
function oc_checkWordNum(fieldID, fieldName, size) {
	var fieldObj = document.getElementById(fieldID);
	var oc_fieldContent = fieldObj.value.replace(/^\s\s*/, "").replace(/\s\s*$/, "").replace(/\s+/g, " ");
	var oc_fieldLength = oc_fieldContent.split(" ").length;
	if (oc_fieldLength > size) {
		alert("The field " + fieldName + " is limited to " + size + " words.  There are currently " + oc_fieldLength + " words.  Please revise.");
	}
}

// oc_checkCharNum - checks text field length for # of characters
function oc_checkCharNum(fieldID, fieldName, size) {
	var oc_fieldLength = document.getElementById(fieldID).length;
	if (oc_fieldLength > size) {
		alert("The field " + fieldName + " is limited to " + size + " characters.  There are currently " + oc_fieldLength + " characters.  Please revise.");
	}
}

// display show Processing field
function oc_showProcessing() {
	if ( ! document.getElementById) { return; }
	var procdiv = document.getElementById("processing");
	procdiv.style.visibility="visible";
}

