Theme Discovery Add in for Logos 3.0

John David Wade
John David Wade Member Posts: 7
edited November 20 in English Forum

Years ago I was given a Theme discovery add in for my Logos software and my computer crashed and I had to redo everything.  I found the link for the add in but that site no longer exists.  Does anyone have this or know where I can find it? I used it all the time.  Thanks

Tagged:

Comments

  • Mark Smith
    Mark Smith Member, MVP Posts: 11,790 ✭✭✭

    Here is a screen shot of the code in the window it needs to be inserted. You get to this window by creating a custom toolbar item (Theme Discovery) then selecting "Run Script Code", then clicking on that in the RH pane and selecting Details.

    image

    Here is the code:

    var objFileOperations = new ActiveXObject("Utility.LbxFileOperations");
    var strFilePath = objFileOperations.GetSpecialFolder("MyDocuments");
    strFilePath += "\\automatingx\\Theme Discovery Report\\ThemeDiscovery.hta";
    objFileOperations.OpenDocument(strFilePath);

     

    Pastor, North Park Baptist Church

    Bridgeport, CT USA

  • John David Wade
    John David Wade Member Posts: 7

    That is perfect!  I got it loaded up and the little icon is on the toolbar but nothing seems to happen when I click on it.  I forgot how to use it.  I thought I remembered a window popping up and i would enter the passage or book.

    Thank you so much for your help.

    John

  • John David Wade
    John David Wade Member Posts: 7

    It doesn't work, ohhhhhhhh I'm so close I can feel it, lol, what am I missing? Is there more to it than just adding the script?

     

  • Francis
    Francis Member Posts: 3,807

    I don't know if this is what you are missing but I still have from the old installation another file, TDR.rep which was installed into My Documents\\AutomatingX\Theme Discovery Report. I post here the contents of the file and you can paste it into a regular notepad file and then change the extension to .rep and save it in a path like the one above. Then see if it works.

    File contents:


    <HTML xmlns:dlg xmlns:rpt><HEAD>

    <LINK title=dlgStyle href="" type=text/css rel=stylesheet>

    <LINK title=rptStyle href="" type=text/css rel=stylesheet>

    <STYLE>

    .rptOutput .Heading {

    font-weight: bold;

    padding-top: 3pt;

    }

     

    .divIndent {

    margin-left: 24pt;

    }

    </STYLE>

    </HEAD>

    <BODY>

    <!---

    //==================================================================//

    //This report is based on Englishmans Contextual Concordance.    //

    // http://www.chooselife.org.au/dean/ECC.htm    //

    // I asked Libronix (Bob) to create such a report however I got    //

    // tired of waiting.  I use this tool regularly to discover the    //

    // key themes in the both the OT and NT.  The report works better   //

    // in the OT because it doesn't include words like:            //

    //    "it, he, she, which, and" etc.    //

    // This is because Hebrew joins these words to the nouns and verbs. //

    //    //

    // This report is not supported by Libronix.    //

    // Please continue to support the gospel programmers of Libronix by //

    // purchasing their wonderful Addins under 'tools unlock'    //

    //==================================================================//

    -->

     

     

    <!--- changes by John McComb March 21, 2005

           - moved the report to a generic file (TDR.REP) for a report window application

      - removed GetObject and ActiveXObject function calls

      - changed all objLDLS references to "window.external.Application"

      - added a  rptExpandCollapse funtion to stop traps when the Settings bar is double clicked.

        The controls section now disappears and reappears when that bar is clicked.

       - added a "Save" button to save preferences. Removed the code to save preferences when

         the window is closed.

       - added funtionality to open the report with the active bible reference in the Verse Range

         window. The verse range added comes from the active reference of the most recently

        active resource window that is indexed by datatype 'bible'.

      - changed the Reset button to load the user preferences instead of the original defaults. On

         reset the Verse Range is loaded with the active bible reference if applicable. Otherwise it

     loads the range stored in the users preferences.

      - removed the 'OnReset' function.

      - changed the help button to a toggle button and removed the 'Close Help' tag.

      -changed the version to 2.0

        New Funtions:

                            rptExpandCollapse

                   GetDatatypeRef

                toggleHelp

        Deleted Funtions:

                    OnReset

        Changed Funtions:

                            OnUnLoad

                OnHelp

     

    John McComb - jmccomb1@telus.net

    -->

    <!---

    Version 2.1 March 23, 2005

     

              Fixed the font mismatch problem.

               fix ever growing Stongs Bible list bug.

     

                    John McComb - jmccomb1@telus.net

    -->

     

    <!---

    Version 2.2 March 25, 2005

     

             - Fixed so that it display using the User Interface Style set for LDLS

    by the user in the TOOLS->OPTIONS->INTERFACE DIALOG

     

              - Added Upper Limit Control for max no of occurences to be displayed by Report

     

     

                    Andrew Mckenzie - netsurfer71@hotmail.com & Karl B. Jones - karl-jones@aireville.fsnet.co.uk

    -->

     

    <!---

    Version 2.3 March 31, 2005

     

             - Added Get Active Reference button to get active reference. If there is no active bible, the save value

    in preference file is used, if no saved value, defaults to Genesis 1

     

             - Added fix so that if max words set to value below min words, max words automatically set to min words

     

             - format of instructions freshened up so that it now uses colour from LDLS User Interface Style

     

     

                    Andrew Mckenzie - netsurfer71@hotmail.com

     

    Version 2.3a  April 1, 2005

     

             -  modified the description of the limits so that they more accurately describe how they are limiting what words to include. 

     

     

                    Floyd Johnson - floydj@netins.net <floydj@netins.net>

     

    Version 2.3b  April 11, 2005

     

             - fixed bug that was causing Save feature not to work for min and max values

     

     

                    Andrew Mckenzie - netsurfer71@hotmail.com

    -->

     

     

    <SCRIPT language=JScript id=scriptRptCode src=""></SCRIPT>

     

    <SCRIPT language=JScript id=scriptCommonUI src=""></SCRIPT>

     

    <SCRIPT language=JScript id=scriptCommon src=""></SCRIPT>

     

    <SCRIPT language=JScript id=scriptBibleUtility src=""></SCRIPT>

     

    <SCRIPT language=JScript>

    scriptRptCode.src = external.Application.NamedFileTable.Item("rptCode");

    scriptCommon.src = external.Application.NamedFileTable.Item("ScriptCommon");

    scriptCommonUI.src = external.Application.NamedFileTable.Item("CommonUI");

    scriptBibleUtility.src = external.Application.NamedFileTable.Item("ScriptBibleUtility");

    </SCRIPT>

     

    <rpt:Report position="bottom">

    <rpt:ControlPanelContainer>

    <rpt:ControlPanelLabel>

    <table cellspacing="0" class="tblControlPanelLabel" ID="Table1">

    <tr>

    <td class="tblControlPanelLabel">Settings</td>

    <td width=100% align=right onclick='rptExpandCollapse()' ondblclick='rptExpandCollapse()'><span id='spanExpandContract'></span></td>

    </tr>

    </table>            <!--//Table1-->

    </rpt:ControlPanelLabel>

     

    <rpt:ControlPanel>

    <table id="Controls">

    <tr>

    <td nowrap><u>V</u>erse Range:</td>

    <td width="100%"><input type="text" class="txtInput" id="txtVerseRange" style="WIDTH: 100%"  required="true" NAME="txtVerseRange" size="20"></td>

    <TD noWrap><BUTTON id=btnGetActiveChapter onclick='GetActiveChapter()'>Get <u>A</u>ctive</BUTTON> </TD>

    </tr>

    <tr>

    <td><u>V</u>ersion:</td>

    <td width="100%"><select id="selBibles" style="WIDTH: 100%" NAME="selBibles"></select></td>

    </tr>

    <tr>

    <td></td>

    <td><table ID="Table2">

    <tr>

    <td><input type="checkbox" id="cbShowKeyLinks" NAME="cbShowKeyLinks" checked value="ON"></td>

    <td><table style="WIDTH: 100%" ID="Table3">

    <tr>

    <td nowrap>Show Up To <u>F</u>irst&nbsp;</td>

    <td width="32"><input type="text" id="txtKeyLinkCount" class="txtInput" style="WIDTH: 24pt" required="true" onchange="cbShowKeyLinks.checked = true" NAME="txtKeyLinkCount" size="20"></td>

    <td><label for="txtKeyLinkCount">&nbsp;<u>K</u>eyLink Destinations</label></td>

    </tr>

    </table></td>             <!--//Table 3-->

    </tr>

    </table></td>            <!--// Table 2-->

    </tr>

    <tr>

    <td>&nbsp;</td>

    <td><table ID="Table3a">

    <tr>

    <td><input type="checkbox" id="cbIncludeText" NAME="cbIncludeText" onclick="cbTextClick()" checked value="true"></td>

    <td nowrap>Show Bible Text</td>

    <td width="50">&nbsp;</td>

    <td id="TrimText"><input type="checkbox" id="cbTrimText" NAME="cbTrimText" onclick="cbTrimClick()" checked value="true">&nbsp;Trim Bible Text</td>

     

    </tr>

    </table> <!--// Table 3a-->

    </tr>

    <tr>

    <td>&nbsp;</td>

    <td><table ID="Table4">

    <tr>

    <td nowrap>Do not include words that occur less than&nbsp;</td>

    <td width="32"><input type="text" id="txtMinWords" class="txtInput" onChange="txtMinWordsChange()" style="WIDTH: 24pt" required="true"  NAME="txtMinWords" size="20"></td>

    <td id="MinWordsTimes">&nbsp;times and</td>

    </tr>

    <tr> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or more than &nbsp;</td>

    <td width="32"><input type="text" id="txtMaxWords" class="txtInput" onChange="txtMaxWordsChange()" style="WIDTH: 24pt" required="true"  NAME="txtMaxWords" size="20"></td>

    <td id="MaxWordsTimes">&nbsp;times.</td>

    </tr>

    </table>               <!--// Table 4-->

    </tr>

    </table>               <!--// Table Controls-->

     

     

    <dlg:Space></dlg:Space>

     

    <table ID="Table5">

    <tr>

    <td width="100%">

    <button id="btnSave" onclick="SavePrefs()" type="button"><u>S</u>ave</button>

                                             </td>

    <td nowrap>

    <button id="btnUpdate" onclick="OnGenerate()" type="button"><u>G</u>enerate</button>

    <dlg:ButtonSpace></dlg:ButtonSpace>

    <button id="btnReset" onclick="LoadPrefs()" type="button">Reset Form</button>

    <dlg:ButtonSpace></dlg:ButtonSpace>

    <button id="btnInstructions"  onclick="showInsructions()" type="button">Toggle Help</button>

    </td>

    </tr>

    </table>     <!--// Table 5-->

    <table id="ProgressBarContainer">

    <tr>

    <td><button id="btnStopProgressBar" type="button" onclick="Stop()">Stop</button></td>

    <td class="tblGutter">&nbsp;</td>

    <td style="width: 100%;"><rpt:ProgressBar></rpt:ProgressBar></td>

    </tr>

    </table>          <!--// ProgressBarContainer-->

    </rpt:ControlPanel>

    </rpt:ControlPanelContainer>

     

     

    <rpt:ReportContents>

     

    <table width="100%">

    <tr>

    <td><table width="100%">

    <tr>

    <td nowrap><h1 id="rptTitle">Theme Discovery</h1></td>

    <td nowrap>(2.3)</td>

    <td nowrap align="right" width="100%">By: Dean Montgomery</td>

    </tr>

    </table></td>

    </tr>

    <tr>

    <td>Based on&nbsp;<a href="http://www.chooselife.org.au/dean/ECC.htm" target="_blank">Englishmans Contextual Concordance</a></td>

    </tr>

    </table>

     

    <h2 id="rptSubTitle"></h2>

    <dlg:Space></dlg:Space>

    <div id="divHelp"></div>

    <dlg:Space></dlg:Space>

    <div id="divOutput"></div>

    <dlg:Space></dlg:Space>

    </rpt:ReportContents>

    </rpt:Report>

     

     

    <script language="JavaScript">

    //Global Variables

    //************************************************** extra golbal variables for the bug busting code *********************************************************

    // var bugEndChapter;  // stores chapter at which processHits is to stop

    // var bugEndVerse;  // stores verse at which processHits is to stop

    // var bugContinue = true;  // boolean - should processHits continue with extracting bibletext for hits?

    //*************************************************************************************************************************************************************

     

    var KeyLinkHandler = window.external.Application.KeyLinkHandler;

    var ScriptUtil = window.external.Application.ScriptUtil;

     

    var g_objLibrarian = window.external.Application.Librarian;

    var g_objRes = null;

    var g_strResourceID = "";

    var g_strVerse;

    var g_strLanguage = window.external.Application.Options.Language;

    var g_intStrongs;

    var g_i;

    //var g_progCounter;

    var g_strOutput = "";

    var g_stop;

    var QueryParser = window.external.Application.QueryParser;

    var g_oldTestament;

    var g_strongsPrefix;

    var g_searchPrefix;

    var g_objSearchAgent = null;

    var g_bSearchAgentConnected = false;

    var g_nSearchAgentConnectionCookie = -1;

    var g_nHitsProcessed = 0;

    var g_nHitCount = 0;

    var g_nResultCount = 0;

    var g_xmlResults = null;

    var g_strDefaultScheme = "";

    var g_xslNewVersesTemplate = null;

    var c_strNoStrongsNumber = "--";

    var g_objDataTypeManager = window.external.Application.DataTypeManager;

    var g_rgStrongs = null;

    var g_rgLocal = null;

    var g_stopAt = 0;

    var g_objPrefs = window.external.Application.UserPreferences( "LDLSu/UserInterface/Reports" );

    var g_superscript = new Array();

     

    //Begining of Program

     

    function OnLoad()

    {

    //Preferences are stored here//C:\Documents and Settings\User Name\Application Data\Libronix DLS\Library\Preferences

    document.title = rptTitle.innerText;

    LoadPrefs();

    rptAttachProgressBar();

    //InitLocalSearchAgent();

    LoadVerseTemplates(true);

    }

     

    function OnGenerate()

    {

         rptShowProgressBar();

    g_stop = false;

         hideInstructions();

    g_rgStrongs = new Array();

    g_rgLocal = new Array();

     

         var strRange = getRange();  //Step 1

         if (strRange == "")

         {

    rptHideProgressBar();

    return;

         }

     

    g_intStrongs = extractStrongs(strRange);  //Step 2

    g_i = 0;

    g_strOutput = "";

     

    //Calculate stop value

    //if (parseInt(txtMinWords.value<1)) txtMinWords.value = "1";

    var stopValue = utilParseInt(txtMinWords.value, 2)

    g_stopAt = 0;

    while ((g_intStrongs[g_stopAt + 1]!=null) && (g_intStrongs[g_stopAt + 1].count >= stopValue) && (g_intStrongs[g_stopAt + 1].count > 0)){g_stopAt++;}

    g_stopAt++;

     

    //'setTimeout()' is used instead of a loop because it allows the screen to refresh

    // which makes the progress bar and stop button function properly

    setTimeout(generateReport,0);  //Step 3

     

    }

     

    function getRange()

    {

    //===========================================================

    //Step 1) Get range of verses

    //===========================================================

    var strVerse = txtVerseRange.value;

     

         //g_strResourceID = "LLS:1.0.71"; // NASB95'

         //g_strResourceID = "LLS:1.0.3"; //KJV

         if ( selBibles.selectedIndex >= 0 ) g_strResourceID = selBibles[selBibles.selectedIndex].value;

         g_objRes = window.external.Application.Librarian.OpenResource(g_strResourceID);

         g_strDefaultScheme = GetResourceDefaultBibleScheme(g_objRes);

     

                 //Parses strVerse (Gen 1:1) into data type reference (bible.1.1.1) //range? "bible.1.1.1-1.1.10"

      var objParseResults = window.external.Application.DataTypeManager.Parse("bible", strVerse, "en");

          g_strVerse = objParseResults.Reference;

     

    //*************************************************** Extra code added due to v2 bug ************************************************************************************************

    // extract verses and chapters from reference range e.g. from bible.1.1.1-1.1.10 return bugChapter[0]=1 bugVerse[0]=1 and bugChapter[1]=1 bugVerse[1]=10

    //        var bugVerse = new Array(2);

    // var bugChapter = new Array(2);  //variables added so can find chapter and verse of g_strVerse in getRange so processHits doesn't process more verses than required

    //       bugChapter[1]=0;

    //       bugVerse[1]=0;

    //       var arrSplitVerseRange = g_strVerse.split("-");

     

    //       for (var c = 0; c < arrSplitVerseRange.length; ++c)  // for each part of the range i.e. c goes from 0 to 1 only

    //       {

    //       var strStartVerse = arrSplitVerseRange[c]

    //       var arrSplitVerse = strStartVerse.split(".");

    //       bugChapter[c] = parseInt(arrSplitVerse[2-c]);   //-c because if c=1 ie 2nd part of string there is no "bible."

    //       if (arrSplitVerse.length > (3-c)) {bugVerse[c] = parseInt(arrSplitVerse[3-c]);}

    //       else {bugVerse[c] = 0;}   // i.e. no verse part e.g. if refstring was Genesis 1

    //       }

     

    //       //if a range set bugChapter[1] and bugVerse[1] to that final ref else set to 0

    //       bugEndChapter = (bugChapter[1]==0) ? bugChapter[0] : bugChapter[1];

    //       bugEndVerse = (bugChapter[1]==0) ? bugVerse[0] : bugVerse[1];

    //***********************************************************************************************************************************************************************************

     

         //Add a the verse heading.

         rptSubTitle.innerHTML = window.external.Application.DataTypeManager.Render( g_strVerse, window.external.Application.Options.Language, "long" );

     

    //Creates a text range from a data type reference

         var objRange = g_objRes.TextRanges.CreateRangeFromReference(g_strVerse);

     

         if (objRange == null)

         {

    alert("Invalid Verse Range");

    return "";

         }

     

         //the next line lists all the fields you can include.

         //var strRange = objRange.Text("rich-text|fields=yes|refs=yes|footnotes=yes|xrefs=yes")

         var strRange = objRange.Text("rich-text|xrefs=yes|refs=yes");

         //alert("strRange="+strRange);

     

    //Set if we are in NT or OT

    g_oldTestament = isOT( g_strVerse );

     

    if (g_oldTestament)

    {

    g_strongsPrefix = "strongs+h";

    g_searchPrefix = "HebrewStrongs=";

    }

    else

    {

    g_strongsPrefix = "strongs+g";

    g_searchPrefix = "GreekStrongs=";

    }

    return strRange;

    }

     

    function extractStrongs(strRange)

    {

    //===========================================================

    //Step 2) Extract strongs from verses & Sort strongs number

    //===========================================================

    var intStrongs = new Array();

    var pointer = 0;

    var endP = strRange.lastIndexOf(g_strongsPrefix);

    var intNum = 0;

     

    var nFindSup = 0;

    var strCheckverse = "";

    var nCheckverse = 0;

     

    var intEndofRange = strRange.length;

    var intEndofVerse  = 0;

    var engpointer = 0;

    var intVerseStart = 0;

    var intRefStart = 0;

    var intNextRefStart = 0;

    var intPrevSpan=0;

    var intPrevCloseSpan=0;

    var strVerseRef="";

    var strStrongsEng="";

    var intNextVerseStart = 5;  // so while will work first time and stop when intNextVerse = 4 i.e the indexOf was -1

     

     

    //alert("extractStrongs:strRange="+strRange);

     

    // intVerseStart = strRange.indexOf("<sup>",intNextVerseStart)+5; //5 is number of characters in <sup>

    pointer = strRange.indexOf(g_strongsPrefix + ".", pointer + 1) + 10; //1st strongs number

    //engpointer = strRange.indexOf("en-us\">", pointer)+ 7;

     

    //while (intNextVerseStart >= 5) { //loop until no more verses

     while (intEndofVerse < intEndofRange) {

     

    intRefStart = strRange.indexOf("bible.", intVerseStart);

     

    intVerseStart = (pointer < intRefStart) ? intRefStart : pointer;

     

    engpointer = strRange.indexOf("en-us\">", pointer)+ 7;

     

    strVerseRef = (strRange.slice(intRefStart, strRange.indexOf("\"", intRefStart))); //returns e.g. bible.1.1.1 for Gen 1v1

     

    intNextRefStart = strRange.indexOf("bible.", intRefStart + 6);

     

    if (intNextRefStart > 0) {

    intPrevSpan = strRange.lastIndexOf("<span", intNextRefStart);

    intPrevCloseSpan =strRange.lastIndexOf("</span", intNextRefStart);

    intNextVerseStart = (intPrevSpan > intPrevCloseSpan) ? intPrevSpan : intNextRefStart;

    intEndofVerse = intNextVerseStart -1;

    }

    else

    {

    intEndofVerse = intEndofRange;

    }

     

    while ( pointer < intEndofVerse )

     

    {

    //alert("extractStrongs: intEndofVerse="+intEndofVerse+"; pointer="+pointer);

    intNum = strRange.substring(pointer, strRange.indexOf("\"",pointer));

    strStrongsEng = strRange.slice(engpointer, strRange.indexOf("</span>", engpointer));

    var strNum = "" + parseInt(intNum);  //extract the numeric number

    var strSuffix = intNum.slice(strNum.length);//extract the suffix e.g. if strongs was 1254a

    if (intNum != "0")

    {

    if (intStrongs[intNum] != null)

    {

    intStrongs[strNum].count += 1;

    intStrongs[strNum].refs = intStrongs[strNum].refs + ";"+ strVerseRef; //add reference to array

    intStrongs[strNum].eng = intStrongs[strNum].eng+ ";"+ strStrongsEng; //add english translation to array

    if (strSuffix != "") {intStrongs[strNum].suffix = intStrongs[strNum].suffix + ";"+ strSuffix;} //if theres a suffix add it to array

    //alert("extractStrongs: Added instance of  "+ intStrongs[strNum].number +" where ref = "+strVerseRef+" and English = "+strStrongsEng);

    }

    else

    {

    intStrongs[strNum] = new objElt(strNum,1,strVerseRef, strStrongsEng, strSuffix);

    //alert("extractStrongs: Created "+ intStrongs[strNum].number + " where ref = "+strVerseRef+" and English = "+strStrongsEng);

    }

    }

    pointer = strRange.indexOf(g_strongsPrefix + ".", pointer + 1) + 10; // get next strongs number

     

    if (pointer<10) {pointer=intEndofVerse;} // <10 i.e the indexof = -1 ; pointer =intEnd of verse stops while loop

    else {engpointer = strRange.indexOf("en-us\">", pointer)+7;}  //next english text

    }

    intVerseStart = intNextVerseStart-1;

    }

     

    //sort the array of strongs number objects (see 'compare' function for sort method)

    intStrongs.sort(compare);

    return intStrongs;

    }

     

     

    //This is an individual strongs number object with (number, count, refs, eng, suffix)

    function objElt(number,count, refs, eng, suffix)

    {

    this.number = number;

    this.count = count;

    this.refs = refs;

    this.eng = eng;

    this.suffix = suffix;

    }

     

    //This is used for sorting strongs numbers

    function compare(a,b)

    {

    return parseInt(b.count) - parseInt(a.count)

    }

     

     

    function generateReport()

    {

    //===========================================================

    //Step 3) Generate Report Output

    //===========================================================

     

    var fContinue = true;

     

    //loop through each strongs number

    //debugger;

     

     

    //strOutput += getText("LLS:1.0.3", g_strongsPrefix + ".431")

    //lower limit is set here (stop at 2 occurances or less)

    fContinue = ( (g_intStrongs[g_i] != null) && (g_stopAt > g_i) );

    if ( fContinue && !g_stop)

    {

    //debugger;

    //Start searching for occurance text

    //eccTextSearch( "HebrewStrongs=430", "bible.1.1.1-1.1.5" );

    if (cbIncludeText.checked){

     

    setTimeout(ProcessHits, 0 );

    }

    if (g_intStrongs[g_i].count <= txtMaxWords.value)

    {

    //--------------------

    // section heading

    //--------------------

    //Contextual Search Link

    var strOccuranceEnd = (g_intStrongs[g_i].count==1) ? " time.</h3><br>" : " times.</h3><br>";

    var strOccurance = "<h3>" + g_intStrongs[g_i].number + g_intStrongs[g_i].suffix + " occurs about " + g_intStrongs[g_i].count + strOccuranceEnd;

    var strSearchLink = "<table class='rptOutput'>";

    strSearchLink += "<tr><td><a href=\"javascript:eccSearch('" + g_searchPrefix + g_intStrongs[g_i].number + "'" + ",'" + g_strVerse + "');\">" + strOccurance + "</a></td></tr>";

    strSearchLink += "</table>";

    g_strOutput += strSearchLink;

     

     

    //--------------------

    // occurance keylinks

    //--------------------

    var strStrongsReference = g_strongsPrefix + "." + g_intStrongs[g_i].number;

    if ( cbShowKeyLinks.checked == true )

    {

    var objKeyLinkDataType = KeyLinkHandler.DataTypes( strStrongsReference );

    if ( objKeyLinkDataType != null )

    {

    var objKeyLinkResults = KeyLinkHandler.KeyLink( strStrongsReference, "verb-type=resource", utilParseInt(txtKeyLinkCount.value, 20) );

     

    if ( objKeyLinkResults.Count )

    {

        //version 2.1 - fix the font 'box' problem by adding the style attribute.

    var strKeyLinks = "<table class='rptOutput' style='font-family:Arial Unicode MS'>";

    for ( var x = 0; x < objKeyLinkResults.Count; ++x )

    {

    var strID = document.uniqueID;

     

    if ( objKeyLinkResults.Item(x).Command.substr( 0, 4 ) == "jump" )

    strKeyLinks += "<tr><td onclick=\"ExpandKeyLink('" + strID + "', '" + objKeyLinkResults.Item(x).Command + "');\" onkeydown=\"if (window.event.keyCode == 13) ExpandKeyLink('" + strID + "', '" + objKeyLinkResults.Item(x).Command + "');\" class='tblCollapsed'><span class='tblCMk' tabindex='0'>4</span><span class='tblEMk' tabindex='0'>6</span></td>";

    else

    strKeyLinks += "<tr><td></td>";

     

    strKeyLinks += "<td><a href=\"javascript:utilExec('" + objKeyLinkResults.Item(x).Command + "');\">" + ScriptUtil.HTML.RenderText( window.external.Application.DescribeCommand( objKeyLinkResults.Item(x).Command ) ) + "</a></td></tr>";

    strKeyLinks += "<tr style='display: none;' id='" + strID + "'><td></td><td id='" + strID + "Cell'></td></tr>";

    }

    strKeyLinks += "</table>";

     

    g_strOutput += strKeyLinks

     

     

    }

    }

    }

     

     

    // "HebrewStrongs=430" Syntax for searching a number in Libronix

    //<a href="libronixdls:dialog|name=SearchBible|search=HebrewStrongs=430|range=bible.1.1.1-1.1.10|res=LLS:1.0.3">

     

    //Englishmans Link

    //<a href="javascript:utilExec("report|name=ReportEnglishmans|reference=strongs+h.7225|res=LLS:1.0.71");">Generate Englishman's Concordance for H7225</a>

    g_strOutput += "<a href=\"javascript:utilExec('report|name=ReportEnglishmans|reference=" + strStrongsReference + "|res=" + g_strResourceID + "');\">Generate Englishman's Concordance for Strong's Number " + g_intStrongs[g_i].number + "</a><br>";

     

    //--------------------------

    // occurance text lands here

    //--------------------------

    }

    }//end of item

     

    //debugger;

    rptSetProgressBar(g_i / g_stopAt * 100);

    fContinue = ( (g_intStrongs[g_i + 1] != null) && (g_stopAt > g_i) );

    if (fContinue && !g_stop)

    {

    if (!cbIncludeText.checked)

    {

    if (g_intStrongs[g_i].count <= txtMaxWords.value){ g_strOutput += "<hr>"};

    g_i++;

    setTimeout(generateReport,0); //Loop

    }

     

    //If cbIncludeText.checked then this function dies and waits for ProcessHits to finish

    // then this function is called again for the next item.

    }

    else   //all finished - all strongs numbers processed then display results

    {

    divOutput.innerHTML = g_strOutput;

    rptHideProgressBar();

    }

     

     

    }

     

     

    function Stop()

    {

    g_stop = true;  //Stop Report

    }

     

     

    function cbTextClick()

    {

    //Hide or Show TrimText check box

    if (!cbIncludeText.checked)

    {

    if ( typeof(TrimText) == "object" ) TrimText.style.display = "none";

    }

    else

    {

    if ( typeof(TrimText) == "object" ) TrimText.style.display = "block";

    }

    }

     

     

    function cbTrimClick()

    {

    //cbIncludeText.checked = true;

    }

     

    function txtMinWordsChange()

    {

    if (txtMinWords.value==1)

    {

    MinWordsTimes.innerHTML = "&nbsp;time";

    }

    else

    {

    MinWordsTimes.innerHTML = "&nbsp;times";

    }

    }

    function txtMaxWordsChange()

    {

    if(eval(txtMaxWords.value) < eval(txtMinWords.value))

    {

    txtMaxWords.value = txtMinWords.value

    }

    if (txtMaxWords.value==1)

    {

    MaxWordsTimes.innerHTML = "&nbsp;time.";

    }

    else

    {

    MaxWordsTimes.innerHTML = "&nbsp;times.";

    }

    }

     

     

     

    //======================================================================

    //

    //======================================================================

    function ExpandKeyLink( strID, strKeyLinkCommand )

    {

    var elem = window.event.srcElement;

    if ( elem.tagName != "TD" ) elem = elem.parentElement;

    if ( eval( strID ).IsExpanded )

    {

    elem.className = "tblCollapsed";

    eval( strID ).style.display = "none";

    eval( strID ).IsExpanded = false;

    if (document.activeElement == elem.firstChild.nextSibling) elem.firstChild.focus();

    }

    else

    {

    var Elements = strKeyLinkCommand.split("|");

    var strTempResourceID = "";

    var strTempReference = "";

    var strPosition = "";

    if ( Elements[0] != "jump" )

    {

    alert( "Error: Non 'jump' KeyLink command." );

    return;

    }

     

    for ( var x = 0; x < Elements.length; ++x )

    {

    var KV = Elements[x].split("=");

    if ( KV[0] == "res" ) strTempResourceID = KV[1];

    else if ( KV[0] == "ref" ) strTempReference = KV[1];

    else if ( KV[0] == "pos" ) strPosition = KV[1];

    }

     

    var objTempResource = g_objLibrarian.OpenResource(strTempResourceID);

    var TextRange = objTempResource.TextRanges.CreateRangeFromPosition(strPosition);

    if ( TextRange )

    {

    TextRange.Expand("article");

    elem.className = "tblExpanded";

    eval( strID ).style.display = "block";

    eval( strID + "Cell" ).innerHTML = ScriptUtil.HTML.RenderRichText( TextRange.Text( "rich-text|fields=yes|refs=yes" ) );

     

    //HACK utilFixTextPresentation();

     

    eval( strID ).IsExpanded = true;

     

    if (document.activeElement == elem.firstChild) elem.firstChild.nextSibling.focus();

    }

    }

    }

     

     

    function rptOnResize()

    {

    dlgFixTextInputBoxesReset();

     

    // Now call the report provided version

    if ( typeof(OnResize) == "function" ) OnResize();

    dlgFixTextInputBoxes();

    }

     

     

    function dlgFixTextInputBoxes()

    {

    // Now fix the widths of txtInput INPUT boxes so that they don't accidentally get wider

    var rgInput = document.all.tags("INPUT");

    for ( var x = 0; x < rgInput.length; ++x )

    {

    if ( rgInput[x].VariableInput )

    {

    // alert( rgInput[x].id + ": " + rgInput[x].offsetWidth );

    // alert( rgInput[x].id + ": " + rgInput[x].parentElement.offsetWidth );

    rgInput[x].style.width = rgInput[x].offsetWidth;

     

    if ( rgInput[x].TemporaryText )

    {

    rgInput[x].value = rgInput[x].TemporaryText;

    rgInput[x].TemporaryText = "";

    }

    }

    }

    }

     

     

    function dlgFixTextInputBoxesReset()

    {

    // Empty and "reset" the input boxes so that they position "ideally"

    var rgInput = document.all.tags("INPUT");

    for ( var x = 0; x < rgInput.length; ++x )

    {

    if ( rgInput[x].VariableInput )

    {

    rgInput[x].style.width = "";

    rgInput[x].TemporaryText = rgInput[x].value;

    rgInput[x].value = "";

    }

    }

    }

     

     

    function utilExec(strExecCommand)

    {

    window.external.Application.ExecuteCommand(strExecCommand);

    }

     

     

    //Englishmans Search Function

    function eccSearch( strSearchString, strReferenceRange )

    {

     

    if (strSearchString == "")

    {

    return;

    }

     

    // create <lbx-search-query>

    var objSearchQueryDoc = window.external.Application.MSXML.CreateDocument();

    var objSearchQuery = objSearchQueryDoc.createElement("lbx-search-query");

    objSearchQueryDoc.documentElement = objSearchQuery;

     

    // add <query> element

    var objQuery = QueryParser.Parse(strSearchString, g_strLanguage, objSearchQueryDoc);

    if (objQuery == null)

    {

    alert("Invalid search query.");

    return;

    }

    objSearchQuery.appendChild(objQuery);

     

    // add <range> element

    var objRange = objSearchQueryDoc.createElement("range");

    objSearchQuery.appendChild(objRange);

     

     

    // add <reference> element

    var objReference = objSearchQueryDoc.createElement("reference");

    objReference.setAttribute("ref", strReferenceRange);

    objRange.appendChild(objReference);

     

    var objResource = g_objRes;

     

    // add resource

    var objResourceElement = objSearchQueryDoc.createElement("resource");

    objResourceElement.setAttribute("resource-id", g_strResourceID);//objResource.value);

    objReference.appendChild(objResourceElement);

     

    var objTermNodes = objQuery.selectNodes( ".//term" );

    for ( var x = 0; x < objTermNodes.length; ++x )

    {

    var strSpace = " ";

    var strAttribute = objTermNodes[x].getAttribute( "field" );

    if ( strAttribute == null )

    {

    strAttribute = "";

    strSpace = "";

    }

    objTermNodes[x].setAttribute( "field", ( strAttribute + strSpace + "bible" ) );

    }

     

    // Set options for verse or section level searching

    var objOptionsElement = objSearchQueryDoc.createElement("options");

    var objDocumentLevelElement = objSearchQueryDoc.createElement("document-level");

    objDocumentLevelElement.setAttribute("name","verse");

    objOptionsElement.appendChild(objDocumentLevelElement);

    objSearchQuery.appendChild(objOptionsElement);

     

    // open search results window

    var objWindow = utilActivateSearchTargetWindow();

     

    var objReport = ( window.external.Application.Reports("SearchResultsBible"));

     

    if ( objReport == null ) objReport = window.external.Application.Reports("SearchResultsStandard");

    objWindow.View.Open( objReport );

    var objSearchAgent = objWindow.Info.SearchAgent;

    objSearchAgent.Query = objSearchQuery;

     

    // start search

    objSearchAgent.Start();

    }

     

     

     

    function utilActivateSearchTargetWindow()

    {

    // activate search target window

    var objWindow = utilGetSearchTargetWindow();

    if (objWindow != null) utilActivateWindow(objWindow);

    return objWindow;

    }

     

     

    function utilActivateWindow(objWindow)

    {

    // restore and activate

    if (objWindow.WindowState == 1) objWindow.WindowState = 0;

    objWindow.Activate();

    }

     

     

    function utilGetSearchTargetWindow()

    {

    // look for search target

    var objEnum = new Enumerator(window.external.Application.WindowTypes("search-results").RecentWindows);

    for (; !objEnum.atEnd(); objEnum.moveNext())

    {

    // check window

    var objWindow = objEnum.item();

    if (objWindow != null && objWindow.Info.SearchTarget) return objWindow;

    }

     

    // create new window

    return window.external.Application.Windows.Add("search-results");

    }

     

     

    function utilDoKeyLink( strRef )

    {

    var objCommand = new ActiveXObject("Utility.LbxParameters");

    objCommand.Value("") = "keylink";

    objCommand.Value("ref") = strRef;

    window.external.Application.ExecuteCommand( objCommand.Render() );

    }

     

     

    function isOT( BibleRef )

    {

    // bible.1-39 = Old Testament  // bible.61-87 = New Testament

    var Output = BibleRef;

    var Parts = BibleRef.split(".");

     

    if ( Parts[1] <= 39 ) return true;  //is OT

    else return false; //is NT

    }

     

     

    function GetStrongsBibles( strPreferredID )

    {

    // get titles for all books of type Bible

    var objEnum = new Enumerator(utilGetResourceCollection(g_objLibrarian, "<resource-filter><resource license-state='not-locked' available-location-state='any' metadata-key='dc.type:lbx-types' metadata-value='text.monograph.bible' metadata-value-match='prefix'/></resource-filter>"));

    var Titles = new Array();

    var nCount = 0;

    for ( ; !objEnum.atEnd(); objEnum.moveNext() )

    {

    var strResourceID = objEnum.item().ResourceID;

    var objMetadata = g_objLibrarian.OpenResourceMetadata( strResourceID );

     

    if ( objMetadata ) {

    var objXML = objMetadata.XML;

     

    if ( objXML.selectSingleNode( "controls/control[@name='display']/options/option[@name='inline-strongs']" ) )

    {

    var objTitle = g_objLibrarian.GetSortableResourceTitle( strResourceID );

    var oItem = new Option( objTitle.Title, strResourceID );

    // 3 = Tertiary

    oItem.SortKey = window.external.Application.ScriptUtil.String.CreateCollationKey( objTitle.SortTitle, g_strLanguage, 3 );

    Titles[nCount++] = oItem;

    }

    }

    }

     

    Titles = Titles.sort( utilSortBySortKey );

     

    var nSelected = 0;

    for ( var x = 0; x < nCount; ++x )

    {

    if ( Titles[x].value == strPreferredID ) nSelected = x;

    selBibles.add(Titles[x]);

    }

     

    selBibles.selectedIndex = nCount ? nSelected : -1;

     

    if ( nCount == 0 ) btnDisable( btnUpdate );

    }

     

     

    function utilGetResourceCollection(objLibrarian, strResourceFilter)

    {

    var objResourceFilter = utilParseXMLDocument(strResourceFilter);

    return objLibrarian.Information.Resources(objResourceFilter.documentElement);

    }

     

     

    function utilParseXMLDocument(strSource)

    {

    // catch exceptions

    try {

    // open file

    var docResult = window.external.Application.MSXML.CreateDocument();

    if (docResult.loadXML(strSource))

    {

    // return document

    return docResult;

    }

    else

    {

    // error parsing file

    window.external.Application.ScriptLog.WriteWarning("utilParseXMLDocument", "Error parsing XML from string: " + docResult.parseError.reason +

    " (Line " + docResult.parseError.line.toString(10) + ", Column " + docResult.parseError.linepos.toString(10) + ")");

    return null;

    }

    }

    catch (x) {

    // error opening file

    window.external.Application.ScriptLog.WriteWarning("utilParseXMLDocument", "Error opening XML from string: " + x.message);

    return null;

    }

    }

     

     

    function utilSortBySortKey(objLeft, objRight)

    {

    // sort by sort key

    return window.external.Application.ScriptUtil.String.CompareCollationKeys(objLeft.SortKey, objRight.SortKey);

    }

     

     

     

    //Progress bar functions

     

    function rptAttachProgressBar()

    {

    for (var nProgressBar = 0; nProgressBar < document.all.tags("ProgressBar").length; ++nProgressBar)

    {

    document.all.tags("ProgressBar").item(nProgressBar).insertAdjacentHTML("beforeend","<rpt:ProgressBarColorBar></rpt:ProgressBarColorBar>");

    }

    }

     

     

    function rptShowProgressBar()

    {

    if ( typeof(ProgressBarContainer) == "object" ) ProgressBarContainer.style.display = "block";

    document.all.tags("ProgressBar").item(0).style.display = "block";

     

    // clear this flag, just in case the user pressed ESC before the progress bar was shown

    fStopProgressBar = false;

     

    rptSetProgressBar( 0 );

     

    var sTime = new Date();

    document.all.tags("ProgressBar").item(0).StartTime = sTime.getTime();

    }

     

     

    function rptHideProgressBar()

    {

    var eTime = new Date();

    var endTime = eTime.getTime();

    document.all.tags("ProgressBar").item(0).Time = ( endTime - document.all.tags("ProgressBar").item(0).StartTime );

     

    if ( typeof(ProgressBarContainer) == "object" ) ProgressBarContainer.style.display = "none";

    document.all.tags("ProgressBar").item(0).style.display = "none";

     

    fStopProgressBar = false;

    }

     

     

    function rptSetProgressBar( nPercent )

    {

    if (nPercent != null && isFinite(nPercent))

    {

    //debugger;

    if (nPercent < 0) nPercent = 0;

    if (nPercent > 100) nPercent = 100;

     

    // TODO: We occasionally get Error Tip email for LocationManager.html with an "Object Required" error on this line (probably because objProgressColorBar is null)

    // The following code attempts to work around it -- but why is it happening?

    var objProgressColorBar = document.all.tags("ProgressBarColorBar").item(0);

    if (objProgressColorBar) objProgressColorBar.style.width = nPercent + "%";

    }

    }

     

     

    function rptStopProgressBar()

    {

    fStopProgressBar = true;

    }

     

     

    //=========================

    //Begin Search Agent Code

     

     

    function InitLocalSearchAgent()

    {

    document.body.insertAdjacentHTML( "beforeEnd","<object style='display:none' id='g_objSearchAgentEventsBridge' classid='clsid:9DDD9CBE-0E84-434F-AA26-8CACEE3E42E6'><\/object>" +

    "<script language='JavaScript' for='g_objSearchAgentEventsBridge' event='StatusChanged(status)'>searchOnStatusChanged(status);<\/script>" +

    "<script language='JavaScript' for='g_objSearchAgentEventsBridge' event='ResultsChanged(nResultCount, nHitCount)'>searchOnResultsChanged(nResultCount, nHitCount);<\/script>");

     

    g_objSearchAgent = window.external.Application.CreateSearchAgent();

    g_nSearchAgentConnectionCookie = g_objSearchAgentEventsBridge.Connect( g_objSearchAgent );

    g_bSearchAgentConnected = true;

    }

     

     

    function searchOnStatusChanged(status)

    {

    if ( status == 3 || status == 4 )   //i.e search agent has finished and found all hits

    {

    g_objSearchAgent.Stop();

    var objTemplateDocument = utilParseXMLDocument("<lbx-search-results>" + "<results resource='" + g_strResourceID + "' count='' hit-count='' total-count=''>" +

    "<result index='' article='' score='' resource=''>" + "<title/>" + "<hits hit-count=''>" + "<hit pos='' />" +

    "</hits>" + "</result>" + "</results>" + "</lbx-search-results>");

     

    g_xmlResults = g_objSearchAgent.Results(objTemplateDocument.documentElement);

     

    //Start Processing search result Hits

    setTimeout(ProcessHits, 0 );

    }

    }

     

     

    function searchOnResultsChanged(nResultCount, nHitCount)

    {

    // called when results have been found after search agent query, just before status changes to 4

    g_nResultCount = nResultCount;    //number of verses containing query  e.g. 15 verses

    g_nHitCount = nHitCount;         // number of times query is in verses  e.g. 18 hits in those 15 verses

    }

     

     

    function ProcessHits() //processes for each strongs number g_i

    {

    var lContinue = true;

    var strPreview="";

    var strRefPreview="";

    g_nHitCount=g_intStrongs[g_i].count

    var arrRefs = g_intStrongs[g_i].refs.split(";");

    var arrEng = g_intStrongs[g_i].eng.split(";");

    var nHitposstart = 0; //startposition of Hitpos

    var Hitlength  = 0;

    var Hitpos = 0;

     

    //alert("ProcessHits: Strongs="+g_intStrongs[g_i].number+"; g_nHitCount="+g_nHitCount+"; ref="+arrRefs[0]+"; Eng="+arrEng[0]);

     

     

    if ( ! fStopProgressBar )

    {

    for ( var x = 0; x < g_nHitCount; x++ )

    {

    if (g_nHitCount <= txtMaxWords.value)

    {

    // get the Bible reference

    var strPassageSR = arrRefs[x];

    nHitposstart= ((x>0) && (strPassageSR!=arrRefs[x-1])) ? 0 : Hitpos+Hitlength; //if we're starting a new verse (ie passage and arrRefs dont equal) then nHisposstart = 0 again

    var strrgVerse = g_objRes.TextRanges.CreateRangeFromReference(strPassageSR).Text().slice(1); // slice(3) means choose substring from position 3 to end i.e. remove verse numbers!

    Hitlength = arrEng[x].length;

     

    Hitpos = strrgVerse.indexOf(arrEng[x],nHitposstart);//if bibleref is same as previous hit find next occurance of the hit in that verse

     

    //alert("ProcessHits: Strongs="+g_intStrongs[g_i].number+"; x=" +x+"; g_nHitCount="+g_nHitCount+"; strPassageSR="+strPassageSR+"; strrgVerse="+strrgVerse);

     

    // get a TextRange for the part of the verse before the hit

    var strrgPrev = strrgVerse.slice(0,Hitpos);

    // and the part of the verse after the hit

    var strrgNext = strrgVerse.slice(Hitpos+Hitlength);

     

    if ( cbTrimText.checked ) // Trim to short context; turn off to get whole verse

    {

    // In a crude way (ignoring non-Bible text counts, etc.) we're going to

    // try to keep the same number of characters for context, even if they're // all on one side.

    var nContextChars = 30; // Desired number of characters on each side

     

    arrstrrgPrev = strrgPrev.split(" ");  //split into words

    var nPrevWords = arrstrrgPrev.length; //get number of words in 1st section previous to hit

    arrstrrgNext = strrgNext.split(" ");

    var nNextWords = arrstrrgNext.length;

    strrgPrev=""; //reset

    strrgNext="";

    var j=0;

    while ((strrgPrev.length<nContextChars) && (nPrevWords-1-j>=0)) {

      strrgPrev = arrstrrgPrev[nPrevWords-1-j]+" " + strrgPrev;

    j=j+1;

    }

     

    j=0;

    while ((strrgNext.length<nContextChars) && (j< nNextWords)) {

      strrgNext += arrstrrgNext[j]+" ";

    j=j+1;

    }

    }

     

    var strWord = arrEng[x];

     

    // convert the ranges to HTML

     

    // if (g_superscript[strPassageSR]!=null){ //var supSearchStrRE = new RegExp(g_superscript[strPassageSR].eng + g_superscript[strPassageSR].txt, "i");

    // var supSearchStrRE = new RegExp("\uFEFF" + g_superscript[strPassageSR].txt + "\uFEFF");

    // //var supReplaceStr = g_superscript[strPassageSR].eng + "<b><sup>" + g_superscript[strPassageSR].txt + "</sup></b>";

    // var supReplaceStr = "<b><sup>" + g_superscript[strPassageSR].txt + "</sup></b>";

    // strrgPrev = strrgPrev.replace(supSearchStrRE, supReplaceStr);

    // strrgNext = strrgNext.replace(supSearchStrRE, supReplaceStr);

    // }

     

    // if there is superscript text (marked in this text by character \uFEFF) replace with bold superscript HTML tags

    var supSearchStrRE = new RegExp("\uFEFF","i");

    var supLoc = strrgPrev.indexOf("\uFEFF");

    while (supLoc >= 0) {

    supLocNext = strrgPrev.indexOf("\uFEFF", supLoc+1);

    if ((supLocNext-supLoc)==2){

    strrgPrev = strrgPrev.replace(supSearchStrRE, "<b><sup>"); //replace 1st instance

    strrgPrev = strrgPrev.replace(supSearchStrRE, "</sup></b>"); //replace 2nd instance

    }

    supLoc = strrgPrev.indexOf("\uFEFF", supLoc+1);

    }

     

    var supLoc = strrgNext.indexOf("\uFEFF");

    while (supLoc >= 0) {

    supLocNext = strrgNext.indexOf("\uFEFF", supLoc+1);

    if ((supLocNext-supLoc)==2){

    strrgNext = strrgNext.replace(supSearchStrRE, "<b><sup>"); //replace 1st instance

    strrgNext = strrgNext.replace(supSearchStrRE, "</sup></b>"); //replace 2nd instance

    }

    supLoc = strrgNext.indexOf("\uFEFF", supLoc+1);

    }

     

     

    if ((x>0) && (strPassageSR==arrRefs[x-1])) {strRefPreview="";}

    else

    {

     

    strRefPreview = "<a href=\"javascript:utilExec('jump|res=" + g_strResourceID + "|ref=" + strPassageSR + "')\" ref=\"" + strPassageSR + "\">" + g_objDataTypeManager.Render( strPassageSR, g_strLanguage, "long" ) + "</a>";

     

    }

     

    strPreview += "<tr><td nowrap style='vertical-align: top;'>"+strRefPreview+"</td><td style='padding-left: 6pt'>" + strrgPrev + "<b>" + strWord + "</b>" + strrgNext+"</td></tr>";

     

    }

    }

    // No more hits to process

     

    g_nHitCount = 0;

    lContinue = false; // Prevent the timeout from being set again

    if (g_intStrongs[g_i].count<= txtMaxWords.value){g_strOutput += "<br><table>" + strPreview + "</table>"};

    if (g_intStrongs[g_i].count <= txtMaxWords.value){g_strOutput += "<hr>"};

     

     

     

     

     

    g_i++; //Move on to the next number

    setTimeout(generateReport,0);  // Loop into the next strongs number.

     

    }//end of if

     

    if ( lContinue )

    {

    // move on to the next hit

    setTimeout( ProcessHits, 0 );  // Loop to the next hit

    }

     

    }

     

     

     

    function GetVerseBTORange(Range, bVerseRef)

    {

    var strOutput = "";

     

    if ( ! Range ) // we're probably in the OT in an NT or vice versa -- what's appropriate?

    return( strOutput );

     

    var strMarkDatatype = GetResourceDefaultBibleScheme(Range.Parent);

    strOutput += Range.Text("rich-text|fields=yes|refs=yes|footnotes=yes");

    strOutput = strOutput.replace(/(\uFEFF|\u200D)/g, "");

    var Processed = window.external.Application.MSXML.CreateDocument();

    Processed.preserveWhiteSpace = true;

    Processed.loadXML( utilEncapsulateRichText( strOutput ) );

    Processed.setProperty("SelectionNamespaces","xmlns:lbxrt='http://www.libronix.com/xmlns/rich-text'");

     

    if ( ! Processed.documentElement )

    {

    utilDisplayXMLParseErrorTip(Processed, -5, "Res: " + Range.Parent.Metadata.ID + ", Ref: " + Range.Parent.TextRanges.ConvertRangeToReference(Range, "bible"));

    return "";

    }

     

    // Render Bible reference

    var Nodes = Processed.documentElement.selectNodes("//lbxrt:mark[@name=" + utilCreateSelectionString(strMarkDatatype) + " and @ref]");

    for ( var x = 0; x < Nodes.length; ++x )

    {

    if (bVerseRef)

    {

    var strBibleSR = Nodes[x].getAttribute("ref");

    var nVerse = "<br xmlns='http://www.w3.org/1999/xhtml' />" + strBibleSR.substr( strBibleSR.lastIndexOf( "." ) + 1 ) + " ";

    Nodes[x].setAttribute("BeforeVerse", nVerse);

    }

    else

    {

    Nodes[x].parentNode.removeChild(Nodes[x]);

    }

    }

     

    // return utilEscapeMarkupCharacters(Processed.xml);

     

    var objXSLProcessor = g_xslNewVersesTemplate.createProcessor();

    objXSLProcessor.addParameter("bible-text-only", "true");

    objXSLProcessor.addParameter("preserve-red-letter", "false");

    objXSLProcessor.addParameter("remove-character-formatting", "true");

    objXSLProcessor.addParameter("remove-paragraph-formatting", "false");

    objXSLProcessor.addParameter("remove-paragraphs", "true");

    objXSLProcessor.addParameter("copy-footnotes", "false");

    objXSLProcessor.addParameter("mark-datatype", strMarkDatatype);

    objXSLProcessor.input = Processed;

    objXSLProcessor.transform();

     

    var xmlOutput = objXSLProcessor.output.replace( /<br [^>]*>/, "" ); // Only the first one!

     

    strOutput = window.external.Application.ScriptUtil.HTML.RenderRichText( xmlOutput );

    return ( strOutput );

    }

     

     

    function GetResourceDefaultBibleScheme(objResource)

    {

    // examine the active data types in the resource metadata to find the preferred bible subtype

    // The Resource.References.DataTypes collection can not be trusted to have data types listed // in any particular order.

    // select the default bible subtype, then select the first bible subtype if that fails

    var objDataType = objResource.Metadata.XML.selectSingleNode("active-data-types/active-data-type[substring(@name, 1, 5)='bible' and @default='yes']");

    if (objDataType == null) objDataType = objResource.Metadata.XML.selectSingleNode("active-data-types/active-data-type[substring(@name, 1, 5)='bible']");

    return objDataType == null ? "bible" : objDataType.getAttribute("name");

    }

     

     

    function utilEncapsulateRichText( strFragment )

    {

    return( "<lbxrt:rich-text xmlns:lbxrt='http://www.libronix.com/xmlns/rich-text' xmlns='http://www.w3.org/1999/xhtml'&gt;" + strFragment + "</lbxrt:rich-text>" );

    }

     

     

    function utilCreateSelectionString(strSelectionString)

    {

    if (strSelectionString.indexOf("\"") == -1) return "\"" + strSelectionString + "\"";

    else return "concat(\"" + strSelectionString.replace(/"/g, "\", '\"', \"") + "\")";

    }

     

     

    function LoadVerseTemplates(bHideError)

    {

    if (g_xslNewVersesTemplate == null)

    {

    var xmlNewVersesTemplate = window.external.Application.MSXML.CreateFreeThreadedDocument();

    if (xmlNewVersesTemplate.load(window.external.Application.NamedFileTable.OpenStream("BTNewVersesTemplate")))

    {

    g_xslNewVersesTemplate = window.external.Application.MSXML.CreateXSLTemplate();

    g_xslNewVersesTemplate.stylesheet = xmlNewVersesTemplate;

    }

    else if (!(typeof(bHideError) == "boolean" && bHideError))

    {

    utilDisplayXMLParseErrorTip(xmlNewVersesTemplate, -2);

    }

    }

     

    return (g_xslNewVersesTemplate != null);

    }

     

     

    //End Search Agent stuff

    //=========================

     

    function utilParseInt(strString, nDefaultValue, nRadix)

    {

    // nRadix defaults to 10 if not specified

    if (typeof(nRadix) != "number") nRadix = 10;

     

    // parse the string, checking for valid result

    var nNumber = parseInt(strString, nRadix);

    if (isNaN(nNumber)) nNumber = nDefaultValue;

    return nNumber;

    }

     

     

    function LoadPrefs()

    {

    var strBible = g_objPrefs.GetValue( "ThemeDiscovery", "PreferredBible", "LLS:1.0.3" );

    // version 2.1 fix ever growing Stongs Bible list bug. inserted the if statement.

    // we don't  need to update the bible list when we press the reset button.

    if (!selBibles.hasChildNodes()) GetStrongsBibles( strBible );

    cbShowKeyLinks.checked = ( g_objPrefs.GetValue( "ThemeDiscovery", "ShowKeyLinks", "true" ) == "true" ? true : false );;

    txtKeyLinkCount.value = g_objPrefs.GetValue( "ThemeDiscovery", "KeyLinkCount", 20 );

    txtVerseRange.value = GetDatatypeRef();

    cbIncludeText.checked = ( g_objPrefs.GetValue( "ThemeDiscovery", "IncludeText", "true" ) == "true" ? true : false );;

    cbTrimText.checked = ( g_objPrefs.GetValue( "ThemeDiscovery", "TrimText", "true" ) == "true" ? true : false );;

    txtMinWords.value = g_objPrefs.GetValue( "ThemeDiscovery", "MinWords", 2 );

    txtMaxWords.value = g_objPrefs.GetValue( "ThemeDiscovery", "MaxWords", 100 );

    cbTextClick();  //Hide cbTrimText if nessesary

    txtMinWordsChange();

    txtMaxWordsChange();

    }

     

    function GetDatatypeRef()

    {

                 var retVal = g_objPrefs.GetValue( "ThemeDiscovery", "VerseRange", "Genesis 1" );

                 var objRWindows = window.external.Application.RecentWindows;

                 if (objRWindows !=null)

                 {

                 for (var win = 0 ;win < objRWindows.count ; win++)

                 {

                 objWin = objRWindows.Item(win);

                 if (objWin.Type == "resource")

                 {

                 if (objWin.Info.ActiveDataType == "bible")

                 {

                 var splitRef = window.external.Application.DataTypeManager.Render(objWin.info.ActiveReference,"en","long").split(":");

    retVal  = splitRef[0]//+":"+splitRef[1];

    break;

                 }

                 }

                 }

    }

    return(retVal);

    }

    function GetActiveChapter()

    txtVerseRange.value=GetDatatypeRef()

    }

    function GetVerseRange()

    {

    var retRange =  g_objPrefs.GetValue( "ThemeDiscovery", "VerseRange", "" );

    if (retRange == "")

    {

    var retRange=GetDatatypeRef();

    }

    return(retRange);

    }

    function OnUnload()

    {

    //The Save preferences portion of this function has been disabled for this report window

    // version of Theme Discovery. That is because more then one window can be open at

    // the same time and it doesn't make sense to save your most recent settings every time

    // one is closed. A 'save' button has been added to save preferences.

    //Save preferences.

    // Preferences are stored in a separate directory LDLSu so that they are // never confused with Libronix preferences

    // SAVE PREFERENCES CODE DELETED

    // disconnect from search agent events

    if (g_bSearchAgentConnected)

    {

    g_objSearchAgentEventsBridge.Disconnect(g_objSearchAgent, g_nSearchAgentConnectionCookie);

    g_bSearchAgentConnected = false;

    }

    }

     

     

    function  onInstructions()

    {

    //alert("This tool works better with the Hebrew Old Testament because Hebrew joins pronouns etc. to the nouns and verbs.  This is based on E.C.C. (http://www.chooselife.org.au/dean/ECC.htm).  Libronix does not provide support this report. agape_logos<at>hotmail<dot>com");

    var helpOutput = "";

    helpOutput += "<H3>Theme Discovery Instructions</H3><BR>"

    helpOutput += "<table border=\"0\" cellpadding=\"5\" cellspacing=\"5\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\" id=\"AutoNumber1\">"

    helpOutput += "  <tr>"

    helpOutput += "   <td width=\"19%\" align=\"right\"  valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Verse Range:&nbsp;</td></tr></table></td>"

    helpOutput += "   <td width=\"81%\"><ul><li>This is the range of verses that the report will search.&nbsp;"

    helpOutput += "     Larger ranges are slow.</li>"

    helpOutput += "     <li>Format: eg Genesis 1 or Genesis 1:1-5 or Genesis 1-2</li>"

    helpOutput += "     &nbsp; </ul>"

    helpOutput += "     </td>"

    helpOutput += "  </tr>"

    helpOutput += "  <tr>"

    helpOutput += "     <td width=\"19%\" align=\"right\" valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Get Active:&nbsp;</td></tr></table></td>"

    helpOutput += "    <td width=\"81%\"><ul><li>This returns the chapter of the active bible reference.</li><li> If there is no active bible then it will return the saved reference for the report or default to Genesis 1.</li>"

    helpOutput += "  </tr>"

    helpOutput += "   <tr>"

    helpOutput += "    <td width=\"19%\" align=\"right\"  valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Version:&nbsp;</td></tr></table></td>"

    helpOutput += "    <td width=\"81%\"><ul><li>This is the unlocked bible version the report will use.</li> "

    helpOutput += "    <li>The bible must be Strong's Number encoded eg. KJV, NASB1995, and Strong's Encoded Greek Texts.</li>"

    helpOutput += "   &nbsp; </ul>"

    helpOutput += "    </td>"

    helpOutput += "  </tr>"

    helpOutput += "  <tr>"

    helpOutput += "    <td width=\"25%\" align=\"right\" valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Show up to  # Keylinks:&nbsp;</td></tr></table></td>"

    helpOutput += "    <td width=\"75%\"><ul><li>When checked the report automatically looks up the Strong's "

    helpOutput += "    Number in your Lexicons </li>"

    helpOutput += "    <li>The number value represents how many of these Keylinks to return</li>"

    helpOutput += "     <li>Unchecked and no lexicon keylinks will be returned</li><li> <i>Unchecked will produce faster reports</i></li>"

    helpOutput += "    &nbsp;</ul>"

    helpOutput += "    </td>"

    helpOutput += "  </tr>"

    helpOutput += "  <tr>"

    helpOutput += "    <td width=\"19%\" align=\"right\"  valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Show Bible Text:&nbsp;</td></tr></table></td>"

    helpOutput += "    <td width=\"81%\"><ul><li>When checked the report will display the bible text and automatically "

    helpOutput += "    highlight the word(s) in context.</li>"

    helpOutput += "      <li>Unchecked and the bible text will not be dispalyed</li><li><i>Unchecked will produce faster reports</i></li>"

    helpOutput += "    &nbsp;</ul>"

    helpOutput += "    </td>"

    helpOutput += "  </tr>"

    helpOutput += "  <tr>"

    helpOutput += "    <td width=\"19%\" align=\"right\"  valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Trim Bible Text:&nbsp;</td></tr></table></td>"

    helpOutput += "    <td width=\"81%\"><ul><li>When checked the verses returned will be trimmed.</li>"

    helpOutput += "    <li>Unchecked will return full verses</li><li><i>Unchecked may produce faster reports</i></li>"

    helpOutput += "     &nbsp;</ul>"

    helpOutput += "    </td>"

    helpOutput += "  </tr>"

    helpOutput += "  <tr>"

    helpOutput += "    <td width=\"19%\" align=\"right\"  valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Do not include words:&nbsp;</td></tr></table></td>"

    helpOutput += "    <td width=\"81%\"><ul><li>This sets the lower and upper limits of where the report should stop "

    helpOutput += "    looking up Strong's Numbers.</li>"

    helpOutput += "      <li>Upper limit should be equal to or less than lower limit </li><li><i>Higher lower limit produce faster reports</i></li><li><i>Upper limit can be used to eliminate common words like \"it, he, she, which, and\" for larger verse ranges</i></li>"

    helpOutput += "    </ul>"

    helpOutput += "    </td>"

    helpOutput += "  </tr>"

    helpOutput += "  <tr>"

    helpOutput += "    <td width=\"19%\" align=\"right\"  valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Save:&nbsp;</td></tr></table></td>"

    helpOutput += "    <td width=\"81%\"><ul><li>Save the current configuration in your Preferences.</li>&nbsp;</ul></td>"

    helpOutput += "  </tr>"

    helpOutput += "  <tr>"

    helpOutput += "    <td width=\"19%\" align=\"right\"  valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Generate:&nbsp;</td></tr></table></td>"

    helpOutput += "    <td width=\"81%\"><ul><li>This generates the report.</li>&nbsp</ul></td>"

    helpOutput += "   &nbsp; </tr>"

    helpOutput += "  <tr>"

    helpOutput += "    <td width=\"19%\" align=\"right\"  valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Reset Form:&nbsp;</td></tr></table></td>"

    helpOutput += "    <td width=\"81%\"><ul><li>This resets the form to the user preferences. If there exists an open resource that is: <OL> <LI>Actively indexed by a &quot;bible&quot; datatype. <LI>Postitioned on an active bible reference.</OL>&nbsp;<li>Then the Verse Range will be updated to contain that reference (truncated to chapter). If there is more than one bible indexed resource open, then  the bible reference used will come from the last active resource window. If no bible reference can be found from an open resource then the reference saved in your preferences will be used. The default reference for users that have never saved their preferences is Genesis 1</li>&nbsp;</ul></td>"

    helpOutput += "  </tr>"

    helpOutput += "  <tr>"

    helpOutput += "    <td width=\"19%\" align=\"right\"  valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Settings:&nbsp;</td></tr></table></td>"

    helpOutput += "    <td width=\"81%\"><ul><li>Click on the Settings label to collapse and expand the control panel</li>&nbsp;</ul></td>"

    helpOutput += "  </tr>"

    helpOutput += "  <tr>"

    helpOutput += "    <td width=\"19%\" align=\"right\"  valign=\"top\"><table width = 100% class=\"tblControlPanelLabel\"><tr ><td>&nbsp;Toggle Help:&nbsp;</td></tr></table></td>"

    helpOutput += "    <td width=\"81%\"><ul><li>Open and close this Help Panel</li>&nbsp;</ul></td>"

    helpOutput += "   &nbsp; </tr>"

    helpOutput += "</table>"

    helpOutput += "<p><br>I use this tool regularly to discover the key themes in the both the OT and "

    helpOutput += "NT. The report works better in the OT because it doesn't include words like: "

    helpOutput += "&quot;it, he, she, which, and&quot; etc. This is because Hebrew joins these words to the "

    helpOutput += "nouns and verbs.</p>"

    helpOutput += "<p>This report is based on "

    helpOutput += "<a target=\"_blank\" href=\"http://www.chooselife.org.au/dean/ECC.htm\">Englishmans "

    helpOutput += "Contextual Concordance</a>. A while ago I asked Bob at Libronix to create such a "

    helpOutput += "report however I got tired of waiting.&nbsp; I would still like it if Libronix "

    helpOutput += "would integrate this report into their application framework and sell it as "

    helpOutput += "another Addin.&nbsp;"

    helpOutput += "&quot;Theme Discovery&quot; report is "

    helpOutput += "not supported by Libronix.</p>"

    helpOutput += "<br>Please continue to support the "

    helpOutput += "gospel programmers at Libronix by purchasing their wonderful Addins under the "

    helpOutput += "'tools', 'unlock' menu.</p>"

    helpOutput += "<p>Agape en Iesous<br>"

    helpOutput += "Dean &amp; Jenn Montgomery</p>"

    helpOutput += "<p><a target=\"_blank\"href=\"mailto:agape_logos@hotmail.com\">agape_logos@hotmail.com</a></p>"

    divHelp.innerHTML = helpOutput;

    }

     

    function showInsructions()

    {

    if (divHelp.innerHTML == "")

    {

        onInstructions();

    } else {

        hideInstructions();

    }

    }

     

    function hideInstructions()

    {

    divHelp.innerHTML = "";

    }

     

    function rptExpandCollapse()

    {

    if (document.getElementById("Controls").style.display == "none")

    {

      document.getElementById("Controls").style.display="block";

       document.getElementById("table5").style.display="block";

    }else{

      document.getElementById("Controls").style.display="none";

      document.getElementById("table5").style.display="none";

          }

    }

     

    function SavePrefs()

    {

    //Save preferences.

    // Preferences are stored in a separate directory LDLSu so that they are // never confused with Libronix preferences

    g_objPrefs.SetValue( "ThemeDiscovery", "ShowKeyLinks", ( cbShowKeyLinks.checked ? "true" : "false" ) );

    g_objPrefs.SetValue( "ThemeDiscovery", "KeyLinkCount", txtKeyLinkCount.value );

     

    if ( selBibles.selectedIndex >= 0 )

    {

    g_objPrefs.SetValue( "ThemeDiscovery", "PreferredBible", selBibles[selBibles.selectedIndex].value );

    }

     

    g_objPrefs.SetValue( "ThemeDiscovery", "VerseRange", txtVerseRange.value );

    g_objPrefs.SetValue( "ThemeDiscovery", "IncludeText", ( cbIncludeText.checked ? "true" : "false" ) );

    g_objPrefs.SetValue( "ThemeDiscovery", "TrimText", ( cbTrimText.checked ? "true" : "false" ) );

    g_objPrefs.SetValue( "ThemeDiscovery", "MinWords", txtMinWords.value );

    g_objPrefs.SetValue( "ThemeDiscovery", "MaxWords", txtMaxWords.value );

    }

     

    window.onresize = rptOnResize;

    window.onunload = OnUnload;

    OnLoad(); //sets up the interface

     

    </script>

    </body>

    </html>

     

  • Mark Smith
    Mark Smith Member, MVP Posts: 11,790 ✭✭✭

    It doesn't work

    Well I should have tried it out before lifting your hopes. I haven't used it in a long time and can't recall if it became inoperable with one of the updates to Libronix. Sorry. I've looked in my other Libronix folders and can't find anything else.

    Pastor, North Park Baptist Church

    Bridgeport, CT USA

  • John David Wade
    John David Wade Member Posts: 7

    Francis, Thank you.  I left a comment on your page asking if you could just copy and paste the file in an email.  This is what I need but this didn't come through well.  Thank you again.

  • John David Wade
    John David Wade Member Posts: 7

    Mark, thank you, that was actually what I needed in part.  I had forgotten how to do the toolbar thing, now I am just trying to find the actual addin and it looks like Francis has it.

  • Mark Smith
    Mark Smith Member, MVP Posts: 11,790 ✭✭✭

    Pastor, North Park Baptist Church

    Bridgeport, CT USA