function validate(form) {
	if(form.elements["name"].value == "")	{
		alert('Please enter Contact Name');
		return false;
	}
	if(form.elements["email"].value != "")	{
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.elements["email"].value))){
			alert('Please enter a valid e-mail address.')
			return false;
		}
	}
	if(form.elements["comments"].value == "")	{
		alert('Please enter a comment or question.');
		return false;
	}
}
function validateAddPhoto(form) {
	if(form.name.value.length==0){
		alert('Please enter a name.');
		return false;
	}
	if(form.image.value.length==0){
		alert('Please upload an image.');
		return false;
	}
	/*
	if(form.price.value.length==0){
		alert('Please enter a price.');
		return false;
	}
	// Check for valid price
	else {
		var Chars = "0123456789.,$";
		for (var i=0; i<form.price.value.length; i++) {
			if (Chars.indexOf(form.price.value.charAt(i)) == -1) {
				alert("Invalid Character(s)\n\nOnly numbers (0-9), a dollar sign, a comma, and a period are allowed in this field.");
				return false;
			}
		}
	}
	*/
	if(form.description.value.length==0){
		alert('Please enter a description.');
		return false;
	}
	else if(form.description.value.length>255){
		alert('Please shorten your ' + sType + '\'s description by ' + (form.description.value.length - 255) + ' character(s).');
		return false;
	}
	if(form.categories.value.length==0){
		alert('Please add at least one category.');
		return false;
	}
}
function validateEditProduct(form) {
	var sType = form.kind.value;
	if(form.name.value.length==0){
		alert('Please name your ' + sType + '.');
		return false;
	}
	/*
	if(form.price.value.length==0){
		alert('Please price your ' + sType + '.');
	return false;
	}
	// Check for valid price
	else {
		var Chars = "0123456789.,$";
		for (var i = 0; i < form.price.length; i++) {
			if (Chars.indexOf(form.price.charAt(i)) == -1) {
				alert("Invalid Character(s)\n\nOnly numbers (0-9), a dollar sign, a comma, and a period are allowed in this field.");
				return false;
			}
		}
	}
	*/
	if(form.description.value.length==0){
		alert('Please describe your ' + sType + '.');
		return false;
	}
	else if(form.description.value.length>255){
		alert('Please shorten your ' + sType + '\'s description by ' + (form.description.value.length - 255) + ' character(s).');
		return false;
	}
}
function checkLength(textarea) {
	if(textarea.value.length>255){
		alert('You reached the maximum amount of letters allowed for the description.  Please use a shorter description.  Your have ' + (textarea.value.length - 255) + ' character(s) too many.');
		return false;
	}
}
function charLeft(textarea, maxlength) {
	charRemaining = maxlength - textarea.value.length;
	document.getElementById(textarea.id+'-remaining').innerHTML = (charRemaining>=0)?charRemaining+" characters remaining":"<strong>"+(charRemaining*-1)+" characters too many</strong>"
}
