//chkAlphaNum
//Checks the user's keypress input.  This gets called when a user tries
//to enter data into fields that accept alphanumeric values.  
function chkAlphaNum(e)
{
	if(!chkAlpha(e) && !chkNum(e))
		return false;
	return true;
}

function chkAlpha(e)
{
	var key = window.event ? e.keyCode : e.which;
	var c = String.fromCharCode(key);
	//accept Backspace, Tab, Space, Period, Comma, &
	if(key == 8 || key == 0 || key == 32 || key == 38 || key == 39 || key == 46 || key == 44 || key == 38) return true;
	if(c != "0")
	{
		if(c < "A" || c > "Z")
		{
			if(c < "a" || c > "z")
				return false;
		}
	}
	return true;
}

function chkNum(e)
{
	var key = window.event ? e.keyCode : e.which;
	var c = String.fromCharCode(key);
	//accept Backspace and Tab
	if(key == 8 || key == 0) return true;
	if(c < "0" || c > "9")
		return false;
	return true;
}


function chkPhone(e)
{
	var key = window.event ? e.keyCode : e.which;
	var c = String.fromCharCode(key);
	//accept Backspace, Tab, (, ), -, ., and Space
	if(key == 8 || key == 0 || key == 40 || key == 41 || key == 45 || key == 46 || key == 32) return true;
	if(c < "0" || c > "9")
		return false;
	return true;
}

//chkEmail
//Used on email fields to check the user's input of an email address
//Accepts a-z and 0-9 as well as '@', '.', '-', '_'
function chkEmail(e)
{
	var key = window.event ? e.keyCode : e.which;
	if(key == 32) return false;
	else if(key == 8 || key == 0) return true;
	else if(key == 64 || key == 46 || key == 45 || key == 95) return true;
	else if(!chkAlpha(e) && !chkNum(e))
		return false;
	return true;
}

function checkUser()
{
	var val = document.getElementById('curuser').value;
	if(val == "Yes")
	{
		document.getElementById('bpname').style.display = "";
		document.getElementById('bpbox').style.display = "";
	}
	else
	{
		document.getElementById('bpname').style.display = "none";
		document.getElementById('bpbox').style.display = "none";
	}
}

                