/*
* jQuery TATOTI v1.0 by Volkan Talayhan (talayhan@msn.com)
*  A nice and usefull Tooltip with mouse track and rotation
*  I've tryed to write it as easy as it could to be
*  Tooltip takes the data from the child div[class=tooltipcontent]  of a[tooltipattribute] .
*  If there isn't a child div[class=tooltipcontent] then Tooltip going to use content of a[tooltipattribute]
*  Licenced under The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php
*/

/* You could change this area
    var tooltipclass = "tatoti"
    var tooltipcontent = "hiddendata"
    var tooltipattribute = "data-toti"
 ////////////////////////// */

    $(document).ready(function () {
    $("." + tooltipcontent).hide();
    $("body").append("<div class='" + tooltipclass + "'></div>");
    $("." + tooltipclass).css({ 'position' : 'absolute' });
    $("img["+tooltipattribute+"]").each(function () {
        $(this).hover(function (e) {
            $("body").mousemove(function (e) {
                var tipY = e.pageY + 16; var tipX = e.pageX + 16;
                if (tipY + 20 + $("."+tooltipclass).height() - window.pageYOffset > $(window).height()) { tipY = tipY - ($("."+tooltipclass).height() + 26); };
                if (tipX + 20 + $("."+tooltipclass).width() - window.pageXOffset  > $(window).width()) { tipX = tipX - ($("."+tooltipclass).width() + 26); };
                $("."+tooltipclass).css({ 'top': tipY, 'left': tipX });
            });
             if ($(this).find("." + tooltipcontent).length) {
                gettoticontent = $(this).find("." + tooltipcontent).html()
            } else {
                gettoticontent = $(this).attr(tooltipattribute)
            }


            $("."+tooltipclass).html(gettoticontent).stop(true, true).fadeIn("fast");
        }, function () {
            $("."+tooltipclass).stop(true, true).fadeOut("fast");
        });});});
 
