﻿$(document).ready(function () {
    $('.calculateButton').click(function (e) {
        var types = new Array();

        $('input:checked:not(:disabled)').each(function () {
            var id = $(this).parent().attr('programid');
            if (id == 29 || id == 30) {
                if ($.inArray('AHC', types) == -1) { types.push('AHC'); }
            } else if (id == 16 || id == 17 || id == 31 || id == 32) {
                if ($.inArray('AWE', types) == -1) { types.push('AWE'); }
            } else {
                if ($.inArray('GC', types) == -1) { types.push('GC'); }
            }
        });

        if (types.length > 1) {
            e.preventDefault();
            alert("You must order the Australian History Competition, Asia Wise Competition and Primary School Programs seperately");
        }
    });

});
