
$(function(){$('#book').addClass('on');$('.store').click(function(){location.href='/store/c0/c0/u0/p1/v0/ALL.html';});$('.vip_store').click(function(){location.href='/store/c0/c0/u0/p1/v1/ALL.html';});$('.option_select').click(function(){var show=$(this).attr("show");drop_onclick(show);});$('.option_select').mouseout(function(){var show=$(this).attr("show");drop_mouseout(show);});$('.option').click(function(){var show=$(this).attr("show");search_show(show,this);});$('.option').mouseover(function(){var show=$(this).attr("show");drop_mouseover(show);});$('.option').mouseout(function(){var show=$(this).attr("show");drop_mouseout(show);});function childCategorys(categoryId){if(parseInt(categoryId)==0){return;}
var url='/ajax/store.childCategoryList.do';var params={categoryId:categoryId};$.ajax({type:"GET",url:url,data:params,success:function(data){if(data){if(data.childCategorys){$("#qblbSel").empty(":gt(0)");for(var i in data.childCategorys){var optionObj=$("<a id=\'"+data.childCategorys[i].cateId+"' show='qblb'>"
+data.childCategorys[i].cateName+"</a>");optionObj.click(function(){var id=$(this).attr("id");var show=$(this).attr("show");$('body').attr('childCategoryId',id);search_show(show,this);});optionObj.mouseover(function(){var show=$(this).attr("show");drop_mouseover(show);});optionObj.mouseout(function(){var show=$(this).attr("show");drop_mouseout(show);});optionObj.wrap("<li></li>").appendTo('#qblbSel');}}}},dataType:'json'});}
$('.load_child').click(function(){var id=$(this).attr("id");$('body').attr('categoryId',id);$('body').attr('childCategoryId',0);$('#qblbSlected').empty();$('#qblbSlected').html('全部类别');childCategorys(id);});childCategorys($('body').attr('categoryId'));$('#option_all_category').click(function(){$('body').attr('categoryId',0);});$('#option_all_child').click(function(){$('body').attr('childCategoryId',0);});$('#search_submit').click(function(){var categoryId=$('body').attr('categoryId');var childCategoryId=$('body').attr('childCategoryId');var page=$('body').attr('page');var vip=$('body').attr('vip');var order=$('body').attr('order');var firstChar=$('body').attr('firstChar');if(!firstChar){firstChar='ALL';}
location.href='/store/c'+categoryId+'/c'+childCategoryId+'/u'+order+"/p"+page+"/v"+vip+"/"+firstChar+".html";});$('.char').click(function(){$('body').attr('firstChar',$(this).attr('value'));var categoryId=$('body').attr('categoryId');var childCategoryId=$('body').attr('childCategoryId');var vip=$('body').attr('vip');var order=$('body').attr('order');var firstChar=$('body').attr('firstChar');if(!firstChar){firstChar='ALL';}
location.href='/store/c'+categoryId+'/c'+childCategoryId+'/u'+order+"/p1/v"+vip+"/"+firstChar+".html";});$('.order').click(function(){$('body').attr('order',$(this).attr('id'));});$('.go_page').click(function(){$('body').attr('page',$(this).attr('page'));var categoryId=$('body').attr('categoryId');var childCategoryId=$('body').attr('childCategoryId');var page=$('body').attr('page');var vip=$('body').attr('vip');var order=$('body').attr('order');var firstChar=$('body').attr('firstChar');if(!firstChar){firstChar='ALL';}
location.href='/store/c'+categoryId+'/c'+childCategoryId+'/u'+order+"/p"+page+"/v"+vip+"/"+firstChar+".html";});function pageGo(){var value=$('#input_page').val();if(!value){return;}
var page=$.trim(value);if(page.match(/^\d+$/)){var categoryId=$('body').attr('categoryId');var childCategoryId=$('body').attr('childCategoryId');var vip=$('body').attr('vip');var order=$('body').attr('order');var firstChar=$('body').attr('firstChar');if(!firstChar){firstChar='ALL';}
if(page<=0){page=1;}
location.href='/store/c'+categoryId+'/c'+childCategoryId+'/u'+order+"/p"+page+"/v"+vip+"/"+firstChar+".html";}else{alert("请输入数字");}}
$('.page_button').click(function(){pageGo();});$(document).keyup(function(event){if(event.keyCode==13){pageGo();}});function search_show(pos,href){document.getElementById(pos+"Sel").style.display="none";document.getElementById(pos+"Slected").innerHTML=href.innerHTML;try{window.clearTimeout(timer);}catch(e){}
return false;}
function drop_onclick(pos){if(document.getElementById(pos+"Sel").style.display=='none'){document.getElementById(pos+"Sel").style.display='block';}else{document.getElementById(pos+"Sel").style.display='none';}
return false;}
function drop_mouseout(pos){var posSel=document.getElementById(pos+"Sel").style.display;if(posSel=="block"){timer=setTimeout(function(){document.getElementById(pos+"Sel").style.display="none";},1000);}}
function drop_mouseover(pos){try{window.clearTimeout(timer);}catch(e){}}
var firstChar=$('body').attr("firstChar");$('.char').each(function(index,element){if($(element).attr("value")==firstChar){$(element).addClass("active");}});});