// JavaScript Document

var divleft = "<div style='position:fixed;top:153px; right:0px;width:300px;background-color:#475761;border:#475761 2px solid;font-size:16px;color:#fff;min-height:20px;padding:10px;'>"

function checkFoundationCourse(submittingform)

{
	// The basic course total is 150, plus their chosen option
	var validationfailed = false;
	
	if ($("#SectionC_Option1").is(':checked')) 
	{
		// disable the other checkbox
		$("#CAT_Custom_159625").attr('disabled', 'disabled');
		// enable this one
		$("#CAT_Custom_159624").removeAttr('disabled');
	}
	
	if ($("#SectionC_Option2").is(':checked')) 
	{
		// disable the other checkbox
		$("#CAT_Custom_159624").attr('disabled', 'disabled');
		// enable this one
		$("#CAT_Custom_159625").removeAttr('disabled');
	}
	
	//Make sure they've selected a course for each of the options
	if ($("#CAT_Custom_159063_0").val()=="*")
		{ validationfailed = true; }
	if ($("#CAT_Custom_159621").val()=="*")
		{ validationfailed = true; }
	if ($("#CAT_Custom_159622").val()=="*")
		{ validationfailed = true; }
	if ($("#CAT_Custom_159623").val()=="*")
		{ validationfailed = true; }
		
	if (($("#SectionC_Option1").is(':checked'))  && ($("#CAT_Custom_159624").val()=="*"))
		{ validationfailed = true; }

	if (($("#SectionC_Option2").is(':checked'))  && ($("#CAT_Custom_159625").val()=="*"))
		{ validationfailed = true; }


	if ($("#CAT_Custom_159626").val()=="*")
		{ validationfailed = true; }
	if ($("#CAT_Custom_159627").val()=="*")
		{ validationfailed = true; }
	if ($("#CAT_Custom_159628").val()=="*")
		{ validationfailed = true; }
	if ($("#CAT_Custom_159629").val()=="*")
		{ validationfailed = true; }

		if(submittingform && validationfailed)
			{
				alert('Please ensure you have selected a course date and time for each of the modules you have ticked.');
				return false;
			}
}

function updateAdvancedCourseTotal(submittingform)
{
    var pointstotal = 0;
	var failvalidation=false;
    groupAmodule=false;
    groupBmodule=false;
    groupCmodule=false;
    groupDmodule=false;
    groupEmodule=false;
    groupFmodule=false;
	var myimg="";

if ($("#CAT_Custom_159210_0_Parent").is(':checked'))
        {pointstotal+=10;groupAmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159210_0").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
else {$("#CAT_Custom_159210_0").val("*");}

    if ($("#CAT_Custom_159210_1_Parent").is(':checked'))
        {pointstotal+=10;groupAmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159210_1").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159210_1").val("*");}
        
    if ($("#CAT_Custom_159210_2_Parent").is(':checked'))
        {pointstotal+=20;groupAmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159210_2").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159210_2").val("*");}
        
    if ($("#CAT_Custom_159211_0_Parent").is(':checked'))
        {pointstotal+=40;groupBmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159211_0").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159211_0").val("*");}

        
    if ($("#CAT_Custom_159211_1_Parent").is(':checked'))
        {pointstotal+=40;groupBmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159211_1").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159211_1").val("*");}

        
    if ($("#CAT_Custom_159211_2_Parent").is(':checked'))
        {pointstotal+=40;groupBmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159211_2").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159211_2").val("*");}

        
    if ($("#CAT_Custom_159211_3_Parent").is(':checked'))
        {pointstotal+=10;groupBmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159211_3").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159211_3").val("*");}

        
    if ($("#CAT_Custom_159211_4_Parent").is(':checked'))
        {pointstotal+=20;groupBmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159211_4").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159211_4").val("*");}

        
    if ($("#CAT_Custom_159211_5_Parent").is(':checked'))
        {pointstotal+=40;groupBmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159211_5").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159211_5").val("*");}

        
    if ($("#CAT_Custom_159211_6_Parent").is(':checked'))
        {pointstotal+=20;groupBmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159211_6").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159211_6").val("*");}

        
    if ($("#CAT_Custom_159212_0_Parent").is(':checked'))
        {pointstotal+=40;groupCmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159212_0").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159212_0").val("*");}

        
    if ($("#CAT_Custom_159212_1_Parent").is(':checked'))
        {pointstotal+=20;groupCmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159212_1").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159212_1").val("*");}

        
    if ($("#CAT_Custom_159213_0_Parent").is(':checked'))
        {pointstotal+=10;groupDmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159213_0").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159213_0").val("*");}

        
    if ($("#CAT_Custom_159213_1_Parent").is(':checked'))
        {pointstotal+=40;groupDmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159213_1").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159213_1").val("*");}

        
    if ($("#CAT_Custom_159213_2_Parent").is(':checked'))
        {pointstotal+=40;groupDmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159213_2").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159213_2").val("*");}

        
    if ($("#CAT_Custom_159214_0_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_0").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_0").val("*");}
	
	if ($("#CAT_Custom_159214_17_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_1").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_0").val("*");}

        
    if ($("#CAT_Custom_159214_1_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_1").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_1").val("*");}

        
    if ($("#CAT_Custom_159214_2_Parent").is(':checked'))
        {pointstotal+=40;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_2").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_2").val("*");}

        
    if ($("#CAT_Custom_159214_3_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_3").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_3").val("*");}

        
    if ($("#CAT_Custom_159214_4_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_4").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_4").val("*");}

        
    if ($("#CAT_Custom_159214_5_Parent").is(':checked'))
        {pointstotal+=20;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_5").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_5").val("*");}

        
    if ($("#CAT_Custom_159214_6_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_6").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_6").val("*");}

        
    if ($("#CAT_Custom_159214_7_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_7").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_7").val("*");}

        
    if ($("#CAT_Custom_159214_8_Parent").is(':checked'))
        {pointstotal+=40;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_8").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_8").val("*");}

        
    if ($("#CAT_Custom_159214_9_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_9").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_9").val("*");}

        
    if ($("#CAT_Custom_159214_10_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_10").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_10").val("*");}

        
    if ($("#CAT_Custom_159214_11_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_11").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_11").val("*");}


    if ($("#CAT_Custom_159214_12_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159214_12").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159214_12").val("*");}

    // Group F
    
        if ($("#CAT_Custom_159264_0_Parent").is(':checked'))
        {pointstotal+=20;groupFmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159264_0").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159264_0").val("*");}


        if ($("#CAT_Custom_159264_1_Parent").is(':checked'))
        {pointstotal+=20;groupFmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159264_1").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159264_1").val("*");}


        if ($("#CAT_Custom_159264_2_Parent").is(':checked'))
        {pointstotal+=40;groupFmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159264_2").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159264_2").val("*");}


        if ($("#CAT_Custom_159264_3_Parent").is(':checked'))
        {pointstotal+=40;groupFmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159264_3").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159264_3").val("*");}

        if ($("#CAT_Custom_159264_4_Parent").is(':checked'))
        {pointstotal+=40;groupFmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159264_4").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159264_4").val("*");}

        if ($("#CAT_Custom_159264_5_Parent").is(':checked'))
        {pointstotal+=10;groupFmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159264_5").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159264_5").val("*");}

        if ($("#CAT_Custom_159264_6_Parent").is(':checked'))
        {pointstotal+=20;groupFmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159264_6").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159264_6").val("*");}

	if (pointstotal<320)
	{
		// They cannot continue - they've not got enough points, so hide the submit button
		$("#submitdiv").hide();
		$("#submitmessage").html("Please select at least one module from each section - you need 320 points.");
		$("#submitmessage").show();
	}

	if (pointstotal>320)
	{
		// They cannot continue - they've got too many points, so hide the submit button
		$("#submitdiv").hide();
		$("#submitmessage").html("Sorry, you have selected too many modules - there is a limit of 320 points.");
		$("#submitmessage").show();
	}

	if (pointstotal==320)
	{
		myimg =" <img src='/ok.png' width=24 height=24>";
		// Check that they've selected a module from each of the groups
		if (groupAmodule & groupBmodule && groupCmodule && groupDmodule && groupEmodule && groupFmodule)
		{
			// They can continue
			$("#submitdiv").show();
			$("#submitmessage").hide();
			if(submittingform && failvalidation)
			{
				alert('Please ensure you have selected a course date and time for each of the modules you have ticked.');
				return false;
			}
		}
		else
		{
			// Error message
			$("#submitdiv").hide();
			$("#submitmessage").html("Sorry, you must choose at least one course from each of the groups.");
			$("#submitmessage").show();
		}
	}

	$("#pointstotal").html(divleft + "Total Points: " + pointstotal + " points " + myimg + "</div>");
	
}

function updateOnlineCourseTotal(submittingform)
{
    var pointstotal = 0;
	var myimg = "";
	var failvalidation=false;
    groupAmodule=false;
    groupBmodule=false;
    groupCmodule=false;
    groupDmodule=false;
    groupEmodule=false;
    groupFmodule=false;
    
	//Group A
    if ($("#CAT_Custom_159669_Parent").is(':checked'))
        {pointstotal+=10;groupAmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159669").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159669").val("*");}
		
    if ($("#CAT_Custom_159670_Parent").is(':checked'))
        {pointstotal+=10;groupAmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159670").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159670").val("*");}
		
    if ($("#CAT_Custom_159671_Parent").is(':checked'))
        {pointstotal+=10;groupAmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159671").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159671").val("*");}
		
    if ($("#CAT_Custom_159672_Parent").is(':checked'))
        {pointstotal+=10;groupAmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159672").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159672").val("*");}
		
    if ($("#CAT_Custom_159673_Parent").is(':checked'))
        {pointstotal+=10;groupAmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159673").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159673").val("*");}

	// Group B
    if ($("#CAT_Custom_159674_Parent").is(':checked'))
        {pointstotal+=10;groupBmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159674").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159674").val("*");}
		
    if ($("#CAT_Custom_159675_Parent").is(':checked'))
        {pointstotal+=10;groupBmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159675").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159675").val("*");}
		
    if ($("#CAT_Custom_159676_Parent").is(':checked'))
        {pointstotal+=10;groupBmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159676").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159676").val("*");}
		
    if ($("#CAT_Custom_159677_Parent").is(':checked'))
        {pointstotal+=10;groupBmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159677").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159677").val("*");}

	//Group C
    if ($("#CAT_Custom_159678_Parent").is(':checked'))
        {pointstotal+=10;groupCmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159678").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159678").val("*");}

if ($("#CAT_Custom_159679_Parent").is(':checked'))
        {pointstotal+=10;groupCmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159679").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159679").val("*");}

	// Group D

    if ($("#CAT_Custom_159680_Parent").is(':checked'))
        {pointstotal+=10;groupDmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159680").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159680").val("*");}
		
    if ($("#CAT_Custom_159681_Parent").is(':checked'))
        {pointstotal+=10;groupDmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159681").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159681").val("*");}

    if ($("#CAT_Custom_159682_Parent").is(':checked'))
        {pointstotal+=10;groupDmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159682").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159682").val("*");}
		
    if ($("#CAT_Custom_159683_Parent").is(':checked'))
        {pointstotal+=10;groupDmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159683").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159683").val("*");}
		
    if ($("#CAT_Custom_159684_Parent").is(':checked'))
        {pointstotal+=10;groupDmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159684").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159684").val("*");}
		
    if ($("#CAT_Custom_159685_Parent").is(':checked'))
        {pointstotal+=10;groupDmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159685").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159685").val("*");}

// Group E

    if ($("#CAT_Custom_159686_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159686").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159686").val("*");}
		
    if ($("#CAT_Custom_159687_Parent").is(':checked'))
        {pointstotal+=10;groupEmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159687").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159687").val("*");}

//Group F

    if ($("#CAT_Custom_159688_Parent").is(':checked'))
        {pointstotal+=10;groupFmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159688").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159688").val("*");}
		
    if ($("#CAT_Custom_159689_Parent").is(':checked'))
        {pointstotal+=10;groupFmodule=true;
        if(submittingform)
        {
            if($("#CAT_Custom_159689").val()=="*")
            {
                failvalidation = true;
            }
        }
        }
	else {$("#CAT_Custom_159689").val("*");}



if (pointstotal<180)
	{
		// They cannot continue - they've not got enough points, so hide the submit button
		$("#submitdiv").hide();
		$("#submitmessage").html("Please select at least one module from each section - you need 180 points.");
		$("#submitmessage").show();
	}

	if (pointstotal>180)
	{
		// They cannot continue - they've got too many points, so hide the submit button
		$("#submitdiv").hide();
		$("#submitmessage").html("Sorry, you have selected too many modules - there is a limit of 180 points.");
		$("#submitmessage").show();
	}

	if (pointstotal==180)
	{
		
		myimg =" <img src='/ok.png' width=24 height=24>";
		// Check that they've selected a module from each of the groups
		if (groupAmodule & groupBmodule && groupCmodule && groupDmodule && groupEmodule && groupFmodule)
		{
			// They can continue
			$("#submitdiv").show();
			$("#submitmessage").hide();
			if(submittingform && failvalidation)
			{
				alert('Please ensure you have selected a course date and time for each of the modules you have ticked.');
				return false;
			}
		}
		else
		{
			// Error message
			$("#submitdiv").hide();
			$("#submitmessage").html("Sorry, you must choose at least one course from each of the groups.");
			$("#submitmessage").show();
		}
	}

	$("#pointstotal").html(divleft + "Total Points: " + pointstotal + " points " + myimg + "</div>");
	
}

function updateDiplomaCourseTotal(submittingform)
{
	var pointstotal = 0;
	var failvalidation=false;
	groupAmodule=false;
	groupBmodule=false;
	groupCmodule=false;
	groupDmodule=false;
	groupEmodule=false;
	var myimg="";
	
	// Group A

	if ($("#CAT_Custom_159266_0_Parent").is(':checked'))
	{pointstotal+=10;groupAmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159266_0").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159266_0").val("*");}

	// Group B

	if ($("#CAT_Custom_159267_0_Parent").is(':checked'))
	{pointstotal+=40;groupBmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159267_0").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159267_0").val("*");}

	if ($("#CAT_Custom_159267_1_Parent").is(':checked'))
	{pointstotal+=10;groupBmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159267_1").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159267_1").val("*");}

	if ($("#CAT_Custom_159267_2_Parent").is(':checked'))
	{pointstotal+=40;groupBmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159267_2").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159267_2").val("*");}

	if ($("#CAT_Custom_159267_3_Parent").is(':checked'))
	{pointstotal+=10;groupBmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159267_3").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159267_3").val("*");}

	if ($("#CAT_Custom_159267_4_Parent").is(':checked'))
	{pointstotal+=20;groupBmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159267_4").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159267_4").val("*");}


	// Group C
	if ($("#CAT_Custom_159268_0_Parent").is(':checked'))
	{pointstotal+=40;groupCmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159268_0").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159268_0").val("*");}

	if ($("#CAT_Custom_159268_1_Parent").is(':checked'))
	{pointstotal+=40;groupCmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159268_1").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159268_1").val("*");}

	if ($("#CAT_Custom_159268_2_Parent").is(':checked'))
	{pointstotal+=40;groupCmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159268_2").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159268_2").val("*");}

	if ($("#CAT_Custom_159268_3_Parent").is(':checked'))
	{pointstotal+=20;groupCmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159268_3").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159268_3").val("*");}

	if ($("#CAT_Custom_159268_4_Parent").is(':checked'))
	{pointstotal+=20;groupCmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159268_4").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159268_4").val("*");}

	if ($("#CAT_Custom_159268_5_Parent").is(':checked'))
	{pointstotal+=20;groupCmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159268_5").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159268_5").val("*");}

	// Group D
	if ($("#CAT_Custom_159269_0_Parent").is(':checked'))
	{pointstotal+=20;groupDmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159269_0").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159269_0").val("*");}

	if ($("#CAT_Custom_159269_1_Parent").is(':checked'))
	{pointstotal+=20;groupDmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159269_1").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159269_1").val("*");}

	if ($("#CAT_Custom_159269_2_Parent").is(':checked'))
	{pointstotal+=10;groupDmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159269_2").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159269_2").val("*");}

	if ($("#CAT_Custom_159269_3_Parent").is(':checked'))
	{pointstotal+=40;groupDmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159269_3").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159269_3").val("*");}

	if ($("#CAT_Custom_159269_4_Parent").is(':checked'))
	{pointstotal+=20;groupDmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159269_4").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159269_4").val("*");}

	// Group E
	if ($("#CAT_Custom_159270_0_Parent").is(':checked'))
	{pointstotal+=40;groupEmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159270_0").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159270_0").val("*");}

	if ($("#CAT_Custom_159270_1_Parent").is(':checked'))
	{pointstotal+=20;groupEmodule=true;
			if(submittingform)
			{
				if($("#CAT_Custom_159270_1").val()=="*")
				{
					failvalidation = true;
				}
			}
        }
	else {$("#CAT_Custom_159270_1").val("*");}



	if (pointstotal<280)
	{
		// They cannot continue - they've not got enough points, so hide the submit button
		$("#submitdiv").hide();
		$("#submitmessage").html("Please select at least one module from each section - you need 280 points.");
		$("#submitmessage").show();
	}

	if (pointstotal>280)
	{
		// They cannot continue - they've got too many points, so hide the submit button
		$("#submitdiv").hide();
		$("#submitmessage").html("Sorry, you have selected too many modules - there is a limit of 280 points.");
		$("#submitmessage").show();
	}

	if (pointstotal==280)
	{
		myimg =" <img src='/ok.png' width=24 height=24>";

		// Check that they've selected a module from each of the groups
		if ( groupAmodule && groupBmodule && groupCmodule && groupDmodule && groupEmodule)
		{
			// They can continue
			$("#submitdiv").show();
			$("#submitmessage").hide();
			if(submittingform && failvalidation)
			{
				alert('Please ensure you have selected a course date and time for each of the modules you have ticked.');
				return false;
			}

		}
		else
		{
			// Error message
			$("#submitdiv").hide();
			$("#submitmessage").html("Sorry, you must choose at least one course from each of the groups.");
			$("#submitmessage").show();
		}
	}

	$("#pointstotal").html(divleft + "Total Points: " + pointstotal + " points " + myimg + "</div>");


}

