function htmlspecialchars(f,i){var h={},g="",c="",e="";c=f.toString();if(false===(h=this.get_html_translation_table("HTML_SPECIALCHARS",i))){return false}for(g in h){e=h[g];c=c.split(g).join(e)}return c}function get_html_translation_table(l,i){var g={},k={},f=0,c="";var h={},e={};var m={},j={};h[0]="HTML_SPECIALCHARS";h[1]="HTML_ENTITIES";e[0]="ENT_NOQUOTES";e[2]="ENT_COMPAT";e[3]="ENT_QUOTES";m=!isNaN(l)?h[l]:l?l.toUpperCase():"HTML_SPECIALCHARS";j=!isNaN(i)?e[i]:i?i.toUpperCase():"ENT_COMPAT";if(m!=="HTML_SPECIALCHARS"&&m!=="HTML_ENTITIES"){throw Error("Table: "+m+" not supported")}g["38"]="&amp;";if(j!=="ENT_NOQUOTES"){g["34"]="&quot;"}if(j==="ENT_QUOTES"){g["39"]="&#039;"}g["60"]="&lt;";g["62"]="&gt;";if(m==="HTML_ENTITIES"){g["160"]="&nbsp;";g["161"]="&iexcl;";g["162"]="&cent;";g["163"]="&pound;";g["164"]="&curren;";g["165"]="&yen;";g["166"]="&brvbar;";g["167"]="&sect;";g["168"]="&uml;";g["169"]="&copy;";g["170"]="&ordf;";g["171"]="&laquo;";g["172"]="&not;";g["173"]="&shy;";g["174"]="&reg;";g["175"]="&macr;";g["176"]="&deg;";g["177"]="&plusmn;";g["178"]="&sup2;";g["179"]="&sup3;";g["180"]="&acute;";g["181"]="&micro;";g["182"]="&para;";g["183"]="&middot;";g["184"]="&cedil;";g["185"]="&sup1;";g["186"]="&ordm;";g["187"]="&raquo;";g["188"]="&frac14;";g["189"]="&frac12;";g["190"]="&frac34;";g["191"]="&iquest;";g["192"]="&Agrave;";g["193"]="&Aacute;";g["194"]="&Acirc;";g["195"]="&Atilde;";g["196"]="&Auml;";g["197"]="&Aring;";g["198"]="&AElig;";g["199"]="&Ccedil;";g["200"]="&Egrave;";g["201"]="&Eacute;";g["202"]="&Ecirc;";g["203"]="&Euml;";g["204"]="&Igrave;";g["205"]="&Iacute;";g["206"]="&Icirc;";g["207"]="&Iuml;";g["208"]="&ETH;";g["209"]="&Ntilde;";g["210"]="&Ograve;";g["211"]="&Oacute;";g["212"]="&Ocirc;";g["213"]="&Otilde;";g["214"]="&Ouml;";g["215"]="&times;";g["216"]="&Oslash;";g["217"]="&Ugrave;";g["218"]="&Uacute;";g["219"]="&Ucirc;";g["220"]="&Uuml;";g["221"]="&Yacute;";g["222"]="&THORN;";g["223"]="&szlig;";g["224"]="&agrave;";g["225"]="&aacute;";g["226"]="&acirc;";g["227"]="&atilde;";g["228"]="&auml;";g["229"]="&aring;";g["230"]="&aelig;";g["231"]="&ccedil;";g["232"]="&egrave;";g["233"]="&eacute;";g["234"]="&ecirc;";g["235"]="&euml;";g["236"]="&igrave;";g["237"]="&iacute;";g["238"]="&icirc;";g["239"]="&iuml;";g["240"]="&eth;";g["241"]="&ntilde;";g["242"]="&ograve;";g["243"]="&oacute;";g["244"]="&ocirc;";g["245"]="&otilde;";g["246"]="&ouml;";g["247"]="&divide;";g["248"]="&oslash;";g["249"]="&ugrave;";g["250"]="&uacute;";g["251"]="&ucirc;";g["252"]="&uuml;";g["253"]="&yacute;";g["254"]="&thorn;";g["255"]="&yuml;"}for(f in g){c=String.fromCharCode(f);k[c]=g[f]}return k}function nl2br(e){var c="<br />";return(e+"").replace(/\n/g,""+c+"\n")}function br2nl(c){return(c+"").replace(/<br\s*\/?>/mg,"\n")}function array_push(g){var e,c=arguments,f=c.length;for(e=1;e<f;e++){g[g.length++]=c[e]}return g.length}function array_shift(c){if(c.length>0){return c.shift()}return null}function array_unshift(g){var f=arguments.length,c=arguments,e;for(e=1;e<f;e++){g.unshift(c[e])}return(g.length)}function array_pop(f){var e="",c=0;if(f.hasOwnProperty("length")){if(!f.length){return null}return f.pop()}else{for(e in f){c++}if(c){delete (f[e]);return f[e]}else{return null}}}function track_ajax_call(k){var g="es-racocatala";var h="0";var i="uk";var c=location.protocol.indexOf("https")>-1?"https:":"http:";var l=escape(window.location);var j=c+"//secure-"+i+".imrworldwide.com/";var e=new Image(1,1);var f="rnd="+(new Date()).getTime()+"&ci="+g+"&cg="+h;f+="&si="+escape(k)+"&rp="+l;e.src=j+"cgi-bin/m?"+f}function get_user_pref(c){if(current_user.prefs[c]){return current_user.prefs[c]}else{return false}}(function(i){i.popbox=function(q){i.popbox.loading();if(q.template=="notice"){l(q.title,q.title_img,q.content,q.callback)}else{if(q.template=="error"){k(q.content,q.callback)}else{if(q.template=="ajax"){h(q.url)}}}return false};i.extend(i.popbox,{settings:{opacity:0.1,overlay:true,loadingImage:"img/loader2.gif",templatesTypes:["send-to-friend","correct","share"],template:"send-to-friend",boxHtml:'<div id="popbox" class="popbox" style="display:none;"><div class="popup"><table><tbody><tr><td class="tl"/><td class="b"/><td class="tr"/></tr><tr><td class="b"/><td class="body"><div id="popboxContent" class="content"></div></td><td class="b"/></tr><tr><td class="bl"/><td class="b"/><td class="br"/></tr></tbody></table></div></div>',unloading:false},loading:function(){o();i(document).unbind("closed.popbox");if(i("#popbox .loading").length==1){return true}g();i("#popbox .content").empty();i("#popbox .body").children().hide().end().append('<div class="loading"><img src="'+i.popbox.settings.loadingImage+'"/></div>');i("#popbox").css({top:m()[1]+(n()/5),left:385.5}).show();i(document).bind("keydown.popbox",function(q){if(q.keyCode==27){i.popbox.close()}return true});i(document).trigger("loading.popbox")},reveal:function(q){i(document).trigger("beforeReveal.popbox");i("#popbox .content").append(q);i("#popbox .loading").remove();i("#popbox .body").children().fadeIn("normal");i("#popbox").css("left",(i(window).width()/2)-(i("#popbox table").width()/2));i(document).trigger("reveal.popbox").trigger("afterReveal.popbox")},close:function(){i(document).trigger("close.popbox");return false}});i.fn.popbox=function(q){o(q);function r(){i.popbox.loading(true);if(q.template=="send-to-friend"){j(this.href,q.article_id)}else{if(q.template=="correct"){e(this.href,q.article_id)}else{if(q.template=="confirm"){p(q.title,q.title_img,q.content,q.callback,this)}}}return false}return this.click(r)};function o(r){if(i.popbox.settings.inited){return true}else{i.popbox.settings.inited=true}i(document).trigger("init.popbox");if(r){i.extend(i.popbox.settings,r)}i("body").append(i.popbox.settings.boxHtml);var q=[new Image(),new Image()];q[0].src=i.popbox.settings.closeImage;q[1].src=i.popbox.settings.loadingImage;i("#popbox").find(".b:first, .bl, .br, .tl, .tr").each(function(){q.push(new Image());q.slice(-1).src=i(this).css("background-image").replace(/url\((.+)\)/,"$1")});i("#popbox .close").live("click",i.popbox.close)}function j(r,q){var s='<h3><img src="img/t/articles.envia.png" alt="envia l\'article" /></h3>';s+='<form id="form-send-to-friend" action="'+r+'" method="post">';s+='<input type="hidden" name="article_id" value="'+q+'" />';s+='<div class="padding">';s+="<dl>";s+='<dt><label for="ipt-sendf-toname">Nom del destinatari</label></dt>';s+='<dd><input id="ipt-sendf-toname" type="text" name="to-name" /></dd>';s+="</dl>";s+="<dl>";s+='<dt><label for="ipt-sendf-toemail">Adreça electrònica del destinatari</label></dt>';s+='<dd><input id="ipt-sendf-toemail" type="text" name="to-email" /></dd>';s+="</dl>";s+="<dl>";s+='<dt><label for="ipt-sendf-fromname">El teu nom</label></dt>';s+='<dd><input id="ipt-sendf-fromname" type="text" name="from-name" /></dd>';s+="</dl>";s+="<dl>";s+='<dt><label for="ipt-sendf-fromemail">La teva adreça electrònica</label></dt>';s+='<dd><input id="ipt-sendf-fromemail" type="text" name="from-email" /></dd>';s+="</dl>";s+="<dl>";s+='<dt><label for="ipt-sendf-comment">Comentari (opcional)</label></dt>';s+='<dd><textarea id="ipt-sendf-comment" name="comment" rows="4"></textarea></dd>';s+="</dl>";s+="</div>";s+='<p class="submit">';s+='<input type="image" src="img/blocks/article.send.png" alt="envia l\'article" />';s+=' <input class="close" type="image" src="img/blocks/cancel.png" alt="Anul·la" />';s+="</p>";s+="</form>";i.popbox.reveal(s);i("#form-send-to-friend").bind("submit",function(t){i.post("ajax/send-to-friend.php",i(this).serialize(),function(u){if(u.error){if(i("#form-send-to-friend").find("p.error").length>0){i("#form-send-to-friend").find("p.error")[0].innerHTML=u.error}else{i("#form-send-to-friend").prepend('<p class="error">'+u.error+"</p>")}}else{i("#form-send-to-friend").html("<h4 class=\"padding\">S'ha enviat l'article correctament.</h4>").append('<p class="submit"><input id="popup_ok" type="image" src="img/blocks/ok.png" alt="D\'acord" /></p>');jQuery("#popup_ok").click(function(){i.popbox.close()})}},"json");return false})}function e(r,q){var s='<h3><img src="img/t/articles.corregeix.png" alt="corregeix l\'article" /></h3>';s+='<form id="form-correct" action="'+r+'" method="post">';s+='<input type="hidden" name="article_id" value="'+q+'" />';s+='<div class="padding">';s+="<dl>";s+='<dt><label for="ipt-sendf-fromname">El teu nom</label></dt>';s+='<dd><input id="ipt-sendf-fromname" type="text" name="from-name" /></dd>';s+="</dl>";s+="<dl>";s+='<dt><label for="ipt-sendf-fromemail">La teva adreça electrònica</label></dt>';s+='<dd><input id="ipt-sendf-fromemail" type="text" name="from-email" /></dd>';s+="</dl>";s+="<dl>";s+='<dt><label for="ipt-sendf-text">Correcció</label></dt>';s+='<dd><textarea id="ipt-sendf-text" name="text" rows="4"></textarea></dd>';s+="</dl>";s+="</div>";s+='<p class="submit">';s+='<input type="image" src="img/blocks/article.correct.png" alt="envia la correcció" />';s+=' <input class="close" type="image" src="img/blocks/cancel.png" alt="Anul·la" />';s+="</p>";s+="</form>";i.popbox.reveal(s);i("#form-correct").bind("submit",function(t){i.post("ajax/correct-article.php",i(this).serialize(),function(u){if(u.error){if(i("#form-correct").find("p.error").length>0){i("#form-correct").find("p.error")[0].innerHTML=u.error}else{i("#form-correct").prepend('<p class="error">'+u.error+"</p>")}}else{i("#form-correct").html("<h4 class=\"padding\">S'ha enviat la correcció de l'article correctament.</h4>").append('<p class="submit"><input id="popup_ok" type="image" src="img/blocks/ok.png" alt="D\'acord" /></p>');jQuery("#popup_ok").click(function(){i.popbox.close()})}},"json");return false})}function p(u,t,r,v,q){var s='<h3><img src="img/t/'+t+'" alt="'+u+'" /></h3>';s+='<div class="padding">';s+="<h5>"+r+"</h5>";s+="</div>";s+='<p class="submit">';s+='<input id="popup_yes" type="image" src="img/blocks/confirm.png" alt="Confirma" />';s+=' <input id="popup_no" type="image" src="img/blocks/cancel.png" alt="Anul·la" />';s+="</p>";i.popbox.reveal(s);jQuery("#popup_yes").click(function(){if(v){i(document).bind("closed.popbox",function(){v(true,q)})}i.popbox.close()});jQuery("#popup_no").click(function(){if(v){i(document).bind("closed.popbox",function(){v(false,q)})}i.popbox.close()})}function l(t,s,q,u){var r='<h3><img src="img/t/'+s+'" alt="'+t+'" /></h3>';r+='<div class="padding">';r+="<h5>"+q+"</h5>";r+="</div>";r+='<p class="submit">';r+='<input id="popup_ok" type="image" src="img/blocks/ok.png" alt="D\'acord" />';r+="</p>";i.popbox.reveal(r);jQuery("#popup_ok").click(function(){if(u){i(document).bind("closed.popbox",function(){u()})}i.popbox.close()})}function k(q,s){var r='<h3><img src="img/t/error.png" alt="error" /></h3>';r+='<div class="padding">';r+="<h5>"+q+"</h5>";r+="</div>";r+='<p class="submit">';r+='<input id="popup_ok" type="image" src="img/blocks/ok.png" alt="D\'acord" />';r+="</p>";i.popbox.reveal(r);jQuery("#popup_ok").click(function(){if(s){i(document).bind("closed.popbox",function(){s(true,element)})}i.popbox.close()})}function h(q,r){i.get(q,function(s){var t='<h3 id="box-title"></h3>';t+='<div class="padding">';t+=s;t+="</div>";t+='<p class="submit">';t+='<input id="popup_ok" type="image" src="img/blocks/ok.png" alt="D\'acord" />';t+="</p>";i.popbox.reveal(t);jQuery("#popup_ok").click(function(){if(r){i(document).bind("closed.popbox",function(){r()})}i.popbox.close()})})}function f(){return i.popbox.settings.overlay===false||i.popbox.settings.opacity===null}function g(){if(f()){return}if(i("popbox_overlay").length===0){i("body").append('<div id="popbox_overlay" class="popbox_hide"></div>')}i("#popbox_overlay").hide().addClass("popbox_overlayBG").css("opacity",i.popbox.settings.opacity).click(function(){i(document).trigger("close.popbox")}).fadeIn(200);return false}function c(){if(f()){return}i("#popbox_overlay").fadeOut(200,function(){i("#popbox_overlay").removeClass("popbox_overlayBG");i("#popbox_overlay").addClass("popbox_hide");i("#popbox_overlay").remove();i(document).trigger("closed.popbox")});return false}function m(){var r,q;if(self.pageYOffset){q=self.pageYOffset;r=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){q=document.documentElement.scrollTop;r=document.documentElement.scrollLeft}else{if(document.body){q=document.body.scrollTop;r=document.body.scrollLeft}}}return[r,q]}function n(){var q;if(self.innerHeight){q=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){q=document.documentElement.clientHeight}else{if(document.body){q=document.body.clientHeight}}}return q}i(document).bind("close.popbox",function(){i(document).unbind("keydown.popbox");i("#popbox").fadeOut(function(){i("#popbox .content").removeClass().addClass("content");i("#popbox .loading").remove();c()})})})(jQuery);function popbox_from_ajax(c){$.popbox({template:"ajax",url:c})}function shareThis(g){g.preventDefault();if($("#share-this").length===0){var f='<a href="http://latafanera.cat/submit.php?url='+g.data.url+'" title="Envia a La Tafanera"><img src="'+rc_get_cdn_path()+'img/tafanera.jpg" alt="La Tafanera" /></a>';f+='<a href="http://technorati.com/search/'+g.data.url+'" title="Cerca a Technorati"><img src="'+rc_get_cdn_path()+'img/technorati.png" alt="Technorati" /></a>';f+='<a href="http://del.icio.us/post?url='+g.data.url+'" title="Envia a Delicious"><img src="'+rc_get_cdn_path()+'img/delicious.gif" alt="Delicious" /></a>';f+='<a href="http://www.facebook.com/share.php?u='+g.data.url+'" title="Comparteix a Facebook"><img src="'+rc_get_cdn_path()+'img/facebook.gif" alt="Facebook" /></a>';$("body").append('<p id="share-this"></p>');$("#share-this").hide().html(f)}var c=g.target;var e=$("#share-this");e.toggle().css({top:g.target.offsetTop+c.offsetHeight+5,left:c.offsetLeft+c.offsetWidth-e[0].offsetWidth})}function switchTab(g){g.preventDefault();var f=jQuery(g.target);if(f.hasClass("current")){return}var e=f[0].className.replace("tab-link-","");f.removeClass("current");var c=f.parent().parent().parent();c.find("a.current").removeClass("current");c.find(".tab-link-"+e).addClass("current");c.find(".tab-content-current").slideUp().removeClass("tab-content-current");c.find(".tab-content-"+e).slideDown().addClass("tab-content-current")}function getEmoticons(f){var c='<div class="smileys">';var e=false;jQuery.each(emoticons,function(h,g){c+="<a onclick=\"insertEmoticon('"+f+"',"+h+');"><img src="images/'+g+'" /></a>';if(!((h+1)%11)&&e===false){c+="<br />"}if(!((h+1)%20)&&e===false){c+='<p><a id="link_more_emoticons_'+f+'" onclick="show_hide_more_emoticons(\''+f+'\')">Mostra totes les icones</a></p><div class="clear"></div>';c+='</div><div style="display:none" class="smileys" id="more_emoticons_'+f+'">';e=true}});c+="</div>";return c}var timeout_missatge;var editantse=[];var showed_forms=[];var submitting_answer=[];var commentsType;function removeForm(c){$("#answer-box-"+c).remove();showed_forms[c]=false}var messageErrorTimeouts=[];function clearShowMessageErrorTimeout(e){var c=messageErrorTimeouts[e];if(c){window.clearTimeout(c)}}function showMessageErrorStatus(g,f){clearShowMessageErrorTimeout(g);var c=$("#message-error-status-"+g);if(c.length===0){var e=$("#editor-footer-"+g);e.prepend('<span id="message-error-status-'+g+'" class="message-error-status">'+f+"</span>").append('<div class="clear"></div>')}else{c.html(f)}messageErrorTimeouts[g]=window.setTimeout("clearMessageErrorStatus('"+g+"')",15000)}function clearMessageErrorStatus(c){$("#message-error-status-"+c).remove()}function showError(c){$.popbox({template:"error",content:c})}var messageTimeouts=[];function clearShowMessageTimeout(e){var c=messageTimeouts[e];if(c){window.clearTimeout(c)}}function showMessageStatus(g,f){clearShowMessageTimeout(g);var c=$("#message-status-"+g);if(c.length===0){var e=$("#answer-box-"+g).prev();e.prepend('<span id="message-status-'+g+'" class="message-status">'+f+"</span>")}else{c.html(f)}messageTimeouts[g]=window.setTimeout("clearMessageStatus("+g+")",15000)}function clearMessageStatus(c){$("#message-status-"+c).remove()}function storeAnswer(h){h.preventDefault();var k=h.data.id;if(submitting_answer[k]!==undefined&&submitting_answer[k]===true){return}var f=false;if(k.indexOf("-edit")!=-1){f=true}var e=(typeof tinyMCE!=="undefined")&&tinyMCE.get("mce_"+k)!==undefined;submitting_answer[k]=true;if(e){var c=tinyMCE.get("mce_"+k);c.save()}var g=jQuery("#mce_"+k).val();if(!e){g=nl2br(g)}if(!g){alert("No has escrit cap resposta.");submitting_answer[k]=false;return}else{var j=0;if(f){j=k.replace("-edit","").substr(2)}else{if(jQuery("#mce_autosave_id_"+k).val()){j=jQuery("#mce_autosave_id_"+k).val()}}var i={action:"store",id:k,message_id:j||0,content:g,rc_nonce:rc_nonce};c.setProgressState(1);form_disable_buttons(k);jQuery.ajax({data:i,type:"POST",url:"ajax/store.php",success:function(o){submitting_answer[k]=false;c.setProgressState(0);if(o.error){showMessageErrorStatus(k,o.error);form_enable_buttons(k)}else{if(e){c.remove()}if(o.is_editing){jQuery("#content-"+o.message_id).html(o.content).show()}else{$("#clink-"+o.parent_id).html("Respon");var l=$("#answer-box-"+k).parent().parent().parent();var n=l.children(".replies");var m="";if(n.length===0){m=$('<div class="comment"></div>').html(o.box).appendTo('<li class="comment last"></li>').parent().prepend('<a name="'+o.message_id+'"></a>').appendTo('<ul class="replies"></ul>').parent().appendTo(l).find("a.comment-link").parent().parent()}else{n.children(".last").removeClass("last");m=n.append('<li class="comment last"><a name="'+o.message_id+'"></a><div class="comment">'+o.box+"</div></li>").find("a.comment-link:last").parent().parent()}m.find("div.header").animate({backgroundColor:"pink"},500).animate({backgroundColor:"#F3DCB6"},500);m.find("div.content").animate({backgroundColor:"#fdeff9"},500).animate({backgroundColor:"#FDF9F3"},500);m.find("div.signature").animate({backgroundColor:"#fdeff9"},500).animate({backgroundColor:"#FDF9F3"},500);m.find("div.footer").animate({backgroundColor:"#f9daf8"},500).animate({backgroundColor:"#F9EDDA"},500)}removeForm(k);$.scrollTo("#"+o.message_id);track_ajax_call(window.location)}},dataType:"json"})}}function showFormByEvent(e){e.preventDefault();var c=e.target;showForm(c)}function showForm(i){var g=jQuery(i);var k=commentsType;var n=false;var e=0;var m=null;var h="";if(g.attr("class")!==""){h=g.attr("class");if(h=="edit-link"){n=true;e=g.attr("id").replace("elink-","");m=jQuery("#content-"+e)}else{e=g.attr("id").replace("clink-","");m=g.parent().parent()}}else{h=g.parent().attr("class");e=g.parent().attr("id").replace("clink-","");m=g.parent().parent().parent()}var f=h.indexOf("comment-has-autosave")!=-1?true:false;if(f){h=h.replace("comment-has-autosave","")}e=k+"-"+e;if(n===true){e+="-edit"}if(showed_forms[e]!==undefined&&showed_forms[e]===true){$.scrollTo("#answer-box-"+e);return}showed_forms[e]=true;var c=$('<div class="answer-box" id="answer-box-'+e+'"></div>').append('<fieldset><form id="answer-form-'+e+'" method="post"></form></fieldset>');if(n===true){c.insertAfter(m)}else{c.appendTo(m)}var l=$("#answer-form-"+e);l.append('<input type="hidden" id="mce_autosave_id_'+e+'" />');if(!n){l.append('<div class="quote-link"><a onclick="quoteMessage(\''+e+"')\">Cita el missatge anterior per respondre</a></div>")}l.append('<div class="editorcontainer"><textarea name="content" id="mce_'+e+'" class="richtext_area"></textarea></div>');if(!n){jQuery("#mce_"+e).parent().append('<div class="editor-footer" id="editor-footer-'+e+'"><span id="autosave-message-'+e+'">Missatge sense desar</span></div>')}else{jQuery("#mce_"+e).parent().append('<div class="editor-footer" id="editor-footer-'+e+'"></div>')}l.append('<div class="answer-footer">'+getEmoticons(e)+'<div class="submit"><input class="discard" type="button" onclick="discardMessage(\''+e+'\')" value="Descarta" /><input class="submit" type="submit" value="Desa" /></div></div>').append('<div class="clear"></div>').bind("submit",{id:e},storeAnswer);if(get_user_pref("rich_editing")){tinyMCE.execCommand("mceAddControl",true,"mce_"+e)}if(n){$.scrollTo(m)}else{$.scrollTo("#answer-box-"+e)}if(f===false&&typeof tinyMCE!="undefined"){tinyMCE.get("mce_"+e).focus()}if(!n){add_autosave(e,f)}else{m.hide();form_disable_buttons(e);var j={action:"load_post",id:e,format:"content"};if(jQuery("#ipt-element_id_type").length){j.element_id_type=jQuery("#ipt-element_id_type").val()}jQuery("#autosave-message-"+e).html("Carregant l'esborrany...");jQuery.ajax({data:j,url:"ajax/get_comment.php",success:function(p){var o=tinyMCE.getInstanceById("mce_"+e);if(o===undefined){$("#mce_"+e).append(p.content)}else{o.setContent(p.content);o.save();o.focus()}form_enable_buttons(e);track_ajax_call(window.location)},dataType:"json"})}}function show_hide_more_emoticons(c){if($("#more_emoticons_"+c).css("display")=="none"){$("#link_more_emoticons_"+c).html("Amaga les icones addicionals");$("#more_emoticons_"+c).show()}else{$("#link_more_emoticons_"+c).html("Mostra totes les icones");$("#more_emoticons_"+c).hide()}}function insertEmoticon(h,f){var g=emoticons[f];var e='<img alt="" src="'+globals.server_cdn_path+"images/"+g+'" />';if(typeof(tinyMCE)!="undefined"){var c=tinyMCE.get("mce_"+h);if(c!==undefined){tinyMCE.execInstanceCommand("mce_"+h,"mceInsertContent",false,e)}else{jQuery("#mce_"+h).val(jQuery("#mce_"+h).val()+e)}}else{jQuery("#mce_"+h).val(jQuery("#mce_"+h).val()+e)}}function quoteMessage(c){$.getJSON("ajax/quote_message.php",{id:c},function(g){if(g.error){return}var f="<blockquote><h5>"+g.username+" escrigué:</h5>"+g.message+"</blockquote>";if(typeof(tinyMCE)!=="undefined"){var e=tinyMCE.get("mce_"+c);if(e!==undefined){tinyMCE.execInstanceCommand("mce_"+c,"mceInsertContent",false,f)}else{$("#mce_"+c).val(jQuery("#mce_"+c).val()+f)}}else{$("#mce_"+c).val(jQuery("#mce_"+c).val()+f)}track_ajax_call(window.location)})}function discardMessage(h){var c=tinyMCE.get("mce_"+h);if(c!==undefined){if("mce_fullscreen"==c.id){c.setContent(c.getContent({format:"raw"}),{format:"raw"})}c.save()}var f=jQuery("#mce_"+h).val();if(!f||confirm("Segur que voleu descartar l'escrit?\n\nPerdreu les dades que heu escrit i qualsevol esborrany d'aquest missatge")){c.remove();removeForm(h);remove_autosave(h);var g=0;if(h.indexOf("-edit")!==-1){g=h.replace("-edit","").substr(2);var e=jQuery("#content-"+g);e.show();$.scrollTo(e)}else{g=h.substr(2);$.scrollTo("#"+g)}}}var rc_votes=[];function vote_comment(g,f,e){if(typeof(rc_votes[g])!=="undefined"&&rc_votes[g]===true){return}rc_votes[g]=true;var c="ajax/votes.php?id="+g+"&value="+f+"&nonce="+e+"&type=comment";$.getJSON(c,function(h){if(h.error){alert("Error: "+h.error);return false}else{$("#nv-"+g).html(h.votes+"");$("#nv-"+g).attr("title",h.votes+" vot"+(h.votes!=1?"s":""));$("#kv-"+g).html(h.karma+"");if(h.image.length>0){$("#c-votes-"+g).html('<img src="'+h.image+'"/>')}}})}function vote_forum_post(g,f,e){if(typeof(rc_votes[g])!=="undefined"&&rc_votes[g]===true){return}rc_votes[g]=true;var c="ajax/votes.php?id="+g+"&value="+f+"&nonce="+e+"&type=forum_post";$.getJSON(c,function(h){if(h.error){alert("Error: "+h.error);return false}else{$("#nv-"+g).html(h.votes+"");$("#nv-"+g).attr("title",h.votes+" vot"+(h.votes!=1?"s":""));$("#kv-"+g).html(h.karma+"");if(h.image.length>0){$("#c-votes-"+g).html('<img src="'+h.image+'"/>')}}track_ajax_call(window.location)})}function vote_forum_topic(g,f,e){if(typeof(rc_votes[g])!=="undefined"&&rc_votes[g]===true){return}rc_votes[g]=true;var c="ajax/votes.php?id="+g+"&value="+f+"&nonce="+e+"&type=forum_topic";$.getJSON(c,function(h){if(h.error){alert("Error: "+h.error);return false}else{$("#nv-t-"+g).html(h.votes+"");$("#nv-t-"+g).attr("title",h.votes+" vot"+(h.votes!=1?"s":""));$("#kv-t-"+g).html(h.karma+"");if(h.image.length>0){$("#c-votes-t-"+g).html('<img src="'+h.image+'"/>')}}track_ajax_call(window.location)})}var starring_topic=false;function star_topic(e,c,g,f){if(starring_topic===true){return}f=jQuery(f);starring_topic=true;$.getJSON("ajax/star.php",{type:"topic",rel:c,topic_id:e,nonce:g},function(h){starring_topic=false;if(h.error){alert("Error: "+h.error);return false}else{f.attr("title",h.title);f.find("img").attr("src",h.src);f.find("span").html(h.title)}track_ajax_call(window.location)})}function add_username_suggestion(c){jQuery(c).suggest("ajax/autocompleter.php?t=user",{delay:500,minchars:2,multiple:true,multipleSep:", "})}var starring_pm=false;function star_pm(c,f,e){if(starring_pm===true){return}e=jQuery(e);starring_pm=true;$.getJSON("ajax/star.php",{type:"pm",msg_id:c,nonce:f},function(g){starring_pm=false;if(g.error){alert("Error: "+g.error);return false}else{e.attr("title",g.title);e.find("img").attr("src",g.src);e.find("span").html(g.title)}track_ajax_call(window.location)})}function show_embedded(e,c){e=jQuery(e);e.html('<img src="img/loader1.gif');jQuery('<object width="425" height="350" data="'+c+'" type="application/x-shockwave-flash"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></object>').insertAfter(e);e.remove();return false}function show_comment(f,e,g){var c="ajax/get_comment.php?type="+e+"&id="+g+"&format=full";$.get(c,function(i){var h=jQuery(i);h.removeClass("hidden").addClass("hidden-shown");jQuery(f).parent().parent().replaceWith(h)})}function fold_unfold_comment(c){jQuery("#"+c).toggleClass("folded")}function print_adsense_zone(c){var e=(location.protocol=="https:"?"https://ads.catmedia.cat/www/delivery/ajs.php":"http://ads.catmedia.cat/www/delivery/ajs.php");var f=Math.floor(Math.random()*99999999999);if(!document.MAX_used){document.MAX_used=","}document.write("<script type='text/javascript' src='"+e);document.write("?zoneid="+c);document.write("&amp;cb="+f);if(document.MAX_used!=","){document.write("&amp;exclude="+document.MAX_used)}document.write(document.charset?"&amp;charset="+document.charset:(document.characterSet?"&amp;charset="+document.characterSet:""));document.write("&amp;loc="+escape(window.location));if(document.referrer){document.write("&amp;referer="+escape(document.referrer))}if(document.context){document.write("&context="+escape(document.context))}if(document.mmm_fo){document.write("&amp;mmm_fo=1")}document.write("'><\/script>")}function get_votes(e,f,c,g,h){var e="ajax/"+e+"?id="+h+"&p="+g+"&t="+f;$(c).load(e);track_ajax_call(window.location)}function rc_get_cdn_path(){return globals.server_cdn_path}var selectWidth="150";document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: '+selectWidth+"px; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style>");var Custom={actions:[],init:function(){var e=[];var c=document.getElementsByTagName("select");for(a=0;a<c.length;a++){if(c[a].className=="styled"){option=c[a].getElementsByTagName("option");active=option[0].childNodes[0].nodeValue;textnode=document.createTextNode(active);for(b=0;b<option.length;b++){if(option[b].selected==true){textnode=document.createTextNode(option[b].childNodes[0].nodeValue)}}e[a]=document.createElement("span");e[a].className="select";e[a].id="select"+c[a].name;e[a].appendChild(textnode);c[a].parentNode.insertBefore(e[a],c[a]);Custom.actions[c[a].id]=c[a].onchange;c[a].onchange=Custom.choose}}},choose:function(){option=this.getElementsByTagName("option");for(d=0;d<option.length;d++){if(option[d].selected==true){document.getElementById("select"+this.name).childNodes[0].nodeValue=option[d].childNodes[0].nodeValue}}Custom.actions[this.id]()}};jQuery(function(){Custom.init()});jQuery(function(){$("#content").find("span.username.actions a.username").live("mouseenter",user_hover);$("#content").find("span.username.actions a.username").live("mouseleave",user_blur);$("#content").find("span.username.actions a.username").live("click",user_unfold_actions)});var users_actions_schedules=[];var users_actions_folds=[];function user_hover(c){el=jQuery(c.currentTarget);el.addClass("hover");var e=el[0].firstChild.nodeValue;if(typeof users_actions_folds[e]!="undefined"){$.cancel(users_actions_folds[e])}if(el.html()==e){users_actions_folds[el.html()]=$.schedule({time:500,func:function(){user_unfold_actions(c)},repeat:false,protect:false})}}function user_blur(c){el=jQuery(c.currentTarget);el.removeClass("hover");$.cancel(users_actions_schedules[el.html()]);var e=el[0].firstChild.nodeValue;users_actions_folds[e]=$.schedule({time:500,func:function(){user_fold_actions()},repeat:false,protect:false})}function user_unfold_actions(c){c.preventDefault();el=jQuery(c.currentTarget);if(!el.hasClass("hover")){return false}var g=el[0].firstChild.nodeValue;var e=jQuery("#ua-box");if(e.length==0){e=jQuery(document.createElement("div")).attr("id","ua-box").appendTo("body")}var f=el.offset();e.css({top:(f.top+el.height()+11)+"px",left:f.left+"px"}).html('<ul><li><a href="">Envia-li un missatge</a></li><li><a href="">Afegeix-lo d\'amistat</a></li></ul>').slideDown("fast").appendTo(el)}function user_fold_actions(){jQuery("#ua-box").html("").hide().appendTo("body")}JSOC=function(){var c={};return{get:function(g){var e={},f=c[g];e[g]=f;if(f){return e}},getMulti:function(f){var e=[];for(var g in f){e.push(this.get(f[g]))}return e},getType:function(f){var e=[];for(var g in c){if(typeof(c[g])==f.toLowerCase()){e.push(this.get(g))}}return e},set:function(i,g){if(c[i]){delete (c[i])}c[i]=g;if(arguments[2]){var e=arguments[2].ttl||null;if(e){var f=this,h=setTimeout(function(){f.remove(i)},e)}}return(c[i])?1:0},add:function(i,g){if(!c[i]){c[i]=g;if(arguments[2]){var e=arguments[2].ttl||null;if(e){var f=this,h=setTimeout(function(){f.remove(i)},e)}}return(c[i])?1:0}},replace:function(i,g){if(c[i]){delete (c[i]);c[i]=g;if(arguments[2]){var e=arguments[2].ttl||null;if(e){var f=this,h=setTimeout(function(){f.remove(i)},e)}}return(c[i])?1:0}},remove:function(e){delete (c[e]);return(!c[e])?1:0},flush_all:function(){for(var e in c){delete (c[e])}return 1}}};if(typeof(JSOC)!="undefined"){function tooltip(){}tooltip.id="tooltip";tooltip.main=null;tooltip.offsetx=10;tooltip.offsety=10;tooltip.shoffsetx=8;tooltip.shoffsety=8;tooltip.x=0;tooltip.y=0;tooltip.tooltipShadow=null;tooltip.tooltipText=null;tooltip.title_saved="";tooltip.saveonmouseover=null;tooltip.timeout=null;tooltip.active=false;tooltip.cache=new JSOC();tooltip.ie=(document.all)?true:false;if(tooltip.ie){tooltip.ie5=(navigator.userAgent.indexOf("MSIE 5")>0)}else{tooltip.ie5=false}tooltip.dom2=((document.getElementById)&&!(tooltip.ie5))?true:false}tooltip.show=function(c,e){if(this.dom2==false){return false}if(this.tooltipShadow==null){this.tooltipShadow=document.createElement("div");this.tooltipShadow.setAttribute("id","tooltip-shadow");document.body.appendChild(tooltip.tooltipShadow);this.tooltipText=document.createElement("div");this.tooltipText.setAttribute("id","tooltip-text");document.body.appendChild(this.tooltipText)}this.saveonmouseover=document.onmousemove;document.onmousemove=this.mouseMove;this.mouseMove(c);this.setText(e);this.tooltipText.style.visibility="visible";this.tooltipShadow.style.visibility="visible";this.active=true;return false};tooltip.setText=function(c){tooltip.tooltipShadow.style.width=0+"px";tooltip.tooltipShadow.style.height=0+"px";this.tooltipText.innerHTML=c;setTimeout("tooltip.setShadow()",1);return false};tooltip.setShadow=function(){tooltip.tooltipShadow.style.width=tooltip.tooltipText.clientWidth+"px";tooltip.tooltipShadow.style.height=tooltip.tooltipText.clientHeight+"px"};tooltip.hide=function(c){if(this.dom2==false){return false}document.onmousemove=this.saveonmouseover;this.saveonmouseover=null;if(this.tooltipShadow!=null){this.tooltipText.style.visibility="hidden";this.tooltipShadow.style.visibility="hidden";this.tooltipText.innerHTML=""}this.active=false};tooltip.mouseMove=function(c){if(tooltip.ie){tooltip.x=event.clientX;tooltip.y=event.clientY}else{tooltip.x=c.pageX;tooltip.y=c.pageY}tooltip.moveTo(tooltip.x+tooltip.offsetx,tooltip.y+tooltip.offsety)};tooltip.moveTo=function(e,c){if(this.ie){e+=document.documentElement.scrollLeft;c+=document.documentElement.scrollTop}if(this.tooltipText.clientWidth>0&&document.documentElement.clientWidth>0&&e>document.documentElement.clientWidth*0.55){e=e-this.tooltipText.clientWidth-2*this.offsetx}this.tooltipText.style.left=e+"px";this.tooltipText.style.top=c+"px";xLS=e+this.shoffsetx;yLS=c+this.shoffsety;this.tooltipShadow.style.left=xLS+"px";this.tooltipShadow.style.top=yLS+"px"};tooltip.c_show=function(e,c,f){if(this.dom2==false){return false}target_text="content-"+f;target_author="cusername-"+f;target=document.getElementById(target_text);author_target=document.getElementById(target_author);if(!target||!author_target){this.ajax_delayed(e,"get_comment.php?type="+c,f);return}text="<strong>"+author_target.innerHTML+"</strong><br/>"+target.innerHTML;return this.show(e,text)};tooltip.clear=function(c){if(this.timeout!=null){clearTimeout(this.timeout);this.timeout=null}this.hide(c)};tooltip.ajax_delayed=function(e,c,g,f){f=f||600000;if(this.active){return false}if((object=this.cache.get(c+g))!=undefined){tooltip.show(e,object[c+g])}else{this.show(e,"carregant...");this.timeout=setTimeout("tooltip.ajax_request('"+c+"', '"+g+"', "+f+")",100)}};tooltip.ajax_request=function(c,g,f){var e="ajax/"+c+"&format=tooltip&id="+g;tooltip.timeout=null;$.ajax({url:e,dataType:"html",success:function(h){tooltip.cache.set(c+g,h,{ttl:f});tooltip.setText(h);track_ajax_call(window.location)}})};var fadeNoF;var NoF;var contentNoF;var shownNoF=[];function startNoF(){NoF=jQuery('<div id="ndr" class="popbox"><div class="popup"><table><tbody><tr><td class="tl"/><td class="b"/><td class="tr"/></tr><tr><td class="b"/><td class="body"><div id="ndr-content" class="content"></div></td><td class="b"/></tr><tr><td class="bl"/><td class="b"/><td class="br"/></tr></tbody></table></div></div>').hide();NoF.appendTo("body");var c=jQuery("#ndr-content");c.append("<h3>Notificacions</h3>");contentNoF=jQuery('<div class="padding"></div>').appendTo(c);data='<p class="submit"><input id="ndr_ok" type="image" src="img/blocks/ok.png" alt="D\'acord" /></p>';jQuery(data).insertAfter(contentNoF);jQuery("#ndr_ok").click(function(){hideNoF()});loadNoF()}function hideNoF(){NoF.hide()}function showNoF(){NoF.show().fadeIn()}function loadNoF(){$.getJSON("ajax/load_nof.php",function(c){if(c.nofs){var e=false;$.each(c.nofs,function(f,g){if(!shownNoF[g.permalink]){shownNoF[g.permalink]=true;contentNoF.append('<p class="margin '+g.status+'">Has rebut una resposta de <strong>'+g.username+"</strong> "+g.description+': <br />&nbsp;<a href="'+g.permalink+'">'+g.title+"</a></p>");if(g.status=="unread"){e=true}}});if(e){showNoF()}}window.setTimeout("loadNoF()",50000)})}var autosaveLast=[];var autosavePeriodical=[];var autosaveOldMessage=[];function add_autosave(g,c){var f=get_user_pref("comments_drafts");if(!f||f<20){return false}autosaveLast[g]=$("#mce_"+g).val();autosavePeriodical[g]=$.schedule({time:f*1000,func:function(){autosave(g)},repeat:true,protect:false});$("#answer-form-"+g).submit(function(){$.cancel(autosavePeriodical[g])});if(c==true){form_disable_buttons(g);var e={action:"load_autosave",id:g};if(jQuery("#ipt-element_id_type").length){e.element_id_type=jQuery("#ipt-element_id_type").val()}jQuery("#autosave-message-"+g).html("Carregant l'esborrany...");jQuery.ajax({data:e,type:"POST",url:"ajax/autosave.php",success:load_autosave_callback,dataType:"json"})}}function remove_autosave(e){$.cancel(autosavePeriodical[e]);autosaveLast[e]=null;autosaveOldMessage[e]=null;autosavePeriodical[e]=null;var c={action:"remove_autosave",id:e,rc_nonce:rc_nonce};if(jQuery("#ipt-element_id_type").length){c.element_id_type=jQuery("#ipt-element_id_type").val()}jQuery.ajax({data:c,type:"POST",url:"ajax/autosave.php",success:remove_autosave_callback,dataType:"json"})}function load_autosave_callback(e){if(e.error){showError(e.error);return false}var f=e.id;if(typeof tinyMCE=="undefined"){$("#mce_"+f).append(htmlspecialchars(br2nl(e.content)))}else{var c=tinyMCE.get("mce_"+f);c.setContent(e.content);c.save();c.focus()}autosaveLast[f]=e.content;autosave_saved_new(e);track_ajax_call(window.location)}function remove_autosave_callback(e){if(e.error){showError(e.error);return false}var f=e.id;var c=tinyMCE.get("mce_"+f);if(c==undefined){$("#mce_"+f).value=""}else{c.setContent("");c.save()}jQuery("#clink-"+f.substr(2)).removeClass("comment-has-autosave").html("Respon");jQuery("#autosave-message-"+f).html("Missatge sense desar");track_ajax_call(window.location)}function autosave_saved(c){if(c.error){showError(c.error);form_enable_buttons(e);return false}var e=c.id;if(c.message){jQuery("#autosave-message-"+e).html(c.message)}form_enable_buttons(e);track_ajax_call(window.location)}function autosave_saved_new(c){if(c.error){showError(c.error);form_enable_buttons(f);return false}var f=c.id;track_ajax_call(window.location);if(c.error){jQuery("#autosave-message-"+f).html(c.error);return}var e=c.message_id;if(e!=parseInt(jQuery("#mce_autosave_id_"+f).val())){jQuery("#mce_autosave_id_"+f).attr({name:"message_id"});jQuery("#mce_autosave_id_"+f).val(e);jQuery("#autosave-message-"+f).html(c.message);form_enable_buttons(f)}}function autosave_loading(c){jQuery("#autosave-message-"+c).html("Desant l'esborrany...")}function form_enable_buttons(c){jQuery("#answer-form-"+c+" :button:disabled, #answer-form-"+c+" :submit:disabled").attr("disabled","")}function form_disable_buttons(c){jQuery("#answer-form-"+c+" :button:enabled, #answer-form-"+c+" :submit:enabled").attr("disabled","disabled");setTimeout(form_enable_buttons,5000)}var autosave=function(i){if(showed_forms[i]==undefined||showed_forms[i]==false){return}var f=(typeof tinyMCE!="undefined")&&tinyMCE.get("mce_"+i)!=undefined;var g={action:"autosave",id:i,rc_nonce:rc_nonce,message_id:$("#mce_autosave_id_"+i).val()||0,autosave:1};var h=true;if(f){var e=tinyMCE.get("mce_"+i);if("mce_fullscreen"==e.id){e.setContent(e.getContent({format:"raw"}),{format:"raw"})}e.save();g.content=jQuery("#mce_"+i).val()}else{g.content=nl2br(jQuery("#mce_"+i).val())}if(jQuery("#ipt-element_id_type").length){g.element_id_type=jQuery("#ipt-element_id_type").val()}if((g.content.length==0)||g.content==autosaveLast[i]){return}autosaveLast[i]=g.content;if(parseInt(g.message_id)<1){var c=autosave_saved_new}else{var c=autosave_saved}if(!h){g.autosave=0}autosaveOldMessage[i]=jQuery("#autosave-message-"+i).html();autosave_loading(i);form_disable_buttons(i);jQuery.ajax({data:g,type:"POST",url:"ajax/autosave.php",success:c,dataType:"json"})};