var Yamaha;(function(n){"use strict";for(var t,i,f,r,e=[{metaName:"x-font-awesome-stylesheet-fallback-test",test:function(n){return n.style.fontFamily==="FontAwesome"},href:"/Content/fa"}],o=n.getElementsByTagName("meta"),u=0;u<e.length;++u)for(t=e[u],i=0;i<o.length;++i)if(f=o[i],f.getAttribute("name")===t.metaName){t.test(f)||(r=n.createElement("link"),r.href=t.href,r.rel="stylesheet",n.getElementsByTagName("head")[0].appendChild(r));break}})(document),function(n){"use strict";var i=[{test:function(){return window.Modernizr},src:"/bundles/modernizr"},{test:function(){return window.jQuery},src:"/bundles/jquery"},{test:function(){return window.jQuery.validator},src:"/bundles/jqueryval"},{test:function(){return window.jQuery.validator.unobtrusive},src:"/bundles/jqueryvalunobtrusive"},{test:function(){return window.jQuery.fn.modal},src:"/bundles/bootstrap"}],t=function(i,r){var f,u;r<i.length&&(f=i[r],f.test()?t(i,r+1):(u=n.createElement("script"),u.onload=function(){t(i,r+1)},u.src=f.src,n.getElementsByTagName("body")[0].appendChild(u)))};t(i,0)}(document);Yamaha=Yamaha||{},function(n,t,i,r,u,f){"use strict";u.Location={setByCoordinates:function(n,i,r){t.ajax({url:"/api/location/setlocation/?lat="+n+"&lon="+i+"&accuracy="+r,type:"get",dataType:"json",cache:!1,traditional:!0,success:function(){},error:function(){}})},setByIP:function(){t.ajax({url:"/api/location/setlocation/",type:"get",dataType:"json",cache:!1,traditional:!0,success:function(){},error:function(){}})}};t(function(){function n(n){u.Location.setByCoordinates(n.coords.latitude,n.coords.longitude,n.coords.accuracy)}function i(n){switch(n.code){case n.PERMISSION_DENIED:case n.POSITION_UNAVAILABLE:case n.TIMEOUT:case n.UNKNOWN_ERROR:default:u.Location.setByIP()}}if(typeof t.cookie("UserLocation")=="undefined"&&navigator.geolocation)navigator.geolocation.getCurrentPosition(n,i,{enableHighAccuracy:!0,timeout:1e7,maximumAge:0})});n.Calculator=function(n){this.throwOnDivideByZero=n===f?!0:n};n.Calculator.prototype=function(){function t(n,t){return n+t}function i(n,t){return n-t}function r(n,t){return n*t}function u(n,t){return f(t),n/t}function f(t){if(t===0&&n.throwOnDivideByZero)throw new Error("Divide by Zero.");}var n=this;return{add:t,subtract:i,multiply:r,divide:u}}()}(window.framework=window.framework||{},window.jQuery,window,document,Yamaha),function(){function n(){document.removeEventListener("DOMContentLoaded",n,!1);for(var i=document.getElementsByClassName("email-signup-form"),r=i.length;r--;)i[r].addEventListener("submit",t,!1)}function t(n){var i,t,r,u;n.defaultPrevented||(n.currentTarget.parentElement.classList.add("email-signup-submitted"),i=n.currentTarget.elements[1].value,i.length>4&&($.ajax({url:"/api/location/setlocation?zip="+i,type:"get",dataType:"json",cache:!1,traditional:!0,success:function(){},error:function(){}}),t=new Date,r=365,t.setTime(t.getTime()+r*864e5),u="expires="+t.toUTCString(),document.cookie="SubscribeRequest=true;"+u+";path=/"))}document.readyState!=="loading"?n():document.addEventListener("DOMContentLoaded",n,!1)}();Yamaha=Yamaha||{},function(n,t,i,r,u){"use strict";u.OwnersManual={getCategoriesForYearsList:function(n,i){var r=[];if(t.each(i,function(i,u){u.Year==n&&(console.log("Found year "+n),t.each(u.Categories,function(n,t){console.log("Found category "+t.Category);r.push(t.Category)}))}),r.length===0)throw"Year not found or no categories. Year: "+n;return r},getModels:function(n,i,r){var u=[];if(t.each(r,function(r,f){f.Year==n&&t.each(f.Categories,function(n,r){r.Category==i&&t.each(r.Models,function(n,t){console.log("Found model "+t.Model);u.push(t)})})}),u.length===0)throw"No models found for. Year: "+n+" Category: "+i;return u},initializeManualForm:function(n,r){var o=t(n),s=t(o).find("#YEAR"),e=t(o).find("#LINE"),f=t(o).find("#MODEL"),h=t(o).find("#DOWNLOAD");s.find("option:eq(0)").prop("selected",!0);e.find("option:eq(0)").prop("selected",!0);f.find("option:eq(0)").prop("selected",!0);s.change(function(){var i=t(s).val(),n;console.info("Year changed");e.find("option:gt(0)").remove();f.find("option:gt(0)").remove();e.find("option:eq(0)").prop("selected",!0);f.find("option:eq(0)").prop("selected",!0);n=u.OwnersManual.getCategoriesForYearsList(i,r);t.each(n,function(n,i){t(e).append(t("<option>",{value:i,text:i}))})});e.change(function(){var i=t(s).val(),o=t(e).val(),n;console.info("Line changed");f.find("option:gt(0)").remove();f.find("option:eq(0)").prop("selected",!0);n=u.OwnersManual.getModels(i,o,r);t.each(n,function(n,i){t(f).append(t("<option>",{value:i.PDF_URL,text:i.Model}))})});f.change(function(){var n=t(f).val();t(h).attr("data-yamaha-download-url",n)});t(h).click(function(){var n=t(h).attr("data-yamaha-download-url");return n?i.open(n):alert("Please select a model"),!1});t(o).submit=function(n){n.preventDefault();var r=t(h).attr("data-yamaha-download-url");return r||(i.location=r),!1}}};t(function(){})}(window.framework=window.framework||{},window.jQuery,window,document,Yamaha)