/*trimpath*/ var TrimPath;(function(){ if(TrimPath==null) TrimPath=new Object(); if(TrimPath.evalEx==null) TrimPath.evalEx=function(src){return eval(src);}; var UNDEFINED; if(Array.prototype.pop==null) Array.prototype.pop=function(){ if(this.length===0){return UNDEFINED;} return this[--this.length];}; if(Array.prototype.push==null) Array.prototype.push=function(){ for(var i=0;i/g,">");}, "capitalize":function(s){return String(s).toUpperCase();}, "default":function(s,d){return s!=null?s:d;}} TrimPath.parseTemplate_etc.modifierDef.h=TrimPath.parseTemplate_etc.modifierDef.escape; TrimPath.parseTemplate_etc.Template=function(tmplName,tmplContent,funcSrc,func,etc){ this.process=function(context,flags){ if(context==null) context={}; if(context._MODIFIERS==null) context._MODIFIERS={}; if(context.defined==null) context.defined=function(str){return(context[str]!=undefined);}; for(var k in etc.modifierDef){ if(context._MODIFIERS[k]==null) context._MODIFIERS[k]=etc.modifierDef[k];} if(flags==null) flags={}; var resultArr=[]; var resultOut={write:function(m){resultArr.push(m);}}; try{ func(resultOut,context,flags);}catch(e){ if(flags.throwExceptions==true) throw e; var result=new String(resultArr.join("")+"[ERROR: "+e.toString()+(e.message?'; '+e.message:'')+"]"); result["exception"]=e; return result;} return resultArr.join("");} this.name=tmplName; this.source=tmplContent; this.sourceFunc=funcSrc; this.toString=function(){return "TrimPath.Template ["+tmplName+"]";}} TrimPath.parseTemplate_etc.ParseError=function(name,line,message){ this.name=name; this.line=line; this.message=message;} TrimPath.parseTemplate_etc.ParseError.prototype.toString=function(){ return("TrimPath template ParseError in "+this.name+": line "+this.line+", "+this.message);} var parse=function(body,tmplName,etc){ body=cleanWhiteSpace(body); var funcText=["var TrimPath_Template_TEMP = function(_OUT, _CONTEXT, _FLAGS) { with (_CONTEXT) {"]; var state={stack:[],line:1}; var endStmtPrev=-1; while(endStmtPrev+1=0){ var endStmt=body.indexOf('}',begStmt+1); var stmt=body.substring(begStmt,endStmt); var blockrx=stmt.match(/^\{(cdata|minify|eval)/); if(blockrx){ var blockType=blockrx[1]; var blockMarkerBeg=begStmt+blockType.length+1; var blockMarkerEnd=body.indexOf('}',blockMarkerBeg); if(blockMarkerEnd>=0){ var blockMarker; if(blockMarkerEnd-blockMarkerBeg<=0){ blockMarker="{/"+blockType+"}";}else{ blockMarker=body.substring(blockMarkerBeg+1,blockMarkerEnd);} var blockEnd=body.indexOf(blockMarker,blockMarkerEnd+1); if(blockEnd>=0){ emitSectionText(body.substring(endStmtPrev+1,begStmt),funcText); var blockText=body.substring(blockMarkerEnd+1,blockEnd); if(blockType=='cdata'){ emitText(blockText,funcText);}else if(blockType=='minify'){ emitText(scrubWhiteSpace(blockText),funcText);}else if(blockType=='eval'){ if(blockText!=null&&blockText.length>0) funcText.push('_OUT.write( (function() { '+blockText+' })() );');} begStmt=endStmtPrev=blockEnd+blockMarker.length-1;}}}else if(body.charAt(begStmt-1)!='$'&& body.charAt(begStmt-1)!='\\'){ var offset=(body.charAt(begStmt+1)=='/'?2:1); if(body.substring(begStmt+offset,begStmt+10+offset).search(TrimPath.parseTemplate_etc.statementTag)==0) break;} begStmt=body.indexOf("{",begStmt+1);} if(begStmt<0) break; var endStmt=body.indexOf("}",begStmt+1); if(endStmt<0) break; emitSectionText(body.substring(endStmtPrev+1,begStmt),funcText); emitStatement(body.substring(begStmt,endStmt+1),state,funcText,tmplName,etc); endStmtPrev=endStmt;} emitSectionText(body.substring(endStmtPrev+1),funcText); if(state.stack.length!=0) throw new etc.ParseError(tmplName,state.line,"unclosed, unmatched statement(s): "+state.stack.join(",")); funcText.push("}}; TrimPath_Template_TEMP"); return funcText.join("");} var emitStatement=function(stmtStr,state,funcText,tmplName,etc){ var parts=stmtStr.slice(1,-1).split(' '); var stmt=etc.statementDef[parts[0]]; if(stmt==null){ emitSectionText(stmtStr,funcText); return;} if(stmt.delta<0){ if(state.stack.length<=0) throw new etc.ParseError(tmplName,state.line,"close tag does not match any previous statement: "+stmtStr); state.stack.pop();} if(stmt.delta>0) state.stack.push(stmtStr); if(stmt.paramMin!=null&& stmt.paramMin>=parts.length) throw new etc.ParseError(tmplName,state.line,"statement needs more parameters: "+stmtStr); if(stmt.prefixFunc!=null) funcText.push(stmt.prefixFunc(parts,state,tmplName,etc)); else funcText.push(stmt.prefix); if(stmt.suffix!=null){ if(parts.length<=1){ if(stmt.paramDefault!=null) funcText.push(stmt.paramDefault);}else{ for(var i=1;i1) funcText.push(' '); funcText.push(parts[i]);}} funcText.push(stmt.suffix);}} var emitSectionText=function(text,funcText){ if(text.length<=0) return; var nlPrefix=0; var nlSuffix=text.length-1; while(nlPrefix=0&&(text.charAt(nlSuffix)==' '||text.charAt(nlSuffix)=='\t')) nlSuffix--; if(nlSuffix0){ funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("'); var s=text.substring(0,nlPrefix).replace('\n','\\n'); if(s.charAt(s.length-1)=='\n') s=s.substring(0,s.length-1); funcText.push(s); funcText.push('");');} var lines=text.substring(nlPrefix,nlSuffix+1).split('\n'); for(var i=0;i1){ funcText.push(','); funcText.push(parts[1]);} funcText.push(')');} var cleanWhiteSpace=function(result){ result=result.replace(/\t/g," "); result=result.replace(/\r\n/g,"\n"); result=result.replace(/\r/g,"\n"); result=result.replace(/^(\s*\S*(\s+\S+)*)\s*$/,'$1'); return result;} var scrubWhiteSpace=function(result){ result=result.replace(/^\s+/g,""); result=result.replace(/\s+$/g,""); result=result.replace(/\s+/g," "); result=result.replace(/^(\s*\S*(\s+\S+)*)\s*$/,'$1'); return result;} TrimPath.parseDOMTemplate=function(elementId,optDocument,optEtc){ if(optDocument==null) optDocument=document; var element=optDocument.getElementById(elementId); var content=element.value; if(content==null) content=element.innerHTML; content=content.replace(/</g,"<").replace(/>/g,">"); return TrimPath.parseTemplate(content,elementId,optEtc);} TrimPath.processDOMTemplate=function(elementId,context,optFlags,optDocument,optEtc){ return TrimPath.parseDOMTemplate(elementId,optDocument,optEtc).process(context,optFlags);}})(); /*pagination*/ jQuery.fn.pagination=function(maxentries,opts){ opts=jQuery.extend({ items_per_page:10, num_display_entries:10, current_page:0, num_edge_entries:0, link_to:"#", prev_text:"Prev", next_text:"Next", ellipse_text:"...", prev_show_always:true, next_show_always:true, callback:function(){return false;}},opts||{}); return this.each(function(){ function numPages(){ return Math.ceil(maxentries/opts.items_per_page);} function getInterval(){ var ne_half=Math.ceil(opts.num_display_entries/2); var np=numPages(); var upper_limit=np-opts.num_display_entries; var start=current_page>ne_half?Math.max(Math.min(current_page-ne_half,upper_limit),0):0; var end=current_page>ne_half?Math.min(current_page+ne_half,np):Math.min(opts.num_display_entries,np); return[start,end];} function pageSelected(page_id,evt){ current_page=page_id; drawLinks(); var continuePropagation=opts.callback(page_id,panel); if(!continuePropagation){ if(evt.stopPropagation){ evt.stopPropagation();} else{ evt.cancelBubble=true;}} return continuePropagation;} function drawLinks(){ panel.empty(); var interval=getInterval(); var np=numPages(); if(np==1){ $(".Pagination").css({display:"none"});} var getClickHandler=function(page_id){ return function(evt){return pageSelected(page_id,evt);}} var appendItem=function(page_id,appendopts){ page_id=page_id<0?0:(page_id"+(appendopts.text)+"");} else{ var lnk=$(""+(appendopts.text)+"") .bind("click",getClickHandler(page_id)) .attr('href',opts.link_to.replace(/__id__/,page_id));} if(appendopts.classes){lnk.addClass(appendopts.classes);} panel.append(lnk);} if(opts.prev_text&&(current_page>0||opts.prev_show_always)){ appendItem(current_page-1,{text:opts.prev_text,classes:"prev"});} if(interval[0]>0&&opts.num_edge_entries>0){ var end=Math.min(opts.num_edge_entries,interval[0]); for(var i=0;i"+opts.ellipse_text+"").appendTo(panel);}} for(var i=interval[0];i0){ if(np-opts.num_edge_entries>interval[1]&&opts.ellipse_text){ jQuery(""+opts.ellipse_text+"").appendTo(panel);} var begin=Math.max(np-opts.num_edge_entries,interval[1]); for(var i=begin;i0){ pageSelected(current_page-1); return true;} else{ return false;}} this.nextPage=function(){ if(current_pageul>li".split(">"),mainTimer:null,subTimer:null,tag:false,convert:false,btn:null,disabled:"disabled",pos:{ojbect:null,clone:null}},option||{});var object=this.find(s.dom[1]);var subObject=this.find(s.dom[2]);var clone;if(s.deriction=="up"||s.deriction=="down"){var height=object.eq(0).outerHeight();var step=s.step*subObject.eq(0).outerHeight();object.css({width:s.width+"px",overflow:"hidden"});};if(s.deriction=="left"||s.deriction=="right"){var width=subObject.length*subObject.eq(0).outerWidth();object.css({width:width+"px",overflow:"hidden"});var step=s.step*subObject.eq(0).outerWidth();};var init=function(){var wrap="
";object.css({position:"absolute",left:0,top:0}).wrap(wrap);s.pos.object=0;clone=object.clone();object.after(clone);switch(s.deriction){default:case "up":object.css({marginLeft:0,marginTop:0});clone.css({marginLeft:0,marginTop:height+"px"});s.pos.clone=height;break;case "down":object.css({marginLeft:0,marginTop:0});clone.css({marginLeft:0,marginTop:-height+"px"});s.pos.clone=-height;break;case "left":object.css({marginTop:0,marginLeft:0});clone.css({marginTop:0,marginLeft:width+"px"});s.pos.clone=width;break;case "right":object.css({marginTop:0,marginLeft:0});clone.css({marginTop:0,marginLeft:-width+"px"});s.pos.clone=-width;break;};if(s.auto){initMainTimer();object.hover(function(){clear(s.mainTimer);},function(){initMainTimer();});clone.hover(function(){clear(s.mainTimer);},function(){initMainTimer();});};if(callback){callback();};if(s.control){initControls();}};var initMainTimer=function(delay){clear(s.mainTimer);s.stay=delay?delay:s.stay;s.mainTimer=setInterval(function(){initSubTimer()},s.stay);};var initSubTimer=function(){clear(s.subTimer);s.subTimer=setInterval(function(){roll()},s.delay);};var clear=function(timer){if(timer!=null){clearInterval(timer);}};var disControl=function(A){if(A){$(s._front).unbind("click");$(s._back).unbind("click");$(s._stop).unbind("click");$(s._continue).unbind("click");}else{initControls();}};var initControls=function(){if(s._front!=null){$(s._front).click(function(){$(s._front).addClass(s.disabled);disControl(true);clear(s.mainTimer);s.convert=true;s.btn="front";if(!s.auto){s.tag=true;};convert();});};if(s._back!=null){$(s._back).click(function(){$(s._back).addClass(s.disabled);disControl(true);clear(s.mainTimer);s.convert=true;s.btn="back";if(!s.auto){s.tag=true;};convert();});};if(s._stop!=null){$(s._stop).click(function(){clear(s.mainTimer);});};if(s._continue!=null){$(s._continue).click(function(){initMainTimer();});}};var convert=function(){if(s.tag&&s.convert){s.convert=false;if(s.btn=="front"){if(s.deriction=="down"){s.deriction="up";};if(s.deriction=="right"){s.deriction="left";}};if(s.btn=="back"){if(s.deriction=="up"){s.deriction="down";};if(s.deriction=="left"){s.deriction="right";}};if(s.auto){initMainTimer();}else{initMainTimer(4*s.delay);}}};var setPos=function(y1,y2,x){if(x){clear(s.subTimer);s.pos.object=y1;s.pos.clone=y2;s.tag=true;}else{s.tag=false;};if(s.tag){if(s.convert){convert();}else{if(!s.auto){clear(s.mainTimer);}}};if(s.deriction=="up"||s.deriction=="down"){object.css({marginTop:y1+"px"});clone.css({marginTop:y2+"px"});};if(s.deriction=="left"||s.deriction=="right"){object.css({marginLeft:y1+"px"});clone.css({marginLeft:y2+"px"});}};var roll=function(){var y_object=(s.deriction=="up"||s.deriction=="down")?parseInt(object.get(0).style.marginTop):parseInt(object.get(0).style.marginLeft);var y_clone=(s.deriction=="up"||s.deriction=="down")?parseInt(clone.get(0).style.marginTop):parseInt(clone.get(0).style.marginLeft);var y_add=Math.max(Math.abs(y_object-s.pos.object),Math.abs(y_clone-s.pos.clone));var y_ceil=Math.ceil((step-y_add)/s.speed);switch(s.deriction){case "up":if(y_add==step){setPos(y_object,y_clone,true);$(s._front).removeClass(s.disabled);disControl(false);}else{if(y_object<=-height){y_object=y_clone+height;s.pos.object=y_object;};if(y_clone<=-height){y_clone=y_object+height;s.pos.clone=y_clone;};setPos((y_object-y_ceil),(y_clone-y_ceil));};break;case "down":if(y_add==step){setPos(y_object,y_clone,true);$(s._back).removeClass(s.disabled);disControl(false);}else{if(y_object>=height){y_object=y_clone-height;s.pos.object=y_object;};if(y_clone>=height){y_clone=y_object-height;s.pos.clone=y_clone;};setPos((y_object+y_ceil),(y_clone+y_ceil));};break;case "left":if(y_add==step){setPos(y_object,y_clone,true);$(s._front).removeClass(s.disabled);disControl(false);}else{if(y_object<=-width){y_object=y_clone+width;s.pos.object=y_object;};if(y_clone<=-width){y_clone=y_object+width;s.pos.clone=y_clone;};setPos((y_object-y_ceil),(y_clone-y_ceil));};break;case "right":if(y_add==step){setPos(y_object,y_clone,true);$(s._back).removeClass(s.disabled);disControl(false);}else{if(y_object>=width){y_object=y_clone-width;s.pos.object=y_object;};if(y_clone>=width){y_clone=y_object-width;s.pos.clone=y_clone;};setPos((y_object+y_ceil),(y_clone+y_ceil));};break;}};if(s.deriction=="up"||s.deriction=="down"){if(height>=s.height&&height>=s.step){init();}};if(s.deriction=="left"||s.deriction=="right"){if(width>=s.width&&width>=s.step){init();}}}})(jQuery); /*search_plug*/ var $GLOBAL_VAR={"_text":"","_arr":null,"_count":0,"_num":0,"_select":null,"_out_select":null,"_flag":true};var $callback={"hidden":function(){if($GLOBAL_VAR._flag){$dt._div.style.display="none";}},"input_event":function(event){var _e=event||window.event;if($GLOBAL_VAR._text==$dt._tbox.value||_e.keyCode=="40"||_e.keyCode=="38"){$o.move(_e);}else{$GLOBAL_VAR._count=0;$GLOBAL_VAR._text=$dt._tbox.value;if(_e.keyCode=="13"){$callback.hidden();}else{$util.createElement($o.updatelist);}}}};var Operator=function(){this.updatelist=function(){if(text.length<1){$dt._div.style.display="none";return;}$GLOBAL_VAR._arr=text.split("|");var _t;var _html="";for(var _i=0;_i<$GLOBAL_VAR._arr.length-1;_i++){_t=$GLOBAL_VAR._arr[_i].split(",");_html+=$pro._htmls[0]+_t[0]+$pro._htmls[1]+(_i+1)+$pro._htmls[2]+_t[1]+$pro._htmls[3]+_t[0]+$pro._htmls[4];}_html+=$pro._htmls[5];$dt._div.innerHTML=_html;$dt._div.style.display="block";$dt._div.onmouseover=function(){$GLOBAL_VAR._flag=false;};$dt._div.onmouseout=function(){$GLOBAL_VAR._flag=true;};$GLOBAL_VAR._num=$GLOBAL_VAR._arr.length-1;};this.xg=function(){$GLOBAL_VAR._arr=text.split("|");var _t;var _html="";for(var _i=0;_i<$GLOBAL_VAR._arr.length-1;_i++){if(_i==10){continue;}_t=$GLOBAL_VAR._arr[_i].split(",");if(_t[0].length>10||_t[0]==$dt._tbox.value){continue;}_html+=$pro._xghtmls[0]+_t[0]+$pro._xghtmls[1]+_t[0]+$pro._xghtmls[2];}if(_html.length<1){$util.get("CorrSearch").style.display="none";}return _html;};this.move=function(_e){if(_e.keyCode=="40"){$GLOBAL_VAR._count++;if($GLOBAL_VAR._count>$GLOBAL_VAR._num){$GLOBAL_VAR._count=1;}this.moveDown();}if(_e.keyCode=="38"){$GLOBAL_VAR._count--;if($GLOBAL_VAR._count<1){$GLOBAL_VAR._count=$GLOBAL_VAR._num;}this.moveUp();}};this.moveUp=function(){$GLOBAL_VAR._select=$util.get("d_"+$GLOBAL_VAR._count);if($GLOBAL_VAR._count==$GLOBAL_VAR._num){$GLOBAL_VAR._out_select=$util.get("d_1");}else{$GLOBAL_VAR._out_select=$util.get("d_"+($GLOBAL_VAR._count+1));}$GLOBAL_VAR._out_select.style.backgroundColor="";$GLOBAL_VAR._select.style.backgroundColor="#FFFF99";$dt._tbox.value=$GLOBAL_VAR._arr[$GLOBAL_VAR._count-1].split(",")[0];};this.moveDown=function(){$GLOBAL_VAR._select=$util.get("d_"+$GLOBAL_VAR._count);if($GLOBAL_VAR._count==1){$GLOBAL_VAR._out_select=$util.get("d_"+$GLOBAL_VAR._num);}else{$GLOBAL_VAR._out_select=$util.get("d_"+($GLOBAL_VAR._count-1));}$GLOBAL_VAR._out_select.style.backgroundColor="";$GLOBAL_VAR._select.style.backgroundColor="#FFFF99";$dt._tbox.value=$GLOBAL_VAR._arr[$GLOBAL_VAR._count-1].split(",")[0];};this.selectText=function(_d){$GLOBAL_VAR._flag=true;$dt._tbox.value=_d.title;$callback.hidden();window.location.href="http://search.360buy.com/search?keyword="+_d.title;};this.over=function(_d){_d.style.backgroundColor="#FFFF99";};this.out=function(_d){_d.style.backgroundColor="";};};var MyUtil=function(){this.get=function(_id){return document.getElementById(_id);};this.createElement=function(_callback){if($dt._tbox.value.length<1){$dt._div.style.display="none";return;}var flag=function(){if(_callback==null)return;};var _element=null;var _e=this.get($pro._script_id);if(_e){_e.parentNode.removeChild(_e);}_element=document.createElement("script");_element.id=$pro._script_id;_element.src=$pro._action+($dt._tbox.value);_element.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(_element);if(document.all){_element.onreadystatechange=function(){var state=_element.readyState;if(state=="loaded"||state=="interactive"||state=="complete"){if(_callback==null){return;}_callback();}};}else{flag();_element.onload=_callback;}};};var Properties={"_action":"http://search.360buy.com/ks?keyword=","_input":"key","_div":"tie","_script_id":"_rs","_htmls":new Array("
  • 约","条
    ","
  • ",""),"_xghtmls":new Array("")};var Dt=function(t,d){this._div=d;this._tbox=t;};var $util=new MyUtil();var $pro=Properties;var $o=new Operator();var $dt=new Dt($util.get($pro._input),$util.get($pro._div));if(null!==$dt._tbox){$dt._tbox.onkeyup=$callback.input_event;$dt._tbox.onblur=$callback.hidden;}