///////////////////////////////////////////
// Tooltips v1.0.0                       //
// (c) 2001 by Flying/DR/HRz             //
///////////////////////////////////////////
// Contact me: flying@dom.natm.ru        //
// if you want to use this script        //
// or need something else for your site. //
///////////////////////////////////////////

 var tooltipsStylePrefix = 'ttStyle'; var defaultTooltipWidth = null; var defaultTooltipHeight = null; var tooltipXOffset = 10; var tooltipYOffset = 10; var windowXMargin = 5; var windowYMargin = 5; var windowScrollbarSize = 20;
var tooltipsParentLookup = false; var tooltipStyles = new Array(); var tooltipObjects = new Array(); var attachedTooltips = new Array(); var curTooltipStyle = null; var activeTooltip = null; var windowWidth = 0; var windowHeight = 0; var mouseX = 0; var mouseY = 0; var taDefault = null;
var taLeft = 'left'; var taRight = 'right'; var taCenter = 'center'; var taJustify = 'justify'; function startTooltips() { addTooltipStyle('default'); }; function addTooltipStyle(id) { var qArgs = addTooltipStyle.arguments.length;
var fontFace = (qArgs>=2 )?addTooltipStyle.arguments[1] :(curTooltipStyle!=null)?curTooltipStyle.fontFace:'Arial'; var fontSize = (qArgs>=3 )?addTooltipStyle.arguments[2] :(curTooltipStyle!=null)?curTooltipStyle.fontSize:8; var fontColor = (qArgs>=4 )?addTooltipStyle.arguments[3] :(curTooltipStyle!=null)?curTooltipStyle.fontColor:'#000000';
var bold = (qArgs>=5 )?addTooltipStyle.arguments[4] :(curTooltipStyle!=null)?curTooltipStyle.bold:false; var italic = (qArgs>=6 )?addTooltipStyle.arguments[5] :(curTooltipStyle!=null)?curTooltipStyle.italic:false; var underline = (qArgs>=7 )?addTooltipStyle.arguments[6] :(curTooltipStyle!=null)?curTooltipStyle.underline:false;
var textAlign = (qArgs>=8 )?addTooltipStyle.arguments[7] :(curTooltipStyle!=null)?curTooltipStyle.align:taDefault; var bgColor = (qArgs>=9 )?addTooltipStyle.arguments[8] :(curTooltipStyle!=null)?curTooltipStyle.bgColor:'#FFFFCC'; var bgImage = (qArgs>=10)?addTooltipStyle.arguments[9] :(curTooltipStyle!=null)?curTooltipStyle.bgImage:null;
var borderWidth = (qArgs>=11)?addTooltipStyle.arguments[10]:(curTooltipStyle!=null)?curTooltipStyle.borderWidth:1; var borderColor = (qArgs>=12)?addTooltipStyle.arguments[11]:(curTooltipStyle!=null)?curTooltipStyle.borderColor:'#000000'; var padding = (qArgs>=13)?addTooltipStyle.arguments[12]:(curTooltipStyle!=null)?curTooltipStyle.padding:3;
var customCSS = (qArgs>=14)?addTooltipStyle.arguments[13]:(curTooltipStyle!=null)?curTooltipStyle.customCSS:null; curTooltipStyle = new objTooltipStyle(id,fontFace,fontSize,fontColor,bold,italic,underline,textAlign,bgColor,bgImage,borderWidth,borderColor,padding,customCSS); tooltipStyles[tooltipStyles.length] = curTooltipStyle; };
function setTooltipStyleParameters() { }; function setTooltipStyle(id) { var style = getTooltipStyle(id); if (style!=null) curTooltipStyle = style; }; function addTooltip(id,text) { var qArgs = addTooltip.arguments.length; var style = (qArgs>=3)?addTooltip.arguments[2]:curTooltipStyle.id;
var width = (qArgs>=4)?addTooltip.arguments[3]:null; var height = (qArgs>=5)?addTooltip.arguments[4]:null; if (style==null) style = curTooltipStyle.id; style = getTooltipStyle(style); if (style==null) style = getTooltipStyle('default'); var tooltip = new objTooltip(id,text,style); if (width!=null)
tooltip.width = width; if (height!=null) tooltip.height = height; tooltipObjects[tooltipObjects.length] = tooltip; }; function setTooltipParameters() { }; function attachTooltip(htmlID) {
var tooltipID = (attachTooltip.arguments.length>1)?attachTooltip.arguments[1]:tooltipObjects[tooltipObjects.length-1].id; var tooltipObj = null; for (var i=0;i<tooltipObjects.length;i++) if (tooltipObjects[i].id==tooltipID) tooltipObj = tooltipObjects[i]; if (tooltipObj==null) return; attachedTooltips[htmlID] = tooltipObj; }; function endTooltips() { };
function runTooltips() { var canRun = isNS4 || isNS6 || isIE || isO5; if (!canRun) return; updateBrowserWindowSize(); var css = '<style type="text/css">'; for (var i=0;i<tooltipStyles.length;i++) css += tooltipStyles[i].createCSS(); css += '</style>'; var html = '';
for (var i=0;i<tooltipObjects.length;i++) html += tooltipObjects[i].createHTML(); document.write(html); if (!isNS4) { document.write(css); document.onmouseover = ttOnMouseOver; document.onmouseout = ttOnMouseOut; } else document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = ttOnMouseMove; window.onresize = ttOnResize; }; function objTooltipStyle(id,fontFace,fontSize,fontColor,bold,italic,underline,textAlign,bgColor,bgImage,borderWidth,borderColor,padding,customCSS) { this.id = id; this.fontFace = fontFace; this.fontSize = fontSize;
this.fontColor = fontColor; this.bold = bold; this.italic = italic; this.underline = underline; this.textAlign = textAlign; this.bgColor = bgColor; this.bgImage = bgImage; this.borderWidth = borderWidth; this.borderColor = borderColor; this.padding = padding;
this.customCSS = customCSS; this.createCSS = _createCSS; function _createCSS() { if (isNS4) return; var css = ''; if (this.fontFace) css = css+"font-family:"+this.fontFace+"; "; if (this.fontSize) css = css+"font-size:"+this.fontSize+"pt; "; if (this.fontColor)
css = css+"color:"+this.fontColor+"; "; if (this.bold) css = css+"font-weight:bold; "; if (this.italic) css = css+"font-style:italic; "; if (this.underline) css = css+"text-decoration:underline; "; if (this.textAlign) css = css+"text-align:"+this.textAlign+"; "; if (this.bgColor)
css = css+"background-color:"+this.bgColor+"; "; if (this.bgImage) css = css+"background-image: url("+this.bgImage+"); "; if (this.borderWidth) css = css+"border: "+this.borderWidth+" solid "+this.borderColor; if (this.customCSS) css = css+this.customCSS;
return('.'+tooltipsStylePrefix+this.id+' {'+css+"}\n"); }; }; function objTooltip(id,text,style) { this.id = id; this.text = text; this.style = style; this.width = defaultTooltipWidth; this.height = defaultTooltipHeight; this.layerObj = null; this.createHTML = _createHTML; this.setVisible = _setVisible;
this.setPosition = _setPosition; this.updatePosition = _updatePosition; function _createHTML() { var _text = this.text; if (this.style!=null) { if (isNS4) { if (this.style.bold) _text = "<b>"+_text+"</b>"; if (this.style.italic) _text = "<i>"+_text+"</i>"; if (this.style.underline)
_text = "<u>"+_text+"</u>"; _text = '<font face="'+this.style.fontFace+ '" point-size="'+this.style.fontSize+'" color="'+this.style.fontColor+'">'+_text+'</a>'; if (this.style.textAlign) _text = '<div align='+this.style.textAlign+'>'+_text+'</div>'; }; };
var _border = ((this.style) && (this.style.borderWidth))?this.style.borderWidth:0; var _html = '<table border=0 cellspacing=0 cellpadding='+_border; if (this.width) _html = _html+' width='+this.width; if (this.height) _html = _html+' height='+this.height; _html = _html+'><tr><td'; if ((this.style) && (this.style.borderColor))
_html = _html+' bgcolor='+this.style.borderColor; var _padding = ((this.style) && (this.style.padding))?this.style.padding:0; _html = _html+'><table border=0 cellspacing=0 cellpadding='+_padding; if (this.width) _html = _html+' width='+(this.width-2*_border); if (this.height)
_html = _html+' height='+(this.height-2*_border); _html = _html+'><tr><td'; if ((this.style) && (this.style.bgColor)) _html = _html+' bgcolor='+this.style.bgColor; if ((this.style) && (this.style.bgImage)) _html = _html+' background="'+this.style.bgImage+'"'; if ((this.style) && (!isNS4))
_html = _html+' class="'+tooltipsStylePrefix+this.style.id+'"'; _html = _html+'>'+_text+'</td></tr></table></td></tr></table>'; if (isNS4) _html = '<layer id="'+this.id+'" left="0" top="0" z-index="100" visibility="hide">'+_html+'</layer>'; else
_html = '<div id="'+this.id+'" style="position:absolute; left:0; top:0; z-index:100; visibility:hidden">'+_html+'</div>'; return(_html); }; function _setVisible(vState) { if (this.layerObj==null) this.layerObj = getLayer(this.id); setLayerVisibility(this.layerObj,vState); }; function _setPosition(x,y) { if (this.layerObj==null) this.layerObj = getLayer(this.id);
if (x<windowXMargin) x = windowXMargin; if (y<windowYMargin) y = windowYMargin; if ((this.width!=null) && ((x+this.width)>(windowWidth-windowXMargin-windowScrollbarSize))) x = windowWidth-windowXMargin-windowScrollbarSize-this.width; setLayerPosition(this.layerObj,x,y); };
function _updatePosition() { this.setPosition(mouseX+tooltipXOffset,mouseY+tooltipYOffset); }; }; function ttOnMouseOver(ev) { var id = null; if ((isNS4) || (new String(typeof(ev))=='string')) id = ev; else { var elm = null; if (isOpera || isNS6) { elm = ev.target; if (elm.id)
id = elm.id; }; if (isIE) { elm = window.event.toElement; if (elm.id) id = elm.id; }; if (tooltipsParentLookup) { do { if (hasTooltip(id)) { setToolipOn(id); return; }; elm = elm.parentNode; if ((elm) && (elm.id)) id = elm.id; } while (elm); }; }; setToolipOn(id);
}; function setToolipOn(id) { if (hasTooltip(id)) { var newTooltip = attachedTooltips[id]; if ((activeTooltip!=null) && (activeTooltip.id!=newTooltip.id)) { activeTooltip.setVisible(false); activeTooltip.setPosition(0,0); }; activeTooltip = newTooltip;
activeTooltip.updatePosition(); activeTooltip.setVisible(true); }; }; function ttOnMouseOut(ev) { if (activeTooltip) { activeTooltip.setVisible(false); activeTooltip.setPosition(0,0); activeTooltip = null; }; }; function ttOnMouseMove(ev) { if (isNS4 || isNS6) { mouseX = ev.pageX;
mouseY = ev.pageY; }; if (isOpera) { mouseX = ev.clientX; mouseY = ev.clientY; }; if (isIE) { mouseX = window.event.clientX + document.body.scrollLeft; mouseY = window.event.clientY + document.body.scrollTop; }; if (activeTooltip) activeTooltip.updatePosition(); };
function ttOnResize() { updateBrowserWindowSize(); if (activeTooltip) activeTooltip.updatePosition(); }; function hasTooltip(id) { return((id!=null) && (new String(attachedTooltips[id])!="undefined")); }; function getTooltipStyle(id) {
for (var i=0;i<tooltipStyles.length;i++) if (tooltipStyles[i].id==id) return(tooltipStyles[i]); return(null); }; function getLayer(layerID) { var _layer = null; if (isNS4) _layer = document.layers[layerID]; if (isNS6 || isOpera) _layer = document.getElementById(layerID); if (isIE)
_layer = document.all[layerID]; return(_layer); }; function setLayerVisibility(layerObj,vState) { if (!layerObj) return; var _state = (vState)?'visible':'hidden'; if (isNS4) layerObj.visibility=_state; else layerObj.style.visibility=_state; };
function setLayerPosition(layerObj,xPos,yPos) { if (isNS4) { layerObj.left=xPos; layerObj.top=yPos; } else { layerObj.style.left=xPos; layerObj.style.top=yPos; }; }; function updateBrowserWindowSize() { windowWidth = (isIE)?((document.body)?document.body.clientWidth:0):window.innerWidth;
windowHeight = (isIE)?((document.body)?document.body.clientHeight:0):window.innerHeight; };
