function validate_email(field,alerttxt) {
	with (field) {
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			return notify(alerttxt, false);
		} else {
			return true;
		}
	}
}

function validate_required(field,alerttxt) {
	with (field) {
		if (value==null||value=="") { 
			return notify(alerttxt, false); 
		} else { 
			return true; 
		}
	}
}

function validate_combo(field,alerttxt) {
	with (field) {
		if (value=="0") { 
			return notify(alerttxt, false);
		} else { 
			return true; 
		}
	}
}

function notify(alerttxt, returnval) {
	$('div#notification').addClass('error');
	$('div#notification').html(alerttxt);
	return returnval;
}

function scrollto(field) {
	$('html').animate({
		scrollTop: $(field).offset().top - 100 }, 1000);
	field.focus();
}

function validate_form(thisform) {
	with (thisform) {
		if (validate_required(NAME,"Please enter a name.")==false) {
			scrollto(NAME);return false;
		}
		if (validate_email(EMAIL,"Please enter a valid email address.")==false) {
			scrollto(EMAIL);return false;
		}
	}
}
