﻿jQuery.validator.setDefaults({
    onsubmit: false,
    onfocusout: function(element) { $(element).valid(); },
    // the errorPlacement has to take the table layout into account
    errorPlacement: function(error, element) {
        //There should be an error
        if (element.is(":checkbox"))
            element.parent().append(error);
        else
            element.after(error);
    },
    // set this class to error-labels to indicate valid fields
    success: function(label) {
        // set   as text for IE 
        label.html(" ").addClass("checked");
    },
    showErrors: function(errors, errorList) {
        this.defaultShowErrors();

        $.each($("label.error"), function(i, error) {
            if ($(error).html() != " ") {
                $(error).attr("title", $(this).html()).html(" ").cluetip({
                    tracking: true,
                    splitTitle: '|',
                    arrows: true,
                    dropShadow: false,
                    positionBy: 'mouse',
                    topOffset: -46,
                    leftOffset: -2,
                    //sticky: true, //use to fix stiles and stuff
                    cursor: 'pointer',
                    onShow: function(ct, c) { ct.find("#cluetip-title").corner("5px"); }
                });
            }
        });
    }
});
