function checkPwdForm(form)
{
	if(form.oldpwd.value == "")
	{
		document.getElementById('oldpwd').style.backgroundColor='#ffcccc';
		alert("Old Password can not be blank");
		document.getElementById('oldpwd').focus();
		return false;
	}
	else if(form.newpwd.value != form.cnfpwd.value)
	{
		document.getElementById('newpwd').style.backgroundColor='#ffcccc';
		document.getElementById('cnfpwd').style.backgroundColor='#ffcccc';
		document.getElementById('oldpwd').style.backgroundColor='#ffffff';
		alert("These two boxes must match!");
		document.getElementById('newpwd').focus();
		return false;
	}
	else if(form.newpwd.value == "")
	{
		document.getElementById('newpwd').style.backgroundColor='#ffcccc';
		document.getElementById('oldpwd').style.backgroundColor='#ffffff';
		alert("New Password can not be blank");
		document.getElementById('newpwd').focus();
		return false;
	}
	else if(form.cnfpwd.value == "")
	{
		document.getElementById('cnfpwd').style.backgroundColor='#ffcccc';
		alert("Confirm New Password can not be blank");
		document.getElementById('cnfpwd').focus();
		return false;
	}
	else
	{
		return confirm("You are about to change your password.\nAre you sure you want to do this?");
	}
}
function hideMenu()
{
		document.getElementById('corMenu').style.display='none';
}
function isEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}
function checkForgotPwdForm(form)
{
	if(form.uid.value == "")
	{
			document.getElementById('uid').style.backgroundColor='#ffcccc';
			alert("You must enter your User ID");
			return false;
	}
	else if(!isEmail(form.uid.value))
	{
		document.getElementById('uid').style.backgroundColor='#ffcccc';
		alert("You have not entered a valid email address");
		return false;
	}
	else
		return true;
}
function checkAddUserForm(form)
{
	var pass=true;
	if(form.email.value == "" || !isEmail(form.email.value))
	{
		document.getElementById('email').style.backgroundColor='#ffcccc';
		alert("You must enter a valid email address");
		pass=false;
	}
	if(form.fname.value == "")
	{
		document.getElementById('fname').style.backgroundColor='#ffcccc';
		alert("You must enter a first name");
		pass=false;
	}
	if(form.lname.value == "")
	{
		document.getElementById('lname').style.backgroundColor='#ffcccc';
		alert("You must enter a last name");
		pass=false;
	}
	if(form.company.value=="")
	{
		document.getElementById('company').style.backgroundColor='#ffcccc';
		alert("You must enter a company name");
		pass=false;
	}
	return pass;
}
function checkUserSearchForm(form)
{
	var field = "";
	var l = 4;
	for(i=0; i<l; i++)
	{
		if(form.field[i].checked) field= form.field[i].value;
	}
	if(form.term.value == "")
	{
		document.getElementById('term').style.backgroundColor='#ffcccc';
		alert("You must enter a term to search by");
		document.getElementById('term').focus();
		return false;
	}
	else if(field == "")
	{
		alert("You must select a field to search");
		return false;
	}
	else if(field == '0' && !isEmail(form.term.value))
	{
		document.getElementById('term').style.backgroundColor='#ffcccc';
		alert("You must enter a valid email address");
		document.getElementById('term').focus();
		return false;
	}
	else
		return true;
}
function checkEditUserForm(form)
{
	var pass=true;
	if(form.email.value=="")
	{
		document.getElementById('email').style.backgroundColor='#ffcccc';
		alert("You must enter an email address");
		pass=false;
	}
	if(!isEmail(form.email.value))
	{
		document.getElementById('email').style.backgroundColor='#ffcccc';
		alert("You entered an invalid email address");
		pass=false;
	}
	if(form.fname.value=="")
	{
		document.getElementById('fname').style.backgroundColor='#ffcccc';
		alert("You must enter a first name");
		pass=false;
	}
	if(form.lname.value=="")
	{
		document.getElementById('lname').style.backgroundColor='#ffcccc';
		alert("You must enter a last name");
		pass=false;
	}
	if(form.company.value=="")
	{
		document.getElementById('company').style.backgroundColor='#ffcccc';
		alert("You must enter a Company name");
		pass=false;
	}
	if(form.pwd.checked)
	{
		pass = confirm("You are about to reset the users password.\nThe new password will be emailed to address in the above email field.");
	}
	if(pass == true)
		return true;
	else if(pass == false)
		return false;
}