/*
* @title 紀伊國屋書店新宿本店在庫検索
* @description 選択した文字列または現在のAmazon商品ページの書籍を在庫検索します。コード内のG2=新宿本店です。
* @include http://*
* @license MIT License
* @require
*/
(function(){
var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f=d.createElement('form'),asin=d.getElementById('ASIN');
if(asin){
location.href='http://bookweb.kinokuniya.co.jp/hb/ws_search.cgi?KCD=FA&W-ISBN='+asin.value
}else{
f.setAttribute('action','http://bookweb.kinokuniya.co.jp/hb/ws_search.cgi');
f.setAttribute('accept-charset','shift_jis');
var kcd=d.createElement('input');
kcd.setAttribute('name','KCD');
kcd.setAttribute('value','G2');
f.appendChild(kcd);
var title=d.createElement('input');
title.setAttribute('name','W-TITLE');
title.setAttribute('value',s);
f.appendChild(title);
d.getElementsByTagName('head')[0].appendChild(f);
d.charset='shift_jis';
f.submit();
}
}());