function openForumHistory(B){dojo.byId("forumHistoryClosed").style.display=B?"none":"";dojo.byId("forumHistoryOpen").style.display=B?"":"none"}function selectForumUserInfo(D,C){dojo.byId("forumUserInfoLink_"+D+"_user").className=C=="user"?"active":"";dojo.byId("forumUserInfoLink_"+D+"_phone").className=C=="phone"?"active":"";dojo.byId("forumUserInfo_"+D+"_user").style.display=C=="user"?"":"none";dojo.byId("forumUserInfo_"+D+"_phone").style.display=C=="phone"?"":"none"}function saveForumPost(Z,d,a,c,b,W,R,V,T,U,Q,Y,S,X,P){console.debug("saveForumPost -- form = "+Z);Z.submitPost.disabled="disabled";Z.previewPost.disabled="disabled";dojo.xhrPost({url:d+"/forum/post/post",form:Z,handleAs:"json",contentType:"application/x-www-form-urlencoded; charset=utf-8",load:function(B,A){Z.submitPost.disabled=null;Z.previewPost.disabled=null;if(B.status=="ok"){clearErrors(Z,b,W);if(Z.action.value=="submit"){document.location.href=d+"/"+a+"/thread/"+B.threadId+"/"+B.urlTitle+(B.startIndex>0?("?si="+B.startIndex):"")+"#p"+B.postId}else{dojo.byId("previewOuterContainer").style.display="";dojo.byId("previewInnerContainer").innerHTML='<table class="forumEntry" cellspacing="0">'+B.previewHtml+"</table>"}}else{if(B.sessionExpired){showPasswordParagraph(Y,S,X,P);alert(B.sessionExpired)}else{if(B.passwordError){showPasswordParagraph(Y,S,X,P)}showErrors(Z,b,W,R,V,B.errors)}}},error:function(B,A){Z.submitPost.disabled=null;Z.previewPost.disabled=null;alert(B.status==410?T:B.status==403?U:Q)}})}function setAllPostsRead(L,I,G,J){if(!confirm(G)){return}var H=dojo.byId("setAllPostsReadButton");var K=dojo.byId("setAllPostsReadDisabled");if(H&&K){H.style.display="none";K.style.display=""}dojo.xhrPost({url:L+"/"+I+"/set-all-posts-read",handleAs:"json",load:function(B,A){if(B.status=="ok"){window.location.reload()}else{if(B.sessionExpired){if(H&&K){H.style.display="";K.style.display="none"}alert(B.sessionExpiredError)}}},error:function(B,A){if(H&&K){H.style.display="";K.style.display="none"}alert(J)}})}function subscribeToThread(G,H,K,I,L,J){dojo.xhrPost({url:G+"/"+H+"/subscribe-to-thread",content:{threadId:K,subscribe:I?"1":"0"},handleAs:"json",load:function(B,A){if(B.status=="ok"){var C=dojo.byId("subscribeButton1");var D=dojo.byId("subscribeButton2");if(C){C.style.display=I?"none":""}if(D){D.style.display=I?"none":""}dojo.byId("unsubscribeButton1").style.display=I?"":"none";dojo.byId("unsubscribeButton2").style.display=I?"":"none"}else{if(B.sessionExpired){alert(B.sessionExpiredError)}}},error:function(B,A){alert(B.status==403?L:J)}})}function setThreadAnswered(N,I,K,M,H,L,J){if(!confirm(H)){return}dojo.xhrPost({url:N+"/"+I+"/set-thread-answered",content:{threadId:K,answered:M?"1":"0"},handleAs:"json",load:function(B,A){if(B.status=="ok"){dojo.byId("setAnsweredButton1").style.display=M?"none":"";dojo.byId("setAnsweredButton2").style.display=M?"none":"";dojo.byId("unsetAnsweredButton1").style.display=M?"":"none";dojo.byId("unsetAnsweredButton2").style.display=M?"":"none"}else{if(B.sessionExpired){alert(B.sessionExpiredError)}}},error:function(B,A){alert(B.status==403?L:J)}})}function setThreadStickiness(Q,O,L,N,R,P,M,K){var J=prompt(R,N);if(J==null||J==""){return}var N=parseInt(J);if(isNaN(N)||N<0){alert(P);return}dojo.xhrPost({url:Q+"/"+O+"/set-thread-stickiness",content:{threadId:L,stickiness:N},handleAs:"json",load:function(B,A){if(B.status=="ok"){window.location.reload()}else{if(B.sessionExpired){alert(B.sessionExpiredError)}}},error:function(B,A){alert(B.status==403?M:K)}})}function setThreadClosed(M,H,K,I,N,L,J){if(!confirm(N)){return}dojo.xhrPost({url:M+"/"+H+"/set-thread-closed",content:{threadId:K,closed:I?"1":"0"},handleAs:"json",load:function(B,A){if(B.status=="ok"){window.location.reload()}else{if(B.sessionExpired){alert(B.sessionExpiredError)}}},error:function(B,A){alert(B.status==403?L:J)}})}function setPostReportedAsSpam(J,L,M,N,K,O,I,P){if(!confirm(K)){return}dojo.xhrPost({url:J+"/"+L+"/set-post-reported-as-spam",content:{postId:M,reportedAsSpam:N?"1":"0"},handleAs:"json",load:function(B,A){if(B.status=="ok"){dojo.byId("post"+M+"_reportAsSpamButtonOff").style.display="";dojo.byId("post"+M+"_reportAsSpamButtonOn").style.display="none";alert(O)}else{if(B.sessionExpired){alert(B.sessionExpiredError)}}},error:function(B,A){alert(B.status==403?I:P)}})}function deletePost(L,H,I,G,K,J){if(!confirm(G)){return}dojo.xhrPost({url:L+"/"+H+"/delete-post",content:{postId:I},handleAs:"json",load:function(B,A){if(B.status=="ok"){window.location.reload()}else{if(B.sessionExpired){alert(B.sessionExpiredError)}}},error:function(B,A){alert(B.status==403?K:J)}})}function ratePost(L,H,I,G,K,J){dojo.xhrPost({url:L+"/"+H+"/rate-post",content:{postId:I,rating:G},handleAs:"json",load:function(B,D){if(B.status=="ok"){var C=dojo.byId("post"+I+"totalRating");if(B.totalRating>0){C.innerHTML="+"+B.totalRating;C.className="ratingPositive"}else{if(B.totalRating<0){C.innerHTML=B.totalRating;C.className="ratingNegative"}else{C.innerHTML="&plusmn;0";C.className="ratingZero"}}var A=dojo.byId("post"+I+"numRatings");if(B.numRatings==1){A.innerHTML="(1 Stimme)"}else{A.innerHTML="("+B.numRatings+" Stimmen)"}dojo.byId("post"+I+"ratePositiveActive").style.display=G>0?"":"none";dojo.byId("post"+I+"ratePositive").style.display=G>0?"none":"";dojo.byId("post"+I+"rateNegativeActive").style.display=G<0?"":"none";dojo.byId("post"+I+"rateNegative").style.display=G<0?"none":""}else{if(B.sessionExpired){alert(B.sessionExpiredError)}}},error:function(B,A){alert(B.status==403?K:J)}})}function centerForumRules(){centerPopup("forumRules")}function centerPhoneInfo(){centerPopup("forumPhoneInfo")}function hideForumRules(E,F,D){dojo.byId("containerForumRules").style.display="none";dojo.xhrPost({url:E+"/"+F+"/set-rules-read",handleAs:"json",load:function(B,A){},error:function(B,A){}});if(D){dojo.byId("containerForumPhoneInfo").style.display="";centerPhoneInfo();window.onresize=centerPhoneInfo}else{window.onresize=null}}function savePhoneInfo(F,E,G,H){dojo.xhrPost({url:E+"/"+G+"/save-phone-info",form:F,handleAs:"json",contentType:"application/x-www-form-urlencoded; charset=utf-8",load:function(B,A){hidePhoneInfo(E,G,false)},error:function(B,A){alert(H)}})}function hidePhoneInfo(E,F,D){dojo.byId("containerForumPhoneInfo").style.display="none";if(D){dojo.xhrPost({url:E+"/"+F+"/save-phone-info-canceled",handleAs:"json",load:function(B,A){},error:function(B,A){}})}window.onresize=null}function initForumSearchBox(){$(document).ready(function(){$("#searchSmall a#down").click(function(){$("#searchSmallOptions").slideDown("normal");$("#searchSmall a#down").hide();$("#searchSmall a#up").show()});$("#searchSmall a#up").click(function(){$("#searchSmallOptions").slideUp("normal");$("#searchSmall a#up").hide();$("#searchSmall a#down").show()})})}var collapsedCategories;function loadToggleMainCategorySettings(){collapsedCategories=new Object();dojo.require("dojo.cookie");var E=dojo.cookie("forum_collapsed_cats");if(E){var D=E.split(";");for(var F=0;F<D.length;F++){if(D[F]!=""){collapsedCategories[D[F]]=true;toggleMainCategory(D[F])}}}}function toggleMainCategory(J){var M=dojo.byId("toggle"+J);var K=M.className;var I=K=="toggleUp";M.className=I?"toggleDown":"toggleUp";var N=dojo.byId("category"+J);var L=N.getElementsByTagName("tr");for(var O=1;O<L.length;O++){L[O].style.display=I?"none":""}collapsedCategories[J]=I;var P="";for(var J in collapsedCategories){if(collapsedCategories[J]){P+=J+";"}}dojo.cookie("forum_collapsed_cats",P,{expires:120,path:"/"})}function showLanguageSelection(){dojo.byId("languageSelection").style.display=""}function hideLanguageSelection(){dojo.byId("languageSelection").style.display="none"}function setForumAddLangs(F,E,G,H){dojo.xhrPost({url:E+"/"+G+"/set-forum-add-langs",form:F,handleAs:"json",contentType:"application/x-www-form-urlencoded; charset=utf-8",load:function(B,A){window.location.reload()},error:function(B,A){alert(H)}})};