var MCP={init:function(A){this.options=$extend({removeForm:true,nameError:"Por favor ingresa tu nombre",emailError:"Por favor ingresa una dirección de correo electrónico que sea válida",msgError:"¡Olvidaste escribir tu comentario!",inmoderation:"¡Gracias por tu aporte! Será mostrado tras ser revisado por un moderador."},A||{});$("commentform").addEvent("submit",function(B){this.sendForm(B);return false}.bind(this))},sendForm:function(B){try{var A="";if($("commentform").author&&$("commentform").author.value==""){A="<br />"+MCP.options.nameError}else{if($("commentform").email&&!(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test($("commentform").email.value))){A="<br />"+MCP.options.emailError}else{if($("commentform").comment.value==""||$("commentform").comment.value==$("commentform").comment.title){A="<br />"+MCP.options.msgError}}}if(A!=""){MCP.errorMsg(A)}else{$("commentform").addClass("throbbing");$("commentform").send({evalScripts:false,onFailure:function(E){try{er=E.responseText.match(/<p>(.*)<\/p>/);if(er.length){er=er[1]}MCP.errorMsg(er);MCP.mcpDone()}catch(D){MCP.errorMsg("¡O-oh! Ha ocurrido un error &mdash; por favor intenta de nuevo");$("commentform").removeEvents("submit");$("commentform").fireEvent("submit")}},onSuccess:function(){var D=this.response.text.split(/<body[^>]*?>/);D=D[1].split(/<\/body>/);tempDump=new Element("div").setHTML(D[0]);if($E(".commentlist")){if($E(".commentlist").getChildren().length==$E(".commentlist",tempDump).getChildren().length){new Element("li").setHTML(MCP.options.inmoderation).addClass("in-moderation").injectInside($E(".commentlist"))}else{$E(".commentlist",tempDump).getLast().injectInside($E(".commentlist"))}}else{if($E("ol",tempDump)){el=$E("ol",tempDump)}else{el=$E("ul",tempDump)}if(!$E("comments",el)&&$E("#comments",tempDump)){$E("#comments",tempDump).injectBefore($("commentform"))}el.injectBefore($("commentform"))}tempDump.remove();MCP.errorMsg("Gracias, tu envío fue exitoso");MCP.removeForm();MCP.mcpDone()}})}new Event(B).stop();return false}catch(C){return true}},removeForm:function(){if(MCP.options.removeForm){new Fx.Slide("commentform",{duration:1800,onComplete:function(){$("commentform").remove();if($("respond")){$("respond").remove()}}}).slideOut()}else{$("comment").value=""}},errorMsg:function(C){MCP.mcpDone();var D=new Element("div",{"class":"error"}).setHTML(C).injectBefore($("comment"));var A=new Fx.Slide(D);var B=new Fx.Style(D,"opacity",{duration:1500});B.start(0.1,0.9).chain(function(){B.start(0.9,0.1)}).chain(function(){A.slideOut()})},mcpDone:function(){$("comment").removeClass("throbbing")}};
