﻿/*effects.js*/
String.prototype.parseColor = function() { var a = "#"; if (this.slice(0, 4) == "rgb(") { var c = this.slice(4, this.length - 1).split(","); var b = 0; do { a += parseInt(c[b]).toColorPart() } while (++b < 3) } else { if (this.slice(0, 1) == "#") { if (this.length == 4) { for (var b = 1; b < 4; b++) { a += (this.charAt(b) + this.charAt(b)).toLowerCase() } } if (this.length == 7) { a = this.toLowerCase() } } } return (a.length == 7 ? a : (arguments[0] || this)) }; Element.collectTextNodes = function(a) { return $A($(a).childNodes).collect(function(b) { return (b.nodeType == 3 ? b.nodeValue : (b.hasChildNodes() ? Element.collectTextNodes(b) : "")) }).flatten().join("") }; Element.collectTextNodesIgnoreClass = function(a, b) { return $A($(a).childNodes).collect(function(c) { return (c.nodeType == 3 ? c.nodeValue : ((c.hasChildNodes() && !Element.hasClassName(c, b)) ? Element.collectTextNodesIgnoreClass(c, b) : "")) }).flatten().join("") }; Element.setContentZoom = function(a, b) { a = $(a); Element.setStyle(a, { fontSize: (b / 100) + "em" }); if (navigator.appVersion.indexOf("AppleWebKit") > 0) { window.scrollBy(0, 0) } }; Element.getOpacity = function(b) { var a; if (a = Element.getStyle(b, "opacity")) { return parseFloat(a) } if (a = (Element.getStyle(b, "filter") || "").match(/alpha\(opacity=(.*)\)/)) { if (a[1]) { return parseFloat(a[1]) / 100 } } return 1 }; Element.setOpacity = function(a, b) { a = $(a); if (b == 1) { Element.setStyle(a, { opacity: (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : null }); if (/MSIE/.test(navigator.userAgent)) { Element.setStyle(a, { filter: Element.getStyle(a, "filter").replace(/alpha\([^\)]*\)/gi, "") }) } } else { if (b < 0.00001) { b = 0 } Element.setStyle(a, { opacity: b }); if (/MSIE/.test(navigator.userAgent)) { Element.setStyle(a, { filter: Element.getStyle(a, "filter").replace(/alpha\([^\)]*\)/gi, "") + "alpha(opacity=" + b * 100 + ")" }) } } }; Element.getInlineOpacity = function(a) { return $(a).style.opacity || "" }; Element.childrenWithClassName = function(c, d, e) { var b = new RegExp("(^|\\s)" + d + "(\\s|$)"); var a = $A($(c).getElementsByTagName("*"))[e ? "detect" : "select"](function(f) { return (f.className && f.className.match(b)) }); if (!a) { a = [] } return a }; Element.forceRerendering = function(a) { try { a = $(a); var c = document.createTextNode(" "); a.appendChild(c); a.removeChild(c) } catch (b) { } }; Array.prototype.call = function() { var a = arguments; this.each(function(b) { b.apply(this, a) }) }; var Effect = { tagifyText: function(a) { var b = "position:relative"; if (/MSIE/.test(navigator.userAgent)) { b += ";zoom:1" } a = $(a); $A(a.childNodes).each(function(c) { if (c.nodeType == 3) { c.nodeValue.toArray().each(function(d) { a.insertBefore(Builder.node("span", { style: b }, d == " " ? String.fromCharCode(160) : d), c) }); Element.remove(c) } }) }, multiple: function(b, c) { var e; if (((typeof b == "object") || (typeof b == "function")) && (b.length)) { e = b } else { e = $(b).childNodes } var a = Object.extend({ speed: 0.1, delay: 0 }, arguments[2] || {}); var d = a.delay; $A(e).each(function(g, f) { new c(g, Object.extend(a, { delay: f * a.speed + d })) }) }, PAIRS: { slide: ["SlideDown", "SlideUp"], blind: ["BlindDown", "BlindUp"], appear: ["Appear", "Fade"] }, toggle: function(b, c) { b = $(b); c = (c || "appear").toLowerCase(); var a = Object.extend({ queue: { position: "end", scope: (b.id || "global"), limit: 1} }, arguments[2] || {}); Effect[b.visible() ? Effect.PAIRS[c][1] : Effect.PAIRS[c][0]](b, a) } }; var Effect2 = Effect; Effect.Transitions = {}; Effect.Transitions.linear = function(a) { return a }; Effect.Transitions.sinoidal = function(a) { return (-Math.cos(a * Math.PI) / 2) + 0.5 }; Effect.Transitions.reverse = function(a) { return 1 - a }; Effect.Transitions.flicker = function(a) { return ((-Math.cos(a * Math.PI) / 4) + 0.75) + Math.random() / 4 }; Effect.Transitions.wobble = function(a) { return (-Math.cos(a * Math.PI * (9 * a)) / 2) + 0.5 }; Effect.Transitions.pulse = function(a) { return (Math.floor(a * 10) % 2 == 0 ? (a * 10 - Math.floor(a * 10)) : 1 - (a * 10 - Math.floor(a * 10))) }; Effect.Transitions.none = function(a) { return 0 }; Effect.Transitions.full = function(a) { return 1 }; Effect.ScopedQueue = Class.create(); Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), { initialize: function() { this.effects = []; this.interval = null }, _each: function(a) { this.effects._each(a) }, add: function(b) { var c = new Date().getTime(); var a = (typeof b.options.queue == "string") ? b.options.queue : b.options.queue.position; switch (a) { case "front": this.effects.findAll(function(d) { return d.state == "idle" }).each(function(d) { d.startOn += b.finishOn; d.finishOn += b.finishOn }); break; case "end": c = this.effects.pluck("finishOn").max() || c; break } b.startOn += c; b.finishOn += c; if (!b.options.queue.limit || (this.effects.length < b.options.queue.limit)) { this.effects.push(b) } if (!this.interval) { this.interval = setInterval(this.loop.bind(this), 40) } }, remove: function(a) { this.effects = this.effects.reject(function(b) { return b == a }); if (this.effects.length == 0) { clearInterval(this.interval); this.interval = null } }, loop: function() { var a = new Date().getTime(); this.effects.invoke("loop", a) } }); Effect.Queues = { instances: $H(), get: function(a) { if (typeof a != "string") { return a } if (!this.instances[a]) { this.instances[a] = new Effect.ScopedQueue() } return this.instances[a] } }; Effect.Queue = Effect.Queues.get("global"); Effect.DefaultOptions = { transition: Effect.Transitions.sinoidal, duration: 1, fps: 25, sync: false, from: 0, to: 1, delay: 0, queue: "parallel" }; Effect.Base = function() { }; Effect.Base.prototype = { position: null, start: function(a) { this.options = Object.extend(Object.extend({}, Effect.DefaultOptions), a || {}); this.currentFrame = 0; this.state = "idle"; this.startOn = this.options.delay * 1000; this.finishOn = this.startOn + (this.options.duration * 1000); this.event("beforeStart"); if (!this.options.sync) { Effect.Queues.get(typeof this.options.queue == "string" ? "global" : this.options.queue.scope).add(this) } }, loop: function(c) { if (c >= this.startOn) { if (c >= this.finishOn) { this.render(1); this.cancel(); this.event("beforeFinish"); if (this.finish) { this.finish() } this.event("afterFinish"); return } var b = (c - this.startOn) / (this.finishOn - this.startOn); var a = Math.round(b * this.options.fps * this.options.duration); if (a > this.currentFrame) { this.render(b); this.currentFrame = a } } }, render: function(a) { if (this.state == "idle") { this.state = "running"; this.event("beforeSetup"); if (this.setup) { this.setup() } this.event("afterSetup") } if (this.state == "running") { if (this.options.transition) { a = this.options.transition(a) } a *= (this.options.to - this.options.from); a += this.options.from; this.position = a; this.event("beforeUpdate"); if (this.update) { this.update(a) } this.event("afterUpdate") } }, cancel: function() { if (!this.options.sync) { Effect.Queues.get(typeof this.options.queue == "string" ? "global" : this.options.queue.scope).remove(this) } this.state = "finished" }, event: function(a) { if (this.options[a + "Internal"]) { this.options[a + "Internal"](this) } if (this.options[a]) { this.options[a](this) } }, inspect: function() { return "#<Effect:" + $H(this).inspect() + ",options:" + $H(this.options).inspect() + ">" } }; Effect.Parallel = Class.create(); Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), { initialize: function(a) { this.effects = a || []; this.start(arguments[1]) }, update: function(a) { this.effects.invoke("render", a) }, finish: function(a) { this.effects.each(function(b) { b.render(1); b.cancel(); b.event("beforeFinish"); if (b.finish) { b.finish(a) } b.event("afterFinish") }) } }); Effect.Opacity = Class.create(); Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), { initialize: function(b) { this.element = $(b); if (/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout)) { this.element.setStyle({ zoom: 1 }) } var a = Object.extend({ from: this.element.getOpacity() || 0, to: 1 }, arguments[1] || {}); this.start(a) }, update: function(a) { this.element.setOpacity(a) } }); Effect.Move = Class.create(); Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), { initialize: function(b) { this.element = $(b); var a = Object.extend({ x: 0, y: 0, mode: "relative" }, arguments[1] || {}); this.start(a) }, setup: function() { this.element.makePositioned(); this.originalLeft = parseFloat(this.element.getStyle("left") || "0"); this.originalTop = parseFloat(this.element.getStyle("top") || "0"); if (this.options.mode == "absolute") { this.options.x = this.options.x - this.originalLeft; this.options.y = this.options.y - this.originalTop } }, update: function(a) { this.element.setStyle({ left: this.options.x * a + this.originalLeft + "px", top: this.options.y * a + this.originalTop + "px" }) } }); Effect.MoveBy = function(b, a, c) { return new Effect.Move(b, Object.extend({ x: c, y: a }, arguments[3] || {})) }; Effect.Scale = Class.create(); Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), { initialize: function(b, c) { this.element = $(b); var a = Object.extend({ scaleX: true, scaleY: true, scaleContent: true, scaleFromCenter: false, scaleMode: "box", scaleFrom: 100, scaleTo: c }, arguments[2] || {}); this.start(a) }, setup: function() { this.restoreAfterFinish = this.options.restoreAfterFinish || false; this.elementPositioning = this.element.getStyle("position"); this.originalStyle = {}; ["top", "left", "width", "height", "fontSize"].each(function(b) { this.originalStyle[b] = this.element.style[b] } .bind(this)); this.originalTop = this.element.offsetTop; this.originalLeft = this.element.offsetLeft; var a = this.element.getStyle("font-size") || "100%"; ["em", "px", "%"].each(function(b) { if (a.indexOf(b) > 0) { this.fontSize = parseFloat(a); this.fontSizeType = b } } .bind(this)); this.factor = (this.options.scaleTo - this.options.scaleFrom) / 100; this.dims = null; if (this.options.scaleMode == "box") { this.dims = [this.element.offsetHeight, this.element.offsetWidth] } if (/^content/.test(this.options.scaleMode)) { this.dims = [this.element.scrollHeight, this.element.scrollWidth] } if (!this.dims) { this.dims = [this.options.scaleMode.originalHeight, this.options.scaleMode.originalWidth] } }, update: function(a) { var b = (this.options.scaleFrom / 100) + (this.factor * a); if (this.options.scaleContent && this.fontSize) { this.element.setStyle({ fontSize: this.fontSize * b + this.fontSizeType }) } this.setDimensions(this.dims[0] * b, this.dims[1] * b) }, finish: function(a) { if (this.restoreAfterFinish) { this.element.setStyle(this.originalStyle) } }, setDimensions: function(a, e) { var f = {}; if (this.options.scaleX) { f.width = e + "px" } if (this.options.scaleY) { f.height = a + "px" } if (this.options.scaleFromCenter) { var c = (a - this.dims[0]) / 2; var b = (e - this.dims[1]) / 2; if (this.elementPositioning == "absolute") { if (this.options.scaleY) { f.top = this.originalTop - c + "px" } if (this.options.scaleX) { f.left = this.originalLeft - b + "px" } } else { if (this.options.scaleY) { f.top = -c + "px" } if (this.options.scaleX) { f.left = -b + "px" } } } this.element.setStyle(f) } }); Effect.Highlight = Class.create(); Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), { initialize: function(b) { this.element = $(b); var a = Object.extend({ startcolor: "#ffff99" }, arguments[1] || {}); this.start(a) }, setup: function() { if (this.element.getStyle("display") == "none") { this.cancel(); return } this.oldStyle = { backgroundImage: this.element.getStyle("background-image") }; this.element.setStyle({ backgroundImage: "none" }); if (!this.options.endcolor) { this.options.endcolor = this.element.getStyle("background-color").parseColor("#ffffff") } if (!this.options.restorecolor) { this.options.restorecolor = this.element.getStyle("background-color") } this._base = $R(0, 2).map(function(a) { return parseInt(this.options.startcolor.slice(a * 2 + 1, a * 2 + 3), 16) } .bind(this)); this._delta = $R(0, 2).map(function(a) { return parseInt(this.options.endcolor.slice(a * 2 + 1, a * 2 + 3), 16) - this._base[a] } .bind(this)) }, update: function(a) { this.element.setStyle({ backgroundColor: $R(0, 2).inject("#", function(b, c, d) { return b + (Math.round(this._base[d] + (this._delta[d] * a)).toColorPart()) } .bind(this)) }) }, finish: function() { this.element.setStyle(Object.extend(this.oldStyle, { backgroundColor: this.options.restorecolor })) } }); Effect.ScrollTo = Class.create(); Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), { initialize: function(a) { this.element = $(a); this.start(arguments[1] || {}) }, setup: function() { Position.prepare(); var b = Position.cumulativeOffset(this.element); if (this.options.offset) { b[1] += this.options.offset } var a = window.innerHeight ? window.height - window.innerHeight : document.body.scrollHeight - (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight); this.scrollStart = Position.deltaY; this.delta = (b[1] > a ? a : b[1]) - this.scrollStart }, update: function(a) { Position.prepare(); window.scrollTo(Position.deltaX, this.scrollStart + (a * this.delta)) } }); Effect.Fade = function(c) { c = $(c); var a = c.getInlineOpacity(); var b = Object.extend({ from: c.getOpacity() || 1, to: 0, afterFinishInternal: function(d) { if (d.options.to != 0) { return } d.element.hide(); d.element.setStyle({ opacity: a }) } }, arguments[1] || {}); return new Effect.Opacity(c, b) }; Effect.Appear = function(b) { b = $(b); var a = Object.extend({ from: (b.getStyle("display") == "none" ? 0 : b.getOpacity() || 0), to: 1, afterFinishInternal: function(c) { c.element.forceRerendering() }, beforeSetup: function(c) { c.element.setOpacity(c.options.from); c.element.show() } }, arguments[1] || {}); return new Effect.Opacity(b, a) }; Effect.Puff = function(b) { b = $(b); var a = { opacity: b.getInlineOpacity(), position: b.getStyle("position") }; return new Effect.Parallel([new Effect.Scale(b, 200, { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), new Effect.Opacity(b, { sync: true, to: 0 })], Object.extend({ duration: 1, beforeSetupInternal: function(c) { c.effects[0].element.setStyle({ position: "absolute" }) }, afterFinishInternal: function(c) { c.effects[0].element.hide(); c.effects[0].element.setStyle(a) } }, arguments[1] || {})) }; Effect.BlindUp = function(a) { a = $(a); a.makeClipping(); return new Effect.Scale(a, 0, Object.extend({ scaleContent: false, scaleX: false, restoreAfterFinish: true, afterFinishInternal: function(b) { b.element.hide(); b.element.undoClipping() } }, arguments[1] || {})) }; Effect.BlindDown = function(b) { b = $(b); var a = b.getDimensions(); return new Effect.Scale(b, 100, Object.extend({ scaleContent: false, scaleX: false, scaleFrom: 0, scaleMode: { originalHeight: a.height, originalWidth: a.width }, restoreAfterFinish: true, afterSetup: function(c) { c.element.makeClipping(); c.element.setStyle({ height: "0px" }); c.element.show() }, afterFinishInternal: function(c) { c.element.undoClipping() } }, arguments[1] || {})) }; Effect.SwitchOff = function(b) { b = $(b); var a = b.getInlineOpacity(); return new Effect.Appear(b, { duration: 0.4, from: 0, transition: Effect.Transitions.flicker, afterFinishInternal: function(c) { new Effect.Scale(c.element, 1, { duration: 0.3, scaleFromCenter: true, scaleX: false, scaleContent: false, restoreAfterFinish: true, beforeSetup: function(d) { d.element.makePositioned(); d.element.makeClipping() }, afterFinishInternal: function(d) { d.element.hide(); d.element.undoClipping(); d.element.undoPositioned(); d.element.setStyle({ opacity: a }) } }) } }) }; Effect.DropOut = function(b) { b = $(b); var a = { top: b.getStyle("top"), left: b.getStyle("left"), opacity: b.getInlineOpacity() }; return new Effect.Parallel([new Effect.Move(b, { x: 0, y: 100, sync: true }), new Effect.Opacity(b, { sync: true, to: 0 })], Object.extend({ duration: 0.5, beforeSetup: function(c) { c.effects[0].element.makePositioned() }, afterFinishInternal: function(c) { c.effects[0].element.hide(); c.effects[0].element.undoPositioned(); c.effects[0].element.setStyle(a) } }, arguments[1] || {})) }; Effect.Shake = function(b) { b = $(b); var a = { top: b.getStyle("top"), left: b.getStyle("left") }; return new Effect.Move(b, { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(c) { new Effect.Move(c.element, { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(d) { new Effect.Move(d.element, { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(e) { new Effect.Move(e.element, { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(f) { new Effect.Move(f.element, { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(g) { new Effect.Move(g.element, { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(h) { h.element.undoPositioned(); h.element.setStyle(a) } }) } }) } }) } }) } }) } }) }; Effect.SlideDown = function(c) { c = $(c); c.cleanWhitespace(); var a = $(c.firstChild).getStyle("bottom"); var b = c.getDimensions(); return new Effect.Scale(c, 100, Object.extend({ scaleContent: false, scaleX: false, scaleFrom: window.opera ? 0 : 1, scaleMode: { originalHeight: b.height, originalWidth: b.width }, restoreAfterFinish: true, afterSetup: function(d) { d.element.makePositioned(); d.element.firstChild.makePositioned(); if (window.opera) { d.element.setStyle({ top: "" }) } d.element.makeClipping(); d.element.setStyle({ height: "0px" }); d.element.show() }, afterUpdateInternal: function(d) { d.element.firstChild.setStyle({ bottom: (d.dims[0] - d.element.clientHeight) + "px" }) }, afterFinishInternal: function(d) { d.element.undoClipping(); if (/MSIE/.test(navigator.userAgent)) { d.element.undoPositioned(); d.element.firstChild.undoPositioned() } else { d.element.firstChild.undoPositioned(); d.element.undoPositioned() } d.element.firstChild.setStyle({ bottom: a }) } }, arguments[1] || {})) }; Effect.SlideUp = function(b) { b = $(b); b.cleanWhitespace(); var a = $(b.firstChild).getStyle("bottom"); return new Effect.Scale(b, window.opera ? 0 : 1, Object.extend({ scaleContent: false, scaleX: false, scaleMode: "box", scaleFrom: 100, restoreAfterFinish: true, beforeStartInternal: function(c) { c.element.makePositioned(); c.element.firstChild.makePositioned(); if (window.opera) { c.element.setStyle({ top: "" }) } c.element.makeClipping(); c.element.show() }, afterUpdateInternal: function(c) { c.element.firstChild.setStyle({ bottom: (c.dims[0] - c.element.clientHeight) + "px" }) }, afterFinishInternal: function(c) { c.element.hide(); c.element.undoClipping(); c.element.firstChild.undoPositioned(); c.element.undoPositioned(); c.element.setStyle({ bottom: a }) } }, arguments[1] || {})) }; Effect.Squish = function(a) { return new Effect.Scale(a, window.opera ? 1 : 0, { restoreAfterFinish: true, beforeSetup: function(b) { b.element.makeClipping(b.element) }, afterFinishInternal: function(b) { b.element.hide(b.element); b.element.undoClipping(b.element) } }) }; Effect.Grow = function(c) { c = $(c); var b = Object.extend({ direction: "center", moveTransition: Effect.Transitions.sinoidal, scaleTransition: Effect.Transitions.sinoidal, opacityTransition: Effect.Transitions.full }, arguments[1] || {}); var a = { top: c.style.top, left: c.style.left, height: c.style.height, width: c.style.width, opacity: c.getInlineOpacity() }; var g = c.getDimensions(); var h, f; var e, d; switch (b.direction) { case "top-left": h = f = e = d = 0; break; case "top-right": h = g.width; f = d = 0; e = -g.width; break; case "bottom-left": h = e = 0; f = g.height; d = -g.height; break; case "bottom-right": h = g.width; f = g.height; e = -g.width; d = -g.height; break; case "center": h = g.width / 2; f = g.height / 2; e = -g.width / 2; d = -g.height / 2; break } return new Effect.Move(c, { x: h, y: f, duration: 0.01, beforeSetup: function(i) { i.element.hide(); i.element.makeClipping(); i.element.makePositioned() }, afterFinishInternal: function(i) { new Effect.Parallel([new Effect.Opacity(i.element, { sync: true, to: 1, from: 0, transition: b.opacityTransition }), new Effect.Move(i.element, { x: e, y: d, sync: true, transition: b.moveTransition }), new Effect.Scale(i.element, 100, { scaleMode: { originalHeight: g.height, originalWidth: g.width }, sync: true, scaleFrom: window.opera ? 1 : 0, transition: b.scaleTransition, restoreAfterFinish: true })], Object.extend({ beforeSetup: function(j) { j.effects[0].element.setStyle({ height: "0px" }); j.effects[0].element.show() }, afterFinishInternal: function(j) { j.effects[0].element.undoClipping(); j.effects[0].element.undoPositioned(); j.effects[0].element.setStyle(a) } }, b)) } }) }; Effect.Shrink = function(c) { c = $(c); var b = Object.extend({ direction: "center", moveTransition: Effect.Transitions.sinoidal, scaleTransition: Effect.Transitions.sinoidal, opacityTransition: Effect.Transitions.none }, arguments[1] || {}); var a = { top: c.style.top, left: c.style.left, height: c.style.height, width: c.style.width, opacity: c.getInlineOpacity() }; var f = c.getDimensions(); var e, d; switch (b.direction) { case "top-left": e = d = 0; break; case "top-right": e = f.width; d = 0; break; case "bottom-left": e = 0; d = f.height; break; case "bottom-right": e = f.width; d = f.height; break; case "center": e = f.width / 2; d = f.height / 2; break } return new Effect.Parallel([new Effect.Opacity(c, { sync: true, to: 0, from: 1, transition: b.opacityTransition }), new Effect.Scale(c, window.opera ? 1 : 0, { sync: true, transition: b.scaleTransition, restoreAfterFinish: true }), new Effect.Move(c, { x: e, y: d, sync: true, transition: b.moveTransition })], Object.extend({ beforeStartInternal: function(g) { g.effects[0].element.makePositioned(); g.effects[0].element.makeClipping() }, afterFinishInternal: function(g) { g.effects[0].element.hide(); g.effects[0].element.undoClipping(); g.effects[0].element.undoPositioned(); g.effects[0].element.setStyle(a) } }, b)) }; Effect.Pulsate = function(c) { c = $(c); var b = arguments[1] || {}; var a = c.getInlineOpacity(); var e = b.transition || Effect.Transitions.sinoidal; var d = function(f) { return e(1 - Effect.Transitions.pulse(f)) }; d.bind(e); return new Effect.Opacity(c, Object.extend(Object.extend({ duration: 3, from: 0, afterFinishInternal: function(f) { f.element.setStyle({ opacity: a }) } }, b), { transition: d })) }; Effect.Fold = function(b) { b = $(b); var a = { top: b.style.top, left: b.style.left, width: b.style.width, height: b.style.height }; Element.makeClipping(b); return new Effect.Scale(b, 5, Object.extend({ scaleContent: false, scaleX: false, afterFinishInternal: function(c) { new Effect.Scale(b, 1, { scaleContent: false, scaleY: false, afterFinishInternal: function(d) { d.element.hide(); d.element.undoClipping(); d.element.setStyle(a) } }) } }, arguments[1] || {})) }; ["setOpacity", "getOpacity", "getInlineOpacity", "forceRerendering", "setContentZoom", "collectTextNodes", "collectTextNodesIgnoreClass", "childrenWithClassName"].each(function(a) { Element.Methods[a] = Element[a] }); Element.Methods.visualEffect = function(b, c, a) { s = c.gsub(/_/, "-").camelize(); effect_class = s.charAt(0).toUpperCase() + s.substring(1); new Effect[effect_class](b, a); return $(b) }; Element.addMethods();
/*fader.js*/
var fadeimages = new Array(); fadeimages[0] = ["images/CityPasstime.jpg", "contact.aspx", ""]; fadeimages[1] = ["images/SummerFruits.jpg", "contact.aspx", ""]; fadeimages[2] = ["images/CountryHome.jpg", "contact.aspx", ""]; fadeimages[3] = ["images/CityPasstime.jpg", "contact.aspx", ""]; fadeimages[4] = ["images/Urbanlife.jpg", "contact.aspx", ""]; var fade_smith = new Array(); fade_smith[0] = ["images/LifeInsurance.gif", "", ""]; fade_smith[1] = ["images/shortTermMedical.gif", "", ""]; fade_smith[2] = ["images/PermanentWholeLife.gif", "", ""]; fade_smith[3] = ["images/childonshoulders.jpg", "", ""]; var fade_tribute = new Array(); fade_tribute[0] = ["images/Img4.png", "", ""]; fade_tribute[1] = ["images/SoleilAndFriends.jpg", "", ""]; fade_tribute[2] = ["images/logo.gif", "", ""]; var fadebgcolor = "white"; var fadearray = new Array(); var fadeclear = new Array(); var dom = (document.getElementById); var iebrowser = document.all; function fadeshow(b, e, a, f, d, g, c) { this.pausecheck = g; this.mouseovercheck = 0; this.delay = d; this.degree = 10; this.curimageindex = 0; this.nextimageindex = 1; fadearray[fadearray.length] = this; this.slideshowid = fadearray.length - 1; this.canvasbase = "canvas" + this.slideshowid; this.curcanvas = this.canvasbase + "_0"; if (typeof c != "undefined") { b.sort(function() { return 0.5 - Math.random() }) } this.theimages = b; this.imageborder = parseInt(f); this.postimages = new Array(); for (p = 0; p < b.length; p++) { this.postimages[p] = new Image(); this.postimages[p].src = b[p][0] } var e = e + this.imageborder * 2; var a = a + this.imageborder * 2; if (iebrowser && dom || dom) { document.write('<div id="master' + this.slideshowid + '" style="position:relative;width:' + e + "px;height:" + a + 'px;overflow:hidden;"><div id="' + this.canvasbase + '_0" style="position:absolute;width:' + e + "px;height:" + a + "px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:" + fadebgcolor + '"></div><div id="' + this.canvasbase + '_1" style="position:absolute;width:' + e + "px;height:" + a + "px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-color:" + fadebgcolor + '"></div></div>') } else { document.write('<div><img name="defaultslide' + this.slideshowid + '" src="' + this.postimages[0].src + '"></div>') } if (iebrowser && dom || dom) { this.startit() } else { this.curimageindex++; setInterval("fadearray[" + this.slideshowid + "].rotateimage()", this.delay) } } function fadepic(a) { if (a.degree < 100) { a.degree += 10; if (a.tempobj.filters && a.tempobj.filters[0]) { if (typeof a.tempobj.filters[0].opacity == "number") { a.tempobj.filters[0].opacity = a.degree } else { a.tempobj.style.filter = "alpha(opacity=" + a.degree + ")" } } else { if (a.tempobj.style.MozOpacity) { a.tempobj.style.MozOpacity = a.degree / 101 } else { if (a.tempobj.style.KhtmlOpacity) { a.tempobj.style.KhtmlOpacity = a.degree / 100 } } } } else { clearInterval(fadeclear[a.slideshowid]); a.nextcanvas = (a.curcanvas == a.canvasbase + "_0") ? a.canvasbase + "_0" : a.canvasbase + "_1"; a.tempobj = iebrowser ? iebrowser[a.nextcanvas] : document.getElementById(a.nextcanvas); a.populateslide(a.tempobj, a.nextimageindex); a.nextimageindex = (a.nextimageindex < a.postimages.length - 1) ? a.nextimageindex + 1 : 0; setTimeout("fadearray[" + a.slideshowid + "].rotateimage()", a.delay) } } fadeshow.prototype.populateslide = function(a, c) { var b = ""; if (this.theimages[c][1] != "") { b = '<a href="' + this.theimages[c][1] + '" target="' + this.theimages[c][2] + '">' } b += '<img src="' + this.postimages[c].src + '" border="' + this.imageborder + 'px">'; if (this.theimages[c][1] != "") { b += "</a>" } a.innerHTML = b }; fadeshow.prototype.rotateimage = function() { if (this.pausecheck == 1) { var c = this } if (this.mouseovercheck == 1) { setTimeout(function() { c.rotateimage() }, 100) } else { if (iebrowser && dom || dom) { this.resetit(); var a = this.tempobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas); a.style.zIndex++; fadeclear[this.slideshowid] = setInterval("fadepic(fadearray[" + this.slideshowid + "])", 50); this.curcanvas = (this.curcanvas == this.canvasbase + "_0") ? this.canvasbase + "_1" : this.canvasbase + "_0" } else { var b = document.images["defaultslide" + this.slideshowid]; b.src = this.postimages[this.curimageindex].src } } this.curimageindex = (this.curimageindex < this.postimages.length - 1) ? this.curimageindex + 1 : 0 }; fadeshow.prototype.resetit = function() { this.degree = 10; var a = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas); if (a.filters && a.filters[0]) { if (typeof a.filters[0].opacity == "number") { a.filters(0).opacity = this.degree } else { a.style.filter = "alpha(opacity=" + this.degree + ")" } } else { if (a.style.MozOpacity) { a.style.MozOpacity = this.degree / 101 } else { if (a.style.KhtmlOpacity) { a.style.KhtmlOpacity = obj.degree / 100 } } } }; fadeshow.prototype.startit = function() { var a = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas); this.populateslide(a, this.curimageindex); if (this.pausecheck == 1) { var c = this; var b = iebrowser ? iebrowser["master" + this.slideshowid] : document.getElementById("master" + this.slideshowid); b.onmouseover = function() { c.mouseovercheck = 1 }; b.onmouseout = function() { c.mouseovercheck = 0 } } this.rotateimage() };       
/*lightbox.js*/
var fileLoadingImage = "images/lightbox/loading.gif"; var fileBottomNavCloseImage = "images/lightbox/closelabel.gif"; var resizeSpeed = 7; var borderSize = 10; var imageArray = new Array; var activeImage; if (resizeSpeed > 10) { resizeSpeed = 10 } if (resizeSpeed < 1) { resizeSpeed = 1 } resizeDuration = (11 - resizeSpeed) * 0.15; Object.extend(Element, { getWidth: function(a) { a = $(a); return a.offsetWidth }, setWidth: function(b, a) { b = $(b); b.style.width = a + "px" }, setHeight: function(a, b) { a = $(a); a.style.height = b + "px" }, setTop: function(b, a) { b = $(b); b.style.top = a + "px" }, setSrc: function(a, b) { a = $(a); a.src = b }, setHref: function(b, a) { b = $(b); b.href = a }, setInnerHTML: function(a, b) { a = $(a); a.innerHTML = b } }); Array.prototype.removeDuplicates = function() { for (i = 1; i < this.length; i++) { if (this[i][0] == this[i - 1][0]) { this.splice(i, 1) } } }; Array.prototype.empty = function() { for (i = 0; i <= this.length; i++) { this.shift() } }; var Lightbox = Class.create(); Lightbox.prototype = { initialize: function() { if (!document.getElementsByTagName) { return } var o = document.getElementsByTagName("a"); for (var u = 0; u < o.length; u++) { var f = o[u]; var w = String(f.getAttribute("rel")); if (f.getAttribute("href") && (w.toLowerCase().match("lightbox"))) { f.onclick = function() { myLightbox.start(this); return false } } } var x = document.getElementsByTagName("body").item(0); var g = document.createElement("div"); g.setAttribute("id", "overlay"); g.style.display = "none"; g.onclick = function() { myLightbox.end(); return false }; x.appendChild(g); var n = document.createElement("div"); n.setAttribute("id", "lightbox"); n.style.display = "none"; x.appendChild(n); var v = document.createElement("div"); v.setAttribute("id", "outerImageContainer"); n.appendChild(v); var m = document.createElement("div"); m.setAttribute("id", "imageContainer"); v.appendChild(m); var j = document.createElement("img"); j.setAttribute("id", "lightboxImage"); m.appendChild(j); var r = document.createElement("div"); r.setAttribute("id", "hoverNav"); m.appendChild(r); var s = document.createElement("a"); s.setAttribute("id", "prevLink"); s.setAttribute("href", "#"); r.appendChild(s); var c = document.createElement("a"); c.setAttribute("id", "nextLink"); c.setAttribute("href", "#"); r.appendChild(c); var t = document.createElement("div"); t.setAttribute("id", "loading"); m.appendChild(t); var a = document.createElement("a"); a.setAttribute("id", "loadingLink"); a.setAttribute("href", "#"); a.onclick = function() { myLightbox.end(); return false }; t.appendChild(a); var l = document.createElement("img"); l.setAttribute("src", fileLoadingImage); a.appendChild(l); var e = document.createElement("div"); e.setAttribute("id", "imageDataContainer"); e.className = "clearfix"; n.appendChild(e); var d = document.createElement("div"); d.setAttribute("id", "imageData"); e.appendChild(d); var q = document.createElement("div"); q.setAttribute("id", "imageDetails"); d.appendChild(q); var h = document.createElement("span"); h.setAttribute("id", "caption"); q.appendChild(h); var b = document.createElement("span"); b.setAttribute("id", "numberDisplay"); q.appendChild(b); var p = document.createElement("div"); p.setAttribute("id", "bottomNav"); d.appendChild(p); var y = document.createElement("a"); y.setAttribute("id", "bottomNavClose"); y.setAttribute("href", "#"); y.onclick = function() { myLightbox.end(); return false }; p.appendChild(y); var k = document.createElement("img"); k.setAttribute("src", fileBottomNavCloseImage); y.appendChild(k) }, start: function(g) { hideSelectBoxes(); var c = getPageSize(); Element.setHeight("overlay", c[1]); new Effect.Appear("overlay", { duration: 0.2, from: 0, to: 0.8 }); imageArray = []; imageNum = 0; if (!document.getElementsByTagName) { return } var e = document.getElementsByTagName("a"); if ((g.getAttribute("rel") == "lightbox")) { imageArray.push(new Array(g.getAttribute("href"), g.getAttribute("title"))) } else { for (var d = 0; d < e.length; d++) { var b = e[d]; if (b.getAttribute("href") && (b.getAttribute("rel") == g.getAttribute("rel"))) { imageArray.push(new Array(b.getAttribute("href"), b.getAttribute("title"))) } } imageArray.removeDuplicates(); while (imageArray[imageNum][0] != g.getAttribute("href")) { imageNum++ } } var c = getPageSize(); var a = getPageScroll(); var f = a[1] + (c[3] / 15); Element.setTop("lightbox", f); Element.show("lightbox"); this.changeImage(imageNum) }, changeImage: function(a) { activeImage = a; Element.show("loading"); Element.hide("lightboxImage"); Element.hide("hoverNav"); Element.hide("prevLink"); Element.hide("nextLink"); Element.hide("imageDataContainer"); Element.hide("numberDisplay"); imgPreloader = new Image(); imgPreloader.onload = function() { Element.setSrc("lightboxImage", imageArray[activeImage][0]); myLightbox.resizeImageContainer(imgPreloader.width, imgPreloader.height) }; imgPreloader.src = imageArray[activeImage][0] }, resizeImageContainer: function(b, a) { this.wCur = Element.getWidth("outerImageContainer"); this.hCur = Element.getHeight("outerImageContainer"); this.xScale = ((b + (borderSize * 2)) / this.wCur) * 100; this.yScale = ((a + (borderSize * 2)) / this.hCur) * 100; wDiff = (this.wCur - borderSize * 2) - b; hDiff = (this.hCur - borderSize * 2) - a; if (!(hDiff == 0)) { new Effect.Scale("outerImageContainer", this.yScale, { scaleX: false, duration: resizeDuration, queue: "front" }) } if (!(wDiff == 0)) { new Effect.Scale("outerImageContainer", this.xScale, { scaleY: false, delay: resizeDuration, duration: resizeDuration }) } if ((hDiff == 0) && (wDiff == 0)) { if (navigator.appVersion.indexOf("MSIE") != -1) { pause(250) } else { pause(100) } } Element.setHeight("prevLink", a); Element.setHeight("nextLink", a); Element.setWidth("imageDataContainer", b + (borderSize * 2)); this.showImage() }, showImage: function() { Element.hide("loading"); new Effect.Appear("lightboxImage", { duration: 0.5, queue: "end", afterFinish: function() { myLightbox.updateDetails() } }); this.preloadNeighborImages() }, updateDetails: function() { Element.show("caption"); Element.setInnerHTML("caption", imageArray[activeImage][1]); if (imageArray.length > 1) { Element.show("numberDisplay"); Element.setInnerHTML("numberDisplay", "Image " + eval(activeImage + 1) + " of " + imageArray.length) } new Effect.Parallel([new Effect.SlideDown("imageDataContainer", { sync: true, duration: resizeDuration + 0.25, from: 0, to: 1 }), new Effect.Appear("imageDataContainer", { sync: true, duration: 1 })], { duration: 0.65, afterFinish: function() { myLightbox.updateNav() } }) }, updateNav: function() { Element.show("hoverNav"); if (activeImage != 0) { Element.show("prevLink"); document.getElementById("prevLink").onclick = function() { myLightbox.changeImage(activeImage - 1); return false } } if (activeImage != (imageArray.length - 1)) { Element.show("nextLink"); document.getElementById("nextLink").onclick = function() { myLightbox.changeImage(activeImage + 1); return false } } this.enableKeyboardNav() }, enableKeyboardNav: function() { document.onkeydown = this.keyboardAction }, disableKeyboardNav: function() { document.onkeydown = "" }, keyboardAction: function(a) { if (a == null) { keycode = event.keyCode } else { keycode = a.which } key = String.fromCharCode(keycode).toLowerCase(); if ((key == "x") || (key == "o") || (key == "c")) { myLightbox.end() } else { if (key == "p") { if (activeImage != 0) { myLightbox.disableKeyboardNav(); myLightbox.changeImage(activeImage - 1) } } else { if (key == "n") { if (activeImage != (imageArray.length - 1)) { myLightbox.disableKeyboardNav(); myLightbox.changeImage(activeImage + 1) } } } } }, preloadNeighborImages: function() { if ((imageArray.length - 1) > activeImage) { preloadNextImage = new Image(); preloadNextImage.src = imageArray[activeImage + 1][0] } if (activeImage > 0) { preloadPrevImage = new Image(); preloadPrevImage.src = imageArray[activeImage - 1][0] } }, end: function() { this.disableKeyboardNav(); Element.hide("lightbox"); new Effect.Fade("overlay", { duration: 0.2 }); showSelectBoxes() } }; function getPageScroll() { var a; if (self.pageYOffset) { a = self.pageYOffset } else { if (document.documentElement && document.documentElement.scrollTop) { a = document.documentElement.scrollTop } else { if (document.body) { a = document.body.scrollTop } } } arrayPageScroll = new Array("", a); return arrayPageScroll } function getPageSize() { var c, a; if (window.innerHeight && window.scrollMaxY) { c = document.body.scrollWidth; a = window.innerHeight + window.scrollMaxY } else { if (document.body.scrollHeight > document.body.offsetHeight) { c = document.body.scrollWidth; a = document.body.scrollHeight } else { c = document.body.offsetWidth; a = document.body.offsetHeight } } var b, d; if (self.innerHeight) { b = self.innerWidth; d = self.innerHeight } else { if (document.documentElement && document.documentElement.clientHeight) { b = document.documentElement.clientWidth; d = document.documentElement.clientHeight } else { if (document.body) { b = document.body.clientWidth; d = document.body.clientHeight } } } if (a < d) { pageHeight = d } else { pageHeight = a } if (c < b) { pageWidth = b } else { pageWidth = c } arrayPageSize = new Array(pageWidth, pageHeight, b, d); return arrayPageSize } function getKey(a) { if (a == null) { keycode = event.keyCode } else { keycode = a.which } key = String.fromCharCode(keycode).toLowerCase(); if (key == "x") { } } function listenKey() { document.onkeypress = getKey } function showSelectBoxes() { selects = document.getElementsByTagName("select"); for (i = 0; i != selects.length; i++) { selects[i].style.visibility = "visible" } } function hideSelectBoxes() { selects = document.getElementsByTagName("select"); for (i = 0; i != selects.length; i++) { selects[i].style.visibility = "hidden" } } function pause(b) { var a = new Date(); var c = a.getTime() + b; while (true) { a = new Date(); if (a.getTime() > c) { return } } } function initLightbox() { myLightbox = new Lightbox() } Event.observe(window, "load", initLightbox, false);
/*preloadimg.js*/
function MM_swapImgRestore() { var d, b, c = document.MM_sr; for (d = 0; c && d < c.length && (b = c[d]) && b.oSrc; d++) { b.src = b.oSrc } } function MM_preloadImages() { var f = document; if (f.images) { if (!f.MM_p) { f.MM_p = new Array() } var e, c = f.MM_p.length, b = MM_preloadImages.arguments; for (e = 0; e < b.length; e++) { if (b[e].indexOf("#") != 0) { f.MM_p[c] = new Image; f.MM_p[c++].src = b[e] } } } } function MM_findObj(f, e) { var c, b, a; if (!e) { e = document } if ((c = f.indexOf("?")) > 0 && parent.frames.length) { e = parent.frames[f.substring(c + 1)].document; f = f.substring(0, c) } if (!(a = e[f]) && e.all) { a = e.all[f] } for (b = 0; !a && b < e.forms.length; b++) { a = e.forms[b][f] } for (b = 0; !a && e.layers && b < e.layers.length; b++) { a = MM_findObj(f, e.layers[b].document) } if (!a && e.getElementById) { a = e.getElementById(f) } return a } function MM_swapImage() { var e, d = 0, b, c = MM_swapImage.arguments; document.MM_sr = new Array; for (e = 0; e < (c.length - 2); e += 3) { if ((b = MM_findObj(c[e])) != null) { document.MM_sr[d++] = b; if (!b.oSrc) { b.oSrc = b.src } b.src = c[e + 2] } } };
/*scroller.js*/
var scrollspeed = cache = 2; var initialdelay = 500; function initializeScroller() { dataobj = document.all ? document.all.datacontainer : document.getElementById("datacontainer"); if (dataobj) { dataobj.style.top = "5px" } setTimeout("getdataheight()", initialdelay) } function getdataheight() { if (!dataobj) { return } thelength = dataobj.offsetHeight; if (thelength == 0) { setTimeout("getdataheight()", 10) } else { scrollDiv() } } function scrollDiv() { dataobj.style.top = parseInt(dataobj.style.top) - scrollspeed + "px"; if (parseInt(dataobj.style.top) < thelength * (-1)) { dataobj.style.top = "5px" } setTimeout("scrollDiv()", 40) } if (window.addEventListener) { window.addEventListener("load", initializeScroller, false) } else { if (window.attachEvent) { window.attachEvent("onload", initializeScroller) } else { window.onload = initializeScroller } };


        function onSilverlightError(sender, args) {
            if (args.errorType == "InitializeError")  {
                var errorDiv = document.getElementById("errorLocation");
                if (errorDiv != null)
                    errorDiv.innerHTML = args.errorType + "- " + args.errorMessage;
            }
        }
function ValidateCUItem(item, name, validate_mail)
{
  if (document.getElementById(item)) {
    if (document.getElementById(item).value.length < 1)
    {  alert("You must enter a value for " + name);
      document.getElementById(item).focus();
      return false;
    }
    if (validate_mail)
    {
      var emailFilter=/^.+@.+\..{2,3}$/;
      var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
      var strng = document.getElementById(item).value;
      if (!(emailFilter.test(strng)))
      { alert("You have entered an invalid email address.");
        document.getElementById(item).focus();
        return false;
      }
      if (strng.match(illegalChars))
      { alert("Your email address contains invalid characters.");
        document.getElementById(item).focus();
        return false;
      }
    }
  }
  return true;
}
function ValidateCUForm()
{
    if (!ValidateCUItem("Request_Name", "Name", false)) return false;
    if (!ValidateCUItem("Request_Email", "Email Address", true)) return false;
    if (!ValidateCUItem("Request_Address1", "Address", false)) return false;
    if (!ValidateCUItem("Request_City", "City", false)) return false;
    if (!ValidateCUItem("Request_State", "State", false)) return false;
    if (!ValidateCUItem("Request_Zip", "Zip", false)) return false;
    if (!ValidateCUItem("Request_Phone", "Phone", false)) return false;
    return true;
}
function ValidateContactForm() {
    if (!ValidateCUItem("Request_Email", "Email Address", true)) return false;
    return true;
}
