var Debug = (function() { var a = function() { var b = document.location.href; if(b.indexOf("?") > 0) { b = b.split("?")[1]; b = b.split("=")[1]; switch(b) { case "1024": $(".frame").addClass("frame_debug_1024"); break; } } }; return { init: a }; })(); Debug.init(); function animateIntro() { $(".redNav").delay(600).animate({ left: 0 }, 500, "easeOutBack"); $(".mainNav > ul").delay(900).animate({ left: 0 }, 500, "easeInOutQuint"); var c = $(".hero"); var g = $(".heroBg"); var d = $(c).find(".leftSide .bg"); var f = $(c).find(".rightSide .bg"); var e = $(c).find(".leftSide .text"); var b = $(c).find(".rightSide .text"); var a = $(c).find(".scrollDown"); $(".heroBox").removeClass("loading"); $(d).delay(500).animate({ left: "80px" }, 350, "easeOutBack", function() { $(f).animate({ right: "80px" }, 350, "easeOutBack", function() { $(g).fadeIn(700); $(e).delay(300).animate({ top: "356px" }, 550, "easeInQuint").animate({ top: "352px" }, 80, function() { $(b).delay(650).animate({ bottom: "81px" }, 250, "easeInOutQuint").animate({ bottom: "76px" }, 60, function() { $(a).delay(750).fadeIn(500); }); }); }); }); } var leftLink = $("section#header .leftMain"); var leftNav = $("section#header .leftNav"); var rightLink = $("section#header .rightMain"); var rightNav = $("section#header .rightNav"); function mainNavInit() { $(leftLink).hover(function() { $(this).addClass("active"); mainNavAnimateIn(leftNav); }, function() { mainNavAnimateOut(leftNav); }); $(leftNav).hover(function() { mainNavAnimateRestore(leftNav); }, function() { mainNavAnimateOut(leftNav); }); $(rightLink).hover(function() { $(this).addClass("active"); mainNavAnimateIn(rightNav); }, function() { mainNavAnimateOut(rightNav); }); $(rightNav).hover(function() { mainNavAnimateRestore(rightNav); }, function() { mainNavAnimateOut(rightNav); }); } function mainNavAnimateIn(a) { if($(a).is(":visible")) { $(a).stop(true).css("opacity", "1"); } else { $(a).children().css("opacity", "0"); $(a).css({ height: "0", display: "block", opacity: "1", overflow: "visible" }).animate({ height: 44 }, 150, function() { $(a).children().animate({ opacity: 1 }, 175); }); } } function mainNavAnimateRestore(a) { $(a).stop(true, true).css({ opacity: "1", display: "block" }); $(a).children().animate({ opacity: 1 }, 175); } function mainNavAnimateOut(a) { $(a).delay(300).animate({ opacity: 0 }, 400, function() { $(this).hide(); if($(a).hasClass("leftNav")) { $(leftLink).removeClass("active"); } else { $(rightLink).removeClass("active"); } }); } var RaceSchedule = (function(b) { var f = {}, e = {}; var d = function() { $("#schedule-detail").show().css({ opacity: 0, left: "1000px" }); }; var a = function() { $("#schedule-list li").click(function(r) { r.preventDefault(); var p = $(this).index(), q = $("#schedule-detail .scrollable:eq(" + p + ")"), n = $("#schedule-detail .results:eq(" + p + ")"), o = $("#schedule-detail .gallery:eq(" + p + ")"); if(!$(this).hasClass("inactive")) { if(!$(this).hasClass("selected")) { r.preventDefault(); $("#schedule-list li").removeClass("selected"); $(this).addClass("selected"); linkTrack("schedule_content", $(this).attr("data-lid")); if($(".ie7Detect").exists() || $(".ie8Detect").exists()) { $("#schedule-detail .scrollable").hide(); $("#schedule-detail .results").hide(); $("#schedule-detail .gallery").hide(); q.stop(true, true).show().tinyscrollbar({ sizethumb: 100 }); n.stop(true, true).show(); o.stop(true, true).show(); } else { $("#schedule-detail .scrollable").fadeOut(500); $("#schedule-detail .results").fadeOut(500); $("#schedule-detail .gallery").fadeOut(500); q.stop(true, true).show().fadeOut(0).fadeIn(500).tinyscrollbar({ sizethumb: 100 }); n.stop(true, true).show().fadeOut(0).fadeIn(500); o.stop(true, true).show().fadeOut(0).fadeIn(500); } j(o); h(); } q.tinyscrollbar_update(0); } }); $("#schedule-detail .closeBtn").click(function(n) { n.preventDefault(); linkTrack("schedule_content", "close"); l(); }); }; var h = function() { if($(".ie7Detect").exists() || $(".ie8Detect").exists()) { $("#schedule-detail").show(); } $("#schedule-container").stop(true, true).animate({ left: "-250px" }, 500); $("#schedule-detail").stop(true, true).animate({ left: "880px", opacity: 1 }, 500); }; var j = function(n) { if(!n.hasClass("init")) { n.addClass("init"); n.attr("data-current-first", 1); n.find(".gallery-scroll-prev").click(function() { g(n, -1); }); n.find(".gallery-scroll-next").click(function() { g(n, 1); }); n.find("a[rel^='prettyPhoto']").unbind().click(function(o) { o.preventDefault(); pageTrack("", "overlay/race_schedule_gallery"); }).prettyPhoto({ doHash: false, page_track_on_close: function() { pageTrack("", "schedule"); }, tracking_content_lpos: "race_schedule_content", tracking_close_lid: "close_gallery", tracking_media_content_lpos: "race_schedule_content", tracking_media_content_lid: "photo_", tracking_media_prev_lid: "previous", tracking_media_next_lid: "next" }); c(n); } }; var g = function(o, p) { var n = { nextLeft: parseInt(o.attr("data-current-first")) + p }; n.nextLeft = Math.max(1, Math.min(o.find("li").size(), n.nextLeft)); n.scrollTo = (-1) * (n.nextLeft - 1) * o.find("li").width(); o.find("ul").stop(true, true).animate({ left: n.scrollTo + "px" }, 600, function() { o.attr("data-current-first", n.nextLeft); c(o); }); }; var c = function(n) { if(n.attr("data-current-first") == 1) { n.addClass("isFirst"); } else { n.removeClass("isFirst"); } if(n.attr("data-current-first") == n.find("li").size()) { n.addClass("isLast"); } else { n.removeClass("isLast"); } }; var k = function() { $("#schedule-container").find(".gallery").each(function() { $(this).find("ul").css({ left: 0 }); }); }; var m = function(n) { e = $.extend(f, n); d(); a(); }; var l = function() { $("#schedule-list li").removeClass("selected"); $("#schedule-detail .scrollable").stop(true, true).fadeOut(500); $("#schedule-container").stop(true, true).animate({ left: 0 }, 500); $("#schedule-detail").stop(true, true).animate({ left: "1000px", opacity: 0 }, 500); if($(".ie7Detect").exists() || $(".ie8Detect").exists()) { $("#schedule-detail").hide(); } k(); }; return { init: m, resetContent: l }; })(); var GoodLookGallery = (function(d) { var f = {}, b = {}; var e = function() { $("#goodlookGallery a[rel^='prettyPhoto']").prettyPhoto({ doHash: false, page_track_on_close: function() { pageTrack("", "goodlook"); }, tracking_content_lpos: "dart_rt_gallery_content", tracking_close_lid: "close_gallery", tracking_media_content_lpos: "dart_rt_gallery_content", tracking_media_content_lid: "photo_", tracking_media_prev_lid: "previous", tracking_media_next_lid: "next" }); }; var h = function() { var j = 0; $("#goodlookGallery a[rel^='prettyPhoto']").each(function() { $(this).attr("data-photo-number", j); j++; }).click(function(k) { k.preventDefault(); linkTrack("dart_rt_gallery_content", "photo_" + $(this).attr("data-photo-number")); pageTrack("", "overlay/dart_rt_gallery"); }); $("#goodlook .btnGallery").click(function(k) { c(); }); $("#goodlook .btnBack").click(function(k) { a(); }); }; var c = function() { var k = $("#goodlookGallery"), l = $("#goodlookLayer1 .content"), j = ((parseInt($(window).width()) / 2) + 540) * -1; $(l).stop().animate({ opacity: 0 }, 150, function() { $(k).stop().css("left", j).show().animate({ left: -241 }, 500, "easeOutQuart"); }); }; var a = function() { var k = $("#goodlookGallery"), l = $("#goodlookLayer1 .content"), j = ((parseInt($(window).width()) / 2) + 540) * -1; $(k).stop().animate({ left: j }, 400, "easeInExpo", function() { $(this).hide(); $(l).stop().animate({ opacity: 1 }, 400); }); }; var g = function(j) { b = $.extend(f, j); e(); h(); }; return { init: g }; })(); var TakeoffVideo = (function(b) { var d = {}, a = {}; var c = function() { $("#takeoff a[rel^='prettyPhoto']").prettyPhoto({ doHash: false, page_track_on_close: function() { pageTrack("", "takeoff"); }, tracking_content_lpos: "takeoff_content", tracking_close_lid: "close_gallery", tracking_media_content_lpos: "takeoff_content", tracking_media_content_lid: "video_", tracking_media_prev_lid: "previous", tracking_media_next_lid: "next" }); }; var f = function() { $("#takeoff a[rel^='prettyPhoto']").click(function(g) { g.preventDefault(); linkTrack("takeoff_content", "play_video"); pageTrack("", "overlay/takeoff_video"); }); }; var e = function(g) { a = $.extend(d, g); c(); f(); }; return { init: e }; })(); var NotSeenGallery = (function(b) { var d = {}, a = {}; var c = function() { $("#notseen-gallery-wrap a").prettyPhoto({ doHash: false, page_track_on_close: function() { pageTrack("", "notseen"); }, tracking_content_lpos: "notseen_content", tracking_close_lid: "close_gallery", tracking_media_content_lpos: "notseen_content", tracking_media_content_lid: "photo_", tracking_media_prev_lid: "previous", tracking_media_next_lid: "next" }); }; var f = function() { $("#notseen-gallery-wrap a").click(function(g) { g.preventDefault(); linkTrack("notseen_content", "photo_" + $(this).index()); pageTrack("", "overlay/notseen_gallery"); }); }; var e = function(g) { a = $.extend(d, g); c(); f(); }; return { init: e }; })(); function loadPress(b) { var e = "#" + ($(b).attr("rel")); var d = $("#pressNavDisplay"); var c = parseInt($(d).css("left")); var a = c + 40; if($(d).hasClass("animating")) { return false; } else { $(d).addClass("animating"); $(d).children(".scrollable").hide(); $("#pressNavList li").removeClass("active"); $(b).parent().addClass("active"); if(!$(d).hasClass("open")) { $(d).css({ left: a, opacity: 0, display: "block" }).animate({ left: c, opacity: 1 }, 250); $(d).addClass("open"); loadPressContent(e); } else { loadPressContent(e); } } } function loadPressContent(a) { $(a).fadeIn(600, function() { $("#pressNavDisplay").removeClass("animating"); }); $(a).tinyscrollbar({ sizethumb: 199 }); } function hidePress() { var c = $("#pressNavDisplay"); var b = parseInt($(c).css("left")); var a = b + 40; $(c).animate({ left: a, opacity: 0 }, 250, function() { $(c).css("left", "").css("opacity", "").css("display", "").removeClass("open"); }); } function popFire() { if(!$("body").hasClass("popupClicked")) { initRadioButtons(); setFormValidationRequirements(document.fulfillment, ""); $("body").addClass("popupClicked"); } $("#popupMask").fadeIn(250).unbind(); $(".popupWindow").css("opacity", "0").fadeIn(0, function() { popCenter(this); popAssignClicks(); $(this).delay(50).animate({ opacity: "1" }, 200); }); } function popAssignClicks() { $("#popupMask, .popupWindow .closeBtnPop").unbind().click(function() { $("#popupMask, .popupWindow, #popupLoading").fadeOut(300); }); } function popCenter(b) { var a = ((($(window).height() - $(b).outerHeight()) / 2)); $(b).css("top", a + "px").css("left", (($(window).width() - $(b).outerWidth()) / 2) + "px"); return this; } function popRecenter(b) { var a = ((($(window).height() - $(b).outerHeight()) / 2)) + "px"; if($(".iPadDetect.vOne").exists()) { $(b).css("top", a); } else { $(b).animate({ top: a }, 300); } } function ipadinit() { $("body").bind("orientationchange", function() { if($(".popupWindow").is(":visible")) { popRecenter(".popupWindow"); } }); window.onscroll = function() { if($(".popupWindow").is(":visible")) { popRecenter(".popupWindow"); } }; } initRadioButtons = function() { if($(".emailMail").length !== 0) { ($(".emailMail").find("input").size() >= 1) ? $(".emailMail").find("input").remove(): ""; ($(".email").find("input").size() >= 1) ? $(".email").find("input").remove(): ""; $(".emailMail").click(function(a, c) { var b = $(this); (b.find("input").size() >= 1) ? b.find("input").remove(): ""; curForm = "emailMail"; $(".emailMail label").addClass("selected"); $(".email label").removeClass("selected"); $(".mailOnly").show(); $(".zipcode").hide(); linkTrack(b.attr("data-lpos"), b.attr("data-lid")); }); $(".email").click(function(a, c) { var b = $(this); curForm = "email"; $(".email label").addClass("selected"); $(".emailMail label").removeClass("selected"); $(".mailOnly").hide(); $(".zipcode").show(); linkTrack(b.attr("data-lpos"), b.attr("data-lid")); }); } }; function setFormValidationRequirements(a, b) { a.A15$3$first_name.required = "First Name"; a.A17$3$last_name.required = "Last Name"; a.A40$2$email.required = "E-mail Address"; a.A24$3$zipcode.required = "ZIP Code"; if(b != "email") { a.A20$3$first_line.required = "Street Address"; a.A22$3$city.required = "City"; a.A23$3$state.required = "State"; } else { a.A20$3$first_line.required = ""; a.A22$3$city.required = ""; a.A23$3$state.required = ""; } a.A20$3$first_line.label = "Street Address"; a.A22$3$city.label = "city"; a.A23$3$state.label = "State"; a.A20$3$first_line.subtype = "alphaNum"; a.A24$3$zipcode.subtype = "zipcode"; a.A40$2$email.subtype = "email"; } function submitFulfillment(a) { var b = validateForm(a); var c = "form_id=" + encodeURI(document.fulfillment.elements.form_id.value) + "&error_pg=" + encodeURI(document.fulfillment.elements.error_pg.value) + "&success_pg=" + encodeURI(document.fulfillment.elements.success_pg.value) + "&form_type=" + encodeURI(document.fulfillment.elements.form_type.value) + "&confirm_pg=" + encodeURI(document.fulfillment.elements.confirm_pg.value) + "&A01$1$marketing_info=" + encodeURI(document.fulfillment.elements["A01$1$marketing_info"].value) + "&A70$1$survey=" + encodeURI(document.fulfillment.elements["A70$1$survey"].value) + "&A19$2$address=" + encodeURI(document.fulfillment.elements["A19$2$address"].value) + "&A11$2$subchannel_id=" + encodeURI(document.fulfillment.elements["A11$2$subchannel_id"].value) + "&A02$2$program_id=" + encodeURI(document.fulfillment.elements["A02$2$program_id"].value) + "&A80$1$product_of_interest=" + encodeURI(document.fulfillment.elements["A80$1$product_of_interest"].value); if(mktCodeCookie) { c += "&A03$2$buy_id=" + encodeURI(document.fulfillment.elements["A03$2$buy_id"].value) + "&A04$2$site_id=" + encodeURI(document.fulfillment.elements["A04$2$site_id"].value) + "&A05$2$ad_id=" + encodeURI(document.fulfillment.elements["A05$2$ad_id"].value) + "&A06$2$rendering_id=" + encodeURI(document.fulfillment.elements["A06$2$rendering_id"].value) + "&A07$2$placement_id=" + encodeURI(document.fulfillment.elements["A07$2$placement_id"].value) + "&A08$2$channel=" + encodeURI(document.fulfillment.elements["A08$2$channel"].value); } c += "&A12$1$customer=" + encodeURI(document.fulfillment.elements["A12$1$customer"].value) + "&A13$2$name=" + encodeURI(document.fulfillment.elements["A13$2$name"].value) + "&A15$3$first_name=" + encodeURI(document.fulfillment.elements["A15$3$first_name"].value) + "&A17$3$last_name=" + encodeURI(document.fulfillment.elements["A17$3$last_name"].value) + "&A40$2$email=" + encodeURI(document.fulfillment.elements["A40$2$email"].value) + "&A20$3$first_line=" + encodeURI(document.fulfillment.elements["A20$3$first_line"].value) + "&A22$3$city=" + encodeURI(document.fulfillment.elements["A22$3$city"].value) + "&A23$3$state=" + encodeURI(document.fulfillment.elements["A23$3$state"].value) + "&A24$3$zipcode=" + encodeURI(document.fulfillment.elements["A24$3$zipcode"].value); if(b) { makePOSTRequest("/formbase/FbFormInput", c, thankyou()); } } function thankyou() { $(".thankYou").fadeIn("slow"); $(".form :input").val(" "); $(".signUp").hide(); $(".btn-close3").click(function() { $(".thankYou").hide(); }); submitClicked = false; pageTrack("", "thank_you"); } function resetFooter() { $("#footer").css("bottom", "-650px"); } function lazyImageLoader(a) { $(a).each(function() { if(!$(this).hasClass("loaded")) { var b = $(this).attr("data-src"); $(this).attr("src", b).addClass("loaded"); } }); } $(document).ready(function() { var a = []; var c = null; var d = 1; $("#intro img[data-src], #subintro img[data-src], #dirt-and-roads img[data-src], #travis img[data-src]").each(function() { a.push({ target: $(this), path: $(this).attr("data-src") }); }); function b(n, q, o) { function g(r, j) { var s = "" + r; while(s.length < j) { s = "0" + s; } return s; } for(var l = 0, k = o; l < k; l++) { var h = new Image(); var f = g(l, 3); var p = $(n).children(); var m = q.replace(/{index}/g, f); $(h).attr("data-trigger", "none").attr("data-src", m).css("display", "none"); $(n).append(h); a.push({ target: $(p + '[data-src="' + m + '"]'), path: m }); } if(typeof $(n).attr("loadedCount") == "undefined") { $(n).attr("loadedCount", $(n).find("img").size()); } } b($("#travis-backflip"), "images/sequence/backflip/{index}.png", 40); b($("#schedule-car"), "images/sequence/scheduleGRC/vid-50/{index}.png", 13); RaceSchedule.init(); GoodLookGallery.init(); TakeoffVideo.init(); NotSeenGallery.init(); function e() { $("#mainPreloader .status").html("0%"); var j = 0; var f = a.length; var g = ""; var h; $(a).each(function() { var k = $(this.target); h = $(""); $(h).load(function() { $(k).attr("src", $(this).attr("src")).addClass("loaded"); j = j + 1; g = (Math.ceil((j / f) * 100)) + "%"; $("#mainPreloader .status").html(g); if(j == f) { preloadComplete(); } }); h[0].src = this.path; }); } setTimeout(function() { e(); }, 0); }); function preloadComplete() { $("#mainPreloader").fadeOut(600); animateIntro(); mainNavInit(); initImageSequences(); dart360widget(); $("#mainScrollBarThumb").draggable({ containment: "parent" }, { drag: function(e, f) { var a = $("#mainScrollBarThumb"); var b = $(a).position(); var d = parseInt($("#mainScrollBarTrack").height() - 134); var g = 13000 / d; var c = b.top * g; scrollAnimate = ScrollAnimator(); scrollAnimate.scrollTo(c); } }); $("#pressEntry1").tinyscrollbar({ sizethumb: 199 }); $("html").addClass("scrollEnabled"); } var imageSequences = {}; imageSequences.backflip = new ImageSequence({ filesPath: "images/sequence/backflip/{index}.png", imageCount: 40, skipImages: 1, zeroPad: 3, preload: false, container: $("#travis-backflip") }); imageSequences["vehicle-schedule"] = new ImageSequence({ filesPath: "images/sequence/scheduleGRC/vid-50/{index}.png", imageCount: 13, skipImages: 1, zeroPad: 3, preload: false, container: $("#schedule-car") }); function initImageSequences() { for(i in imageSequences) { imageSequences[i].load(); } }