var SearchByColor=function(){};SearchByColor.dumper=function(a){return objectdump(a,document.getElementById("_debug"))};SearchByColor.resErrMsg=function(){$j("#color_next_btn").hide();$j("#color_search_disp").html('<div class="res_error">商品が見つかりませんでした。</div>')};SearchByColor.totalCount=null;SearchByColor.currAjxPageNum=1;SearchByColor.currAjxPageData={};SearchByColor.callBacks={colorProd:function(a){SearchByColor.totalCount=a.TotalCount;SearchByColor.currAjxPageData[SearchByColor.currAjxPageNum]=a;if(SearchByColor.totalCount!=null&&(Math.floor(SearchByColor.totalCount/(SearchByColor.sByCObj.qryData.params.count+SearchByColor.sByCObj.qryData.params.start-1))==0)||SearchByColor.totalCount==SearchByColor.sByCObj.qryData.params.count){SearchByColor.sByCObj.nextBtnhide()}var b=a.Products;if(b!=null){var c="";$j.each(b,function(h){var g=this.product_id;var e=decodeURIComponent(this.name);var d=ZetaUtil.separate3(this.price_sale);var f="/item/top/"+g+"/"+this.name+"/";var k=this.cat_id_1;var j=this.cat_id_2;var l=k;if(j!=null&&j.length!=0){l+="/"+j}c+='<div class="color_prod"><div id="row_image_id_'+g+'" class="color_prod_img image"><a href="'+f+'"><img class="product_img" src="'+this.url+'" onload="normalizeBox(this, 110)"; onmousedown="DragDropObject.setProductId('+g+"); DragDropObject.setCategory('"+l+'\');" /></a></div><div id="info_tt_order_by_'+(h+1)+'" class="box_info_tooltips"><div class="info_tt_arraw"></div><div class="info_tooltips"><div class="info_tt_name">'+e+'</div><div class="info_tt_price"><img alt="円" title="円" src="/images/icon/yen.gif" />'+d+"</div></div></div></div>"});$j("#color_search_disp").html(c+'<br class="clear" />');$j("div.color_prod").hover(function(){var d=$j(this);var e=$j("div.box_info_tooltips",d).get(0).id.replace("info_tt_order_by_","");var h=d.position();var g=null;var f=h.top;if(e%6!=1){g=h.left+15}else{g=h.left+90;$j("div.info_tt_arraw",d).css({marginRight:120})}$j("div.box_info_tooltips",d).css({top:f+110,left:g-87}).show()},function(){$j("div.box_info_tooltips",$j(this)).hide()});$j("div.box_info_tooltips").hover(function(){$j(this).hide()},function(){});$j("div.image").draggable({helper:"clone",revert:true,zIndex:100,start:function(f,d){},drag:function(f,d){SimilaritySearchBox.isSimiOtherType=false;DragDropObject.setProductId(DragDropObject.getProductId())},stop:function(f,d){}})}else{SearchByColor.resErrMsg()}}};SearchByColor.prototype={qryData:{url:"/api.miteca.jp/api/json/search/color/",params:{color:"",category:"",start:1,count:24},callBack:"colorProd"},ajxJson:function(qryData){var callBkMeth=eval(SearchByColor.callBacks[qryData.callBack]);var currData=SearchByColor.currAjxPageData[SearchByColor.currAjxPageNum];if(currData!=null&&currData.length!=0){callBkMeth(currData)}else{var thisObj=this;$j.ajax({async:true,url:qryData.url,type:"POST",cache:true,timeout:20000,data:qryData.params,dataType:"json",complete:function(){},success:function(resData){try{var resJson=resData.json_data;if(resJson.status==200){callBkMeth(resJson.dataList)}else{SearchByColor.resErrMsg()}}catch(e){SearchByColor.resErrMsg();SearchByColor.dumper(e)}},error:function(resData){SearchByColor.resErrMsg();SearchByColor.dumper(resData)}})}},initAction:function(){$j("#color_search_area").show();var b=location.hash;if(b!=""&&b.length!=0){var c=b.split("__");var a=c[1];if(a.search(/^#[0-9a-fA-F]{6}$/)!=-1){$j("#color").val(a)}$j("#cat_sele_color").val(c[2])}else{if(this.DEFAULT_COLOR!=""){$j("#color").val(this.DEFAULT_COLOR)}if(this.DEFAULT_CATEGORY!=""){$j("#cat_sele_color").val(this.DEFAULT_CATEGORY)}}this.submitClick();$j("#picker").farbtastic("#color");this.currentColor()},currentColor:function(){$j("#current_clolor").css({background:$j("#color").val()})},submitClick:function(){$j("#color_search_disp").html(this.loadImage());var b=$j("#color").val();var c=$j("#cat_sele_color").val();this.setLocationHref({currColor:b,currCat:c});var a=this.changeRGBMap(b);this.qryData.params.color=a.r+","+a.g+","+a.b;this.qryData.params.category=c;this.ajxJson(this.qryData)},setLocationHref:function(a){location.href=location.pathname+"#__"+a.currColor+"__"+a.currCat},loadImage:function(){return'<div class="color_loading_image"><img src="/images/parts/loading_circle_big01.gif" /></div>'},changeRGB:function(a){return new RGBColor(a)},changeRGBMap:function(b){var a=this.changeRGB(b);return{r:a.r,g:a.g,b:a.b}},changeRGBToHex:function(a){return this.changeRGB(a).toHex()},preBtnClick:function(){SearchByColor.currAjxPageNum--;this.qryData.params.start=this.qryData.params.start-this.qryData.params.count;this.submitClick();if(this.qryData.params.start==1){this.preBtnhide()}if(this.isNextBtn_off){this.nextBtnShow()}},nextBtnClick:function(){SearchByColor.currAjxPageNum++;if(this.qryData.params.start==1){this.preBtnShow()}this.qryData.params.start=this.qryData.params.start+this.qryData.params.count;this.submitClick();if(SearchByColor.totalCount!=null&&(Math.floor(SearchByColor.totalCount/(this.qryData.params.count+this.qryData.params.start-1))==0||Math.floor(SearchByColor.totalCount%(this.qryData.params.count+this.qryData.params.start-1))==0)){this.nextBtnhide();this.isNextBtn_off=true}},isNextBtn_off:false,preBtnShow:function(){$j("#color_pre_btn").html('<img src="/images/common/btn/prev_btn_on_02.gif" alt="prev" />').show()},preBtnhide:function(){$j("#color_pre_btn").hide()},nextBtnShow:function(){$j("#color_next_btn").html('<img src="/images/common/btn/next_btn_on_02.gif" alt="next" />').show()},nextBtnhide:function(){$j("#color_next_btn").hide()}};SearchByColor.sByCObj="";$j("div.pre_next_btn").hover(function(){$j(this).css({paddingTop:"10px"})},function(){$j(this).css({paddingTop:"0px"})});