function pvalidation(show) {
	var errvar = 0;
	errors = '';
	if ($('pfname').value.length < 2) {
		errvar++;
		errors += "Please enter parent/guardian's first name\n"; 
	}
	if ($('plname').value.length < 2) {
		errvar++;
		errors += "Please enter parent/guardian's last name\n"; 
	}
	if (show == 1) {
		if (errvar != 0) {
			alert(errors);
		}
		else {
			addParent();
		}
	}
}
function addParent() {
	$('submit').disabled = true;
	$('list').innerHTML = '<img src="images/load.gif" />';
	loadingText('update');
	getvars = getAllInputs('form[general]');
	window.setTimeout(function() { ajaxCall('plist','app.php','page=addparent&'+getvars); },100);
}
function saveParent() {
	$('submit').disabled = true;
	$('list').innerHTML = '<img src="images/load.gif" />';
	loadingText('update');
	getvars = getAllInputs('form[general]');
	window.setTimeout(function() { ajaxCall('plist','app.php','page=saveparent&'+getvars); },100);
}
function removeParent(personid) {
	if (confirm("Are you sure you want to remove this parent/guardian?")) {
		$('list').innerHTML = '<img src="images/load.gif" />';
		loadingText('update');
		getvars = getAllInputs('form[general]');
		window.setTimeout(function() { ajaxCall('plist','app.php','page=removeparent&'+getvars+'&id='+personid); },100);
	}
}
function editPerson(personid,mtype) {
	ajaxCall('pinfo'+mtype,'app.php','page=personinfo&'+getvars+'&id='+personid);
}
