").appendTo("body"); scrollbarWidth=scrollbarParent.children().innerWidth()-scrollbarParent.children().height(99).innerWidth(); if (userAgent.match(/(edge\/\d+|Edge\/\d+)/)) {scrollbarWidth=scrollbarWidth+4;} scrollbarParent.remove();} $(document).on("shown.bs.modal",function(){if (!isMobile) {$("body, #chat, .intercom-messenger-frame, .modal").css("margin-right",scrollbarWidth+"px"); $("#bodyheader, #intercom-container iframe").css("padding-right",scrollbarWidth+"px"); if (!$("#proxyscroll").length) {$("
").appendTo("body");}} $("body").css({"overflow-x":"hidden","overflow-y":"hidden"});}); $(document).on("hidden.bs.modal",function(){if (!$(".modal").is(":visible")) {if (!isMobile) {$("body, #chat, .intercom-messenger-frame, .modal").css("margin-right","0"); $("#bodyheader, #intercom-container iframe").css("padding-right","0"); $("#proxyscroll").remove();} $("body").css({"overflow-x":"visible","overflow-y":"scroll"});}}); if (isFF) {$("#bodyheader .badge").css("padding-bottom","5px");} if (isMobile) {$("head").append("");} if (userAgent.match(/(iphone|ipad|ipod)/)) {$("head").append("");} $(".navcontact").click(function(){$("#contactmodal").modal({backdrop:"static", keyboard:false, show:true});}); $("#contactsubmit").click(function(){$("#contactform").submit();}); $(".results, .modalresults").each(function(){$(this).attr("src","about:blank");}); $(".modalresults").parents(".modal").on("hidden.bs.modal",function(){$(".modalresults",this).css({"height":"0","margin-bottom":"0"}).attr("src","about:blank");}); $(".modal").on("hidden.bs.modal",function(){$(".modal-footer",this).addClass("modalbtnhide");}); $(window).on("shown.bs.modal",function(){$(".modal:visible").each(function(){var shownModal=$(this), checkFooter=setInterval(function(){var shownFooter=shownModal.find(".modal-footer").first(); if (shownFooter.length) {clearInterval(checkFooter); modalButtons(shownFooter);}},0);});}); $("#browsemodal, #setupprojectmodal, #paymentmodal").on("hidden.bs.modal",function(){$(this).find(".modal-content").empty(); $(this).removeData();}); resizeNav(true); setupHeader(); targetForm(""); modalScroll(""); modalPopover($("body")); $("a[data-toggle='popover']").on("shown.bs.popover",function(){modalPopover($(this).next());}); if (isMobile) {$(".modal-content").css("margin-bottom","30px");} else {$(".modal-scroll").scroll(function(){$("[data-toggle=popover]").popover("hide");});} $(".navsigninclient").click(function(){signinModal(true,false,"");}); $(".navsigninpro").click(function(){signinModal(false,false,"");}); $(".navsigninbusiness").click(function(){signinModal(false,true,"");}); $("#signinretrieve").click(function(){$("#signinretrieveform").toggle();}); $("#signinsubmit").click(function(){$("#signinform").submit();}); localDate(); if (isMobile) {$("body").addClass("mobile");} if (isSafari) {$("#promptmodal .modal-body>img").css("filter","blur(0px)");} $("#genres option:selected").removeAttr("selected"); $("#subgenres option:selected").removeAttr("selected"); $("#subgenresearch").val(""); $("#genres").prepend($("")).select2({placeholder: "Sort by Genre", minimumResultsForSearch: Infinity, templateResult: formatGenre}); $("#subgenres").select2({dropdownParent: $("#subgenresparent"), templateResult: formatSubGenre, templateSelection: formatSubGenreSelection}).on("select2:closing",function(e){e.preventDefault();}).on("select2:selecting",function(e){e.preventDefault();}).on("select2:unselecting",function(e){e.preventDefault();}).on("select2:open",function(){$("#subgenresparent .subgenre[data-value='"+$("#subgenres option").length+"']").waitUntilExists(function(){$(function(){$("[data-toggle=popover]").popover();}); $("body").on("click",function(e){$("[data-toggle=popover]").each(function(){if (!$(this).is(e.target) && $(this).has(e.target).length===0 && $(".popover").has(e.target).length===0) {$(this).popover("hide");}});}); $(window).resize(function(){$("[data-toggle=popover]").popover("hide");}); $("#subgenresparent .subgenre>a").on("shown.bs.popover",function(){$(this).next(".popover").highlight($("#subgenresearch").val().trim().replace(/|/g,"").replace(/'/g,"'"));}).click(function(e){$("[data-toggle=popover]").not(this).popover("hide"); e.stopPropagation();}); $("#subgenresparent .select2-results__options").first().scroll(function(){$("[data-toggle=popover]").popover("hide");}); $("#subgenresparent .subgenre").click(function(){var thisValue=$(this).data("value").toString(), selected=$("#subgenres").val() || [], thisIndex=selected.indexOf(thisValue); if (thisIndex==-1) {$(this).parent().attr("aria-selected","true"); selected.push(thisValue);} else {$(this).parent().attr("aria-selected","false"); selected.splice(thisIndex,1);} $("#subgenres").val(selected).trigger("change"); if (thisIndex==-1) {$(".subgenreselection[data-value='"+thisValue+"']").waitUntilExists(function(){$(this).first().prev().click(function(){var thisValue=$(this).next().data("value").toString(), selected=$("#subgenres").val() || [], thisIndex=selected.indexOf(thisValue); if (thisIndex!=-1) {$("#subgenresparent .subgenre[data-value='"+thisValue+"']").first().parent().attr("aria-selected","false"); selected.splice(thisIndex,1); $("#subgenres").val(selected).trigger("change");}});});}});});}).select2("open").change(function(){var top=$("#subgenresparent .select2-container--default .select2-results>.select2-results__options"), bottom=$(".select2-container--default .select2-selection--multiple").first(), promptContent1=$("#promptcontent"), promptContent2=$("#promptcontent>div"); $("#subgenresubmit").prop("disabled",$(this).val()==null); if ($(this).val()==null && top.outerHeight()!=265) {promptContent1.css("pointer-events","none"); promptContent2.css("pointer-events","none"); top.animate({"height":"265px"},function(){promptContent1.css("pointer-events","auto");}); bottom.css("padding","0").animate({"height":"0"},function(){promptContent2.css("pointer-events","auto");}).children().css("display","none");} else if ($(this).val()!=null && top.outerHeight()!=145) {promptContent1.css("pointer-events","none"); promptContent2.css("pointer-events","none"); top.animate({"height":"145px"},function(){promptContent1.css("pointer-events","auto");}); bottom.animate({"height":"120px"},function(){$(this).css("padding","5px").children().css("cssText","display: block !important;"); promptContent2.css("pointer-events","auto");});}}); $("#subgenresearch").on("change paste keyup",function(){var search=$("#subgenresearch").val().trim().toLowerCase().replace(/|/g,"").replace(/'/g,"'"); $("#subgenresparent .select2-results__options").first().scrollTop(0); if (search=="") {$("#subgenresparent .subgenre").removeClass("searchremove"); $("#subgenresparent .subgenre>a>i").removeClass("highlight");} else {$("#subgenresparent .subgenre").filter(function(){return $(this).data("search").indexOf(search)!=-1;}).removeClass("searchremove"); $("#subgenresparent .subgenre").filter(function(){return $(this).data("search").indexOf(search)==-1;}).addClass("searchremove"); $("#subgenresparent .subgenre>a>i").addClass("highlight");} $("#subgenresparent").unhighlight().highlight(search);}); $("#genres").on("select2:select",function(e){var sort=e.params.data.id; $("#subgenresparent .select2-results__options").first().scrollTop(0); if (sort=="" || sort=="0") {$("#subgenresparent .subgenre").removeClass("sortremove");} else {$("#subgenresparent .subgenre[data-sort='"+sort+"']").removeClass("sortremove"); $("#subgenresparent .subgenre[data-sort!='"+sort+"']").addClass("sortremove");}}); $("#subgenresubmit").click(function(){$("#promptform>fieldset").prop("disabled",true); $(this).html(""+$(this).text()+""); setTimeout(function(){$("#promptform").submit(); $("#promptresults").one("load",function(){var promptButton=$("#subgenresubmit"), buttonText=promptButton.text(); $("#promptform>fieldset").prop("disabled",false); promptButton.empty().text(buttonText); setupPrompt("promptmodal",false); iframeSize($("#promptresults")); $("#promptmodal").modal({backdrop:"static", keyboard:false, show:true});});},2000);}); $(".nextprompt, .previousprompt").click(function(){var iframe=$("#promptresults"), oldPrompt=iframe.contents().find("#prompts>div").not(".none").first(), newPrompt=oldPrompt.next(), pos=["-100%","100%"]; if ($(this).hasClass("previousprompt")) {newPrompt=oldPrompt.prev(); pos=["100%","-100%"];} if (newPrompt.length) {$(".nextprompt, .previousprompt").prop("disabled",true); $("#promptmodal .modal-dialog").animate({left: pos[0]},600,function(){oldPrompt.addClass("none"); newPrompt.removeClass("none"); iframeSize(iframe); setupPrompt("",false); if (isMobile) {$("#promptmodal").scrollTop(0);} else {$("#promptmodal .modal-scroll").first().scrollTop(0);} $(this).css("left",pos[1]).animate({left: "0"},600);});}}); setTimeout(function(){$(document).trigger("afterready");},1);}); $(document).bind("afterready",function(){$("html").css("opacity","1"); if ($("#bodyheader").length) {$("#bodyheader").css("opacity","1");}}); $(function(){$("[data-toggle=popover]").popover();}); $("body").on("click",function(e){$("[data-toggle=popover]").each(function(){if (!$(this).is(e.target) && $(this).has(e.target).length===0 && $(".popover").has(e.target).length===0) {$(this).popover("hide");}});}); $(window).resize(function(){$("[data-toggle=popover]").popover("hide");}); $(window).resize(function(){resizeNav(false); modalScroll(""); modalButtons($(".modal-footer:visible")); if ($.isFunction(window.froalaHeight)) {froalaHeight();} $(".results, .modalresults, .message").each(function(){if ($(this).contents().has("title").length && !($(this).hasClass("message") && $(this).prev().hasClass("msginitial"))) {iframeSize($(this));}});}); $(function(){$("[href^='#']").not("[href~='#']").click(function(e){e.preventDefault(); $(window).scrollTop($("[id*='"+$(this).attr("href").split("#")[1]+"']").offset().top-68);});});