find_url = new Array();
find_escape = new Array();
find_about = new Array();
find_url[17] = 'http://search.vector.co.jp/search?query=';
find_escape[17] = '0';
find_about[17] = '';

find_url[16] = 'http://search.impress.co.jp/cgi-bin/forest/library/namazu.cgi?max=20&query=';
find_escape[16] = '0';
find_about[16] = '';

find_url[11] = 'http://yougo.ascii24.com/gh/search/?pattern=';
find_escape[11] = '0';
find_about[11] = 'IT';

find_url[10] = 'http://www.mapfan.com/keywordsrch.cgi?SRCHKIND=SRCH_ADR&PARAM=';
find_escape[10] = '0';
find_about[10] = '';

find_url[9] = 'http://www.bk1.co.jp/cgi-bin/srch/srch_result_book.cgi?aid=p-hary04166&srch=2&idx=3&s1=ta&dp=10&ol=';
find_escape[9] = '0';
find_about[9] = 'キーワード検索';

find_url[8] = 'http://www.bk1.co.jp/cgi-bin/srch/srch_result_book.cgi?aid=p-hary04166&srch=2&idx=3&s1=ta&dp=10&ti=';
find_escape[8] = '0';
find_about[8] = 'タイトル検索';

find_url[7] = 'http://www.bk1.co.jp/cgi-bin/srch/srch_result_book.cgi?aid=p-hary04166&srch=2&idx=3&s1=ta&dp=10&au=';
find_escape[7] = '0';
find_about[7] = '著者名検索';

find_url[5] = 'http://www.excite.co.jp/world/text/?wb_lp=JAEN&before=';
find_escape[5] = '0';
find_about[5] = '';

find_url[4] = 'http://www.bk1.co.jp/cgi-bin/srch/srch_result_book.cgi?aid=p-hary04166&srch=2&idx=3&s1=ta&dp=10&pb=';
find_escape[4] = '0';
find_about[4] = '出版社検索';

find_url[3] = 'http://www.google.co.jp/search?hl=ja&inlang=ja&lr=lang_ja&ie=Shift_JIS&q=';
find_escape[3] = '0';
find_about[3] = '';

find_url[18] = 'http://www.mapfan.com/keywordsrch.cgi?SRCHKIND=SRCH_STATION&PARAM=';
find_escape[18] = '0';
find_about[18] = '';

find_url[6] = 'http://www.excite.co.jp/world/text/?wb_lp=ENJA&before=';
find_escape[6] = '0';
find_about[6] = '';

find_url[20] = 'http://search.yahoo.co.jp/bin/search?p=';
find_escape[20] = '0';
find_about[20] = '';

find_url[19] = 'http://www.mapfan.com/keywordsrch.cgi?SRCHKIND=SRCH_NAME&PARAM=';
find_escape[19] = '0';
find_about[19] = '';

find_url[14] = 'http://dictionary.goo.ne.jp/search.php?kind=je&mode=0&je.x=36&je.y=16&MT=';
find_escape[14] = '0';
find_about[14] = '';

find_url[12] = 'http://ask.jp/web.asp?o=0&qsrc=3&q=';
find_escape[12] = '1';
find_about[12] = '';

find_url[13] = 'http://dictionary.goo.ne.jp/search.php?kind=ej&mode=0&ej.x=48&ej.y=10&MT=';
find_escape[13] = '0';
find_about[13] = '';

find_url[15] = 'http://dictionary.goo.ne.jp/search.php?kind=je&mode=0&jn.x=18&jn.y=11&MT=';
find_escape[15] = '0';
find_about[15] = '';

// 検索実行
function find_open() {

  var WORD = document.web_find.web_word.value;
  var FINDER = find_url[document.web_find.finder.value];

  if (find_escape[document.web_find.finder.value] == 1) {
    WORD = encodeURL(WORD);
  }

  if (WORD != '') {
    window.open(FINDER + WORD,'_blank');
  }
  
  return false;

}

/*  Function Equivalent to URLEncoder.encode(String, "UTF-8")
    Copyright (C) 2002 Cresc Corp.
    Version: 1.0
*/
function encodeURL(str) {

  var s0, i, s, u;
  s0 = ""; // encoded str

  for (i = 0; i < str.length; i++) { // scan the source
    s = str.charAt(i);
    u = str.charCodeAt(i); // get unicode of the char

    if (s == " ") { // SP should be converted to "+"
      s0 += "+";

    } else {
      if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))) { // check for escape
        s0 = s0 + s; // don't escape

      } else { // escape
        if ((u >= 0x0) && (u <= 0x7f)) { // single byte format
          s = "0"+u.toString(16);
          s0 += "%"+ s.substr(s.length-2);

        } else if (u > 0x1fffff) { // quaternary byte format (extended)
          s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
          s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
          s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
          s0 += "%" + (0x80 + (u & 0x3f)).toString(16);

        } else if (u > 0x7ff) { // triple byte format
          s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
          s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
          s0 += "%" + (0x80 + (u & 0x3f)).toString(16);

        } else { // double byte format
          s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
          s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
        }
      }
    }
  }

  return s0;

}

// 説明文侮ｦ
function about_text(ABOUT) {

  document.getElementById('find_about').innerHTML = find_about[ABOUT];
  document.web_find.web_word.focus();

}
document.write('<div id="find_form">');
document.write('<form name="web_find" onsubmit="return find_open();">  <input type="text" name="web_word" class="text" size="30" maxlength="256" value="" />  <select name="finder" OnChange="about_text(this.value);">');
document.write('    <optgroup label="普通の検索">      <option value="3">Google(日本語)</option>      <option value="20">Yahoo!</option>      <option value="12">Ask.jp</option>    </optgroup>    <optgroup label="翻訳系">      <option value="5">エキサイト(和英翻訳)</option>      <option value="6">エキサイト(英和翻訳)</option>      <option value="14">goo 和英辞典</option>      <option value="13">goo 英和辞典</option>      <option value="15">goo 国語辞典</option>    </optgroup>    <optgroup label="書籍">      <option value="9">bk1 (キーワード)</option>      <option value="8">bk1 (タイトル)</option>      <option value="7">bk1 (著者名)</option>      <option value="4">bk1 (出版社)</option>    </optgroup>    <optgroup label="地図">      <option value="10">MapFan(住所)</option>      <option value="18">MapFan(駅名)</option>      <option value="19">MapFan(スポット) </option>    </optgroup>    <optgroup label="その他">      <option value="17">Vector</option>      <option value="16">窓の杜</option>      <option value="11">アスキーデジタル用語辞典</option>    </optgroup>');
document.write('  </select>  <input type="submit" value=":: 検索 ::" />  <div id="find_about"></div></form>');
document.write('<small><a href="http://hpcgi2.nifty.com/hary/tool/search.cgi">サーチセレクターCGI</a> ver1.0 made in <a href="http://homepage2.nifty.com/hary/" title="作者サイト" target="_blank">Hary</a></small></div>');
