function checkItNum(evt) { 
	evt = (evt) ? evt : window.event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if (charCode < 48 || charCode > 57) {
		//alert("This field accepts numbers only."); //You can Comment this line out if you do not want to alert the user.
		status = "This field accepts numbers only."
		return false
	}
	status = ""
	return true
}

function checkItTime(evt) { 
	evt = (evt) ? evt : window.event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if ((charCode < 48 || charCode > 58) && (charCode != 65) && (charCode != 97) && (charCode != 77) && (charCode != 109) && (charCode != 80) && (charCode != 112)){
		//alert("This field accepts numbers only."); //You can Comment this line out if you do not want to alert the user.
		status = "This field accepts time notation characters only."
		return false
	}
	status = ""
	return true
}

function checkItDate(evt) { 
	evt = (evt) ? evt : window.event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if (charCode < 47 || charCode > 57) {
		//alert("This field accepts numbers only."); //You can Comment this line out if you do not want to alert the user.
		status = "This field accepts date notation characters only. (numerals and slash)"
		return false
	}
	status = ""
	return true
}

function checkItMoney(fld,evt) { 
	evt = (evt) ? evt : window.event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if (fld.value.substr(0,1) == '0') fld.value = '';
	if (((charCode < 48 || charCode > 57) && charCode != 46) || (charCode == 46 && fld.value.indexOf('.') != -1) || (fld.value.indexOf('.') != -1 && fld.value.substring(fld.value.indexOf('.'),fld.value.length).length > 2)) {
		//alert("This field accepts numbers only."); //You can Comment this line out if you do not want to alert the user.
		status = "This field accepts numbers and one decimal only."
		return false
	}
	status = ""
	return true
}

function checkItAlpha(evt) { 
	evt = (evt) ? evt : window.event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if ((charCode != 32 && charCode < 65) || (charCode > 122) || (charCode > 90 && charCode < 97)) {
		//alert("This field accepts alpha characters only."); //You can Comment this line out if you do not want to alert the user.
		status = "This field accepts alpha characters only."
		return false
	}
	status = ""
	return true
}

function checkItAlphaNum(evt) { 
	evt = (evt) ? evt : window.event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if ((charCode != 32 && charCode < 48) || (charCode > 57 && charCode < 65) || (charCode > 90 && charCode < 97) || (charCode > 122)) {
		//alert("This field accepts alphanumeric characters only."); //You can Comment this line out if you do not want to alert the user.
		status = "This field accepts alphanumeric characters only."
		return false
	}
	status = ""
	return true
}

function checkItAlphaNumCr(evt) { 
	evt = (evt) ? evt : window.event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if ((charCode != 13 && charCode != 32 && charCode < 48) || (charCode > 57 && charCode < 65) || (charCode > 90 && charCode < 97) || (charCode > 122)) {
		//alert("This field accepts alphanumeric characters and line breaks only."); //You can Comment this line out if you do not want to alert the user.
		status = "This field accepts alphanumeric characters and line breaks only."
		return false
	}
	status = ""
	return true
}

function checkItEmail(evt) { 
	evt = (evt) ? evt : window.event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if ((charCode < 45) || (charCode > 122) || (charCode == 47) || (charCode > 57 && charCode < 64) || (charCode > 64 && charCode < 95) || (charCode > 95 && charCode < 97)){
		//alert("This field accepts email-valid characters only."); //You can Comment this line out if you do not want to alert the user.
		status = "This field accepts email-valid characters only."
		return false
	}
	status = ""
	return true
}

function validateEmail(val){
	if (val == null || val == '') {
		return false
	} else {
		var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;									// not valid
		var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;		// valid
		if (!reg1.test(val) && reg2.test(val) && val.length>=7)	{						// if syntax is valid
			status = ""
			return true;
		} else {
			//alert('Please verify your email is in the format: \'user@domain.ext\'.');
			status = "Please verify your email is in the format: \'user@domain.ext\'.";
			return false
		}
	}
}

function chkFields() {
	if (document.frmControlPanel.addFeed.checked) {
		var sn = document.frmControlPanel.sitename.value.toLowerCase().replace(' ','');
		var su = document.frmControlPanel.siteURL.value;
		var strErr = "";
		if (sn == "sitename" || sn.length==0) strErr += "You must enter a site name.\n";
		if (su == "http://" || su == "https://" || su.length<9 || (su.substring(0,4)=="http" && su.length>=9)) strErr += "You must enter a site URL beginning with \'http://\' or \'https://\'.\n";
		if (strErr.length>0) {
			alert(strErr);
			return false
		} else return true
	} else {
		document.frmControlPanel.sitename.value = '';
		document.frmControlPanel.siteURL.value = '';
		return true 
	}
}