function clearAllFormElements(form)
{
    for (i=0; i < form.elements.length; i++)
    {
        switch (form.elements[i].type)
        {
            case 'radio':
                 form.elements[i].checked = false;
                 break;
            case 'text':
                 form.elements[i].value = ""
                 break;
         }
    }
}


function crcCheck()
{
    //question: How many separate CRC has the proband had?
    if (frm_CRC_calculator.separate_CRC[0].checked == true)
    {
        alert("You selected that the proband has had no separate CRC.  Please review your answer and fill in the appropriate information.");    
    }
    
    if (frm_CRC_calculator.separate_CRC[1].checked == true && frm_CRC_calculator.separate_CRC_age_two.value != "")
    {
        alert("You selected that the proband has had one separate CRC.  Please review your answer and fill in the appropriate information.");
        frm_CRC_calculator.separate_CRC_age_two.focus();
    }

    
    if (frm_CRC_calculator.separate_CRC[2].checked == true && frm_CRC_calculator.separate_CRC_age_one.value != "")
    {
        alert("You selected that the proband has had two or more separate CRCs.  Please review your answer and fill in the appropriate information.");
    }
}

function colonicAdenomaCheck()
{    
    //question: Has the proband had colonic adenoma(s)?
    if (frm_CRC_calculator.colonic_adenoma[1].checked == true  && frm_CRC_calculator.colonic_adenoma_age.value != "")
    {
        alert("You selected that the proband has not had colonic adenoma.  Please review your answer and fill in the appropriate information.");    
    }
}

function endometrialCheck()
{    
    //question: Has the proband had endometrial cancer?
    if (frm_CRC_calculator.endometrial[1].checked == true && frm_CRC_calculator.endometrial_age.value != "")
    {
        alert("You selected that the proband has not had endometrial cancer.  Please review your answer and fill in the appropriate information.");    
    }
}

function firstDegreeCRCCheck()
{    
    //question: How many first degree relatives have had CRC?
    if (frm_CRC_calculator.first_degree_crc[0].checked == true)
    {
        alert("You selected that the proband has had no first degree relatives with CRC.  Please review your answer and fill in the appropriate information.");    
    }
    
    if (frm_CRC_calculator.first_degree_crc[1].checked == true && frm_CRC_calculator.first_degree_crc_age_two.value != "")
    {
        alert("You selected that the proband has had one first degree relative with CRC.  Please review your answer and fill in the appropriate information.");
    }
    
    if (frm_CRC_calculator.first_degree_crc[2].checked == true && frm_CRC_calculator.first_degree_crc_age_one.value != "")
    {
        alert("You selected that the proband has had two or more first degree relatives with CRC.  Please review your answer and fill in the appropriate information.");
    }
}

function firstDegreeEndometrialCheck()
{    
    //question: How many first degree relatives have had endometrial cancer?
    if (frm_CRC_calculator.first_degree_endometrial[0].checked == true)
    {
        alert("You selected that the proband has had no first degree relatives with endometrial.  Please review your answer and fill in the appropriate information.");    
    }
    
    if (frm_CRC_calculator.first_degree_endometrial[1].checked == true && frm_CRC_calculator.first_degree_endometrial_age_two.value != "")
    {
        alert("You selected that the proband has had one first degree relative with endometrial cancer.  Please review your answer and fill in the appropriate information.");
    }
    
    if (frm_CRC_calculator.first_degree_endometrial[2].checked == true && frm_CRC_calculator.first_degree_endometrial_age_one.value != "")
    {
        alert("You selected that the proband has had two or more first degree relatives with endometrial cancer.  Please review your answer and fill in the appropriate information.");
    }
}

function secondDegreeCRCCheck()
{    
    //question: How many first degree relatives have had CRC?
    if (frm_CRC_calculator.second_degree_crc[0].checked == true)
    {
        alert("You selected that the proband has had no second degree relatives with CRC.  Please review your answer and fill in the appropriate information.");    
    }
    
    if (frm_CRC_calculator.second_degree_crc[1].checked == true && frm_CRC_calculator.second_degree_crc_age_two.value != "")
    {
        alert("You selected that the proband has had one second degree relative with CRC.  Please review your answer and fill in the appropriate information.");
    }
    
    if (frm_CRC_calculator.second_degree_crc[2].checked == true && frm_CRC_calculator.second_degree_crc_age_one.value != "")
    {
        alert("You selected that the proband has had two or more second degree relatives with CRC.  Please review your answer and fill in the appropriate information.");
    }
}


function secondDegreeEndometrialCheck()
{    
    //question: How many first degree relatives have had endometrial cancer?
    if (frm_CRC_calculator.second_degree_endometrial[0].checked == true)
    {
        alert("You selected that the proband has had no second degree relatives with endometrial.  Please review your answer and fill in the appropriate information.");    
    }
    
    if (frm_CRC_calculator.second_degree_endometrial[1].checked == true && frm_CRC_calculator.second_degree_endometrial_age_two.value != "")
    {
        alert("You selected that the proband has had one second degree relative with endometrial cancer.  Please review your answer and fill in the appropriate information.");
    }
    
    if (frm_CRC_calculator.second_degree_endometrial[2].checked == true && frm_CRC_calculator.second_degree_endometrial_age_one.value != "")
    {
        alert("You selected that the proband has had two or more second degree relatives with endometrial cancer.  Please review your answer and fill in the appropriate information.");
    }
}