﻿jQuery.easing['jswing'] = jQuery.easing['swing']; jQuery.extend(jQuery.easing, { def: 'easeOutQuad', swing: function(x, t, b, c, d) { return jQuery.easing[jQuery.easing.def](x, t, b, c, d); }, easeInQuad: function(x, t, b, c, d) { return c * (t /= d) * t + b; }, easeOutQuad: function(x, t, b, c, d) { return -c * (t /= d) * (t - 2) + b; }, easeInOutQuad: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t + b; return -c / 2 * ((--t) * (t - 2) - 1) + b; }, easeInCubic: function(x, t, b, c, d) { return c * (t /= d) * t * t + b; }, easeOutCubic: function(x, t, b, c, d) { return c * ((t = t / d - 1) * t * t + 1) + b; }, easeInOutCubic: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; return c / 2 * ((t -= 2) * t * t + 2) + b; }, easeInQuart: function(x, t, b, c, d) { return c * (t /= d) * t * t * t + b; }, easeOutQuart: function(x, t, b, c, d) { return -c * ((t = t / d - 1) * t * t * t - 1) + b; }, easeInOutQuart: function(x, 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; }, easeInQuint: function(x, t, b, c, d) { return c * (t /= d) * t * t * t * t + b; }, easeOutQuint: function(x, t, b, c, d) { return c * ((t = t / d - 1) * t * t * t * t + 1) + b; }, easeInOutQuint: function(x, 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; }, easeInSine: function(x, t, b, c, d) { return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; }, easeOutSine: function(x, t, b, c, d) { return c * Math.sin(t / d * (Math.PI / 2)) + b; }, easeInOutSine: function(x, t, b, c, d) { return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; }, easeInExpo: function(x, t, b, c, d) { return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b; }, easeOutExpo: function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; }, easeInOutExpo: function(x, t, b, c, d) { if (t == 0) return b; if (t == d) return b + c; if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b; return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInCirc: function(x, t, b, c, d) { return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; }, easeOutCirc: function(x, t, b, c, d) { return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; }, easeInOutCirc: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; }, easeInElastic: function(x, t, b, c, d) {
    var s = 1.70158; var p = 0; var a = c; if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3; if (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;
}, easeOutElastic: function(x, t, b, c, d) {
    var s = 1.70158; var p = 0; var a = c; if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3; if (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;
}, easeInOutElastic: function(x, t, b, c, d) {
    var s = 1.70158; var p = 0; var a = c; if (t == 0) return b; if ((t /= d / 2) == 2) return b + c; if (!p) p = d * (.3 * 1.5); if (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;
}, easeInBack: function(x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c * (t /= d) * t * ((s + 1) * t - s) + b; }, easeOutBack: function(x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; }, easeInOutBack: function(x, t, b, c, d, s) { if (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; }, easeInBounce: function(x, t, b, c, d) { return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b; }, easeOutBounce: function(x, 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; } else { return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b; } }, easeInOutBounce: function(x, t, b, c, d) { if (t < d / 2) return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b; } 
}); (function($) {
    $.fn.fieldtag = function(options) {
        var opt = $.extend({ markedClass: "tagged", standardText: false }, options); $(this).focus(function() { if (!this.changed) { this.clear(); } }).blur(function() { if (!this.changed) { this.addTag(); } }).keyup(function() { this.changed = ($(this).val() ? true : false); }).each(function() {
            this.title = $(this).attr("title"); if ($(this).val() == $(this).attr("title")) { this.changed = false; }
            this.clear = function() { if (!this.changed) { $(this).val("").removeClass(opt.markedClass); } }
            this.addTag = function() { $(this).val(opt.standardText === false ? this.title : opt.standardText).addClass(opt.markedClass); }
            if (this.form) {
                this.form.tagFieldsToClear = this.form.tagFieldsToClear || []; this.form.tagFieldsToClear.push(this); if (this.form.tagFieldsAreCleared) { return true; }
                this.form.tagFieldsAreCleared = true; $(this.form).submit(function() { $(this.tagFieldsToClear).each(function() { this.clear(); }); });
            } 
        }).keyup().blur(); return $(this);
    } 
})(jQuery); ; (function($) {
    var ie6 = $.browser.msie && parseInt($.browser.version) == 6 && typeof window['XMLHttpRequest'] != "object", ieQuirks = null, w = []; $.modal = function(data, options) { return $.modal.impl.init(data, options); }; $.modal.close = function() { $.modal.impl.close(); }; $.fn.modal = function(options) { return $.modal.impl.init(this, options); }; $.modal.defaults = { appendTo: 'body', focus: true, opacity: 50, overlayId: 'simplemodal-overlay', overlayCss: {}, containerId: 'simplemodal-container', containerCss: {}, dataId: 'simplemodal-data', dataCss: {}, minHeight: 200, minWidth: 300, maxHeight: null, maxWidth: null, autoResize: false, zIndex: 1000, close: true, closeHTML: '<a class="modalCloseImg" title="Close"></a>', closeClass: 'simplemodal-close', escClose: true, overlayClose: false, position: null, persist: false, onOpen: null, onShow: null, onClose: null }; $.modal.impl = { opts: null, dialog: {}, init: function(data, options) {
        if (this.dialog.data) { return false; }
        ieQuirks = $.browser.msie && !$.boxModel; this.opts = $.extend({}, $.modal.defaults, options); this.zIndex = this.opts.zIndex; this.occb = false; if (typeof data == 'object') { data = data instanceof jQuery ? data : $(data); if (data.parent().parent().size() > 0) { this.dialog.parentNode = data.parent(); if (!this.opts.persist) { this.dialog.orig = data.clone(true); } } }
        else if (typeof data == 'string' || typeof data == 'number') { data = $('<div/>').html(data); }
        else { alert('SimpleModal Error: Unsupported data type: ' + typeof data); return false; }
        this.create(data); data = null; this.open(); if ($.isFunction(this.opts.onShow)) { this.opts.onShow.apply(this, [this.dialog]); }
        return this;
    }, create: function(data) {
        w = this.getDimensions(); if (ie6) { this.dialog.iframe = $('<iframe src="javascript:false;"/>').css($.extend(this.opts.iframeCss, { display: 'none', opacity: 0, position: 'fixed', height: w[0], width: w[1], zIndex: this.opts.zIndex, top: 0, left: 0 })).appendTo(this.opts.appendTo); }
        this.dialog.overlay = $('<div/>').attr('id', this.opts.overlayId).addClass('simplemodal-overlay').css($.extend(this.opts.overlayCss, { display: 'none', opacity: this.opts.opacity / 100, height: w[0], width: w[1], position: 'fixed', left: 0, top: 0, zIndex: this.opts.zIndex + 1 })).appendTo(this.opts.appendTo); this.dialog.container = $('<div/>').attr('id', this.opts.containerId).addClass('simplemodal-container').css($.extend(this.opts.containerCss, { display: 'none', position: 'fixed', zIndex: this.opts.zIndex + 2 })).append(this.opts.close && this.opts.closeHTML ? $(this.opts.closeHTML).addClass(this.opts.closeClass) : '').appendTo(this.opts.appendTo); this.dialog.wrap = $('<div/>').attr('tabIndex', -1).addClass('simplemodal-wrap').css({ height: '100%', outline: 0, width: '100%' }).appendTo(this.dialog.container); this.dialog.data = data.attr('id', data.attr('id') || this.opts.dataId).addClass('simplemodal-data').css($.extend(this.opts.dataCss, { display: 'none' })); data = null; this.setContainerDimensions(); this.dialog.data.appendTo(this.dialog.wrap); if (ie6 || ieQuirks) { this.fixIE(); } 
    }, bindEvents: function() {
        var self = this; $('.' + self.opts.closeClass).bind('click.simplemodal', function(e) { e.preventDefault(); self.close(); }); if (self.opts.close && self.opts.overlayClose) { self.dialog.overlay.bind('click.simplemodal', function(e) { e.preventDefault(); self.close(); }); }
        $(document).bind('keydown.simplemodal', function(e) {
            if (self.opts.focus && e.keyCode == 9) { self.watchTab(e); }
            else if ((self.opts.close && self.opts.escClose) && e.keyCode == 27) { e.preventDefault(); self.close(); } 
        }); $(window).bind('resize.simplemodal', function() {
            w = self.getDimensions(); self.opts.autoResize ? self.setContainerDimensions() : self.setPosition(); if (ie6 || ieQuirks) { self.fixIE(); }
            else { self.dialog.iframe && self.dialog.iframe.css({ height: w[0], width: w[1] }); self.dialog.overlay.css({ height: w[0], width: w[1] }); } 
        });
    }, unbindEvents: function() { $('.' + this.opts.closeClass).unbind('click.simplemodal'); $(document).unbind('keydown.simplemodal'); $(window).unbind('resize.simplemodal'); this.dialog.overlay.unbind('click.simplemodal'); }, fixIE: function() {
        var p = this.opts.position; $.each([this.dialog.iframe || null, this.dialog.overlay, this.dialog.container], function(i, el) {
            if (el) {
                var bch = 'document.body.clientHeight', bcw = 'document.body.clientWidth', bsh = 'document.body.scrollHeight', bsl = 'document.body.scrollLeft', bst = 'document.body.scrollTop', bsw = 'document.body.scrollWidth', ch = 'document.documentElement.clientHeight', cw = 'document.documentElement.clientWidth', sl = 'document.documentElement.scrollLeft', st = 'document.documentElement.scrollTop', s = el[0].style; s.position = 'absolute'; if (i < 2) { s.removeExpression('height'); s.removeExpression('width'); s.setExpression('height', '' + bsh + ' > ' + bch + ' ? ' + bsh + ' : ' + bch + ' + "px"'); s.setExpression('width', '' + bsw + ' > ' + bcw + ' ? ' + bsw + ' : ' + bcw + ' + "px"'); }
                else {
                    var te, le; if (p && p.constructor == Array) { var top = p[0] ? typeof p[0] == 'number' ? p[0].toString() : p[0].replace(/px/, '') : el.css('top').replace(/px/, ''); te = top.indexOf('%') == -1 ? top + ' + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"' : parseInt(top.replace(/%/, '')) + ' * ((' + ch + ' || ' + bch + ') / 100) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'; if (p[1]) { var left = typeof p[1] == 'number' ? p[1].toString() : p[1].replace(/px/, ''); le = left.indexOf('%') == -1 ? left + ' + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"' : parseInt(left.replace(/%/, '')) + ' * ((' + cw + ' || ' + bcw + ') / 100) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'; } }
                    else { te = '(' + ch + ' || ' + bch + ') / 2 - (this.offsetHeight / 2) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'; le = '(' + cw + ' || ' + bcw + ') / 2 - (this.offsetWidth / 2) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'; }
                    s.removeExpression('top'); s.removeExpression('left'); s.setExpression('top', te); s.setExpression('left', le);
                } 
            } 
        });
    }, focus: function(pos) { var self = this, p = pos || 'first'; var input = $(':input:enabled:visible:' + p, self.dialog.wrap); input.length > 0 ? input.focus() : self.dialog.wrap.focus(); }, getDimensions: function() { var el = $(window); var h = $.browser.opera && $.browser.version > '9.5' && $.fn.jquery <= '1.2.6' ? document.documentElement['clientHeight'] : $.browser.opera && $.browser.version < '9.5' && $.fn.jquery > '1.2.6' ? window.innerHeight : el.height(); return [h, el.width()]; }, getVal: function(v) { return v == 'auto' ? 0 : parseInt(v.replace(/px/, '')); }, setContainerDimensions: function() {
        var ch = this.getVal(this.dialog.container.css('height')), cw = this.dialog.container.width(), dh = this.dialog.data.height(), dw = this.dialog.data.width(); var mh = this.opts.maxHeight && this.opts.maxHeight < w[0] ? this.opts.maxHeight : w[0], mw = this.opts.maxWidth && this.opts.maxWidth < w[1] ? this.opts.maxWidth : w[1]; if (!ch) {
            if (!dh) { ch = this.opts.minHeight; }
            else {
                if (dh > mh) { ch = mh; }
                else if (dh < this.opts.minHeight) { ch = this.opts.minHeight; }
                else { ch = dh; } 
            } 
        }
        else { ch = ch > mh ? mh : ch; }
        if (!cw) {
            if (!dw) { cw = this.opts.minWidth; }
            else {
                if (dw > mw) { cw = mw; }
                else if (dw < this.opts.minWidth) { cw = this.opts.minWidth; }
                else { cw = dw; } 
            } 
        }
        else { cw = cw > mw ? mw : cw; }
        this.dialog.container.css({ height: ch, width: cw }); if (dh > ch || dw > cw) { this.dialog.wrap.css({ overflow: 'auto' }); }
        this.setPosition();
    }, setPosition: function() {
        var top, left, hc = (w[0] / 2) - ((this.dialog.container.height() || this.dialog.data.height()) / 2), vc = (w[1] / 2) - ((this.dialog.container.width() || this.dialog.data.width()) / 2); if (this.opts.position && this.opts.position.constructor == Array) { top = this.opts.position[0] || hc; left = this.opts.position[1] || vc; } else { top = hc; left = vc; }
        this.dialog.container.css({ left: left, top: top });
    }, watchTab: function(e) {
        var self = this; if ($(e.target).parents('.simplemodal-container').length > 0) { self.inputs = $(':input:enabled:visible:first, :input:enabled:visible:last', self.dialog.data); if (!e.shiftKey && e.target == self.inputs[self.inputs.length - 1] || e.shiftKey && e.target == self.inputs[0] || self.inputs.length == 0) { e.preventDefault(); var pos = e.shiftKey ? 'last' : 'first'; setTimeout(function() { self.focus(pos); }, 10); } }
        else { e.preventDefault(); setTimeout(function() { self.focus(); }, 10); } 
    }, open: function() {
        this.dialog.iframe && this.dialog.iframe.show(); if ($.isFunction(this.opts.onOpen)) { this.opts.onOpen.apply(this, [this.dialog]); }
        else { this.dialog.overlay.show(); this.dialog.container.show(); this.dialog.data.show(); }
        this.focus(); this.bindEvents();
    }, close: function() {
        if (!this.dialog.data) { return false; }
        this.unbindEvents(); if ($.isFunction(this.opts.onClose) && !this.occb) { this.occb = true; this.opts.onClose.apply(this, [this.dialog]); }
        else {
            if (this.dialog.parentNode) {
                if (this.opts.persist) { this.dialog.data.hide().appendTo(this.dialog.parentNode); }
                else { this.dialog.data.hide().remove(); this.dialog.orig.appendTo(this.dialog.parentNode); } 
            }
            else { this.dialog.data.hide().remove(); }
            this.dialog.container.hide().remove(); this.dialog.overlay.hide().remove(); this.dialog.iframe && this.dialog.iframe.hide().remove(); this.dialog = {};
        } 
    } 
    };
})(jQuery); (function($) {
    $.fn.tweetScroll = function(scrollOptions) {
        $this = $(this); var _c = function() { return $this.parent().parent().parent(); }; var _cursorPosition; var _colMax; var _itemMax; var _colPosition = 0; var $items = $('#twitter_div li', $this); var defaultOptions = { rows: 4, cols: 3, scrollSingleColumn: false, easing: 'swing', speed: 600 }; var options = $.extend({}, defaultOptions, scrollOptions); var setVisability = function() {
            debug($items); var _count = 0; $this.css('width', _colMax); $items.each(function(index, item) {
                var item = $(item); if (index >= _cursorPosition && index < _cursorPosition + (options.cols * options.rows)) { item.show(); } else { item.hide(); }
                item.css('float', 'left');
            }); setPagingVisability(); m("Current Cursor: " + _cursorPosition);
        }; var setWidth = function() {
            _colMax = 0; _itemMax = 0; var totalWidth = 0; var outerWidth = 0; var totalWidth = 0; $('.tweetSlideColumn', _c).each(function(index, item) {
                outerWidth += $(item).outerWidth(true); if ($(item).outerWidth(true) > _colMax)
                    _colMax = $(item).outerWidth(true);
            }); $('.tweetSlideViewer', _c).css({ float: 'left', 'overflow': 'hidden', width: _colMax * options.cols + 'px' }); $('.tweetSlideArea', _c).css({ width: outerWidth + 'px' });
        }; var setPagingVisability = function() {
            $previousButton.unbind(); $nextButton.unbind(); if (_cursorPosition <= 0)
                $previousButton.click(function() { $previousButton.toggleClass("noshow"); return false; }); else {
                $previousButton.click(function() {
                    var newIndex = (options.scrollSingleColumn) ? _cursorPosition - options.rows : _cursorPosition - (options.cols * options.rows); if (0 < newIndex < $items.length) { _cursorPosition = newIndex; _colPosition = _cursorPosition / options.rows; } else
                    { _cursorPosition = 0; }
                    setVisability(); return false;
                });
            }
            if (_cursorPosition > $items.length - (options.cols * options.rows))
                $previousButton.click(function() { $previousButton.toggleClass("noshow"); return false; }); else {
                $nextButton.click(function() {
                    var newIndex = (options.scrollSingleColumn) ? _cursorPosition + options.rows : _cursorPosition + (options.cols * options.rows); if (0 < newIndex < $items.length) { _cursorPosition = newIndex; _colPosition = _cursorPosition / options.rows; setVisability(); }
                    return false;
                });
            }
            var lnewPosition = -(_colPosition * _colMax); m("new postion: " + lnewPosition + " Easing: " + options.easing); $(".tweetSlideArea", _c).animate({ left: lnewPosition }, options.speed, options.easing, function() { });
        }; var setup = function() {
            var lContainer; var lContainerMaxWidth = 0; var lColCount = 0
            $items.each(function(index, item) {
                if (index % options.rows == 0)
                { lColCount++; $('.tweetSlideArea').append('<div id="tweetSlide-' + lColCount + '" class="tweetSlideColumn">'); lContainer = $("#tweetSlide-" + lColCount); }
                lContainer.append('<div class="tweetSlideItem">' + $(item).html() + '</div>'); if (lContainer.outerWidth > lContainerMaxWidth)
                    lContainerMaxWidth = lContainer.outerWidth;
            }); $('.tweetSlideColumn', _c).css('float', 'left');
        }; this.intialize = function() {
            $this.wrap("<div class='tweetScrollContainer'>"); $this.before("<div class='tweetScrollLeftContainer'><a class='tweetScrollPreviousButton' href='#' onclick='return false;'>Previous</a></div>"); $this.after("<div class='tweetScrollRightContainer'><a class='tweetScrollNextButton' href='#' onclick='return false;'>Next</a></div>"); $this.wrap("<div class='tweetSlideViewer'>"); $this.wrap("<div class='tweetSlideArea'>"); $('.tweetScrollLeftContainer', _c).css('float', 'left'); $('.tweetSlideArea', _c).css({ position: 'relative', left: '0px' }); $('.tweetScrollRightContainer', _c).css('float', 'left'); $items = $('li', $this); debug($items); _cursorPosition = 0; m("initialize"); $previousButton = $(".tweetScrollPreviousButton", _c); $nextButton = $(".tweetScrollNextButton", _c); if ($.meta) { options = $.extend({}, options, this.data()); }
            $this.hide(); setup(); setWidth(); setVisability();
        }; return this.intialize();
    }; function debug($obj) {
        if (window.console && window.console.log)
            window.console.log("tweetscroll selection count: " + $obj.size());
    }; function m($msg) {
        if (window.console && window.console.log)
            window.console.log($msg);
    };
})(jQuery);
