    (function(){
        $.validity.outputs.custom = {

            start:function(){ 
                $("input, select").removeClass('fail');
				$("#validity-summary").addClass('hidden');
            },
            
            end:function(results) {
                // If not valid and scrollTo is enabled, scroll the page to the first error.
                if (!results.valid && $.validity.settings.scrollTo) {
                    location.hash = $(".fail:eq(0)").attr('id')
                }
				if(!results.valid) {
					$("#validity-summary").removeClass('hidden');
				}
            },
            
            raise:function($obj, msg){
                //alert(msg);
                $obj.addClass('fail');
            },
            
            // Just raise the error on the last input.
            raiseAggregate:function($obj, msg){ 
                this.raise($($obj.get($obj.length - 1)), msg); 
            },
            
            scrollToFirstError:function(){
                location.hash = $('.fail:eq(0)').attr('id');
            }
        }

    })();
      
$.validity.setup({ outputMode:'custom' });
