
(function($){
    // JQUERY VALIDATION PLUGIN
    
    var isValid = true;
    //var error_list = null;
    var error_prefix = "error_";
    var submitHandler = null;
    var error_header = "The following fields must be completed before you can continue from this page:";
    var error_messagebox = {
        errorMessageBoxID: '#errorMessage',
        message_container: ".validationContent",
        errorWrapper: 'p',
        labelClass: 'errorLabel',
        inputClass: 'errorInput'
    };
    var options = {};
    
    var rules = {
        required: {
            method: 'validateRequired',
            message: 'is required'
        },
        numeric: {
            method: 'validateNumeric',
            message: 'must be numeric'
        },
        email: {
            method: 'validateEmail',
            message: 'is invalid email'
        },
        url: {
            method: 'validateURL',
            message: 'is invalid URL'
        },
        link: {
            method: 'validateURL',
            message: 'is invalid link'
        },
        alphabetic: {
            method: 'validateAlphabetic',
            message: 'must be alphabetic'
        },
        alphanumeric: {
            method: 'validateAlphanumeric',
            message: 'must be alphanumeric'
        },
        /* Georges Villot: filter out all non printable characters */
        printable: {
            method: 'validatePrintable',
            message: 'must be printable'
        },
        date: {
            method: 'validateDate',
            message: 'is invalid date format'
        },
        daterangefrom: {
            method: 'validateDateRange',
            message: 'is outside the date range'
        },
        videofile: {
            method: 'validateFiletype',
            args: "mov|wmv|mpeg|mpg|avi|flv|swf|mp3",
            message: 'is not a valid video file type'
        },
        mediafile: {
            method: 'validateFiletype',
            args: "mov|wmv|mpeg|mpg|avi|flv|swf|mp3",
            message: 'is not a valid media file type'
        },
        documentfile: {
            method: 'validateFiletype',
            args: "pdf|doc|txt|xls|ppt|rtf",
            message: 'is not a valid document file type'
        },
        docfile: {
            method: 'validateFiletype',
            args: "pdf|doc|txt|xls|ppt|rtf",
            message: 'is not a valid document file type'
        },
        imagefile: {
            method: 'validateFiletype',
            args: "jpg|jpeg|gif|png",
            message: 'is not a valid image file type'
        },
        minselected: {
            method: 'validateMinSelected'
        },
        compareto: {
            method: 'validateEqualTo'
        },
        minlength: {
            method: 'validateMinLength',
            message: 'does not meet the minimum number of characters'
        },
        maxlength: {
            method: 'validateMaxLength',
            message: 'must not exceed the maximum number of character'
        }
    }; // end rules
    $.fn.validate = function(){
        var submitHandler = null;
        var options = null;
        var validate_options = null;
        
        for (var i = 0; i < arguments.length; i++) {
            if (typeof arguments[i] == 'object') {
                validate_options = {};
                validate_options = arguments[i];
            } // end if
            if (typeof arguments[i] == 'function' || $.isFunction(arguments[i])) {
                submitHandler = arguments[i];
            } // end if
        } // end for
        // define the className for the error fields and label
        if (!validate_options.labelClass) 
            validate_options.labelClass = error_messagebox.labelClass;
        if (!validate_options.inputClass) 
            validate_options.inputClass = error_messagebox.inputClass;
        
        // define the settings for the Error Message Box
        var effect, speed;
        if (validate_options.effect) 
            effect = validate_options.effect;
        if (validate_options.effectSpeed) 
            speed = validate_options.effectSpeed;
        
        // define the error message wrapper
        if (!validate_options.errorWrapper) 
            validate_options.errorWrapper = 'p';
        
        // define the error message container
        if (!validate_options.errorMessageBoxID) 
            validate_options.errorMessageBoxID = error_messagebox.errorMessageBoxID;
        
        
        var isFormValid = true;
        var form = $(this);
        
        // validate during form submission
        this.each(function(event){
            var error_list = new Object();
            var num_errors = 0;
            
            $(":input", this).not(":submit,:button,:reset,:image").each(function(){
                var el_name = $(this).attr('name');
                var element = $("[@name='" + el_name + "']");
                var label = $("label[@for='" + el_name + "']");
                
                // validate using metadata within the element
                var el_className = element.attr('class') || this.className;
                $.each((el_className || "").split(/\s+/), function(i, el_className){
                    var rule = el_className;
                    if (rules[rule]) {
                        // execute the rule thats predefined in this plugin
                        
                        // get data about each rule
                        var el_method = rules[rule].method;
                        var args = null;
                        if (rules[rule].args) 
                            args = rules[rule].args;
                        var el_errormessage = rules[rule].message;
                        
                        // check if the element is valid by executing the function on each element
                        var el_valid = element[el_method](args);
                    } // end if
                    if (el_valid == false) {
                        if (typeof error_list[el_name] != 'object') 
                            error_list[el_name] = new Object();
                        error_list[el_name][rule] = el_valid;
                        num_errors++;
                    } // end if
                });
                
                // validate using javascript configuration in the options variable passed to the function
                if (validate_options[el_name]) {
                    for (var rule in validate_options[el_name]) {
                    
                        var el_valid = false;
                        
                        // check if the rule is a user defined function
                        if (typeof validate_options[el_name][rule] == 'function') {
                            var el_valid = validate_options[el_name][rule]();
                        } // end if
                        // if the rule is part of the predefined functions in the plugin
                        else 
                            if (rules[rule]) {
                                // execute the rule thats predefined in this plugin
                                
                                // get data about each rule
                                var el_method = rules[rule].method;
                                var args = null;
                                if (rules[rule].args) 
                                    args = rules[rule].args;
                                var el_errormessage = rules[rule].message;
                                
                                // if there are no args from the predefined RULES object, use the args 
                                // defined in the options if needed
                                if (!args && validate_options[el_name]) 
                                    args = validate_options[el_name][rule];
                                
                                // check if the element is valid by executing the function on each element
                                var el_valid = element[el_method](args);
                            } // end if
                            // if not either of the above, then ignore
                            else {
                                var el_valid = true;
                            } // end if
                        // if not valid, display the error messages, and if needed, format the elements
                        // as error elements
                        if (!el_valid || el_valid == false) {
                            if (typeof error_list[el_name] != 'object') 
                                error_list[el_name] = new Object();
                            error_list[el_name][rule] = el_valid;
                            num_errors++;
                        } // end if
                    } // end for
                } // end if
                // validate based on the JQUERY selectors defined in the javascript options variable
                for (var selector in validate_options) {
                    if (element.is(selector)) {
                        if (typeof validate_options[selector] == 'object') {
                            for (var rule in validate_options[selector]) {
                            
                                if (typeof validate_options[selector][rule] == 'function') {
                                    var el_valid = validate_options[selector][rule](this);
                                } // end if
                                else 
                                    if (rules[rule]) {
                                        // get data about each rule
                                        var el_method = rules[rule].method;
                                        var args = null;
                                        if (rules[rule].args) 
                                            args = rules[rule].args;
                                        var el_errormessage = rules[rule].message;
                                        
                                        if (!args && validate_options[selector]) 
                                            args = validate_options[selector][rule];
                                        
                                        var el_valid = element[el_method](args);
                                    } // end if
                                    else {
                                        var el_valid = true;
                                    } // end if
                                // if not valid, display the error messages, and if needed, format the elements
                                // as error elements
                                if (!el_valid || el_valid == false) {
                                    if (typeof error_list[selector] != 'object') 
                                        error_list[selector] = new Object();
                                    error_list[selector][rule] = el_valid;
                                    if (typeof error_list[el_name] != 'object') 
                                        error_list[el_name] = new Object();
                                    num_errors++;
                                } // end if
                            } // end for
                        } // end if
                    } // end if
                } // end for
                // highlight the element if its an invalid element
                if (error_list[el_name]) {
                    element.addClass(validate_options.inputClass);
                    label.addClass(validate_options.labelClass);
                } // end if
                // else remove highlight
                else {
                    element.removeClass(validate_options.inputClass);
                    label.removeClass(validate_options.labelClass);
                } // end if
            });
            
            // display the error messages
            var error_container = $(validate_options.errorMessageBoxID);
            var form_error;
            if (validate_options.error) {
                form_error = validate_options.error.toString();
                if (error_messages[form_error].header) 
                    error_header = error_messages[form_error].header;
            } // end if
            else 
                if (error_messages.header || error_header) 
                    error_header = error_messages.header || error_header;
            
            if (error_container.length > 0) {
                // if there is an error container defined, then display
                
                /*$.clearErrors();
                 $.hideErrorMessage(effect,speed);
                 $.addHeaderError(error_header);*/
                $(this).clearErrors();
                $(this).hideErrorMessage(effect, speed);
                $(this).addHeaderError(error_header);
                
                for (var form_field in error_list) {
                    var title = $("[@name='" + form_field + "']").attr('title') || $("label[@for='" + form_field + "']").text() || form_field;
                    
                    if (error_messages[form_error] && error_messages[form_error][form_field]) {
                        var field_error_messages = error_messages[form_error][form_field];
                        
                        if (typeof field_error_messages == 'string') {
                            field_error_messages = "<" + validate_options.errorWrapper + ">" + field_error_messages + "</" + validate_options.errorWrapper + ">";
                            $(this).addError(field_error_messages);
                        } // end if
                        if (typeof field_error_messages == 'object') {
                            for (var rule in error_list[form_field]) {
                                if (field_error_messages[rule]) {
                                    var field_error_message = "<" + validate_options.errorWrapper + ">" + field_error_messages[rule] + "</" + validate_options.errorWrapper + ">";
                                    $(this).addError(field_error_message);
                                } // end if
                                else {
                                    if (!rules[rule] || !rules[rule].message) 
                                        continue;
                                    var message = rules[rule].message;
                                    var field_error_message = "<" + validate_options.errorWrapper + ">" + title + ' ' + message + "</" + validate_options.errorWrapper + ">";
                                    $(this).addError(field_error_message);
                                } // end if
                            } // end if
                        } // end if
                    } // end if
                    else {
                        var field_error_messages = new Array();
                        for (var rule in error_list[form_field]) {
                            if (!rules[rule] || !rules[rule].message) 
                                continue;
                            var message = rules[rule] ? rules[rule].message : null;
                            if (title) 
                                field_error_messages.push(message);
                        } // end for
                        if (field_error_messages.length > 0) {
                            var field_error_message = title + ' ' + field_error_messages.join(", ");
                            field_error_message = "<" + validate_options.errorWrapper + ">" + field_error_message + "</" + validate_options.errorWrapper + ">";
                            $(this).addError(field_error_message);
                        } // end if
                    } // end if
                } // end for
            } // end if
            if (num_errors) {
                $(this).showErrorMessage(effect, speed);
                isFormValid = false;
            } // end if
        });
        return isFormValid;
        
    }; // end function
    $.fn.validateForm = function(validate_options){
        this.submit(function(event){
            var isFormValid = $(this).validate(validate_options);
            if (isFormValid && validate_options.submitHandler) {
                validate_options.submitHandler($(this));
                return false;
            } // end if
            return isFormValid;
        });
        return true;
    }; // end function
    $.fn.validateRequired = function(){
        // returns true if valid
        var element = $(this);
        var form = $(this).parents('form');
        var input_name = this.name || element.attr('name');
        var input_value = $.trim(this.value) || $.trim(element.val());
        
        if (element.is(":radio,:checkbox")) {
            return (form.find("[@name='" + input_name + "']:checked").length > 0) ? true : false;
        } // end if
        if (element.is(":input:not(:radio,:checkbox,:button)") || element.is(":text")) {
            return $.inArray(input_value, ['', null, 'undefined']) ? true : false;
        } // end if
        return this;
    }; // end function
    $.fn.validateByRegex = function(regex){
        var element = $(this);
        // var form = $(this).parents('form');
        var input_name = this.name || element.attr('name');
        var input_value = $.trim(this.value) || $.trim(element.val());
        
        if (element.is(":text, :file") && element.is(".required")) {
            return regex.test(input_value);
        } // end if
        if (element.is(":text, :file") && input_value != '') {
            return regex.test(input_value);
        } // end if
        return this;
    }; // end function
    $.fn.validateNumeric = function(){
        var regex = /^\d+$/;
        return $(this).validateByRegex(regex);
    }; // end function
    $.fn.validateEmail = function(){
        var regex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
        return $(this).validateByRegex(regex);
    }; // end function
    $.fn.validateURL = function(){
        var regex = /^[\w+\d+-_]+\.[\w\d-_%&?\/\.\=]+$/;
        var isValidURL = $(this).validateByRegex(regex);
        
        if (isValidURL == true) {
            var rgxhttp = /^[a-zA-z0-9]{3,4}:\/\/(.?)+$/;
            if (!rgxhttp.test($(this).val())) {
                $(this).val('http://' + $(this).val());
            } // end if
        } // end if
        return isValidURL;
    }; // end function
    $.fn.validateAlphabetic = function(){
        var regex = /^[a-zA-Z]+$/;
        return $(this).validateByRegex(regex);
    }; // end function
    $.fn.validateAlphanumeric = function(){
        var regex = /^[a-zA-Z0-9\s+]+$/;
        return $(this).validateByRegex(regex);
    }; // end function
    /* Georges Villot: regular expression to filter any non printable characters, ex: copy/paste from word documents...*/
    $.fn.validatePrintable = function(){
        var regex = /^[A-Za-z0-9~!@#$%^&*()_+`\-={}\[\]:\";'<>,./?'\s]+$/;
        return $(this).validateByRegex(regex);
    }; // end function
    $.fn.validateDate = function(){
        var element = $(this);
        
        // var regex = /^\d{2}\/\d{2}\/\d{4}$/;
        var input_value = $(this).val();
        var regex = /Invalid|NaN/;
        var isValidDate = !regex.test(new Date(input_value)) && /^\d{2}\/\d{2}\/\d{4}$/.test(input_value);
        
        if (element.is(":text") && element.is(".required")) {
            return isValidDate;
        } // end if
        if (element.is(":text") && input_value != '') {
            return isValidDate;
        } // end if
        return this;
    }; // end function
    $.fn.validateFiletype = function(filetypes){
        var regex = "([^/\]+)[\.]+(" + filetypes + ")";
        regex = new RegExp(regex, ["i"]);
        return $(this).validateByRegex(regex);
    }; // end function
    $.fn.validateMinSelected = function(numselected){
        var element = $(this);
        var form = $(this).parents('form');
        var input_name = this.name || element.attr('name');
        var input_value = $.trim(this.value) || $.trim(element.val());
        
        numselected = numselected || 1;
        if (element.is(":radio,:checkbox")) {
            return (form.find("[@name='" + input_name + "']:checked").length >= numselected) ? true : false;
        } // end if
        return this;
    }; // end function
    $.fn.validateEqualTo = function(selector){
        var this_value = $(this).val();
        var that_value = $("[@name='" + selector + "']").val();
        if ($.trim(that_value) != '') 
            return this_value == that_value;
        return this;
    }; // end function
    $.fn.validateRange = function(range1, range2){
        var this_value = $(this).val();
        if (this_value < range1) 
            return false;
        if (this_value > range2) 
            return false;
        return this;
    }; // end function
    $.fn.validateDateRange = function(selector){
        // compares the this date with another date if it is not before the other date
        // ie this_date > that_date
        // the date format should be dd/mm/yyyy
        
        var this_date = $.trim($(this).val());
        var this_date = this_date.split('/');
        var this_date = new Date(this_date[2], this_date[1] - 1, this_date[0], 0, 0, 0, 0);
        
        var that_date = $.trim($("[@name='" + selector + "']").val());
        var that_date = that_date.split('/');
        var that_date = new Date(that_date[2], that_date[1] - 1, that_date[0], 0, 0, 0, 0);
        
        if (this_date < that_date) 
            return false;
        return this;
    }; // end function
    $.fn.validateMinLength = function(length){
        var this_value = $(this).val();
        if (this_value.length < length) 
            return false;
        return this;
    }; // end function
    $.fn.validateMaxLength = function(length){
        var this_value = $(this).val();
        // if(this_value.length > length) return false;
        return (this_value.length > length) ? false : true;
        return this;
    }; // end function
    $.fn.validateLength = function(length){
        var this_value = $(this).val();
        if (this_value.length != length) 
            return false;
        return this;
    }; // end function
    $.fn.clearErrors = function(){
        $("#errorMessage .validationContent", this).empty();
        return this;
    }; // end function
    $.clearErrors = function(){
        $("#errorMessage .validationContent").empty();
        return this;
    }; // end function
    $.fn.addHeaderError = function(error_message){
        error_message = '<h2>' + error_message + '</h2>';
        $("#errorMessage .validationContent", this).append(error_message);
        return this;
    }; // end function
    $.addHeaderError = function(error_message){
        error_message = '<h2>' + error_message + '</h2>';
        $("#errorMessage .validationContent").append(error_message);
        return this;
    }; // end function
    $.fn.addError = function(error_message){
        $("#errorMessage .validationContent", this).append(error_message);
        return this;
    }; // end function
    $.addError = function(error_message){
        $("#errorMessage .validationContent").append(error_message);
        return this;
    }; // end function
    $.fn.showErrorMessage = function(effect, speed){
        if (!speed) 
            speed = 250;
        switch (effect) {
            case 'fade':
                $("#errorMessage", this).fadeIn(speed);
                break;
            case 'slide':
                $("#errorMessage", this).slideDown(speed);
                break;
            case 'show':
            default:
                $("#errorMessage", this).show();
                break;
        } // end switch					
        return this;
    }; // end function
    $.showErrorMessage = function(effect, speed){
        if (!speed) 
            speed = 250;
        switch (effect) {
            case 'fade':
                $("#errorMessage").fadeIn(speed);
                break;
            case 'slide':
                $("#errorMessage").slideDown(speed);
                break;
            case 'show':
            default:
                $("#errorMessage").show();
                break;
        } // end switch					
        return this;
    }; // end function
    $.fn.hideErrorMessage = function(effect, speed){
        if (!speed) 
            speed = 250;
        switch (effect) {
            case 'fade':
                $("#errorMessage", this).fadeOut(speed);
                break;
            case 'slide':
                $("#errorMessage", this).slideUp(speed);
                break;
            case 'show':
            default:
                $("#errorMessage", this).hide();
                break;
        } // end switch					
        return this;
    }; // end function
    $.hideErrorMessage = function(effect, speed){
        if (!speed) 
            speed = 250;
        switch (effect) {
            case 'fade':
                $("#errorMessage").fadeOut(speed);
                break;
            case 'slide':
                $("#errorMessage").slideUp(speed);
                break;
            case 'show':
            default:
                $("#errorMessage").hide();
                break;
        } // end switch					
        return this;
    }; // end function
    ////////////////////// deprecated functions ======= delete when necessary
    $.numErrors = function(){
        var count = 0;
        for (var x in error_list) {
            count++;
        } // end for
        return count;
    }; // end function
    $.showError = function(error_message){
        if ($("#" + error_prefix + error_message).length > 0) 
            $("#" + error_prefix + error_message).show();
        else 
            $("#errorMessage").find(".validationContent").append("<p>" + error_message + "</p>");
        return this;
    }; // end function
    $.hideError = function(error_message){
        if ($("#" + error_prefix + error_message).length > 0) 
            $("#" + error_prefix + error_message).hide();
        return this;
    }; // end function
})(jQuery);



var error_messages = {
    header: "The following fields must be completed before you can continue from this page:",
    
    IP001E1: {
        email: {
            required: "Please enter the email address of the person you wish to send this page to...",
            email: "The email address is not valid. Please check the email address..."
        }
    },
    PA002E1: {
        header: "At least one of the following fields must be completed before you can continue from this page:",
        publicationDate: {
            required: "You must set a publication date.",
            date: "The publication date is an invalid date format. Please enter as dd/mm/yyyy format",
            datePastMax: "The publication date can only be set up to 10.5 months in the future.",
            datePastMin: "Publication Date cannot be set before today's date"
        },
        expiryDate: {
            required: "You must set an expiry date.",
            date: "The expiry date is an invalid date format. Please enter as dd/mm/yyyy format",
            daterangefrom: "You cannot set an expiry date/time before the publication date/time.",
            datePastMax: "The expiry date can only be set up to 10.5 months in the future.",
            datePastMin: "Expiry Date cannot be set before today's date"
        }
    },
    PA004E1: {
        newSubpage: {
            required: "You must enter a name for the page.",
            alphanumeric: "Page names can only contain alpha-numeric characters."
        }
    },
    PA004E2: {
        input: "Page names can only contain alpha-numeric characters."
    },
    ST007E1: {
        imageUpload: {
            imagefile: "JPG files and 2MB files size upload limit only allowed"
        }
    },
    ST007E12: {
        imageUpload: {
            required: "No image has been selected."
        }
    },
    ST007BE1: {
        imageDescription: {
            required: "A description of the image is required for accessibility compliance."
        }
    },
    ST008E1: {
        mediaUpload: {
            required: "No files have been selected.",
            videofile: "MOV, MPG, MPEG, AVI, WMV, FLV files only allowed."
        }
    },
    ST008AE1: {
        header: "The following fields must be completed before you can continue from this page:",
        mediaTitle: {
            required: "Media Title is required"
        },
        mediaDescription: {
            required: "Media Description is required"
        }
    },
    ST009E1: {
        fileUpload: {
            docfile: "DOC, PDF, TXT, XLS, PPT and RTF files and 2MB files size upload limit only allowed."
        }
    },
    ST009E12: {
        fileUpload: {
            required: "No file has been selected (2MB files size upload limit only allowed)."
        }
    },
    ST009AE1: {
        header: "You must complete the following fields.",
        fileTitle: {
            required: "Please enter a title for the file"
        },
        fileDescription: {
            required: "Please enter a short description for the file."
        }
    },
    ST015E1: {
        linkText: {
            required: 'Please provide a Link Text'
        },
        internalLink: {
            required: "No selected page or No link was entered.",
            url: "Invalid address"
        },
        newWebLink: {
            url: "Invalid address"
        }
    },
    
    SB005E1: {
        header: "You haven't chosen who to delegate the set up to",
        delegate: {
            required: "Select the member of staff you wish to delegate responsibility to by clicking the radio button to the left of their name, or press Back if you wish to complete the set up yourself."
        }
    },
    SB015CE1: {
        firstName: {
            filter: "You must select at least one field to filter"
        },
        lastName: {
            filter: "You must select at least one field to filter"
        },
        location: {
            filter: "You must select at least one field to filter"
        }
    },
    SB015E1: {
        option_approver: {
            required: "The site must have at least two approvers",
            minselected: "You must select at least two people that will act as approvers for the school website."
        }
    },
    SB015DE1: {
        header: "No author selected",
        person: {
            required: "You must select the person you wish to add as an author."
        }
    },
    SB015FE1: {
        header: "The following fields must be completed before you can continue from this page:",
        dobDay: {
            required: "Birth Day is required.",
            numeric: "Birth Day must be numeric",
            minlength: "Birth Day must be at least 2 characters in length",
            correctDay: "Birth Day is incorrect"
        },
        dobMonth: {
            required: "Birth Month is required.",
            minlength: "Birth Month must be at least 2 characters in length",
            correctMonth: "Birth Month is incorrect"
        },
        dobYear: {
            required: "Birth Year is required.",
            minlength: "Birth Year must be at least 4 characters in length",
            correctYear: "Birth Year is incorrect"
        }
    },
    LO001H1: {
        header: "Login details were not recognised. Please check and retype your login details."
    },
    LO002E1: {
        email: {
            required: "The email address is required",
            email: "The email address was not recognized. Did you spell it correctly?"
        }
    },
    LO004E1: {
        oldpswd: {
            required: "Current password is incorrect. You did not enter you current password correctly. Re-type your current password in the Old password field."
        },
        newpswd2: {
            required: "Retype new password is required",
            compareto: "New passwords don't match. Please enter the same password in both the New password and Retype new password fields."
        }
    },
    
    AT004AE1: {
        header: "The following fields must be completed before you can continue from this page:",
        '.imageTitle': {
            required: "Image Title is mandatory"
        },
        '.imageChildren': {
            required: "Does this file contain an image of a child is mandatory"
        },
        '.imageAlt': {
            required: "Image Alt is mandatory"
        }
    },
    AT004E1: {
        '.inputFile': {
            imagefile: "JPG files and 7MB files size upload limit only allowed.",
            filetype: "The following files can't be uploaded because they are not a valid format. You can upload the following file type: jpg (7MB files size upload limit only allowed)",
            minuploaded: "Please upload at least 1 file to continue (7MB files size upload limit only allowed)"
        }
    },
    AT006E1: {
        header: "The following fields must be completed before you can continue from this page:",
        '.imageAlbumCoverApprove': {
            required: "You need to approve/disapprove the Album details"
        },
        '.imageApprove': {
            required: "You need to approve/disapprove the New images"
        },
        '.imageModified': {
            required: "You need to approve/disapprove the Modified images"
        },
        '.imageRemove': {
            required: "You need to approve/disapprove the Removed images"
        }
    },
    HT007E1: {
        header: "The following fields must be completed before you can continue from this page:",
        title: {
            required: "Homepage alert title is mandatory"
        },
        message: {
            required: "Homepage Alert message is mandatory."
        },
        startDate: {
            datePastMin: "Start Date cannot be before the current date",
            datePastMax: "Start Date cannot be after 31 days from the current date"
        },
        endDate: {
            datePastMin: "End Date cannot be before the current date or the Start Date",
            datePastMax: "End Date cannot be after 31 days from the current date"
        }
    },
    NT004E1: {
        header: "The following fields must be completed before you can continue from this page:",
        newsletterTitle: {
            required: "Newsletter title is required"
        },
        newsletterFile: {
            required: "Newsletter file is required, please upload a newsletter file in Word / PDF format",
            filetype: "File format is invalid, please upload only Word / PDF files"
        }
    },
    NT004E2: {
        input: "The newsletter title has been used before. Please enter a unique title for the newsletter, such as the publication date of the newsletter."
    },
    NT006E1: {
        header: "The following fields must be completed before you can continue from this page:",
        newsTitle: {
            required: "News Story Title is mandatory"
        },
        newsArticle: {
            required: "News Story Article is mandatory"
        },
        priority: {
            required: "Please select the Priority of this News Story"
        },
        endDate: {
            required: "Please enter the End Date for this News Story",
            datePastMin: "The End Date for the News Story is invalid, please enter a date after the current date",
            datePastMax: "The End Date for the News Story is invalid, you can only be set up to 10.5 months in the future."
        }
    },
    
    
    CE008AE1: {
        title: {
            required: "Please enter the Alert Event Name."
        },
        message: {
            required: "Please enter the Alert Event Message."
        }
    },
    CE009AE1: {
        title: {
            required: "Please enter the Service Message Title."
        },
        message: {
            required: "Please enter the Message."
        },
        serviceMessageFor: {
            required: "Please select at least 1 User to send Service Message to."
        }
    },
    CE011E1: {
        title: {
            required: "Please enter the Title."
        },
        message: {
            required: "Please enter the Message."
        }
    },
    CE014E1: {
        internalLink: {
            required: "Please select a page within the School site."
        },
        fileUpload: {
            required: "Please select a file to upload."
        },
        fileDescription: {
            required: "File description is required. Please enter description."
        }
    },
    HT004E1: {
        imageUpload: {
            required: "File Upload Image is required.",
            imagefile: "File Upload Image file type is incorrect, please upload only JPEG or GIF files."
        }
    },
    SU003E1: {
        agreeTerms: {
            required: "You must agree to the Terms and Conditions to proceed"
        }
    }
}; // end class
