function addFunctionChangeAmount(urlNavegacao1,urlNavegacao2,urlNavegacao3,urlNavegacao4){$("#confirma-filtro-valor").click(function(){bindValuesFilterValue(urlNavegacao1,urlNavegacao2,urlNavegacao3,urlNavegacao4)})}function bindValuesFilterValue(urlNavegacao1,urlNavegacao2,urlNavegacao3,urlNavegacao4){var amount_unmask=moeda2float($("#amount").val()),amount2_unmask=moeda2float($("#amount2").val());window.location.href=urlNavegacao1+"/"+urlNavegacao2+amount_unmask+"/"+urlNavegacao3+amount2_unmask+urlNavegacao4+"#conteudo"}function initFilterListing(urlLoja,urlPaginaAtual,csrfName,csrfToken,navigationID,filtroUrl){let urlAtualPageBase64=document.getElementById("filtro-produtos").dataset.urlPaginaAtual;(filtroUrl=JSON.parse(filtroUrl)).urlPaginaAtualBase64=urlAtualPageBase64,filtroUrl.navigationId=navigationID,$.ajax({type:"GET",url:urlLoja+"ajax.php?acao=filtroListagem",data:filtroUrl,success:function(resposta){resposta.html&&$("#content-filtro-listagem-async").html(resposta.html).ready(function(){window.matchMedia("(max-width: 1000px)").matches&&$("#content-filtro-listagem-async").clone(!0).prependTo(".filtro-listagem-produto-menu"),$("html").on("click",function(e){0==$(e.target).closest(".item-drop-selecao").length&&$(".filtro-horizontal .content-opcoes-selecao").find(".item-drop-selecao.open").removeClass("open").find(".content-drop-selecao").hide()}),$(".content-nome-selecao-drop").on("click",function(e){if($(this).closest(".filtro-horizontal").length>0)$(this).closest(".item-drop-selecao").hasClass("open")||$(".content-opcoes-selecao").find(".item-drop-selecao").removeClass("open").find(".content-drop-selecao").hide(),$(this).closest(".item-drop-selecao").toggleClass("open").find(".content-drop-selecao").toggle();else{var $itemDropSelecao=$(this).closest(".item-drop-selecao"),$contentDropSelecao=$itemDropSelecao.find(".content-drop-selecao"),isOpening=!$itemDropSelecao.hasClass("open");$itemDropSelecao.toggleClass("open"),$contentDropSelecao.slideToggle("slow",function(){isOpening&&scrollToShowExpandedFilter($itemDropSelecao,$contentDropSelecao)})}}),$(".input-pesquisa-drop-selecao").on("keyup",function(){var value=$(this).val().toLowerCase();$(this).parent().siblings().find("li .nome").filter(function(){$(this).parent().toggle($(this).text().toLowerCase().indexOf(value)>-1)})}),loadSlider(),applyValueInputMask()}),resposta.htmlBreadcrumb&&$(".content-breadcrum-categoria-sync").html(resposta.htmlBreadcrumb)}},"json")}function loadSlider(){const sliderDiv=$("#slider-range");let amountFromInitial=moeda2float($("#amount").val()),amountToInitial=moeda2float($("#amount2").val());sliderDiv.slider({range:!0,min:amountFromInitial,max:amountToInitial,values:[amountFromInitial,amountToInitial],slide:function(event,ui){let amount_unmask=float2moeda(ui.values[0]),amount2_unmask=float2moeda(ui.values[1]);$("#amount").val(amount_unmask),$("#amount2").val(amount2_unmask),fixSecondHandlePosition($(this))},change:function(event,ui){let amountFrom=ui.values[0],amountTo=ui.values[1];$("#amount").val(float2moeda(amountFrom)),$("#amount2").val(float2moeda(amountTo))},create:function(event,ui){const handles=$(this).find(".ui-slider-handle");handles.length>=2&&(handles.eq(1).css({left:"auto",right:"0%"}),setupHandleObserver($(this),handles.eq(1)))}})}function applyValueInputMask(){$("#amount").priceFormat({prefix:"",centsLimit:2,centsSeparator:",",thousandsSeparator:"."}),$("#amount2").priceFormat({prefix:"",centsLimit:2,centsSeparator:",",thousandsSeparator:"."})}function fixSecondHandlePosition(sliderElement){const handles=sliderElement.find(".ui-slider-handle");if(handles.length>=2){const secondHandle=handles.eq(1),sliderWidth=sliderElement.width(),handleWidth=secondHandle.outerWidth(),rightPosition=sliderWidth-parseFloat(secondHandle.css("left"))-handleWidth,rightPercentage=Math.max(0,rightPosition/sliderWidth*100);secondHandle.css({left:"auto",right:rightPercentage+"%"})}}function setupHandleObserver(sliderElement,secondHandle){new MutationObserver(function(mutations){mutations.forEach(function(mutation){if("attributes"===mutation.type&&"style"===mutation.attributeName){const leftValue=secondHandle.css("left");leftValue&&"auto"!==leftValue&&fixSecondHandlePosition(sliderElement)}})}).observe(secondHandle[0],{attributes:!0,attributeFilter:["style"]})}function scrollToShowExpandedFilter($itemDropSelecao,$contentDropSelecao){if($itemDropSelecao.length&&$contentDropSelecao.length){var $scrollContainer=$(".listagem-filtro-lateral #filtro-produtos");if($scrollContainer.length){var containerScrollTop=$scrollContainer.scrollTop(),containerOffset=$scrollContainer.offset(),elementTopInDocument=$itemDropSelecao.offset().top,elementHeight=$itemDropSelecao.outerHeight(),elementTopInScrollable=elementTopInDocument-containerOffset.top+containerScrollTop,elementBottomInScrollable=elementTopInScrollable+elementHeight,containerVisibleTop=containerScrollTop,containerVisibleBottom=containerScrollTop+$scrollContainer.height(),visibleTop=Math.max(elementTopInScrollable,containerVisibleTop),visibleBottom=Math.min(elementBottomInScrollable,containerVisibleBottom);if(Math.max(0,visibleBottom-visibleTop)<.5*elementHeight||elementBottomInScrollable>containerVisibleBottom){var targetScrollTop=elementTopInScrollable-20;targetScrollTop=Math.max(0,targetScrollTop),$scrollContainer.animate({scrollTop:targetScrollTop},400)}}}}function getInfoAsync(){const uniqId=(new Date).getTime();let mobile=!1;window.matchMedia("(max-width: 1000px)").matches&&(mobile=!0);let params={acao:"getInfoCliente",pageType:PAGE_TYPE,urlSession:URL_SESSION,mobile:mobile};$.get("ajax.php?getInfoCliente"+uniqId,params,function(resposta){if(resposta.template)for(i in resposta.template)$(resposta.template[i].attrId).html(resposta.template[i].html);resposta.customer?(CURRENT_CUSTOMER=resposta.customer.hash,showFavoritesChecked()):CURRENT_CUSTOMER=null},"json")}function validandoProcura(){if(!($("#procura-central-ajuda").val().length>0))return alert("Informe sua duvida."),!1;document.getElementById("form-central-ajuda-procura").submit()}function adicionarCarrinho(id_pdt,idEstoque,object,url,formaAdicao,atributos,nameTagContent,isCompreJuntoEnabled=!1){void 0===nameTagContent&&(nameTagContent=".item-produto"),$(".botao.botao-compre-junto").length>0&&isCompreJuntoEnabled?comprarProdutosAdicionaisSelecionados(id_pdt):adicionarCarrinhoOrcamento(id_pdt,idEstoque,"adicionarCarrinho",url,object,nameTagContent,formaAdicao,atributos)}function adicionarOrcamento(id_pdt,object,url,formaAdicao,atributos,nameTagContent){void 0===nameTagContent&&(nameTagContent=".item-produto"),adicionarCarrinhoOrcamento(id_pdt,"adicionarOrcamento",url,object,"",formaAdicao,atributos,nameTagContent)}function adicionarCarrinhoAtributos(id_pdt,idEstoque,object,url){buildRequestStringData($(object).closest("section").data("codigoProduto",id_pdt).find(".content-produto-personalizado-form"),function(atributos){adicionarCarrinho(id_pdt,idEstoque,object,url,"atributos",atributos,"section")})}function adicionarCarrinhoAtributosAtalho(id_pdt,idEstoque,object){$(object).showLoading(),$(object).closest("section").data("codigoProduto",id_pdt).find(".content-produto-personalizado-form").find("button").click()}function adicionarCarrinhoOrcamento(id_pdt,idEstoque,acao,url,object,nameTagContent,formaAdicao,atributos){formaAdicao||(formaAdicao="normal");var paginaComprar=$(object).attr("paginaComprar");paginaComprar=void 0!==paginaComprar?paginaComprar:"listagem",nameTagContent=nameTagContent||"fieldset";var quant=1;quant=$(object).closest(".box-botao-comprar-e-selos").length>0||$(object).closest(".box-botao-comprar-e-selos").lenght>0?$(object).closest(".box-botao-comprar-e-selos").find("input.quantidade-produto").val():$(object).closest(".botoes-listagem").find("input.quantidade-produto").val(),"produto"==paginaComprar&&(idEstoque=$(".id_estoque_selecionado_"+id_pdt).val(),idEstoque=void 0!==idEstoque?idEstoque:"");var largura=$(".compra-metragem-largura").val();largura=void 0!==largura?largura:"";var comprimento=$(".compra-metragem-comprimento").val();comprimento=void 0!==comprimento?comprimento:"";var idListaCasamento=$(".lista-casamento").val(),remainingItemsGiftList=$(object).data("remaining-items-gift-list");if(idListaCasamento=void 0!==idListaCasamento?idListaCasamento:"",0==remainingItemsGiftList){if(!confirm("Este produto n\xe3o est\xe1 mais dispon\xedvel para compra nessa lista de presentes. Deseja continuar mesmo assim?"))return;idListaCasamento=""}if("listagem"!=paginaComprar&&(""==idEstoque||null==idEstoque)){var tamanhoSelecionado=$(".lista-opcoes-tamanhos").attr("selecionado"),corSelecionada=$(".lista-opcoes-cores").attr("selecionado");return $("html, body").animate({scrollTop:$("#produto-detalhes-preco").offset().top-100},500),""!=tamanhoSelecionado&&null!=tamanhoSelecionado||""!=corSelecionada&&null!=corSelecionada?""==tamanhoSelecionado||null==tamanhoSelecionado?$(object).parents(nameTagContent).find(".caracteristicas-produto").find("#alert-tamanho").fadeIn().delay(5e3).fadeOut("slow"):""!=corSelecionada&&null!=corSelecionada||$(object).parents(nameTagContent).find(".caracteristicas-produto").find("#alert-cor").fadeIn().delay(5e3).fadeOut("slow"):$(object).parents(nameTagContent).find(".caracteristicas-produto").find("#alert-ambas-opcoes").fadeIn().delay(5e3).fadeOut("slow"),$(object).hideLoading(),!1}"atributos"==formaAdicao&&$(".content-produto-personalizado-form").find(".validacoes").html(""),(null==quant||quant<1)&&(quant="1");var section=$(object).closest("section"),optionsSelected=findAllOptionsSelectedVirtual(object),hasVirtualElements=$(object).parents("#produtos").find(".opcaoProdutoVirtual").length>0,hasVirtualSectionComment=section.length>0&&-1!==section.html().indexOf("produto_detalhes_formato_virtual_opcoes"),isVirtualProduct=hasVirtualElements||hasVirtualSectionComment;if(isVirtualProduct){var hasValidOptions=optionsSelected&&optionsSelected.length>0&&optionsSelected.some(function(option){return option&&""!==option.trim()});hasValidOptions||("undefined"!=typeof Sentry&&Sentry.captureException(new Error("VirtualProductWithoutSelectedItems"),{extra:{productId:id_pdt,estoqueId:idEstoque},tags:{error_type:"virtual_product_validation"}}),$(object).hideLoading())}var date=new Date,uniqId=date.getTime(),mobile=!1;window.matchMedia("(max-width: 1000px)").matches&&(mobile=!0);var data=JSON.stringify({idProduto:id_pdt,idEstoque:idEstoque,quant:quant,optionsSelected:optionsSelected,idListaCasamento:idListaCasamento,paginaComprar:paginaComprar,formaAdicao:formaAdicao,atributos:atributos,largura:largura,comprimento:comprimento,CSRFName:$(object).attr("csrfname"),CSRFToken:$(object).attr("csrftoken"),mobile:mobile});$.ajax({type:"POST",dataType:"json",url:"ajax.php?acao="+acao+"&"+uniqId,data:data,contentType:"application/json",beforeSend:function(x){x&&x.overrideMimeType&&x.overrideMimeType("application/json"),$(object).closest(nameTagContent).data("codigoProduto",id_pdt).find("div.input_quantidade").hide(),$(object).showLoading().addClass("active-loading")},success:function(resposta,response,xhr){try{resposta.facebookPixel&&eval(resposta.facebookPixel),resposta.googleAnalytics&&$(".google-analytics-event").html(resposta.googleAnalytics)}catch(e){"undefined"!=typeof Sentry&&Sentry.captureException(e)}if(resposta.no_stock&&alert(resposta.no_stock),resposta.redirect)window.location.href=resposta.redirect;else if(200==xhr.status){if(resposta.resultado){if(1==resposta.local_mensagem)$(".notification-center").length||$("body").after().prepend('
'),$(".notification-center").prepend("
"+resposta.resultado+"
"),$("#notification-"+uniqId).fadeIn(800).delay(5e3).fadeOut(800);else if(2==resposta.local_mensagem)if("listagem"==paginaComprar){sectionProduto(id_pdt,nameTagContent).find(".content-notificacao-produto").remove(),sectionProduto(id_pdt,nameTagContent).find(".notificacao-produto").length||sectionProduto(id_pdt,nameTagContent).append('
');var painelNotificacaoContent=sectionProduto(id_pdt,nameTagContent).find(".content-notificacao-produto"),painelNotificacaoTableCell=sectionProduto(id_pdt,nameTagContent).find(".content-notificacao-produto .table-cell");painelNotificacaoTableCell.append("
"),painelNotificacaoTableCell.append("
"+resposta.resultado+"
"),resposta.quantidadeMaior||painelNotificacaoTableCell.append("
"+resposta.numeroItensAdicionado+"
"),painelNotificacaoContent.fadeIn(800).delay(5e3).fadeOut(800,function(){$(this).remove()})}else{$("body").find(".content-notificacao-produto").remove(),$("body").find(".notificacao-produto").length||$("body").append('
'),$("body").find(".content-notificacao-produto").length||$("body").find(".notificacao-produto").append('
');var painelNotificacaoContent=$("body").find(".content-notificacao-produto"),painelNotificacaoTableCell=$("body").find(".content-notificacao-produto .table-cell");painelNotificacaoTableCell.append("
"),painelNotificacaoTableCell.append("
"+resposta.resultado+"
"),resposta.quantidadeMaior||painelNotificacaoTableCell.append("
"+resposta.numeroItensAdicionado+"
"),painelNotificacaoContent.fadeIn(800,function(){$("html, body").animate({scrollTop:$(".notificacao-produto").offset().top},300)}).delay(5e3).fadeOut(800,function(){$(this).remove()})}else 4==resposta.local_mensagem&&$("body").append(resposta.resultado);resposta.resumo_carrinho&&$(".resumo-carrinho-modal").html(resposta.resumo_carrinho),resposta.carrinho&&$(".itens-carrinho").fadeOut(300).html(resposta.carrinho).fadeIn(300),3==resposta.local_mensagem&&(window.matchMedia("(max-width: 1000px)").matches&&$(".item-adicionar-no-carrinho").fadeIn(800).delay(5e3).fadeOut(800),$(".botao-carrinho .carrinho-itens-hover").fadeIn(800,function(){$(".notification-resumo-carrinho").html(resposta.resultado).fadeIn(),$(".botao-carrinho .carrinho-itens-hover").css("visibility","visible")}).delay(5e3).fadeOut(800,function(){$(".notification-resumo-carrinho").html(resposta.resultado).fadeOut(),$(".botao-carrinho .carrinho-itens-hover").css({display:"",visibility:""}),$(".botao-carrinho ul li:first-child").removeAttr("class")}))}else if(resposta.erros_atributos){$(".content-produto-personalizado-form").find(".validacoes").html(resposta.erros_atributos),$(object).closest("section").data("codigoProduto",id_pdt).find(".content-produto-personalizado-form").find("button");var mq=window.matchMedia("(max-width: 1000px)");mq.matches?$("html, body").animate({scrollTop:$($(object).closest("section").data("codigoProduto",id_pdt).find(".content-produto-personalizado-form").find("button")).offset().top-5},2e3):$("html, body").animate({scrollTop:$($(object).closest("section").data("codigoProduto",id_pdt).find(".content-produto-personalizado-form").find("button")).offset().top-80},2e3)}}else try{var error="Ocorreu um erro inesperado, caso o erro persista, por favor, entre em contato.";throw alert(error),error}catch(e){"undefined"!=typeof Sentry&&Sentry.captureException(e)}},complete:function(resposta){$(".botao-carrinho").hasClass("loaded")||$(".botao-carrinho").addClass("loaded"),resposta&&resposta.responseJSON&&resposta.responseJSON.CSRFName&&($(object).attr("csrfname",resposta.responseJSON.CSRFName),$(object).attr("csrftoken",resposta.responseJSON.CSRFToken)),$(object).closest("section").data("codigoProduto",id_pdt).find("div.input_quantidade").show(),$(object).closest("section").data("codigoProduto",id_pdt).find("button").each(function(){$(this).hideLoading().removeClass("active-loading")}),$(object).hideLoading().removeClass("active-loading")},error:function(error,x,y){if(0!=error.readyState)try{console.clear(),console.log(data,JSON.stringify(error),JSON.stringify(x),JSON.stringify(y));error="Ocorreu um erro inesperado, caso o erro persista, por favor, entre em contato. C\xf3digo do erro: #CHCKTSQL000-CODE"+error.status;throw alert(error),error}catch(e){"undefined"!=typeof Sentry&&Sentry.captureException(e)}else try{throw error="O navegador n\xe3o conseguiu se conectar com o servi\xe7o de destino. C\xf3digo do erro: #CHCKTRDSTT00"}catch(e){"undefined"!=typeof Sentry&&Sentry.captureException(e)}}})}function buildRequestStringData(form,callBack){for(var select=form.find("select"),input=form.find("input"),retorno={},countFiles=0,i=0;i0?$(".opcaoProdutoVirtual").map(function(){if(this.value)return this.value}).get():[]}function labelAsPlaceHolderMobile(input){input.val().length?(input.addClass("active"),input.closest("li").find("label").addClass("active")):(input.closest("li").find("label").removeClass("active"),input.removeClass("active"))}function checkout(){$(document).ready(function($){let body=$("body");$(body).on("click",".adicionar-item-qtd",function(){let fieldset=$(this).closest(".quantidade"),quantidade=$(fieldset).find(".quantidade-produto"),value=quantidade.val();value++,quantidade.val(value).blur(),$("#resultado-frete").html("")}),$(body).on("click",".remover-item-qtd",function(){let fieldset=$(this).closest(".quantidade"),quantidade=$(fieldset).find(".quantidade-produto"),value=quantidade.val();value>1&&value--,quantidade.val(value).blur(),$("#resultado-frete").html("")}),$(body).on("click",".close-notification",function(){$(this).closest(".cart-notification").fadeOut(200).delay(200).remove()})})}function addListenerEventToggleFavoriteButton(){let buttonAction=$(".action-add-favorite-list");$(buttonAction).unbind("click"),$(buttonAction).click(function(){let data=JSON.stringify({productId:$(this).data("produto-id"),CSRFName:$(this).attr("csrfname"),CSRFToken:$(this).attr("csrftoken")}),element=$(this);return $.ajax({type:"POST",contentType:"application/json",dataType:"json",url:"ajax.php?acao=favoritesList",data:data,success:function(res){let response;if(res.googleAnalytics&&$(".google-analytics-event").html(res.googleAnalytics),"added"===res.status){if(response="PRODUTO ADICIONADO COM SUCESSO",$(element).addClass("active"),$(element).hasClass("button-add-favorite-list")&&$(element).find(".description").html("Remover dos Favoritos"),CURRENT_CUSTOMER){let arrayFavoriteProductIds=JSON.parse(localStorage.getItem("favoriteItems"));null===arrayFavoriteProductIds&&(arrayFavoriteProductIds={},arrayFavoriteProductIds[CURRENT_CUSTOMER]=[]);let newArrayFavoriteProductIds=arrayFavoriteProductIds[CURRENT_CUSTOMER],productId=JSON.parse(data).productId;newArrayFavoriteProductIds.push(productId);let customer={};customer[CURRENT_CUSTOMER]=newArrayFavoriteProductIds,localStorage.setItem("favoriteItems",JSON.stringify(customer))}}else if("removed"===res.status){if(response="PRODUTO REMOVIDO COM SUCESSO",$(element).hasClass("button-add-favorite-list")?($(element).removeClass("active"),$(element).find(".description").html("Adicionar aos Favoritos")):$(element).closest(".icon-toggle-favorite-list").removeClass("active"),CURRENT_CUSTOMER){let arrayFavoriteProductIds=JSON.parse(localStorage.getItem("favoriteItems"));null===arrayFavoriteProductIds&&(arrayFavoriteProductIds={},arrayFavoriteProductIds[CURRENT_CUSTOMER]=[]);let productId=JSON.parse(data).productId,newArrayFavoriteProductIds=arrayFavoriteProductIds[CURRENT_CUSTOMER];newArrayFavoriteProductIds=newArrayFavoriteProductIds.filter(value=>value!==productId);let customer={};customer[CURRENT_CUSTOMER]=newArrayFavoriteProductIds,localStorage.setItem("favoriteItems",JSON.stringify(customer))}}else res.redirect&&(window.location.href=res.redirect);if($(element).hasClass("button-add-favorite-list")){let productDetail=$(element).closest("#produtos");$(productDetail).find("#fotos-produto .toggle-favorite").append(response),$(productDetail).find("#fotos-produto .toggle-favorite").find(".background-favorite").fadeIn("200").delay("2000").fadeOut("200",function(){$(productDetail).find("#fotos-produto .toggle-favorite").find(".background-favorite").remove()})}else $(element).closest(".toggle-favorite").append(response),$(element).closest(".toggle-favorite").find(".background-favorite").fadeIn("200").delay("2000").fadeOut("200",function(){$(element).closest(".toggle-favorite").find(".background-favorite").remove()})}}),!1})}function showFavoritesChecked(){if(CURRENT_CUSTOMER){let favoriteItems=JSON.parse(localStorage.getItem("favoriteItems"));if(favoriteItems&&favoriteItems[CURRENT_CUSTOMER]){let favoritesButton="";favoriteItems[CURRENT_CUSTOMER].forEach(productId=>{favoritesButton=document.querySelectorAll("[data-produto-id='"+productId+"']"),favoritesButton.forEach(favoriteButton=>{favoriteButton.classList.add("active"),$(favoriteButton).hasClass("button-add-favorite-list")&&$(favoriteButton).find(".description").html("Remover dos Favoritos")})})}}}PAGE_ASYNC?require(["helper"],function(){$(document).ready(function(){getInfoAsync()})}):$(document).ready(function(){getInfoAsync()}),PAGE_ASYNC?require(["helper"],function(){checkout()}):checkout(),function(factory){"function"==typeof define&&define.amd?define(["jquery"],factory):factory(jQuery)}(function($){var d=[],doc=$(document),ua=navigator.userAgent.toLowerCase(),wndw=$(window),w=[],browser={ieQuirks:null,msie:/msie/.test(ua)&&!/opera/.test(ua),opera:/opera/.test(ua)};browser.ie6=browser.msie&&/msie 6./.test(ua)&&"object"!=typeof window.XMLHttpRequest,browser.ie7=browser.msie&&/msie 7.0/.test(ua),browser.boxModel="CSS1Compat"===document.compatMode,$.modal=function(data,options){return $.modal.impl.init(data,options)},$.modal.close=function(){$.modal.impl.close()},$.modal.focus=function(pos){$.modal.impl.focus(pos)},$.modal.setContainerDimensions=function(){$.modal.impl.setContainerDimensions()},$.modal.setPosition=function(){$.modal.impl.setPosition()},$.modal.update=function(height,width){$.modal.impl.update(height,width)},$.fn.modal=function(options){return $.modal.impl.init(this,options)},$.modal.defaults={appendTo:"body",focus:!0,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:!1,autoPosition:!0,zIndex:1e3,close:!0,closeHTML:'',closeClass:"simplemodal-close",escClose:!0,overlayClose:!1,fixed:!0,position:null,persist:!1,modal:!0,onOpen:null,onShow:null,onClose:null},$.modal.impl={d:{},init:function(data,options){var s=this;if(s.d.data)return!1;if(browser.ieQuirks=browser.msie&&!browser.boxModel,s.o=$.extend({},$.modal.defaults,options),s.zIndex=s.o.zIndex,s.occb=!1,"object"==typeof data)data=data instanceof $?data:$(data),s.d.placeholder=!1,data.parent().parent().length>0&&(data.before($("").attr("id","simplemodal-placeholder").css({display:"none"})),s.d.placeholder=!0,s.display=data.css("display"),s.o.persist||(s.d.orig=data.clone(!0)));else{if("string"!=typeof data&&"number"!=typeof data)return alert("SimpleModal Error: Unsupported data type: "+typeof data),s;data=$("
").html(data)}return s.create(data),data=null,s.open(),$.isFunction(s.o.onShow)&&s.o.onShow.apply(s,[s.d]),s},create:function(data){var s=this;s.getDimensions(),s.o.modal&&browser.ie6&&(s.d.iframe=$('').css($.extend(s.o.iframeCss,{display:"none",opacity:0,position:"fixed",height:w[0],width:w[1],zIndex:s.o.zIndex,top:0,left:0})).appendTo(s.o.appendTo)),s.d.overlay=$("
").attr("id",s.o.overlayId).addClass("simplemodal-overlay").css($.extend(s.o.overlayCss,{display:"none",opacity:s.o.opacity/100,height:s.o.modal?d[0]:0,width:s.o.modal?d[1]:0,position:"fixed",left:0,top:0,zIndex:s.o.zIndex+1})).appendTo(s.o.appendTo),s.d.container=$("
").attr("id",s.o.containerId).attr("role","dialog").addClass("simplemodal-container").css($.extend({position:s.o.fixed?"fixed":"absolute"},s.o.containerCss,{display:"none",zIndex:s.o.zIndex+2})).append(s.o.close&&s.o.closeHTML?$(s.o.closeHTML).addClass(s.o.closeClass):"").appendTo(s.o.appendTo),s.d.wrap=$("
").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(s.d.container),s.d.data=data.attr("id",data.attr("id")||s.o.dataId).addClass("simplemodal-data").css($.extend(s.o.dataCss,{display:"none"})).appendTo("body"),data=null,s.setContainerDimensions(),s.d.data.appendTo(s.d.wrap),(browser.ie6||browser.ieQuirks)&&s.fixIE()},bindEvents:function(){var s=this;$("."+s.o.closeClass).bind("click.simplemodal",function(e){e.preventDefault(),s.close()}),s.o.modal&&s.o.close&&s.o.overlayClose&&s.d.overlay.bind("click.simplemodal",function(e){e.preventDefault(),s.close()}),doc.bind("keydown.simplemodal",function(e){s.o.modal&&9===e.keyCode?s.watchTab(e):s.o.close&&s.o.escClose&&27===e.keyCode&&(e.preventDefault(),s.close())}),wndw.bind("resize.simplemodal orientationchange.simplemodal",function(){s.getDimensions(),s.o.autoResize?s.setContainerDimensions():s.o.autoPosition&&s.setPosition(),browser.ie6||browser.ieQuirks?s.fixIE():s.o.modal&&(s.d.iframe&&s.d.iframe.css({height:w[0],width:w[1]}),s.d.overlay.css({height:d[0],width:d[1]}))})},unbindEvents:function(){$("."+this.o.closeClass).unbind("click.simplemodal"),doc.unbind("keydown.simplemodal"),wndw.unbind(".simplemodal"),this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var s=this,p=s.o.position;$.each([s.d.iframe||null,s.o.modal?s.d.overlay:null,"fixed"===s.d.container.css("position")?s.d.container:null],function(i,el){if(el){var bch="document.body.clientHeight",bcw="document.body.clientWidth",bsh="document.body.scrollHeight",bsl="document.body.scrollLeft",bst="document.body.scrollTop",bsw="document.body.scrollWidth",ch="document.documentElement.clientHeight",cw="document.documentElement.clientWidth",sl="document.documentElement.scrollLeft",st="document.documentElement.scrollTop",s=el[0].style;if(s.position="absolute",i<2)s.removeExpression("height"),s.removeExpression("width"),s.setExpression("height",bsh+" > "+bch+" ? "+bsh+" : "+bch+' + "px"'),s.setExpression("width",bsw+" > "+bcw+" ? "+bsw+" : "+bcw+' + "px"');else{var te,le;if(p&&p.constructor===Array){var top=p[0]?"number"==typeof p[0]?p[0].toString():p[0].replace(/px/,""):el.css("top").replace(/px/,"");if(te=-1===top.indexOf("%")?top+" + (t = "+st+" ? "+st+" : "+bst+') + "px"':parseInt(top.replace(/%/,""))+" * (("+ch+" || "+bch+") / 100) + (t = "+st+" ? "+st+" : "+bst+') + "px"',p[1]){var left="number"==typeof p[1]?p[1].toString():p[1].replace(/px/,"");le=-1===left.indexOf("%")?left+" + (t = "+sl+" ? "+sl+" : "+bsl+') + "px"':parseInt(left.replace(/%/,""))+" * (("+cw+" || "+bcw+") / 100) + (t = "+sl+" ? "+sl+" : "+bsl+') + "px"'}}else te="("+ch+" || "+bch+") / 2 - (this.offsetHeight / 2) + (t = "+st+" ? "+st+" : "+bst+') + "px"',le="("+cw+" || "+bcw+") / 2 - (this.offsetWidth / 2) + (t = "+sl+" ? "+sl+" : "+bsl+') + "px"';s.removeExpression("top"),s.removeExpression("left"),s.setExpression("top",te),s.setExpression("left",le)}}})},focus:function(pos){var s=this,p=pos&&-1!==$.inArray(pos,["first","last"])?pos:"first",input=$(":input:enabled:visible:"+p,s.d.wrap);setTimeout(function(){input.length>0?input.focus():s.d.wrap.focus()},10)},getDimensions:function(){var h=void 0===window.innerHeight?wndw.height():window.innerHeight;d=[doc.height(),doc.width()],w=[h,wndw.width()]},getVal:function(v,d){return v?"number"==typeof v?v:"auto"===v?0:v.indexOf("%")>0?parseInt(v.replace(/%/,""))/100*("h"===d?w[0]:w[1]):parseInt(v.replace(/px/,"")):null},update:function(height,width){var s=this;if(!s.d.data)return!1;s.d.origHeight=s.getVal(height,"h"),s.d.origWidth=s.getVal(width,"w"),s.d.data.hide(),height&&s.d.container.css("height",height),width&&s.d.container.css("width",width),s.setContainerDimensions(),s.d.data.show(),s.o.focus&&s.focus(),s.unbindEvents(),s.bindEvents()},setContainerDimensions:function(){var s=this,badIE=browser.ie6||browser.ie7,ch=s.d.origHeight?s.d.origHeight:browser.opera?s.d.container.height():s.getVal(badIE?s.d.container[0].currentStyle.height:s.d.container.css("height"),"h"),cw=s.d.origWidth?s.d.origWidth:browser.opera?s.d.container.width():s.getVal(badIE?s.d.container[0].currentStyle.width:s.d.container.css("width"),"w"),dh=s.d.data.outerHeight(!0),dw=s.d.data.outerWidth(!0);s.d.origHeight=s.d.origHeight||ch,s.d.origWidth=s.d.origWidth||cw;var mxoh=s.o.maxHeight?s.getVal(s.o.maxHeight,"h"):null,mxow=s.o.maxWidth?s.getVal(s.o.maxWidth,"w"):null,mh=mxoh&&mxohmh?mh:chmh?mh:s.o.minHeight&&"auto"!==moh&&dhmw?mw:cwmw?mw:s.o.minWidth&&"auto"!==mow&&dwch||dw>cw?"auto":"visible"}),s.o.autoPosition&&s.setPosition()},setPosition:function(){var top,left,s=this,hc=w[0]/2-s.d.container.outerHeight(!0)/2,vc=w[1]/2-s.d.container.outerWidth(!0)/2,st="fixed"!==s.d.container.css("position")?wndw.scrollTop():0;s.o.position&&"[object Array]"===Object.prototype.toString.call(s.o.position)?(top=parseFloat(st)+parseFloat(s.o.position[0]||hc),left=s.o.position[1]||vc):(top=st+hc,left=vc),s.d.container.css({left:left,top:top})},watchTab:function(e){var s=this;if($(e.target).parents(".simplemodal-container").length>0){if(s.inputs=$(":input:enabled:visible:first, :input:enabled:visible:last",s.d.data[0]),!e.shiftKey&&e.target===s.inputs[s.inputs.length-1]||e.shiftKey&&e.target===s.inputs[0]||0===s.inputs.length){e.preventDefault();var pos=e.shiftKey?"last":"first";s.focus(pos)}}else e.preventDefault(),s.focus()},open:function(){var s=this;s.d.iframe&&s.d.iframe.show(),$.isFunction(s.o.onOpen)?s.o.onOpen.apply(s,[s.d]):(s.d.overlay.show(),s.d.container.show(),s.d.data.show()),s.o.focus&&s.focus(),s.bindEvents()},close:function(){var s=this;if(!s.d.data)return!1;if(s.unbindEvents(),$.isFunction(s.o.onClose)&&!s.occb)s.occb=!0,s.o.onClose.apply(s,[s.d]);else{if(s.d.placeholder){var ph=$("#simplemodal-placeholder");s.o.persist?ph.replaceWith(s.d.data.removeClass("simplemodal-data").css("display",s.display)):(s.d.data.hide().remove(),ph.replaceWith(s.d.orig))}else s.d.data.hide().remove();s.d.container.hide().remove(),s.d.overlay.hide(),s.d.iframe&&s.d.iframe.hide().remove(),s.d.overlay.remove(),s.d={}}}}}),function(global,$){"use strict";var modal={activeElement:void 0,lastActive:void 0,stackedElements:[],tabbableElements:"a[href], area[href], input:not([disabled]),select:not([disabled]), textarea:not([disabled]),button:not([disabled]), iframe, object, embed, *[tabindex],*[contenteditable]",on:function(event,elements,callback){var i=0;if("string"!=typeof event)throw new Error("Type error: `event` has to be a string");if("function"!=typeof callback)throw new Error("Type error: `callback` has to be a function");if(elements)for(elements.length||(elements=[elements]);i=0;i--)if(modal.isElementVisible(nodeList[i]))return nodeList[i];return null},isElementVisible:function(element){return!(0===element.offsetWidth&&0===element.offsetHeight)},setActive:function(element){modal.addClass(element,"is-active"),modal.activeElement=element,modal.activeElement.setAttribute("aria-hidden","false"),modal.setFocus(element.id),modal.trigger("cssmodal:show",modal.activeElement)},unsetActive:function(isStacked,shouldNotBeStacked){modal.removeClass(document.documentElement,"has-overlay"),modal.activeElement&&(modal.removeClass(modal.activeElement,"is-active"),modal.trigger("cssmodal:hide",modal.activeElement),modal.activeElement.setAttribute("aria-hidden","true"),modal.removeFocus(),isStacked&&!shouldNotBeStacked&&modal.stackModal(modal.activeElement),!isStacked&&modal.stackedElements.length>0&&modal.unstackModal(),modal.activeElement=null)},stackModal:function(stackableModal){modal.addClass(stackableModal,"is-stacked"),modal.stackedElements.push(modal.activeElement)},unstackModal:function(){var stackedCount=modal.stackedElements.length,lastStacked=modal.stackedElements[stackedCount-1];modal.removeClass(lastStacked,"is-stacked"),global.location.hash=lastStacked.id,modal.stackedElements.splice(stackedCount-1,1)},mainHandler:function(event,noHash){var modalElement,modalChild,hash=global.location.hash.replace("#",""),index=0,tmp=[];if(noHash&&(hash=event.currentTarget.getAttribute("href").replace("#","")),modalElement=document.getElementById(hash),-1!==hash.indexOf("/")){if(index=(tmp=hash.split("/")).pop(),hash=tmp.join("/"),!(modalElement=document.getElementById(hash)))throw new Error('ReferenceError: element "'+hash+'" does not exist!');modalElement.index=1*index}if(modalElement){try{event.preventDefault()}catch(ex){event.returnValue=!1}(modalChild=modalElement.children[0])&&modalChild.className.match(/modal-inner/)&&(modal.unsetActive(!modal.hasClass(modalElement,"is-active"),"false"===modalElement.getAttribute("data-stackable")),modal.addClass(document.documentElement,"has-overlay"),modal._currentScrollPositionY=global.scrollY,modal._currentScrollPositionX=global.scrollX,modal.setActive(modalElement),modal.activeElement._noHash=noHash)}else modal.unsetActive();return!0},injectIframes:function(){for(var iframe,iframes=document.querySelectorAll("[data-iframe-src]"),i=0;i