home *** CD-ROM | disk | FTP | other *** search
/ Thompson Chain-Reference…ible - Preacher's Library / Iep_tcpl_5r.iso / Catalog / ibible_link.js < prev    next >
Text File  |  2001-11-17  |  3KB  |  59 lines

  1. // ibible_link.js : Javascript include for iBible search box link - ibible_link.htm
  2. //---------------------------------------------------------------------------
  3. var _bibles=6;
  4. var _bible=Array("NASB","King James","ASV","GOD's WORD","Darby Translation","Young's Literal");
  5. var _ibibles="NASB,KJV,ASV,GW,DAR,YLT";     // sets the Bible list in iBible
  6. //---------------------------------------------------------------------------
  7. var _server="www.iBibleHome.com";
  8. var _browser=navigator.appVersion;
  9. var _IE=(_browser.indexOf("MSIE") >= 0);
  10. var _IE5=(_browser.indexOf("MSIE 5") >= 0);
  11. function DoBibles() { for(i=0; i<_bibles; i++) document.write("<OPTION>" + _bible[i]); }
  12. function DoInput() { 
  13.    if (_IE) n="18"; else n="15"; 
  14.    document.write("<INPUT name=Text type=text size=" + n +" maxlength=30 onkeydown='Key(self)'>");
  15. }
  16. function DoButtons() {
  17.    with (document) {
  18.       write(" ");
  19.       if (_IE5) {
  20.          write("<BUTTON style='position:relative; top:-4px' onclick=Search()>Search</BUTTON>   ");
  21.          write("<A href='javascript:iBible()'><IMG src='images/ibiblebtn.gif' style='position:relative; left:-5px' border=0></A>");
  22.       }
  23.       else write("<input type=button value=Search onclick=Search()>");
  24.    }   
  25. }
  26. function Key(me) { if (me.event.keyCode == 13) Search(); }
  27. function Fix(txt) {
  28.    s = "";
  29.    for(i=0; i<txt.length; i++) {
  30.       c = txt.charAt(i);
  31.       cc = txt.charCodeAt(i);
  32.       if (cc == 32) s += "+"; else if (cc == 39) s += "_"; else s += ("" + c);
  33.    }
  34.    return s;
  35. }
  36. function SelectedBible() { 
  37.    ndx = document.Frm.Bibles.selectedIndex;
  38.    return Fix(document.Frm.Bibles.options[ndx].text);
  39. }
  40. function SearchText() { 
  41.    txt = document.Frm.Text.value;
  42.    if (txt == "") txt = "_none_";
  43.    return Fix(txt);
  44. }
  45. function iBible() { 
  46.    window.open("http://" + _server + "/x.iis2?LoadiBible?BIBLE=" + SelectedBible()
  47.              + "&BIBLELIST=" + _ibibles + "&BROWSER=" + _browser,
  48.              "","resizable,status,menubar=0,titlebar=0,hotkeys=0");
  49. }
  50. function Search() { 
  51.    txt = SearchText();
  52.    if (txt == "_none_") { alert("Please enter a search word or phrase"); return; }
  53.    if (_IE5) func = "LoadiBible"; else func = "NSPage";
  54.    window.open("http://" + _server + "/x.iis2?" + func + "?BIBLE=" + SelectedBible()
  55.              + "&SEARCH=" + txt + "&BIBLELIST=" + _ibibles + "&BROWSER=" + Fix(_browser),
  56.              "","resizable,status,menubar=0,titlebar=0,hotkeys=0");
  57.    return false;
  58. }             
  59. function _Submit() { if (!_IE) return Search(); }