var bdRecord=(function(){var config={};config.recordClickNumber=10;config.recordClickWeight=5;config.recordClickShowNumber=10;config.recordSearchNumber=3;config.recordSearchWeight=2;config.recordSearchShowNumber=3;function scope($,B){var $=$||window.esvent,_=$.target||$.srcElement,A={};if(_.tagName.toUpperCase()=="A")A={anchor:encodeURIComponent(_.innerHTML),url:encodeURIComponent(_.href),count:0};if(_.tagName.toUpperCase()=="AREA")A={anchor:encodeURIComponent(_.alt),url:encodeURIComponent(_.href),count:0};if(A.anchor==undefined||A.url==undefined)return;if(B)searchPolicy(decodeURIComponent(A.anchor),B);else clickPolicy(A)}function insertSort(C,$){var _,$=$||false;for(var B=1;B<C.length;B++){_=C[B];if($==false)for(var A=B;A>0&&_.count<C[A-1].count;A--)C[A]=C[A-1];else for(A=B;A>0&&_.count>C[A-1].count;A--)C[A]=C[A-1];C[A]=_}return C}function isClose($){if(userCookie.is("HAORECORDSTATUS")){var _=parseInt(userCookie.get("HAORECORDSTATUS"));if($=="click")if(_==1||_==3)return true;if($=="search")if(_==2||_==3)return true;return false}return false}function searchPolicy(v,tabType){if(isClose("search")||tabType!="web")return;v=trim(v);if(v==""||/(^https?)|(^ftp)/.test(v))return false;var aData=UserData.is("HAOSEARCHRECORD")?eval("("+UserData.get("HAOSEARCHRECORD")+")"):[],aData=insertSort(aData,true),isExist=false,params={anchor:v,count:0};for(var i=0;i<aData.length;i++){if(params.anchor==aData[i].anchor){aData[i].count+=1;aData=insertSort(aData,true);isExist=true;break}isExist=false}if(isExist==false){params.count=1;if(aData.length==config.recordSearchNumber)aData.splice(config.recordSearchWeight,1);aData.push(params)}UserData.set("HAOSEARCHRECORD",jsonToString(aData))}function clickPolicy(params){if(isClose("click"))return;var aData=UserData.is("HAORECORD")?eval("("+UserData.get("HAORECORD")+")"):[],aData=insertSort(aData,true),isExist=false;for(var i=0;i<aData.length;i++){if(params.url==aData[i].url&&params.anchor==aData[i].anchor){aData[i].count+=1;aData=insertSort(aData,true);isExist=true;break}isExist=false}if(isExist==false){params.count=1;if(aData.length==config.recordClickNumber)aData.splice(config.recordClickWeight-1,1);aData.push(params)}UserData.set("HAORECORD",jsonToString(aData))}function printSearchRecord(id,tabType){if(isClose("search")||tabType!="web"){Config.FormConfig.web.content="";return}var aData=UserData.is("HAOSEARCHRECORD")?eval("("+UserData.get("HAOSEARCHRECORD")+")"):[],aDataLength=aData.length<config.recordSearchShowNumber?aData.length:config.recordSearchShowNumber,tStr="",anchor="",content;if(aDataLength==0)return;tStr='<table><tr><td monkey="record_search" align="right" onmousedown="bdRecord.scope(event,\'web\')">';for(var i=0;i<aDataLength;i++){anchor=decodeURIComponent(aData[i].anchor);content=byteSlice(anchor,10);tStr+='<a href="http://www.baidu.com/s?word='+anchor+'&tn=comhao123" title='+anchor+">"+content+"</a>&nbsp;&nbsp;"}tStr+='</td><td align="center" width="50px" monkey="record_clear">'+'<a style="color:#205001" href="#" onclick="bdRecord.close(\'search\');return false;">[\u6e05\u9664]</a><td><tr></table>';G(id).innerHTML=Config.FormConfig.web.content=tStr}function printClickRecord(id){if(isClose("click"))return;var aData=UserData.is("HAORECORD")?eval("("+UserData.get("HAORECORD")+")"):[],aDataLength=aData.length<config.recordClickShowNumber?aData.length:config.recordClickShowNumber;if(aDataLength==0)return;var tStr='<b style="color:#666">\u5feb\u6377\u8bbf\u95ee\uff1a</b>';for(var i=0;i<aDataLength;i++)tStr+='<a href="'+decodeURIComponent(aData[i].url)+'" >'+decodeURIComponent(aData[i].anchor)+"</a>";G(id).innerHTML=tStr+'<a style="color:#205001" href="#" onclick="bdRecord.close(\'click\');return false;">[\u6e05\u9664]</a>';G(id).style.display="block"}function closeRecord(_){var $={click:1,search:2},A=0;userCookie.init();if(userCookie.is("HAORECORDSTATUS")){A=parseInt(userCookie.get("HAORECORDSTATUS"))+$[_];userCookie.set("HAORECORDSTATUS",A)}else if(_=="click"){userCookie.set("HAORECORDSTATUS","1");UserData.remove("HAORECORD")}else if(_=="search"){userCookie.set("HAORECORDSTATUS","2");UserData.remove("HAOSEARCHRECORD")}removeRecord(_)}function removeRecord($){switch($){case"click":UserData.remove("HAORECORD");G("BDRecord").style.display="none";break;case"search":UserData.remove("HAOSEARCHRECORD");G("hao_search_content").innerHTML="";break}}return{scope:scope,searchPolicy:searchPolicy,printSearchRecord:printSearchRecord,print:printClickRecord,remove:removeRecord,close:closeRecord}})()