<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5281412490715734218</id><updated>2024-09-10T00:58:02.302+09:00</updated><category term="実験"/><category term="ツール"/><category term="テスト"/><title type='text'>朝日はまだか?</title><subtitle type='html'>主にWEB関連の覚え書き。たまに実験もしてみる。</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>55</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-4602246501924143915</id><published>2012-04-10T21:23:00.001+09:00</published><updated>2012-04-10T21:23:21.471+09:00</updated><title type='text'>投稿テスト３</title><content type='html'>&lt;b&gt;リッチテキストは？&lt;/b&gt;&lt;div&gt;&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; size=&quot;6&quot;&gt;これで送るとどうなりますか？&lt;br clear=&quot;all&quot;&gt;&lt;/font&gt;&lt;/b&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt; &lt;/div&gt; </content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/4602246501924143915/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2012/04/blog-post_7684.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/4602246501924143915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/4602246501924143915'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2012/04/blog-post_7684.html' title='投稿テスト３'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-8437847682623870532</id><published>2012-04-10T19:58:00.001+09:00</published><updated>2012-04-10T19:59:35.132+09:00</updated><title type='text'>テスト投稿</title><content type='html'>&amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;これどう見える？&amp;lt;/span&amp;gt;&lt;br clear=&quot;all&quot;&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt; 
うわ、そのままテキストに見えるんだ…Orz</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/8437847682623870532/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2012/04/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/8437847682623870532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/8437847682623870532'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2012/04/blog-post.html' title='テスト投稿'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-2114341201905384640</id><published>2012-04-10T19:56:00.000+09:00</published><updated>2012-04-10T20:00:42.979+09:00</updated><title type='text'>テスト投稿</title><content type='html'>&amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;これどう見える？&amp;lt;/span&amp;gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/2114341201905384640/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2012/04/blog-post_10.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/2114341201905384640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/2114341201905384640'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2012/04/blog-post_10.html' title='テスト投稿'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-3274242530477518448</id><published>2010-08-11T12:16:00.001+09:00</published><updated>2010-08-11T12:17:26.976+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="テスト"/><title type='text'>location.host</title><content type='html'>&lt;script&gt;
document.writeln(&#39;host=&#39; + location.host);
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/3274242530477518448/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/08/locationhost.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/3274242530477518448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/3274242530477518448'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/08/locationhost.html' title='location.host'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-8990645489812568263</id><published>2010-06-04T05:32:00.009+09:00</published><updated>2010-06-04T05:53:54.286+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="実験"/><title type='text'>DOMのツリーを渡り歩く</title><content type='html'>&lt;div id=&quot;DOM-tree-result&quot;&gt;&lt;/div&gt;

&lt;script type=&quot;text/javascript&quot; src=&quot;http://sharri.web.fc2.com/JSlab/json2-min.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
var tree_walk_block = document.createElement(&#39;div&#39;);

function find_all_tree(n, l) {
  if (!n) return;

  var entry = document.createElement(&#39;div&#39;);
  entry.innerHTML = &#39;[&#39; + l + &#39;] &#39; + n.nodeName + &#39; &#39; + n.nodeType + &#39; &#39;;
  entry.appendChild(document.createTextNode(JSON.stringify(n.nodeValue)));
  tree_walk_block.appendChild(entry);
  
  find_all_tree(n.firstChild, l + 1);
  find_all_tree(n.nextSibling, l + 1);

}
&lt;/script&gt;


&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
google.setOnLoadCallback(
function(){
  find_all_tree(document, 1);
  document.getElementById(&#39;DOM-tree-result&#39;).appendChild(tree_walk_block);
}
);
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/8990645489812568263/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/06/dom.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/8990645489812568263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/8990645489812568263'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/06/dom.html' title='DOMのツリーを渡り歩く'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-6876641337248499861</id><published>2010-06-03T21:46:00.013+09:00</published><updated>2010-06-04T06:04:56.081+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="実験"/><title type='text'>XMLHttpRequestを使う</title><content type='html'>&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://sharri.web.fc2.com/JSlab/json2-min.js&quot;&gt;&lt;/script&gt;

&lt;div id=&quot;result-xmlhttp-request&quot;&gt;&lt;/div&gt;

&lt;script&gt;

function find(n, l) {
  if (!n) return;

  var block = document.getElementById(&#39;result-xmlhttp-request&#39;);

  var entry = document.createElement(&#39;div&#39;);
  entry.innerHTML = &#39;[&#39; + l + &#39;] &#39; + n.nodeName + &#39; &#39; + n.nodeType + &#39; &#39; + n.nodeValue;
  block.appendChild(entry);
  
  find(n.firstChild, l + 1);
  find(n.nextSibling, l + 1);

}

var client = new XMLHttpRequest();
client.open(&#39;GET&#39;, location.href, true);  
client.onreadystatechange = function (aEvt) {  
  document.getElementById(&#39;result-xmlhttp-request&#39;).appendChild(
    document.createTextNode(&#39;readyState=&#39; + client.readyState)
  );
      document.getElementById(&#39;result-xmlhttp-request&#39;).innerHTML += &#39;&lt;br/&gt;&#39;;
  if (client.readyState == 4) {  
      document.getElementById(&#39;result-xmlhttp-request&#39;).innerHTML += &#39;status=&#39; + client.status + &#39;&lt;br/&gt;&#39;;
     if(client.status == 200)  {
      document.getElementById(&#39;result-xmlhttp-request&#39;).appendChild(
        document.createTextNode(&#39;responseXML=&#39; + client.responseXML)
      );
      find(client.responseXML, 1);
      document.getElementById(&#39;result-xmlhttp-request&#39;).innerHTML += &#39;&lt;hr/&gt;&#39;;
      document.getElementById(&#39;result-xmlhttp-request&#39;).appendChild(
        document.createTextNode(client.responseText)
      );
     }
     else  
      document.getElementById(&#39;result-xmlhttp-request&#39;).appendChild(
        document.createTextNode(&#39;status=&#39; + client.status)
      );
  }  
};  

google.setOnLoadCallback(
function(){
  client.send(null);  
}
);

&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/6876641337248499861/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/06/xmlhttprequest.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/6876641337248499861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/6876641337248499861'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/06/xmlhttprequest.html' title='XMLHttpRequestを使う'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-3806271591689622934</id><published>2010-06-03T06:52:00.009+09:00</published><updated>2010-06-03T07:06:15.544+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="実験"/><title type='text'>コメントを除去する</title><content type='html'>&lt;script&gt;

var s = &#39;&lt;!-- abcdefg;hijklmn; --&gt;&#39;;

s = s.replace(&#39;&lt;!--&#39;,&#39;&#39;);
s = s.replace(&#39;--&gt;&#39;,&#39;&#39;);

document.writeln(s);

&lt;/script&gt;
&lt;p&gt;
書き換えた文字列が返ってくるのね…String.replace()って、Stringそのものを書き換えるのかと思った。
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/3806271591689622934/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/06/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/3806271591689622934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/3806271591689622934'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/06/blog-post.html' title='コメントを除去する'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-495589630246368019</id><published>2010-06-03T06:31:00.009+09:00</published><updated>2010-06-03T06:50:42.933+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="実験"/><title type='text'>SCRITPタグを動的に</title><content type='html'>&lt;script&gt;

var script = document.createElement(&#39;script&#39;);
script.type = &#39;text/javascript&#39;;
script.innerHTML = &#39;script_marker = &quot;abcdefg&quot;;&#39;;

document.writeln(&#39;ヘッダにアタッチする前:&#39; + (window.script_marker?script_marker:&#39;未定義&#39;) + &#39;&lt;br/&gt;&#39;);

document.getElementsByTagName(&#39;head&#39;)[0].appendChild(script);

document.writeln(&#39;ヘッダにアタッチした後:&#39; + (window.script_marker?script_marker:&#39;未定義&#39;) + &#39;&lt;br/&gt;&#39;);

eval(script.innerHTML);

document.writeln(&#39;evalした後:&#39; + (window.script_marker?script_marker:&#39;未定義&#39;) + &#39;&lt;br/&gt;&#39;);

script_marker = &quot;abcdefg&quot;;


document.writeln(&#39;そのまま実行した後:&#39; + (window.script_marker?script_marker:&#39;未定義&#39;) + &#39;&lt;br/&gt;&#39;);
&lt;/script&gt;
内容をコメントアウトすると実行されないようだ。</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/495589630246368019/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/06/scritp.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/495589630246368019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/495589630246368019'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/06/scritp.html' title='SCRITPタグを動的に'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-5027488932102314678</id><published>2010-06-03T05:44:00.013+09:00</published><updated>2010-06-03T06:52:02.377+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="実験"/><title type='text'>SCRIPTタグにIDをつけるとどうなる？</title><content type='html'>&lt;script id=&quot;data-section&quot;&gt;

if (!window._bdb) _bdb = [];
_bdb.push(&#39;a&#39;, &#39;b&#39;, &#39;c&#39;);

&lt;/script&gt;

&lt;span style=&quot;font-weight:bold;&quot;&gt;s全体&lt;/span&gt; &lt;br /&gt;
&lt;script&gt;
document.writeln(document.getElementById(&#39;data-section&#39;)+&#39;&lt;br/&gt;&#39;);
&lt;/script&gt;

&lt;span style=&quot;font-weight:bold;&quot;&gt;innerHTML&lt;/span&gt; &lt;br /&gt;
&lt;script&gt;
document.writeln(document.getElementById(&#39;data-section&#39;).innerHTML+&#39;&lt;br/&gt;&#39;);
&lt;/script&gt;

&lt;span style=&quot;font-weight:bold;&quot;&gt;SCRIPTタグの実行結果&lt;/span&gt; &lt;br /&gt;
&lt;script&gt;
document.writeln(JSON.stringify(_bdb)+&#39;&lt;br/&gt;&#39;);
&lt;/script&gt;

…普通にgetElementByIdで検索出来て、書いたままの文字列として扱えるようだ。</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/5027488932102314678/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/06/scriptid.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/5027488932102314678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/5027488932102314678'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/06/scriptid.html' title='SCRIPTタグにIDをつけるとどうなる？'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-1534421773673665398</id><published>2010-06-01T06:35:00.010+09:00</published><updated>2010-06-01T07:28:27.552+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="テスト"/><title type='text'>JSON文字列生成テスト</title><content type='html'>&lt;form onsubmit=&quot;lookupOnClick();return false;&quot;&gt;
    Keyword: &lt;input type=&quot;text&quot; id=&quot;search-key&quot; /&gt; 
    &lt;input type=&quot;button&quot; value=&quot;search&quot; onclick=&quot;lookupOnClick()&quot;/&gt;
&lt;/form&gt;

&lt;div style=&quot;border:1px solid; margin: 2px; padding: 4px;&quot;&gt;
&lt;div id=&quot;text-area&quot;&gt;&lt;/div&gt;
&lt;br style=&quot;clear:both&quot;/&gt;
&lt;/div&gt;

&lt;div id=&quot;branding&quot;&gt;&lt;/div&gt;

&lt;div id=&quot;log-area&quot;&gt; &lt;/div&gt;


&lt;div style=&quot;display:none&quot;&gt;
&lt;img id=&quot;pict-template&quot; onerror=&quot;dispose(this);&quot; border=&quot;0&quot; style=&quot;float:right; border:1px outset; margin:3px; padding:0px;&quot; /&gt;
&lt;div id=&quot;clearbox-template&quot; style=&quot;clear:both&quot;&gt;&lt;/div&gt;
&lt;p id=&quot;entry-template&quot;&gt;&lt;/p&gt;
&lt;div id=&quot;title-template&quot; style=&quot;&quot;&gt;&lt;/div&gt;
&lt;span id=&quot;subtitle-template&quot; style=&quot;font-size:80%;&quot;&gt;&lt;/span&gt;
&lt;div id=&quot;content-template&quot; style=&quot;margin-left:1em;&quot;&gt;&lt;/div&gt;
&lt;span id=&quot;relateLink-template&quot; style=&quot;font-size:90%;&quot;&gt;&lt;/span&gt;
&lt;a id=&quot;link-template&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;http://sharri.web.fc2.com/JSlab/SL.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;http://sharri.web.fc2.com/JSlab/json2-min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--

var _NM = { start: new Date() };

function printLog(log) {
    document.getElementById(&#39;log-area&#39;).innerHTML += log + &#39;&lt;br/&gt;&#39;;
}

function getTemplate(name) {
    return sL.template.create(name);
/*
    var templ = document.getElementById(name).cloneNode(true);
    templ.id = null;
    return templ;
*/
}

function dispose(img) {

    printLog(&#39;disposed: &#39; + img.src);
    var pa = img.parentNode;
    pa.removeChild(img);
    var granPa = pa.parentNode;
    granPa.removeChild(pa);
    var great = granPa.parentNode;
    great.removeChild(granPa);
}

function diffTime(a, b) {
    var d = a.getTime() - b.getTime();
    if (d &lt; 1000 * 60) {
        return &#39;now&#39;;
    }

    if (d &lt; 1000 * 60 * 60) {
        return Math.floor(d / (1000 * 60)) + &#39;min&#39;;
    }

    if (d &lt; 1000 * 60 * 60 * 24) {
        return Math.floor(d / (1000 * 60 * 60)) + &#39;hour&#39;;
    }

    return Math.floor(d / (1000 * 60 * 60 * 24)) + &#39;day&#39;;
}

google.load(&#39;search&#39;, &#39;1&#39;);

function bsComp(bs) {
    if (!bs.results) return;

    var target = document.getElementById(&#39;text-area&#39;);

    var results = bs.results;

    for (var i = 0; i &lt; results.length; ++i) {
        var r = results[i];

        var newsBlock = getTemplate(&#39;entry-template&#39;);

        var title = getTemplate(&#39;title-template&#39;);
        var a = getTemplate(&#39;link-template&#39;);
        a.innerHTML = r.titleNoFormatting;
        a.href = r.postUrl;
        title.appendChild(a);
        newsBlock.appendChild(title);

        var title = getTemplate(&#39;subtitle-template&#39;);
        title.innerHTML =
            r.blogUrl
            + &#39; by &#39;
            + r.author
            + &#39; - &#39;
            + &#39; (&#39; + new Date(r.publishedDate).toLocaleDateString() + &#39;)&#39;
            + &#39; &#39;
            + diffTime(new Date(), new Date(r.publishedDate));

        var div = document.createElement(&#39;div&#39;);
        div.appendChild(title);
        newsBlock.appendChild(div);

        var content = getTemplate(&#39;content-template&#39;);
        content.innerHTML = r.content;
        newsBlock.appendChild(content);

        target.appendChild(newsBlock);
    }

    var cursor = bs.cursor;
    var next = cursor.currentPageIndex + 1;
    if (next &gt;= cursor.pages.length) return;
    bs.gotoPage(next);
}

function nsComp(ns) {
    if (!ns.results) return;

    var target = document.getElementById(&#39;text-area&#39;);

    var results = ns.results;

    for (var i = 0; i &lt; results.length; ++i) {
        var r = results[i];

        printLog(&#39;JSON:&#39; + JSON.stringify(r));

        var newsBlock = getTemplate(&#39;entry-template&#39;);
        if (r.image) {
            var img = getTemplate(&#39;pict-template&#39;);
            img.src = r.image.url;
            img.alt = r.titleNoFormatting
                        + &#39; - &#39;
                        + r.image.publisher;

            a = getTemplate(&#39;link-template&#39;);
            a.href = r.image.originalContextUrl;
            a.title = r.titleNoFormatting
                        + &#39; - &#39;
                        + r.image.publisher;
            //a.href = r.unescapedUrl;
            //a.title = r.titleNoFormatting;
            a.appendChild(img);


            var cb = getTemplate(&#39;clearbox-template&#39;);
            cb.appendChild(a);

            newsBlock.appendChild(cb);
        }

        var title = getTemplate(&#39;title-template&#39;);
        var a = getTemplate(&#39;link-template&#39;);
        a.innerHTML = r.titleNoFormatting;
        a.href = r.unescapedUrl;
        title.appendChild(a);
        newsBlock.appendChild(title);

        var title = getTemplate(&#39;subtitle-template&#39;);
        title.innerHTML =
            r.publisher
            + &#39; - &#39;
            + &#39; (&#39; + new Date(r.publishedDate).toLocaleDateString() + &#39;)&#39;
            + &#39; &#39;
            + diffTime(new Date(), new Date(r.publishedDate));

        var div = document.createElement(&#39;div&#39;);
        div.appendChild(title);
        newsBlock.appendChild(div);

        var content = getTemplate(&#39;content-template&#39;);
        content.innerHTML = r.content;
        newsBlock.appendChild(content);

        if (r.relatedStories) {
            var p = getTemplate(&#39;content-template&#39;);
            for (var ii = 0; ii &lt; r.relatedStories.length; ++ii) {
                var subentry = document.createElement(&#39;span&#39;);
                p.appendChild(subentry);
                p.appendChild(document.createElement(&#39;br&#39;));

                var span = getTemplate(&#39;relateLink-template&#39;);
                var a = getTemplate(&#39;link-template&#39;);
                a.innerHTML = r.relatedStories[ii].titleNoFormatting;
                a.href = r.relatedStories[ii].unescapedUrl;
                span.appendChild(a);

                var subspan = getTemplate(&#39;subtitle-template&#39;);
                subspan.innerHTML += &#39; - &#39; + r.relatedStories[ii].publisher;
                span.appendChild(subspan);

                subentry.appendChild(span);
            }
            content.appendChild(p);
        }

        //newsBlock.appendChild(document.createElement(&#39;br&#39;));

        target.appendChild(newsBlock);
    }

    var cursor = ns.cursor;
    var next = cursor.currentPageIndex + 1;
    if (next &gt;= cursor.pages.length) return;
    ns.gotoPage(next);
}

function lookup(target) {
    var n = new google.search.NewsSearch();
    n.setNoHtmlGeneration();
    n.setSearchCompleteCallback(this, nsComp, [n]);

    var b = new google.search.BlogSearch();
    b.setNoHtmlGeneration();
    b.setSearchCompleteCallback(this, bsComp, [b]);

    n.execute(target);
    b.execute(target);
}

function dumpObj(obj) {
    var str = &#39;{&#39;;
    for (var p in obj) {
        str += p + &#39; : &#39; + obj[p] + &#39;, &#39;;
    }
    return str + &#39;_eop:null}&#39;;
}

function dumpProp(obj) {
    var str = &#39;{&#39;;
    for (var p in obj) {
        str += p +  &#39;, &#39;;
    }
    return str + &#39;_eop}&#39;;
}


function clientInfo() {
    var info = [navigator.userAgent];
    info.push(location.host);
    info.push(location.hostname);
    info.push(location.port);
    info.push(location.protocol);
    return JSON.stringify(info);
/*
    var s = function (str) {
        return &#39;&quot;&#39; + str + &#39;&quot;&#39;;
    };

    var info = &#39;[&#39;;
    info += s(navigator.userAgent);
    info += &#39;,&#39;;

    info += s(location.href);
    info += &#39;,&#39;;

    info += s(location.host);
    info += &#39;,&#39;;

    info += s(location.hostname);
    info += &#39;,&#39;;

    info += s(location.port);
    info += &#39;,&#39;;

    info += s(location.protocol);

    info += &#39;]&#39;;

    return info;
*/
}

function lookupOnClick() {
    document.getElementById(&#39;text-area&#39;).innerHTML = &#39;&#39;;
    lookup(document.getElementById(&#39;search-key&#39;).value);
}

window.onload = function () {
    printLog(&#39;info:&#39; + clientInfo());
    /*
    lookup(&#39;OpenGL&#39;);
    lookup(&#39;Direct3D&#39;);
    lookup(&#39;Direct2D&#39;);
    lookup(&#39;beauty&#39;);
    lookup(&#39;woman&#39;);
    lookup(&#39;girl&#39;);
    */
    
    google.search.Search.getBranding(document.getElementById(&quot;branding&quot;));
};

//--&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/1534421773673665398/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/06/json.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/1534421773673665398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/1534421773673665398'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/06/json.html' title='JSON文字列生成テスト'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-963741905052586640</id><published>2010-05-29T21:57:00.001+09:00</published><updated>2010-05-29T22:00:44.650+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ツール"/><title type='text'>News/Blog検索ツール</title><content type='html'>&lt;form onsubmit=&quot;lookupOnClick()&quot;&gt;
    Keyword: &lt;input type=&quot;text&quot; id=&quot;search-key&quot; /&gt; 
    &lt;input type=&quot;button&quot; value=&quot;search&quot; onclick=&quot;lookupOnClick()&quot;/&gt;
&lt;/form&gt;

&lt;div style=&quot;border:1px solid; margin: 2px; padding: 4px;&quot;&gt;
&lt;div id=&quot;text-area&quot;&gt;&lt;/div&gt;
&lt;br style=&quot;clear:both&quot;/&gt;
&lt;/div&gt;

&lt;div id=&quot;branding&quot;&gt;&lt;/div&gt;

&lt;div id=&quot;log-area&quot;&gt; &lt;/div&gt;


&lt;div style=&quot;display:none&quot;&gt;
&lt;img id=&quot;pict-template&quot; onerror=&quot;dispose(this);&quot; border=&quot;0&quot; style=&quot;float:right; border:1px outset; margin:3px; padding:0px;&quot; /&gt;
&lt;div id=&quot;clearbox-template&quot; style=&quot;clear:both&quot;&gt;&lt;/div&gt;
&lt;p id=&quot;entry-template&quot;&gt;&lt;/p&gt;
&lt;div id=&quot;title-template&quot; style=&quot;&quot;&gt;&lt;/div&gt;
&lt;span id=&quot;subtitle-template&quot; style=&quot;font-size:80%;&quot;&gt;&lt;/span&gt;
&lt;div id=&quot;content-template&quot; style=&quot;margin-left:1em;&quot;&gt;&lt;/div&gt;
&lt;span id=&quot;relateLink-template&quot; style=&quot;font-size:90%;&quot;&gt;&lt;/span&gt;
&lt;a id=&quot;link-template&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--

function printLog(log) {
    document.getElementById(&#39;log-area&#39;).innerHTML += log + &#39;&lt;br/&gt;&#39;;
}

function getTemplate(name) {
    var templ = document.getElementById(name).cloneNode(true);
    templ.id = null;
    return templ;
}

function dispose(img) {

    printLog(&#39;disposed: &#39; + img.src);
    var pa = img.parentNode;
    pa.removeChild(img);
    var granPa = pa.parentNode;
    granPa.removeChild(pa);
    var great = granPa.parentNode;
    great.removeChild(granPa);
}

function diffTime(a, b) {
    var d = a.getTime() - b.getTime();
    if (d &lt; 1000 * 60) {
        return &#39;now&#39;;
    }

    if (d &lt; 1000 * 60 * 60) {
        return Math.floor(d / (1000 * 60)) + &#39;min&#39;;
    }

    if (d &lt; 1000 * 60 * 60 * 24) {
        return Math.floor(d / (1000 * 60 * 60)) + &#39;hour&#39;;
    }

    return Math.floor(d / (1000 * 60 * 60 * 24)) + &#39;day&#39;;
}

google.load(&#39;search&#39;, &#39;1&#39;);

function bsComp(bs) {
    if (!bs.results) return;

    var target = document.getElementById(&#39;text-area&#39;);

    var results = bs.results;

    for (var i = 0; i &lt; results.length; ++i) {
        var r = results[i];

        var newsBlock = getTemplate(&#39;entry-template&#39;);

        var title = getTemplate(&#39;title-template&#39;);
        var a = getTemplate(&#39;link-template&#39;);
        a.innerHTML = r.titleNoFormatting;
        a.href = r.postUrl;
        title.appendChild(a);
        newsBlock.appendChild(title);

        var title = getTemplate(&#39;subtitle-template&#39;);
        title.innerHTML =
            r.blogUrl
            + &#39; by &#39;
            + r.author
            + &#39; - &#39;
            + &#39; (&#39; + new Date(r.publishedDate).toLocaleDateString() + &#39;)&#39;
            + &#39; &#39;
            + diffTime(new Date(), new Date(r.publishedDate));

        var div = document.createElement(&#39;div&#39;);
        div.appendChild(title);
        newsBlock.appendChild(div);

        var content = getTemplate(&#39;content-template&#39;);
        content.innerHTML = r.content;
        newsBlock.appendChild(content);

        target.appendChild(newsBlock);
    }

    var cursor = bs.cursor;
    var next = cursor.currentPageIndex + 1;
    if (next &gt;= cursor.pages.length) return;
    bs.gotoPage(next);
}

function nsComp(ns) {
    if (!ns.results) return;

    var target = document.getElementById(&#39;text-area&#39;);

    var results = ns.results;

    for (var i = 0; i &lt; results.length; ++i) {
        var r = results[i];

        var newsBlock = getTemplate(&#39;entry-template&#39;);
        if (r.image) {
            var img = getTemplate(&#39;pict-template&#39;);
            img.src = r.image.url;
            img.alt = r.titleNoFormatting
                        + &#39; - &#39;
                        + r.image.publisher;

            a = getTemplate(&#39;link-template&#39;);
            a.href = r.image.originalContextUrl;
            a.title = r.titleNoFormatting
                        + &#39; - &#39;
                        + r.image.publisher;
            //a.href = r.unescapedUrl;
            //a.title = r.titleNoFormatting;
            a.appendChild(img);


            var cb = getTemplate(&#39;clearbox-template&#39;);
            cb.appendChild(a);

            newsBlock.appendChild(cb);
        }

        var title = getTemplate(&#39;title-template&#39;);
        var a = getTemplate(&#39;link-template&#39;);
        a.innerHTML = r.titleNoFormatting;
        a.href = r.unescapedUrl;
        title.appendChild(a);
        newsBlock.appendChild(title);

        var title = getTemplate(&#39;subtitle-template&#39;);
        title.innerHTML =
            r.publisher
            + &#39; - &#39;
            + &#39; (&#39; + new Date(r.publishedDate).toLocaleDateString() + &#39;)&#39;
            + &#39; &#39;
            + diffTime(new Date(), new Date(r.publishedDate));

        var div = document.createElement(&#39;div&#39;);
        div.appendChild(title);
        newsBlock.appendChild(div);

        var content = getTemplate(&#39;content-template&#39;);
        content.innerHTML = r.content;
        newsBlock.appendChild(content);

        if (r.relatedStories) {
            var p = getTemplate(&#39;content-template&#39;);
            for (var ii = 0; ii &lt; r.relatedStories.length; ++ii) {
                var subentry = document.createElement(&#39;span&#39;);
                p.appendChild(subentry);
                p.appendChild(document.createElement(&#39;br&#39;));

                var span = getTemplate(&#39;relateLink-template&#39;);
                var a = getTemplate(&#39;link-template&#39;);
                a.innerHTML = r.relatedStories[ii].titleNoFormatting;
                a.href = r.relatedStories[ii].unescapedUrl;
                span.appendChild(a);

                var subspan = getTemplate(&#39;subtitle-template&#39;);
                subspan.innerHTML += &#39; - &#39; + r.relatedStories[ii].publisher;
                span.appendChild(subspan);

                subentry.appendChild(span);
            }
            content.appendChild(p);
        }

        //newsBlock.appendChild(document.createElement(&#39;br&#39;));

        target.appendChild(newsBlock);
    }

    var cursor = ns.cursor;
    var next = cursor.currentPageIndex + 1;
    if (next &gt;= cursor.pages.length) return;
    ns.gotoPage(next);
}

function lookup(target) {
    var n = new google.search.NewsSearch();
    n.setNoHtmlGeneration();
    n.setSearchCompleteCallback(this, nsComp, [n]);
    var b = new google.search.BlogSearch();
    b.setNoHtmlGeneration();
    b.setSearchCompleteCallback(this, bsComp, [b]);

    n.execute(target);
    b.execute(target);
}

function dumpObj(obj) {
    var str = &#39;{&#39;;
    for (var p in obj) {
        str += p + &#39; : &#39; + obj[p] + &#39;, &#39;;
    }
    return str + &#39;_eop:null}&#39;;
}

function dumpProp(obj) {
    var str = &#39;{&#39;;
    for (var p in obj) {
        str += p +  &#39;, &#39;;
    }
    return str + &#39;_eop}&#39;;
}


function clientInfo() {
    var s = function (str) {
        return &#39;&quot;&#39; + str + &#39;&quot;&#39;;
    };

    var info = &#39;[&#39;;
    info += s(navigator.userAgent);
    info += &#39;,&#39;;

    info += s(location.href);
    info += &#39;,&#39;;

    info += s(location.host);
    info += &#39;,&#39;;

    info += s(location.hostname);
    info += &#39;,&#39;;

    info += s(location.port);
    info += &#39;,&#39;;

    info += s(location.protocol);

    info += &#39;]&#39;;

    return info;
}

function lookupOnClick() {
    document.getElementById(&#39;text-area&#39;).innerHTML = &#39;&#39;;
    lookup(document.getElementById(&#39;search-key&#39;).value);
}

google.setOnLoadCallback(function () {
    printLog(&#39;info:&#39; + clientInfo());
    /*
    lookup(&#39;OpenGL&#39;);
    lookup(&#39;Direct3D&#39;);
    lookup(&#39;Direct2D&#39;);
    lookup(&#39;beauty&#39;);
    lookup(&#39;woman&#39;);
    lookup(&#39;girl&#39;);
    */
    
    google.search.Search.getBranding(document.getElementById(&quot;branding&quot;));
});

//--&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/963741905052586640/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/05/newsblog.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/963741905052586640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/963741905052586640'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/05/newsblog.html' title='News/Blog検索ツール'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-4349206215626360237</id><published>2010-05-29T19:47:00.008+09:00</published><updated>2010-05-29T21:08:59.160+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ツール"/><title type='text'>ニュース検索ツール</title><content type='html'>&lt;form onsubmit=&quot;lookupOnClick()&quot;&gt;
    Keyword: &lt;input type=&quot;text&quot; id=&quot;search-key&quot; /&gt; 
    &lt;input type=&quot;button&quot; value=&quot;search&quot; onclick=&quot;lookupOnClick()&quot;/&gt;
&lt;/form&gt;

&lt;div style=&quot;border:1px solid; margin: 2px; padding: 4px;&quot;&gt;
&lt;div id=&quot;text-area&quot;&gt;&lt;/div&gt;
&lt;br style=&quot;clear:both&quot;/&gt;
&lt;/div&gt;

&lt;div id=&quot;branding&quot;&gt;&lt;/div&gt;

&lt;div id=&quot;log-area&quot;&gt; &lt;/div&gt;


&lt;div style=&quot;display:none&quot;&gt;
&lt;img id=&quot;pict-template&quot; onerror=&quot;dispose(this);&quot; border=&quot;0&quot; style=&quot;float:right; border:1px outset; margin:3px; padding:0px;&quot; /&gt;
&lt;div id=&quot;clearbox-template&quot; style=&quot;clear:both&quot;&gt;&lt;/div&gt;
&lt;p id=&quot;entry-template&quot;&gt;&lt;/p&gt;
&lt;div id=&quot;title-template&quot; style=&quot;&quot;&gt;&lt;/div&gt;
&lt;span id=&quot;subtitle-template&quot; style=&quot;font-size:80%;&quot;&gt;&lt;/span&gt;
&lt;div id=&quot;content-template&quot; style=&quot;margin-left:1em;&quot;&gt;&lt;/div&gt;
&lt;span id=&quot;relateLink-template&quot; style=&quot;font-size:90%;&quot;&gt;&lt;/span&gt;
&lt;a id=&quot;link-template&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--

function printLog(log) {
    document.getElementById(&#39;log-area&#39;).innerHTML += log + &#39;&lt;br/&gt;&#39;;
}

function getTemplate(name) {
    var templ = document.getElementById(name).cloneNode(true);
    templ.id = null;
    return templ;
}

function dispose(img) {

    printLog(&#39;disposed: &#39; + img.src);
    var pa = img.parentNode;
    pa.removeChild(img);
    var granPa = pa.parentNode;
    granPa.removeChild(pa);
    var great = granPa.parentNode;
    great.removeChild(granPa);
}

function diffTime(a, b) {
    var d = a.getTime() - b.getTime();
    if (d &lt; 1000 * 60) {
        return &#39;now&#39;;
    }

    if (d &lt; 1000 * 60 * 60) {
        return Math.floor(d / (1000 * 60)) + &#39;min&#39;;
    }

    if (d &lt; 1000 * 60 * 60 * 24) {
        return Math.floor(d / (1000 * 60 * 60)) + &#39;hour&#39;;
    }

    return Math.floor(d / (1000 * 60 * 60 * 24)) + &#39;day&#39;;
}

google.load(&#39;search&#39;, &#39;1&#39;);

function nsComp(ns) {
    if (!ns.results) return;

    var target = document.getElementById(&#39;text-area&#39;);

    var results = ns.results;

    for (var i = 0; i &lt; results.length; ++i) {
        var r = results[i];

        var newsBlock = getTemplate(&#39;entry-template&#39;);
        if (r.image) {
            var img = getTemplate(&#39;pict-template&#39;);
            img.src = r.image.url;
            img.alt = r.titleNoFormatting
                        + &#39; - &#39;
                        + r.image.publisher;

            a = getTemplate(&#39;link-template&#39;);
            a.href = r.image.originalContextUrl;
            a.title = r.titleNoFormatting
                        + &#39; - &#39;
                        + r.image.publisher;
            //a.href = r.unescapedUrl;
            //a.title = r.titleNoFormatting;
            a.appendChild(img);


            var cb = getTemplate(&#39;clearbox-template&#39;);
            cb.appendChild(a);

            newsBlock.appendChild(cb);
        }

        var title = getTemplate(&#39;title-template&#39;);
        var a = getTemplate(&#39;link-template&#39;);
        a.innerHTML = r.titleNoFormatting;
        a.href = r.unescapedUrl;
        title.appendChild(a);
        newsBlock.appendChild(title);

        var title = getTemplate(&#39;subtitle-template&#39;);
        title.innerHTML =
            r.publisher
            + &#39; - &#39;
            + &#39; (&#39; + new Date(r.publishedDate).toLocaleDateString() + &#39;)&#39;
            + &#39; &#39;
            + diffTime(new Date(), new Date(r.publishedDate));

        var div = document.createElement(&#39;div&#39;);
        div.appendChild(title);
        newsBlock.appendChild(div);

        var content = getTemplate(&#39;content-template&#39;);
        content.innerHTML = r.content;
        newsBlock.appendChild(content);

        if (r.relatedStories) {
            var p = getTemplate(&#39;content-template&#39;);
            for (var ii = 0; ii &lt; r.relatedStories.length; ++ii) {
                var subentry = document.createElement(&#39;span&#39;);
                p.appendChild(subentry);
                p.appendChild(document.createElement(&#39;br&#39;));

                var span = getTemplate(&#39;relateLink-template&#39;);
                var a = getTemplate(&#39;link-template&#39;);
                a.innerHTML = r.relatedStories[ii].titleNoFormatting;
                a.href = r.relatedStories[ii].unescapedUrl;
                span.appendChild(a);

                var subspan = getTemplate(&#39;subtitle-template&#39;);
                subspan.innerHTML += &#39; - &#39; + r.relatedStories[ii].publisher;
                span.appendChild(subspan);

                subentry.appendChild(span);
            }
            content.appendChild(p);
        }

        //newsBlock.appendChild(document.createElement(&#39;br&#39;));

        target.appendChild(newsBlock);
    }

    var cursor = ns.cursor;
    var next = cursor.currentPageIndex + 1;
    if (next &gt;= cursor.pages.length) return;
    ns.gotoPage(next);
}

function lookup(target) {
    var searcher = new google.search.NewsSearch();
    searcher.setSearchCompleteCallback(
        this,
        nsComp,
        [searcher]
    );
    searcher.execute(target);
}

function dumpObj(obj) {
    var str = &#39;{&#39;;
    for (var p in obj) {
        str += p + &#39; : &#39; + obj[p] + &#39;, &#39;;
    }
    return str + &#39;_eop:null}&#39;;
}

function dumpProp(obj) {
    var str = &#39;{&#39;;
    for (var p in obj) {
        str += p +  &#39;, &#39;;
    }
    return str + &#39;_eop}&#39;;
}


function clientInfo() {
    var s = function (str) {
        return &#39;&quot;&#39; + str + &#39;&quot;&#39;;
    };

    var info = &#39;[&#39;;
    info += s(navigator.userAgent);
    info += &#39;,&#39;;

    info += s(location.href);
    info += &#39;,&#39;;

    info += s(location.host);
    info += &#39;,&#39;;

    info += s(location.hostname);
    info += &#39;,&#39;;

    info += s(location.port);
    info += &#39;,&#39;;

    info += s(location.protocol);

    info += &#39;]&#39;;

    return info;
}

function lookupOnClick() {
    document.getElementById(&#39;text-area&#39;).innerHTML = &#39;&#39;;
    lookup(document.getElementById(&#39;search-key&#39;).value);
}

google.setOnLoadCallback(function () {
    printLog(&#39;info:&#39; + clientInfo());
    /*
    lookup(&#39;OpenGL&#39;);
    lookup(&#39;Direct3D&#39;);
    lookup(&#39;Direct2D&#39;);
    lookup(&#39;beauty&#39;);
    lookup(&#39;woman&#39;);
    lookup(&#39;girl&#39;);
    */
    
    google.search.Search.getBranding(document.getElementById(&quot;branding&quot;));
});

//--&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/4349206215626360237/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/05/news-search.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/4349206215626360237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/4349206215626360237'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/05/news-search.html' title='ニュース検索ツール'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-8560123618592717306</id><published>2010-05-29T12:03:00.001+09:00</published><updated>2010-05-29T16:26:11.698+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="実験"/><title type='text'>テキストエリア中のテキストの取得方法</title><content type='html'>&lt;form&gt;
&lt;textarea rows=&quot;10&quot; cols=&quot;50&quot; id=&quot;try-value&quot; onchange=&quot;tt(this)&quot; onkeydown=&quot;tt(this)&quot; onkeyup=&quot;tt(this)&quot;&gt;
Come on, type here!
&lt;/textarea&gt;
&lt;/form&gt;

&lt;h3&gt;Value&lt;/h3&gt;
&lt;div style=&quot;width:50em;border:1px solid&quot; id=&quot;by-value&quot;&gt;&lt;/div&gt;
&lt;div style=&quot;width:50em;border:1px solid&quot; id=&quot;by-value2&quot;&gt;&lt;/div&gt;
&lt;h3&gt;InnerHTML&lt;/h3&gt;
&lt;div style=&quot;width:50em;border:1px solid&quot; id=&quot;by-innerHTML&quot;&gt;&lt;/div&gt;
&lt;div style=&quot;width:50em;border:1px solid&quot; id=&quot;by-innerHTML2&quot;&gt;&lt;/div&gt;

&lt;script&gt;
function tt(ta) {
  document.getElementById(&#39;by-value&#39;).innerHTML = ta.value;
  document.getElementById(&#39;by-innerHTML&#39;).innerHTML = ta.innerHTML;

  ta = document.getElementById(&#39;try-value&#39;);

  document.getElementById(&#39;by-value2&#39;).innerHTML = ta.value;
  document.getElementById(&#39;by-innerHTML2&#39;).innerHTML = ta.innerHTML;
}
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/8560123618592717306/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/05/blog-post_29.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/8560123618592717306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/8560123618592717306'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/05/blog-post_29.html' title='テキストエリア中のテキストの取得方法'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-3541158429019992107</id><published>2010-05-29T00:36:00.001+09:00</published><updated>2010-05-29T00:50:45.536+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="テスト"/><title type='text'>ニュースサーチ</title><content type='html'>&lt;div id=&quot;log-area&quot;&gt;
&lt;/div&gt;

&lt;div style=&quot;border:1px solid; margin: 2px; padding: 4px;&quot;&gt;
&lt;div id=&quot;text-area&quot;&gt;&lt;/div&gt;
&lt;br style=&quot;clear:both&quot;/&gt;
&lt;/div&gt;

&lt;div id=&quot;branding&quot;&gt;&lt;/div&gt;

&lt;div style=&quot;display:none&quot;&gt;
&lt;img id=&quot;pict-template&quot; onerror=&quot;dispose(this);&quot; border=&quot;0&quot; style=&quot;float:right; border:1px solid; margin:2px; padding:2px;&quot; /&gt;
&lt;div id=&quot;clearbox-template&quot; style=&quot;clear:both&quot;&gt;&lt;/div&gt;
&lt;p id=&quot;entry-template&quot;&gt;&lt;/p&gt;
&lt;div id=&quot;title-template&quot; style=&quot;&quot;&gt;&lt;/div&gt;
&lt;span id=&quot;subtitle-template&quot; style=&quot;font-size:80%;&quot;&gt;&lt;/span&gt;
&lt;div id=&quot;content-template&quot; style=&quot;margin-left:1em;&quot;&gt;&lt;/div&gt;
&lt;span id=&quot;relateLink-template&quot; style=&quot;font-size:90%;&quot;&gt;&lt;/span&gt;
&lt;a id=&quot;link-template&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--

function printLog(log) {
    document.getElementById(&#39;log-area&#39;).innerHTML += log + &#39;&lt;br/&gt;&#39;;
}

function getTemplate(name) {
    var templ = document.getElementById(name).cloneNode(true);
    templ.id = null;
    return templ;
}

function dispose(img) {

    printLog(&#39;disposed: &#39; + img.src);
    var pa = img.parentNode;
    pa.removeChild(img);
    var granPa = pa.parentNode;
    granPa.removeChild(pa);
    var great = granPa.parentNode;
    great.removeChild(granPa);
}

function diffTime(a, b) {
    var d = a.getTime() - b.getTime();
    if (d &lt; 1000 * 60) {
        return &#39;now&#39;;
    }

    if (d &lt; 1000 * 60 * 60) {
        return Math.floor(d / (1000 * 60)) + &#39;min&#39;;
    }

    if (d &lt; 1000 * 60 * 60 * 24) {
        return Math.floor(d / (1000 * 60 * 60)) + &#39;hour&#39;;
    }

    return Math.floor(d / (1000 * 60 * 60 * 24)) + &#39;day&#39;;
}

google.load(&#39;search&#39;, &#39;1&#39;);

function nsComp(ns) {
    if (!ns.results) return;

    var target = document.getElementById(&#39;text-area&#39;);

    var results = ns.results;

    for (var i = 0; i &lt; results.length; ++i) {
        var r = results[i];

        var newsBlock = getTemplate(&#39;entry-template&#39;);
        if (r.image) {
            var img = getTemplate(&#39;pict-template&#39;);
            img.src = r.image.url;
            img.alt = r.titleNoFormatting
                        + &#39; - &#39;
                        + r.image.publisher;

            a = getTemplate(&#39;link-template&#39;);
            a.href = r.image.originalContextUrl;
            a.title = r.titleNoFormatting
                        + &#39; - &#39;
                        + r.image.publisher;
            //a.href = r.unescapedUrl;
            //a.title = r.titleNoFormatting;
            a.appendChild(img);


            var cb = getTemplate(&#39;clearbox-template&#39;);
            cb.appendChild(a);

            newsBlock.appendChild(cb);
        }

        var title = getTemplate(&#39;title-template&#39;);
        var a = getTemplate(&#39;link-template&#39;);
        a.innerHTML = r.titleNoFormatting;
        a.href = r.unescapedUrl;
        title.appendChild(a);
        newsBlock.appendChild(title);

        var title = getTemplate(&#39;subtitle-template&#39;);
        title.innerHTML =
            r.publisher
            + &#39; - &#39;
            + &#39; (&#39; + new Date(r.publishedDate).toLocaleDateString() + &#39;)&#39;
            + &#39; &#39;
            + diffTime(new Date(), new Date(r.publishedDate));

        var div = document.createElement(&#39;div&#39;);
        div.appendChild(title);
        newsBlock.appendChild(div);

        var content = getTemplate(&#39;content-template&#39;);
        content.innerHTML = r.content;
        newsBlock.appendChild(content);

        if (r.relatedStories) {
            var p = getTemplate(&#39;content-template&#39;);
            for (var ii = 0; ii &lt; r.relatedStories.length; ++ii) {
                var subentry = document.createElement(&#39;span&#39;);
                p.appendChild(subentry);
                p.appendChild(document.createElement(&#39;br&#39;));

                var span = getTemplate(&#39;relateLink-template&#39;);
                var a = getTemplate(&#39;link-template&#39;);
                a.innerHTML = r.relatedStories[ii].titleNoFormatting;
                a.href = r.relatedStories[ii].unescapedUrl;
                span.appendChild(a);

                var subspan = getTemplate(&#39;subtitle-template&#39;);
                subspan.innerHTML += &#39; - &#39; + r.relatedStories[ii].publisher;
                span.appendChild(subspan);

                subentry.appendChild(span);
            }
            content.appendChild(p);
        }

        //newsBlock.appendChild(document.createElement(&#39;br&#39;));

        target.appendChild(newsBlock);
    }

    var cursor = ns.cursor;
    var next = cursor.currentPageIndex + 1;
    if (next &gt;= cursor.pages.length) return;
    ns.gotoPage(next);
}

function lookup(target) {
    var searcher = new google.search.NewsSearch();
    searcher.setSearchCompleteCallback(
        this,
        nsComp,
        [searcher]
    );
    searcher.execute(target);
}

function dumpObj(obj) {
    var str = &#39;{&#39;;
    for (var p in obj) {
        str += p + &#39; : &#39; + obj[p] + &#39;, &#39;;
    }
    return str + &#39;_eop:null}&#39;;
}

function dumpProp(obj) {
    var str = &#39;{&#39;;
    for (var p in obj) {
        str += p +  &#39;, &#39;;
    }
    return str + &#39;_eop}&#39;;
}


function clientInfo() {
    var s = function (str) {
        return &#39;&quot;&#39; + str + &#39;&quot;&#39;;
    };

    var info = &#39;[&#39;;
    info += s(navigator.userAgent);
    info += &#39;,&#39;;

    info += s(location.href);
    info += &#39;,&#39;;

    info += s(location.host);
    info += &#39;,&#39;;

    info += s(location.hostname);
    info += &#39;,&#39;;

    info += s(location.port);
    info += &#39;,&#39;;

    info += s(location.protocol);

    info += &#39;]&#39;;

    return info;
}

google.setOnLoadCallback(function () {
    printLog(&#39;info:&#39; + clientInfo());
    /*
    lookup(&#39;OpenGL&#39;);
    lookup(&#39;Direct3D&#39;);
    lookup(&#39;Direct2D&#39;);
    */
    lookup(&#39;beauty&#39;);
    lookup(&#39;woman&#39;);
    lookup(&#39;girl&#39;);
    
    google.search.Search.getBranding(document.getElementById(&quot;branding&quot;));
});

//--&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/3541158429019992107/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/05/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/3541158429019992107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/3541158429019992107'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/05/blog-post.html' title='ニュースサーチ'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-1305962041207733171</id><published>2010-05-24T23:20:00.001+09:00</published><updated>2010-05-24T23:25:42.349+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ツール"/><title type='text'>サムネイル・プレビュー作成ツール ver.1.7</title><content type='html'>&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;http://sharri.web.fc2.com/JSlab/SL.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
google.load(&#39;search&#39;, &#39;1&#39;);
//--&gt;
&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
var IT = {
  keyword: function() {
    return document.getElementById(&#39;IT_SearchKey&#39;).value;
  }
  ,
  walkAllPage: function (s) {
    var cursor = s.cursor;
    var next = cursor.currentPageIndex + 1;
    if (next &gt;= cursor.pages.length) return;
    s.gotoPage(next);
  }
  ,
  buildIcon: function (url, alt, width, height) {
       var newImg = document.createElement(&#39;img&#39;);
       newImg.alt           = alt;
       newImg.src           = url;
       newImg.height        = height;
       newImg.width         = width;
       newImg.style.margin  = &#39;1px&#39;;
       newImg.style.padding = &#39;1px&#39;;
       newImg.style.border  = &#39;1px solid #888&#39;;
       return newImg;
  }
  ,
  viewResult: function (result) {

    var imgUrl = result.url;
    var srcUrl = result.originalContextUrl;
    var width = result.width;
    var height = result.height;
    var content = result.titleNoFormatting;

    var aSrc = document.getElementById(&#39;IT_ImageSrcLink&#39;);
    var aImg = document.getElementById(&#39;IT_ImageLink&#39;);
    var d = document.getElementById(&#39;IT_ImageDescription&#39;);

    if (aImg == null || aSrc == null || d == null) return;

    d.innerHTML = &#39;&#39;;
    d.appendChild(document.createTextNode(content));
    d.appendChild(document.createElement(&#39;br&#39;));
    d.appendChild(document.createTextNode(&#39;img = &#39; + imgUrl));
    d.appendChild(document.createElement(&#39;br&#39;));
    d.appendChild(document.createTextNode(&#39;src = &#39; + srcUrl));
    d.appendChild(document.createElement(&#39;br&#39;));

    var img = document.createElement(&#39;img&#39;);
    img.style.border = &#39;none&#39;;

    aSrc.href = srcUrl;

    img.alt = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
    img.src = imgUrl;

    var aW = width;
    var aH = height;

    img.width = 450;

    aImg.innerHTML = &#39;&#39;;
    aImg.href = imgUrl;
    aImg.title = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
    aImg.appendChild(img);

  }
  ,
  buildIconHtml: function (result, uid) {
    var viewScript =
       &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).src=&#39;&quot; + result.url +&quot;&#39;;&quot;
       + &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).height=&#39;&quot; + Math.floor(result.height * 450 / result.width) +&quot;&#39;;&quot;
        + &#39;return false;&#39;;

    var img = &#39;&lt;img &#39;
       + &#39; height=&quot;100&quot; &#39;
        + &#39; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot;&#39;
        + &#39; onmouseover=&quot;&#39; + viewScript + &#39;&quot;&#39;
        + &#39; alt=&quot;&#39; + this.keyword() + &#39; &#39; + (new Date).getTime()
           + &#39;&quot;&#39;
        + &#39; src=&quot;&#39; + result.url + &#39;&quot;&#39;
                      + &#39; /&gt;&#39;;
    var a = &#39;&lt;a&#39;
            + &#39; target=&quot;_blank&quot;&#39;
            + &#39; href=&quot;&#39; + result.url + &#39;&quot;&#39;
            + &#39; title=&quot;&#39; + this.keyword() + &#39; &#39; + (new Date).getTime()
               + &#39;&quot;&#39;
            + &#39; &gt;&#39;
            + img
            + &#39;&lt;/a&gt;&#39;;

    return a;
  }
  ,
  buildEraseIcon: function(picts, index) {
    var eraseIcon = sL.image.buildSquareLink(
                      70, 
                      &#39;javascript:void(0);&#39;,
                      picts[index].url,
                      picts[index].titleNoFormatting
                    );
    eraseIcon.style.cssFloat = &#39;left&#39;;
    eraseIcon.style.styleFloat = &#39;left&#39;;
    eraseIcon.style.border = &#39;1px outset&#39;;
    eraseIcon.style.margin = &#39;1px&#39;;
    eraseIcon.style.padding = &#39;1px&#39;;
    eraseIcon.onclick = (function (i) { return function () {
                            IT.removePict(i);
                        };})(index);
    return eraseIcon;
  }
  ,
  buildSelectionBox: function() {
    var bin = document.getElementById(&#39;IT_Bin&#39;);
    var sbox = document.getElementById(&#39;IT_ImageSelectList&#39;);
    sbox.innerHTML = &#39;&#39;;
    for (var i = 0; i &lt; bin.numPict; ++i) {
      if (!bin.picts[i]) continue;
      sbox.appendChild(this.buildEraseIcon(bin.picts, i));
    }
  }
  ,
  buildBin: function () {
    var bin = document.getElementById(&#39;IT_Bin&#39;);
    var uid = &#39;id_&#39;+ (new Date).getTime();

    bin.innerHTML = &#39;&#39;;
    
    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var tdView = document.createElement(&#39;td&#39;);
    var tdIcon = document.createElement(&#39;td&#39;);

    bin.appendChild(table);
    table.appendChild(tbody);
    tbody.appendChild(tr);
    tr.appendChild(tdView);
    tr.appendChild(tdIcon);

    tdIcon.style.verticalAlign = &#39;top&#39;;
    tdView.style.verticalAlign = &#39;top&#39;;

    var img = document.createElement(&#39;img&#39;);
    img.style.cssFloat = &#39;left&#39;;
    img.style.styleFloat = &#39;left&#39;;
    img.style.border = &#39;1px solid #888&#39;;
    img.style.margin = &#39;1px&#39;;
    img.style.padding = &#39;1px&#39;;
    img.width = 450;
    img.id = uid;
    img.alt = this.keyword() + &#39; &#39; + (new Date).getTime();

    if (bin.numPict &gt; 0) {
      for (i = bin.numPict; i &gt; 0; --i) {
        if (!bin.picts[i - 1]) continue;
        img.src = bin.picts[i - 1].url;
        break;
      }
    }
    tdView.appendChild(img);

    var div = document.createElement(&#39;div&#39;);
    div.style.border = &#39;none&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    tdIcon.appendChild(div);
    
    for (var i = 0; i &lt; bin.numPict; ++i) {
      if (!bin.picts[i]) continue;
      div.innerHTML += IT.buildIconHtml(bin.picts[i], uid);
    }

    IT.buildSelectionBox();

    var wsBlock = document.createElement(&#39;div&#39;);
    wsBlock.id = &#39;WebSearchBlock&#39;;
    bin.appendChild(wsBlock);

    for (var i = 0; i &lt; bin.numWeb; ++i) {
      wsBlock.appendChild(bin.webSites[i]);
    }
  }
  ,
  updateTextArea: function () {
    var text = document.getElementById(&#39;IT_GeneratedText&#39;);
    text.innerHTML = &#39;&#39;;
    text.appendChild(
       document.createTextNode(
         document.getElementById(&#39;IT_Bin&#39;).innerHTML));
  }
  ,
  removePict: function (i) {
    var div = document.getElementById(&#39;IT_Bin&#39;);
    if (!(i &lt; div.numPict)) return;
    div.picts[i] = null;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  addPict: function (result) {
    var div = document.getElementById(&#39;IT_Bin&#39;);
    div.picts[div.numPict++] = result;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  showImageState: function () {
    document.getElementById(&#39;IT_ImageStateInfo&#39;).innerHTML = 
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten
      + &#39;/&#39; +
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch
    ;
  }
  ,
  isComplete: function (is) {
    if (!is.results) return;
    if (is.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_ImageIconBlock&#39;);

    var results = is.results;

    document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch += results.length;
    IT.showImageState();

    if (contentDiv.previewMode == &#39;all&#39;) {
      for (var i = 0; i &lt; results.length; i++) {
        var result = results[i];

        var img = document.createElement(&#39;img&#39;);
        img.onload = (function (img, result) { return function () {
          img.onload = null;

          if (img.width != result.width || img.height != result.height) {
            sL.logger.log(&#39;drop:&#39; + result.url + &#39; w:&#39; + img.width + &#39;/&#39; + result.width + &#39; h:&#39; + img.height + &#39;/&#39; + result.height);
            return;
          }

          img.alt = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;

          document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten += 1;
          IT.showImageState();
          var link =  document.createElement(&#39;a&#39;);
          link.title   = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;
          link.href    = &#39;javascript:void(0);&#39;;
          link.onclick = (function (result) { return function () {
                   IT.addPict(result)
          };})(result);

          var h = 120;
          var w = (result.tbWidth * h) / result.tbHeight;
          link.appendChild(IT.buildIcon(result.tbUrl, result.visibleUrl, w, h));
          document.getElementById(&#39;IT_ImageIconBlock&#39;).appendChild(link);

        }})(img, result);
        img.src = result.url;
      }
    } else {
      for (var i = 0; i &lt; results.length; i++) {
        var result = results[i];

        var img = document.createElement(&#39;img&#39;);
        img.onload = (function (img, result) { return function () {
          img.onload = null;

          if (img.width != result.width || img.height != result.height) {
            sL.logger.log(&#39;drop:&#39; + result.url + &#39; w:&#39; + img.width + &#39;/&#39; + result.width + &#39; h:&#39; + img.height + &#39;/&#39; + result.height);
            return;
          }

          img.alt = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;

          document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten += 1;
          IT.showImageState();
          var link =  document.createElement(&#39;a&#39;);
          link.title   = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;
          link.href    = &#39;javascript:void(0);&#39;;
          link.onclick = (function (result) { return function () {
                   IT.addPict(result)
          };})(result);
          link.onmouseover = (function (result) { return function () {
                  IT.viewResult(result)
          };})(result);
          link.onfocus = (function (result) { return function () {
                  IT.viewResult(result)
          };})(result);

          var w = 80;
          var h = (result.tbHeight * w) / result.tbWidth;
          link.appendChild(IT.buildIcon(result.tbUrl, result.visibleUrl, w, h));
          document.getElementById(&#39;IT_ImageIconBlock&#39;).appendChild(link);

        }})(img, result);
        img.src = result.url;
      }
    }

    IT.walkAllPage(is);
  }
  ,
  switchImageView: function (mode) {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);
    div.previewMode = mode;
    IT.initImageDiv();
    IT.doImageSearch();
  }
  ,
  switchImageSize: function (size) {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);
    div.imageSize = size;
    IT.initImageDiv();
    IT.doImageSearch();
  }
  ,
  initImageDiv: function () {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);

    div.innerHTML = &#39;&#39;;

    var child = document.createElement(&#39;a&#39;);
    child.name = &#39;images&#39;;
    div.appendChild(child);

    var head = document.createElement(&#39;p&#39;);
    head.appendChild(document.createTextNode(&#39;[&#39; + this.keyword() + &#39;]&#39;));

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    var span = document.createElement(&#39;span&#39;);
    span.id = &#39;IT_ImageStateInfo&#39;;
    head.appendChild(span);

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    head.appendChild(document.createElement(&#39;br&#39;));

    head.appendChild(document.createTextNode(&#39;View:&#39;));
    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Mode&#39;;
    input.value = &#39;all&#39;;
    input.checked = (div.previewMode == &#39;all&#39;);
    input.onclick = (function (mode) { return function () {
                        IT.switchImageView(mode);
                    };})(&#39;all&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Thumbnail &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Mode&#39;;
    input.value = &#39;preview&#39;;
    input.checked = (div.previewMode != &#39;all&#39;);
    input.onclick = (function (mode) { return function () {
                        IT.switchImageView(mode);
                    };})(&#39;preview&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Preview &#39;));

    head.appendChild(document.createElement(&#39;br&#39;));

    head.appendChild(document.createTextNode(&#39;Size:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;None&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == undefined ||
                    document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;N&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;N&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;None &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Small&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;S&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;S&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Small &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Medium&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;M&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;M&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Medium &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Large&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;L&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;L&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Large &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;ExtraLarge&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;X&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;X&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Extra Large &#39;));

    div.appendChild(head);

    div.style.margin  = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;

    var iconBlock = document.getElementById(&#39;IT_ImageIconBlock&#39;);
    if (iconBlock == null) {
       iconBlock = document.createElement(&#39;div&#39;);
       iconBlock.id = &#39;IT_ImageIconBlock&#39;;
    }

    iconBlock.previewMode = div.previewMode;

    if (iconBlock.previewMode == &#39;all&#39;) {
      iconBlock.style.width    = &#39;auto&#39;;
      iconBlock.style.height   = &#39;auto&#39;;
      iconBlock.style.overflow = &#39;visible&#39;;
      div.appendChild(iconBlock);
    } else {
      iconBlock.style.width    = &#39;100px&#39;;
      iconBlock.style.height   = &#39;550px&#39;;
      iconBlock.style.overflow = &#39;auto&#39;;

      var imgA = document.getElementById(&#39;IT_ImageLink&#39;);
      if (imgA == null) {
        imgA        = document.createElement(&#39;a&#39;);
        imgA.id     = &#39;IT_ImageLink&#39;;
        imgA.target = &#39;_blank&#39;;
      }

      var orgA = document.getElementById(&#39;IT_ImageSrcLink&#39;);
      if (orgA == null) {
        orgA = document.createElement(&#39;a&#39;);
        orgA.id        = &#39;IT_ImageSrcLink&#39;;
        orgA.target    = &#39;_blank&#39;;
        orgA.innerHTML = &#39;[original site]&#39;;
      }

      var descDiv = document.getElementById(&#39;IT_ImageDescription&#39;);
      if (descDiv == null) {
        descDiv = document.createElement(&#39;div&#39;);
        descDiv.id = &#39;IT_ImageDescription&#39;;
      }

      var table  = document.createElement(&#39;table&#39;);
      table.style.border = &#39;none&#39;;

      var tbody = document.createElement(&#39;tbody&#39;);
      table.style.border = &#39;none&#39;;
      table.appendChild(tbody);

      var tr     = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var viewTd = document.createElement(&#39;td&#39;);
      viewTd.style.textAlign = &#39;center&#39;;

      var viewDiv = document.createElement(&#39;div&#39;);
      viewDiv.style.width = &#39;500px&#39;;
      //viewDiv.style.height = &#39;450px&#39;;
      viewDiv.style.overflow = &#39;auto&#39;;
      viewTd.appendChild(viewDiv);
      viewTd.style.verticalAlign = &#39;top&#39;;

      var br = document.createElement(&#39;div&#39;);
      br.style.clear = &#39;both&#39;;

      viewDiv.appendChild(imgA);
      viewDiv.appendChild(br);
      viewDiv.appendChild(orgA);
      viewDiv.appendChild(descDiv);

      var iconTd = document.createElement(&#39;td&#39;);
      iconTd.style.verticalAlign = &#39;top&#39;;

      tr.appendChild(viewTd);
      tr.appendChild(iconTd);
      iconTd.appendChild(iconBlock);

      div.appendChild(table);
    }
  }
  ,
  doImageSearch: function () {
      var imageSearch = new google.search.ImageSearch();
          
      /*
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_MEDIUM);
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
      */

      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGETYPE,
           google.search.ImageSearch.IMAGETYPE_PHOTO);

      imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
          
      imageSearch.setSearchCompleteCallback(this, IT.isComplete, [imageSearch]);
          
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch = 0;
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten = 0;

      switch (document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize) {
        case &#39;N&#39;: break;
        default: break;
        case &#39;S&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_SMALL);
          break;
        case &#39;M&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_MEDIUM);
          break;
        case &#39;L&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_LARGE);
          break;
        case &#39;X&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
          break;
      }
      /*
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
      */

      imageSearch.execute(this.keyword());
  }
  ,
  addWebSite: function (html) {
    var div = document.getElementById(&#39;IT_Bin&#39;);

    div.webSites[div.numWeb++] = html;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  wsComplete: function (ws) {
    if (!ws.results) return;
    if (ws.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_WebListBlock&#39;);
    var results = ws.results;

    var table = document.createElement(&#39;table&#39;);
    contentDiv.appendChild(table);

    var tbody = document.createElement(&#39;tbody&#39;);
    table.appendChild(tbody);
   
    for (var i = 0; i &lt; results.length; i++) {
      var result = results[i];
      
      var tr = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var tdButton = document.createElement(&#39;td&#39;);
      tr.appendChild(tdButton);

      var tdContent = document.createElement(&#39;td&#39;);
      // tdContent.appendChild(result.html.cloneNode(true));
      tr.appendChild(tdContent);
      tdContent.style.border = &#39;1px solid #888&#39;;
      tdContent.style.margin = &#39;1px&#39;;

      var content = document.createElement(&#39;p&#39;);
      var a = document.createElement(&#39;a&#39;);
      a.href = result.unescapedUrl;
      a.target = &#39;_blank&#39;;
      a.appendChild(document.createTextNode(result.titleNoFormatting));
      content.appendChild(a);
      content.appendChild(document.createTextNode(&#39; - &#39; + result.visibleUrl));
      content.appendChild(document.createElement(&#39;br&#39;));
      var span = document.createElement(&#39;span&#39;);
      span.innerHTML = result.content;
      content.appendChild(span);
      tdContent.appendChild(content);
      
      var form = document.createElement(&#39;form&#39;);
      tdButton.appendChild(form);
      
      var p = document.createElement(&#39;p&#39;);
      form.appendChild(p);
      
      var button = document.createElement(&#39;input&#39;);
      button.type = &#39;button&#39;;
      button.value = &#39;web&#39;;
      button.onclick = 
             (function (html) {
                return function () {
                  IT.addWebSite(html.cloneNode(true))
                };
             })(content);
      p.appendChild(button);
    }

    IT.walkAllPage(ws);
  }
  ,
  nsComplete: function (ns) {
    if (!ns.results) return;
    if (ns.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_WebListBlock&#39;);
    var results = ns.results;

    var table = document.createElement(&#39;table&#39;);
    contentDiv.appendChild(table);

    var tbody = document.createElement(&#39;tbody&#39;);
    table.appendChild(tbody);
   
    for (var i = 0; i &lt; results.length; i++) {
      var result = results[i];
      
      var tr = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var tdButton = document.createElement(&#39;td&#39;);
      tr.appendChild(tdButton);

      var tdContent = document.createElement(&#39;td&#39;);
      tr.appendChild(tdContent);
      tdContent.style.border = &#39;1px solid #888&#39;;
      tdContent.style.margin = &#39;1px&#39;;

      var content = document.createElement(&#39;p&#39;);

      if (!(result.image == undefined)) {
        var newsImg = document.createElement(&#39;img&#39;);
        newsImg.src = result.image.url; 
        newsImg.alt = result.titleNoFormatting;
        newsImg.border = &#39;none&#39;;
        newsImg.margin = &#39;0px&#39;
        newsImg.padding = &#39;0px&#39;

        newsImg.onload = 
          (function (img, result) { return function () {
            img.onload = null;

            if (img.width &lt;= 0 || img.height &lt;= 0) return;
            if (img.width &gt; 200) {
              img.width = 200;
              /*var W = 200;
              var H = W * img.height / img.width;
              img.style.width = W + &#39;px&#39;;
              img.style.height = H + &#39;px&#39;;*/
            }

          }})(newsImg);

        var a = document.createElement(&#39;a&#39;);
        a.href = result.image.originalContextUrl;
        a.title = result.titleNoFormatting;
        a.target = &#39;_blank&#39;;
        a.appendChild(newsImg);

        var imgTable = document.createElement(&#39;table&#39;);
        var imgTbody = document.createElement(&#39;tbody&#39;);
        var imgTr = document.createElement(&#39;tr&#39;);
        var imgTd = document.createElement(&#39;td&#39;);
        imgTable.appendChild(imgTbody);
        imgTbody.appendChild(imgTr);
        imgTr.appendChild(imgTd);
        imgTd.appendChild(a);

        imgTable.style.cssFloat = &#39;right&#39;;
        imgTable.style.styleFloat = &#39;right&#39;;
        imgTable.style.border = &#39;1px outset&#39;;
        imgTable.style.margin = &#39;5px&#39;;

        content.appendChild(imgTable);
      }

      var a = document.createElement(&#39;a&#39;);
      a.href = result.unescapedUrl;
      a.target = &#39;_blank&#39;;
      a.appendChild(document.createTextNode(result.titleNoFormatting));
      content.appendChild(a);
      content.appendChild(document.createTextNode(&#39; &#39; + result.publisher + &#39; (&#39; + result.publishedDate + &#39;)&#39;));
      content.appendChild(document.createElement(&#39;br&#39;));
      var span = document.createElement(&#39;span&#39;);
      span.innerHTML = result.content;
      content.appendChild(span);

      var br = document.createElement(&#39;br&#39;);
      br.style.clear = &#39;both&#39;;
      content.appendChild(br);

      tdContent.appendChild(content);
      
      var form = document.createElement(&#39;form&#39;);
      tdButton.appendChild(form);
      
      var p = document.createElement(&#39;p&#39;);
      form.appendChild(p);
      
      var button = document.createElement(&#39;input&#39;);
      button.type = &#39;button&#39;;
      button.value = &#39;news&#39;;
      button.onclick = 
             (function (html) {
                return function () {
                  IT.addWebSite(html.cloneNode(true))
                };
             })(content);
      p.appendChild(button);
    }

    IT.walkAllPage(ns);
  }
  ,
  doWebSearch: function () {
      var webSearch = new google.search.WebSearch();
      webSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
      webSearch.setSearchCompleteCallback(this, IT.wsComplete, [webSearch]);
      document.getElementById(&#39;IT_WebListBlock&#39;).innerHTML = &#39;&#39;;
      webSearch.execute(this.keyword());

      var newsSearch = new google.search.NewsSearch();
      newsSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
      newsSearch.setSearchCompleteCallback(this, IT.nsComplete, [newsSearch]);
      newsSearch.execute(this.keyword());
  }
  ,
  initWebDiv: function () {
    var div = document.getElementById(&#39;IT_WebSearchResults&#39;);

    div.innerHTML = &#39;&#39;;

    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var td = document.createElement(&#39;td&#39;);
    var tdDiv = document.createElement(&#39;div&#39;);
    tdDiv.id = &#39;IT_WebListBlock&#39;;
    tdDiv.style.overflow = &#39;auto&#39;;
    tdDiv.style.height = &#39;250px&#39;;

    div.appendChild(table);
    table.appendChild(tbody);
    tbody.appendChild(tr);
    tr.appendChild(td);
    td.appendChild(tdDiv);
  }
  ,
  mining: function (target1, target2) {
    var imageDiv = document.getElementById(target1);
    var webDiv = document.getElementById(target2);

    if (!imageDiv || !webDiv) return;

    imageDiv.innerHTML = &#39;&#39;;
    webDiv.innerHTML = &#39;&#39;;

    var div =  document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageSearchResults&#39;;
    div.previewMode = &#39;preview&#39;;
    imageDiv.appendChild(div);
    IT.initImageDiv();

    var div =  document.createElement(&#39;div&#39;);
    div.id = &#39;IT_WebSearchResults&#39;;
    div.previewMode = &#39;preview&#39;;
    webDiv.appendChild(div);
    IT.initWebDiv();

    IT.doImageSearch();
    IT.doWebSearch();

  }
  ,
  initBin: function () {
    var bin = document.getElementById(&#39;IT_Bin&#39;);

    bin.numPict = 0;
    bin.numWeb = 0;
    bin.innerHTML = &#39;&#39;;

    IT.updateTextArea();
    IT.buildSelectionBox();

    return false;
  }
  ,
  clickSearch: function () {
    IT.mining(&#39;IT_ImageList&#39;, &#39;IT_WebList&#39;);
    //IT.initBin();

    return false;
  }
  ,
  putLabel: function (parent, place) {
    var label = &#39;&#39;;
    
    switch (place) {
    case 0: label = &#39;ToolTop&#39;;
            break;
    case 1: label = &#39;ImageResults&#39;;
            break;
    case 2: label = &#39;WebResults&#39;;
            break;
    case 3: label = &#39;GeneratedHTML&#39;;
            break;
    }

    var p = document.createElement(&#39;p&#39;);
    parent.appendChild(p);

    var a = document.createElement(&#39;a&#39;);
    a.name = label;
    p.appendChild(a);

    label = &#39;ToolTop&#39;;
    var tn = document.createTextNode(label);
    if (place == 0) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;ImageResults&#39;;
    var tn = document.createTextNode(label);
    if (place == 1) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;WebResults&#39;;
    var tn = document.createTextNode(label);
    if (place == 2) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;GeneratedHTML&#39;;
    var tn = document.createTextNode(label);
    if (place == 3) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

  }
  ,
  begin: function (place) {
    //sL.logger.enable();

    var placeDiv = document.getElementById(place);
    placeDiv.style.border = &#39;1px solid #888&#39;;
    placeDiv.style.padding = &#39;1px&#39;;

    IT.putLabel(placeDiv, 0);
    
    var form = document.createElement(&#39;form&#39;);
    form.style.verticalAlign = &#39;top&#39;;
    form.onsubmit = IT.clickSearch;
    form.id = &#39;IT_InputForm&#39;;
    placeDiv.appendChild(form);

    form.appendChild(document.createTextNode(&#39;Keyword:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;text&#39;;
    input.id = &#39;IT_SearchKey&#39;;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Search&#39;;
    input.onclick = IT.clickSearch;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Clear Keyword&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_SearchKey&#39;).value = &#39;&#39;;
      document.getElementById(&#39;IT_SearchKey&#39;).focus();
    };
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Clear Bin&#39;;
    input.onclick = function () {
      IT.initBin();
    };
    form.appendChild(input);

    //placeDiv.appendChild(document.createElement(&#39;br&#39;));

    var form = document.createElement(&#39;form&#39;);
    form.style.verticalAlign = &#39;top&#39;;
    form.onsubmit = IT.clickSearch;
    placeDiv.appendChild(form);

    form.appendChild(document.createTextNode(&#39;Direct URL:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;text&#39;;
    input.id = &#39;IT_DirectURL&#39;;
    input.onchange = 
       (function () {
          return function () {
            var img = document.createElement(&#39;img&#39;);
            img.style.border = &#39;1px sloid #888&#39;;
            img.style.margin = &#39;1px&#39;;
            img.style.padding = &#39;1px&#39;;

            var pv = document.getElementById(&#39;IT_DirecdtURLPreview&#39;);
            pv.innerHTML = &#39;&#39;;
            pv.appendChild(img);
            img.src = document.getElementById(&#39;IT_DirectURL&#39;).value;
            img.width = 450;
          };
       })();
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;); // dummy button
    input.type = &#39;button&#39;;
    input.value = &#39;View&#39;;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Add&#39;;
    input.onclick = 
       (function () {
          return function () {
            var imgUrl = document.getElementById(&#39;IT_DirectURL&#39;).value;
            var dummyImg = document.createElement(&#39;img&#39;);
            dummyImg.src = imgUrl;
            IT.addPict(
              {
                url: imgUrl,
                titleNoFormatting: imgUrl,
                width: dummyImg.width,
                height: dummyImg.height
              }
            );
          };
       })();
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Clear&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_DirecdtURLPreview&#39;).innerHTML = &#39;&#39;;
      document.getElementById(&#39;IT_DirectURL&#39;).value = &#39;&#39;;
      document.getElementById(&#39;IT_DirectURL&#39;).focus();
    };
    form.appendChild(input);

    var span = document.createElement(&#39;span&#39;);
    span.id = &#39;IT_DirecdtURLPreview&#39;;
    form.appendChild(span);

    IT.putLabel(placeDiv, 1);

    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var td = document.createElement(&#39;td&#39;);
    placeDiv.appendChild(td);

    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageSelectList&#39;;
    div.style.border = &#39;none&#39;;
    td.appendChild(div);

    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageList&#39;;
    div.style.border = &#39;1px solid #888&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    placeDiv.appendChild(div);

    IT.putLabel(placeDiv, 2);
    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_WebList&#39;;
    div.style.border = &#39;1px solid #888&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    placeDiv.appendChild(div);
    
    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_Bin&#39;
    div.style.border = &#39;1px solid #888&#39;;
    div.picts = new Array;
    div.numPict = 0;
    div.webSites = new Array;
    div.numWeb = 0;
    placeDiv.appendChild(div);

    IT.putLabel(placeDiv, 3);

    var gentext = document.createElement(&#39;div&#39;);
    var form = document.createElement(&#39;form&#39;);
    gentext.appendChild(form);

    var form = document.createElement(&#39;form&#39;);
    placeDiv.appendChild(form);

    var p = document.createElement(&#39;p&#39;);
    form.appendChild(p);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Select&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_GeneratedText&#39;).select();
    };
    p.appendChild(input);

    p.appendChild(document.createElement(&#39;br&#39;));

    var textArea = document.createElement(&#39;textarea&#39;);
    textArea.rows = 20;
    textArea.cols = 60;
    textArea.id = &#39;IT_GeneratedText&#39;;
    p.appendChild(textArea);

    IT.initBin();
  }
};

//--&gt;
&lt;/script&gt;

&lt;!--&lt;div style=&quot;height:200px;overflow:auto;&quot; id=&quot;slLogArea&quot;&gt;log area&lt;/div&gt;--&gt;

&lt;div id=&quot;tool-pane&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
    IT.begin(&#39;tool-pane&#39;);
//--&gt;
&lt;/script&gt;
&lt;noscript&gt;Sorry, you have to enable javascript.&lt;/noscript&gt;

&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/1305962041207733171/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/05/ver17.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/1305962041207733171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/1305962041207733171'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/05/ver17.html' title='サムネイル・プレビュー作成ツール ver.1.7'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-2020320270112579395</id><published>2010-05-19T08:38:00.001+09:00</published><updated>2010-05-19T08:38:28.569+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="実験"/><title type='text'>HTML生成結果テスト</title><content type='html'>&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;vertical-align: top; &quot;&gt;&lt;img style=&quot;float: left; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(136, 136, 136); border-bottom-color: rgb(136, 136, 136); border-left-color: rgb(136, 136, 136); margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; &quot; width=&quot;450&quot; id=&quot;id_1274225871599&quot; alt=&quot;矢口真里 1274225871599&quot; src=&quot;http://f.hatena.ne.jp/images/fotolife/i/idol100/20070818/20070818011902.jpg&quot;&gt;&lt;/td&gt;&lt;td style=&quot;vertical-align: top; &quot;&gt;&lt;div style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; &quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://image.space.rakuten.co.jp/lg01/18/0001060418/80/imgacb31a61zikbzj.jpeg&quot; title=&quot;矢口真里 1274225871599&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1274225871599&#39;).src=&#39;http://image.space.rakuten.co.jp/lg01/18/0001060418/80/imgacb31a61zikbzj.jpeg&#39;;document.getElementById(&#39;id_1274225871599&#39;).height=&#39;579&#39;;return false;&quot; alt=&quot;矢口真里 1274225871599&quot; src=&quot;http://image.space.rakuten.co.jp/lg01/18/0001060418/80/imgacb31a61zikbzj.jpeg&quot;&gt;&lt;/a&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://thumbnail.image.rakuten.co.jp/%400_mall/book/cabinet/0878/08780470.jpg&quot; title=&quot;矢口真里 1274225871599&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1274225871599&#39;).src=&#39;http://thumbnail.image.rakuten.co.jp/%400_mall/book/cabinet/0878/08780470.jpg&#39;;document.getElementById(&#39;id_1274225871599&#39;).height=&#39;648&#39;;return false;&quot; alt=&quot;矢口真里 1274225871599&quot; src=&quot;http://thumbnail.image.rakuten.co.jp/%400_mall/book/cabinet/0878/08780470.jpg&quot;&gt;&lt;/a&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://f.hatena.ne.jp/images/fotolife/i/idol100/20070818/20070818011902.jpg&quot; title=&quot;矢口真里 1274225871600&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1274225871599&#39;).src=&#39;http://f.hatena.ne.jp/images/fotolife/i/idol100/20070818/20070818011902.jpg&#39;;document.getElementById(&#39;id_1274225871599&#39;).height=&#39;600&#39;;return false;&quot; alt=&quot;矢口真里 1274225871600&quot; src=&quot;http://f.hatena.ne.jp/images/fotolife/i/idol100/20070818/20070818011902.jpg&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div id=&quot;WebSearchBlock&quot;&gt;&lt;p&gt;&lt;table style=&quot;float: right; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: outset; border-right-style: outset; border-bottom-style: outset; border-left-style: outset; border-color: initial; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; &quot;&gt;&lt;tbody&gt;&lt;imgtr&gt;&lt;td&gt;&lt;a href=&quot;http://www.cinematoday.jp/page/N0024195&quot; title=&quot;矢口真里がアンタッチャブル山崎の言い訳にツッコミ連発！「プライベートでは毎日一緒にはいられないですね」&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://s.cinematoday.jp/res/N0/02/41/N0024195.jpg&quot; alt=&quot;矢口真里がアンタッチャブル山崎の言い訳にツッコミ連発！「プライベートでは毎日一緒にはいられないですね」&quot; border=&quot;none&quot;&gt;&lt;/a&gt;&lt;/td&gt;&lt;/imgtr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;a href=&quot;http://www.cinematoday.jp/page/N0024195&quot; target=&quot;_blank&quot;&gt;矢口真里がアンタッチャブル山崎の言い訳にツッコミ連発！「プライベートでは毎日一緒にはいられないですね」&lt;/a&gt; シネマトゥデイ (Thu, 06 May 2010 06:19:31 -0700)&lt;br&gt;&lt;span&gt;&lt;b&gt;矢口真里&lt;/b&gt; - (C)2010東北新社 原作：伊藤洋介（avex management inc.）／幻冬舎文庫 [シネマトゥデイ映画ニュース] アンタッチャブル山崎弘也と歌手・タレントの&lt;b&gt;矢口真里&lt;/b&gt;が出演するサラリーマン必須の大ヒット世渡り指南書を映像化したショートドラマ・ &lt;b&gt;...&lt;/b&gt;&lt;/span&gt;&lt;br style=&quot;clear: both; &quot;&gt;&lt;/p&gt;&lt;p&gt;&lt;table style=&quot;float: right; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: outset; border-right-style: outset; border-bottom-style: outset; border-left-style: outset; border-color: initial; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; &quot;&gt;&lt;tbody&gt;&lt;imgtr&gt;&lt;td&gt;&lt;a href=&quot;http://woman.infoseek.co.jp/news/entertainment/story.html?q=28fujizak20100428023&quot; title=&quot;元モー娘・矢口真里が“しゃぶしゃぶの未来”も変えようとしている！&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://news.www.infoseek.co.jp/img/photos/fuji/zak20100428023view-small.jpg&quot; alt=&quot;元モー娘・矢口真里が“しゃぶしゃぶの未来”も変えようとしている！&quot; border=&quot;none&quot; width=&quot;200&quot;&gt;&lt;/a&gt;&lt;/td&gt;&lt;/imgtr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;a href=&quot;http://woman.infoseek.co.jp/news/entertainment/story.html?q=28fujizak20100428023&quot; target=&quot;_blank&quot;&gt;元モー娘・矢口真里が“しゃぶしゃぶの未来”も変えようとしている！&lt;/a&gt; インフォシーク (Wed, 28 Apr 2010 01:14:14 -0700)&lt;br&gt;&lt;span&gt;日本の未来はＷＯＷ×４～♪と歌っていた元モーニング娘のメンバー&lt;b&gt;矢口真里&lt;/b&gt;が、“しゃぶしゃぶの未来”も変えようとしている！ 全国に店舗展開をしている「しゃぶしゃぶ温野菜」の六本木店は、矢口がメニューからインテリアまでをプロデュース。 &lt;b&gt;...&lt;/b&gt;&lt;/span&gt;&lt;br style=&quot;clear: both; &quot;&gt;&lt;/p&gt;&lt;p&gt;&lt;table style=&quot;float: right; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: outset; border-right-style: outset; border-bottom-style: outset; border-left-style: outset; border-color: initial; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; &quot;&gt;&lt;tbody&gt;&lt;imgtr&gt;&lt;td&gt;&lt;a href=&quot;http://www.j-cast.com/mono/2010/04/30065640.html&quot; title=&quot;人気モデル愛用おしゃれアイテム チャリティーフリマに出品&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://www.j-cast.com/mono/images/2010/mono65640_pho01.jpg&quot; alt=&quot;人気モデル愛用おしゃれアイテム チャリティーフリマに出品&quot; border=&quot;none&quot; width=&quot;200&quot;&gt;&lt;/a&gt;&lt;/td&gt;&lt;/imgtr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;a href=&quot;http://www.j-cast.com/mono/2010/04/30065640.html&quot; target=&quot;_blank&quot;&gt;人気モデル愛用おしゃれアイテム チャリティーフリマに出品&lt;/a&gt; J-CASTニュース (Thu, 29 Apr 2010 19:22:14 -0700)&lt;br&gt;&lt;span&gt;タレントの&lt;b&gt;矢口真里&lt;/b&gt;さんやテレビ番組プロデューサー・おちまさとさんの妻でファッションモデルの越智千恵子さんといった、有名人やスタイリストたちの私物が出品される。レアな1点モノからオシャレ心をくすぐるアイテムまで幅広く扱っていくという。 &lt;b&gt;...&lt;/b&gt;&lt;/span&gt;&lt;br style=&quot;clear: both; &quot;&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/2020320270112579395/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/05/html_19.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/2020320270112579395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/2020320270112579395'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/05/html_19.html' title='HTML生成結果テスト'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-3089100384817942946</id><published>2010-05-18T00:31:00.001+09:00</published><updated>2010-05-18T00:31:48.504+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="テスト"/><title type='text'>HTML生成結果テスト</title><content type='html'>&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;vertical-align: top; &quot;&gt;&lt;img style=&quot;float: left; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(136, 136, 136); border-bottom-color: rgb(136, 136, 136); border-left-color: rgb(136, 136, 136); margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; &quot; width=&quot;450&quot; id=&quot;id_1274110271287&quot; alt=&quot;真野恵里菜 1274110271287&quot; src=&quot;http://image.blog.livedoor.jp/sakuramakoto/imgs/7/5/751a300c.jpg&quot;&gt;&lt;/td&gt;&lt;td style=&quot;vertical-align: top; &quot;&gt;&lt;div style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; &quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.yassite.com/musume/prof/data/ManoErina.jpg&quot; title=&quot;真野恵里菜 1274110271287&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1274110271287&#39;).src=&#39;http://www.yassite.com/musume/prof/data/ManoErina.jpg&#39;;document.getElementById(&#39;id_1274110271287&#39;).height=&#39;675&#39;;return false;&quot; alt=&quot;真野恵里菜 1274110271287&quot; src=&quot;http://www.yassite.com/musume/prof/data/ManoErina.jpg&quot;&gt;&lt;/a&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://natalie.mu/media/0812/1203/extra/news_large_manoerina081203.jpg&quot; title=&quot;真野恵里菜 1274110271288&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1274110271287&#39;).src=&#39;http://natalie.mu/media/0812/1203/extra/news_large_manoerina081203.jpg&#39;;document.getElementById(&#39;id_1274110271287&#39;).height=&#39;644&#39;;return false;&quot; alt=&quot;真野恵里菜 1274110271287&quot; src=&quot;http://natalie.mu/media/0812/1203/extra/news_large_manoerina081203.jpg&quot;&gt;&lt;/a&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://image.blog.livedoor.jp/sakuramakoto/imgs/7/5/751a300c.jpg&quot; title=&quot;真野恵里菜 1274110271288&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1274110271287&#39;).src=&#39;http://image.blog.livedoor.jp/sakuramakoto/imgs/7/5/751a300c.jpg&#39;;document.getElementById(&#39;id_1274110271287&#39;).height=&#39;600&#39;;return false;&quot; alt=&quot;真野恵里菜 1274110271288&quot; src=&quot;http://image.blog.livedoor.jp/sakuramakoto/imgs/7/5/751a300c.jpg&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div id=&quot;WebSearchBlock&quot;&gt;&lt;p&gt;&lt;table style=&quot;float: right; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: outset; border-right-style: outset; border-bottom-style: outset; border-left-style: outset; border-color: initial; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; &quot;&gt;&lt;tbody&gt;&lt;imgtr&gt;&lt;td&gt;&lt;a href=&quot;http://mainichi.jp/enta/cinema/news/20100507mog00m200006000c.html&quot; title=&quot;真野恵里菜：「怪談新耳袋 怪奇」で映画デビュー 主題歌も担当 アメリカで先行上映&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://mainichi.jp/enta/cinema/news/images/20100507mog00m200005000p_size5.jpg&quot; alt=&quot;真野恵里菜：「怪談新耳袋 怪奇」で映画デビュー 主題歌も担当 アメリカで先行上映&quot; border=&quot;none&quot;&gt;&lt;/a&gt;&lt;/td&gt;&lt;/imgtr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;a href=&quot;http://mainichi.jp/enta/cinema/news/20100507mog00m200006000c.html&quot; target=&quot;_blank&quot;&gt;真野恵里菜：「怪談新耳袋 怪奇」で映画デビュー 主題歌も担当 アメリカで先行上映&lt;/a&gt; 毎日新聞 (Sun, 09 May 2010 16:06:40 -0700)&lt;br&gt;&lt;span&gt;プロジェクト」所属のアイドル、&lt;b&gt;真野恵里菜&lt;/b&gt;さん（１９）が、本格ホラー「怪談新耳袋 怪奇」（篠崎誠監督）で映画初主演を務めることが明らかになった。０３年からＢＳ－ＴＢＳ（旧ＢＳ－ｉ）で放送されていた人気ホラーシリーズの劇場版で、今回は「ツキモノ」 &lt;b&gt;...&lt;/b&gt;&lt;/span&gt;&lt;br style=&quot;clear: both; &quot;&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/3089100384817942946/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/05/html_18.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/3089100384817942946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/3089100384817942946'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/05/html_18.html' title='HTML生成結果テスト'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-8832345075421667796</id><published>2010-05-17T06:38:00.016+09:00</published><updated>2010-05-24T23:18:39.963+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ツール"/><title type='text'>サムネイル・プレビュー作成ツール ver.1.6</title><content type='html'>&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;http://sharri.web.fc2.com/JSlab/SL.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
google.load(&#39;search&#39;, &#39;1&#39;);
//--&gt;
&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
var IT = {
  keyword: function() {
    return document.getElementById(&#39;IT_SearchKey&#39;).value;
  }
  ,
  walkAllPage: function (s) {
    var cursor = s.cursor;
    var next = cursor.currentPageIndex + 1;
    if (next &gt;= cursor.pages.length) return;
    s.gotoPage(next);
  }
  ,
  buildIcon: function (url, alt, width, height) {
       var newImg = document.createElement(&#39;img&#39;);
       newImg.alt           = alt;
       newImg.src           = url;
       newImg.height        = height;
       newImg.width         = width;
       newImg.style.margin  = &#39;1px&#39;;
       newImg.style.padding = &#39;1px&#39;;
       newImg.style.border  = &#39;1px solid #888&#39;;
       return newImg;
  }
  ,
  viewResult: function (result) {

    var imgUrl = result.url;
    var srcUrl = result.originalContextUrl;
    var width = result.width;
    var height = result.height;
    var content = result.titleNoFormatting;

    var aSrc = document.getElementById(&#39;IT_ImageSrcLink&#39;);
    var aImg = document.getElementById(&#39;IT_ImageLink&#39;);
    var d = document.getElementById(&#39;IT_ImageDescription&#39;);

    if (aImg == null || aSrc == null || d == null) return;

    d.innerHTML = &#39;&#39;;
    d.appendChild(document.createTextNode(content));
    d.appendChild(document.createElement(&#39;br&#39;));
    d.appendChild(document.createTextNode(&#39;img = &#39; + imgUrl));
    d.appendChild(document.createElement(&#39;br&#39;));
    d.appendChild(document.createTextNode(&#39;src = &#39; + srcUrl));
    d.appendChild(document.createElement(&#39;br&#39;));

    var img = document.createElement(&#39;img&#39;);
    img.style.border = &#39;none&#39;;

    aSrc.href = srcUrl;

    img.alt = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
    img.src = imgUrl;

    var aW = width;
    var aH = height;

    img.width = 450;

    aImg.innerHTML = &#39;&#39;;
    aImg.href = imgUrl;
    aImg.title = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
    aImg.appendChild(img);

  }
  ,
  buildIconHtml: function (result, uid) {
    var viewScript =
       &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).src=&#39;&quot; + result.url +&quot;&#39;;&quot;
       + &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).height=&#39;&quot; + Math.floor(result.height * 450 / result.width) +&quot;&#39;;&quot;
        + &#39;return false;&#39;;

    var img = &#39;&lt;img &#39;
       + &#39; height=&quot;100&quot; &#39;
        + &#39; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot;&#39;
        + &#39; onmouseover=&quot;&#39; + viewScript + &#39;&quot;&#39;
        + &#39; alt=&quot;&#39; + this.keyword() + &#39; &#39; + (new Date).getTime()
           + &#39;&quot;&#39;
        + &#39; src=&quot;&#39; + result.url + &#39;&quot;&#39;
                      + &#39; /&gt;&#39;;
    var a = &#39;&lt;a&#39;
            + &#39; target=&quot;_blank&quot;&#39;
            + &#39; href=&quot;&#39; + result.url + &#39;&quot;&#39;
            + &#39; title=&quot;&#39; + this.keyword() + &#39; &#39; + (new Date).getTime()
               + &#39;&quot;&#39;
            + &#39; &gt;&#39;
            + img
            + &#39;&lt;/a&gt;&#39;;

    return a;
  }
  ,
  buildEraseIcon: function(picts, index) {
    var eraseIcon = sL.image.buildSquareLink(
                      70, 
                      &#39;javascript:void(0);&#39;,
                      picts[index].url,
                      picts[index].titleNoFormatting
                    );
    eraseIcon.style.cssFloat = &#39;left&#39;;
    eraseIcon.style.styleFloat = &#39;left&#39;;
    eraseIcon.style.border = &#39;1px outset&#39;;
    eraseIcon.style.margin = &#39;1px&#39;;
    eraseIcon.style.padding = &#39;1px&#39;;
    eraseIcon.onclick = (function (i) { return function () {
                            IT.removePict(i);
                        };})(index);
    return eraseIcon;
  }
  ,
  buildSelectionBox: function() {
    var bin = document.getElementById(&#39;IT_Bin&#39;);
    var sbox = document.getElementById(&#39;IT_ImageSelectList&#39;);
    sbox.innerHTML = &#39;&#39;;
    for (var i = 0; i &lt; bin.numPict; ++i) {
      if (!bin.picts[i]) continue;
      sbox.appendChild(this.buildEraseIcon(bin.picts, i));
    }
  }
  ,
  buildBin: function () {
    var bin = document.getElementById(&#39;IT_Bin&#39;);
    var uid = &#39;id_&#39;+ (new Date).getTime();

    bin.innerHTML = &#39;&#39;;
    
    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var tdView = document.createElement(&#39;td&#39;);
    var tdIcon = document.createElement(&#39;td&#39;);

    bin.appendChild(table);
    table.appendChild(tbody);
    tbody.appendChild(tr);
    tr.appendChild(tdView);
    tr.appendChild(tdIcon);

    tdIcon.style.verticalAlign = &#39;top&#39;;
    tdView.style.verticalAlign = &#39;top&#39;;

    var img = document.createElement(&#39;img&#39;);
    img.style.cssFloat = &#39;left&#39;;
    img.style.styleFloat = &#39;left&#39;;
    img.style.border = &#39;1px solid #888&#39;;
    img.style.margin = &#39;1px&#39;;
    img.style.padding = &#39;1px&#39;;
    img.width = 450;
    img.id = uid;
    img.alt = this.keyword() + &#39; &#39; + (new Date).getTime();

    if (bin.numPict &gt; 0) {
      for (i = bin.numPict; i &gt; 0; --i) {
        if (!bin.picts[i - 1]) continue;
        img.src = bin.picts[i - 1].url;
        break;
      }
    }
    tdView.appendChild(img);

    var div = document.createElement(&#39;div&#39;);
    div.style.border = &#39;none&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    tdIcon.appendChild(div);
    
    for (var i = 0; i &lt; bin.numPict; ++i) {
      if (!bin.picts[i]) continue;
      div.innerHTML += IT.buildIconHtml(bin.picts[i], uid);
    }

    IT.buildSelectionBox();

    var wsBlock = document.createElement(&#39;div&#39;);
    wsBlock.id = &#39;WebSearchBlock&#39;;
    bin.appendChild(wsBlock);

    for (var i = 0; i &lt; bin.numWeb; ++i) {
      wsBlock.appendChild(bin.webSites[i]);
    }
  }
  ,
  updateTextArea: function () {
    var text = document.getElementById(&#39;IT_GeneratedText&#39;);
    text.innerHTML = &#39;&#39;;
    text.appendChild(
       document.createTextNode(
         document.getElementById(&#39;IT_Bin&#39;).innerHTML));
  }
  ,
  removePict: function (i) {
    var div = document.getElementById(&#39;IT_Bin&#39;);
    if (!(i &lt; div.numPict)) return;
    div.picts[i] = null;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  addPict: function (result) {
    var div = document.getElementById(&#39;IT_Bin&#39;);
    div.picts[div.numPict++] = result;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  showImageState: function () {
    document.getElementById(&#39;IT_ImageStateInfo&#39;).innerHTML = 
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten
      + &#39;/&#39; +
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch
    ;
  }
  ,
  isComplete: function (is) {
    if (!is.results) return;
    if (is.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_ImageIconBlock&#39;);

    var results = is.results;

    document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch += results.length;
    IT.showImageState();

    if (contentDiv.previewMode == &#39;all&#39;) {
      for (var i = 0; i &lt; results.length; i++) {
        var result = results[i];

        var img = document.createElement(&#39;img&#39;);
        img.onload = (function (img, result) { return function () {
          img.onload = null;

          if (img.width != result.width || img.height != result.height) {
            sL.logger.log(&#39;drop:&#39; + result.url + &#39; w:&#39; + img.width + &#39;/&#39; + result.width + &#39; h:&#39; + img.height + &#39;/&#39; + result.height);
            return;
          }

          img.alt = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;

          document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten += 1;
          IT.showImageState();
          var link =  document.createElement(&#39;a&#39;);
          link.title   = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;
          link.href    = &#39;javascript:void(0);&#39;;
          link.onclick = (function (result) { return function () {
                   IT.addPict(result)
          };})(result);

          var h = 120;
          var w = (result.tbWidth * h) / result.tbHeight;
          link.appendChild(IT.buildIcon(result.tbUrl, result.visibleUrl, w, h));
          document.getElementById(&#39;IT_ImageIconBlock&#39;).appendChild(link);

        }})(img, result);
        img.src = result.url;
      }
    } else {
      for (var i = 0; i &lt; results.length; i++) {
        var result = results[i];

        var img = document.createElement(&#39;img&#39;);
        img.onload = (function (img, result) { return function () {
          img.onload = null;

          if (img.width != result.width || img.height != result.height) {
            sL.logger.log(&#39;drop:&#39; + result.url + &#39; w:&#39; + img.width + &#39;/&#39; + result.width + &#39; h:&#39; + img.height + &#39;/&#39; + result.height);
            return;
          }

          img.alt = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;

          document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten += 1;
          IT.showImageState();
          var link =  document.createElement(&#39;a&#39;);
          link.title   = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;
          link.href    = &#39;javascript:void(0);&#39;;
          link.onclick = (function (result) { return function () {
                   IT.addPict(result)
          };})(result);
          link.onmouseover = (function (result) { return function () {
                  IT.viewResult(result)
          };})(result);
          link.onfocus = (function (result) { return function () {
                  IT.viewResult(result)
          };})(result);

          var w = 80;
          var h = (result.tbHeight * w) / result.tbWidth;
          link.appendChild(IT.buildIcon(result.tbUrl, result.visibleUrl, w, h));
          document.getElementById(&#39;IT_ImageIconBlock&#39;).appendChild(link);

        }})(img, result);
        img.src = result.url;
      }
    }

    IT.walkAllPage(is);
  }
  ,
  switchImageView: function (mode) {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);
    div.previewMode = mode;
    IT.initImageDiv();
    IT.doImageSearch();
  }
  ,
  switchImageSize: function (size) {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);
    div.imageSize = size;
    IT.initImageDiv();
    IT.doImageSearch();
  }
  ,
  initImageDiv: function () {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);

    div.innerHTML = &#39;&#39;;

    var child = document.createElement(&#39;a&#39;);
    child.name = &#39;images&#39;;
    div.appendChild(child);

    var head = document.createElement(&#39;p&#39;);
    head.appendChild(document.createTextNode(&#39;[&#39; + this.keyword() + &#39;]&#39;));

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    var span = document.createElement(&#39;span&#39;);
    span.id = &#39;IT_ImageStateInfo&#39;;
    head.appendChild(span);

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    var a = document.createElement(&#39;a&#39;);
    a.href = &#39;javascript:void(0);&#39;;
    a.onclick = IT.initBin;
    a.appendChild(document.createTextNode(&#39;Clear&#39;));
    head.appendChild(a);

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    head.appendChild(document.createElement(&#39;br&#39;));

    head.appendChild(document.createTextNode(&#39;View:&#39;));
    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Mode&#39;;
    input.value = &#39;all&#39;;
    input.checked = (div.previewMode == &#39;all&#39;);
    input.onclick = (function (mode) { return function () {
                        IT.switchImageView(mode);
                    };})(&#39;all&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Thumbnail &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Mode&#39;;
    input.value = &#39;preview&#39;;
    input.checked = (div.previewMode != &#39;all&#39;);
    input.onclick = (function (mode) { return function () {
                        IT.switchImageView(mode);
                    };})(&#39;preview&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Preview &#39;));

    head.appendChild(document.createElement(&#39;br&#39;));

    head.appendChild(document.createTextNode(&#39;Size:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;None&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == undefined ||
                    document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;N&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;N&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;None &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Small&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;S&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;S&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Small &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Medium&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;M&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;M&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Medium &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Large&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;L&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;L&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Large &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;ExtraLarge&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;X&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;X&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Extra Large &#39;));

    div.appendChild(head);

    div.style.margin  = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;

    var iconBlock = document.getElementById(&#39;IT_ImageIconBlock&#39;);
    if (iconBlock == null) {
       iconBlock = document.createElement(&#39;div&#39;);
       iconBlock.id = &#39;IT_ImageIconBlock&#39;;
    }

    iconBlock.previewMode = div.previewMode;

    if (iconBlock.previewMode == &#39;all&#39;) {
      iconBlock.style.width    = &#39;auto&#39;;
      iconBlock.style.height   = &#39;auto&#39;;
      iconBlock.style.overflow = &#39;visible&#39;;
      div.appendChild(iconBlock);
    } else {
      iconBlock.style.width    = &#39;100px&#39;;
      iconBlock.style.height   = &#39;550px&#39;;
      iconBlock.style.overflow = &#39;auto&#39;;

      var imgA = document.getElementById(&#39;IT_ImageLink&#39;);
      if (imgA == null) {
        imgA        = document.createElement(&#39;a&#39;);
        imgA.id     = &#39;IT_ImageLink&#39;;
        imgA.target = &#39;_blank&#39;;
      }

      var orgA = document.getElementById(&#39;IT_ImageSrcLink&#39;);
      if (orgA == null) {
        orgA = document.createElement(&#39;a&#39;);
        orgA.id        = &#39;IT_ImageSrcLink&#39;;
        orgA.target    = &#39;_blank&#39;;
        orgA.innerHTML = &#39;[original site]&#39;;
      }

      var descDiv = document.getElementById(&#39;IT_ImageDescription&#39;);
      if (descDiv == null) {
        descDiv = document.createElement(&#39;div&#39;);
        descDiv.id = &#39;IT_ImageDescription&#39;;
      }

      var table  = document.createElement(&#39;table&#39;);
      table.style.border = &#39;none&#39;;

      var tbody = document.createElement(&#39;tbody&#39;);
      table.style.border = &#39;none&#39;;
      table.appendChild(tbody);

      var tr     = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var viewTd = document.createElement(&#39;td&#39;);
      viewTd.style.textAlign = &#39;center&#39;;

      var viewDiv = document.createElement(&#39;div&#39;);
      viewDiv.style.width = &#39;500px&#39;;
      //viewDiv.style.height = &#39;450px&#39;;
      viewDiv.style.overflow = &#39;auto&#39;;
      viewTd.appendChild(viewDiv);
      viewTd.style.verticalAlign = &#39;top&#39;;

      var br = document.createElement(&#39;div&#39;);
      br.style.clear = &#39;both&#39;;

      viewDiv.appendChild(imgA);
      viewDiv.appendChild(br);
      viewDiv.appendChild(orgA);
      viewDiv.appendChild(descDiv);

      var iconTd = document.createElement(&#39;td&#39;);
      iconTd.style.verticalAlign = &#39;top&#39;;

      tr.appendChild(viewTd);
      tr.appendChild(iconTd);
      iconTd.appendChild(iconBlock);

      div.appendChild(table);
    }
  }
  ,
  doImageSearch: function () {
      var imageSearch = new google.search.ImageSearch();
          
      /*
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_MEDIUM);
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
      */

      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGETYPE,
           google.search.ImageSearch.IMAGETYPE_PHOTO);

      imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
          
      imageSearch.setSearchCompleteCallback(this, IT.isComplete, [imageSearch]);
          
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch = 0;
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten = 0;

      switch (document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize) {
        case &#39;N&#39;: break;
        default: break;
        case &#39;S&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_SMALL);
          break;
        case &#39;M&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_MEDIUM);
          break;
        case &#39;L&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_LARGE);
          break;
        case &#39;X&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
          break;
      }
      /*
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
      */

      imageSearch.execute(this.keyword());
  }
  ,
  addWebSite: function (html) {
    var div = document.getElementById(&#39;IT_Bin&#39;);

    div.webSites[div.numWeb++] = html;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  wsComplete: function (ws) {
    if (!ws.results) return;
    if (ws.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_WebListBlock&#39;);
    var results = ws.results;

    var table = document.createElement(&#39;table&#39;);
    contentDiv.appendChild(table);

    var tbody = document.createElement(&#39;tbody&#39;);
    table.appendChild(tbody);
   
    for (var i = 0; i &lt; results.length; i++) {
      var result = results[i];
      
      var tr = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var tdButton = document.createElement(&#39;td&#39;);
      tr.appendChild(tdButton);

      var tdContent = document.createElement(&#39;td&#39;);
      // tdContent.appendChild(result.html.cloneNode(true));
      tr.appendChild(tdContent);
      tdContent.style.border = &#39;1px solid #888&#39;;
      tdContent.style.margin = &#39;1px&#39;;

      var content = document.createElement(&#39;p&#39;);
      var a = document.createElement(&#39;a&#39;);
      a.href = result.unescapedUrl;
      a.target = &#39;_blank&#39;;
      a.appendChild(document.createTextNode(result.titleNoFormatting));
      content.appendChild(a);
      content.appendChild(document.createTextNode(&#39; - &#39; + result.visibleUrl));
      content.appendChild(document.createElement(&#39;br&#39;));
      var span = document.createElement(&#39;span&#39;);
      span.innerHTML = result.content;
      content.appendChild(span);
      tdContent.appendChild(content);
      
      var form = document.createElement(&#39;form&#39;);
      tdButton.appendChild(form);
      
      var p = document.createElement(&#39;p&#39;);
      form.appendChild(p);
      
      var button = document.createElement(&#39;input&#39;);
      button.type = &#39;button&#39;;
      button.value = &#39;web&#39;;
      button.onclick = 
             (function (html) {
                return function () {
                  IT.addWebSite(html.cloneNode(true))
                };
             })(content);
      p.appendChild(button);
    }

    IT.walkAllPage(ws);
  }
  ,
  nsComplete: function (ns) {
    if (!ns.results) return;
    if (ns.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_WebListBlock&#39;);
    var results = ns.results;

    var table = document.createElement(&#39;table&#39;);
    contentDiv.appendChild(table);

    var tbody = document.createElement(&#39;tbody&#39;);
    table.appendChild(tbody);
   
    for (var i = 0; i &lt; results.length; i++) {
      var result = results[i];
      
      var tr = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var tdButton = document.createElement(&#39;td&#39;);
      tr.appendChild(tdButton);

      var tdContent = document.createElement(&#39;td&#39;);
      tr.appendChild(tdContent);
      tdContent.style.border = &#39;1px solid #888&#39;;
      tdContent.style.margin = &#39;1px&#39;;

      var content = document.createElement(&#39;p&#39;);

      if (!(result.image == undefined)) {
        var newsImg = document.createElement(&#39;img&#39;);
        newsImg.src = result.image.url; 
        newsImg.alt = result.titleNoFormatting;
        newsImg.border = &#39;none&#39;;
        newsImg.margin = &#39;0px&#39;
        newsImg.padding = &#39;0px&#39;

        newsImg.onload = 
          (function (img, result) { return function () {
            img.onload = null;

            if (img.width &lt;= 0 || img.height &lt;= 0) return;
            if (img.width &gt; 200) {
              img.width = 200;
              /*var W = 200;
              var H = W * img.height / img.width;
              img.style.width = W + &#39;px&#39;;
              img.style.height = H + &#39;px&#39;;*/
            }

          }})(newsImg);

        var a = document.createElement(&#39;a&#39;);
        a.href = result.image.originalContextUrl;
        a.title = result.titleNoFormatting;
        a.target = &#39;_blank&#39;;
        a.appendChild(newsImg);

        var imgTable = document.createElement(&#39;table&#39;);
        var imgTbody = document.createElement(&#39;tbody&#39;);
        var imgTr = document.createElement(&#39;tr&#39;);
        var imgTd = document.createElement(&#39;td&#39;);
        imgTable.appendChild(imgTbody);
        imgTbody.appendChild(imgTr);
        imgTr.appendChild(imgTd);
        imgTd.appendChild(a);

        imgTable.style.cssFloat = &#39;right&#39;;
        imgTable.style.styleFloat = &#39;right&#39;;
        imgTable.style.border = &#39;1px outset&#39;;
        imgTable.style.margin = &#39;5px&#39;;

        content.appendChild(imgTable);
      }

      var a = document.createElement(&#39;a&#39;);
      a.href = result.unescapedUrl;
      a.target = &#39;_blank&#39;;
      a.appendChild(document.createTextNode(result.titleNoFormatting));
      content.appendChild(a);
      content.appendChild(document.createTextNode(&#39; &#39; + result.publisher + &#39; (&#39; + result.publishedDate + &#39;)&#39;));
      content.appendChild(document.createElement(&#39;br&#39;));
      var span = document.createElement(&#39;span&#39;);
      span.innerHTML = result.content;
      content.appendChild(span);

      var br = document.createElement(&#39;br&#39;);
      br.style.clear = &#39;both&#39;;
      content.appendChild(br);

      tdContent.appendChild(content);
      
      var form = document.createElement(&#39;form&#39;);
      tdButton.appendChild(form);
      
      var p = document.createElement(&#39;p&#39;);
      form.appendChild(p);
      
      var button = document.createElement(&#39;input&#39;);
      button.type = &#39;button&#39;;
      button.value = &#39;news&#39;;
      button.onclick = 
             (function (html) {
                return function () {
                  IT.addWebSite(html.cloneNode(true))
                };
             })(content);
      p.appendChild(button);
    }

    IT.walkAllPage(ns);
  }
  ,
  doWebSearch: function () {
      var webSearch = new google.search.WebSearch();
      webSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
      webSearch.setSearchCompleteCallback(this, IT.wsComplete, [webSearch]);
      document.getElementById(&#39;IT_WebListBlock&#39;).innerHTML = &#39;&#39;;
      webSearch.execute(this.keyword());

      var newsSearch = new google.search.NewsSearch();
      newsSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
      newsSearch.setSearchCompleteCallback(this, IT.nsComplete, [newsSearch]);
      newsSearch.execute(this.keyword());
  }
  ,
  initWebDiv: function () {
    var div = document.getElementById(&#39;IT_WebSearchResults&#39;);

    div.innerHTML = &#39;&#39;;

    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var td = document.createElement(&#39;td&#39;);
    var tdDiv = document.createElement(&#39;div&#39;);
    tdDiv.id = &#39;IT_WebListBlock&#39;;
    tdDiv.style.overflow = &#39;auto&#39;;
    tdDiv.style.height = &#39;250px&#39;;

    div.appendChild(table);
    table.appendChild(tbody);
    tbody.appendChild(tr);
    tr.appendChild(td);
    td.appendChild(tdDiv);
  }
  ,
  mining: function (target1, target2) {
    var imageDiv = document.getElementById(target1);
    var webDiv = document.getElementById(target2);

    if (!imageDiv || !webDiv) return;

    imageDiv.innerHTML = &#39;&#39;;
    webDiv.innerHTML = &#39;&#39;;

    var div =  document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageSearchResults&#39;;
    div.previewMode = &#39;preview&#39;;
    imageDiv.appendChild(div);
    IT.initImageDiv();

    var div =  document.createElement(&#39;div&#39;);
    div.id = &#39;IT_WebSearchResults&#39;;
    div.previewMode = &#39;preview&#39;;
    webDiv.appendChild(div);
    IT.initWebDiv();

    IT.doImageSearch();
    IT.doWebSearch();

  }
  ,
  initBin: function () {
    var bin = document.getElementById(&#39;IT_Bin&#39;);

    bin.numPict = 0;
    bin.numWeb = 0;
    bin.innerHTML = &#39;&#39;;

    IT.updateTextArea();
    IT.buildSelectionBox();

    return false;
  }
  ,
  clickSearch: function () {
    IT.mining(&#39;IT_ImageList&#39;, &#39;IT_WebList&#39;);
    IT.initBin();

    return false;
  }
  ,
  putLabel: function (parent, place) {
    var label = &#39;&#39;;
    
    switch (place) {
    case 0: label = &#39;ToolTop&#39;;
            break;
    case 1: label = &#39;ImageResults&#39;;
            break;
    case 2: label = &#39;WebResults&#39;;
            break;
    case 3: label = &#39;GeneratedHTML&#39;;
            break;
    }

    var p = document.createElement(&#39;p&#39;);
    parent.appendChild(p);

    var a = document.createElement(&#39;a&#39;);
    a.name = label;
    p.appendChild(a);

    label = &#39;ToolTop&#39;;
    var tn = document.createTextNode(label);
    if (place == 0) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;ImageResults&#39;;
    var tn = document.createTextNode(label);
    if (place == 1) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;WebResults&#39;;
    var tn = document.createTextNode(label);
    if (place == 2) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;GeneratedHTML&#39;;
    var tn = document.createTextNode(label);
    if (place == 3) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

  }
  ,
  begin: function (place) {
    //sL.logger.enable();

    var placeDiv = document.getElementById(place);
    placeDiv.style.border = &#39;1px solid #888&#39;;
    placeDiv.style.padding = &#39;1px&#39;;

    IT.putLabel(placeDiv, 0);
    
    var form = document.createElement(&#39;form&#39;);
    form.style.verticalAlign = &#39;top&#39;;
    form.onsubmit = IT.clickSearch;
    form.id = &#39;IT_InputForm&#39;;
    placeDiv.appendChild(form);

    form.appendChild(document.createTextNode(&#39;Keyword:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;text&#39;;
    input.id = &#39;IT_SearchKey&#39;;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Search&#39;;
    input.onclick = IT.clickSearch;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Clear&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_SearchKey&#39;).value = &#39;&#39;;
      document.getElementById(&#39;IT_SearchKey&#39;).focus();
    };
    form.appendChild(input);

    //placeDiv.appendChild(document.createElement(&#39;br&#39;));

    var form = document.createElement(&#39;form&#39;);
    form.style.verticalAlign = &#39;top&#39;;
    form.onsubmit = IT.clickSearch;
    placeDiv.appendChild(form);

    form.appendChild(document.createTextNode(&#39;Direct URL:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;text&#39;;
    input.id = &#39;IT_DirectURL&#39;;
    input.onchange = 
       (function () {
          return function () {
            var img = document.createElement(&#39;img&#39;);
            img.style.border = &#39;1px sloid #888&#39;;
            img.style.margin = &#39;1px&#39;;
            img.style.padding = &#39;1px&#39;;

            var pv = document.getElementById(&#39;IT_DirecdtURLPreview&#39;);
            pv.innerHTML = &#39;&#39;;
            pv.appendChild(img);
            img.src = document.getElementById(&#39;IT_DirectURL&#39;).value;
            img.width = 450;
          };
       })();
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;); // dummy button
    input.type = &#39;button&#39;;
    input.value = &#39;View&#39;;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Add&#39;;
    input.onclick = 
       (function () {
          return function () {
            var imgUrl = document.getElementById(&#39;IT_DirectURL&#39;).value;
            var dummyImg = document.createElement(&#39;img&#39;);
            dummyImg.src = imgUrl;
            IT.addPict(
              {
                url: imgUrl,
                titleNoFormatting: imgUrl,
                width: dummyImg.width,
                height: dummyImg.height
              }
            );
          };
       })();
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Clear&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_DirecdtURLPreview&#39;).innerHTML = &#39;&#39;;
      document.getElementById(&#39;IT_DirectURL&#39;).value = &#39;&#39;;
      document.getElementById(&#39;IT_DirectURL&#39;).focus();
    };
    form.appendChild(input);

    var span = document.createElement(&#39;span&#39;);
    span.id = &#39;IT_DirecdtURLPreview&#39;;
    form.appendChild(span);

    IT.putLabel(placeDiv, 1);

    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var td = document.createElement(&#39;td&#39;);
    placeDiv.appendChild(td);

    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageSelectList&#39;;
    div.style.border = &#39;none&#39;;
    td.appendChild(div);

    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageList&#39;;
    div.style.border = &#39;1px solid #888&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    placeDiv.appendChild(div);

    IT.putLabel(placeDiv, 2);
    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_WebList&#39;;
    div.style.border = &#39;1px solid #888&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    placeDiv.appendChild(div);
    
    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_Bin&#39;
    div.style.border = &#39;1px solid #888&#39;;
    div.picts = new Array;
    div.numPict = 0;
    div.webSites = new Array;
    div.numWeb = 0;
    placeDiv.appendChild(div);

    IT.putLabel(placeDiv, 3);

    var gentext = document.createElement(&#39;div&#39;);
    var form = document.createElement(&#39;form&#39;);
    gentext.appendChild(form);

    var form = document.createElement(&#39;form&#39;);
    placeDiv.appendChild(form);

    var p = document.createElement(&#39;p&#39;);
    form.appendChild(p);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Select&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_GeneratedText&#39;).select();
    };
    p.appendChild(input);

    p.appendChild(document.createElement(&#39;br&#39;));

    var textArea = document.createElement(&#39;textarea&#39;);
    textArea.rows = 20;
    textArea.cols = 60;
    textArea.id = &#39;IT_GeneratedText&#39;;
    p.appendChild(textArea);
  }
};

//--&gt;
&lt;/script&gt;

&lt;!--&lt;div style=&quot;height:200px;overflow:auto;&quot; id=&quot;slLogArea&quot;&gt;log area&lt;/div&gt;--&gt;

&lt;div id=&quot;tool-pane&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
    IT.begin(&#39;tool-pane&#39;);
//--&gt;
&lt;/script&gt;
&lt;noscript&gt;Sorry, you have to enable javascript.&lt;/noscript&gt;

&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/8832345075421667796/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/05/cursor_17.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/8832345075421667796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/8832345075421667796'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/05/cursor_17.html' title='サムネイル・プレビュー作成ツール ver.1.6'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-634375074167470280</id><published>2010-05-10T07:29:00.001+09:00</published><updated>2010-05-10T07:29:09.707+09:00</updated><title type='text'>生成HTML</title><content type='html'>&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;vertical-align: top; &quot;&gt;&lt;img style=&quot;float: left; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(136, 136, 136); border-bottom-color: rgb(136, 136, 136); border-left-color: rgb(136, 136, 136); margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; &quot; width=&quot;450&quot; id=&quot;id_1273444117125&quot; alt=&quot;杉原杏璃 1273444117126&quot; src=&quot;http://static.straightline.jp/html/found/static/upload/l/l_a7414b2b10455c6e4068de13a8352e8e.jpg&quot;&gt;&lt;/td&gt;&lt;td style=&quot;vertical-align: top; &quot;&gt;&lt;div style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; &quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://aidle.up.seesaa.net/image/3305532578_dae6c52ea6.jpg&quot; title=&quot;杉原杏璃 1273444117126&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1273444117125&#39;).src=&#39;http://aidle.up.seesaa.net/image/3305532578_dae6c52ea6.jpg&#39;;document.getElementById(&#39;id_1273444117125&#39;).height=&#39;675&#39;;return false;&quot; alt=&quot;杉原杏璃 1273444117126&quot; src=&quot;http://aidle.up.seesaa.net/image/3305532578_dae6c52ea6.jpg&quot;&gt;&lt;/a&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://farm4.static.flickr.com/3246/3042029241_9cb181a9c6.jpg&quot; title=&quot;杉原杏璃 1273444117127&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1273444117125&#39;).src=&#39;http://farm4.static.flickr.com/3246/3042029241_9cb181a9c6.jpg&#39;;document.getElementById(&#39;id_1273444117125&#39;).height=&#39;673&#39;;return false;&quot; alt=&quot;杉原杏璃 1273444117127&quot; src=&quot;http://farm4.static.flickr.com/3246/3042029241_9cb181a9c6.jpg&quot;&gt;&lt;/a&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://static.straightline.jp/html/found/static/upload/l/l_a7414b2b10455c6e4068de13a8352e8e.jpg&quot; title=&quot;杉原杏璃 1273444117127&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1273444117125&#39;).src=&#39;http://static.straightline.jp/html/found/static/upload/l/l_a7414b2b10455c6e4068de13a8352e8e.jpg&#39;;document.getElementById(&#39;id_1273444117125&#39;).height=&#39;675&#39;;return false;&quot; alt=&quot;杉原杏璃 1273444117127&quot; src=&quot;http://static.straightline.jp/html/found/static/upload/l/l_a7414b2b10455c6e4068de13a8352e8e.jpg&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div id=&quot;WebSearchBlock&quot;&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/634375074167470280/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/05/html_10.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/634375074167470280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/634375074167470280'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/05/html_10.html' title='生成HTML'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://farm4.static.flickr.com/3246/3042029241_9cb181a9c6_t.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-8538672192734107845</id><published>2010-05-10T07:26:00.003+09:00</published><updated>2010-05-16T11:02:07.681+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ツール"/><title type='text'>サムネイル・プレビュー作成ツール ver.1.5</title><content type='html'>&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;
&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;http://sharri.web.fc2.com/JSlab/SL.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
google.load(&#39;search&#39;, &#39;1&#39;);
//--&gt;
&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
var IT = {
  keyword: function() {
    return document.getElementById(&#39;IT_SearchKey&#39;).value;
  }
  ,
  walkAllPage: function (s) {
    var cursor = s.cursor;
    var next = cursor.currentPageIndex + 1;
    if (next &gt;= cursor.pages.length) return;
    s.gotoPage(next);
  }
  ,
  buildIcon: function (url, alt, width, height) {
       var newImg = document.createElement(&#39;img&#39;);
       newImg.alt           = alt;
       newImg.src           = url;
       newImg.height        = height;
       newImg.width         = width;
       newImg.style.margin  = &#39;1px&#39;;
       newImg.style.padding = &#39;1px&#39;;
       newImg.style.border  = &#39;1px solid #888&#39;;
       return newImg;
  }
  ,
  viewResult: function (result) {

    var imgUrl = result.url;
    var srcUrl = result.originalContextUrl;
    var width = result.width;
    var height = result.height;
    var content = result.titleNoFormatting;

    var aSrc = document.getElementById(&#39;IT_ImageSrcLink&#39;);
    var aImg = document.getElementById(&#39;IT_ImageLink&#39;);
    var d = document.getElementById(&#39;IT_ImageDescription&#39;);

    if (aImg == null || aSrc == null || d == null) return;

    d.innerHTML = &#39;&#39;;
    d.appendChild(document.createTextNode(content));
    d.appendChild(document.createElement(&#39;br&#39;));
    d.appendChild(document.createTextNode(&#39;img = &#39; + imgUrl));
    d.appendChild(document.createElement(&#39;br&#39;));
    d.appendChild(document.createTextNode(&#39;src = &#39; + srcUrl));
    d.appendChild(document.createElement(&#39;br&#39;));

    var img = document.createElement(&#39;img&#39;);
    img.style.border = &#39;none&#39;;

    aSrc.href = srcUrl;

    img.alt = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
    img.src = imgUrl;

    var aW = width;
    var aH = height;

    img.width = 450;

    aImg.innerHTML = &#39;&#39;;
    aImg.href = imgUrl;
    aImg.title = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
    aImg.appendChild(img);

  }
  ,
  buildIconHtml: function (result, uid) {
    var viewScript =
       &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).src=&#39;&quot; + result.url +&quot;&#39;;&quot;
       + &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).height=&#39;&quot; + Math.floor(result.height * 450 / result.width) +&quot;&#39;;&quot;
        + &#39;return false;&#39;;

    var img = &#39;&lt;img &#39;
       + &#39; height=&quot;100&quot; &#39;
        + &#39; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot;&#39;
        + &#39; onmouseover=&quot;&#39; + viewScript + &#39;&quot;&#39;
        + &#39; alt=&quot;&#39; + this.keyword() + &#39; &#39; + (new Date).getTime()
           + &#39;&quot;&#39;
        + &#39; src=&quot;&#39; + result.url + &#39;&quot;&#39;
                      + &#39; /&gt;&#39;;
    var a = &#39;&lt;a&#39;
            + &#39; target=&quot;_blank&quot;&#39;
            + &#39; href=&quot;&#39; + result.url + &#39;&quot;&#39;
            + &#39; title=&quot;&#39; + this.keyword() + &#39; &#39; + (new Date).getTime()
               + &#39;&quot;&#39;
            + &#39; &gt;&#39;
            + img
            + &#39;&lt;/a&gt;&#39;;

    return a;
  }
  ,
  buildEraseIcon: function(picts, index) {
    var eraseIcon = sL.image.buildSquareLink(
                      70, 
                      &#39;javascript:void(0);&#39;,
                      picts[index].url,
                      picts[index].titleNoFormatting
                    );
    eraseIcon.style.cssFloat = &#39;left&#39;;
    eraseIcon.style.styleFloat = &#39;left&#39;;
    eraseIcon.style.border = &#39;1px outset&#39;;
    eraseIcon.style.margin = &#39;1px&#39;;
    eraseIcon.style.padding = &#39;1px&#39;;
    eraseIcon.onclick = (function (i) { return function () {
                            IT.removePict(i);
                        };})(index);
    return eraseIcon;
  }
  ,
  buildSelectionBox: function() {
    var bin = document.getElementById(&#39;IT_Bin&#39;);
    var sbox = document.getElementById(&#39;IT_ImageSelectList&#39;);
    sbox.innerHTML = &#39;&#39;;
    for (var i = 0; i &lt; bin.numPict; ++i) {
      if (!bin.picts[i]) continue;
      sbox.appendChild(this.buildEraseIcon(bin.picts, i));
    }
  }
  ,
  buildBin: function () {
    var bin = document.getElementById(&#39;IT_Bin&#39;);
    var uid = &#39;id_&#39;+ (new Date).getTime();

    bin.innerHTML = &#39;&#39;;
    
    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var tdView = document.createElement(&#39;td&#39;);
    var tdIcon = document.createElement(&#39;td&#39;);

    bin.appendChild(table);
    table.appendChild(tbody);
    tbody.appendChild(tr);
    tr.appendChild(tdView);
    tr.appendChild(tdIcon);

    tdIcon.style.verticalAlign = &#39;top&#39;;
    tdView.style.verticalAlign = &#39;top&#39;;

    var img = document.createElement(&#39;img&#39;);
    img.style.cssFloat = &#39;left&#39;;
    img.style.styleFloat = &#39;left&#39;;
    img.style.border = &#39;1px solid #888&#39;;
    img.style.margin = &#39;1px&#39;;
    img.style.padding = &#39;1px&#39;;
    img.width = 450;
    img.id = uid;
    img.alt = this.keyword() + &#39; &#39; + (new Date).getTime();

    if (bin.numPict &gt; 0) {
      for (i = bin.numPict; i &gt; 0; --i) {
        if (!bin.picts[i - 1]) continue;
        img.src = bin.picts[i - 1].url;
        break;
      }
    }
    tdView.appendChild(img);

    var div = document.createElement(&#39;div&#39;);
    div.style.border = &#39;none&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    tdIcon.appendChild(div);
    
    for (var i = 0; i &lt; bin.numPict; ++i) {
      if (!bin.picts[i]) continue;
      div.innerHTML += IT.buildIconHtml(bin.picts[i], uid);
    }

    IT.buildSelectionBox();

    var wsBlock = document.createElement(&#39;div&#39;);
    wsBlock.id = &#39;WebSearchBlock&#39;;
    bin.appendChild(wsBlock);

    for (var i = 0; i &lt; bin.numWeb; ++i) {
      wsBlock.appendChild(bin.webSites[i]);
    }
  }
  ,
  updateTextArea: function () {
    var text = document.getElementById(&#39;IT_GeneratedText&#39;);
    text.innerHTML = &#39;&#39;;
    text.appendChild(
       document.createTextNode(
         document.getElementById(&#39;IT_Bin&#39;).innerHTML));
  }
  ,
  removePict: function (i) {
    var div = document.getElementById(&#39;IT_Bin&#39;);
    if (!(i &lt; div.numPict)) return;
    div.picts[i] = null;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  addPict: function (result) {
    var div = document.getElementById(&#39;IT_Bin&#39;);
    div.picts[div.numPict++] = result;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  showImageState: function () {
    document.getElementById(&#39;IT_ImageStateInfo&#39;).innerHTML = 
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten
      + &#39;/&#39; +
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch
    ;
  }
  ,
  isComplete: function (is) {
    if (!is.results) return;
    if (is.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_ImageIconBlock&#39;);

    var results = is.results;

    document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch += results.length;
    IT.showImageState();

    if (contentDiv.previewMode == &#39;all&#39;) {
      for (var i = 0; i &lt; results.length; i++) {
        var result = results[i];

        var img = document.createElement(&#39;img&#39;);
        img.onload = (function (img, result) { return function () {
          img.onload = null;

          if (img.width != result.width || img.height != result.height) {
            sL.logger.log(&#39;drop:&#39; + result.url + &#39; w:&#39; + img.width + &#39;/&#39; + result.width + &#39; h:&#39; + img.height + &#39;/&#39; + result.height);
            return;
          }

          img.alt = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;

          document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten += 1;
          IT.showImageState();
          var link =  document.createElement(&#39;a&#39;);
          link.title   = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;
          link.href    = &#39;javascript:void(0);&#39;;
          link.onclick = (function (result) { return function () {
                   IT.addPict(result)
          };})(result);

          var h = 120;
          var w = (result.tbWidth * h) / result.tbHeight;
          link.appendChild(IT.buildIcon(result.tbUrl, result.visibleUrl, w, h));
          document.getElementById(&#39;IT_ImageIconBlock&#39;).appendChild(link);

        }})(img, result);
        img.src = result.url;
      }
    } else {
      for (var i = 0; i &lt; results.length; i++) {
        var result = results[i];

        var img = document.createElement(&#39;img&#39;);
        img.onload = (function (img, result) { return function () {
          img.onload = null;

          if (img.width != result.width || img.height != result.height) {
            sL.logger.log(&#39;drop:&#39; + result.url + &#39; w:&#39; + img.width + &#39;/&#39; + result.width + &#39; h:&#39; + img.height + &#39;/&#39; + result.height);
            return;
          }

          img.alt = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;

          document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten += 1;
          IT.showImageState();
          var link =  document.createElement(&#39;a&#39;);
          link.title   = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;
          link.href    = &#39;javascript:void(0);&#39;;
          link.onclick = (function (result) { return function () {
                   IT.addPict(result)
          };})(result);
          link.onmouseover = (function (result) { return function () {
                  IT.viewResult(result)
          };})(result);
          link.onfocus = (function (result) { return function () {
                  IT.viewResult(result)
          };})(result);

          var w = 80;
          var h = (result.tbHeight * w) / result.tbWidth;
          link.appendChild(IT.buildIcon(result.tbUrl, result.visibleUrl, w, h));
          document.getElementById(&#39;IT_ImageIconBlock&#39;).appendChild(link);

        }})(img, result);
        img.src = result.url;
      }
    }

    IT.walkAllPage(is);
  }
  ,
  switchImageView: function (mode) {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);
    div.previewMode = mode;
    IT.initImageDiv();
    IT.doImageSearch();
  }
  ,
  switchImageSize: function (size) {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);
    div.imageSize = size;
    IT.initImageDiv();
    IT.doImageSearch();
  }
  ,
  initImageDiv: function () {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);

    div.innerHTML = &#39;&#39;;

    var child = document.createElement(&#39;a&#39;);
    child.name = &#39;images&#39;;
    div.appendChild(child);

    var head = document.createElement(&#39;p&#39;);
    head.appendChild(document.createTextNode(&#39;[&#39; + this.keyword() + &#39;]&#39;));

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    var span = document.createElement(&#39;span&#39;);
    span.id = &#39;IT_ImageStateInfo&#39;;
    head.appendChild(span);

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    var a = document.createElement(&#39;a&#39;);
    a.href = &#39;javascript:void(0);&#39;;
    a.onclick = IT.initBin;
    a.appendChild(document.createTextNode(&#39;Clear&#39;));
    head.appendChild(a);

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    head.appendChild(document.createElement(&#39;br&#39;));

    head.appendChild(document.createTextNode(&#39;View:&#39;));
    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Mode&#39;;
    input.value = &#39;all&#39;;
    input.checked = (div.previewMode == &#39;all&#39;);
    input.onclick = (function (mode) { return function () {
                        IT.switchImageView(mode);
                    };})(&#39;all&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Thumbnail &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Mode&#39;;
    input.value = &#39;preview&#39;;
    input.checked = (div.previewMode != &#39;all&#39;);
    input.onclick = (function (mode) { return function () {
                        IT.switchImageView(mode);
                    };})(&#39;preview&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Preview &#39;));

    head.appendChild(document.createElement(&#39;br&#39;));

    head.appendChild(document.createTextNode(&#39;Size:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;None&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == undefined ||
                    document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;N&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;N&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;None &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Small&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;S&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;S&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Small &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Medium&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;M&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;M&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Medium &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Large&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;L&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;L&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Large &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;ExtraLarge&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;X&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;X&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Extra Large &#39;));

    div.appendChild(head);

    div.style.margin  = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;

    var iconBlock = document.getElementById(&#39;IT_ImageIconBlock&#39;);
    if (iconBlock == null) {
       iconBlock = document.createElement(&#39;div&#39;);
       iconBlock.id = &#39;IT_ImageIconBlock&#39;;
    }

    iconBlock.previewMode = div.previewMode;

    if (iconBlock.previewMode == &#39;all&#39;) {
      iconBlock.style.width    = &#39;auto&#39;;
      iconBlock.style.height   = &#39;auto&#39;;
      iconBlock.style.overflow = &#39;visible&#39;;
      div.appendChild(iconBlock);
    } else {
      iconBlock.style.width    = &#39;100px&#39;;
      iconBlock.style.height   = &#39;550px&#39;;
      iconBlock.style.overflow = &#39;auto&#39;;

      var imgA = document.getElementById(&#39;IT_ImageLink&#39;);
      if (imgA == null) {
        imgA        = document.createElement(&#39;a&#39;);
        imgA.id     = &#39;IT_ImageLink&#39;;
        imgA.target = &#39;_blank&#39;;
      }

      var orgA = document.getElementById(&#39;IT_ImageSrcLink&#39;);
      if (orgA == null) {
        orgA = document.createElement(&#39;a&#39;);
        orgA.id        = &#39;IT_ImageSrcLink&#39;;
        orgA.target    = &#39;_blank&#39;;
        orgA.innerHTML = &#39;[original site]&#39;;
      }

      var descDiv = document.getElementById(&#39;IT_ImageDescription&#39;);
      if (descDiv == null) {
        descDiv = document.createElement(&#39;div&#39;);
        descDiv.id = &#39;IT_ImageDescription&#39;;
      }

      var table  = document.createElement(&#39;table&#39;);
      table.style.border = &#39;none&#39;;

      var tbody = document.createElement(&#39;tbody&#39;);
      table.style.border = &#39;none&#39;;
      table.appendChild(tbody);

      var tr     = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var viewTd = document.createElement(&#39;td&#39;);
      viewTd.style.textAlign = &#39;center&#39;;

      var viewDiv = document.createElement(&#39;div&#39;);
      viewDiv.style.width = &#39;500px&#39;;
      //viewDiv.style.height = &#39;450px&#39;;
      viewDiv.style.overflow = &#39;auto&#39;;
      viewTd.appendChild(viewDiv);
      viewTd.style.verticalAlign = &#39;top&#39;;

      var br = document.createElement(&#39;div&#39;);
      br.style.clear = &#39;both&#39;;

      viewDiv.appendChild(imgA);
      viewDiv.appendChild(br);
      viewDiv.appendChild(orgA);
      viewDiv.appendChild(descDiv);

      var iconTd = document.createElement(&#39;td&#39;);
      iconTd.style.verticalAlign = &#39;top&#39;;

      tr.appendChild(viewTd);
      tr.appendChild(iconTd);
      iconTd.appendChild(iconBlock);

      div.appendChild(table);
    }
  }
  ,
  doImageSearch: function () {
      var imageSearch = new google.search.ImageSearch();
          
      /*
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_MEDIUM);
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
      */

      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGETYPE,
           google.search.ImageSearch.IMAGETYPE_PHOTO);

      imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
          
      imageSearch.setSearchCompleteCallback(this, IT.isComplete, [imageSearch]);
          
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch = 0;
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten = 0;

      switch (document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize) {
        case &#39;N&#39;: break;
        default: break;
        case &#39;S&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_SMALL);
          break;
        case &#39;M&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_MEDIUM);
          break;
        case &#39;L&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_LARGE);
          break;
        case &#39;X&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
          break;
      }
      /*
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
      */

      imageSearch.execute(this.keyword());
  }
  ,
  addWebSite: function (html) {
    var div = document.getElementById(&#39;IT_Bin&#39;);

    div.webSites[div.numWeb++] = html;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  wsComplete: function (ws) {
    if (!ws.results) return;
    if (ws.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_WebListBlock&#39;);
    var results = ws.results;

    var table = document.createElement(&#39;table&#39;);
    contentDiv.appendChild(table);

    var tbody = document.createElement(&#39;tbody&#39;);
    table.appendChild(tbody);
   
    for (var i = 0; i &lt; results.length; i++) {
      var result = results[i];
      
      var tr = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var tdButton = document.createElement(&#39;td&#39;);
      tr.appendChild(tdButton);

      var tdContent = document.createElement(&#39;td&#39;);
      // tdContent.appendChild(result.html.cloneNode(true));
      tr.appendChild(tdContent);
      tdContent.style.border = &#39;1px solid #888&#39;;
      tdContent.style.margin = &#39;1px&#39;;

      var content = document.createElement(&#39;p&#39;);
      var a = document.createElement(&#39;a&#39;);
      a.href = result.unescapedUrl;
      a.target = &#39;_blank&#39;;
      a.appendChild(document.createTextNode(result.titleNoFormatting));
      content.appendChild(a);
      content.appendChild(document.createTextNode(&#39; - &#39; + result.visibleUrl));
      content.appendChild(document.createElement(&#39;br&#39;));
      var span = document.createElement(&#39;span&#39;);
      span.innerHTML = result.content;
      content.appendChild(span);
      tdContent.appendChild(content);
      
      var form = document.createElement(&#39;form&#39;);
      tdButton.appendChild(form);
      
      var p = document.createElement(&#39;p&#39;);
      form.appendChild(p);
      
      var button = document.createElement(&#39;input&#39;);
      button.type = &#39;button&#39;;
      button.value = &#39;Add&#39;;
      button.onclick = 
             (function (html) {
                return function () {
                  IT.addWebSite(html)
                };
             })(content.cloneNode(true));
      p.appendChild(button);
    }

    IT.walkAllPage(ws);
  }
  ,
  doWebSearch: function () {
      var webSearch = new google.search.WebSearch();
          
      // webSearch.setNoHtmlGeneration();

      webSearch.setRestriction(google.search.ImageSearch.RESTRICT_SAFESEARCH,
                                 google.search.Search.SAFESEARCH_OFF);

      webSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
          
      webSearch.setSearchCompleteCallback(this, IT.wsComplete, [webSearch]);
          
      document.getElementById(&#39;IT_WebListBlock&#39;).innerHTML = &#39;&#39;;

      webSearch.execute(this.keyword());
  }
  ,
  initWebDiv: function () {
    var div = document.getElementById(&#39;IT_WebSearchResults&#39;);

    div.innerHTML = &#39;&#39;;

    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var td = document.createElement(&#39;td&#39;);
    var tdDiv = document.createElement(&#39;div&#39;);
    tdDiv.id = &#39;IT_WebListBlock&#39;;
    tdDiv.style.overflow = &#39;auto&#39;;
    tdDiv.style.height = &#39;250px&#39;;

    div.appendChild(table);
    table.appendChild(tbody);
    tbody.appendChild(tr);
    tr.appendChild(td);
    td.appendChild(tdDiv);
  }
  ,
  mining: function (target1, target2) {
    var imageDiv = document.getElementById(target1);
    var webDiv = document.getElementById(target2);

    if (!imageDiv || !webDiv) return;

    imageDiv.innerHTML = &#39;&#39;;
    webDiv.innerHTML = &#39;&#39;;

    var div =  document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageSearchResults&#39;;
    div.previewMode = &#39;preview&#39;;
    imageDiv.appendChild(div);
    IT.initImageDiv();

    var div =  document.createElement(&#39;div&#39;);
    div.id = &#39;IT_WebSearchResults&#39;;
    div.previewMode = &#39;preview&#39;;
    webDiv.appendChild(div);
    IT.initWebDiv();

    IT.doImageSearch();
    IT.doWebSearch();

  }
  ,
  initBin: function () {
    var bin = document.getElementById(&#39;IT_Bin&#39;);

    bin.numPict = 0;
    bin.numWeb = 0;
    bin.innerHTML = &#39;&#39;;

    IT.updateTextArea();
    IT.buildSelectionBox();

    return false;
  }
  ,
  clickSearch: function () {
    IT.mining(&#39;IT_ImageList&#39;, &#39;IT_WebList&#39;);
    IT.initBin();

    return false;
  }
  ,
  putLabel: function (parent, place) {
    var label = &#39;&#39;;
    
    switch (place) {
    case 0: label = &#39;ToolTop&#39;;
            break;
    case 1: label = &#39;ImageResults&#39;;
            break;
    case 2: label = &#39;WebResults&#39;;
            break;
    case 3: label = &#39;GeneratedHTML&#39;;
            break;
    }

    var p = document.createElement(&#39;p&#39;);
    parent.appendChild(p);

    var a = document.createElement(&#39;a&#39;);
    a.name = label;
    p.appendChild(a);

    label = &#39;ToolTop&#39;;
    var tn = document.createTextNode(label);
    if (place == 0) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;ImageResults&#39;;
    var tn = document.createTextNode(label);
    if (place == 1) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;WebResults&#39;;
    var tn = document.createTextNode(label);
    if (place == 2) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;GeneratedHTML&#39;;
    var tn = document.createTextNode(label);
    if (place == 3) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

  }
  ,
  begin: function (place) {
    //sL.logger.enable();

    var placeDiv = document.getElementById(place);
    placeDiv.style.border = &#39;1px solid #888&#39;;
    placeDiv.style.padding = &#39;1px&#39;;

    IT.putLabel(placeDiv, 0);
    
    var form = document.createElement(&#39;form&#39;);
    form.style.verticalAlign = &#39;top&#39;;
    form.onsubmit = IT.clickSearch;
    form.id = &#39;IT_InputForm&#39;;
    placeDiv.appendChild(form);

    form.appendChild(document.createTextNode(&#39;Keyword:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;text&#39;;
    input.id = &#39;IT_SearchKey&#39;;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Search&#39;;
    input.onclick = IT.clickSearch;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Clear&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_SearchKey&#39;).value = &#39;&#39;;
      document.getElementById(&#39;IT_SearchKey&#39;).focus();
    };
    form.appendChild(input);

    //placeDiv.appendChild(document.createElement(&#39;br&#39;));

    var form = document.createElement(&#39;form&#39;);
    form.style.verticalAlign = &#39;top&#39;;
    form.onsubmit = IT.clickSearch;
    placeDiv.appendChild(form);

    form.appendChild(document.createTextNode(&#39;Direct URL:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;text&#39;;
    input.id = &#39;IT_DirectURL&#39;;
    input.onchange = 
       (function () {
          return function () {
            var img = document.createElement(&#39;img&#39;);
            img.style.border = &#39;1px sloid #888&#39;;
            img.style.margin = &#39;1px&#39;;
            img.style.padding = &#39;1px&#39;;

            var pv = document.getElementById(&#39;IT_DirecdtURLPreview&#39;);
            pv.innerHTML = &#39;&#39;;
            pv.appendChild(img);
            img.src = document.getElementById(&#39;IT_DirectURL&#39;).value;
            img.width = 450;
          };
       })();
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;); // dummy button
    input.type = &#39;button&#39;;
    input.value = &#39;View&#39;;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Add&#39;;
    input.onclick = 
       (function () {
          return function () {
            var imgUrl = document.getElementById(&#39;IT_DirectURL&#39;).value;
            var dummyImg = document.createElement(&#39;img&#39;);
            dummyImg.src = imgUrl;
            IT.addPict(
              {
                url: imgUrl,
                titleNoFormatting: imgUrl,
                width: dummyImg.width,
                height: dummyImg.height
              }
            );
          };
       })();
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Clear&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_DirecdtURLPreview&#39;).innerHTML = &#39;&#39;;
      document.getElementById(&#39;IT_DirectURL&#39;).value = &#39;&#39;;
      document.getElementById(&#39;IT_DirectURL&#39;).focus();
    };
    form.appendChild(input);

    var span = document.createElement(&#39;span&#39;);
    span.id = &#39;IT_DirecdtURLPreview&#39;;
    form.appendChild(span);

    IT.putLabel(placeDiv, 1);

    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var td = document.createElement(&#39;td&#39;);
    placeDiv.appendChild(td);

    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageSelectList&#39;;
    div.style.border = &#39;none&#39;;
    td.appendChild(div);

    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageList&#39;;
    div.style.border = &#39;1px solid #888&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    placeDiv.appendChild(div);

    IT.putLabel(placeDiv, 2);
    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_WebList&#39;;
    div.style.border = &#39;1px solid #888&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    placeDiv.appendChild(div);
    
    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_Bin&#39;
    div.style.border = &#39;1px solid #888&#39;;
    div.picts = new Array;
    div.numPict = 0;
    div.webSites = new Array;
    div.numWeb = 0;
    placeDiv.appendChild(div);

    IT.putLabel(placeDiv, 3);

    var gentext = document.createElement(&#39;div&#39;);
    var form = document.createElement(&#39;form&#39;);
    gentext.appendChild(form);

    var form = document.createElement(&#39;form&#39;);
    placeDiv.appendChild(form);

    var p = document.createElement(&#39;p&#39;);
    form.appendChild(p);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Select&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_GeneratedText&#39;).select();
    };
    p.appendChild(input);

    p.appendChild(document.createElement(&#39;br&#39;));

    var textArea = document.createElement(&#39;textarea&#39;);
    textArea.rows = 20;
    textArea.cols = 60;
    textArea.id = &#39;IT_GeneratedText&#39;;
    p.appendChild(textArea);
  }
};

//--&gt;
&lt;/script&gt;

&lt;!--&lt;div style=&quot;height:200px;overflow:auto;&quot; id=&quot;slLogArea&quot;&gt;log area&lt;/div&gt;--&gt;

&lt;div id=&quot;tool-pane&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
    IT.begin(&#39;tool-pane&#39;);
//--&gt;
&lt;/script&gt;
&lt;noscript&gt;Sorry, you have to enable javascript.&lt;/noscript&gt;

&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/8538672192734107845/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/05/cursor.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/8538672192734107845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/8538672192734107845'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/05/cursor.html' title='サムネイル・プレビュー作成ツール ver.1.5'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-151203205375141172</id><published>2010-05-10T07:13:00.000+09:00</published><updated>2010-05-10T07:14:11.077+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="実験"/><title type='text'>生成HTML</title><content type='html'>&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;vertical-align: top; &quot;&gt;&lt;img style=&quot;float: left; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(136, 136, 136); border-bottom-color: rgb(136, 136, 136); border-left-color: rgb(136, 136, 136); margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; &quot; width=&quot;450&quot; id=&quot;id_1273443177644&quot; alt=&quot;杉原杏璃 1273443177644&quot; src=&quot;http://static.straightline.jp/html/found/static/upload/l/l_a7414b2b10455c6e4068de13a8352e8e.jpg&quot;&gt;&lt;/td&gt;&lt;td style=&quot;vertical-align: top; &quot;&gt;&lt;div style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; &quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://aidle.up.seesaa.net/image/3305532578_dae6c52ea6.jpg&quot; title=&quot;杉原杏璃 1273443177644&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1273443177644&#39;).src=&#39;http://aidle.up.seesaa.net/image/3305532578_dae6c52ea6.jpg&#39;;document.getElementById(&#39;id_1273443177644&#39;).height=&#39;675&#39;;return false;&quot; alt=&quot;杉原杏璃 1273443177644&quot; src=&quot;http://aidle.up.seesaa.net/image/3305532578_dae6c52ea6.jpg&quot;&gt;&lt;/a&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://rcm-images.amazon.com/images/P/B0011UGXUO.09.IN01.LZZZZZZZ.jpg&quot; title=&quot;杉原杏璃 1273443177644&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1273443177644&#39;).src=&#39;http://rcm-images.amazon.com/images/P/B0011UGXUO.09.IN01.LZZZZZZZ.jpg&#39;;document.getElementById(&#39;id_1273443177644&#39;).height=&#39;642&#39;;return false;&quot; alt=&quot;杉原杏璃 1273443177644&quot; src=&quot;http://rcm-images.amazon.com/images/P/B0011UGXUO.09.IN01.LZZZZZZZ.jpg&quot;&gt;&lt;/a&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://static.straightline.jp/html/found/static/upload/l/l_a7414b2b10455c6e4068de13a8352e8e.jpg&quot; title=&quot;杉原杏璃 1273443177645&quot;&gt;&lt;img height=&quot;100&quot; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot; onmouseover=&quot;document.getElementById(&#39;id_1273443177644&#39;).src=&#39;http://static.straightline.jp/html/found/static/upload/l/l_a7414b2b10455c6e4068de13a8352e8e.jpg&#39;;document.getElementById(&#39;id_1273443177644&#39;).height=&#39;NaN&#39;;return false;&quot; alt=&quot;杉原杏璃 1273443177645&quot; src=&quot;http://static.straightline.jp/html/found/static/upload/l/l_a7414b2b10455c6e4068de13a8352e8e.jpg&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div id=&quot;WebSearchBlock&quot;&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/151203205375141172/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/05/html.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/151203205375141172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/151203205375141172'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/05/html.html' title='生成HTML'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-1864138131458324265</id><published>2010-04-28T22:58:00.047+09:00</published><updated>2010-05-10T07:27:17.469+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ツール"/><title type='text'>サムネイル・プレビュー作成ツール ver.1.4</title><content type='html'>&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;
&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;http://sharri.web.fc2.com/JSlab/SL.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
google.load(&#39;search&#39;, &#39;1&#39;);
//--&gt;
&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
var IT = {
  keyword: function() {
    return document.getElementById(&#39;IT_SearchKey&#39;).value;
  }
  ,
  walkAllPage: function (s) {
    var cursor = s.cursor;
    var next = cursor.currentPageIndex + 1;
    if (next &gt;= cursor.pages.length) return;
    s.gotoPage(next);
  }
  ,
  buildIcon: function (url, alt, width, height) {
       var newImg = document.createElement(&#39;img&#39;);
       newImg.alt           = alt;
       newImg.src           = url;
       newImg.height        = height;
       newImg.width         = width;
       newImg.style.margin  = &#39;1px&#39;;
       newImg.style.padding = &#39;1px&#39;;
       newImg.style.border  = &#39;1px solid #888&#39;;
       return newImg;
  }
  ,
  viewResult: function (result) {

    var imgUrl = result.url;
    var srcUrl = result.originalContextUrl;
    var width = result.width;
    var height = result.height;
    var content = result.titleNoFormatting;

    var aSrc = document.getElementById(&#39;IT_ImageSrcLink&#39;);
    var aImg = document.getElementById(&#39;IT_ImageLink&#39;);
    var d = document.getElementById(&#39;IT_ImageDescription&#39;);

    if (aImg == null || aSrc == null || d == null) return;

    d.innerHTML = &#39;&#39;;
    d.appendChild(document.createTextNode(content));
    d.appendChild(document.createElement(&#39;br&#39;));
    d.appendChild(document.createTextNode(&#39;img = &#39; + imgUrl));
    d.appendChild(document.createElement(&#39;br&#39;));
    d.appendChild(document.createTextNode(&#39;src = &#39; + srcUrl));
    d.appendChild(document.createElement(&#39;br&#39;));

    var img = document.createElement(&#39;img&#39;);
    img.style.border = &#39;none&#39;;

    aSrc.href = srcUrl;

    img.alt = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
    img.src = imgUrl;

    var aW = width;
    var aH = height;

    img.width = 450;

    aImg.innerHTML = &#39;&#39;;
    aImg.href = imgUrl;
    aImg.title = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
    aImg.appendChild(img);

  }
  ,
  buildIconHtml: function (result, uid) {
    var viewScript =
       &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).src=&#39;&quot; + result.url +&quot;&#39;;&quot;
       + &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).height=&#39;&quot; + Math.floor(result.height * 450 / result.width) +&quot;&#39;;&quot;
        + &#39;return false;&#39;;

    var img = &#39;&lt;img &#39;
       + &#39; height=&quot;100&quot; &#39;
        + &#39; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot;&#39;
        + &#39; onmouseover=&quot;&#39; + viewScript + &#39;&quot;&#39;
        + &#39; alt=&quot;&#39; + this.keyword() + &#39; &#39; + (new Date).getTime()
           + &#39;&quot;&#39;
        + &#39; src=&quot;&#39; + result.url + &#39;&quot;&#39;
                      + &#39; /&gt;&#39;;
    var a = &#39;&lt;a&#39;
            + &#39; target=&quot;_blank&quot;&#39;
            + &#39; href=&quot;&#39; + result.url + &#39;&quot;&#39;
            + &#39; title=&quot;&#39; + this.keyword() + &#39; &#39; + (new Date).getTime()
               + &#39;&quot;&#39;
            + &#39; &gt;&#39;
            + img
            + &#39;&lt;/a&gt;&#39;;

    return a;
  }
  ,
  buildEraseIcon: function(picts, index) {
    var eraseIcon = sL.image.buildSquareLink(
                      70, 
                      &#39;javascript:void(0);&#39;,
                      picts[index].url,
                      picts[index].titleNoFormatting
                    );
    eraseIcon.style.cssFloat = &#39;left&#39;;
    eraseIcon.style.styleFloat = &#39;left&#39;;
    eraseIcon.style.border = &#39;1px outset&#39;;
    eraseIcon.style.margin = &#39;1px&#39;;
    eraseIcon.style.padding = &#39;1px&#39;;
    eraseIcon.onclick = (function (i) { return function () {
                            IT.removePict(i);
                        };})(index);
    return eraseIcon;
  }
  ,
  buildSelectionBox: function() {
    var bin = document.getElementById(&#39;IT_Bin&#39;);
    var sbox = document.getElementById(&#39;IT_ImageSelectList&#39;);
    sbox.innerHTML = &#39;&#39;;
    for (var i = 0; i &lt; bin.numPict; ++i) {
      if (!bin.picts[i]) continue;
      sbox.appendChild(this.buildEraseIcon(bin.picts, i));
    }
  }
  ,
  buildBin: function () {
    var bin = document.getElementById(&#39;IT_Bin&#39;);
    var uid = &#39;id_&#39;+ (new Date).getTime();

    bin.innerHTML = &#39;&#39;;
    
    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var tdView = document.createElement(&#39;td&#39;);
    var tdIcon = document.createElement(&#39;td&#39;);

    bin.appendChild(table);
    table.appendChild(tbody);
    tbody.appendChild(tr);
    tr.appendChild(tdView);
    tr.appendChild(tdIcon);

    tdIcon.style.verticalAlign = &#39;top&#39;;
    tdView.style.verticalAlign = &#39;top&#39;;

    var img = document.createElement(&#39;img&#39;);
    img.style.cssFloat = &#39;left&#39;;
    img.style.styleFloat = &#39;left&#39;;
    img.style.border = &#39;1px solid #888&#39;;
    img.style.margin = &#39;1px&#39;;
    img.style.padding = &#39;1px&#39;;
    img.width = 450;
    img.id = uid;
    img.alt = this.keyword() + &#39; &#39; + (new Date).getTime();

    if (bin.numPict &gt; 0) {
      for (i = bin.numPict; i &gt; 0; --i) {
        if (!bin.picts[i - 1]) continue;
        img.src = bin.picts[i - 1].url;
        break;
      }
    }
    tdView.appendChild(img);

    var div = document.createElement(&#39;div&#39;);
    div.style.border = &#39;none&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    tdIcon.appendChild(div);
    
    for (var i = 0; i &lt; bin.numPict; ++i) {
      if (!bin.picts[i]) continue;
      div.innerHTML += IT.buildIconHtml(bin.picts[i], uid);
    }

    IT.buildSelectionBox();

    var wsBlock = document.createElement(&#39;div&#39;);
    wsBlock.id = &#39;WebSearchBlock&#39;;
    bin.appendChild(wsBlock);

    for (var i = 0; i &lt; bin.numWeb; ++i) {
      wsBlock.appendChild(bin.webSites[i]);
    }
  }
  ,
  updateTextArea: function () {
    var text = document.getElementById(&#39;IT_GeneratedText&#39;);
    text.innerHTML = &#39;&#39;;
    text.appendChild(
       document.createTextNode(
         document.getElementById(&#39;IT_Bin&#39;).innerHTML));
  }
  ,
  removePict: function (i) {
    var div = document.getElementById(&#39;IT_Bin&#39;);
    if (!(i &lt; div.numPict)) return;
    div.picts[i] = null;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  addPict: function (result) {
    var div = document.getElementById(&#39;IT_Bin&#39;);
    div.picts[div.numPict++] = result;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  showImageState: function () {
    document.getElementById(&#39;IT_ImageStateInfo&#39;).innerHTML = 
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten
      + &#39;/&#39; +
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch
    ;
  }
  ,
  isComplete: function (is) {
    if (!is.results) return;
    if (is.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_ImageIconBlock&#39;);

    var results = is.results;

    document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch += results.length;
    IT.showImageState();

    if (contentDiv.previewMode == &#39;all&#39;) {
      for (var i = 0; i &lt; results.length; i++) {
        var result = results[i];

        var img = document.createElement(&#39;img&#39;);
        img.onload = (function (img, result) { return function () {
          img.onload = null;

          if (img.width != result.width || img.height != result.height) {
            sL.logger.log(&#39;drop:&#39; + result.url + &#39; w:&#39; + img.width + &#39;/&#39; + result.width + &#39; h:&#39; + img.height + &#39;/&#39; + result.height);
            return;
          }

          img.alt = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;

          document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten += 1;
          IT.showImageState();
          var link =  document.createElement(&#39;a&#39;);
          link.title   = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;
          link.href    = &#39;javascript:void(0);&#39;;
          link.onclick = (function (result) { return function () {
                   IT.addPict(result)
          };})(result);

          var h = 120;
          var w = (result.tbWidth * h) / result.tbHeight;
          link.appendChild(IT.buildIcon(result.tbUrl, result.visibleUrl, w, h));
          document.getElementById(&#39;IT_ImageIconBlock&#39;).appendChild(link);

        }})(img, result);
        img.src = result.url;
      }
    } else {
      for (var i = 0; i &lt; results.length; i++) {
        var result = results[i];

        var img = document.createElement(&#39;img&#39;);
        img.onload = (function (img, result) { return function () {
          img.onload = null;

          if (img.width != result.width || img.height != result.height) {
            sL.logger.log(&#39;drop:&#39; + result.url + &#39; w:&#39; + img.width + &#39;/&#39; + result.width + &#39; h:&#39; + img.height + &#39;/&#39; + result.height);
            return;
          }

          img.alt = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;

          document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten += 1;
          IT.showImageState();
          var link =  document.createElement(&#39;a&#39;);
          link.title   = result.titleNoFormatting+ &#39;(&#39;+ result.width + &#39;x&#39; + result.height + &#39;)&#39;;
          link.href    = &#39;javascript:void(0);&#39;;
          link.onclick = (function (result) { return function () {
                   IT.addPict(result)
          };})(result);
          link.onmouseover = (function (result) { return function () {
                  IT.viewResult(result)
          };})(result);
          link.onfocus = (function (result) { return function () {
                  IT.viewResult(result)
          };})(result);

          var w = 80;
          var h = (result.tbHeight * w) / result.tbWidth;
          link.appendChild(IT.buildIcon(result.tbUrl, result.visibleUrl, w, h));
          document.getElementById(&#39;IT_ImageIconBlock&#39;).appendChild(link);

        }})(img, result);
        img.src = result.url;
      }
    }

    IT.walkAllPage(is);
  }
  ,
  switchImageView: function (mode) {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);
    div.previewMode = mode;
    IT.initImageDiv();
    IT.doImageSearch();
  }
  ,
  switchImageSize: function (size) {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);
    div.imageSize = size;
    IT.initImageDiv();
    IT.doImageSearch();
  }
  ,
  initImageDiv: function () {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);

    div.innerHTML = &#39;&#39;;

    var child = document.createElement(&#39;a&#39;);
    child.name = &#39;images&#39;;
    div.appendChild(child);

    var head = document.createElement(&#39;p&#39;);
    head.appendChild(document.createTextNode(&#39;[&#39; + this.keyword() + &#39;]&#39;));

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    var span = document.createElement(&#39;span&#39;);
    span.id = &#39;IT_ImageStateInfo&#39;;
    head.appendChild(span);

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    var a = document.createElement(&#39;a&#39;);
    a.href = &#39;javascript:void(0);&#39;;
    a.onclick = IT.initBin;
    a.appendChild(document.createTextNode(&#39;Clear&#39;));
    head.appendChild(a);

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    head.appendChild(document.createElement(&#39;br&#39;));

    head.appendChild(document.createTextNode(&#39;View:&#39;));
    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Mode&#39;;
    input.value = &#39;all&#39;;
    input.checked = (div.previewMode == &#39;all&#39;);
    input.onclick = (function (mode) { return function () {
                        IT.switchImageView(mode);
                    };})(&#39;all&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Thumbnail &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Mode&#39;;
    input.value = &#39;preview&#39;;
    input.checked = (div.previewMode != &#39;all&#39;);
    input.onclick = (function (mode) { return function () {
                        IT.switchImageView(mode);
                    };})(&#39;preview&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Preview &#39;));

    head.appendChild(document.createElement(&#39;br&#39;));

    head.appendChild(document.createTextNode(&#39;Size:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;None&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == undefined ||
                    document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;N&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;N&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;None &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Small&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;S&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;S&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Small &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Medium&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;M&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;M&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Medium &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Large&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;L&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;L&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Large &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;ExtraLarge&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;X&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;X&#39;);
    head.appendChild(input);
    head.appendChild(document.createTextNode(&#39;Extra Large &#39;));

    div.appendChild(head);

    div.style.margin  = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;

    var iconBlock = document.getElementById(&#39;IT_ImageIconBlock&#39;);
    if (iconBlock == null) {
       iconBlock = document.createElement(&#39;div&#39;);
       iconBlock.id = &#39;IT_ImageIconBlock&#39;;
    }

    iconBlock.previewMode = div.previewMode;

    if (iconBlock.previewMode == &#39;all&#39;) {
      iconBlock.style.width    = &#39;auto&#39;;
      iconBlock.style.height   = &#39;auto&#39;;
      iconBlock.style.overflow = &#39;visible&#39;;
      div.appendChild(iconBlock);
    } else {
      iconBlock.style.width    = &#39;100px&#39;;
      iconBlock.style.height   = &#39;550px&#39;;
      iconBlock.style.overflow = &#39;auto&#39;;

      var imgA = document.getElementById(&#39;IT_ImageLink&#39;);
      if (imgA == null) {
        imgA        = document.createElement(&#39;a&#39;);
        imgA.id     = &#39;IT_ImageLink&#39;;
        imgA.target = &#39;_blank&#39;;
      }

      var orgA = document.getElementById(&#39;IT_ImageSrcLink&#39;);
      if (orgA == null) {
        orgA = document.createElement(&#39;a&#39;);
        orgA.id        = &#39;IT_ImageSrcLink&#39;;
        orgA.target    = &#39;_blank&#39;;
        orgA.innerHTML = &#39;[original site]&#39;;
      }

      var descDiv = document.getElementById(&#39;IT_ImageDescription&#39;);
      if (descDiv == null) {
        descDiv = document.createElement(&#39;div&#39;);
        descDiv.id = &#39;IT_ImageDescription&#39;;
      }

      var table  = document.createElement(&#39;table&#39;);
      table.style.border = &#39;none&#39;;

      var tbody = document.createElement(&#39;tbody&#39;);
      table.style.border = &#39;none&#39;;
      table.appendChild(tbody);

      var tr     = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var viewTd = document.createElement(&#39;td&#39;);
      viewTd.style.textAlign = &#39;center&#39;;

      var viewDiv = document.createElement(&#39;div&#39;);
      viewDiv.style.width = &#39;500px&#39;;
      //viewDiv.style.height = &#39;450px&#39;;
      viewDiv.style.overflow = &#39;auto&#39;;
      viewTd.appendChild(viewDiv);
      viewTd.style.verticalAlign = &#39;top&#39;;

      var br = document.createElement(&#39;div&#39;);
      br.style.clear = &#39;both&#39;;

      viewDiv.appendChild(imgA);
      viewDiv.appendChild(br);
      viewDiv.appendChild(orgA);
      viewDiv.appendChild(descDiv);

      var iconTd = document.createElement(&#39;td&#39;);
      iconTd.style.verticalAlign = &#39;top&#39;;

      tr.appendChild(viewTd);
      tr.appendChild(iconTd);
      iconTd.appendChild(iconBlock);

      div.appendChild(table);
    }
  }
  ,
  doImageSearch: function () {
      var imageSearch = new google.search.ImageSearch();
          
      /*
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_MEDIUM);
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
      */

      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGETYPE,
           google.search.ImageSearch.IMAGETYPE_PHOTO);

      imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
          
      imageSearch.setSearchCompleteCallback(this, IT.isComplete, [imageSearch]);
          
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch = 0;
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten = 0;

      switch (document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize) {
        case &#39;N&#39;: break;
        default: break;
        case &#39;S&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_SMALL);
          break;
        case &#39;M&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_MEDIUM);
          break;
        case &#39;L&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_LARGE);
          break;
        case &#39;X&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
          break;
      }
      /*
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
      */

      imageSearch.execute(this.keyword());
  }
  ,
  addWebSite: function (html) {
    var div = document.getElementById(&#39;IT_Bin&#39;);

    div.webSites[div.numWeb++] = html;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  wsComplete: function (ws) {
    if (!ws.results) return;
    if (ws.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_WebListBlock&#39;);
    var results = ws.results;

    var table = document.createElement(&#39;table&#39;);
    contentDiv.appendChild(table);

    var tbody = document.createElement(&#39;tbody&#39;);
    table.appendChild(tbody);
   
    for (var i = 0; i &lt; results.length; i++) {
      var result = results[i];
      
      var tr = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var tdButton = document.createElement(&#39;td&#39;);
      tr.appendChild(tdButton);

      var tdContent = document.createElement(&#39;td&#39;);
      // tdContent.appendChild(result.html.cloneNode(true));
      tr.appendChild(tdContent);
      tdContent.style.border = &#39;1px solid #888&#39;;
      tdContent.style.margin = &#39;1px&#39;;

      var content = document.createElement(&#39;p&#39;);
      var a = document.createElement(&#39;a&#39;);
      a.href = result.unescapedUrl;
      a.target = &#39;_blank&#39;;
      a.appendChild(document.createTextNode(result.titleNoFormatting));
      content.appendChild(a);
      content.appendChild(document.createTextNode(&#39; - &#39; + result.visibleUrl));
      content.appendChild(document.createElement(&#39;br&#39;));
      var span = document.createElement(&#39;span&#39;);
      span.innerHTML = result.content;
      content.appendChild(span);
      tdContent.appendChild(content);
      
      var form = document.createElement(&#39;form&#39;);
      tdButton.appendChild(form);
      
      var p = document.createElement(&#39;p&#39;);
      form.appendChild(p);
      
      var button = document.createElement(&#39;input&#39;);
      button.type = &#39;button&#39;;
      button.value = &#39;Add&#39;;
      button.onclick = 
             (function (html) {
                return function () {
                  IT.addWebSite(html)
                };
             })(content.cloneNode(true));
      p.appendChild(button);
    }

    IT.walkAllPage(ws);
  }
  ,
  doWebSearch: function () {
      var webSearch = new google.search.WebSearch();
          
      // webSearch.setNoHtmlGeneration();

      webSearch.setRestriction(google.search.ImageSearch.RESTRICT_SAFESEARCH,
                                 google.search.Search.SAFESEARCH_OFF);

      webSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
          
      webSearch.setSearchCompleteCallback(this, IT.wsComplete, [webSearch]);
          
      document.getElementById(&#39;IT_WebListBlock&#39;).innerHTML = &#39;&#39;;

      webSearch.execute(this.keyword());
  }
  ,
  initWebDiv: function () {
    var div = document.getElementById(&#39;IT_WebSearchResults&#39;);

    div.innerHTML = &#39;&#39;;

    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var td = document.createElement(&#39;td&#39;);
    var tdDiv = document.createElement(&#39;div&#39;);
    tdDiv.id = &#39;IT_WebListBlock&#39;;
    tdDiv.style.overflow = &#39;auto&#39;;
    tdDiv.style.height = &#39;250px&#39;;

    div.appendChild(table);
    table.appendChild(tbody);
    tbody.appendChild(tr);
    tr.appendChild(td);
    td.appendChild(tdDiv);
  }
  ,
  mining: function (target1, target2) {
    var imageDiv = document.getElementById(target1);
    var webDiv = document.getElementById(target2);

    if (!imageDiv || !webDiv) return;

    imageDiv.innerHTML = &#39;&#39;;
    webDiv.innerHTML = &#39;&#39;;

    var div =  document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageSearchResults&#39;;
    div.previewMode = &#39;preview&#39;;
    imageDiv.appendChild(div);
    IT.initImageDiv();

    var div =  document.createElement(&#39;div&#39;);
    div.id = &#39;IT_WebSearchResults&#39;;
    div.previewMode = &#39;preview&#39;;
    webDiv.appendChild(div);
    IT.initWebDiv();

    IT.doImageSearch();
    IT.doWebSearch();

  }
  ,
  initBin: function () {
    var bin = document.getElementById(&#39;IT_Bin&#39;);

    bin.numPict = 0;
    bin.numWeb = 0;
    bin.innerHTML = &#39;&#39;;

    IT.updateTextArea();
    IT.buildSelectionBox();

    return false;
  }
  ,
  clickSearch: function () {
    IT.mining(&#39;IT_ImageList&#39;, &#39;IT_WebList&#39;);
    IT.initBin();

    return false;
  }
  ,
  putLabel: function (parent, place) {
    var label = &#39;&#39;;
    
    switch (place) {
    case 0: label = &#39;ToolTop&#39;;
            break;
    case 1: label = &#39;ImageResults&#39;;
            break;
    case 2: label = &#39;WebResults&#39;;
            break;
    case 3: label = &#39;GeneratedHTML&#39;;
            break;
    }

    var p = document.createElement(&#39;p&#39;);
    parent.appendChild(p);

    var a = document.createElement(&#39;a&#39;);
    a.name = label;
    p.appendChild(a);

    label = &#39;ToolTop&#39;;
    var tn = document.createTextNode(label);
    if (place == 0) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;ImageResults&#39;;
    var tn = document.createTextNode(label);
    if (place == 1) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;WebResults&#39;;
    var tn = document.createTextNode(label);
    if (place == 2) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;GeneratedHTML&#39;;
    var tn = document.createTextNode(label);
    if (place == 3) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

  }
  ,
  begin: function (place) {
    //sL.logger.enable();

    var placeDiv = document.getElementById(place);
    placeDiv.style.border = &#39;1px solid #888&#39;;
    placeDiv.style.padding = &#39;1px&#39;;

    IT.putLabel(placeDiv, 0);
    
    var form = document.createElement(&#39;form&#39;);
    form.style.verticalAlign = &#39;top&#39;;
    form.onsubmit = IT.clickSearch;
    form.id = &#39;IT_InputForm&#39;;
    placeDiv.appendChild(form);

    form.appendChild(document.createTextNode(&#39;Keyword:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;text&#39;;
    input.id = &#39;IT_SearchKey&#39;;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Search&#39;;
    input.onclick = IT.clickSearch;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Clear&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_SearchKey&#39;).value = &#39;&#39;;
      document.getElementById(&#39;IT_SearchKey&#39;).focus();
    };
    form.appendChild(input);

    //placeDiv.appendChild(document.createElement(&#39;br&#39;));

    var form = document.createElement(&#39;form&#39;);
    form.style.verticalAlign = &#39;top&#39;;
    form.onsubmit = IT.clickSearch;
    placeDiv.appendChild(form);

    form.appendChild(document.createTextNode(&#39;Direct URL:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;text&#39;;
    input.id = &#39;IT_DirectURL&#39;;
    input.onchange = 
       (function () {
          return function () {
            var img = document.createElement(&#39;img&#39;);
            img.style.border = &#39;1px sloid #888&#39;;
            img.style.margin = &#39;1px&#39;;
            img.style.padding = &#39;1px&#39;;

            var pv = document.getElementById(&#39;IT_DirecdtURLPreview&#39;);
            pv.innerHTML = &#39;&#39;;
            pv.appendChild(img);
            img.src = document.getElementById(&#39;IT_DirectURL&#39;).value;
            img.width = 450;
          };
       })();
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;); // dummy button
    input.type = &#39;button&#39;;
    input.value = &#39;View&#39;;
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Add&#39;;
    input.onclick = 
       (function () {
          return function () {
            var imgUrl = document.getElementById(&#39;IT_DirectURL&#39;).value;
            IT.addPict(
              {
                url: imgUrl,
                titleNoFormatting: imgUrl
              }
            );
          };
       })();
    form.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Clear&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_DirecdtURLPreview&#39;).innerHTML = &#39;&#39;;
      document.getElementById(&#39;IT_DirectURL&#39;).value = &#39;&#39;;
      document.getElementById(&#39;IT_DirectURL&#39;).focus();
    };
    form.appendChild(input);

    var span = document.createElement(&#39;span&#39;);
    span.id = &#39;IT_DirecdtURLPreview&#39;;
    form.appendChild(span);

    IT.putLabel(placeDiv, 1);

    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var td = document.createElement(&#39;td&#39;);
    placeDiv.appendChild(td);

    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageSelectList&#39;;
    div.style.border = &#39;none&#39;;
    td.appendChild(div);

    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageList&#39;;
    div.style.border = &#39;1px solid #888&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    placeDiv.appendChild(div);

    IT.putLabel(placeDiv, 2);
    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_WebList&#39;;
    div.style.border = &#39;1px solid #888&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    placeDiv.appendChild(div);
    
    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_Bin&#39;
    div.style.border = &#39;1px solid #888&#39;;
    div.picts = new Array;
    div.numPict = 0;
    div.webSites = new Array;
    div.numWeb = 0;
    placeDiv.appendChild(div);

    IT.putLabel(placeDiv, 3);

    var gentext = document.createElement(&#39;div&#39;);
    var form = document.createElement(&#39;form&#39;);
    gentext.appendChild(form);

    var form = document.createElement(&#39;form&#39;);
    placeDiv.appendChild(form);

    var p = document.createElement(&#39;p&#39;);
    form.appendChild(p);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Select&#39;;
    input.onclick = function () {
      document.getElementById(&#39;IT_GeneratedText&#39;).select();
    };
    p.appendChild(input);

    p.appendChild(document.createElement(&#39;br&#39;));

    var textArea = document.createElement(&#39;textarea&#39;);
    textArea.rows = 20;
    textArea.cols = 60;
    textArea.id = &#39;IT_GeneratedText&#39;;
    p.appendChild(textArea);
  }
};

//--&gt;
&lt;/script&gt;

&lt;!--&lt;div style=&quot;height:200px;overflow:auto;&quot; id=&quot;slLogArea&quot;&gt;log area&lt;/div&gt;--&gt;

&lt;div id=&quot;tool-pane&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
    IT.begin(&#39;tool-pane&#39;);
//--&gt;
&lt;/script&gt;
&lt;noscript&gt;Sorry, you have to enable javascript.&lt;/noscript&gt;

&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/1864138131458324265/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/04/ver14.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/1864138131458324265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/1864138131458324265'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/04/ver14.html' title='サムネイル・プレビュー作成ツール ver.1.4'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-4802181120415572705</id><published>2010-04-22T23:22:00.026+09:00</published><updated>2010-05-10T07:27:40.748+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ツール"/><title type='text'>サムネイル・プレビュー作成ツール ver.1.3</title><content type='html'>&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;
&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;http://sharri.web.fc2.com/JSlab/SL.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
google.load(&#39;search&#39;, &#39;1&#39;);
//--&gt;
&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
var IT = {
  walkAllPage: function (s) {
    var cursor = s.cursor;
    var next = cursor.currentPageIndex + 1;
    if (next &gt;= cursor.pages.length) return;
    s.gotoPage(next);
  }
  ,
  buildIcon: function (url, alt, width, height) {
       var newImg = document.createElement(&#39;img&#39;);
       newImg.alt           = alt;
       newImg.src           = url;
       newImg.height        = height;
       newImg.width         = width;
       newImg.style.margin  = &#39;1px&#39;;
       newImg.style.padding = &#39;1px&#39;;
       newImg.style.border  = &#39;1px solid #888&#39;;
       return newImg;
  }
  ,
  viewResult: function (result) {

    var imgUrl = result.url;
    var srcUrl = result.originalContextUrl;
    var width = result.width;
    var height = result.height;
    var content = result.titleNoFormatting;

    var aSrc = document.getElementById(&#39;IT_ImageSrcLink&#39;);
    var aImg = document.getElementById(&#39;IT_ImageLink&#39;);
    var d = document.getElementById(&#39;IT_ImageDescription&#39;);

    if (aImg == null || aSrc == null || d == null) return;

    d.innerHTML = &#39;&#39;;
    d.appendChild(document.createTextNode(content));
    d.appendChild(document.createElement(&#39;br&#39;));
    d.appendChild(document.createTextNode(&#39;img = &#39; + imgUrl));
    d.appendChild(document.createElement(&#39;br&#39;));
    d.appendChild(document.createTextNode(&#39;src = &#39; + srcUrl));
    d.appendChild(document.createElement(&#39;br&#39;));

    var img = document.createElement(&#39;img&#39;);
    img.style.border = &#39;none&#39;;

    aSrc.href = srcUrl;

    img.alt = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
    img.src = imgUrl;

    var aW = width;
    var aH = height;

    if (aW &gt; 400) {
      aW = 400;
      aH = height * 400 / width;
    }      
    
    if (aH &gt; 400) {
       aH = 400;
       aW = width * 400 / height;
    }
    img.width = aW;
    img.height = aH;

    aImg.innerHTML = &#39;&#39;;
    aImg.href = imgUrl;
    aImg.title = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
    aImg.appendChild(img);

  }
  ,
  buildIconHtml: function (result, uid) {
    var viewScript =
       &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).src=&#39;&quot; + result.url +&quot;&#39;;&quot;
       + &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).height=&#39;&quot; + Math.floor(result.height * 450 / result.width) +&quot;&#39;;&quot;
        + &#39;return false;&#39;;

    var img = &#39;&lt;img &#39;
       + &#39; height=&quot;100&quot; &#39;
        + &#39; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot;&#39;
        + &#39; onmouseover=&quot;&#39; + viewScript + &#39;&quot;&#39;
        + &#39; alt=&quot;&#39; + document.getElementById(&#39;IT_ImageSearchResults&#39;).keyword + &#39; &#39; + (new Date).getTime()
           + &#39;&quot;&#39;
        + &#39; src=&quot;&#39; + result.url + &#39;&quot;&#39;
                      + &#39; /&gt;&#39;;
    var a = &#39;&lt;a&#39;
            + &#39; target=&quot;_blank&quot;&#39;
            + &#39; href=&quot;&#39; + result.url + &#39;&quot;&#39;
            + &#39; title=&quot;&#39; + document.getElementById(&#39;IT_ImageSearchResults&#39;).keyword + &#39; &#39; + (new Date).getTime()
               + &#39;&quot;&#39;
            + &#39; &gt;&#39;
            + img
            + &#39;&lt;/a&gt;&#39;;

    return a;
  }
  ,
  buildBin: function () {
    var bin = document.getElementById(&#39;IT_Bin&#39;);
    var uid = &#39;id_&#39;+ (new Date).getTime();

    bin.innerHTML = &#39;&#39;;
    
    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var tdView = document.createElement(&#39;td&#39;);
    var tdIcon = document.createElement(&#39;td&#39;);

    bin.appendChild(table);
    table.appendChild(tbody);
    tbody.appendChild(tr);
    tr.appendChild(tdView);
    tr.appendChild(tdIcon);

    tdIcon.style.verticalAlign = &#39;top&#39;;
    tdView.style.verticalAlign = &#39;top&#39;;

    var img = document.createElement(&#39;img&#39;);
    img.style.cssFloat = &#39;left&#39;;
    img.style.styleFloat = &#39;left&#39;;
    img.style.border = &#39;1px solid #888&#39;;
    img.style.margin = &#39;1px&#39;;
    img.style.padding = &#39;1px&#39;;
    img.width = 450;
    img.id = uid;
    img.alt = document.getElementById(&#39;IT_ImageSearchResults&#39;).keyword + &#39; &#39; + (new Date).getTime();

    if (bin.numPict &gt; 0) {
      img.src = bin.picts[bin.numPict - 1].url;
    }
    tdView.appendChild(img);

    var div = document.createElement(&#39;div&#39;);
    div.style.border = &#39;none&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    tdIcon.appendChild(div);
    
    for (var i = 0; i &lt; bin.numPict; ++i) {
      div.innerHTML += IT.buildIconHtml(bin.picts[i], uid);
    }

    var wsBlock = document.createElement(&#39;div&#39;);
    wsBlock.id = &#39;WebSearchBlock&#39;;
    bin.appendChild(wsBlock);

    for (var i = 0; i &lt; bin.numWeb; ++i) {
      wsBlock.appendChild(bin.webSites[i]);
    }
  }
  ,
  updateTextArea: function () {
    var text = document.getElementById(&#39;IT_GeneratedText&#39;);
    text.innerHTML = &#39;&#39;;
    text.appendChild(
       document.createTextNode(
         document.getElementById(&#39;IT_Bin&#39;).innerHTML));
    text.select();
  }
  ,
  addPict: function (result) {
    var div = document.getElementById(&#39;IT_Bin&#39;);
    div.picts[div.numPict++] = result;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  showImageState: function () {
    document.getElementById(&#39;IT_ImageStateInfo&#39;).innerHTML = 
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten
      + &#39;/&#39; +
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch
    ;
  }
  ,
  isComplete: function (is) {
    if (!is.results) return;
    if (is.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_ImageIconBlock&#39;);

    var results = is.results;

    document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch += results.length;
    IT.showImageState();

    if (contentDiv.previewMode == &#39;all&#39;) {
      for (var i = 0; i &lt; results.length; i++) {
        var result = results[i];

        var img = document.createElement(&#39;img&#39;);
        img.onload = (function (img, result) { return function () {
          img.onload = null;

          if (img.width != result.width || img.height != result.height) {
            sL.logger.log(&#39;drop:&#39; + result.url + &#39; w:&#39; + img.width + &#39;/&#39; + result.width + &#39; h:&#39; + img.height + &#39;/&#39; + result.height);
            return;
          }

          document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten += 1;
          IT.showImageState();
          var link =  document.createElement(&#39;a&#39;);
          link.title  = result.visibleUrl;
          link.href   = &#39;javascript:void(0);&#39;;
          link.onclick = (function (result) { return function () {
                   IT.addPict(result)
          };})(result);

          var h = 120;
          var w = (result.tbWidth * h) / result.tbHeight;
          link.appendChild(IT.buildIcon(result.tbUrl, result.visibleUrl, w, h));
          document.getElementById(&#39;IT_ImageIconBlock&#39;).appendChild(link);

        }})(img, result);
        img.src = result.url;
      }
    } else {
      for (var i = 0; i &lt; results.length; i++) {
        var result = results[i];

        var img = document.createElement(&#39;img&#39;);
        img.onload = (function (img, result) { return function () {
          img.onload = null;

          if (img.width != result.width || img.height != result.height) {
            sL.logger.log(&#39;drop:&#39; + result.url + &#39; w:&#39; + img.width + &#39;/&#39; + result.width + &#39; h:&#39; + img.height + &#39;/&#39; + result.height);
            return;
          }

          document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten += 1;
          IT.showImageState();
          var link =  document.createElement(&#39;a&#39;);
          link.title  = result.visibleUrl;
          link.href   = &#39;javascript:void(0);&#39;;
          link.onclick = (function (result) { return function () {
                   IT.addPict(result)
          };})(result);
          link.onmouseover = (function (result) { return function () {
                  IT.viewResult(result)
          };})(result);
          link.onfocus = (function (result) { return function () {
                  IT.viewResult(result)
          };})(result);

          var w = 120;
          var h = (result.tbHeight * w) / result.tbWidth;
          link.appendChild(IT.buildIcon(result.tbUrl, result.visibleUrl, w, h));
          document.getElementById(&#39;IT_ImageIconBlock&#39;).appendChild(link);

        }})(img, result);
        img.src = result.url;
      }
    }

    IT.walkAllPage(is);
  }
  ,
  switchImageView: function (mode) {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);
    div.previewMode = mode;
    IT.initImageDiv();
    IT.doImageSearch();
  }
  ,
  switchImageSize: function (size) {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);
    div.imageSize = size;
    IT.initImageDiv();
    IT.doImageSearch();
  }
  ,
  initImageDiv: function () {
    var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);

    div.innerHTML = &#39;&#39;;

    var child = document.createElement(&#39;a&#39;);
    child.name = &#39;images&#39;;
    div.appendChild(child);

    var head = document.createElement(&#39;p&#39;);
    head.appendChild(document.createTextNode(&#39;[&#39; + div.keyword + &#39;]&#39;));

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    var a = document.createElement(&#39;a&#39;);
    a.href = &#39;javascript:void(0);&#39;;
    a.onclick = IT.initBin;
    a.appendChild(document.createTextNode(&#39;Clear&#39;));
    head.appendChild(a);

    var span = document.createElement(&#39;span&#39;);
    span.innerHTML = &#39;&amp;nbsp;&#39;;
    head.appendChild(span);

    if (div.previewMode == &#39;all&#39;) {
      child = document.createElement(&#39;a&#39;);
      child.href = &#39;javascript:IT.switchImageView(&quot;preview&quot;);&#39;;
      child.innerHTML = &#39;Preview&#39;;
      head.appendChild(child);

       child = document.createElement(&#39;span&#39;);
       child.innerHTML = &#39;&amp;nbsp;&#39;;
       head.appendChild(child);

       child = document.createElement(&#39;span&#39;);
       child.innerHTML = &#39;Thumbnail&#39;;
       head.appendChild(child);

       child = document.createElement(&#39;span&#39;);
       child.innerHTML = &#39;&amp;nbsp;&#39;;
       head.appendChild(child);
    } else {
      child = document.createElement(&#39;span&#39;);
      child.innerHTML = &#39;Preview&#39;;
      head.appendChild(child);

      child = document.createElement(&#39;span&#39;);
      child.innerHTML = &#39;&amp;nbsp;&#39;;
      head.appendChild(child);

      child = document.createElement(&#39;a&#39;);
      child.href = &#39;javascript:IT.switchImageView(&quot;all&quot;);&#39;;
      child.innerHTML = &#39;Thumbnail&#39;;
      head.appendChild(child);

      child = document.createElement(&#39;span&#39;);
      child.innerHTML = &#39;&amp;nbsp;&#39;;
      head.appendChild(child);
    }

    var p = document.createElement(&#39;p&#39;);
    head.appendChild(p);
    p.appendChild(document.createTextNode(&#39;Mode:&#39;));
    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Mode&#39;;
    input.value = &#39;all&#39;;
    input.checked = (div.previewMode == &#39;all&#39;);
    input.onclick = (function (mode) { return function () {
                        IT.switchImageView(mode);
                    };})(&#39;all&#39;);
    p.appendChild(input);
    p.appendChild(document.createTextNode(&#39;Thumbnail &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Mode&#39;;
    input.value = &#39;preview&#39;;
    input.checked = (div.previewMode != &#39;all&#39;);
    input.onclick = (function (mode) { return function () {
                        IT.switchImageView(mode);
                    };})(&#39;preview&#39;);
    p.appendChild(input);
    p.appendChild(document.createTextNode(&#39;Preview &#39;));

    var p = document.createElement(&#39;p&#39;);
    head.appendChild(p);

    p.appendChild(document.createTextNode(&#39;Size:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;None&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == undefined ||
                    document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;N&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;N&#39;);
    p.appendChild(input);
    p.appendChild(document.createTextNode(&#39;None &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Small&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;S&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;S&#39;);
    p.appendChild(input);
    p.appendChild(document.createTextNode(&#39;Small &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Medium&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;M&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;M&#39;);
    p.appendChild(input);
    p.appendChild(document.createTextNode(&#39;Medium &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;Large&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;L&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;L&#39;);
    p.appendChild(input);
    p.appendChild(document.createTextNode(&#39;Large &#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;radio&#39;;
    input.name = &#39;Size&#39;;
    input.value = &#39;ExtraLarge&#39;;
    input.checked = document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize == &#39;X&#39;;
    input.onclick = (function (size) { return function () {
                        IT.switchImageSize(size)
                    };})(&#39;X&#39;);
    p.appendChild(input);
    p.appendChild(document.createTextNode(&#39;Extra Large &#39;));

    var p = document.createElement(&#39;p&#39;);
    p.id = &#39;IT_ImageStateInfo&#39;;
    head.appendChild(p);

    div.appendChild(head);

    div.style.margin  = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;

    var iconBlock = document.getElementById(&#39;IT_ImageIconBlock&#39;);
    if (iconBlock == null) {
       iconBlock = document.createElement(&#39;div&#39;);
       iconBlock.id = &#39;IT_ImageIconBlock&#39;;
    }

    iconBlock.previewMode = div.previewMode;

    if (iconBlock.previewMode == &#39;all&#39;) {
      iconBlock.style.width    = &#39;auto&#39;;
      iconBlock.style.height   = &#39;auto&#39;;
      iconBlock.style.overflow = &#39;visible&#39;;
      div.appendChild(iconBlock);
    } else {
      iconBlock.style.width    = &#39;150px&#39;;
      iconBlock.style.height   = &#39;550px&#39;;
      iconBlock.style.overflow = &#39;auto&#39;;

      var imgA = document.getElementById(&#39;IT_ImageLink&#39;);
      if (imgA == null) {
        imgA        = document.createElement(&#39;a&#39;);
        imgA.id     = &#39;IT_ImageLink&#39;;
        imgA.target = &#39;_blank&#39;;
      }

      var orgA = document.getElementById(&#39;IT_ImageSrcLink&#39;);
      if (orgA == null) {
        orgA = document.createElement(&#39;a&#39;);
        orgA.id        = &#39;IT_ImageSrcLink&#39;;
        orgA.target    = &#39;_blank&#39;;
        orgA.innerHTML = &#39;[original site]&#39;;
      }

      var descDiv = document.getElementById(&#39;IT_ImageDescription&#39;);
      if (descDiv == null) {
        descDiv = document.createElement(&#39;div&#39;);
        descDiv.id = &#39;IT_ImageDescription&#39;;
      }

      var table  = document.createElement(&#39;table&#39;);
      table.style.border = &#39;none&#39;;

      var tbody = document.createElement(&#39;tbody&#39;);
      table.style.border = &#39;none&#39;;
      table.appendChild(tbody);

      var tr     = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var viewTd = document.createElement(&#39;td&#39;);
      viewTd.style.textAlign = &#39;center&#39;;

      var viewDiv = document.createElement(&#39;div&#39;);
      viewDiv.style.width = &#39;450px&#39;;
      viewDiv.style.height = &#39;450px&#39;;
      viewDiv.style.overflow = &#39;auto&#39;;
      viewTd.appendChild(viewDiv);

      var br = document.createElement(&#39;div&#39;);
      br.style.clear = &#39;both&#39;;

      viewDiv.appendChild(imgA);
      viewDiv.appendChild(br);
      viewDiv.appendChild(orgA);
      viewDiv.appendChild(descDiv);

      var iconTd = document.createElement(&#39;td&#39;);


      tr.appendChild(viewTd);
      tr.appendChild(iconTd);
      iconTd.appendChild(iconBlock);

      div.appendChild(table);
    }
  }
  ,
  doImageSearch: function () {
      var imageSearch = new google.search.ImageSearch();
          
      /*
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_MEDIUM);
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
      */

      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGETYPE,
           google.search.ImageSearch.IMAGETYPE_PHOTO);

      imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
          
      imageSearch.setSearchCompleteCallback(this, IT.isComplete, [imageSearch]);
          
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numSearch = 0;
      document.getElementById(&#39;IT_ImageSearchResults&#39;).numGotten = 0;

      switch (document.getElementById(&#39;IT_ImageSearchResults&#39;).imageSize) {
        case &#39;N&#39;: break;
        default: break;
        case &#39;S&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_SMALL);
          break;
        case &#39;M&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_MEDIUM);
          break;
        case &#39;L&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_LARGE);
          break;
        case &#39;X&#39;:
          imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                     google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
          break;
      }
      /*
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
      */

      imageSearch.execute(
        document.getElementById(&#39;IT_ImageSearchResults&#39;).keyword
      );
  }
  ,
  addWebSite: function (html) {
    var div = document.getElementById(&#39;IT_Bin&#39;);

    div.webSites[div.numWeb++] = html;
    IT.buildBin();
    IT.updateTextArea();
  }
  ,
  wsComplete: function (ws) {
    if (!ws.results) return;
    if (ws.results.length &lt;= 0) return;

    var contentDiv = document.getElementById(&#39;IT_WebListBlock&#39;);
    var results = ws.results;

    var table = document.createElement(&#39;table&#39;);
    contentDiv.appendChild(table);

    var tbody = document.createElement(&#39;tbody&#39;);
    table.appendChild(tbody);
   
    for (var i = 0; i &lt; results.length; i++) {
      var result = results[i];
      
      var tr = document.createElement(&#39;tr&#39;);
      tbody.appendChild(tr);

      var tdButton = document.createElement(&#39;td&#39;);
      tr.appendChild(tdButton);

      var tdContent = document.createElement(&#39;td&#39;);
      // tdContent.appendChild(result.html.cloneNode(true));
      tr.appendChild(tdContent);
      tdContent.style.border = &#39;1px solid #888&#39;;
      tdContent.style.margin = &#39;1px&#39;;

      var content = document.createElement(&#39;p&#39;);
      var a = document.createElement(&#39;a&#39;);
      a.href = result.unescapedUrl;
      a.target = &#39;_blank&#39;;
      a.appendChild(document.createTextNode(result.titleNoFormatting));
      content.appendChild(a);
      content.appendChild(document.createTextNode(&#39; - &#39; + result.visibleUrl));
      content.appendChild(document.createElement(&#39;br&#39;));
      var span = document.createElement(&#39;span&#39;);
      span.innerHTML = result.content;
      content.appendChild(span);
      tdContent.appendChild(content);
      
      var form = document.createElement(&#39;form&#39;);
      tdButton.appendChild(form);
      
      var p = document.createElement(&#39;p&#39;);
      form.appendChild(p);
      
      var button = document.createElement(&#39;input&#39;);
      button.type = &#39;button&#39;;
      button.value = &#39;Add&#39;;
      button.onclick = 
             (function (html) {
                return function () {
                  IT.addWebSite(html)
                };
             })(content.cloneNode(true));
      p.appendChild(button);
    }

    IT.walkAllPage(ws);
  }
  ,
  doWebSearch: function () {
      var webSearch = new google.search.WebSearch();
          
      // webSearch.setNoHtmlGeneration();

      webSearch.setRestriction(google.search.ImageSearch.RESTRICT_SAFESEARCH,
                                 google.search.Search.SAFESEARCH_OFF);

      webSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
          
      webSearch.setSearchCompleteCallback(this, IT.wsComplete, [webSearch]);
          
      document.getElementById(&#39;IT_WebListBlock&#39;).innerHTML = &#39;&#39;;

      webSearch.execute(document.getElementById(&#39;IT_WebSearchResults&#39;).keyword);
  }
  ,
  initWebDiv: function () {
    var div = document.getElementById(&#39;IT_WebSearchResults&#39;);

    div.innerHTML = &#39;&#39;;

    var table = document.createElement(&#39;table&#39;);
    var tbody = document.createElement(&#39;tbody&#39;);
    var tr = document.createElement(&#39;tr&#39;);
    var td = document.createElement(&#39;td&#39;);
    var tdDiv = document.createElement(&#39;div&#39;);
    tdDiv.id = &#39;IT_WebListBlock&#39;;
    tdDiv.style.overflow = &#39;auto&#39;;
    tdDiv.style.height = &#39;250px&#39;;

    div.appendChild(table);
    table.appendChild(tbody);
    tbody.appendChild(tr);
    tr.appendChild(td);
    td.appendChild(tdDiv);
  }
  ,
  mining: function (target1, target2, keyword) {
    var imageDiv = document.getElementById(target1);
    var webDiv = document.getElementById(target2);

    if (!imageDiv || !webDiv) return;

    imageDiv.innerHTML = &#39;&#39;;
    webDiv.innerHTML = &#39;&#39;;

    var div =  document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageSearchResults&#39;;
    div.previewMode = &#39;preview&#39;;
    div.keyword = keyword;
    imageDiv.appendChild(div);
    IT.initImageDiv();

    var div =  document.createElement(&#39;div&#39;);
    div.id = &#39;IT_WebSearchResults&#39;;
    div.previewMode = &#39;preview&#39;;
    div.keyword = keyword;
    webDiv.appendChild(div);
    IT.initWebDiv();

    IT.doImageSearch();
    IT.doWebSearch();

  }
  ,
  initBin: function () {
    var bin = document.getElementById(&#39;IT_Bin&#39;);

    bin.numPict = 0;
    bin.numWeb = 0;
    bin.innerHTML = &#39;&#39;;

    IT.updateTextArea();

    return false;
  }
  ,
  clickSearch: function () {
    var text = document.getElementById(&#39;IT_SearchKey&#39;);
    IT.mining(&#39;IT_ImageList&#39;, &#39;IT_WebList&#39;, text.value);
    IT.initBin();

    return false;
  }
  ,
  putLabel: function (parent, place) {
    var label = &#39;&#39;;
    
    switch (place) {
    case 0: label = &#39;ToolTop&#39;;
            break;
    case 1: label = &#39;ImageResults&#39;;
            break;
    case 2: label = &#39;WebResults&#39;;
            break;
    case 3: label = &#39;GeneratedHTML&#39;;
            break;
    }

    var p = document.createElement(&#39;p&#39;);
    parent.appendChild(p);

    var a = document.createElement(&#39;a&#39;);
    a.name = label;
    p.appendChild(a);

    label = &#39;ToolTop&#39;;
    var tn = document.createTextNode(label);
    if (place == 0) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;ImageResults&#39;;
    var tn = document.createTextNode(label);
    if (place == 1) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;WebResults&#39;;
    var tn = document.createTextNode(label);
    if (place == 2) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

    p.appendChild(document.createTextNode(&#39; &#39;));

    label = &#39;GeneratedHTML&#39;;
    var tn = document.createTextNode(label);
    if (place == 3) {
      p.appendChild(tn);
    } else {
      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;#&#39; + label;
      a.appendChild(tn);
      p.appendChild(a);
    }

  }
  ,
  begin: function (place) {
    //sL.logger.enable();

    var placeDiv = document.getElementById(place);
    placeDiv.style.border = &#39;1px solid #888&#39;;
    placeDiv.style.padding = &#39;1px&#39;;

    IT.putLabel(placeDiv, 0);
    
    var form = document.createElement(&#39;form&#39;);
    form.style.verticalAlign = &#39;top&#39;;
    form.onsubmit = IT.clickSearch;
    placeDiv.appendChild(form);

    var p = document.createElement(&#39;p&#39;);
    form.id = &#39;IT_InputForm&#39;;
    form.appendChild(p);

    p.appendChild(document.createTextNode(&#39;Keyword:&#39;));

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;text&#39;;
    input.id = &#39;IT_SearchKey&#39;;
    p.appendChild(input);

    var input = document.createElement(&#39;input&#39;);
    input.type = &#39;button&#39;;
    input.value = &#39;Search&#39;;
    input.onclick = IT.clickSearch;
    p.appendChild(input);

    IT.putLabel(placeDiv, 1);

    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_ImageList&#39;;
    div.style.border = &#39;1px solid #888&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    placeDiv.appendChild(div);

    IT.putLabel(placeDiv, 2);
    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_WebList&#39;;
    div.style.border = &#39;1px solid #888&#39;;
    div.style.margin = &#39;1px&#39;;
    div.style.padding = &#39;1px&#39;;
    placeDiv.appendChild(div);
    
    var div = document.createElement(&#39;div&#39;);
    div.id = &#39;IT_Bin&#39;
    div.style.border = &#39;1px solid #888&#39;;
    div.picts = new Array;
    div.numPict = 0;
    div.webSites = new Array;
    div.numWeb = 0;
    placeDiv.appendChild(div);

    IT.putLabel(placeDiv, 3);

    var gentext = document.createElement(&#39;div&#39;);
    var form = document.createElement(&#39;form&#39;);
    gentext.appendChild(form);

    var form = document.createElement(&#39;form&#39;);
    placeDiv.appendChild(form);

    var p = document.createElement(&#39;p&#39;);
    form.appendChild(p);

    var textArea = document.createElement(&#39;textarea&#39;);
    textArea.rows = 20;
    textArea.cols = 60;
    textArea.id = &#39;IT_GeneratedText&#39;;
    p.appendChild(textArea);
  }
};

//--&gt;
&lt;/script&gt;

&lt;!--&lt;div style=&quot;height:200px;overflow:auto;&quot; id=&quot;slLogArea&quot;&gt;log area&lt;/div&gt;--&gt;

&lt;div id=&quot;tool-pane&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
    IT.begin(&#39;tool-pane&#39;);
//--&gt;
&lt;/script&gt;
&lt;noscript&gt;Sorry, you have to enable javascript.&lt;/noscript&gt;

&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/4802181120415572705/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/04/ver13.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/4802181120415572705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/4802181120415572705'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/04/ver13.html' title='サムネイル・プレビュー作成ツール ver.1.3'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-4464588854930824181</id><published>2010-04-18T22:01:00.027+09:00</published><updated>2010-04-19T23:53:48.073+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="実験"/><title type='text'>test thumbnail...</title><content type='html'>&lt;script type=&quot;text/javascript&quot; src=&quot;http://sharri.web.fc2.com/JSlab/SL.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--

  var IL = {
    step: 20,
    current: 1,
    domain: &#39;light-is-right-kias&#39;,
    tbSize: 100,
    log: function (l) {
//      console.log(l);
    }
    ,
    getFeed: function (data) {
      var num = this.build(data);
      this.log(&#39;feed_recieve=&#39; + num);
    }
    ,
    fetch: function (start) {
      if (start &gt; 0) this.current = start;
      var startIndex = this.current;
      var maxResults = this.step;
      var order = &#39;posts&#39;;
      var redirect = false;

      var script = document.createElement(&#39;script&#39;);
      script.src =
        &#39;http://&#39; + encodeURIComponent(this.domain) +
        &#39;.blogspot.com/feeds/&#39; + order +
        &#39;/default?redirect=&#39; + redirect +
        //&#39;&amp;orderby=updated&#39; +
        &#39;&amp;start-index=&#39; + startIndex +
        &#39;&amp;max-results=&#39; + maxResults +
        &#39;&amp;alt=json-in-script&amp;callback=IL.getFeed&#39;;
      script.type = &#39;text/javascript&#39;;
      document.documentElement.firstChild.appendChild(script);
    }
    ,
    findImgUrl: function (str) {
      var srcImg = str.match(/&lt;img[^&gt;]*&gt;/);
      if (srcImg == null) return null;

      this.log(&#39;srcImg.length:&#39; + srcImg.length);

      var src = srcImg[0].match(/src=\&quot;[^\&quot;]*\&quot;/);
      if (src == null) return null;

      return src[0].substring(
               src[0].indexOf(&#39;&quot;&#39;) + 1,
               src[0].lastIndexOf(&#39;&quot;&#39;)
             );
    }
    ,
    buildTextLink: function (linkSrc, imgSrc, title) {
      var a = document.createElement(&#39;a&#39;);
      a.title = title;
      a.href = linkSrc;
      a.innerHTML = &#39;&amp;nbsp;&#39; +  title + &#39;&amp;nbsp;&#39;;
      return a;
    }
    ,
    buildImgLink: function (linkSrc, imgSrc, title) {

      var span = document.createElement(&#39;span&#39;);
      var a = document.createElement(&#39;a&#39;);
      a.title = title;
      a.href = linkSrc;
      /*
      a.innerHTML = &#39;&lt;img border=&quot;0&quot; height=&quot;100&quot;&#39; + 
                        &#39; src=&quot;&#39; + imgSrc + &#39;&quot;&#39; +
                        &#39; alt=&quot;&#39; + title + &#39;&quot;&#39; +
                        &#39;/&gt;&#39;;
      */

      var img = document.createElement(&#39;img&#39;);
      img.border = 0;
      img.alt = title;
      img.height = IL.tbSize;
      a.appendChild(img);
      span.appendChild(a);

      img.onload = (function (img, link, span) {
                       return function () {
                         link.innerHTML = &#39;&#39;;
                         span.appendChild(
                           sL.image.buildSquareFrame(IL.tbSize, img, link)
                         );
                         img.onload = null;
                       };
                    })(img, a, span);

      img.src = imgSrc;

      return span;
    }
    ,
    build: function (data) {
    
      var entries = data.feed.entry;
      var num = 0;

      var header = document.getElementById(&#39;list-head&#39;);
      var textList = document.getElementById(&#39;text-list&#39;);
      var thumbnail = document.getElementById(&#39;thumbnail-block&#39;);

      header.innerHTML = &#39;&#39;;
      textList.innerHTML = &#39;&#39;;
      thumbnail.innerHTML = &#39;&#39;;

      var info = document.getElementById(&#39;archiveinfo&#39;);
      if (info != null) {
        var numPosts = info.numPosts;
      } else {
        var numPosts = 100;
      }

      var frame = 0;
      for (var i = 0; i &lt; numPosts; i += this.step) {
        ++frame;

        if ((i + 1) == this.current) {
          header.appendChild(document.createTextNode(&#39; &#39; + frame + &#39; &#39;));
          continue;
        }

        var a = document.createElement(&#39;a&#39;);
        a.appendChild(document.createTextNode(frame));
        a.href = &#39;javascript:void(0);&#39;;
        a.onclick = (function (start) {
                       return function () {
                         IL.fetch(start)
                       };
                     })(i + 1);

        header.appendChild(document.createTextNode(&#39; &#39;));
        header.appendChild(a);
        header.appendChild(document.createTextNode(&#39; &#39;));
      }

      for (var i = 0; i &lt; entries.length; ++i) {
        var entry = entries[i];
        var alink = &#39;&#39;;

        for (var k = 0; k &lt; entry.link.length; k++) {
          if (entry.link[k].rel == &#39;alternate&#39;) {
            alink = entry.link[k].href;
            break;
          }
        }

        var srcUrl = this.findImgUrl(entry.content.$t);
        if (srcUrl == null) continue;

        this.log(&#39;srcUrl:&#39; + srcUrl);
        ++num;

        var div = document.createElement(&#39;div&#39;);
        div.style.width = &#39;100px&#39;;
        div.style.height = &#39;100px&#39;;
        div.style.backgroundColor = &#39;#FFFFFF&#39;;
        div.style.border = &#39;1px outset&#39;;
        div.style.overflow = &#39;hidden&#39;;
        div.style.textAlign = &#39;center&#39;;
        div.style.margin = &#39;1px&#39;;
        div.style.padding = &#39;0px&#39;;
        div.style.cssFloat = &#39;left&#39;;
        div.style.styleFloat = &#39;left&#39;;
        thumbnail.appendChild(div);

        div.appendChild(this.buildImgLink(alink, srcUrl, entry.title.$t));
        textList.appendChild(this.buildTextLink(alink, srcUrl, entry.title.$t));
      }

      return num;
    }
  };

  google.setOnLoadCallback(
    function () {
      IL.fetch(1);
    }
  );
//--&gt;
&lt;/script&gt;

&lt;div&gt;
&lt;div style=&quot;text-align:center;&quot; id=&quot;list-head&quot;&gt;
&lt;/div&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td style=&quot;width:125px;border:1px outset;vertical-align:top;&quot; id=&quot;text-list&quot;&gt;
&lt;/td&gt;
&lt;td style=&quot;vertical-align:top;&quot; id=&quot;thumbnail-block&quot;&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/4464588854930824181/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/04/test-thumbnail_18.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/4464588854930824181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/4464588854930824181'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/04/test-thumbnail_18.html' title='test thumbnail...'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281412490715734218.post-3501399823693934728</id><published>2010-04-17T03:38:00.004+09:00</published><updated>2010-04-22T23:22:32.030+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ツール"/><title type='text'>サムネイル・プレビュー作成ツール ver.1.2</title><content type='html'>&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
google.load(&#39;search&#39;, &#39;1&#39;);
//--&gt;
&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
    function it_walkAllPage(s) {
      var cursor = s.cursor;
      var next = cursor.currentPageIndex + 1;
      if (next &gt;= cursor.pages.length) return;
      s.gotoPage(next);
    }
    
    function it_buildIcon(url, alt, width, height) {
         var newImg = document.createElement(&#39;img&#39;);
         newImg.alt           = alt;
         newImg.src           = url;
         newImg.height        = height;
         newImg.width         = width;
         newImg.style.margin  = &#39;1px&#39;;
         newImg.style.padding = &#39;1px&#39;;
         newImg.style.border  = &#39;1px solid #888&#39;;
         return newImg;
    }

    function it_viewResult(result) {

      var imgUrl = result.url;
      var srcUrl = result.originalContextUrl;
      var width = result.width;
      var height = result.height;
      var content = result.titleNoFormatting;

      var aSrc = document.getElementById(&#39;IT_ImageSrcLink&#39;);
      var aImg = document.getElementById(&#39;IT_ImageLink&#39;);
      var d = document.getElementById(&#39;IT_ImageDescription&#39;);

      if (aImg == null || aSrc == null || d == null) return;

      d.innerHTML = &#39;&#39;;
      d.appendChild(document.createTextNode(content));
      d.appendChild(document.createElement(&#39;br&#39;));
      d.appendChild(document.createTextNode(&#39;img = &#39; + imgUrl));
      d.appendChild(document.createElement(&#39;br&#39;));
      d.appendChild(document.createTextNode(&#39;src = &#39; + srcUrl));
      d.appendChild(document.createElement(&#39;br&#39;));

      var img = document.createElement(&#39;img&#39;);
      img.style.border = &#39;none&#39;;

      aSrc.href = srcUrl;

      img.alt = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
      img.src = imgUrl;

      var aW = width;
      var aH = height;

      if (aW &gt; 400) {
        aW = 400;
        aH = height * 400 / width;
      }      
      
      if (aH &gt; 400) {
         aH = 400;
         aW = width * 400 / height;
      }
      img.width = aW;
      img.height = aH;

/*
      if (width &gt; height) {
         if (width &gt; 400) {
           img.width = 400;
           img.height = height * 400 / width;
         } else {
           img.width = width;
           img.height = height;
         }

      } else {
         if (height &gt; 400) {
           img.height = 400;
           img.width = width * 400 / height;
         } else {
           img.width = width;
           img.height = height;
         }
      }
*/

      aImg.innerHTML = &#39;&#39;;
      aImg.href = imgUrl;
      aImg.title = imgUrl + &#39; (&#39; + width + &#39;x&#39; + height + &#39;)&#39;;
      aImg.appendChild(img);

    }

    function it_buildIconHtml(result, uid) {
      var viewScript =
         &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).src=&#39;&quot; + result.url +&quot;&#39;;&quot;
         + &quot;document.getElementById(&#39;&quot; + uid + &quot;&#39;).height=&#39;&quot; + Math.floor(result.height * 450 / result.width) +&quot;&#39;;&quot;
          + &#39;return false;&#39;;

      var img = &#39;&lt;img &#39;
         + &#39; height=&quot;100&quot; &#39;
          + &#39; style=&quot;border:1px solid #888;margin:1px;padding:1px&quot;&#39;
          + &#39; onmouseover=&quot;&#39; + viewScript + &#39;&quot;&#39;
          + &#39; alt=&quot;&#39; + document.getElementById(&#39;IT_ImageSearchResults&#39;).keyword + &#39; &#39; + (new Date).getTime()
             + &#39;&quot;&#39;
          + &#39; src=&quot;&#39; + result.url + &#39;&quot;&#39;
                        + &#39; /&gt;&#39;;
      var a = &#39;&lt;a&#39;
              + &#39; target=&quot;_blank&quot;&#39;
              + &#39; href=&quot;&#39; + result.url + &#39;&quot;&#39;
              + &#39; title=&quot;&#39; + document.getElementById(&#39;IT_ImageSearchResults&#39;).keyword + &#39; &#39; + (new Date).getTime()
                 + &#39;&quot;&#39;
              + &#39; &gt;&#39;
              + img
              + &#39;&lt;/a&gt;&#39;;

      return a;
    }

    function it_buildBin() {
      var bin = document.getElementById(&#39;IT_Bin&#39;);
      var uid = &#39;id_&#39;+ (new Date).getTime();

      bin.innerHTML = &#39;&#39;;
      
      var table = document.createElement(&#39;table&#39;);
      var tbody = document.createElement(&#39;tbody&#39;);
      var tr = document.createElement(&#39;tr&#39;);
      var tdView = document.createElement(&#39;td&#39;);
      var tdIcon = document.createElement(&#39;td&#39;);

      bin.appendChild(table);
      table.appendChild(tbody);
      tbody.appendChild(tr);
      tr.appendChild(tdView);
      tr.appendChild(tdIcon);

      tdIcon.style.verticalAlign = &#39;top&#39;;
      tdView.style.verticalAlign = &#39;top&#39;;

      var img = document.createElement(&#39;img&#39;);
      img.style.cssFloat = &#39;left&#39;;
      img.style.styleFloat = &#39;left&#39;;
      img.style.border = &#39;1px solid #888&#39;;
      img.style.margin = &#39;1px&#39;;
      img.style.padding = &#39;1px&#39;;
      img.width = 450;
      img.id = uid;
      img.alt = document.getElementById(&#39;IT_ImageSearchResults&#39;).keyword + &#39; &#39; + (new Date).getTime();

      if (bin.numPict &gt; 0) {
        img.src = bin.picts[bin.numPict - 1].url;
      }
      tdView.appendChild(img);

      var div = document.createElement(&#39;div&#39;);
      div.style.border = &#39;none&#39;;
      div.style.margin = &#39;1px&#39;;
      div.style.padding = &#39;1px&#39;;
      tdIcon.appendChild(div);
      
      for (var i = 0; i &lt; bin.numPict; ++i) {
        div.innerHTML += it_buildIconHtml(bin.picts[i], uid);
      }

      var wsBlock = document.createElement(&#39;div&#39;);
      wsBlock.id = &#39;WebSearchBlock&#39;;
      bin.appendChild(wsBlock);

      for (var i = 0; i &lt; bin.numWeb; ++i) {
        wsBlock.appendChild(bin.webSites[i]);
      }
    }

    function it_updateTextArea() {
      var text = document.getElementById(&#39;IT_GeneratedText&#39;);
      text.innerHTML = &#39;&#39;;
      text.appendChild(
         document.createTextNode(
           document.getElementById(&#39;IT_Bin&#39;).innerHTML));
      text.select();
    }

    function it_addPict(result) {
      var div = document.getElementById(&#39;IT_Bin&#39;);

      div.picts[div.numPict++] = result;
      it_buildBin();
      it_updateTextArea();
    }

    function it_isComplete(is) {
      if (!is.results) return;
      if (is.results.length &lt;= 0) return;

      var contentDiv = document.getElementById(&#39;IT_ImageIconBlock&#39;);

      var results = is.results;

      if (contentDiv.previewMode == &#39;all&#39;) {
         for (var i = 0; i &lt; results.length; i++) {
           var result = results[i];

           var link =  document.createElement(&#39;a&#39;);
           link.title  = result.visibleUrl;
           link.href   = &#39;javascript:void(0);&#39;;
           link.onclick = 
               (function (result) {
                  return function () {
                    it_addPict(result)
                  };
               })(result);

           var h = 120;
           var w = (result.tbWidth * h) / result.tbHeight;
           link.appendChild(it_buildIcon(result.tbUrl, result.visibleUrl, w, h));
           contentDiv.appendChild(link);
         }
      } else {
         for (var i = 0; i &lt; results.length; i++) {
           var result = results[i];

           var link =  document.createElement(&#39;a&#39;);
           link.title  = result.visibleUrl;
           link.href   = &#39;javascript:void(0);&#39;;
           link.onclick = 
               (function (result) {
                  return function () {
                    it_addPict(result)
                  };
               })(result);
           link.onmouseover =
               (function (result) {
                  return function () {
                    it_viewResult(result)
                  };
               })(result);

           var w = 120;

           var h = (result.tbHeight * w) / result.tbWidth;
           link.appendChild(it_buildIcon(result.tbUrl, result.visibleUrl, w, h));
           contentDiv.appendChild(link);
         }

         if (is.cursor.currentPageIndex == 0) {
           it_viewResult(results[0]);
         }
      }

      it_walkAllPage(is);
    }
    
    function it_switchImageView(mode) {
      var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);
      div.previewMode = mode;
      it_initImageDiv();
      it_doImageSearch();
    }

    function it_initImageDiv() {
      var div = document.getElementById(&#39;IT_ImageSearchResults&#39;);

      div.innerHTML = &#39;&#39;;

      var child = document.createElement(&#39;a&#39;);
      child.name = &#39;images&#39;;
      div.appendChild(child);

      var head = document.createElement(&#39;h3&#39;);
      head.appendChild(document.createTextNode(&#39;[&#39; + div.keyword + &#39;]&#39;));

      var span = document.createElement(&#39;span&#39;);
      span.innerHTML = &#39;&amp;nbsp;&#39;;
      head.appendChild(span);

      var a = document.createElement(&#39;a&#39;);
      a.href = &#39;javascript:void(0);&#39;;
      a.onclick = it_initBin;
      a.appendChild(document.createTextNode(&#39;Clear&#39;));
      head.appendChild(a);

      var span = document.createElement(&#39;span&#39;);
      span.innerHTML = &#39;&amp;nbsp;&#39;;
      head.appendChild(span);

      if (div.previewMode == &#39;all&#39;) {
        child = document.createElement(&#39;a&#39;);
        child.href = &#39;javascript:it_switchImageView(&quot;preview&quot;);&#39;;
        child.innerHTML = &#39;Preview&#39;;
        head.appendChild(child);

         child = document.createElement(&#39;span&#39;);
         child.innerHTML = &#39;&amp;nbsp;&#39;;
         head.appendChild(child);

         child = document.createElement(&#39;span&#39;);
         child.innerHTML = &#39;Thumbnail&#39;;
         head.appendChild(child);

         child = document.createElement(&#39;span&#39;);
         child.innerHTML = &#39;&amp;nbsp;&#39;;
         head.appendChild(child);
      } else {
        child = document.createElement(&#39;span&#39;);
        child.innerHTML = &#39;Preview&#39;;
        head.appendChild(child);

        child = document.createElement(&#39;span&#39;);
        child.innerHTML = &#39;&amp;nbsp;&#39;;
        head.appendChild(child);

        child = document.createElement(&#39;a&#39;);
        child.href = &#39;javascript:it_switchImageView(&quot;all&quot;);&#39;;
        child.innerHTML = &#39;Thumbnail&#39;;
        head.appendChild(child);

        child = document.createElement(&#39;span&#39;);
        child.innerHTML = &#39;&amp;nbsp;&#39;;
        head.appendChild(child);
      }

      div.appendChild(head);

      div.style.margin  = &#39;1px&#39;;
      div.style.padding = &#39;1px&#39;;

      var iconBlock = document.getElementById(&#39;IT_ImageIconBlock&#39;);
      if (iconBlock == null) {
         iconBlock = document.createElement(&#39;div&#39;);
         iconBlock.id = &#39;IT_ImageIconBlock&#39;;
      }

      iconBlock.previewMode = div.previewMode;

      if (iconBlock.previewMode == &#39;all&#39;) {
        iconBlock.style.width    = &#39;auto&#39;;
        iconBlock.style.height   = &#39;auto&#39;;
        iconBlock.style.overflow = &#39;visible&#39;;
        div.appendChild(iconBlock);
      } else {
        iconBlock.style.width    = &#39;150px&#39;;
        iconBlock.style.height   = &#39;550px&#39;;
        iconBlock.style.overflow = &#39;auto&#39;;

        var imgA = document.getElementById(&#39;IT_ImageLink&#39;);
        if (imgA == null) {
          imgA        = document.createElement(&#39;a&#39;);
          imgA.id     = &#39;IT_ImageLink&#39;;
          imgA.target = &#39;_blank&#39;;
        }

        var orgA = document.getElementById(&#39;IT_ImageSrcLink&#39;);
        if (orgA == null) {
          orgA = document.createElement(&#39;a&#39;);
          orgA.id        = &#39;IT_ImageSrcLink&#39;;
          orgA.target    = &#39;_blank&#39;;
          orgA.innerHTML = &#39;[original site]&#39;;
        }

        var descDiv = document.getElementById(&#39;IT_ImageDescription&#39;);
        if (descDiv == null) {
          descDiv = document.createElement(&#39;div&#39;);
          descDiv.id = &#39;IT_ImageDescription&#39;;
        }

        var table  = document.createElement(&#39;table&#39;);
        table.style.border = &#39;none&#39;;

        var tbody = document.createElement(&#39;tbody&#39;);
        table.style.border = &#39;none&#39;;
        table.appendChild(tbody);

        var tr     = document.createElement(&#39;tr&#39;);
        tbody.appendChild(tr);

        var viewTd = document.createElement(&#39;td&#39;);
        viewTd.style.textAlign = &#39;center&#39;;

        var viewDiv = document.createElement(&#39;div&#39;);
        viewDiv.style.width = &#39;450px&#39;;
        viewDiv.style.height = &#39;450px&#39;;
        viewDiv.style.overflow = &#39;auto&#39;;
        viewTd.appendChild(viewDiv);

        var br = document.createElement(&#39;div&#39;);
        br.style.clear = &#39;both&#39;;

        viewDiv.appendChild(imgA);
        viewDiv.appendChild(br);
        viewDiv.appendChild(orgA);
        viewDiv.appendChild(descDiv);

        var iconTd = document.createElement(&#39;td&#39;);


        tr.appendChild(viewTd);
        tr.appendChild(iconTd);
        iconTd.appendChild(iconBlock);

        div.appendChild(table);
      }
    }

    function it_doImageSearch() {
        var imageSearch = new google.search.ImageSearch();
            
        /*
        imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                   google.search.ImageSearch.IMAGESIZE_MEDIUM);
        imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                   google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
        */

        imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGETYPE,
             google.search.ImageSearch.IMAGETYPE_PHOTO);

        imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
            
        imageSearch.setSearchCompleteCallback(this, it_isComplete, [imageSearch]);
            
        /*
        imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                   google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE);
        */

        imageSearch.execute(
          document.getElementById(&#39;IT_ImageSearchResults&#39;).keyword
        );
    }

    function it_addWebSite(html) {
      var div = document.getElementById(&#39;IT_Bin&#39;);

      div.webSites[div.numWeb++] = html;
      it_buildBin();
      it_updateTextArea();
    }

    function it_wsComplete(ws) {
      if (!ws.results) return;
      if (ws.results.length &lt;= 0) return;

      var contentDiv = document.getElementById(&#39;IT_WebListBlock&#39;);
      var results = ws.results;

      var table = document.createElement(&#39;table&#39;);
      contentDiv.appendChild(table);

      var tbody = document.createElement(&#39;tbody&#39;);
      table.appendChild(tbody);
     
      for (var i = 0; i &lt; results.length; i++) {
        var result = results[i];
        
        var tr = document.createElement(&#39;tr&#39;);
        tbody.appendChild(tr);

        var tdButton = document.createElement(&#39;td&#39;);
        tr.appendChild(tdButton);

        var tdContent = document.createElement(&#39;td&#39;);
        // tdContent.appendChild(result.html.cloneNode(true));
        tr.appendChild(tdContent);
        tdContent.style.border = &#39;1px solid #888&#39;;
        tdContent.style.margin = &#39;1px&#39;;

        var content = document.createElement(&#39;p&#39;);
        var a = document.createElement(&#39;a&#39;);
        a.href = result.unescapedUrl;
        a.target = &#39;_blank&#39;;
        a.appendChild(document.createTextNode(result.titleNoFormatting));
        content.appendChild(a);
        content.appendChild(document.createTextNode(&#39; - &#39; + result.visibleUrl));
        content.appendChild(document.createElement(&#39;br&#39;));
        var span = document.createElement(&#39;span&#39;);
        span.innerHTML = result.content;
        content.appendChild(span);
        tdContent.appendChild(content);
        
        var form = document.createElement(&#39;form&#39;);
        tdButton.appendChild(form);
        
        var p = document.createElement(&#39;p&#39;);
        form.appendChild(p);
        
        var button = document.createElement(&#39;input&#39;);
        button.type = &#39;button&#39;;
        button.value = &#39;Add&#39;;
        button.onclick = 
               (function (html) {
                  return function () {
                    it_addWebSite(html)
                  };
               })(content.cloneNode(true));
        p.appendChild(button);
      }

      it_walkAllPage(ws);
    }

    function it_doWebSearch() {
        var webSearch = new google.search.WebSearch();
            
        // webSearch.setNoHtmlGeneration();

        webSearch.setRestriction(google.search.ImageSearch.RESTRICT_SAFESEARCH,
                                   google.search.Search.SAFESEARCH_OFF);

        webSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
            
        webSearch.setSearchCompleteCallback(this, it_wsComplete, [webSearch]);
            
        document.getElementById(&#39;IT_WebListBlock&#39;).innerHTML = &#39;&#39;;

        webSearch.execute(document.getElementById(&#39;IT_WebSearchResults&#39;).keyword);
    }

    function it_initWebDiv() {
      var div = document.getElementById(&#39;IT_WebSearchResults&#39;);

      div.innerHTML = &#39;&#39;;

      var table = document.createElement(&#39;table&#39;);
      var tbody = document.createElement(&#39;tbody&#39;);
      var tr = document.createElement(&#39;tr&#39;);
      var td = document.createElement(&#39;td&#39;);
      var tdDiv = document.createElement(&#39;div&#39;);
      tdDiv.id = &#39;IT_WebListBlock&#39;;
      tdDiv.style.overflow = &#39;auto&#39;;
      tdDiv.style.height = &#39;250px&#39;;

      div.appendChild(table);
      table.appendChild(tbody);
      tbody.appendChild(tr);
      tr.appendChild(td);
      td.appendChild(tdDiv);
    }

    function it_mining(target1, target2, keyword) {
      var imageDiv = document.getElementById(target1);
      var webDiv = document.getElementById(target2);

      if (!imageDiv || !webDiv) return;

      imageDiv.innerHTML = &#39;&#39;;
      webDiv.innerHTML = &#39;&#39;;

      var div =  document.createElement(&#39;div&#39;);
      div.id = &#39;IT_ImageSearchResults&#39;;
      div.previewMode = &#39;preview&#39;;
      div.keyword = keyword;
      imageDiv.appendChild(div);
      it_initImageDiv();

      var div =  document.createElement(&#39;div&#39;);
      div.id = &#39;IT_WebSearchResults&#39;;
      div.previewMode = &#39;preview&#39;;
      div.keyword = keyword;
      webDiv.appendChild(div);
      it_initWebDiv();

      it_doImageSearch();
      it_doWebSearch();

    }

    function it_initBin() {
      var bin = document.getElementById(&#39;IT_Bin&#39;);

      bin.numPict = 0;
      bin.numWeb = 0;
      bin.innerHTML = &#39;&#39;;

      it_updateTextArea();

      return false;
    }

    function it_clickSearch() {
      var text = document.getElementById(&#39;IT_SearchKey&#39;);
      it_mining(&#39;IT_ImageList&#39;, &#39;IT_WebList&#39;, text.value);
      it_initBin();

      return false;
    }

    function it_putLabel(parent, place) {
      var label = &#39;&#39;;
      
      switch (place) {
      case 0: label = &#39;ToolTop&#39;;
              break;
      case 1: label = &#39;ImageResults&#39;;
              break;
      case 2: label = &#39;WebResults&#39;;
              break;
      case 3: label = &#39;GeneratedHTML&#39;;
              break;
      }

      var p = document.createElement(&#39;p&#39;);
      parent.appendChild(p);

      var a = document.createElement(&#39;a&#39;);
      a.name = label;
      p.appendChild(a);

      label = &#39;ToolTop&#39;;
      var tn = document.createTextNode(label);
      if (place == 0) {
        p.appendChild(tn);
      } else {
        var a = document.createElement(&#39;a&#39;);
        a.href = &#39;#&#39; + label;
        a.appendChild(tn);
        p.appendChild(a);
      }

      p.appendChild(document.createTextNode(&#39; &#39;));

      label = &#39;ImageResults&#39;;
      var tn = document.createTextNode(label);
      if (place == 1) {
        p.appendChild(tn);
      } else {
        var a = document.createElement(&#39;a&#39;);
        a.href = &#39;#&#39; + label;
        a.appendChild(tn);
        p.appendChild(a);
      }

      p.appendChild(document.createTextNode(&#39; &#39;));

      label = &#39;WebResults&#39;;
      var tn = document.createTextNode(label);
      if (place == 2) {
        p.appendChild(tn);
      } else {
        var a = document.createElement(&#39;a&#39;);
        a.href = &#39;#&#39; + label;
        a.appendChild(tn);
        p.appendChild(a);
      }

      p.appendChild(document.createTextNode(&#39; &#39;));

      label = &#39;GeneratedHTML&#39;;
      var tn = document.createTextNode(label);
      if (place == 3) {
        p.appendChild(tn);
      } else {
        var a = document.createElement(&#39;a&#39;);
        a.href = &#39;#&#39; + label;
        a.appendChild(tn);
        p.appendChild(a);
      }

    }

    function it_begin(place) {
      var placeDiv = document.getElementById(place);
      placeDiv.style.border = &#39;1px solid #888&#39;;
      placeDiv.style.padding = &#39;1px&#39;;

      it_putLabel(placeDiv, 0);
      
      var form = document.createElement(&#39;form&#39;);
      form.style.verticalAlign = &#39;top&#39;;
      form.onsubmit = it_clickSearch;
      placeDiv.appendChild(form);

      var p = document.createElement(&#39;p&#39;);
      form.id = &#39;IT_InputForm&#39;;
      form.appendChild(p);

      p.appendChild(document.createTextNode(&#39;Keyword:&#39;));

      var input = document.createElement(&#39;input&#39;);
      input.type = &#39;text&#39;;
      input.id = &#39;IT_SearchKey&#39;;
      p.appendChild(input);

      var input = document.createElement(&#39;input&#39;);
      input.type = &#39;button&#39;;
      input.value = &#39;Search&#39;;
      input.onclick = it_clickSearch;
      p.appendChild(input);

      it_putLabel(placeDiv, 1);

      var div = document.createElement(&#39;div&#39;);
      div.id = &#39;IT_ImageList&#39;;
      div.style.border = &#39;1px solid #888&#39;;
      div.style.margin = &#39;1px&#39;;
      div.style.padding = &#39;1px&#39;;
      placeDiv.appendChild(div);

      it_putLabel(placeDiv, 2);
      var div = document.createElement(&#39;div&#39;);
      div.id = &#39;IT_WebList&#39;;
      div.style.border = &#39;1px solid #888&#39;;
      div.style.margin = &#39;1px&#39;;
      div.style.padding = &#39;1px&#39;;
      placeDiv.appendChild(div);
      
      var div = document.createElement(&#39;div&#39;);
      div.id = &#39;IT_Bin&#39;
      div.style.border = &#39;1px solid #888&#39;;
      div.picts = new Array;
      div.numPict = 0;
      div.webSites = new Array;
      div.numWeb = 0;
      placeDiv.appendChild(div);

      it_putLabel(placeDiv, 3);

      var gentext = document.createElement(&#39;div&#39;);
      var form = document.createElement(&#39;form&#39;);
      gentext.appendChild(form);

      var form = document.createElement(&#39;form&#39;);
      placeDiv.appendChild(form);

      var p = document.createElement(&#39;p&#39;);
      form.appendChild(p);

      var textArea = document.createElement(&#39;textarea&#39;);
      textArea.rows = 20;
      textArea.cols = 60;
      textArea.id = &#39;IT_GeneratedText&#39;;
      p.appendChild(textArea);

    }
//--&gt;
&lt;/script&gt;

&lt;div id=&quot;tool-pane&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
    it_begin(&#39;tool-pane&#39;);
//--&gt;
&lt;/script&gt;
&lt;noscript&gt;Sorry, you have to enable javascript.&lt;/noscript&gt;
&lt;/div&gt;





&lt;ul&gt;
&lt;li&gt;
微妙に修正。オブジェクトっぽく仕立て直したい気もするが、メンドクサイ…
&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://arika-kias.blogspot.com/feeds/3501399823693934728/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://arika-kias.blogspot.com/2010/04/ver12.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/3501399823693934728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281412490715734218/posts/default/3501399823693934728'/><link rel='alternate' type='text/html' href='http://arika-kias.blogspot.com/2010/04/ver12.html' title='サムネイル・プレビュー作成ツール ver.1.2'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>