function CalculateVxy() {
	message = "";
	also = "";
	linebreak = "";
	v0_x = document.getElementById('v0_x').value;
	v0_y = document.getElementById('v0_y').value;
	angle_x = document.getElementById('angle_x').value;
	angle_y = document.getElementById('angle_y').value;
	vx0 = Math.round(v0_x * 1000 * Math.cos(angle_x * Math.PI / 180)) / 1000;
	vy0 = Math.round(v0_y * 1000 * Math.sin(angle_y * Math.PI / 180)) / 1000;
	document.getElementById('vx0').innerHTML = vx0;
	document.getElementById('vy0').innerHTML = vy0;
	
	if (v0_x != v0_y) {
		message = "The v0 used in both equations should be the same.";
		also = " also ";
		linebreak = "\n";
	}
	if (angle_x != angle_y) {
		message = message + linebreak + "The angle used in both equations should" + also + "be the same.";
	}
	
	if (v0_x != v0_y || angle_x != angle_y) {
		message = message + "\n" + "Make the correction(s) and re-calculate before move on to the next step.";
		alert (message);
	}
}

function CalculateTmax() {
	message = "";
	also = "";
	linebreak = "";
	vy0 = document.getElementById('vy0').innerHTML;
	vy0_t = document.getElementById('vy0_t').value;
	tmax = Math.round(1000 * vy0_t / 9.8) / 1000;
	document.getElementById('tmax').innerHTML = tmax;
	
	if (vy0 != vy0_t) {
		message = "The vy0 used in this equation should be the same as the vy0 obtained above.";
		message = message + "\n" + "Make the correction(s) and re-calculate before move on to the next step.";
		alert (message);
	}
}

function CalculateTtotal() {
	message = "";
	also = "";
	linebreak = "";
	tmax = document.getElementById('tmax').innerHTML;
	tmax_ttotal = document.getElementById('tmax_ttotal').value;
	ttotal = 2 * tmax_ttotal;
	document.getElementById('ttotal').innerHTML = ttotal;
	
	if (tmax != tmax_ttotal) {
		message = "The tmax used in this equation should be the same as the tmax obtained above.";
		message = message + "\n" + "Make the correction(s) and re-calculate before move on to the next step.";
		alert (message);
	}
}

function CalculateDx() {
	message = "";
	also = "";
	linebreak = "";
	ttotal = document.getElementById('ttotal').innerHTML;
	ttotal_dx = document.getElementById('ttotal_dx').value;
	vx0 = document.getElementById('vx0').innerHTML;
	vx0_dx = document.getElementById('vx0_dx').value;

	dx = Math.round(1000 * vx0_dx * ttotal_dx) / 1000;
	document.getElementById('dx').innerHTML = dx;
	
	if (vx0 != vx0_dx) {
		message = "The vx0 used in this equation should be the same as the vx0 obtained in the first step above.";
		also = " also ";
		linebreak = "\n";
	}
	if (ttotal != ttotal_dx) {
		message = message + linebreak + "The ttotal used in this equations should" + also + "be the same as the ttotal obtained above.";
	}
	
	if (vx0 != vx0_dx || ttotal != ttotal_dx) {
		message = message + "\n" + "Make the correction(s) and re-calculate.";
		alert (message);
	}
}