$.fn.qtip.styles.mystyle = { // Last part is the name of the style
    style: { width: { max: 250 } },
    'font-weight': "normal",
    color: "#0D6CBB",
    border: {
        radius: 2
    },
    /** tip: {
        corner:'bottomLeft',
        size:{
            x:10,
            y:1
        }
    }, */
    name: 'blue' 
};

function removeTooltip(element) {
    $(element).qtip("destroy");
}

function createTooltip(element, text, replace) {
    if (replace) {
        $(element).qtip("destroy")
    }
    $(element).addClass("tooltipEnabled");
    $(element).qtip({
        content:text,
        position: {
            corner: {
                target: 'bottomMiddle',
                tooltip: 'topLeft'
            }
        },
        style: "mystyle",
        show: {
            delay:1000,
            when: {
                event: "mouseenter"
            },
            solo: true,
            effect: {
                type: 'fade',
                length: 100
            }
        },
        hide: {
            delay:100,
            effect: {
                type: 'fade',
                length: 100
            },  
            when:{
                event:"mouseleave"
            }
        }
    });
}

function bindingTipToLabel() {
    var links = $("a");
    for (var i = 0; i < links.length; i++) {

        if ($(links[i]).text()) {
            if (trim($(links[i]).text()).length > 0) {
                $(links[i]).qtip({
                    content:$(links[i]).text(),
                    style: {
                        name: 'mystyle'
                    },
                    position: { adjust: { x: -$(links[i]).width() / 2, y: 0 } },
                    show: {
                        delay:500,
                        effect: {
                            type: 'fade',
                            length: 430
                        }
                    },
                    hide: {
                        delay:50,
                        effect: {
                            type: 'fade',
                            length: 430  }

                    }
                });
            }
        } else {
            //alert($(links[i]).html());
        }

    }
}

function bindingTipToTooltip() {
    var links = $("a");
    for (var i = 0; i < links.length; i++) {
        if ($(links[i]).attr("tooltip")) {
            if (trim($(links[i]).attr("tooltip")).length > 0) {
                $(links[i]).qtip({
                    content:$(links[i]).attr("tooltip"),
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomLeft'
            }
        },
        style: "mystyle",
        show: {
            delay:1000,
            when: {
                event: "mouseenter"
            },
            solo: true,
            effect: {
                type: 'fade',
                length: 100
            }

        },
        hide: {
            delay:100,
            effect: {
                type: 'fade',
                length: 100
            },
            when:{
                event:"mouseleave"
            }
        }
                });
            }
        } else {
            //alert($(links[i]).html());
        }

    }
}