\n" + "\n" + hlexmain.PAGE_END ;
hlexmain.hlexdummy.hlexscript.document.write(SearchScriptString);
hlexmain.hlexdummy.hlexscript.document.close();
}
}
}
function remTabs(text) {
var newText = "";
for(var i=0; i= 0) {
newText = text.substring(0, index);
newText += " ";
newText += text.substring(index+1,text.length);
text = newText;
}
index = 0;
while((index = text.indexOf("<", index)) >= 0) {
newText = text.substring(0, index);
newText += " ";
newText += text.substring(index+1,text.length);
text = newText;
}
index = 0;
while((index = text.indexOf(">", index)) >= 0) {
newText = text.substring(0, index);
newText += " ";
newText += text.substring(index+1,text.length);
text = newText;
}
return text;
}
//To hightlight the search string present inside the divided part of the chapter
function replacetext(Text, LowerText, SearchPattern){
var ReplacedString = "";
var wText_p1="";
var wText_p2="";
var wText_p3=Text;
while(LowerText.indexOf(SearchPattern.toLowerCase()) > -1){
searchIndex = LowerText.indexOf(SearchPattern);
wText_p1 = Text.substring(0,searchIndex);
wText_p2 = Text.substring(searchIndex,searchIndex+SearchPattern.length);
wText_p3 = Text.substring(searchIndex+SearchPattern.length);
LowerText = wText_p3.toLowerCase();
Text = wText_p3;
ReplacedString += wText_p1 + "" + wText_p2 + "";
}
ReplacedString += wText_p3;
return ReplacedString;
}
function searchPartChildChapters(chapter,searchedString) {
var wText ="";
var lowerwText ="";
for(var i=1;; i++) {
if (BrowserType == "Firefox")
{
if (typeof(eval("hlexmain."+chapter+'P'+i)) != "undefined")
{
wText=eval("hlexmain."+chapter+'P'+i);
}
else
{
break;
}
}
else
{
if (typeof(eval("hlexmain.hlexdummy.hlexscript."+chapter+'P'+i)) != "undefined")
{
wText=eval("hlexmain.hlexdummy.hlexscript."+chapter+'P'+i);
}
else
{
break;
}
}
// Need to highlight the search string
lowerwText=wText.toLowerCase();
newText = replacetext(wText,lowerwText,searchedString.toLowerCase());
hlexmain.hlexdummy.hlexdoc.document.write(newText);
}
return null;
}
function writeHighLight(fCoords, chapter) {
hlextbar.isPDFView = true;
if(!canEnableTree())
hlexmain.showTree(chapter);
hlexmain.currentChapter = chapter;
var wText="";
if (BrowserType == "Firefox")
{
var chapObj = eval("hlexmain."+chapter);
}
else
{
var chapObj = eval("top.hlexmain.hlexdummy.hlexscript."+chapter);
}
hlexmain.hlexdummy.hlexdoc.document.open()
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.PAGE_START);
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.BODY_START);
for(var i=0; i";
searchedString=chapObj.substring((coordsNew[0]), coordsNew[1]);
wText += chapObj.substring((coordsNew[0]), coordsNew[1]);
wText += "";
if(i==(fCoords.length-1)) {
wText += chapObj.substring(coordsNew[1], chapObj.length);
}
}
hlexmain.hlexdummy.hlexdoc.document.write(wText);
//Search in the divided parts of chapter if present
searchPartChildChapters(chapter,searchedString);
var childs = getChildChapters(chapter);
hlexmain.hlexdummy.hlexdoc.document.write(childs);
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.PAGE_END);
hlexmain.hlexdummy.hlexdoc.document.close();
push(chapter);
}
function getChildChapters(chapter) {
var childChapters = "";
for(var i=0; i= (chapter.length+1)) {
var chapName = hlexmain.CHAPTERS[i].substring(0, (chapter.length+1));
if(chapName == (chapter+'_'))
{
if (BrowserType == "Firefox")
{
childChapters += eval("hlexmain."+hlexmain.CHAPTERS[i]);
}
else
{
childChapters += eval("hlexmain.hlexdummy.hlexscript."+hlexmain.CHAPTERS[i]);
}
childChapters += getPartChildChapters(hlexmain.CHAPTERS[i]);
}
}
}
}
return childChapters;
}
//Added by Srimant : Return the contents of all the divided parts of the chapter
// to be used during Search
function getPartChildChapters(chapter) {
var partChapter = "";
for(var i=1;; i++) {
if (BrowserType == "Firefox")
{
if (typeof(eval("hlexmain."+chapter+'P'+i)) != "undefined")
{
partChapter += eval("hlexmain."+chapter+'P'+i);
}
else
{
break;
}
}
else
{
if (typeof(eval("hlexmain.hlexdummy.hlexscript."+chapter+'P'+i)) != "undefined")
{
partChapter += eval("hlexmain.hlexdummy.hlexscript."+chapter+'P'+i);
}
else
{
break;
}
}
}
return partChapter;
}
//Added by Srimant : Write the contents of all the divided parts of the chapter
function writePartChildChapters(chapter) {
for(var i=1;; i++) {
if (BrowserType == "Firefox")
{
if (typeof(eval("hlexmain."+chapter+'P'+i)) != "undefined")
{
hlexmain.hlexdummy.hlexdoc.document.write(eval("hlexmain."+chapter+'P'+i));
}
else
{
break;
}
}
else
{
if (typeof(eval("hlexmain.hlexdummy.hlexdoc."+chapter+'P'+i)) != "undefined")
{
hlexmain.hlexdummy.hlexdoc.document.write(eval("hlexmain.hlexdummy.hlexscript."+chapter+'P'+i));
}
else
{
break;
}
}
}
return;
}
function writeChap(chapter, isPop, treeUpDate) {
//For Parallel PDF option
if(chapter == "PDF")
{
showParallelPDF();
}
else
{
hlextbar.isPDFView = true;
if (BrowserType != "Firefox"){
if(!isPop)
push(chapter);
}
hlexmain.currentChapter = chapter;
var chapObj = "hlexmain."+chapter;
if(chapObj == "hlexmain.C0")
{
if(!canEnableTree())
hlexmain.showTree("C0");
writeDocument();
}
else
{
//Need to link the correct JavaScript File
var indexpart = chapter.indexOf('C');
var newText = chapter.substring(indexpart+1, indexpart+2);
if(chapter.indexOf('_') > 0) {
newText = chapter.substring(indexpart+1,chapter.indexOf('_'));
} else {
newText = chapter.substring(indexpart+1);
}
var newpart = "PART" + newText + ".js" ;
if (chapter != "TOP" )
{
if (BrowserType != "Firefox")
{
hlexmain.hlexdummy.hlexscript.document.open();
hlexmain.hlexdummy.hlexscript.document.write(hlexmain.PAGE_START);
//Write the chapter content and Update the tree structure
var ScriptString = "\n" + "\n" + hlexmain.PAGE_END ;
hlexmain.hlexdummy.hlexscript.document.write(ScriptString);
hlexmain.hlexdummy.hlexscript.document.close();
return;
}
else
{
hlexmain.hlexdummy.hlexdoc.document.open();
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.PAGE_START);
}
}
if (chapter != "TOP" )
{
if (BrowserType == "Firefox")
{
var chapObj = eval("hlexmain."+chapter);
}
}
else
{
var chapObj = eval("hlexmain."+chapter);
}
if (chapter == "TOP" ) {
hlexmain.hlexdummy.hlexdoc.document.open();
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.PAGE_START);
}
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.BODY_START);
hlexmain.hlexdummy.hlexdoc.document.write(chapObj);
if (chapter == "TOP" ) {
for(var i=1;; i++) {
if (typeof(eval("hlexmain.TOP"+i)) != "undefined")
{
hlexmain.hlexdummy.hlexdoc.document.write(eval("hlexmain.TOP"+i));
}
else
{
break;
}
}
}
writePartChildChapters(chapter);
var childs = getChildChapters(chapter);
hlexmain.hlexdummy.hlexdoc.document.write(childs);
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.PAGE_END);
hlexmain.hlexdummy.hlexdoc.document.close();
if(!canEnableTree() && treeUpDate)
hlexmain.showTree(chapter);
}
}
if (BrowserType == "Firefox"){
if(!isPop)
push(chapter);
}
}
function writeDocument() {
if (BrowserType != "Firefox")
{
var SearchScriptString = "";
hlexmain.hlexdummy.hlexscript.document.open();
hlexmain.hlexdummy.hlexscript.document.write(hlexmain.PAGE_START);
for(var j=0; j<\/script>\n";
}
SearchScriptString = SearchScriptString+"\n" + "\n" + hlexmain.PAGE_END ;
hlexmain.hlexdummy.hlexscript.document.write(SearchScriptString);
hlexmain.hlexdummy.hlexscript.document.close();
return;
}
hlexmain.hlexdummy.hlexdoc.document.open();
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.PAGE_START);
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.BODY_START);
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.TOP);
for(var i=1;; i++) {
if (typeof(eval("hlexmain.TOP"+i)) != "undefined")
{
hlexmain.hlexdummy.hlexdoc.document.write(eval("hlexmain.TOP"+i));
}
else
{
break;
}
}
for(var i=0; i', (j+1)))-j);
c = ' ';
}
if((c == '\n') || (c == '\t'))
c = ' ';
if(c == '&') {
j += ((text.indexOf(';', (j+1)))-j);
c = ' ';
}
if(lastFound == ' ' && c == ' ') {
continue;
}
if(c.toLowerCase() == search.charAt(sLen)) {
lastFound = c;
if(foundIndex == 0 && !isFoundIndex) {
foundIndex = j;
isFoundIndex = true;
}
sLen++;
if(sLen == search.length) {
var coords = new Array(foundIndex, (j+1));
foundIndex=0;
fCoords[fCoords.length] = coords;
}
} else {
sLen = 0;
foundIndex = 0;
isFoundIndex = false;
}
if(j>=(text.length-1) && fCoords.length>0) {
writeHighLight(fCoords, chapters[i]);
anyFounds = true;
return;
}
}
}
if(anyFounds) {
alert("Finished searching the document.");
srcRerun = true;
} else {
alert("Search string not found!");
}
}
function writeDocumentIE() {
hlexmain.hlexdummy.hlexdoc.document.open();
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.PAGE_START);
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.BODY_START);
hlexmain.hlexdummy.hlexdoc.document.write(hlexmain.TOP);
for(var i=1;; i++) {
if (typeof(eval("hlexmain.TOP"+i)) != "undefined")
{
hlexmain.hlexdummy.hlexdoc.document.write(eval("hlexmain.TOP"+i));
}
else
{
break;
}
}
for(var i=0; i