﻿function initializeHome() { mobile.init(); alerts.init(); eventTracking.init(); konami.init() } var homepage = { slides: Object, current: Number, controls: Object, next: Object, previous: Object, moreShown: Boolean, init: function () { this.slides = $("div.slide"); this.current = Math.floor(Math.random() * this.slides.length); this.controls = $("a.controls"); this.next = $("a#next"); this.previous = $("a#previous"); this.moreShown = false; this.didItRun = true; this.run() }, run: function () { homepage.controls.fadeTo("fast", .25); if ($.cookies.get("tasty_cookie") == null) { homepage.current = 1; $.cookies.set("tasty_cookie", true, { hoursToLive: 48 }) } homepage.slides.eq(homepage.current).addClass("on"); getThe.newColors(); homepage.controls.hover(function () { $(this).stop().fadeTo("fast", .6) }, function () { $(this).stop().fadeTo(1e3, .25) }); homepage.previous.click(function (a) { $("#arrow").remove(); alerts.showAlerts = false; if (homepage.current != 0) { $("div.slide.on").removeClass("on").prev().addClass("on"); homepage.current-- } else { $("div.slide.on").removeClass("on"); homepage.current = homepage.slides.length - 1; homepage.slides.eq(homepage.current).addClass("on") } _gaq.push(["_trackEvent", "Home Slides", "Click Prev", $("div.slide.on").attr("id")]); getThe.newColors(); a.preventDefault() }); homepage.next.click(function (a) { $("#arrow").remove(); alerts.showAlerts = false; if (homepage.current != homepage.slides.length - 1) { $("div.slide.on").removeClass("on").next().addClass("on"); homepage.current++ } else { $("div.slide.on").removeClass("on"); homepage.current = 0; homepage.slides.eq(homepage.current).addClass("on") } if (homepage.moreShown == false) { _gaq.push(["_trackEvent", "Home Slides", "Click Next", $("div.slide.on").attr("id")]) } else { _gaq.push(["_trackEvent", "Home Slides", "Click Next After More Shown", $("div.slide.on").attr("id")]) } getThe.newColors(); a.preventDefault() }) } }; var getThe = { changers: Object, newColors: function () { this.changers = $("div.slide.on").find("input[type=hidden]"); this.changers.each(function () { if ($(this).hasClass("all")) { color.all($(this).attr("value")) } else if ($(this).hasClass("chameleon")) { color.chameleon($(this).attr("value")) } else if ($(this).hasClass("links")) { color.links($(this).attr("value")) } else if ($(this).hasClass("background")) { color.background($(this).attr("value")) } }) } }; var alerts = { showAlerts: Boolean, init: function () { this.showAlerts = true; $("#arrow").css("display", "block").fadeTo(1, 0); setTimeout("alerts.arrow()", 15e3); this.run() }, run: function () { if ($.browser.msie && $.browser.version.substr(0, 1) < 7) { window.location = "/About/" } }, arrow: function () { if (mobile.winW < 520) { mobile.arrow.hide(); return false } else if (homepage.didItRun === true) { return false } else { if (this.showAlerts == true) { $("#arrow").animate({ right: "54px", marginTop: "-73px", opacity: .6 }, 1e3, "easeOutBounce"); _gaq.push(["_trackEvent", "Home Slides", "More Shown", "More Label Shown"]); homepage.moreShown = true } } } }; var eventTracking = { init: function () { this.run() }, run: function () { $(".col1 a").click(function () { if ($(this).hasClass("homeButton")) { _gaq.push(["_trackEvent", "Home Services", "Button Click", $(this).attr("id")]) } else { _gaq.push(["_trackEvent", "Home Services", "Link Clicked", $(this).attr("id")]) } }); $(".tunneler").click(function () { _gaq.push(["_trackEvent", "Home Slides", "Slide call to action clicked", $("slide.on").attr("id")]) }) } }; var konami = { code: String, keys: Array, init: function () { this.code = "38,38,40,40,37,39,37,39,66,65"; this.keys = []; this.shown = false; this.run() }, run: function () { $(document).keydown(function (a) { konami.keys.push(a.keyCode); if (konami.keys.toString().indexOf(konami.code) >= 0) { $(document).unbind("keydown", arguments.callee); var b = document.createElement("script"); b.type = "text/javascript"; document.body.appendChild(b); b.src = "/Scripts/asteroids.min.js" } }, true) } }; var mobile = { winW: Object, resizeTimer: Object, init: function () { this.winW = $(window).width(); this.arrow = $("#arrow"); this.resizeTimer; this.run() }, run: function () { $(window).resize(function () { clearTimeout(mobile.resizeTimer); mobile.resizeTimer = setTimeout(mobile.howBigAmI, 100) }); mobile.howBigAmI() }, howBigAmI: function () { mobile.winW = $(window).width(); if (mobile.winW < 520) { mobile.arrow.hide(); return false } else if (homepage.didItRun === true) { return false } else { homepage.init() } } }; $(document).ready(function () { initializeHome() }); var jaaulde = window.jaaulde || {}; jaaulde.utils = jaaulde.utils || {}; jaaulde.utils.cookies = function () { var a = []; var b = { hoursToLive: null, path: "/", domain: null, secure: false }; var c = function (a) { var c; if (typeof a !== "object" || a === null) { c = b } else { c = { hoursToLive: typeof a.hoursToLive === "number" && a.hoursToLive !== 0 ? a.hoursToLive : b.hoursToLive, path: typeof a.path === "string" && a.path !== "" ? a.path : b.path, domain: typeof a.domain === "string" && a.domain !== "" ? a.domain : b.domain, secure: typeof a.secure === "boolean" && a.secure ? a.secure : b.secure} } return c }; var d = function (a) { var b = new Date; b.setTime(b.getTime() + a * 60 * 60 * 1e3); return b.toGMTString() }; var e = function (a) { a = c(a); return (typeof a.hoursToLive === "number" ? "; expires=" + d(a.hoursToLive) : "") + "; path=" + a.path + (typeof a.domain === "string" ? "; domain=" + a.domain : "") + (a.secure === true ? "; secure" : "") }; var f = function () { a = {}; var b, c, d, e = document.cookie.split(";"); for (var f = 0; f < e.length; f = f + 1) { b = e[f].split("="); c = b[0].replace(/^\s*/, "").replace(/\s*$/, ""); d = decodeURIComponent(b[1]); a[c] = d } return a }; var g = function () { }; g.prototype.get = function (b) { var c; f(); if (typeof b === "string") { c = typeof a[b] !== "undefined" ? a[b] : null } else if (typeof b === "object" && b !== null) { c = {}; for (var d in b) { if (typeof a[b[d]] !== "undefined") { c[b[d]] = a[b[d]] } else { c[b[d]] = null } } } else { c = a } return c }; g.prototype.filter = function (b) { var c = {}; f(); if (typeof b === "string") { b = new RegExp(b) } for (var d in a) { if (d.match(b)) { c[d] = a[d] } } return c }; g.prototype.set = function (a, b, c) { if (typeof b === "undefined" || b === null) { if (typeof c !== "object" || c === null) { c = {} } b = ""; c.hoursToLive = -8760 } var d = e(c); document.cookie = a + "=" + encodeURIComponent(b) + d }; g.prototype.del = function (a, b) { var c = {}; if (typeof b !== "object" || b === null) { b = {} } if (typeof a === "boolean" && a === true) { c = this.get() } else if (typeof a === "string") { c[a] = true } for (var d in c) { if (typeof d === "string" && d !== "") { this.set(d, null, b) } } }; g.prototype.test = function () { var a = false, b = "cT", c = "data"; this.set(b, c); if (this.get(b) === c) { this.del(b); a = true } return a }; g.prototype.setOptions = function (a) { if (typeof a !== "object") { a = null } b = c(a) }; return new g } (); (function () { if (window.jQuery) { (function (a) { a.cookies = jaaulde.utils.cookies; var b = { cookify: function (b) { return this.each(function () { var c, d = false, e = false, f = "", g = "", h = ["name", "id"], i, j; for (c in h) { if (!isNaN(c)) { f = a(this).attr(h[c]); if (typeof f === "string" && f !== "") { d = true; break } } } if (d) { i = this.nodeName.toLowerCase(); if (i !== "input" && i !== "textarea" && i !== "select" && i !== "img") { g = a(this).html(); e = true } else { j = a(this).attr("type"); if (typeof j === "string" && j !== "") { j = j.toLowerCase() } if (j !== "radio" && j !== "checkbox") { g = a(this).val(); e = true } } if (e) { if (typeof g !== "string" || g === "") { g = null } a.cookies.set(f, g, b) } } }) }, cookieFill: function () { return this.each(function () { var b, c = false, d = "", e, f = ["name", "id"], g = 0, h; for (b in f) { if (!isNaN(b)) { d = a(this).attr(f[b]); if (typeof d === "string" && d !== "") { c = true; break } } } if (c) { e = a.cookies.get(d); if (e !== null) { h = this.nodeName.toLowerCase(); if (h === "input" || h === "textarea" || h === "select") { a(this).val(e) } else { a(this).html(e) } } } g = 0 }) }, cookieBind: function (b) { return this.each(function () { a(this).cookieFill().change(function () { a(this).cookify(b) }) }) } }; a.each(b, function (b) { a.fn[b] = this }) })(window.jQuery) } })()
