function checklength(b){var c=bbinsert&&wysiwyg?html2bbcode(getEditorContents()):(!b.parseurloff.checked?parseurl(b.message.value):b.message.value);var a=postmaxchars!=0?lang.board_allowed+": "+postminchars+" "+lang.lento+" "+postmaxchars+" "+lang.bytes:"";alert("\n"+lang.post_curlength+": "+mb_strlen(c)+" "+lang.bytes+"\n\n"+a)}if(!tradepost){var tradepost=0}function validate(a,b){var c=bbinsert&&wysiwyg?html2bbcode(getEditorContents()):(!a.parseurloff.checked?parseurl(a.message.value):a.message.value);if(($("postsubmit").name!="replysubmit"&&!($("postsubmit").name=="editsubmit"&&!isfirstpost)&&a.subject.value=="")||c==""){alert(lang.post_subject_and_message_isnull);if(special!=2){a.subject.focus()}return false}else{if(mb_strlen(a.subject.value)>80){alert(lang.post_subject_toolong);a.subject.focus();return false}}if(tradepost){if(a.item_name.value==""){alert(lang.post_trade_goodsname_null);a.item_name.focus();return false}else{if(a.item_price.value==""){alert(lang.post_trade_price_null);a.item_price.focus();return false}else{if(!parseInt(a.item_price.value)){alert(lang.post_trade_price_is_number);a.item_price.focus();return false}else{if(a.item_costprice.value!=""&&!parseInt(a.item_costprice.value)){alert(lang.post_trade_costprice_is_number);a.item_costprice.focus();return false}else{if(a.item_number.value!="0"&&!parseInt(a.item_number.value)){alert(lang.post_trade_amount_is_number);a.item_number.focus();return false}}}}}}if(in_array($("postsubmit").name,["topicsubmit","editsubmit"])){if(a.typeid&&(a.typeid.options&&a.typeid.options[a.typeid.selectedIndex].value==0)&&typerequired){alert(lang.post_type_isnull);a.typeid.focus();return false}if(special==3&&isfirstpost){if(a.rewardprice.value==""){alert(lang.post_reward_credits_null);a.rewardprice.focus();return false}}else{if(special==4&&isfirstpost){if(a.activityclass.value==""){alert(lang.post_activity_sort_null);a.activityclass.focus();return false}else{if($("starttimefrom_0").value==""&&$("starttimefrom_1").value==""){alert(lang.post_activity_fromtime_null);return false}else{if(a.activityplace.value==""){alert(lang.post_activity_addr_null);a.activityplace.focus();return false}}}}else{if(special==6&&isfirstpost){$("subjectu8").value=encodeURIComponent($("subject").value);if($("tags")!=null){$("tagsu8").value=encodeURIComponent($("tags").value)}if($("vid").value==""){alert(lang.post_video_uploading);return false}else{if($("vclass")&&getradiovalue("vclass")==""){alert(lang.post_video_vclass_required);return false}}}}}}if(!disablepostctrl&&((postminchars!=0&&mb_strlen(c)<postminchars)||(postmaxchars!=0&&mb_strlen(c)>postmaxchars))){alert(lang.post_message_length_invalid+"\n\n"+lang.post_curlength+": "+mb_strlen(c)+" "+lang.bytes+"\n"+lang.board_allowed+": "+postminchars+" "+lang.lento+" "+postmaxchars+" "+lang.bytes);return false}a.message.value=c;if(in_array($("postsubmit").name,["topicsubmit","replysubmit"])){seccheck(a,seccodecheck,secqaacheck,b)}if(b||$("postsubmit").name=="editsubmit"){return true}}function seccheck(b,f,e,d){if(!d&&(f||e)){var c="ajax.do?inajax=1&action=";if(f){var a=new Ajax();a.get(c+"checkseccode&seccodeverify="+(is_ie&&document.charset=="utf-8"?encodeURIComponent($("seccodeverify").value):$("seccodeverify").value),function(g){if(g!="succeed"){alert(g);$("seccodeverify").focus()}else{if(e){checksecqaa(c,b)}else{postsubmit(b)}}})}else{if(e){checksecqaa(c,b)}}}else{postsubmit(b,d)}}function checksecqaa(c,b){var a=new Ajax();var d=$("secanswer").value;d=is_ie&&document.charset=="utf-8"?encodeURIComponent(d):d;a.get(c+"checksecanswer&secanswer="+d,function(e){if(e!="succeed"){alert(e);$("secanswer").focus()}else{postsubmit(b)}})}function postsubmit(a,b){if(!b){a.replysubmit?a.replysubmit.disabled=true:a.topicsubmit.disabled=true;a.submit()}}function previewpost(){if(!validate($("postform"),true)){$("subject").focus();return}$("previewmessage").innerHTML='<span class="bold"><span class="smalltxt">'+$("subject").value+'</span></span><br /><br /><span style="font-size: {MSGFONTSIZE}">'+bbcode2html($("postform").message.value)+"</span>";$("previewtable").style.display="";window.scroll(0,0)}function clearcontent(){if(wysiwyg&&bbinsert){editdoc.body.innerHTML=is_moz?"<br />":""}else{textobj.value=""}}function resizeEditor(c){var a=bbinsert?editbox:textobj;var b=parseInt(a.style.height,10)+c;if(b>=100){a.style.height=b+"px"}}function relatekw(){var a=getEditorContents();a=a.substr(0,500);a=a.replace(/&/ig,"",a);ajaxget("relatekw.jsp?subjectenc="+$("subject").value+"&messageenc="+a,"tagselect")}function getradiovalue(c){var a=document.getElementsByTagName("input");for(var b=0;b<a.length;b++){if(a[b].name==c&&a[b].checked){return a[b].value}}return""};
