(function(){

    // The output mode will be named whatever you assign it to.
    // In this example, since we're assigning it to 'myOutputMode'
    // it will be called 'myOutputMode'.
    $.validity.outputs.alertOutput = {
    	message: "",
    	valid: true,
        // The start function will be called when validation starts.
        // This allows you to prepare the page for validation, for instance
        // you might remove any validation messages that are already on the page.
        start:function(){ 
        	$.validity.outputs.alertOutput.message = "";
        	$.validity.outputs.alertOutput.valid = true;
        },
        
        // The end function is called when validation has concluded.
        // This allows you to flush any buffers or do anything you need to
        // after all of the validators have been called.
        // results will be the results object.
        // results.valid is a boolean representing whether the form is valid.
        // results.errors is an integer of how many errors there are.
        end:function(results) { 
        	if ($.validity.outputs.alertOutput.message != "") {
        		alert($.validity.outputs.alertOutput.message);
			}
        },
        
        // The raise function is called to raise an error for a specific input.
        // The first argument is a jQuery object of the input to raise the error message for.
        // The second argument is the string of the error message.
        raise:function($obj, msg){
       		$.validity.outputs.alertOutput.valid = false;
        	if (msg != "" && $.validity.outputs.alertOutput.message == "") {
        		$.validity.outputs.alertOutput.message = msg;
        	}
        },
        
        // The raiseAggregate function is similar to the raise function, except that
        // the $obj argument will be a jQuery object of several inputs, 
        // all of which are invalid aggregately.
        raiseAggregate:function($obj, msg){ 
       		$.validity.outputs.alertOutput.valid = false;
        	if (msg != "" && $.validity.outputs.alertOutput.message == "") {
        		$.validity.outputs.alertOutput.message = msg;
        	}
        }
    }
})();
