function validatePassword()
{
	// allow ONLY alphanumeric keys, no symbols or punctuation
	// this can be altered for any set of characters
	var acceptedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
	var allCharsValid = true;
	var checkStr = document.passChange.new1.value;
	
	for (i = 0;  i < checkStr.length;  i++)
	{
		if (allCharsValid)
		{
			ch = checkStr.charAt(i);
			for (j = 0;  j < acceptedChars.length;  j++)
			{
				if (ch == acceptedChars.charAt(j))
				break;
				
				if (j+1 == acceptedChars.length)
				{
					allCharsValid = false;
					break;
				}
			}
		}
	}
	
	if (!allCharsValid)
	{
		alert("Please enter only letter and numeric characters.");
		document.passChange.new1.focus();
		return (false);
	}
	
	// require at least 6 characters in the password field
	if (document.passChange.new1.value.length < 6)
	{
		alert("Please enter at least 6 characters in the password fields.");
		document.passChange.new1.focus();
		return (false);
	}
	
	// check if both password fields are the same
	if (document.passChange.new1.value != document.passChange.new2.value)
	{
		alert("The two new password fields are not the same.  Passwords must match.");
		document.passChange.new2.focus();
		return (false);
	}
	return (true);
}

function showMessage(text, type)
{
	$('pageMessage').update(text);
	$('pageMessage').className = type;
	Element.show('pageMessage');
	setTimeout("Element.hide('pageMessage')",10000);
}

function showMenu(menu)
{
	if($(menu).style.display == "none")
	{
		Element.show(menu);
	}
	else
	{
		Element.hide(menu);
	}
}

function updateContent(functionToShow)
{
	new Ajax.Updater("maincontent", "/reporting/loginFunctions.php?func=displayContent&show="+functionToShow,
	{
		asynchronous : true,
		on400 : function(resp)
		{
			alert(resp.statusText);
		},
		onFailure : function(resp)
		{
			alert('Error ' + resp.status + ' -- ' + resp.statusText);
		}
	});
}

function procedureA(formName, fieldName)
{
	if (formName != '')
	{ 
		var thisform = document.forms[formName];
	} 
	else 
	{ 
		var thisform = document.forms[0];  
	} 
	thisform[fieldName].focus(); 
	sessionAcceptsPopups('acceptsPopups', 'loginForm');							
}

function procedureB()
{
	sessionAcceptsPopups('acceptsPopups', 'loginForm');
}

var newwindow;
function popup(url)
{
	newwindow=window.open(url,'name','height=600,width=600,scrollbars=yes,menubar=no,left=600,top=200,resizing=yes');
	if (window.focus) {newwindow.focus()}
}	

function formSubmitter(func, formName)
{
	new Ajax.Updater("maincontent", "/reporting/loginFunctions.php?func="+func,
	{
		asynchronous : true,
		evalScripts : true,
		parameters : Form.serialize($(formName)),
		on400 : function(resp)
		{
			alert(resp.statusText);
		},
		onFailure : function(resp)
		{
			alert('Error ' + resp.status + ' -- ' + resp.statusText);
		}
	});
}