$(document).ready(function(){var RETAIL_PRICE=239900;createCookie("wpage",true,60);$('.stop-propagation').on('click',function(e){e.stopPropagation();});$('.stop-default').on('click',function(e){e.preventDefault();});if($(window).width()<=800){$(".animated").removeClass('animated');}
var validateEmail=function(email){var re=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return re.test(email);}
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/;domain=.shapertools.com";}
$(function($){var time=new Date().getTime();var refreshCounter;var forceRefresh=false;var refresh=30000;var prevRemaining=-1;var currentRemaining=0;var current;var TICKER=false;if($("#countdown-info").length>0){TICKER=true;}
if(TICKER){$(document.body).bind("mousemove keypress",function(e){time=new Date().getTime();if(forceRefresh){clearTimeout(refreshCounter);updateCountdown();}});}
function updateCountdown(){if(new Date().getTime()- time<=refresh){forceRefresh=false;$.ajax({url:'https://preorder.shapertools.com/api/v1/bundle/',cache:false,type:'GET',success:function(response){if(response){$("#bundle-container").html('');$("#bundle-pricing-hero").html('');var active,first;for(id in response){if(id==0||id==1){continue;}
var title=classes=offset="";if(!active&&(response[id].metrics.remaining>0||response[id].sp)){active=true;current=response[id];if(first){if(response[id].metrics.remaining>300){title="<small class='text-center' style='font-size:13px !important'>Limited Quantity</small>";}else{title="<small class='remaining-num'></small>";}
classes="highlight active";}else{first=true;classes="highlight active";offset="col-md-offset-"+((12-((response.length-1)*2))/2);
title="<small>Limited Quantity</small>";}}else if(!active){if(!first)offset="col-lg-offset-"+((12-((response.length-1)*2))/2);
first=true;title="<small>Sold Out</small>";}else{classes="active";title="<small>Batch 2</small>";}
$("#bundle-container").append('<div class="'+offset+' col-lg-2 col-sm-3 col-md-3 pr20 pl20"><a href="https://preorder.shapertools.com"><div class="col-md-12 text-right bundle-pricing '+classes+'"><div class="col-md-10 col-md-push-1 pr0 pl0"><h1 class="color-light">$'+(response[id].cost/100)+'</h1>'+title+'</div></div></a></div>');$("#bundle-pricing-hero").append('<div class="ml25 mr25"><div class="col-md-12 text-right bundle-pricing-col mb10 '+classes+'"> <div class="col-md-6 text-left"><h1>$'+(response[id].cost/100)+'</h1></div> <div class="col-md-6">'+title+'</div> </div>');}
$("#bundle-container").append('<div class="col-sm-3 col-lg-2  col-md-3 pr20 pl20"><a href="https://preorder.shapertools.com"><div class="col-md-12 text-right bundle-pricing active"><div class="col-md-10 col-md-push-1 pr0 pl0"><h1 class="color-light">$'+(RETAIL_PRICE/100)+'</h1><small class="pr5">retail</small></div></div></div></div>');$("#bundle-pricing-hero").append('<div class="ml25 mr25"><div class="col-md-12 text-right bundle-pricing-col mb10 active"> <div class="col-md-6 text-left"><h1>$'+(RETAIL_PRICE/100)+'</h1></div> <div class="col-md-6">retail</div> </div>');if(prevRemaining==-1){prevRemaining=current.metrics.remaining;currentRemaining=current.metrics.remaining;$(".remaining-num").html(current.metrics.remaining+" left");}else{if(prevRemaining>current.metrics.remaining){$({n:prevRemaining}).animate({n:current.metrics.remaining},{duration:refresh,step:function(now,fx){var tmp=Math.floor(now);if(currentRemaining!=tmp){$(".remaining-num").html(tmp+" left");currentRemaining=tmp;}}});}else{$(".remaining-num").html(current.metrics.remaining+" left");}
prevRemaining=current.metrics.remaining;}
if(current.metrics.remaining==undefined){$(".remaining-num").html("Pre-Order");}
$("#countdown-info").toggleClass('hidden',false);}
refreshCounter=setTimeout(updateCountdown,refresh);},error:function(xhr,ajaxOptions,thrownError){console.log(xhr.responseJSON.message);refreshCounter=setTimeout(updateCountdown,refresh);}});}else{forceRefresh=true;refreshCounter=setTimeout(updateCountdown,refresh);}}
if(TICKER){updateCountdown();}});$('body').on('click','a.disabled',function(event){event.preventDefault();});$(function($){"use strict";$('a[href="https://preorder.shapertools.com"]').on('click',function(event){fbq('track',"PreOrderClick");});$('.button-subscribe').on('click',function(e){e.preventDefault();$('.button-subscribe').toggleClass('disabled',true);if(validateEmail($('.input-newsletter').val())){fbq('track',"EmailSignup");$.ajax({url:'https://preorder.shapertools.com/api/v1/subscribe/',data:{email:$('.input-newsletter').val()},error:function(){console.log("error");$('.button-subscribe').toggleClass('disabled',false);$("#newsletter-help").text("There was an error processing your signup. Please try again later.");$('#newsletter-help').toggleClass('hidden',false);$('#newsletter-help').toggleClass('color-green',false);$('#newsletter-help').toggleClass('color-red',true);},success:function(response){if(response.status=="success"){$('.input-newsletter').val("");$("#newsletter-help").text("Thanks! We will keep you upto date with all the latest.");$('#newsletter-help').toggleClass('hidden',false);$('#newsletter-help').toggleClass('color-green',true);$('#newsletter-help').toggleClass('color-red',false);}else{if(response.message=="Member Exists"){$("#newsletter-help").text("You're already signed up. We're glad you're so excited about Origin!");}else{$("#newsletter-help").text(response.message);}
$('#newsletter-help').toggleClass('hidden',false);$('#newsletter-help').toggleClass('color-green',false);$('#newsletter-help').toggleClass('color-red',true);}
$('.button-subscribe').toggleClass('disabled',false);}});}else{$('.button-subscribe').toggleClass('disabled',false);$("#newsletter-help").text("Please enter a valid email address.");$('#newsletter-help').toggleClass('hidden',false);$('#newsletter-help').toggleClass('color-green',false);$('#newsletter-help').toggleClass('color-red',true);}});});$(function($){"use strict";$('.animated').appear(function(){var elem=$(this);var animation=elem.data('animation');if(!elem.hasClass('visible')){var animationDelay=elem.data('animation-delay');if(animationDelay){setTimeout(function(){elem.addClass(animation+" visible");},animationDelay);}else{elem.addClass(animation+" visible");}}});});$(function(){"use strict";$('.navbar-collapse ul li a:not(.dropdown-toggle)').on('click',function(event){$('.navbar-toggle:visible').click();});});$(function(){"use strict";if($(".navbar-sticky").length>0){$(".navbar-sticky").sticky({topSpacing:0});$(".navbar-sticky").css('z-index','100');$(".navbar-sticky").addClass('bg-light');$(".navbar-sticky").addClass("top-nav-collapse");};});$(function(){"use strict";$(".navbar-op ul li a, .navbar-op a.navbar-brand, .intro-direction a, a.go-to-top").on('click',function(event){event.preventDefault();var hash=this.hash;$('html, body').animate({scrollTop:$(hash).offset().top},900,function(){window.location.hash=hash;});});});$(function(){"use strict";if($(".navbar-standart").length>0){$(".navbar-pasific").addClass("top-nav-collapse");$(".navbar-brand > img").addClass("invert");}else{$(window).scroll(function(){if(!$(".navbar-pasific").hasClass("static")){if($(".navbar").offset().top>10){$(".navbar-pasific").addClass("top-nav-collapse");$("#preorder-btn").toggleClass('button-o',false);$("#preorder-btn").toggleClass('button',true);$(".navbar-brand > img").addClass("invert");}else{$(".navbar-pasific").removeClass("top-nav-collapse");$(".navbar-brand > img").removeClass("invert");$("#preorder-btn").toggleClass('button-o',true);$("#preorder-btn").toggleClass('button',false);}}});};});$(function(){"use strict";if($(".navbar-pasific-inverse").length>0){$(window).scroll(function(){if($(".navbar").offset().top>10){$(".navbar-pasific").addClass("top-nav-collapse-inverse");$(".navbar-brand > img").addClass("invert");}else{$(".navbar-pasific").removeClass("top-nav-collapse-inverse");$(".navbar-brand > img").removeClass("invert");}});};});$(function(){"use strict";if($("a.go-to-top").length>0){$("a.go-to-top").fadeOut();$(window).scroll(function(){if($(".navbar").offset().top>1200){$("a.go-to-top").fadeIn();}else{$("a.go-to-top").fadeOut();}});};});$(function(){"use strict";if($(".mb-ytplayer").length>0){$(".mb-ytplayer").mb_YTPlayer();}});$(function(){"use strict";if($(".popup-youtube").length>0){$('.popup-youtube').magnificPopup({type:'iframe',iframe:{markup:'<div class="mfp-iframe-scaler">'+'<div class="mfp-close"></div>'+'<iframe id="player" class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+'</div>',patterns:{youtube:{index:'youtube.com/',id:'v=',src:'//www.youtube.com/embed/%id%?rel=0&autoplay=1&enablejsapi=1'}},srcAction:'iframe_src',},callbacks:{open:function(){new YT.Player('player',{events:{'onStateChange':onPlayerStateChange}});}},midClick:true,closeOnBgClick:true,removalDelay:200,preloader:false,mainClass:'mfp-fade mfp-video',});};});}(jQuery));function onPlayerStateChange(event){if(event.data==YT.PlayerState.ENDED){$.magnificPopup.close();}}
$(window).load(function(){$(function(){"use strict";var portfolioSizes=[{transitionWidth:0,numProjects:4},{transitionWidth:767,numProjects:8},{transitionWidth:991,numProjects:12}];var windowWidth=$(window).width();var numDisplayedProjects=0;for(var i=0;i<portfolioSizes.length;i++){if(windowWidth>portfolioSizes[i].transitionWidth){numDisplayedProjects=portfolioSizes[i].numProjects;};};$(".portfolio-item").each(function(index){$(this).attr("id","portfolio_"+ index);if(index<numDisplayedProjects){$(this).addClass("portfolio-shown");}else{$(this).addClass("portfolio-hidden");$(this).hide();}})
var $portfolio=$('.portfolio').isotope({itemSelector:'.portfolio-shown',masonry:{rowHeight:280}});var $blogMasonry2Col=$('.blog-masonry-3col').isotope({itemSelector:'.blog-masonry-item',masonry:{columnWidth:'.col-md-4',gutter:0}});$('ul.filters li a').on('click',function(){var filterValue=$(this).attr('data-filter');$('.blog-masonry-3col').isotope({filter:filterValue});});$('ul.filters li a').on('click',function(){$('ul.filters li').removeClass('active');$(this).parent().addClass('active');});$('#more-projects').on('click',function(e){$(".portfolio-hidden").show();$(".portfolio-hidden").addClass("portfolio-shown");var $newItems=$(".portfolio-hidden");$portfolio.append($newItems).isotope('appended',$newItems);$portfolio.imagesLoaded().progress(function(){$portfolio.isotope('layout');});$('#more-projects').toggleClass('hidden',true);$('.popup-youtube').magnificPopup({type:'iframe',iframe:{markup:'<div class="mfp-iframe-scaler">'+'<div class="mfp-close"></div>'+'<iframe id="player" class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+'</div>',patterns:{youtube:{index:'youtube.com/',id:'v=',src:'//www.youtube.com/embed/%id%?rel=0&autoplay=1&enablejsapi=1'}},srcAction:'iframe_src',},callbacks:{open:function(){new YT.Player('player',{events:{'onStateChange':onPlayerStateChange}});}},midClick:true,closeOnBgClick:true,removalDelay:200,preloader:false,mainClass:'mfp-fade mfp-video',});});});});