function getHikisuu(){
     getHikisuu.data = new Array();
     getHikisuu.string = location.search.substring(1);//?をサプレス
     getHikisuu.string = getHikisuu.string.split('&');
     for(var i = 0; i != getHikisuu.string.length; i++) {
//         getHikisuu.data[ck_shikibetushi(getHikisuu.string[i].split('=')[0])] 
//                               =  Escape(unescape(getHikisuu.string[i].split('=')[1]));
        getHikisuu.data[ck_shikibetushi(getHikisuu.string[i].split('=')[0])] 
                               =  Escape(decodeURI(getHikisuu.string[i].split('=')[1]));
     }

     function ck_shikibetushi(shiki){ //識別子（プロパティ）の命名チェック
         shiki_TOP = shiki.substring(0,1);
         if(shiki_TOP.match(/[a-zA-Z_$]/g) == null){
            //alert(shiki+"の引数が不正です。（一文字目は、ASCII、_、$、のいずれかです。）");
            return null;
         }
         else if(shiki.match(/[^a-zA-Z0-9_$]/g) != null){
            //alert(shiki+"の引数が不正です。（命名文字は、ASCII、数字、_、$、のいずれかです。）");
            return null;
         } 
         return shiki;
     }

     function Escape(str){ //文字参照へ変換 
          str = str.replace( /\&/g, '&amp;' );
          str = str.replace( /</g, '&lt;' ); 
          str = str.replace( />/g, '&gt;' ); 
          str = str.replace( /\"/g, '&quot;' );
          str = str.replace( /\'/g, '&#39;' );
          return str;
    }

} //--new getHikisuu();
//document.write("qの値は、" + getHikisuu.data.q +"<br>");

function disp(qqq){

            if (getHikisuu.data.tag ==undefined || getHikisuu.data.tag =="?????" || getHikisuu.data.tag =="90347" || getHikisuu.data.tag =="50131") {
            getHikisuu.data.tag = "httpbooknewbl-22";
            //document.write(getHikisuu.data.tag);
            }else{
            //document.write(getHikisuu.data.tag);
            }

            if (getHikisuu.data.q !="") {
             if(getHikisuu.data.q.substring(0,3) != "-!-"){
             document.supri.moji.value= getHikisuu.data.q;
             //var disq = decodeURI(qq);
               if( getHikisuu.data.q.length > 35){ 

               document.write("<div style='font-size:12px;color:#333333;'><B>" + getHikisuu.data.q.substring(0,40) + "</B>... に一致するタイトル&nbsp;&nbsp;<span id='paso' style='font-size:11px;'></span></div>")

               document.title = getHikisuu.data.q.substring(0,40) + "...  - BookSupri 検索"; 
               }else{

               document.write("<div style='font-size:12px;color:#333333;'><B>" + getHikisuu.data.q + "</B> に一致するタイトル&nbsp;&nbsp;<span id='paso' style='font-size:11px;'></span></div>")

               document.title = getHikisuu.data.q + " - BookSupri 検索"; 
               }
             }else{
             document.supri.moji.value= "";//getHikisuu.data.q;
             document.title = "おすすめブック - BookSupri 検索"; 
             document.write("<div style='background-color: #F8F8FF'><font size ='-1'  color ='#696969' >おすすめブック</font>&nbsp;&nbsp;<span id='paso' style='font-size:11px;'></span></div>");
             }
            }else{
            //setck("NG")
            document.location = "http://booksupri.web.fc2.com/";
            }
}


function keep(){
flag = document.getElementsByName("sType")[1].checked;
strGet = document.supri.moji.value;
strGet2 = encodeURI(strGet);
document.location = "result.html?q="  + strGet2 + "&start=1&tag=httpbooknewbl-22" + "&mode=" + flag + "&favo=true";
}

function keepF(){
var strGetF = document.supri2.mojiF.value;
var strGetF2 = encodeURI(strGetF);
document.location = "result.html?q="  + strGetF2 + "&start=1&tag=httpbooknewbl-22" + "&favo=true";
}


function keep2(){
//var strGet = document.supri.moji.value;
strGet9 = encodeURI("TodaysBook");
document.location = "result.html?q=-!-"  + strGet9 + "&start=1&tag=httpbooknewbl-22";
}

function web(){
var strGetW = document.supri.moji.value;
document.location = "http://www.google.co.jp/search?q=" + strGetW + "&lr=lang_ja";
}

function key_press(){
　　　　if (event.keyCode==13) {
　　　　　　keep();
　　　　　　return false;
　　　　}
　　　　else return true;
}

function book(bkno,wind,rndno){

 if(rndno==0){
  var bktit=document.getElementById(bkno + "Title").innerHTML;
  var bkisbn=document.getElementById(bkno + "ISBN").innerHTML;
 }else{
  var bktit=document.getElementById(bkno + "TitleRnd").innerHTML;
  var bkisbn=document.getElementById(bkno + "ISBNRnd").innerHTML;
 }
  var bkq=encodeURI(getHikisuu.data.q);
  var bktag=encodeURI(getHikisuu.data.tag);

 if(wind==0){
//  document.location = "books.html?q=" + bkq + "&book=" + encodeURI(bktit) + "&isbn=" + bkisbn + "&tag=" + bktag;
document.location = "http://www.amazon.co.jp/gp/product/" + bkisbn + "?ie=UTF8&tag=" + bktag + "&linkCode=as2&camp=247&creative=1211&creativeASIN=" + bkisbn;
 }else{
//  window.open("books.html?q=" + bkq + "&book=" + encodeURI(bktit) + "&isbn=" + bkisbn + "&tag=" + bktag);
window.open("http://www.amazon.co.jp/gp/product/" + bkisbn + "?ie=UTF8&tag=" + bktag + "&linkCode=as2&camp=247&creative=1211&creativeASIN=" + bkisbn);
 }

  //document.write("s<iframe src='books.html' height=100 width=100 frameborder='1' scrolling=no></iframe>");
  //document.write("<iframe src='books.html?q=" + bkq + "&book=" + encodeURI(bktit) + "&isbn=" + bkisbn + "&tag=" + bktag + "' height=100 width=100 frameborder='1' scrolling=no></iframe>");

  //document.location = "http://www.amazon.co.jp/gp/product/" + bkisbn + "?ie=UTF8&tag=" + bktag + "&linkCode=as2&camp=247&creative=1211&creativeASIN=" + bkisbn;

  //document.location = "http://google.co.jp/";
}

function afi(){
document.getElementById("Output1").innerHTML = "<span id='Output2'><FORM name='afi' onSubmit='afi2();return false'><table><tr><td><font size='-1' color='gray'>アソシエイトID</font></td><td><INPUT size='30' type='text' name='id' value=''>　<input type=button value='リンク作成' onClick=afi2()></td></tr></table></FORM><table style='font-size:12px; color:gray;'><tr><td><img src='pin.png'><a href='https://affiliate.amazon.co.jp/' target='_blank'>Amazonアソシエイト・プログラム</a></td></tr><tr><td>ログインした後、「現在のトラッキングID：」に記載されている「id******-22」という部分(太字)があなたのアフィリエイトIDです。（例: book-22）</td></tr></table></span>";
}

function afi2(){
strGetTIT = decodeURI(getHikisuu.data.q);
  var bkq2=encodeURI(getHikisuu.data.q);
var strGetID = document.afi.id.value;
var aurl = "http://booksupri.web.fc2.com/result.html?q=" + bkq2 + "&start=1&tag=" + strGetID + "&mode=false";
document.getElementById("Output1").innerHTML = "<font color='gray' size='-1'>リンクができました！</font><font size='-1' color='gray'>　コピーしてご利用ください。</font><br><table width='80%' style='font-size:12px; color:green;'><tr><td align='center'>&lt;a href='" + aurl + "' target='_blank'&gt;" + strGetTIT + "&lt;/a&gt;</td></tr></table><br>";
document.getElementById("Output3").innerHTML = "<font color='gray' size='-1'>プレビュー：　<a href='" + aurl + "' target='_blank'>" + strGetTIT + "</a></font>";
}

function wordq(){
var strGetQr = document.words.word.value + "本は？";
strGetQr = encodeURI(strGetQr);
document.location = "result.html?q="  + strGetQr + "&start=1&tag=httpbooknewbl-22" + "&favo=true";
}

function check(f){
f.word.value="";
for (var i=0; i<f.length;i++){
if(f[i].className=="kanjo" && f[i].checked==true){
f.word.value += f[i].value;
document.getElementById("Output").innerHTML = "<img src='magnifier.png'>『" + f.word.value  + "<a href='javascript:wordq()'><U><B style='color:#0000FF;'>本は？</B></U></a>』<br><br>";
}
}
f.word.readOnly=(f.word.value!="");
}

function parsonal(){
frezA="";
//frezA="<span id='OutputP1'><font size='-1' color='#696969'><B>&nbsp;&nbsp;オリジナルフレーズ検索</B> <a href='javascript:phrase_open()'>▼</a></font></span>";
                favoread();
                strLv = decodeURI(decodeURI(ckary[0]));
                cntLv=0;
                while(strLv.indexOf(" ") > -1){
                strLv = strLv.replace(" ",",");
                cntLv++;
                }
                if (cntLv >=5) {
                //frezA=frezA+"&nbsp;&nbsp;<font size='-1' color='#696969'><B>パーソナライズド</B><a href='result.html?q=-!-" + decodeURI(ckary[0]) + "&start=1&tag=httpbooknewbl-22' title='" + decodeURI(decodeURI(ckary[0])).substring(0,20) + "...に関する、あなた限定のサーチ-Lv." + cntLv + "'>検索</a></font><font color='green' size='-2'>Lv." + cntLv + "</font>";
                frezA="<a href='result.html?q=-!-" + decodeURI(ckary[0]) + "&start=1&tag=httpbooknewbl-22&favo=false' title='" + decodeURI(decodeURI(ckary[0])).substring(0,20) + "...に関するあなたへのオススメブック-Lv." + cntLv + "'>あなたへオススメ</a></font>&nbsp;[<a href='javascript:favoread2()' style='font-size:11px;'>編集</a>]";
                }else{
                //document.location = "http://booksupri.web.fc2.com/";
                frezA="";//"<font color='gray'>パーソナライズドサーチ</font>";
                }
//frezA=frezA+"<br><br><span id='OutputP2'></span>";
document.getElementById("paso").innerHTML = frezA;
}

function footaa(){
footA="<center>";
//footA+="<table width='98%' bgcolor='#FFFFFF' style='font-size:11px; border-style: solid none solid none; border-color:#999999; border-width:1px;'><tr><td align='left' valign='middle' width='40'><a href='mobile.html' target='_blank'><img src='mqr.png' align='left' alt='BookSupri' border='0' /></a></td><td align='left' valign='middle' class='category'><span style='color:#666666;font-size:11px;'>BookSupri - モバイルメール検索</span><br><a href='mobile.html' target='_blank'>メールを送るとオススメな小説を勝手に選んでくれます。</a><span style='color:#333333;font-size:12px;'>どんなメールからでもサーチして結果を自動返信してくれます。</span></td></tr></table><br>";
footA = footA + "<FORM name='supri2' onSubmit='keepF();return false'><table style='font-size:12px; border-style: solid none solid none; border-color:#999999; border-width:1px;' align='center' width='98%' bgcolor='#E6E6FA'><tr><td width='100%' align='center'><br><INPUT size='50' type='text' name='mojiF' value=''><input type=button value='検索' onClick=keepF()></td></tr></FORM>";
footA = footA + "<br><span id='Output1' style='font-size:11px;'>";
footA += "<tr><td align='center'><span><br><a href='mobile.html'>小説相性メール検索</a> - <a href='category.html' title=''>カテゴリ検索</a> - <a href='diary.html' title=''>ダイアリー検索</a> - <a href='phrase.html' title=''>オリジナル フレーズ検索</a> - <a href='story.html'>あらすじ検索</a> - <a href='book100.html'>学生への100選書</a> - <a href='maximlink.html'>名言ブログパーツ</a><br></span><br></td></tr></table>";
//footA = footA + "<font size='-1' color='gray'>AmazonIDを設定してこの検索キーワードにリンクをすると、リンク経由後の成果が、<br>ご自身のAmazonアソシエイトIDでの成果にできる専用のリンクが<a href='javascript:afi()'>作成</a>できます。</font><br><br>";
footA = footA + "</span><span id='Output3'></span>";
footA = footA + "</center><div class='flink' Align='center'>";
//footA = footA + "<hr size=1 color='#CCCCCC' align='left' width='100%' style='padding-bottom: 5px;'/>";
footA = footA + "<span><br>Copyright (C) BookSupri All Rights Reserved.　　";
footA = footA + "<a href='http://booksupri.web.fc2.com/' >HOME</a> - <a href='help.html' >便利な使い方</a> - <a href='mission.html' >活動理念</a> - <a href='privacy.html' >プライバシーポリシー</a> - <a href='http://booknews.blog98.fc2.com/blog-entry-237.html'>お問い合わせ</a></span>";
document.getElementById("footaa").innerHTML = footA;
}

function Navigate(){
         NowP = (getHikisuu.data.start)*10;
         document.getElementById("navigate").innerHTML = "<div style='background-color: #F8F8FF'><font size ='-1'  color ='#696969' >約 " + cntHit + " 冊中 " + parseInt((getHikisuu.data.start-1)*10+1) + " - " + NowP + "冊目</font></div>";
//document.getElementById("navigate").innerHTML = naviA;
}

function makefav(){
dispQ="<FORM name='words'>";
dispQ+="<table width='100%' style='font-size:12px;color:#333333; border-style: solid none solid none; border-color:#999999; border-width:1px;' align='left' bgcolor='#FFFFFF'>";
//dispQ+="<tr><td colspan='2' align='left' style='color:#333333;'><img src='folder_heart.png'><B>恋愛</B></td>";
dispQ+="<td><input type='checkbox' class='kanjo' name='kanjo[]' onClick='check(this.form)' value='恋愛の'>恋愛したい</td>";
dispQ+="<td><input type='checkbox' class='kanjo' name='kanjo[]' onClick='check(this.form)' value='青春の'>青春したい</td>";
dispQ+="<td><input type='checkbox' class='kanjo' name='kanjo[]' onClick='check(this.form)' value='泣ける'>泣きたい</td>";
dispQ+="<td><input type='checkbox' class='kanjo' name='kanjo[]' onClick='check(this.form)' value='楽しい'>楽しみたい</td></tr>";
dispQ+="<tr><td><input type='checkbox' class='kanjo' name='kanjo[]' onClick='check(this.form)' value='感動の'>感動したい</td>";
dispQ+="<td><input type='checkbox' class='kanjo' name='kanjo[]' onClick='check(this.form)' value='爽やか'>スカッとしたい</td>";
dispQ+="<td><input type='checkbox' class='kanjo' name='kanjo[]' onClick='check(this.form)' value='癒し'>癒されたい</td>";
dispQ+="<td><input type='checkbox' class='kanjo' name='kanjo[]' onClick='check(this.form)' value='優しい'>優しくなりたい</td></tr>";
dispQ+="<tr><td colspan='4' align='left' width='100%' style='font-size:12px;color:black;'><INPUT size='2' type='text' name='word' value='' style='position:absolute;visibility:hidden'> </FORM></td></tr><tr><td colspan='4'><span id='Output' width='100%'></span></td></tr></table><br clear='all' /><br>";

document.getElementById("disp_Q").innerHTML =dispQ;
}
