function isLeapYear(year) { return (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) ? 1 : 0 } function isValidDate(A, C, B) { if (A == "" || C == "" || B == "") { return false } if (parseInt(A) > 28 && C == "02" && (!isLeapYear(B) || parseInt(A) > 29)) { return false } else { if (parseInt(A) > 30 && (C == "09" || C == "04" || C == "06" || C == "11")) { return false } else { return true } } } var TipsAustar = new Class({ options: { onShow: function(A) { A.setStyle("visibility", "visible") }, onHide: function(A) { A.setStyle("visibility", "hidden") }, loadingText: "Loading...", errTitle: "Error", errText: "There was a problem retrieving the information.", maxTitleChars: 30, showDelay: 100, hideDelay: 100, className: "Tool", offsets: { x: 10, y: 16 }, width: 139, fixed: false }, initialize: function(B, A) { this.setOptions(A); this.toolTip = new Element("div", { "class": this.options.className + "Tip", styles: { position: "absolute", top: "0", left: "0", visibility: "hidden"} }).inject(document.body); this.wrapper = new Element("div").inject(this.toolTip); $$(B).each(this.build, this); if (this.options.initialize) { this.options.initialize.call(this) } }, addElements: function(A) { $$(A).each(this.build, this) }, getVisibility: function() { if (this.toolTip.getStyle("visibility")) { return this.toolTip.getStyle("visibility") } else { return false } }, build: function(B) { B.$tmp.myTitle = (B.href && B.getTag() == "a") ? B.href.replace("http://", "") : (B.rel || false); if (!B.$tmp.ajaxBuild) { B.$tmp.wholeTitle = B.title } else { if (!B.$tmp.isComplete) { if (B.$tmp.wholeTitle) { B.title = B.$tmp.wholeTitle } } } if (B.title) { var C = B.title.split(":::"); if (C.length > 1) { B.$tmp.myWidth = C[1].trim(); B.title = C[0].trim() } if (B.title.test("^DOM:", "i")) { B.title = $(B.title.split(":")[1].trim()).innerHTML } if (B.title.test("^AJAX:", "i")) { B.title = this.options.loadingText + "::" + B.title } var D = B.title.split("::"); if (D.length > 1) { B.$tmp.myTitle = D[0].trim(); B.$tmp.myText = D[1].trim(); if (D.length > 2) { B.$tmp.myTitleClass = D[2].trim() } } else { B.$tmp.myText = B.title } B.removeAttribute("title") } else { B.$tmp.myText = false } if (B.$tmp.myTitle && B.$tmp.myTitle.length > this.options.maxTitleChars) { B.$tmp.myTitle = B.$tmp.myTitle.substr(0, this.options.maxTitleChars - 1) + "&hellip;" } if (!B.$tmp.builtEvents) { B.$tmp.builtEvents = true; B.addEvent("mouseenter", this.mouseEnterEventHandler.bindWithEvent(this, B)); if (!this.options.fixed) { B.addEvent("mousemove", this.locate.bindWithEvent(this)) } var A = this.end.bind(this); B.addEvent("mouseleave", A); B.addEvent("trash", A) } }, mouseEnterEventHandler: function(B, A) { this.start(A); if (!this.options.fixed) { this.locate(B) } else { this.position(A) } }, start: function(A) { this.wrapper.empty(); if (A.$tmp.ajaxBuild && !A.$tmp.isComplete) { A.$tmp.ajaxBuild = false; if (A.$tmp.wholeTitle) { A.title = A.$tmp.wholeTitle } this.build(A); this.start(A); return } if (A.$tmp.myWidth) { this.toolTip.setStyle("width", A.$tmp.myWidth) } else { this.toolTip.setStyle("width", this.options.width) } if (A.$tmp.myText && A.$tmp.myText.test("^AJAX:", "i")) { A.$tmp.ajaxBuild = true; this.ajax = new Ajax(A.$tmp.myText.replace(/AJAX:/i, ""), { onComplete: function(B, C) { A.$tmp.isComplete = true; A.title = B; this.build(A); this.start(A) } .bind(this), onFailure: function() { A.$tmp.isComplete = true; A.title = this.options.errTitle + "::" + this.options.errText; this.build(A); this.start(A) } .bind(this), autoCancel: true, method: "get" }).request(); A.$tmp.myText = '<div class="' + this.options.className + 'Loading">&nbsp;</div>' } if (A.$tmp.myTitle) { this.title = new Element("h4", { "class": A.$tmp.myTitleClass }).inject(new Element("div", { "class": this.options.className + "TitleContainer" }).inject(new Element("div", { "class": this.options.className + "Title" }).inject(this.wrapper))).setHTML(A.$tmp.myTitle) } if (A.$tmp.myText) { this.text = new Element("div", { "class": "Content" }).inject(new Element("div", { "class": this.options.className + "TextContainer" }).inject(new Element("div", { "class": this.options.className + "Text" }).inject(this.wrapper))).setHTML(A.$tmp.myText) } $clear(this.timer); this.timer = this.show.delay(this.options.showDelay, this) }, end: function(A) { $clear(this.timer); if (this.ajax) { this.ajax.cancel() } this.timer = this.hide.delay(this.options.hideDelay, this) }, position: function(A) { var B = A.getPosition(); this.toolTip.setStyles({ left: B.x + this.options.offsets.x, top: B.y + this.options.offsets.y }) }, locate: function(B) { var D = { x: window.getWidth(), y: window.getHeight() }; var A = { x: window.getScrollLeft(), y: window.getScrollTop() }; var C = { x: this.toolTip.offsetWidth, y: this.toolTip.offsetHeight }; var G = { x: "left", y: "top" }; for (var E in G) { var F = B.page[E] + this.options.offsets[E]; if ((F + C[E] - A[E]) > D[E]) { F = B.page[E] - this.options.offsets[E] - C[E] } this.toolTip.setStyle(G[E], F) } }, show: function() { if (this.options.timeout) { this.timer = this.hide.delay(this.options.timeout, this) } this.fireEvent("onShow", [this.toolTip]) }, hide: function() { this.fireEvent("onHide", [this.toolTip]) } }); TipsAustar.implement(new Events, new Options); var ProcessMenu = new Class({ options: { onClick: function(A) { if (this.options.hrefArray[A]) { window.location.assign(this.options.hrefArray[A]) } }, start: -1, smallWidth: 0, selected: -1, activeStep: 0, completedStep: 0, transition: Fx.Transitions.expoOut, menuWidthArray: [100, 100, 100, 100, 100, 100, 100, 100], hrefArray: [], completeTip: "Complete::You have completed this step", completeModifyTip: "Complete::Click if you wish to modify this step", futureTip: "Future Step::You are not up to this step yet", currentTip: "Current::This is the current step", currentPendingTip: "Current::This is the current step partially completed", pendingTip: "Populated Step::You have partially completed this step" }, initialize: function(B, A) { this.myElements = B; this.setOptions(A); var C = new Fx.Elements(B.getElement("a"), { wait: false, duration: 400, transition: this.options.transition }); B.each(function(E, D) { if (this.testCompleted(D)) { E.addClass("Complete") } else { if (this.testPending(D)) { E.addClass("Pending") } } E.addEvent("mouseenter", function(F) { F = new Event(F).stop(); E.show() }); if (this.testClickEnabled(D)) { E.addEvent("click", function(F) { E.select(); this.fireEvent("onClick", [this.options.selected]) } .bind(this)) } else { E.setStyle("cursor", "default"); if (D != this.options.activeStep - 1) { E.getElement("a").setOpacity(0.4) } } E.addEvent("mouseleave", function(F) { F = new Event(F).stop(); E.hide() }); E.show = function() { var F = {}; F[D] = { width: [E.getElement("a").getStyle("width").toInt(), this.options.menuWidthArray[D]] }; B.each(function(G, I) { if (G != E) { var H = G.getElement("a").getStyle("width").toInt(); if (H != this.options.smallWidth) { F[I] = { width: [H, this.options.smallWidth]} } } } .bind(this)); C.start(F) } .bind(this); E.hide = function() { var F = {}; if (this.options.selected == -1) { B.each(function(H, G) { F[G] = { width: [H.getElement("a").getStyle("width").toInt(), this.options.smallWidth]} } .bind(this)) } else { B.each(function(I, H) { if (H != this.options.selected) { var G = I.getElement("a").getStyle("width").toInt(); if (G != this.options.smallWidth) { F[H] = { width: [G, this.options.smallWidth]} } } else { F[H] = { width: [I.getElement("a").getStyle("width").toInt(), this.options.menuWidthArray[H]]} } } .bind(this)) } C.start(F) } .bind(this); E.select = function() { if (this.options.selected == D) { this.options.selected = -1 } else { this.options.selected = D } } .bind(this); this.setToolTip(E, D) } .bind(this)); if (this.options.activeStep > 0) { this.options.start = this.options.activeStep - 1 } if (this.options.start != -1) { B[this.options.start].show(); B[this.options.start].select() } }, testDisabled: function(A) { if (A >= this.options.activeStep) { return true } else { return false } }, testPending: function(A) { if (A < this.options.completedStep && A >= this.options.activeStep - 1) { return true } else { return false } }, testClickEnabled: function(A) { var B = this.options.activeStep; if ((B < 5) && (A + 1 < B)) { return true } else { if ((B < 7) && (A + 1 < B) && (A + 1 > 4)) { return true } else { return false } } }, testCompleted: function(A) { if (A < this.options.activeStep - 1) { return true } else { return false } }, setToolTip: function(B, A) { if (B.hasClass("Complete")) { if (B.getStyle("cursor") == "default") { B.setAttribute("title", this.options.completeTip) } else { B.setAttribute("title", this.options.completeModifyTip) } } else { if (A != this.options.activeStep - 1) { if (B.hasClass("Pending")) { B.setAttribute("title", this.options.pendingTip) } else { B.setAttribute("title", this.options.futureTip) } } else { if (B.hasClass("Pending")) { B.setAttribute("title", this.options.currentPendingTip) } else { B.setAttribute("title", this.options.currentTip) } } } }, reset: function() { this.options.selected = -1; this.myElements.each(function(B, A) { B.hide() }) } }); ProcessMenu.implement(new Events, new Options);