<%@ include file="/includes.jsp"%><%@ include file="printstyles.css"%>
<tiles:importAttribute />
<div class="container">
	<div class="sectionSubPageTop">
		<h2>Assessment Milestones</h2>
		<div class="fieldSet2Column" style="text-align: left;">
			<span class="inputLabel">Patient's baseline toxicity and performance status are recorded accurately.<br/>
			The patient toxicity assessment needs to be completed prior to each chemotherapy cycle.</span>
		</div>
		<div class="fieldSet2Column" style="text-align: left;">
			<p>This toxicity assessment form incorporates World Health Organisation Toxicity Assessment Criteria and the National Cancer Institute Common Terminology Criteria for Adverse Events Version 4.0 Published: May 28, 2009 (v4.03: June 14, 2010).</p>
			<p>For further details of the grading system please refer to the guidance notes through
				following the link below.</p>
		</div>
		<div class="fieldSet2Column">
			<span class="inputLabel"><a href="../emdt/tiles/forms/ChemoG1/ChemoF4NN/Guidance%20notes%20for%20patient%20toxicity%20assessment%20Nov%202016.pdf" target="_blank">Instructions for Toxicity Assessment
					<img src="../emdt/images/16x16/pdf.gif" title="Click to open instructions" alt="PDF" />
			</a></span>
		</div>
		<div class="fieldSet2Column">
			<hr />
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Patient Treatment Stage:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <tiles:insertTemplate
					template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName"
						value="Chemo_Patient_Treatment_Stage" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1PatStage" />
				</tiles:insertTemplate> </span>
		</div>

		<div class="fieldSet2Column clearfix"></div>

		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Cycle nbr:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <tiles:insertTemplate
					template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="Chemo_Cycle_Nbr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1PatCycle" />
				</tiles:insertTemplate> </span>
		</div>
		<div class="fieldSet2Column clearfix"></div>

		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Day nbr:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <tiles:insertTemplate
					template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="Chemo_Day_Nbr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1PatDay" />
				</tiles:insertTemplate> </span>
		</div>
	</div>



	<div class="sectionSubPageTop">
		<h2>Toxicity Assessment</h2>

		<table id="toxicity_table">
			<tr>
				<th>Toxicity</th>
				<th>Grade (0 to 4)</th>
				<th>Comment</th>
			</tr>
		</table>

		<div class="tox_left_col">
			<span class="tox_label">Performance status:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_ggyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1PerfStat" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtPerf" />
			</tiles:insertTemplate>
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Nausea:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_ggyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1Nausea" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtNaus" />
			</tiles:insertTemplate>
		</div>

		<div class="tox_left_col">
			<span class="tox_label">Vomiting:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_ggyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1Vomit" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtVom" />
			</tiles:insertTemplate>
		</div>

		<div class="tox_left_col">
			<span class="tox_label">Mucositis / stomatitis:</span>
		</div>
		<div class="tox_mid_col">
			<div class="gyyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_gyyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1Muco" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtMuco" />
			</tiles:insertTemplate>
		</div>

		<div class="tox_left_col">
			<span class="tox_label">Diarrhoea:</span>
		</div>
		<div class="tox_mid_col">
			<div class="gyyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_gyyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1Diar" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtDiar" />
			</tiles:insertTemplate>
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Constipation:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_ggyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1Const" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtCons" />
			</tiles:insertTemplate>
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Fever/Pyrexia/Infection:</span>
		</div>
		<div class="tox_mid_col">
			<div class="grrrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_grrrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1Fever" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtFever" />
			</tiles:insertTemplate>
		</div>


		<div class="tox_left_col">
			<span class="tox_label">PPE:</span>
		</div>
		<div class="tox_mid_col">
			<div class="gyyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_gyyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1PPE" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtPPE" />
			</tiles:insertTemplate>
		</div>



		<div class="tox_left_col">
			<span class="tox_label">Fatigue:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_ggyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1Fatig" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtFatig" />
			</tiles:insertTemplate>
		</div>



		<div class="tox_left_col">
			<span class="tox_label">Pain:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_ggyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1Pain" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtPain" />
			</tiles:insertTemplate>
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Anorexia:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_ggyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1Anor" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtAnor" />
			</tiles:insertTemplate>
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Dyspnoea:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_ggyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1Dyps" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtDysp" />
			</tiles:insertTemplate>
		</div>



		<div class="tox_left_col">
			<span class="tox_label">Alopecia:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldOptionsMapName" value="TAF_ggyrr" />
					<tiles:putAttribute name="fieldInputType" value="5" />
					<tiles:putAttribute name="fieldName" value="CF4NP1Alop" />
				</tiles:insertTemplate>
			</div>
		</div>
		<div class="tox_right_col">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldName" value="CF4NP1CmtAlop" />
			</tiles:insertTemplate>
		</div>



	<div class="tox_left_col">
		<span class="tox_label">Rash:</span>
	</div>
	<div class="tox_mid_col">
		<div class="gyyrr">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldOptionsMapName" value="TAF_gyyrr" />
				<tiles:putAttribute name="fieldInputType" value="5" />
				<tiles:putAttribute name="fieldName" value="CF4NP1Rash" />
			</tiles:insertTemplate>
		</div>
	</div>
	<div class="tox_right_col">
		<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
			<tiles:putAttribute name="fieldName" value="CF4NP1CmtRash" />
		</tiles:insertTemplate>
	</div>



	<div class="tox_left_col">
		<span class="tox_label">Chest pain:</span>
	</div>
	<div class="tox_mid_col">
		<div class="grrrr">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldOptionsMapName" value="TAF_grrrr" />
				<tiles:putAttribute name="fieldInputType" value="5" />
				<tiles:putAttribute name="fieldName" value="CF4NP1Chest" />
			</tiles:insertTemplate>
		</div>
	</div>
	<div class="tox_right_col">
		<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
			<tiles:putAttribute name="fieldName" value="CF4NP1CmtChest" />
		</tiles:insertTemplate>
	</div>


	<div class="tox_left_col">
		<span class="tox_label">Neuropathy:</span>
	</div>
	<div class="tox_mid_col">
		<div class="gyrrr">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldOptionsMapName" value="TAF_gyrrr" />
				<tiles:putAttribute name="fieldInputType" value="5" />
				<tiles:putAttribute name="fieldName" value="CF4NP1Neuro" />
			</tiles:insertTemplate>
		</div>
	</div>
	<div class="tox_right_col">
		<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
			<tiles:putAttribute name="fieldName" value="CF4NP1CmtNeur" />
		</tiles:insertTemplate>
	</div>

	<div class="tox_left_col">
		<span class="tox_label">Bleeding or bruising:</span>
	</div>
	<div class="tox_mid_col">
		<div class="grrrr">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldOptionsMapName" value="TAF_grrrr" />
				<tiles:putAttribute name="fieldInputType" value="5" />
				<tiles:putAttribute name="fieldName" value="CF4NP1Bleed" />
			</tiles:insertTemplate>
		</div>
	</div>
	<div class="tox_right_col">
		<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
			<tiles:putAttribute name="fieldName" value="CF4NP1CmtBleed" />
		</tiles:insertTemplate>
	</div>

	<div class="tox_left_col">
		<span class="tox_label">Urinary disorder:</span>
	</div>
	<div class="tox_mid_col">
		<div class="gyyrr">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldOptionsMapName" value="TAF_gyyrr" />
				<tiles:putAttribute name="fieldInputType" value="5" />
				<tiles:putAttribute name="fieldName" value="CF4NP1Urin" />
			</tiles:insertTemplate>
		</div>
	</div>
	<div class="tox_right_col">
		<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
			<tiles:putAttribute name="fieldName" value="CF4NP1CmtUrin" />
		</tiles:insertTemplate>
	</div>

	<div class="tox_left_col">
		<span class="tox_label">Ocular/Eye problems:</span>
	</div>
	<div class="tox_mid_col">
		<div class="gyrrr">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldOptionsMapName" value="TAF_gyrrr" />
				<tiles:putAttribute name="fieldInputType" value="5" />
				<tiles:putAttribute name="fieldName" value="CF4NP1Eye" />
			</tiles:insertTemplate>
		</div>
	</div>
	<div class="tox_right_col">
		<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
			<tiles:putAttribute name="fieldName" value="CF4NP1CmtEye" />
		</tiles:insertTemplate>
	</div>



	<div class="tox_left_col">
		<span class="tox_label">Other:</span>
	</div>
	<div class="tox_mid_col">
		<div class="grrrr">
			<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
				<tiles:putAttribute name="fieldOptionsMapName" value="TAF_grrrr" />
				<tiles:putAttribute name="fieldInputType" value="5" />
				<tiles:putAttribute name="fieldName" value="CFP1Other" />
			</tiles:insertTemplate>
		</div>
	</div>
	<div class="tox_right_col">
		<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
			<tiles:putAttribute name="fieldName" value="CF4NP1CmtOther" />
		</tiles:insertTemplate>
	</div>

	<div class="fieldSet2Column">
		Assessment Grading:
		<div id="assessmentGrading">
		<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
			<tiles:putAttribute name="fieldName" value="CF4NP1AssessmentGrading" />
		</tiles:insertTemplate></div>
	</div>

</div>



<div class="sectionSubPageTop">
	<h2>Other Information</h2>
	

	<div class="fieldSetLeftColumn">
		<span class="inputLabel">Has the patient been admitted to
			hospital or been seen by a GP since treatment was prescribed?</span>
	</div>
	<div class="fieldSetRightColumn">
		<span class="inputControl"> 
		<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
			<tiles:putAttribute name="fieldOptionsMapName"
				value="YesNo" />
			<tiles:putAttribute name="fieldInputType" value="5" />
			<tiles:putAttribute name="fieldName" value="CF4NP1PatAdm" />
		</tiles:insertTemplate> </span>
	
	</div>
	<div class="fieldSet2Column">
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Reason:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldName" value="CF4NP1PatAdmReas" />
					<tiles:putAttribute name="colWidth" value="50" />
					<tiles:putAttribute name="colHeight" value="1" />
					<tiles:putAttribute name="fieldType" value="101" />
				</tiles:insertTemplate> </span>

		</div>
	</div>
	<div class="fieldSet2Column"></div>

	<div class="fieldSet2Column">
		<hr />
	</div>

	<div class="fieldSetLeftColumn">
		<span class="inputLabelAbove">Relevant tumour marker taken:</span>
	</div>
	<div class="fieldSetRightColumn">
		<span class="inputControl"> 
		<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
			<tiles:putAttribute name="fieldOptionsMapName"
				value="YesNo" />
			<tiles:putAttribute name="fieldInputType" value="5" />
			<tiles:putAttribute name="fieldName" value="CF4NP1RelTumMk" />
		</tiles:insertTemplate> </span>
	</div>
	<div class="fieldSet2Column">
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Detail:</span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputControl"> <tiles:insertTemplate
					template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldName" value="CF4NP1RelTumDtl" />
					<tiles:putAttribute name="colWidth" value="50" />
					<tiles:putAttribute name="colHeight" value="1" />
					<tiles:putAttribute name="fieldType" value="101" />
				</tiles:insertTemplate> </span>
		</div>
	</div>
	<div class="fieldSet2Column">
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Allergies:</span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputControl">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldName" value="CF4NP1Allergy" />
					<tiles:putAttribute name="colWidth" value="50" />
					<tiles:putAttribute name="colHeight" value="1" />
					<tiles:putAttribute name="fieldType" value="101" />
				</tiles:insertTemplate> </span>
		</div>
	</div>
	
	
		<div class="fieldSet2Column">
			<div class="fieldSetLeftColumn">
				<span class="inputLabel">Additional Information:</span>
			</div>
			<div class="fieldSetLeftColumn">
			<span class="inputControl">
				<tiles:insertTemplate template='../../printFieldRenderer.jsp'>
					<tiles:putAttribute name="fieldName" value="CF4NAddInf" />
					<tiles:putAttribute name="colWidth" value="50" />
					<tiles:putAttribute name="colHeight" value="1" />
					<tiles:putAttribute name="fieldType" value="101" />
				</tiles:insertTemplate> </span>
			</div>
		</div>
		
		<div class="fieldSet2Column">
			<div class="fieldSetLeftColumn">
				<span class="inputLabel">Last updated by:</span>
			</div>
			<div class="fieldSetLeftColumn">
				<span class="inputControl"><c:out value="${consultationNoteForm.view.note.modifiedByUser.name}"/></span>
			</div>
		</div>
		<div class="fieldSet2Column">
			<div class="fieldSetLeftColumn">
				<span class="inputLabel">Last updated:</span>
			</div>
			<div class="fieldSetLeftColumn">
				<span class="inputControl"><fmt:formatDate value="${consultationNoteForm.view.note.modifiedDate}" pattern="dd MMM yyyy HH:mm" /></span>
			</div>
		</div>
</div>
</div>
<script type="text/javascript">
//  	CF4NP1AssessmentGrading
//		CF4NP1TempWarning
//		CF4NP1SPO2Warning

/*
Assessment Grading: Calculated as follows
Red [Must be seen and reviewed by senior medical staff prior to treatment] = Patients flagging up 2x Ambers (or more) equates to a RED. As does any red outcome.
Amber [Review by senior nurse / medical staff]= 1x Amber AND / OR Patient has been seen by GP / admitted to hospital (Yes)
Green [Proceed with treatment] = All green AND No to Patient has been seen by GP


 */

 
 // Names of radio buttons which are coloured in sequence 0=green, 1=green, 2=yellow, 3=red, 4=red etc
var ggyrr_field_names = ["CF4NP1PerfStat", "CF4NP1Nausea", "CF4NP1Vomit", "CF4NP1Const", "CF4NP1Fatig", "CF4NP1Pain", "CF4NP1Anor", "CF4NP1Dyps", "CF4NP1Alop"];
var gyyrr_field_names = ["CF4NP1Muco", "CF4NP1Diar", "CF4NP1PPE", "CF4NP1Rash", "CF4NP1Urin"];
var grrrr_field_names = ["CF4NP1Fever", "CF4NP1Chest", "CF4NP1Bleed", "CFP1Other"];
var gyrrr_field_names = ["CF4NP1Neuro", "CF4NP1Eye"];

// Determine colour of a radio button from its name and numeric value
//   returns: colour name as string, e.g. 'red', 'green', 'amber', or 'unknown' as an error case.
//
function get_colour (name, value)	{
	
	// do the easy short cuts first, since all 0 is green and all 3 or 4 is red
	if (value == 0)
		return 'green';
	
	if (value == 3 || value == 4)
		return 'red';

	// all radios in this sequence are red apart from value 0
	for (i = 0; i < grrrr_field_names.length; i++)	{
		if (name.indexOf(grrrr_field_names[i]) != -1)	{
			return 'red';
		}
	}

	for (i = 0; i < gyrrr_field_names.length; i++)	{
		if (name.indexOf(gyrrr_field_names[i]) != -1)	{
			if (value == 2)		{
				return 'red';
			}
			return 'amber';
		}
	}
		
	if (value == 2)		{
		return 'amber';
	}
	
	// only 1 to distinguish now

	for (i = 0; i < ggyrr_field_names.length; i++)	{
		if (name.indexOf(ggyrr_field_names[i]) != -1)	
			return 'green';
	}
	for (i = 0; i < gyyrr_field_names.length; i++)	{
		if (name.indexOf(gyyrr_field_names[i]) != -1)	
		return 'amber';
	}
	
	return 'unknown';
}

var numred = '';
var numamber = '';
var numgreen = '';

// calculate assessment grading when any of the toxicity radios are clicked
$('.grade > input:radio').click( function() {
	setAssessmentGrading();
});
// calculate assessment grading when the 'patient admitted to hospital or seen gp' radio is clicked
$('#CF4NP1PatAdm0').click( function()	{
	setAssessmentGrading();
});
$('#CF4NP1PatAdm1').click( function()	{
	setAssessmentGrading();
});

// calculate assessment grading when page initially loads
$( document ).ready(function() {
	setAssessmentGrading();
//	 checkAndSetTempWarning();
//	 checkAndSetOxygenWarning ();
});
//
// Calculate and dislay the assessment grading.
// Based on number of colours selected and state of 'patient admitted to hospital' radio button, determine appropriate warning message and display it in a DIV and a hidden field.
//
function setAssessmentGrading ()	{	
	var colour = '';
	numred = 0;
	numgreen = 0;
	numamber = 0;
	
	$('.grade > input[type=radio]:checked').each(function ()	{
			colour = get_colour(this.name, this.value);
			if (colour == 'red')
				numred++;
			if (colour == 'green')
				numgreen++;
			if (colour == 'amber')
				numamber++;
	});

	if (numred > 0 || numamber >= 2)	{
		// red alert
		$('#CF4NP1AssessmentGrading').val('Red: Must be seen and reviewed by senior medical staff prior to treatment');
		$('#assessmentGrading').text('Red: Must be seen and reviewed by senior medical staff prior to treatment');
		$('#assessmentGrading').css('color', 'red');
	}
	else if (numamber == 1 || $('#CF4NP1PatAdm0').prop("checked") == true) 	{
		$('#CF4NP1AssessmentGrading').val( 'Amber: Review by senior nurse / medical staff');
		$('#assessmentGrading').text( 'Amber: Review by senior nurse / medical staff');
		$('#assessmentGrading').css('color', 'orange');
	}
	else if (numamber == 0 && numred == 0 && $('#CF4NP1PatAdm0').prop("checked") != true && numgreen > 0)	{
		$('#CF4NP1AssessmentGrading').val ( 'Green: Proceed with treatment' );
		$('#assessmentGrading').text ( 'Green: Proceed with treatment' );
		$('#assessmentGrading').css('color', 'green');
	}
}
 
</script>