﻿///////////////////////////////////////
// REQUIRES: jquery-1.4.1.js
///////////////////////////////////////

var $ttips = jQuery.noConflict();
$ttips(document).ready(function () {

    $ttips('[tooltip]').each(function () {

        var sTipID = $ttips(this).attr("tooltip");
        var sWidth = $ttips(this).attr("tooltipWidth");
        var sContent = $ttips("#" + sTipID).html();
        var sTipLoc = $ttips(this).attr("tooltipLoc");
        if (sTipLoc == undefined) sTipLoc = "left";

        var sToolTipLoc = "leftBottom";
        var sTargetLoc = "topRight";
        if (sTipLoc.toLowerCase() == "left") {
            sToolTipLoc = "rightBottom";
            sTargetLoc = "topLeft";
        } else if (sTipLoc.toLowerCase() == "middle") {
            sToolTipLoc = "bottomMiddle";
            sTargetLoc = "topMiddle";
        }

        var iWidth;
        if (sWidth == undefined)
            iWidth = 250;
        else
            iWidth = parseInt(sWidth, 10);

        $ttips(this).qtip({

            position: {
                corner: { tooltip: sToolTipLoc, target: sTargetLoc }
            },

            style: {
                width: iWidth,
                'font-family': 'verdana,arial,helvetica,sans-serif',
                background: '#ffffee',
                border: {
                    width: 4,
                    radius: 4,
                    color: '#000066'
                },
                tip: sToolTipLoc
            },

            content: sContent
        });
    });
});

