$(function() {
$("").appendTo('body');
tooltip = $("
").appendTo($('body'));
$('.tooltip').live('mouseleave', function(){tooltipcanclose=true;setTimeout("close_tooltip();", 300);});
$('.tooltip').live('mouseover', function(){tooltipcanclose=false;});
$('[data-page]').live('mouseover', show_tooltip);
$('[data-service]').live('mouseover', show_tooltip);
$('[data-category]').live('mouseover', show_tooltip);
$('[data-brand]').live('mouseover', show_tooltip);
$('[data-product]').live('mouseover', show_tooltip);
$('[data-post]').live('mouseover', show_tooltip);
$('[data-act]').live('mouseover', show_tooltip);
$('[data-feature]').live('mouseover', show_tooltip);
});
function show_tooltip()
{
tooltipcanclose=false;
tooltip.show();
$(this).live('mouseleave', function(){tooltipcanclose=true;setTimeout("close_tooltip();", 500);});
flip = !($(this).offset().left+tooltip.width()+25 < $('body').width());
tooltip.css('top', $(this).height() + 5 + $(this).offset().top + 'px');
tooltip.css('left', ($(this).offset().left + $(this).outerWidth()*0.5 - (flip ? tooltip.width()-40 : 0) + 0) + 'px');
tooltip.find('.tooltipHeader').addClass(flip ? 'tooltipHeaderFlip' : 'tooltipHeaderDirect').removeClass(flip ? 'tooltipHeaderDirect' : 'tooltipHeaderFlip');
from = encodeURIComponent(window.location);
tooltipcontent = '';
if(id = $(this).attr('data-service'))
{
tooltipcontent = "Редактировать";
tooltipcontent += "Добавить услугу";
}
if(id = $(this).attr('data-page'))
{
tooltipcontent = "Редактировать";
tooltipcontent += "Добавить страницу";
}
if(id = $(this).attr('data-category'))
{
tooltipcontent = "Редактировать";
tooltipcontent += "Добавить товар";
}
if(id = $(this).attr('data-brand'))
{
tooltipcontent = "Редактировать";
}
if(id = $(this).attr('data-product'))
{
tooltipcontent = "Редактировать";
}
if(id = $(this).attr('data-post'))
{
tooltipcontent = "Редактировать";
}
if(id = $(this).attr('data-act'))
{
tooltipcontent = "Редактировать";
}
if(id = $(this).attr('data-feature'))
{
tooltipcontent = "Редактировать";
}
$('.tooltipBody').html(tooltipcontent);
}
function close_tooltip()
{
if(tooltipcanclose)
{
tooltipcanclose=false;
tooltip.hide();
}
}
function SetTooltips() {
elements = document.getElementsByTagName("body")[0].getElementsByTagName("*");
for (i = 0; i