function round(number,X) {
	// rounds number to X decimal places, defaults to 2
	X = (!X ? 2 : X);
	return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
}

function getHtoWRatio(w, h) {
	//add the values from the questions

	var waist = new Number(w);
	var hip = new Number (h);
	var error = false;
	
	if (isNaN(waist) || waist == 0) {
		alert('Please enter a number greater than 0 for Waist Circumference.');
		document.quiz.waist.focus();
		error = true;
	}
	if (isNaN(hip) || hip == 0) {
		alert('Please enter a number greater than 0 for Hip Circumference.');
		document.quiz.hip.focus();
		error = true;
	}	
	
	if (error == false) {
			waistToHipRatio = w/h;
			document.quiz.results.value = round(waistToHipRatio,2);
			//top.location = '#results';
			location = '#results';
	}	
}

function resetTest() {

	document.quiz.waist.value = "";
	document.quiz.hip.value = "";
}
