function testTreatmentForm(theForm) {
	exprDate = new RegExp("([0-3]{1,1})([0-9]{1,1})/([0-1]{1,1})([0-9]{1,1})/([1-2]{1,1})([0-9]{1,1})([0-9]{1,1})([0-9]{1,1})");
	document.getElementById("treatmentError").innerHTML = "";
	errorCount = 0;
	if (theForm.treatmentFirstName.value == "") {
		document.getElementById("xFirst").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xFirst").style.border = "0 none";
	}
	if (theForm.treatmentLastName.value == "") {
		document.getElementById("xLast").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xLast").style.border = "0 none";
	}
	if (theForm.treatmentEmail.value == "") {
		document.getElementById("xEmail").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xEmail").style.border = "0 none";
	}
	if (theForm.treatmentPhone.value == "") {
		document.getElementById("xPhone").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xPhone").style.border = "0 none";
	}
	if (theForm.treatmentAddress.value == "") {
		document.getElementById("xAddress").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xAddress").style.border = "0 none";
	}
	if (theForm.treatmentSuburb.value == "") {
		document.getElementById("xSuburb").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xSuburb").style.border = "0 none";
	}
	if (theForm.treatmentState.value == "0") {
		document.getElementById("xState").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xState").style.border = "0 none";
	}
	if (theForm.treatmentPostcode.value == "") {
		document.getElementById("xPostcode").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xPostcode").style.border = "0 none";
	}
	if (theForm.treatmentCountry.value == "0") {
		document.getElementById("xCountry").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xCountry").style.border = "0 none";
	}
	if (theForm.treatmentDOB.value == "" || !exprDate.test(theForm.treatmentDOB.value)) {
		document.getElementById("xDOB").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xDOB").style.border = "0 none";
	}
	if (!theForm.treatmentNoSex[0].checked && !theForm.treatmentNoSex[1].checked) {
		document.getElementById("xNoSex").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xNoSex").style.border = "0 none";
	}
	if (!theForm.treatmentCurve[0].checked && !theForm.treatmentCurve[1].checked) {
		document.getElementById("xCurve").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xCurve").style.border = "0 none";
	}
	if (theForm.treatmentLesion.value == "0") {
		document.getElementById("xLesion").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xLesion").style.border = "0 none";
	}
	if (!theForm.treatmentAutoDys[0].checked && !theForm.treatmentAutoDys[1].checked) {
		document.getElementById("xAutoDys").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xAutoDys").style.border = "0 none";
	}
	if (!theForm.treatmentNitrates[0].checked && !theForm.treatmentNitrates[1].checked) {
		document.getElementById("xNitrates").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xNitrates").style.border = "0 none";
	}
	if (!theForm.treatmentCaverject[0].checked && !theForm.treatmentCaverject[1].checked) {
		document.getElementById("xCaverject").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xCaverject").style.border = "0 none";
	}
	if (!theForm.treatmentInjection[0].checked && !theForm.treatmentInjection[1].checked) {
		document.getElementById("xInjection").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xInjection").style.border = "0 none";
	}
	if (!theForm.treatmentLevitra[0].checked && !theForm.treatmentLevitra[1].checked) {
		document.getElementById("xLevitra").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xLevitra").style.border = "0 none";
	}
	if (!theForm.treatmentCialis[0].checked && !theForm.treatmentCialis[1].checked) {
		document.getElementById("xCialis").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xCialis").style.border = "0 none";
	}
	if (!theForm.treatmentViagra[0].checked && !theForm.treatmentViagra[1].checked) {
		document.getElementById("xViagra").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xViagra").style.border = "0 none";
	}
	if (!theForm.treatmentSpray[0].checked && !theForm.treatmentSpray[1].checked) {
		document.getElementById("xNasal").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xNasal").style.border = "0 none";
	}
	if (theForm.treatmentAppointDate.value == "" || !exprDate.test(theForm.treatmentAppointDate.value)) {
		document.getElementById("xAppoint").style.border = "1px solid #cc0000";
		errorCount++;
	} else {
		document.getElementById("xAppoint").style.border = "0 none";
	}
	if (errorCount > 0) {
		document.getElementById("treatmentError").innerHTML = "There " + (errorCount>1?"are":"is") + " " + errorCount + " field" + (errorCount>1?"s":"") + " that need" + (errorCount>1?"":"s") + " correcting.<br />Please fill out all required fields correctly";
		return false;
	}
	else {
		return true;
	}
}

function showOther(theSelect,theIndex,theHide) {
	if ( theSelect.selectedIndex == theIndex ) {
		document.getElementById(theHide).style.display = "block";
	} else {
		document.getElementById(theHide).style.display = "none";
	}
}

function showOtherRadio(theAction) {
	if ( theAction == true ) {
		for (var i=1; i<arguments.length; i++) {
			document.getElementById(arguments[i]).style.display = "block";
		}
	} else {
		for (var i=1; i<arguments.length; i++) {
			document.getElementById(arguments[i]).style.display = "none";
		}
	}
}

function treatmentOnload() {
	showOther(document.forms[0].treatmentBladder,5,'bladderOther');
	if (document.forms[0].treatmentRelationship[0].checked) showOtherRadio(true,'relationshipLength');
	if (document.forms[0].treatmentCaverject[0].checked) showOtherRadio(true,'caverject1','caverject2','caverject3');
	if (document.forms[0].treatmentInjection[0].checked) showOtherRadio(true,'injection1','injection2','injection3');
	if (document.forms[0].treatmentLevitra[0].checked) showOtherRadio(true,'levitra1','levitra2','levitra3');
	if (document.forms[0].treatmentCialis[0].checked) showOtherRadio(true,'cialis1','cialis2','cialis3');
	if (document.forms[0].treatmentViagra[0].checked) showOtherRadio(true,'viagra1','viagra2','viagra3');
	if (document.forms[0].treatmentSpray[0].checked) showOtherRadio(true,'nasal1','nasal2','nasal3');
}

window.onload = treatmentOnload;