/*
* Tip, based on JTip By Cody Lindley (http://www.codylindley.com)
*/
$.Tip = {
show : function(id, width, title, html) {
if (width != '') {
width = ' style="width:'+width+'px"';
}
var de = document.documentElement;
var w = self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
var hasArea = w - getAbsoluteLeft(id);
var clickElementy = getAbsoluteTop(id) - 45;
var clickElementx = getAbsoluteLeft(id) + 45;
$('body').append('
');
$('#tip-box').css( {left: clickElementx +'px', top: clickElementy +'px'} );
$('#tip-box').show();
},
hide : function() {
$('#tip-box').remove();
}
};
function getAbsoluteLeft(objectId) {
// Get an object left position from the upper left viewport corner
o = document.getElementById(objectId)
oLeft = o.offsetLeft // Get left position from the parent object
while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
oParent = o.offsetParent // Get parent object reference
oLeft += oParent.offsetLeft // Add parent left position
o = oParent
}
return oLeft
}
function getAbsoluteTop(objectId) {
// Get an object top position from the upper left viewport corner
o = document.getElementById(objectId)
oTop = o.offsetTop // Get top position from the parent object
while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
oParent = o.offsetParent // Get parent object reference
oTop += oParent.offsetTop // Add parent top position
o = oParent
}
return oTop
}