//
// Dreamweaver functions
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; }
//
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i]; } } }
//
function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x; }
//
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2]; } }
//
// Sets focus to username or password based on saved settings
function fnFocusLogIn(bol) {
var d=document.all;
if(bol) { d.idPassword.focus(); } else {
d.idUsername.focus(); } }
//
// Validates administration login
function fnValidateLogin() {
var d=document.all;
	// username
if(d.idUsername.value=='') {
alert('Please enter your username.');
d.idUsername.focus();
return false; }
	// password
if(d.idPassword.value=='') {
alert('Please enter your password.');
d.idPassword.focus();
return false; } }
//
// Creates the hover effect when you mouse over a list item
function fnHover(obj,bol) {
if(bol) { obj.className='admin_list_over';
} else { obj.className=''; } }
//
// Opens a URL in the current window
function fnGetURL(url) {
window.location.href=url; }
//
// Validates the add/edit news form
function fnValidateNews() {
var d=document.all;
var regExpDate = /\d{1,2}\/\d{1,2}\/\d{2,4}/
	// date
if(d.idNewsDate.value==''||!regExpDate.test(d.idNewsDate.value)) {
alert('Please enter a valid date.');
d.idNewsDate.select();
return false; }
	// title
if(d.idNewsTitle.value=='') {
alert('Please enter a title.');
d.idNewsTitle.focus();
return false; }
	// body
if(d.idNewsBody.value=='') {
alert('Please enter the body of the news article.');
return false; }
	// ms word text
fnMSWordCode(d.idNewsBody.value); }
//
// Validates the add/edit user form
function fnValidateUser() {
var d=document.all;
	// user fname
if(d.idUserFName.value=='') {
alert('Please enter your first name.');
d.idUserFName.focus();
return false; }
	// user lname
if(d.idUserLName.value=='') {
alert('Please enter your last name.');
d.idUserLName.focus();
return false; }
	// username
if(d.idUserName.value=='') {
alert('Please enter a username.');
d.idUserName.focus();
return false; }
	// password1
if(d.idPassword1.value=='') {
alert('Please enter a password.');
d.idPassword1.focus();
return false; }
	// passwords do not match
if(d.idPassword1.value!=d.idPassword2.value) {
alert('Passwords do not match.\nPlease re-enter your password.');
d.idPassword1.value='';
d.idPassword2.value='';
d.idPassword1.focus();
return false; } }
//
// Checks for pasted Microsoft Word text and cautions user
function fnMSWordCode(str) {
if(str.indexOf('mso-')>=0) { // Microsoft Word code exists
alert('It is recommended that when pasting text from Microsoft Word that\nyou first paste the text into Notepad and then into the text editor.');
return true; } else { return false; } }
//
// Validates the specified setting value against the specified parameters
function fnValidateSetting(intSettingID,intControlType,intErrorType) {
		// intSettingID: idSettingName{N} where N is the setting id
		// intControlType: 1 = checkbox, 2 = radio, 3 = select, 4 = text
		// intErrorType: 1 = empty, 2 = NaN, 3 = hyperlink
	// text
  switch(intControlType) {
    case 4 :
	  return fnValidateText(intSettingID,intErrorType);
    break; } }
// Validates the specified text value against the specified parameter
function fnValidateText(intSettingID,intErrorType) {
	// see fnValidateSetting for settings
  switch(intErrorType) {
    case 2 :
	  return fnValidateNumber(intSettingID);
	break;
    case 3 :
	  return fnValidateHyperlink(intSettingID);
	break; } }
// Validates a hyperlink
function fnValidateHyperlink(intSettingID) {
  var o=document.all['idSettingValue'+intSettingID];
  var msg='Please enter a complete URL in the text box.';
	// empty
  if(o.value=='') {
    alert(msg);
	o.focus();
	return false; }
	// no http://
  if(o.value.indexOf('http://')==(-1)) {
    alert(msg);
	o.select();
	return false; }
	// no dot
  if(o.value.indexOf('.')==(-1)) {
    alert(msg);
	o.select();
	return false; } }
// Validates a number
function fnValidateNumber(intSettingID) {
  var o=document.all['idSettingValue'+intSettingID];
  var msg='Please enter a number in the text box.';
  	// empty
  if(o.value=='') {
    alert(msg);
	o.focus();
	return false; }
  	// NaN
  if(isNaN(o.value)) {
    alert(msg);
	o.select();
	return false; } }
//
// Validates the add/edit meeting form
function fnValidateMeeting() {
var d=document.all;
var regExpDate = /\d{1,2}\/\d{1,2}\/\d{2,4}/
	// date
if(d.idMeetingDate.value==''||!regExpDate.test(d.idMeetingDate.value)) {
alert('Please enter a valid date.');
d.idMeetingDate.select();
return false; }
	// title
if(d.idMeetingTitle.value=='') {
alert('Please enter a title.');
d.idMeetingTitle.focus();
return false; } }
//
// Validates the add/edit statement form
function fnValidateFinancialStatement() {
var d=document.all;
var regExpDate = /\d{1,2}\/\d{1,2}\/\d{2,4}/
	// date
if(d.idStatementDate.value==''||!regExpDate.test(d.idStatementDate.value)) {
alert('Please enter a valid date.');
d.idStatementDate.select();
return false; }
	// title
if(d.idStatementTitle.value=='') {
alert('Please enter a title.');
d.idStatementTitle.focus();
return false; }
	// PDF
if(d.idStatementFileName.value=='') {
alert('Please select a PDF.');
d.idStatementFileName.focus();
return false; } }

