if (typeof App === "undefined") { var App = {} } App.MIN_FLASH_VERSION = "10"; $(document).ready(function() { App.ie6 = $.browser.msie && /^6/.test($.browser.version); App.ie7 = $.browser.msie && /^7/.test($.browser.version) }); if (typeof console === "undefined") { console = { log: function(a) { } } } $(document).ready(function() { $("ul li:first-child").addClass("first_item"); $("ul li:last-child").addClass("last_item") }); App.Cookies = { getCookie: function(g, d, b) { var f = d + "="; var a = g.split(b); for (var e = 0; e < a.length; e++) { var h = a[e]; while (h.charAt(0) == " ") { h = h.substring(1, h.length) } if (h.indexOf(f) == 0) { return h.substring(f.length, h.length) } } return null }, getGlobal: function(a) { var b = document.cookie; return this.getCookie(b, a, ";") }, addSubCookie: function(k, a, l) { var h = ""; var b = a + "="; var e = false; var d = k.split("&"); var j = []; for (var f = 0; f < d.length; f++) { var g = d[f]; while (g.charAt(0) == " ") { g = g.substring(1, g.length) } if (g.indexOf(b) == 0) { j.push(b + l); e = true } else { j.push(g) } } h = j.join("&"); if (!e) { h += "&" + b + l } return h }, get: function(a) { var b = this.getGlobal(App.Constants.getSubCookiesName()); return this.getCookie(b, a, "&") }, set: function(b, c) { var d = App.Constants.getSubCookiesName(); var a = this.getGlobal(d); a = this.addSubCookie(a, b, c); this.setGlobal(d, a) }, setGlobal: function(a, c) { var b = a + "=" + c + "; path=/;"; window.document.cookie = b } }; App.PageSwitcher = (function(a) { return { pages: {}, switchToPage: function(b) { if (typeof this.pages[b] == "object" && !this.isPageActive(b)) { a("div.show-page.active").removeClass("active").trigger("hidepage"); this.ensurePageIsInitialized(b); a("#" + b).addClass("active").trigger("showpage") } }, isPageActive: function(b) { var c = a("#" + b).hasClass("active"); return c }, registerPage: function(b) { this.pages[b.id] = b }, isPageRegistered: function(b) { return (typeof this.pages[b] == "object") }, isPagePreInitialized: function(b) { return a("#" + b).data("App.PageSwitcher.pagePreInitialized") }, ensurePageIsInitialized: function(b) { if (!this.isPagePreInitialized(b)) { this.preInitPage(b) } }, preInitPage: function(b) { if (!this.isPageRegistered(b)) { throw ("Page #" + b + " is not registered.") } var c = this.pages[b]; c.preInit(); a("#" + c.id).bind("showpage", c.onEnter).bind("hidepage", c.onLeave).bind("showpage.postInitPage", function() { var d = a(this); if (!d.data("App.PageSwitcher.pagePostInitialized")) { c.postInit(); d.data("App.PageSwitcher.pagePostInitialized", true) } d.unbind("showpage.postInitPage").trigger("postinitpage") }).data("App.PageSwitcher.pagePreInitialized", true).trigger("preinitpage") } } })(jQuery); App.DynamicPage = function(a) { return { id: a, show: function() { App.PageSwitcher.switchToPage(this.id) }, isActive: function() { return App.PageSwitcher.isPageActive(this.id) }, preInit: function() { }, postInit: function() { }, onEnter: function() { }, onLeave: function() { } } }; App.ProgressBar = function() { return { totalCnt: 10, doneCnt: 0, total: 0, complete: null, active: null, inited: false, init: function(c, b, a) { $(c).prepend("<div class='progressBarInner'></div>"); this.setTotalCount(b); a ? this.setCompleteCount(a) : null; this.inited = 1 }, setTotalCount: function(d) { d = d || this.total; var c = $("<ul></ul>"); for (var b = 0; b < d; b++) { var a = $('<li id="pb' + (b + 1) + '" rel="' + (b + 1) + '"></li>'); c.append(a) } $(".progressBarInner").html(c); this.total = d; $("#progressBar").css("width", 59 * d).css("margin-left", -Math.round(59 * d / 2)) }, setCompleteCount: function(c, d) { if (d) { this.complete = c } c = Math.max(c, this.complete); $(".progressBarInner li").removeClass("completedStep").unbind("click mouseenter mouseleave mouseover mouseout"); for (var b = 0; b < Math.min(c, this.total); b++) { var a = $(".progressBarInner li#pb" + (b + 1)); a.addClass("completedStep").hover(function() { $(this).hasClass("completedStep") ? $(this).addClass("hover") : null }, function() { $(this).removeClass("hover") }); a.click(function(e) { e.stopImmediatePropagation(); App.Questions.Events.onToolStepAnswer(App.Questions.currentToolStep, App.Questions.lastAnswerId); App.Questions.startQuestion($(this).attr("rel")) }) } this.complete = c }, setActiveStep: function(a) { a = a || this.active; if (a > this.total) { return } $(".progressBarInner li").removeClass("activeStep"); $(".progressBarInner li#pb" + a).removeClass("completedStep").addClass("activeStep") } } } (); App.ModalWindow = (function(a) { return { show: function(b) { a('<div id="reviewWrap"><div id="reviewModal"><div id="reviewModalClose">close</div><div id="reviewModalContent">' + b + "</div></div></div>").prependTo("body"); a("#reviewModalClose").click(function() { a(this).parent().parent().remove() }); a("#reviewModalContent").jScrollPane({ scrollbarWidth: 20, scrollbarMargin: 15, showArrows: false }); return false }, load: function(c) { var d = a.ajax({ type: "GET", url: c, async: false, processData: false }).responseText; var b = a("<div></div>").hide().html(d); var e = a(b).find("#reviewPopup").html(); this.show(e) } } })(jQuery); (function(b) { var a = new App.DynamicPage("intro"); a.onEnter = function() { b.address.value(this.id); b("div.footer").hide(); App.Questions.Accuracy.hide(); if (swfobject.hasFlashPlayerVersion(App.MIN_FLASH_VERSION)) { App.Video.show(); App.Video.prepare(App.Constants.getIntroVideoPath()); App.Video.play(function() { App.PageSwitcher.switchToPage("welcome-page"); App.Video.hide() }) } else { App.PageSwitcher.switchToPage("welcome-page") } }; App.PageSwitcher.registerPage(a) })(jQuery); (function(f) { var e = new App.DynamicPage("welcome-page"); var a = f.browser.msie && /^6/.test(f.browser.version); var d = function() { f(".socialScroller ul").cycle({ fx: "scrollUp", speed: 600, timeout: 5000, easing: "easeOutCirc", cleartypeNoBg: true }) }; f.fn.vis = function() { f(this).css("visibility", "visible") }; f.fn.invis = function() { f(this).css("visibility", "hidden") }; var c = function() { if (f("#welcomeContent h1.h1OpenUp").length) { f('<div id="imageHolster" style="display:none; background-image:url(images/interface/bgLinkOrbHover.gif);"></div>').appendTo("body"); f('<div id="imageHolster2" style="display:none; background-image:url(images/interface/bgLinkOrbHoverOut.gif);"></div>').appendTo("body"); var n = f("#mockButtonWrap").html(); f("#mockButtonWrap").remove(); f("#btnSubmit").replaceWith(n); f('<div class="introContent" id="liveContent"></div>').insertBefore(".contentMask"); f("#welcomeContent .contentSet01").clone().appendTo("#liveContent"); f("#welcomeContent .contentSet02").clone().appendTo("#liveContent"); f("#liveContent a.btnStartHere").click(function(q) { q.preventDefault(); var p = f(this).attr("href"); var o = p.substring(p.indexOf("#") + 1); App.PageSwitcher.switchToPage(o) }); f("#liveContent a.btnStartHere").hover(function() { f(this).css("background-image", "url(images/interface/bgLinkOrbHover.gif)") }, function() { f(this).css("background-image", "url(images/interface/bgLinkOrbHoverOut.gif)") }); f("#welcomeContent").hide().css({ overflow: "hidden" }); var i = 0; function k() { f("#welcomeContent .contentSet01").vis(); f("#welcomeContent .contentSet02").show(); f("#welcomeContent .contentSet02").css("alpha", 1); f("#welcomeContent").css({ top: "0px", height: a ? "500px" : "700px" }).show(); f("#welcomeContent .retrieveContent").show(); f("#liveContent .contentSet01").invis(); f("#liveContent .retrieveContent").show(); f("#liveContent").hide(); i = 1 } function m() { f("#liveContent").css("top", "-370px").show(); f("#liveContent .contentSet02").vis(); f("#welcomeContent .contentSet02").hide(); f("#welcomeContent").animate({ top: "-500px" }, 200, function() { i = 0 }); var o = f("#liveContent .credEntry:first input"); g(o.get(0), o.val().length) } function l() { f("#welcomeContent .contentSet02").show(); f("#welcomeContent .contentSet01").fadeIn("fast"); f("#welcomeContent").css({ top: "-370px", height: "550px" }).show(); f("#liveContent").hide(); i = 1 } function h() { f("#welcomeContent .contentSet01").invis(); f("#liveContent .contentSet02").invis(); f("#liveContent .contentSet01").vis(); f("#liveContent .retrieveContent").hide(); f("#liveContent").css("top", "0px").show(); f("#welcomeContent").animate({ top: "10px" }, 100, function() { f(this).hide().css({ top: "0px" }); i = 0 }) } f("#liveContent .txtUsername").blur(function() { f("#welcomeContent .txtUsername").val(f(this).val()) }); f("#liveContent .txtPassword").blur(function() { f("#welcomeContent .txtPassword").val(f(this).val()) }); function j(p, q, r) { if (p.setSelectionRange) { p.focus(); p.setSelectionRange(q, r) } else { if (p.createTextRange) { var o = p.createTextRange(); o.collapse(true); o.moveEnd("character", r); o.moveStart("character", q); o.select() } } } function g(o, p) { j(o, p, p) } f("#liveContent .returnUser a").click(function(o) { o.preventDefault(); k(); f("#welcomeContent").animate({ top: "-370px" }, { duration: 700, specialEasing: { top: "easeOutBack" }, complete: m }).animate({ height: "780px" }, { duraion: 200, queue: false }) }); f("#welcomeContent .cancelLink").click(function() { return false }); f("#liveContent .cancelLink").click(function(o) { o.preventDefault(); if (i) { return } l(); f("#welcomeContent").animate({ top: "0px", height: "550px" }, { duration: 700, specialEasing: { top: "easeOutBack" }, complete: h }) }) } }; var b = function() { if (f.browser.msie && f.browser.version >= 6) { f(".num").FontEffect({ mirror: true, mirrorColor: "#fff", mirrorOffset: -7, mirrorHeight: 82, mirrorTLength: 13, mirrorTStart: 0.4 }) } else { f(".num").FontEffect({ mirror: true, mirrorColor: "#fff", mirrorOffset: -6, mirrorHeight: 98, mirrorDetail: 1, mirrorTLength: 11, mirrorTStart: 0.7 }) } }; e.preInit = function() { f.address.value(this.id) }; e.postInit = function() { d(); c(); b() }; e.onEnter = function() { var g = f(this); f("div.footer").show(); f("#features").show(); f("div.siteOptions").show(); App.Questions.Accuracy.show(); if (swfobject.hasFlashPlayerVersion(App.MIN_FLASH_VERSION)) { App.Video.prepare(App.Constants.getWelcomeToQuestionsVideo()) } }; e.onLeave = function() { f("#features").hide() }; App.PageSwitcher.registerPage(e) })(jQuery); (function(b) { var a = new App.DynamicPage("questions"); a.onEnter = function() { b.address.value(this.id); b("div.body-bg").show(); b("div.footer").show(); b("div.siteOptions").show(); b("#features").hide(); App.Questions.Accuracy.show(); if (!b.browser.msie) { App.Questions.Transition.unReady() } App.Questions.hideQuestionPanel(true); App.Questions.firstTime = true; if (typeof App.Questions.currentToolStep === "undefined" || !App.Questions.currentToolStep) { if (App.Questions.currentIndex == 0) { App.Questions.currentIndex = 1; App.Questions.currentSubIndex = 0; App.Questions.subQuestionMode = false } } App.Questions.doAfterInitialization(function() { App.Questions.startQuestion(); App.Questions.Events.onToolStepsStart() }) }; a.preInit = function() { }; a.postInit = function() { }; App.PageSwitcher.registerPage(a); b("body").bind("growcomplete", function() { App.Questions.showQuestion() }); b("body").bind("shrinkcomplete", function() { if ((App.Questions.currentIndex == App.Questions.data.length - 1)) { App.Questions.currentToolStep = null; App.PageSwitcher.switchToPage("recap-page") } else { if (App.Questions.currentIndex > 0) { App.Questions.Transition.startGrowQuestionTransition() } else { App.PageSwitcher.switchToPage("welcome-page") } } }) })(jQuery); (function(a) { var b = new App.DynamicPage("welcome-to-questions-transition"); b.onEnter = function() { a("div.footer").hide(); App.Questions.Accuracy.hide(); if (swfobject.hasFlashPlayerVersion(App.MIN_FLASH_VERSION)) { App.Video.play(function() { App.Video.hide(); App.PageSwitcher.switchToPage("questions") }) } else { App.PageSwitcher.switchToPage("questions") } }; App.PageSwitcher.registerPage(b) })(jQuery); (function(b) { var a = new App.DynamicPage("recap-page"); a.onEnter = function() { App.Questions.currentIndex = 0; b.address.value(this.id); b("div.footer").show(); b("#features").show(); b("div.siteOptions").show(); b("p.recap").load(App.Constants.getRecapPageContentUrl()); b("p.recap a").live("click", function(d) { d.preventDefault(); App.Questions.setCurrentQuestionByToolStepID(b(this).attr("rel")); App.PageSwitcher.switchToPage("questions") }); function c(e, f) { for (var d in e) { if (e[d].ToolStepOptionID == f) { return e[d] } } return null } b("a.btnGetReg").unbind().click(function(d) { App.Constants.redirectToResultsPage(); d.preventDefault() }) }; App.PageSwitcher.registerPage(a) })(jQuery); (function(b) { var a = new App.DynamicPage("questions-to-thankyou-transition"); a.onEnter = function() { b("div.footer").hide(); App.Questions.Accuracy.show(); App.Video.show(); App.Video.play(App.Constants.getQuestionsToThankYouTransition(), function() { App.Video.hide(); App.Constants.redirectToResultsPage() }) }; App.PageSwitcher.registerPage(a) })(jQuery); (function(b) { var a = new App.DynamicPage("results-page"); a.onEnter = function() { b.address.value(this.id); b("div.footer").hide(); b("#features").hide() }; App.PageSwitcher.registerPage(a) })(jQuery); (function(b) { var a = new App.DynamicPage("quit-and-save"); a.onEnter = function() { b.address.value(this.id); b("div.footer").show(); b("#features").show(); App.Questions.Accuracy.show(); b(".checkboxDup").unbind("click").click(function() { b(this).attr("id") ? b(this).attr("id", "") : b(this).attr("id", "checked") }); b("#quit-and-save").unbind("click").click(function(c) { App.PageSwitcher.switchToPage("quit-and-save") }) }; App.PageSwitcher.registerPage(a) })(jQuery); $(document).ready(function() { if ($.address.value() == "") { App.PageSwitcher.switchToPage("intro") } $.address.init(function(a) { if (a.value != "") { App.PageSwitcher.switchToPage(a.value) } }).change(function(a) { return false }).externalChange(function(b) { var a = b.value; if (a == "") { pageid = "intro" } App.PageSwitcher.switchToPage(a) }).history(true) }); function videoPlayerLoaded() { App.Video.onPlayerLoaded() } function videoPlayerVideoReady() { App.Video.onPlayerVideoReady() } function videoPlayerVideoComplete() { App.Video.onPlayerVideoPlaybackComplete() } App.Video = (function(a) { return { targetId: "video-player-flash", flashObjectId: "video-player-flash", swfFile: "swf/OlayVideoPlayer.swf", initialized: false, loaded: false, ready: false, playing: false, flash: null, playImmediately: false, ensureInitialization: function() { if (!this.initialized) { this.init() } }, init: function() { var b = {}; var d = { menu: "false", scale: "noScale", allowFullscreen: "false", allowScriptAccess: "always", bgcolor: "none", wmode: "transparent" }; var c = { id: "video-player-flash" }; swfobject.embedSWF(this.swfFile, this.targetId, "100%", "100%", "9", "swf/expressInstall.swf", b, d, c); App.Video.initialized = true }, prepare: function(b) { App.Video.ready = false; App.Video.ensureInitialization(); App.Video.playImmediately = false; var e = function() { App.Video.flash.setVideoSource(b) }; var f = (new Date()).getTime(); var d = Math.round(1000 * Math.random()); var c = "AppVideoPlay" + f + d; if (this.loaded) { e() } else { a("body").bind("videoplayerloaded." + c, function() { a(this).unbind("videoplayerloaded." + c); e() }) } }, play: function(e) { var d = (new Date()).getTime(); var c = Math.round(1000 * Math.random()); var b = "AppVideoPlay" + d + c; if (typeof e !== "undefined") { a("body").bind("videoplayerplaybackcomplete." + b, function() { a("body").unbind("videoplayerplaybackcomplete." + b); e.call(App.Video) }) } if (App.Video.ready) { App.Video.startPlayback() } else { App.Video.playImmediately = true } }, startPlayback: function() { App.Video.playing = true; App.Video.show(); App.Video.flash.playVideo() }, stop: function() { App.Video.flash.stopVideo(); App.Video.playing = false }, onPlayerLoaded: function() { App.Video.loaded = true; App.Video.flash = a("#video-player-flash").get(0); a("body").trigger("videoplayerloaded") }, onPlayerVideoReady: function() { App.Video.ready = true; a("body").trigger("videoplayerready"); if (App.Video.playImmediately) { App.Video.startPlayback() } }, onPlayerVideoPlaybackComplete: function() { App.Video.playing = false; a("body").trigger("videoplayerplaybackcomplete") }, show: function() { a("#video-player").css("margin-top", "0px").show() }, hide: function() { a("#video-player").css("margin-top", "-5000px") }, showFlash: function() { App.Video.flash.showPlayer() }, hideFlash: function() { App.Video.flash.hidePlayer() } } })(jQuery); App.Questions = (function(a) { return { initialized: false, data: {}, interceptToolStep: null, currentIndex: 0, questionsAmount: 0, subQuestionKey: "", subQuestionMode: false, currentSubIndex: 0, currentToolStep: null, questionsHistory: {}, firstTime: true, lastAnswerId: "", FADE_IN_DURATION: 200, init: function(b, g) { var c = a("#questions div.panelNav"); this.nextButtonText = a("a.pnNext", c).text(); this.backButtonText = a("a.pnBack", c).text(); this.data = new Array(); this.interceptToolStep = g; var d; var h = {}; for (d = 0; d < b.length; d++) { var f = b[d]; if (!f.ParentToolStepID || f.ParentToolStepID == "0") { this.data.push(f); f.SubQuestions = new Array(); h[f.ToolStepID] = f } else { var e = f.tblToolStepOption[0]; if (typeof h[f.ParentToolStepID].SubQuestions[e.ParentToolStepOptionID] === "undefined") { h[f.ParentToolStepID].SubQuestions[e.ParentToolStepOptionID] = new Array() } h[f.ParentToolStepID].SubQuestions[e.ParentToolStepOptionID].push(f) } } this.questionsAmount = this.data.length - 2; this.Transition.init("swf/olayAnimation.swf", "questions-transition-flash"); a("#questions div.question-container > div").remove(); a("#questions a.pnNext").click(function(i) { App.Questions.nextQuestion(); i.preventDefault() }); a("#questions a.pnBack").click(function(i) { App.Questions.prevQuestion(); i.preventDefault() }); App.ProgressBar.init("#progressBar", this.data.length - 2); App.ProgressBar.setActiveStep(1); this.initialized = true }, doAfterInitialization: function(d) { var c = new Date().getTime(); var b = "App-Questions-doAfterInitialization" + c; if (this.initialized) { d() } else { a("body").bind("toolsteps-data-loaded." + b, function() { a("body").unbind("toolsteps-data-loaded." + b); d() }) } }, setCurrentQuestionByToolStepID: function(f) { var c = App.Questions; for (var k = 0; k < c.data.length; k++) { var l = c.data[k]; if (l.ToolStepID == f) { c.currentIndex = k; c.currentSubIndex = 0; c.subQuestionKey = ""; c.subQuestionMode = false; return true } } for (var k = 0; k < c.data.length; k++) { var l = c.data[k]; if (typeof l.SubQuestions !== "undefined") { var b = l.SubQuestions; for (var e in b) { var d = b[e]; for (var g = 0; g < d.length; g++) { var h = d[g]; if (h.ToolStepID == f) { c.currentIndex = k; c.currentSubIndex = g; c.subQuestionKey = e; c.subQuestionMode = true; return true } } } } } }, startQuestion: function(b, c) { if (typeof b === "undefined") { this.currentIndex = parseInt(this.currentIndex); b = this.currentIndex; c = this.currentSubIndex } else { b = parseInt(b); this.currentIndex = b; if (typeof c === "undefined") { c = 0; this.subQuestionMode = false } else { this.currentSubIndex = c; this.subQuestionMode = true } } if (!this.subQuestionMode) { App.ProgressBar.setCompleteCount(b); App.ProgressBar.setActiveStep(b) } if (this.currentToolStep != null) { this.addHistoryState(this.currentToolStep) } var d = this.currentToolStep; if (this.subQuestionMode) { this.currentToolStep = this.data[b].SubQuestions[this.subQuestionKey][c]; thislastAnswerId = this.getHistoryState(this.currentToolStep) } else { this.currentToolStep = this.data[b]; this.lastAnswerId = this.getHistoryState(this.currentToolStep) } if (this.firstTime) { this.firstTime = false; this.hideQuestionPanel(); this.Transition.startGrowQuestionTransition() } else { this.Transition.startShrinkQuestionTransition(d) } }, hideAllQuestions: function() { a("#questions div.question-container > div.question").hide(); if (App.ie6 || App.ie7) { a("#questions div.question-container > div.question .slider").css("visibility", "hidden") } }, showQuestion: function() { this.showQuestionPanel(); var b = this.currentIndex; var c = this.currentSubIndex; if (this.subQuestionMode) { } else { } var d = this.currentToolStep; if (a("#question-data-" + d.ToolStepID).length) { this.hideAllQuestions(); a("#question-data-" + d.ToolStepID).show().find("div.slider").css("visibility", "visible"); a("#questionInstruction").html("<p>" + d.StepHeader + "</p>") } else { this.hideAllQuestions(); this.initQuestionContent(a("#questions div.question-container"), d); a("#questionInstruction").html("<p>" + d.StepHeader + "</p>") } }, addHistoryState: function(b) { this.questionsHistory["q" + b.ToolStepID] = this.lastAnswerId }, getHistoryState: function(c) { var b = this.questionsHistory["q" + c.ToolStepID]; if (typeof b !== "undefined") { return b } return "" }, reportAnswer: function(b) { App.Questions.Events.onToolStepAnswer(b, App.Questions.lastAnswerId) }, nextQuestion: function() { App.Questions.reportAnswer(App.Questions.currentToolStep); var b = this.currentIndex; var c; if (this.subQuestionMode) { c = this.currentSubIndex + 1; if (this.data[this.currentIndex].SubQuestions[this.subQuestionKey].length <= c) { b++; this.subQuestionMode = false; this.subQuestionKey = ""; this.currentSubIndex = 0; this.currentIndex = b } else { this.currentSubIndex = c } } else { if (typeof this.data[this.currentIndex].SubQuestions[this.lastAnswerId] !== "undefined") { this.subQuestionMode = true; this.subQuestionKey = this.lastAnswerId; this.currentSubIndex = 0 } else { this.currentIndex = b + 1; this.subQuestionMode = false; this.subQuestionKey = ""; this.currentSubIndex = 0 } } this.startQuestion() }, prevQuestion: function() { App.Questions.reportAnswer(App.Questions.currentToolStep); if (this.subQuestionMode) { if (this.currentSubIndex > 0) { this.currentSubIndex-- } else { this.currentSubIndex = 0; this.subQuestionMode = false } } else { this.currentIndex--; var c = this.data[this.currentIndex]; var b = this.getHistoryState(c); if (typeof c.SubQuestions[b] !== "undefined" && c.SubQuestions[b].length > 0) { this.subQuestionMode = true; this.subQuestionKey = b; this.currentSubIndex = c.SubQuestions[b].length - 1 } } if (this.currentIndex == 0) { App.Questions.Transition.startShrinkQuestionTransition(App.Questions.currentToolStep) } else { this.startQuestion() } }, hideQuestionPanel: function(b) { if (typeof b === "undefined" || !b) { a("#question-wrapper").hide() } else { a("#question-wrapper").hide() } }, showQuestionPanel: function() { if (App.Questions.currentIndex == 1) { a("#question-wrapper a.pnBack").hide() } else { a("#question-wrapper a.pnBack").show() } a("#question-wrapper").show(); if (App.ie6 || App.ie7) { a("#question-wrapper div.slider").css("display", "none").css("display", "block") } }, initQuestionContent: function(n, c) { switch (c.QuestionType) { case "slider": var f = this.Templater.getHtml(c); var d = a(f); a(n).append(d); var o = c.tblToolStepOption; var e = o.length; var g = Math.ceil(e * 0.5) - 1; a("div.slider-value", d).html(o[g].StepOptionName); this.lastAnswerId = o[g].ToolStepOptionID; var h = function(r, q) { App.Questions.currentToolStep.step = q; var p = Math.floor(q / 100); a("div.slider-value", d).html(o[p].StepOptionName); var s = o[p].ToolStepOptionID; App.Questions.lastAnswerId = s }; c.step = (c.tblToolStepOption.length) * 50; a(":range", d).rangeinput({ onSlide: h, change: h, progress: true, value: c.step, speed: 0 }); break; case "ageslider": var f = this.Templater.getHtml(c); var d = a(f); a(n).append(d); var o = c.tblToolStepOption; var e = o.length; var k = function(q) { if (q < 20) { return o[0] } else { if (q >= 80) { return o[e - 1] } else { var p = Math.floor(q / 10); return o[p - 1] } } }; var m = function(p) { if (p < 20) { return o[0].StepOptionName } else { if (p >= 80) { return o[e - 1].StepOptionName } else { return p } } }; this.age2string = m; var h = function(r, q) { var p = m(q); App.Questions.Transition.showAgeSliderValue.call(a("div.slider-value span", d).data("currentSliderValue", q)); var s = k(q).ToolStepOptionID; App.Questions.lastAnswerId = s }; var l = 30; a("div.slider-value span", d).data("currentSliderValue", l).data("shownSliderValue", l).html(m(l)); this.lastAnswerId = k(l).ToolStepOptionID; a(":range", d).rangeinput({ onSlide: h, change: h, progress: true, value: 30, speed: 0 }); break; case "checkbox": var f = this.Templater.getHtml(c); var d = a(f); a(n).append(d); a(".tips .tip", d).hide(); a(".question-content input[type=checkbox]", d).hide(); var b = a(".question-content label", d); b.click(function() { var q = a(this); var r = q.attr("for"); if (q.hasClass("checked")) { q.removeClass("checked"); a("#" + r).removeAttr("checked"); var p = r.substring(9); if (jQuery.inArray(p, App.Questions.lastAnswerId) >= 0) { App.Questions.lastAnswerId.splice(jQuery.inArray(p, App.Questions.lastAnswerId), 1) } } else { q.addClass("checked"); a("#" + r).attr("checked", "true"); var p = r.substring(9); if (typeof App.Questions.lastAnswerId === "string") { App.Questions.lastAnswerId = new Array(); App.Questions.lastAnswerId.push(p) } else { if (jQuery.inArray(p, App.Questions.lastAnswerId) == -1) { App.Questions.lastAnswerId.push(p) } } } }); if (a(".tip", d).length) { b.mouseover(function() { var q = a(this); var p = q.addClass("hover").data("answerId"); if (typeof p === "undefined" || !p) { var r = q.attr("for"); p = r.substring(9); q.data("answerId", p) } a("#option-tip-" + p, d).slideDown("fast") }).mouseout(function() { var q = a(this); var p = q.removeClass("hover").data("answerId"); a("#option-tip-" + p, d).stop(true, true).slideUp() }) } else { b.mouseover(function() { a(this).addClass("hover") }).mouseout(function() { a(this).removeClass("hover") }) } var j = a(".panel-options", d); var i = Math.round(67 - j.height() / 2); a(".panel-options", d).css("marginTop", i + "px"); break; case "icon": var f = this.Templater.getHtml(c); var d = a(f); a(n).append(d); a(".tips .tip", d).hide(); a(".question-content input[type=radio]", d).hide(); var b = a(".question-content label", d); b.click(function() { a("label.checked", d).removeClass("checked"); var q = a(this).addClass("checked").data("answerId"); if (typeof q === "undefined" || !q) { var p = a(this).attr("for"); q = p.substring(6); a(this).data("answerId", q) } App.Questions.lastAnswerId = q }).mouseenter(function() { var q = a(this).data("answerId"); if (typeof q === "undefined" || !q) { var p = a(this).attr("for"); q = p.substring(6); a(this).data("answerId", q) } a("#option-tip-" + q).slideDown("fast"); a("div.d-arrow", this).animate({ backgroundPositionY: "0px" }) }).mouseleave(function() { var p = a(this).data("answerId"); a("#option-tip-" + p).stop(true, true).slideUp(); a("div.d-arrow", this).stop(true, true).animate({ backgroundPositionY: "-8px" }) }); break; case "radio": default: var f = this.Templater.getHtml(c); var d = a(f); a(n).append(d); a(".tips .tip", d).hide(); a(".question-content input[type=radio]", d).hide(); var b = a(".question-content label", d); b.click(function() { a("label.checked", d).removeClass("checked"); var q = a(this).addClass("checked").data("answerId"); if (typeof q === "undefined" || !q) { var p = a(this).attr("for"); q = p.substring(6); a(this).data("answerId", q) } App.Questions.lastAnswerId = q }); if (a(".tip", d).length) { b.mouseover(function() { var r = a(this); var q = r.addClass("hover").data("answerId"); if (typeof q === "undefined" || !q) { var p = r.attr("for"); q = p.substring(6); a(this).data("answerId", q) } a("#option-tip-" + q, d).slideDown() }).mouseout(function() { var p = a(this).removeClass("hover").data("answerId"); a("#option-tip-" + p, d).stop(true, true).slideUp() }) } else { b.mouseover(function() { a(this).addClass("hover") }).mouseout(function() { a(this).removeClass("hover") }) } var j = a(".panel-options", d); var i = Math.round(67 - j.height() / 2); a(".panel-options", d).css("marginTop", i + "px"); break } } } })(jQuery); $(document).ready(function() { $.ajax({ url: App.Constants.getToolStepsJsonUrl(), dataType: "json", success: function(c) { var b = c.iGoDataSet.tblToolStep; var a = b.pop(); App.Questions.init(b, a); $("body").trigger("toolsteps-data-loaded") } }) }); App.Questions.Events = (function(a) { return { onToolStepAnswer: function(e, d) { if (e.ParentToolStepID == "0" && (d != "" && d.length != 0)) { var b = parseInt(e.ToolStepID); App.Questions.Accuracy.checkOnce(b) } var c = jQuery.Event("toolstep-complete"); c.toolStep = e; c.answerId = d; a("body").trigger(c) }, onToolStepsStart: function() { var b = jQuery.Event("toolsteps-start"); a("body").trigger(b) } } })(jQuery); App.Questions.Accuracy = (function(a) { return { currentValue: 0, answeredTotal: 0, answered: {}, init: function() { App.Cookies.set("accuracy", 0); var b = a("div.recAccuracy").get(0); a("h2", b).toggle(function() { a(this).parent().find(".recOptions").slideDown({ duration: 400, easing: "easeOutBack" }); a(this).attr("style", "background: url(images/interface/bgRecOptions.gif) no-repeat 1px 100%;"); a(this).find("span.arrow").addClass("accuracyOpen") }, function() { a(this).parent().find(".recOptions").slideUp({ duration: 400, easing: "easeOutBack" }); a(this).find("span.arrow").removeClass("accuracyOpen") }); a("div.recAccuracy a.skipNext").live("click", function(c) { c.preventDefault(); App.PageSwitcher.switchToPage("recap-page"); return false }); a("div.recAccuracy a.skipBack").live("click", function(c) { c.preventDefault(); App.PageSwitcher.switchToPage("welcome-page"); return false }) }, set: function(b) { App.Cookies.set("accuracy", b); this.currentValue = parseInt(b); a("div.recAccuracy .recBotCap .value").text(b + "%") }, get: function(b) { return this.currentValue }, add: function(b) { var b = parseInt(b); this.updateState(this.answeredTotal + 1, this.currentValue + b); this.set(this.currentValue + b) }, checkOnce: function(c) { c = parseInt(c); if (typeof this.answered[c] === "undefined") { this.answered[parseInt(c)] = true; if (this.answeredTotal < 3) { this.add(Math.round(25 + (Math.random() * 10 - 5))) } else { if (this.answeredTotal < App.Questions.questionsAmount) { var d = 100 - this.currentValue; var b = App.Questions.questionsAmount - this.answeredTotal; this.add(Math.round(d / b)) } } this.answeredTotal++ } }, updateState: function(c, b) { if (this.currentValue < 60 && b >= 60) { var d = a("div.recAccuracy .recOptions"); a(".state01", d).hide(); a(".state02", d).show() } }, setContent: function(b) { a("div.recAccuracy .recOptions").nhtml(b) }, hide: function() { a("div.recAccuracy").hide() }, show: function() { a("div.recAccuracy").show() } } })(jQuery); $(document).ready(function() { App.Questions.Accuracy.init() }); App.Questions.Templater = (function(a) { return { getSliderQuestionHtml: function(f) { var b = f.tblToolStepOption; var e = b[0].StepOptionNotes; var d = b[b.length - 1].StepOptionNotes; var c = '<div id="question-data-' + f.ToolStepID + '" class="question slider-question"> <div class="question-content"> <h2>' + f.StepTitle + '</h2> <div class="slider-value">&nbsp; </div> <input type="range" min="0" max="' + ((b.length) * 100 - 1) + '" step="1" value="0" class="range-input" /> <div class="sliderDescriptors wrap"> <span class="left">' + e + '</span> <span class="right">' + d + "</span> </div> </div> </div>"; return c }, getAgeSliderQuestionHtml: function(f) { var b = f.tblToolStepOption; var e = b[0].StepOptionName; var d = b[b.length - 1].StepOptionName; var c = '<div id="question-data-' + f.ToolStepID + '" class="question ageslider-question"> <div class="question-content"> <h2>' + f.StepTitle + '</h2> <div class="slider-value"><span>&nbsp;</span> </div> <input type="range" min="18" max="82" step="1" value="30" class="range-input" /> <div class="sliderDescriptors wrap"> <span class="left">' + e + '</span> <span class="right">' + d + "</span> </div> </div> </div>"; return c }, getRadioQuestionHtml: function(d) { var k = d.tblToolStepOption; var b = k.length; var h = Math.ceil(b * 0.5) - 1; var j = '<div class="two-column-1">'; var c = ""; for (var e = 0; e < b; e++) { var g = k[e]; j += '<label for="radio-' + g.ToolStepOptionID + '"><span class="outer"><span class="inner">' + g.StepOptionName + '</span></span><span class="bottom"></span></label> <input name="toolstep-' + d.ToolStepID + '" id="radio-' + g.ToolStepOptionID + '" type="radio" value="' + g.ToolStepOptionID + '" />'; if (e == h) { j += '</div><div class="two-column-2">' } if (g.StepOptionNotes != "") { c += '<div class="tip" id="option-tip-' + g.ToolStepOptionID + '"> <span>' + g.StepOptionName + ":</span> " + g.StepOptionNotes + " </div>" } } j += "</div>"; var f = '<div id="question-data-' + d.ToolStepID + '" class="question radio-question"> <div class="question-content"> <h2>' + d.StepTitle + '</h2> <div class="panel-options">' + j + '</div> <div class="tips">' + c + "</div> </div> </div>"; return f }, getCheckboxQuestionHtml: function(d) { var k = d.tblToolStepOption; var b = k.length; var h = Math.ceil(b * 0.5) - 1; var c = ""; var j = '<div class="two-column-1">'; for (var e = 0; e < b; e++) { var g = k[e]; j += '<label for="checkbox-' + g.ToolStepOptionID + '"><span class="outer"><span class="inner">' + g.StepOptionName + '</span></span><span class="bottom"></span></label> <input name="toolstep-' + d.ToolStepID + '" id="checkbox-' + g.ToolStepOptionID + '" type="checkbox" value="' + g.ToolStepOptionID + '" />'; if (e == h) { j += '</div><div class="two-column-2">' } if (g.StepOptionNotes != "") { c += '<div class="tip" id="option-tip-' + g.ToolStepOptionID + '"> <span>' + g.StepOptionName + ":</span> " + g.StepOptionNotes + " </div>" } } j += "</div>"; var f = '<div id="question-data-' + d.ToolStepID + '" class="question checkbox-question"> <div class="question-content"> <h2>' + d.StepTitle + '</h2> <div class="panel-options">' + j + '</div> <div class="tips">' + c + "</div> </div> </div>"; return f }, getIconQuestionHtml: function(d) { var k = d.tblToolStepOption; var b = k.length; var h = Math.ceil(b * 0.5) - 1; var j = ""; var c = ""; for (var e = 0; e < b; e++) { var g = k[e]; j += '<div class="icon-option"><label for="radio-' + g.ToolStepOptionID + '"><span class="icon-graphic"><div class="d-arrow"><!--arrow--></div><img src="images/184-bgOption' + g.ToolStepOptionID + "." + g.FileType + '" alt="' + g.StepOptionName + '" /><img src="images/interface/iconHover.gif" class="iconHover" /></span>' + g.StepOptionName + '</label><input name="toolstep-' + d.ToolStepID + '" id="radio-' + g.ToolStepOptionID + '" type="radio" value="' + g.ToolStepOptionID + '" /></div>'; c += ' <div class="tip" id="option-tip-' + g.ToolStepOptionID + '"> <span>' + g.StepOptionName + "</span>: " + g.StepOptionNotes + " </div>" } var f = '<div id="question-data-' + d.ToolStepID + '" class="question icon-question"> <div class="question-content"> <h2>' + d.StepTitle + '</h2> <div class="panel-options"> <div class="one-column"> <div class="icon-options-wrapper">' + j + '</div> </div> </div> <div class="tips">' + c + "</div> </div> </div>"; return f }, getHtml: function(b) { switch (b.QuestionType) { case "ageslider": return this.getAgeSliderQuestionHtml(b); case "slider": return this.getSliderQuestionHtml(b); case "checkbox": return this.getCheckboxQuestionHtml(b); case "icon": return this.getIconQuestionHtml(b); case "radio": default: return this.getRadioQuestionHtml(b) } } } })(jQuery); if (typeof App.Questions.Transition === "undefined") { App.Questions.Transition = {} } function flashLoaded() { App.Questions.Transition.ready = true; App.Questions.Transition.flash = $("#olay").get(0); $("body").trigger("flashloaded") } function growComplete() { $("body").trigger("growcomplete") } function shrinkComplete() { $("body").trigger("shrinkcomplete") } App.Questions.Transition.Flash = function(a) { return { flash: null, ready: null, unReady: function() { this.ready = false }, init: function(e, d) { var b = {}; var f = { menu: "false", scale: "noScale", allowFullscreen: "false", allowScriptAccess: "always", bgcolor: "none", wmode: "transparent" }; var c = { id: "olay" }; swfobject.embedSWF(e, d, "100%", "100%", "9", "swf/expressInstall.swf", b, f, c); a("body").bind("growcomplete", this.growComplete); a("body").bind("shrinkcomplete", this.shrinkComplete) }, growComplete: function() { }, shrinkComplete: function() { }, startGrowQuestionTransition: function() { var m; var o = App.Questions.currentToolStep; var f = o.StepTitle; var d = "0"; var n = []; var k = ""; var e = 2; var r = App.Questions.getHistoryState(o); switch (o.QuestionType) { case "ageslider": case "icon": m = function() { }; break; case "slider": d = "1"; var q = o.tblToolStepOption; var h = q.length; if (typeof r !== "undefined") { for (var j = 0; j < q.length; j++) { if (q[j].ToolStepOptionID == r) { k = q[j].StepOptionName } } } if (k == "") { var l = Math.ceil(h * 0.5) - 1; k = q[l].StepOptionName } var b = q[0].StepOptionNotes; var c = q[q.length - 1].StepOptionNotes; n = [b, c]; var g; if (typeof o.step === "undefined") { g = 0.5 } else { g = o.step * 0.01 / q.length } m = function() { App.Questions.Transition.flash.updateQuestion(k, g, []) }; break; case "checkbox": case "radio": default: d = "0"; var q = o.tblToolStepOption; var h = q.length; for (var j = 0; j < h; j++) { n.push(q[j].StepOptionName) } if ((typeof r !== "undefined") && this.ready) { m = function() { App.Questions.Transition.flash.updateQuestion("", "", App.Questions.Transition.getSelectedValues(o)) } } else { m = function() { } } break } if (this.ready) { this.flash.setFlashQuestionContent(f, App.Questions.currentIndex == 1 ? "" : App.Questions.backButtonText, App.Questions.nextButtonText, d, e, k, n); m() } else { var p = this; a("body").bind("flashloaded.startGrowQuestionTransition", function() { a("body").unbind("flashloaded.startGrowQuestionTransition"); p.flash.setFlashQuestionContent(f, App.Questions.currentIndex == 1 ? "" : App.Questions.backButtonText, App.Questions.nextButtonText, d, e, k, n); m() }) } }, startShrinkQuestionTransition: function(g) { var e = App.Questions.getHistoryState(g); switch (g.QuestionType) { case "slider": var b = g.tblToolStepOption; if (typeof e !== "undefined") { var d = ""; for (var c = 0; c < b.length; c++) { if (b[c].ToolStepOptionID == e) { d = b[c].StepOptionName } } if (this.ready) { this.flash.updateQuestion(d, g.step * 0.01 / b.length, []) } } break; case "radio": case "checkbox": case "": default: if (typeof e !== "undefined") { if (this.ready) { this.flash.updateQuestion("", "", this.getSelectedValues(g)) } } } if (this.ready) { this.flash.shrink(); App.Questions.hideQuestionPanel() } else { var f = this; a("body").bind("flashloaded.startShrinkQuestionTransition", function() { a("body").unbind("flashloaded.startShrinkQuestionTransition"); f.flash.shrink(); App.Questions.hideQuestionPanel() }) } }, getSelectedValues: function(f) { var d = []; var e = App.Questions.getHistoryState(f); switch (f.QuestionType) { case "checkbox": var b = f.tblToolStepOption; for (var c = 0; c < b.length; c++) { if (jQuery.inArray(b[c].ToolStepOptionID, e) == -1) { d.push(false) } else { d.push(true) } } break; case "radio": case "": default: var b = f.tblToolStepOption; for (var c = 0; c < b.length; c++) { if (b[c].ToolStepOptionID == e) { d.push(true) } else { d.push(false) } } } return d }, showAgeSliderValue: function(b) { App.Questions.Transition.Ageslider.showAgeSliderValue.call(this, b) } } }; if (typeof App.Questions.Transition === "undefined") { App.Questions.Transition = {} } App.Questions.Transition.JsTransition = function(a) { return { flash: null, ready: true, unReady: function() { }, init: function(c, b) { }, growComplete: function() { a("body").trigger("growcomplete") }, shrinkComplete: function() { a("body").trigger("shrinkcomplete") }, startGrowQuestionTransition: function() { var b = 500; a("#reflection_left").animate({ height: 370, left: -104, top: 50, opacity: 0.4 }, b); a("#reflection_right").animate({ height: 370, right: -104, top: 50, opacity: 0.4 }, b); a("#placard").animate({ opacity: 1 }, b); a("#highlight_container").animate({ height: 310, left: 23, top: 2, width: 598 }, b); a("#highlight").animate({ height: 311, right: 590 }, b); a("#window_back").animate({ width: 646, left: 0, top: 0 }, b, this.growComplete) }, startShrinkQuestionTransition: function(c) { App.Questions.hideQuestionPanel(); var b = 500; a("#reflection_left").animate({ height: 226, left: 220, top: 102, opacity: 0 }, b); a("#reflection_right").animate({ height: 226, right: 220, top: 102, opacity: 0 }, b); a("#placard").animate({ opacity: 0 }, b); a("#highlight_container").animate({ height: 208, left: 119, top: 26, width: 408 }, b); a("#highlight").animate({ height: 208, right: -225 }, b); a("#window_back").animate({ left: 106, top: 25, width: 435 }, b, this.shrinkComplete) }, showAgeSliderValue: function(b) { App.Questions.Transition.Ageslider.showAgeSliderValue.call(this, b) } } }; App.Questions.Transition = (function(a) { if (swfobject.hasFlashPlayerVersion(App.MIN_FLASH_VERSION)) { return new App.Questions.Transition.Flash(a) } else { return new App.Questions.Transition.JsTransition(a) } })(jQuery); $(document).ready(function() { App.Questions.Transition.init() }); App.Questions.Transition.Ageslider = (function(a) { return { isNumber: /^\d+$/, showAgeSliderValueTimer: 0, showAgeSliderValue: function(d) { var h = this; var f = a(this); if (typeof d === "undefined") { d = false } if (d || !f.hasClass("changing")) { var g = f.data("currentSliderValue"); var c = f.data("shownSliderValue"); var e = c; if (g != c) { var i = false; if (g < c) { c -= 2; i = true; if (g > c) { c = g } } else { if (g > c) { c += 2; i = true; if (g < c) { g = c } } } var b = App.Questions.age2string(c); f.data("shownSliderValue", c).html(b); if (!App.Questions.Transition.Ageslider.isNumber.test(b)) { f.removeClass("changing changing-2") } else { if (!i && g == c) { f.removeClass("changing changing-2") } else { if (Math.floor(e / 10) != Math.floor(c / 10)) { f.removeClass("changing").addClass("changing-2") } else { f.removeClass("changing-2").addClass("changing") } App.Questions.Transition.Ageslider.showAgeSliderValueTimer = setTimeout(function() { App.Questions.Transition.Ageslider.showAgeSliderValue.call(h, true) }, 50) } } } else { f.removeClass("changing changing-2") } } } } })(jQuery); $(document).ready(function() { $(".soMusic a").toggle(function() { $(this).parent().addClass("soundOff"); $(this).html("Turn on") }, function() { $(this).parent().removeClass("soundOff"); $(this).html("Turn off") }); $(".siteOptions li").not(".siteOptions li li").hover(function() { $(this).find("ul:first").stop(true, true).slideDown({ duration: 500, easing: "easeOutBack" }) }, function() { $(this).find("ul:first").stop(true, true).slideUp({ duration: 500, easing: "easeOutBack" }) }) }); App.OnClose = (function(a) { return { init: function() { this.bind(); a("#intercept-start .iGetRec").click(function(b) { App.Constants.reportToolStepAnswer(App.Questions.interceptToolStep.ToolStepID, App.Questions.lastAnswerId, function() { App.Constants.redirectToResultsPage() }); b.preventDefault() }); a("#intercept-start .iThanks").click(function(b) { b.preventDefault(); App.OnClose.closeWindow() }) }, initInterceptQuestion: function() { var b = App.Questions.interceptToolStep; App.Questions.initQuestionContent(a("#intercept-start div.question-container"), b) }, interceptStart: function() { App.OnClose.unbind(); a.fn.colorbox({ width: "650px", height: "600px", inline: true, href: "#intercept-start", overlayClose: false, transition: "none" }); this.initInterceptQuestion() }, closeWindow: function() { App.OnClose.unbind(); a.colorbox.close(); window.close() }, bind: function() { window.onbeforeunload = function() { if (App.PageSwitcher.isPageActive("questions") && App.Questions.Accuracy.answeredTotal < 3) { App.OnClose.interceptStart(); return "" } } }, unbind: function() { window.onbeforeunload = null } } })($); $(document).ready(function() { App.OnClose.init() });
