File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/admin/javascript/global.js
;jQuery(function($) {
/**
* If a class of new-window is given to an anchor, open up that link in a new window. The target attribute
* was deprecated as of HTML 4.01 and XHTML 1.0.
*/
$('a.new-window').live('click', function() {
window.open($(this).attr('href'), 'newWindow');
return false;
});
/**
* Tooltips
*/
(function() {
var
_dataKey = '__tooltip',
_template = '<div style="border: 1px solid rgb(231, 227, 190); padding: 10px; display: none; z-index: 1000; position: absolute; width: 190px; background-color: rgb(254, 252, 213); color: rgb(0, 0, 0);"><span class="helpTip"><b>#{title}</b></span><br/><img height="5" width="1" alt="" src="images/blank.gif"/><br/><div class="helpTip" style="padding-left: 5px; padding-right: 5px;">#{content}</div></div>';
// use event delegation so it works with elemets that
// haven't been added to the DOM yet
$('img.tooltip')
// show the tooltip when moused over
.live('mouseover', function(e) {
var t = $(this);
// reference to the objects tooltip if it doesn't exist
if (!t.data(_dataKey)) {
var template = $(_template).template().parse({
title : t.attr('alt'),
content : t.attr('title')
}).appendTo('body');
t
.data(_dataKey, template)
.removeAttr('title');
}
// show the tooltip
t.data(_dataKey)
.css({
position : 'absolute',
top : e.pageY,
left : e.pageX
})
.fadeIn();
})
// close
.live('mouseout', function(e) {
$(this).data(_dataKey).fadeOut();
})
// when the mose is moved, move the tooltip with it
.live('mousemove', function(e) {
var t = $(this);
// Either IE fires the mousemove event before the mouseover event, or the mouseover
// event doesn't complete before the mousemove event fires. Whichever way, we need
// to check to make sure the data is stored on the tooltip, otherwise we can't do
// anything with it and IE will spit the dummy.
if (!t.data(_dataKey)) {
return false;
}
var
w = $(window),
t = t.data(_dataKey),
wh = w.height(),
ww = w.width(),
st = w.scrollTop(),
sl = w.scrollLeft(),
bh = $('body').height(),
oh = t.outerHeight(),
ow = t.outerWidth(),
top = e.pageY,
left = e.pageX + 10;
if (((e.pageY - st) + oh) > wh) {
top = (wh + st) - oh - 10;
}
if (((e.pageX - sl) + ow) > ww) {
left = e.pageX - ow - 10;
}
t.css({
top : top,
left : left
});
});
})();
});