/*jslint bitwise: true, browser: true, eqeqeq: true, immed: true, newcap: true, nomen: true, onevar: true, plusplus: true, undef: true, white: true, indent: 4 */

/*Analogue 1.10.10, Copyright (c) 2010 Analogue Web Design LLC, all rights reserved.*/
var analogue = (function (window, root) {
    var build = new Date(1287423243754), detect = (function () {
        var a, div = document.createElement('div');
        root.className = 'hasJs';
        div.innerHTML = '<form><a href="/a" style="color:red;float:left;opacity:.5">a</a><input /></form>';
        div.getElementsByTagName('input')[0].setAttribute('name', 'nameAttribute');
        a = div.getElementsByTagName('a')[0];
        if (!window.HTMLElement) {
            if (window.Element && window.Element.prototype) {
                window.HTMLElement = window.Element;
            } else {
                if (window['[[DOMElement.prototype]]']) {
                    window.HTMLElement = function () {};
                    window.HTMLElement.prototype = window['[[DOMElement.prototype]]'];
                }
            }
        }
        return {
            cssFloat: !!a.style.cssFloat ? 'cssFloat' : 'styleFloat',
            encType: !!div.getElementsByTagName('form')[0].encoding ? 'encoding' : 'enctype',
            getElementById: (function () {
                var div = document.createElement('div'), id = 'id' + new Date().getTime(), value = true;
                div.innerHTML = '<a name="' + id + '"></a>';
                root.insertBefore(div, root.firstChild);
                value = !div.ownerDocument.getElementById(id);
                root.removeChild(div);
                return value;
            }()),
            href: a.getAttribute('href') === '/a',
            style: (/red/).test(a.getAttribute('style')),
            setAttribute: (/nameAttribute/).test(div.innerHTML),
            arraySlice: (function () {
                try {
                    return !!Array.prototype.slice.call(root.childNodes)[0];
                } catch (e) {
                    return false;
                }
            }()),
            opacity: a.style.opacity === '0.5',
            textContent: a.textContent === 'a' ? 'textContent' : 'innerText'
        };
    }()), events = (function () {
        var cancelBubble, fixEvent = function (element, event) {
            event.metaKey = event.ctrlKey;
            event.pageX = event.clientX + Math.max(root.scrollLeft, document.body.scrollLeft) - (root.clientLeft || 0);
            event.pageY = event.clientY + Math.max(root.scrollTop, document.body.scrollTop) - (root.clientTop || 0);
            event.preventDefault = function () {
                this.returnValue = false;
            };
            event.relatedTarget = event.type === 'mouseover' ? event.fromElement : event.type === 'mouseout' ? event.toElement : undefined;
            event.stopPropagation = function () {
                this.cancelBubble = true;
            };
            event.target = event.srcElement || element;
            event.timeStamp = new Date().getTime();
            event.which = event.charCode = event.keyCode;
            if (!event.which && event.button) {
                event.which = (event.button === 1 ? 1 : (event.button === 4 ? 2 : (event.button === 2 ? 3 : 0)));
            }
            return event;
        }, guid = 0, meta = null, returnValue, handleEvent = function (event) {
            event = event || fixEvent(this, window.event);
            var i, listeners = this.events[event.type];
            for (i in listeners) {
                if (listeners.hasOwnProperty(i)) {
                    meta.pseudoEvent = {'listener': listeners[i], 'target': this, 'event': event};
                    if (returnValue === false) {
                        event.preventDefault();
                    }
                    if (cancelBubble === true) {
                        event.stopPropagation();
                    }
                }
            }
        };
        if (root.attachEvent) {
            meta = document.createElement('meta');
            meta.pseudoEvent = null;
            meta.attachEvent('onpropertychange', function (event) {
                if (event.propertyName === 'pseudoEvent') {
                    meta.pseudoEvent.listener.call(meta.pseudoEvent.target, meta.pseudoEvent.event);
                    returnValue = meta.pseudoEvent.event.returnValue;
                    cancelBubble = meta.pseudoEvent.event.cancelBubble;
                }
            });
            document.getElementsByTagName('head')[0].appendChild(meta);
        }
        return {
            addEvent: root.addEventListener ? function (type, listener) {
                this.addEventListener(type, listener, false);
                return this;
            } : function (type, listener) {
                listener.guid = listener.guid || (guid += 1);
                this.events = this.events || {};
                if (!this.events[type]) {
                    this.events[type] = {};
                    if (this['on' + type]) {
                        this.events[type][0] = this['on' + type];
                    }
                    this['on' + type] = handleEvent;
                }
                this.events[type][listener.guid] = listener;
                return this;
            },
            removeEvent: root.removeEventListener ? function (type, listener) {
                this.removeEventListener(type, listener, false);
                return this;
            } : function (type, listener) {
                if (this.events && this.events[type] && listener.guid) {
                    delete this.events[type][listener.guid];
                }
                return this;
            },
            triggerEvent: root.dispatchEvent ? function (type, which) {
                var charCode = 0, event = null, keyCode = 0;
                if (/mouse|click/.test(type)) {
                    event = document.createEvent('MouseEvents');
                    if (event.initMouseEvent) {
                        event.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, which || 0, null);
                    } else {
                        event = document.createEvent('UIEvents');
                        event.initEvent(type, true, true);
                        event.button = which || 0;
                    }
                } else if (/key(down|press|up)/.test(type)) {
                    if (which) {
                        which = typeof which === 'number' ? which : which.charCodeAt(0);
                        if (type === 'keypress') {
                            if ((which > 64 && which < 91) || (which > 96 && which < 123)) {
                                charCode = which;
                            } else {
                                keyCode = which;
                            }
                        } else {
                            keyCode = which;
                        }
                    }
                    try {
                        event = document.createEvent('KeyEvents');
                        event.initKeyEvent(type, true, true, window, false, false, false, false, keyCode, charCode);
                    } catch (e) {
                        try {
                            event = document.createEvent('Events');
                        } catch (er) {
                            event = document.createEvent('UIEvents');
                        } finally {
                            event.initEvent(type, true, true);
                            event.keyCode = keyCode;
                            event.charCode = charCode;
                            event.which = which || 0;
                        }
                    }
                } else {
                    event = document.createEvent('HTMLEvents');
                    event.initEvent(type, true, true);
                }
                return this.dispatchEvent(event);
            } : function (type, which) {
                var event = document.createEventObject();
                if (/mouse|click/.test(type)) {
                    event.button = (which === 0 ? 1 : (which === 1 ? 4 : (which === 2 ? 2 : 0)));
                } else if (/key(down|press|up)/.test(type)) {
                    event.keyCode = which ? (typeof which === 'number' ? which : which.charCodeAt(0)) : 0;
                }
                event.type = type;
                return this.fireEvent('on' + type, fixEvent(this, event));
            }
        };
    }()), extend = function (object, source) {
        if (!source) {
            source = object;
            object = this;
        }
        for (var i in source) {
            if (source.hasOwnProperty(i) && !object[i]) {
                object[i] = source[i];
            }
        }
        return object;
    }, methods = (function () {
        var booleans = {
            'checked': 'checked',
            'disabled': 'disabled',
            'multiple': 'multiple',
            'readonly': 'readOnly',
            'selected': 'selected'
        }, getOpacity = function (element) {
            if (detect.opacity) {
                return window.getComputedStyle(element, null).opacity || 1;
            }
            try {
                return element.filters.item('DXImageTransform.Microsoft.Alpha').opacity / 100;
            } catch (e) {
                try {
                    return element.filters.alpha.opacity / 100;
                } catch (er) {}
            }
            return 1;
        }, i, properties = {
            'accesskey': 'accessKey',
            'class': 'className',
            'enctype': detect.encType,
            'float': detect.cssFloat,
            'for': 'htmlFor',
            'html': 'innerHTML',
            'maxlength': 'maxLength',
            'tabindex': 'tabIndex',
            'text': detect.textContent,
            'value': 'value'
        };
        for (i in booleans) {
            if (booleans.hasOwnProperty(i)) {
                properties[i] = booleans[i];
            }
        }
        return {
            addClass: function (value) {
                var classes = this.className.split(' ');
                if (!this.hasClass(value)) {
                    classes.push(value);
                    this.className = classes.join(' ');
                }
                return this;
            },
            getProperty: function (attribute) {
                if (attribute === 'style' && !detect.style) {
                    return this.style.cssText.toLowerCase();
                }
                if (attribute === 'opacity') {
                    return getOpacity(this);
                }
                if ((/^(href|src|type|value)$/i).test(attribute) && !detect.href) {
                    return this.getAttribute(attribute, 2);
                }
                if (booleans[attribute]) {
                    return !!this[properties[attribute]];
                }
                return properties[attribute] ? this[properties[attribute]] : this.getAttribute(attribute);
            },
            hasClass: function (value) {
                return this.className && new RegExp('(^|\\s)' + value + '($|\\s)').test(this.className);
            },
            removeClass: function (value) {
                var classes = this.className.split(' '), i, ii;
                for (i = 0, ii = classes.length; i < ii; i += 1) {
                    if (classes[i] === value) {
                        classes.splice(i, 1);
                    }
                }
                this.className = classes.join(' ');
                return this;
            },
            setProperty: function (attribute, value) {
                if (attribute === 'style' && !detect.style) {
                    this.style.cssText = value;
                } else if (attribute === 'opacity') {
                    if (detect.opacity) {
                        this.style.opacity = value;
                    } else if (this.style.filter !== undefined) {
                        this.style.filter = 'alpha(opacity=' + value * 100 + ')';
                    }
                } else if (attribute.match(/^on(\w+)$/i) && typeof value === 'function') {
                    this.addEvent(RegExp.$1, value);
                } else if (properties[attribute]) {
                    if (booleans[attribute] && typeof value !== 'boolean') {
                        value = (typeof value !== 'undefined') ? true : false;
                    }
                    this[properties[attribute]] = value;
                } else {
                    this.setAttribute(attribute, value);
                }
                return this;
            },
            toggleClass: function (value) {
                if (this.hasClass(value)) {
                    this.removeClass(value);
                } else {
                    this.addClass(value);
                }
                return this;
            }
        };
    }()), path = (function (location, src) {
        return src.replace(/(\?[\w\.]+)$/, '').replace(/((\/)*[\w\.]+)$/, '/').replace(new RegExp('^' + location.protocol + '//' + location.host), '');
    }(window.location, document.getElementsByTagName('script')[0].src)), selectors = (function () {
        var clean = function (string) {
            return string.replace(/^\s+|\s+$/g, '');
        }, getElementById = detect.getElementById ? function (id) {
            return document.getElementById(id);
        } : function (id) {
            var element = document.getElementById(id), elements, i;
            if (element) {
                if (element.id === id) {
                    return element;
                } else {
                    elements = document.all[id];
                    for (i = 1; (element = elements[i]); i += 1) {
                        if (element.id === id) {
                            return element;
                        }
                    }
                }
            }
            return null;
        }, getElements = function (context, tag, combinator) {
            tag = (tag ? tag : '*').toLowerCase();
            var child, children, collection = [], element, elements, i, ii, j;
            for (i = 0, ii = context.length; i < ii; i += 1) {
                switch (combinator) {
                case '>':
                    children = context[i].childNodes;
                    for (j = 0; (child = children[j]); j += 1) {
                        if (child.nodeType === 1 && child.nodeName !== '!') {
                            if (tag === '*' || child.nodeName.toLowerCase() === tag) {
                                collection.push(child);
                            }
                        }
                    }
                    break;
                case '+':
                    element = context[i].nextSibling;
                    while (element) {
                        if (element.nodeType === 1 && element.nodeName !== '!') {
                            if (tag !== '*' && element.nodeName.toLowerCase() !== tag) {
                                break;
                            }
                            collection.push(element);
                            break;
                        } else {
                            element = element.nextSibling;
                        }
                    }
                    break;
                default:
                    elements = context[i].getElementsByTagName(tag);
                    for (j = 0; (element = elements[j]); j += 1) {
                        collection.push(element);
                    }
                }
            }
            return collection;
        }, getPrevious = function (element) {
            while (element.nodeType !== 1) {
                element = element.previousSibling;
            }
            return element;
        }, parse = function (context, selector) {
            context = [context];
            selector = clean(selector.replace(/\s*(>|\+)\s*/g, ' $1'));
            var combinator, element, elements, i, ii, j, k, kk, match, parts, property, token, tokens = selector.split(' ');
            for (i = 0, ii = tokens.length; i < ii; i += 1) {
                token = clean(tokens[i]);
                if ((match = (/^(>|\+)/i).exec(token))) {
                    combinator = match[1];
                    token = token.replace(combinator, '');
                }
                if (token.indexOf('#') > -1) {
                    parts = token.split('#');
                    element = getElementById(parts[1]);
                    if (!element || (parts[0] && element.nodeName.toLowerCase() !== parts[0])) {
                        return [];
                    }
                    context = [element];
                } else if (token.indexOf('.') > -1) {
                    parts = token.split('.');
                    elements = getElements(context, parts[0], combinator);
                    context = [];
                    for (j = 0; (element = elements[j]); j += 1) {
                        match = true;
                        for (k = 1, kk = parts.length; k < kk; k += 1) {
                            if (!element.className || !new RegExp('(^|\\s)' + parts[k] + '(\\s|$)').test(element.className)) {
                                match = false;
                                break;
                            }
                        }
                        if (match) {
                            context.push(element);
                        }
                    }
                } else if ((match = (/^(\w*):first\-child$/i).exec(token))) {
                    elements = getElements(context, match[1], combinator);
                    context = [];
                    for (j = 0; (element = elements[j]); j += 1) {
                        if (!getPrevious(element)) {
                            context.push(element);
                        }
                    }
                } else if ((match = (/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/i).exec(token))) {
                    elements = getElements(context, match[1], combinator);
                    context = [];
                    for (j = 0; (element = elements[j]); j += 1) {
                        if ((property = element.getProperty(match[2]))) {
                            if (!match[3]) {
                                context.push(element);
                            } else if (match[3] === '=' && property === match[4]) {
                                context.push(element);
                            } else if (match[3] === '~' && new RegExp('(^|\\s)' + match[4] + '(\\s|$)').test(property)) {
                                context.push(element);
                            } else if (match[3] === '^' && property.indexOf(match[4]) === 0) {
                                context.push(element);
                            } else if (match[3] === '$' && property.lastIndexOf(match[4]) === (property.length - match[4].length)) {
                                context.push(element);
                            } else if (match[3] === '*' && (property.indexOf(match[4]) + 1)) {
                                context.push(element);
                            } else if (match[3] === '|' && new RegExp('^' + match[4] + '-').test(property)) {
                                context.push(element);
                            }
                        }
                    }
                } else {
                    context = getElements(context, token, combinator);
                }
            }
            return context;
        }, unique = function (collection) {
            var element, filtered = [], i;
            for (i = 0; (element = collection[i]); i += 1) {
                if (!element.included && element.nodeName !== '!') {
                    element.included = true;
                    filtered.push(element);
                }
            }
            for (i = 0; (element = filtered[i]); i += 1) {
                element.included = null;
            }
            return filtered;
        };
        return {
            match: document.querySelectorAll ? function (context, selector) {
                var collection = [], elements = context.querySelectorAll(selector), i = 0;
                if (detect.arraySlice) {
                    return Array.prototype.slice.call(elements);
                }
                while (elements[i]) {
                    collection.push(elements[i]);
                    i += 1;
                }
                return collection;
            } : function (context, selector) {
                var collection = [], i, ii, groups = selector.split(',');
                for (i = 0, ii = groups.length; i < ii; i += 1) {
                    collection = collection.concat(parse(context, groups[i]));
                }
                return unique(collection);
            }
        };
    }()), versioning = [1, String(build.getFullYear()).slice(2), String((build.getMonth() + 1) / 100).slice(2)];
    extend(methods, extend(events, {
        getElementsByAttribute: function (name, value, tag) {
            return selectors.match(this, (tag ? tag : '') + '[' + name + (value ? '~="' + value + '"' : '') + ']');
        },
        getElementsByClassName: function (value) {
            return selectors.match(this, '.' + value.replace(' ', '.'));
        },
        getElementsBySelector: function (selector) {
            return selectors.match(this, selector);
        }
    }));
    extend(Function.prototype, {
        bind: function (object) {
            var method = this;
            return function () {
                return method.apply(object, arguments);
            };
        },
        extend: extend,
        inherit: function (object) {
            this.prototype = object;
            return this;
        }
    });
    extend(window, {
        addEvent: function () {
            return events.addEvent.apply(window, arguments);
        },
        removeEvent: function () {
            return events.removeEvent.apply(window, arguments);
        },
        triggerEvent: function () {
            return events.triggerEvent.apply(window, arguments);
        }
    });
    extend(document, {
        addEvent: function (type, listener) {
            if ((/^(dom|ready)+(contentloaded)*$/i).test(type)) {
                if (!this.ready.fired) {
                    events.addEvent.call(this, 'dataavailable', listener);
                } else {
                    listener.apply(this, arguments);
                }
                return this;
            } else {
                return events.addEvent.call(this, type, listener);
            }
        },
        get: function (query) {
            var attempt = 'getElementById,getElementsByTagName,getElementsByClassName,getElementsBySelector'.split(','), i, ii, result;
            for (i = 0, ii = attempt.length; i < ii; i += 1) {
                try {
                    result = this[attempt[i]](query);
                    if (result !== null && (result.length === undefined || result.length !== 0)) {
                        return result;
                    }
                } catch (e) {}
            }
            return null;
        },
        head: document.getElementsByTagName('head')[0],
        loadScript: function (source) {
            if (/*@cc_on!@*/false && !this.ready.fired) {
                this.write(decodeURI('%3Cscript src="' + source + '" type="text/javascript"%3E%3C/script%3E'));
            } else {
                var script = this.createElement('script');
                script.setAttribute('type', 'text/javascript');
                script.setAttribute('src', source);
                this.head.appendChild(script);
            }
            return this;
        },
        loadStyleSheet: function (source, media) {
            var sheet = this.createElement('link');
            sheet.setAttribute('href', source);
            sheet.setAttribute('media', media || 'screen');
            sheet.setAttribute('rel', 'stylesheet');
            sheet.setAttribute('type', 'text/css');
            this.head.appendChild(sheet);
            return this;
        },
        ready: function () {
            if (!document.ready.fired) {
                document.ready.fired = true;
                document.ready.fire();
                if (document.removeEventListener) {
                    document.removeEventListener('DOMContentLoaded', document.ready, false);
                }
                window.removeEvent('load', document.ready);
            }
        }.extend({
            fire: root.dispatchEvent ? function () {
                var event = document.createEvent('HTMLEvents');
                event.initEvent('dataavailable', true, true);
                document.dispatchEvent(event);
            } : function () {
                var event = document.createEventObject();
                event.type = 'dataavailable';
                document.fireEvent('on' + event.type, event);
            },
            fired: false
        }),
        set: function (tag, attributes, content) {
            var element, i, ii;
            if (attributes && !detect.setAttribute) {
                for (i in attributes) {
                    if (i.match(/^(checked|multiple|name|readonly|type)$/i)) {
                        tag += ' ' + i + '="' + attributes[i] + '"';
                        delete attributes[i];
                    }
                }
                tag = '<' + tag + '>';
            }
            element = document.createElement(tag);
            if (attributes) {
                for (i in attributes) {
                    if (attributes.hasOwnProperty(i)) {
                        element.setProperty(i, attributes[i]);
                    }
                }
            }
            if (content) {
                if (typeof content === 'string') {
                    element.appendChild(document.createTextNode(content));
                } else {
                    for (i = 0, ii = content.length; i < ii; i += 1) {
                        if (typeof content[i] === 'string') {
                            content[i] = document.createTextNode(content[i]);
                        }
                        element.appendChild(content[i]);
                    }
                }
            }
            return element;
        }
    });
    extend(document, events);
    if (window.HTMLElement) {
        extend(window.HTMLElement.prototype, methods);
    } else {
        document.create = document.createElement;
        document.createElement = function (tag) {
            return extend(document.create(tag), methods);
        };
        document.addEvent('ready', function () {
            var elements = document.getElementsByTagName('*'), i, ii;
            for (i = 0, ii = elements.length; i < ii; i += 1) {
                extend(elements[i], methods);
            }
        });
    }
    if (document.addEventListener) {
        document.addEventListener('DOMContentLoaded', document.ready, false);
    }
    /*@cc_on document.loadScript(path + 'Analogue.MSIE.js.ashx').write(decodeURI('%3Cscript defer src="//:" onreadystatechange="if(this.readyState===\'complete\'){document.ready();}"%3E%3C/script%3E')); @*/
    window.addEvent('load', document.ready);
    return {
        path: path,
        version: versioning.join('.') + ' (' + parseInt(build.valueOf() / 1000, 10) + ')'
    };
}(this, document.documentElement));

/*Analogue.Forms 1.10.1, Copyright (c) 2010 Analogue Web Design LLC, all rights reserved.*/
analogue.forms = (function (window) {
    var build = new Date('February 24 2010 20:51:50'), check = {
        alpha: function (value) {
            return !(/[^a-zA-Z]/g).test(value);
        },
        alphaNumeric: function (value) {
            return !(/[^a-zA-Z\d]/g).test(value);
        },
        creditCard: (function () {
            var cards = [ // http://en.wikipedia.org/wiki/Credit_card_number
                {length: '15', name: 'American Express', prefix: /^3[4|7]{1}/},
                {length: '16', name: 'Discover', prefix: /^(6011|622|(64[4-9]{1})|65)/},
                {length: '16', name: 'MasterCard', prefix: /^5[1-5]{1}/},
                {length: '13,16', name: 'Visa', prefix: /^4/}
            ];
            return {
                length: function (element) {
                    var i, ii, lengths = cards[element.cardType].length.split(','), value = element.value;
                    for (i = 0, ii = lengths.length; i < ii; i += 1) {
                        if (value.length === parseInt(lengths[i], 10)) {
                            return true;
                        }
                    }
                    return false;           
                },
                luhn: function (value) { 
                    var calc, checksum = 0, i, j = 1;
                    for (i = value.length - 1; i >= 0; i -= 1) {
                        calc = Number(value.charAt(i)) * j;
                        if (calc > 9) {
                            checksum = checksum + 1;
                            calc = calc - 10;
                        }
                        checksum = checksum + calc;
                        j = j === 1 ? 2 : 1;
                    } 
                    return (checksum % 10 === 0);
                },
                prefix: function (element) {
                    var i, ii, value = element.value;
                    element.cardName = element.cardType = null;
                    if (value.length > 1) {
                        for (i = 0, ii = cards.length; i < ii; i += 1) {
                            if (cards[i].prefix.test(value)) {
                                element.cardType = i;
                                element.cardName = cards[i].name;
                                return true;
                            }
                        }
                    }     
                    return false;
                }
            };
        }()),
        date: function (value) {
            var day, days, month, year;
            if (!(/^(\d{1,2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{4})$/).test(value)) {
                return false;
            }
            month = parseInt(RegExp.$1, 10);
            day = parseInt(RegExp.$2, 10);
            year = parseInt(RegExp.$3, 10);
            if (month < 1 || month > 12 || year < 1900 || year > 2100) {
                return false;
            }
            switch (month) {
            case 2:
                days = ((year % 4) === 0) ? 29 : 28;
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                days = 30;
                break;
            default:
                days = 31;
            }
            return (day >= 1 && day <= days);
        },
        email: function (value) {
            if ((/^([\w\-]+(?:\.[\w\-]+)*)@((?:[\w\-]+\.)*\w[\w\-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/).test(value)) {
                var path = analogue.path + 'mx/lookup.ashx', request = new XMLHttpRequest();
                if (!request) {
                    return true;
                } else {
                    request.open('GET', path + '?email=' + value.split('@')[1] + '&nocache=' + new Date().getTime(), false);
                    request.send(null);
                    if (request.status === 200) {
                        if (request.responseText.indexOf('ERROR')) {
                            return true;
                        }
                        return false;
                    }
                    return true;
                }
            }
            return false;
        },
        empty: function (value) {
            return !(value === null || value.length === 0 || (/^\s+$/).test(value));
        },
        group: function (node) {
            var count = 0, i, ii, valid = null;
            if (node.nodeType !== 1) {
                return 0;
            }
            if (node.nodeName.toLowerCase() === 'input') {
                switch (node.type.toLowerCase()) {
                case 'checkbox':
                case 'radio':
                    valid = node.checked;
                    break;
                default: 
                    valid = node.value;
                }
            } else {
                valid = node.value;
            }
            if (valid && this.empty(valid)) {
                count += 1;
            }
            for (i = 0, ii = node.childNodes.length; i < ii; i += 1) {
                count += this.group(node.childNodes[i]);
            }
            return count;
        },
        match: function (element) {
            var verify = document.getElementById(element.id.split('-')[1]);
            if (verify && element.value !== verify.value) {
                return false;
            }
            return true;
        },
        numeric: function (value) {
            return !(/[^\d\.\-]/g).test(value);
        },
        phone: function (value) {
            return (/^([1]?[\s\.\-]?\(?[2-9]\d{2}\)?)?[\s\.\-]?(\d{3}[\s\.\-]?\d{4})$/).test(value);
        },
        url: function (value) {
            return (/^(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?\^=%&amp;:\/~\+#]*[\w\-\@?\^=%&amp;\/~\+#])?/).test(value);
        }
    }, getLabel = function (element, form) {
        if (element.parentNode.nodeName.toLowerCase() === 'label') {
            return element.parentNode;
        }
        var i, label, labels = form.getElementsByTagName('label');
        for (i = 0; (label = labels[i]); i += 1) {
            if (label.htmlFor && label.htmlFor === element.id) {
                return label;
            }
        }
        return false;
    }, serialize = function () {
        var element, elements = this.elements, i, j, jj, parameters = [], push = function (name, value) {
            parameters.push(encodeURIComponent(name) + '=' + encodeURIComponent(value));
        };
        for (i = 0; (element = elements[i]); i += 1) {
            if (!element.disabled) {
                switch (element.type) {
                case 'text':
                case 'password':
                case 'hidden':
                case 'textarea': 
                    push(element.name, element.value);
                    break;
                case 'select-one':
                    if (element.selectedIndex >= 0) {
                        push(element.name, element.options[element.selectedIndex].value);
                    }
                    break;
                case 'select-multiple':
                    for (j = 0, jj = element.options.length; j < jj; j += 1) {
                        if (element.options[j].selected) {
                            push(element.name, element.options[j].value);
                        }
                    }
                    break;
                case 'checkbox':
                case 'radio':
                    if (element.checked) {
                        push(element.name, element.value);
                    }
                    break;
                }
            }
        }
        return parameters.join('&');
    }, validate = function (event) {
        var count, element, elements = this.getElementsByClassName('isRequired'), error, errors = [], i, j, jj, match, message, span, tag, title, valid, value;
        for (i = 0; (element = elements[i]); i += 1) {
            element.removeClass('isInvalid');
            if (element.label) {
                element.label.removeClass('isInvalid');
            }
            if (element.nextSibling && element.nextSibling.nodeName.toLowerCase() === 'span') {
                element.parentNode.removeChild(element.nextSibling);
            } else if (element.lastChild && element.lastChild.nodeName.toLowerCase() === 'span') {
                element.removeChild(element.lastChild);
            }
            tag = element.nodeName.toLowerCase();
            title = element.title;
            valid = true;
            value = element.value;
            switch (tag) {
            case 'div':
            case 'fieldset':
                if ((/atLeast-(\d+)/).test(element.className)) {
                    if (!(valid = (count = parseInt(RegExp.$1, 10)) <= check.group(element))) {
                        errors.push('Please select at least ' + count + ' options in the ' + title + ' group.');
                    }
                } else if (!(valid = check.group(element))) {
                    errors.push('Please select an option in the ' + title + ' group.');
                } 
                if (valid && (/atMost-(\d+)/).test(element.className)) {
                    if (!(valid = (count = parseInt(RegExp.$1, 10)) >= check.group(element))) {
                        errors.push('Please select no more than ' + count + ' options in the ' + title + ' group.');
                    }
                }
                break;
            case 'input':
                switch (element.type.toLowerCase()) {
                case 'checkbox':
                case 'radio':
                    if (!(valid = element.checked)) {
                        errors.push('You must ' + title + '.');
                    }
                    break;
                default:
                    if (!(valid = check.empty(value))) {
                        errors.push('The ' + title + ' field is required.');
                    } else if (element.hasClass('checkPlaceholder') && (!(valid = value !== title))) {
                        errors.push('The ' + title + ' field is required.');
                    } else if (element.hasClass('checkAlpha') && (!(valid = check.alpha(value)))) {
                        errors.push('The ' + title + ' field may contain letters only, no numbers or other characters.');
                    } else if (element.hasClass('checkAlphaNumeric') && (!(valid = check.alphaNumeric(value)))) {
                        errors.push('The ' + title + ' field may contain letters and numbers only.');
                    } else if (element.hasClass('checkCreditCard')) { 
                        value = element.value = element.value.replace(/\W/gi, '');
                        if ((!(valid = check.numeric(value)))) {
                            errors.push('The Credit Card number may contain numbers only, no letters or other characters.');
                        } else if (!(valid = check.creditCard.prefix(element))) {
                            errors.push('The Credit Card number you entered is an unknown or unsupported card type.');
                        } else if (!(valid = check.creditCard.length(element))) {
                            errors.push('Your ' + element.cardName + ' card number has too many or too few digits.');
                        } else if (!(valid = check.creditCard.luhn(value))) {
                            errors.push('Your ' + element.cardName + ' card number is invalid.');
                        }
                    } else if (element.hasClass('checkDate') && (!(valid = check.date(value)))) {
                        errors.push(value + ' does not appear to be a valid date.');
                    } else if (element.hasClass('checkEmail') && (!(valid = check.email(value)))) {
                        errors.push(value + ' does not appear to be a valid e-mail address.');
                    } else if (element.hasClass('checkMatch') && (!(valid = check.match(element)))) {
                        match = document.getElementById(element.id.split('-')[1]);
                        errors.push('The ' + title + ' field does not match the ' + match.title + ' field.');
                    } else if (element.hasClass('checkNumeric') && (!(valid = check.numeric(value)))) {
                        errors.push('The ' + title + ' field may contain numbers only, no letters or other characters.');
                    } else if (element.hasClass('checkPhone') && (!(valid = check.phone(value)))) {
                        errors.push(value + ' does not appear to be a valid phone number.');
                    } else if (element.hasClass('checkUrl') && (!(valid = check.url(value)))) {
                        errors.push(value + ' does not appear to be a valid URL.');
                    }
                }
                break;
            case 'select':
                if (element.hasClass('checkIndex')) {
                    valid = element.selectedIndex !== 0;
                } else {
                    valid = check.empty(element.options[element.selectedIndex].value);
                }
                if (!valid) {
                    errors.push('Please select an option from the ' + title + ' list.');
                }
                break;
            case 'textarea':
                if (!(valid = check.empty(value))) {
                    errors.push('The ' + title + ' field is required.');
                } else if (element.hasClass('checkPlaceholder') && (!(valid = value !== title))) {
                    errors.push('The ' + title + ' field is required.');
                }
                break;
            }
            if (!valid) {
                element.addClass('isInvalid');
                if (element.label) { 
                    element.label.addClass('isInvalid');
                }
                if (!this.hasClass('useConfirm') && !this.hasClass('useAlert')) {
                    span = document.set('span', { 'class': 'errorDetail' },  [errors[0], document.set('span')]);
                    if (tag === 'fieldset' || tag === 'div') {
                        element.appendChild(span);
                    } else {
                        element.parentNode.insertBefore(span, element.nextSibling);
                    }
                    if (element.focus) {
                        element.focus();
                    }
                    event.preventDefault();
                    return false;
                }
                if (errors.length === 1) {
                    error = element;
                }
            }
        }
        if (errors.length === 0) {
            if (this.hasClass('disableSubmit')) {
                this.getElementsBySelector('[type="submit"]')[0].disabled = true;
            }
            return true;
        }
        message = 'The following form ' + (errors.length > 1 ? 'fields were' : 'field is') + ' incomplete or incorrect:\n\n';
        for (j = 0, jj = errors.length; j < jj; j += 1) {
            message += (j + 1) + '. ' + errors[j] + '\n';
        }
        if (this.hasClass('useConfirm') && window.confirm(message + '\nYour form has not been submitted.\nClick \"OK\" to continue submitting the form; or\nClick \"Cancel\" to check the information that you provided and try again.')) {
            return true;
        } else if (this.hasClass('useAlert')) {
            window.alert(message + '\nYour form has not been submitted.\nPlease check the information that you provided and submit the form again.');
        }
        if (error.focus) {
            error.focus();
        }
        event.preventDefault();
        return false;
    }, versioning = [1, build.getFullYear().toString().slice(2), build.getMonth().toString()];
    document.addEvent('ready', function () {
        var element, elements, form, forms = document.getElementsByTagName('form'), i, j, setFocus = false;
        for (i = 0; (form = forms[i]); i += 1) {
            form.serialize = serialize;
            if (!setFocus && form.hasClass('setFocus')) {
                setFocus = form;
            }
            elements = form.getElementsByClassName('isRequired');
            if (elements.length > 0) {
                form.addEvent('submit', validate);
                for (j = 0; (element = elements[j]); j += 1) {
                    element.label = getLabel(element, form);
                }
            }
        }
        if (setFocus) {
            window.addEvent('load', function () {
                var element, elements = this.elements, i;
                for (i = 0; (element = elements[i]); i += 1) {
                    if (element.nodeName.toLowerCase() !== 'fieldset' && element.type.toLowerCase() !== 'hidden' && !element.disabled) {
                        element.focus();
                        break;
                    }
                }
            }.bind(setFocus));
        }
    });  
    document.addEvent('ready', function () {
        var blur = function () {
            if (this.value === '') {
                this.value = this.getProperty('title');
            }
        }, focus = function () {
            if (this.value === this.getProperty('title')) {
                this.value = '';
            }
        }, i, field, fields = document.get('.checkPlaceholder') || [];
        for (i = 0; (field = fields[i]); i += 1) {
            field.addEvent('blur', blur).addEvent('focus', focus);
        }
    });  
    return {
        validate: function (method, parameters) {
            return check[method](parameters);
        },
        version: versioning.join('.') + ' (' + (build.valueOf() / 1000) + ')' 
    };
}(this));

/*Animate 1.10.1, Copyright (c) 2010 Analogue Web Design LLC, all rights reserved.*/
var animate = function (object, property, transition, begin, finish, duration, suffix) {
    var instance = {
        addEvent: function (listener) {
            this.removeEvent(listener);
            return this.listeners.push(listener);
        },
        callEvent: function () {
            var i, ii, listener, listeners = this.listeners, properties = [];
            for (i = 0, ii = arguments.length; i < ii; i += 1) {
                properties.push(arguments[i]);
            }
            listener = properties.shift();
            for (i = 0, ii = listeners.length; i < ii; i += 1) {
                if (listeners[i][listener]) {
                    listeners[i][listener].apply(listeners[i], properties);
                }
            }
        },
        change: 0,
        continueTo: function (finish, duration) {
            this.begin = this.position;
            this.setFinish(finish);
            if (this.duration !== undefined) {
                this.setDuration(duration);
            }
            this.start();
        },
        delegate: function (object, method) {
            var array = [], i, ii;
            for (i = 2, ii = arguments.length; i < ii; i += 1) {
                array[i - 2] = arguments[i];
            }
            return function () {
                method.apply(object, [].concat(arguments, array));
            };
        },
        fforward: function () {
            this.time = this.duration;
            this.fixTime();
            this.update();
        },
        fixTime: function () {
            this.startTime = this.getTimer() - this.time * 1000;
        },
        getPosition: function (time) {
            if (time === undefined) {
                time = this.time;
            }
            return this.transition(time, this.begin, this.change, this.duration);
        },
        getTimer: function () {
            return new Date().getTime() - this.time;
        },
        initialize: function () {
            this.listeners = [];
            this.addEvent(this);
            this.object = object;
            this.property = property;
            if (transition !== null && transition !== '') {
                this.transition = transition;
            }
            if (property === 'opacity') {
                if (begin < 0) {
                    begin = 0;
                }
                if (finish > 100) {
                    finish = 100;
                }
            }
            this.begin = begin;
            this.position = begin;
            this.setFinish(finish);
            this.setDuration(duration);
            this.suffix = suffix || '';
            return this;
        },
        listeners: [],
        looping: false,
        nextFrame: function () {
            this.setTime((this.getTimer() - this.startTime) / 1000);
        },
        onEnterFrame: function () {
            if (this.isPlaying) {
                this.nextFrame();
                setTimeout(this.delegate(this, this.onEnterFrame), 0);
            }
        },
        position: 0,
        prevPosition: 0,
        prevTime: 0,
        removeEvent: function (listener) {
            var i, ii, listeners = this.listeners;
            for (i = 0, ii = listeners.length; i < ii; i += 1) {
                if (listeners[i] === listener) {
                    listeners.splice(i, 1);
                    return true;
                }
            }
            return false;
        },
        resume: function () {
            this.fixTime();
            this.startEnterFrame();
            this.callEvent('onresume', { target: this, type: 'onresume' });
        },
        rewind: function (time) {
            this.stop();
            this.time = (time === undefined) ? 0 : time;
            this.fixTime();
            this.update();
        },
        setDuration: function (duration) {
            this.duration = (duration === null || duration <= 0) ? 100000 : duration;
        },
        setFinish: function (finish) {
            this.change = finish - this.begin;
        },
        setPosition: function (position) {
            this.prevPosition = this.position;
            if (this.property === 'opacity') {
                this.object.style.opacity = Math.round(position) / 100; 
                this.object.style.MozOpacity = Math.round(position) / 100;
                this.object.style.KhtmlOpacity = Math.round(position) / 100;
                this.object.style.filter = 'alpha(opacity=' + Math.round(position) + ')';
            } else {
                this.object[this.property] = Math.round(position) + this.suffix;
            }
            this.position = position;
            this.callEvent('onchange', { target: this, type: 'onchange' });
        },
        setTime: function (time) {
            this.prevTime = this.time;
            if (time > this.duration) {
                if (this.looping) {
                    this.rewind(time - this.duration);
                    this.update();
                    this.callEvent('onloop', { target: this, type: 'onloop' });
                } else {
                    this.time = this.duration;
                    this.update();
                    this.stop();
                    this.callEvent('onfinish', { target: this, type: 'onfinish' });
                }
            } else if (time < 0) {
                this.rewind();
                this.update();
            } else {
                this.time = time;
                this.update();
            }
        },
        start: function () {
            this.rewind();
            this.startEnterFrame();
            this.callEvent('onstart', { target: this, type: 'onstart' });
        },
        startEnterFrame: function () {
            this.stopEnterFrame();
            this.isPlaying = true;
            this.onEnterFrame();
        },
        startTime: 0,
        stop: function () {
            this.stopEnterFrame();
            this.callEvent('onstop', { target: this, type: 'onstop' });
        },
        stopEnterFrame: function () {
            this.isPlaying = false;
        },
        time: 0,
        // simple linear tweening - no easing
        transition: function (t, b, c, d) {
            return c * t / d + b;
        },
        update: function () {
            this.setPosition(this.getPosition(this.time));
        },
        yoyo: function () {
            this.continueTo(this.begin, this.time);
        }
    };
    return instance.initialize();
}.extend({
    // BACK EASING: overshooting cubic easing: (s+1)*t^3 - s*t^2
    backIn: function (t, b, c, d, s) {
        s = s || 1.70158;
        return c * (t /= d) * t * ((s + 1) * t - s) + b;
    },
    backOut: function (t, b, c, d, s) {
        s = s || 1.70158;
        return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
    },
    backInOut: function (t, b, c, d, s) {
        s = 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;
    },
    // BOUNCE EASING: exponentially decaying parabolic bounce
    bounceIn: function (t, b, c, d) {
        return c - animate.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 + 0.75) + b;
        } else if (t < (2.5 / 2.75)) {
            return c * (7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375) + b;
        } else {
            return c * (7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375) + b;
        }
    },
    bounceInOut: function (t, b, c, d) {
        if (t < d / 2) {
            return animate.bounceIn(t * 2, 0, c, d) * 0.5 + b;
        }
        return animate.bounceOut(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b;
    },
    // QUADRATIC EASING: t^2
    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;
    },
    easeInOut: function (t, b, c, d) {
        if ((t /= d / 2) < 1) {
            return c / 2 * t * t + b;
        }
        return -c / 2 * ((t -= 1) * (t - 2) - 1) + b;
    },
    // QUINTIC EASING: t^5
    snapIn: function (t, b, c, d) {
        return c * (t /= d) * t * t * t * t + b;
    },
    snapOut: function (t, b, c, d) {
        return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
    },
    snapInOut: function (t, b, c, d) {
        if ((t /= d / 2) < 1) {
            return c / 2 * t * t * t * t * t + b;
        }
        return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
    },
    version: (function () {
        var build = new Date('February 24 2010 20:53:39'), versioning = [1, build.getFullYear().toString().slice(2), build.getMonth().toString()];
        return versioning.join('.') + ' (' + (build.valueOf() / 1000) + ')';
    }())
});

var slideshow = function (id, interval, pause, element) {
    if (document.getElementById(id)) {
        var container = document.get(id), instance = {
            container: container,
            current: 0,
            fade: function () {
                clearTimeout(this.slideshow);
                var current = this.current, fadeIn, fadeOut, images = this.images, next = images[current + 1] ? current + 1 : 0;
                images[next].style.display = 'block';
                fadeIn = animate(images[next], 'opacity', animate.easeIn, 0, 100, 1, '');
                fadeOut = animate(images[current], 'opacity', animate.easeIn, 100, 0, 1, '');
                fadeOut.onfinish = function () {
                    images[current].style.display = 'none';
                    this.current = next;
                    this.slideshow = setTimeout(function () {
                        this.fade();
                    }.bind(this), this.interval);                 
                }.bind(this);
                fadeIn.start();
                fadeOut.start();
            },
            images: container.getElementsByTagName(element),
            initialize: function () {
                if (pause) {
                    this.container.addEvent('mouseover', function () {
                        clearTimeout(this.slideshow);
                    }.bind(this)).addEvent('mouseout', function () {
                        this.slideshow = setTimeout(function () {
                            this.fade();
                        }.bind(this), this.interval);
                    }.bind(this));
                }
                this.images[0].style.display = 'block';
                this.slideshow = setTimeout(function () {
                    this.fade();
                }.bind(this), this.interval);
                return this;  
            },
            interval: interval || 2000
        };
        return instance.initialize();
    }  
};

/*SPECIAL*/
var special = (function (window) {
    var getPageScroll = function () {
        return [
            window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
            window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
        ];
    }, getPageSize = function () {
        var pageHeight, pageWidth, windowHeight, windowWidth, xScroll, yScroll;
        if (window.innerHeight && window.scrollMaxY) {
            xScroll = window.innerWidth + window.scrollMaxX;
            yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight) {
            xScroll = document.body.scrollWidth;
            yScroll = document.body.scrollHeight;
        } else {
            xScroll = document.body.offsetWidth;
            yScroll = document.body.offsetHeight;
        }
        if (window.innerHeight) {
            if (document.documentElement.clientWidth) {
                windowWidth = document.documentElement.clientWidth; 
            } else {
                windowWidth = window.innerWidth;
            }
            windowHeight = window.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) {
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        } else if (document.body) {
            windowWidth = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
        }
        if (yScroll < windowHeight) {
            pageHeight = windowHeight;
        } else { 
            pageHeight = yScroll;
        }
        if (xScroll < windowWidth) {	
            pageWidth = xScroll;		
        } else {
            pageWidth = windowWidth;
        }
        return [pageWidth, pageHeight, windowWidth, windowHeight];
    };
    return {
        end: function () {
            document.onkeydown = function () {};
            this.special.style.display = 'none';
            this.overlayEffect = animate(this.overlay, 'opacity', animate.easeIn, this.overlayOpacity, 0, this.resizeDuration / 2, '');
            this.overlayEffect.start();
            this.overlayEffect.onfinish = function () {
                this.overlay.style.display = 'none';
            }.bind(this);
        },
        initialize: function (overlayOpacity, resizeSpeed) {
            this.overlayOpacity = overlayOpacity || 80;
            if (this.overlayOpacity > 100) {
                this.overlayOpacity = 100;
            } else if (this.overlayOpacity < 0) {
                this.overlayOpacity = 0;
            }
            this.resizeSpeed = resizeSpeed || 8;
            if (this.resizeSpeed > 10) {
                this.resizeSpeed = 10;
            } else if (this.resizeSpeed < 1) {
                this.resizeSpeed = 1;
            }
            this.resizeDuration = (11 - this.resizeSpeed) * 0.15;
            this.overlay = document.get('overlay');
            this.special = document.get('lightbox-special');
            this.specialHeight = 485;
            document.get('#special a[rel="close"]')[0].addEvent('click', function (event) {
                this.end();
                event.preventDefault();
            }.bind(this));
            document.get('#special a[rel="signup"]')[0].addEvent('click', function (event) {
                document.onkeydown = function () {};
                document.get('rtype').value = 'Web Special';
                this.special.style.display = 'none';
                this.overlayEffect = animate(this.overlay, 'opacity', animate.easeIn, this.overlayOpacity, 0, this.resizeDuration / 2, '');
                this.overlayEffect.start();
                this.overlayEffect.onfinish = function () {
                    this.overlay.style.display = 'none';
                    if (document.get('name')) {
                        document.location.href = '#contact';
                        document.get('name').focus();
                        event.preventDefault();
                    };
                }.bind(this);
                event.preventDefault();
            }.bind(this));
            this.start();
        },
        onkeydown: function () {
            document.onkeydown = function (e) {
                var escape, keycode;
                if (!e) {
                    keycode = event.keyCode;
                    escape = 27;
                } else {
                    keycode = e.which;
                    escape = e.DOM_VK_ESCAPE;
                }
                if (keycode === escape) {
                    this.end();
                }
            }.bind(this);
        },
        start: function () {
            var pageScroll = getPageScroll(), pageSize = getPageSize(), top = (pageScroll[1] + ((pageSize[3] - this.specialHeight) / 2));
            this.overlay.setProperty('style', 'display:block; height:' + pageSize[1] + 'px;');
            this.overlayEffect = animate(this.overlay, 'opacity', animate.easeOut, 0, this.overlayOpacity, this.resizeDuration, '');
            this.overlayEffect.start();
            this.special.setProperty('style', 'display:block; top:' + (top < 0 ? 0 : top) + 'px; left:' + pageScroll[0] + 'px;');
            this.specialEffect = animate(this.special, 'opacity', animate.easeIn, 0, 100, this.resizeDuration, '');
            this.specialEffect.start();
            this.onkeydown();
        }
    };
}(this));
window.addEvent('load', function () {
    if (document.get('lightbox-special')) {
        special.initialize(60)
    }
});

/*Google Anayltics*/
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16077008-1'], ['_trackPageview']);
