jQuery.extend(jQuery.validator.messages,{required:"Este campo es obligatorio.",remote:"Por favor, rellena este campo.",email:"Por favor, escribe una dirección de correo válida",url:"Por favor, escribe una URL válida.",date:"Por favor, escribe una fecha válida.",dateISO:"Por favor, escribe una fecha (ISO) válida.",number:"Por favor, escribe un número entero válido.",digits:"Por favor, escribe sólo dígitos.",creditcard:"Por favor, escribe un número de tarjeta válido.",equalTo:"Por favor, escribe el mismo valor de nuevo.",accept:"Por favor, escribe un valor con una extensión aceptada.",maxlength:jQuery.validator.format("Por favor, no escribas más de {0} caracteres."),minlength:jQuery.validator.format("Por favor, no escribas menos de {0} caracteres."),rangelength:jQuery.validator.format("Por favor, escribe un valor entre {0} y {1} caracteres."),range:jQuery.validator.format("Por favor, escribe un valor entre {0} y {1}."),max:jQuery.validator.format("Por favor, escribe un valor menor o igual a {0}."),min:jQuery.validator.format("Por favor, escribe un valor mayor o igual a {0}.")});function stopAudio(a,b){if(typeof arrAudioPlayers==="object"){jq.each(arrAudioPlayers,function(d,c){if(c.idPlayer!=b){jwplayer(c.idPlayer).stop()}})}}jQuery("img.svg").each(function(){var d=jQuery(this);var b=d.attr("id");var c=d.attr("class");var a=d.attr("src");jQuery.get(a,function(f){var e=jQuery(f).find("svg");if(typeof b!=="undefined"){e=e.attr("id",b)}if(typeof c!=="undefined"){e=e.attr("class",c+" replaced-svg")}e=e.removeAttr("xmlns:a");d.replaceWith(e)},"xml")});(function(e){e(".subnav-posts").each(function(){if(e(this).html().trim().length===0){e(this).parents(".subnav-container").remove()}});window.updateReacciones=function(i,k,l){if(typeof k=="undefined"){k=e("a.link-reaccion").first().data("idnota")}if(typeof l=="undefined"){l=!1}if(typeof i=="undefined"){i=1}var j="reacciones_"+k;e.ajax("/_post/increaseReaction.php",{data:{idContenido:k,idReaccion:l,idCMSModulo:i},success:function(m){reacciones=JSON.parse(m);total=0;counter=0;porcentaje=0;umbral=0.59;e.each(reacciones,function(n,o){if(typeof o.cantidad=="number"||typeof o.cantidad=="string"){total+=parseInt(o.cantidad)}});if(total>0){e.each(reacciones,function(n,o){e.each(e("div[role=progressbar]"),function(q,p){if(parseInt(e(p).data("idreaccion"))==parseInt(o.idReaccion)){counter++;value=(100*parseInt(o.cantidad)/total);decimal=value-parseInt(value);if(parseFloat(decimal.toFixed(2))>parseFloat(umbral.toFixed(2))){value=Math.round(value)}else{value=Math.floor(value)}value=parseInt(value)?value:0;porcentaje+=value;if(counter==5){if(porcentaje>100){value-=porcentaje-100}else{if(porcentaje<100){value+=100-porcentaje}}}e(p).css("width",value.toString()+"%");e(p).children("span.skill-number").text(value.toString()+"%")}if(e(this).attr("data-idreaccion")==l){e(this).addClass("voted")}})})}if(l){e("a.link-reaccion").off();e("a.link-reaccion").click(function(){alert("Ud. ya reaccionó en esta nota")})}}})};if(typeof photoboxGalleries==="object"){e.each(photoboxGalleries,function(k,j){e("#"+j).photobox("a.photobox",{time:0})})}e("#content-gallery").photobox("a.photobox",{time:0});e.each(e("a.nolink"),function(k,j){e(j).attr("href","javascript:;")});if(e("a.link-reaccion").length){idcmsmodulo=(e("#reacciones").data("idcmsmodulo"))?e("#reacciones").data("idcmsmodulo"):1;updateReacciones(idcmsmodulo)}e.each(e("a.link-reaccion"),function(k,j){e(j).click(function(){idcmsmodulo=(e("#reacciones").data("idcmsmodulo"))?e("#reacciones").data("idcmsmodulo"):1;var i="reacciones_"+e(j).data("idnota");if(typeof e.cookie(i)=="undefined"){e.cookie(i,1,{path:"/",expires:7});updateReacciones(idcmsmodulo,e(j).data("idnota"),e(j).data("idreaccion"))}else{alert("Ud. ya reaccionó en esta nota");e("a.link-reaccion").off();e("a.link-reaccion").click(function(){alert("Ud. ya reaccionó en esta nota")})}})});if(typeof arrAudioPlayers==="object"){e.each(arrAudioPlayers,function(k,j){jwplayer(j.idPlayer).onPlay(function(){stopAudio(j.idObject,j.idPlayer)})})}if(!CMSTools.isCMSBackend){e.each(e(".overlay"),function(k,j){e(j).click(function(){window.location.href=e(j).data("url")})})}e("#contactForm").validate({lang:"es",submitHandler:function(j){var i=e(j);var k=e(".alert-success",i);var l=e(".alert-danger",i);e.ajax({url:"/_post/lasamericas/enviar_contacto.php",type:"POST",data:i.serialize(),dataType:"json",success:function(m){k.removeClass("hide").show();l.hide()},error:function(){l.removeClass("hide").show();k.hide()}});return!1}});e("#empleoForm").submit(function(l){if(e("#empleoForm").valid()){var i=e("#empleoForm");var j=e(".alert-success",i);var k=e(".alert-danger",i);e.ajax("/_post/elpatagonico/enviar_empleo.php",{type:"POST",data:new FormData(this),processData:!1,contentType:!1,dataType:"json",success:function(m){if(m.success){j.removeClass("hide").show();k.hide()}else{k.removeClass("hide").show();j.hide()}},error:function(){k.removeClass("hide").show();j.hide()}})}l.preventDefault()});var b=e("#concursoForm");var d=e(".alert-success",b);var g=e(".alert-danger",b);e("#concursoForm").validate({submitHandler:function(i){e.ajax("/_post/elpatagonico/enviar_concurso.php",{type:"POST",data:b.serialize(),success:function(j){d.removeClass("hide").show();e("#subscribeConcurso").attr("disabled","disabled");e("#checkBases").attr("disabled","disabled");g.hide()},error:function(){g.removeClass("hide").show();d.hide()}})}});var h=e("#ventasForm");var c=e(".alert-success",h);var a=e(".alert-danger",h);e("#ventasForm").validate({submitHandler:function(i){e.ajax("/_post/elpatagonico/enviar_ventas.php",{type:"POST",data:h.serialize(),success:function(j){c.removeClass("hide").show();e("#subscribeConcurso").attr("disabled","disabled");e("#checkBases").attr("disabled","disabled");a.hide()},error:function(){a.removeClass("hide").show();c.hide()}})}});e(document).on("click",".arrowFix",function(){e(this).children().toggleClass("fa-angle-down fa-angle-up")});function f(i){e(document).on("click tap",i,function(){var j=jq(this);j.addClass("animation");stopAudio();setTimeout(function(){j.removeClass("animation")},250)})}f(".galright");f(".galleft");setTimeout(function(){if(typeof Milkbox=="function"){milkbox=new Milkbox({centered:!0})}},500);window.mostrarOcultarEncuestaResultado=function(i){if($$("#"+i+" .surveyOptions")[0]!="undefined"&&$$("#"+i+" .surveyOptions")[0].getStyle("display")=="block"){window.arrSurveyv2[i].hideOptions();window.arrSurveyv2[i].showResult();$$("#"+i+" .encuesta").addClass("results")}else{window.arrSurveyv2[i].hideResult();window.arrSurveyv2[i].showOptions();$$("#"+i+" .encuesta").removeClass("results")}}})(jQuery)