if(Kotohaco==null){var Kotohaco={Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1},Protocol:document.location.protocol,Host:"",AccountId:"",Debug:false};Kotohaco.Class={create:function(){return function(){this.initialize.apply(this,arguments)}}};Kotohaco.Object={extend:function(a,c){for(var b in c){a[b]=c[b]}return a},clone:function(a){return Kotohaco.Object.extend({},a)},inspect:function(b,a){return(b===undefined||b===null)?((a===undefined)?null:a):b},toJSON:function(a){var d=typeof a;switch(d){case"undefined":case"function":case"unknown":return;case"boolean":case"number":return a.toString();case"string":return"'"+a.replace(/'/g,"\\'")+"'"}if(a===null){return"null"}if(a.ownerDocument===document){return}var c=[];var f;if(a.constructor===Array){for(var b=0;b<a.length;b++){f=Kotohaco.Object.toJSON(a[b]);if(f!==undefined){c.push(f)}}return"["+c.join(", ")+"]"}else{for(var e in a){f=Kotohaco.Object.toJSON(a[e]);if(f!==undefined){c.push(Kotohaco.Object.toJSON(e)+": "+f)}}return"{"+c.join(", ")+"}"}},assertEquals:function(d,b){if(d===undefined||b===undefined){return false}if(d===null&&b===null){return true}if(typeof(d)!==typeof(b)){return false}if(typeof(d)==="function"||typeof(b)==="function"){return false}var a=typeof(d);switch(a){case"object":if(d==null||b===null){return false}for(var e in d){if(typeof(d[e])==="function"){continue}if(!Kotohaco.Object.assertEquals(d[e],b[e])){return false}}for(var c in b){if(typeof(b[c])==="function"){continue}if(!Kotohaco.Object.assertEquals(d[c],b[c])){return false}}return true;default:return(d===b)}}};Kotohaco.Url={replaceProtocol:function(a){a=String(Kotohaco.Object.inspect(a,""));var b=a.match(/^(http:|https:)/);if(b&&b[0]!==Kotohaco.Protocol){var c=new RegExp("^"+b[0]);a=a.replace(c,Kotohaco.Protocol)}return a},_encodeKeyPair:function(a,b){a=String(Kotohaco.Object.inspect(a,""));b=String(Kotohaco.Object.inspect(b,""));return(a==="")?null:(encodeURIComponent(a)+"="+encodeURIComponent(b))},createQueryStr:function(d){d=Kotohaco.Object.inspect(d,"");if(d===""||typeof(d)!=="object"){return""}var c=new Array();var e;for(var b in d){if(Kotohaco.Object.inspect(d[b])===null||typeof(d[b])==="function"){continue}if(d[b].constructor===Array){for(var a=0;a<d[b].length;a++){e=Kotohaco.Url._encodeKeyPair(b,d[b][a]);if(e){c.push(e)}}}else{e=Kotohaco.Url._encodeKeyPair(b,d[b]);if(e){c.push(e)}}}return c.join("&")},createUrl:function(a,c,b){a=String(Kotohaco.Object.inspect(a,""));a=(a==="")?"":(Kotohaco.Protocol+"//"+a);c=String(Kotohaco.Object.inspect(c,""));c=(c==="")?((a==="")?"":"/"):c;b=Kotohaco.Object.inspect(b);b=(b===null)?"":("?"+((typeof(b)==="object")?Kotohaco.Url.createQueryStr(b):String(b)));return a+c+b}};Kotohaco.Script={load:function(c,a){c=String(Kotohaco.Object.inspect(c,""));if(c===""){return}a=String(Kotohaco.Object.inspect(a,""));var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("language","JavaScript");b.setAttribute("src",Kotohaco.Url.replaceProtocol(c));b.setAttribute("charset","UTF-8");switch(a){case"head":document.getElementsByTagName("head")[0].appendChild(b);break;case"body":document.getElementsByTagName("body")[0].appendChild(b);break;case"":default:var d=document.createElement("div");d.appendChild(b);document.write(d.innerHTML);break}}};Kotohaco.Module={JsDirUrl:"",_loadedModules:{},load:function(a){a=String(Kotohaco.Object.inspect(a,""));if(a!==""&&Kotohaco.Module._loadedModules[a]!==true){Kotohaco.Script.load(Kotohaco.Url.createUrl(Kotohaco.Host,Kotohaco.Module.JsDirUrl+"Kotohaco."+a+".class.js"),"head");Kotohaco.Module._loadedModules[a]=false}}};Kotohaco.Object.extend(Kotohaco,{initialize:function(){var a=document.getElementsByTagName("head")[0].getElementsByTagName("script");var e=/^((http|https):\/\/([\w.:]+))?([\w\/.]+)Kotohaco\.js(\?\w+)?$/;for(var d=0;d<a.length;d++){var c=a[d].src;var b=c.match(e);if(b!==null){Kotohaco.Host=Kotohaco.Object.inspect(b[3],"");Kotohaco.Module.JsDirUrl=Kotohaco.Object.inspect(b[1],"")+Kotohaco.Object.inspect(b[4],"");if(b[5]!==undefined){Kotohaco.AccountId=b[5].slice(1)}}}}});Kotohaco.initialize()}Kotohaco.String={escapeHtml:function(a){if(a===undefined||a===null||typeof(a)=="function"){return""}return String(a).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}};Kotohaco.Module._loadedModules.String=true;Kotohaco.Number={split3:function(a){if(a===undefined||isNaN(parseFloat(a))){return""}var c=String(parseFloat(a));var b="";while(c!=(b=c.replace(/^([+-]?\d+)(\d\d\d)/,"$1,$2"))){c=b}return c}};Kotohaco.Module._loadedModules.Number=true;Kotohaco.Object.extend(Kotohaco.Url,{parseQueryStr:function(f){f=String(Kotohaco.Object.inspect(f,""));if(f===""){return{}}var a={};var d=f.split("&");for(var c=0;c<d.length;c++){var j=d[c].split("=");var b=String(Kotohaco.Object.inspect(j[0],""));if(b===""){continue}var h=Kotohaco.Object.inspect(j[1]);if(h===null){continue}try{b=decodeURIComponent(b.replace(/\+/g,"%20"));h=decodeURIComponent(h.replace(/\+/g,"%20"))}catch(g){if(Kotohaco.Debug){throw g}else{continue}}h=(isNaN(h)||h==="")?h:parseFloat(h);switch(typeof(a[b])){case"undefined":a[b]=h;break;case"string":case"number":a[b]=[a[b],h];break;default:if(a[b].constructor===Array){a[b].push(h)}break}}return a}});Kotohaco.Module._loadedModules.Url=true;Kotohaco.RedirectUrl={replaceProtocol:function(a){a=String(Kotohaco.Object.inspect(a,""));if(a===""){return a}var f=String(a).split("?");var d=Kotohaco.Object.inspect(f[0],"");var e=Kotohaco.Object.inspect(f[1],"");d=Kotohaco.Url.replaceProtocol(d);if(e!==""){var c=e.split("&");for(var b=0;b<c.length;b++){f=c[b].split("=");if(f[0]=="url"){f[1]=encodeURIComponent(Kotohaco.Url.replaceProtocol(decodeURIComponent(f[1])));c[b]=f.join("=")}}e="?"+c.join("&")}return d+e}};Kotohaco.Module._loadedModules.RedirectUrl=true;Kotohaco.Cookie={Domain:(function(){var a;return((a=document.location.hostname.match(/(\d+\.\d+\.\d+\.\d+)$/))!==null)?a[1]:(((a=document.location.hostname.match(/(\w+\.(co|or|ne|ac|ad|ed|go|gr|lg)\.jp)$/))!==null)?a[1]:(((a=document.location.hostname.match(/(\w+\.\w+)$/))!==null)?a[1]:document.location.hostname))}()),Path:"/",Expire:0,setCookie:function(c,g,b,d,e){c=String(Kotohaco.Object.inspect(c,""));g=String(Kotohaco.Object.inspect(g,""));if(c===""){return}if(g.indexOf(";")!==-1){if(Kotohaco.Debug){throw new Error("semicolon included in cookie string!!")}return}var f="";b=Kotohaco.Object.inspect(b,Kotohaco.Cookie.Expire);if((b=parseFloat(b))===Number.NaN){return}if(b!=0){var a=new Date();a.setTime(a.getTime()+(parseFloat(b)*24*60*60*1000));f=a.toGMTString()}d=String(Kotohaco.Object.inspect(d,Kotohaco.Cookie.Domain));e=String(Kotohaco.Object.inspect(e,Kotohaco.Cookie.Path));document.cookie=encodeURIComponent(c)+"="+g+((f!=="")?("; expires="+f):"")+"; path="+e+"; domain="+d},setCookieAsJson:function(b,e,a,c,d){Kotohaco.Cookie.setCookie(b,encodeURIComponent(Kotohaco.Object.toJSON(e)),a,c,d)},getCookie:function(d){if((d=String(Kotohaco.Object.inspect(d,"")))===""){return null}var a=document.cookie.split("; ");for(var c=0;c<a.length;c++){if(a[c].split("=")[0]===d){try{var b=a[c].split("=")[1]}catch(f){if(Kotohaco.Debug){throw f}}return b}}return null},getCookieAsJson:function(key){key=String(Kotohaco.Object.inspect(key,""));var retval=Kotohaco.Cookie.getCookie(key);if(retval===null||retval===""){return null}try{retval=eval("("+decodeURIComponent(retval)+")")}catch(e){if(Kotohaco.Debug){throw e}else{return null}}return Kotohaco.Object.inspect(retval)}};Kotohaco.Module._loadedModules.Cookie=true;Kotohaco.Jsonp={send:function(service,query,callbackFunc){var path=((Kotohaco.AccountId!=="")?("/~"+String(Kotohaco.AccountId)):"")+"/ec/_"+String(service)+"/";query=Kotohaco.Object.inspect(query,"");var querystr=(typeof(query)!=="string")?Kotohaco.Url.createQueryStr(query):query;if(querystr==""){return}if(typeof(callbackFunc)=="string"&&eval("typeof("+callbackFunc+")")=="function"){querystr+="&"+Kotohaco.Url.createQueryStr({fmt:"jsonp",callbackFunc:callbackFunc});Kotohaco.Script.load(Kotohaco.Url.createUrl(Kotohaco.Host,path,querystr),"head")}}};Kotohaco.Module._loadedModules.Jsonp=true;Kotohaco.History={};Kotohaco.History.Item=Kotohaco.Class.create();Kotohaco.History.Item.prototype={initialize:function(a){a=Kotohaco.Object.inspect(a,{});this.value=Kotohaco.Object.inspect(a.value)}};Kotohaco.Object.extend(Kotohaco.History,{_initializeHistory:function(b){var a;b=Kotohaco.Object.inspect(b,{});this.ListLength=10;if((a=parseInt(Kotohaco.Object.inspect(b.ListLength,this.ListLength)))!==Number.NaN){this.ListLength=(a>0&&a<=50)?a:this.ListLength}this.CookieExpireDays=180;if((a=parseFloat(Kotohaco.Object.inspect(b.CookieExpireDays,this.CookieExpireDays)))!==Number.NaN){this.CookieExpireDays=(a>=0&&a<=1000)?a:this.CookieExpireDays}this.CookieDomain=Kotohaco.Cookie.Domain;this.CookieDomain=String(Kotohaco.Object.inspect(b.CookieDomain,this.CookieDomain));this.CookiePath=Kotohaco.Cookie.Path;this.CookieName="jp.co.kotoha.ec.history"+((Kotohaco.AccountId!=="")?("."+Kotohaco.AccountId):"");this.ItemClass=Kotohaco.History.Item;this.List=[]},initialize:function(a){this._initializeHistory(a);this._load()},getHistory:function(){return this.List},_addHistory:function(c){if((c=Kotohaco.Object.inspect(c))===null||typeof(c)==="function"){return}var b=[c];for(var a=0;a<this.List.length;a++){if(this._assertEquals(c,this.List[a])){continue}b.push(this.List[a])}this.List=b.slice(0,parseInt(this.ListLength));Kotohaco.Cookie.setCookieAsJson(this.CookieName,this.List,this.CookieExpireDays,this.CookieDomain,this.CookiePath)},_assertEquals:function(b,a){return Kotohaco.Object.assertEquals(b,a)},_load:function(){this.List=[];var b=Kotohaco.Cookie.getCookieAsJson(this.CookieName);if(b!==null&&b.constructor===Array){for(var a=0;a<b.length;a++){this.List.push(new this.ItemClass(b[a]))}}},deleteHistory:function(){this.List=[];Kotohaco.Cookie.setCookieAsJson(this.CookieName,[],-1,this.CookieDomain,this.CookiePath)},add:function(a){if((a=String(Kotohaco.Object.inspect(a,"")))!==""){this._addHistory(new this.ItemClass({value:a}))}}});Kotohaco.Module._loadedModules.History=true;Kotohaco.ViewRenderer={addRenderer:function(c,b,a){c=encodeURIComponent(String(Kotohaco.Object.inspect(c,"")));if(c===""){return null}if(document.getElementById(c)===null){document.write((document.createElement("div")).appendChild(Kotohaco.Object.extend((document.createElement("div")),{id:c})).parentNode.innerHTML)}b=Kotohaco.Object.inspect(b);if(typeof(b)!=="function"){return null}Kotohaco.Object.extend(document.getElementById(c),{kotohacoRenderHtml:function(){var f="";try{f=String(b.apply(null,arguments))}catch(d){if(Kotohaco.Debug){throw d}}if(f!==""){this.innerHTML=f}}});a=Kotohaco.Object.inspect(a);if(a!==null&&typeof(a)==="object"&&a.construnctor!==Array){Kotohaco.Object.extend(document.getElementById(c),a)}return document.getElementById(c)},addJsonpRenderer:function(a,d,f,c,b){var e=Kotohaco.ViewRenderer.addRenderer(f,c,b);if(e===null){return null}Kotohaco.Jsonp.send(a,d,'document.getElementById("'+f+'").kotohacoRenderHtml');return e}};Kotohaco.Module._loadedModules.ViewRenderer=true;Kotohaco.ViewHelper={NoImageUrl:Kotohaco.Url.createUrl(Kotohaco.Host,"/ec/image/noimage.png"),loadErrorImage:function(c,b){if(Kotohaco.Object.inspect(c)===null||Kotohaco.Object.inspect(c.tagName)===null||c.tagName.toUpperCase()!=="IMG"){return}var a=String(Kotohaco.Object.inspect(b,""));a=(a!=="")?a:Kotohaco.ViewHelper.NoImageUrl;c.onerror=null;c.src=a},selectJumper:function(b,d){var a="";try{a=Kotohaco.Url.replaceProtocol(b[b.selectedIndex].value)}catch(c){if(Kotohaco.Debug){throw c}return}if(a===""){return}d=String(Kotohaco.Object.inspect(d,"0"));switch(d){case"2":window.parent.document.location.href=a;break;case"1":window.open(a,"","");break;default:case"0":location.href=a;break}return}};Kotohaco.Module._loadedModules.ViewHelper=true;Kotohaco.ItemList={DefaultOpt:{title:"",viewCols:["image","title","price"],pricePreText:"\\ ",pricePostText:"",layout:"table",rows:2,columns:5,maxItems:10,permittedMaxItems:100,noImageUrl:Kotohaco.ViewHelper.NoImageUrl},ClassPrefix:"kotohaco_",_renderItem:function(e,c){e=Kotohaco.Object.inspect(e);c=Kotohaco.Object.inspect(c);if(e===null||e.itemid===undefined||c===null||c.viewCols===undefined){return""}var h="";var g=Kotohaco.RedirectUrl.replaceProtocol(String(Kotohaco.Object.inspect(e.redirect_url,"")));var d=Kotohaco.String.escapeHtml(String(Kotohaco.Object.inspect(e.title,"")));for(var b=0;b<c.viewCols.length;b++){var a=c.viewCols[b];var f;switch(a.replace(/\d*/,"")){case"n":f=parseFloat(Kotohaco.Object.inspect(e[a],0));f=(isNaN(f))?"":String(f);break;case"price":f=parseFloat(Kotohaco.Object.inspect(e.price,0));f=(isNaN(f)||f<0)?"":Kotohaco.String.escapeHtml((c.pricePreText+Kotohaco.Number.split3(f)+c.pricePostText));break;case"image":f="<img";f+=' src="'+Kotohaco.Url.replaceProtocol(Kotohaco.Object.inspect(e.image,""))+'"';f+=' alt="'+d+'"';f+=' title="'+d+'"';f+=' onerror="Kotohaco.ViewHelper.loadErrorImage(this);"';f+=" />";break;default:f=Kotohaco.String.escapeHtml(String(Kotohaco.Object.inspect(e[a],"")));break}if(f!==""){if(a==="title"||a==="image"){f='<a href="'+g+'" />'+f+"</a>"}h+='<div class="'+Kotohaco.ItemList.ClassPrefix+"item_"+Kotohaco.String.escapeHtml(a)+'">';h+=f;h+="</div>"}}return h},createRenderer:function(a){return(function(l){if(Kotohaco.Object.inspect(l)===null){return""}try{var k=l.result.items.item;if(k.constructor!==Array||k.length==0){return""}}catch(m){if(Kotohaco.Debug){throw m}else{return""}}a=Kotohaco.Object.inspect(a,{});for(var b in Kotohaco.ItemList.DefaultOpt){var f=Kotohaco.ItemList.DefaultOpt[b];if(typeof(f)==="function"||typeof(f)==="object"){continue}switch(typeof(f)){case"number":a[b]=isNaN(parseInt(Kotohaco.Object.inspect(a[b],f)))?f:a[b];a[b]=(a[b]>0)?a[b]:f;break;default:a[b]=String(Kotohaco.Object.inspect(a[b],f));break}}a.viewCols=Kotohaco.Object.inspect(a.viewCols,Kotohaco.ItemList.DefaultOpt.viewCols);a.viewCols=(a.viewCols.constructor!==Array)?Kotohaco.ItemList.DefaultOpt.viewCols:a.viewCols;switch(a.layout){default:case"table":a.layout="table";if(a.rows*a.columns>Kotohaco.ItemList.DefaultOpt.permittedMaxItems){a.columns=Kotohaco.ItemList.DefaultOpt.columns;a.rows=Math.ceil(Kotohaco.ItemList.DefaultOpt.permittedMaxItems/a.columns)}break;case"list":a.maxItems=(a.maxItems>Kotohaco.ItemList.DefaultOpt.permittedMaxItems)?Kotohaco.ItemList.DefaultOpt.Kotohaco.ItemList.DefaultOpt.permittedMaxItems:a.maxItems;break}var c="<!-- Kotohaco ItemList Renderer -->";c+="<dl>";if(a.title!==""){c+='<dt class="'+Kotohaco.ItemList.ClassPrefix+'title">';c+=Kotohaco.String.escapeHtml(a.title);c+="</dt>"}c+='<dd class="'+Kotohaco.ItemList.ClassPrefix+'itemlist">';var g;var d;switch(a.layout){default:case"table":g=((Math.ceil(k.length/a.columns)>a.rows)?a.rows:Math.ceil(k.length/a.columns))*a.columns;c+="<table";d="td";break;case"list":g=a.maxItems;c+="<ol";d="li";break}c+=' class="'+Kotohaco.ItemList.ClassPrefix+'items">';for(var j=0;j<g;j++){switch(a.layout){case"table":c+=(j%a.columns===0)?"<tr>":"";break;case"list":break}var h=Kotohaco.ItemList._renderItem(k[j],a);if(h===""){switch(a.layout){case"table":c+="<td>&nbsp;</td>";break;case"list":break}}else{c+="<"+d+' class="'+Kotohaco.ItemList.ClassPrefix+"item seq"+String("000"+(j+1)).slice(-3)+'">';c+=h;c+="</"+d+">"}switch(a.layout){case"table":c+=(j%a.columns===a.columns-1)?"</tr>":"";break;case"list":break}}switch(a.layout){case"table":c+="</table>";break;case"list":c+="</ol>";break}c+="</dd></dl>";c+="<!-- /Kotohaco ItemList Renderer -->";return c})}};Kotohaco.Module._loadedModules.ItemList=true;Kotohaco.ItemHistory=Kotohaco.Object.clone(Kotohaco.History);Kotohaco.ItemHistory.Item=Kotohaco.Class.create();Kotohaco.ItemHistory.Item.prototype={initialize:function(a){a=Kotohaco.Object.inspect(a,{});this.itemid=String(Kotohaco.Object.inspect(a.itemid,""));this.itemid=(this.itemid!=="")?this.itemid:"";try{this.viewtime=parseFloat(Kotohaco.Object.inspect(a.viewtime,(new Date()).getTime()))}catch(b){if(Kotohaco.Debug){throw b}else{this.viewtime=(new Date()).getTime()}}}};Kotohaco.Object.extend(Kotohaco.ItemHistory,{initialize:function(a){this._initializeHistory(a);this.CookieName="jp.co.kotoha.ec.viewhistory"+((Kotohaco.AccountId!=="")?("."+Kotohaco.AccountId):"");this.ItemClass=Kotohaco.ItemHistory.Item;this.ViewId="kotohaco_itemhistory";this._load()},_assertEquals:function(b,a){b=Kotohaco.Object.inspect(b,{});a=Kotohaco.Object.inspect(a,{});return(Kotohaco.Object.assertEquals(b.itemid,a.itemid)&&(Kotohaco.Object.inspect(b.itemid)!==null))},add:function(a){if((a)!==""){this._addHistory(new this.ItemClass({itemid:a}))}},show:function(a,d){a=(Kotohaco.Object.inspect(a)!==null)?a:Kotohaco.ItemList.createRenderer();var c=this.getHistory();if(c.length===0){return}var e=[];for(var b=0;b<c.length;b++){if(Kotohaco.Object.inspect(c[b].itemid)!==null){e.push(c[b].itemid)}}Kotohaco.ViewRenderer.addJsonpRenderer("getIteminfo",{k_itemid_list:e.join(";")},this.ViewId,a,d)}});Kotohaco.Module._loadedModules.ItemHistory=true;Kotohaco.Looklike={ViewId:"kotohaco_looklike",show:function(c,a,b){c=String(Kotohaco.Object.inspect(c,""));if(c===""){return}a=(Kotohaco.Object.inspect(a)!==null)?a:Kotohaco.ItemList.createRenderer();Kotohaco.ViewRenderer.addJsonpRenderer("search",{li:c},this.ViewId,a,b)}};Kotohaco.Module._loadedModules.Looklike=true;Kotohaco.RefQuery={ViewId:"kotohaco_refquery",ItemListTitle:Kotohaco.ItemList.DefaultOpt.title,SearchLinkTitle:"",KeywordParams:["q"],show:function(a,c){var b;if((b=String(Kotohaco.Object.inspect(this.getQueryString(),"")))===""){return}a=(Kotohaco.Object.inspect(a)!==null)?a:this.createRenderer();Kotohaco.ViewRenderer.addJsonpRenderer("search",{q:b},this.ViewId,a,c)},getQueryString:function(){try{var d=(Kotohaco.Url.parseQueryStr((document.referrer.split("?"))[1]))}catch(f){if(Kotohaco.Debug){throw f}else{return null}}var b=[];for(var c=0;c<this.KeywordParams.length;c++){var a="";if((a=String(Kotohaco.Object.inspect(d[this.KeywordParams[c]],"")))!==""){b.push(a)}}return b.join(" ")},createRenderer:function(a){var b=this.getQueryString();a=Kotohaco.Object.inspect(a,{});a.title=String(Kotohaco.Object.inspect(a.title,this.ItemListTitle));a.title=a.title.replace(/%q/,b);var c=String(Kotohaco.Object.inspect(a.footer,this.SearchLinkTitle));c=c.replace(/%q/,b);return function(d){var e=Kotohaco.ItemList.createRenderer(a);var f=e(d);if(f!==""&&c!==""){f+='<div class="'+Kotohaco.ItemList.ClassPrefix+'searchlink">';f+=(document.createElement("div").appendChild(Kotohaco.Object.extend(document.createElement("a"),{title:c,href:Kotohaco.Url.createUrl(Kotohaco.Host,(Kotohaco.AccountId!=="")?("/~"+Kotohaco.AccountId+"/"):"/",{q:b}),innerHTML:Kotohaco.String.escapeHtml(c)}))).parentNode.innerHTML;f+="</div>"}return f}}};Kotohaco.Module._loadedModules.RefQuery=true;Kotohaco.Search={ViewId:"kotohaco_search",show:function(c,a,b){c=Kotohaco.Object.inspect(c);if(c===null){return}a=(Kotohaco.Object.inspect(a)!==null)?a:Kotohaco.ItemList.createRenderer();Kotohaco.ViewRenderer.addJsonpRenderer("search",c,this.ViewId,a,b)}};Kotohaco.Module._loadedModules.Search=true;Kotohaco.Uid={CookieDomain:Kotohaco.Cookie.Domain,CookieExpireDays:1000,CookieName:"jp.co.kotoha.ec.uid"+((Kotohaco.AccountId!=="")?("."+Kotohaco.AccountId):""),TmpCookieName:"jp.co.kotoha.ec.uid_tmp",setUid:function(a){a=encodeURIComponent(String(Kotohaco.Object.inspect(a,"")));if(a===""){return null}Kotohaco.Cookie.setCookie(this.CookieName,a,this.CookieExpireDays,this.CookieDomain);return a},setTmpUid:function(b){b=encodeURIComponent(String(Kotohaco.Object.inspect(b,"")));if(b===""){var c=String(Math.random());var a=String(new Date().getTime());b="kotohacojp"+c.substr(c.length-4)+a.substr(a.length-12)}Kotohaco.Cookie.setCookie(this.TmpCookieName,b,this.CookieExpireDays,this.CookieDomain);return b},getUid:function(a){a=Boolean(Kotohaco.Object.inspect(a,false));var c="";try{c=decodeURIComponent(String(Kotohaco.Object.inspect(Kotohaco.Cookie.getCookie(this.CookieName),"")))}catch(b){if(Kotohaco.Debug){throw b}}if(c===""&&!a){c=String(Kotohaco.Object.inspect(Kotohaco.Cookie.getCookie(this.TmpCookieName),""));if(c===""){c=this.setTmpUid()}}return c}};Kotohaco.Module._loadedModules.Uid=true;Kotohaco.Recommend={ViewId:"kotohaco_recommend",RelationUseUid:true,log:function(a){a=String(Kotohaco.Object.inspect(a,""));if(a===""){return}Kotohaco.Jsonp.send("recoAccess",{itemid:a,k_uid:Kotohaco.Uid.getUid()},"Kotohaco.Recommend.dummyFunction")},dummyFunction:function(){},showRelation:function(g,f,b,e){g=Kotohaco.Object.inspect(g);if(g===null){return}if(g.constructor!==Array){g=[g]}var c=[];for(var d=0;d<g.length;d++){var h=String(Kotohaco.Object.inspect(g[d],""));if(h!==""){c.push(encodeURIComponent(h))}}if(c.length===0){return}f=Kotohaco.Object.inspect(f,{});var a="";if(Boolean(Kotohaco.Object.inspect(this.RelationUseUid))){a="recommend";f.recommend=Kotohaco.Uid.getUid(true);f.recokey=c.join(";")}else{a="relation";f.relation=c.join(";")}b=(Kotohaco.Object.inspect(b)!==null)?b:Kotohaco.ItemList.createRenderer();Kotohaco.ViewRenderer.addJsonpRenderer(a,f,this.ViewId,b,e)},showRecommend:function(d,a,c){var b=Kotohaco.Uid.getUid(true);if(b===""){return}this.showRecommendByUid(b,d,a,c)},showRecommendByUid:function(b,d,a,c){d=Kotohaco.Object.inspect(d,{});b=String(Kotohaco.Object.inspect(b,""));if(b===""){return}d.recommend=b;d.recokey=undefined;a=(Kotohaco.Object.inspect(a)!==null)?a:Kotohaco.ItemList.createRenderer();Kotohaco.ViewRenderer.addJsonpRenderer("recommend",d,this.ViewId,a,c)},showItemHistoryRelation:function(f,a,d){var c=[];try{c=Kotohaco.ItemHistory.getHistory();if(c.length===0){return}}catch(h){if(Kotohaco.Debug){throw h}else{return}}var j=[];for(var b=0;b<c.length;b++){var g=c[b];if(Kotohaco.Object.inspect(g.itemid)!==null){j.push(g.itemid)}}this.showRelation(j,f,a,d)}};Kotohaco.Module._loadedModules.Recommend=true;Kotohaco.SearchHistory=Kotohaco.Object.clone(Kotohaco.History);Kotohaco.SearchHistory.Item=Kotohaco.Class.create();Kotohaco.SearchHistory.Item.prototype={initialize:function(b){b=Kotohaco.Object.inspect(b,{});this.searchCondition=Kotohaco.Object.inspect(b.searchCondition,{});this.searchQuery=Kotohaco.Object.inspect(b.searchQuery,{});try{this.viewtime=parseFloat(Kotohaco.Object.inspect(b.viewtime,(new Date()).getTime()))}catch(c){if(Kotohaco.Debug){throw c}else{this.viewtime=(new Date()).getTime()}}this.name=String(Kotohaco.Object.inspect(b.name,""));if(this.name===""){var a=new Date(this.viewtime);this.name=a.getFullYear()+"/"+(a.getMonth()+1)+"/"+a.getDate()+" "+("00"+a.getHours()).slice(-2)+":"+("00"+a.getMinutes()).slice(-2)}}};Kotohaco.Object.extend(Kotohaco.SearchHistory,{initialize:function(b){this._initializeHistory(b);b=Kotohaco.Object.inspect(b,{});var a;this.CookieName="jp.co.kotoha.ec.searchhistory"+((Kotohaco.AccountId!=="")?("."+Kotohaco.AccountId):"");this.ItemClass=Kotohaco.SearchHistory.Item;this.ViewId="kotohaco_searchhistory";this.RequiredParams=["q"];if((a=Kotohaco.Object.inspect(b.RequiredParams))!==null&&a.constructor===Array){this.RequiredParams=a}this.CompareParams=["q"];if((a=Kotohaco.Object.inspect(b.CompareParams))!==null&&a.constructor===Array){this.CompareParams=a}this.SaveParams=["q","v","l","s","si","sd"];if((a=Kotohaco.Object.inspect(b.SaveParams))!==null&&a.constructor===Array){this.SaveParams=a}this.ViewTitle="";this.ViewTitle=String(Kotohaco.Object.inspect(b.ViewTitle,this.ViewTitle));this.ShowElapsed=false;this.ShowElapsed=Boolean(Kotohaco.Object.inspect(b.ShowElapsed,this.ShowElapsed));this._load()},_assertEquals:function(b,a){b=Kotohaco.Object.inspect(b,{});a=Kotohaco.Object.inspect(a,{});return(Kotohaco.Object.assertEquals(b.searchCondition,a.searchCondition)&&(Kotohaco.Object.inspect(b.searchCondition)!==null))},add:function(a){if(!Kotohaco.Object.assertEquals(this._getQueryObject(this.RequiredParams),{})){this._addHistory(new this.ItemClass({name:String(Kotohaco.Object.inspect(a,"")),searchCondition:this._getQueryObject(this.CompareParams),searchQuery:this._getQueryObject(this.SaveParams)}))}},_getQueryObject:function(f){var d={};if((f=Kotohaco.Object.inspect(f))===null){return d}var c=Kotohaco.Url.parseQueryStr(document.location.search.slice(1));for(var b=0;b<f.length;b++){var e=f[b];var a=String(Kotohaco.Object.inspect(c[e],""));if(e==="q"){a=a.replace(/\s+$/,"")}if(a===""){continue}d[e]=a}return d},renderer:function(f){f=Kotohaco.Object.inspect(f);if(f===null||f.constructor!==Array||f.length==0){return""}var g="<!-- Kotohaco SearchHistory Renderer -->";g+="<dl>";if(this.ViewTitle!==""){g+='<dt class="'+Kotohaco.ItemList.ClassPrefix+'title">';g+=Kotohaco.String.escapeHtml(Kotohaco.SearchHistory.ViewTitle);g+="</dt>"}g+='<dd class="'+Kotohaco.ItemList.ClassPrefix+'searchhistorylist">';g+='<ol class="'+Kotohaco.ItemList.ClassPrefix+'searchhistoryitems">';var d=(new Date()).getTime();for(var e=0;e<f.length;e++){var a=f[e];g+='<li class="'+Kotohaco.ItemList.ClassPrefix+'searchhistoryitem">';var c=document.createElement("div");c.appendChild(Kotohaco.Object.extend(document.createElement("a"),{href:Kotohaco.Url.createUrl(Kotohaco.Host,((Kotohaco.AccountId!=="")?("/~"+Kotohaco.AccountId):"")+"/",Kotohaco.Url.createQueryStr(a.searchQuery)),title:a.name,innerHTML:Kotohaco.String.escapeHtml(a.name)}));if(Kotohaco.SearchHistory.ShowElapsed){var b=parseInt((d-a.viewtime)/1000);if(b<0){b=""}else{if(b<60){b=b+"秒前"}else{if(b<60*60){b=parseInt(b/60)+"分前"}else{if(b<60*60*24){b=parseInt(b/(60*60))+"時間前"}else{b=parseInt(b/(60*60*24))+"日前"}}}}if(b!==""){b="("+b+")"}c.appendChild(Kotohaco.Object.extend(document.createElement("span"),{className:Kotohaco.ItemList.ClassPrefix+"searchhistoryitem_when",innerHTML:b}))}g+=c.innerHTML;g+="</li>"}g+="</ol></dd></dl>";return g},show:function(){var a=this.getHistory();if(a.length===0){return}if(Kotohaco.Object.assertEquals(this._getQueryObject(this.CompareParams),a[0].searchCondition)){a.shift()}if(a.length===0){return}var b=Kotohaco.ViewRenderer.addRenderer(this.ViewId,this.renderer);if(b!==null){b.kotohacoRenderHtml(a)}}});Kotohaco.Module._loadedModules.SearchHistory=true;Kotohaco.UrlBookmarklet={LpoLinkmaker:false,ViewId:"kotohaco_UrlBookmarklet",ViewElement:null,InvalidKeys:["o","searchbox"],BaseUrl:"",init:function(){this.ViewElement=document.getElementById(this.ViewId);if(this.ViewElement===null){var a=document.createElement("div");a.setAttribute("id",this.ViewId);a.style.color="#303030";a.style.padding="20px";a.style.zIndex="9999";a.style.fontSize="1.0em";a.style.border="1px solid #606060";a.style.background="white";a.style.position="fixed";a.style.right="0px";a.style.top="0px";a.style.width="700px";this.ViewElement=document.body.appendChild(a)}this.ViewElement.style.display="block";this.ViewElement.innerHTML="Loading...";Kotohaco.Jsonp.send("parseQuery",{q:document.location.search.slice(1)},"Kotohaco.UrlBookmarklet._initView")},_initView:function(c){var d=c.result;for(var b=0;b<this.InvalidKeys.length;b++){d[this.InvalidKeys[b]]=undefined}this.BaseUrl=Kotohaco.Url.createUrl(document.location.host,document.location.pathname,d);var a="";a+='<p style="text-align:right;"><a href="Javascript:Kotohaco.UrlBookmarklet.close();">[閉じる]</a></p>';a+='<p style="font-size:large; font-weight:bold; color:#000000;">コトハコECエンジン リンク用URL確認ツール</p>';a+='<p style="font-size:large;">表示中のページのURL</p>';a+='<textarea cols="80" rows="3">'+this.BaseUrl+"</textarea><br />";a+="※検索結果の最初のページへのリンクです。<br />";if(this.LpoLinkmaker===true){a+='<hr /><p style="font-size:large;">ランディングページ リンクURL作成</p>';a+='<p>ランディングページ表題: <input type="text" id="kotohaco_urlbookmarklet_lpotitle" size="30" />';a+='<input type="button" value="URLを確認" onClick="Kotohaco.UrlBookmarklet.createLpoUrl()" /></p>';a+='<textarea cols="80" rows="3" id="kotohaco_urlbookmarklet_lpourl"></textarea><br />';a+='<p id="kotohaco_urlbookmarklet_lpolink"></p>'}this.ViewElement.innerHTML=a},createLpoUrl:function(){var a=Kotohaco.Object.inspect(document.getElementById("kotohaco_urlbookmarklet_lpotitle").value,"");Kotohaco.Jsonp.send("encryptText",{s:a},"Kotohaco.UrlBookmarklet._updateLpoUrl")},_updateLpoUrl:function(b){var c=b.result.encodedstr;var a=this.BaseUrl;if(c!==""){a+="&pt="+c}document.getElementById("kotohaco_urlbookmarklet_lpourl").value=a;document.getElementById("kotohaco_urlbookmarklet_lpolink").innerHTML='<a href="'+a+'" target="_blank">表示を確認</a>'},close:function(){this.ViewElement.style.display="none"}};Kotohaco.Module._loadedModules.UrlBookmarklet=true;
