/* COPYRIGHT (C) 2006, YAHOO! INC. ALL RIGHTS RESERVED. CODE LICENSED UNDER THE BSD LICENSE: HTTP://DEVELOPER.YAHOO.NET/YUI/LICENSE.TXT  version: 2.2.1*/

/* Global */
if (typeof YAHOO == "undefined") { var YAHOO = {}; }
YAHOO.namespace = function () {
    var a = arguments, o = null, i, j, d; for (i = 0; i < a.length; i = i + 1) { d = a[i].split("."); o = YAHOO; for (j = (d[0] == "YAHOO") ? 1 : 0; j < d.length; j = j + 1) { o[d[j]] = o[d[j]] || {}; o = o[d[j]]; } }
    return o;
}; YAHOO.log = function (msg, cat, src) { var l = YAHOO.widget.Logger; if (l && l.log) { return l.log(msg, cat, src); } else { return false; } }; YAHOO.init = function () {
    this.namespace("util", "widget", "example"); if (typeof YAHOO_config != "undefined") {
        var l = YAHOO_config.listener, ls = YAHOO.env.listeners, unique = true, i; if (l) {
            for (i = 0; i < ls.length; i = i + 1) { if (ls[i] == l) { unique = false; break; } }
            if (unique) { ls.push(l); }
        }
    }
}; YAHOO.register = function (name, mainClass, data) {
    var mods = YAHOO.env.modules; if (!mods[name]) { mods[name] = { versions: [], builds: [] }; }
    var m = mods[name], v = data.version, b = data.build, ls = YAHOO.env.listeners; m.name = name; m.version = v; m.build = b; m.versions.push(v); m.builds.push(b); m.mainClass = mainClass; for (var i = 0; i < ls.length; i = i + 1) { ls[i](m); }
    if (mainClass) { mainClass.VERSION = v; mainClass.BUILD = b; } else { YAHOO.log("mainClass is undefined for module " + name, "warn"); }
}; YAHOO.env = YAHOO.env || { modules: [], listeners: [], getVersion: function (name) { return YAHOO.env.modules[name] || null; } }; YAHOO.lang = { isArray: function (obj) { if (obj && obj.constructor && obj.constructor.toString().indexOf('Array') > -1) { return true; } else { return YAHOO.lang.isObject(obj) && obj.constructor == Array; } }, isBoolean: function (obj) { return typeof obj == 'boolean'; }, isFunction: function (obj) { return typeof obj == 'function'; }, isNull: function (obj) { return obj === null; }, isNumber: function (obj) { return typeof obj == 'number' && isFinite(obj); }, isObject: function (obj) { return obj && (typeof obj == 'object' || YAHOO.lang.isFunction(obj)); }, isString: function (obj) { return typeof obj == 'string'; }, isUndefined: function (obj) { return typeof obj == 'undefined'; }, hasOwnProperty: function (obj, prop) {
    if (Object.prototype.hasOwnProperty) { return obj.hasOwnProperty(prop); }
    return !YAHOO.lang.isUndefined(obj[prop]) && obj.constructor.prototype[prop] !== obj[prop];
}, extend: function (subc, superc, overrides) {
    if (!superc || !subc) { throw new Error("YAHOO.lang.extend failed, please check that " + "all dependencies are included."); }
    var F = function () { }; F.prototype = superc.prototype; subc.prototype = new F(); subc.prototype.constructor = subc; subc.superclass = superc.prototype; if (superc.prototype.constructor == Object.prototype.constructor) { superc.prototype.constructor = superc; }
    if (overrides) { for (var i in overrides) { subc.prototype[i] = overrides[i]; } }
}, augment: function (r, s) {
    if (!s || !r) { throw new Error("YAHOO.lang.augment failed, please check that " + "all dependencies are included."); }
    var rp = r.prototype, sp = s.prototype, a = arguments, i, p; if (a[2]) { for (i = 2; i < a.length; i = i + 1) { rp[a[i]] = sp[a[i]]; } } else { for (p in sp) { if (!rp[p]) { rp[p] = sp[p]; } } }
}
}; YAHOO.init(); YAHOO.util.Lang = YAHOO.lang; YAHOO.augment = YAHOO.lang.augment; YAHOO.extend = YAHOO.lang.extend; YAHOO.register("yahoo", YAHOO, { version: "2.2.1", build: "193" });

/* DOM */
(function () {
    var Y = YAHOO.util, getStyle, setStyle, id_counter = 0, propertyCache = {}; var ua = navigator.userAgent.toLowerCase(), isOpera = (ua.indexOf('opera') > -1), isSafari = (ua.indexOf('safari') > -1), isGecko = (!isOpera && !isSafari && ua.indexOf('gecko') > -1), isIE = (!isOpera && ua.indexOf('msie') > -1); var patterns = { HYPHEN: /(-[a-z])/i, ROOT_TAG: /body|html/i }; var toCamel = function (property) {
        if (!patterns.HYPHEN.test(property)) { return property; }
        if (propertyCache[property]) { return propertyCache[property]; }
        var converted = property; while (patterns.HYPHEN.exec(converted)) { converted = converted.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase()); }
        propertyCache[property] = converted; return converted;
    }; if (document.defaultView && document.defaultView.getComputedStyle) {
        getStyle = function (el, property) {
            var value = null; if (property == 'float') { property = 'cssFloat'; }
            var computed = document.defaultView.getComputedStyle(el, ''); if (computed) { value = computed[toCamel(property)]; }
            return el.style[property] || value;
        };
    } else if (document.documentElement.currentStyle && isIE) {
        getStyle = function (el, property) {
            switch (toCamel(property)) {
                case 'opacity': var val = 100; try { val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity; } catch (e) { try { val = el.filters('alpha').opacity; } catch (e) { } }
                    return val / 100; break; case 'float': property = 'styleFloat'; default: var value = el.currentStyle ? el.currentStyle[property] : null; return (el.style[property] || value);
            }
        };
    } else { getStyle = function (el, property) { return el.style[property]; }; }
    if (isIE) {
        setStyle = function (el, property, val) {
            switch (property) {
                case 'opacity': if (YAHOO.lang.isString(el.style.filter)) { el.style.filter = 'alpha(opacity=' + val * 100 + ')'; if (!el.currentStyle || !el.currentStyle.hasLayout) { el.style.zoom = 1; } }
                    break; case 'float': property = 'styleFloat'; default: el.style[property] = val;
            }
        };
    } else {
        setStyle = function (el, property, val) {
            if (property == 'float') { property = 'cssFloat'; }
            el.style[property] = val;
        };
    }
    YAHOO.util.Dom = { get: function (el) {
        if (YAHOO.lang.isString(el)) { return document.getElementById(el); }
        if (YAHOO.lang.isArray(el)) {
            var c = []; for (var i = 0, len = el.length; i < len; ++i) { c[c.length] = Y.Dom.get(el[i]); }
            return c;
        }
        if (el) { return el; }
        return null;
    }, getStyle: function (el, property) { property = toCamel(property); var f = function (element) { return getStyle(element, property); }; return Y.Dom.batch(el, f, Y.Dom, true); }, setStyle: function (el, property, val) { property = toCamel(property); var f = function (element) { setStyle(element, property, val); }; Y.Dom.batch(el, f, Y.Dom, true); }, getXY: function (el) {
        var f = function (el) {
            if ((el.parentNode === null || el.offsetParent === null || this.getStyle(el, 'display') == 'none') && el != document.body) { return false; }
            var parentNode = null; var pos = []; var box; if (el.getBoundingClientRect) {
                box = el.getBoundingClientRect(); var doc = document; if (!this.inDocument(el) && parent.document != document) { doc = parent.document; if (!this.isAncestor(doc.documentElement, el)) { return false; } }
                var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop); var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft); return [box.left + scrollLeft, box.top + scrollTop];
            }
            else {
                pos = [el.offsetLeft, el.offsetTop]; parentNode = el.offsetParent; var hasAbs = this.getStyle(el, 'position') == 'absolute'; if (parentNode != el) {
                    while (parentNode) {
                        pos[0] += parentNode.offsetLeft; pos[1] += parentNode.offsetTop; if (isSafari && !hasAbs && this.getStyle(parentNode, 'position') == 'absolute') { hasAbs = true; }
                        parentNode = parentNode.offsetParent;
                    }
                }
                if (isSafari && hasAbs) { pos[0] -= document.body.offsetLeft; pos[1] -= document.body.offsetTop; }
            }
            parentNode = el.parentNode; while (parentNode.tagName && !patterns.ROOT_TAG.test(parentNode.tagName)) {
                if (isOpera && Y.Dom.getStyle(parentNode, 'display') != 'inline') { pos[0] -= parentNode.scrollLeft; pos[1] -= parentNode.scrollTop; }
                parentNode = parentNode.parentNode;
            }
            return pos;
        }; return Y.Dom.batch(el, f, Y.Dom, true);
    }, getX: function (el) { var f = function (el) { return Y.Dom.getXY(el)[0]; }; return Y.Dom.batch(el, f, Y.Dom, true); }, getY: function (el) { var f = function (el) { return Y.Dom.getXY(el)[1]; }; return Y.Dom.batch(el, f, Y.Dom, true); }, setXY: function (el, pos, noRetry) {
        var f = function (el) {
            var style_pos = this.getStyle(el, 'position'); if (style_pos == 'static') { this.setStyle(el, 'position', 'relative'); style_pos = 'relative'; }
            var pageXY = this.getXY(el); if (pageXY === false) { return false; }
            var delta = [parseInt(this.getStyle(el, 'left'), 10), parseInt(this.getStyle(el, 'top'), 10)]; if (isNaN(delta[0])) { delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft; }
            if (isNaN(delta[1])) { delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop; }
            if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
            if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
            if (!noRetry) { var newXY = this.getXY(el); if ((pos[0] !== null && newXY[0] != pos[0]) || (pos[1] !== null && newXY[1] != pos[1])) { this.setXY(el, pos, true); } }
        }; Y.Dom.batch(el, f, Y.Dom, true);
    }, setX: function (el, x) { Y.Dom.setXY(el, [x, null]); }, setY: function (el, y) { Y.Dom.setXY(el, [null, y]); }, getRegion: function (el) { var f = function (el) { var region = new Y.Region.getRegion(el); return region; }; return Y.Dom.batch(el, f, Y.Dom, true); }, getClientWidth: function () { return Y.Dom.getViewportWidth(); }, getClientHeight: function () { return Y.Dom.getViewportHeight(); }, getElementsByClassName: function (className, tag, root) { var method = function (el) { return Y.Dom.hasClass(el, className); }; return Y.Dom.getElementsBy(method, tag, root); }, hasClass: function (el, className) { var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)'); var f = function (el) { return re.test(el.className); }; return Y.Dom.batch(el, f, Y.Dom, true); }, addClass: function (el, className) {
        var f = function (el) {
            if (this.hasClass(el, className)) { return; }
            el.className = [el.className, className].join(' ');
        }; Y.Dom.batch(el, f, Y.Dom, true);
    }, removeClass: function (el, className) {
        var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g'); var f = function (el) {
            if (!this.hasClass(el, className)) { return; }
            var c = el.className; el.className = c.replace(re, ' '); if (this.hasClass(el, className)) { this.removeClass(el, className); }
        }; Y.Dom.batch(el, f, Y.Dom, true);
    }, replaceClass: function (el, oldClassName, newClassName) {
        if (oldClassName === newClassName) { return false; }
        var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g'); var f = function (el) {
            if (!this.hasClass(el, oldClassName)) { this.addClass(el, newClassName); return; }
            el.className = el.className.replace(re, ' ' + newClassName + ' '); if (this.hasClass(el, oldClassName)) { this.replaceClass(el, oldClassName, newClassName); }
        }; Y.Dom.batch(el, f, Y.Dom, true);
    }, generateId: function (el, prefix) {
        prefix = prefix || 'yui-gen'; el = el || {}; var f = function (el) {
            if (el) { el = Y.Dom.get(el); } else { el = {}; }
            if (!el.id) { el.id = prefix + id_counter++; }
            return el.id;
        }; return Y.Dom.batch(el, f, Y.Dom, true);
    }, isAncestor: function (haystack, needle) {
        haystack = Y.Dom.get(haystack); if (!haystack || !needle) { return false; }
        var f = function (needle) {
            if (haystack.contains && !isSafari) { return haystack.contains(needle); }
            else if (haystack.compareDocumentPosition) { return !!(haystack.compareDocumentPosition(needle) & 16); }
            else {
                var parent = needle.parentNode; while (parent) {
                    if (parent == haystack) { return true; }
                    else if (!parent.tagName || parent.tagName.toUpperCase() == 'HTML') { return false; }
                    parent = parent.parentNode;
                }
                return false;
            }
        }; return Y.Dom.batch(needle, f, Y.Dom, true);
    }, inDocument: function (el) { var f = function (el) { return this.isAncestor(document.documentElement, el); }; return Y.Dom.batch(el, f, Y.Dom, true); }, getElementsBy: function (method, tag, root) {
        tag = tag || '*'; var nodes = []; if (root) { root = Y.Dom.get(root); if (!root) { return nodes; } } else { root = document; }
        var elements = root.getElementsByTagName(tag); if (!elements.length && (tag == '*' && root.all)) { elements = root.all; }
        for (var i = 0, len = elements.length; i < len; ++i) { if (method(elements[i])) { nodes[nodes.length] = elements[i]; } }
        return nodes;
    }, batch: function (el, method, o, override) {
        var id = el; el = Y.Dom.get(el); var scope = (override) ? o : window; if (!el || el.tagName || !el.length) {
            if (!el) { return false; }
            return method.call(scope, el, o);
        }
        var collection = []; for (var i = 0, len = el.length; i < len; ++i) {
            if (!el[i]) { id = el[i]; }
            collection[collection.length] = method.call(scope, el[i], o);
        }
        return collection;
    }, getDocumentHeight: function () { var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight; var h = Math.max(scrollHeight, Y.Dom.getViewportHeight()); return h; }, getDocumentWidth: function () { var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth; var w = Math.max(scrollWidth, Y.Dom.getViewportWidth()); return w; }, getViewportHeight: function () {
        var height = self.innerHeight; var mode = document.compatMode; if ((mode || isIE) && !isOpera) { height = (mode == 'CSS1Compat') ? document.documentElement.clientHeight : document.body.clientHeight; }
        return height;
    }, getViewportWidth: function () {
        var width = self.innerWidth; var mode = document.compatMode; if (mode || isIE) { width = (mode == 'CSS1Compat') ? document.documentElement.clientWidth : document.body.clientWidth; }
        return width;
    }
    };
})(); YAHOO.util.Region = function (t, r, b, l) { this.top = t; this[1] = t; this.right = r; this.bottom = b; this.left = l; this[0] = l; }; YAHOO.util.Region.prototype.contains = function (region) { return (region.left >= this.left && region.right <= this.right && region.top >= this.top && region.bottom <= this.bottom); }; YAHOO.util.Region.prototype.getArea = function () { return ((this.bottom - this.top) * (this.right - this.left)); }; YAHOO.util.Region.prototype.intersect = function (region) { var t = Math.max(this.top, region.top); var r = Math.min(this.right, region.right); var b = Math.min(this.bottom, region.bottom); var l = Math.max(this.left, region.left); if (b >= t && r >= l) { return new YAHOO.util.Region(t, r, b, l); } else { return null; } }; YAHOO.util.Region.prototype.union = function (region) { var t = Math.min(this.top, region.top); var r = Math.max(this.right, region.right); var b = Math.max(this.bottom, region.bottom); var l = Math.min(this.left, region.left); return new YAHOO.util.Region(t, r, b, l); }; YAHOO.util.Region.prototype.toString = function () { return ("Region {" + "top: " + this.top + ", right: " + this.right + ", bottom: " + this.bottom + ", left: " + this.left + "}"); }; YAHOO.util.Region.getRegion = function (el) { var p = YAHOO.util.Dom.getXY(el); var t = p[1]; var r = p[0] + el.offsetWidth; var b = p[1] + el.offsetHeight; var l = p[0]; return new YAHOO.util.Region(t, r, b, l); }; YAHOO.util.Point = function (x, y) {
    if (x instanceof Array) { y = x[1]; x = x[0]; }
    this.x = this.right = this.left = this[0] = x; this.y = this.top = this.bottom = this[1] = y;
}; YAHOO.util.Point.prototype = new YAHOO.util.Region(); YAHOO.register("dom", YAHOO.util.Dom, { version: "2.2.1", build: "193" });

/* event */
YAHOO.util.CustomEvent = function (type, oScope, silent, signature) {
    this.type = type; this.scope = oScope || window; this.silent = silent; this.signature = signature || YAHOO.util.CustomEvent.LIST; this.subscribers = []; if (!this.silent) { }
    var onsubscribeType = "_YUICEOnSubscribe"; if (type !== onsubscribeType) { this.subscribeEvent = new YAHOO.util.CustomEvent(onsubscribeType, this, true); }
}; YAHOO.util.CustomEvent.LIST = 0; YAHOO.util.CustomEvent.FLAT = 1; YAHOO.util.CustomEvent.prototype = { subscribe: function (fn, obj, override) {
    if (!fn) { throw new Error("Invalid callback for subscriber to '" + this.type + "'"); }
    if (this.subscribeEvent) { this.subscribeEvent.fire(fn, obj, override); }
    this.subscribers.push(new YAHOO.util.Subscriber(fn, obj, override));
}, unsubscribe: function (fn, obj) {
    if (!fn) { return this.unsubscribeAll(); }
    var found = false; for (var i = 0, len = this.subscribers.length; i < len; ++i) { var s = this.subscribers[i]; if (s && s.contains(fn, obj)) { this._delete(i); found = true; } }
    return found;
}, fire: function () {
    var len = this.subscribers.length; if (!len && this.silent) { return true; }
    var args = [], ret = true, i; for (i = 0; i < arguments.length; ++i) { args.push(arguments[i]); }
    var argslength = args.length; if (!this.silent) { }
    for (i = 0; i < len; ++i) {
        var s = this.subscribers[i]; if (s) {
            if (!this.silent) { }
            var scope = s.getScope(this.scope); if (this.signature == YAHOO.util.CustomEvent.FLAT) {
                var param = null; if (args.length > 0) { param = args[0]; }
                ret = s.fn.call(scope, param, s.obj);
            } else { ret = s.fn.call(scope, this.type, args, s.obj); }
            if (false === ret) {
                if (!this.silent) { }
                return false;
            }
        }
    }
    return true;
}, unsubscribeAll: function () {
    for (var i = 0, len = this.subscribers.length; i < len; ++i) { this._delete(len - 1 - i); }
    return i;
}, _delete: function (index) {
    var s = this.subscribers[index]; if (s) { delete s.fn; delete s.obj; }
    this.subscribers.splice(index, 1);
}, toString: function () { return "CustomEvent: " + "'" + this.type + "', " + "scope: " + this.scope; }
}; YAHOO.util.Subscriber = function (fn, obj, override) { this.fn = fn; this.obj = obj || null; this.override = override; }; YAHOO.util.Subscriber.prototype.getScope = function (defaultScope) {
    if (this.override) { if (this.override === true) { return this.obj; } else { return this.override; } }
    return defaultScope;
}; YAHOO.util.Subscriber.prototype.contains = function (fn, obj) { if (obj) { return (this.fn == fn && this.obj == obj); } else { return (this.fn == fn); } }; YAHOO.util.Subscriber.prototype.toString = function () { return "Subscriber { obj: " + (this.obj || "") + ", override: " + (this.override || "no") + " }"; }; if (!YAHOO.util.Event) {
    YAHOO.util.Event = function () {
        var loadComplete = false; var DOMReady = false; var listeners = []; var unloadListeners = []; var legacyEvents = []; var legacyHandlers = []; var retryCount = 0; var onAvailStack = []; var legacyMap = []; var counter = 0; var lastError = null; return { POLL_RETRYS: 200, POLL_INTERVAL: 10, EL: 0, TYPE: 1, FN: 2, WFN: 3, OBJ: 3, ADJ_SCOPE: 4, isSafari: (/KHTML/gi).test(navigator.userAgent), webkit: function () {
            var v = navigator.userAgent.match(/AppleWebKit\/([^ ]*)/); if (v && v[1]) { return v[1]; }
            return null;
        } (), isIE: (!this.webkit && !navigator.userAgent.match(/opera/gi) && navigator.userAgent.match(/msie/gi)), _interval: null, startInterval: function () { if (!this._interval) { var self = this; var callback = function () { self._tryPreloadAttach(); }; this._interval = setInterval(callback, this.POLL_INTERVAL); } }, onAvailable: function (p_id, p_fn, p_obj, p_override) { onAvailStack.push({ id: p_id, fn: p_fn, obj: p_obj, override: p_override, checkReady: false }); retryCount = this.POLL_RETRYS; this.startInterval(); }, onDOMReady: function (p_fn, p_obj, p_override) { this.DOMReadyEvent.subscribe(p_fn, p_obj, p_override); }, onContentReady: function (p_id, p_fn, p_obj, p_override) { onAvailStack.push({ id: p_id, fn: p_fn, obj: p_obj, override: p_override, checkReady: true }); retryCount = this.POLL_RETRYS; this.startInterval(); }, addListener: function (el, sType, fn, obj, override) {
            if (!fn || !fn.call) { return false; }
            if (this._isValidCollection(el)) {
                var ok = true; for (var i = 0, len = el.length; i < len; ++i) { ok = this.on(el[i], sType, fn, obj, override) && ok; }
                return ok;
            } else if (typeof el == "string") { var oEl = this.getEl(el); if (oEl) { el = oEl; } else { this.onAvailable(el, function () { YAHOO.util.Event.on(el, sType, fn, obj, override); }); return true; } }
            if (!el) { return false; }
            if ("unload" == sType && obj !== this) { unloadListeners[unloadListeners.length] = [el, sType, fn, obj, override]; return true; }
            var scope = el; if (override) { if (override === true) { scope = obj; } else { scope = override; } }
            var wrappedFn = function (e) { return fn.call(scope, YAHOO.util.Event.getEvent(e), obj); }; var li = [el, sType, fn, wrappedFn, scope]; var index = listeners.length; listeners[index] = li; if (this.useLegacyEvent(el, sType)) {
                var legacyIndex = this.getLegacyIndex(el, sType); if (legacyIndex == -1 || el != legacyEvents[legacyIndex][0]) { legacyIndex = legacyEvents.length; legacyMap[el.id + sType] = legacyIndex; legacyEvents[legacyIndex] = [el, sType, el["on" + sType]]; legacyHandlers[legacyIndex] = []; el["on" + sType] = function (e) { YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e), legacyIndex); }; }
                legacyHandlers[legacyIndex].push(li);
            } else { try { this._simpleAdd(el, sType, wrappedFn, false); } catch (ex) { this.lastError = ex; this.removeListener(el, sType, fn); return false; } }
            return true;
        }, fireLegacyEvent: function (e, legacyIndex) {
            var ok = true, le, lh, li, scope, ret; lh = legacyHandlers[legacyIndex]; for (var i = 0, len = lh.length; i < len; ++i) { li = lh[i]; if (li && li[this.WFN]) { scope = li[this.ADJ_SCOPE]; ret = li[this.WFN].call(scope, e); ok = (ok && ret); } }
            le = legacyEvents[legacyIndex]; if (le && le[2]) { le[2](e); }
            return ok;
        }, getLegacyIndex: function (el, sType) { var key = this.generateId(el) + sType; if (typeof legacyMap[key] == "undefined") { return -1; } else { return legacyMap[key]; } }, useLegacyEvent: function (el, sType) {
            if (this.webkit && ("click" == sType || "dblclick" == sType)) { var v = parseInt(this.webkit, 10); if (!isNaN(v) && v < 418) { return true; } }
            return false;
        }, removeListener: function (el, sType, fn) {
            var i, len; if (typeof el == "string") { el = this.getEl(el); } else if (this._isValidCollection(el)) {
                var ok = true; for (i = 0, len = el.length; i < len; ++i) { ok = (this.removeListener(el[i], sType, fn) && ok); }
                return ok;
            }
            if (!fn || !fn.call) { return this.purgeElement(el, false, sType); }
            if ("unload" == sType) {
                for (i = 0, len = unloadListeners.length; i < len; i++) { var li = unloadListeners[i]; if (li && li[0] == el && li[1] == sType && li[2] == fn) { unloadListeners.splice(i, 1); return true; } }
                return false;
            }
            var cacheItem = null; var index = arguments[3]; if ("undefined" == typeof index) { index = this._getCacheIndex(el, sType, fn); }
            if (index >= 0) { cacheItem = listeners[index]; }
            if (!el || !cacheItem) { return false; }
            if (this.useLegacyEvent(el, sType)) { var legacyIndex = this.getLegacyIndex(el, sType); var llist = legacyHandlers[legacyIndex]; if (llist) { for (i = 0, len = llist.length; i < len; ++i) { li = llist[i]; if (li && li[this.EL] == el && li[this.TYPE] == sType && li[this.FN] == fn) { llist.splice(i, 1); break; } } } } else { try { this._simpleRemove(el, sType, cacheItem[this.WFN], false); } catch (ex) { this.lastError = ex; return false; } }
            delete listeners[index][this.WFN]; delete listeners[index][this.FN]; listeners.splice(index, 1); return true;
        }, getTarget: function (ev, resolveTextNode) { var t = ev.target || ev.srcElement; return this.resolveTextNode(t); }, resolveTextNode: function (node) { if (node && 3 == node.nodeType) { return node.parentNode; } else { return node; } }, getPageX: function (ev) {
            var x = ev.pageX; if (!x && 0 !== x) { x = ev.clientX || 0; if (this.isIE) { x += this._getScrollLeft(); } }
            return x;
        }, getPageY: function (ev) {
            var y = ev.pageY; if (!y && 0 !== y) { y = ev.clientY || 0; if (this.isIE) { y += this._getScrollTop(); } }
            return y;
        }, getXY: function (ev) { return [this.getPageX(ev), this.getPageY(ev)]; }, getRelatedTarget: function (ev) {
            var t = ev.relatedTarget; if (!t) { if (ev.type == "mouseout") { t = ev.toElement; } else if (ev.type == "mouseover") { t = ev.fromElement; } }
            return this.resolveTextNode(t);
        }, getTime: function (ev) {
            if (!ev.time) { var t = new Date().getTime(); try { ev.time = t; } catch (ex) { this.lastError = ex; return t; } }
            return ev.time;
        }, stopEvent: function (ev) { this.stopPropagation(ev); this.preventDefault(ev); }, stopPropagation: function (ev) { if (ev.stopPropagation) { ev.stopPropagation(); } else { ev.cancelBubble = true; } }, preventDefault: function (ev) { if (ev.preventDefault) { ev.preventDefault(); } else { ev.returnValue = false; } }, getEvent: function (e) {
            var ev = e || window.event; if (!ev) {
                var c = this.getEvent.caller; while (c) {
                    ev = c.arguments[0]; if (ev && Event == ev.constructor) { break; }
                    c = c.caller;
                }
            }
            return ev;
        }, getCharCode: function (ev) { return ev.charCode || ev.keyCode || 0; }, _getCacheIndex: function (el, sType, fn) {
            for (var i = 0, len = listeners.length; i < len; ++i) { var li = listeners[i]; if (li && li[this.FN] == fn && li[this.EL] == el && li[this.TYPE] == sType) { return i; } }
            return -1;
        }, generateId: function (el) {
            var id = el.id; if (!id) { id = "yuievtautoid-" + counter; ++counter; el.id = id; }
            return id;
        }, _isValidCollection: function (o) { return (o && o.length && typeof o != "string" && !o.tagName && !o.alert && typeof o[0] != "undefined"); }, elCache: {}, getEl: function (id) { return document.getElementById(id); }, clearCache: function () { }, DOMReadyEvent: new YAHOO.util.CustomEvent("DOMReady", this), _load: function (e) { if (!loadComplete) { loadComplete = true; var EU = YAHOO.util.Event; EU._ready(); if (this.isIE) { EU._simpleRemove(window, "load", EU._load); } } }, _ready: function (e) { if (!DOMReady) { DOMReady = true; var EU = YAHOO.util.Event; EU.DOMReadyEvent.fire(); EU._simpleRemove(document, "DOMContentLoaded", EU._ready); } }, _tryPreloadAttach: function () {
            if (this.locked) { return false; }
            if (this.isIE && !DOMReady) { return false; }
            this.locked = true; var tryAgain = !loadComplete; if (!tryAgain) { tryAgain = (retryCount > 0); }
            var notAvail = []; var executeItem = function (el, item) {
                var scope = el; if (item.override) { if (item.override === true) { scope = item.obj; } else { scope = item.override; } }
                item.fn.call(scope, item.obj);
            }; var i, len, item, el; for (i = 0, len = onAvailStack.length; i < len; ++i) { item = onAvailStack[i]; if (item && !item.checkReady) { el = this.getEl(item.id); if (el) { executeItem(el, item); onAvailStack[i] = null; } else { notAvail.push(item); } } }
            for (i = 0, len = onAvailStack.length; i < len; ++i) { item = onAvailStack[i]; if (item && item.checkReady) { el = this.getEl(item.id); if (el) { if (loadComplete || el.nextSibling) { executeItem(el, item); onAvailStack[i] = null; } } else { notAvail.push(item); } } }
            retryCount = (notAvail.length === 0) ? 0 : retryCount - 1; if (tryAgain) { this.startInterval(); } else { clearInterval(this._interval); this._interval = null; }
            this.locked = false; return true;
        }, purgeElement: function (el, recurse, sType) {
            var elListeners = this.getListeners(el, sType); if (elListeners) { for (var i = 0, len = elListeners.length; i < len; ++i) { var l = elListeners[i]; this.removeListener(el, l.type, l.fn); } }
            if (recurse && el && el.childNodes) { for (i = 0, len = el.childNodes.length; i < len; ++i) { this.purgeElement(el.childNodes[i], recurse, sType); } }
        }, getListeners: function (el, sType) {
            var results = [], searchLists; if (!sType) { searchLists = [listeners, unloadListeners]; } else if (sType == "unload") { searchLists = [unloadListeners]; } else { searchLists = [listeners]; }
            for (var j = 0; j < searchLists.length; ++j) { var searchList = searchLists[j]; if (searchList && searchList.length > 0) { for (var i = 0, len = searchList.length; i < len; ++i) { var l = searchList[i]; if (l && l[this.EL] === el && (!sType || sType === l[this.TYPE])) { results.push({ type: l[this.TYPE], fn: l[this.FN], obj: l[this.OBJ], adjust: l[this.ADJ_SCOPE], index: i }); } } } }
            return (results.length) ? results : null;
        }, _unload: function (e) {
            var EU = YAHOO.util.Event, i, j, l, len, index; for (i = 0, len = unloadListeners.length; i < len; ++i) {
                l = unloadListeners[i]; if (l) {
                    var scope = window; if (l[EU.ADJ_SCOPE]) { if (l[EU.ADJ_SCOPE] === true) { scope = l[EU.OBJ]; } else { scope = l[EU.ADJ_SCOPE]; } }
                    l[EU.FN].call(scope, EU.getEvent(e), l[EU.OBJ]); unloadListeners[i] = null; l = null; scope = null;
                }
            }
            unloadListeners = null; if (listeners && listeners.length > 0) {
                j = listeners.length; while (j) {
                    index = j - 1; l = listeners[index]; if (l) { EU.removeListener(l[EU.EL], l[EU.TYPE], l[EU.FN], index); }
                    j = j - 1;
                }
                l = null; EU.clearCache();
            }
            for (i = 0, len = legacyEvents.length; i < len; ++i) { legacyEvents[i][0] = null; legacyEvents[i] = null; }
            legacyEvents = null; EU._simpleRemove(window, "unload", EU._unload);
        }, _getScrollLeft: function () { return this._getScroll()[1]; }, _getScrollTop: function () { return this._getScroll()[0]; }, _getScroll: function () { var dd = document.documentElement, db = document.body; if (dd && (dd.scrollTop || dd.scrollLeft)) { return [dd.scrollTop, dd.scrollLeft]; } else if (db) { return [db.scrollTop, db.scrollLeft]; } else { return [0, 0]; } }, regCE: function () { }, _simpleAdd: function () { if (window.addEventListener) { return function (el, sType, fn, capture) { el.addEventListener(sType, fn, (capture)); }; } else if (window.attachEvent) { return function (el, sType, fn, capture) { el.attachEvent("on" + sType, fn); }; } else { return function () { }; } } (), _simpleRemove: function () { if (window.removeEventListener) { return function (el, sType, fn, capture) { el.removeEventListener(sType, fn, (capture)); }; } else if (window.detachEvent) { return function (el, sType, fn) { el.detachEvent("on" + sType, fn); }; } else { return function () { }; } } ()
        };
    } (); (function () {
        var EU = YAHOO.util.Event; EU.on = EU.addListener; if (EU.isIE) { document.write('<scr' + 'ipt id="_yui_eu_dr" defer="true" src="//:"></script>'); var el = document.getElementById("_yui_eu_dr"); el.onreadystatechange = function () { if ("complete" == this.readyState) { this.parentNode.removeChild(this); YAHOO.util.Event._ready(); } }; el = null; YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach, YAHOO.util.Event, true); } else if (EU.webkit) { EU._drwatch = setInterval(function () { var rs = document.readyState; if ("loaded" == rs || "complete" == rs) { clearInterval(EU._drwatch); EU._drwatch = null; EU._ready(); } }, EU.POLL_INTERVAL); } else { EU._simpleAdd(document, "DOMContentLoaded", EU._ready); }
        EU._simpleAdd(window, "load", EU._load); EU._simpleAdd(window, "unload", EU._unload); EU._tryPreloadAttach();
    })();
}
YAHOO.util.EventProvider = function () { }; YAHOO.util.EventProvider.prototype = { __yui_events: null, __yui_subscribers: null, subscribe: function (p_type, p_fn, p_obj, p_override) {
    this.__yui_events = this.__yui_events || {}; var ce = this.__yui_events[p_type]; if (ce) { ce.subscribe(p_fn, p_obj, p_override); } else {
        this.__yui_subscribers = this.__yui_subscribers || {}; var subs = this.__yui_subscribers; if (!subs[p_type]) { subs[p_type] = []; }
        subs[p_type].push({ fn: p_fn, obj: p_obj, override: p_override });
    }
}, unsubscribe: function (p_type, p_fn, p_obj) { this.__yui_events = this.__yui_events || {}; var ce = this.__yui_events[p_type]; if (ce) { return ce.unsubscribe(p_fn, p_obj); } else { return false; } }, unsubscribeAll: function (p_type) { return this.unsubscribe(p_type); }, createEvent: function (p_type, p_config) {
    this.__yui_events = this.__yui_events || {}; var opts = p_config || {}; var events = this.__yui_events; if (events[p_type]) { } else {
        var scope = opts.scope || this; var silent = opts.silent || null; var ce = new YAHOO.util.CustomEvent(p_type, scope, silent, YAHOO.util.CustomEvent.FLAT); events[p_type] = ce; if (opts.onSubscribeCallback) { ce.subscribeEvent.subscribe(opts.onSubscribeCallback); }
        this.__yui_subscribers = this.__yui_subscribers || {}; var qs = this.__yui_subscribers[p_type]; if (qs) { for (var i = 0; i < qs.length; ++i) { ce.subscribe(qs[i].fn, qs[i].obj, qs[i].override); } }
    }
    return events[p_type];
}, fireEvent: function (p_type, arg1, arg2, etc) {
    this.__yui_events = this.__yui_events || {}; var ce = this.__yui_events[p_type]; if (ce) {
        var args = []; for (var i = 1; i < arguments.length; ++i) { args.push(arguments[i]); }
        return ce.fire.apply(ce, args);
    } else { return null; }
}, hasEvent: function (type) {
    if (this.__yui_events) { if (this.__yui_events[type]) { return true; } }
    return false;
}
}; YAHOO.util.KeyListener = function (attachTo, keyData, handler, event) {
    if (!attachTo) { } else if (!keyData) { } else if (!handler) { }
    if (!event) { event = YAHOO.util.KeyListener.KEYDOWN; }
    var keyEvent = new YAHOO.util.CustomEvent("keyPressed"); this.enabledEvent = new YAHOO.util.CustomEvent("enabled"); this.disabledEvent = new YAHOO.util.CustomEvent("disabled"); if (typeof attachTo == 'string') { attachTo = document.getElementById(attachTo); }
    if (typeof handler == 'function') { keyEvent.subscribe(handler); } else { keyEvent.subscribe(handler.fn, handler.scope, handler.correctScope); }
    function handleKeyPress(e, obj) {
        if (!keyData.shift) { keyData.shift = false; }
        if (!keyData.alt) { keyData.alt = false; }
        if (!keyData.ctrl) { keyData.ctrl = false; }
        if (e.shiftKey == keyData.shift && e.altKey == keyData.alt && e.ctrlKey == keyData.ctrl) { var dataItem; var keyPressed; if (keyData.keys instanceof Array) { for (var i = 0; i < keyData.keys.length; i++) { dataItem = keyData.keys[i]; if (dataItem == e.charCode) { keyEvent.fire(e.charCode, e); break; } else if (dataItem == e.keyCode) { keyEvent.fire(e.keyCode, e); break; } } } else { dataItem = keyData.keys; if (dataItem == e.charCode) { keyEvent.fire(e.charCode, e); } else if (dataItem == e.keyCode) { keyEvent.fire(e.keyCode, e); } } }
    }
    this.enable = function () {
        if (!this.enabled) { YAHOO.util.Event.addListener(attachTo, event, handleKeyPress); this.enabledEvent.fire(keyData); }
        this.enabled = true;
    }; this.disable = function () {
        if (this.enabled) { YAHOO.util.Event.removeListener(attachTo, event, handleKeyPress); this.disabledEvent.fire(keyData); }
        this.enabled = false;
    }; this.toString = function () {
        return "KeyListener [" + keyData.keys + "] " + attachTo.tagName +
(attachTo.id ? "[" + attachTo.id + "]" : "");
    };
}; YAHOO.util.KeyListener.KEYDOWN = "keydown"; YAHOO.util.KeyListener.KEYUP = "keyup"; YAHOO.register("event", YAHOO.util.Event, { version: "2.2.1", build: "193" });

/* animation */
YAHOO.util.Anim = function (el, attributes, duration, method) { if (el) { this.init(el, attributes, duration, method); } }; YAHOO.util.Anim.prototype = { toString: function () { var el = this.getEl(); var id = el.id || el.tagName; return ("Anim " + id); }, patterns: { noNegatives: /width|height|opacity|padding/i, offsetAttribute: /^((width|height)|(top|left))$/, defaultUnit: /width|height|top$|bottom$|left$|right$/i, offsetUnit: /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i }, doMethod: function (attr, start, end) { return this.method(this.currentFrame, start, end - start, this.totalFrames); }, setAttribute: function (attr, val, unit) {
    if (this.patterns.noNegatives.test(attr)) { val = (val > 0) ? val : 0; }
    YAHOO.util.Dom.setStyle(this.getEl(), attr, val + unit);
}, getAttribute: function (attr) {
    var el = this.getEl(); var val = YAHOO.util.Dom.getStyle(el, attr); if (val !== 'auto' && !this.patterns.offsetUnit.test(val)) { return parseFloat(val); }
    var a = this.patterns.offsetAttribute.exec(attr) || []; var pos = !!(a[3]); var box = !!(a[2]); if (box || (YAHOO.util.Dom.getStyle(el, 'position') == 'absolute' && pos)) { val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)]; } else { val = 0; }
    return val;
}, getDefaultUnit: function (attr) {
    if (this.patterns.defaultUnit.test(attr)) { return 'px'; }
    return '';
}, setRuntimeAttribute: function (attr) {
    var start; var end; var attributes = this.attributes; this.runtimeAttributes[attr] = {}; var isset = function (prop) { return (typeof prop !== 'undefined'); }; if (!isset(attributes[attr]['to']) && !isset(attributes[attr]['by'])) { return false; }
    start = (isset(attributes[attr]['from'])) ? attributes[attr]['from'] : this.getAttribute(attr); if (isset(attributes[attr]['to'])) { end = attributes[attr]['to']; } else if (isset(attributes[attr]['by'])) { if (start.constructor == Array) { end = []; for (var i = 0, len = start.length; i < len; ++i) { end[i] = start[i] + attributes[attr]['by'][i]; } } else { end = start + attributes[attr]['by']; } }
    this.runtimeAttributes[attr].start = start; this.runtimeAttributes[attr].end = end; this.runtimeAttributes[attr].unit = (isset(attributes[attr].unit)) ? attributes[attr]['unit'] : this.getDefaultUnit(attr);
}, init: function (el, attributes, duration, method) {
    var isAnimated = false; var startTime = null; var actualFrames = 0; el = YAHOO.util.Dom.get(el); this.attributes = attributes || {}; this.duration = duration || 1; this.method = method || YAHOO.util.Easing.easeNone; this.useSeconds = true; this.currentFrame = 0; this.totalFrames = YAHOO.util.AnimMgr.fps; this.getEl = function () { return el; }; this.isAnimated = function () { return isAnimated; }; this.getStartTime = function () { return startTime; }; this.runtimeAttributes = {}; this.animate = function () {
        if (this.isAnimated()) { return false; }
        this.currentFrame = 0; this.totalFrames = (this.useSeconds) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration; YAHOO.util.AnimMgr.registerElement(this);
    }; this.stop = function (finish) {
        if (finish) { this.currentFrame = this.totalFrames; this._onTween.fire(); }
        YAHOO.util.AnimMgr.stop(this);
    }; var onStart = function () {
        this.onStart.fire(); this.runtimeAttributes = {}; for (var attr in this.attributes) { this.setRuntimeAttribute(attr); }
        isAnimated = true; actualFrames = 0; startTime = new Date();
    }; var onTween = function () {
        var data = { duration: new Date() - this.getStartTime(), currentFrame: this.currentFrame }; data.toString = function () { return ('duration: ' + data.duration + ', currentFrame: ' + data.currentFrame); }; this.onTween.fire(data); var runtimeAttributes = this.runtimeAttributes; for (var attr in runtimeAttributes) { this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit); }
        actualFrames += 1;
    }; var onComplete = function () { var actual_duration = (new Date() - startTime) / 1000; var data = { duration: actual_duration, frames: actualFrames, fps: actualFrames / actual_duration }; data.toString = function () { return ('duration: ' + data.duration + ', frames: ' + data.frames + ', fps: ' + data.fps); }; isAnimated = false; actualFrames = 0; this.onComplete.fire(data); }; this._onStart = new YAHOO.util.CustomEvent('_start', this, true); this.onStart = new YAHOO.util.CustomEvent('start', this); this.onTween = new YAHOO.util.CustomEvent('tween', this); this._onTween = new YAHOO.util.CustomEvent('_tween', this, true); this.onComplete = new YAHOO.util.CustomEvent('complete', this); this._onComplete = new YAHOO.util.CustomEvent('_complete', this, true); this._onStart.subscribe(onStart); this._onTween.subscribe(onTween); this._onComplete.subscribe(onComplete);
}
}; YAHOO.util.AnimMgr = new function () {
    var thread = null; var queue = []; var tweenCount = 0; this.fps = 1000; this.delay = 1; this.registerElement = function (tween) { queue[queue.length] = tween; tweenCount += 1; tween._onStart.fire(); this.start(); }; this.unRegister = function (tween, index) {
        tween._onComplete.fire(); index = index || getIndex(tween); if (index != -1) { queue.splice(index, 1); }
        tweenCount -= 1; if (tweenCount <= 0) { this.stop(); }
    }; this.start = function () { if (thread === null) { thread = setInterval(this.run, this.delay); } }; this.stop = function (tween) {
        if (!tween) {
            clearInterval(thread); for (var i = 0, len = queue.length; i < len; ++i) { if (queue[0].isAnimated()) { this.unRegister(queue[0], 0); } }
            queue = []; thread = null; tweenCount = 0;
        }
        else { this.unRegister(tween); }
    }; this.run = function () {
        for (var i = 0, len = queue.length; i < len; ++i) {
            var tween = queue[i]; if (!tween || !tween.isAnimated()) { continue; }
            if (tween.currentFrame < tween.totalFrames || tween.totalFrames === null) {
                tween.currentFrame += 1; if (tween.useSeconds) { correctFrame(tween); }
                tween._onTween.fire();
            }
            else { YAHOO.util.AnimMgr.stop(tween, i); }
        }
    }; var getIndex = function (anim) {
        for (var i = 0, len = queue.length; i < len; ++i) { if (queue[i] == anim) { return i; } }
        return -1;
    }; var correctFrame = function (tween) {
        var frames = tween.totalFrames; var frame = tween.currentFrame; var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames); var elapsed = (new Date() - tween.getStartTime()); var tweak = 0; if (elapsed < tween.duration * 1000) { tweak = Math.round((elapsed / expected - 1) * tween.currentFrame); } else { tweak = frames - (frame + 1); }
        if (tweak > 0 && isFinite(tweak)) {
            if (tween.currentFrame + tweak >= frames) { tweak = frames - (frame + 1); }
            tween.currentFrame += tweak;
        }
    };
}; YAHOO.util.Bezier = new function () {
    this.getPosition = function (points, t) {
        var n = points.length; var tmp = []; for (var i = 0; i < n; ++i) { tmp[i] = [points[i][0], points[i][1]]; }
        for (var j = 1; j < n; ++j) { for (i = 0; i < n - j; ++i) { tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0]; tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1]; } }
        return [tmp[0][0], tmp[0][1]];
    };
}; (function () {
    YAHOO.util.ColorAnim = function (el, attributes, duration, method) { YAHOO.util.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method); }; YAHOO.extend(YAHOO.util.ColorAnim, YAHOO.util.Anim); var Y = YAHOO.util; var superclass = Y.ColorAnim.superclass; var proto = Y.ColorAnim.prototype; proto.toString = function () { var el = this.getEl(); var id = el.id || el.tagName; return ("ColorAnim " + id); }; proto.patterns.color = /color$/i; proto.patterns.rgb = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i; proto.patterns.hex = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i; proto.patterns.hex3 = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i; proto.patterns.transparent = /^transparent|rgba\(0, 0, 0, 0\)$/; proto.parseColor = function (s) {
        if (s.length == 3) { return s; }
        var c = this.patterns.hex.exec(s); if (c && c.length == 4) { return [parseInt(c[1], 16), parseInt(c[2], 16), parseInt(c[3], 16)]; }
        c = this.patterns.rgb.exec(s); if (c && c.length == 4) { return [parseInt(c[1], 10), parseInt(c[2], 10), parseInt(c[3], 10)]; }
        c = this.patterns.hex3.exec(s); if (c && c.length == 4) { return [parseInt(c[1] + c[1], 16), parseInt(c[2] + c[2], 16), parseInt(c[3] + c[3], 16)]; }
        return null;
    }; proto.getAttribute = function (attr) {
        var el = this.getEl(); if (this.patterns.color.test(attr)) { var val = YAHOO.util.Dom.getStyle(el, attr); if (this.patterns.transparent.test(val)) { var parent = el.parentNode; val = Y.Dom.getStyle(parent, attr); while (parent && this.patterns.transparent.test(val)) { parent = parent.parentNode; val = Y.Dom.getStyle(parent, attr); if (parent.tagName.toUpperCase() == 'HTML') { val = '#fff'; } } } } else { val = superclass.getAttribute.call(this, attr); }
        return val;
    }; proto.doMethod = function (attr, start, end) {
        var val; if (this.patterns.color.test(attr)) {
            val = []; for (var i = 0, len = start.length; i < len; ++i) { val[i] = superclass.doMethod.call(this, attr, start[i], end[i]); }
            val = 'rgb(' + Math.floor(val[0]) + ',' + Math.floor(val[1]) + ',' + Math.floor(val[2]) + ')';
        }
        else { val = superclass.doMethod.call(this, attr, start, end); }
        return val;
    }; proto.setRuntimeAttribute = function (attr) {
        superclass.setRuntimeAttribute.call(this, attr); if (this.patterns.color.test(attr)) {
            var attributes = this.attributes; var start = this.parseColor(this.runtimeAttributes[attr].start); var end = this.parseColor(this.runtimeAttributes[attr].end); if (typeof attributes[attr]['to'] === 'undefined' && typeof attributes[attr]['by'] !== 'undefined') { end = this.parseColor(attributes[attr].by); for (var i = 0, len = start.length; i < len; ++i) { end[i] = start[i] + end[i]; } }
            this.runtimeAttributes[attr].start = start; this.runtimeAttributes[attr].end = end;
        }
    };
})(); YAHOO.util.Easing = { easeNone: function (t, b, c, d) { return c * t / d + b; }, easeIn: function (t, b, c, d) { return c * (t /= d) * t + b; }, easeOut: function (t, b, c, d) { return -c * (t /= d) * (t - 2) + b; }, easeBoth: function (t, b, c, d) {
    if ((t /= d / 2) < 1) { return c / 2 * t * t + b; }
    return -c / 2 * ((--t) * (t - 2) - 1) + b;
}, easeInStrong: function (t, b, c, d) { return c * (t /= d) * t * t * t + b; }, easeOutStrong: function (t, b, c, d) { return -c * ((t = t / d - 1) * t * t * t - 1) + b; }, easeBothStrong: function (t, b, c, d) {
    if ((t /= d / 2) < 1) { return c / 2 * t * t * t * t + b; }
    return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
}, elasticIn: function (t, b, c, d, a, p) {
    if (t == 0) { return b; }
    if ((t /= d) == 1) { return b + c; }
    if (!p) { p = d * .3; }
    if (!a || a < Math.abs(c)) { a = c; var s = p / 4; }
    else { var s = p / (2 * Math.PI) * Math.asin(c / a); }
    return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
}, elasticOut: function (t, b, c, d, a, p) {
    if (t == 0) { return b; }
    if ((t /= d) == 1) { return b + c; }
    if (!p) { p = d * .3; }
    if (!a || a < Math.abs(c)) { a = c; var s = p / 4; }
    else { var s = p / (2 * Math.PI) * Math.asin(c / a); }
    return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
}, elasticBoth: function (t, b, c, d, a, p) {
    if (t == 0) { return b; }
    if ((t /= d / 2) == 2) { return b + c; }
    if (!p) { p = d * (.3 * 1.5); }
    if (!a || a < Math.abs(c)) { a = c; var s = p / 4; }
    else { var s = p / (2 * Math.PI) * Math.asin(c / a); }
    if (t < 1) { return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; }
    return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
}, backIn: function (t, b, c, d, s) {
    if (typeof s == 'undefined') { s = 1.70158; }
    return c * (t /= d) * t * ((s + 1) * t - s) + b;
}, backOut: function (t, b, c, d, s) {
    if (typeof s == 'undefined') { s = 1.70158; }
    return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
}, backBoth: function (t, b, c, d, s) {
    if (typeof s == 'undefined') { s = 1.70158; }
    if ((t /= d / 2) < 1) { return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b; }
    return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
}, bounceIn: function (t, b, c, d) { return c - YAHOO.util.Easing.bounceOut(d - t, 0, c, d) + b; }, bounceOut: function (t, b, c, d) {
    if ((t /= d) < (1 / 2.75)) { return c * (7.5625 * t * t) + b; } else if (t < (2 / 2.75)) { return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b; } else if (t < (2.5 / 2.75)) { return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b; }
    return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
}, bounceBoth: function (t, b, c, d) {
    if (t < d / 2) { return YAHOO.util.Easing.bounceIn(t * 2, 0, c, d) * .5 + b; }
    return YAHOO.util.Easing.bounceOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b;
}
}; (function () {
    YAHOO.util.Motion = function (el, attributes, duration, method) { if (el) { YAHOO.util.Motion.superclass.constructor.call(this, el, attributes, duration, method); } }; YAHOO.extend(YAHOO.util.Motion, YAHOO.util.ColorAnim); var Y = YAHOO.util; var superclass = Y.Motion.superclass; var proto = Y.Motion.prototype; proto.toString = function () { var el = this.getEl(); var id = el.id || el.tagName; return ("Motion " + id); }; proto.patterns.points = /^points$/i; proto.setAttribute = function (attr, val, unit) { if (this.patterns.points.test(attr)) { unit = unit || 'px'; superclass.setAttribute.call(this, 'left', val[0], unit); superclass.setAttribute.call(this, 'top', val[1], unit); } else { superclass.setAttribute.call(this, attr, val, unit); } }; proto.getAttribute = function (attr) {
        if (this.patterns.points.test(attr)) { var val = [superclass.getAttribute.call(this, 'left'), superclass.getAttribute.call(this, 'top')]; } else { val = superclass.getAttribute.call(this, attr); }
        return val;
    }; proto.doMethod = function (attr, start, end) {
        var val = null; if (this.patterns.points.test(attr)) { var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100; val = Y.Bezier.getPosition(this.runtimeAttributes[attr], t); } else { val = superclass.doMethod.call(this, attr, start, end); }
        return val;
    }; proto.setRuntimeAttribute = function (attr) {
        if (this.patterns.points.test(attr)) {
            var el = this.getEl(); var attributes = this.attributes; var start; var control = attributes['points']['control'] || []; var end; var i, len; if (control.length > 0 && !(control[0] instanceof Array)) { control = [control]; } else {
                var tmp = []; for (i = 0, len = control.length; i < len; ++i) { tmp[i] = control[i]; }
                control = tmp;
            }
            if (Y.Dom.getStyle(el, 'position') == 'static') { Y.Dom.setStyle(el, 'position', 'relative'); }
            if (isset(attributes['points']['from'])) { Y.Dom.setXY(el, attributes['points']['from']); }
            else { Y.Dom.setXY(el, Y.Dom.getXY(el)); }
            start = this.getAttribute('points'); if (isset(attributes['points']['to'])) { end = translateValues.call(this, attributes['points']['to'], start); var pageXY = Y.Dom.getXY(this.getEl()); for (i = 0, len = control.length; i < len; ++i) { control[i] = translateValues.call(this, control[i], start); } } else if (isset(attributes['points']['by'])) { end = [start[0] + attributes['points']['by'][0], start[1] + attributes['points']['by'][1]]; for (i = 0, len = control.length; i < len; ++i) { control[i] = [start[0] + control[i][0], start[1] + control[i][1]]; } }
            this.runtimeAttributes[attr] = [start]; if (control.length > 0) { this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control); }
            this.runtimeAttributes[attr][this.runtimeAttributes[attr].length] = end;
        }
        else { superclass.setRuntimeAttribute.call(this, attr); }
    }; var translateValues = function (val, start) { var pageXY = Y.Dom.getXY(this.getEl()); val = [val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1]]; return val; }; var isset = function (prop) { return (typeof prop !== 'undefined'); };
})(); (function () {
    YAHOO.util.Scroll = function (el, attributes, duration, method) { if (el) { YAHOO.util.Scroll.superclass.constructor.call(this, el, attributes, duration, method); } }; YAHOO.extend(YAHOO.util.Scroll, YAHOO.util.ColorAnim); var Y = YAHOO.util; var superclass = Y.Scroll.superclass; var proto = Y.Scroll.prototype; proto.toString = function () { var el = this.getEl(); var id = el.id || el.tagName; return ("Scroll " + id); }; proto.doMethod = function (attr, start, end) {
        var val = null; if (attr == 'scroll') { val = [this.method(this.currentFrame, start[0], end[0] - start[0], this.totalFrames), this.method(this.currentFrame, start[1], end[1] - start[1], this.totalFrames)]; } else { val = superclass.doMethod.call(this, attr, start, end); }
        return val;
    }; proto.getAttribute = function (attr) {
        var val = null; var el = this.getEl(); if (attr == 'scroll') { val = [el.scrollLeft, el.scrollTop]; } else { val = superclass.getAttribute.call(this, attr); }
        return val;
    }; proto.setAttribute = function (attr, val, unit) { var el = this.getEl(); if (attr == 'scroll') { el.scrollLeft = val[0]; el.scrollTop = val[1]; } else { superclass.setAttribute.call(this, attr, val, unit); } };
})(); YAHOO.register("animation", YAHOO.util.Anim, { version: "2.2.1", build: "193" });

/* connection */
YAHOO.util.Connect = { _msxml_progid: ['MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'], _http_headers: {}, _has_http_headers: false, _use_default_post_header: true, _default_post_header: 'application/x-www-form-urlencoded; charset=UTF-8', _use_default_xhr_header: true, _default_xhr_header: 'XMLHttpRequest', _has_default_headers: true, _default_headers: {}, _isFormSubmit: false, _isFileUpload: false, _formNode: null, _sFormData: null, _poll: {}, _timeOut: {}, _polling_interval: 50, _transaction_id: 0, _submitElementValue: null, _hasSubmitListener: (function () {
    if (YAHOO.util.Event) {
        YAHOO.util.Event.addListener(document, 'click', function (e) { var obj = YAHOO.util.Event.getTarget(e); if (obj.type == 'submit') { YAHOO.util.Connect._submitElementValue = encodeURIComponent(obj.name) + "=" + encodeURIComponent(obj.value); } })
        return true;
    }
    return false;
})(), setProgId: function (id)
{ this._msxml_progid.unshift(id); }, setDefaultPostHeader: function (b)
{ this._use_default_post_header = b; }, setDefaultXhrHeader: function (b)
{ this._use_default_xhr_header = b; }, setPollingInterval: function (i)
{ if (typeof i == 'number' && isFinite(i)) { this._polling_interval = i; } }, createXhrObject: function (transactionId) {
    var obj, http; try
{ http = new XMLHttpRequest(); obj = { conn: http, tId: transactionId }; }
    catch (e) {
        for (var i = 0; i < this._msxml_progid.length; ++i) {
            try
{ http = new ActiveXObject(this._msxml_progid[i]); obj = { conn: http, tId: transactionId }; break; }
            catch (e) { }
        }
    }
    finally
{ return obj; }
}, getConnectionObject: function () {
    var o; var tId = this._transaction_id; try
{ o = this.createXhrObject(tId); if (o) { this._transaction_id++; } }
    catch (e) { }
    finally
{ return o; }
}, asyncRequest: function (method, uri, callback, postData) {
    var o = this.getConnectionObject(); if (!o) { return null; }
    else {
        if (this._isFormSubmit) {
            if (this._isFileUpload) { this.uploadFile(o.tId, callback, uri, postData); this.releaseObject(o); return; }
            if (method.toUpperCase() == 'GET') {
                if (this._sFormData.length != 0) { uri += ((uri.indexOf('?') == -1) ? '?' : '&') + this._sFormData; }
                else { uri += "?" + this._sFormData; }
            }
            else if (method.toUpperCase() == 'POST') { postData = postData ? this._sFormData + "&" + postData : this._sFormData; }
        }
        o.conn.open(method, uri, true); if (this._use_default_xhr_header) { if (!this._default_headers['X-Requested-With']) { this.initHeader('X-Requested-With', this._default_xhr_header, true); } }
        if (this._isFormSubmit || (postData && this._use_default_post_header)) { this.initHeader('Content-Type', this._default_post_header); if (this._isFormSubmit) { this.resetFormState(); } }
        if (this._has_default_headers || this._has_http_headers) { this.setHeader(o); }
        this.handleReadyState(o, callback); o.conn.send(postData || null); return o;
    }
}, handleReadyState: function (o, callback) {
    var oConn = this; if (callback && callback.timeout) { this._timeOut[o.tId] = window.setTimeout(function () { oConn.abort(o, callback, true); }, callback.timeout); }
    this._poll[o.tId] = window.setInterval(function () {
        if (o.conn && o.conn.readyState === 4) {
            window.clearInterval(oConn._poll[o.tId]); delete oConn._poll[o.tId]; if (callback && callback.timeout) { delete oConn._timeOut[o.tId]; }
            oConn.handleTransactionResponse(o, callback);
        }
    }, this._polling_interval);
}, handleTransactionResponse: function (o, callback, isAbort) {
    if (!callback) { this.releaseObject(o); return; }
    var httpStatus, responseObject; try {
        if (o.conn.status !== undefined && o.conn.status !== 0) { httpStatus = o.conn.status; }
        else { httpStatus = 13030; }
    }
    catch (e) { httpStatus = 13030; }
    if (httpStatus >= 200 && httpStatus < 300 || httpStatus === 1223) {
        responseObject = this.createResponseObject(o, callback.argument); if (callback.success) {
            if (!callback.scope) { callback.success(responseObject); }
            else { callback.success.apply(callback.scope, [responseObject]); }
        }
    }
    else {
        switch (httpStatus) {
            case 12002: case 12029: case 12030: case 12031: case 12152: case 13030: responseObject = this.createExceptionObject(o.tId, callback.argument, (isAbort ? isAbort : false)); if (callback.failure) {
                    if (!callback.scope) { callback.failure(responseObject); }
                    else { callback.failure.apply(callback.scope, [responseObject]); }
                }
                break; default: responseObject = this.createResponseObject(o, callback.argument); if (callback.failure) {
                    if (!callback.scope) { callback.failure(responseObject); }
                    else { callback.failure.apply(callback.scope, [responseObject]); }
                }
        }
    }
    this.releaseObject(o); responseObject = null;
}, createResponseObject: function (o, callbackArg) {
    var obj = {}; var headerObj = {}; try
{ var headerStr = o.conn.getAllResponseHeaders(); var header = headerStr.split('\n'); for (var i = 0; i < header.length; i++) { var delimitPos = header[i].indexOf(':'); if (delimitPos != -1) { headerObj[header[i].substring(0, delimitPos)] = header[i].substring(delimitPos + 2); } } }
    catch (e) { }
    obj.tId = o.tId; obj.status = (o.conn.status == 1223) ? 204 : o.conn.status; obj.statusText = (o.conn.status == 1223) ? "No Content" : o.conn.statusText; obj.getResponseHeader = headerObj; obj.getAllResponseHeaders = headerStr; obj.responseText = o.conn.responseText; obj.responseXML = o.conn.responseXML; if (typeof callbackArg !== undefined) { obj.argument = callbackArg; }
    return obj;
}, createExceptionObject: function (tId, callbackArg, isAbort) {
    var COMM_CODE = 0; var COMM_ERROR = 'communication failure'; var ABORT_CODE = -1; var ABORT_ERROR = 'transaction aborted'; var obj = {}; obj.tId = tId; if (isAbort) { obj.status = ABORT_CODE; obj.statusText = ABORT_ERROR; }
    else { obj.status = COMM_CODE; obj.statusText = COMM_ERROR; }
    if (callbackArg) { obj.argument = callbackArg; }
    return obj;
}, initHeader: function (label, value, isDefault) {
    var headerObj = (isDefault) ? this._default_headers : this._http_headers; if (headerObj[label] === undefined) { headerObj[label] = value; }
    else { headerObj[label] = value + "," + headerObj[label]; }
    if (isDefault) { this._has_default_headers = true; }
    else { this._has_http_headers = true; }
}, setHeader: function (o) {
    if (this._has_default_headers) { for (var prop in this._default_headers) { if (YAHOO.lang.hasOwnProperty(this._default_headers, prop)) { o.conn.setRequestHeader(prop, this._default_headers[prop]); } } }
    if (this._has_http_headers) {
        for (var prop in this._http_headers) { if (YAHOO.lang.hasOwnProperty(this._http_headers, prop)) { o.conn.setRequestHeader(prop, this._http_headers[prop]); } }
        delete this._http_headers; this._http_headers = {}; this._has_http_headers = false;
    }
}, resetDefaultHeaders: function () {
    delete this._default_headers
    this._default_headers = {}; this._has_default_headers = false;
}, setForm: function (formId, isUpload, secureUri) {
    this.resetFormState(); var oForm; if (typeof formId == 'string') { oForm = (document.getElementById(formId) || document.forms[formId]); }
    else if (typeof formId == 'object') { oForm = formId; }
    else { return; }
    if (isUpload) { this.createFrame(secureUri ? secureUri : null); this._isFormSubmit = true; this._isFileUpload = true; this._formNode = oForm; return; }
    var oElement, oName, oValue, oDisabled; var hasSubmit = false; for (var i = 0; i < oForm.elements.length; i++) {
        oElement = oForm.elements[i]; oDisabled = oForm.elements[i].disabled; oName = oForm.elements[i].name; oValue = oForm.elements[i].value; if (!oDisabled && oName) {
            switch (oElement.type) {
                case 'select-one': case 'select-multiple': for (var j = 0; j < oElement.options.length; j++) {
                        if (oElement.options[j].selected) {
                            if (window.ActiveXObject) { this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oElement.options[j].attributes['value'].specified ? oElement.options[j].value : oElement.options[j].text) + '&'; }
                            else { this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oElement.options[j].hasAttribute('value') ? oElement.options[j].value : oElement.options[j].text) + '&'; }
                        }
                    }
                    break; case 'radio': case 'checkbox': if (oElement.checked) { this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&'; }
                    break; case 'file': case undefined: case 'reset': case 'button': break; case 'submit': if (hasSubmit === false) {
                        if (this._hasSubmitListener) { this._sFormData += this._submitElementValue + '&'; }
                        else { this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&'; }
                        hasSubmit = true;
                    }
                    break; default: this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&'; break;
            }
        }
    }
    this._isFormSubmit = true; this._sFormData = this._sFormData.substr(0, this._sFormData.length - 1); return this._sFormData;
}, resetFormState: function () { this._isFormSubmit = false; this._isFileUpload = false; this._formNode = null; this._sFormData = ""; }, createFrame: function (secureUri) {
    var frameId = 'yuiIO' + this._transaction_id; if (window.ActiveXObject) {
        var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />'); if (typeof secureUri == 'boolean') { io.src = 'javascript:false'; }
        else if (typeof secureURI == 'string') { io.src = secureUri; }
    }
    else { var io = document.createElement('iframe'); io.id = frameId; io.name = frameId; }
    io.style.position = 'absolute'; io.style.top = '-1000px'; io.style.left = '-1000px'; document.body.appendChild(io);
}, appendPostData: function (postData) {
    var formElements = []; var postMessage = postData.split('&'); for (var i = 0; i < postMessage.length; i++) { var delimitPos = postMessage[i].indexOf('='); if (delimitPos != -1) { formElements[i] = document.createElement('input'); formElements[i].type = 'hidden'; formElements[i].name = postMessage[i].substring(0, delimitPos); formElements[i].value = postMessage[i].substring(delimitPos + 1); this._formNode.appendChild(formElements[i]); } }
    return formElements;
}, uploadFile: function (id, callback, uri, postData) {
    var frameId = 'yuiIO' + id; var uploadEncoding = 'multipart/form-data'; var io = document.getElementById(frameId); this._formNode.setAttribute('action', uri); this._formNode.setAttribute('method', 'POST'); this._formNode.setAttribute("target", frameId); if (this._formNode.encoding) { this._formNode.encoding = uploadEncoding; }
    else { this._formNode.enctype = uploadEncoding; }
    if (postData) { var oElements = this.appendPostData(postData); }
    this._formNode.submit(); if (oElements && oElements.length > 0) { for (var i = 0; i < oElements.length; i++) { this._formNode.removeChild(oElements[i]); } }
    this.resetFormState(); var uploadCallback = function () {
        var obj = {}; obj.tId = id; obj.argument = callback.argument; try
{ obj.responseText = io.contentWindow.document.body ? io.contentWindow.document.body.innerHTML : null; obj.responseXML = io.contentWindow.document.XMLDocument ? io.contentWindow.document.XMLDocument : io.contentWindow.document; }
        catch (e) { }
        if (callback && callback.upload) {
            if (!callback.scope) { callback.upload(obj); }
            else { callback.upload.apply(callback.scope, [obj]); }
        }
        if (YAHOO.util.Event) { YAHOO.util.Event.removeListener(io, "load", uploadCallback); }
        else if (window.detachEvent) { io.detachEvent('onload', uploadCallback); }
        else { io.removeEventListener('load', uploadCallback, false); }
        setTimeout(function () { document.body.removeChild(io); }, 100);
    }; if (YAHOO.util.Event) { YAHOO.util.Event.addListener(io, "load", uploadCallback); }
    else if (window.attachEvent) { io.attachEvent('onload', uploadCallback); }
    else { io.addEventListener('load', uploadCallback, false); }
}, abort: function (o, callback, isTimeout) {
    if (this.isCallInProgress(o)) {
        o.conn.abort(); window.clearInterval(this._poll[o.tId]); delete this._poll[o.tId]; if (isTimeout) { delete this._timeOut[o.tId]; }
        this.handleTransactionResponse(o, callback, true); return true;
    }
    else { return false; }
}, isCallInProgress: function (o) {
    if (o.conn) { return o.conn.readyState !== 4 && o.conn.readyState !== 0; }
    else { return false; }
}, releaseObject: function (o)
{ o.conn = null; o = null; }
}; YAHOO.register("connection", YAHOO.util.Connect, { version: "2.2.1", build: "193" });

/* modal dialog */
YAHOO.util.Config = function (owner) { if (owner) { this.init(owner); } }; YAHOO.util.Config.CONFIG_CHANGED_EVENT = "configChanged"; YAHOO.util.Config.BOOLEAN_TYPE = "boolean"; YAHOO.util.Config.prototype = { owner: null, queueInProgress: false, config: null, initialConfig: null, eventQueue: null, configChangedEvent: null, checkBoolean: function (val) { return (typeof val == YAHOO.util.Config.BOOLEAN_TYPE); }, checkNumber: function (val) { return (!isNaN(val)); }, fireEvent: function (key, value) { var property = this.config[key]; if (property && property.event) { property.event.fire(value); } }, addProperty: function (key, propertyObject) {
    key = key.toLowerCase(); this.config[key] = propertyObject; propertyObject.event = new YAHOO.util.CustomEvent(key, this.owner); propertyObject.key = key; if (propertyObject.handler) { propertyObject.event.subscribe(propertyObject.handler, this.owner); }
    this.setProperty(key, propertyObject.value, true); if (!propertyObject.suppressEvent) { this.queueProperty(key, propertyObject.value); }
}, getConfig: function () {
    var cfg = {}; for (var prop in this.config) { var property = this.config[prop]; if (property && property.event) { cfg[prop] = property.value; } }
    return cfg;
}, getProperty: function (key) { var property = this.config[key.toLowerCase()]; if (property && property.event) { return property.value; } else { return undefined; } }, resetProperty: function (key) {
    key = key.toLowerCase(); var property = this.config[key]; if (property && property.event) {
        if (this.initialConfig[key] && !YAHOO.lang.isUndefined(this.initialConfig[key])) { this.setProperty(key, this.initialConfig[key]); }
        return true;
    } else { return false; }
}, setProperty: function (key, value, silent) {
    key = key.toLowerCase(); if (this.queueInProgress && !silent) { this.queueProperty(key, value); return true; } else {
        var property = this.config[key]; if (property && property.event) {
            if (property.validator && !property.validator(value)) { return false; } else {
                property.value = value; if (!silent) { this.fireEvent(key, value); this.configChangedEvent.fire([key, value]); }
                return true;
            }
        } else { return false; }
    }
}, queueProperty: function (key, value) {
    key = key.toLowerCase(); var property = this.config[key]; if (property && property.event) {
        if (!YAHOO.lang.isUndefined(value) && property.validator && !property.validator(value)) { return false; } else {
            if (!YAHOO.lang.isUndefined(value)) { property.value = value; } else { value = property.value; }
            var foundDuplicate = false; var iLen = this.eventQueue.length; for (var i = 0; i < iLen; i++) { var queueItem = this.eventQueue[i]; if (queueItem) { var queueItemKey = queueItem[0]; var queueItemValue = queueItem[1]; if (queueItemKey == key) { this.eventQueue[i] = null; this.eventQueue.push([key, (!YAHOO.lang.isUndefined(value) ? value : queueItemValue)]); foundDuplicate = true; break; } } }
            if (!foundDuplicate && !YAHOO.lang.isUndefined(value)) { this.eventQueue.push([key, value]); }
        }
        if (property.supercedes) { var sLen = property.supercedes.length; for (var s = 0; s < sLen; s++) { var supercedesCheck = property.supercedes[s]; var qLen = this.eventQueue.length; for (var q = 0; q < qLen; q++) { var queueItemCheck = this.eventQueue[q]; if (queueItemCheck) { var queueItemCheckKey = queueItemCheck[0]; var queueItemCheckValue = queueItemCheck[1]; if (queueItemCheckKey == supercedesCheck.toLowerCase()) { this.eventQueue.push([queueItemCheckKey, queueItemCheckValue]); this.eventQueue[q] = null; break; } } } } }
        return true;
    } else { return false; }
}, refireEvent: function (key) { key = key.toLowerCase(); var property = this.config[key]; if (property && property.event && !YAHOO.lang.isUndefined(property.value)) { if (this.queueInProgress) { this.queueProperty(key); } else { this.fireEvent(key, property.value); } } }, applyConfig: function (userConfig, init) {
    if (init) { this.initialConfig = userConfig; }
    for (var prop in userConfig) { this.queueProperty(prop, userConfig[prop]); }
}, refresh: function () { for (var prop in this.config) { this.refireEvent(prop); } }, fireQueue: function () {
    this.queueInProgress = true; for (var i = 0; i < this.eventQueue.length; i++) { var queueItem = this.eventQueue[i]; if (queueItem) { var key = queueItem[0]; var value = queueItem[1]; var property = this.config[key]; property.value = value; this.fireEvent(key, value); } }
    this.queueInProgress = false; this.eventQueue = [];
}, subscribeToConfigEvent: function (key, handler, obj, override) {
    var property = this.config[key.toLowerCase()]; if (property && property.event) {
        if (!YAHOO.util.Config.alreadySubscribed(property.event, handler, obj)) { property.event.subscribe(handler, obj, override); }
        return true;
    } else { return false; }
}, unsubscribeFromConfigEvent: function (key, handler, obj) { var property = this.config[key.toLowerCase()]; if (property && property.event) { return property.event.unsubscribe(handler, obj); } else { return false; } }, toString: function () {
    var output = "Config"; if (this.owner) { output += " [" + this.owner.toString() + "]"; }
    return output;
}, outputEventQueue: function () {
    var output = ""; for (var q = 0; q < this.eventQueue.length; q++) { var queueItem = this.eventQueue[q]; if (queueItem) { output += queueItem[0] + "=" + queueItem[1] + ", "; } }
    return output;
}
}; YAHOO.util.Config.prototype.init = function (owner) { this.owner = owner; this.configChangedEvent = new YAHOO.util.CustomEvent(YAHOO.util.CONFIG_CHANGED_EVENT, this); this.queueInProgress = false; this.config = {}; this.initialConfig = {}; this.eventQueue = []; }; YAHOO.util.Config.alreadySubscribed = function (evt, fn, obj) {
    for (var e = 0; e < evt.subscribers.length; e++) { var subsc = evt.subscribers[e]; if (subsc && subsc.obj == obj && subsc.fn == fn) { return true; } }
    return false;
}; YAHOO.widget.Module = function (el, userConfig) { if (el) { this.init(el, userConfig); } else { } }; YAHOO.widget.Module.IMG_ROOT = null; YAHOO.widget.Module.IMG_ROOT_SSL = null; YAHOO.widget.Module.CSS_MODULE = "yui-module"; YAHOO.widget.Module.CSS_HEADER = "hd"; YAHOO.widget.Module.CSS_BODY = "bd"; YAHOO.widget.Module.CSS_FOOTER = "ft"; YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;"; YAHOO.widget.Module.textResizeEvent = new YAHOO.util.CustomEvent("textResize"); YAHOO.widget.Module._EVENT_TYPES = { "BEFORE_INIT": "beforeInit", "INIT": "init", "APPEND": "append", "BEFORE_RENDER": "beforeRender", "RENDER": "render", "CHANGE_HEADER": "changeHeader", "CHANGE_BODY": "changeBody", "CHANGE_FOOTER": "changeFooter", "CHANGE_CONTENT": "changeContent", "DESTORY": "destroy", "BEFORE_SHOW": "beforeShow", "SHOW": "show", "BEFORE_HIDE": "beforeHide", "HIDE": "hide" }; YAHOO.widget.Module._DEFAULT_CONFIG = { "VISIBLE": { key: "visible", value: true, validator: YAHOO.lang.isBoolean }, "EFFECT": { key: "effect", suppressEvent: true, supercedes: ["visible"] }, "MONITOR_RESIZE": { key: "monitorresize", value: true} }; YAHOO.widget.Module.prototype = { constructor: YAHOO.widget.Module, element: null, header: null, body: null, footer: null, id: null, imageRoot: YAHOO.widget.Module.IMG_ROOT, initEvents: function () { var EVENT_TYPES = YAHOO.widget.Module._EVENT_TYPES; this.beforeInitEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_INIT, this); this.initEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.INIT, this); this.appendEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.APPEND, this); this.beforeRenderEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_RENDER, this); this.renderEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.RENDER, this); this.changeHeaderEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_HEADER, this); this.changeBodyEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_BODY, this); this.changeFooterEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_FOOTER, this); this.changeContentEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_CONTENT, this); this.destroyEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.DESTORY, this); this.beforeShowEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_SHOW, this); this.showEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.SHOW, this); this.beforeHideEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_HIDE, this); this.hideEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.HIDE, this); }, platform: function () { var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) { return "windows"; } else if (ua.indexOf("macintosh") != -1) { return "mac"; } else { return false; } } (), browser: function () { var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf('opera') != -1) { return 'opera'; } else if (ua.indexOf('msie 7') != -1) { return 'ie7'; } else if (ua.indexOf('msie') != -1) { return 'ie'; } else if (ua.indexOf('safari') != -1) { return 'safari'; } else if (ua.indexOf('gecko') != -1) { return 'gecko'; } else { return false; } } (), isSecure: function () { if (window.location.href.toLowerCase().indexOf("https") === 0) { return true; } else { return false; } } (), initDefaultConfig: function () { var DEFAULT_CONFIG = YAHOO.widget.Module._DEFAULT_CONFIG; this.cfg.addProperty(DEFAULT_CONFIG.VISIBLE.key, { handler: this.configVisible, value: DEFAULT_CONFIG.VISIBLE.value, validator: DEFAULT_CONFIG.VISIBLE.validator }); this.cfg.addProperty(DEFAULT_CONFIG.EFFECT.key, { suppressEvent: DEFAULT_CONFIG.EFFECT.suppressEvent, supercedes: DEFAULT_CONFIG.EFFECT.supercedes }); this.cfg.addProperty(DEFAULT_CONFIG.MONITOR_RESIZE.key, { handler: this.configMonitorResize, value: DEFAULT_CONFIG.MONITOR_RESIZE.value }); }, init: function (el, userConfig) {
    this.initEvents(); this.beforeInitEvent.fire(YAHOO.widget.Module); this.cfg = new YAHOO.util.Config(this); if (this.isSecure) { this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL; }
    if (typeof el == "string") { var elId = el; el = document.getElementById(el); if (!el) { el = document.createElement("div"); el.id = elId; } }
    this.element = el; if (el.id) { this.id = el.id; }
    var childNodes = this.element.childNodes; if (childNodes) { for (var i = 0; i < childNodes.length; i++) { var child = childNodes[i]; switch (child.className) { case YAHOO.widget.Module.CSS_HEADER: this.header = child; break; case YAHOO.widget.Module.CSS_BODY: this.body = child; break; case YAHOO.widget.Module.CSS_FOOTER: this.footer = child; break; } } }
    this.initDefaultConfig(); YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Module.CSS_MODULE); if (userConfig) { this.cfg.applyConfig(userConfig, true); }
    if (!YAHOO.util.Config.alreadySubscribed(this.renderEvent, this.cfg.fireQueue, this.cfg)) { this.renderEvent.subscribe(this.cfg.fireQueue, this.cfg, true); }
    this.initEvent.fire(YAHOO.widget.Module);
}, initResizeMonitor: function () {
    if (this.browser != "opera") {
        var resizeMonitor = document.getElementById("_yuiResizeMonitor"); if (!resizeMonitor) {
            resizeMonitor = document.createElement("iframe"); var bIE = (this.browser.indexOf("ie") === 0); if (this.isSecure && YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL && bIE) { resizeMonitor.src = YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL; }
            resizeMonitor.id = "_yuiResizeMonitor"; resizeMonitor.style.visibility = "hidden"; document.body.appendChild(resizeMonitor); resizeMonitor.style.width = "10em"; resizeMonitor.style.height = "10em"; resizeMonitor.style.position = "absolute"; var nLeft = -1 * resizeMonitor.offsetWidth; var nTop = -1 * resizeMonitor.offsetHeight; resizeMonitor.style.top = nTop + "px"; resizeMonitor.style.left = nLeft + "px"; resizeMonitor.style.borderStyle = "none"; resizeMonitor.style.borderWidth = "0"; YAHOO.util.Dom.setStyle(resizeMonitor, "opacity", "0"); resizeMonitor.style.visibility = "visible"; if (!bIE) { var doc = resizeMonitor.contentWindow.document; doc.open(); doc.close(); }
        }
        var fireTextResize = function () { YAHOO.widget.Module.textResizeEvent.fire(); }; if (resizeMonitor && resizeMonitor.contentWindow) {
            this.resizeMonitor = resizeMonitor; YAHOO.widget.Module.textResizeEvent.subscribe(this.onDomResize, this, true); if (!YAHOO.widget.Module.textResizeInitialized) {
                if (!YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", fireTextResize)) { YAHOO.util.Event.addListener(this.resizeMonitor, "resize", fireTextResize); }
                YAHOO.widget.Module.textResizeInitialized = true;
            }
        }
    }
}, onDomResize: function (e, obj) { var nLeft = -1 * this.resizeMonitor.offsetWidth, nTop = -1 * this.resizeMonitor.offsetHeight; this.resizeMonitor.style.top = nTop + "px"; this.resizeMonitor.style.left = nLeft + "px"; }, setHeader: function (headerContent) {
    if (!this.header) { this.header = document.createElement("div"); this.header.className = YAHOO.widget.Module.CSS_HEADER; }
    if (typeof headerContent == "string") { this.header.innerHTML = headerContent; } else { this.header.innerHTML = ""; this.header.appendChild(headerContent); }
    this.changeHeaderEvent.fire(headerContent); this.changeContentEvent.fire();
}, appendToHeader: function (element) {
    if (!this.header) { this.header = document.createElement("div"); this.header.className = YAHOO.widget.Module.CSS_HEADER; }
    this.header.appendChild(element); this.changeHeaderEvent.fire(element); this.changeContentEvent.fire();
}, setBody: function (bodyContent) {
    if (!this.body) { this.body = document.createElement("div"); this.body.className = YAHOO.widget.Module.CSS_BODY; }
    if (typeof bodyContent == "string")
    { this.body.innerHTML = bodyContent; } else { this.body.innerHTML = ""; this.body.appendChild(bodyContent); }
    this.changeBodyEvent.fire(bodyContent); this.changeContentEvent.fire();
}, appendToBody: function (element) {
    if (!this.body) { this.body = document.createElement("div"); this.body.className = YAHOO.widget.Module.CSS_BODY; }
    this.body.appendChild(element); this.changeBodyEvent.fire(element); this.changeContentEvent.fire();
}, setFooter: function (footerContent) {
    if (!this.footer) { this.footer = document.createElement("div"); this.footer.className = YAHOO.widget.Module.CSS_FOOTER; }
    if (typeof footerContent == "string") { this.footer.innerHTML = footerContent; } else { this.footer.innerHTML = ""; this.footer.appendChild(footerContent); }
    this.changeFooterEvent.fire(footerContent); this.changeContentEvent.fire();
}, appendToFooter: function (element) {
    if (!this.footer) { this.footer = document.createElement("div"); this.footer.className = YAHOO.widget.Module.CSS_FOOTER; }
    this.footer.appendChild(element); this.changeFooterEvent.fire(element); this.changeContentEvent.fire();
}, render: function (appendToNode, moduleElement) {
    this.beforeRenderEvent.fire(); if (!moduleElement) { moduleElement = this.element; }
    var me = this; var appendTo = function (element) {
        if (typeof element == "string") { element = document.getElementById(element); }
        if (element) { element.appendChild(me.element); me.appendEvent.fire(); }
    }; if (appendToNode) { appendTo(appendToNode); } else { if (!YAHOO.util.Dom.inDocument(this.element)) { return false; } }
    if (this.header && !YAHOO.util.Dom.inDocument(this.header)) { var firstChild = moduleElement.firstChild; if (firstChild) { moduleElement.insertBefore(this.header, firstChild); } else { moduleElement.appendChild(this.header); } }
    if (this.body && !YAHOO.util.Dom.inDocument(this.body)) { if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { moduleElement.insertBefore(this.body, this.footer); } else { moduleElement.appendChild(this.body); } }
    if (this.footer && !YAHOO.util.Dom.inDocument(this.footer)) { moduleElement.appendChild(this.footer); }
    this.renderEvent.fire(); return true;
}, destroy: function () {
    var parent; if (this.element) { YAHOO.util.Event.purgeElement(this.element, true); parent = this.element.parentNode; }
    if (parent) { parent.removeChild(this.element); }
    this.element = null; this.header = null; this.body = null; this.footer = null; for (var e in this) { if (e instanceof YAHOO.util.CustomEvent) { e.unsubscribeAll(); } }
    YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize, this); this.destroyEvent.fire();
}, show: function () { this.cfg.setProperty("visible", true); }, hide: function () { this.cfg.setProperty("visible", false); }, configVisible: function (type, args, obj) { var visible = args[0]; if (visible) { this.beforeShowEvent.fire(); YAHOO.util.Dom.setStyle(this.element, "display", "block"); this.showEvent.fire(); } else { this.beforeHideEvent.fire(); YAHOO.util.Dom.setStyle(this.element, "display", "none"); this.hideEvent.fire(); } }, configMonitorResize: function (type, args, obj) { var monitor = args[0]; if (monitor) { this.initResizeMonitor(); } else { YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize, this, true); this.resizeMonitor = null; } }
}; YAHOO.widget.Module.prototype.toString = function () { return "Module " + this.id; }; YAHOO.widget.Overlay = function (el, userConfig) { YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig); }; YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module); YAHOO.widget.Overlay._EVENT_TYPES = { "BEFORE_MOVE": "beforeMove", "MOVE": "move" }; YAHOO.widget.Overlay._DEFAULT_CONFIG = { "X": { key: "x", validator: YAHOO.lang.isNumber, suppressEvent: true, supercedes: ["iframe"] }, "Y": { key: "y", validator: YAHOO.lang.isNumber, suppressEvent: true, supercedes: ["iframe"] }, "XY": { key: "xy", suppressEvent: true, supercedes: ["iframe"] }, "CONTEXT": { key: "context", suppressEvent: true, supercedes: ["iframe"] }, "FIXED_CENTER": { key: "fixedcenter", value: false, validator: YAHOO.lang.isBoolean, supercedes: ["iframe", "visible"] }, "WIDTH": { key: "width", suppressEvent: true, supercedes: ["iframe"] }, "HEIGHT": { key: "height", suppressEvent: true, supercedes: ["iframe"] }, "ZINDEX": { key: "zindex", value: null }, "CONSTRAIN_TO_VIEWPORT": { key: "constraintoviewport", value: false, validator: YAHOO.lang.isBoolean, supercedes: ["iframe", "x", "y", "xy"] }, "IFRAME": { key: "iframe", value: (YAHOO.widget.Module.prototype.browser == "ie" ? true : false), validator: YAHOO.lang.isBoolean, supercedes: ["zIndex"]} }; YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;"; YAHOO.widget.Overlay.TOP_LEFT = "tl"; YAHOO.widget.Overlay.TOP_RIGHT = "tr"; YAHOO.widget.Overlay.BOTTOM_LEFT = "bl"; YAHOO.widget.Overlay.BOTTOM_RIGHT = "br"; YAHOO.widget.Overlay.CSS_OVERLAY = "yui-overlay"; YAHOO.widget.Overlay.prototype.init = function (el, userConfig) {
    YAHOO.widget.Overlay.superclass.init.call(this, el); this.beforeInitEvent.fire(YAHOO.widget.Overlay); YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY); if (userConfig) { this.cfg.applyConfig(userConfig, true); }
    if (this.platform == "mac" && this.browser == "gecko") {
        if (!YAHOO.util.Config.alreadySubscribed(this.showEvent, this.showMacGeckoScrollbars, this)) { this.showEvent.subscribe(this.showMacGeckoScrollbars, this, true); }
        if (!YAHOO.util.Config.alreadySubscribed(this.hideEvent, this.hideMacGeckoScrollbars, this)) { this.hideEvent.subscribe(this.hideMacGeckoScrollbars, this, true); }
    }
    this.initEvent.fire(YAHOO.widget.Overlay);
}; YAHOO.widget.Overlay.prototype.initEvents = function () { YAHOO.widget.Overlay.superclass.initEvents.call(this); var EVENT_TYPES = YAHOO.widget.Overlay._EVENT_TYPES; this.beforeMoveEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_MOVE, this); this.moveEvent = new YAHOO.util.CustomEvent(EVENT_TYPES.MOVE, this); }; YAHOO.widget.Overlay.prototype.initDefaultConfig = function () { YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this); var DEFAULT_CONFIG = YAHOO.widget.Overlay._DEFAULT_CONFIG; this.cfg.addProperty(DEFAULT_CONFIG.X.key, { handler: this.configX, validator: DEFAULT_CONFIG.X.validator, suppressEvent: DEFAULT_CONFIG.X.suppressEvent, supercedes: DEFAULT_CONFIG.X.supercedes }); this.cfg.addProperty(DEFAULT_CONFIG.Y.key, { handler: this.configY, validator: DEFAULT_CONFIG.Y.validator, suppressEvent: DEFAULT_CONFIG.Y.suppressEvent, supercedes: DEFAULT_CONFIG.Y.supercedes }); this.cfg.addProperty(DEFAULT_CONFIG.XY.key, { handler: this.configXY, suppressEvent: DEFAULT_CONFIG.XY.suppressEvent, supercedes: DEFAULT_CONFIG.XY.supercedes }); this.cfg.addProperty(DEFAULT_CONFIG.CONTEXT.key, { handler: this.configContext, suppressEvent: DEFAULT_CONFIG.CONTEXT.suppressEvent, supercedes: DEFAULT_CONFIG.CONTEXT.supercedes }); this.cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key, { handler: this.configFixedCenter, value: DEFAULT_CONFIG.FIXED_CENTER.value, validator: DEFAULT_CONFIG.FIXED_CENTER.validator, supercedes: DEFAULT_CONFIG.FIXED_CENTER.supercedes }); this.cfg.addProperty(DEFAULT_CONFIG.WIDTH.key, { handler: this.configWidth, suppressEvent: DEFAULT_CONFIG.WIDTH.suppressEvent, supercedes: DEFAULT_CONFIG.WIDTH.supercedes }); this.cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key, { handler: this.configHeight, suppressEvent: DEFAULT_CONFIG.HEIGHT.suppressEvent, supercedes: DEFAULT_CONFIG.HEIGHT.supercedes }); this.cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key, { handler: this.configzIndex, value: DEFAULT_CONFIG.ZINDEX.value }); this.cfg.addProperty(DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key, { handler: this.configConstrainToViewport, value: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value, validator: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator, supercedes: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes }); this.cfg.addProperty(DEFAULT_CONFIG.IFRAME.key, { handler: this.configIframe, value: DEFAULT_CONFIG.IFRAME.value, validator: DEFAULT_CONFIG.IFRAME.validator, supercedes: DEFAULT_CONFIG.IFRAME.supercedes }); }; YAHOO.widget.Overlay.prototype.moveTo = function (x, y) { this.cfg.setProperty("xy", [x, y]); }; YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function () { YAHOO.util.Dom.removeClass(this.element, "show-scrollbars"); YAHOO.util.Dom.addClass(this.element, "hide-scrollbars"); }; YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function () { YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars"); YAHOO.util.Dom.addClass(this.element, "show-scrollbars"); }; YAHOO.widget.Overlay.prototype.configVisible = function (type, args, obj) {
    var visible = args[0]; var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility"); if (currentVis == "inherit") {
        var e = this.element.parentNode; while (e.nodeType != 9 && e.nodeType != 11) {
            currentVis = YAHOO.util.Dom.getStyle(e, "visibility"); if (currentVis != "inherit") { break; }
            e = e.parentNode;
        }
        if (currentVis == "inherit") { currentVis = "visible"; }
    }
    var effect = this.cfg.getProperty("effect"); var effectInstances = []; if (effect) { if (effect instanceof Array) { for (var i = 0; i < effect.length; i++) { var eff = effect[i]; effectInstances[effectInstances.length] = eff.effect(this, eff.duration); } } else { effectInstances[effectInstances.length] = effect.effect(this, effect.duration); } }
    var isMacGecko = (this.platform == "mac" && this.browser == "gecko"); if (visible) {
        if (isMacGecko) { this.showMacGeckoScrollbars(); }
        if (effect) {
            if (visible) {
                if (currentVis != "visible" || currentVis === "") {
                    this.beforeShowEvent.fire(); for (var j = 0; j < effectInstances.length; j++) {
                        var ei = effectInstances[j]; if (j === 0 && !YAHOO.util.Config.alreadySubscribed(ei.animateInCompleteEvent, this.showEvent.fire, this.showEvent)) { ei.animateInCompleteEvent.subscribe(this.showEvent.fire, this.showEvent, true); }
                        ei.animateIn();
                    }
                }
            }
        } else { if (currentVis != "visible" || currentVis === "") { this.beforeShowEvent.fire(); YAHOO.util.Dom.setStyle(this.element, "visibility", "visible"); this.cfg.refireEvent("iframe"); this.showEvent.fire(); } }
    } else {
        if (isMacGecko) { this.hideMacGeckoScrollbars(); }
        if (effect) {
            if (currentVis == "visible") {
                this.beforeHideEvent.fire(); for (var k = 0; k < effectInstances.length; k++) {
                    var h = effectInstances[k]; if (k === 0 && !YAHOO.util.Config.alreadySubscribed(h.animateOutCompleteEvent, this.hideEvent.fire, this.hideEvent)) { h.animateOutCompleteEvent.subscribe(this.hideEvent.fire, this.hideEvent, true); }
                    h.animateOut();
                }
            } else if (currentVis === "") { YAHOO.util.Dom.setStyle(this.element, "visibility", "hidden"); }
        } else { if (currentVis == "visible" || currentVis === "") { this.beforeHideEvent.fire(); YAHOO.util.Dom.setStyle(this.element, "visibility", "hidden"); this.cfg.refireEvent("iframe"); this.hideEvent.fire(); } }
    }
}; YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent = function () { if (this.cfg.getProperty("visible")) { this.center(); } }; YAHOO.widget.Overlay.prototype.configFixedCenter = function (type, args, obj) {
    var val = args[0]; if (val) {
        this.center(); if (!YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent, this.center, this)) { this.beforeShowEvent.subscribe(this.center, this, true); }
        if (!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent, this.doCenterOnDOMEvent, this)) { YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent, this, true); }
        if (!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent, this.doCenterOnDOMEvent, this)) { YAHOO.widget.Overlay.windowScrollEvent.subscribe(this.doCenterOnDOMEvent, this, true); }
    } else { YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this); YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this); }
}; YAHOO.widget.Overlay.prototype.configHeight = function (type, args, obj) { var height = args[0]; var el = this.element; YAHOO.util.Dom.setStyle(el, "height", height); this.cfg.refireEvent("iframe"); }; YAHOO.widget.Overlay.prototype.configWidth = function (type, args, obj) { var width = args[0]; var el = this.element; YAHOO.util.Dom.setStyle(el, "width", width); this.cfg.refireEvent("iframe"); }; YAHOO.widget.Overlay.prototype.configzIndex = function (type, args, obj) {
    var zIndex = args[0]; var el = this.element; if (!zIndex) { zIndex = YAHOO.util.Dom.getStyle(el, "zIndex"); if (!zIndex || isNaN(zIndex)) { zIndex = 0; } }
    if (this.iframe) {
        if (zIndex <= 0) { zIndex = 1; }
        YAHOO.util.Dom.setStyle(this.iframe, "zIndex", (zIndex - 1));
    }
    YAHOO.util.Dom.setStyle(el, "zIndex", zIndex); this.cfg.setProperty("zIndex", zIndex, true);
}; YAHOO.widget.Overlay.prototype.configXY = function (type, args, obj) { var pos = args[0]; var x = pos[0]; var y = pos[1]; this.cfg.setProperty("x", x); this.cfg.setProperty("y", y); this.beforeMoveEvent.fire([x, y]); x = this.cfg.getProperty("x"); y = this.cfg.getProperty("y"); this.cfg.refireEvent("iframe"); this.moveEvent.fire([x, y]); }; YAHOO.widget.Overlay.prototype.configX = function (type, args, obj) { var x = args[0]; var y = this.cfg.getProperty("y"); this.cfg.setProperty("x", x, true); this.cfg.setProperty("y", y, true); this.beforeMoveEvent.fire([x, y]); x = this.cfg.getProperty("x"); y = this.cfg.getProperty("y"); YAHOO.util.Dom.setX(this.element, x, true); this.cfg.setProperty("xy", [x, y], true); this.cfg.refireEvent("iframe"); this.moveEvent.fire([x, y]); }; YAHOO.widget.Overlay.prototype.configY = function (type, args, obj) { var x = this.cfg.getProperty("x"); var y = args[0]; this.cfg.setProperty("x", x, true); this.cfg.setProperty("y", y, true); this.beforeMoveEvent.fire([x, y]); x = this.cfg.getProperty("x"); y = this.cfg.getProperty("y"); YAHOO.util.Dom.setY(this.element, y, true); this.cfg.setProperty("xy", [x, y], true); this.cfg.refireEvent("iframe"); this.moveEvent.fire([x, y]); }; YAHOO.widget.Overlay.prototype.showIframe = function () { if (this.iframe) { this.iframe.style.display = "block"; } }; YAHOO.widget.Overlay.prototype.hideIframe = function () { if (this.iframe) { this.iframe.style.display = "none"; } }; YAHOO.widget.Overlay.prototype.configIframe = function (type, args, obj) {
    var val = args[0]; if (val) {
        if (!YAHOO.util.Config.alreadySubscribed(this.showEvent, this.showIframe, this)) { this.showEvent.subscribe(this.showIframe, this, true); }
        if (!YAHOO.util.Config.alreadySubscribed(this.hideEvent, this.hideIframe, this)) { this.hideEvent.subscribe(this.hideIframe, this, true); }
        var x = this.cfg.getProperty("x"); var y = this.cfg.getProperty("y"); if (!x || !y) { this.syncPosition(); x = this.cfg.getProperty("x"); y = this.cfg.getProperty("y"); }
        if (!isNaN(x) && !isNaN(y)) {
            if (!this.iframe) {
                this.iframe = document.createElement("iframe"); if (this.isSecure) { this.iframe.src = YAHOO.widget.Overlay.IFRAME_SRC; }
                var parent = this.element.parentNode; if (parent) { parent.appendChild(this.iframe); } else { document.body.appendChild(this.iframe); }
                YAHOO.util.Dom.setStyle(this.iframe, "position", "absolute"); YAHOO.util.Dom.setStyle(this.iframe, "border", "none"); YAHOO.util.Dom.setStyle(this.iframe, "margin", "0"); YAHOO.util.Dom.setStyle(this.iframe, "padding", "0"); YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0"); if (this.cfg.getProperty("visible")) { this.showIframe(); } else { this.hideIframe(); }
            }
            var iframeDisplay = YAHOO.util.Dom.getStyle(this.iframe, "display"); if (iframeDisplay == "none") { this.iframe.style.display = "block"; }
            YAHOO.util.Dom.setXY(this.iframe, [x, y]); var width = this.element.clientWidth; var height = this.element.clientHeight; YAHOO.util.Dom.setStyle(this.iframe, "width", (width + 2) + "px"); YAHOO.util.Dom.setStyle(this.iframe, "height", (height + 2) + "px"); if (iframeDisplay == "none") { this.iframe.style.display = "none"; }
        }
    } else {
        if (this.iframe) { this.iframe.style.display = "none"; }
        this.showEvent.unsubscribe(this.showIframe, this); this.hideEvent.unsubscribe(this.hideIframe, this);
    }
}; YAHOO.widget.Overlay.prototype.configConstrainToViewport = function (type, args, obj) { var val = args[0]; if (val) { if (!YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent, this.enforceConstraints, this)) { this.beforeMoveEvent.subscribe(this.enforceConstraints, this, true); } } else { this.beforeMoveEvent.unsubscribe(this.enforceConstraints, this); } }; YAHOO.widget.Overlay.prototype.configContext = function (type, args, obj) {
    var contextArgs = args[0]; if (contextArgs) {
        var contextEl = contextArgs[0]; var elementMagnetCorner = contextArgs[1]; var contextMagnetCorner = contextArgs[2]; if (contextEl) {
            if (typeof contextEl == "string") { this.cfg.setProperty("context", [document.getElementById(contextEl), elementMagnetCorner, contextMagnetCorner], true); }
            if (elementMagnetCorner && contextMagnetCorner) { this.align(elementMagnetCorner, contextMagnetCorner); }
        }
    }
}; YAHOO.widget.Overlay.prototype.align = function (elementAlign, contextAlign) {
    var contextArgs = this.cfg.getProperty("context"); if (contextArgs) {
        var context = contextArgs[0]; var element = this.element; var me = this; if (!elementAlign) { elementAlign = contextArgs[1]; }
        if (!contextAlign) { contextAlign = contextArgs[2]; }
        if (element && context) { var contextRegion = YAHOO.util.Dom.getRegion(context); var doAlign = function (v, h) { switch (elementAlign) { case YAHOO.widget.Overlay.TOP_LEFT: me.moveTo(h, v); break; case YAHOO.widget.Overlay.TOP_RIGHT: me.moveTo(h - element.offsetWidth, v); break; case YAHOO.widget.Overlay.BOTTOM_LEFT: me.moveTo(h, v - element.offsetHeight); break; case YAHOO.widget.Overlay.BOTTOM_RIGHT: me.moveTo(h - element.offsetWidth, v - element.offsetHeight); break; } }; switch (contextAlign) { case YAHOO.widget.Overlay.TOP_LEFT: doAlign(contextRegion.top, contextRegion.left); break; case YAHOO.widget.Overlay.TOP_RIGHT: doAlign(contextRegion.top, contextRegion.right); break; case YAHOO.widget.Overlay.BOTTOM_LEFT: doAlign(contextRegion.bottom, contextRegion.left); break; case YAHOO.widget.Overlay.BOTTOM_RIGHT: doAlign(contextRegion.bottom, contextRegion.right); break; } }
    }
}; YAHOO.widget.Overlay.prototype.enforceConstraints = function (type, args, obj) {
    var pos = args[0]; var x = pos[0]; var y = pos[1]; var offsetHeight = this.element.offsetHeight; var offsetWidth = this.element.offsetWidth; var viewPortWidth = YAHOO.util.Dom.getViewportWidth(); var viewPortHeight = YAHOO.util.Dom.getViewportHeight(); var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollY = document.documentElement.scrollTop || document.body.scrollTop; var topConstraint = scrollY + 10; var leftConstraint = scrollX + 10; var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10; var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10; if (x < leftConstraint) { x = leftConstraint; } else if (x > rightConstraint) { x = rightConstraint; }
    if (y < topConstraint) { y = topConstraint; } else if (y > bottomConstraint) { y = bottomConstraint; }
    this.cfg.setProperty("x", x, true); this.cfg.setProperty("y", y, true); this.cfg.setProperty("xy", [x, y], true);
}; YAHOO.widget.Overlay.prototype.center = function () { var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollY = document.documentElement.scrollTop || document.body.scrollTop; var viewPortWidth = YAHOO.util.Dom.getClientWidth(); var viewPortHeight = YAHOO.util.Dom.getClientHeight(); var elementWidth = this.element.offsetWidth; var elementHeight = this.element.offsetHeight; var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX; var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY; this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]); this.cfg.refireEvent("iframe"); }; YAHOO.widget.Overlay.prototype.syncPosition = function () { var pos = YAHOO.util.Dom.getXY(this.element); this.cfg.setProperty("x", pos[0], true); this.cfg.setProperty("y", pos[1], true); this.cfg.setProperty("xy", pos, true); }; YAHOO.widget.Overlay.prototype.onDomResize = function (e, obj) { YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj); var me = this; setTimeout(function () { me.syncPosition(); me.cfg.refireEvent("iframe"); me.cfg.refireEvent("context"); }, 0); }; YAHOO.widget.Overlay.prototype.destroy = function () {
    if (this.iframe) { this.iframe.parentNode.removeChild(this.iframe); }
    this.iframe = null; YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this); YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this); YAHOO.widget.Overlay.superclass.destroy.call(this);
}; YAHOO.widget.Overlay.prototype.toString = function () { return "Overlay " + this.id; }; YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll"); YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize"); YAHOO.widget.Overlay.windowScrollHandler = function (e) {
    if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
        if (!window.scrollEnd) { window.scrollEnd = -1; }
        clearTimeout(window.scrollEnd); window.scrollEnd = setTimeout(function () { YAHOO.widget.Overlay.windowScrollEvent.fire(); }, 1);
    } else { YAHOO.widget.Overlay.windowScrollEvent.fire(); }
}; YAHOO.widget.Overlay.windowResizeHandler = function (e) {
    if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
        if (!window.resizeEnd) { window.resizeEnd = -1; }
        clearTimeout(window.resizeEnd); window.resizeEnd = setTimeout(function () { YAHOO.widget.Overlay.windowResizeEvent.fire(); }, 100);
    } else { YAHOO.widget.Overlay.windowResizeEvent.fire(); }
}; YAHOO.widget.Overlay._initialized = null; if (YAHOO.widget.Overlay._initialized === null) { YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler); YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler); YAHOO.widget.Overlay._initialized = true; }
YAHOO.widget.OverlayManager = function (userConfig) { this.init(userConfig); }; YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused"; YAHOO.widget.OverlayManager.prototype = { constructor: YAHOO.widget.OverlayManager, overlays: null, initDefaultConfig: function () { this.cfg.addProperty("overlays", { suppressEvent: true }); this.cfg.addProperty("focusevent", { value: "mousedown" }); }, init: function (userConfig) {
    this.cfg = new YAHOO.util.Config(this); this.initDefaultConfig(); if (userConfig) { this.cfg.applyConfig(userConfig, true); }
    this.cfg.fireQueue(); var activeOverlay = null; this.getActive = function () { return activeOverlay; }; this.focus = function (overlay) {
        var o = this.find(overlay); if (o) {
            if (activeOverlay != o) {
                if (activeOverlay) { activeOverlay.blur(); }
                activeOverlay = o; YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED); this.overlays.sort(this.compareZIndexDesc); var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex"); if (!isNaN(topZIndex) && this.overlays[0] != overlay) { activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex, 10) + 2)); }
                this.overlays.sort(this.compareZIndexDesc); o.focusEvent.fire();
            }
        }
    }; this.remove = function (overlay) { var o = this.find(overlay); if (o) { var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex"); o.cfg.setProperty("zIndex", -1000, true); this.overlays.sort(this.compareZIndexDesc); this.overlays = this.overlays.slice(0, this.overlays.length - 1); o.cfg.setProperty("zIndex", originalZ, true); o.cfg.setProperty("manager", null); o.focusEvent = null; o.blurEvent = null; o.focus = null; o.blur = null; } }; this.blurAll = function () { for (var o = 0; o < this.overlays.length; o++) { this.overlays[o].blur(); } }; this._onOverlayBlur = function (p_sType, p_aArgs) { activeOverlay = null; }; var overlays = this.cfg.getProperty("overlays"); if (!this.overlays) { this.overlays = []; }
    if (overlays) { this.register(overlays); this.overlays.sort(this.compareZIndexDesc); }
}, register: function (overlay) {
    if (overlay instanceof YAHOO.widget.Overlay) {
        overlay.cfg.addProperty("manager", { value: this }); overlay.focusEvent = new YAHOO.util.CustomEvent("focus", overlay); overlay.blurEvent = new YAHOO.util.CustomEvent("blur", overlay); var mgr = this; overlay.focus = function () { mgr.focus(this); }; overlay.blur = function () { if (mgr.getActive() == this) { YAHOO.util.Dom.removeClass(this.element, YAHOO.widget.OverlayManager.CSS_FOCUSED); this.blurEvent.fire(); } }; overlay.blurEvent.subscribe(mgr._onOverlayBlur); var focusOnDomEvent = function (e, obj) { overlay.focus(); }; var focusevent = this.cfg.getProperty("focusevent"); YAHOO.util.Event.addListener(overlay.element, focusevent, focusOnDomEvent, this, true); var zIndex = YAHOO.util.Dom.getStyle(overlay.element, "zIndex"); if (!isNaN(zIndex)) { overlay.cfg.setProperty("zIndex", parseInt(zIndex, 10)); } else { overlay.cfg.setProperty("zIndex", 0); }
        this.overlays.push(overlay); return true;
    } else if (overlay instanceof Array) {
        var regcount = 0; for (var i = 0; i < overlay.length; i++) { if (this.register(overlay[i])) { regcount++; } }
        if (regcount > 0) { return true; }
    } else { return false; }
}, find: function (overlay) {
    if (overlay instanceof YAHOO.widget.Overlay) { for (var o = 0; o < this.overlays.length; o++) { if (this.overlays[o] == overlay) { return this.overlays[o]; } } } else if (typeof overlay == "string") { for (var p = 0; p < this.overlays.length; p++) { if (this.overlays[p].id == overlay) { return this.overlays[p]; } } }
    return null;
}, compareZIndexDesc: function (o1, o2) { var zIndex1 = o1.cfg.getProperty("zIndex"); var zIndex2 = o2.cfg.getProperty("zIndex"); if (zIndex1 > zIndex2) { return -1; } else if (zIndex1 < zIndex2) { return 1; } else { return 0; } }, showAll: function () { for (var o = 0; o < this.overlays.length; o++) { this.overlays[o].show(); } }, hideAll: function () { for (var o = 0; o < this.overlays.length; o++) { this.overlays[o].hide(); } }, toString: function () { return "OverlayManager"; }
}; YAHOO.widget.ContainerEffect = function (overlay, attrIn, attrOut, targetElement, animClass) {
    if (!animClass) { animClass = YAHOO.util.Anim; }
    this.overlay = overlay; this.attrIn = attrIn; this.attrOut = attrOut; this.targetElement = targetElement || overlay.element; this.animClass = animClass;
}; YAHOO.widget.ContainerEffect.prototype.init = function () { this.beforeAnimateInEvent = new YAHOO.util.CustomEvent("beforeAnimateIn", this); this.beforeAnimateOutEvent = new YAHOO.util.CustomEvent("beforeAnimateOut", this); this.animateInCompleteEvent = new YAHOO.util.CustomEvent("animateInComplete", this); this.animateOutCompleteEvent = new YAHOO.util.CustomEvent("animateOutComplete", this); this.animIn = new this.animClass(this.targetElement, this.attrIn.attributes, this.attrIn.duration, this.attrIn.method); this.animIn.onStart.subscribe(this.handleStartAnimateIn, this); this.animIn.onTween.subscribe(this.handleTweenAnimateIn, this); this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn, this); this.animOut = new this.animClass(this.targetElement, this.attrOut.attributes, this.attrOut.duration, this.attrOut.method); this.animOut.onStart.subscribe(this.handleStartAnimateOut, this); this.animOut.onTween.subscribe(this.handleTweenAnimateOut, this); this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut, this); }; YAHOO.widget.ContainerEffect.prototype.animateIn = function () { this.beforeAnimateInEvent.fire(); this.animIn.animate(); }; YAHOO.widget.ContainerEffect.prototype.animateOut = function () { this.beforeAnimateOutEvent.fire(); this.animOut.animate(); }; YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn = function (type, args, obj) { }; YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn = function (type, args, obj) { }; YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn = function (type, args, obj) { }; YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut = function (type, args, obj) { }; YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut = function (type, args, obj) { }; YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut = function (type, args, obj) { }; YAHOO.widget.ContainerEffect.prototype.toString = function () {
    var output = "ContainerEffect"; if (this.overlay) { output += " [" + this.overlay.toString() + "]"; }
    return output;
}; YAHOO.widget.ContainerEffect.FADE = function (overlay, dur) {
    var fade = new YAHOO.widget.ContainerEffect(overlay, { attributes: { opacity: { from: 0, to: 1} }, duration: dur, method: YAHOO.util.Easing.easeIn }, { attributes: { opacity: { to: 0} }, duration: dur, method: YAHOO.util.Easing.easeOut }, overlay.element); fade.handleStartAnimateIn = function (type, args, obj) {
        YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select"); if (!obj.overlay.underlay) { obj.overlay.cfg.refireEvent("underlay"); }
        if (obj.overlay.underlay) { obj.initialUnderlayOpacity = YAHOO.util.Dom.getStyle(obj.overlay.underlay, "opacity"); obj.overlay.underlay.style.filter = null; }
        YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible"); YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 0);
    }; fade.handleCompleteAnimateIn = function (type, args, obj) {
        YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select"); if (obj.overlay.element.style.filter) { obj.overlay.element.style.filter = null; }
        if (obj.overlay.underlay) { YAHOO.util.Dom.setStyle(obj.overlay.underlay, "opacity", obj.initialUnderlayOpacity); }
        obj.overlay.cfg.refireEvent("iframe"); obj.animateInCompleteEvent.fire();
    }; fade.handleStartAnimateOut = function (type, args, obj) { YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select"); if (obj.overlay.underlay) { obj.overlay.underlay.style.filter = null; } }; fade.handleCompleteAnimateOut = function (type, args, obj) {
        YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select"); if (obj.overlay.element.style.filter) { obj.overlay.element.style.filter = null; }
        YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden"); YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 1); obj.overlay.cfg.refireEvent("iframe"); obj.animateOutCompleteEvent.fire();
    }; fade.init(); return fade;
}; YAHOO.widget.ContainerEffect.SLIDE = function (overlay, dur) {
    var x = overlay.cfg.getProperty("x") || YAHOO.util.Dom.getX(overlay.element); var y = overlay.cfg.getProperty("y") || YAHOO.util.Dom.getY(overlay.element); var clientWidth = YAHOO.util.Dom.getClientWidth(); var offsetWidth = overlay.element.offsetWidth; var slide = new YAHOO.widget.ContainerEffect(overlay, { attributes: { points: { to: [x, y]} }, duration: dur, method: YAHOO.util.Easing.easeIn }, { attributes: { points: { to: [(clientWidth + 25), y]} }, duration: dur, method: YAHOO.util.Easing.easeOut }, overlay.element, YAHOO.util.Motion); slide.handleStartAnimateIn = function (type, args, obj) { obj.overlay.element.style.left = (-25 - offsetWidth) + "px"; obj.overlay.element.style.top = y + "px"; }; slide.handleTweenAnimateIn = function (type, args, obj) {
        var pos = YAHOO.util.Dom.getXY(obj.overlay.element); var currentX = pos[0]; var currentY = pos[1]; if (YAHOO.util.Dom.getStyle(obj.overlay.element, "visibility") == "hidden" && currentX < x) { YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible"); }
        obj.overlay.cfg.setProperty("xy", [currentX, currentY], true); obj.overlay.cfg.refireEvent("iframe");
    }; slide.handleCompleteAnimateIn = function (type, args, obj) { obj.overlay.cfg.setProperty("xy", [x, y], true); obj.startX = x; obj.startY = y; obj.overlay.cfg.refireEvent("iframe"); obj.animateInCompleteEvent.fire(); }; slide.handleStartAnimateOut = function (type, args, obj) { var vw = YAHOO.util.Dom.getViewportWidth(); var pos = YAHOO.util.Dom.getXY(obj.overlay.element); var yso = pos[1]; var currentTo = obj.animOut.attributes.points.to; obj.animOut.attributes.points.to = [(vw + 25), yso]; }; slide.handleTweenAnimateOut = function (type, args, obj) { var pos = YAHOO.util.Dom.getXY(obj.overlay.element); var xto = pos[0]; var yto = pos[1]; obj.overlay.cfg.setProperty("xy", [xto, yto], true); obj.overlay.cfg.refireEvent("iframe"); }; slide.handleCompleteAnimateOut = function (type, args, obj) { YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden"); obj.overlay.cfg.setProperty("xy", [x, y]); obj.animateOutCompleteEvent.fire(); }; slide.init(); return slide;
}; YAHOO.register("container_core", YAHOO.widget.Module, { version: "2.2.1", build: "193" });

// Short hand
var YUD = YAHOO.util.Dom,
    YUE = YAHOO.util.Event,
    YUA = YAHOO.util.Anim,
    YUC = YAHOO.util.Connect,

// SET FLASH VERSION VARIABLES
    requiredMajorVersion = 7,
    requiredMinorVersion = 0,
    requiredRevision = 0;

/* --------------------------------------------
Misc Functions
-------------------------------------------- */
function focusSearch() {
    if (!document.globSearch) { return false };
    var search = document.globSearch;

    for (var i = 0; i < search.elements.length; i++) {
        var element = search.elements[i];
        if (element.type == "submit") continue;
        if (!element.defaultValue) continue;

        element.onfocus = function () {
            if (this.value == this.defaultValue) {
                this.value = "";
            }
        }

        element.onblur = function () {
            if (this.value == "") {
                this.value = this.defaultValue;
            }
        }
    }
}

function setLocationCookie(href) {
    var saveLoc = YUD.get('makeDefaultLoc');
    if (saveLoc.checked) {
        setCookie('location', unescape(href), 360 * 5);
    }
}

function setCookie(name, value, expires, options) {
    if (options === undefined) { options = {}; }
    if (expires) {
        var expires_date = new Date();
        expires_date.setDate(expires_date.getDate() + expires)
    }
    document.cookie = name + '=' + value +
      ((expires) ? ';expires=' + expires_date.toGMTString() : '') +
      ((options.path) ? ';path=' + options.path : '') +
      ((options.domain) ? ';domain=' + options.domain : '') +
      ((options.secure) ? ';secure' : '');
}

// ANIMATION FOR DROP-DOWN MENU

var ControlPanel = function (element, container, control) {
    if (element) {
        this.init(element, container, control);
    }
};

ControlPanel.prototype = {

    addControlListener: function () {
        YUE.addListener(this.control, 'click', this.handleControlClick, this, true);
    },

    handleControlClick: function (e) {

        YUE.preventDefault(e);
        if (YUD.hasClass(this.element, 'closed')) {
            if (YUD.getStyle(this.container, "visibility") == "hidden") {
                YUD.setStyle(this.container, "visibility", "visible");
                YUD.setStyle(this.container, "margin-top", parseInt(0 - this.container.scrollHeight) + "px");
            };

            this.rollDown();
            YUD.replaceClass(this.control, 'off', 'on');
        } else {
            this.rollUp();
            YUD.replaceClass(this.control, 'on', 'off');
        }
        YUD.setStyle(this.container, "height", "auto");

    },

    rollUp: function () {
        var button_container = this.container;

        var attributes = {
            marginTop: { to: 0 - button_container.offsetHeight }
        };

        var anim = new YUA(button_container, attributes, 0.4, YAHOO.util.Easing.backIn);
        anim.onComplete.subscribe(function () { YUD.addClass(this.element, 'closed') }, this, true);
        anim.animate();
    },

    rollDown: function () {
        var button_container = this.container;

        var attributes = {
            marginTop: { to: 0 }
        };

        var anim = new YUA(button_container, attributes, 0.4, YAHOO.util.Easing.backOut);
        YUD.removeClass(this.element, 'closed');
        anim.animate();
    },

    init: function (element, container, control) {
        this.element = YUD.get(element);
        this.container = YUD.get(container);
        this.control = YUD.get(control);

        if (control) {
            this.addControlListener();
        }
    }

};

function initPrefsPane() {

    function create(module) {

        var hdr = YUD.getElementsByClassName("hdr", null, module)[0];
        var bdy = YUD.getElementsByClassName("bdy", "ul", module)[0];

        new ControlPanel(module, bdy, hdr);

    }

    if (!YUD.getElementsByClassName("module")[0]) { return false };
    var modules = YUD.getElementsByClassName("module", "div", this);

    YUD.batch(modules, create);
};

function initDropDown() {
    if (!document.getElementById("infoBoxSecondary")) { return false };
    YUE.onContentReady('bdy', initPrefsPane);
}

// ----------------------------------------------------------------------------------------------

// ROUNDED CORNERS FOR GLOBAL NAV + PRODUCT INFOBOXS

function roundedCorners() {
    if (!NiftyCheck())
        return;
    /* main nav */
    var roundFunc = Rounded,
        mainNav = YUD.get('mainNav'),
        firstLevNav = YUD.getElementsBy(function (obj) {
            if (obj.parentNode.parentNode.id == 'mainNav') {
                return true;
            }
            else {
                return false;
            }
        }, 'ul', mainNav);

    // Get the first level nodes an apply the bottom rounded corners to them        
    roundFunc(firstLevNav, "bottom", "transparent", "#FFF", "border #CCC");

    var isIE6 = document.compatMode && document.all && !window.XMLHttpRequest,
        shimFrame,
        menuItems = mainNav == null ? [] : mainNav.getElementsByTagName('ul'),
        height = '0px',
        width = '0px',
        region;

    if (isIE6) {
        for (var i = 0, len = menuItems.length; i < len; i++) {
            region = YUD.getRegion(menuItems[i]);
            height = (region.bottom - region.top) + 'px';
            width = (region.right - region.left) + 'px';
            shimFrame = document.createElement('iframe');

            shimFrame.setAttribute('src', 'javascript:false');
            shimFrame.setAttribute('scrolling', 'no');
            shimFrame.setAttribute('frameborder', '0');

            YUD.addClass(shimFrame, 'hdrshim');
            YUD.setStyle(shimFrame, 'z-index', -1);
            YUD.setStyle(shimFrame, 'height', height);

            menuItems[i].parentNode.insertBefore(shimFrame, menuItems[i]);
        }
    }

    // Set the rounded corners on the rest of the ul 
    for (var i = 0, len = firstLevNav.length; i < len; i++) {
        roundFunc(firstLevNav[i].getElementsByTagName('ul'), "all", "transparent", "#FFF", "border #CCC");
    }


}

function NiftyCheck() {
    if (!document.getElementById || !document.createElement)
        return (false);
    var b = navigator.userAgent.toLowerCase();
    if (b.indexOf("msie 5") > 0 && b.indexOf("opera") == -1)
        return (false);
    return (true);
}

function Rounded(selector, wich, bk, color, opt) {
    var i, prefixt, prefixb, cn = "r", ecolor = "", edges = false, eclass = "", b = false, t = false;

    if (color == "transparent") {
        cn = cn + "x";
        ecolor = bk;
        bk = "transparent";
    }
    else if (opt && opt.indexOf("border") >= 0) {
        var optar = opt.split(" ");
        for (i = 0; i < optar.length; i++)
            if (optar[i].indexOf("#") >= 0) ecolor = optar[i];
        if (ecolor == "") ecolor = "#666";
        cn += "e";
        edges = true;
    }
    else if (opt && opt.indexOf("smooth") >= 0) {

        cn += "a";
        ecolor = Mix(bk, color);
    }
    if (opt && opt.indexOf("small") >= 0) cn += "s";
    prefixt = cn;
    prefixb = cn;
    if (wich.indexOf("all") >= 0) { t = true; b = true }
    else if (wich.indexOf("top") >= 0) t = "true";
    else if (wich.indexOf("tl") >= 0) {
        t = "true";
        if (wich.indexOf("tr") < 0) prefixt += "l";
    }
    else if (wich.indexOf("tr") >= 0) {
        t = "true";
        prefixt += "r";
    }
    if (wich.indexOf("bottom") >= 0) b = true;
    else if (wich.indexOf("bl") >= 0) {
        b = "true";
        if (wich.indexOf("br") < 0) prefixb += "l";
    }
    else if (wich.indexOf("br") >= 0) {
        b = "true";
        prefixb += "r";
    }
    var v = typeof selector == 'string' ? getElementsBySelector(selector) : selector;
    var l = v.length;
    for (i = 0; i < l; i++) {
        if (edges) AddBorder(v[i], ecolor);
        if (t) AddTop(v[i], bk, color, ecolor, prefixt);
        if (b) AddBottom(v[i], bk, color, ecolor, prefixb);
    }
}

function AddBorder(el, bc) {
    var i;
    if (!el.passed) {
        if (el.childNodes.length == 1 && el.childNodes[0].nodeType == 3) {
            var t = el.firstChild.nodeValue;
            el.removeChild(el.lastChild);
            var d = CreateEl("span");

            d.style.display = "block";
            d.appendChild(document.createTextNode(t));
            el.appendChild(d);
        }
        for (i = 0; i < el.childNodes.length; i++) {
            if (el.childNodes[i].nodeType == 1) {
                el.childNodes[i].style.borderLeft = "1px solid " + bc;
                el.childNodes[i].style.borderRight = "1px solid " + bc;
            }
        }
    }
    el.passed = true;
}

function AddTop(el, bk, color, bc, cn) {
    var i, lim = 4, d = CreateEl("b");

    if (cn.indexOf("s") >= 0) lim = 2;
    if (bc) d.className = "artop";
    else d.className = "rtop";
    d.style.backgroundColor = bk;
    for (i = 1; i <= lim; i++) {
        var x = CreateEl("b");
        x.className = cn + i;
        x.style.backgroundColor = color;
        if (bc) x.style.borderColor = bc;
        d.appendChild(x);
    }
    el.style.paddingTop = 0;
    el.insertBefore(d, el.firstChild);
}

function AddBottom(el, bk, color, bc, cn) {
    var i, lim = 4, d = CreateEl("b");

    if (cn.indexOf("s") >= 0) lim = 2;
    if (bc) d.className = "artop";
    else d.className = "rtop";
    d.style.backgroundColor = bk;
    for (i = lim; i > 0; i--) {
        var x = CreateEl("b");
        x.className = cn + i;
        x.style.backgroundColor = color;
        if (bc) x.style.borderColor = bc;
        d.appendChild(x);
    }
    el.style.paddingBottom = 0;
    el.appendChild(d);
}

function CreateEl(x) {
    return (document.createElement(x));
}

function getElementsBySelector(selector) {
    var i, selid = "", selclass = "", tag = selector, f, s = [], objlist = [];

    if (selector.indexOf(" ") > 0) {  //descendant selector like "tag#id tag"
        s = selector.split(" ");
        var fs = s[0].split("#");
        if (fs.length == 1) return (objlist);
        f = document.getElementById(fs[1]);
        if (f) return (f.getElementsByTagName(s[1]));
        return (objlist);
    }
    if (selector.indexOf("#") > 0) { //id selector like "tag#id"
        s = selector.split("#");
        tag = s[0];
        selid = s[1];
    }
    if (selid != "") {
        f = document.getElementById(selid);
        if (f) objlist.push(f);
        return (objlist);
    }
    if (selector.indexOf(".") > 0) {  //class selector like "tag.class"
        s = selector.split(".");
        tag = s[0];
        selclass = s[1];
    }
    var v = document.getElementsByTagName(tag);  // tag selector like "tag"
    if (selclass == "")
        return (v);
    for (i = 0; i < v.length; i++) {
        if (v[i].className.indexOf(selclass) >= 0) {
            objlist.push(v[i]);
        }
    }
    return (objlist);
}

function Mix(c1, c2) {
    var i, step1, step2, x, y, r = new Array(3);
    if (c1.length == 4) step1 = 1;
    else step1 = 2;
    if (c2.length == 4) step2 = 1;
    else step2 = 2;
    for (i = 0; i < 3; i++) {
        x = parseInt(c1.substr(1 + step1 * i, step1), 16);
        if (step1 == 1) x = 16 * x + x;
        y = parseInt(c2.substr(1 + step2 * i, step2), 16);
        if (step2 == 1) y = 16 * y + y;
        r[i] = Math.floor((x * 50 + y * 50) / 100);
    }
    return ("#" + r[0].toString(16) + r[1].toString(16) + r[2].toString(16));
}

function setTextAreaCharLimit(tArea, charLimit) {
    var tArea = typeof tArea == 'string' ? YUD.get(tArea) : tArea;
    var countChars = function (e, obj) {
        if (this.value.length > this.charLimit) {
            this.value = this.value.substring(0, this.charLimit);
        }
    };
    // Only set the handler on the textarea once
    if (tArea.chars !== undefined) {
        return;
    }
    else {
        tArea.charLimit = charLimit;
        YUE.on(tArea, 'keyup', countChars, tArea, true);
        YUE.on(tArea, 'keydown', countChars, tArea, true);
        YUE.on(tArea, 'focus', countChars, tArea, true);
    }
}

function createWin(href, name, attr) {
    var win = window.open(href, name, attr);
    if (win == null || typeof win == 'undefined') {
        return true;
    }
    else {
        return false;
    }
}

/* --------------------------------------------
Custom Classes
-------------------------------------------- */

// DHTML dropdown menus
(function () {

    MouseOverNav = function (id) {
        this.init(id);
    }

    MouseOverNav.prototype =
    {
        init: function (id) {
            var me = this;
            me.timerStarted = false;

            var mouseOverCallBack = function (e, obj) {
                var elem = this;


                if (elem.hideTimer) {
                    clearTimeout(elem.hideTimer);
                    elem.hideTimer = null;
                }

                if (!YUD.hasClass(elem, 'sfhover')) {
                    elem.showTimer = setTimeout(function () {
                        YUD.addClass(elem, 'sfhover');
                    }, 250);
                }
            }

            var mouseOutCallBack = function (e, obj) {
                var elem = this;

                if (elem.showTimer) {
                    clearTimeout(elem.showTimer);
                    elem.showTimer = null;
                }

                if (YUD.hasClass(elem, 'sfhover')) {
                    elem.hideTimer = setTimeout(function () {
                        YUD.removeClass(elem, 'sfhover');
                    }, 250);

                }
            }

            YUE.onAvailable(id, function (obj) {
                var els = this.getElementsByTagName('li');
                YUE.on(els, 'mouseover', mouseOverCallBack);
                YUE.on(els, 'mouseout', mouseOutCallBack);
            });
        }
    }
})();

// PRODUCT IMAGE CAROUSEL
(function () {

    var me;
    // Constructor
    ProductCarousel = function (oParams) {
        me = this;
        var _elem = document.createElement('div'),
            _str = [];

        _str.push('<div id="carouselDialog">');
        _str.push('<div id="carouselPopUpBox">');
        _str.push('<a href="#" title="Close Window" id="carouselClose"><img src="/images/btn_close.gif" alt="close window" /></a>');
        _str.push('<div class="carouselBd">');
        _str.push('<img id="default-image" height="368" src=""  />');
        _str.push('<div id="dhtml-carousel" class="carousel-component">');
        _str.push('<div id="carouselBottom">');
        _str.push('<img id="prev-arrow" class="left-button-image" src="/images/morePhotos_leftON.gif" alt="previous image" />');
        _str.push('<img id="next-arrow" class="right-button-image" src="/images/morePhotos_rightON.gif" alt="next image" />');
        _str.push('<div id="carousel-ul" class="carousel-clip-region"></div>');
        _str.push('</div>');
        _str.push('</div>');
        _str.push('</div>');
        _str.push('</div>');
        _str.push('</div>');

        _elem.innerHTML = _str.join('\n');

        YUE.onAvailable('bdy', function () {
            document.body.appendChild(_elem);
        });

        _str = null;


        YUE.onAvailable("carousel-ul", function () {

            var ulTarget = this;
            // create the UL on the fly to avoid W3C validation error (empty ULs)
            ulTarget.innerHTML = "<ul class='carousel-list'></ul>";

            me.dialog = new YAHOO.widget.Overlay('carouselDialog',
            {
                visible: false,
                fixedcenter: true,
                zindex: 999,
                effect: { effect: YAHOO.widget.ContainerEffect.FADE, duration: 0.25 }
            });

            me.dialog.render();

            YUE.on('carouselClose', 'click', function () {
                me.dialog.hide();
            });

            YUE.on('productOverlayBox', 'click', function () {
                me.dialog.show();
            });

            pageLoad();
            prepareGallery();

        });

        me.thumbs = oParams.thumbs;
        me.photos = oParams.photos;

    }

    // PRODUCT IMAGE CAROUSEL
    /*
    Copyright (c) 2006, Bill W. Scott
    All rights reserved.
    Version 0.3.6 - 12.13.2006
    */

    var lastRan = -1;

    /* create the interface for each carousel item */
    var fmtItem = function (imgUrl, url) {

        var innerHTML = '<a href="' + url + '"><img src="' + imgUrl + '" width="' + 62 + '" height="' + 38 + '" alt="Product Thumb" /></a>';
        return innerHTML;

    };

    /* inital load handler */
    var loadInitialItems = function (type, args) {

        var start = args[0];
        var last = args[1];

        load(this, start, last);
    };

    /* load next handler */
    var loadNextItems = function (type, args) {

        var start = args[0];
        var last = args[1];
        var alreadyCached = args[2];

        if (!alreadyCached) {
            load(this, start, last);
        }
        prepareGallery();
    };

    /* load previous handler */
    var loadPrevItems = function (type, args) {
        var start = args[0];
        var last = args[1];
        var alreadyCached = args[2];

        if (!alreadyCached) {
            load(this, start, last);
        }
    };

    var load = function (carousel, start, last) {
        for (var i = start; i <= last; i++) {
            carousel.addItem(i, fmtItem(me.thumbs[i - 1], me.photos[i - 1]));
        }
    };

    /* enabling/disabling button state. */
    var handlePrevButtonState = function (type, args) {

        var enabling = args[0];
        var leftImage = args[1];
        if (enabling) {
            leftImage.src = "/images/morePhotos_leftON.gif";
        } else {
            leftImage.src = "/images/morePhotos_leftOFF.gif";
        }

    };

    var handleNextButtonState = function (type, args) {

        var enabling = args[0];
        var rightImage = args[1];
        if (enabling) {
            rightImage.src = "/images/morePhotos_rightON.gif";
        } else {
            rightImage.src = "/images/morePhotos_rightOFF.gif";
        }

    };

    /* create the carousel after the page is loaded since it is dependent on an HTML element */
    var pageLoad = function () {

        var carousel = new YAHOO.extension.Carousel("dhtml-carousel",
                {
                    numVisible: (me.thumbs.length < 4 ? me.thumbs.length : 4),
                    animationSpeed: .25,
                    scrollInc: 3,
                    navMargin: 40,
                    prevElementID: "prev-arrow",
                    nextElementID: "next-arrow",
                    loadInitHandler: loadInitialItems,
                    loadNextHandler: loadNextItems,
                    loadPrevHandler: loadPrevItems,
                    size: me.thumbs.length,
                    prevButtonStateHandler: handlePrevButtonState,
                    nextButtonStateHandler: handleNextButtonState
                }
            );

        YUE.onAvailable('default-image', function () {
            this.src = me.photos[0];
        });

        // Custom fix for carousel width if fewer than 4 items
        YUE.onAvailable('dhtml-carousel', function () {
            if (me.thumbs.length < 4) {
                YUD.setStyle(this, 'width', '380px');
            }
        });
    };

    /* grab current anchor tags and prapre onclick */
    function prepareGallery() {
        var gallery = YUD.getElementsByClassName("carousel-list")[0];
        var links = gallery.getElementsByTagName("a");
        for (var i = 0; i < links.length; i++) {
            links[i].onclick = function () {
                return showPic(this);
            }
        }
    }

    /* identify target and switch target image */
    function showPic(whichpic) {
        var source = whichpic.getAttribute("href");
        var targetImage = document.getElementById("default-image");
        targetImage.setAttribute("src", source);
        return false;
    }

    /*
    ProductCarousel.prototype.init = function(oParams)        
    {
    me.photos = oParams.photos;
    me.thumbs = oParams.photos;
            
    if(me.photos.length == 0 || me.thumbs.length == 0)
    {
    me = null;
    return;
    }
    else
    {
    if(me.photos[0] == '' && me.thumbs[0] == '')
    {
    me = null;
    return;
    }
    }            
            
    YUE.onAvailable("carousel-ul",function() {			
    var ulTarget = this;
    // create the UL on the fly to avoid W3C validation error (empty ULs)
    ulTarget.innerHTML = "<ul class='carousel-list'></ul>";
    			
    funcs.pageLoad();
    funcs.prepareGallery();
    });
            
    // Set the default image
    var defaultImg = YUD.get('default-image');
    defaultImg.src = me.photos[0];            
            
    }
    }
    */
})();

// Flash 360 View
(function () {
    Flash360View = function () {
        this.init();
    }

    Flash360View.prototype = {
        init: function () {
            var me = this;

            YUE.onAvailable('bdyCopy', function () {

                var y = YUD.getY(YUD.get('bdyCopyHdr')) + 40;
                me.popup = new PopUpDialog({
                    id: 'flash360Box',
                    parentId: 'bdyCopy',
                    popupType: '360',
                    centerInElement: true
                });

                me.popup.dialog.cfg.setProperty("y", y)
            });

            YUE.on('threeSixtyOverlayBox', 'click', function (e, obj) {
                YUE.preventDefault(e);
                me.popup.dialog.show();
            });
        }
    }

})();

var finderid = 0;
var printerfinderpopup;
var mediafinderpopup;
//var enginefinderpopup;
// Flash PrinterFinder View
(function () {
    PrinterFinder = function () {
        this.init();
    }

    PrinterFinder.prototype = {
        init: function () {
            var me = this;

            YUE.onAvailable('bdyCopy', function () {

                var y = YUD.getY(YUD.get('bdyCopyHdr')) + 40;
                printerfinderpopup = new PopUpDialog({
                    id: 'printerfinderBox',
                    parentId: 'bdyCopy',
                    popupType: 'printerfinder',
                    centerInElement: true
                });
                printerfinderpopup.dialog.cfg.setProperty("y", y)
            });

            //            YUE.on('submitBtn', 'click', function(e, obj){});			
        }
    }

})();
// Flash MediaFinder View

(function () {
    MediaFinder = function () {
        this.init();
    }

    MediaFinder.prototype = {
        init: function () {
            var me = this;

            YUE.onAvailable('bdyCopy', function () {

                var y = YUD.getY(YUD.get('bdyCopyHdr')) + 40;
                mediafinderpopup = new PopUpDialog({
                    id: 'mediafinderBox',
                    parentId: 'bdyCopy',
                    popupType: 'mediafinder',
                    centerInElement: true
                });
                mediafinderpopup.dialog.cfg.setProperty("y", y)
            });

        }
    }

})();


// Flash EngineFinder View
(function () {
    EngineFinder = function () {
        this.init();
    }

    EngineFinder.prototype = {
        init: function () {
            var me = this;

            YUE.onAvailable('bdyCopy', function () {

                var y = YUD.getY(YUD.get('bdyCopyHdr')) + 40;
                me.popup = new PopUpDialog({
                    id: 'enginefinderBox',
                    parentId: 'bdyCopy',
                    popupType: 'enginefinder',
                    centerInElement: true
                });
                me.popup.dialog.cfg.setProperty("y", y)
            });

            YUE.on('enginefinderlink', 'click', function (e, obj) {
                YUE.preventDefault(e);
                me.popup.dialog.show();
            });
        }
    }

})();

function btnclick() {
    var finderType = '';
    if (document.getElementById('CID').value == "5939" && document.getElementById('CID').value != "") {
        finderid = document.getElementById('CID').value;
        finderType = 'PrinterFinder';
    }
    else if (document.getElementById('CID').value == "5940" && document.getElementById('CID').value != "") {
        finderType = 'MediaFinder';
        finderid = document.getElementById('CID').value;
    }
    //        else if(document.getElementById('CID').value=="5941" && document.getElementById('CID').value!="" )
    //        {   
    //        finderType='EngineFinder';             
    //        finderid=document.getElementById('CID').value;
    //        }
    var s = s_gi(s.fun); s.linkTrackVars = 'eVar3'; s.eVar3 = finderType; s.tl(this, 'o', finderType);
}

// Downloads and manuals forms
(function () {
    DownloadsManuals = function (oParams) {
        this.init(oParams);
    }

    DownloadsManuals.prototype = {
        init: function (oParams) {
            var me = this;
            me.type = oParams.type;
            YUE.on('supportSearch', 'submit', me.submitCallBack, me, false);
        },

        submitCallBack: function (e, obj) {
            var category,
                catVal,
                family,
                famVal,
                prodVal,
                product
            YUE.preventDefault(e);

            category = document.getElementById('productcategory');
            family = document.getElementById('productfamily');
            product = document.getElementById('product');

            if (category.selectedIndex == 0) {
                obj.showError(YUD.get('productcategory'));
                return;
            }
            else {
                obj.hideError(YUD.get('productcategory'));
            }
            catVal = category.options[category.selectedIndex].value;
            famVal = family.options[family.selectedIndex].value;
            prodVal = product.options[product.selectedIndex].value;
            href = this.action + '?categoryid=' + (category.selectedIndex != 0 ? catVal : "") + '&familyid=' + (family.selectedIndex != 0 ? famVal : "") + '&productnodeid=' + (product.selectedIndex != 0 ? prodVal : "");
            location.href = href;

            return false;
        },

        showError: function (obj) {
            var error = document.createElement('span');
            YUD.addClass(error, 'req');
            error.innerHTML = errMsgs.selCat; //errMsgs.selAll
            obj.parentNode.insertBefore(error, obj.parentNode.firstChild);
        },

        hideError: function (obj) {
            var error = YUD.getElementsByClassName('req', 'span', obj.parentNode);
            if (error.length > 0) {
                obj.parentNode.removeChild(error[0]);
            }
        }
    };
})();
//setting focus for search box in downloads and manuals index pages
function setfocusdownloadsmanuals() {
    document.getElementById("txtdownloadsmanuals").focus();
}
//validating search box in downloads and manuals index pages.
function validatedownloadsmanuals() {
    if (document.getElementById("txtdownloadsmanuals").value.split(' ').join('') == "") {
        document.getElementById("lblDownloadsManuals").innerHTML = "Please enter a product name";
        document.getElementById("txtdownloadsmanuals").focus();
        return false;
    }
}
//validating banner search box in casestudies and white papers index pages.
function validatelearninghdrsearch() {
    if (document.getElementById("txtlearninghdr").value.split(' ').join('') == "") {
        document.getElementById("lbllearninghdr").innerHTML = "Please enter a search term";
        document.getElementById("txtlearninghdr").focus();
        return false;
    }
}

//validating globsearch
function validateglobsearch() {
    var isallowed = false;
    var re = /[a-zA-Z0-9 ]+/;
    isallowed = re.test(document.getElementById("searchField").value.split(' ').join(''));
    if (!isallowed) {
        document.getElementById("lblglobsearch").innerHTML = "Please enter a valid search term";
        return false;
    }
    else if (document.getElementById("searchField").value.split(' ').join('') == "SEARCH" || document.getElementById("searchField").value.split(' ').join('').toLowerCase() == "search" || document.getElementById("searchField").value.split(' ').join('') == "") {

        document.getElementById("lblglobsearch").innerHTML = "Please enter a search term";

        return false;
    }
}

//Manuals Language selection
function dosubmit(ddl) {
    var url = window.location.href;
    var listcnt = url.indexOf("listing.aspx");
    var cnt = url.indexOf("=");
    catid = getQryStr("categoryid");
    famid = getQryStr("familyid");
    prodid = getQryStr("productnodeid");

    var callback = {

        success: function (response) {
            document.getElementById("manualContent").innerHTML = response.responseText;

        },

        failure: function (response) {
            //                var tabContent = YUD.get(response.argument[0]);
            //                tabContent.hasError = 1;
            //                YUD.removeClass(tabContent, 'loading');
            //                tabContent.innerHTML = '<h4 class="req">Sorry, this page could not be loaded.  Please try again</h4>';
        }

    }

    if (cnt != -1) {
        YUC.asyncRequest('get', 'search.aspx?mode=bodyContent&id=manualContent&sel=' + ddl.options[ddl.selectedIndex].value + '&categoryid=' + catid + '&familyid=' + famid + '&productnodeid=' + prodid, callback);
    }
    else if (listcnt != -1) {
        YUC.asyncRequest('get', 'listing.aspx?mode=bodyContent&id=manualContent&sel=' + ddl.options[ddl.selectedIndex].value, callback);
    }
    else {
        YUC.asyncRequest('get', 'manuals.aspx?mode=bodyContent&id=manualContent&sel=' + ddl.options[ddl.selectedIndex].value, callback);
    }

}
function getQryStr(str) {
    querystr = window.location.search.substring(1);
    qstr = querystr.split("&");
    for (i = 0; i < qstr.length; i++) {
        qval = qstr[i].split("=");
        if (qval[0] == str) {
            return qval[1];
        }
    }
}


function setStatus() {
    document.getElementById("erruname").innerHTML = "";
    document.getElementById("errpwd").innerHTML = "";
    if (document.getElementById("txtusername").value == "") {
        document.getElementById("erruname").innerHTML = "Username can not be blank.";
        return false;
    }
    else if (document.getElementById("txtusername").value != "") {
        var re = /^[a-zA-Z0-9 ]+$/;
        isallowed = re.test(document.getElementById("txtusername").value);
        if (!isallowed) {
            document.getElementById("erruname").innerHTML = "Only alphanumeric characters are allowed in username.";
            return false;
        }
        else
        { document.getElementById("erruname").innerHTML = ""; }
    }


    if (document.getElementById("txtpwd").value == "") {
        document.getElementById("errpwd").innerHTML = "Password can not be blank.";
        return false;
    }
    else
    { document.getElementById("errpwd").innerHTML = ""; }

}

function createHotspot() {
    var bannerimage = document.getElementById("bannerimage").value;
    var altbannerimage = document.getElementById("altbannerimage").value;
    var container = document.getElementById("bdyCopyHdr");
    var hotspot = document.getElementById("hotspot");
    var bannerheading = document.getElementById("bannerheading").value;
    var altbannerheading = document.getElementById("altbannerheading").value;
    var proddescription = document.getElementById("proddescription").value;
    var altproddescription = document.getElementById("altproddescription").value;


    hotspot.onmouseover = function () {
        if (altbannerimage != "")
            container.style.background = "transparent url(" + altbannerimage + ") no-repeat 0 0";
        if (altbannerheading != "")
            document.getElementById("prodheader").innerHTML = altbannerheading;
        if (altproddescription != "")
            document.getElementById("proddesc").innerHTML = altproddescription;


    };
    hotspot.onmouseout = function () {

        container.style.background = "transparent url(" + bannerimage + ") no-repeat 0 0";
        document.getElementById("prodheader").innerHTML = bannerheading;
        document.getElementById("proddesc").innerHTML = proddescription;

    };

}
function smartprintingeffect() {
    if (document.getElementById("altbannerimage").value.length > 0 || document.getElementById("altbannerheading").value.length > 0 || document.getElementById("altproddescription").value.length > 0) {
        if (document.getElementById("alturl").value.length > 0) {
            document.getElementById("hotspot").style.display = "block";
            document.getElementById("hotspot").href = document.getElementById("alturl").value;
            document.getElementById("hotspot").setAttribute("target", "_blank");
            createHotspot();
        }
        else {
            document.getElementById("hotspot").style.display = "block";
            createHotspot();
        }
    }

}



// Location Finder Map
(function () {
    LocationMap = function (href) {
        var me = this;
        YUE.onAvailable('locationContent', function () {
            me.setMapHref(href);
            me.createPopup();

        });
    }

    LocationMap.prototype = {
        showMap: function (e, obj) {
            var target = YUE.getTarget(e);
            if (!target) { return }

            if (YUD.hasClass("initOverlay")) {
                YUE.preventDefault(e);
                this.showPopup();
            }
        },

        createPopup: function () {
            this.popup = new PopUpDialog({
                id: 'locationdlg' + new Date().getTime(),
                parentId: 'locationResults',
                centerInElement: true
            });

            this.popup.setContent('<img src="' + this.getMapHref + '" alt="Location Map"/>');
        },

        showPopup: function () {
            this.popup.dialog.show();
        },

        setMapHref: function (href) {
            this.href = href;
        },

        getMapHref: function () {
            return href;
        }
    };
})();

/* --------------------------------------------
Generic Classes
-------------------------------------------- */

// Wrapper for making XHR requests that return JSON
(function () {

    // Constructor
    JSONRequester = function () {
        this.init();
    };

    // Public Properties and Methods


    JSONRequester.prototype.init = function () {
        var me = this;

        // Define custom events
        me.onStart = new YAHOO.util.CustomEvent('onStart', me, true, YAHOO.util.CustomEvent.FLAT);         // Fires when the async request is made
        me.onSuccess = new YAHOO.util.CustomEvent('onSuccess', me, true, YAHOO.util.CustomEvent.FLAT);     // Fires when JSON is successfully returned
        me.onFailure = new YAHOO.util.CustomEvent('onFailure', me, true, YAHOO.util.CustomEvent.FLAT);     // Fires when there is a server side error
        me.onComplete = new YAHOO.util.CustomEvent('onComplete', me, true, YAHOO.util.CustomEvent.FLAT);   // Fires after the request has returned                                    
    }

    /**
    *   Wrapper method for making XHR requests 
    *   @param method -> Method of the submission. GET | POST
    *   @param url -> Url of the requests
    *   @param postData -> string of postdata ex: address=test&city=test&zip=test
    **/
    JSONRequester.prototype.makeRequest = function (method, url, postData) {
        YUC.asyncRequest(method, url, this.requestCallBack(), postData);
        this.onStart.fire();
    }

    /**
    *   Object  that contains the evaluation methods for success and failure on returned JSON
    *   @param json -> An YUI XMLHttpRequest object wrapper
    **/
    JSONRequester.prototype.requestCallBack = function () {
        var me = this;
        return {
            success: function (json) {

                var jsonText = me.eval(json);

                if (!jsonText) {
                    me.onFailure.fire();
                    me.onComplete.fire(0);
                }
                else {
                    me.onSuccess.fire(jsonText);
                    me.onComplete.fire(1);
                }

            },
            failure: function (json) {
                me.onFailure.fire(this.eval(json));
                me.onComplete.fire(0);
            }
        }
    }

    /**
    *   Wrapper for compiling responseText
    *   @param json -> A YUI XMLHttpRequest object wrapper
    *   @return Object | null
    **/
    JSONRequester.prototype.eval = function (json) {
        var jsonText;
        try {
            eval("jsonText = " + json.responseText);
        }
        catch (e) {
            jsonText = null;
        }

        return jsonText;
    }

})();

// Interdependant Drop Downs
/**
*   Drop down select updater
*   @param <optional> selArray -> 2D array of values used to create options for a select menu
*   @param <optional> dataSource -> Url of a service that will be used to get the values for the select arrays
*   @param baseSelectMenu -> Id of the base select menu whose change events will initiate repopulating the target select menu
*   @param targetSelectMenu -> Id of the target select menu
*   @param <optional> addlSelect -> Id of a third select menu that will be populated on change events from the target Select Menu
*   @param <optional> addlArray -> 2D array of values used to create options for the addl select menu
**/
(function () {

    // Constructor
    DropDownList = function (oParams) {
        me = this;
        funcs.init(oParams);
    };

    //Global
    var me;

    //Private Properties and Methods
    var funcs = {

        // Initialize the object
        init: function (oParams) {
            me.selArray = oParams.selectArray;
            me.baseSelect = oParams.baseSelectMenu;
            me.targetSelect = oParams.targetSelectMenu;

            if (oParams.dataSource) {
                me.dataSource = oParams.dataSource;
            }

            if (oParams.addlSelect) {
                me.addlSelect = oParams.addlSelect;
            }

            if (oParams.defaultListAll) {
                me.defaultListAll = oParams.defaultListAll;
            }
            // Pull down the array data
            if (me.dataSource) {
                funcs.getArrayData('GET', me.dataSource);
            }
            else {
                funcs.setHandlers();
            }
        },

        setHandlers: function () {
            // Preload the fields when the product category dropdown is available                        
            YUE.onContentReady(me.baseSelect, funcs.baseOnChangeCallBack, me.targetSelect, false);
            YUE.on(me.baseSelect, 'change', funcs.baseOnChangeCallBack, me.targetSelect, false);

            if (me.addlSelect) {
                YUE.on(me.targetSelect, 'change', funcs.addlOnChangeCallBack, me.addlSelect, false);
            }
        },

        baseOnChangeCallBack: function (e, obj) {
            // If called by onContentReady, no event parameter is passed
            if (!obj) { obj = e }

            var addlSelect,
                dataKey = this.options[this.selectedIndex].text,
                data = me.selArray.items[dataKey] !== undefined ? me.selArray.items[dataKey] : null;
            if (dataKey == "Select a Category") {
                var targetSelect = YUD.get(me.targetSelect);
                targetSelect.options.length = 1;
                targetSelect.options.selectedIndex = 0;
                targetSelect.options.selectedValue = "Select a Family";
                targetSelect.disabled = true;
            }
            if (dataKey == "Select a Region") {
                var targetSelect = YUD.get(me.targetSelect);
                targetSelect.options.length = 1;
                targetSelect.options.selectedIndex = 0;
                targetSelect.options.selectedValue = "Select a Country";
                targetSelect.disabled = true;
            }
            // Clear out the additional select drop down
            if (me.addlSelect !== undefined) {
                addlSelect = YUD.get(me.addlSelect);
                addlSelect.disabled = true;
                addlSelect.options.length = 1;
            }


            if (data) {
                funcs.populateDropDown(data, obj);
            }

        },

        addlOnChangeCallBack: function (e, obj) {
            var baseSelect = YUD.get(me.baseSelect),
                baseValue = baseSelect.options[baseSelect.options.selectedIndex].text,
                targetValue = this.options[this.selectedIndex].text,
                data = me.selArray.items[baseValue].items[targetValue];

            funcs.populateDropDown(data, obj);
        },

        populateDropDown: function (data, obj) {

            var targetField = YUD.get(obj),
                len = !data ? 1 : data.length + 1,
                value;

            // The target array doesn't have any items so disable it
            if (len == 1) {
                targetField.disabled = true;
            }
            else {
                targetField.disabled = false;
            }

            // Set the appropriate length for the new select box
            targetField.options.length = len;

            if (targetField.disabled) { return }

            // Handle the main case
            if (obj == "loccountry" || obj == "locstate" || obj == "productfamily") {
                if (data.items) {
                    var i = 1;
                    for (dataItem in data.items) {
                        targetField.options[i] = new Option(dataItem, data.items[dataItem].value);
                        i++;
                    }
                }
            }
            else {
                if (data.items) {
                    var i = 1;
                    for (dataItem in data.items) {
                        targetField.options[i] = new Option(data.items[dataItem].value, dataItem);
                        i++;
                    }
                }
            }
        },

        getArrayData: function (method, path, params) {
            var xhr = new JSONRequester();
            xhr.onSuccess.subscribe(funcs.getArrayDataCallBack);
            xhr.makeRequest(method, path, params);
        },

        // Handles the success case of the XHR return trip for the array data
        getArrayDataCallBack: function (json) {
            if (!json.status || json.status != '1') {
                return;
            }

            me.selArray = json.data;
            funcs.setHandlers();
        }
    };
})();

// Creates background mask for modal dialogs
/**
*   A opaque div layer that disables any clicking a user can do while a request is made
*   @param id -> The id of the modal mask element
**/
(function () {

    // Constructor
    ModalMask = function (id) {
        me = this;
        funcs.init(id);
    }

    // Globals
    var me;

    //Private Properties and Methods
    var funcs = {

        init: function (id) {
            var parent = document.body;
            mask = document.createElement('div'),
                width = YUD.getDocumentWidth();

            // Define the onComplete event (for when the mask has completed being shown
            me.onComplete = new YAHOO.util.CustomEvent('onComplete', me, true, YAHOO.util.CustomEvent.FLAT);

            // Set the id of the mask
            funcs.id = id;
            funcs.hasIframe = false;

            parent.appendChild(mask);

            YUD.addClass(mask, 'modalMask');
            YUD.setStyle(mask, 'width', width + 'px');
            YUD.setStyle(mask, 'height', '0px');
            YUD.setStyle(mask, 'z-index', 9998);

            mask.setAttribute('id', funcs.id);

            YUD.setStyle(mask, "display", "block");
            YUD.setXY(mask, [0, 0]);
            YUD.setStyle(mask, "display", "none");

            // Add an iframe shim if IE6-              
            if (document.all && !window.XMLHttpRequest) {
                funcs.hasIframe = true;
                funcs.shim = new IframeShim({
                    'id': 'shimMask' + (new Date().getTime()),
                    'parent': parent,
                    'width': 0,
                    'height': 0,
                    'xy': [0, 0]
                });
            }

            // Resize the dialog with the window
            YUE.on(window, 'resize', function (e, obj) {

                var mask = YUD.get(funcs.id);

                if (parseInt(YUD.getStyle(mask, 'height')) > 0) {
                    me.resize(YUD.getDocumentWidth(), YUD.getDocumentHeight());
                }
            });
        }
    }

    ModalMask.prototype = {

        /**
        *   Roll down the modal dialog as an animation
        **/
        show: function () {
            var mask = YUD.get(funcs.id),
                animObjs = [],
                anim;

            animObjs[0] = mask;

            // Roll down the iframe as well
            if (funcs.hasIframe) {
                animObjs[1] = funcs.shim.getElement();
            }

            YUD.setStyle(mask, "display", "block");
            anim = anim = new YUA(animObjs, { height: { to: YUD.getDocumentHeight()} }, .25);
            anim.onComplete.subscribe(function () { me.onComplete.fire(true); });

            anim.animate();

        },

        /**
        *   Roll up the modal mask as an animation
        **/
        hide: function () {
            var mask = YUD.get(funcs.id),
                animObjs = [],
                anim;

            animObjs[0] = mask;

            // Rollup the iframe as well
            if (funcs.hasIframe) {
                animObjs[1] = funcs.shim.getElement();
            }

            anim = new YUA(animObjs, { height: { to: 0} }, .25);
            anim.onComplete.subscribe(function () { YUD.setStyle(mask, "display", "none"); me.onComplete.fire(false); });

            anim.animate();


        },

        /**
        *   Resize the the modal mask as an animation
        **/
        resize: function (width, height) {
            var mask = YUD.get(funcs.id);
            YUD.setStyle(mask, 'width', width + 'px');
            YUD.setStyle(mask, 'height', height + 'px');

            if (funcs.hasIframe) {
                funcs.shim.resize(width, height);
            }
        }
    };

})();

// Iframe shim used for IE select hack
/**
*   Manages an iframe shim for fixing IE select bugs
*   @param parent -> Reference to the parent element who should add the iframe
*   @param width -> Width of the iframe
*   @param height -> Height of the iframe
*   @param xy -> 2 element array that holds the iframe's x and y coordinates
**/
(function () {

    // Constructor
    IframeShim = function (oParams) {
        me = this;
        funcs.init(oParams);
    };

    // Global
    var me;

    //Private Properties and Methods
    var funcs = {

        init: function (oParams) {
            var shim = document.createElement('iframe');
            funcs.id = oParams.id;

            // Add the iframe to the parent
            oParams.parent.appendChild(shim);

            YUD.addClass(shim, 'shim');
            shim.setAttribute('src', 'javascript:false;');

            YUD.setStyle(shim, 'width', oParams.width + 'px');
            YUD.setStyle(shim, 'height', '0px');

            if (oParams.zIndex !== undefined) {
                YUD.setStyle(shim, 'z-index', oParams.zIndex);
            }

            shim.setAttribute('id', oParams.id);

            // Set the iframe's x and y coords
            YUD.setXY(shim, oParams.xy);
        },

        id: {}
    };

    IframeShim.prototype = {

        /**
        * Show the iframe 
        **/
        show: function () {
            var shim = YUD.get(funcs.id);
            YUD.setStyle(shim, 'display', 'block');
        },

        /**
        * Hide the iframe 
        **/
        hide: function () {
            var shim = YUD.get(funcs.id);
            YUD.setStyle(shim, 'display', 'none');
        },

        /**
        * Resize the iframe
        **/
        resize: function (width, height) {
            var shim = YUD.get(funcs.id);
            YUD.setStyle(shim, 'width', width + 'px');
            YUD.setStyle(shim, 'height', height + 'px');
        },

        /**
        *  Return a reference to the iframe
        **/
        getElement: function () {
            var shim = YUD.get(funcs.id);
            return shim;
        }

    };
})();

// Generic loading dialog
/**
*   Dialog for displaying a wait message while an action is performed
*   @param id -> The id for the loading dialog
*   @param parentId ->  The id of the element that will hold the loading dialog
*   @param message ->   The message to display inside of the loading dialog
*   @param modal [Optional] -> Determines whether there should be a modal background
*   @param modalId [Optional] -> If the modal property is set to true, this is the id to be used for the modal mask
**/
(function () {

    // Constructor
    LoadingDialog = function (oParams) {
        oParams.modal = true;
        oParams.modalId = "modal_" + (new Date()).getTime();

        var me = this;
        //me.parentId = oParams.parentId;
        me.parentId = document.getElementsByTagName("body")[0].id;
        me.id = oParams.id;

        var parent = YUD.get(me.parentId),
        //var parent = YUD.get(document.getElementsByTagName("body")[0]),
        region = YUD.getRegion(parent),
        elem;

        me.dialog = new YAHOO.widget.Overlay(me.id,
        {
            visible: false,
            //fixedcenter:false,            
            fixedcenter: true,
            zIndex: 9999,
            effect: { effect: YAHOO.widget.ContainerEffect.FADE, duration: 0.25 }
        });

        me.dialog.setBody('<div class="loading">' + oParams.message + '</div>');
        me.dialog.render(parent);

        elem = me.dialog.element;
        YUD.addClass(elem, 'loadingdialog');
        YUD.setStyle(elem, "display", "block");
        me.dialog.cfg.setProperty("xy", me.getCenterCoords(region, elem));
        YUD.setStyle(elem, "display", "none");

        if (oParams.modal !== undefined && oParams.modalId !== undefined && oParams.modal) {
            me.modal = new ModalMask(oParams.modalId);
            //me.modal.onComplete.subscribe(me.displayCallBack);
        }

    }

    LoadingDialog.prototype = {

        /**
        * Sets the message of the loading dialog
        * @param msg -> The message to set
        **/
        setMessage: function (msg) {
            var parent = YUD.get(me.id),
                bd = YUD.getElementsByClassName('bd', 'div', parent);

            if (bd.length > 0) {
                bd[0].innerHTML = msg;
            }
        },

        /**
        * Handles the oncomplete event of the modal mask
        * @param visible -> Flag that says whether the dialog should be visible or not
        **/
        displayCallBack: function (visible) {
            if (visible) {
                YUD.setStyle(this.dialog.element, "display", "block");
                this.dialog.show();
            }
            else {
                YUD.setStyle(this.dialog.element, "display", "none");
                this.dialog.hide();
            }
        },

        /**
        *    Show the dialog and the mask if necessary
        **/
        show: function () {
            if (this.modal !== undefined) {
                this.modal.show();
                YUD.setStyle(this.dialog.element, "display", "block");
                this.dialog.show();
            }
            else {
                YUD.setStyle(this.dialog.element, "display", "block");
                this.dialog.show();
            }
        },

        /**
        *    Hide the dialog and the mask if necessary
        **/
        hide: function () {
            if (this.modal !== undefined) {
                this.modal.hide();
                YUD.setStyle(this.dialog.element, "display", "none");
                this.dialog.hide();
            }
            else {
                YUD.setStyle(this.dialog.element, "display", "none");
                this.dialog.hide();
            }
        },

        /**
        *    Get the center region of the dialog
        *    @param region -> The region of the parent element
        *    @param  elem -> The element to center
        *    @return Array -> Returns an array of x, y coords
        **/
        getCenterCoords: function (region, elem) {
            // Find the middle point of the region
            var x = region.right - ((region.right - region.left) / 2),
                y = region.top + 40;

            // Subtract half the width and height of the element to center from the coords
            x = x - parseInt(YUD.getStyle(elem, 'width')) / 2;


            return [x, y];
        }
    }

})();

// Generic popup dialog
/**
*   Dialog for displaying an inline popup using the Intermec Pop Up Template
**/
(function () {

    // Constructor
    PopUpDialog = function (oParams) {
        var me = this;
        me.onClose = new YAHOO.util.CustomEvent('onClose', me, true, YAHOO.util.CustomEvent.FLAT);     // Fires when JSON is

        var popup = [],
            popupElem = document.createElement('div'),
            modaldialogElem = document.createElement('div'),
            parent = YUD.get(oParams.parentId),
            ftr;

        popupElem.setAttribute('id', oParams.id);
        modaldialogElem.setAttribute('id', 'flashPopUpmd');
        modaldialogElem.setAttribute('class', 'closeflashPopUp');
        // Build the default popup
        if (oParams.popupType === undefined || oParams.popupType == 'default') {
            popup.push('<div class="popup">');
            popup.push('<div class="hd">');
            popup.push('<img src="/images/logo_intermec.gif" alt="Intermec Home"border="0" class="left"/>');
            popup.push('<div class="right">');
            popup.push('<a href="#" title="Close Window" class="closeWindow">X</a>');
            popup.push('</div>');
            popup.push('<div class="clear"></div>');
            popup.push('</div>');
            popup.push('<div class="content">');
            popup.push('<b class="artop"><b class="re1"></b><b class="re2"></b><b class="re3"></b><b class="re4"></b></b>');
            popup.push('<div class="bd">');
            popup.push('</div>');
            popup.push('<b class="artop" style="background-color:transparent"><b class="re4"></b><b class="re3"></b><b class="re2"></b><b class="re1"></b></b>');
            popup.push('</div>');
            popup.push('</div>');
        }
        else {
            if (oParams.popupType == 'logindisplay') {
                popup.push('<div class="loginPopUpBox">');
                popup.push('<div class="hd">');
                popup.push('<img src="/images/logoLoginPopup.gif " alt="Intermec Home"border="0" class="left"/>');
                popup.push('<div class="right">');
                popup.push('<a href="#" title="Close Window" class="closeWindow">X</a>');
                popup.push('</div>');
                popup.push('<div class="clear"></div>');
                popup.push('</div>');
                popup.push('<div class="content">');
                popup.push('<b class="artop"><b class="re1"></b><b class="re2"></b><b class="re3"></b><b class="re4"></b></b>');
                popup.push('<div class="bd">');
                popup.push('</div>');
                popup.push('<b class="artop" style="background-color:transparent"><b class="re4"></b><b class="re3"></b><b class="re2"></b><b class="re1"></b></b>');
                popup.push('</div>');
                popup.push('</div>');
            }

            // Build the popup carousel
            if (oParams.popupType == 'carousel') {
                popup.push('<div class="popup">');
                popup.push('<div class="hd">');
                popup.push('<div class="right">');
                popup.push('<a href="#" title="Close Window" class="closeWindow">X</a>');
                popup.push('</div>');
                popup.push('<div class="clear"></div>');
                popup.push('</div>');
                popup.push('<div class="content center">');
                popup.push('<img id="default-image" src="" alt="Product Views" />');
                popup.push('<div id="dhtml-carousel" class="carousel-component">');
                popup.push('<img id="prev-arrow" class="left-button-image" src="/images/morePhotos_leftON.gif" alt="previous image" />');
                popup.push('<div id="carousel-ul" class="carousel-clip-region"></div>');
                popup.push('<img id="next-arrow" class="right-button-image" src="/images/morePhotos_rightON.gif" alt="next image" />');
                popup.push('<div class="clear"></div>')
                popup.push('</div>');
                popup.push('</div>');
                popup.push('</div>');
            }
            else if (oParams.popupType == '360') {
                popup.push('<div class="popup">');
                popup.push('<div class="hd">');
                popup.push('<div class="right">');
                popup.push('<a href="#" title="Close Window" class="closeWindow">X</a>');
                popup.push('</div>');
                popup.push('<div class="clear"></div>');
                popup.push('</div>');
                popup.push('<div class="content">');
                popup.push('<div id="flash360" class="bd">');
                popup.push('</div>');
                popup.push('</div>');
                popup.push('</div>');
            }
            else if (oParams.popupType == 'printerfinder') {
                popup.push('<div class="popup">');
                popup.push('<div class="hd">');
                popup.push('<div class="right">');
                popup.push('<a href="#" title="Close Window" class="closeWindow">X</a>');
                popup.push('</div>');
                popup.push('<div class="clear"></div>');
                popup.push('</div>');
                popup.push('<div class="content">');
                popup.push('<div id="printerfinder" class="bd">');
                popup.push('</div>');

                popup.push('</div>');
                popup.push('</div>');
            }

            else if (oParams.popupType == 'mediafinder') {
                popup.push('<div class="popup">');
                popup.push('<div class="hd">');
                popup.push('<div class="right">');
                popup.push('<a href="#" title="Close Window" class="closeWindow">X</a>');
                popup.push('</div>');
                popup.push('<div class="clear"></div>');
                popup.push('</div>');
                popup.push('<div class="content">');
                popup.push('<div id="mediafinder" class="bd">');
                popup.push('</div>');

                popup.push('</div>');
                popup.push('</div>');
            }
            else if (oParams.popupType == 'enginefinder') {
                popup.push('<div class="popup">');
                popup.push('<div class="hd">');
                popup.push('<div class="right">');
                popup.push('<a href="#" title="Close Window" class="closeWindow">X</a>');
                popup.push('</div>');
                popup.push('<div class="clear"></div>');
                popup.push('</div>');
                popup.push('<div class="content">');
                popup.push('<div id="enginefinder" class="bd">');
                popup.push('</div>');

                popup.push('</div>');
                popup.push('</div>');
            }
            else if (oParams.popupType == 'feedback') {

                popup.push('<div class="feedBackMain">');
                popup.push('<b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>');
                popup.push('<div class="clear"></div>');
                popup.push('<div id="feedBackBody">');
                popup.push('<div class="right">');
                popup.push('<a href="#" title="Close Window" class="closeWindow">X</a>');
                popup.push('</div>');
                popup.push('<img class="logo" src="/images/logo.jpg"  width="250" height="38" alt="Intermec Feedback"/>');
                popup.push('<img class="banner" src="/images/bannerimage.jpg" width="428" height="86" alt="Feedback Banner"/>');
                popup.push('<div id="feedBackContent" class="feedBackContent">');

                popup.push('</div>');
                popup.push('</div>');
                popup.push('<b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b>');
                popup.push('</div>');
            }
            else if (oParams.popupType == 'leadcapture') {
                popup.push('<div id="leadcaptureForm">');
                popup.push('<b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>');
                popup.push('<div id="leadcaptureBody">');

                popup.push('<div id="leadcaptureContent" class="leadcaptureContent">');
                popup.push('<div class="right">');
                popup.push('<a href="#" title="Close Window" class="lccloseWindow">X</a>');
                popup.push('</div>');
                popup.push('</div>');
                popup.push('</div>');
                popup.push('<b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b>');
                popup.push('</div>');

            }
            else if (oParams.popupType == 'streamingvideo') {
                popup.push('<div class="popup">');
                popup.push('<div class="hd">');
                popup.push('<div class="right">');
                popup.push('<a href="#" title="Close Window" class="svcloseWindow">X</a>');
                popup.push('</div>');
                popup.push('<div class="clear"></div>');
                popup.push('</div>');
                popup.push('<div class="content">');
                popup.push('<div class="bd">');
                popup.push('</div>');
                popup.push('</div>');
                popup.push('</div>');

            }

        }
        popupElem.innerHTML = popup.join('');
        if (oParams.popupType == 'streamingvideo')
            document.body.appendChild(modaldialogElem);

        document.body.appendChild(popupElem);
        if (oParams.id == 'feedBackWrapper') {
            me.dialog = new YAHOO.widget.Overlay(oParams.id,
        {
            'fixedCenter': true,
            'visible': false,
            'zIndex': 1000,
            'width': 450,
            'effect': { 'effect': YAHOO.widget.ContainerEffect.FADE, duration: 0.25 }
        });
        }
        else if (oParams.id == 'flashPopUp') {
            me.dialog = new YAHOO.widget.Overlay(oParams.id,
        {
            'fixedCenter': true,
            'visible': false,
            'zIndex': 1000,
            'width': 648,
            'effect': { 'effect': YAHOO.widget.ContainerEffect.FADE, duration: 0.25 }
        });
        }
        else {
            me.dialog = new YAHOO.widget.Overlay(oParams.id,
        {
            'fixedCenter': true,
            'visible': false,
            'zIndex': 1000,
            'width': 600,
            'effect': { 'effect': YAHOO.widget.ContainerEffect.FADE, duration: 0.25 }
        });
        }
        if (oParams.id == 'eventDialog') {
            YUD.setStyle(YUD.getElementsByClassName('bd', 'div', me.dialog.element.id)[0], 'width', '437px');
            YUD.setStyle(YUD.getElementsByClassName('bd', 'div', me.dialog.element.id)[0], 'height', '280px');
        }
        me.dialog.render();

        if (oParams.centerInElement !== undefined && oParams.centerInElement == true) {
            var region = YUD.getRegion(parent);
            me.dialog.cfg.setProperty("xy", me.getCenterCoords(region, popupElem));

        }

        YUE.on(me.dialog.element.id, 'click', function (e, obj) {
            // Handle close button clicks                            
            var target = YUE.getTarget(e);
            if (YUD.hasClass(target, 'closeWindow')) {
                YUE.preventDefault(e);
                me.hide();
                me.onClose.fire(0);
            }
            else if (YUD.hasClass(target, 'lccloseWindow')) {
                YUE.preventDefault(e);
                me.hide();
                me.onClose.fire(0);
                var bdy = YUD.getElementsByClassName('leadcaptureContent', 'div', YUD.get('leadcaptureWrapper'));
                createlcPopUpBody(bdy);
            }
            else if (YUD.hasClass(target, 'svcloseWindow')) {
                YUE.preventDefault(e);
                me.hide();
                me.onClose.fire(0);
                document.getElementById('flashPopUpmd').style.visibility = 'hidden';
                var bdy = YUD.getElementsByClassName('bd', 'div', YUD.get('flashPopUp'));
                flvpath = "";
                createsvPopUpBody(bdy);
            }
        });
        if (me.dialog.element.id == "flashPopUp") {
            YUE.on("flashPopUpmd", 'click', function (e, obj) {
                var target = YUE.getTarget(e);
                //IE7 fix for modal dialog click
                //            if(YUD.hasClass(target, 'closeflashPopUp'))
                //            {
                YUE.preventDefault(e);
                me.hide();
                me.onClose.fire(0);
                document.getElementById('flashPopUpmd').style.visibility = 'hidden';
                var bdy = YUD.getElementsByClassName('bd', 'div', YUD.get('flashPopUp'));
                flvpath = "";
                createsvPopUpBody(bdy);
                //            }
            });
        }
    }

    PopUpDialog.prototype = {

        show: function () {
            this.dialog.show();
        },

        hide: function () {
            this.dialog.hide();
        },

        /**
        *    Get the center region of the dialog
        *    @param region -> The region of the parent element
        *    @param  elem -> The element to center
        *    @return Array -> Returns an array of x, y coords
        **/
        getCenterCoords: function (region, elem) {
            // Find the middle point of the region
            var x = region.right - ((region.right - region.left) / 2),
                y = region.top + 40;

            // Subtract half the width and height of the element to center from the coords            
            x = x - parseInt(YUD.getStyle(elem, 'width')) / 2;

            return [x, y];
        },

        setContent: function (content) {
            var cArea = YUD.getElementsByClassName('content', 'div', this.element.id)[0];
            var bdy = YUD.getElementsByClassName('bd', 'div', cArea)[0];
            bdy.innerHTML = content;
        }
    };

})();

// Form Utility object
/**
*   Class that implements static form utility methods
**/
(function () {

    FormUtils = {

        /**
        * Builds a string of params to pass in a post request
        * @params formId -> The id of the form to submit
        * @return String
        **/
        getFormParams: function (formId) {
            var form = document.forms[formId],
                elems = form.elements,
                params = '';

            for (var i = 0, len = elems.length; i < len; i++) {
                if (elems[i].name !== undefined && elems[i].type !== "radio" && elems[i].type !== "checkbox") {
                    if (elems[i].value == "Please enter your comments about this page here") {
                        params += elems[i].name + '=&';
                    }
                    else {
                        params += elems[i].name + '=' + elems[i].value + '&';
                    }
                }
                else if (elems[i].checked) {
                    params += elems[i].name + '=' + elems[i].value + '&';
                }
            }

            return params;
        },

        /**
        * Validates                  
        * @param validator -> An associative array of field names and functions used to validate them.  A validator function should take a field name as a paramater and return 
        * @return Object -> Returns an object with two properties.  Length, and Errors.  Status = 0|1 and Errors is a list of errors that map to each element                  
        **/
        validate: function (validator) {
            var response = {},
                errMsg;

            response.length = 0;
            response.errors = {};

            // Loop through every field/fieldgroup specified in the validator and execute the validator associated with it
            for (var elem in validator) {
                errMsg = validator[elem](elem);
                if (errMsg != '') {
                    response.length++;
                    response.errors[elem] = errMsg;
                }
            }

            return response;
        },

        /**
        * Validates an email address
        * @param emailAddress -> Email address to validate
        * @return bool
        **/
        isValidEmail: function (emailAddress) {
            var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
            return !FormUtils.isEmptyValue(emailAddress) && re.test(emailAddress);
        },

        /**
        * Checks to see if a value has any non space, carriage return, new line characters
        * @param value -> Value to validate
        * @return bool
        **/
        isEmptyValue: function (value) {
            var re = /^[\n\s\r]*$/;
            return re.test(value);
        },

        /**
        * Checks to make sure a value has the minimum number of characters required
        * @param value -> Value to validate
        * @param min -> Minimum number of chars required
        * @return bool
        **/
        hasMinChars: function (value, min) {
            return !FormUtils.isEmptyValue(value) && value.length >= min;
        },

        /**
        * Checks to see if a value is a valid phone number
        * @param value -> Value to validate                  
        * @return bool
        **/
        isValidPhone: function (value) {
            var re = /\d+/,
                rmvDel = /\D/g,
                value = value.replace(rmvDel, '');  // Remove all non digit characters
            return re.test(value) && value.length >= 10 && value.length <= 81;
        },

        /**
        * Checks to see if a value is formatted as a valid zip code
        * @param value -> Value to validate                  
        * @return bool
        **/
        isValidZip: function (value) {
            var re = /[a-zA-Z0-9 ]+/;
            return re.test(value) && value.length >= 1;
        },

        /**
        * Checks to see if a value is a number
        * @param value -> Value to validate                  
        * @return bool
        **/
        isNumber: function (value) {
            var re = /\d+/;
            return re.test(value);
        },
        isRadioButtonChecked: function (radio) {
            var isChecked = false;
            for (var i = radio.length - 1; i > -1; i--) {
                if (radio[i].checked) {
                    isChecked = true;
                }
            }
            return isChecked;
        }

    };

})();

// Generic Form Handler Class
/**
*   Wrapper for validating and submitting a form
**/
(function () {

    // Constructor
    FormHandler = function (oParams) {
        var me = this;
        if (YUD.get(oParams.id) == null) {
            YUE.onAvailable(oParams.id, function () {
                me.init(oParams);
            });
        }
        else {
            me.init(oParams);
        }
    }

    FormHandler.prototype.init = function (oParams) {
        //debugger;
        if (oParams.handler !== undefined) {
            this.dialog = new LoadingDialog({
                'id': 'loadingDialog' + (new Date().getTime()),
                'parentId': oParams.id,
                'message': oParams.message,
                'modal': oParams.modal !== undefined ? oParams.modal : true
            }, true);

            this.handler = oParams.handler;            // Holds the location of the form handler
            this.success = oParams.success;            // Holds a custom function for handling successful submissions                                        
            this.failure = oParams.failure;
        }

        this.id = oParams.id;                      // Id of the form
        this.disabled = false;                     // Disable the form to prevent multiple on submit attempts
        this.validator = oParams.validator;        // Holds the validator used for each field
        this.oldErrors = {};                       // Holds the previous errors on a submission attemp

        // Set character limits on textareas
        if (oParams.textareas !== undefined) {
            for (var i = 0, len = oParams.textareas.length; i < len; i++) {
                YUE.onAvailable(oParams.textareas[0].id, function () {
                    setTextAreaCharLimit(oParams.textareas[0].id, oParams.textareas[0].chars);
                });
            }
        }

        YUE.on(this.id, 'submit', this.submitCallBack, this, false);
    }

    FormHandler.prototype.submitCallBack = function (e, obj) {
        if (!obj.disabled) {
            var validate = FormUtils.validate(obj.validator);

            // Remove all previous errors
            obj.removeErrors(validate, obj.oldErrors);

            // Disable the form
            obj.disabled = true;

            // All required fields are filled out correctly and you should submit the form using javascript
            if (validate.length == 0) {
                // Submit the form
                if (obj.dialog === undefined) {
                    return true;
                }

                // Submit the form using javascript
                YUE.preventDefault(e);
                obj.dialog.show();
                obj.submitForm('POST', obj.handler + '?method=js&r=' + new Date().getTime(), FormUtils.getFormParams(obj.id));
            }
            // Display the errors
            else {
                YUE.preventDefault(e);
                obj.showErrors(validate);
                obj.disabled = false;

                obj.oldErrors = validate;
            }
        }

        return false;
    }

    FormHandler.prototype.submitForm = function (method, path, params) {
        var xhr = new JSONRequester(),
            func = this;
        xhr.onSuccess.subscribe(function (json) { func.submitFormCallBack(json) });
        xhr.onFailure.subscribe(function (json) { func.submitFormErrors(json) });
        xhr.makeRequest(method, path, params);
    }

    FormHandler.prototype.submitFormCallBack = function (json) {
        this.dialog.hide();
        if (!json.status || json.status != '1') {
            this.submitFormErrors(json);
            return;
        }

        // Reset the form
        var frm = YUD.get(this.id);
        frm.reset();

        if (this.success !== undefined) {
            this.success(json);
        }
        else {
            var target = typeof funcs.targetId == 'object' ? this.targetId : YUD.get(this.targetId);
            target.innerHTML = json.data;
        }

        this.disabled = false;
    }

    FormHandler.prototype.submitFormErrors = function (json) {
        this.dialog.hide();
        if (this.failure !== undefined) {
            this.failure(json);
        }
        else {
            var target = typeof funcs.targetId == 'object' ? this.targetId : YUD.get(this.targetId);
            target.innerHTML = json.data;
        }
        this.disabled = false;
    }

    FormHandler.prototype.showErrors = function (validate) {
        var ve = validate.errors,
            obj,
            parent,
            error,
            anim;


        for (var elem in ve) {
            // Get the first element with a particular name
            obj = document.getElementsByName(elem)[0];
            parent = obj.parentNode;
            error = YUD.getElementsByClassName('req', 'span', parent);

            if (error.length > 0 && !YUD.hasClass(parent, 'hasErrors')) {
                error = error[0];
                // Create the error node                                        
                error.innerHTML += '<span class="error">' + ve[elem] + '</span>';

                // Append the error                                    
                YUD.addClass(parent, 'hasErrors');
            }
        }
        
        $("#" + this.id).find("span.error").show().fadeTo(1,1);
//        anim = new YUA(YUD.getElementsByClassName('error', 'span', YUD.get(this.id)),
//                        { opacity: { to: 100} }, 2, YAHOO.util.Easing.easeIn);
//        anim.animate();
    }

    FormHandler.prototype.removeErrors = function (newErrors, oldErrors) {
        // There are no old errors to remove
        if (oldErrors['length'] === undefined) {
            return;
        }

        var fixedErrors = [],
            oe = oldErrors.errors,
            ne = newErrors.errors,
            obj,
            parent,
            error;

        for (var error in oe) {
            // If the error isn't in the new error object
            if (ne[error] === undefined) {
                // Get the first element with a particular name
                obj = document.getElementsByName(error)[0];
                parent = obj.parentNode;
                YUD.removeClass(parent, 'hasErrors');
                error = YUD.getElementsByClassName('req', 'span', parent);

                for (var i = 0, len = error.length; i < len; i++) {
                    if (obj.getAttribute("class") == "logininput" || obj.getAttribute("class") == "noastr") {
                        error[i].innerHTML = ' ';
                    }
                    else
                    { error[i].innerHTML = '* '; }
                }
            }
        }
    }
})();

// Ajax Tabs for dynamically loading content
/**
*Ajax Tabs  
**/

(function () {
    var taburl;
    AjaxTabs = function (tabParent, tabBox, defaultTabId) {
        if (YUD.get(defaultTabId) != null) {
            this.init(tabParent, tabBox, defaultTabId);
        }
    }

    AjaxTabs.prototype.init = function (tabParent, tabBox, defaultTabId) {
        var me = this;

        me.id = tabParent;
        me.tabBox = tabBox;

        var aTab = YUD.getElementsByClassName('on', 'li', tabParent);
        if (aTab.length > 0) {
            aTab = aTab[0];
            aTab.tabBody = defaultTabId;
            YUE.on(aTab.parentNode.getElementsByTagName('a'), 'click', me.changeTabs, me, false);
        }
    }

    AjaxTabs.prototype.changeTabs = function (e, obj) {
        YUE.preventDefault(e);
        taburl = this.href;
        var parent = this.parentNode,
            aTab = YUD.getElementsByClassName('on', 'li', parent.parentNode);

        if (YUD.hasClass(parent, 'on')) { return }

        if (aTab.length > 0) {
            if (this.search == null || this.search == '')
                obj.getTabContent(this, parent, aTab[0], this.href + '?mode=bodyContent&id=tabContent');
            else
                obj.getTabContent(this, parent, aTab[0], this.href + '&mode=bodyContent&id=tabContent');
        }
    }

    AjaxTabs.prototype.getTabContent = function (tabLink, currTab, prevTab, href) {
        var tabs,
            currTabBox,
            prevTabBox = YUD.get(prevTab.tabBody),
            tabIndex = 0;

        YUD.setStyle(prevTabBox, 'display', 'none');
        YUD.removeClass(prevTab, 'on');
        YUD.addClass(currTab, 'on');

        // No Tab Content has been loaded, go and get it
        if (currTab.tabBody === undefined) {
            this.createTabContent(currTab);
            YUC.asyncRequest('get', href, this.getContentCallBack([currTab.tabBody, tabLink.getAttribute('rel')]));
        }
        else {
            currTabBox = YUD.get(currTab.tabBody);
            // If for whatever reason there is an error, let the user try again
            if (currTabBox.hasError) {
                currTabBox.hasError = null;
                currTabBox.innerHTML = '';
                YUD.addClass(currTabBox, 'loading');
                YUC.asyncRequest('get', href, this.getContentCallBack([currTab.tabBody, '']));
            }
            else {
                this.hidePrintToolBar(currTabBox);
            }
            YUD.setStyle(currTabBox, 'display', 'block');
        }
    }

    AjaxTabs.prototype.createTabContent = function (tab) {
        var tabBox = YUD.get(this.tabBox),
            tabParent = YUD.get(this.id),
            tabs = tabParent.getElementsByTagName('li'),
            tabIndex = 0,
            tabContent;

        // Find the tab index
        for (var i = 0, len = tabs.length; i < len; i++) {
            if (tabs[i] == tab) {
                tabIndex = i;
                break;
            }
        }

        // Create the tab container
        tabContent = document.createElement('div');

        // Create the tab container's id, and store it in the current tabs tabBody property
        tabContent.id = 'tab' + tabIndex;
        YUD.addClass(tabContent, 'text');
        YUD.addClass(tabContent, 'loading');
        YUD.addClass(tabContent, 'tabContainer');
        tab.tabBody = tabContent.id;

        tabBox.appendChild(tabContent);
    }

    AjaxTabs.prototype.getContentCallBack = function (args) {
        var me = this;
        var callback = {
            success: function (response) {
                var tabContent = YUD.get(response.argument[0]),
                    iframes;
                YUD.removeClass(tabContent, 'loading');

                if (response.argument[1] != '') {
                    me.appendScript(response.argument[1]);

                }
                if ((taburl.indexOf('related_products.aspx') > -1) && (taburl.indexOf('/products/') > -1)) {
                    if ((response.responseText).indexOf('<div') > -1 || (response.responseText).indexOf('<p') > -1 || (response.responseText).indexOf('<li') > -1) {
                        tabContent.innerHTML = response.responseText + ' <div class="clear"></div>';
                    }
                    else {
                        tabContent.innerHTML = '<h4 class="req">Sorry, you do not have permission to view this page.</h4>';
                    }
                }
                else {
                    tabContent.innerHTML = response.responseText + ' <div class="clear"></div>';
                    if (tabContent.innerHTML.indexOf('watchvideo') != -1)
                        initflashPopUp();
                }
                me.hidePrintToolBar(tabContent);
historyCollapse();
              
            },

            failure: function (response) {
                var tabContent = YUD.get(response.argument[0]);
                tabContent.hasError = 1;
                YUD.removeClass(tabContent, 'loading');
                tabContent.innerHTML = '<h4 class="req">Sorry, this page could not be loaded.  Please try again</h4>';
            },

            timeout: 15000,
            argument: args
        }

        return callback;
    }

    AjaxTabs.prototype.appendScript = function (src) {
        var scr = document.createElement('script');
        scr.type = 'text/javascript';
        scr.src = src;

        if (document.all) {
            scr.setAttribute('defer', 'defer');
        }
        document.body.appendChild(scr);
    }

    AjaxTabs.prototype.hidePrintToolBar = function (tabContent) {
        var iframes,
            printToolBar = YUD.getElementsByClassName('copyUtilities', 'p', 'bdyCopy');

        if (printToolBar.length < 1) { return }

        // The tab already has a content frame, so the print toolbar should not show
        if (YUD.hasClass(tabContent, 'hasIframe') && YUD.getStyle(printToolBar, 'display') == 'block') {
            YUD.setStyle(printToolBar, 'display', 'none');
            return;
        }

        // See if the tab already has a content frame, so the print toolbar should not show
        iframes = tabContent.getElementsByTagName('iframe');
        for (var i = 0, len = iframes.length; i < len; i++) {
            if (iframes[i].id != '' && iframes[i].id == 'contentFrame') {
                printToolBar = printToolBar[0];
                if (YUD.getStyle(printToolBar, 'display') == 'block') {
                    YUD.setStyle(printToolBar, 'display', 'none');
                    YUD.addClass(tabContent, 'hasIframe');
                }
                return;
            }
        }

        // If it makes it here, then show the tool bar     
        if (YUD.getStyle(printToolBar, 'display') == 'none') {
            YUD.setStyle(printToolBar, 'display', 'block');
        }
    }
})();

/* --------------------------------------------
Initialization
-------------------------------------------- */
function initemailPopUp() {

    var container = YUD.getElementsByClassName('copyUtilities', 'p', 'bdyCopy');
    var email;
    var createPopUpBody = function (obj) {
        var str = [];

        if (obj.length > 0) {
            str.push('<div class="req">' + errMsgs.req + '</div>');
            str.push('<p>' + varPopMsgs + '<a href="/about_us/legal/privacy_policy.aspx" title="' + varPrivacyPolicy + '">' + varPrivacyPolicy + '</a>.</p>');
            str.push('<form style="position:relative" id="emailThisPage" name="emailThisPage" method="post" action="/webservices/mailto/sendtocolleague.ashx">');
            str.push('<fieldset>');
            str.push('<legend>' + varContactUs + '</legend>');
            str.push('<p><span class="req">* </span><label for="yourname">' + varYourName + ': </label><input type="text" name="yourname" id="yourname" maxlength="60" tabindex="1" /></p>');
            str.push('<p><span class="req">* </span><label for="youremail">' + varYourEmailAddress + ': </label><input type="text" name="youremail" id="youremail" maxlength="70" tabindex="2"  /></p>');
            str.push('<p><span class="req">* </span><label for="yourcompanyame">' + varYourCompanyName + ': </label><input type="text" name="yourcompanyame" id="yourcompanyame" maxlength="70" tabindex="3" /></p>');
            str.push('<p><label for="pageurl">' + varInReferenceTo + ': </label><input type="text" value="' + location.href + '" name="pageurl" id="pageurl" tabindex="4" disabled="true"/></p>');
            str.push('<p><span class="req">* </span><label for="yourcolleaguename">' + varYourColleagueName + ': </label><input type="text" name="yourcolleaguename" id="yourcolleaguename" maxlength="60" tabindex="5"/></p>');
            str.push('<p><span class="req">* </span><label for="yourcolleagueemail">' + varYourColleaguesEmail + ': </label><input type="text" name="yourcolleagueemail" id="yourcolleagueemail" maxlength="70" tabindex="6"/></p>');
            str.push('<p><label for="yourcomments">' + varCommentToColleague + ': </label><textarea name="yourcomments" id="yourcomments" tabindex="6" rows="5" cols="30"></textarea></p>');
            str.push('<div class="clear"></div>');
            str.push('<p><input type="image" src="/images/btn_submit.gif" alt="' + varSubmit + '" class="submit" id="submitBtn"/><div class="closeText"><a class="closeWindow" href="#">' + varCloseWindow + '</a></div></p>');
            str.push('</fieldset>');
            str.push('</form>');

            obj[0].innerHTML = str.join('');

            emailPopUpHandler = new FormHandler({
                'id': 'emailThisPage',
                'message': 'Please wait while we send your message...',
                'modal': false,
                'handler': '/webservices/mailto/sendtocolleague.ashx',
                'target': 'emailThisPage',
                'textareas': [{ id: 'yourcomments', chars: 225}],
                'success': function (json) {
                    var target = YUD.get('emailThisPage');
                    var parent = target.parentNode;
                    YUE.purgeElement(target);

                    var hideContent = new YUA(parent, { opacity: { to: 0} }, 1),
                                showContent = new YUA(parent, { opacity: { to: 100} }, 1);

                    YUD.setStyle(parent, 'height', parent.offsetHeight + 'px');
                    hideContent.onComplete.subscribe(function () {
                        parent.innerHTML = json.data;
                        showContent.animate();
                    });

                    hideContent.animate();
                },
                'validator': {
                    'yourname': function (name) {
                        var elem = document.getElementsByName(name)[0],
                                    err = '';

                        if (!FormUtils.hasMinChars(elem.value, 1)) {
                            err = errMsgs.entrName;
                        }

                        return err;
                    },
                    'yourcolleaguename': function (name) {
                        var elem = document.getElementsByName(name)[0],
                                    err = '';

                        if (!FormUtils.hasMinChars(elem.value, 1)) {
                            err = errMsgs.entrName;
                        }

                        return err;
                    },
                    'yourcompanyame': function (name) {
                        var elem = document.getElementsByName(name)[0],
                                    err = '';

                        if (!FormUtils.hasMinChars(elem.value, 1)) {
                            err = errMsgs.entrComName;
                        }

                        return err;
                    },
                    'youremail': function (name) {
                        var elem = document.getElementsByName(name)[0],
                                    err = '';

                        if (!FormUtils.isValidEmail(elem.value)) {
                            err = errMsgs.entrEmail;
                        }
                        return err;
                    },
                    'yourcolleagueemail': function (name) {
                        var elem = document.getElementsByName(name)[0],
                                    err = '';

                        if (!FormUtils.isValidEmail(elem.value)) {
                            err = errMsgs.entrEmail;
                        }
                        return err;
                    }
                }

            });
        }
    }
    if (container.length > 0) {
        email = YUD.getElementsByClassName('email', 'a', container[0]);
        emailPopUp = new PopUpDialog({
            id: 'emailPopUp', parentId: 'bdyCopy', centerInElement: true
        });

        emailPopUp.onClose.subscribe(function () {
            // Recreate the form
            if (YUD.get('emailThisPage') == null) {
                var bdy = YUD.getElementsByClassName('bd', 'div', YUD.get('emailPopUp'));
                createPopUpBody(bdy);
            }
        });

        YUE.onAvailable('emailPopUp', function (e, obj) {
            var bdy = YUD.getElementsByClassName('bd', 'div', YUD.get('emailPopUp')),
                str = [];

            if (bdy.length > 0) {
                createPopUpBody(bdy);
            }
        });

        YUE.on(email, 'click', function (e, obj) {
            YUE.preventDefault(e);
            emailPopUp.show();
        });
    }
}

//this function includes rave.js file for product overview tab
function include(file) {

    var script = document.createElement('script');
    script.src = file;
    script.type = 'text/javascript';
    if (document.getElementsByTagName('head')[0].innerHTML.indexOf('/scripts/rave.js') == -1) {
        document.getElementsByTagName('head').item(0).appendChild(script);
    }
}

var createsvPopUpBody = "";
var flvpath = "";
//streaming flash popup
function initflashPopUp() {
    var container = "";
    if (YUD.getElementsByClassName('icon-module', 'ul', 'videoslist').length > 0) {
        container = YUD.getElementsByClassName('icon-module', 'ul', 'videoslist');
    }
    else if (YUD.getElementsByClassName('promotile', 'div', 'bdyCopy').length > 0) {
        container = YUD.getElementsByClassName('promotile', 'div', 'bdyCopy');
        include('/scripts/rave.js');
    }
    var watch;

    var bdy;
    createsvPopUpBody = function (obj) {
        var str = [];

        if (obj.length > 0) {

            str.push('<div id="flashcontent">This DIV contents to be replaced by Rave.</div>');

            obj[0].innerHTML = str.join('');
            defaultWimpyConfigs.wimpyWidth = "648";
            defaultWimpyConfigs.wimpyHeight = "392";
            defaultWimpyConfigs.wimpySkin = "/skins/skin_public.xml";
            //            defaultWimpyConfigs.wimpyApp = "/playlist1.xml";
            makeWimpyPlayer(flvpath);

        }
    }
    if (container.length > 0) {
        if (YUD.getElementsByClassName('watchmedia', 'a', container[0]).length > 0) {
            watch = YUD.getElementsByClassName('watchmedia', 'a', container[0]);
        }
        else if (YUD.getElementsByClassName('watchvideo', 'a', container[0]).length > 0) {
            watch = YUD.getElementsByClassName('watchvideo', 'a', container[0]);
        }
        flashPopUp = new PopUpDialog({
            id: 'flashPopUp', parentId: 'bdyCopy', popupType: 'streamingvideo', centerInElement: true
        });

        flashPopUp.onClose.subscribe(function () {
            // Recreate the form
            if (YUD.get('videosform') == null) {
                bdy = YUD.getElementsByClassName('bd', 'div', YUD.get('flashPopUp'));
                createsvPopUpBody(bdy);
            }
        });

        YUE.onAvailable('flashPopUp', function (e, obj) {
            bdy = YUD.getElementsByClassName('bd', 'div', YUD.get('flashPopUp')),
                str = [];

            //                if(bdy.length > 0)
            //                {   
            //                    createPopUpBody(bdy);
            //                }
        });

        YUE.on(watch, 'click', function (e, obj) {
            flvpath = this.title;
            bdy = YUD.getElementsByClassName('bd', 'div', YUD.get('flashPopUp'));
            createsvPopUpBody(bdy);
            document.getElementById('flashPopUpmd').style.visibility = 'visible';
            YUE.preventDefault(e);
            flashPopUp.show();

        });
    }
}

//Feed back popup
function initfeedbackPopUp() {

    var container = YUD.getElementsByClassName('login', 'p', 'hdr');
    var email;
    var createPopUpBody = function (obj) {
        var str = [];

        if (obj.length > 0) {
            var callback = {
                success: function (json) {
                    str.push(json.responseText);
                    obj[0].innerHTML = str.join('');

                    feedbackHandler = new FormHandler({
                        'id': 'feedback',
                        'message': 'Please wait while we send your message...',
                        'modal': true,
                        'handler': '/webservices/mailto/feedback.ashx',
                        'target': 'feedback',
                        'textareas': [{ id: 'comments', chars: 1000}],
                        'success': function (json) {
                            var target = YUD.get('feedback');
                            var parent = target.parentNode;
                            YUE.purgeElement(target);

                            var hideContent = new YUA(parent, { opacity: { to: 0} }, 1),
                                showContent = new YUA(parent, { opacity: { to: 100} }, 1);

                            YUD.setStyle(parent, 'height', parent.offsetHeight + 'px');
                            hideContent.onComplete.subscribe(function () {
                                parent.innerHTML = json.data;
                                showContent.animate();
                            });

                            hideContent.animate();
                        },
                        'validator': {
                            'chooseTopic': function (name) {
                                var elem = document.getElementsByName(name)[0],
                                err = '';


                                if (elem.selectedIndex == 0) {
                                    err = errMsgs.selTopic;
                                }

                                return err;
                            },
                            'overall': function (name) {
                                var elem = document.forms['feedback'].elements['overall'],
                                err = '';
                                //var elem = feedback.overall,
                                //                                err = ''; 
                                if (!FormUtils.isRadioButtonChecked(elem)) {
                                    err = errMsgs.selOverall;
                                }
                                return err;
                            }

                        }

                    });
                },
                failure: function (json) {
                    str.push(json.responseText);
                    obj[0].innerHTML = str.join('');
                }
            };

            YUC.asyncRequest('Get', '/feedback.aspx?mode=bodyContent&id=feedBackContent', callback);

            /**
            *   Populates the innerHTML property of the calendar elment
            *   @param json -> A YUI XMLHttpRequest object wrapper                    
            **/
            //        getEventItemCallBack: function(json)
            //        { 
            //          str.push(json.responseText);   
            //          obj[0].innerHTML = str.join('');         
            //        }         

        }
    }

    if (container.length > 0) {
        feedback = YUD.getElementsByClassName('feedback', 'a', container[0]);
        feedBackPopUpBox = new PopUpDialog({
            id: 'feedBackWrapper', parentId: 'bdyCopy', popupType: 'feedback', centerInElement: true
        });

        feedBackPopUpBox.onClose.subscribe(function () {
            // Recreate the form
            if (YUD.get('feedback') == null) {
                var bdy = YUD.getElementsByClassName('feedBackContent', 'div', YUD.get('feedBackWrapper'));
                createPopUpBody(bdy);
            }
        });

        YUE.onAvailable('feedBackWrapper', function (e, obj) {
            var bdy = YUD.getElementsByClassName('feedBackContent', 'div', YUD.get('feedBackWrapper')),
                str = [];

            if (bdy.length > 0) {
                createPopUpBody(bdy);
            }
        });

        YUE.on(feedback, 'click', function (e, obj) {
            YUE.preventDefault(e);
            feedBackPopUpBox.show();
        });
    }
}
//Feedback popup: textarea
function clearbox(thebox) {
    if (document.getElementById('comments').value == "Please enter your comments about this page here" || thebox.value == 'E-mail address')
        thebox.value = "";

}

//Lead Capture form
var leadcapturePopUpBox;
var leadcaptureStatus = "";
var createlcPopUpBody = "";
var isfindercookie = false;
function initleadcapturePopUp() {

    var container = YUD.getElementsByClassName('infoBoxBdy', 'div', 'infoBox');
    var container1 = YUD.getElementsByClassName('actionButtons', 'div', 'actionButtonsroot');

    var email;
    createlcPopUpBody = function (obj) {
        var str = [];


        if (obj.length > 0) {
            var callback = {
                success: function (json) {
                    str.push(json.responseText);
                    obj[0].innerHTML = str.join('');


                    leadcaptureHandler = new FormHandler({
                        'id': 'contactUs',
                        'message': 'Please wait while we send your message...',
                        'modal': true,
                        'handler': '/webservices/mailto/leadcapture.ashx',
                        'target': 'contactUs',
                        'success': function (json) {
                            var target = YUD.get('contactUs');
                            var parent = target.parentNode;
                            YUE.purgeElement(target);

                            var hideContent = new YUA(parent, { opacity: { to: 0} }, 1),
                                showContent = new YUA(parent, { opacity: { to: 100} }, 1);

                            YUD.setStyle(parent, 'height', parent.offsetHeight + 'px');
                            hideContent.onComplete.subscribe(function () {
                                if (getStatus(json.data) == "OK") {
                                    leadcaptureStatus = "success";
                                }
                                else {
                                    leadcaptureStatus = "failure";
                                }
                                if (leadcaptureStatus == "success") {
                                    showContent.animate();
                                    leadcapturePopUpBox.hide();
                                    var bdy = YUD.getElementsByClassName('leadcaptureContent', 'div', YUD.get('leadcaptureWrapper'));
                                    createlcPopUpBody(bdy);

                                    if (finderid == "5939" && finderid != 0) {
                                        printerfinderpopup.dialog.show();
                                    }
                                    else if (finderid == "5940" && finderid != 0) {
                                        mediafinderpopup.dialog.show();
                                    }
                                    //                                else if(finderid=="5941" && finderid!=0)
                                    //                                {
                                    //                                enginefinderpopup.dialog.show();
                                    //                                }                                
                                }
                                else {
                                    parent.innerHTML = '<div class="right"><a href="#" title="Close Window" class="lccloseWindow">X</a></div><div id="lcconfirmmation"><h4>Unable to process your data. Please try again.</h4><a href="#" title="Close Window"><img class="lccloseWindow" src="/images/btn_close_window.gif" /></a></div>';
                                    showContent.animate();
                                }
                            });

                            hideContent.animate();
                        },
                        'validator': {
                            'firstname': function (name) {
                                var elem = document.getElementsByName(name)[0],
                                    err = '';

                                if (!FormUtils.hasMinChars(elem.value, 1)) {
                                    err = errMsgs.firstName;
                                }

                                return err;
                            },
                            'lastname': function (name) {
                                var elem = document.getElementsByName(name)[0],
                                    err = '';

                                if (!FormUtils.hasMinChars(elem.value, 1)) {
                                    err = errMsgs.lstName;
                                }

                                return err;
                            },
                            'company': function (name) {
                                var elem = document.getElementsByName(name)[0],
                                    err = '';

                                if (!FormUtils.hasMinChars(elem.value, 1)) {
                                    err = errMsgs.entrComName;
                                }

                                return err;
                            },
                            'phone': function (name) {
                                var elem = document.getElementsByName(name)[0],
                                    err = '';

                                if (!FormUtils.isValidPhone(elem.value)) {
                                    err = errMsgs.entrPhoneno;
                                }
                                return err;
                            },
                            'email': function (name) {
                                var elem = document.getElementsByName(name)[0],
                                    err = '';

                                if (!FormUtils.isValidEmail(elem.value)) {
                                    err = errMsgs.entrEmail;
                                }
                                return err;
                            }

                        }

                    });
                },
                failure: function (json) {
                    str.push(json.responseText);
                    obj[0].innerHTML = str.join('');
                }
            };

            YUC.asyncRequest('Get', '/leadcapture.aspx?mode=bodyContent&id=leadcaptureContent', callback);
        }
    }

    if (container.length > 0 || container1.length > 0) {
        leadcapturePopUpBox = new PopUpDialog({
            id: 'leadcaptureWrapper', parentId: 'bdyCopy', popupType: 'leadcapture', centerInElement: true
        });

        leadcapturePopUpBox.onClose.subscribe(function () {
            // Recreate the form
            if (YUD.get('contactUs') == null) {
                var bdy = YUD.getElementsByClassName('leadcaptureContent', 'div', YUD.get('leadcaptureWrapper'));
                createlcPopUpBody(bdy);
            }
        });

        YUE.onAvailable('leadcaptureWrapper', function (e, obj) {
            var bdy = YUD.getElementsByClassName('leadcaptureContent', 'div', YUD.get('leadcaptureWrapper')),
                str = [];

            if (bdy.length > 0) {
                createlcPopUpBody(bdy);
            }
        });

        YUE.on('printerfinderlink', 'click', function (e, obj) {
            YUE.preventDefault(e);
            ReadFinderCookie();
            if (!isfindercookie) {
                document.getElementById('findername').innerHTML = "Printer Finder ";
                document.getElementById('CID').value = "5939";
                leadcapturePopUpBox.show();
                document.getElementById('firstname').focus();
            }
            else {
                printerfinderpopup.dialog.show();
            }
        });

        YUE.on('mediafinderlink', 'click', function (e, obj) {
            YUE.preventDefault(e);
            ReadFinderCookie();
            if (!isfindercookie) {
                document.getElementById('findername').innerHTML = "Media Finder ";
                document.getElementById('CID').value = "5940";
                leadcapturePopUpBox.show();
                document.getElementById('firstname').focus();
            }
            else {
                mediafinderpopup.dialog.show();
            }
        });

        //        YUE.on('enginefinderlink', 'click', function(e, obj){
        //            YUE.preventDefault(e);
        //            ReadFinderCookie();
        //            if(!isfindercookie)
        //            {
        //            document.getElementById('findername').innerHTML="Engine Finder ";
        //            document.getElementById('CID').value="5941";
        //            leadcapturePopUpBox.show();
        //            document.getElementById('firstname').focus();
        //            }
        //            else
        //            {
        //            enginefinderpopup.dialog.show();
        //            }
        //            });
    }
}

function getStatus(str) {
    var status = "";
    if (str == '') {
        return status;
    }
    var temp = new Array();
    temp = str.split(',');
    if (temp[0].indexOf("OK") > -1)
        status = "OK";
    return status;
}

function press(evt, frm) {
    if (evt.which || evt.keyCode) {
        if ((evt.which == 13) || (evt.keyCode == 13)) {
            frm.submit();
            return false;
        }
    }
    else {
        return true;
    }
}



function removeFlashBgImg() {
    setTimeout(function () {
        document.getElementById('flashbanner').style.backgroundImage = "none";
    }, 2000);
}


function ReadCookie() {
    var cookieName = "usercookie";
    var userName = "";
    var theCookie = "" + document.cookie;
    var ind = theCookie.indexOf(cookieName);
    if (ind == -1 || cookieName == "") {
        document.getElementById("txtusername").focus();
        return "";
    }
    var ind1 = theCookie.indexOf(';', ind);
    if (ind1 == -1) ind1 = theCookie.length;

    userName = theCookie.substring(ind + cookieName.length + 1, ind1);
    if (userName != "" && userName != ";") {
        document.getElementById("chkRemember").checked = true;
        document.getElementById("txtpwd").focus();
        document.getElementById("txtusername").value = userName;
    }
    else {
        document.getElementById("txtusername").focus();
    }
}

function ReadFinderCookie() {
    isfindercookie = false;
    var cookieName = "findercookie";
    var userName = "";
    var theCookie = "" + document.cookie;
    var ind = theCookie.indexOf(cookieName);
    if (ind == -1 || cookieName == "") {
        return "";
    }
    var ind1 = theCookie.indexOf(';', ind);
    if (ind1 == -1) ind1 = theCookie.length;

    userName = theCookie.substring(ind + cookieName.length + 1, ind1);
    if (userName != "" && userName != ";") {
        isfindercookie = true;
    }
    else {
        isfindercookie = false;
    }
}

function initlogindisplay() {

    var container = YUD.getElementsByClassName('login', 'p', 'hdr');
    var email;
    var createPopUpBody = function (obj) {
        var str = [];

        if (obj.length > 0) {

            str.push(' <div id="partnerLoginContent">');
            str.push('<div class="partnerLoginHeader">');
            str.push('<img src="/images/ptnr_lgn_txt.gif" alt ="Partner Login" align="center" />');
            str.push('</div>');
            str.push('<div class="parnterLoginForm">');

            str.push(' <form id="frmLogin"  defaultbutton="btnLogin" class="parnterLoginForm" runat="server"  method="post" >');
            str.push('<span id="loginErrMsg"  name="loginErrMsg"></span>');
            str.push('<fieldset>');
            /*Srinath Reddy.M : As per Ticket 5073 request username max length is changed to 40*/
            str.push(' <p class="partnerUsername"><span class="req" style="text-align:left;"></span><label for="name">Username:</label>&nbsp;&nbsp;<input type="text"  class="logininput" name="txtusername" id="txtusername" MaxLength="40" /></p>');

            str.push(' <p class="partnerUsername"><span class="req" style="text-align:left;"></span><label for="email">Password:</label>&nbsp;&nbsp;<input name="txtpwd" id="txtpwd" type="password" class="logininput" MaxLength="20" /></p>');

            //str.push('<input id="btnLogin" name="btnLogin" type="image" accesskey="ENTER" src="/images/btnLogin.gif" alt="Login" class="loginSubmit" />');
            str.push('<p  class="RememberUsername"><input id="chkRemember" type="checkbox" name="chkRemember"  value="Remember my username"/><label for="RememberUsername">&nbsp;Remember my username</label></p><p><input id="btnLogin" name="btnLogin" type="submit" value=" " style="background-image :url(/images/btnLogin.gif);background-repeat:no-repeat;background-color:white; width:60px;height:20px;cursor:hand;"   alt="Login" class="loginSubmit" /></p>');



            str.push('<p class="forgotPassword"><a href="/ForgotPassword.aspx">Forgot Your Password?</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="chpwd" href="/Register.aspx">Request New Account</a>');


            str.push('</fieldset>');
            str.push('</form>');
            str.push(' </div>');
            str.push(' </div>');

            obj[0].innerHTML = str.join('');
            loginHandler = new FormHandler({

                'id': 'frmLogin',
                'message': 'Please wait while we access your details...',
                'modal': true,
                'handler': '/webservices/login.ashx',
                'target': 'frmLogin',
                'validator': {
                    'txtusername': function (name) {
                        var elem = document.getElementsByName(name)[0],
                                err = '';


                        if (elem.value == "") {
                            document.getElementById('loginErrMsg').innerHTML = "";
                            err = "Username can't be blank";
                        }

                        return err;
                    },
                    'txtpwd': function (name) {
                        var elem = document.getElementsByName(name)[0],
                                err = '';


                        if (elem.value == "") {
                            document.getElementById('loginErrMsg').innerHTML = "";
                            err = "Password can't be blank";
                        }

                        return err;
                    }
                },
                'success': function (json) {
                    loginPopUp.hide();
                    window.location = json.data;
                },
                'failure': function (json) {
                    document.getElementById('loginErrMsg').innerHTML = "Invalid Username and Password, Please try again";
                    document.getElementById('loginErrMsg').style.display = "block";
                }

            });



        }
    }
    if (container.length > 0) {
        email = YUD.getElementsByClassName('loginPopUp', 'a', container[0]);
        loginPopUp = new PopUpDialog({
            id: 'loginPopUp', parentId: 'bdyCopy', popupType: 'logindisplay', centerInElement: true
        });

        loginPopUp.onClose.subscribe(function () {
            // Recreate the form
            if (YUD.get('frmLogin') != null) {
                loginPopUp.hide();
                var bdy = YUD.getElementsByClassName('bd', 'div', YUD.get('loginPopUp'));
                createPopUpBody(bdy);
            }
        });

        YUE.onAvailable('loginPopUp', function (e, obj) {

            var bdy = YUD.getElementsByClassName('bd', 'div', YUD.get('loginPopUp')),
                str = [];

            if (bdy.length > 0) {
                createPopUpBody(bdy);
            }
        });

        YUE.on(email, 'click', function (e, obj) {


            YUE.preventDefault(e);
            loginPopUp.show();
            ReadCookie();
        });
    }
}


//PopUp window for case stuides and white papers help

function initcswphelp() {

    var container = YUD.getElementsByClassName('copyUtilitiess', 'h5', 'bdyCopy');
    var email;
    var createPopUpBody = function (obj) {
        var str = [];

        if (obj.length > 0) {
            str.push('<form >');
            str.push('<fieldset>');
            str.push('<strong>Product Branch:</strong> The tree allows you to select multiple nodes of ');
            str.push('Product category, Product family and Products. All associated Whitepapers/Casestudies ');
            str.push('are retrieved based on the selected nodes.');
            str.push('<br />');
            str.push('<br />');
            str.push('<strong>Service Branch: </strong>The tree allows you to select multiple nodes of ');
            str.push('Service category, Service family and Services. All associated Whitepapers/Casestudies ');
            str.push('are retrieved based on the selected nodes.');
            str.push('<br />');
            str.push('<br />');
            str.push('<strong>Industry Branch: </strong>The tree allows you to select multiple nodes of ');
            str.push('Industry and Solution. All associated Whitepapers/Casestudies are retrieved based ');
            str.push('on the selected nodes.');
            str.push('<br />');
            str.push('<br />');
            str.push('If nodes across the branches (Product branch, Service branch and Industry branch) ');
            str.push('are selected, the result page will contain all the Whitepapers/Casestudies associated ');
            str.push('with each node selected.');

            str.push('</fieldset>');

            str.push('</form>');


            obj[0].innerHTML = str.join('');


        }
    }
    if (container.length > 0) {
        email = YUD.getElementsByClassName('email', 'a', container[0]);
        emailPopUp = new PopUpDialog({
            id: 'emailPopUp', parentId: 'bdyCopy', centerInElement: true
        });

        emailPopUp.onClose.subscribe(function () {
            // Recreate the form
            if (YUD.get('emailThisPage') == null) {
                var bdy = YUD.getElementsByClassName('bd', 'div', YUD.get('emailPopUp'));
                createPopUpBody(bdy);
            }
        });

        YUE.onAvailable('emailPopUp', function (e, obj) {
            var bdy = YUD.getElementsByClassName('bd', 'div', YUD.get('emailPopUp')),
                str = [];

            if (bdy.length > 0) {
                createPopUpBody(bdy);
            }
        });

        YUE.on(email, 'click', function (e, obj) {
            YUE.preventDefault(e);
            emailPopUp.show();
        });
    }
}

//WWAN Service Activation Form
function enableTextbox(obj) {
    if (obj.id == "chkNewPhone") {
        if (obj.checked) {
            document.getElementById("areaCode").disabled = false;
            document.getElementById("areaCode").focus();
        }
        else {
            document.getElementById("areaCode").value = "";
            document.getElementById("areaCode").disabled = true;
        }
    }
    else {
        if (obj.checked) {
            document.getElementById("existingMobile").disabled = false;
            document.getElementById("existingMobile").focus();
        }
        else {
            document.getElementById("existingMobile").value = "";
            document.getElementById("existingMobile").disabled = true;
        }
    }
}

function uncheckOthers(obj) {
    if (obj.checked) {
        document.getElementById("chkStandard").checked = false;
        document.getElementById("chkNonStandard").checked = false;
        document.getElementById("chkStandard").disabled = true;
        document.getElementById("chkNonStandard").disabled = true;
    }
    else {
        document.getElementById("chkNonStandard").disabled = false;
        document.getElementById("chkStandard").disabled = false;
    }
}

function getTodaysDate() {
    var monthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    var now = new Date();
    document.getElementById("todaysDate").value = monthNames[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear();
}


function addPopUpWins() {
    YUE.onAvailable('bdyCopy', function () {
        var me = this;
        var alinks = YUD.getElementsByClassName('wppopup', 'a', me);
        if (alinks.length == 0) { return; }

        YUE.on(alinks, 'click', function (e, obj) {
            var pWins = createWin(this.href, 'iwindow', 'width=700,resizable=yes,scrollbars=yes');
            if (pWins) {
                return;
            }
            else {
                YUE.preventDefault(e);
            }
        });
    });
}

//Product Profile language list popup functionlity
function langpopup() {
    var acount = document.getElementById('divactbuttons').getElementsByTagName('a');
    var offset = 0;
    if (document.getElementById('linkprofile').offsetParent) {
        var profilep = document.getElementById('divProductProfile');
        var leftoffset = document.getElementById('divactbuttons').offsetLeft;
        if (acount.length == 3) {
            for (var i = 0; i < acount.length; i++) {
                if (acount.item(i).getAttribute('title') == 'Product Profile') {
                    var temp = i;
                    if (temp == 2) offset = 561 - leftoffset;
                    if (temp == 1) offset = 449 - leftoffset;
                    if (temp == 0) offset = 335 - leftoffset;
                }
            }
        }
        else if (acount.length == 4) {
            for (var i = 0; i < acount.length; i++) {
                if (acount.item(i).getAttribute('title') == 'Product Profile') {
                    var temp = i;
                    if (temp == 3) offset = 618 - leftoffset;
                    if (temp == 2) offset = 506 - leftoffset;
                    if (temp == 1) offset = 392 - leftoffset;
                    if (temp == 0) offset = 279 - leftoffset;
                }
            }
        }
        else if (acount.length == 2) {
            for (var i = 0; i < acount.length; i++) {
                if (acount.item(i).getAttribute('title') == 'Product Profile') {
                    var temp = i;
                    if (temp == 1) offset = 505 - leftoffset;
                    if (temp == 0) offset = 392 - leftoffset;
                }
            }
        }
        else if (acount.length == 1) {
            offset = 448 - 213;
        }
        profilep.style.left = leftoffset + offset + 'px';
        profilep.style.top = document.getElementById('divactbuttons').offsetTop + document.getElementById('prodprofileimg').offsetHeight + 'px';
        profilep.style.display = 'block';
    }
}

//hide product profile language list popup
function hidelangpopup() {
    if (document.getElementById('divProductProfile').style.display == 'block')
        document.getElementById('divProductProfile').style.display = 'none';
}

//New ticker

function ticknews(nextitem, time) {
    /*$("#ticker li:eq(" + curritem + ")").slideUp(300, function () {
    $("#ticker li:eq(" + (++curritem % newsitems) + ")").slideDown(300);
    });*/
    nextitem = (nextitem) ? nextitem : (curritem + 1) % newsitems;
    time = (time) ? time : 1000;
    $(".tickerClone").show().fadeTo(time, 1, function () {
        $("#ticker li:eq(" + curritem + ")").hide();
        $("#ticker li:eq(" + nextitem + ")").show();
        $(".tickerClone").fadeTo(time, 0, function () {
            $(this).hide();
        });
        curritem = nextitem;
    });

    newtimeint = setTimeout("ticknews()", 5000);
}


function restartticknews() {
    stop_ticknews();
    newtimeint = setTimeout("ticknews()", 2000);
}

function stop_ticknews() {
    clearTimeout(newtimeint);
}

function newsnavigation(id) {
    stop_ticknews();
    if (id == 'prev') {
        //$("#ticker li:eq("+curritem+")").fadeOut( 1000 );
        $("#ticker li:eq(" + curritem + ")").fadeOut('fast');
        if (curritem == 0)
            curritem = newsitems - 1;
        else
            curritem = curritem - 1;
        $("#ticker li:eq(" + curritem + ")").fadeIn('fast');
        newtimeint = setTimeout("ticknews()", 5000);
        //t1=setTimeout( "ticknews1()", 1000 );
    }
    if (id == 'next') {
        $("#ticker li:eq(" + curritem + ")").fadeOut('fast');
        if (curritem == newsitems - 1)
            curritem = 0;
        else
            curritem = curritem + 1;
        $("#ticker li:eq(" + curritem + ")").fadeIn('fast');
        newtimeint = setTimeout("ticknews()", 5000);
        //t1=setTimeout( "ticknews1()", 1000 );
    }
}
//End News ticker

//validating products search in megamenu
function validateprodsearch() {
    var isallowed = false;
    var re = /[a-zA-Z0-9 ]+/;
    isallowed = re.test(document.getElementById("prodsearchField").value.split(' ').join(''));
    if (!isallowed) {
        document.getElementById("lblprodsearch").innerHTML = "Please enter a valid search term";
        return false;
    }
    else if (document.getElementById("prodsearchField").value.split(' ').join('') == "SEARCH" || document.getElementById("prodsearchField").value.split(' ').join('').toLowerCase() == "search" || document.getElementById("prodsearchField").value.split(' ').join('') == "") {

        document.getElementById("lblprodsearch").innerHTML = "Please enter a search term";

        return false;
    }
}

//validating resource center search in megamenu
function validatercsearch() {
    var isallowed = false;
    var re = /[a-zA-Z0-9 ]+/;
    isallowed = re.test(document.getElementById("rcsearchField").value.split(' ').join(''));
    if (!isallowed) {
        document.getElementById("lblrcsearch").innerHTML = "Please enter a valid search term";
        return false;
    }
    else if (document.getElementById("rcsearchField").value.split(' ').join('') == "SEARCH" || document.getElementById("rcsearchField").value.split(' ').join('').toLowerCase() == "search" || document.getElementById("rcsearchField").value.split(' ').join('') == "") {

        document.getElementById("lblrcsearch").innerHTML = "Please enter a search term";

        return false;
    }
}

//validating downloads search in megamenu
function validatedownloadsearch() {
    var isallowed = false;
    var re = /[a-zA-Z0-9 ]+/;
    isallowed = re.test(document.getElementById("downloadsearchField").value.split(' ').join(''));
    if (!isallowed) {
        document.getElementById("lbldownloadsearch").innerHTML = "Please enter a valid search term";
        return false;
    }
    else if (document.getElementById("downloadsearchField").value.split(' ').join('') == "SEARCH" || document.getElementById("downloadsearchField").value.split(' ').join('').toLowerCase() == "search" || document.getElementById("downloadsearchField").value.split(' ').join('') == "") {

        document.getElementById("lbldownloadsearch").innerHTML = "Please enter a search term";

        return false;
    }
}
//function initHangingMenuDisplay() {
//Hanging menu js
//var UA = navigator.userAgent.toLowerCase();
$(document).ready(function () {
    //    if ((UA.match(/safari/) && !UA.match(/chrome/)) || UA.match(/opera/)) {
    //        $("#hangingMenu .linkBar a:link, #hangingMenu .linkBar a:visited, #hangingMenu .linkBar a:hover, #hangingMenu .linkBar a:active").css({
    //            "font-size": "13px",
    //            "font-weight": "normal"
    //        });
    //        $("#hangingMenu #sliderMap h4, #hangingMenu #sliderMap h3, #hangingMenu #sliderLogin .formRow label, #hangingMenu #sliderLogin .lableClass, #hangingMenu #sliderLogin h3").css({
    //            "font-weight": "normal !important"
    //        });
    //    }
    $(document).click(function (e) {
        if ($(e.target).parents('div#hangingMenu').length <= 0) {
            $("#hangingMenu .content").slideUp(400);
            document.forms['frmLogin'].reset();
            document.forms['feedback'].reset();
            if (!document.forms['contactUs']) {
                $(".hasErrors").removeClass("hasErrors");
                $(".req").html("");
            }
            document.getElementById("feedBackContent").style.display = "block";
            document.getElementById("feedbackResponse").innerHTML = "";
            document.getElementById("loginErrMsg").innerHTML = "";
        }
    });
    $("#hangingMenu .topMenuAction").click(function () {
        $(".mmContent:visible").fadeOut("fast");
        $(".menuItemClone").hide();
        $("#shd-lt, #shd").hide();
        var target = $($(this).attr("rel"));
        $(".hasErrors").removeClass("hasErrors");
        $(".req").html("");
        if (target.is(":visible")) {
            target.slideUp(400);
            document.forms['frmLogin'].reset();
            document.forms['feedback'].reset();
            document.getElementById("feedBackContent").style.display = "block";
            document.getElementById("feedbackResponse").innerHTML = "";
        } else {
            $("#hangingMenu .content").slideUp(400);
            target.slideDown(500);
            if (target.attr("id") == 'sliderLogin') {
                setTimeout("ReadCookie()", 500);
            }
        }
    });
    $(".mapHover li").mouseenter(function () {
        $("#mapSprite").css("background-position", "left -" + $(this).closest("ul").attr("y") + "px");
    });
    $(".mapHover li").mouseleave(function () {
        $("#mapSprite").css("background-position", "left 0px");
    });

});

var frmLogin = new FormHandler({
    'id': 'frmLogin',
    'message': 'Please wait while we access your details...',
    //'hideMessage': true,
    'modal': true,
    'handler': '/webservices/login.ashx',
    'target': 'frmLogin',
    'validator': {
        'txtusername': function (name) {
            var elem = document.getElementsByName(name)[0],
                            err = '';


            if (elem.value == "") {
                document.getElementById('loginErrMsg').innerHTML = "";
                err = "Username can't be blank";
            }

            return err;
        },
        'txtpwd': function (name) {
            var elem = document.getElementsByName(name)[0],
                            err = '';


            if (elem.value == "") {
                document.getElementById('loginErrMsg').innerHTML = "";
                err = "Password can't be blank";
            }

            return err;
        }
    },
    'success': function (json) {
        window.location = json.data;
    },
    'failure': function (json) {
        document.getElementById('loginErrMsg').innerHTML = "Invalid Username and Password, Please try again";
        document.getElementById('loginErrMsg').style.display = "block";
    }

});


var feedbackHandler = new FormHandler({
    'id': 'feedback',
    'message': 'Please wait while we send your message...',
    //'hideMessage': true,
    'modal': true,
    'handler': '/webservices/mailto/feedback.ashx',
    'target': 'feedback',
    'textareas': [{ id: 'comments', chars: 1000}],
    'success': function (json) {
        var target = YUD.get('feedback');
        var parent = target.parentNode;
        //YUE.purgeElement(target);

        var hideContent = new YUA(parent, { opacity: { to: 0} }, 1),
            showContent = new YUA(parent, { opacity: { to: 100} }, 1);

        YUD.setStyle(parent, 'height', parent.offsetHeight + 'px');
        hideContent.onComplete.subscribe(function () {
            document.getElementById("feedbackResponse").innerHTML = json.data;
            document.getElementById("feedBackContent").style.display = "none";
            document.getElementById("feedbackResponse").style.display = "block";

            showContent.animate();
            //feedbackTrigger();
        });

        hideContent.animate();
    },
    'validator': {
        'chooseTopic': function (name) {
            var elem = document.getElementsByName(name)[0],
                        err = '';


            if (elem.selectedIndex == 0) {
                err = errMsgs.selTopic;
            }

            return err;
        },
        'overall': function (name) {
            var elem = document.forms['feedback'].elements['overall'],
                        err = '';
            if (!FormUtils.isRadioButtonChecked(elem)) {
                err = errMsgs.selOverall;
            }
            return err;
        }

    },
    'failure': function (json) {
        str.push(json.responseText);
        obj[0].innerHTML = str.join('');
    }

});
//}

function initMegaMenuDisplay() {
    //Mega Menu JavaScript Functions
    //    var UA = navigator.userAgent.toLowerCase();
    //    $(document).ready(function () {
    //        if ((UA.match(/safari/) && !UA.match(/chrome/)) || (UA.match(/opera/))) {
    //            $("#megamenu ul.mm_navStrip li a").css({
    //                "font-size": "15px",
    //                "font-weight": "normal"
    //            });
    //        }
    //    });
    var megamenu = (function ($) {
        if (!$) return { init: function () { } };

        var config;
        var defaults = {
            navContainer: "#megamenu",
            navBlocks: "#megamenu ul.mm_navStrip li a",
            contentContainer: "#mmContentContainer",
            contentBlocks: "#mmContentContainer > .mmContent",
            show: {
                delay: 0,
                anim: "none", // none*, fade, slide
                animTime: 2000
            },
            hide: {
                delay: 500,
                anim: "fade", // none, fade*, slide
                animTime: 2000
            }
        };

        return {
            timer: null,
            hideMenu: function (mmContent) {
                if (mmContent) {
                    var self = $(mmContent);
                    if (self.data("content")) {
                        var content = self.data("content");
                        var clone = self;
                    } else {
                        var content = self;
                        var clone = self.data("clone");
                    }

                    content.fadeOut("slow");
                    clone.fadeOut("fast");
                } else {
                    config.contentBlocks.hide().stop(false, true);
                    $("#menuItemCloneContainer a").hide().stop(false, true);
                }
                $("#shd-lt, #shd").hide();
            },
            showMenu: function (src) {
                var content = $(src.attr("rel"));
                if (content.length > 0) {
                    var srcOffset = {
                        left: Math.floor(src.offset().left),
                        top: Math.floor(src.offset().top)
                    };
                    var mmOffset = {
                        left: Math.floor(config.navContainer.offset().left),
                        top: Math.floor(config.navContainer.offset().top)
                    };
                    var srcHeight = src.data("height");
                    var mmWidth = config.navContainer.data("width");
                    var contentWidth = content.data("width");
                    var contentHeight = content.data("height");

                    var left = srcOffset.left - mmOffset.left - 1;
                    if (left + contentWidth > mmWidth) {
                        left = mmWidth - contentWidth + 1;
                        if (left < 0) {
                            left = 0;
                        }
                    }
                    left += mmOffset.left;

                    content.css({
                        top: srcOffset.top + srcHeight + 4,
                        left: left
                    });

                    $("#shd").css({
                        top: srcOffset.top + srcHeight + 5,
                        left: left + 10,
                        width: contentWidth,
                        height: contentHeight + 51
                    });
                    $("#shd-lt").css({
                        top: srcOffset.top + srcHeight + 5,
                        left: left - 5,
                        width: 15,
                        height: contentHeight + 51
                    });


                    src.data("clone").css({
                        top: srcOffset.top - 10,
                        left: srcOffset.left - 1
                    });

                    $("form[name=prodSearch], form[name=rcSearch], form[name=frmQckContact], form[name=downloadSearch], form[name=frmMMLogin]").each(function () {
                        this.reset();
                    });

                    $("#qcContent").show();
                    $("#qcResponse, #lblprodsearch, #lblrcsearch, #lbldownloadsearch, #loginMMErrMsg").empty();

                    $(".hasErrors").removeClass("hasErrors");
                    $(".req").html("");

                    content.fadeIn("slow");
                    $("#shd, #shd-lt").show();
                    //src.data("clone").fadeIn("fast");
                    src.data("clone").fadeIn("slow");
                    //src.data("clone").css("visibility", "hidden").show();
                    //setTimeout(function () { src.data("clone").css("visibility", ""); }, 100);
                }
            },
            bindEvents: function () {
                var menu = this;
                config.navBlocks.bind("mouseover", function () {
                    var self = $(this);
                    clearTimeout(menu.timer);
                    menu.timer = setTimeout(function () {
                        menu.hideMenu();
                        menu.showMenu(self);
                    }, config.show.delay);
                });
                config.contentBlocks.bind("mouseover", function () {
                    clearTimeout(menu.timer);
                    $(this)
                    .data("nav").data("clone")
                    .add($(this))
                    .stop(false, true).show();
                    $("#shd-lt, #shd").show();
                });
                config.contentBlocks.add($("#menuItemCloneContainer a.menuItemClone")).bind("mouseleave", function () {
                    var self = this;
                    clearTimeout(menu.timer);
                    menu.timer = setTimeout(function () {
                        menu.hideMenu(self);
                    }, config.hide.delay);
                });
            },
            cleanMenu: function () {
                var menu = this;
                var imgBoxes = config.contentBlocks.find("ul.imgBoxes");

                imgBoxes.each(function () {
                    var menuLayer = $(this).closest(".mmContent");
                    var items = $(this).find(" > li");
                    var pos = null;
                    var itemsArr = [];
                    menuLayer.show().css("visibility", "hidden");
                    for (var x = 0; x < items.length; x++) {
                        var top = parseInt(items.eq(x).position().top);
                        if (top != pos) {
                            itemsArr.push([]);
                            pos = top;
                        }
                        itemsArr[itemsArr.length - 1].push(items.eq(x));
                    }
                    for (var x = 0; x < itemsArr.length; x++) {
                        var height = -1;
                        for (var y = 0; y < itemsArr[x].length; y++) {
                            var item = itemsArr[x][y];
                            height = Math.max(height, item.height());
                            if (y == itemsArr[x].length - 1) {
                                item.addClass("last");
                            }
                            if (item.is(".oneCol") || item.is(".twoCol") || item.is(".threeCol") || item.is(".fourCol") || item.find("ul.bulleted").length > 0) {
                                if (y > 0) {
                                    item.prev().addClass("last");
                                }
                            }
                        }
                        for (var y = 0; y < itemsArr[x].length; y++) {
                            itemsArr[x][y].height(height);
                        }
                    }
                    menuLayer.hide().css("visibility", "");
                });
            },
            init: function (options) {
                config = $.extend(true, {}, defaults, options);

                // Housekeeping
                config.contentContainer = $(config.contentContainer);
                config.contentBlocks = $(config.contentBlocks);
                config.navContainer = $(config.navContainer);
                config.navBlocks = $(config.navBlocks);


                config.contentContainer.appendTo("body");
                config.navContainer.data({
                    "width": Math.floor(config.navContainer.width()),
                    "height": Math.floor(config.navContainer.height())
                });
                config.contentBlocks.each(function () {
                    $(this).show().data({
                        "width": Math.floor($(this).width()),
                        "height": Math.floor($(this).height())
                    }).hide();
                });

                var menuItemCloneContainer = $("<div />").attr("id", "menuItemCloneContainer").appendTo("body");
                config.navBlocks.each(function () {
                    var content = $($(this).attr("rel"));

                    // Make Nav item clones
                    var clone = $(this).clone()
                    .addClass("menuItemClone")
                    //.addClass("menuItemCloneRounded")
                    .css({
                        display: "none",
                        position: "absolute"
                    })
                    .data("content", content)
                    .appendTo(menuItemCloneContainer);

                    $(this).data({
                        "clone": clone,
                        "width": Math.floor($(this).outerWidth()),
                        "height": Math.floor($(this).outerHeight()),
                        "content": content
                    });
                    content.data({
                        "nav": $(this),
                        "clone": clone
                    });
                });


                this.bindEvents();
                this.cleanMenu();
            }
        };
    })(jQuery);
    $(function () {
        megamenu.init();
    });

    var frmMMLogin = new FormHandler({
        'id': 'frmMMLogin',
        'message': 'Please wait while we access your details...',
        //'hideMessage': true,
        'modal': true,
        'handler': '/webservices/login.ashx',
        'target': 'frmMMLogin',
        'validator': {
            'txtMMusername': function (name) {
                var elem = document.getElementsByName(name)[0],
                            err = '';

                if (elem.value == "") {
                    document.getElementById('loginMMErrMsg').innerHTML = "";
                    err = "Username can't be blank";
                }
                return err;
            },
            'txtMMpwd': function (name) {
                var elem = document.getElementsByName(name)[0],
                            err = '';

                if (elem.value == "") {
                    document.getElementById('loginMMErrMsg').innerHTML = "";
                    err = "Password can't be blank";
                }
                return err;
            }
        },
        'success': function (json) {
            window.location = json.data;
        },
        'failure': function (json) {
            document.getElementById('loginMMErrMsg').innerHTML = "Invalid Username and Password, Please try again";
            document.getElementById('loginMMErrMsg').style.display = "block";
        }

    });

}

var qcHandler = new FormHandler({
    'id': 'frmQckContact',
    'message': 'Please wait while we send your message...',
    //'hideMessage': true,
    'modal': true,
    'handler': '/webservices/mailto/QuickContactSubmit.ashx',
    'target': 'frmQckContact',
    'textareas': [{ id: 'txtcomments', chars: 1000}],
    'success': function (json) {
        var target = YUD.get('frmQckContact');
        var parent = target.parentNode;

        var hideContent = new YUA(parent, { opacity: { to: 0} }, 1),
                showContent = new YUA(parent, { opacity: { to: 100} }, 1);

        YUD.setStyle(parent, 'height', parent.offsetHeight + 'px');
        hideContent.onComplete.subscribe(function () {
            document.getElementById("qcResponse").innerHTML = json.data;
            document.getElementById("qcContent").style.display = "none";
            document.getElementById("qcResponse").style.display = "block";

            showContent.animate();
        });

        hideContent.animate();
    },
    'validator': {
        'txtname': function (name) {
            var elem = document.getElementsByName(name)[0],
                            err = '';

            if (elem.value == "") {
                err = "Name can't be blank";
            }
            return err;
        },
        'txtemail': function (name) {
            var elem = document.getElementsByName(name)[0],
                            err = '';

            if (elem.value == "") {
                err = "Email can't be blank";
            }
            return err;
        },
        'txtcomments': function (name) {
            var elem = document.getElementsByName(name)[0],
                            err = '';

            if (elem.value == "") {
                err = "Comments can't be blank";
            }
            return err;
        }
    },
    'failure': function (json) {
        str.push(json.responseText);
        obj[0].innerHTML = str.join('');
    }

});

function mmRoundedCorners() {

    if (!$.support.borderRadius) {
        if (!$.browser.msie) {
            //if ($("#bannerNew").length > 0) {
            $('.megamenuouter').corner("top 10px keep sc:#ccc cc:#EEEDED").corner("bottom 10px keep sc:#transparent cc:#EEEDED");
            $('#megamenu').corner("top 10px keep sc:#fff cc:#EEEDED").corner("bottom 10px keep sc:transparent cc:#EEEDED");
            //} else {
            //$('.megamenuouter').corner("10px keep sc:#ccc cc:#EEEDED");
            //$('.megamenuouter').css("background-color", "transparent");
            //$('#megamenu').css("border", "solid 1px #ccc").corner("10px keep sc:#fff cc:#EEEDED");
            //}
        }
        $('a.menuItemClone').corner("top 10px cc:#ECECED sc:#3A5A9C");
    }

    //alert($.support.borderRadius);
    //    if (!$.support.borderRadius) {
    //        $('.megamenuouter').css("position","relative");
    //        if (!$.browser.msie) {
    //            if ($("#bannerNew").length > 0) {
    //            
    //                //$('.megamenuouter').corner("top 10px keep sc:#ccc cc:#EEEDED");
    //                //$('#megamenu').corner("top 10px keep sc:#fff cc:#EEEDED");
    //            
    //                $('.megamenuouter').corner("top 8px keep sc:#ccc cc:#EEEDED");
    //                $('#megamenu').corner("top 8px keep sc:#fff cc:#EEEDED");
    //                $('#search').css({top: 6, right: 0});
    //            } else {
    //                $('.megamenuouter').corner("top 8px keep sc:#ccc cc:#EEEDED").corner("bottom 8px keep  cc:#EEEDED");
    //                $('#megamenu').corner("top 8px keep sc:#fff cc:#EEEDED").corner("bottom 8px  sc:#f4f4f4 cc:#EEEDED");
    //                $('#search').css({top: 6, right: 0});
    //                //$('.megamenuouter').corner("10px keep sc:#ccc cc:#EEEDED");
    //                //$('.megamenuouter').css("background-color", "transparent");
    //                //$('#megamenu').css("border", "solid 1px #ccc").corner("10px keep sc:#fff cc:#EEEDED");
    //            }
    //        }

    //        //$('#search').css('margin', '-60px -10px 0 15px');

    //        $('a.menuItemClone').corner("top 10px cc:#ECECED sc:#3A5A9C");
    //    }
    /*
    if ($.browser.opera && operaVer < 10.5) {
    $('.megamenuouter').corner("top 10px keep sc:#ccc cc:#EEEDED");
    $('#megamenu').corner("top 10px keep sc:#fff cc:#EEEDED");

    }
    if ($.browser.msie) {
    $('a.menuItemClone').corner("top 10px cc:#ECECED sc:#3A5A9C");
    }
    */
}

function initLoad() {

    focusSearch();
    roundedCorners();
    initDropDown();
    //initHangingMenuDisplay();
    //initlogindisplay()
    initcswphelp();
    //initfeedbackPopUp();
    initleadcapturePopUp();
    initflashPopUp();
    initMegaMenuDisplay();

    mmRoundedCorners();
    globalNav = new MouseOverNav('mainNav');
    if (document.getElementById('searchAsYouType') != null && document.getElementById('searchField') != null)
        searchAsYouType.initialize(document.getElementById('searchField'), false);
    YUE.onAvailable('NewftrWrapper', function () {
        initemailPopUp();
        if (document.body.id == 'learningCenter') {
            addPopUpWins();
        }

        iTabs = new AjaxTabs('tabs', 'bdyCopy', 'tabContent');
    });
    if ($("#newsticker").length > 0) {
        $("<div />").addClass("tickerClone").css({
            top: $("#newsticker").offset().top + 1,
            left: $("#ticker").offset().left
        }).appendTo("body").fadeTo(1, 0).hide();
    }
}

YUE.on(window, 'load', initLoad);
YUE.on(window, 'load', historyCollapse);

/*Error messages */
errMsgs = new Object();
errMsgs.entrName = "Please enter a Name";
errMsgs.entrComName = "Please enter in a company name";
errMsgs.entrEmail = "Please enter in a valid email address";
errMsgs.bussinessUnit = "Please select who you are trying to contact";
errMsgs.firstName = "Please enter in a first name";
errMsgs.lstName = "Please enter in a last name";
errMsgs.entrZip = "Please enter in a zip/postal code";
errMsgs.entrPhoneno = "Please enter in a valid phone number";
errMsgs.machEmail = "Your email addresses do not match";
errMsgs.eNews = "Please select an eNewsletter";
errMsgs.errOccured = "Sorry an error has occured.";
errMsgs.selAll = "* All available fields must be selected";
errMsgs.custNo = "Please enter in a valid customer number";
errMsgs.orderNo = "Please enter in a valid order number";
errMsgs.invoiceDate = "Please enter in a valid invoice date";
errMsgs.matNo = "Please enter in a valid material number";
errMsgs.invoiceNo = "Please enter in a valid invoice number";
errMsgs.serialNo = "Please enter in a valid serial number"
errMsgs.street = "Please enter in a street address";
errMsgs.state = "Please enter in a state/province";
errMsgs.city = "Please enter in a city";
errMsgs.selTopic = "Please select an option";
errMsgs.selOverall = "Please select a value";
errMsgs.selCat = "* Please select a product category";

/*mail popup variables */
errMsgs.req = "(*) Indicates a required field.";
varPopMsgs = "By entering details in the fields provided, we will send a note to your colleague asking that they visit this page.  All information entered will be held in confidence, and all correspondence will adhere to our strict ";
varPrivacyPolicy = "Privacy Policy";
varContactUs = "Contact Us";
varYourName = "Your Name";
varYourEmailAddress = "Your Email Address";
varInReferenceTo = "In Reference To";
varYourColleagueName = "Your Colleague&#39;s Name";
varYourColleaguesEmail = "Your Colleague&#39;s Email Address";
varCommentToColleague = "Special Comment To Your Colleague (Optional)";
varYourCompanyName = "Your Company Name";
varCloseWindow = "Close Window";
varSubmit = "Submit";
function historyCollapse() {
    var cur_status;
    $('.tabRow').hide();
    $('#tabContent #IMHistory h3.close, #tab2 #IMHistory h3.close,#tabContent #VOHistory h3.close, #tab2 #VOHistory h3.close').attr('status', '');
    var heading = $('#tabContent #IMHistory h3.close, #tab2 #IMHistory h3.close,#tabContent #VOHistory h3.close, #tab2 #VOHistory h3.close');
    heading.bind('click', function () {
        var $this = $(this);

        cur_status = $this.attr('status');
        if (cur_status != 'active') {
            //reset everthing content and attribute
            $('#tabContent #IMHistory .tabRow, #tab2 #IMHistory .tabRow,#tabContent #VOHistory .tabRow, #tab2 #VOHistory .tabRow').slideUp();
            $('.tabRow h3').attr('status', '');

            //then open clicked data
            $this.next().slideDown();
            $this.attr('status', 'active');
            heading.attr("class", "").addClass("close");
            $this.addClass("open");

        }
        //to close the remaining opened data
        else {
            heading.attr("class", "").addClass("close");
            $this.addClass("close");
            $this.next().slideUp();
            $this.attr('status', '');
        }
        return false;
    });
}
