var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\'\|"]/;
function dodacheck(val) {
	var strPass = val.value;
	var strLength = strPass.length;
	var lchar = val.value.charAt((strLength) - 1);
	if(lchar.search(mikExp) != -1) {
		var tst = val.value.substring(0, (strLength) - 1);
		val.value = tst;
   		}
	
	}
function checknumber(field) {
	var valid = "0123456789";
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
		alert("Invalid entry! Only numbers are accepted!");
		field.focus();
		field.select();
		return false;
	}
}

function ignoreSpaces(string) {
	var temp = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
		temp += splitstring[i];
	return temp;
}
function checkemail(field) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(field.value)){
		return (true)
	}
	else { 
		alert("Invalid E-mail Address! Please re-enter.");
		field.focus();
		field.select();
		}
}
var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\'\|"]/;
function validate (theform) {
	//if(theform.uname.value.length <1) {
		//alert("Please enter a Login Name.");
		//return false;
		//}
	if (theform.passwd.value.length < 1) {
		alert("Please choose a password.");
		return false;
		}
	if (theform.firstname.value.length < 1) {
		alert("Please provide your first name.");
		return false;
		}
	if (theform.lastname.value.length < 1 ) {
		alert("Please provide your last name.");
		return false;
		}
	if (theform.schoolname.value.length < 1) {
		alert("Please enter the School Name.");
		return false;
		}
	if (theform.p1.value.length != 3 ) {
		alert("Invalid Entry! Please enter the Telephone number where you can be reached.");
		return false;
		}
	if (theform.p2.value.length != 3) {
		alert("Invalid Entry! Please enter the Telephone number where you can be reached.");
		return false;
		}
	if (theform.p3.value.length != 4) {
	alert("Invalid Entry! Please enter the Telephone number where you can be reached.");
		return false;
		}
	if (theform.email.value.length < 1 ) {
		alert("Please provide an email address.");
		return false;
		}		
	if(theform.filename.value.length < 1) {
		alert("Please enter the Name for the Planner.");
		return false;
		}
	if(theform.filename.value.search(mikExp) == -1) {
		return true;
		}
else {
	alert("Sorry, but the following characters\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rare not allowed!\n");
	form.select();
	form.focus();
	return false;
		} // end else
	return true;
}
