/*
* jquery.qtip wrapper.
*
* Copyright (c) 2010 Spark! Data Systems
* http://www.sparkdata.co.uk
*
*/

function DestroyQTip(element) {

    //check a qtip exists on that element
    if ('object' === typeof $(element).data('qtip')) {
        $(element).qtip('destroy');
    }
}

//show on mouseover, hide on mouseout
function StandardQTip(element, message) {
    $(element).qtip({
        content: message,
        show: 'mouseover',
        hide: 'mouseout',
        style: {
            name: 'green', // Inherit from preset style
            tip: 'topMiddle'
        },
        position: {
            corner: {
                target: 'bottomRight',
                tooltip: 'topRight'
            }
        }
    });
}


//show on mouseover, hide on mouseout
function SideQTip(element, message) {
    $(element).qtip({
        content: message,
        show: 'mouseover',
        hide: 'mouseout',
        style: {
            name: 'green', // Inherit from preset style
            tip: 'leftMiddle'
        },
        position: {
            corner: {
                target: 'rightMiddle',
                tooltip: 'leftMiddle'
            }
        }
    });
}

//show on mouseover, hide on mouseout
function PleaseLoginTip(element) {
    $(element).qtip({
        content: 'Please login or <a href="/Register.aspx">register</a> to view this section of the site',
        show: 'mouseover',
        hide: { when: 'mouseout', fixed: true },
        style: {
            name: 'green', // Inherit from preset style
            tip: 'topMiddle'
        },
        position: {
            corner: {
                target: 'bottomRight',
                tooltip: 'topRight'
            }
        }
    });
}

//show when created, hide on click elsewhere
function FixedQTip(element, message) {
    $(element).qtip({
        content: message,
        show: { ready: true },
        hide: { when: 'click' },
        style: {
            name: 'green', // Inherit from preset style
            tip: 'topMiddle'
        },
        position: {
            corner: {
                target: 'bottomRight',
                tooltip: 'topRight'
            }
        }
    });
}

//show when created, hide on click elsewhere
function LoginQTip(element, message) {
    $(element).qtip({
        content: message,
        show: { ready: true },
        hide: { when: 'click' },
        style: {
            name: 'green', // Inherit from preset style
            tip: 'leftMiddle'
        },
        position: {
            corner: {
            target: 'topRight',
                tooltip: 'topLeft'
            }
        }
    });
}