function validRequired(formField,Message) { var result = true; if (trim(formField.value) == "") { alert(Message); formField.focus(); result = false; } return result; } function signupValidate(theForm) { if (!validRequired(theForm.username,enterusername)) return false; if (!validRequired(theForm.password,enterpassword)) return false; return true; } function CancelClick() { history.go(-1); } function setFocus() { document.forms[0].username.focus(); } function trim(strText) { // this will get rid of leading spaces while (strText.substring(0,1) == ' ') strText = strText.substring(1, strText.length); // this will get rid of trailing spaces while (strText.substring(strText.length-1,strText.length) == ' ') strText = strText.substring(0, strText.length-1); return strText; }