<!--
// This function will trim leading and/or trailing spaces from a string
// arg = the value you wish to have trimmed..
// func = "left" for Ltrim(), "right" for RTrim() or "both" for Trim()

//===================================
function trim(arg,func) {
//===================================

var trimvalue = "";
arglen = arg.length;
if (arglen < 1) return trimvalue;

if (func == "left" || func== "both") {
i = 0;
pos = -1;
while (i < arglen) {
if (arg.charCodeAt(i) != 32 &&
!isNaN(arg.charCodeAt(i))) {
pos = i;
break;
}
i++;
}
}

if (func == "right" || func== "both") {
var lastpos = -1;
i = arglen;
while (i >= 0) {
if (arg.charCodeAt(i) != 32 &&
!isNaN(arg.charCodeAt(i))) {
lastpos = i;
break;
}
i--;
}
}

if (func == "left") {
trimvalue = arg.substring(pos,arglen-1);
}

if (func == "right") {
trimvalue = arg.substring(0,lastpos+1);
}

if (func == "both") {
trimvalue = arg.substring(pos,lastpos + 1);
}

return trimvalue;

}



function isEmail(argvalue){
	if (argvalue.indexOf(" ") != -1){
		return false;
	}
	else if (argvalue.indexOf("@") == -1){
		return false;
	}
	else if (argvalue.indexOf("@") == 0){
		return false;
	}
	else if (argvalue.indexOf("@") == (argvalue.length-1)){
		return false;
	}
	emailArray = argvalue.split("@");
	if (emailArray[1].indexOf(".") == -1){
		return false;
	}
	else if (emailArray[1].indexOf(".") == 0){
		return false;
	}
	else if (emailArray[1].charAt(emailArray[1].length-1) == "."){
		return false;
	}
	return true;
}



function checkform(){
	var aok = true;
	var message = "ERROR:\n";

	theuid = trim(document.userlogon.uid.value,"both");
	thepwd = trim(document.userlogon.pwd.value,"both");

	if (theuid == ''){
		aok = false;
		message = message + 'You must enter a user ID!\n';
	}
	
	if (thepwd == ''){
		aok = false;
		message = message + 'You must enter a password!\n';
	}
	
	if (aok == false){
		alert(message);
	}
	return aok;
}
//-->
