function trimString(str)
{  while(str.charAt(0) == (" ") )
  {  str = str.substring(1);
  }
  while(str.charAt(str.length-1) == " " )
  {  str = str.substring(0,str.length-1);
  }
  return str;
}


function emptyvalidation(entered, alertbox) {
	with (entered) {
		if (value==null || trimString(value)=="" ) {
			if (alertbox!="") {
				alert(alertbox);
			}

			return false;
		}
		else {
			return true;
		}
	}
}

function emailvalidation(entered, alertbox) {
	with (entered) {
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		lastpos=value.length-1;

		if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) {
			if (alertbox) {
				alert(alertbox);
			}

			return false;
		}
		else {
			return true;
		}
	}
}

function passwordvalidation(entered, alertbox) {
	with (entered) {
		if ((value.toLowerCase() != "client") && (value.toLowerCase() != "asps")) {
			if (alertbox!="") {
				alert(alertbox);
			}

			return false;
		}
		else {
			return true;
		}
	}
}