var xdefault_word="2\u500b\u4ee5\u4e0a\u95dc\u9375\u5b57,\u8acb\u4ee5\u7a7a\u767d\u9694\u958b \u4f8b:Tiffany \u9805\u93c8",tmp_button,tmp_sec=31536000,tmp_display=0,tmp_overcheck=0,tmp_originalword="",tmp_viewlocation=0,root_path="http://www.mogan.com.tw/",content=[],browser=navigator.appName; jQuery(function(){xs_default();if(getCookie("suggest_button"))tmp_button=getCookie("suggest_button");else{tmp_button="1";setCookie("suggest_button",tmp_button,tmp_sec)}jQuery("#keyword").keyup(function(a){if(browser=="Netscape"){document.captureEvents(Event.KEYDOWN);a.eventstype=a.which}else if(browser=="Microsoft Internet Explorer")a.eventstype=a.keyCode;if(a.eventstype==38)xs_keyup();else if(a.eventstype==40)xs_keydown();else{if(a.eventstype==13){if(tmp_viewlocation!=0){jQuery("#keyword").attr({value:jQuery("#xs_word_"+ tmp_viewlocation+" > table > tbody > tr > td").eq(0).text()});tmp_viewlocation=0}jQuery("#suggest").css({display:"none"})}getSuggest(jQuery("#keyword").val())}});jQuery("#suggest").mouseover(function(){tmp_overcheck=1});jQuery("#suggest").mouseout(function(){tmp_overcheck=0});jQuery("#keyword").blur(function(){if(tmp_overcheck==0){jQuery("#suggest").css({display:"none"});tmp_viewlocation=0}})}); function setCookie(a,b,d,c,e){a=a+"="+encodeURIComponent(b);if(d){b=new Date;b.setTime(b.getTime()+d*1000);a+=";expires="+b.toUTCString()}if(c)a+=";domain="+c;if(e)a+=";path="+e;document.cookie=a}function getCookie(a){if(document.cookie.length==0)return false;var b=document.cookie.search(a+"=");if(b==-1)return false;b+=a.length+1;a=document.cookie.indexOf(";",b);if(a==-1)a=document.cookie.length;return document.cookie.slice(b,a)} function xs_default(a){if(a=="1"){if(jQuery("#keyword").val()==""||jQuery("#keyword").val()==xdefault_word)jQuery("#keyword").attr({value:"",title:xdefault_word})}else jQuery("#keyword").val()==""&&jQuery("#keyword").attr({value:xdefault_word,title:xdefault_word})}function button_default(){if(tmp_display==1){jQuery("#suggest").css({display:"none"});tmp_display=0}else{var a={};a=button_access();jQuery("#suggest").html(a);jQuery("#suggest").css({display:"block"});tmp_display=1}} function xgetvalue(a,b){var d={};a=a.getElementsByTagName(b);return d=a[0].firstChild.nodeValue}function getSuggest(a){tmp_originalword=a;if(a!=""&&tmp_button=="1"){jQuery("#suggest").css({display:"block"});jQuery.get(root_path+"xsuggest.php",{keyword:a},function(b){xs_access(b)})}else jQuery("#suggest").css({display:"none"})} function xs_access(a){a=a.getElementsByTagName("data");var b={};b="";if(a.length>0){for(i=0;i<a.length;i++){content[i]=[];content[i].title=xgetvalue(a[i],"title");content[i].frequency=xgetvalue(a[i],"frequency");b+=content_access(i+1,content[i].title,content[i].frequency)}b+=button_access();jQuery("#suggest").html(b)}}function suggest_display(){tmp_button=jQuery("#suggest_button").attr("checked")?"1":"0";jQuery("#suggest").css({display:"none"});setCookie("suggest_button",tmp_button,tmp_sec)} function button_access(){var a={};a='<div align="right" style="font-weight:bold"> ';a+=tmp_button=="1"?'<input type="checkbox" id="suggest_button" onClick="suggest_display()" checked />':'<input type="checkbox" id="suggest_button" onClick="suggest_display()" /> ';a+="\u641c\u5c0b\u5efa\u8b70\u958b\u95dc</div>";return a} function content_access(a,b,d){var c={};c="";tmp_width=Number(d)*0.5;match_format="<font color=#ff0000>"+tmp_originalword+"</font>";c+='<div id="xs_word_'+a+'" onmouseover="xs_style(\'Over\',this.id)" onmouseout="xs_style(\'Out\',this.id)" onclick="xs_replace(this.id)" class="xsrowcss"><table width="100%" border="0">';c+="<tr><td>"+b.replace(tmp_originalword,match_format)+"</td>";c+='<td width="30%" align="right">'+d+'%<img src="http://www.mogan.com.tw/images/bg_bar_search.gif" width="'+tmp_width+ '%" height="10" border="0" /> </td></tr>';c+="</table></div>";return c}function xs_style(a,b){if(a=="Over")jQuery("#"+b).css({"background-color":"#FFFFCC"});else a=="Out"&&jQuery("#"+b).css({"background-color":""})}function xs_replace(a){a=a.split("xs_word_");a=Number(a[1])-1;jQuery("#keyword").attr({value:content[a].title});jQuery("#suggest").css({display:"none"});tmp_viewlocation=0} function xs_keyup(){if(tmp_viewlocation>0){tmp_viewlocation--;var a=tmp_viewlocation+1;tmp_viewlocation+1>=0&&xs_style("Out","xs_word_"+a);xs_style("Over","xs_word_"+tmp_viewlocation)}else{a=jQuery("#suggest > div").length-1;xs_style("Out","xs_word_"+tmp_viewlocation);xs_style("Over","xs_word_"+a);tmp_viewlocation=a}} function xs_keydown(){var a=jQuery("#suggest > div").length;if(tmp_viewlocation<a-1){tmp_viewlocation++;a=tmp_viewlocation-1;tmp_viewlocation-1>=0&&xs_style("Out","xs_word_"+a);xs_style("Over","xs_word_"+tmp_viewlocation)}else{xs_style("Out","xs_word_"+tmp_viewlocation);tmp_viewlocation=0}};