﻿/* 
* JS Document 
* @author Ryan Suleski ryan.suleski@rosetta.com, Michael Lyons michael.lyons@rosetta.com
* 
*/
var Gout = Gout || {}; Gout.UI = Gout.UI || {};
Gout.UI = { JSONLoaded: !1, onComplete: function () {
    if (!window.location.hash || window.location.hash.slice(2, window.location.hash.length) === window.location.pathname.toLowerCase().slice(1, window.location.pathname.length) || window.location.hash == "#") $(".page-container, #header").removeClass("init"), Gout.UI.Animation.active = !0, Gout.Analytics.pageLoad(window.location.pathname.toLowerCase().slice(1, window.location.pathname.length)); else if (Gout.UI.getRev(window.location.hash.slice(2, window.location.hash.length)) ==
-1) window.location.href = "/"; Gout.UI.anchorSetup()
}, anchorSetup: function () {
    $("a").live("click", function () {
        Gout.Analytics.fireGA(this); var a = $(this), b = a.attr("href"), c = b, e = b ? Gout.UI.getRev(b.slice(1, b.length)) : -1; if (a.hasClass("interstitial")) (b = $.cookie("OPTINMARKETINGSOURCE")) && (c = c.indexOf("?") > -1 ? c + "&ms=" + b : c + "?ms=" + b), a.hasClass("leaveUloric") ? $("#overlay-text").html('Please click "OK" if you wish to be taken to a site to learn <br />more about a treatment option to lower uric acid.') : (Gout.Analytics.pageLoad("goutsmart"),
$("#overlay-text").html('Please click "OK" if you wish to be taken to a site to get<br />more information.')), $("#cancel-button").bind("click", function () { $("#overlay, #overlay-box").fadeOut("fast") }), $("#proceed-button").bind("click", function () { $("#overlay, #overlay-box").hide(0); window.location.href = c }), $("#overlay").css({ height: $(document).height() }).fadeIn("800"), $("#overlay-box").delay(400).fadeIn("slow"); else if (a.hasClass("overlay-button")) $("#cancel-button", "#proceed-button").unbind(); else if (a.attr("id") ==
"realdownloadlink") window.open("/doctor-discussion/card.pdf"), Gout.UI.Animation.handler(e, !0), Gout.Analytics.pageLoad(b.slice(1, b.length)); else if (a.hasClass("video-btn") && a.hasClass("play")) _gaq.push(["_trackEvent", "Video", "Play", "Learn More"]), jwplayer("video-player").setup({ width: "878", height: "493", file: "/Content/videos/BetweenFlaresDrG.mp4", skin: "/Content/jwplayer/goutskin/gout.zip", events: { onComplete: function () { $("#replay-screen").show() } }, modes: [{ type: "html5" }, { type: "flash", src: "/Content/jwplayer/player.swf"}] }),
$(".home-top.one").hide(), $(".home-video").fadeIn(1E3), $(".home-top-container").animate({ height: "493px" }, 1E3, function () { jwplayer(document.getElementById("video-player")).play() }); else if (a.hasClass("replay-btn")) $("#replay-screen").hide(0), jwplayer(document.getElementById("video-player")).play(); else if (e >= 0 && e <= 14 && Gout.UI.Animation.currentPage >= 0 && Gout.UI.Animation.currentPage <= 14) Gout.Analytics.pageLoad(b.slice(1, b.length)), Gout.UI.Animation.handler(e, !0); else if (a.attr("id") != "hideShowAll") a.attr("target") ==
"_blank" ? window.open(b) : window.location.href = b; return !1
    })
}, getRev: function (a) {
    switch (a) {
        case "": return 0; case "what-is-gout": return 1; case "what-is-gout/signs-symptoms": return 2; case "what-is-gout/effects": return 3; case "causes-triggers": return 4; case "causes-triggers/high-uric-acid": return 5; case "causes-triggers/gout-diet": return 6; case "treating-gout-flares": return 7; case "treating-gout-flares/pain-management": return 8; case "treating-gout-pain/long-term": return 9; case "treating-gout-pain/healthy-lifestyle": return 10;
        case "doctor-discussion": case "doctor-discussion/guide": return 12; case "doctor-discussion/preview": return 13; case "doctor-discussion/confirmation": return 14; case "terms-conditions": return 15; case "privacy-policy": return 16; case "page-not-found": return 17; case "page-error": return 18; case "site-map": return 19; default: return -1
    } 
} 
}; Gout.UI.Accordion = Gout.UI.Accordion || {};
Gout.UI.Accordion = { hideShowAll: null, Init: function () { Gout.UI.Accordion.hideShowAll = $("#hideShowAll"); var a = $(".expandable h3"); Gout.UI.Accordion.hideShowAll.bind("click", function () { var b = Gout.UI.Accordion.hideShowAll.hasClass("show"); a.each(function () { Gout.UI.Accordion.HideShowElement($(this), b) }) }); a.bind("click", function () { $(this).parent().hasClass("open") ? Gout.UI.Accordion.HideShowElement($(this), !1) : Gout.UI.Accordion.HideShowElement($(this), !0) }) }, HideShowElement: function (a, b) {
    var c = a.parent(),
e = a.next(), e = a.height() + e.height() + parseInt(e.css("padding-top")) + e.next().height(), g = parseInt(e / 1.5); b ? (a.parent().css({ "background-position": "0 -52px" }).animate({ height: e }, g, function () { c.addClass("open") }), Gout.UI.Accordion.hideShowAll.html("Hide All").removeClass("show")) : a.parent().animate({ height: 52 }, g, function () { c.removeClass("open").css({ "background-position": "0 0" }); $(".expandable.open").length == 0 && Gout.UI.Accordion.hideShowAll.html("Show All").addClass("show") })
} 
};
Gout.Analytics = Gout.Analytics || {};
Gout.Analytics = { pageLoad: function (a) { Gout.Analytics.runMediaMind(Gout.Analytics.getMediaMindID(a)); try { _gaq.push(["_trackPageview", Gout.JSON.d[Gout.UI.Animation.currentPage].GooglePageName]) } catch (b) { } }, runMediaMind: function (a) {
    if (a) {
        var b = Math.random() + ""; b *= 1E6; var c = document.createElement("script"); c.src = "HTTP://bs.serving-sys.com/BurstingPipe/ActivityServer.bs?cn=as&ActivityID=" + a + "&rnd=" + b; c.id = "mediaMind"; a = document.getElementsByTagName("body")[0]; b = document.getElementById("mediaMind"); a.removeChild(b);
        a.appendChild(c)
    } 
}, getMediaMindID: function (a) { switch (a) { case "": return 134058; case "treating-gout-flares": return 134059; case "what-is-gout": return 134060; case "causes-triggers": return 134061; case "doctor-discussion/guide": return 134064; case "doctor-discussion/confirmation": return 134066; case "goutsmart": return 134062; default: return 0 } }, fireGA: function (a) {
    var a = a.id, b = Gout.JSON.d[Gout.UI.Animation.currentPage].GooglePageName; switch (a) {
        case "gout-conversation": _gaq.push(["_trackEvent", "Homepage Callouts",
"Download Card", "click"]); break; case "learn-uric-acid": _gaq.push(["_trackEvent", "Homepage Callouts", "Uric Acid", "click"]); break; case "learn-about-managing": _gaq.push(["_trackEvent", "SubTier page Callouts", b, "Managing Gout Long Term"]); break; case "gout-get-the-facts": _gaq.push(["_trackEvent", "SubTier page Callouts", b, "Gout: Get The Facts"]); break; case "talk-with-doctor-get": _gaq.push(["_trackEvent", "SubTier page Callouts", b, "Talking With Your Doctor"]); break; case "looking-at-gout-long-term": _gaq.push(["_trackEvent",
"SubTier page Callouts", b, "Looking At Gout Long Term"]); break; case "a-more-informed-conversation": _gaq.push(["_trackEvent", "SubTier page Callouts", b, "A More Informed Conversation"]); break; case "uloric-outboundlink": _gat._getTrackerByName()._trackEvent("Outbound Links", "Uloric.com"); break; default: a.indexOf("sign-up-") >= 0 && _gaq.push(["_trackEvent", "Global Callouts", a.replace("sign-up-", ""), "Sign Up"])
    } 
} 
}; Gout.JSON = Gout.JSON || {};
Gout.JSON = { d: { Identifier: null, ActionName: null, CalloutContent: null, MainContent: null, NavigationContent: null, SectionNumber: null, LeftNavigationIndex: null, PageBackGround: null, GooglePageName: null} }; Gout.UI.Animation = Gout.UI.Animation || {};
Gout.UI.Animation = { mainPage: 0, guidePage: 12, accordionPage: 3, sections: { one: 0, two: 1, three: 2, four: 3, five: 4, six: 5 }, currentSection: "one", currentPage: 0, active: !1, mainNav: null, leftNav: null, Container: null, lastContent: null, aTags: null, uiLocked: !1, currentPageContainer: null, curtain: null, emptySubPageHTML: '<div class="wrapper"><div class="leftContent"></div></div>', OnComplete: function () {
    $.ajax({ url: "/services/ContentPageService.svc/GetAllContentPageJson", dataType: "json", success: function (a) {
        Gout.JSON = a; Gout.UI.JSONLoaded =
!0; Gout.UI.Animation.currentPageContainer = $(".page-container"); Gout.UI.Animation.mainNav = $("#nav li"); Gout.UI.Animation.Container = $("#container"); Gout.UI.Animation.lastContent = $(".rightContent"); Gout.UI.Animation.leftNav = $(".leftContent ul li"); Gout.UI.Animation.curtain = $("#curtain")
    }, complete: function () {
        var a = Gout.UI.getRev(window.location.pathname.toLowerCase().slice(1, window.location.pathname.length)); Gout.UI.Animation.currentPage = a; Gout.UI.Animation.currentSection = Gout.JSON.d[a].SectionNumber;
        $.history.init(function (a) { if (a == "") Gout.UI.Animation.handler(Gout.UI.getRev(window.location.pathname.toLowerCase().slice(1, window.location.pathname.length)), !1); else { var a = a.slice(1, a.length), c = Gout.UI.getRev(a); c >= 0 && c <= 14 && (Gout.UI.Animation.active || Gout.Analytics.pageLoad(a), Gout.UI.Animation.handler(c, !0)) } }, { unescape: ",/" })
    } 
    })
}, handler: function (a, b) {
    if (!Gout.UI.Animation.uiLocked && Gout.UI.Animation.currentPage != a) $(".leftContent").attr("class", "leftContent"), Gout.UI.Animation.lockUI(), Gout.UI.Animation.active ?
Gout.UI.Animation.currentPage == Gout.UI.Animation.mainPage || a >= Gout.UI.Animation.guidePage ? Gout.UI.Animation.AnimateAllHorizontal(!0, a) : Gout.UI.Animation.currentPage >= Gout.UI.Animation.guidePage || a == Gout.UI.Animation.mainPage ? Gout.UI.Animation.AnimateAllHorizontal(!1, a) : Gout.UI.Animation.currentSection == Gout.JSON.d[a].SectionNumber ? Gout.UI.Animation.AnimateVertical(a) : Gout.UI.Animation.AnimateHorizontal(a) : Gout.UI.Animation.AnimateInitial(a), Gout.UI.Animation.active = !0, $(document).attr("title", Gout.JSON.d[a].PageTitle),
b && $.history.load("/" + Gout.JSON.d[a].Identifier); return !1
}, lockUI: function () { Gout.UI.Animation.uiLocked = !0; $("body").addClass("wait"); return !1 }, unlockUI: function () { Gout.UI.Animation.uiLocked = !1; $("body").removeClass("wait"); return !1 }, AnimateVertical: function (a) {
    var b = 500; Gout.UI.Animation.leftNav.removeClass("selected"); Gout.UI.Animation.leftNav.eq(Gout.UI.Animation.sections[Gout.JSON.d[a].LeftNavigationIndex]).addClass("selected"); b = !0; Gout.UI.Animation.currentPage - a > 0 && (b = !1); Gout.UI.Animation.AnimateBG(a);
    var c = $(".callout .content"), e = $(".content", Gout.JSON.d[a].CalloutContent), g = c.height(); c.css({ height: g }).children().fadeOut("slow", function () { c.html(e.html()); c.children().hide().fadeIn("slow", function () { jQuery.browser.msie && $(this).get(0).style.removeAttribute("filter") }); c.css({ height: "auto" }); var a = c.height(); c.css({ height: g }).animate({ height: a }, "slow") }); var d = $(".rightContent", Gout.JSON.d[a].MainContent); if (b) {
        var f = parseInt(Gout.UI.Animation.lastContent.height()), b = f / 1.2, f = -f; Gout.UI.Animation.lastContent.parent().append(d);
        Gout.UI.Animation.lastContent.animate({ "margin-top": f }, b, function () { $(this).fadeOut("fast", function () { $(this).remove() }); Gout.UI.Animation.lastContent = d; Gout.UI.Animation.currentPage = a; Gout.UI.Animation.unlockUI() })
    } else Gout.UI.Animation.lastContent.parent().prepend(d), f = parseInt(d.height()), b = f / 1.2, d.css({ "margin-top": -f }), d.animate({ "margin-top": 0 }, b, function () {
        Gout.UI.Animation.lastContent.fadeOut("fast", function () { $(this).remove() }); Gout.UI.Animation.lastContent = d; Gout.UI.Animation.currentPage =
a; Gout.UI.Animation.unlockUI()
    }); $("html, body").animate({ scrollTop: 0 }, b); a == Gout.UI.Animation.accordionPage && Gout.UI.Accordion.Init()
}, AnimateHorizontal: function (a) {
    Gout.UI.Animation.currentSection = Gout.JSON.d[a].SectionNumber; var b = Gout.UI.Animation.lastContent.width(), c = b / 1.2, e = "left"; Gout.UI.Animation.currentPage - a < 0 && (e = "right"); Gout.UI.Animation.mainNav.removeClass("carrot"); Gout.UI.Animation.mainNav.eq(Gout.UI.Animation.sections[Gout.JSON.d[a].SectionNumber]).addClass("carrot"); $("#header").removeClass("init");
    Gout.UI.Animation.AnimateBG(a); var g = $(".leftContent ul"), d = $("ul", Gout.JSON.d[a].NavigationContent), b = g.width(); e === "right" && (b = -b); d.addClass(e); d.insertAfter(g); d.removeClass("selected"); d.find("." + Gout.JSON.d[a].LeftNavigationIndex).addClass("selected"); g.animate({ left: b }, c, function () { $(this).fadeOut(500, function () { d.removeClass(e); $(this).remove(); Gout.UI.Animation.leftNav = d.find("li") }) }); d.animate({ left: 0 }, c); var f = $(".callout .content"), j = $(".content", Gout.JSON.d[a].CalloutContent), i = f.height();
    f.css({ height: i }).children().fadeOut("slow", function () { f.html(j.html()); f.children().hide().fadeIn("slow", function () { jQuery.browser.msie && $(this).get(0).style.removeAttribute("filter") }); f.css({ height: "auto" }); var a = f.height(); f.css({ height: i }).animate({ height: a }, "slow") }); var h = $(".rightContent", Gout.JSON.d[a].MainContent); h.addClass(e); Gout.UI.Animation.lastContent.parent().append(h); b = Gout.UI.Animation.lastContent.width() + 90; e === "right" && (b = -b); Gout.UI.Animation.lastContent.animate({ left: b }, c,
function () { $(this).fadeOut(400, function () { $(this).remove() }); Gout.UI.Animation.lastContent = h; Gout.UI.Animation.currentPage = a }); h.animate({ left: 0 }, c + 1, function () { window.setTimeout(function () { h.removeClass(e); Gout.UI.Animation.unlockUI() }, 500) }); $("html, body").animate({ scrollTop: 0 }, c); a == Gout.UI.Animation.accordionPage && Gout.UI.Accordion.Init()
}, AnimateAllHorizontal: function (a, b) {
    Gout.UI.Animation.currentSection = Gout.JSON.d[b].SectionNumber; var c = Gout.UI.Animation.currentPageContainer.width(), e = c /
1.2; Gout.UI.Animation.mainNav.removeClass("carrot"); Gout.UI.Animation.mainNav.eq(Gout.UI.Animation.sections[Gout.JSON.d[b].SectionNumber]).addClass("carrot"); $("#header").removeClass("init"); Gout.UI.Animation.AnimateBG(b); var g = "left"; a && (g = "right", c = -c); var d = Gout.UI.Animation.currentPageContainer.clone(); d.removeClass("init"); d.addClass(g); b == Gout.UI.Animation.mainPage || b >= Gout.UI.Animation.guidePage ? d.html(Gout.JSON.d[b].MainContent) : (d.html(Gout.UI.Animation.emptySubPageHTML), d.find(".leftContent").append(Gout.JSON.d[b].NavigationContent).append(Gout.JSON.d[b].CalloutContent).parent().append(Gout.JSON.d[b].MainContent),
d.find(".leftContent ." + Gout.JSON.d[b].LeftNavigationIndex).addClass("selected")); a ? d.insertAfter("#header") : d.insertAfter(Gout.UI.Animation.currentPageContainer); d.animate({ left: 0 }, e); Gout.UI.Animation.currentPageContainer.animate({ left: c }, e, function () {
    d.removeClass(g); d.css("left", ""); Gout.UI.Animation.currentPageContainer.remove(); Gout.UI.Animation.currentPageContainer = d; Gout.UI.Animation.currentPage = b; Gout.UI.Animation.lastContent = $(".rightContent"); Gout.UI.Animation.leftNav = $(".leftContent ul li");
    Gout.UI.Animation.unlockUI()
}); $("html, body").animate({ scrollTop: 0 }, e); b == Gout.UI.Animation.accordionPage && Gout.UI.Accordion.Init()
}, AnimateInitial: function (a) {
    Gout.UI.Animation.currentSection = Gout.JSON.d[a].SectionNumber; Gout.UI.Animation.mainNav.removeClass("carrot"); Gout.UI.Animation.mainNav.eq(Gout.UI.Animation.sections[Gout.JSON.d[a].SectionNumber]).addClass("carrot"); Gout.JSON.d[a].PageBackGround === "KeyPage" ? (Gout.UI.Animation.Container.addClass("KeyPage"), Gout.UI.Animation.Container.removeClass("SubPage DiscussionPage")) :
Gout.JSON.d[a].PageBackGround === "SubPage" ? (Gout.UI.Animation.Container.addClass("SubPage"), Gout.UI.Animation.Container.removeClass("KeyPage DiscussionPage")) : Gout.JSON.d[a].PageBackGround === "DiscussionPage" && (Gout.UI.Animation.Container.addClass("DiscussionPage"), Gout.UI.Animation.Container.removeClass("KeyPage SubPage")); var b = Gout.UI.Animation.currentPageContainer.clone(); a == Gout.UI.Animation.mainPage || a >= Gout.UI.Animation.guidePage ? b.html(Gout.JSON.d[a].MainContent) : (b.html(Gout.UI.Animation.emptySubPageHTML),
b.find(".leftContent").append(Gout.JSON.d[a].NavigationContent).append(Gout.JSON.d[a].CalloutContent).parent().append(Gout.JSON.d[a].MainContent), b.find(".leftContent ." + Gout.JSON.d[a].LeftNavigationIndex).addClass("selected")); Gout.UI.Animation.currentPageContainer.replaceWith(b); $(".page-container, #header").removeClass("init"); Gout.UI.Animation.active = !0; Gout.UI.Animation.currentPageContainer = b; Gout.UI.Animation.currentPage = a; Gout.UI.Animation.lastContent = $(".rightContent"); Gout.UI.Animation.leftNav =
$(".leftContent ul li"); Gout.UI.Animation.unlockUI(); a == Gout.UI.Animation.accordionPage && Gout.UI.Accordion.Init()
}, AnimateBG: function (a) { var b = Gout.JSON.d[Gout.UI.Animation.currentPage].PageBackGround, a = Gout.JSON.d[a].PageBackGround; b != a && (Gout.UI.Animation.curtain.addClass(b).show(), Gout.UI.Animation.Container.removeClass("KeyPage SubPage DiscussionPage"), Gout.UI.Animation.Container.addClass(a), Gout.UI.Animation.curtain.fadeOut(1E3, function () { Gout.UI.Animation.curtain.removeClass("KeyPage SubPage DiscussionPage") })) } 
};
$(document).ready(function () { Gout.UI.onComplete(); Gout.UI.Animation.OnComplete() });
