function chkAjaBrowser(){var a,j=navigator.userAgent;this.b={s:((a=j.split('AppleWebKit/')[1])?a.split('.')[0]:0)>=124,k:((a=j.split('Konqueror/')[1])?a.split(';')[0]:0)>=3.3,m:((a=j.split('Gecko/')[1])?a.split(' ')[0]:0)>=20011128,op:(!!window.opera)&&((typeof XMLHttpRequest)=='function'),e:(!!window.ActiveXObject)?(!!createHttpRequest()):false};return(this.b.s||this.b.k||this.b.m||this.b.op||this.b.e)};function createHttpRequest(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else if(window.ActiveXObject){try{return new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP');}catch(e2){return null;}}}else{return null;}}function sendRequest(c,d,p,u,y,t,v,w){var o=createHttpRequest();if(o==null)return null;var t=(!!sendRequest.arguments[5])?t:false;if(t||p.toUpperCase()=='GET')u+='?';if(t)u=u+'t='+(new Date()).getTime();var z=new chkAjaBrowser();var op=z.b.op;var s=z.b.s;var k=z.b.k;var m=z.b.m;if(typeof c=='object'){var l=c.onload;var h=c.onbeforsetheader}else{var l=c;var h=null;}if(op||s||m){o.onload=function(){l(o);}}else{o.onreadystatechange=function(){if(o.readyState==4){l(o);}}}d=r(d,u);if(p.toUpperCase()=='GET'){u+=d}o.open(p,u,y,v,w);if(!!h)h(o);x(o);o.send(d);function x(o){var g='application/x-www-form-urlencoded; charset=UTF-8';if(!window.opera){o.setRequestHeader('Content-Type',g);}else{if((typeof o.setRequestHeader)=='function')o.setRequestHeader('Content-Type',g);}return o}function r(d,u){var n=(u.indexOf('?')==-1)?'?dmy':'';if(typeof d=='object'){for(var i in d)n+='&'+encodeURIComponent(i)+'='+encodeURIComponent(d[i]);}else if(typeof d=='string'){if(d=='')return'';var n='';var f=d.split('&');for(var i=1;i<f.length;i++){var q=f[i].split('=');n+='&'+encodeURIComponent(q[0])+'='+encodeURIComponent(q[1]);}}return n;}return o}
function outputLAYER(layName,html){
    if(document.getElementById){        //e5,e6,n6,n7,m1,o7,s1用
      document.getElementById(layName).innerHTML=html
    } else if(document.all){            //e4用
      document.all(layName).innerHTML=html
    } else if(document.layers) {        //n4用
       with(document.layers[layName].document){
         open()
         write(html)
         close()
      }
    }
  }
function moveLAYER(idName,x,y){
    
    if(document.getElementById){        //Moz,NN6,IE5用
      document.getElementById(idName).style.left=x
      document.getElementById(idName).style.top=y
    }
    else if(document.all){
      document.all(idName).style.pixelLeft=x //IE4用
      document.all(idName).style.pixelTop=y
    }
    else if(document.layers)
      document.layers[idName].moveTo(x,y)    //NN4用

  }
var keyw="";//予備キー１
var keyww="";//2

/*
本の場合
タイトル、著者、ISBN、オークション 
値は　1,0,-1,10

例：
(1)タイトルで検索時
予備の候補は
(0)著書
(-1)ISBN
となって送る
その予備の候補を判別するために
keyw2　=1
keyww2　=-1
を使う
*/
var keyw2="";//予備キー1,0,-1
var keyww2="";//予備キー1,0,-1
function s() {
if(document.f.a.value == ""){outputLAYER('mess',"キーワードを入力してください");}
else{
if(document.f.tt[0].checked){i=1;}
else if(document.f.tt[1].checked){i=0;}
else if(document.f.tt[2].checked){i=-1;}
else{i=10;}
window.location.href="f0.htm?"+i+"&"+encodeURIComponent(document.f.a.value)+"&"+encodeURIComponent(keyw)+"&"+keyw2+"&"+encodeURIComponent(keyww)+"&"+keyww2;
}
return false;
}

function setk(v,v1,v11,v2){
if(v2==1){
document.f.tt[0].checked=1;
keyw2=0;
keyww2=-1;
}
else if(v2==0){
document.f.tt[1].checked=1;
keyw2=1;
keyww2=-1;
}
else if(v2==-1){
document.f.tt[2].checked=1;
keyw2=0;
keyww2=1;
}
else{
document.f.tt[3].checked=1;
keyw2=0;//適当
keyww2=1;//適当
}
document.f.a.value=v;
keyw=v1;
keyww=v11;
scroll(0,0);
}
function reimg(j){j.src = 'reimg50.gif';}
function imgwh(j){
if(j.width==1){j.src = 'reimg50.gif';}
//else if(j.width > j.height){j.width=50;}
//else{j.height=50;}
}
function tugi(v,v1,v2){
if(v != ""){
if(v2==100){
if(document.f.tt[0].checked){t=1;}
else if(document.f.tt[1].checked){t=0;}
else if(document.f.tt[2].checked){t=-1;}
else{t=10;}
}
else{t=v2;}
sendRequest(onloaded,{"p":v1,"a":v,"t":t},'GET','ams.php',true,true);
return false;
}
else{outputLAYER('mess',"キーワードを入力してください");}
}
fmhtml='<form name="f" onSubmit="return s()"><center><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td colspan="8" valign="middle"><IMG height=52 src="logo.gif" border=0 style="visibility:hidden"></td><td width="100%"><table border="0" cellpadding="2" cellspacing="0"><tbody><tr><td><input maxLength="2048" size="35" type="text" name="a" class="in"><br><input type="radio" checked name="tt" value="1"><font size="-1">タイトル</font>　<input type="radio" name="tt" value="0"><font size="-1">著者</font>　<input type="radio" name="tt" value="-1"><font size="-1">ISBN</font>　<input type="radio" name="tt" value="10"><font size="-1">オークション</font>　<input type="submit" value="古本 検索">　<div id="mess2"></div></td></tr></tbody></table></td></tr></tbody></table></center></form>';
function onloaded(res){
if(res.responseText=="x "){outputLAYER('setu','<font size="-1"><a href="index.html">取得失敗</a></font>');}
else{
if(document.f.tt[0].checked){ttv=1;}
else if(document.f.tt[1].checked){ttv=0;}
else if(document.f.tt[2].checked){ttv=-1;}
else{ttv=10;}
moveLAYER('imgl',6,6);
outputLAYER('setu',fmhtml+'<p><font size="-1">※　タイトルや歌手名をクリックするとフォームに入力されます。</font></p>'+res.responseText);
scroll(0,0);
if(ttv==1){document.f.tt[0].checked=1}
else if(ttv==0){document.f.tt[1].checked=1}
else if(ttv==-1){document.f.tt[2].checked=1}
else{document.f.tt[3].checked=1}
}

}
function best(v,v1){
sendRequest(onloaded,{"p":v1,"a":v},'GET','ams.php',true,true);
}