var LOGIN_SYSTEM="請登入系統";var INPUT_CURRECT_INFO="請輸入正確的帳號與密碼";var INPUT_CONTAIN="請輸入內容";var INPUT_CAPTCHA="請輸入驗證碼";var INPUT_USER_NAME="請輸入使用者帳號";var INPUT_PASSWORD="請輸入密碼";var beNested=false;function postListingComment(a,b){new Ajax.Request("listmania/postComment.ajax.php",{method:"post",parameters:"pid="+encodeURIComponent(a)+"&username="+encodeURIComponent($("username").value)+"&password="+encodeURIComponent($("password").value)+"&commenttext="+encodeURIComponent(ta.value)+"&cparent="+encodeURIComponent(b)+"&user_code="+encodeURIComponent(tc.value)+"&owner_id="+ownerID+"&group_text="+encodeURIComponent("來自蒐藏 ["+listTitle+"] 的討論")+"&listing_id="+listingID,onSuccess:postListingCommentCallback})}function postListingCommentCallback(a){resp=a.responseText;if(resp=="error_captcha"){Element.show("captcha_msg");$("captcha_img").src=PUSH_P+"comment/captcha.php?r="+Math.random()}else{if(resp=="no_login"){alert(LOGIN_SYSTEM);location.reload()}else{if(resp=="error_login"){alert(INPUT_CURRECT_INFO)}else{location.reload()}}}}function checkAndPostComment(a,b){ta=document.getElementById("commenttext_"+b);tc=document.getElementById("captcha_text");if(ta.value.length==0){alert(INPUT_CONTAIN);return}if(tc.value.length==0){alert(INPUT_CAPTCHA);return}if(!isLogin){if($("username").value.length==0){alert(INPUT_USER_NAME);return}if($("password").value.length==0){alert(INPUT_PASSWORD);return}}postListingComment(a,b)}function logout(){new Ajax.Request("logout.ajax.php",{method:"post",onSuccess:logoutCallback})}function logoutCallback(){location.reload()}function doHighlight(g,c,f,e){if((!f)||(!e)){f="<font style='color:blue; background-color:yellow;'>";e="</font>"}var d="";var b=-1;var a=c.toLowerCase();var h=g.toLowerCase();while(g.length>0){b=h.indexOf(a,b+1);if(b<0){d+=g;g=""}else{if(g.lastIndexOf(">",b)>=g.lastIndexOf("<",b)){if(h.lastIndexOf("/script>",b)>=h.lastIndexOf("<script",b)){d+=g.substring(0,b)+f+g.substr(b,c.length)+e;g=g.substr(b+c.length);h=g.toLowerCase();b=-1}}}}return d}function highlightSearchTerms(a,b,d,g,e){if(b){searchArray=[a]}else{searchArray=a.split(" ")}if(!document.body||typeof(document.body.innerHTML)=="undefined"){if(d){alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.")}return false}var f=$("result").innerHTML;for(var c=0;c<searchArray.length;c++){f=doHighlight(f,searchArray[c],g,e)}$("result").innerHTML=f;return true};