// ******************************************
// * Written By Tamir Mordo From *
// * www.tetitu.co.il *
// * no coping is allowed without permision *
// ******************************************
// ver 0.2 06/05/2004
// * added the function doAllReplacements() _
// * so i can call it after every javascript manipulation
var tooltiparray = new Array () // ids
var tooltiptextarray = new Array () // names to search and display tooltip for them
var tooltipbodyarray = new Array () // the tooltip text
document.onreadystatechange=fnStartInit;
function fnStartInit()
{
if (document.readyState=="complete")
{
// add the tootips texts to the HTML
var TollTipHolder= document.createElement("")
var ToolTipHolderText = ""
for (var i=0 ;i" + tooltipbodyarray[i] + ""
}
TollTipHolder.innerHTML = ToolTipHolderText
document.body.insertBefore(TollTipHolder);
// get all elemets from the html that i need to do the text replacement
// Finish initialization.
doAllReplacements()
}
}
function doAllReplacementsByName(inname)
{
var rcontent = ""
var elem
for (var i=0 ;i<, !\@#$%^&*()-\/\\\t`~;'"]/
while (inTextSearch.indexOf(inWordSearch,startSearchAt) != -1)
{
// alert (inText.indexOf(inWord,startSearchAt))
startSearchAt = inTextSearch.indexOf(inWordSearch,startSearchAt) + 1
// i need to check if it's a stand alone text
charBefore = new String(inTextSearch.charAt(startSearchAt -2))
charAfter = new String(inTextSearch.charAt(startSearchAt+inWordSearch.length -1))
// first or is if its the first word in the string only next char should be empty
// OR if it's in the middle both chars should be empty
// OR if it's the last word then only before char should be empty
// i dont handle a single word check
if ((startSearchAt==1 && blankre.test(charAfter)) ||
(startSearchAt>0 && blankre.test(charBefore) && blankre.test(charAfter)) ||
((startSearchAt + inWord.length)-1==inTextSearch.length && blankre.test(charBefore)))
{
// it's word in the sentance
// now i'm checking that i'm not within an html tag
openHtmlBefore = inText.lastIndexOf("<",startSearchAt)
closeHtmlBefore = inText.lastIndexOf(">",startSearchAt)
openHtmlAfter = inText.indexOf("<",startSearchAt)
closeHtmlAfter = inText.indexOf(">",startSearchAt)
if (!( openHtmlBefore > -1 &&
openHtmlBefore > closeHtmlBefore &&
closeHtmlAfter > -1 &&
(
(openHtmlAfter == -1) ||
(openHtmlAfter > closeHtmlAfter )
)
))
{
// ok i have a word now i need to put it into the transfer
// alert (inTextSearch.substring(lastStartIs + inWordSearch.length-1,startSearchAt+inWordSearch.length-1))
//outText+= inText.substring(lastStartIs +inWordSearch.length-1,startSearchAt-1) + "*" + inText.substr(startSearchAt-1,inWordSearch.length) + "*";
outText+= inText.substring(lastStartIs +inWordSearch.length-1,startSearchAt-1) + "" + inText.substr(startSearchAt-1,inWordSearch.length) + "";
lastStartIs = startSearchAt
}
}
else
{
// alert ("word not maching * " + (startSearchAt+inWord.length) + " * " + inText.length + " * " + charBefore + " * " + charAfter)
}
// i have the text now i need to check if im not in a tag : "<" tag ">"
// alert (openHtmlBefore + " * " + closeHtmlBefore + " * " + openHtmlAfter + " * " + closeHtmlAfter + " * " )
}
if (lastStartIs <=0)
//did nothing
outText = inText
else
{
if (lastStartIs + inWordSearch.length -1 < inTextSearch.length)
{
//i need to add the last part
outText+= inText.substring(lastStartIs +inWordSearch.length-1,inText.length)
}
}
//alert (outText + "\n" + inText + "\n" + startSearchAt + "\n" + lastStartIs + "\n" +inText.length)
return outText
}
function HideTip(elemid)
{
var myelem = document.getElementById("oTipZ"+elemid);
myelem.style.display = "none";
}
function ShowTip(elemid)
{
var oBody = window.document.body;
var iOffsetX = window.event.x - 10;
var iOffsetY = window.event.y + 18;
var myelem = document.getElementById("oTipZ"+elemid);
myelem.style.position = "absolute";
myelem.style["padding"] = "0 2 0 2";
myelem.style["backgroundColor"] = "#ffffe7";
myelem.style["borderStyle"] = "solid";
myelem.style["borderWidth"] = "1px";
myelem.style["borderColor"] = "black";
myelem.style["color"] = "black";
var iOffsetW = parseInt(myelem.style.width);
var iOffsetH = parseInt(myelem.style.height);
// Set the horizontal position of the tooltip
if (iOffsetX + iOffsetW > oBody.clientWidth)
{
myelem.style.left = oBody.clientWidth + oBody.scrollLeft - iOffsetW;
}
else myelem.style.left = iOffsetX + oBody.scrollLeft;
// Set the vertical position of the tooltip
if (iOffsetY + iOffsetH > oBody.offsetHeight)
{
myelem.style.top = oBody.clientHeight + oBody.scrollTop - iOffsetH;
}
else myelem.style.top = iOffsetY + oBody.scrollTop;
// Make the tooltip visible
myelem.style.display = "block";
}