/* From: wfe9-nyc : 23818 */
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.2
*/
/**
 * The drag and drop utility provides a framework for building drag and drop
 * applications.  In addition to enabling drag and drop for specific elements,
 * the drag and drop elements are tracked by the manager class, and the
 * interactions between the various elements are tracked during the drag and
 * the implementing code is notified about these important moments.
 * @module dragdrop
 * @title Drag and Drop
 * @requires yahoo,dom,event
 * @namespace YAHOO.util
 */

// Only load the library once.  Rewriting the manager class would orphan 
// existing drag and drop instances.
if (!YAHOO.util.DragDropMgr) {

/**
 * DragDropMgr is a singleton that tracks the element interaction for 
 * all DragDrop items in the window.  Generally, you will not call 
 * this class directly, but it does have helper methods that could 
 * be useful in your DragDrop implementations.
 * @class DragDropMgr
 * @static
 */
YAHOO.util.DragDropMgr = function() {

    var Event = YAHOO.util.Event;

    return {

        /**
         * Two dimensional Array of registered DragDrop objects.  The first 
         * dimension is the DragDrop item group, the second the DragDrop 
         * object.
         * @property ids
         * @type {string: string}
         * @private
         * @static
         */
        ids: {},

        /**
         * Array of element ids defined as drag handles.  Used to determine 
         * if the element that generated the mousedown event is actually the 
         * handle and not the html element itself.
         * @property handleIds
         * @type {string: string}
         * @private
         * @static
         */
        handleIds: {},

        /**
         * the DragDrop object that is currently being dragged
         * @property dragCurrent
         * @type DragDrop
         * @private
         * @static
         **/
        dragCurrent: null,

        /**
         * the DragDrop object(s) that are being hovered over
         * @property dragOvers
         * @type Array
         * @private
         * @static
         */
        dragOvers: {},

        /**
         * the X distance between the cursor and the object being dragged
         * @property deltaX
         * @type int
         * @private
         * @static
         */
        deltaX: 0,

        /**
         * the Y distance between the cursor and the object being dragged
         * @property deltaY
         * @type int
         * @private
         * @static
         */
        deltaY: 0,

        /**
         * Flag to determine if we should prevent the default behavior of the
         * events we define. By default this is true, but this can be set to 
         * false if you need the default behavior (not recommended)
         * @property preventDefault
         * @type boolean
         * @static
         */
        preventDefault: true,

        /**
         * Flag to determine if we should stop the propagation of the events 
         * we generate. This is true by default but you may want to set it to
         * false if the html element contains other features that require the
         * mouse click.
         * @property stopPropagation
         * @type boolean
         * @static
         */
        stopPropagation: true,

        /**
         * Internal flag that is set to true when drag and drop has been
         * intialized
         * @property initialized
         * @private
         * @static
         */
        initalized: false,

        /**
         * All drag and drop can be disabled.
         * @property locked
         * @private
         * @static
         */
        locked: false,


        /**
         * Provides additional information about the the current set of
         * interactions.  Can be accessed from the event handlers. It
         * contains the following properties:
         *
         *       out:       onDragOut interactions
         *       enter:     onDragEnter interactions
         *       over:      onDragOver interactions
         *       drop:      onDragDrop interactions
         *       point:     The location of the cursor
         *       draggedRegion: The location of dragged element at the time
         *                      of the interaction
         *       sourceRegion: The location of the source elemtn at the time
         *                     of the interaction
         *       validDrop: boolean
         * @property interactionInfo
         * @type object
         * @static
         */
        interactionInfo: null,

        /**
         * Called the first time an element is registered.
         * @method init
         * @private
         * @static
         */
        init: function() {
            this.initialized = true;
        },

        /**
         * In point mode, drag and drop interaction is defined by the 
         * location of the cursor during the drag/drop
         * @property POINT
         * @type int
         * @static
         * @final
         */
        POINT: 0,

        /**
         * In intersect mode, drag and drop interaction is defined by the 
         * cursor position or the amount of overlap of two or more drag and 
         * drop objects.
         * @property INTERSECT
         * @type int
         * @static
         * @final
         */
        INTERSECT: 1,

        /**
         * In intersect mode, drag and drop interaction is defined only by the 
         * overlap of two or more drag and drop objects.
         * @property STRICT_INTERSECT
         * @type int
         * @static
         * @final
         */
        STRICT_INTERSECT: 2,

        /**
         * The current drag and drop mode.  Default: POINT
         * @property mode
         * @type int
         * @static
         */
        mode: 0,

        /**
         * Runs method on all drag and drop objects
         * @method _execOnAll
         * @private
         * @static
         */
        _execOnAll: function(sMethod, args) {
            for (var i in this.ids) {
                for (var j in this.ids[i]) {
                    var oDD = this.ids[i][j];
                    if (! this.isTypeOfDD(oDD)) {
                        continue;
                    }
                    oDD[sMethod].apply(oDD, args);
                }
            }
        },

        /**
         * Drag and drop initialization.  Sets up the global event handlers
         * @method _onLoad
         * @private
         * @static
         */
        _onLoad: function() {

            this.init();


            Event.on(document, "mouseup",   this.handleMouseUp, this, true);
            Event.on(document, "mousemove", this.handleMouseMove, this, true);
            Event.on(window,   "unload",    this._onUnload, this, true);
            Event.on(window,   "resize",    this._onResize, this, true);
            // Event.on(window,   "mouseout",    this._test);

        },

        /**
         * Reset constraints on all drag and drop objs
         * @method _onResize
         * @private
         * @static
         */
        _onResize: function(e) {
            this._execOnAll("resetConstraints", []);
        },

        /**
         * Lock all drag and drop functionality
         * @method lock
         * @static
         */
        lock: function() { this.locked = true; },

        /**
         * Unlock all drag and drop functionality
         * @method unlock
         * @static
         */
        unlock: function() { this.locked = false; },

        /**
         * Is drag and drop locked?
         * @method isLocked
         * @return {boolean} True if drag and drop is locked, false otherwise.
         * @static
         */
        isLocked: function() { return this.locked; },

        /**
         * Location cache that is set for all drag drop objects when a drag is
         * initiated, cleared when the drag is finished.
         * @property locationCache
         * @private
         * @static
         */
        locationCache: {},

        /**
         * Set useCache to false if you want to force object the lookup of each
         * drag and drop linked element constantly during a drag.
         * @property useCache
         * @type boolean
         * @static
         */
        useCache: true,

        /**
         * The number of pixels that the mouse needs to move after the 
         * mousedown before the drag is initiated.  Default=3;
         * @property clickPixelThresh
         * @type int
         * @static
         */
        clickPixelThresh: 3,

        /**
         * The number of milliseconds after the mousedown event to initiate the
         * drag if we don't get a mouseup event. Default=1000
         * @property clickTimeThresh
         * @type int
         * @static
         */
        clickTimeThresh: 1000,

        /**
         * Flag that indicates that either the drag pixel threshold or the 
         * mousdown time threshold has been met
         * @property dragThreshMet
         * @type boolean
         * @private
         * @static
         */
        dragThreshMet: false,

        /**
         * Timeout used for the click time threshold
         * @property clickTimeout
         * @type Object
         * @private
         * @static
         */
        clickTimeout: null,

        /**
         * The X position of the mousedown event stored for later use when a 
         * drag threshold is met.
         * @property startX
         * @type int
         * @private
         * @static
         */
        startX: 0,

        /**
         * The Y position of the mousedown event stored for later use when a 
         * drag threshold is met.
         * @property startY
         * @type int
         * @private
         * @static
         */
        startY: 0,

        /**
         * Each DragDrop instance must be registered with the DragDropMgr.  
         * This is executed in DragDrop.init()
         * @method regDragDrop
         * @param {DragDrop} oDD the DragDrop object to register
         * @param {String} sGroup the name of the group this element belongs to
         * @static
         */
        regDragDrop: function(oDD, sGroup) {
            if (!this.initialized) { this.init(); }
            
            if (!this.ids[sGroup]) {
                this.ids[sGroup] = {};
            }
            this.ids[sGroup][oDD.id] = oDD;
        },

        /**
         * Removes the supplied dd instance from the supplied group. Executed
         * by DragDrop.removeFromGroup, so don't call this function directly.
         * @method removeDDFromGroup
         * @private
         * @static
         */
        removeDDFromGroup: function(oDD, sGroup) {
            if (!this.ids[sGroup]) {
                this.ids[sGroup] = {};
            }

            var obj = this.ids[sGroup];
            if (obj && obj[oDD.id]) {
                delete obj[oDD.id];
            }
        },

        /**
         * Unregisters a drag and drop item.  This is executed in 
         * DragDrop.unreg, use that method instead of calling this directly.
         * @method _remove
         * @private
         * @static
         */
        _remove: function(oDD) {
            for (var g in oDD.groups) {
                if (g && this.ids[g][oDD.id]) {
                    delete this.ids[g][oDD.id];
                }
            }
            delete this.handleIds[oDD.id];
        },

        /**
         * Each DragDrop handle element must be registered.  This is done
         * automatically when executing DragDrop.setHandleElId()
         * @method regHandle
         * @param {String} sDDId the DragDrop id this element is a handle for
         * @param {String} sHandleId the id of the element that is the drag 
         * handle
         * @static
         */
        regHandle: function(sDDId, sHandleId) {
            if (!this.handleIds[sDDId]) {
                this.handleIds[sDDId] = {};
            }
            this.handleIds[sDDId][sHandleId] = sHandleId;
        },

        /**
         * Utility function to determine if a given element has been 
         * registered as a drag drop item.
         * @method isDragDrop
         * @param {String} id the element id to check
         * @return {boolean} true if this element is a DragDrop item, 
         * false otherwise
         * @static
         */
        isDragDrop: function(id) {
            return ( this.getDDById(id) ) ? true : false;
        },

        /**
         * Returns the drag and drop instances that are in all groups the
         * passed in instance belongs to.
         * @method getRelated
         * @param {DragDrop} p_oDD the obj to get related data for
         * @param {boolean} bTargetsOnly if true, only return targetable objs
         * @return {DragDrop[]} the related instances
         * @static
         */
        getRelated: function(p_oDD, bTargetsOnly) {
            var oDDs = [];
            for (var i in p_oDD.groups) {
                for (j in this.ids[i]) {
                    var dd = this.ids[i][j];
                    if (! this.isTypeOfDD(dd)) {
                        continue;
                    }
                    if (!bTargetsOnly || dd.isTarget) {
                        oDDs[oDDs.length] = dd;
                    }
                }
            }

            return oDDs;
        },

        /**
         * Returns true if the specified dd target is a legal target for 
         * the specifice drag obj
         * @method isLegalTarget
         * @param {DragDrop} the drag obj
         * @param {DragDrop} the target
         * @return {boolean} true if the target is a legal target for the 
         * dd obj
         * @static
         */
        isLegalTarget: function (oDD, oTargetDD) {
            var targets = this.getRelated(oDD, true);
            for (var i=0, len=targets.length;i<len;++i) {
                if (targets[i].id == oTargetDD.id) {
                    return true;
                }
            }

            return false;
        },

        /**
         * My goal is to be able to transparently determine if an object is
         * typeof DragDrop, and the exact subclass of DragDrop.  typeof 
         * returns "object", oDD.constructor.toString() always returns
         * "DragDrop" and not the name of the subclass.  So for now it just
         * evaluates a well-known variable in DragDrop.
         * @method isTypeOfDD
         * @param {Object} the object to evaluate
         * @return {boolean} true if typeof oDD = DragDrop
         * @static
         */
        isTypeOfDD: function (oDD) {
            return (oDD && oDD.__ygDragDrop);
        },

        /**
         * Utility function to determine if a given element has been 
         * registered as a drag drop handle for the given Drag Drop object.
         * @method isHandle
         * @param {String} id the element id to check
         * @return {boolean} true if this element is a DragDrop handle, false 
         * otherwise
         * @static
         */
        isHandle: function(sDDId, sHandleId) {
            return ( this.handleIds[sDDId] && 
                            this.handleIds[sDDId][sHandleId] );
        },

        /**
         * Returns the DragDrop instance for a given id
         * @method getDDById
         * @param {String} id the id of the DragDrop object
         * @return {DragDrop} the drag drop object, null if it is not found
         * @static
         */
        getDDById: function(id) {
            for (var i in this.ids) {
                if (this.ids[i][id]) {
                    return this.ids[i][id];
                }
            }
            return null;
        },

        /**
         * Fired after a registered DragDrop object gets the mousedown event.
         * Sets up the events required to track the object being dragged
         * @method handleMouseDown
         * @param {Event} e the event
         * @param oDD the DragDrop object being dragged
         * @private
         * @static
         */
        handleMouseDown: function(e, oDD) {

            this.currentTarget = YAHOO.util.Event.getTarget(e);

            this.dragCurrent = oDD;

            var el = oDD.getEl();

            // track start position
            this.startX = YAHOO.util.Event.getPageX(e);
            this.startY = YAHOO.util.Event.getPageY(e);

            this.deltaX = this.startX - el.offsetLeft;
            this.deltaY = this.startY - el.offsetTop;

            this.dragThreshMet = false;

            this.clickTimeout = setTimeout( 
                    function() { 
                        var DDM = YAHOO.util.DDM;
                        DDM.startDrag(DDM.startX, DDM.startY); 
                    }, 
                    this.clickTimeThresh );
        },

        /**
         * Fired when either the drag pixel threshol or the mousedown hold 
         * time threshold has been met.
         * @method startDrag
         * @param x {int} the X position of the original mousedown
         * @param y {int} the Y position of the original mousedown
         * @static
         */
        startDrag: function(x, y) {
            clearTimeout(this.clickTimeout);
            if (this.dragCurrent) {
                this.dragCurrent.b4StartDrag(x, y);
                this.dragCurrent.startDrag(x, y);
            }
            this.dragThreshMet = true;
        },

        /**
         * Internal function to handle the mouseup event.  Will be invoked 
         * from the context of the document.
         * @method handleMouseUp
         * @param {Event} e the event
         * @private
         * @static
         */
        handleMouseUp: function(e) {

            if (! this.dragCurrent) {
                return;
            }

            clearTimeout(this.clickTimeout);

            if (this.dragThreshMet) {
                this.fireEvents(e, true);
            } else {
            }

            this.stopDrag(e);

            this.stopEvent(e);
        },

        /**
         * Utility to stop event propagation and event default, if these 
         * features are turned on.
         * @method stopEvent
         * @param {Event} e the event as returned by this.getEvent()
         * @static
         */
        stopEvent: function(e) {
            if (this.stopPropagation) {
                YAHOO.util.Event.stopPropagation(e);
            }

            if (this.preventDefault) {
                YAHOO.util.Event.preventDefault(e);
            }
        },

        /** 
         * Internal function to clean up event handlers after the drag 
         * operation is complete
         * @method stopDrag
         * @param {Event} e the event
         * @private
         * @static
         */
        stopDrag: function(e) {

            // Fire the drag end event for the item that was dragged
            if (this.dragCurrent) {
                if (this.dragThreshMet) {
                    this.dragCurrent.b4EndDrag(e);
                    this.dragCurrent.endDrag(e);
                }

                this.dragCurrent.onMouseUp(e);
            }

            this.dragCurrent = null;
            this.dragOvers = {};
        },


        /** 
         * Internal function to handle the mousemove event.  Will be invoked 
         * from the context of the html element.
         *
         * @TODO figure out what we can do about mouse events lost when the 
         * user drags objects beyond the window boundary.  Currently we can 
         * detect this in internet explorer by verifying that the mouse is 
         * down during the mousemove event.  Firefox doesn't give us the 
         * button state on the mousemove event.
         * @method handleMouseMove
         * @param {Event} e the event
         * @private
         * @static
         */
        handleMouseMove: function(e) {
            if (! this.dragCurrent) {
                return true;
            }

            // var button = e.which || e.button;

            // check for IE mouseup outside of page boundary
            if (YAHOO.util.Event.isIE && !e.button) {
                this.stopEvent(e);
                return this.handleMouseUp(e);
            }

            if (!this.dragThreshMet) {
                var diffX = Math.abs(this.startX - YAHOO.util.Event.getPageX(e));
                var diffY = Math.abs(this.startY - YAHOO.util.Event.getPageY(e));
                if (diffX > this.clickPixelThresh || 
                            diffY > this.clickPixelThresh) {
                    this.startDrag(this.startX, this.startY);
                }
            }

            if (this.dragThreshMet) {
                this.dragCurrent.b4Drag(e);
                this.dragCurrent.onDrag(e);
                this.fireEvents(e, false);
            }

            this.stopEvent(e);

            return true;
        },

        /**
         * Iterates over all of the DragDrop elements to find ones we are 
         * hovering over or dropping on
         * @method fireEvents
         * @param {Event} e the event
         * @param {boolean} isDrop is this a drop op or a mouseover op?
         * @private
         * @static
         */
        fireEvents: function(e, isDrop) {
            var dc = this.dragCurrent;

            // If the user did the mouse up outside of the window, we could 
            // get here even though we have ended the drag.
            if (!dc || dc.isLocked()) {
                return;
            }

            var x = YAHOO.util.Event.getPageX(e);
            var y = YAHOO.util.Event.getPageY(e);
            var pt = new YAHOO.util.Point(x,y);
            var pos = dc.getTargetCoord(pt.x, pt.y);
            var el = dc.getDragEl();
            curRegion = new YAHOO.util.Region( pos.y, 
                                               pos.x + el.offsetWidth,
                                               pos.y + el.offsetHeight, 
                                               pos.x );
            // cache the previous dragOver array
            var oldOvers = [];

            var outEvts   = [];
            var overEvts  = [];
            var dropEvts  = [];
            var enterEvts = [];


            // Check to see if the object(s) we were hovering over is no longer 
            // being hovered over so we can fire the onDragOut event
            for (var i in this.dragOvers) {

                var ddo = this.dragOvers[i];

                if (! this.isTypeOfDD(ddo)) {
                    continue;
                }

                if (! this.isOverTarget(pt, ddo, this.mode, curRegion)) {
                    outEvts.push( ddo );
                }

                oldOvers[i] = true;
                delete this.dragOvers[i];
            }

            for (var sGroup in dc.groups) {
                
                if ("string" != typeof sGroup) {
                    continue;
                }

                for (i in this.ids[sGroup]) {
                    var oDD = this.ids[sGroup][i];
                    if (! this.isTypeOfDD(oDD)) {
                        continue;
                    }

                    if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {
                        if (this.isOverTarget(pt, oDD, this.mode, curRegion)) {
                            // look for drop interactions
                            if (isDrop) {
                                dropEvts.push( oDD );
                            // look for drag enter and drag over interactions
                            } else {

                                // initial drag over: dragEnter fires
                                if (!oldOvers[oDD.id]) {
                                    enterEvts.push( oDD );
                                // subsequent drag overs: dragOver fires
                                } else {
                                    overEvts.push( oDD );
                                }

                                this.dragOvers[oDD.id] = oDD;
                            }
                        }
                    }
                }
            }

            this.interactionInfo = {
                out:       outEvts,
                enter:     enterEvts,
                over:      overEvts,
                drop:      dropEvts,
                point:     pt,
                draggedRegion:    curRegion,
                sourceRegion: this.locationCache[dc.id],
                validDrop: isDrop
            };

            // notify about a drop that did not find a target
            if (isDrop && !dropEvts.length) {
                this.interactionInfo.validDrop = false;
                dc.onInvalidDrop(e);
            }


            if (this.mode) {
                if (outEvts.length) {
                    dc.b4DragOut(e, outEvts);
                    dc.onDragOut(e, outEvts);
                }

                if (enterEvts.length) {
                    dc.onDragEnter(e, enterEvts);
                }

                if (overEvts.length) {
                    dc.b4DragOver(e, overEvts);
                    dc.onDragOver(e, overEvts);
                }

                if (dropEvts.length) {
                    dc.b4DragDrop(e, dropEvts);
                    dc.onDragDrop(e, dropEvts);
                }

            } else {
                // fire dragout events
                var len = 0;
                for (i=0, len=outEvts.length; i<len; ++i) {
                    dc.b4DragOut(e, outEvts[i].id);
                    dc.onDragOut(e, outEvts[i].id);
                }
                 
                // fire enter events
                for (i=0,len=enterEvts.length; i<len; ++i) {
                    // dc.b4DragEnter(e, oDD.id);
                    dc.onDragEnter(e, enterEvts[i].id);
                }
         
                // fire over events
                for (i=0,len=overEvts.length; i<len; ++i) {
                    dc.b4DragOver(e, overEvts[i].id);
                    dc.onDragOver(e, overEvts[i].id);
                }

                // fire drop events
                for (i=0, len=dropEvts.length; i<len; ++i) {
                    dc.b4DragDrop(e, dropEvts[i].id);
                    dc.onDragDrop(e, dropEvts[i].id);
                }

            }
        },

        /**
         * Helper function for getting the best match from the list of drag 
         * and drop objects returned by the drag and drop events when we are 
         * in INTERSECT mode.  It returns either the first object that the 
         * cursor is over, or the object that has the greatest overlap with 
         * the dragged element.
         * @method getBestMatch
         * @param  {DragDrop[]} dds The array of drag and drop objects 
         * targeted
         * @return {DragDrop}       The best single match
         * @static
         */
        getBestMatch: function(dds) {
            var winner = null;

            var len = dds.length;

            if (len == 1) {
                winner = dds[0];
            } else {
                // Loop through the targeted items
                for (var i=0; i<len; ++i) {
                    var dd = dds[i];
                    // If the cursor is over the object, it wins.  If the 
                    // cursor is over multiple matches, the first one we come
                    // to wins.
                    if (this.mode == this.INTERSECT && dd.cursorIsOver) {
                        winner = dd;
                        break;
                    // Otherwise the object with the most overlap wins
                    } else {
                        if (!winner || !winner.overlap || (dd.overlap &&
                            winner.overlap.getArea() < dd.overlap.getArea())) {
                            winner = dd;
                        }
                    }
                }
            }

            return winner;
        },

        /**
         * Refreshes the cache of the top-left and bottom-right points of the 
         * drag and drop objects in the specified group(s).  This is in the
         * format that is stored in the drag and drop instance, so typical 
         * usage is:
         * <code>
         * YAHOO.util.DragDropMgr.refreshCache(ddinstance.groups);
         * </code>
         * Alternatively:
         * <code>
         * YAHOO.util.DragDropMgr.refreshCache({group1:true, group2:true});
         * </code>
         * @TODO this really should be an indexed array.  Alternatively this
         * method could accept both.
         * @method refreshCache
         * @param {Object} groups an associative array of groups to refresh
         * @static
         */
        refreshCache: function(groups) {

            // refresh everything if group array is not provided
            var g = groups || this.ids;

            for (var sGroup in g) {
                if ("string" != typeof sGroup) {
                    continue;
                }
                for (var i in this.ids[sGroup]) {
                    var oDD = this.ids[sGroup][i];

                    if (this.isTypeOfDD(oDD)) {
                        var loc = this.getLocation(oDD);
                        if (loc) {
                            this.locationCache[oDD.id] = loc;
                        } else {
                            delete this.locationCache[oDD.id];
                        }
                    }
                }
            }
        },

        /**
         * This checks to make sure an element exists and is in the DOM.  The
         * main purpose is to handle cases where innerHTML is used to remove
         * drag and drop objects from the DOM.  IE provides an 'unspecified
         * error' when trying to access the offsetParent of such an element
         * @method verifyEl
         * @param {HTMLElement} el the element to check
         * @return {boolean} true if the element looks usable
         * @static
         */
        verifyEl: function(el) {
            try {
                if (el) {
                    var parent = el.offsetParent;
                    if (parent) {
                        return true;
                    }
                }
            } catch(e) {
            }

            return false;
        },
        
        /**
         * Returns a Region object containing the drag and drop element's position
         * and size, including the padding configured for it
         * @method getLocation
         * @param {DragDrop} oDD the drag and drop object to get the 
         *                       location for
         * @return {YAHOO.util.Region} a Region object representing the total area
         *                             the element occupies, including any padding
         *                             the instance is configured for.
         * @static
         */
        getLocation: function(oDD) {
            if (! this.isTypeOfDD(oDD)) {
                return null;
            }

            var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;

            try {
                pos= YAHOO.util.Dom.getXY(el);
            } catch (e) { }

            if (!pos) {
                return null;
            }

            x1 = pos[0];
            x2 = x1 + el.offsetWidth;
            y1 = pos[1];
            y2 = y1 + el.offsetHeight;

            t = y1 - oDD.padding[0];
            r = x2 + oDD.padding[1];
            b = y2 + oDD.padding[2];
            l = x1 - oDD.padding[3];

            return new YAHOO.util.Region( t, r, b, l );
        },

        /**
         * Checks the cursor location to see if it over the target
         * @method isOverTarget
         * @param {YAHOO.util.Point} pt The point to evaluate
         * @param {DragDrop} oTarget the DragDrop object we are inspecting
         * @param {boolean} intersect true if we are in intersect mode
         * @param {YAHOO.util.Region} pre-cached location of the dragged element
         * @return {boolean} true if the mouse is over the target
         * @private
         * @static
         */
        isOverTarget: function(pt, oTarget, intersect, curRegion) {
            // use cache if available
            var loc = this.locationCache[oTarget.id];
            if (!loc || !this.useCache) {
                loc = this.getLocation(oTarget);
                this.locationCache[oTarget.id] = loc;

            }

            if (!loc) {
                return false;
            }

            oTarget.cursorIsOver = loc.contains( pt );

            // DragDrop is using this as a sanity check for the initial mousedown
            // in this case we are done.  In POINT mode, if the drag obj has no
            // contraints, we are done. Otherwise we need to evaluate the 
            // region the target as occupies to determine if the dragged element
            // overlaps with it.
            
            var dc = this.dragCurrent;
            if (!dc || (!intersect && !dc.constrainX && !dc.constrainY)) {

                //if (oTarget.cursorIsOver) {
                //}
                return oTarget.cursorIsOver;
            }

            oTarget.overlap = null;

            // Get the current location of the drag element, this is the
            // location of the mouse event less the delta that represents
            // where the original mousedown happened on the element.  We
            // need to consider constraints and ticks as well.

            if (!curRegion) {
                var pos = dc.getTargetCoord(pt.x, pt.y);
                var el = dc.getDragEl();
                curRegion = new YAHOO.util.Region( pos.y, 
                                                   pos.x + el.offsetWidth,
                                                   pos.y + el.offsetHeight, 
                                                   pos.x );
            }

            var overlap = curRegion.intersect(loc);

            if (overlap) {
                oTarget.overlap = overlap;
                return (intersect) ? true : oTarget.cursorIsOver;
            } else {
                return false;
            }
        },

        /**
         * unload event handler
         * @method _onUnload
         * @private
         * @static
         */
        _onUnload: function(e, me) {
            this.unregAll();
        },

        /**
         * Cleans up the drag and drop events and objects.
         * @method unregAll
         * @private
         * @static
         */
        unregAll: function() {

            if (this.dragCurrent) {
                this.stopDrag();
                this.dragCurrent = null;
            }

            this._execOnAll("unreg", []);

            for (i in this.elementCache) {
                delete this.elementCache[i];
            }

            this.elementCache = {};
            this.ids = {};
        },

        /**
         * A cache of DOM elements
         * @property elementCache
         * @private
         * @static
         */
        elementCache: {},
        
        /**
         * Get the wrapper for the DOM element specified
         * @method getElWrapper
         * @param {String} id the id of the element to get
         * @return {YAHOO.util.DDM.ElementWrapper} the wrapped element
         * @private
         * @deprecated This wrapper isn't that useful
         * @static
         */
        getElWrapper: function(id) {
            var oWrapper = this.elementCache[id];
            if (!oWrapper || !oWrapper.el) {
                oWrapper = this.elementCache[id] = 
                    new this.ElementWrapper(YAHOO.util.Dom.get(id));
            }
            return oWrapper;
        },

        /**
         * Returns the actual DOM element
         * @method getElement
         * @param {String} id the id of the elment to get
         * @return {Object} The element
         * @deprecated use YAHOO.util.Dom.get instead
         * @static
         */
        getElement: function(id) {
            return YAHOO.util.Dom.get(id);
        },
        
        /**
         * Returns the style property for the DOM element (i.e., 
         * document.getElById(id).style)
         * @method getCss
         * @param {String} id the id of the elment to get
         * @return {Object} The style property of the element
         * @deprecated use YAHOO.util.Dom instead
         * @static
         */
        getCss: function(id) {
            var el = YAHOO.util.Dom.get(id);
            return (el) ? el.style : null;
        },

        /**
         * Inner class for cached elements
         * @class DragDropMgr.ElementWrapper
         * @for DragDropMgr
         * @private
         * @deprecated
         */
        ElementWrapper: function(el) {
                /**
                 * The element
                 * @property el
                 */
                this.el = el || null;
                /**
                 * The element id
                 * @property id
                 */
                this.id = this.el && el.id;
                /**
                 * A reference to the style property
                 * @property css
                 */
                this.css = this.el && el.style;
            },

        /**
         * Returns the X position of an html element
         * @method getPosX
         * @param el the element for which to get the position
         * @return {int} the X coordinate
         * @for DragDropMgr
         * @deprecated use YAHOO.util.Dom.getX instead
         * @static
         */
        getPosX: function(el) {
            return YAHOO.util.Dom.getX(el);
        },

        /**
         * Returns the Y position of an html element
         * @method getPosY
         * @param el the element for which to get the position
         * @return {int} the Y coordinate
         * @deprecated use YAHOO.util.Dom.getY instead
         * @static
         */
        getPosY: function(el) {
            return YAHOO.util.Dom.getY(el); 
        },

        /**
         * Swap two nodes.  In IE, we use the native method, for others we 
         * emulate the IE behavior
         * @method swapNode
         * @param n1 the first node to swap
         * @param n2 the other node to swap
         * @static
         */
        swapNode: function(n1, n2) {
            if (n1.swapNode) {
                n1.swapNode(n2);
            } else {
                var p = n2.parentNode;
                var s = n2.nextSibling;

                if (s == n1) {
                    p.insertBefore(n1, n2);
                } else if (n2 == n1.nextSibling) {
                    p.insertBefore(n2, n1);
                } else {
                    n1.parentNode.replaceChild(n2, n1);
                    p.insertBefore(n1, s);
                }
            }
        },

        /**
         * Returns the current scroll position
         * @method getScroll
         * @private
         * @static
         */
        getScroll: function () {
            var t, l, dde=document.documentElement, db=document.body;
            if (dde && (dde.scrollTop || dde.scrollLeft)) {
                t = dde.scrollTop;
                l = dde.scrollLeft;
            } else if (db) {
                t = db.scrollTop;
                l = db.scrollLeft;
            } else {
            }
            return { top: t, left: l };
        },

        /**
         * Returns the specified element style property
         * @method getStyle
         * @param {HTMLElement} el          the element
         * @param {string}      styleProp   the style property
         * @return {string} The value of the style property
         * @deprecated use YAHOO.util.Dom.getStyle
         * @static
         */
        getStyle: function(el, styleProp) {
            return YAHOO.util.Dom.getStyle(el, styleProp);
        },

        /**
         * Gets the scrollTop
         * @method getScrollTop
         * @return {int} the document's scrollTop
         * @static
         */
        getScrollTop: function () { return this.getScroll().top; },

        /**
         * Gets the scrollLeft
         * @method getScrollLeft
         * @return {int} the document's scrollTop
         * @static
         */
        getScrollLeft: function () { return this.getScroll().left; },

        /**
         * Sets the x/y position of an element to the location of the
         * target element.
         * @method moveToEl
         * @param {HTMLElement} moveEl      The element to move
         * @param {HTMLElement} targetEl    The position reference element
         * @static
         */
        moveToEl: function (moveEl, targetEl) {
            var aCoord = YAHOO.util.Dom.getXY(targetEl);
            YAHOO.util.Dom.setXY(moveEl, aCoord);
        },

        /**
         * Gets the client height
         * @method getClientHeight
         * @return {int} client height in px
         * @deprecated use YAHOO.util.Dom.getViewportHeight instead
         * @static
         */
        getClientHeight: function() {
            return YAHOO.util.Dom.getViewportHeight();
        },

        /**
         * Gets the client width
         * @method getClientWidth
         * @return {int} client width in px
         * @deprecated use YAHOO.util.Dom.getViewportWidth instead
         * @static
         */
        getClientWidth: function() {
            return YAHOO.util.Dom.getViewportWidth();
        },

        /**
         * Numeric array sort function
         * @method numericSort
         * @static
         */
        numericSort: function(a, b) { return (a - b); },

        /**
         * Internal counter
         * @property _timeoutCount
         * @private
         * @static
         */
        _timeoutCount: 0,

        /**
         * Trying to make the load order less important.  Without this we get
         * an error if this file is loaded before the Event Utility.
         * @method _addListeners
         * @private
         * @static
         */
        _addListeners: function() {
            var DDM = YAHOO.util.DDM;
            if ( YAHOO.util.Event && document ) {
                DDM._onLoad();
            } else {
                if (DDM._timeoutCount > 2000) {
                } else {
                    setTimeout(DDM._addListeners, 10);
                    if (document && document.body) {
                        DDM._timeoutCount += 1;
                    }
                }
            }
        },

        /**
         * Recursively searches the immediate parent and all child nodes for 
         * the handle element in order to determine wheter or not it was 
         * clicked.
         * @method handleWasClicked
         * @param node the html element to inspect
         * @static
         */
        handleWasClicked: function(node, id) {
            if (this.isHandle(id, node.id)) {
                return true;
            } else {
                // check to see if this is a text node child of the one we want
                var p = node.parentNode;

                while (p) {
                    if (this.isHandle(id, p.id)) {
                        return true;
                    } else {
                        p = p.parentNode;
                    }
                }
            }

            return false;
        }

    };

}();

// shorter alias, save a few bytes
YAHOO.util.DDM = YAHOO.util.DragDropMgr;
YAHOO.util.DDM._addListeners();

}

(function() {

var Event=YAHOO.util.Event; 
var Dom=YAHOO.util.Dom;

/**
 * Defines the interface and base operation of items that that can be 
 * dragged or can be drop targets.  It was designed to be extended, overriding
 * the event handlers for startDrag, onDrag, onDragOver, onDragOut.
 * Up to three html elements can be associated with a DragDrop instance:
 * <ul>
 * <li>linked element: the element that is passed into the constructor.
 * This is the element which defines the boundaries for interaction with 
 * other DragDrop objects.</li>
 * <li>handle element(s): The drag operation only occurs if the element that 
 * was clicked matches a handle element.  By default this is the linked 
 * element, but there are times that you will want only a portion of the 
 * linked element to initiate the drag operation, and the setHandleElId() 
 * method provides a way to define this.</li>
 * <li>drag element: this represents an the element that would be moved along
 * with the cursor during a drag operation.  By default, this is the linked
 * element itself as in {@link YAHOO.util.DD}.  setDragElId() lets you define
 * a separate element that would be moved, as in {@link YAHOO.util.DDProxy}
 * </li>
 * </ul>
 * This class should not be instantiated until the onload event to ensure that
 * the associated elements are available.
 * The following would define a DragDrop obj that would interact with any 
 * other DragDrop obj in the "group1" group:
 * <pre>
 *  dd = new YAHOO.util.DragDrop("div1", "group1");
 * </pre>
 * Since none of the event handlers have been implemented, nothing would 
 * actually happen if you were to run the code above.  Normally you would 
 * override this class or one of the default implementations, but you can 
 * also override the methods you want on an instance of the class...
 * <pre>
 *  dd.onDragDrop = function(e, id) {
 *  &nbsp;&nbsp;alert("dd was dropped on " + id);
 *  }
 * </pre>
 * @namespace YAHOO.util
 * @class DragDrop
 * @constructor
 * @param {String} id of the element that is linked to this instance
 * @param {String} sGroup the group of related DragDrop objects
 * @param {object} config an object containing configurable attributes
 *                Valid properties for DragDrop: 
 *                    padding, isTarget, maintainOffset, primaryButtonOnly,
 */
YAHOO.util.DragDrop = function(id, sGroup, config) {
    if (id) {
        this.init(id, sGroup, config); 
    }
};

YAHOO.util.DragDrop.prototype = {

    /**
     * The id of the element associated with this object.  This is what we 
     * refer to as the "linked element" because the size and position of 
     * this element is used to determine when the drag and drop objects have 
     * interacted.
     * @property id
     * @type String
     */
    id: null,

    /**
     * Configuration attributes passed into the constructor
     * @property config
     * @type object
     */
    config: null,

    /**
     * The id of the element that will be dragged.  By default this is same 
     * as the linked element , but could be changed to another element. Ex: 
     * YAHOO.util.DDProxy
     * @property dragElId
     * @type String
     * @private
     */
    dragElId: null, 

    /**
     * the id of the element that initiates the drag operation.  By default 
     * this is the linked element, but could be changed to be a child of this
     * element.  This lets us do things like only starting the drag when the 
     * header element within the linked html element is clicked.
     * @property handleElId
     * @type String
     * @private
     */
    handleElId: null, 

    /**
     * An associative array of HTML tags that will be ignored if clicked.
     * @property invalidHandleTypes
     * @type {string: string}
     */
    invalidHandleTypes: null, 

    /**
     * An associative array of ids for elements that will be ignored if clicked
     * @property invalidHandleIds
     * @type {string: string}
     */
    invalidHandleIds: null, 

    /**
     * An indexted array of css class names for elements that will be ignored
     * if clicked.
     * @property invalidHandleClasses
     * @type string[]
     */
    invalidHandleClasses: null, 

    /**
     * The linked element's absolute X position at the time the drag was 
     * started
     * @property startPageX
     * @type int
     * @private
     */
    startPageX: 0,

    /**
     * The linked element's absolute X position at the time the drag was 
     * started
     * @property startPageY
     * @type int
     * @private
     */
    startPageY: 0,

    /**
     * The group defines a logical collection of DragDrop objects that are 
     * related.  Instances only get events when interacting with other 
     * DragDrop object in the same group.  This lets us define multiple 
     * groups using a single DragDrop subclass if we want.
     * @property groups
     * @type {string: string}
     */
    groups: null,

    /**
     * Individual drag/drop instances can be locked.  This will prevent 
     * onmousedown start drag.
     * @property locked
     * @type boolean
     * @private
     */
    locked: false,

    /**
     * Lock this instance
     * @method lock
     */
    lock: function() { this.locked = true; },

    /**
     * Unlock this instace
     * @method unlock
     */
    unlock: function() { this.locked = false; },

    /**
     * By default, all insances can be a drop target.  This can be disabled by
     * setting isTarget to false.
     * @method isTarget
     * @type boolean
     */
    isTarget: true,

    /**
     * The padding configured for this drag and drop object for calculating
     * the drop zone intersection with this object.
     * @method padding
     * @type int[]
     */
    padding: null,

    /**
     * Cached reference to the linked element
     * @property _domRef
     * @private
     */
    _domRef: null,

    /**
     * Internal typeof flag
     * @property __ygDragDrop
     * @private
     */
    __ygDragDrop: true,

    /**
     * Set to true when horizontal contraints are applied
     * @property constrainX
     * @type boolean
     * @private
     */
    constrainX: false,

    /**
     * Set to true when vertical contraints are applied
     * @property constrainY
     * @type boolean
     * @private
     */
    constrainY: false,

    /**
     * The left constraint
     * @property minX
     * @type int
     * @private
     */
    minX: 0,

    /**
     * The right constraint
     * @property maxX
     * @type int
     * @private
     */
    maxX: 0,

    /**
     * The up constraint 
     * @property minY
     * @type int
     * @type int
     * @private
     */
    minY: 0,

    /**
     * The down constraint 
     * @property maxY
     * @type int
     * @private
     */
    maxY: 0,

    /**
     * The difference between the click position and the source element's location
     * @property deltaX
     * @type int
     * @private
     */
    deltaX: 0,

    /**
     * The difference between the click position and the source element's location
     * @property deltaY
     * @type int
     * @private
     */
    deltaY: 0,

    /**
     * Maintain offsets when we resetconstraints.  Set to true when you want
     * the position of the element relative to its parent to stay the same
     * when the page changes
     *
     * @property maintainOffset
     * @type boolean
     */
    maintainOffset: false,

    /**
     * Array of pixel locations the element will snap to if we specified a 
     * horizontal graduation/interval.  This array is generated automatically
     * when you define a tick interval.
     * @property xTicks
     * @type int[]
     */
    xTicks: null,

    /**
     * Array of pixel locations the element will snap to if we specified a 
     * vertical graduation/interval.  This array is generated automatically 
     * when you define a tick interval.
     * @property yTicks
     * @type int[]
     */
    yTicks: null,

    /**
     * By default the drag and drop instance will only respond to the primary
     * button click (left button for a right-handed mouse).  Set to true to
     * allow drag and drop to start with any mouse click that is propogated
     * by the browser
     * @property primaryButtonOnly
     * @type boolean
     */
    primaryButtonOnly: true,

    /**
     * The availabe property is false until the linked dom element is accessible.
     * @property available
     * @type boolean
     */
    available: false,

    /**
     * By default, drags can only be initiated if the mousedown occurs in the
     * region the linked element is.  This is done in part to work around a
     * bug in some browsers that mis-report the mousedown if the previous
     * mouseup happened outside of the window.  This property is set to true
     * if outer handles are defined.
     *
     * @property hasOuterHandles
     * @type boolean
     * @default false
     */
    hasOuterHandles: false,

    /**
     * Code that executes immediately before the startDrag event
     * @method b4StartDrag
     * @private
     */
    b4StartDrag: function(x, y) { },

    /**
     * Abstract method called after a drag/drop object is clicked
     * and the drag or mousedown time thresholds have beeen met.
     * @method startDrag
     * @param {int} X click location
     * @param {int} Y click location
     */
    startDrag: function(x, y) { /* override this */ },

    /**
     * Code that executes immediately before the onDrag event
     * @method b4Drag
     * @private
     */
    b4Drag: function(e) { },

    /**
     * Abstract method called during the onMouseMove event while dragging an 
     * object.
     * @method onDrag
     * @param {Event} e the mousemove event
     */
    onDrag: function(e) { /* override this */ },

    /**
     * Abstract method called when this element fist begins hovering over 
     * another DragDrop obj
     * @method onDragEnter
     * @param {Event} e the mousemove event
     * @param {String|DragDrop[]} id In POINT mode, the element
     * id this is hovering over.  In INTERSECT mode, an array of one or more 
     * dragdrop items being hovered over.
     */
    onDragEnter: function(e, id) { /* override this */ },

    /**
     * Code that executes immediately before the onDragOver event
     * @method b4DragOver
     * @private
     */
    b4DragOver: function(e) { },

    /**
     * Abstract method called when this element is hovering over another 
     * DragDrop obj
     * @method onDragOver
     * @param {Event} e the mousemove event
     * @param {String|DragDrop[]} id In POINT mode, the element
     * id this is hovering over.  In INTERSECT mode, an array of dd items 
     * being hovered over.
     */
    onDragOver: function(e, id) { /* override this */ },

    /**
     * Code that executes immediately before the onDragOut event
     * @method b4DragOut
     * @private
     */
    b4DragOut: function(e) { },

    /**
     * Abstract method called when we are no longer hovering over an element
     * @method onDragOut
     * @param {Event} e the mousemove event
     * @param {String|DragDrop[]} id In POINT mode, the element
     * id this was hovering over.  In INTERSECT mode, an array of dd items 
     * that the mouse is no longer over.
     */
    onDragOut: function(e, id) { /* override this */ },

    /**
     * Code that executes immediately before the onDragDrop event
     * @method b4DragDrop
     * @private
     */
    b4DragDrop: function(e) { },

    /**
     * Abstract method called when this item is dropped on another DragDrop 
     * obj
     * @method onDragDrop
     * @param {Event} e the mouseup event
     * @param {String|DragDrop[]} id In POINT mode, the element
     * id this was dropped on.  In INTERSECT mode, an array of dd items this 
     * was dropped on.
     */
    onDragDrop: function(e, id) { /* override this */ },

    /**
     * Abstract method called when this item is dropped on an area with no
     * drop target
     * @method onInvalidDrop
     * @param {Event} e the mouseup event
     */
    onInvalidDrop: function(e) { /* override this */ },

    /**
     * Code that executes immediately before the endDrag event
     * @method b4EndDrag
     * @private
     */
    b4EndDrag: function(e) { },

    /**
     * Fired when we are done dragging the object
     * @method endDrag
     * @param {Event} e the mouseup event
     */
    endDrag: function(e) { /* override this */ },

    /**
     * Code executed immediately before the onMouseDown event
     * @method b4MouseDown
     * @param {Event} e the mousedown event
     * @private
     */
    b4MouseDown: function(e) {  },

    /**
     * Event handler that fires when a drag/drop obj gets a mousedown
     * @method onMouseDown
     * @param {Event} e the mousedown event
     */
    onMouseDown: function(e) { /* override this */ },

    /**
     * Event handler that fires when a drag/drop obj gets a mouseup
     * @method onMouseUp
     * @param {Event} e the mouseup event
     */
    onMouseUp: function(e) { /* override this */ },
   
    /**
     * Override the onAvailable method to do what is needed after the initial
     * position was determined.
     * @method onAvailable
     */
    onAvailable: function () { 
    },

    /**
     * Returns a reference to the linked element
     * @method getEl
     * @return {HTMLElement} the html element 
     */
    getEl: function() { 
        if (!this._domRef) {
            this._domRef = Dom.get(this.id); 
        }

        return this._domRef;
    },

    /**
     * Returns a reference to the actual element to drag.  By default this is
     * the same as the html element, but it can be assigned to another 
     * element. An example of this can be found in YAHOO.util.DDProxy
     * @method getDragEl
     * @return {HTMLElement} the html element 
     */
    getDragEl: function() {
        return Dom.get(this.dragElId);
    },

    /**
     * Sets up the DragDrop object.  Must be called in the constructor of any
     * YAHOO.util.DragDrop subclass
     * @method init
     * @param id the id of the linked element
     * @param {String} sGroup the group of related items
     * @param {object} config configuration attributes
     */
    init: function(id, sGroup, config) {
        this.initTarget(id, sGroup, config);
        Event.on(this.id, "mousedown", this.handleMouseDown, this, true);
        // Event.on(this.id, "selectstart", Event.preventDefault);
    },

    /**
     * Initializes Targeting functionality only... the object does not
     * get a mousedown handler.
     * @method initTarget
     * @param id the id of the linked element
     * @param {String} sGroup the group of related items
     * @param {object} config configuration attributes
     */
    initTarget: function(id, sGroup, config) {

        // configuration attributes 
        this.config = config || {};

        // create a local reference to the drag and drop manager
        this.DDM = YAHOO.util.DDM;
        // initialize the groups array
        this.groups = {};

        // assume that we have an element reference instead of an id if the
        // parameter is not a string
        if (typeof id !== "string") {
            id = Dom.generateId(id);
        }

        // set the id
        this.id = id;

        // add to an interaction group
        this.addToGroup((sGroup) ? sGroup : "default");

        // We don't want to register this as the handle with the manager
        // so we just set the id rather than calling the setter.
        this.handleElId = id;

        Event.onAvailable(id, this.handleOnAvailable, this, true);


        // the linked element is the element that gets dragged by default
        this.setDragElId(id); 

        // by default, clicked anchors will not start drag operations. 
        // @TODO what else should be here?  Probably form fields.
        this.invalidHandleTypes = { A: "A" };
        this.invalidHandleIds = {};
        this.invalidHandleClasses = [];

        this.applyConfig();
    },

    /**
     * Applies the configuration parameters that were passed into the constructor.
     * This is supposed to happen at each level through the inheritance chain.  So
     * a DDProxy implentation will execute apply config on DDProxy, DD, and 
     * DragDrop in order to get all of the parameters that are available in
     * each object.
     * @method applyConfig
     */
    applyConfig: function() {

        // configurable properties: 
        //    padding, isTarget, maintainOffset, primaryButtonOnly
        this.padding           = this.config.padding || [0, 0, 0, 0];
        this.isTarget          = (this.config.isTarget !== false);
        this.maintainOffset    = (this.config.maintainOffset);
        this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);

    },

    /**
     * Executed when the linked element is available
     * @method handleOnAvailable
     * @private
     */
    handleOnAvailable: function() {
        this.available = true;
        this.resetConstraints();
        this.onAvailable();
    },

     /**
     * Configures the padding for the target zone in px.  Effectively expands
     * (or reduces) the virtual object size for targeting calculations.  
     * Supports css-style shorthand; if only one parameter is passed, all sides
     * will have that padding, and if only two are passed, the top and bottom
     * will have the first param, the left and right the second.
     * @method setPadding
     * @param {int} iTop    Top pad
     * @param {int} iRight  Right pad
     * @param {int} iBot    Bot pad
     * @param {int} iLeft   Left pad
     */
    setPadding: function(iTop, iRight, iBot, iLeft) {
        // this.padding = [iLeft, iRight, iTop, iBot];
        if (!iRight && 0 !== iRight) {
            this.padding = [iTop, iTop, iTop, iTop];
        } else if (!iBot && 0 !== iBot) {
            this.padding = [iTop, iRight, iTop, iRight];
        } else {
            this.padding = [iTop, iRight, iBot, iLeft];
        }
    },

    /**
     * Stores the initial placement of the linked element.
     * @method setInitialPosition
     * @param {int} diffX   the X offset, default 0
     * @param {int} diffY   the Y offset, default 0
     * @private
     */
    setInitPosition: function(diffX, diffY) {
        var el = this.getEl();

        if (!this.DDM.verifyEl(el)) {
            return;
        }

        var dx = diffX || 0;
        var dy = diffY || 0;

        var p = Dom.getXY( el );

        this.initPageX = p[0] - dx;
        this.initPageY = p[1] - dy;

        this.lastPageX = p[0];
        this.lastPageY = p[1];



        this.setStartPosition(p);
    },

    /**
     * Sets the start position of the element.  This is set when the obj
     * is initialized, the reset when a drag is started.
     * @method setStartPosition
     * @param pos current position (from previous lookup)
     * @private
     */
    setStartPosition: function(pos) {
        var p = pos || Dom.getXY(this.getEl());

        this.deltaSetXY = null;

        this.startPageX = p[0];
        this.startPageY = p[1];
    },

    /**
     * Add this instance to a group of related drag/drop objects.  All 
     * instances belong to at least one group, and can belong to as many 
     * groups as needed.
     * @method addToGroup
     * @param sGroup {string} the name of the group
     */
    addToGroup: function(sGroup) {
        this.groups[sGroup] = true;
        this.DDM.regDragDrop(this, sGroup);
    },

    /**
     * Remove's this instance from the supplied interaction group
     * @method removeFromGroup
     * @param {string}  sGroup  The group to drop
     */
    removeFromGroup: function(sGroup) {
        if (this.groups[sGroup]) {
            delete this.groups[sGroup];
        }

        this.DDM.removeDDFromGroup(this, sGroup);
    },

    /**
     * Allows you to specify that an element other than the linked element 
     * will be moved with the cursor during a drag
     * @method setDragElId
     * @param id {string} the id of the element that will be used to initiate the drag
     */
    setDragElId: function(id) {
        this.dragElId = id;
    },

    /**
     * Allows you to specify a child of the linked element that should be 
     * used to initiate the drag operation.  An example of this would be if 
     * you have a content div with text and links.  Clicking anywhere in the 
     * content area would normally start the drag operation.  Use this method
     * to specify that an element inside of the content div is the element 
     * that starts the drag operation.
     * @method setHandleElId
     * @param id {string} the id of the element that will be used to 
     * initiate the drag.
     */
    setHandleElId: function(id) {
        if (typeof id !== "string") {
            id = Dom.generateId(id);
        }
        this.handleElId = id;
        this.DDM.regHandle(this.id, id);
    },

    /**
     * Allows you to set an element outside of the linked element as a drag 
     * handle
     * @method setOuterHandleElId
     * @param id the id of the element that will be used to initiate the drag
     */
    setOuterHandleElId: function(id) {
        if (typeof id !== "string") {
            id = Dom.generateId(id);
        }
        Event.on(id, "mousedown", 
                this.handleMouseDown, this, true);
        this.setHandleElId(id);

        this.hasOuterHandles = true;
    },

    /**
     * Remove all drag and drop hooks for this element
     * @method unreg
     */
    unreg: function() {
        Event.removeListener(this.id, "mousedown", 
                this.handleMouseDown);
        this._domRef = null;
        this.DDM._remove(this);
    },

    /**
     * Returns true if this instance is locked, or the drag drop mgr is locked
     * (meaning that all drag/drop is disabled on the page.)
     * @method isLocked
     * @return {boolean} true if this obj or all drag/drop is locked, else 
     * false
     */
    isLocked: function() {
        return (this.DDM.isLocked() || this.locked);
    },

    /**
     * Fired when this object is clicked
     * @method handleMouseDown
     * @param {Event} e 
     * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)
     * @private
     */
    handleMouseDown: function(e, oDD) {

        var button = e.which || e.button;

        if (this.primaryButtonOnly && button > 1) {
            return;
        }

        if (this.isLocked()) {
            return;
        }



        // firing the mousedown events prior to calculating positions
        this.b4MouseDown(e);
        this.onMouseDown(e);

        this.DDM.refreshCache(this.groups);
        // var self = this;
        // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);

        // Only process the event if we really clicked within the linked 
        // element.  The reason we make this check is that in the case that 
        // another element was moved between the clicked element and the 
        // cursor in the time between the mousedown and mouseup events. When 
        // this happens, the element gets the next mousedown event 
        // regardless of where on the screen it happened.  
        var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e));
        if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) )  {
        } else {
            if (this.clickValidator(e)) {


                // set the initial element position
                this.setStartPosition();

                // start tracking mousemove distance and mousedown time to
                // determine when to start the actual drag
                this.DDM.handleMouseDown(e, this);

                // this mousedown is mine
                this.DDM.stopEvent(e);
            } else {


            }
        }
    },

    clickValidator: function(e) {
        var target = Event.getTarget(e);
        return ( this.isValidHandleChild(target) &&
                    (this.id == this.handleElId || 
                        this.DDM.handleWasClicked(target, this.id)) );
    },

    /**
     * Finds the location the element should be placed if we want to move
     * it to where the mouse location less the click offset would place us.
     * @method getTargetCoord
     * @param {int} iPageX the X coordinate of the click
     * @param {int} iPageY the Y coordinate of the click
     * @return an object that contains the coordinates (Object.x and Object.y)
     * @private
     */
    getTargetCoord: function(iPageX, iPageY) {


        var x = iPageX - this.deltaX;
        var y = iPageY - this.deltaY;

        if (this.constrainX) {
            if (x < this.minX) { x = this.minX; }
            if (x > this.maxX) { x = this.maxX; }
        }

        if (this.constrainY) {
            if (y < this.minY) { y = this.minY; }
            if (y > this.maxY) { y = this.maxY; }
        }

        x = this.getTick(x, this.xTicks);
        y = this.getTick(y, this.yTicks);


        return {x:x, y:y};
    },

    /**
     * Allows you to specify a tag name that should not start a drag operation
     * when clicked.  This is designed to facilitate embedding links within a
     * drag handle that do something other than start the drag.
     * @method addInvalidHandleType
     * @param {string} tagName the type of element to exclude
     */
    addInvalidHandleType: function(tagName) {
        var type = tagName.toUpperCase();
        this.invalidHandleTypes[type] = type;
    },

    /**
     * Lets you to specify an element id for a child of a drag handle
     * that should not initiate a drag
     * @method addInvalidHandleId
     * @param {string} id the element id of the element you wish to ignore
     */
    addInvalidHandleId: function(id) {
        if (typeof id !== "string") {
            id = Dom.generateId(id);
        }
        this.invalidHandleIds[id] = id;
    },


    /**
     * Lets you specify a css class of elements that will not initiate a drag
     * @method addInvalidHandleClass
     * @param {string} cssClass the class of the elements you wish to ignore
     */
    addInvalidHandleClass: function(cssClass) {
        this.invalidHandleClasses.push(cssClass);
    },

    /**
     * Unsets an excluded tag name set by addInvalidHandleType
     * @method removeInvalidHandleType
     * @param {string} tagName the type of element to unexclude
     */
    removeInvalidHandleType: function(tagName) {
        var type = tagName.toUpperCase();
        // this.invalidHandleTypes[type] = null;
        delete this.invalidHandleTypes[type];
    },
    
    /**
     * Unsets an invalid handle id
     * @method removeInvalidHandleId
     * @param {string} id the id of the element to re-enable
     */
    removeInvalidHandleId: function(id) {
        if (typeof id !== "string") {
            id = Dom.generateId(id);
        }
        delete this.invalidHandleIds[id];
    },

    /**
     * Unsets an invalid css class
     * @method removeInvalidHandleClass
     * @param {string} cssClass the class of the element(s) you wish to 
     * re-enable
     */
    removeInvalidHandleClass: function(cssClass) {
        for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {
            if (this.invalidHandleClasses[i] == cssClass) {
                delete this.invalidHandleClasses[i];
            }
        }
    },

    /**
     * Checks the tag exclusion list to see if this click should be ignored
     * @method isValidHandleChild
     * @param {HTMLElement} node the HTMLElement to evaluate
     * @return {boolean} true if this is a valid tag type, false if not
     */
    isValidHandleChild: function(node) {

        var valid = true;
        // var n = (node.nodeName == "#text") ? node.parentNode : node;
        var nodeName;
        try {
            nodeName = node.nodeName.toUpperCase();
        } catch(e) {
            nodeName = node.nodeName;
        }
        valid = valid && !this.invalidHandleTypes[nodeName];
        valid = valid && !this.invalidHandleIds[node.id];

        for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
            valid = !Dom.hasClass(node, this.invalidHandleClasses[i]);
        }


        return valid;

    },

    /**
     * Create the array of horizontal tick marks if an interval was specified
     * in setXConstraint().
     * @method setXTicks
     * @private
     */
    setXTicks: function(iStartX, iTickSize) {
        this.xTicks = [];
        this.xTickSize = iTickSize;
        
        var tickMap = {};

        for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {
            if (!tickMap[i]) {
                this.xTicks[this.xTicks.length] = i;
                tickMap[i] = true;
            }
        }

        for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
            if (!tickMap[i]) {
                this.xTicks[this.xTicks.length] = i;
                tickMap[i] = true;
            }
        }

        this.xTicks.sort(this.DDM.numericSort) ;
    },

    /**
     * Create the array of vertical tick marks if an interval was specified in 
     * setYConstraint().
     * @method setYTicks
     * @private
     */
    setYTicks: function(iStartY, iTickSize) {
        this.yTicks = [];
        this.yTickSize = iTickSize;

        var tickMap = {};

        for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
            if (!tickMap[i]) {
                this.yTicks[this.yTicks.length] = i;
                tickMap[i] = true;
            }
        }

        for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
            if (!tickMap[i]) {
                this.yTicks[this.yTicks.length] = i;
                tickMap[i] = true;
            }
        }

        this.yTicks.sort(this.DDM.numericSort) ;
    },

    /**
     * By default, the element can be dragged any place on the screen.  Use 
     * this method to limit the horizontal travel of the element.  Pass in 
     * 0,0 for the parameters if you want to lock the drag to the y axis.
     * @method setXConstraint
     * @param {int} iLeft the number of pixels the element can move to the left
     * @param {int} iRight the number of pixels the element can move to the 
     * right
     * @param {int} iTickSize optional parameter for specifying that the 
     * element
     * should move iTickSize pixels at a time.
     */
    setXConstraint: function(iLeft, iRight, iTickSize) {
        this.leftConstraint = parseInt(iLeft, 10);
        this.rightConstraint = parseInt(iRight, 10);

        this.minX = this.initPageX - this.leftConstraint;
        this.maxX = this.initPageX + this.rightConstraint;
        if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }

        this.constrainX = true;
    },

    /**
     * Clears any constraints applied to this instance.  Also clears ticks
     * since they can't exist independent of a constraint at this time.
     * @method clearConstraints
     */
    clearConstraints: function() {
        this.constrainX = false;
        this.constrainY = false;
        this.clearTicks();
    },

    /**
     * Clears any tick interval defined for this instance
     * @method clearTicks
     */
    clearTicks: function() {
        this.xTicks = null;
        this.yTicks = null;
        this.xTickSize = 0;
        this.yTickSize = 0;
    },

    /**
     * By default, the element can be dragged any place on the screen.  Set 
     * this to limit the vertical travel of the element.  Pass in 0,0 for the
     * parameters if you want to lock the drag to the x axis.
     * @method setYConstraint
     * @param {int} iUp the number of pixels the element can move up
     * @param {int} iDown the number of pixels the element can move down
     * @param {int} iTickSize optional parameter for specifying that the 
     * element should move iTickSize pixels at a time.
     */
    setYConstraint: function(iUp, iDown, iTickSize) {
        this.topConstraint = parseInt(iUp, 10);
        this.bottomConstraint = parseInt(iDown, 10);

        this.minY = this.initPageY - this.topConstraint;
        this.maxY = this.initPageY + this.bottomConstraint;
        if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }

        this.constrainY = true;
        
    },

    /**
     * resetConstraints must be called if you manually reposition a dd element.
     * @method resetConstraints
     * @param {boolean} maintainOffset
     */
    resetConstraints: function() {


        // Maintain offsets if necessary
        if (this.initPageX || this.initPageX === 0) {
            // figure out how much this thing has moved
            var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
            var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;

            this.setInitPosition(dx, dy);

        // This is the first time we have detected the element's position
        } else {
            this.setInitPosition();
        }

        if (this.constrainX) {
            this.setXConstraint( this.leftConstraint, 
                                 this.rightConstraint, 
                                 this.xTickSize        );
        }

        if (this.constrainY) {
            this.setYConstraint( this.topConstraint, 
                                 this.bottomConstraint, 
                                 this.yTickSize         );
        }
    },

    /**
     * Normally the drag element is moved pixel by pixel, but we can specify 
     * that it move a number of pixels at a time.  This method resolves the 
     * location when we have it set up like this.
     * @method getTick
     * @param {int} val where we want to place the object
     * @param {int[]} tickArray sorted array of valid points
     * @return {int} the closest tick
     * @private
     */
    getTick: function(val, tickArray) {

        if (!tickArray) {
            // If tick interval is not defined, it is effectively 1 pixel, 
            // so we return the value passed to us.
            return val; 
        } else if (tickArray[0] >= val) {
            // The value is lower than the first tick, so we return the first
            // tick.
            return tickArray[0];
        } else {
            for (var i=0, len=tickArray.length; i<len; ++i) {
                var next = i + 1;
                if (tickArray[next] && tickArray[next] >= val) {
                    var diff1 = val - tickArray[i];
                    var diff2 = tickArray[next] - val;
                    return (diff2 > diff1) ? tickArray[i] : tickArray[next];
                }
            }

            // The value is larger than the last tick, so we return the last
            // tick.
            return tickArray[tickArray.length - 1];
        }
    },

    /**
     * toString method
     * @method toString
     * @return {string} string representation of the dd obj
     */
    toString: function() {
        return ("DragDrop " + this.id);
    }

};

})();
/**
 * A DragDrop implementation where the linked element follows the 
 * mouse cursor during a drag.
 * @class DD
 * @extends YAHOO.util.DragDrop
 * @constructor
 * @param {String} id the id of the linked element 
 * @param {String} sGroup the group of related DragDrop items
 * @param {object} config an object containing configurable attributes
 *                Valid properties for DD: 
 *                    scroll
 */
YAHOO.util.DD = function(id, sGroup, config) {
    if (id) {
        this.init(id, sGroup, config);
    }
};

YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {

    /**
     * When set to true, the utility automatically tries to scroll the browser
     * window wehn a drag and drop element is dragged near the viewport boundary.
     * Defaults to true.
     * @property scroll
     * @type boolean
     */
    scroll: true, 

    /**
     * Sets the pointer offset to the distance between the linked element's top 
     * left corner and the location the element was clicked
     * @method autoOffset
     * @param {int} iPageX the X coordinate of the click
     * @param {int} iPageY the Y coordinate of the click
     */
    autoOffset: function(iPageX, iPageY) {
        var x = iPageX - this.startPageX;
        var y = iPageY - this.startPageY;
        this.setDelta(x, y);
    },

    /** 
     * Sets the pointer offset.  You can call this directly to force the 
     * offset to be in a particular location (e.g., pass in 0,0 to set it 
     * to the center of the object, as done in YAHOO.widget.Slider)
     * @method setDelta
     * @param {int} iDeltaX the distance from the left
     * @param {int} iDeltaY the distance from the top
     */
    setDelta: function(iDeltaX, iDeltaY) {
        this.deltaX = iDeltaX;
        this.deltaY = iDeltaY;
    },

    /**
     * Sets the drag element to the location of the mousedown or click event, 
     * maintaining the cursor location relative to the location on the element 
     * that was clicked.  Override this if you want to place the element in a 
     * location other than where the cursor is.
     * @method setDragElPos
     * @param {int} iPageX the X coordinate of the mousedown or drag event
     * @param {int} iPageY the Y coordinate of the mousedown or drag event
     */
    setDragElPos: function(iPageX, iPageY) {
        // the first time we do this, we are going to check to make sure
        // the element has css positioning

        var el = this.getDragEl();
        this.alignElWithMouse(el, iPageX, iPageY);
    },

    /**
     * Sets the element to the location of the mousedown or click event, 
     * maintaining the cursor location relative to the location on the element 
     * that was clicked.  Override this if you want to place the element in a 
     * location other than where the cursor is.
     * @method alignElWithMouse
     * @param {HTMLElement} el the element to move
     * @param {int} iPageX the X coordinate of the mousedown or drag event
     * @param {int} iPageY the Y coordinate of the mousedown or drag event
     */
    alignElWithMouse: function(el, iPageX, iPageY) {
        var oCoord = this.getTargetCoord(iPageX, iPageY);

        if (!this.deltaSetXY) {
            var aCoord = [oCoord.x, oCoord.y];
            YAHOO.util.Dom.setXY(el, aCoord);
            var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );
            var newTop  = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );

            this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
        } else {
            YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");
            YAHOO.util.Dom.setStyle(el, "top",  (oCoord.y + this.deltaSetXY[1]) + "px");
        }
        
        this.cachePosition(oCoord.x, oCoord.y);
        this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
    },

    /**
     * Saves the most recent position so that we can reset the constraints and
     * tick marks on-demand.  We need to know this so that we can calculate the
     * number of pixels the element is offset from its original position.
     * @method cachePosition
     * @param iPageX the current x position (optional, this just makes it so we
     * don't have to look it up again)
     * @param iPageY the current y position (optional, this just makes it so we
     * don't have to look it up again)
     */
    cachePosition: function(iPageX, iPageY) {
        if (iPageX) {
            this.lastPageX = iPageX;
            this.lastPageY = iPageY;
        } else {
            var aCoord = YAHOO.util.Dom.getXY(this.getEl());
            this.lastPageX = aCoord[0];
            this.lastPageY = aCoord[1];
        }
    },

    /**
     * Auto-scroll the window if the dragged object has been moved beyond the 
     * visible window boundary.
     * @method autoScroll
     * @param {int} x the drag element's x position
     * @param {int} y the drag element's y position
     * @param {int} h the height of the drag element
     * @param {int} w the width of the drag element
     * @private
     */
    autoScroll: function(x, y, h, w) {

        if (this.scroll) {
            // The client height
            var clientH = this.DDM.getClientHeight();

            // The client width
            var clientW = this.DDM.getClientWidth();

            // The amt scrolled down
            var st = this.DDM.getScrollTop();

            // The amt scrolled right
            var sl = this.DDM.getScrollLeft();

            // Location of the bottom of the element
            var bot = h + y;

            // Location of the right of the element
            var right = w + x;

            // The distance from the cursor to the bottom of the visible area, 
            // adjusted so that we don't scroll if the cursor is beyond the
            // element drag constraints
            var toBot = (clientH + st - y - this.deltaY);

            // The distance from the cursor to the right of the visible area
            var toRight = (clientW + sl - x - this.deltaX);


            // How close to the edge the cursor must be before we scroll
            // var thresh = (document.all) ? 100 : 40;
            var thresh = 40;

            // How many pixels to scroll per autoscroll op.  This helps to reduce 
            // clunky scrolling. IE is more sensitive about this ... it needs this 
            // value to be higher.
            var scrAmt = (document.all) ? 80 : 30;

            // Scroll down if we are near the bottom of the visible page and the 
            // obj extends below the crease
            if ( bot > clientH && toBot < thresh ) { 
                window.scrollTo(sl, st + scrAmt); 
            }

            // Scroll up if the window is scrolled down and the top of the object
            // goes above the top border
            if ( y < st && st > 0 && y - st < thresh ) { 
                window.scrollTo(sl, st - scrAmt); 
            }

            // Scroll right if the obj is beyond the right border and the cursor is
            // near the border.
            if ( right > clientW && toRight < thresh ) { 
                window.scrollTo(sl + scrAmt, st); 
            }

            // Scroll left if the window has been scrolled to the right and the obj
            // extends past the left border
            if ( x < sl && sl > 0 && x - sl < thresh ) { 
                window.scrollTo(sl - scrAmt, st);
            }
        }
    },

    /*
     * Sets up config options specific to this class. Overrides
     * YAHOO.util.DragDrop, but all versions of this method through the 
     * inheritance chain are called
     */
    applyConfig: function() {
        YAHOO.util.DD.superclass.applyConfig.call(this);
        this.scroll = (this.config.scroll !== false);
    },

    /*
     * Event that fires prior to the onMouseDown event.  Overrides 
     * YAHOO.util.DragDrop.
     */
    b4MouseDown: function(e) {
        this.setStartPosition();
        // this.resetConstraints();
        this.autoOffset(YAHOO.util.Event.getPageX(e), 
                            YAHOO.util.Event.getPageY(e));
    },

    /*
     * Event that fires prior to the onDrag event.  Overrides 
     * YAHOO.util.DragDrop.
     */
    b4Drag: function(e) {
        this.setDragElPos(YAHOO.util.Event.getPageX(e), 
                            YAHOO.util.Event.getPageY(e));
    },

    toString: function() {
        return ("DD " + this.id);
    }

    //////////////////////////////////////////////////////////////////////////
    // Debugging ygDragDrop events that can be overridden
    //////////////////////////////////////////////////////////////////////////
    /*
    startDrag: function(x, y) {
    },

    onDrag: function(e) {
    },

    onDragEnter: function(e, id) {
    },

    onDragOver: function(e, id) {
    },

    onDragOut: function(e, id) {
    },

    onDragDrop: function(e, id) {
    },

    endDrag: function(e) {
    }

    */

});
/**
 * A DragDrop implementation that inserts an empty, bordered div into
 * the document that follows the cursor during drag operations.  At the time of
 * the click, the frame div is resized to the dimensions of the linked html
 * element, and moved to the exact location of the linked element.
 *
 * References to the "frame" element refer to the single proxy element that
 * was created to be dragged in place of all DDProxy elements on the
 * page.
 *
 * @class DDProxy
 * @extends YAHOO.util.DD
 * @constructor
 * @param {String} id the id of the linked html element
 * @param {String} sGroup the group of related DragDrop objects
 * @param {object} config an object containing configurable attributes
 *                Valid properties for DDProxy in addition to those in DragDrop: 
 *                   resizeFrame, centerFrame, dragElId
 */
YAHOO.util.DDProxy = function(id, sGroup, config) {
    if (id) {
        this.init(id, sGroup, config);
        this.initFrame(); 
    }
};

/**
 * The default drag frame div id
 * @property YAHOO.util.DDProxy.dragElId
 * @type String
 * @static
 */
YAHOO.util.DDProxy.dragElId = "ygddfdiv";

YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {

    /**
     * By default we resize the drag frame to be the same size as the element
     * we want to drag (this is to get the frame effect).  We can turn it off
     * if we want a different behavior.
     * @property resizeFrame
     * @type boolean
     */
    resizeFrame: true,

    /**
     * By default the frame is positioned exactly where the drag element is, so
     * we use the cursor offset provided by YAHOO.util.DD.  Another option that works only if
     * you do not have constraints on the obj is to have the drag frame centered
     * around the cursor.  Set centerFrame to true for this effect.
     * @property centerFrame
     * @type boolean
     */
    centerFrame: false,

    /**
     * Creates the proxy element if it does not yet exist
     * @method createFrame
     */
    createFrame: function() {
        var self = this;
        var body = document.body;

        if (!body || !body.firstChild) {
            setTimeout( function() { self.createFrame(); }, 50 );
            return;
        }

        var div = this.getDragEl();

        if (!div) {
            div    = document.createElement("div");
            div.id = this.dragElId;
            var s  = div.style;

            s.position   = "absolute";
            s.visibility = "hidden";
            s.cursor     = "move";
            s.border     = "2px solid #aaa";
            s.zIndex     = 999;

            // appendChild can blow up IE if invoked prior to the window load event
            // while rendering a table.  It is possible there are other scenarios 
            // that would cause this to happen as well.
            body.insertBefore(div, body.firstChild);
        }
    },

    /**
     * Initialization for the drag frame element.  Must be called in the
     * constructor of all subclasses
     * @method initFrame
     */
    initFrame: function() {
        this.createFrame();
    },

    applyConfig: function() {
        YAHOO.util.DDProxy.superclass.applyConfig.call(this);

        this.resizeFrame = (this.config.resizeFrame !== false);
        this.centerFrame = (this.config.centerFrame);
        this.setDragElId(this.config.dragElId || YAHOO.util.DDProxy.dragElId);
    },

    /**
     * Resizes the drag frame to the dimensions of the clicked object, positions 
     * it over the object, and finally displays it
     * @method showFrame
     * @param {int} iPageX X click position
     * @param {int} iPageY Y click position
     * @private
     */
    showFrame: function(iPageX, iPageY) {
        var el = this.getEl();
        var dragEl = this.getDragEl();
        var s = dragEl.style;

        this._resizeProxy();

        if (this.centerFrame) {
            this.setDelta( Math.round(parseInt(s.width,  10)/2), 
                           Math.round(parseInt(s.height, 10)/2) );
        }

        this.setDragElPos(iPageX, iPageY);

        YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible"); 
    },

    /**
     * The proxy is automatically resized to the dimensions of the linked
     * element when a drag is initiated, unless resizeFrame is set to false
     * @method _resizeProxy
     * @private
     */
    _resizeProxy: function() {
        if (this.resizeFrame) {
            var DOM    = YAHOO.util.Dom;
            var el     = this.getEl();
            var dragEl = this.getDragEl();

            var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth"    ), 10);
            var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth"  ), 10);
            var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10);
            var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth"   ), 10);

            if (isNaN(bt)) { bt = 0; }
            if (isNaN(br)) { br = 0; }
            if (isNaN(bb)) { bb = 0; }
            if (isNaN(bl)) { bl = 0; }


            var newWidth  = Math.max(0, el.offsetWidth  - br - bl);                                                                                           
            var newHeight = Math.max(0, el.offsetHeight - bt - bb);


            DOM.setStyle( dragEl, "width",  newWidth  + "px" );
            DOM.setStyle( dragEl, "height", newHeight + "px" );
        }
    },

    // overrides YAHOO.util.DragDrop
    b4MouseDown: function(e) {
        this.setStartPosition();
        var x = YAHOO.util.Event.getPageX(e);
        var y = YAHOO.util.Event.getPageY(e);
        this.autoOffset(x, y);
        this.setDragElPos(x, y);
    },

    // overrides YAHOO.util.DragDrop
    b4StartDrag: function(x, y) {
        // show the drag frame
        this.showFrame(x, y);
    },

    // overrides YAHOO.util.DragDrop
    b4EndDrag: function(e) {
        YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden"); 
    },

    // overrides YAHOO.util.DragDrop
    // By default we try to move the element to the last location of the frame.  
    // This is so that the default behavior mirrors that of YAHOO.util.DD.  
    endDrag: function(e) {
        var DOM = YAHOO.util.Dom;
        var lel = this.getEl();
        var del = this.getDragEl();

        // Show the drag frame briefly so we can get its position
        // del.style.visibility = "";
        DOM.setStyle(del, "visibility", ""); 

        // Hide the linked element before the move to get around a Safari 
        // rendering bug.
        //lel.style.visibility = "hidden";
        DOM.setStyle(lel, "visibility", "hidden"); 
        YAHOO.util.DDM.moveToEl(lel, del);
        //del.style.visibility = "hidden";
        DOM.setStyle(del, "visibility", "hidden"); 
        //lel.style.visibility = "";
        DOM.setStyle(lel, "visibility", ""); 
    },

    toString: function() {
        return ("DDProxy " + this.id);
    }

});
/**
 * A DragDrop implementation that does not move, but can be a drop 
 * target.  You would get the same result by simply omitting implementation 
 * for the event callbacks, but this way we reduce the processing cost of the 
 * event listener and the callbacks.
 * @class DDTarget
 * @extends YAHOO.util.DragDrop 
 * @constructor
 * @param {String} id the id of the element that is a drop target
 * @param {String} sGroup the group of related DragDrop objects
 * @param {object} config an object containing configurable attributes
 *                 Valid properties for DDTarget in addition to those in 
 *                 DragDrop: 
 *                    none
 */
YAHOO.util.DDTarget = function(id, sGroup, config) {
    if (id) {
        this.initTarget(id, sGroup, config);
    }
};

// YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop();
YAHOO.extend(YAHOO.util.DDTarget, YAHOO.util.DragDrop, {
    toString: function() {
        return ("DDTarget " + this.id);
    }
});
YAHOO.register("dragdrop", YAHOO.util.DragDropMgr, {version: "2.2.2", build: "204"});

var HPConfig={current_vertical_name:'',current_web_address:'',timestamp_for_clearing_js:0,slideshow_mode:0,blog_id:0,comments_update_interval:0,comments_update_for_all_users:false,wide_format:false,enable_fb_widgets:false,page_data:{}}
var jimAuld=window.jimAuld||{};jimAuld.utils=jimAuld.utils||{};jimAuld.utils.cookies={get:function(cookieName)
{var cookieNameStart,valueStart,valueEnd,value;cookieNameStart=document.cookie.indexOf(cookieName+'=');if(cookieNameStart<0)
{return null;}
valueStart=document.cookie.indexOf(cookieName+'=')+cookieName.length+1;valueEnd=document.cookie.indexOf(";",valueStart);if(valueEnd==-1)
{valueEnd=document.cookie.length;}
value=document.cookie.substring(valueStart,valueEnd);value=unescape(value);if(value=="")
{return null;}
return value;},set:function(cookieName,value,hoursToLive,path,domain,secure,in_seconds)
{var expireString,timerObj,expireAt,pathString,domainString,secureString,setCookieString;if(!hoursToLive||typeof hoursToLive!='number'||parseInt(hoursToLive)=='NaN')
{expireString="";}
else
{timerObj=new Date();hoursToLive=parseInt(hoursToLive);if(!(in_seconds)){hoursToLive=hoursToLive*60*60;}
timerObj.setTime(timerObj.getTime()+hoursToLive*1000);expireAt=timerObj.toGMTString();expireString="; expires="+expireAt;}
pathString="; path=";(!path||path=="")?pathString+="/":pathString+=path;domainString="; domain=";(!domain||domain=="")?domainString+=window.location.hostname.replace(/www\./,''):domainString+=domain;(secure===true)?secureString="; secure":secureString="";value=escape(value);setCookieString=cookieName+"="+value+expireString+pathString+domainString;document.cookie=setCookieString;},del:function(cookieName,path,domain)
{(!path||!path.length)?path="":path=path;(!domain||!domain.length)?domain="":domain=domain;jimAuld.utils.cookies.set(cookieName,"",-8760,path,domain);},test:function()
{jimAuld.utils.cookies.set('cT','acc');var runTest=jimAuld.utils.cookies.get('cT');if(runTest=='acc')
{jimAuld.utils.cookies.del('cT');testStatus=true;}
else
{testStatus=false;}
return testStatus;}};var HuffCookies=jimAuld.utils.cookies;HuffCookies.getCookiePrefix=function()
{if((/\.beta\./.test(location.hostname)))
{var bport='';bport=(""==location.port)?'80':location.port;return'beta'+bport+'_';}
else
{return'';}};HuffCookies.getUserName=function()
{return this.get(this.getCookiePrefix()+'huffpost_user');};HuffCookies.getUserGuid=function()
{return this.get(this.getCookiePrefix()+'huffpost_user_guid');};HuffCookies.getPass=function()
{return this.get(this.getCookiePrefix()+'huffpost_pass');};HuffCookies.getLastLogin=function()
{return this.get(this.getCookiePrefix()+'huffpost_lastlogin');};HuffCookies.getBigAvatar=function()
{var c=this.get(this.getCookiePrefix()+'huffpost_bigphoto');if(!c||c=='')
{return'';}
else
{return c;}};HuffCookies.getSmallAvatar=function()
{var c=this.get(this.getCookiePrefix()+'huffpost_smallphoto');if(!c||c=='')
{return'';}
else
{return c;}};HuffCookies.getSNPstatus=function()
{if(this.getUserName())
return 1;else
return 0;};HuffCookies.setCookie=function(cookieName,value,ttl)
{var cookie_preffix=(/\.beta\./.test(location.hostname))?'beta'+location.port+'_':'';var domain=location.hostname;domain=domain.replace(/www\./,'');if(!ttl){ttl=336;}else if(ttl==-1){ttl=0;}
return this.set(cookie_preffix+cookieName,value,ttl,'/','.'+domain);};HuffCookies.getCookie=function(cookieName)
{var domain=location.hostname;domain=domain.replace(/www\./,'');return this.get(HuffCookies.getCookiePrefix()+cookieName);};HuffCookies.domainCookie=function()
{var domain=location.hostname;domain=domain.replace(/www\./,'');return domain;};HuffCookies.getUserId=function()
{return this.get(this.getCookiePrefix()+'huffpost_user_id');};HuffCookies.destroyCookie=function(name)
{var prefix=(/\.beta\./.test(location.hostname))?'beta'+location.port+'_':'';return this.del(prefix+name,'/','.'+HuffCookies.domainCookie());};HuffCookies.userPrefs={pending:false,subvalues:{'facebook':0,'twitter':1,'read_tracking':2,'gfc':3,'yahoo':4,'google':5,'linkedin':6},subvalues_abbr:{0:'fb',1:'tw',2:'rt',3:'gfc',4:'yh',5:'gfc',6:'linkedin'},charmap:{'facebook':'F','twitter':'T','read_tracking':'R','gfc':'G','yahoo':'Y','google':'L','registered':'H','anonymous':'A'},cookie_name:'huffpost_prefs',get:function(key)
{if(!HuffCookies.getUserId())
return false;if(this.pending)
return null;var val=this._getFromOffset(this.subvalues[key]);if(val=="y")
{return true;}
else if(val=="n")
{return false;}
return null;},to_string:function(as_chars)
{var user='';for(var key in this.subvalues)
{if(this.get(key+''))
{if(as_chars)
{user+=this.charmap[key+''];}
else
{if(user)user+=",";user+=key;}}}
return user;},_getFromOffset:function(pos)
{var values=this._getPrefsValues();if(values[pos]&&(values[pos]=='y'||values[pos]=='n'))
{return values[pos];}
else
{this.pending=true;YAHOO.util.Connect.asyncRequest('POST','/users/login/reauthenticate.php',{success:function(o)
{HPError.d('Reauthenticated');this.pending=false;},failure:function(o)
{HPError.d('Error reauthenticating');}},'blank_post_workaround');return null;}},_getPrefsValues:function()
{var cookie=HuffCookies.getCookie(this.cookie_name);this.values=(cookie&&cookie.split(''))||[];return this.values;}
};HuffPrefs=HuffCookies.userPrefs;
var JSON=function(){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},s={'boolean':function(x){return String(x);},number:function(x){return isFinite(x)?String(x):'null';},string:function(x){if(/["\\\x00-\x1f]/.test(x)){x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}
c=b.charCodeAt();return'\\u00'+
Math.floor(c/16).toString(16)+
(c%16).toString(16);});}
return'"'+x+'"';},object:function(x){if(x){var a=[],b,f,i,l,v;if(x instanceof Array){a[0]='[';l=x.length;for(i=0;i<l;i+=1){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}
a[a.length]=v;b=true;}}}
a[a.length]=']';}else if(x instanceof Object){a[0]='{';for(i in x){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}
a.push(s.string(i),':',v);b=true;}}}
a[a.length]='}';}else{return;}
return a.join('');}
return'null';}};return{copyright:'(c)2005 JSON.org',license:'http://www.crockford.com/JSON/license.html',stringify:function(v){var f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){return v;}}
return null;},parse:function(text){try{return!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g,'')))&&eval('('+text+')');}catch(e){return false;}}};}();
var HPTrack={async:false,pageTracker:null,prod_account:'UA-71081-1',dev_account:'UA-71081-7',modules:[],custom_vars:{'vertical':{"scope":3,"slot":1,"display":"Vertical"},'blog':{"scope":3,"slot":2,"display":"Blog"},'news':{"scope":3,"slot":2,"display":"News"},'page':{"scope":3,"slot":2,"display":"Page"},'tpage':{"scope":3,"slot":2,"display":"TPage"},'user':{"scope":1,"slot":3,"display":"User"},'joined':{"scope":1,"slot":4,"display":"JoinedOn"}},getTracker:function(acct){var account;if(typeof HuffCookies!=='undefined')
{var cookie=HuffCookies.get('__utmz');if(cookie&&cookie.match(/utmcsr=(World|Food|Colle|Busin|Styl|New Y|Los A|Tech|Relig|Politic|Enterta|Livin|Books|Impact|Comed|Denve|Chicag|Media|Green|Sport)/))
{HuffCookies.del('__utmz');}}
if(HPConfig.inst_type&&"dev"==HPConfig.inst_type)
{account=this.dev_account;}
else
{account=acct||this.prod_account;}
if(this.async)
{_gaq.push(['_setAccount',account]);}
else
{this.pageTracker=_gat._getTracker(account);}
if("undefined"!=typeof(HuffPrefs)&&HuffPrefs.to_string)
{var track='A';if(HuffCookies.getUserId())
{var prefs=HuffPrefs.to_string(true);track='H'+prefs;}
else
{this.setCustomVar('joined','0');}
this.setCustomVar('user',track);}},setCampContentKey:function(CampContentKey){if(this.async)
{_gaq.push(['_setCampContentKey',CampContentKey]);}
else
{this.pageTracker._setCampContentKey(CampContentKey);}},setCampMediumKey:function(CampMedKey){if(this.async)
{_gaq.push(['_setCampMediumKey',CampMedKey]);}
else
{this.pageTracker._setCampMediumKey(CampMedKey);}},setCampNameKey:function(CampNameKey){if(this.async)
{_gaq.push(['_setCampNameKey',CampNameKey]);}
else
{this.pageTracker._setCampNameKey(CampNameKey);}},setCampTermKey:function(CampTermKey){if(this.async)
{_gaq.push(['_setCampTermKey',CampTermKey]);}
else
{this.pageTracker._setCampTermKey(CampTermKey);}},setCustomVar:function(field,value)
{var config=this.custom_vars[field+''];if(!(config&&value))return;if(value.length&&value.length>8)
{value=value.substr(0,8);}
if(this.async)
{_gaq.push(['_setCustomVar',config['slot'],config['display'],value,config['scope']]);}
else
{this.pageTracker._setCustomVar(config['slot'],config['display'],value,config['scope']);}},trackPageview:function(url)
{if(this.async)
{var trk=['_trackPageview'];if(url)
trk.push(url);_gaq.push(trk);}
else
{if(!this.pageTracker)
this.getTracker();if(url)
{this.pageTracker._trackPageview(url);}
else
{this.pageTracker._trackPageview();}}},trackEvent:function(category,action,label,value)
{if(this.async)
{_gaq.push(['_trackEvent',category,action,label,value]);}
else
{this.pageTracker._trackEvent(category,action,label,value);}},trackModules:function()
{if(!this.modules)
return;this.trackPageview('/t/m/'+this.modules.join(','));}}
var Y=YAHOO;var E=Y.util.Event;var R=Y.util.Region;var Dom=Y.util.Dom;var C=Y.util.Connect;if("undefined"==typeof(dont_identify_dget_function))
{var $=Dom.get;}
var axel=Math.random()+"";var ord=axel*1000000000000000000;var addEvent=E.addListener;var addListener=E.addListener;var snp_verified=false;function form_to_iframe_callback(callback)
{try
{callback();}
catch(e)
{;}}
var HpSupport={script_eval:null};var FloatingPrompt={type:'bottom',embed_id:null,container:null,html_or_url:'',default_class:'prompting_overlay',embed:function(container,html,url,type,params)
{if(!this.container)
{this.container=document.createElement('div');Dom.addClass(this.container,this.default_class);this.embed_id=Dom.generateId(this.container);document.body.appendChild(this.container);}
else
{this.container.className=this.default_class;}
if(!container.id)
{Dom.generateId(container);}
this.type=type||this.type;params=params||{};var after_cb=params.after_cb||function(){},params_arrow_style=params.arrow_style||'',timeout_remove=params.timeout_remove||100,fp_intersects=params.fp_intersects,pre_cb=params.pre_cb||function(){},ignore_arrow=params.ignore_arrow||false,class_name=params.class_name||'',forget_intersect=params.forget_intersect;if(fp_intersects)
container.setAttribute('on_hover','yes');if(params.width)
this.container.style.width=params.width+'px';if(class_name)
Dom.addClass(this.container,class_name);this.container.setAttribute('embedded_to',container.id);var floating_prompt_mouseout=function(){container.removeAttribute('on_hover');var self=this,callback=function()
{if(self.parentNode&&!container.getAttribute('on_hover')){after_cb();if(self.getAttribute('embedded_to')==container.id)
{E.removeListener(self,'mouseout');E.removeListener(self,'mouseover');self.style.display='none';}
container.removeAttribute('floating_id');}}
if(container.getAttribute('fp_intersects'))
setTimeout(callback,timeout_remove);else
callback();}
container.setAttribute('floating_id',this.embed_id);E.on(container,'mouseout',function(){this.removeAttribute('on_hover');var self=this,callback=function()
{if(Dom.get(self.getAttribute('floating_id'))&&!self.getAttribute('on_hover')){after_cb();if(Dom.get(self.getAttribute('floating_id')).getAttribute('embedded_to')==container.id)
{E.removeListener(self.getAttribute('floating_id'),'mouseout');E.removeListener(self.getAttribute('floating_id'),'mouseover');Dom.get(self.getAttribute('floating_id')).style.display='none';}
self.removeAttribute('floating_id');}}
if(container.getAttribute('fp_intersects'))
setTimeout(callback,timeout_remove);else
callback();});var arrow_style='',type_embedding='',add_xy=params.add_xy||[0,0];switch(this.type)
{case'bottom':arrow_style=' style="top:-5px;left:-14px;" ';type_embedding='right-top';break;case'top':arrow_style='';type_embedding='left-top';break;case'top-right':arrow_style='';type_embedding='right-top';break;}
arrow_style=params_arrow_style||arrow_style;if(undefined===fp_intersects&&!forget_intersect)
{var container_region=Y.util.Region.getRegion(container);container_region.left-=1;container_region.right+=1;container_region.top-=1;container_region.bottom+=1;}
if(''!=html)
{this.container.innerHTML=!ignore_arrow?this._GetContent(arrow_style,html):html;this.container.style.display='block';HPUtil.ShowNearElement(type_embedding,container,this.container,add_xy,pre_cb);if(undefined===fp_intersects&&!forget_intersect)
{var intersects=Y.util.Region.getRegion(this.container).intersect(container_region)?1:0;container.setAttribute('fp_intersects',intersects);if(intersects)
{container.setAttribute('on_hover','yes');E.on(this.container,'mouseout',floating_prompt_mouseout);E.on(this.container,'mouseover',function(){container.setAttribute('on_hover','yes');return false;});}}
else if(!forget_intersect)
{container.setAttribute('fp_intersects',fp_intersects.toString());if(fp_intersects)
{E.on(this.container,'mouseout',floating_prompt_mouseout);E.on(this.container,'mouseover',function(){container.setAttribute('on_hover','yes');return false;});}}}
else
{var me=this;C.asyncRequest('GET',url,{success:function(o){me.container.innerHTML=!ignore_arrow?me._GetContent(arrow_style,o.responseText):o.responseText;me.container.style.display='block';HPUtil.ShowNearElement(type_embedding,container,me.container,add_xy,pre_cb);if(undefined===fp_intersects&&!forget_intersect)
{var intersects=Y.util.Region.getRegion(me.contaner).intersect(container_region)?1:0;container.setAttribute('fp_intersects',intersects);if(intersects)
{container.setAttribute('on_hover','yes');E.on(me.container,'mouseout',floating_prompt_mouseout);E.on(me.container,'mouseover',function(){container.setAttribute('on_hover','yes');return false;});}}
else if(!forget_intersect)
{container.setAttribute('fp_intersects',fp_intersects.toString());if(fp_intersects)
{E.on(me.container,'mouseout',floating_prompt_mouseout);E.on(me.container,'mouseover',function(){container.setAttribute('on_hover','yes');return false;});}}},failure:function(){HPError.e();}});}},_GetContent:function(arrow_style,html)
{switch(this.type)
{case'bottom':return'<div class="btm_embed_arrow" '+arrow_style+'></div>'+html;break;case'top':case'top-right':return html+'<div class="top_embed_arrow" '+arrow_style+'></div>';break;}}}
var HPEventModule={js_main_modules_loaded:{},js_events_loaded:{},yui_version_default:'2.7.0',events_dependencies:{'slideshow_participate':{immediately:{'our':['quickslideshowparticipate','hpimagecrop']},delayed:{'yui':{'button':'default','resize':'default','imagecropper':'default','dragdrop':'default'}}},'quiz_share':{immediately:{'our':['comments']}}},modules_loaded:{},yui_modules_loaded:{},Load:function(event_name,callback,scope,args)
{scope=scope||this;args=args||[];callback=callback||(function(){});if(this.js_events_loaded[event_name])
{callback.apply(scope,args);}
else
{var me=this;this._LoadModules(event_name,function(){callback.apply(scope,args);});}},Wait:function(event_name,callback,preloading_callback,wait_for_delayed_modules,scope)
{if(preloading_callback)
{preloading_callback();}
wait_for_delayed_modules=(undefined===wait_for_delayed_modules)?true:wait_for_delayed_modules;scope=scope||this;var me=this;HPUtil.WaitForCondition.apply(scope,[function(){setTimeout(function(){callback.apply(scope);},100)},1,function(){return!wait_for_delayed_modules?me.js_main_modules_loaded[event_name]:me.js_events_loaded[event_name]}]);},_LoadModules:function(event_name,callback,type_dependencies)
{callback=callback||(function(){});type_dependencies=type_dependencies||'immediately';var events_dependencies=this.events_dependencies[event_name][type_dependencies];var loading_url='/assets/js.php?'+HPConfig.timestamp_for_clearing_js+'&f=';var needed_modules=[],module_name='';if(events_dependencies['our'])
{for(var i=0;i<events_dependencies['our'].length;++i)
{module_name=events_dependencies['our'][i];if(this.modules_loaded[module_name])
{continue;}
needed_modules[needed_modules.length]='modules/'+module_name+'.js';}}
if(events_dependencies['yui'])
{for(var module_name in events_dependencies['yui'])
{if(this.yui_modules_loaded[module_name])
{continue;}
needed_modules[needed_modules.length]='yui_'+('default'!==events_dependencies['yui'][module_name]?events_dependencies['yui'][module_name]:this.yui_version_default)+'/'+module_name+'/'+module_name+'-min.js';}}
if(needed_modules.length)
{needed_modules=needed_modules.sort();loading_url+=needed_modules.join('%2C');var me=this;var hpmodule_callback=function()
{var module_name='';for(var i=0;i<needed_modules.length;++i)
{module_name=(new RegExp(/\/(.*?)\.js$/)).exec(needed_modules[i]);if(-1!==needed_modules[i].indexOf('yui_'))
{me.yui_modules_loaded[module_name[1]]=true;}
else
{me.modules_loaded[module_name[1]]=true;}}
callback();if('immediately'==type_dependencies&&me.events_dependencies[event_name]['delayed'])
{me.js_main_modules_loaded[event_name]=1;me._LoadModules(event_name,null,'delayed');}
else
{me.js_events_loaded[event_name]=1;}}
HPUtil.loadAndRun(loading_url,hpmodule_callback);}}
};YAHOO.namespace('HPBrowser');var HPBrowser=Y.HPBrowser;HPBrowser.isAppleFirefox=function()
{if(navigator&&navigator.userAgent)
return(YAHOO.env.ua.gecko>0)&&(-1!==navigator.userAgent.toLowerCase().indexOf("macintosh"));return false;}
HPBrowser.isAppleSafari=function()
{if(navigator&&navigator.userAgent)
return E.isSafari&&(-1!==navigator.userAgent.toLowerCase().indexOf("macintosh"));return false;}
HPBrowser.isChrome=function()
{if(navigator&&navigator.vendor)
return-1!==navigator.vendor.toLowerCase().indexOf("google");return false;}
HPBrowser.isIE6=function()
{if(navigator&&navigator.userAgent)
return Y.util.Event.isIE&&/MSIE 6.0/i.test(navigator.userAgent);return false;}
HPBrowser.isIE7=function()
{if(navigator&&navigator.userAgent)
return Y.util.Event.isIE&&/MSIE 7./i.test(navigator.userAgent);return false;}
HPBrowser.isIE8=function()
{if(navigator&&navigator.userAgent)
return Y.util.Event.isIE&&/MSIE 8.0/i.test(navigator.userAgent);return false;}
YAHOO.namespace('HPError');var HPError=YAHOO.HPError;HPError.DEFAULT_ERROR='Sorry, an error occurred.  Please check your internet connection';HPError.DEBUG=0;HPError.is_error=0;HPError.setDebug=function(enable)
{if(enable)
{HuffCookies.setCookie('debug_mode','1','1');HPError.DEBUG=1;window.onbeforeunload=function(e)
{var nav_confirm='Your debug cookie is set, please confirm you want to leave the page';e=e||window.event;if(e)
e.returnValue=nav_confirm;return nav_confirm;};}
else
{HuffCookies.destroyCookie('debug_mode');HPError.DEBUG=0;window.onbeforeunload=function(){};}};if(typeof HuffCookies!='undefined'&&HuffCookies.getCookie('debug_mode'))
{HPError.setDebug(true);}
HPError.throwError=function(e,throw_alert)
{throw_alert=throw_alert||false;if(e&&typeof e!=='object')e={msg:e};if(!e)e=new Array();if(!(e.show===0))e.show=1;if(!e.msg||e.msg==this.DEFAULT_ERROR)
{e.msg=this.DEFAULT_ERROR;e.show=0;}
this.is_error=1;if(this.DEBUG)
{try{throw('Err');}catch(e){if(e.stack)
console.log('Stack:',e.stack);}
console.log('Msg: ',e.msg);if(e.obj)console.log(e.obj);}
if(e.show)
{if(throw_alert)alert(e.msg);}}
HPError.debugMessage=function(str,obj)
{if(!this.DEBUG)return false;if(!obj)obj={};if(!str)str='';HPError.e({'show':0,'msg':str,'obj':obj});}
HPError.e=HPError.throwError;HPError.d=HPError.debugMessage;YAHOO.namespace('HPDocStatus');var HPDocStatus=YAHOO.HPDocStatus;HPDocStatus.on_focus=true;HPDocStatus.setFocusHandler=function(callback)
{if(!callback)
hpcallback=function(){HPDocStatus.on_focus=true;};else
hpcallback=function(){callback();HPDocStatus.on_focus=true;};if(Y.util.Event.isIE)
window.onfocusin=hpcallback;else
YAHOO.util.Event.addListener(window,"focus",hpcallback);}
HPDocStatus.setBlurHandler=function(callback)
{if(!callback)
hpcallback=function(){HPDocStatus.on_focus=false;};else
hpcallback=function(){callback();HPDocStatus.on_focus=false;};if(Y.util.Event.isIE)
window.onfocusout=hpcallback;else
YAHOO.util.Event.addListener(window,"blur",hpcallback);}
Array.prototype.inArray=function(value){var i;for(i=0;i<this.length;i++){if(this[i]===value){return true;}}
return false;};Array.prototype.arrayPos=function(value){for(var i=0;i<this.length;i++){if(this[i]===value){return i;}}
return-1;};var Class={create:function(){return function(){this.initialize.apply(this,arguments);}}}
zeroPad=function(num,width){num=num.toString();while(num.length<width)
num="0"+num;return num;}
function isset(varname){if(typeof(window[varname])!="undefined")return true;else return false;}
var HuffPoUtil={entry_comments_for_ajax:[],commenter_name:'',images_preload:[],vote_results:{},vote_results_text:{},url_hashes:[],body_element:document.documentElement?document.documentElement:document.body,EvalScript:function(text)
{if(!text||!(/\S/.test(text))||-1===text.indexOf('<script'))
{return;}
var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement('script'),root=document.documentElement,start_pos=0,script_found_at,script_end_at,id=Dom.generateId().replace('-','');script.type="text/javascript";if(null===HpSupport.script_eval)
{try{script.appendChild(document.createTextNode("window."+id+"=1;"));}catch(e){}
root.insertBefore(script,root.firstChild);if(window[id]){HpSupport.script_eval=true;delete window[id];}
else
{HpSupport.script_eval=false;}}
text=text.replace(/document\.write/g,'');while(-1!==(script_found_at=text.indexOf('<script',start_pos)))
{script=document.createElement("script");script.type="text/javascript";script_found_at=text.indexOf('>',script_found_at+1);script_ends_at=start_pos=text.indexOf('</script>',script_found_at+1);if(HpSupport.script_eval)
script.appendChild(document.createTextNode(text.substr(script_found_at+1,script_ends_at-script_found_at-1)));else
script.text=text.substr(script_found_at+1,script_ends_at-script_found_at-1);head.insertBefore(script,head.firstChild);head.removeChild(script);}},appendScript:function(url)
{var head=document.getElementsByTagName("head")[0];var script=document.createElement('script');script.type='text/javascript';script.src=url;head.appendChild(script);},getReadableTime:function(unixtime,num_times)
{if(!num_times)num_times=2;var times=['1-second','60-minute','3600-hour','86400-day','604800-week','2592000-month','31536000-year'];var d=new Date;var curr_unixtime_ms=d.getTime();var curr_unixtime=parseInt(curr_unixtime_ms/1000);var secs=curr_unixtime-unixtime;var count=0;var time='';for(var i=7;i--;)
{data=times[i].split('-');key=data[0];value=data[1];if(secs>=key&&value!="second")
{var s="";time+=''+Math.floor(secs/key).toString();if((Math.floor(secs/key)!=1))
s="s";time+=" "+value+s;count++;secs=secs%key;if(count>num_times-1||secs==0)
{break;}
else
{if(value!="minute")time+=", ";}}}
return time;},AddStringToQueryString:function(url,params_str)
{var is_question_added=false,hash=(new RegExp(/(#.*)/)).exec(url);url=hash?url.replace(hash[1],''):url;if(-1===url.indexOf('?'))
{is_question_added=true;url+='?';}
url+=(is_question_added?'':'&')+params_str+(hash?hash[1]:'');return url;},ShowNearElement:function(position,container,element_to_show,add_xy,cb)
{var element_position=Dom.getXY(container);add_xy=add_xy||[0,0];switch(position)
{case'right-middle':element_position[0]+=container.offsetWidth;element_position[1]+=container.offsetHeight/2;break;case'right-top':element_position[0]+=container.offsetWidth;break;}
if(cb)
{cb();}
element_to_show.style.top=parseInt(parseInt(element_position[1])+add_xy[1])+'px';element_to_show.style.left=parseInt(parseInt(element_position[0])+add_xy[0])+'px';element_to_show.style.display='block';},getUrlVar:function(var_name)
{if(!this.url_hashes.length)
{var hash;var hashes=window.location.href.slice(window.location.href.indexOf('?')+1).replace(/\#.*$/,'').split('&');for(var i=0;i<hashes.length;i++)
{hash=hashes[i].split('=');this.url_hashes[hash[0]]=hash[1];}}
if(typeof(this.url_hashes[var_name])=="undefined")
{return null;}
else
{return this.url_hashes[var_name];}},ScrollTo:function(scroll_to_el,time,what_to_scroll)
{if(!Dom.get(scroll_to_el))
return;if(typeof(what_to_scroll)=="undefined"||what_to_scroll==null)
{what_to_scroll=HuffPoUtil.body_element;}
if(typeof(time)=="undefined")
{time=0.5;}
var attrs={scroll:{to:[0,Dom.getY(scroll_to_el)]}};(new YAHOO.util.Scroll(what_to_scroll,attrs,time)).animate();},CopyListeners:function(from,to)
{var listeners=E.getListeners(from);if(listeners)
{for(var i=0;i<listeners.length;++i)
{E.addListener(to,listeners[i].type,listeners[i].fn,listeners[i].obj);}}},AddSlashes:function(text)
{var return_text='',c='';for(var i=0;i<text.length;++i)
{switch(text.charAt(i))
{case'<':return_text+='\\x3C';break;case'>':return_text+='\\x3E';break;case'\'':return_text+='\\\'';break;case'\\':return_text+='\\\\';break;case'"':return_text+='\\"';break;case"\n":return_text+='\\n';break;case"\r":return_text+='\\r';break;default:return_text+=text.charAt(i);break;}}
return return_text;},getHostName:function()
{var port=document.location.port;if(!port||port==''||port==80)
{port='';}
else
{port=':'+port;}
return'http://'+document.location.hostname+port;},GetAmazonS3Location:function()
{return-1!==location.href.toLowerCase().indexOf('beta.huffingtonpost.com')?'dev.assets.huffingtonpost.com':'i.huffpost.com';},LinkifyTextLinks:function(arg)
{return arg.replace(/[a-z]+:\/\/[a-z0-9-_]+\.[a-z0-9-_:~%&\?\/.=]+[^:\.,\)\s*$]/ig,function(m){return'<a href="'+m+'">'+((m.length>25)?m.substr(0,24)+'...':m)+'</a>';});},GetEntryID:function(url){if(HPConfig.entry_id)return HPConfig.entry_id;var entry_id=null;if(!url)url=document.location.href;if((entry_id=(new RegExp(/.*huffingtonpost\.com.*_(\d+)\.html/)).exec(url)))
{return entry_id[1];}
return false;},isWWW:function(url){if(!url)url=window.location.href+'';if(url.indexOf("www")==7)return true;return false;},hide:function(id){Dom.setStyle(id,'display','none');},show:function(id,type){if(typeof(type)=="undefined")
type='block';Dom.setStyle(id,'display',type);},show_inline:function(id){Dom.setStyle(id,'display','inline');},trim:function(str,chars){return this.ltrim(this.rtrim(str,chars),chars);},ltrim:function(str,chars){chars=chars||"\\s";return str.replace(new RegExp("^["+chars+"]+","g"),"");},rtrim:function(str,chars){chars=chars||"\\s";return str.replace(new RegExp("["+chars+"]+$","g"),"");},toggleVis:function(id){Dom.batch(id,function(el){if(el.style.display=='none')el.style.display='block';else el.style.display='none';});},toggleReply:function(id){Dom.batch('reply_'+id,function(el){if(el.style.display=='none')el.style.display='block';else el.style.display='none';});},toggleTopPosts:function(caller){if(!Dom.hasClass(caller,'active'))
{HuffPoUtil.toggleVis(['top_news_links','top_blog_links']);HuffPoUtil.tradeClass('tab_top_news','tab_top_blogs','active');}},tradeClass:function(el1,el2,className)
{if(Dom.hasClass(el1,className))
{Dom.addClass(el2,className);Dom.removeClass(el1,className);}
else
{Dom.addClass(el1,className);Dom.removeClass(el2,className);}},WaitForCondition:function(action,interval,condition)
{if(!condition.apply(this))
{var _this=this;setTimeout(function(){HPUtil.WaitForCondition.apply(_this,[action,interval,condition]);},interval);}
else
{action.apply(this);}},AnimRequestFinished:function(els,from_color,to_color)
{if(undefined===els)
{els=[];}
from_color=from_color||'#F9E801';to_color=to_color||'#FFFFFF';if(0==els.length)
return;var canim=[];for(var i=0;i<els.length;++i)
{canim[canim.length]=new YAHOO.util.ColorAnim(els[i],{backgroundColor:{from:from_color,to:to_color}});canim[canim.length-1].onComplete.subscribe(function(){Dom.setStyle(this.getEl(),'background-color','transparent');});canim[canim.length-1].animate();}},AnimPagination:function(els)
{if(undefined===els)
{els=[];}
if(0==els.length)
return;var canim=[];for(var i=0;i<els.length;++i)
{canim[canim.length]=new YAHOO.util.Anim(els[i],{opacity:{from:0.2,to:1}});if(Y.util.Event.isIE)
{canim[canim.length-1].onComplete.subscribe(function(){Dom.setStyle(this.getEl(),'zoom','normal');});}
canim[canim.length-1].animate();}},getCookie:function(name){var prefix=name+'=';var c=document.cookie;var nullstring='';var cookieStartIndex=c.indexOf(prefix);if(cookieStartIndex==-1)
return nullstring;var cookieEndIndex=c.indexOf(";",cookieStartIndex+prefix.length);if(cookieEndIndex==-1)
cookieEndIndex=c.length;return unescape(c.substring(cookieStartIndex+prefix.length,cookieEndIndex));},loadAndRun:function(files,callback,param,scope){LazyLoad.load(files,callback,param,scope);return false;},trackerImg:function(url,holder_el){url=url.replace(/%n/,ord);if(holder_el){var img=new Image();img.src=url;img.width=img.height=1;img.style.display='none';try{holder_el.appendChild(img);}catch(e){return;}
return;}
document.write('<img src="'+url+'" width="1" height="1" style="display:none"/>');},checkEmail:function(email){if(email&&((email.indexOf('@')>0)&&(email.indexOf('.')>0))&&(email.indexOf('.')!=email.length-1)){return true;}
return false;},getDisplayName:function(username){if(!username)
username=HuffCookies.getUserName();var user=username.replace(/[\+_]/g,' ');var display_name=user.replace("hp blogger","HuffPost Blogger");return display_name;},flash:function(element){var flashwarn=new YAHOO.util.ColorAnim(element,{backgroundColor:{from:'#ff0000',to:'#ffffff'}});flashwarn.animate();},yellowFlash:function(element){var flashwarn=new YAHOO.util.ColorAnim(element,{backgroundColor:{from:'#F9E801',to:'#ffffff'}});flashwarn.animate();},enforceTextAreaLimit:function(e,obj){if(!obj||!obj.chars)obj={chars:100};if(this.value.length>obj.chars){HuffPoUtil.flash(this);this.value=this.value.substring(0,obj.chars);this.scrollTop=this.scrollHeight;}},reinit:function()
{HPUtil.initUserNavStatus($('n_pre_nav')?true:false);HPUtil.initUserStatus(true);SNProject.init();SNPModule.load();},initUserNavStatus:function(vert_header)
{if(typeof HuffCookies=='undefined'||!HPUtil.isWWW())return;var HC=HuffCookies;if(!HC.getUserName())return;if(HC.getSNPstatus()==1)
{Dom.addClass(document.body,'sn_signed_in');}
var this_user_profile_link=HC.getSNPstatus()?'/social/':'/users/profile/';this_user_profile_link+=encodeURIComponent(HC.getUserName());if(vert_header)
{Dom.setStyle('n_pre_nav','marginTop','-3px');HuffPoUtil.AvatarLoader.loadAvatarArticleStyle();}
else
{Dom.setStyle('pre_nav','paddingBottom','15px');}
var welcome='<a href="'+this_user_profile_link+'"';welcome+=(vert_header?' style="margin-left: 20px;"':'')+'>';welcome+='Welcome '+HPUtil.getDisplayName()+'</a>';$('wendybird_user_name').innerHTML=welcome;$('wendybird_user').style.display='block';$('not_logged_user').style.display='none';if(typeof HPTrack=='undefined')return;var rc='tmp_date_registered';var registered=HC.getCookie(rc+'');if(registered)
{HC.destroyCookie(rc+'');}
SNProject.closeLinkBar();HPUtil.resetProviderIcons();},resetProviderIcons:function()
{var HC=HuffCookies;if(!HC.getUserName())return;var mega_cookie=HC.getCookie('huffpost_prefs');for(var i=0;i<mega_cookie.length;i++)
{if(mega_cookie[i]=='y')
{Dom.setStyle(HuffCookies.userPrefs.subvalues_abbr[i]+"_social","display","none");}}
return;},initUserStatus:function(updating){if(!HPUtil.isWWW())return;if(HuffCookies.get('user_is_not_approved'))
{HuffCookies.del('user_is_not_approved');HPError.e('Your account has not yet been activated');window.location.href=window.location.href;return;}
if(HuffCookies.get('snn_track_user_logged_in')&&typeof(SNProject)!="undefined")
{SNProject.track(HuffCookies.getUserId(),'user_log_in');HuffCookies.del('snn_track_user_logged_in');}
if(HuffCookies.getSNPstatus()==1)
{Dom.addClass(document.body,'sn_signed_in');}
if(typeof(HPFB)=='undefined')return false;setTimeout(function()
{var t=new Date;t=t.getTime();t=parseInt(t/1000);var OFFSET=86400;if(HuffCookies.getLastLogin()&&HuffCookies.getLastLogin()!='')
{if(parseInt(HuffCookies.getLastLogin())+OFFSET<t)
{var baurl=HuffCookies.getBigAvatar();var saurl=HuffCookies.getSmallAvatar();if(baurl&&saurl&&baurl!=''&&saurl!='')
{if(/facebook/.test(baurl)||/fb:profile/.test(baurl))
{HPFB.ensureInit(function()
{if('connected'==HPFB.user_status)
{HPFB.getFBInfo(function(o)
{if(o)
{square_pic=o[0].pic_square_with_logo;HuffCookies.setCookie('huffpost_smallphoto',square_pic);HuffCookies.setCookie('huffpost_bigphoto',square_pic);HuffCookies.setCookie('huffpost_lastlogin',t);}});}});}}}}},15000);if(HuffCookies.getUserName()){el=$('fbook_main_text_loggedin');if(el)el.style.display="block";el=$('join_login_fbook_loggedin');if(el)el.style.display="block";el=$('fbook_main_text_name');if(el)el.innerHTML=HPUtil.getDisplayName();el=$('fConnect_img_container');if(el)el.style.display="none";}else{el=$('fbook_main_text_notloggedin');if(el)el.style.display="block";el=$('join_login_fbook_notloggedin');if(el)el.style.display="block";el=$('fConnect_img_container');if(el)el.style.display="block";}},isIE6:function()
{return HPBrowser.isIE6();},getCorrectVideoContentForIE6:function(video_code)
{if((-1!==video_code.toLowerCase().indexOf('<object'))&&(-1!==video_code.toLowerCase().indexOf('<embed')))
{video_code=video_code.substr(video_code.toLowerCase().indexOf('<embed'),video_code.toLowerCase().indexOf('</embed>')+8-video_code.toLowerCase().indexOf('<embed'));}
return video_code;},onPageReady:function(callback){var isIE=(true||(navigator.userAgent&&navigator.userAgent.match(/MSIE/)));if(isIE&&!HPBrowser.isIE8()){E.addListener(window,'load',callback);}else{E.onDOMReady(callback);}},formSetOnChange:function(form,callback){if("string"==typeof(form)){if(document.form){form=document.form;}
else{form=Dom.get(form);}}
var is_onchange_fired=false;var new_div=document.createElement('div');new_div.style.visibility='hidden';var new_form=document.createElement('form');var hidden_el=document.createElement('input');hidden_el.type='hidden';new_form.appendChild(hidden_el);new_div.appendChild(new_form);document.body.appendChild(new_div);E.on(new_form,'change',function(){is_onchange_fired=true;});if(document.createEvent){var evObj=document.createEvent('MouseEvents');evObj.initEvent("change",true,false);hidden_el.dispatchEvent(evObj);}
else if(document.createEventObject){hidden_el.fireEvent('onchange');}
new_div.parentNode.removeChild(new_div);if(!is_onchange_fired){var form_elements=form.elements;for(var i=0;i<form_elements.length;++i){E.on(form_elements[i],'change',callback);}}
else{E.on(form,'change',callback);}},init:function()
{this.trackLinks();E.on('top_nav','click',function(o)
{var link=E.getTarget(o),action='Click';if(!(link&&link.tagName&&link.tagName=='A'&&link.parentNode.className&&link.parentNode.className.match(/^n_/)))
return;E.preventDefault(o);if(HPConfig&&HPConfig.current_vertical_name)
action+=' from '+HPConfig.current_vertical_name;var link_track_as=link.title||link.innerHTML;HPTrack.trackEvent('Top Nav',action,link_track_as);if(o.ctrlKey)
window.open(link.href,'_blank');else
setTimeout('document.location = "'+link.href+'"',100);});if(this.GetEntryID())
{E.on('chicklets','click',function(e)
{var target=e.target||e.srcElement;if(!(target&&target.target&&target.target=='chicklet'&&target.title))
return true;E.preventDefault(e);var matches=/Share on (.*)/.exec(target.title);if(matches[1])
HPTrack.trackEvent('Chicklets','Click',matches[1]);window.open(target.href,'chicklet','width=642,height=436,left=0,top=0,resizable,scrollbars=yes');});}
this.initUserStatus();},AvatarLoader:{user_logged_in:(HuffCookies.getUserName()&&1==1),got_avatar_cookies:(HuffCookies.getBigAvatar()&&HuffCookies.getSmallAvatar()&&HuffCookies.getBigAvatar()!=''&&HuffCookies.getSmallAvatar()!=''),got_xfbml_avatar:(/<fb:profile-pic/.test(HuffCookies.getBigAvatar())),got_external_avatar:(!/huffingtonpost/.test(HuffCookies.getBigAvatar())),profile_pic:'avatar_logged_in',cookie_big_avatar:HuffCookies.getBigAvatar(),cookie_small_avatar:HuffCookies.getSmallAvatar(),cookie_username:HuffCookies.getUserName(),loadAvatarHomeStyle:function(base_link)
{var profile_pic_link=(HuffCookies.getSNPstatus()==1)?'/social/'+this.cookie_username:'/users/profile/'+this.cookie_username;var profile_pic=$(this.profile_pic);if(this.user_logged_in&&this.got_avatar_cookies&&typeof ad_ears_on=='undefined')
{if(this.got_external_avatar)
{profile_pic.innerHTML='<a href="'+base_link+profile_pic_link+'" id="avatar_logged_in_link"><img src="'+this.cookie_small_avatar+'" style="width:50px; height:50px;" /></a>';}else{profile_pic.innerHTML='<a href="'+base_link+profile_pic_link+'" id="avatar_logged_in_link"><img src="'+this.freshHuffPoAvatar(this.cookie_big_avatar)+'" style="width:50px; height:50px;" /></a>';}
profile_pic.style.width='50px';profile_pic.style.height='50px';if(Y.util.Event.isIE&&/MSIE 6.0/i.test(navigator.userAgent))
{$('masthead_inner').style.position='relative';var container_height=$('logo').offsetHeight;var el_height=15;if(container_height>89)
{container_height=container_height-89;el_height=el_height+container_height;}
Dom.setStyle(profile_pic,'position','absolute');Dom.setStyle(profile_pic,'right',0);Dom.setStyle(profile_pic,'top',''+el_height+'px');Dom.setStyle(profile_pic,'opacity','0.5');$('masthead_inner').appendChild(profile_pic);}
else
{Dom.setStyle(profile_pic,'top','-65px');}
Dom.setStyle(profile_pic,'float','right');Dom.setStyle(profile_pic,'display','block');}},loadAvatarArticleStyle:function()
{var profile_pic_link=(HuffCookies.getSNPstatus()==1)?'/social/'+this.cookie_username:'/users/profile/'+this.cookie_username;if(this.user_logged_in&&this.got_avatar_cookies&&typeof ad_ears_on=='undefined')
{var avatar=$('avatar_logged_in');if(!this.got_external_avatar)
{avatar.innerHTML='<a href="'+profile_pic_link+'"><img src="'+this.freshHuffPoAvatar(this.cookie_small_avatar)+'" /></a>';avatar.style.top='-10px';avatar.style.left='-23px';}
else
{avatar.innerHTML='<a href="'+profile_pic_link+'"><img src="'+this.cookie_small_avatar+'" style="width:30px; height:30px;" /></a>';avatar.style.left='-23px';}}},freshHuffPoAvatar:function(avatar_url)
{var al=HuffPoUtil.AvatarLoader;if(/\?[0-9]+$/.test(avatar_url)&&!this.got_external_avatar&&!this.got_xfbml_avatar)
{var d=new Date();var curr_month=d.getMonth();var curr_year=d.getFullYear();var curr_monthday=d.getDate();var curr_hour=d.getHours();var curr_minute=d.getMinutes();var curr_second=d.getSeconds();var suffix=''+curr_year+curr_month+curr_monthday+curr_hour+curr_minute+curr_second;return avatar_url.replace(/\?[0-9]+$/,'?'+suffix);}}},ImageLoader:{imageLoaderClass:'unloaded-image',lookAhead:300,loadFrom:'s3',timeOutId:0,handlers:[],timeOutId:0,onScrollDelay:100,onScrollDelayIE:100,_onScrollDelay:0,addHandler:function(fn)
{var il=HuffPoUtil.ImageLoader;var l=il.handlers.length;il.handlers[l]=fn;if(!il._onScrollDelay)
{if(E.isIE)
{il._onScrollDelay=il.onScrollDelayIE;}
else
il._onScrollDelay=il.onScrollDelay;}},myHandlerOnScroll:function()
{var il=HuffPoUtil.ImageLoader;if(il.timeOutId)
{clearTimeout(il.timeOutId);}
il.timeOutId=setTimeout(il.myHandler,il._onScrollDelay);},myHandler:function()
{var il=HuffPoUtil.ImageLoader;for(var i=0,l=il.handlers.length;i<l;i++)
{il.handlers[i]();}},getView:function(refresh)
{if(!this.view||refresh)
{this.view={};this.view.top=self.pageYOffset||(document.documentElement&&document.documentElement.scrollTop)||(document.body&&document.body.scrollTop);this.view.height=YAHOO.util.Dom.getViewportHeight();if(typeof HPTrack!='undefined')
{var t=HPTrack;if(!(t._furthest_scrolled&&t._furthest_scrolled>this.view.top))
t._furthest_scrolled=this.view.top;}
this.view.limit=this.view.top+this.view.height+400;if(!refresh)
{this.addHandler(function(){HuffPoUtil.ImageLoader.getView(1)});E.addListener(window,"resize",HuffPoUtil.ImageLoader.myHandlerOnScroll);E.addListener(window,"scroll",HuffPoUtil.ImageLoader.myHandlerOnScroll);}}},foldCheck:function(container_id,check_if_visible_element,add_dimensions)
{this.getView();var group={};group.id=container_id;group.imgs=YAHOO.util.Dom.getElementsByClassName(HuffPoUtil.ImageLoader.imageLoaderClass,'IMG',container_id);group.count=group.imgs?group.imgs.length:0;group.count_left=group.count;this.addHandler(function(){HuffPoUtil.ImageLoader.load(group,check_if_visible_element,add_dimensions)});this.load(group,check_if_visible_element,add_dimensions);},load:function(group,check_if_visible_element,add_dimensions)
{if(group.count_left<=0||!group.imgs)
{return true;}
if(check_if_visible_element)
{var parent_region=Dom.getRegion(group.id);if(undefined==add_dimensions)
add_dimensions=[0,0];parent_region.left+=add_dimensions[0]<0?add_dimensions[0]:0;parent_region.right+=add_dimensions[0]>0?add_dimensions[0]:0;parent_region.top+=add_dimensions[1]<0?add_dimensions[1]:0;parent_region.bottom+=add_dimensions[1]>0?add_dimensions[1]:0;var img_region=null,intersects=null;}
for(var i=0,elPos=0;i<group.count;i++)
{if(!group.imgs[i])continue;elPos=Dom.getY(group.imgs[i]);if(elPos<=this.view.limit)
{if(check_if_visible_element)
{img_region=YAHOO.util.Region.getRegion(group.imgs[i]);intersects=parent_region.contains(img_region);if(!intersects)
{continue;}}
this.fetchImage(group.imgs[i]);Dom.removeClass(group.imgs[i],'unloaded-image');group.imgs[i]=null;group.count_left--;}}
},fetchImage:function(el)
{if(el&&el.longDesc)
{if(this.loadFrom=='local'&&(url_match=/.*(images|dev.assets).huffingtonpost.com\/gen\/(\d+)\/(.*)/.exec(el.longDesc)))
{image_id=url_match[2];image_suffix=url_match[3];domain=(url_match[1]=='images')?'http://www.huffingtonpost.com':'';el.src=domain+"/imagecrop/"+this.chunk_split(image_id,2,"/")+"/"+image_id+"/"+image_suffix;}
else
{el.src=el.longDesc;}}},chunk_split:function(str,len,end)
{var i=0;var chunk_split=new String();while(i+len<str.length)
{chunk_split+=str.substring(i,i+len)+end;i+=len;}
if(i<str.length)
{chunk_split+=str.substring(i);}
return chunk_split;}
},resize:function()
{if(window.innerWidth<970)
{re=new RegExp(/.*?Netscape.(.*)/);matches=re.exec(navigator.userAgent);if(matches&&matches.length>=2&&matches[1]<7.2)
{document.body.style.margin='0';}}},showad:function()
{this.show('rightad');this.show('frontmidad');},trackLinks:function()
{E.addListener(window.document,'click',function(e){var target=E.getTarget(e);if(!(target.tagName&&target.tagName.toUpperCase()=='A'))
target=target.parentNode||target;if(!(target.tagName&&target.tagName.toUpperCase()=='A'))
return;var ref=target.href;if(target.rel=="popup")
{E.stopEvent(e);var height=430;var width=450;if(target.className=='commentpop')
height=430;if(target.className=='biolink')
width=450;var top=Math.ceil(screen.height/2)-Math.ceil(height/2);var left=Math.ceil(screen.width/2)-Math.ceil(width/2);window.open(target.href,'bio','toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=1,resizable=1,width='+width+',height='+height+',top='+top+',left='+left);return false;}
if(!ref||(ref.indexOf(window.location.href)==0)||(ref.indexOf('javascript:')>-1))
return;if(ref.indexOf('ffingtonpost.com')>-1&&typeof HPTrack!='undefined')
{if(target.onclick)
return;if(e.ctrlKey)
return;var scrolled=HPTrack._furthest_scrolled||0;var doc_height=Dom.getDocumentHeight();var viewport_height=Dom.getViewportHeight();var bottom_scroll=scrolled+viewport_height;var percent=Math.round((bottom_scroll/doc_height)*100);if(percent>100)percent=100;var margin=125;var action='';if(!scrolled)
action='Left w/o scrolling';else if(bottom_scroll>doc_height-margin)
action='Left after scrolling to bottom';else
action='Left w/o scrolling to bottom';var label='non-b-page';if(HPUtil.GetEntryID())
label='b-page';HPTrack.trackEvent('Scrolling',action,label,percent);return;}
else if(typeof HPTrack!='undefined')
{HPTrack.trackPageview("/out/?u="+ref);}});},SharePollToFacebook:function(poll_id,poll_question)
{var me=this,feedData={"name":"Take the poll - "+poll_question.replace(/&\w*;/g,' '),"caption":'{*actor*} voted: '+this.vote_results_text[poll_id].replace(/&\w*;/g,' '),"href":location.href};HPFB.waitForSession(function()
{HPFB.streamPublish('',feedData);});},vote:function(pollId){form=$('poll_form_'+pollId);requestUrl='/polls/add_stats.php?pid='+pollId;var checked=false,show_facebook=false,me=this;for(var i=0;i<form.elements.length;i++)
{if(form.elements[i].checked){requestUrl+='&responses[]='+form.elements[i].value;if(false===checked&&document.getElementById('poll_'+pollId+'_'+form.elements[i].value))
{this.vote_results_text[pollId]=document.getElementById('poll_'+pollId+'_'+form.elements[i].value).innerHTML;show_facebook=true;}
checked=true;}}
if(checked)
{C.asyncRequest('GET',requestUrl,{success:function(transport){if('DB Error'==transport.responseText)
return;var response_data=JSON.parse(transport.responseText);$('poll_'+pollId).innerHTML=response_data.html;if(response_data.last_insert_id)
{me.vote_results[pollId]=response_data.last_insert_id;if(HuffCookies.getUserName()&&me.vote_results[pollId]&&HPUtil.GetEntryID())
SNProject.track(me.vote_results[pollId],'poll_vote',HPUtil.GetEntryID());}
if(show_facebook)
{document.getElementById('fb_share_poll_results_button').style.display='block';}},failure:function(transport){alert(transport.statusText);}});}
else
alert('There are no selected poll results');},UpdateEntriesComments:function()
{if(0==HuffPoUtil.entry_comments_for_ajax.length)
return;var comments_ids_string=JSON.stringify(HuffPoUtil.entry_comments_for_ajax);C.asyncRequest('GET','/commentsv3/ajax/get_number_comments_by_entries.php?'+'entry_ids='+comments_ids_string,{success:function(transport){var response=JSON.parse(transport.responseText);if("object"!==typeof(response))
return;var changed_els=[],all_entries=[];for(var entry_id in response)
{if(Dom.get('comment_count_'+entry_id))
{changed_els[changed_els.length]='comment_count_'+entry_id;Dom.get('comment_count_'+entry_id).innerHTML=response[entry_id];}
if(Dom.get('comment_count1_'+entry_id))
{changed_els[changed_els.length]='comment_count1_'+entry_id;Dom.get('comment_count1_'+entry_id).innerHTML=response[entry_id];}
all_entries=Dom.getElementsByClassName('comment_count_'+entry_id);for(var j=0;j<all_entries.length;++j)
{changed_els[changed_els.length]=all_entries[j];all_entries[j].innerHTML=response[entry_id];}}
HPUtil.AnimRequestFinished(changed_els);},failure:function(transport){}});},number_format:function(number,decimals,dec_point,thousands_sep){var n=!isFinite(+number)?0:+number,prec=!isFinite(+decimals)?0:Math.abs(decimals),sep=(typeof thousands_sep==='undefined')?',':thousands_sep,dec=(typeof dec_point==='undefined')?'.':dec_point,s='',toFixedFix=function(n,prec){var k=Math.pow(10,prec);return''+Math.round(n*k)/k;};s=(prec?toFixedFix(n,prec):''+Math.round(n)).split('.');if(s[0].length>3){s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,sep);}
if((s[1]||'').length<prec){s[1]=s[1]||'';s[1]+=new Array(prec-s[1].length+1).join('0');}return s.join(dec);},updateContent:function(id,msg,callback){var fadeOut=new YAHOO.util.Anim(id,{opacity:{to:0}},0.5);var fadeIn=function(type,args){$(id).innerHTML=msg;var fadeIn=new YAHOO.util.Anim(id,{opacity:{to:1}},0.5);if(callback){fadeIn.onComplete.subscribe(callback);}
fadeIn.animate();};fadeOut.onComplete.subscribe(fadeIn);fadeOut.animate();}}
var TrackingData=new Object;var ViewTracker={VerticalType:-1,VerticalTypeViews:null,AddView:function(vertical_type,views)
{if(!this.VerticalTypeViews)
{this.Init();}
if(!vertical_type)vertical_type=this.VerticalType;if(!views)views=1;if(this.VerticalTypeViews[vertical_type])
{this.VerticalTypeViews[vertical_type]+=views;}
else
{this.VerticalTypeViews[vertical_type]=views;}
HuffCookies.set('huffpo_type_views',JSON.stringify(this.VerticalTypeViews),30*24);},Init:function()
{var value=HuffCookies.get('huffpo_type_views');if(value)
{this.VerticalTypeViews=JSON.parse(value);}
if(!this.VerticalTypeViews)
{this.VerticalTypeViews={};}},GetMostViewedVertical:function()
{var max=0;var vertical=-1;for(var i in this.VerticalTypeViews)
{if(parseInt(i)=='NaN')continue;if(max<this.VerticalTypeViews[i])
{max=this.VerticalTypeViews[i];vertical=i;}}
return vertical;}}
var ClickTracker={debug:false,disabled:false,trackerImg:{},blogRecentRanking:0,trackMe:function(el,o)
{if(ClickTracker.disabled)
return 1;if(ClickTracker.debug)
E.preventDefault(el);var container;el=this;for(i=0;i<6;i++)
{if(el.id&&el.id.match(/(entry|blog|recent)_\d+/))
{container=el;break;}
if(el.parentNode)
{el=el.parentNode;}}
this.trackerImg=new Image();if(container)
{eval("tdata = TrackingData."+container.id);if(!tdata)
tdata={type:'popular',entry_id:this.href.match(/(\d+).html/).pop(),blog_id:this.href.match(/_n_/)?2:3}
tdata.url=escape(this.href);if(!tdata.type)
{if(this.innerHTML.match(/read post/i))
tdata.type='read%20post';else if(this.innerHTML.match(/quick read/i))
tdata.type='in%20brief';else if(this.innerHTML.match(/Related/))
tdata.type='related';else if(this.innerHTML.match(/Comment/))
tdata.type='comments';else if(this.innerHTML.match(/bio/i))
tdata.type='bio';else if(Dom.hasClass(this.parentNode,'tag_wrap'))
tdata.type='tag';else if(this.parentNode.className=='author'||this.parentNode.className=='byline')
tdata.type='author';else if(tdata.blog_id==2&&this.firstChild&&this.firstChild.tagName=='IMG')
tdata.type='image';else if(tdata.blog_id==2)
tdata.type='headline';else if(tdata.blog_id==3&&this.parentNode.tagName&&this.parentNode.tagName=='H2')
tdata.type='headline';else if(tdata.blog_id==3&&this.parentNode.tagName&&this.parentNode.tagName=='P')
tdata.type='entry%20body';else
tdata.type='other';}
tdata.sample=ClickTracker.sample;this.trackerImg.src="/clicktracking/front.php?"+JSON.stringify(tdata);}
else
{el=this;for(i=0;i<6;i++)
{if(el.id&&!Dom.hasClass(el,'ignore_id')&&!el.id.match(/yuievtautoid/))
{container=el;break;}
el=el.parentNode;}
var tdata={url:'',type:'',id:-1,blog_id:-1,rank:-1,zone:-1,sample:ClickTracker.sample,vertical:ClickTracker.vertical_id}
tdata.url=escape(this.href);tdata.type=escape(container.id);this.trackerImg.src="/clicktracking/front.php?"+JSON.stringify(tdata);}
if(ClickTracker.debug)
{E.preventDefault(el);console.log(this.trackerImg.src);console.log(tdata);}
},trackTicker:function(tracking_url){if(ClickTracker.trackClicks)
{if(!(url_chunks=tracking_url.match(/_([nb])_(\d+)\.html/)))
window.location.href=tracking_url;blog_id=(url_chunks[1]=='n')?2:3;var tdata={url:escape(tracking_url),type:'ticker_flash',id:-1,blog_id:blog_id,rank:-1,zone:-1,vertical:ClickTracker.vertical_id}
this.trackerImg=new Image();this.trackerImg.src="/clicktracking/front.php?"+JSON.stringify(tdata);}
if(Dom.hasClass(document.body,'frontpage'))
{if(Dom.hasClass(document.body,'homepage'))
{ticker_area="front";}
else
{ticker_area=document.body.id;}}
else
{ticker_area='secondary';}
HPTrack.trackPageview("/t/a/ticker/"+ticker_area);window.location.href=tracking_url;},trackComment:function(comment_id,entry_id){this.trackerImg=new Image();this.trackerImg.src="/clicktracking/best-of.php?comment_id="+comment_id+"&entry_id="+entry_id;},deprecated_flagComment:function(comment_id,entry_id){this.trackerImg=new Image();this.trackerImg.src="/huff-send-comment.cgi?id="+comment_id+"&entry_id="+entry_id;Dom.addClass('flag_'+comment_id,'flagged');$('flag_'+comment_id).innerHTML='Flagged';},flagComment:function(comment_id,entry_id,blog_id){this.trackerImg=new Image();this.trackerImg.src="/include/flagComment.php?type=abuse&blog_id="+blog_id+"&cmt_id="+comment_id+"&entry_id="+entry_id;Dom.addClass('flag_'+comment_id,'flagged');$('flag_'+comment_id).innerHTML='Flagged';},favComment:function(comment_id,entry_id,blog_id){this.trackerImg=new Image();this.trackerImg.src="/include/flagComment.php?type=best&blog_id="+blog_id+"&cmt_id="+comment_id+"&entry_id="+entry_id;Dom.addClass('best_'+comment_id,'flagged');$('best_'+comment_id).innerHTML='Marked as favorite';SNProject.track(comment_id,'comment_favored',entry_id);},initRelatedTracker:function(){lists=Dom.getElementsByClassName("relatedposts","ul");for(var i=0;i<lists.length;i++)
{Dom.batch(lists[i].getElementsByTagName("a"),function(o){o.href='http://www.huffingtonpost.com/include/lib/RelatedTracker.php?type=related&ref='+document.URL+'&dest='+o.href;});}
lists=Dom.getElementsByClassName("topposts","ul");for(var i=0;i<lists.length;i++)
{Dom.batch(lists[i].getElementsByTagName("a"),function(o){o.href='http://www.huffingtonpost.com/include/lib/RelatedTracker.php?type=top&ref='+document.URL+'&dest='+o.href;});}},init:function(){if(!document.getElementsByTagName)return;E.addListener(document.getElementsByTagName("a"),'mousedown',ClickTracker.trackMe);}}
HuffPoUtil.onPageReady(function(){if($('huff_modal')&&document.body.id&&document.body.id!='popup')
{Modal.movePanel();E.addListener(window,"resize",Modal.sizeMask);setTimeout('Modal.movePanel()',1000);}
if($('huff_share_modal')&&document.body.id&&document.body.id!='popup')
{Modal.movePanel();E.addListener(window,"resize",Modal.sizeMask);setTimeout('Modal.movePanel()',1000);}
HuffPoUtil.init();var lottery=(ClickTracker.sample==1)?1:(Math.round(Math.random()*(ClickTracker.sample-1))==1);ClickTracker.trackClicks=(Dom.hasClass(document.body,'frontpage')&&(lottery||ClickTracker.debug));if(ClickTracker.trackClicks)
ClickTracker.init();Dom.batch(document.getElementsByTagName('UL'),function(el){if(el&&el.getElementsByTagName)
{lis=el.getElementsByTagName('LI');if(lis[0])
{Dom.addClass(lis[0],'first');Dom.addClass(lis[lis.length-1],'last');}}});lists=Dom.getElementsByClassName("widget_children","div");for(var i=0;i<lists.length;i++)
{els=lists[i].getElementsByTagName("div");wi_els=new Array();for(var j=0;j<els.length;j++){o=els[j];if(Dom.hasClass(o,'widget_item')){wi_els.push(o);}}
for(var k=0;k<wi_els.length;k++){o=wi_els[k];if(k==0)
Dom.addClass(o,'first_child');if(k==wi_els.length-1)
Dom.addClass(o,'last_child');}}
setInterval(HuffPoUtil.UpdateEntriesComments,1000*300);});var CommentManager={loadPage:function(region){el=$('comment_page_select_'+region);dest=el.options[el.selectedIndex].value;if(dest)location.href=dest;}}
HuffPoUtil.WEDGJE=function()
{getIframe=function(ad_spec)
{innerH='<iframe width="'+ad_spec.width+'" height="'+ad_spec.height+'" ';innerH+='src="'+getSource(ad_spec)+'"';innerH+=' marginheight="0" marginwidth="0" frameborder="0" scrolling="no"></iframe>'
if(this.isIE)
{return innerH;}
else
{i=document.createElement('span');i.innerHTML=innerH;return i;}};getScript=function(ad_spec)
{if(this.isIE)
{ad_spec.prefix='http://ad.doubleclick.net/adj/';innerH='<script type="text/javascript" src="'+getSource(ad_spec)+'"></script>';return innerH;}
else
{ad_spec.prefix='http://ad.doubleclick.net/adj/';s=document.createElement('script');s.type="text/javascript";s.src=getSource(ad_spec);return s;}};getQCSegs=function()
{a=HuffPoUtil.getCookie('__qseg');return(a)?a.replace(/\|{0,1}Q_/gi,';qcs=').replace(/^;/,'')+';':'';};getSource=function(ad_spec)
{if(ad_spec.prefix)
adSource=ad_spec.prefix;else
adSource="http://ad.doubleclick.net/adi/";adSource+=ad_spec.zone_info+';global=1;';adSource+=getQCSegs();if(ad_spec.interstitial&&(typeof ads_page_type!='undefined'&&ads_page_type!='big_news')&&!(document.referrer&&document.referrer.match(/.*(yahoo|aol)\.com.*/)))adSource+="dcopt=ist;";adSource+=(test_kws=location.href.match(/dc_kw\=[^\&]*/gi))?'kw='+test_kws.toString().replace(/dc_kw\=/gi,'').replace(/\,/gi,';kw=')+';':'';adSource+=(location.href.match(/beta\./))?'kw=beta;':'';adSource+=(document.referrer.match('google.com/cse'))?'ref=hp_search;':'';adSource+=(document.referrer.match('google.com/search'))?'ref=google;':'';adSource+=(navigator.userAgent.toLowerCase().match('chrome/'))?'brsr=chrome;':'';adSource+=(typeof ads_page_type!='undefined')?'page_type='+ads_page_type+';':'';adSource+=(ad_spec.kv)?ad_spec.kv:'postload=0;';adSource+="tile="+ad_spec.tile+";";adSource+="sz="+(ad_spec.sizes||(ad_spec.width+"x"+ad_spec.height))+";";adSource+="ord="+WEDGJE_ord+"?";return adSource;};getBareScript=function(ad_spec)
{if(this.isIE)
{innerH='<script type="text/javascript" src="'+ad_spec["src"]+'"></script>';return innerH;}
else
{s=document.createElement('script');s.type="text/javascript";s.src=ad_spec["src"];return s;}};ad_store={};WEDGJE_ord=Math.random();WEDGJE_ord=WEDGJE_ord*10000000000000000000;isIE=(true||(navigator.userAgent&&navigator.userAgent.match(/MSIE/)));return{double_adsense:false,ads:function(ad_name){return ad_store[ad_name];},ord:function(ad_name){return WEDGJE_ord;},debug_ad_code:function(ad_spec)
{return(location.href.toLowerCase().match('debugadcode'))?'<div style="position:relative;z-index:1000"><div style="z-index:10000;position:absolute;top:0px;left:0px;padding:5px;background-color:#e8d4f4;font-family:arial,helvetica,sans-serif;font-size:9px">'+getSource(ad_spec).replace(/\;/gi,';<br/>')+'<br/><a style="font-weight:bold;font-size:12px" target="_blank" href="/ads/test/ad_isolator.html?'+escape('<s\cript type="text/javascript" src="'+getSource(ad_spec)+'"></s\cript>')+'">See Ad In New Page</a></div></div>':'';},inline_ad:function(ad_spec)
{ad_spec.prefix='http://ad.doubleclick.net/adj/';document.write('<s\cript type="text/javascript" src="'+getSource(ad_spec)+'"></s\cript>'+this.debug_ad_code(ad_spec));},postload_ad:function(ad_spec,container_id)
{var width_str='height: '+ad_spec.height+'px; ';var height_str='width: '+ad_spec.width+'px; ';if(ad_spec.no_container)
{width_str='';height_str='';}
if(ad_spec.type=='iframe')
{ad_store[ad_spec.el_id]=getIframe(ad_spec);}else if(ad_spec.type=='script'){ad_store[ad_spec.el_id]=getScript(ad_spec);}else if(ad_spec.type=='bare'){ad_store[ad_spec.el_id]=getBareScript(ad_spec);}
if(isIE)
{if(typeof(container_id)=="undefined")
{document.write('<div style="'+height_str+width_str+'" class="'+ad_spec.class_name+'" id="'+ad_spec.el_id+'">'+ad_store[ad_spec.el_id]+'<\/div>'+this.debug_ad_code(ad_spec));}
else
{$(container_id).innerHTML='<div style="'+height_str+width_str+'" class="'+ad_spec.class_name+'" id="'+ad_spec.el_id+'">'+ad_store[ad_spec.el_id]+'<\/div>'+this.debug_ad_code(ad_spec);}}
else
{if(typeof(container_id)=="undefined")
{document.write('<div style="'+height_str+width_str+'" class="'+ad_spec.class_name+'" id="'+ad_spec.el_id+'"><\/div>'+this.debug_ad_code(ad_spec));}
else
{$(container_id).innerHTML='<div style="'+height_str+width_str+'" class="'+ad_spec.class_name+'" id="'+ad_spec.el_id+'"><\/div>'+this.debug_ad_code(ad_spec);}
setTimeout("$('"+ad_spec.el_id+"').appendChild(HuffPoUtil.WEDGJE.ads('"+ad_spec.el_id+"'));",(ad_spec.tile*200)+1);}},interstitial:true,tile:1,write:function(ad_spec,container_id)
{if(!Y.util.Event.isIE&&ad_spec.width!='234'&&container_id!='ad_advertisement'&&!(typeof ads_page_type!='undefined'&&ads_page_type=='front'&&(ad_spec.zone_info.match('comedy')||ad_spec.zone_info.match('world')))||location.href.match('postload_test'))
{ad_spec.interstitial=this.interstitial;this.interstitial=false;this.deferred_write(ad_spec,container_id);return;}
ad_spec.tile=this.tile++;if(location.href.match('no_ads')||location.href.match('nsup'))return;if(container_id)
{this.postload_ad(ad_spec,container_id)}
else
{ad_spec.interstitial=this.interstitial;this.interstitial=false;this.inline_ad(ad_spec)}},google_ads:{primed:false,counter:0,vars:{'ad_client':'pub-3264687723376607','ad_output':'js','max_num_ads':'4','ad_type':'text','feedback':'on'
},init:function()
{if(!HuffPoUtil.WEDGJE.google_ads.primed)
{HuffPoUtil.WEDGJE.google_ads.primed=true;}
HuffPoUtil.WEDGJE.google_ads.executions=HuffPoUtil.WEDGJE.google_ads.executions||[];var z=HuffPoUtil.WEDGJE.google_ads.executions.length;HuffPoUtil.WEDGJE.google_ads.executions[z]=[];for(var _name in HuffPoUtil.WEDGJE.google_ads.vars)
{HuffPoUtil.WEDGJE.google_ads.executions[z][_name]=HuffPoUtil.WEDGJE.google_ads.vars[_name];}
for(var _name in arguments[0])
{HuffPoUtil.WEDGJE.google_ads.executions[z][_name]=arguments[0][_name];}},exec:function()
{if(!HuffPoUtil.WEDGJE.google_ads.executions||!HuffPoUtil.WEDGJE.google_ads.executions[0])return;var google_skip=0;for(z=0;HuffPoUtil.WEDGJE.google_ads.executions[z];z++)
{var params='page_url---'+document.location.href+'*';for(_var in HuffPoUtil.WEDGJE.google_ads.executions[z])
{if(typeof HuffPoUtil.WEDGJE.google_ads.executions[z][_var]=='string')
{params+=_var+'---'+HuffPoUtil.WEDGJE.google_ads.executions[z][_var]+'*';}}
params=params.replace(/\*$/gi,'');iframe=document.createElement('iframe');iframe.src='/ads/google_ads_iframe_loader.html#'+escape(escape(params));iframe.style.marginTop="10px";iframe.frameBorder='0';iframe.id='iframe_'+HuffPoUtil.WEDGJE.google_ads.executions[z]['hp_dest_id'];iframe.height=1;iframe.scrolling='no';iframe.width='100%';iframe.name='adsense_iframe_'+Math.round(Math.random()*100000);adloc=document.getElementById(HuffPoUtil.WEDGJE.google_ads.executions[z]['hp_dest_id'].replace(/\"/gi,''));adloc.innerHTML='';adloc.appendChild(iframe);}
},render:function(google_ads)
{var contextual_ad_elem=document.getElementById(google_hp_dest_id);if(google_ads.length==0||!contextual_ad_elem)return;var s='<div class="adsense_left">';s+='<div class="google_links_header"><a target="_blank" href=\"'+google_info.feedback_url+'\" ><span>Ads by Google</span></a></div>';for(var i=0;i<google_ads.length;++i)
{s+=HuffPoUtil.WEDGJE.google_ads.make_link(google_ads[i]);}
s+='</div>';contextual_ad_elem.innerHTML=s;HuffPoUtil.WEDGJE.google_ads.contextual_ad_unit++;HuffPoUtil.WEDGJE.google_ads.counter+=google_ads.length;HuffPoUtil.WEDGJE.google_ads.executions.splice(0,1);HuffPoUtil.WEDGJE.google_ads.exec();},make_link:function(ad)
{var render_order=(arguments[1])?arguments[1]:['header','description','visible_url'];var google_elems={header:'<div class="link_header"><a target="_blank" href="'+ad.url+'" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to '+ad.visible_url+'\';return true">'+ad.line1+'</a></div>',description:'<div class="link_description"><span class="line2">'+ad.line2+'</span><span class="spacer">&nbsp;</span><span class="line3">'+ad.line3+'</span></div>',visible_url:'<div class="link_visible_url"><a target="_blank" href="'+ad.url+'" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to '+ad.visible_url+'\';return true"><span>'+ad.visible_url+'</a></span></div>'}
var google_code='<div class="adsense_block">';for(var a=0;a<render_order.length;a++)
{google_code+=google_elems[render_order[a]];}
google_code+='</div>';return google_code;}}};}();HuffPoUtil.PeriodicalExecute=function(o_function,period,condition_to_start,condition_to_stop){if(undefined===condition_to_start||(undefined!==condition_to_start&&condition_to_start()))
o_function.apply(this);var _this=this;if(undefined!==period&&(undefined===condition_to_stop||(undefined!==condition_to_stop&&!condition_to_stop())))
{window.setTimeout(function(){HuffPoUtil.PeriodicalExecute.apply(_this,[o_function,period,condition_to_start,condition_to_stop]);},period);}};HuffPoUtil.Strip_Tags=function(str,allowed_tags)
{var key='',allowed=false;var matches=[];var allowed_array=[];var allowed_tag='';var i=0;var k='';var html='';var replacer=function(search,replace,str){return str.split(search).join(replace);};if(allowed_tags){allowed_array=allowed_tags.match(/([a-zA-Z]+)/gi);}
str+='';matches=str.match(/(<\/?[\S][^>]*>)/gi);for(key in matches){if(isNaN(key)){continue;}
html=matches[key].toString();allowed=false;for(k in allowed_array){allowed_tag=allowed_array[k];i=-1;if(i!=0){i=html.toLowerCase().indexOf('<'+allowed_tag+'>');}
if(i!=0){i=html.toLowerCase().indexOf('<'+allowed_tag+' ');}
if(i!=0){i=html.toLowerCase().indexOf('</'+allowed_tag);}
if(i==0){allowed=true;break;}}
if(!allowed){str=replacer(html,"",str);}}
return str;};HuffPoUtil.PreloadImages=function(images){if(Y.lang.isArray(images))
for(var i=0;i<images.length;++i)
{this.images_preload[this.images_preload.length]=new Image();this.images_preload[this.images_preload.length-1].src=images[i];}
else
for(var image_src in images)
{this.images_preload[this.images_preload.length]=new Image();if(images[image_src].callback)
this.images_preload[this.images_preload.length-1].onload=images[image_src].callback;this.images_preload[this.images_preload.length-1].src=image_src;}};var HPUtil=HuffPoUtil;var Slider={Next:function(vertical)
{if(Slider.Positions[vertical]<Slider.Lengths[vertical]-1)
{Slider.Positions[vertical]++;}
else
{return false;}
Slider.LoadImage(vertical);Dom.setStyle(Dom.getElementsByClassName('slider_slide','div','slider_'+vertical),'display','none');Dom.setStyle('slider_'+vertical+"_slide_"+Slider.Positions[vertical],'display','block');if(Slider.Positions[vertical]==Slider.Lengths[vertical]-1)
{Dom.addClass('slider_right_'+vertical,'slider_off');}
Dom.removeClass('slider_left_'+vertical,'slider_off');},Previous:function(vertical)
{if(Slider.Positions[vertical]>0)
{Slider.Positions[vertical]--;}
else
{return false;}
Slider.LoadImage(vertical);Dom.setStyle(Dom.getElementsByClassName('slider_slide','div','slider_'+vertical),'display','none');Dom.setStyle('slider_'+vertical+"_slide_"+Slider.Positions[vertical],'display','block');if(Slider.Positions[vertical]==0)
{Dom.addClass('slider_left_'+vertical,'slider_off');}
Dom.removeClass('slider_right_'+vertical,'slider_off');},LoadImage:function(vertical){this_slide=$("slider_"+vertical+"_img_"+Slider.Positions[vertical]);if(this_slide&&!this_slide.src<2&&this_slide.alt)
{this_slide.src=this_slide.alt;}},Positions:new Array(),Lengths:new Array()};var bignewsUpdate={old_menu_length:0,update:function(vertical)
{var uri='/topnav/'+vertical+'.html';YAHOO.util.Connect.asyncRequest('GET',uri,{success:bignewsUpdate.Success,failure:bignewsUpdate.Fail});},Success:function(o)
{if(0==bignewsUpdate.old_menu_length)
{$('big_news_update').innerHTML=o.responseText;bignewsUpdate.old_menu_length=o.responseText.length;}
else
{if(bignewsUpdate.old_menu_length!==o.responseText.length)
{bignewsUpdate.old_menu_length=o.responseText.length;var bignews_div=document.getElementById("big_news_update");var bg_color='#fff';if(null!=$('topnav_big_news_module'))
bg_color=$('topnav_big_news_module').style.backgroundColor;if(bignews_div){anim=new YAHOO.util.ColorAnim(bignews_div,{backgroundColor:{from:'#F9E801',to:bg_color},opacity:{from:0.7,to:1}},1.5)
anim.animate();anim=null;}
$('big_news_update').innerHTML=o.responseText;}}},Fail:function(o)
{return;}};StructuredImage=Class.create();StructuredImage.prototype={initialize:function(Tag){if(!(decon=/<HH--(DEV--)?PHOTO--([A-Z\-]*)--(\d+)--HH>/.exec(Tag)))
return false;this.keywords=decon[2];this.id=decon[3];this.domain=(decon[1])?'dev.assets.huffingtonpost.com':'i.huffpost.com';this.path="http://"+this.domain+"/gen/"+this.id+"/thumbs/";},Url:function(aspect,size){return this.path+aspect+"-"+this.keywords+"-"+size+".jpg";}}
var FanSystem={becomeIdPrefix:'becomefan',updatedIdPrefix:'becomefanupdated',notificationsSaveInner:'<div style="padding:30px 20px"><strong>Your notifications preferences are saved</strong></div>',becomeFan:function(of){if(!of)return true;FanSystem.fanof_username=of.replace(/_/g," ");var fr=YAHOO.util.Connect.asyncRequest('GET','/users/becomeFan.php?of='+of+'&ajax=1',this);if(HPUtil.GetEntryID()&&typeof Comments!='undefined')
{Comments.trackEvent('Fan');}
return false;},success:function(o){if(o.responseText=='')return false;var splits=o.responseText.split(':::');if(splits[0].indexOf('updated')>=0){var userid=splits[1];var fan_success=splits[2];var fan_reason=splits[3];if(!userid)return false;SNProject.track(userid,'user_follow');FanSystem.notificationsPop(fan_success,fan_reason);return this.updateLinks(userid,fan_success,fan_reason);}else if(splits[0].indexOf('login')>=0){QuickLogin.pop();}},failure:function(o){HPError.e('Sorry, unable to process your request');},timeout:5000,updateLinks:function(userid,fan_success,fan_reason){var fan_display='block';var unfan_display='none';if(fan_success||fan_reason=='duplicate')
{fan_display='none';unfan_display='block';}
var fan_divs=Dom.getElementsByClassName('becomefan','div');var unfan_divs=Dom.getElementsByClassName('unfan','div');if(unfan_divs.length){for(var i=0,len=unfan_divs.length;i<len;i++){var splitted_id=unfan_divs[i].id.split('_');if(splitted_id[1]!=userid)
continue;Dom.setStyle(unfan_divs[i].id,'display',unfan_display);}}
if(fan_divs.length){for(var i=0,len=fan_divs.length;i<len;i++){var splitted_id=fan_divs[i].id.split('_');if(splitted_id[1]!=userid)continue;Dom.setStyle(fan_divs[i].id,'display',fan_display);}}
return true;},notificationsPop:function(fan_success,fan_reason){C.asyncRequest('GET','/users/notifications/form.php?blogger=&user='+FanSystem.fanof_username+'&ajax=1'+'&fan_success='+fan_success+'&fan_reason='+fan_reason,{success:function(o){if(/<form[^>]*>/.test(o.responseText)){var modal_params={width:595,social_logo:false};QuickSNProject.showModal(o.responseText,modal_params);$('email_alerts_preferences_form').onsubmit=FanSystem.notificationsSave;}}});},notificationsSave:function(){$('btn_save_preferences_centered').innerHTML='<img src="/images/ajax-loader.gif" alt="" />';C.setForm($('email_alerts_preferences_form'));C.asyncRequest('POST','/users/notifications/index.php?quicksave=1',{success:function(o){$('huff_snn_modal_common_inner').innerHTML=FanSystem.notificationsSaveInner;setTimeout(function(){Modal.hideMask();},2000);},failure:function(o){Modal.hideMask();},timeout:5000});return false;},onNotificationsPopFilter:function(filter){var appendFilteredResult=function(text,divWidth){var el=document.createElement('DIV');el.style.styleFloat='left';el.style.cssFloat='left';if(typeof(divWidth)!='undefined')el.style.width=divWidth+'px';el.style.border='none';el.style.padding='0';el.innerHTML=text;$('fanof_column_filtered').appendChild(el);}
$('fanof_column_filtered').innerHTML='';if(filter==''){$('fanof_column_filtered').style.display='none';$('fanof_column0').style.display='block';$('fanof_column1').style.display='block';$('fanof_column2').style.display='block';return;}
$('fanof_column0').style.display='none';$('fanof_column1').style.display='none';$('fanof_column2').style.display='none';filter='fanof_'+filter.replace(' ','_').toLowerCase();var cols={col0:$('fanof_column0'),col1:$('fanof_column1'),col2:$('fanof_column2')};for(var i in cols){els=cols[i].childNodes;for(var j=0;j<els.length;j++){if(els[j].id&&!els[j].id.toLowerCase().search(filter)){appendFilteredResult(els[j].innerHTML,165);}}}
appendFilteredResult('');$('fanof_column_filtered').style.display='block';},'ajaxRemoveRelation':function(userId,targetId,name,what)
{if(!userId||!targetId)return;if(!confirm("Are you sure you want to remove this relationship?"))return;var link_id='fan_remove_'+targetId;var el_id='fan_'+targetId;if(what=="ignored")
{link_id='ignored_remove_'+targetId;el_id='ignored_'+targetId;}
if(what=="friends")
FriendsPagination.exclude_friends_ids.push(targetId);if(what=="following")
FriendsPagination.exclude_favored_ids.push(targetId);el=$(el_id);if(!el)return;link=$(link_id);if(link)link.innerHTML='<img class="remove_fan" src="http://s.huffpost.com/images/v/spinner.gif" width="16" height="16" alt="" />';var callbacks={success:function(o){result=o.responseText.split(':::');if(result[0]=='success'){el.style.display='none';FanSystem.unfollowFeedback(name,what);}
else if(result[0]=='error'){alert(result[1]);}
else{}},failure:function(o)
{alert("Sorry but we couln't execute this unfollow action. Please try again later");}};YAHOO.util.Connect.asyncRequest('GET','/commentsv3/_removeFan.php?user_id='+userId+'&fan_id='+targetId+'&what='+what,callbacks);},'unfollowFeedback':function(name,what)
{if(!what||(what!='following'&&what!='friends'&&what!='ignored'))what='friends';if(!name)name='User';if($(what+'_feedback'))
{switch(what)
{case"ignored":var msg=name+' is no longer ignored. Changes in your fan base will be shown in 5 minutes.'
break;default:var msg=name+' is no longer followed. Changes in your fan base will be shown in 5 minutes.'
break;}
$(what+'_feedback').innerHTML=msg;$(what+'_feedback').style.display='block';}
return false;}}
function simulateClick(htmlElement)
{htmlElement=$(htmlElement);if(document.createEvent)
{var evt=document.createEvent("MouseEvents");evt.initMouseEvent('click',true,true,window,0,0,0,0,0,false,false,false,false,0,null);var canceled=htmlElement.dispatchEvent(evt);if(canceled)
{}
else
{}}
else
{var evt=document.createEventObject();htmlElement.fireEvent('onclick',evt);}}
Y.namespace('threeup');Y.threeup={items:[],curIdx:0,container:{},newTopImage:{},isMSIE:false,holdNewPress:false,findFirstChild:function(el)
{if(!el)return;for(k=0;k<el.childNodes.length;k++)
{if(el.childNodes[k].id)
{return el.childNodes[k];}}
return el.firstChild;},findLastChild:function(el)
{if(!el)return;for(k=0;k<el.childNodes.length;k++)
{if(el.childNodes[el.childNodes.length-k-1].id)
{return el.childNodes[el.childNodes.length-k-1];}}
return el.lastChild;},insertAfter:function(newElement,targetElement)
{var parent=targetElement.parentNode;if(parent.lastchild==targetElement)
{parent.appendChild(newElement);}
else
{parent.insertBefore(newElement,targetElement.nextSibling);}},left:function()
{if(this.holdNewPress)return;this.holdNewPress=true;this.curIdx-=3;if(this.curIdx<0)
{this.curIdx=this.items.length-this.curIdx;}
var lastEl='';for(var k=0;k<3;k++)
{lastEl=this.findLastChild(this.container);this.newTopImage=$("threeup_image_"+lastEl.id);if(this.newTopImage&&this.newTopImage.alt!="")
{this.newTopImage.src=this.newTopImage.alt;this.newTopImage.alt="";}
this.container.insertBefore(lastEl,this.findFirstChild(this.container));}
this.container.style.left='-906px';var an=new Y.util.Anim(this.container,{left:{from:-900,to:0}},1,Y.util.Easing.easeBoth);an.onComplete.subscribe(function(){Y.threeup.holdNewPress=false});an.animate();},right:function()
{if(this.holdNewPress)return;this.holdNewPress=true;if(this.items[this.curIdx+1])
{for(var k=0;k<3;k++)
{if("undefined"==this.items[this.curIdx+k])break;this.newTopImage=$("threeup_image_"+this.items[(this.curIdx+3+k)%this.items.length].id);if(this.newTopImage&&this.newTopImage.alt!="")
{this.newTopImage.src=this.newTopImage.alt;this.newTopImage.alt="";}}}
var an=new Y.util.Anim(this.container,{left:{from:0,to:-900}},1,Y.util.Easing.easeBoth);an.onComplete.subscribe(function(){for(var k=0;k<3;k++)
{Y.threeup.insertAfter(Y.threeup.findFirstChild(Y.threeup.container),Y.threeup.container.lastChild);}
Y.threeup.container.style.left='0px';Y.threeup.holdNewPress=false});an.animate();this.curIdx=(this.curIdx+3)%this.items.length;},init:function()
{var tmp_items=[];this.container=$('threeup_featured_content');this.items=Dom.getElementsByClassName('threeup_entries','div',this.container);isDOM=document.getElementById;isOpera=window.opera&&isDOM;Y.threeup.isMSIE=document.all&&document.all.item&&!isOpera;}};function CommonPaginator(){this.init.apply(this,arguments);};CommonPaginator.prototype={init:function(params){params=params||{};CommonPaginator.papa=this;this.moduleName=params.moduleName||'';this.maxPage=params.maxPage||0;this.callback=params.callback||function(){};this.create_page_ajax_url=params.create_page_ajax_url||function(){};this.custom_data=params.custom_data||[];this.is_circle=params.is_circle||false;this.is_custom_data=params.is_custom_data||false;this.is_ajax_update=params.is_ajax_update||false;this.is_update_current_page=(false===params.is_update_current_page)?false:true;this.is_whole_circle=params.is_whole_circle||false;this.is_ajax_eval=params.is_ajax_eval||false;this.update_images=params.update_images||false;this.custom_img_width=params.custom_img_width||74;this.custom_img_height=params.custom_img_height||54;this.custom_play_button=params.custom_play_button||false;this.currentPage=1;this.currentCustomPage=0;this.startPage=1;this.to_hide=0;this.lock=false;if(''==this.moduleName){HPError.e('You should set name of module');return false;}
if(0==this.maxPage){HPError.e('You should set maximum of pages');return false;}
E.on($('hp_'+this.moduleName+'_previous_arrow'),'click',this.Previous,this,true);E.on($('hp_'+this.moduleName+'_next_arrow'),'click',this.Next,this,true);},Previous:function(){if(this.currentPage<=this.startPage&&!this.is_circle)
return false;else if(this.currentPage<=this.startPage&&!this.is_whole_circle)
return false;if(this.lock)return false;this.lock=true;this.to_hide=this.currentPage;if(this.is_circle&&this.currentPage<=this.startPage)
this.currentPage=this.maxPage;else
this.currentPage--;if(this.is_update_current_page)
$('hp_'+this.moduleName+'_current_page').innerHTML=this.currentPage;if(this.update_images)
HuffPoUtil.ImageLoader.foldCheck('hp_'+this.moduleName+'_page_'+this.currentPage);HuffPoUtil.hide('hp_'+this.moduleName+'_page_'+this.to_hide);HuffPoUtil.show('hp_'+this.moduleName+'_page_'+this.currentPage);this.lock=false;},Next:function(){if(this.currentPage>=this.maxPage&&!this.is_circle)
return false;if(this.lock)
return false;this.lock=true;this.to_hide=this.currentPage;if(this.is_circle&&this.currentPage>=this.maxPage)
this.currentPage=this.startPage;else
this.currentPage++;if(this.is_ajax_update)
{var self=this;var url=this.create_page_ajax_url(this.currentPage);if($('hp_'+this.moduleName+'_page_'+this.currentPage))
{HuffPoUtil.hide('hp_'+this.moduleName+'_page_'+this.to_hide);HuffPoUtil.show('hp_'+this.moduleName+'_page_'+this.currentPage);if(this.update_images)
HuffPoUtil.ImageLoader.foldCheck('hp_'+this.moduleName+'_page_'+this.currentPage);if(this.is_update_current_page)
$('hp_'+this.moduleName+'_current_page').innerHTML=this.currentPage;}
else
{SNPModule.animatePage(0,'hp_'+this.moduleName+'_all_pages');$('hp_'+this.moduleName+'_main').style.background="transparent url('http://s.huffpost.com/images/loader.gif') no-repeat center top";C.asyncRequest('GET',url,{success:function(o){HuffPoUtil.hide('hp_'+self.moduleName+'_page_'+self.to_hide);$('hp_'+self.moduleName+'_all_pages').innerHTML+=o.responseText;if(self.is_ajax_eval)
HPUtil.EvalScript(o.responseText);HuffPoUtil.show('hp_'+self.moduleName+'_page_'+self.currentPage);if(self.update_images)
HuffPoUtil.ImageLoader.foldCheck('hp_'+self.moduleName+'_page_'+self.currentPage);$('hp_'+self.moduleName+'_main').style.background="";SNPModule.animatePage(1,'hp_'+self.moduleName+'_all_pages');if(self.is_update_current_page)
$('hp_'+self.moduleName+'_current_page').innerHTML=self.currentPage;},failure:function(){$('hp_'+self.moduleName+'_main').style.background="";SNPModule.animatePage(1,'hp_'+self.moduleName+'_all_pages');HPError.e('we have problems with ajax request');}});}}else if(this.is_custom_data){if($('hp_'+this.moduleName+'_page_'+this.currentPage))
{HuffPoUtil.hide('hp_'+this.moduleName+'_page_'+this.to_hide);HuffPoUtil.show('hp_'+this.moduleName+'_page_'+this.currentPage);if(this.update_images)
HuffPoUtil.ImageLoader.foldCheck('hp_'+this.moduleName+'_page_'+this.currentPage);if(this.is_update_current_page)
$('hp_'+this.moduleName+'_current_page').innerHTML=this.currentPage;}else{this.currentCustomPage+=1;HuffPoUtil.hide('hp_'+this.moduleName+'_page_'+this.to_hide);var page=document.createElement('div');page.id='hp_'+this.moduleName+'_page_'+this.currentPage;var length=this.custom_data[this.currentCustomPage].length;for(var i=0;i<length;i++)
{var main_div=document.createElement('div');main_div.className='float_left padding_5';var div_entry_img=document.createElement('div');div_entry_img.className='float_left widget_entry_img';var a_entry_img=document.createElement('a');a_entry_img.target='partners';a_entry_img.href=this.custom_data[this.currentCustomPage][i].entry_url;var img_entry_img=document.createElement('img');img_entry_img.src=this.custom_data[this.currentCustomPage][i].img_url;img_entry_img.width=this.custom_img_width;img_entry_img.height=this.custom_img_height;img_entry_img.className='img_border';var div_entry_title=document.createElement('div');div_entry_title.className='float_left arial_14 bold widget_entry_title';var a_entry_title=document.createElement('a');a_entry_title.href=this.custom_data[this.currentCustomPage][i].entry_url;a_entry_title.className='color_222222';a_entry_title.target='partners';a_entry_title.innerHTML=this.custom_data[this.currentCustomPage][i].title;if(this.custom_play_button){var div_read_more=document.createElement('div');div_read_more.style.paddingTop='2px';var a_read_more=document.createElement('a');a_read_more.className='readmore_words';a_read_more.href=this.custom_data[this.currentCustomPage][i].entry_url;img_read_more=document.createElement('img');img_read_more.src='http://s.huffpost.com/images/widgets/play_button.png';img_read_more.width=79;img_read_more.height=19;}
var div_border=document.createElement('div');if(i<2)
div_border.className='border_bottom_ccc margin_0_5 clear_first';else
div_border.className='clear_first';a_entry_img.appendChild(img_entry_img);div_entry_img.appendChild(a_entry_img);main_div.appendChild(div_entry_img);div_entry_title.appendChild(a_entry_title);if(this.custom_play_button){a_read_more.appendChild(img_read_more);div_read_more.appendChild(a_read_more);div_entry_title.appendChild(div_read_more);}
main_div.appendChild(div_entry_title);page.appendChild(main_div);page.appendChild(div_border);}
$('all_'+this.moduleName+'_pages').appendChild(page);HuffPoUtil.show('hp_'+this.moduleName+'_page_'+this.currentPage);if(this.is_update_current_page)
$('hp_'+this.moduleName+'_current_page').innerHTML=this.currentPage;}}
else
{HuffPoUtil.hide('hp_'+this.moduleName+'_page_'+this.to_hide);HuffPoUtil.show('hp_'+this.moduleName+'_page_'+this.currentPage);if(this.is_update_current_page)
$('hp_'+this.moduleName+'_current_page').innerHTML=this.currentPage;}
this.lock=false;}};var ACTIVEHISTORY={verticals:[],runstate:{bookmark:{url:null,title:null},link:null,test_elem:null,visitedlinks:[]},testlinks:{bookmarks:[{provider:'facebook',urlset:['http:\/\/facebook.com\/','http:\/\/www.facebook.com\/inbox','http:\/\/developers.facebook.com\/','http:\/\/www.facebook.com\/','http:\/\/www.facebook.com\/findfriends.php?ref_friends','http:\/\/www.facebook.com\/profile.php','http:\/\/www.facebook.com\/friends']},{provider:'twitter',urlset:['http:\/\/twitter.com\/','http:\/\/search.twitter.com\/']},{provider:'yahoo',urlset:['http:\/\/yahoo.com\/','http:\/\/www.yahoo.com\/','http:\/\/entertainment.tv.yahoo.com\/','http:\/\/games.yahoo.com\/','http:\/\/movies.yahoo.com\/','http:\/\/music.yahoo.com\/','http:\/\/omg.yahoo.com\/','http:\/\/tv.yahoo.com\/','http:\/\/video.yahoo.com\/','http:\/\/9.yahoo.com\/','http:\/\/buzz.yahoo.com\/']},{provider:'digg',urlset:['http:\/\/digg.com\/','http:\/\/www.digg.com\/','http:\/\/digg.com\/register\/','http:\/\/digg.com\/view\/technology','http:\/\/www.digg.com\/view\/technology','http:\/\/digg.com\/news','http:\/\/www.digg.com\/news','http:\/\/digg.com\/view\/science','http:\/\/www.digg.com\/view\/science','http:\/\/digg.com\/view\/world_business','http:\/\/www.digg.com\/view\/world_business','http:\/\/digg.com\/view\/sports','http:\/\/www.digg.com\/view\/sports','http:\/\/digg.com\/view\/entertainment','http:\/\/www.digg.com\/view\/entertainment','http:\/\/digg.com\/view\/gaming','http:\/\/www.digg.com\/view\/gaming','http:\/\/digg.com\/submit','http:\/\/www.digg.com\/submit']},{provider:'reddit',urlset:['http:\/\/reddit.com\/','http:\/\/reddit.com\/submit','http:\/\/programming.reddit.com\/','http:\/\/programming.reddit.com\/submit','http:\/\/science.reddit.com\/','http:\/\/science.reddit.com\/']},{provider:'buzz',urlset:['http:\/\/buzz.yahoo.com\/']}]},bookmarkdiscovery:function()
{if(location.href&&document.title){ACTIVEHISTORY.runstate.bookmark.url=location.href;ACTIVEHISTORY.runstate.bookmark.title=document.title;return true;}else{return false;}},init:function()
{ACTIVEHISTORY.runstate.test_elem=document.getElementById('linktest');if(!ACTIVEHISTORY.runstate.test_elem)
{ACTIVEHISTORY.runstate.test_elem=document.createElement('div');ACTIVEHISTORY.runstate.test_elem.id='linktest';ACTIVEHISTORY.runstate.test_elem.style.height='1px';ACTIVEHISTORY.runstate.test_elem.style.width='1px';document.body.appendChild(ACTIVEHISTORY.runstate.test_elem);}
ACTIVEHISTORY.runstate.link=document.createElement('a');ACTIVEHISTORY.runstate.link.id='test_link_check';ACTIVEHISTORY.runstate.test_elem.appendChild(ACTIVEHISTORY.runstate.link);if(ACTIVEHISTORY.runstate.link.currentStyle)
{ACTIVEHISTORY.islinkvisited=function(url)
{var link=document.createElement('a');link.href=url;ACTIVEHISTORY.runstate.test_elem.appendChild(link);var color=link.currentStyle.color;if(color=='#000000')
{ACTIVEHISTORY.runstate.test_elem.removeChild(link);return true;}
else
{ACTIVEHISTORY.runstate.test_elem.removeChild(link);return false;}}}
else
{ACTIVEHISTORY.islinkvisited=function(url)
{var link=document.createElement('a');link.href=url;ACTIVEHISTORY.runstate.test_elem.appendChild(link);var computed_style=document.defaultView.getComputedStyle(link,null);if(computed_style)
{if(computed_style.color=='rgb(0, 0, 0)')
{ACTIVEHISTORY.runstate.test_elem.removeChild(link);return true;}}
else
{ACTIVEHISTORY.runstate.test_elem.removeChild(link);return false;}}}},scan:function()
{var links=ACTIVEHISTORY.testlinks.bookmarks;for(var i=0;i<links.length;i++)
{var linktype=links[i];if(linktype.provider&&linktype.urlset)
{var provider=linktype.provider;for(var j=0;j<linktype.urlset.length;j++)
{var url=linktype.urlset[j];var found=ACTIVEHISTORY.islinkvisited(url);if(found)
{if(ACTIVEHISTORY.runstate.visitedlinks)
{ACTIVEHISTORY.runstate.visitedlinks[ACTIVEHISTORY.runstate.visitedlinks.length]=provider;break;}}
url=found=null;}
provider=null;}
linktype=null;}
links=null;ACTIVEHISTORY.runstate.test_elem.innerHTML='';},checkCurtain:function()
{if(!Array.indexOf)
{Array.prototype.indexOf=function(obj){for(var i=0;i<ACTIVEHISTORY.runstate.visitedlinks.length;i++){if(this[i]==obj){return i;}}
return-1;}}
if(ACTIVEHISTORY.verticals.length<1)
{ACTIVEHISTORY.verticals=["entertainment","comedy","green","chicago","business","style","living","world"];}
for(var i=0;i<ACTIVEHISTORY.verticals.length;i++)
{if(0<=ACTIVEHISTORY.runstate.visitedlinks.indexOf(ACTIVEHISTORY.verticals[i]))
{uri='/promos/'+ACTIVEHISTORY.verticals[i]+'/curtain.html';YAHOO.util.Connect.asyncRequest('GET',uri,{success:function c_success(o){$('main_curtain_container').innerHTML=o.responseText;if(!HuffCookies.get("huffpost_curtain"))
{HuffPoUtil.show('main_curtain_container');}
else
{$("main_curtain_container").innerHTML='';}},failure:function c_fail(){return;}});break;}}},run:function()
{if(ACTIVEHISTORY.bookmarkdiscovery())
{ACTIVEHISTORY.init();ACTIVEHISTORY.scan();}}};var CurtainModule={collapse:function(){$("main_container").style.display="none";HuffCookies.set('huffpost_curtain',1);}}
function createIframe(prnt,wd,ht,frmurl){var iframe=document.createElement("iframe");if(prnt){if(wd)iframe.style.width=wd+"px";if(ht)iframe.style.height=ht+"px";iframe.style.border="0px";iframe.setAttribute("frameBorder","0");iframe.style.overflow="hidden";iframe.scrolling="no";if(frmurl)iframe.src=frmurl;prnt.appendChild(iframe);}else{iframe.style.position="absolute";iframe.style.visibility="hidden";document.body.appendChild(iframe);}
if(iframe.contentDocument)iframe.doc=iframe.contentDocument;else if(iframe.contentWindow)iframe.doc=iframe.contentWindow.document;iframe.doc.open();iframe.doc.write('<style>');iframe.doc.write("a{color: #000000; display:none;}");iframe.doc.write("a:visited {color: #FF0000; display:inline;}");iframe.doc.write('</style>');iframe.doc.close();return iframe;}
function chart_showImage(img_type,elem_id){url="http://markets.on.nytimes.com/research/tools/builder/api.asp?sym=$"+
img_type+
"&duration=1&chartstyle=Home&w=337&h=255&display=lineclip";img_elem=document.getElementById(elem_id);img_elem.src=url;}
var prev_anchor=false;load_blogrolls=function(vertical,div_elem){if(prev_anchor){Dom.replaceClass(prev_anchor,"blogroll_tab_anchor","blogroll_tab_anchor_visited");}
if(vertical!="home"){var anchor=document.getElementById("blogroll_tab_"+vertical);Dom.replaceClass(anchor,"blogroll_tab_anchor_visited","blogroll_tab_anchor");prev_anchor="blogroll_tab_"+vertical;}
div_elem=div_elem||"blogroll";cb_onSuccess=function(o){var html_text=o.responseText;var elem=o.argument;var div_to_mod=document.getElementById(elem);var elements=Dom.getElementsByClassName("link_list_wrapper","div");for(i=0;i<elements.length;i++){div_to_mod.removeChild(elements[i]);}
div_to_mod.innerHTML=html_text;}
cb_onFailure=function(o){return 1;}
C.asyncRequest('GET',"/blogrolls.php?vertical="+vertical,{success:cb_onSuccess,failure:cb_onFailure,argument:div_elem});}
function threeup_js(vertical_name,entry_id,threeup_version)
{var callback={success:function(o){$("threeup_featured_content").innerHTML=o.responseText;Y.threeup.init()},failure:function(o){return;}};var url='/threeup.php?threeup=yes&VerticalName='+vertical_name+'&entry_id='+entry_id+'&v='+threeup_version;var currentTime=new Date();var co=YAHOO.util.Connect.asyncRequest('GET',url+'&h='+currentTime.getHours(),callback);}
function Paginator(config){if(!config.hasOwnProperty('paginator_id'))
return;if(!config.hasOwnProperty('name'))
return;if(!config.hasOwnProperty('entry_class'))
return;if(!config.hasOwnProperty('entries_id'))
return;if(!config.hasOwnProperty('entries_per_page'))
this.entries_per_page=5;this.entries_id=config.entries_id;this.paginator_id=config.paginator_id;this.name=config.name;this.entry_class=config.entry_class;this.entries_per_page=this.entries_per_page?this.entries_per_page:config.entries_per_page;this.entries=Dom.getElementsByClassName(this.entry_class);this.entries_tmp=[];var div=document.createElement('div');for(var i=0;i<this.entries.length;i++){if(this.entries[i]){var div=document.createElement('div');div.appendChild(this.entries[i]);this.entries_tmp.push(div.innerHTML);}}
this.BuildPaginator=BuildPaginator;this.RenderPage=RenderPage;this.UpdateFadeInOut=UpdateFadeInOut;;this.RenderPage(1);Dom.setStyle(this.entries_id,'display','block');function RenderPage(page){var ftw=(page-1)*this.entries_per_page;var ltw=ftw+this.entries_per_page-1;var html='';for(var c=ftw;c<=ltw;c++)
{if(this.entries_tmp[c]){html+=this.entries_tmp[c];}}
this.UpdateFadeInOut(this.entries_id,html);var paginator=this.BuildPaginator(page);Dom.get(this.paginator_id).innerHTML=paginator;}
function BuildPaginator(page){var pagination='Pages: ';var epsilon=5;var per_page=this.entries_per_page;var total=this.entries_tmp.length;if(1<(page-epsilon)){pagination+='<a href="javascript:'+this.name+'.RenderPage(1);">1</a> ';if(1<(page-epsilon-1)){pagination+='... ';}}
var pages=Math.ceil(total/per_page);var first=page-epsilon;if(first<1){first=1;}
var last=page+epsilon;if(last>pages){last=pages;}
for(var i=first;i<=last;i++){var p=(i-1)*4;if(i==page){pagination+=i+' ';}else{pagination+='<a href="javascript:'+this.name+'.RenderPage('+i+');">'+i+'</a> ';}}
if((page+epsilon)<pages){if((page+epsilon+1)<pages){pagination+='... ';}
pagination+='<a href="javascript:'+this.name+'.RenderPage('+pages+');">'+pages+'</a> ';}
return pagination;}
function UpdateFadeInOut(id,msg)
{var fadeOut=new YAHOO.util.Anim($(id),{opacity:{to:0}},0.5);var fadeIn=function(type,args){$(id).innerHTML=msg;var fadeIn=new YAHOO.util.Anim($(id),{opacity:{to:1}},0.5);fadeIn.animate();};fadeOut.onComplete.subscribe(fadeIn);fadeOut.animate();}}
def_ifr={store:[],load_ifr:function(ifr_id)
{var ifr_elem=document.getElementById(ifr_id);if(!ifr_elem)
{return;}
new_ifr=document.createElement('IFRAME');new_ifr.scrolling='no';new_ifr.frameBorder='0';new_ifr.marginBottom='0';new_ifr.marginHeight='0';new_ifr.width=ifr_elem.style.width.split('px')[0];new_ifr.height=ifr_elem.style.height.split('px')[0];new_ifr.id=ifr_id+'_iframe';new_ifr.name=ifr_id+'_iframe';ifr_elem.appendChild(new_ifr);new_ifr=ifr_elem.childNodes[0];new_ifr.setAttribute('src',ifr_elem.getAttribute('def_src'));},init:function(ifr_id)
{if(E.DOMReady)
{def_ifr.load_ifr(ifr_id);}
else
{def_ifr.store.push(ifr_id);}},_exec:function()
{for(var a=0;def_ifr.store[0];a=0)
{def_ifr.load_ifr(def_ifr.store[a]);def_ifr.store.shift();}}};HPUtil.onPageReady(def_ifr._exec);HuffPoUtil.WEDGJE.deferred_write=function(ad_spec,container_id)
{ad_spec.tile=this.tile++;if(location.href.match('no_ads')||location.href.match('nsup'))return;var width_str='height: '+ad_spec.height+'px; ';var height_str='width: '+ad_spec.width+'px; ';if(ad_spec.no_container)
{width_str='';height_str='';}
ad_spec.type='script';ad_spec.kv='postload=1;';isIE=true;if(ad_spec.type=='iframe')
{ad_store[ad_spec.el_id]=getIframe(ad_spec);}else if(ad_spec.type=='script'){ad_store[ad_spec.el_id]=getScript(ad_spec);}else if(ad_spec.type=='bare'){ad_store[ad_spec.el_id]=getBareScript(ad_spec);}
if(typeof(container_id)=="undefined")
{document.write('<div style="'+height_str+width_str+'" class="'+ad_spec.class_name+'" id="'+ad_spec.el_id+'"><\/div>'+this.debug_ad_code(ad_spec));}
else
{$(container_id).innerHTML='<div style="'+height_str+width_str+'" class="'+ad_spec.class_name+'" id="'+ad_spec.el_id+'"><\/div>'+this.debug_ad_code(ad_spec);}
HuffPoUtil.WEDGJE.ad_renders.push(function(){document.write('<div id="defer-'+ad_spec.el_id+'">'+ad_store[ad_spec.el_id]+'<\/div>');(function(){var defer_node=$('defer-'+ad_spec.el_id);if(!defer_node)
{setTimeout(arguments.callee,100);return;}
defer_node.parentNode.removeChild(defer_node);$(ad_spec.el_id).appendChild(defer_node);})();});}
HuffPoUtil.WEDGJE.ad_renders=[];var HPAds={ad_store:[],ad_capchecked:false,ad_cap:'n',snpmodule_skin:false,homepage_trailer:{},ad_check_savecookie:function()
{var cn='huffpost_adssale';if(this.ad_capchecked)
{return;}
var cval=HuffCookies.getCookie(cn);if(cval=='y')
{HuffCookies.setCookie(cn,'n',12);this.ad_cap='y';}
else if(cval=='n')
{this.ad_cap='n';}
else
{HuffCookies.setCookie(cn,'y',-1);}
this.ad_capchecked=true;},ad_store_push:function(ad_position_name,ad_type,ad_container_width,ad_content,defer,ad_positioned_callback,slug)
{HPAds.ad_store[ad_position_name]={'ad_type':ad_type,'ad_container_width':ad_container_width,'ad_content':ad_content,'defer':defer,'positioned_callback':ad_positioned_callback,'slug':slug};},homepage_trailer_add:function(id,video_params,caller,exec)
{if(HPAds.homepage_trailer[id])
{HPAds.homepage_trailer[id].video_params=video_params;}
if(exec){QV.popHomepageTrailer(id,caller)}},ads_client_side_qvs:function()
{src_params='';var a=false;var cn='__qseg=';var c=document.cookie;var csi=c.indexOf(cn);if(csi!=-1)
{if((cei=c.indexOf(';',csi+cn.length))==-1)
{cei=c.length;}
a=unescape(c.substring(csi+cn.length,cei));}
if(HuffCookies.getSNPstatus()=='1')
{src_params+='snn=y;';}
this.ad_check_savecookie();src_params+='cap_12='+this.ad_cap+';';src_params+=(a?a.replace(/\|{0,1}Q_/gi,';qcs=').replace(/^;/,'')+';':'');return src_params;},timeout_store:{},ad_move_to_place:function(spot_name,post_load)
{var spot=HPAds.ad_store[spot_name];var type=spot.ad_type;var width=spot.ad_container_width;if('by_request'==type&&!post_load&&!spot.defer)
{HPAds.ad_reload(spot_name);}
else if('dom_move'==type&&!post_load)
{document.getElementById('ad_'+spot_name).innerHTML='';document.getElementById('ad_'+spot_name).appendChild(document.getElementById('ad_store_'+spot_name));YAHOO.util.Dom.removeClass('ad_store_'+spot_name,'ad_store');}
else if('css_positioned'==type)
{var adCont=document.getElementById('ad_store_'+spot_name);if(adCont.clientHeight>59)
{var im=document.createElement('IMG');im.src='/images/spacer.gif';im.width=adCont.clientWidth;im.height=adCont.clientHeight;Dom.setStyle(im,'margin','0');Dom.setStyle(im,'padding','0');var posCont=document.getElementById('ad_'+spot_name);if(posCont.hasChildNodes()){posCont.removeChild(posCont.firstChild);}
document.getElementById('ad_'+spot_name).appendChild(im);var placeholder_position=YAHOO.util.Dom.getXY(im);var wrapper_horiz_offset=YAHOO.util.Dom.getXY(document.getElementById('wrapper'))[0];var wrapper_vert_offset=YAHOO.util.Dom.getXY(document.getElementById('wrapper'))[1];adCont.style.top=parseInt(parseInt(placeholder_position[1])-wrapper_vert_offset)+'px';adCont.style.left=parseInt(parseInt(placeholder_position[0]-wrapper_horiz_offset))+'px';YAHOO.util.Dom.removeClass(adCont,'ad_store');adCont.style.visibility='visible';adCont.style.position='absolute';if(HPAds.timeout_store[spot_name])
{clearInterval(HPAds.timeout_store[spot_name].interval);}}
else if(!HPAds.timeout_store[spot_name])
{HPAds.timeout_store[spot_name]={'interval':setInterval(function(){HPAds.ad_move_to_place(spot_name);},200),'attempt':1}}
else if(HPAds.timeout_store[spot_name].attempt<12)
{HPAds.timeout_store[spot_name].attempt++;}
else
{clearInterval(HPAds.timeout_store[spot_name].interval);HPAds.timeout_store[spot_name]=null;HPAds.ad_store[spot_name]=null;var store_to_clear=document.getElementById('ad_store_'+spot_name);var x=store_to_clear.parentNode;x.removeChild(store_to_clear);}}},ad_store_move_to_place:function(post_load)
{var AS=HPAds.ad_store;for(i in AS)
{if(AS[i])HPAds.ad_move_to_place(i,post_load);}},ad_reload:function(spot_name,ad_holder_id)
{if(!ad_holder_id||ad_holder_id=='')ad_holder_id='ad_'+spot_name;var holder_el=document.getElementById(ad_holder_id);if(holder_el&&HPAds.ad_store[spot_name]){var ad_content=HPAds.ad_store[spot_name].ad_content;var ord=parseInt(Math.random()*1000000000000000);if(/ajax_ord=/i.test(ad_content)){ad_content=ad_content.replace(/ajax_ord=\d*;/ig,'ajax_ord='+ord+';');}
else{ad_content=ad_content.replace(/ord=/ig,'ajax_ord='+ord+';ord=');}
if(HPAds.ad_store[spot_name].slug){holder_el.className=holder_el.className+' ad_wrapper_'+HPAds.ad_store[spot_name].slug;}
holder_el.innerHTML=ad_content;}},ad_check_handlers:{referer:function(params)
{return(document.referrer.search(params)>=0);}},ad_check_wrapper:function(handler,params)
{if(typeof(this.ad_check_handlers[handler])!='undefined')
{return this.ad_check_handlers[handler](params);}
else
return true;}}
function showWebsliceIcons(){var show_webslice_icon=1;if(HPBrowser.isIE8()&&show_webslice_icon=='1'){var icons=YAHOO.util.Dom.getElementsByClassName('webslice_icons');for(var len=icons.length;len--;){icons[len].style.display='inline';}}}
function insertBadgesInContainer(holder_id,params){var div=$(holder_id);if(!div)return false;if(undefined==params)return false;if(undefined==params.entry_id)return false;if(undefined==params.entry_url)return false;if(undefined==params.entry_title)return false;if(undefined==params.entry_vertical)return false;params.css_style=params.css_style||'standard';div.innerHTML="<!-- JS Badge layout is: 1 -->";if(typeof(document.unique_badge_sequencer)=="undefined"){document.unique_badge_sequencer=1;}
var tmpDate=new Date;var badge_id=tmpDate.getTime()+"_"+document.unique_badge_sequencer;var badge_object_name="Badges_"+badge_id;document.unique_badge_sequencer++;document[badge_object_name]=new Badges({unique_id:badge_id,holder_id:holder_id,entry_params:{"id":params.entry_id,"url":params.entry_url,"title":params.entry_title,"vertical_name":params.entry_vertical,"tweet_comm_hash":"","tweet_comm_text":""},global_name:"document."+badge_object_name});document[badge_object_name].setPanelBorderStyle(params.css_style);document[badge_object_name].setSlices({1:"facebook",2:"retweet",3:"comments"});document[badge_object_name].start();}
function getVertical(switching,element){if(element=='INPUT'||element=='TEXTAREA')
{return false;}
var viewWidth=window.innerWidth||document.documentElement.clientWidth;if(viewWidth<990||typeof viewWidth=='undefined')
return false;var vertical_url,el;switch(switching){case"prev":if(HPConfig.current_vertical_name=='homepage'){el=Dom.getLastChild($('topnav_second_ul'));}else if(HPConfig.current_vertical_name=='technology'){el=Dom.getLastChild($('topnav_first_ul'));}else{el=Dom.getPreviousSibling($('li_'+HPConfig.current_vertical_name));}
el=el.firstChild;vertical_url=el.href;break;case"next":if(HPConfig.current_vertical_name=='blogger_index'){el=Dom.getFirstChild($('topnav_first_ul'));if(el.id=='all_social_buttons')
el=Dom.getNextSibling(el);}else if(HPConfig.current_vertical_name=='food'){el=Dom.getFirstChild($('topnav_second_ul'));}else{el=Dom.getNextSibling($('li_'+HPConfig.current_vertical_name));}
el=el.firstChild;vertical_url=el.href;break;}
if(typeof vertical_url!='undefined')
window.location=vertical_url;};function getBNPage(switching,element){if(element=='INPUT'||element=='TEXTAREA')
{return false;}
if(HPConfig.current_vertical_name=='video'||HPConfig.current_vertical_name=='blogger_index')
{getVertical(switching);return false;}
if(HPConfig.slideshow_type=='pollajax'){switch(switching){case"prev":window["oSlideshowPollAjax_"+HPConfig.slideshow_id].prev();break;case"next":window["oSlideshowPollAjax_"+HPConfig.slideshow_id].next();break;}
return false;}
else if(HPConfig.slideshow_type=='fullscreen'){switch(switching){case"prev":if(!window.slideshow_fullscreen){window["FullScreen_"+HPConfig.slideshow_id].openSlideShow();return false;}
window["FullScreen_"+HPConfig.slideshow_id].prevPhoto();break;case"next":if(!window.slideshow_fullscreen){window["FullScreen_"+HPConfig.slideshow_id].openSlideShow();return false;}
window["FullScreen_"+HPConfig.slideshow_id].nextPhoto();break;case"esc":if(window.slideshow_fullscreen){window["FullScreen_"+HPConfig.slideshow_id].closeSlideShow();return;}
break;case"fullscreen":if(!window.slideshow_fullscreen){window["FullScreen_"+HPConfig.slideshow_id].openSlideShow();return;}
break;case"up":E.removeListener(document.body,"mousemove");HPUtil.show('fs_page_layout_'+HPConfig.slideshow_id);break;case"down":E.on(document.body,'mousemove',window["FullScreen_"+HPConfig.slideshow_id].showPageLayout,null,window["FullScreen_"+HPConfig.slideshow_id]);HPUtil.hide('fs_page_layout_'+HPConfig.slideshow_id);break;}
return false;}
uri='/ajax/common/get_next_prev_entry_url.php?eid='+HuffPoUtil.GetEntryID()+'&sw='+switching+'&bid='+HPConfig.blog_id+'&v='+HPConfig.current_vertical_name;YAHOO.util.Connect.asyncRequest('GET',uri,{success:function(o){if(o.responseText!='')
window.location=o.responseText;},failure:function(){return;}});};HPUtil.ExtTracking={Nielsen:function(type)
{var d=new Image(1,1);d.onerror=d.onload=function()
{d.onerror=d.onload=null;};var ts_value="ts=compact";if(type&&type=='ajax')
ts_value="c0=usergen,1";d.src=["//secure-us.imrworldwide.com/cgi-bin/m?ci=us-703240h&cg=0&cc=1&si=",escape(window.location.href),"&rp=",escape(document.referrer),"&",ts_value,"&rnd=",(new Date()).getTime()].join('');}};HPUtil.onPageReady(showWebsliceIcons);var TwitterUtil={elapsedTime:function(created_at,need_ie_fix)
{var date=created_at;var ageInSeconds;if(need_ie_fix){date=this.fixDate(date);ageInSeconds=(new Date().getTime()-new Date(date).getTime())/1000;if(isNaN(ageInSeconds)){ageInSeconds=(new Date().getTime()-new Date(created_at).getTime())/1000;}}else{ageInSeconds=(new Date().getTime()-new Date(created_at).getTime())/1000;}
var s=function(n){return n==1?'':'s';};if(ageInSeconds<60){return'less than a minute ago';}
if(ageInSeconds<60*60){var n=Math.floor(ageInSeconds/60);return n+' minute'+s(n)+' ago';}
if(ageInSeconds<60*60*24){var n=Math.floor(ageInSeconds/60/60);return n+' hour'+s(n)+' ago';}
if(ageInSeconds<60*60*24*7){var n=Math.floor(ageInSeconds/60/60/24);return n+' day'+s(n)+' ago';}
if(ageInSeconds<60*60*24*31){var n=Math.floor(ageInSeconds/60/60/24/7);return n+' week'+s(n)+' ago';}
if(ageInSeconds<60*60*24*365){var n=Math.floor(ageInSeconds/60/60/24/31);return n+' month'+s(n)+' ago';}
var n=Math.floor(ageInSeconds/60/60/24/365);return n+' year'+s(n)+' ago';},fixDate:function(d)
{if(Y.util.Event.isIE)
{var a=d.split(' ');var year=a.pop();return a.slice(0,3).concat([year]).concat(a.slice(3)).join(' ');}
else
return d;},linkifyTextLinks:function(arg)
{return arg.replace(/[a-z]+:\/\/[a-z0-9-_]+\.[a-z0-9-_:~%&\?\/.=]+[^:\.,\)\s*$]/ig,function(m){return'<a href="'+m+'" target="_blank">'+((m.length>25)?m.substr(0,24)+'...':m)+'</a>';});},twittify:function(tweet_text){var at=function(t){return t.replace(/(^|[^\w]+)\@([a-zA-Z0-9_]{1,15})/g,function(m,m1,m2){return m1+'<a href="http://twitter.com/'+m2+'" target="_blank" class="twitter-anywhere-user">'+'@'+m2+'</a>';});};var hash=function(t){return t.replace(/(^|[^\w'"]+)\#([a-zA-Z0-9_]+)/g,function(m,m1,m2){return m1+'#<a href="http://search.twitter.com/search?q=%23'+m2+'" target="_blank">'+m2+'</a>';});};return hash(at(this.linkifyTextLinks(tweet_text)));},arrayChunk:function(startArr,chunkSize){chunkSize=parseInt(chunkSize,10);chunkSize=isNaN(chunkSize)||!chunkSize?1:chunkSize;var base=[];var startArr_len=startArr.length;for(var i=0;i<startArr_len;i+=chunkSize){base.push(startArr.slice(i,i+chunkSize));}
return base;},ucwords:function(str){str=str||'';return str.toLowerCase().replace(/\w+/g,function(s){return s.charAt(0).toUpperCase()+s.substr(1);});}};
Y.namespace('modal');var Modal=Y.modal;Y.namespace('QuickLogin');var QuickLogin=Y.QuickLogin;Y.namespace('FanAction');var FanAction=Y.FanAction;Y.namespace('QuickSubscribeUser');var QuickSubscribeUser=Y.QuickSubscribeUser;Y.namespace('QuickSignup');var QuickSignup=Y.QuickSignup;Y.namespace('QuickFan');var QuickFan=Y.QuickFan;Y.namespace('QuickSNProject');var QuickSNProject=Y.QuickSNProject;Y.namespace('QuickHuffListContribute');var QuickHuffListContribute=Y.QuickHuffListContribute;Y.namespace('UserPoll');var UserPoll=Y.UserPoll;Modal.hideMaskCustom=new Array();Modal.showMaskCustom=new Array();Modal.ShowCommonHpLightbox=function(data)
{//@todo show loading lightbox
E.onAvailable('hp_vertical_common_lightbox',function(data)
{data=data.data||{};if(data.title)
{Dom.getElementsByClassName('hp_common_message','div','hp_vertical_common_lightbox')[0].getElementsByTagName('span')[0].innerHTML=data.title;}
if(data.vertical)
{Dom.getElementsByClassName('close_modal','a','hp_vertical_common_lightbox')[0].getElementsByTagName('img')[0].src='/images/modal/close-'+data.vertical+'.gif';Dom.addClass(Dom.getElementsByClassName('modal_inner','div','hp_vertical_common_lightbox')[0],data.vertical+'_modal_inner');}
Modal.id='hp_vertical_common_lightbox';Modal.setPosition();Modal.showMask(Modal.id);},{data:data},true,true);}
Modal.SetWideFormat=function()
{Dom.getElementsByClassName('modal_inner')[0].className+=' wide_popup';}
Modal.SetHtml=function(html,callback)
{E.onAvailable('hp_vertical_common_lightbox',function(data)
{var content_containers=Dom.getElementsByClassName('content','div',Modal.id);if(content_containers.length)
{content_containers[0].innerHTML='<div id="sf_ad_block_'+Modal.id+'" class="ad_block ad_wide_top floatright"></div>'+data.html;if(typeof(callback)=='function')
{callback(content_containers[0]);}}
else
{HPError.e('There\'s no container with class content');}},{html:html},true,true);}
Modal.buildMask=function()
{if(!this.mask){this.mask=document.createElement("DIV");this.mask.id="wrapper_mask";this.mask.className="mask";this.mask.style.zIndex="887";this.mask.innerHTML="&nbsp;";var firstChild=document.body.firstChild;if(firstChild){document.body.insertBefore(this.mask,document.body.firstChild);}else{document.body.appendChild(this.mask);}}};Modal.hideMask=function(params){params=params||false;var show_qr_ad=false;var show_mask=false;if(params){show_qr_ad=params.show_qr_ad||false;show_mask=params.show_mask||false;}
if(Modal.mask){if(Modal.hideMaskCustom.length)
{for(var i=0;i<Modal.hideMaskCustom.length;i++)
{Modal.hideMaskCustom[i]();}}
this.mask=Modal.mask
var tmp_modal_id='huff_modal';if(typeof(Modal.id)!="undefined")
{tmp_modal_id=Modal.id;delete Modal.id;}
YAHOO.util.Dom.setStyle(tmp_modal_id,'visibility','hidden');if(!show_mask)
{Modal.mask.style.display="none";YAHOO.util.Dom.removeClass(document.body,"masked");}}
if($('qr_ad')&&!show_qr_ad)
{$('qr_ad').innerHTML='';}
if($('snn_qr_ad'))
{$('snn_qr_ad').style.display="none";}
if($('qr_frame'))
{$('qr_frame').src='';}
if($('ad_im'))
{$('ad_im').innerHTML='';}
if($('ad_email'))
{$('ad_email').innerHTML='';}
if($('ad_300_250_1'))
{HuffPoUtil.show('ad_300_250_1');}
Modal.HideEmbed();if(!show_mask)
{Modal.ShowEmbed('object:not(div.content object), embed:not(div.content embed)');}
Modal.restoreDefaults();};Modal.setWidth=function(width){var outer=$(Modal.id);if(outer){outer.style.width=width+'px';outer.style.marginLeft='-'+(width/2)+'px';}
var inner=$('huff_snn_modal_common_inner');if(inner)
{inner.style.width=width+'px';}}
Modal.restoreDefaults=function(width)
{width=width||400;el=$('huff_modal_common_inner');el.innerHTML='Your request is being processed...';Modal.setWidth(width);}
Modal.setMaskListener=function(fn)
{var listener_function=((typeof(fn)=="function")?fn:Modal.hideMask);E.removeListener("wrapper_mask","click");E.addListener("wrapper_mask",'click',listener_function);}
Modal.showMask=function(modal_id){if(!this.mask)
{Modal.buildMask();Modal.movePanel();}
if(this.mask)
{var tmp_modal_id='huff_modal';if(typeof(modal_id)!="undefined")
{Modal.id=modal_id;tmp_modal_id=modal_id;}
if(Modal.showMaskCustom.length)
{for(var i=0;i<Modal.showMaskCustom.length;i++)
{Modal.showMaskCustom[i]();}}
YAHOO.util.Dom.addClass(document.body,"masked");this.sizeMask();Modal.setMaskListener();this.mask.style.display="block";YAHOO.util.Dom.setStyle(this.mask,'opacity','.7');Modal.setPosition();YAHOO.util.Dom.setStyle(tmp_modal_id,'visibility','visible');if(null!==$('ticker_flash'))
{HuffPoUtil.hide('ticker_flash');}
if(null!==$('ew_FlashDiv'))
{HuffPoUtil.hide('ew_FlashDiv');}
if(null!==$('ad_300_250_1'))
{HuffPoUtil.hide('ad_300_250_1');}
Modal.HideEmbed();Modal.ShowIframe();}};Modal.sizeMask=function()
{if(Modal.mask)
{Modal.mask.style.height=YAHOO.util.Dom.getDocumentHeight()+"px";Modal.mask.style.width=YAHOO.util.Dom.getViewportWidth()+"px";}};Modal.extraEmbeds=['curtainunit','ad_leaderboard_top','ad_store_leaderboard_top'];Modal.ShowEmbed=function(selector)
{Modal.ChangeEmbedState('visible',selector);};Modal.HideEmbed=function(selector)
{Modal.ChangeEmbedState('hidden',selector);};Modal.ChangeEmbedState=function(state,selector)
{if(typeof selector=='undefined')
{var objects=document.getElementsByTagName('object');var embeds=document.getElementsByTagName('embed');for(var i=0;i<embeds.length;i++)
{embeds[i].style.visibility=state;}}
else
{objects=YAHOO.util.Selector.query(selector);}
for(i=0;i<objects.length;i++)
{objects[i].style.visibility=state;}
for(i=0;i<Modal.extraEmbeds.length;i++)
if(Dom.get(Modal.extraEmbeds[i]))Dom.setStyle(Modal.extraEmbeds[i],'visibility',state);};Modal.ShowIframe=function()
{var modal_content=$("huff_modal_common");YAHOO.util.Dom.removeClass(modal_content,"hide_iframe");YAHOO.util.Dom.addClass(modal_content,"show_iframe");};Modal.HideIframe=function()
{var modal_content=$("huff_modal_common");YAHOO.util.Dom.removeClass(modal_content,"show_iframe");YAHOO.util.Dom.addClass(modal_content,"hide_iframe");};Modal.applyDefault=function()
{el=$('modal_inner');el.style.width='652px';el.className='';Modal.HideIframe();};Modal.setPosition=function()
{var tmp_modal_id='huff_modal';if(typeof(Modal.id)!="undefined")
{tmp_modal_id=Modal.id;}
currentHeight=(document.body&&document.body.scrollTop)?document.body.scrollTop:document.documentElement.scrollTop;YAHOO.util.Dom.setStyle(tmp_modal_id,'top',(currentHeight+20)+"px");}
Modal.movePanel=function()
{if(!Modal.mask)return;var tmp_modal_id='huff_modal';if(typeof(Modal.id)!="undefined")
{tmp_modal_id=Modal.id;}
if(!Dom.hasClass(document.body,'masked'))
{currentHeight=(document.body&&document.body.scrollTop)?document.body.scrollTop:document.documentElement.scrollTop;YAHOO.util.Dom.setStyle(tmp_modal_id,'top',(currentHeight+20)+"px");}};UserPoll.entry_id=false;UserPoll.createPoll=function()
{Modal.id='huff_modal_poll';Modal.setWidth(730);Modal.showMask(Modal.id);return false;}
QuickSNProject.isLoadedDialog=false;QuickSNProject.followingPaging=false;QuickSNProject.userString=false;QuickSNProject.hideMask_cb=new Array();QuickSNProject.hideMask=function(params)
{params=params||false;Modal.hideMask(params);var cb=QuickSNProject.hideMask_cb.shift();if(typeof(cb)=='function')
{cb();}}
QuickSNProject.returnModalContainer=function(){return"huff_snn_modal_common_inner";};QuickSNProject.modalCache=[];QuickSNProject.showModal=function(html_or_url,params)
{var QSN=QuickSNProject;var html='';var url='';params=params||{};var cb=params['cb']||false;var window_theme=params['window_theme']||"";var theme_params=params['theme_params']||"";var after_cb=params['after_cb']||false;var pre_cb=params['pre_cb']||false;var social_logo_inner=params['social_logo_inner']||false;var inner_class=params['inner_class']||'';var width=params['width']||660;var table_width=params['table_width']||width;var social_logo=(typeof(params['social_logo'])=='undefined')||params['social_logo'];var close_button=(typeof(params['close_button'])=='undefined')||params['close_button'];var use_logo_remove_button=(typeof(params['use_logo_remove_button'])=='undefined')||params['use_logo_remove_button'];html_or_url=html_or_url||'';if(html_or_url.indexOf('http://')===0||html_or_url.indexOf('/')===0)
{if(QSN.modalCache[html_or_url+''])
{html=QSN.modalCache[html_or_url+''];}
else
{url=html_or_url;}}
else
{html=html_or_url;}
var display_loading=((html&&!params['show_loader'])?'none':'block');var style=(inner_class?'class="'+inner_class+'"':'style="text-align:center;font-size:12px;padding:30px 10px;"');Modal.id='huff_snn_modal_common';Modal.setWidth(width);Modal.showMask(Modal.id);if(false!==cb){QuickSNProject.hideMask_cb.push(cb);Modal.setMaskListener(cb);}
var inner_html="";if(window_theme=="basic_twitter"||window_theme=="basic_linkedin"){inner_html=theme_params.inner_html;YAHOO.util.Event.onAvailable(this.returnModalContainer(),function(close_button_id){close_button=$(close_button_id);if(close_button){E.on(close_button,"click",QuickSNProject.hideMask);}},theme_params.close_button_id,this);}else if(window_theme=="basic_twitter_frontpage"||window_theme=="basic_linkedin_frontpage"){inner_html=theme_params.inner_html;YAHOO.util.Event.onAvailable(this.returnModalContainer(),function(close_button_id){close_button=$(close_button_id);if(close_button){E.on(close_button,"click",function(){Dom.setStyle('huff_snn_modal_common','visibility','hidden');});}},theme_params.close_button_id,this);}else{inner_html="<div class=\"huffpo_lightbox_wrapper blue_bg corners_15px\"><div class=\"inner-wrapper white_bg corners_10px\">";if(social_logo){inner_html+="\
				<div id=\"lightbox_header\">\
					<div class=\"huffpo_logo_lightbox\">\
					<img src=\"/images/social-profile/lightbox/huffpo_logo_lightbox_beta.png\" width=\"368\" height=\"36\" alt=\"\" />\
					</div>\
			";if(social_logo_inner){inner_html+="<div style=\"margin-top:5px;\"><img src=\""+social_logo_inner+"\" /></div>";}
if(use_logo_remove_button){inner_html+="\
									<div class=\"huffpo_snn_close_link\">\
						<a class=\"huff_snn_modal_common_close\" id=\"huff_snn_modal_common_close\" href=\"#\" onclick=\"QuickSNProject.hideMask(); return false;\"></a>\
						</div>\
					";}
inner_html+="\
					<br />\
					<div class=\"huffpo_snn_hr\"></div>\
				</div>\
				";}
else{if(close_button){onclose_function="QuickSNProject.hideMask(); return false;";if(params['show_qr_ad']&&params['show_mask'])
onclose_function="QuickSNProject.hideMask({show_qr_ad:"+params['show_qr_ad']+", show_mask:"+params['show_mask']+"}); return false;";inner_html+="\
				<div id=\"lightbox_header\" style=\"margin-top:10px\">\
					<div class=\"huffpo_snn_close_link\">\
					<a class=\"huff_snn_modal_common_close\" id=\"huff_snn_modal_common_close\" href=\"#\" onclick=\""+onclose_function+"\"></a>\
					</div>\
				</div>\
				";}}
inner_html+="\
				<div id=\"huffpo_snn_is_loading\" style=\"display:"+display_loading+";width:100%; text-align:center;\"><img width=\"32\" height=\"32\" src=\"http://s.huffpost.com/images/loader.gif\" /></div>\
				<div id=\"huff_snn_modal_common_inner\" "+style+">"+html+"</div>\
				<div class=\"clear\"></div>\
				</div></div>\
		";}
$('huff_snn_modal_common').innerHTML=inner_html;if(url)
{C.asyncRequest('GET',url+'',{success:function(o){if(pre_cb)
{pre_cb();}
var tx=o.responseText;$('huffpo_snn_is_loading').style.display='none';QSN.modalCache[o.argument+'']=tx;$('huff_snn_modal_common_inner').innerHTML=tx;if(after_cb)
{after_cb();}
return false;},failure:function(o){HPError.e()},argument:url});}
else
{if(pre_cb)
{pre_cb();}
if(after_cb)
{after_cb();}}}
QuickSNProject.ignoreForFan=function(user_id,user_string)
{if(!QuickSNProject.userString)
QuickSNProject.userString=user_string;Dom.addClass($('twit_img_'+user_id),"modal_su_faded");var str_to_replace=user_id+"|";var approved_box=$('user_ids_for_fans');var ignore_box=$('user_ids_for_ignore');approved_box.value=approved_box.value.replace(str_to_replace,"");ignore_box.value+=str_to_replace;$('toggle_link_'+user_id).innerHTML="<a href='javascript:void(0);' onclick='QuickSNProject.approveForFan("+user_id+")'>Ignored <img src=\"/images/profile/delete_icon.gif\" alt=\"Become Fan\" title=\"Become Fan\" /></a>";}
QuickSNProject.approveForFan=function(user_id)
{var str_to_replace=user_id+"|";Dom.removeClass($('twit_img_'+user_id),"modal_su_faded");var approved_box=$('user_ids_for_fans');var ignore_box=$('user_ids_for_ignore');ignore_box.value=ignore_box.value.replace(str_to_replace,"");approved_box.value+=str_to_replace;$('toggle_link_'+user_id).innerHTML="<a href='javascript:void(0);' onclick='QuickSNProject.ignoreForFan("+user_id+")'>Become Fan <img src=\"/images/profile/add_icon.gif\" alt=\"Ignore user\" title=\"Ignore user\" /></a>";}
QuickSNProject.becomeFan=function(user_string,show_all)
{if(!QuickSNProject.userString)
QuickSNProject.userString=user_string;var approve_ids=$('user_ids_for_fans').value;var ignore_ids=$('user_ids_for_ignore').value;if(approve_ids==""&&ignore_ids=="")
{alert("Nothing selected try another page");}
else
{var post_data="approve_ids="+approve_ids+"&ignore_ids="+ignore_ids+"&user_string="+QuickSNProject.userString;YAHOO.util.Connect.asyncRequest('POST','/users/social_news_project/twitter/make_fans.php',{success:function(o)
{var response=o.responseText;var response_arr=response.split(":|:|:");QuickSNProject.userString=response_arr[1];QuickSNProject.followingPaging=response_arr[2];$('user_ids_for_fans').value="";$('user_ids_for_ignore').value="";if(QuickSNProject.userString=="")
{if(show_all!=1)
{$('twitter_fan_button').innerHTML="<div class=\"twitter_rel_message\"><div class=\"twittr_end_links\"><div class=\"t_profile_link\"><a href=\"/social/"+HuffCookies.getUserName()+"\"><strong>Profile</strong><big>&rarr;</big></a></div><div class=\"t_close_link\"><a href=\"javascript:void(0);\" onclick=\"Modal.hideMask()\"><strong>Close</strong><big>&#x2716;</big></a></div></div></div>";}
else
{$('twitter_fan_button').innerHTML='';}}
$('fan_response_div').innerHTML=response_arr[0];},failure:QuickSNProject.GetDialogFail},post_data);}
return false;}
QuickSNProject.twitterUserPaging=function(page_no,following_string,user_string)
{if(!QuickSNProject.followingPaging)
QuickSNProject.followingPaging=following_string;if(!QuickSNProject.userString)
QuickSNProject.userString=user_string;var post_data="page_no="+page_no+"&following_string="+QuickSNProject.followingPaging;$('twitter_paging_div').innerHTML="<div style=\"width:100%; height:100px; margin-top:30px; text-align:center;\"><img width=\"32\" height=\"32\" src=\"http://s.huffpost.com/images/loader.gif\" /></div>";YAHOO.util.Connect.asyncRequest('POST','/users/social_news_project/twitter/twitter_user_paging.php',{success:function(o){$('twitter_paging_div').innerHTML=o.responseText},failure:QuickSNProject.GetDialogFail},post_data);return false;}
QuickSNProject.showJoinDialog=function()
{if(!this.isLoadedDialog)
{QuickSNProject.showModal();}else{this.isLoadedDialog=false;}
return false;};QuickSNProject.GetDialogSuccess=function(o)
{$('huff_snn_modal_common_inner').innerHTML=o.responseText;QuickSNProject.isLoadedDialog=true;};QuickSNProject.GetDialogFail=function(o)
{HPError.e();Modal.hideMask();};QuickLogin.isLoadedForm=false;QuickLogin.activeTab='login';QuickLogin.IsGoogleUserLogged=false;QuickLogin.OnSuccessRequest='';QuickLogin.lbType=false;QuickLogin.onLoginSuccess=function()
{var QL=QuickLogin;HuffCookies.set('snn_track_user_logged_in',1,1);var location=window.location.href.toString();if(QL.OnSuccessRequest.length>0){location+=(location.search(/\?/gi)==-1)?'?':'&';location+=QL.OnSuccessRequest;window.location.href=location;}
else if(typeof(QL.OnSuccessCallback)=='function')
{QL.OnSuccessCallback();}
else
{window.location.href=window.location.href;}
HuffCookies.setCookie('check_for_fans',1);};QuickLogin.pop=function(is_become_fan,params)
{var QS=QuickSignup;Modal.id='huff_snn_modal_common';Modal.setWidth(685);Modal.showMask(Modal.id);if(is_become_fan=='create_poll')
{QuickLogin.nextStep='poll_lightbox';}
else if(typeof(is_become_fan)!="undefined")
{QuickLogin.is_become_fan=is_become_fan;}
params=params||{};if(params.force_facebook)
{QuickSignup._force_click_fb=true;params.signup=true;}
if(params.show_tab)
QuickLogin.show_tab=params.show_tab;if(params.signup)
{QuickLogin.activeTab='signup';}
else
{QuickLogin.activeTab='login';}
if(!this.isLoadedForm)
{$(Modal.id).innerHTML='';YAHOO.util.Connect.asyncRequest('GET','/users/login/get_quicklogin_form.php?linkedin=1',{success:function(o){QuickLogin.GetFormSuccess(o,params.callback)},failure:QuickLogin.GetFormFail});}
else
{$('huff_snn_modal_common').innerHTML=QuickLogin.formHtml;if($('quicklogin_password'))
{$('quicklogin_password').value='';$('quicklogin_password').style.display='none';$('quicklogin_password_mock').style.display='';}
var handler=function(o,target_id)
{QS.tabClick(target_id);}
E.on($('subtab_facebook'),'click',handler,'subtab_facebook');E.on($('subtab_direct'),'click',handler,'subtab_direct');E.on($('subtab_twitter'),'click',handler,'subtab_twitter');E.on($('subtab_yahoo'),'click',handler,'subtab_yahoo');E.on($('subtab_google'),'click',handler,'subtab_google');E.on($('subtab_linkedin'),'click',handler,'subtab_linkedin');this.TabClick(QuickLogin.activeTab);if(QS.selectedService&&QS.selectedService=='direct')
QS.tabClick('subtab_direct');if(QuickLogin.show_tab)
QuickSignup.tabClick('subtab_'+QuickLogin.show_tab);if(params.callback)
params.callback();}
return false;};QuickLogin.RunCallbacksOrRefresh=function(o)
{if(QuickLogin.onLoginSuccess)
{QuickLogin.onLoginSuccess();return;}
window.location.href=window.location.href;};QuickLogin.GetFormSuccess=function(o,callback)
{QuickLogin.formHtml=o.responseText;$('huff_snn_modal_common').innerHTML=o.responseText;QuickLogin.isLoadedForm=true;var handler=function(o,target_id)
{QuickSignup.tabClick(target_id);}
E.on($('subtab_facebook'),'click',handler,'subtab_facebook');E.on($('subtab_twitter'),'click',handler,'subtab_twitter');E.on($('subtab_yahoo'),'click',handler,'subtab_yahoo');E.on($('subtab_direct'),'click',handler,'subtab_direct');if(QuickLogin.activeTab=='signup')
QuickLogin.pop(undefined,{signup:true});else
QuickLogin.pop();if(callback)
callback();};QuickLogin.GetFormFail=function(o)
{HPError.e();Modal.hideMask();};QuickLogin.checkSubmit=function(link_form,postfix)
{QuickLogin.lbType=postfix;var QS=QuickSignup;var field;postfix=postfix||'';if(postfix!='')
QuickLogin.ServiceToLink=postfix.substr(1,2);var login_field=$('quicklogin_username'+postfix);var password_field=$('quicklogin_password'+postfix);var mock_password=$('quicklogin_password_mock'+postfix);login_field.focus();if(login_field.value=='')
{var s='Please enter your username';if(link_form)
{QS.notify(s);}
else
{QuickLogin.notify(s);}
return false;}
try{password_field.focus();}
catch(e)
{}
if(password_field.value=='')
{var s='Please enter your password';if(link_form)
{QS.notify(s);}
else
{QuickLogin.notify(s);}
if(mock_password)mock_password.focus();return false;}
post_body='';post_body=escape(login_field.name)+"="+escape(login_field.value)+"&"+
escape(password_field.name)+"="+escape(password_field.value);QuickLogin.link_login_name=login_field.value;var request_params={success:QuickLogin.Success,failure:QuickLogin.Fail}
if(link_form)
{request_params.success=QuickLogin.LinkSuccess;request_params.failure=QuickLogin.LinkFail;}
YAHOO.util.Connect.asyncRequest('POST',$('quick_login_form'+postfix).action,request_params,post_body);}
QuickLogin.notify=function(msg){var type=(QuickLogin.lbType);if(type==undefined)
var el=$('fast_lightbox_notify');else
var el=$('login'+type+'_lightbox_notify');if(el){el.innerHTML=msg;Dom.removeClass(el,'hidden');HPUtil.flash(el);}
return;}
QuickLogin.LinkSuccess=function(o)
{if(o.responseText!='success')
return QuickLogin.LinkFail(o);Modal.hideMask();if(QuickLogin.ServiceToLink=='fb')
QuickLogin.FacebookPromptForConnectPop();else if(QuickLogin.ServiceToLink=='tc'||QuickLogin.ServiceToLink=='yh'||QuickLogin.ServiceToLink=='go'||QuickLogin.ServiceToLink=='li')
QuickLogin.ProviderPromptForConnectPop();}
QuickLogin.LinkFail=function(o)
{QuickSignup.notify(o.responseText);}
QuickLogin.Success=function(o)
{if(o.responseText!='success')
return QuickLogin.Fail(o);Modal.hideMask();if(/logout/.test(document.location))
{window.location.href='/users/welcome/';}
else
{if(typeof(QuickLogin.is_become_fan)!="undefined")
{HuffCookies.set('huffpost_become_fan',1);}
if(QuickLogin.nextStep=='poll_lightbox')
{HuffCookies.set('huffpost_poll_lightbox',1);}
QuickLogin.onLoginSuccess();}}
QuickLogin.Fail=function(o)
{if(typeof(o)!='undefined'&&!o.silent&&o.responseText)
{QuickLogin.notify(o.responseText);HPError.e(o.responseText);}
if(typeof(QuickLogin.is_become_fan)!="undefined")
{delete QuickLogin.is_become_fan;}
QuickLogin.bIsLoggedInFacebook=false;}
QuickLogin.avoidFBCallbackBeforeHPLogin=false;QuickLogin.bIsLoggedInFacebook=false;QuickLogin.bIsLoggedInFriendConnect=false;QuickLogin.OnFacebookLoginCreateFansNoticeTimeout=3000;QuickLogin.TabClick=function(tabTag){var QS=QuickSignup;var tabs=new Array('login','signup');for(var i=0;i<tabs.length;i++){el_cont=$('modal_'+tabs[i]+'_content');if(el_cont){el_cont.style.display=(tabs[i]==tabTag?'block':'none');}
else{return false;}
el_link=$('modal_tab_'+tabs[i]+'_link');el_cell=el_link.parentNode;if(tabs[i]==tabTag&&!Dom.hasClass(el_cell,'current')){Dom.addClass(el_cell,'current');Dom.replaceClass(el_link,'light_blue','silver');}
else if(tabs[i]!=tabTag&&Dom.hasClass(el_cell,'current')){Dom.removeClass(el_cell,'current');Dom.replaceClass(el_link,'silver','light_blue');}}
QS.init();if(QS._force_click_fb)QS.FBConnect();return false;}
QuickLogin.fieldEvent={username_onBlur:function(o){if(o.value==''){o.value='ENTER USERNAME';o.style.color='#888';}},username_onFocus:function(o){if(o.value=='ENTER USERNAME')o.value='';o.style.color='#000';},password_onBlur:function(o,link_form){postfix=link_form||'';if(o.value==''){$('quicklogin_password_mock'+postfix).style.display='';o.style.display='none';}},passwordmock_onFocus:function(o,link_form){postfix=link_form||'';o.style.display='none';var passFld=$('quicklogin_password'+postfix);passFld.style.display='';passFld.focus();}}
QuickLogin.ServiceLoginFail=function(o)
{var QL=QuickLogin;if(o.argument&&o.argument.autologin)
HuffCookies.setCookie('autologin','1',2);if(o.tld!=null)
{HPError.d('ServiceLoginFail',o);}
else if(o.is_error)
{HPError.d('ServiceLoginFail2',o);}
if(typeof(QL.is_become_fan)!="undefined")
{delete QL.is_become_fan;}
QL.bIsLoggedInFacebook=false;}
QuickLogin.TwitterLogin=function(twitter_name,twitter_id){var rt=new Date().getTime();YAHOO.util.Connect.asyncRequest('GET','/commentsv3/_twitterLogin.php?twitter_name='+twitter_name+'&twitter_id='+twitter_id+'&r='+rt,{success:QuickLogin.TwitterSuccess,failure:QuickLogin.Fail});}
QuickLogin.TwitterSuccess=function(o){var splits=o.responseText.split(':::');var result=splits[0];switch(result)
{case'success':var username=splits[1];alert("Already registered as: "+username);break;case'new_user':Modal.hideMask();var form_txt=splits[1];Modal.id='huff_snn_modal_common';Modal.setWidth(500);Modal.showMask(Modal.id);$('huff_snn_modal_common').innerHTML=form_txt;$('modal_changename_user_name').readonly=false;$('modal_changename_user_name').focus();break;}}
QuickLogin.FacebookSuccess=function(o){document.cookie=document.cookie;var QL=QuickLogin;var HC=HuffCookies;if(o.argument&&o.argument.autologin)
{HC.setCookie('autologin','1',2);}
var result=JSON.parse(o.responseText);switch(result.msg){case'success':HC.destroyCookie('autologin');HC.set('snn_popup_needed','1','1');if(typeof(QuickTwitterSignup.FBLoginCallback)!='undefined')
{QuickTwitterSignup.FBLoginCallback();return;}
if(typeof(QL.FacebookLoginCallback)!="undefined"){QL.FacebookLoginCallback();return;}
Modal.hideMask();QL.onLoginSuccess();return;break;case'new_user':Modal.hideMask();QL.activeTab='signup';QL.pop(false,{force_facebook:true});break;case'prompt_for_connect':Modal.hideMask();QL.FacebookPromptForConnectPop();break;default:QL.ServiceLoginFail(result);break;}}
QuickLogin.FacebookPromptForConnectPop=function(){linkSocialAccount.provider='facebook';linkSocialAccount.FacebookPromtLogin();};QuickLogin.showCommentHoverLinks=function()
{Dom.removeClass("comment_hover_links","display_none");return;};QuickLogin.hideCommentHoverLinks=function()
{Dom.addClass("comment_hover_links","display_none");return;};QuickLogin.flushValues=function()
{QuickLogin.TwitterInfo={};return;}
QuickLogin.ProviderPromptForConnectPop=function(){var QS=QuickSignup;var callback=QuickSNProject.hideMask;if(Provider.user_provider_info[QuickSignup.selectedService].id&&Provider.user_provider_info[QuickSignup.selectedService].screen_name)
{if(HuffPoUtil.trim(QuickLogin.link_login_name)==HuffPoUtil.trim(Provider.user_provider_info[QuickSignup.selectedService].user_name)){alert("You're already linked to the chosen "+QuickSignup.selectedService+" account.");Modal.hideMask();window.location=window.location;}else{linkSocialAccount.provider=QuickSignup.selectedService;linkSocialAccount.PromptLoginConnect();}}
else{Modal.hideMask();window.location=window.location;}
return;}
QuickLogin.TwitterSignupUser=function()
{$('modal_changename_submit').style.visibility='hidden';$('subscribe_loader').style.display='block';callback={success:function(o){if(/<form[^>]*>/.test(o.responseText)){$('huff_snn_modal_common').innerHTML=o.responseText;}
else{switch(o.responseText){case'success':Modal.hideMask();HPFBQuickIntroduce.finalCallback=QuickLogin.FacebookSubscribe;HPFBQuickIntroduce.pop();break;default:$('modal_changename_submit').style.visibility='visible';$('subscribe_loader').style.display='none';HPError.e(o.responseText);break;}}},failure:function(){HPError.e();}}
YAHOO.util.Connect.setForm($('changename_form'));YAHOO.util.Connect.asyncRequest('POST','/commentsv3/_twitterLogin.php',callback);}
QuickLogin.SubscribeHandler=function()
{QuickSNProject.showModal('/users/favorite-bloggers/get_subscribe_user.php?email=&hide_close_button=1&third_party_user=1&f32=1',{after_cb:QuickLogin.callbackSubscribeHandler,use_logo_remove_button:false,inner_class:'service_select_modal',width:552});};QuickLogin.callbackSubscribeHandler=function(){$('check_all').checked=true;QuickSubscribeUser.checkAll();Modal.setMaskListener(function(){var email=QuickSignup._email||$('email').value;QuickSignup.Subscribe(email);});};QuickLogin.SocialLogout=function(sRedirect){SNProject.track(HuffCookies.getUserId(),'user_log_out');QuickLogin.FacebookLogout(sRedirect);}
QuickLogin.FacebookLogout=function(sRedirect){if(!sRedirect)sRedirect='';if(HPFB.session)
{HPFB.session=false;if(sRedirect.length>0)
{HPFB._redirect=sRedirect;FB.logout(function()
{location.href=HPFB._redirect;});}
else
{FB.logout();}}
else
{location.href=((sRedirect.length>0)?sRedirect:location.href);}}
QuickLogin.googleAdsExec=function(_gfcHint)
{_google_vertical_name=(typeof _google_vertical_name!='undefined')?_google_vertical_name:'';_google_hints=(typeof _google_hints!='undefined')?_google_hints:'';_google_test_channel=(typeof _google_test_channel!='undefined')?_google_test_channel:'';if(document.getElementById('contextual_ad_unit_1'))
{HuffPoUtil.WEDGJE.google_ads.init({'ad_channel':'8073093451,'+_google_vertical_name+',9299244974,'+_google_test_channel,'hints':_google_hints+' '+_gfcHint,'hp_dest_id':'contextual_ad_unit_1'});}
if(document.getElementById('contextual_ad_unit_2'))
{HuffPoUtil.WEDGJE.google_ads.init({'ad_channel':'8073093451,'+_google_vertical_name+',4661083346,'+_google_test_channel,'hints':_google_hints+' '+_gfcHint,'max_num_ads':'1','hp_dest_id':'contextual_ad_unit_2'});}
HuffPoUtil.WEDGJE.google_ads.exec();}
QuickLogin.TwitterOauthLogin=function()
{linkSocialAccount.checkLoginStatus('twitter');}
QuickLogin.TwitterOauthFastLogin=function()
{linkSocialAccount.checkLoginStatus('twitter');}
QuickLogin.TwitterOauthSNNLinking=function(params)
{var callback=QuickLogin.TwitterCalls;if(params){callback=function(params){if(params.reload){window.location=window.location;return;}};}
linkSocialAccount.checkLoginStatus('twitter',{onLinkSuccess:callback});return;}
QuickLogin.TwitterCalls=function()
{var element=$('sidebar_service_connect');if(element)
{var flashwarn=new YAHOO.util.ColorAnim(element,{backgroundColor:{from:'#F9E801',to:'#FFFFFF'}});flashwarn.animate();SNPModule.twitterModule(function(){if(SNPModule.max_twitter_page<0)
{if($('snp_twitter_max_page_counter'))
{SNPModule.max_twitter_page=parseInt($('snp_twitter_max_page_counter').innerHTML)-1;}
else
{SNPModule.max_twitter_page=0;}}
E.on($('tweet_status'),'keyup',HPUtil.enforceTextAreaLimit,{chars:140});E.on($('tweet_status'),'change',HPUtil.enforceTextAreaLimit,{chars:140});if($('service_bottom_bar')&&SNProject.service_bar=='twitter')
$('service_bottom_bar').style.display="none";});Dom.addClass(element,"display_none");}
else
window.location=window.location;var pledge_id=HuffCookies.getCookie('hp_pledge_twitter');if(pledge_id)
{var pledge_func_name='joinPledgeTwitter_'+pledge_id;var resp=typeof(eval(pledge_func_name));if(resp=='function')
eval(pledge_func_name)();}
else
setTimeout('SNProject.checkFriendsFansOnJoin()',10000);return false;}
var QuickFacebookInvite={invitationContentConfirmLink:"http://www.huffingtonpost.com/",init:function(invitationConfirmLink){QuickFacebookInvite.invitationContent="Please join me at &lt;a href=&quot;http://www.huffingtonpost.com/&quot;&gt;Huffington Post&lt;/a&gt;!&lt;fb:req-choice url=&quot;";if(invitationConfirmLink){QuickFacebookInvite.invitationContent+=invitationConfirmLink;}
else{QuickFacebookInvite.invitationContent+=QuickFacebookInvite.invitationContentConfirmLink;}
QuickFacebookInvite.invitationContent+="&quot; label=&quot;Confirm&quot;/&gt;";},pop:function(callbackChain)
{if(!HPFB.session)
return false;var callback={success:function(o)
{if(o.responseText=='all'){if(typeof(callbackChain)=="function"){callbackChain();}else{Modal.hideMask();QuickLogin.onLoginSuccess();}}
else
{Modal.hideMask();QuickFacebookInvite.showInviteForm(o.responseText);}},timeout:7000}
var q='/include/facebook.php?app_friends='+HPFB.session.uid;var cObj=C.asyncRequest('POST',q,callback,HPFB.getSessionForServer());},showInviteForm:function(appUsers){var dialogHeight=575+((appUsers!='')?(appUsers.split(',').length/4*20):0);var fbml="<fb:request-form style=\"width:575px; height:580px;\" action=\"";fbml+=window.location.href+"\" method=\"POST\" type=\"HuffingtonPost\" invite=\"true\" ";fbml+="content=\""+QuickFacebookInvite.invitationContent+"\">";if(appUsers!=''){uids=appUsers.split(',');fbml+="<div style=\"padding:20px\"><h2>"+uids.length+" of your friends are already here!</h2>"
j=0;for(i in uids){if(uids[i]==parseInt(uids[i])){fbml+="<div style=\"float:left;width:150px;padding-top:4px\"><fb:name linked=\"false\" uid=\""+uids[i]+"\"></fb:name></div>";j++;if(j==4){j=0;fbml+="<div style=\"clear:both\"></div>";}}}
fbml+="</div>";}
fbml+="<div style=\"margin: 0 auto; width: 466px;\"><fb:multi-friend-selector showborder=\"false\" exclude_ids=\""+appUsers+"\" ";fbml+="actiontext=\"Invite your friends to HuffPost\" rows=\"3\" cols=\"3\" bypass=\"cancel\" showborder=\"false\">";fbml+="</fb:multi-friend-selector></div>";fbml+="</fb:request-form>";FB.ui({'method':'fbml.dialog','fbml':fbml,'display':'iframe',width:1,height:1});return;}};FanAction={send_action:function(fan,action)
{YAHOO.util.Connect.asyncRequest('POST','/users/favorite-bloggers/fan_action.php',this,'fan='+fan+'&action='+action);},success:function(o)
{resp=o.responseText;action=resp.substring(0,3);var resparr=resp.split('::');if(action=='add')
{var userid=resparr[2];SNProject.track(userid,'user_follow');}
fan=resparr[1];var fanDivs=document.getElementsByName(""+fan+"");if(action=='add')
{for(i=0;i<fanDivs.length;i++)
{fanDivs[i].innerHTML='<B>added</B>';}}
else if(action=='mov')
{for(i=0;i<fanDivs.length;i++)
{fanDivs[i].innerHTML='<B>removed</B>';}}
else
{HPError.e();}},failure:function(o)
{HPError.e();}
};QuickSubscribeUser={pop:function(sForm,category,hideIframe,el_id)
{hideIframe=(hideIframe!=null)?hideIframe:1;if("undefined"==typeof(el_id))
{el_id="subscribe_user_email";}
if($(el_id).value=="")
{alert("Please enter your email address.");$(el_id).focus();return false;}
if(!HPUtil.checkEmail($(el_id).value))
{alert("Please specify a valid e-mail.")
$(el_id).focus();return false;}
Modal.id='huff_modal_common';Modal.setWidth(550);Modal.showMask(Modal.id);sEmail=$(el_id).value;var post_data="email="+encodeURIComponent(sEmail)+"&"+category+"=1"+"&"+"f32"+"=1";var uri='/users/favorite-bloggers/get_subscribe_user.php';if(hideIframe)
{YAHOO.util.Connect.asyncRequest('POST',uri,{success:QuickSubscribeUser.Success,failure:QuickSubscribeUser.Fail},post_data);}
else
{$("huff_modal_common_inner").innerHTML="<iframe id='alert_email_iframe' frameborder=no src='http:\/\/www.huffingtonpost.com\/users\/favorite-bloggers\/get_subscribe_user.php?email="+encodeURIComponent(sEmail)+"&iframe=1' style='width:544px; height:110px; visibility:hidden; overflow:hidden;' onload='QuickSubscribeUser.setIframeSize()'><\/iframe>";}
return false;},pop2:function(vertical,internal_id)
{Modal.id='huff_modal_common';Modal.setWidth(400);Modal.showMask(Modal.id);var sEmail="";var post_data=internal_id+"=1"+"&"+"f32"+"=1";var uri='/users/alerts/signup.php';YAHOO.util.Connect.asyncRequest('POST',uri,{success:QuickSubscribeUser.Success,failure:QuickSubscribeUser.Fail},post_data);},getAlerts:function(form)
{Modal.setWidth(547);if(form.email.value=="")
{alert("Please enter your email address.");form.email.focus();return false;}
if(!(form.email&&HPUtil.checkEmail(form.email.value)))
{alert("Please specify a valid e-mail.")
form.email.focus();return false;}
post_data="email="+encodeURIComponent(form.email.value);YAHOO.util.Connect.asyncRequest('POST','/subscription/get_email_alerts.php',{success:QuickSignup.SubscribeSuccess,failure:QuickSignup.SubscribeFail},post_data);},Success:function(o)
{$('huff_modal_common_inner').innerHTML=o.responseText;},Fail:function(o)
{alert(o.responseText);Modal.hideMask('huff_modal_common');},setIframeSize:function()
{h=document.getElementById("alert_email_iframe").myheight||770;try
{document.getElementById("alert_email_iframe").style.height=document.getElementById("alert_email_iframe").contentDocument.body.clientHeight+"px";}
catch(e)
{document.getElementById("alert_email_iframe").style.height=h+"px";}
document.getElementById('alert_email_iframe').style.visibility='visible';},checkAll:function()
{var check_value=false;if($('check_all').checked==true)
check_value=true;var forma=$('unsub_form');for(var i=0;i<forma.length;i++)
{if(forma.elements[i].type=="checkbox")
{forma.elements[i].checked=check_value;}}}};QuickSignup={initted:false,connected:{'facebook':false,'twitter':false,'yahoo':false,'google':false},selectedService:'facebook',services:['facebook','twitter','yahoo','google','linkedin','direct'],init:function()
{var QS=QuickSignup;QS.initted=true;QS.fieldset=$('modal_su_fieldset');QS.inner=$('modal_su_inner');},FBConnect:function()
{var QS=QuickSignup;if(!QS.initted)
QS.init();HPFB.ensureInit(function()
{HPFB.waitForSession(function()
{HPFB.getFBInfo(function(o)
{var QS=QuickSignup;QS.setConnected(QS.selectedService);QuickLogin.FacebookName=o[0].name;QS.showUserInfo(o[0].name,o[0].pic_square,'facebook');});},{fb_signup:true});});},FBUnconnect:function()
{var QS=QuickSignup;QS.connected[QS.selectedService]=false;QS._fb_cache=false;FB.logout(function(){HPFB.session=false;HPFB.user_status=false;QuickSignup.toggleOverlays('facebook');setTimeout(function(){QuickSignup.FBConnect()},1000);});QS.fadeForm(true);},showUserInfo:function(name,pic)
{var QS=QuickSignup;var QL=QuickLogin;if(!QS.initted)QS.init();var userinfo=$('modal_su_userinfo_'+QS.selectedService);if(!userinfo)return;if(QS.selectedService=='facebook'){name=name||'';if(QS._fb_cache&&!(name||pic))
{name=QS._fb_cache.name;pic=QS._fb_cache.pic;}
else if(name||pic)
{QS._fb_cache={name:name+'',pic:pic+''};}
if(!(name||pic))return;if(!pic||pic=='null')pic='http://s.huffpost.com/images/profile/user_placeholder.gif';userinfo.firstChild.src=pic;userinfo.lastChild.innerHTML=name;var suggested_username=name.replace(/[^\w ]/g,'');$('F_USERNAME').value=suggested_username;userinfo.parentNode.style.display='block';QS.fadeForm(false);}
else if(QS.connected[QS.selectedService]){var screen_name=Provider.user_provider_info[QS.selectedService].screen_name;var profile_image=Provider.user_provider_info[QS.selectedService].profile_image;var email=Provider.user_provider_info[QS.selectedService].email||"";$('F_USERNAME').value=screen_name;$('F_EMAIL').value=email;userinfo.firstChild.src=Provider.user_provider_info[QS.selectedService].profile_image;userinfo.lastChild.innerHTML=Provider.user_provider_info[QS.selectedService].screen_name;QS.fadeForm(false);}
return;},hideUserInfo:function()
{var userinfo=$('modal_su_userinfo_'+QuickSignup.selectedService);if(!userinfo)return;userinfo.parentNode.style.display='none';},setConnected:function()
{var QS=QuickSignup;if(!QS.initted)QS.init();QS.connected[QS.selectedService]=true;QS.toggleOverlays();},fadeForm:function(fade)
{var QS=QuickSignup;if(fade==true&&!Dom.hasClass(QS.inner,'modal_su_faded'))
Dom.addClass(QS.inner,'modal_su_faded');else if(!fade)
Dom.removeClass(QS.inner,'modal_su_faded');},tabClick:function(tab_name)
{var QS=QuickSignup;if(!QS.initted)QS.init();QS.hideUserInfo();QS.selectedService=tab_name.substr(7);var tabs=QS.services;var selected='modal_subtab_selected';var normal='modal_subtab';var current='';var service_els=Dom.getElementsByClassName('service_only',null,QS.inner);for(i=0;i<service_els.length;i++)
{var cur=service_els[i];if(Dom.hasClass(cur,QS.selectedService+'_only'))
{cur.style.display='block';}
else
{cur.style.display='none';}}
for(i=0;i<tabs.length;i++)
{var looptab='subtab_'+tabs[i];var tab=$('subtab_'+tabs[i]);if(looptab==tab_name)
{Dom.removeClass(tab,normal);Dom.addClass(tab,selected);current=tabs[i];}
else
{if(Dom.hasClass(tab,selected))
{Dom.removeClass(tab,selected);Dom.addClass(tab,normal);}}}
var direct_signup=(current=='direct');var direct_signup_or_twitter=(HuffPoUtil.getUrlVar('twitter_signup'))?(current=='direct'||current=='twitter'):direct_signup;var form_els=QS.fieldset.getElementsByTagName('DIV');QS.fadeForm(!direct_signup_or_twitter);if(QS.connected[current])
{if(current=='twitter')
{$('modal_su_inner_twitter_dual').style.display='none';$('modal_su_inner').style.display='block';}
QuickSignup.toggleOverlays();}
else
{if(current=='twitter'&&HuffPoUtil.getUrlVar('twitter_signup'))
{QuickSignup.toggleOverlays();$('modal_su_inner_twitter_dual').style.display='block';$('modal_su_inner').style.display='none';return;}
else
{$('modal_su_inner_twitter_dual').style.display='none';$('modal_su_inner').style.display='block';}
QuickSignup.toggleOverlays(current);}
for(i=0;i<form_els.length;i++)
{var el_id=form_els[i].id;if(el_id.indexOf('modal_su_')>=0)
{if((!direct_signup)&&(Dom.hasClass(form_els[i],'modal_su_direct_only')))
{Dom.addClass(form_els[i],'modal_su_hidden');}else
Dom.removeClass(form_els[i],'modal_su_hidden');}}
QS.showUserInfo();if("linkedin"==QS.selectedService&&$('create_an_acc_text')){Dom.replaceClass("create_an_acc_text","su_modal_blue_box","su_modal_linkedin_box");$('create_an_acc_text').innerHTML="";}
else{Dom.replaceClass("create_an_acc_text","su_modal_linkedin_box","su_modal_blue_box");$('create_an_acc_text').innerHTML="Create an Account";}},toggleOverlays:function(current_tab)
{var QS=QuickSignup;if(!QS.initted)QS.init();var overlays=Dom.getElementsByClassName('modal_su_overlay');for(i=0;i<overlays.length;i++)
{if(current_tab&&('modal_su_'+current_tab==overlays[i].id))
{overlays[i].style.display='block';}
else
{overlays[i].style.display='none';}}
},notify:function(msg)
{var notifier=$('modal_su_notification');notifier.innerHTML=msg;notifier.style.display='block';},checkSingupForm:function(email)
{if(undefined===email)
{email='';}
var error={F_USERNAME:'User Name',F_ZIPCODE:'Zip code',F_EMAIL:'Email',F_OPTIN:'Check Box',F_PASSWORD:'Password',F_PASSWORDAGAIN:'Confirm Password'};var forma=$('signup_subscribe_form');var post_data='';$("form_signup_result").innerHTML='';for(var i=0;i<forma.length;i++)
{if(forma.elements[i].name=='F_EMAIL'&&forma.elements[i].value!=='')
{if(!HPUtil.checkEmail(forma.elements[i].value))
{alert('Please specify a valid e-mail');forma.elements[i].value='';forma.elements[i].focus();return false;}}
if(forma.elements[i].name=='F_PASSWORDAGAIN'&&forma.elements[i].value!=='')
{if(forma.elements[i].value!==forma.elements[i-1].value)
{alert('Please confirm your password');forma.elements[i].value='';forma.elements[i].focus();return false;}}
if(forma.elements[i].name=='F_OPTIN'&&forma.elements[i].checked==true)
{forma.elements[i].value=1;}
if(forma.elements[i].value=='')
{alert("Fill in the field - "+error[forma.elements[i].name]);forma.elements[i].focus();return false;}
post_data=post_data+(escape(forma.elements[i].name)+"="+encodeURIComponent(forma.elements[i].value)+"&");}
YAHOO.util.Connect.asyncRequest('POST',$('signup_subscribe_form').action,{success:function(o){QuickSignup.FormSuccess(o,email);},failure:QuickSignup.FormFail},post_data);return false;},FormSuccess:function(o,email)
{Modal.id='huff_modal_common';Modal.setWidth(600);Modal.showMask(Modal.id);if(o.responseText=='ok')
{$("creating_user").innerHTML='';$("creating_user").style.display="none";$("user_created").style.display="block";post_data="email="+encodeURIComponent(email);YAHOO.util.Connect.asyncRequest('POST','/subscription/get_email_alerts.php',{success:QuickSignup.SubscribeSuccess,failure:QuickSignup.SubscribeFail},post_data);}
else
{$("form_signup_result").innerHTML=o.responseText;}},FormFail:function(o)
{alert(o.responseText);},SubscribeSuccess:function(o)
{$("creating_user").style.display="block";$("user_created").style.display="none";$("creating_user").innerHTML=o.responseText;},SubscribeFail:function(o)
{HPError.e();},Subscribe:function(email)
{$('subscribe_loader').style.display='block';var forma=$('unsub_form');for(var i=0;i<forma.length;i++)
{if(forma.elements[i].type=='checkbox')
{if(forma.elements[i].checked==true)
{forma.elements[i].value=1;}
else
{forma.elements[i].value=0;}}}
var form_fields=['update','email_subscribe','field_27','field_28','field_29','field_30','field_31','field_32','field_40','field_41','field_42','field_48','field_49','field_52','notify[fan]','notify[blogger]','sub_status','field_38','field_50','field_51','field_53','field_54','field_55','field_56','field_58','field_59','field_60'];var post_data="email="+encodeURIComponent(email);for(i=0;i<form_fields.length;i++)
{var field=$(form_fields[i]+'');if(field!=null){post_data+='&'+escape(field.name)+"="+escape(field.value);}}
YAHOO.util.Connect.asyncRequest('POST','/subscription/get_email_alerts.php',{success:QuickSignup.SubscribeSuccessEmail,failure:QuickSignup.SubscribeFailEmail},post_data);return false;},SubscribeSuccessEmail:function(o)
{var main_div=document.createElement('div');var div=document.createElement('div');div.setAttribute('style','text-align:center');var h4=document.createElement('h4');h4.innerHTML='<a class="modal_close_link_color" href="#" onclick="Modal.hideMask(); return false;">Close Window</a>';div.appendChild(h4);div.innerHTML+="&nbsp;";var h3=document.createElement('h3');h3.innerHTML="Thank You";div.appendChild(h3);div.innerHTML+="&nbsp;";var p=document.createElement('p');p.className="note";p.innerHTML="Your subscription settings have been updated";div.appendChild(p);div.innerHTML+="&nbsp;";main_div.appendChild(div);$('huff_modal_common_inner').innerHTML=main_div.innerHTML;},SubscribeFailEmail:function(o)
{HPError.e();},checkLoginSignupForm:function()
{var QS=QuickSignup;var forma=$('modal_signup_form');var error={F_USERNAME:'Screen Name',F_ZIPCODE:'Zip code',F_EMAIL:'Email',F_OPTIN:'Check Box',F_PASSWORD:'Password',F_PASSWORDAGAIN:'Confirm Password'};for(var i=0;i<forma.length;i++)
{var el=forma.elements[i];if(el.name=='F_EMAIL'&&el.value!=='')
{if(!HPUtil.checkEmail(el.value))
{QS.notify('Please specify a valid e-mail');el.value='';el.focus();return false;}
else
{QuickSignup._email=el.value;}}
else if(el.name=='F_PASSWORDAGAIN'&&el.value!=='')
{if(el.value!==forma.elements[i-1].value)
{QS.notify('Please confirm your password');el.value='';el.focus();return false;}}
else if(el.name=='F_OPTIN')
{if(el.checked==true)el.value=1;}
else if(el.name=="F_ZIPCODE"&&/[^\w \-]/.test(el.value))
{QS.notify("Please enter a valid zipcode");el.focus();HPUtil.flash(el);return false;}
else if(el.value==''&&!Dom.hasClass(el.parentNode,'modal_su_hidden')&&el.name&&!Dom.hasClass(el,'modal_su_pass_verify'))
{QS.notify("Please fill in the \""+error[el.name]+"\" field");el.focus();HPUtil.flash(el);return false;}}
return true;},LoginSignupFormSubmit:function()
{var switchFormLoading=function(isLoading)
{Dom.setStyle('modal_signup_form_submit','display',(isLoading?'none':'block'));Dom.setStyle('modal_signup_form_spinner','display',(isLoading?'block':'none'));}
var callback={success:function(o)
{if(o.responseText!='')
{var splits=o.responseText.split(':::');if(HuffPoUtil.trim(splits[0])=='success')
{var QL=QuickLogin;if(splits[2]){var SNP=SNProject;SNP.members_count=splits[2];HPFBQuickIntroduce.html=splits[3];SNP.track(HuffCookies.getUserId(),'user_snp_join');SNP._postJoin();return;}
else
{QL.onLoginSuccess();return;}}
else if(HuffPoUtil.trim(splits[0])=='error')
{if(HuffPoUtil.trim(splits[1])=='logged_in')
{$('huff_snn_modal_common_inner').innerHTML="<div style=\"padding:10px 15px;\">"+splits[2]+"</div>";return;}
else
{QuickSignup.notify(splits[1]);switchFormLoading(false);return;}}}
this.failed();},failed:function()
{HPError.e();switchFormLoading(false);}}
switchFormLoading(true);if(this.checkLoginSignupForm())
{var QL=QuickLogin;var getdata="";var post_data="";if(QuickSignup.selectedService=='twitter'&&Provider.user_provider_info.twitter.oauth_token&&Provider.user_provider_info.twitter.oauth_token_secret){post_data="tid="+Provider.user_provider_info.twitter.id+"&tname="+Provider.user_provider_info.twitter.screen_name+"&oauth_token="+Provider.user_provider_info.twitter.oauth_token+"&oauth_secret="+Provider.user_provider_info.twitter.oauth_token_secret;}
else if(QuickSignup.selectedService=='yahoo'&&Provider.user_provider_info.yahoo.id&&Provider.user_provider_info.yahoo.access_token){post_data='access_token='+encodeURIComponent(Provider.user_provider_info.yahoo.access_token)+
'&yahoo_id='+encodeURIComponent(Provider.user_provider_info.yahoo.id);}else if(QuickSignup.selectedService=='google'&&Provider.user_provider_info.google.id&&Provider.user_provider_info.google.access_token){post_data='access_token='+encodeURIComponent(Provider.user_provider_info.google.access_token)+
'&google_id='+Provider.user_provider_info.google.id;}else if(QuickSignup.selectedService=='linkedin'&&Provider.user_provider_info.linkedin.id&&Provider.user_provider_info.linkedin.access_token){post_data='access_token='+encodeURIComponent(Provider.user_provider_info.linkedin.access_token)+
'&linkedin_id='+Provider.user_provider_info.linkedin.id;}else if(HPFB.session){post_data=HPFB.getSessionForServer();}
C.setForm($('modal_signup_form'));C.asyncRequest('POST',$('modal_signup_form').action+'?mode='+QuickSignup.selectedService+getdata,callback,post_data);return false;}
switchFormLoading(false);return false;},CheckUsername:function(uname){if(uname!="")
{$('ajax_uname').innerHTML='<img width="32" height="32" src="http://s.huffpost.com/images/loader.gif" />';var post_data='uname='+uname+'&verify=username';YAHOO.util.Connect.asyncRequest('POST','/users/signup/inline_verify.php',{success:QuickSignup.UsernameVerifyResponse,failure:QuickSignup.UsernameVerifyFailed},post_data);return false;}
else
return false;},UsernameVerifyResponse:function(o){$('ajax_uname').innerHTML=o.responseText;},UsernameVerifyFailed:function()
{HPError.e();},CheckEmail:function(email){if(email!="")
{$('ajax_email').innerHTML='<img width="32" height="32" src="http://s.huffpost.com/images/loader.gif" />';var post_data='email='+email+'&verify=email';YAHOO.util.Connect.asyncRequest('POST','/users/signup/inline_verify.php',{success:QuickSignup.EmailVerifyResponse,failure:QuickSignup.EmailVerifyFailed},post_data);}
else
return false},EmailVerifyResponse:function(o){$('ajax_email').innerHTML=o.responseText;},EmailVerifyFailed:function()
{HPError.e();},TwitterOauth:function(params)
{Provider.SignUp(params);return;},TwitterUnconnect:function()
{var QS=QuickSignup;QS.connected[QS.selectedService]=false;QS.toggleOverlays('twitter');QS.fadeForm(true);}};var PopupManager={popup_window:null,interval:null,interval_time:80,onClose:null,onCloseParams:null,waitForPopupClose:function(){if(PopupManager.isPopupClosed())
{PopupManager.destroyPopup();if('function'==typeof(PopupManager.onClose))
{PopupManager.onClose(PopupManager.onCloseParams);PopupManager.onClose=null;}}},destroyPopup:function(){this.popup_window=null;window.clearInterval(this.interval);this.interval=null;this.callback=null;},isPopupClosed:function(){return(!this.popup_window||this.popup_window.closed);},open:function(url,width,height){url=HuffPoUtil.trim(url);this.popup_window=window.open(url,'_blank',this.getWindowParams(width,height));this.interval=window.setInterval(this.waitForPopupClose,this.interval_time);if(!this.popup_window||this.popup_window.closed)
{alert('Please accept the pop-up for this, check your pop-up blocker');return false;}
return this.popup_window;},getWindowParams:function(width,height){var center=this.getCenterCoords(width,height);return"width="+width+",height="+height+",status=1,location=1,resizable=yes,left="+center.x+",top="+center.y;},getCenterCoords:function(width,height){var parentPos=this.getParentCoords();var parentSize=this.getWindowInnerSize();var xPos=parentPos.width+Math.max(0,Math.floor((parentSize.width-width)/2));var yPos=parentPos.height+Math.max(0,Math.floor((parentSize.height-height)/2));return{x:xPos,y:yPos};},getWindowInnerSize:function(){var w=0;var h=0;if('innerWidth'in window){w=window.innerWidth;h=window.innerHeight;}else{var elem=null;if(('BackCompat'===window.document.compatMode)&&('body'in window.document)){elem=window.document.body;}else if('documentElement'in window.document){elem=window.document.documentElement;}
if(elem!==null){w=elem.offsetWidth;h=elem.offsetHeight;}}
return{width:w,height:h};},getParentCoords:function(){var w=0;var h=0;if('screenLeft'in window){w=window.screenLeft;h=window.screenTop;}else if('screenX'in window){w=window.screenX;h=window.screenY;}
return{width:w,height:h};}};QuickFan={pop_similar:function(blogger)
{Modal.id='huff_modal_common';Modal.setWidth(400);Modal.showMask(Modal.id);HPTrack.trackPageview('/t/a/similar_bloggers');YAHOO.util.Connect.asyncRequest('GET','/users/favorite-bloggers/get_similar_bloggers.php?author='+blogger,{success:QuickFan.GetSimilarSuccess,failure:QuickFan.GetSimilarFail},{});return false;},GetSimilarSuccess:function(o)
{$('huff_modal_common_inner').innerHTML=o.responseText;},GetSimilarFail:function(o)
{HPError.e();Modal.hideMask('huff_modal_common');},pop:function(blogger)
{if(HuffCookies.getUserName())
{$('huff_modal_common_inner').innerHTML='Your request is being processed...';QuickFan.becomeFan(blogger);QuickFan._HeaderText="Thank you, we'll send you email alerts when this blogger posts";QuickFan.pop_email_alerts(blogger);}
else
{QuickLogin.pop(1);}},becomeFan:function(blogger)
{YAHOO.util.Connect.asyncRequest('POST','/users/favorite-bloggers/fan_action.php',{success:QuickFan.Success,failure:QuickFan.Fail},'fan='+blogger+'&action=add');},Success:function(o)
{resp=o.responseText;action=resp.substring(0,3);if(action=='add')
{var resparr=resp.split('::');SNProject.track(resparr[2],'user_follow');}
else if(resp=='notificationsaved')
{Modal.hideMask('huff_email_alerts_modal');}
else if(action!='mov')
{return QuickFan.Fail(o);}
return false;},Fail:function(o)
{alert(o.responseText);},pop_email_alerts:function(blogger)
{if(HuffCookies.getUserName())
{Modal.id='huff_modal_common';Modal.setWidth(600);Modal.showMask(Modal.id);YAHOO.util.Connect.asyncRequest('GET','/users/favorite-bloggers/qet_email_alerts.php',{success:QuickFan.GetEmailAlertsSuccess,failure:QuickFan.GetEmailAlertsFail},{});}
else
{QuickLogin.pop();}},GetEmailAlertsSuccess:function(o)
{$('huff_modal_common_inner').innerHTML=o.responseText;if(typeof(QuickFan._HeaderText)!="undefined")
{$('header_id').innerHTML=QuickFan._HeaderText;delete QuickFan._HeaderText;}},GetEmailAlertsFail:function(o)
{HPError.e();Modal.hideMask('huff_modal_common');},sendForm:function()
{var forma=$('quick_email_alerts_form');for(var i=0;i<forma.length;i++)
{if(forma.elements[i].type=='checkbox'&&forma.elements[i].checked==true)
forma.elements[i].value=1;}
post_body='';post_body=escape($('save').name)+"="+escape($('save').value)+"&"+
escape($('field_27').name)+"="+escape($('field_27').value)+"&"+
escape($('field_28').name)+"="+escape($('field_28').value)+"&"+
escape($('field_29').name)+"="+escape($('field_29').value)+"&"+
escape($('field_30').name)+"="+escape($('field_30').value)+"&"+
escape($('field_31').name)+"="+escape($('field_31').value)+"&"+
escape($('email').name)+"="+encodeURIComponent($('email').value)+"&"+
escape($('email_subscribe').name)+"="+escape($('email_subscribe').value)+"&"+
escape($('notify[blogger]').name)+"="+escape($('notify[blogger]').value)+"&";YAHOO.util.Connect.asyncRequest('POST',$('quick_email_alerts_form').action,{success:QuickFan.Success,failure:QuickFan.Fail},post_body);}};QuickHuffListContribute=function(){this.init.apply(this,arguments);};QuickHuffListContribute.prototype={listId:0,isFormLoaded:false,currentMap:null,currentMarker:null,init:function(listId){this.listId=listId;},show:function(){Modal.id='huff_modal_common';Modal.setWidth(600);Modal.showMask(Modal.id);if(!this.isFormLoaded){var me=this;YAHOO.util.Connect.asyncRequest('POST','/hufflists/webservice.php?action=get_contribute_form_html'+'&'+Math.random(),{success:function(o){me.onFormLoadSuccess(o);},failure:function(o){me.onFormLoadFail(o);}},'list_id='+me.listId);}},close:function(){Modal.hideMask();},onFormLoadSuccess:function(o){$('huff_modal_common_inner').innerHTML=o.responseText;this.isFormLoaded=true;this.show();var me=this;this.loadMap();Y.util.Event.addListener('hufflist_contribute_close','click',function(event){Y.util.Event.preventDefault(event);me.close();});Y.util.Event.addListener('hufflist_contribute_form','submit',function(event){this.action+='&'+Math.random();me.onFormSubmit(event);});Y.util.Event.addListener('hufflist_contribute_map_search','keypress',function(event){if(event.keyCode==13){Y.util.Event.preventDefault(event);me.onMapSearch(this.value);}});},loadMap:function(){Y.util.Event.addListener('body','unload',function(){GUnload();});this.currentMap=new GMap($('hufflist_contribute_map')),this.currentMarker=null,me=this;this.currentMap.setCenter(new GLatLng(37.649034,-92.460937),3);this.currentMap.enableDragging();this.currentMap.enableScrollWheelZoom();this.currentMap.addControl(new GSmallMapControl());this.currentMap.addControl(new GMenuMapTypeControl());if(HPBrowser.isIE8())
{var mousemovepoint=false;GEvent.addListener(this.currentMap,'mousemove',function(latlng){mousemovepoint=latlng;});}
GEvent.addListener(this.currentMap,'click',function(overlay,latlng){if(HPBrowser.isIE8())
latlng=mousemovepoint;if(!latlng){return;}
if(me.currentMarker){me.currentMarker.setLatLng(latlng);me.onSetLocation(latlng);}else{me.currentMarker=new GMarker(latlng,{draggable:true});GEvent.addListener(me.currentMarker,'dragend',function(latlng){me.onSetLocation(latlng);});me.currentMap.addOverlay(me.currentMarker);me.onSetLocation(latlng);}});},onMapSearch:function(address){var geocoder=new GClientGeocoder(),loader=$('hufflist_contribute_map_search_loader'),me=this;loader.style.display='inline';geocoder.getLatLng(address,function(latlng){loader.style.display='none';if(latlng){if(!me.currentMarker){me.currentMarker=new GMarker(latlng,{draggable:true});me.currentMap.addOverlay(me.currentMarker);GEvent.addListener(me.currentMarker,'dragend',function(latlng){me.onSetLocation(latlng);});}
me.currentMap.setZoom(13);me.currentMarker.setLatLng(latlng);me.currentMarker.openInfoWindowHtml(address);me.onSetLocation(latlng);}else{alert('Sorry, address not found');$('hufflist_contribute_map_search').value='';}});},onSetLocation:function(latlng){$('hufflist_contribute_lat').value=latlng.lat().toFixed(6);$('hufflist_contribute_lng').value=latlng.lng().toFixed(6);},onFormLoadFail:function(o){HPError.e();this.hideMask();},onFormSubmit:function(event){var me=this,list_id=parseInt($('hufflist_contribute_list_id').value),title=$('hufflist_contribute_title').value,body=$('hufflist_contribute_body').value,image=$('hufflist_contribute_image').value,lat=parseFloat($('hufflist_contribute_lat').value),lng=parseFloat($('hufflist_contribute_lng').value);if(title.length<3){alert('Please enter title');E.preventDefault(event);return false;}
if(body.length<3){alert('Please enter body');E.preventDefault(event);return false;}
if(list_needed_photo&&image==''){alert('Please select image');E.preventDefault(event);return false;}
if(!lat||!lng){alert('Please choose location');E.preventDefault(event);return false;}
this.onFormSubmitStart();return true;},onFormSubmitStart:function(){$('hufflist_contribute_submit_loader').style.display='inline';$('hufflist_contribute_submit').disabled=true;},onFormSubmitEnd:function(o){$('hufflist_contribute_submit_loader').style.display='none';$('hufflist_contribute_submit').disabled=false;try{var response=o;if(response.error!==''){this.onFormSubmitFail(response.error);}else{SNProject.track(parseInt(response.item_id),'hufflist_item_added',parseInt(HPUtil.GetEntryID(location.href)));this.onFormSubmitSuccess(o);}}catch(e){this.onFormSubmitFail(o);}},onFormSubmitSuccess:function(o){alert('Thank you for your contribution!');this.close();if(HPFB.user_just_login)
{location.href=location.href;}},onFormSubmitFail:function(error){HPError.e(error,true);}};GetEmailAlerts={array_default:[],u_old:0,Unsubscribe:function()
{var elements=document.getElementById('unsub_form');if(this.u_old==2)
{for(var i=0;i<elements.length;i++)
{if(elements[i].name!="status")
{elements[i].disabled=false;}}}
else if(this.u_old==1)
{for(var i=0;i<elements.length;i++)
{if(this.array_default[i]&&elements[i].name!="status")
{elements[i].checked=true;}
elements[i].disabled=false;}}
this.u_old=document.getElementById('sub_status').selectedIndex;if(this.u_old==2)
{for(var i=0;i<elements.length;i++)
{if(elements[i].name!="status"&&elements[i].name!="sub_button"&&elements[i].type!="hidden"&&elements[i].type!="submit")
{elements[i].disabled=true;}}}
else if(this.u_old==1)
{this.array_default=[];for(var i=0;i<elements.length;i++)
{if(elements[i].name!="status"&&elements[i].name!="sub_button"&&elements[i].type!="hidden"&&elements[i].type!="submit")
{this.array_default[i]=elements[i].checked;elements[i].checked=false;elements[i].disabled=true;}}}}};var join_twitter=HuffPoUtil.getUrlVar("join_twitter");if(join_twitter==1)
{if(HuffCookies.getUserId()!=null)
{HuffPoUtil.onPageReady(function(){window.location="http://"+HPConfig.current_web_address+"/users/preferences/#twitter_link";});}
else
{HuffPoUtil.onPageReady(function(){QuickLogin.pop('',{force_twitter:true});});}}
var unlink=HuffPoUtil.getUrlVar("unlink");if(unlink==1)
{HuffCookies.destroyCookie('is_post_to_twitter_checked');window.location=HuffPoUtil.getHostName()+"/users/preferences/";}
HuffPoUtil.onPageReady(function(){SNProject.linkAccountsBar('regular');});var twitsign=HuffPoUtil.getUrlVar("twitsign");if(twitsign)
{HuffPoUtil.onPageReady(function(){SNProject.showTopTwitterInfo(twitsign);});}
var QuickTwitterSignup={'lightbox_loaded':false,'lightbox_html':'','lightbox_id':'huff_snn_modal_common','loading_feedback':null,'current_vertical':null,'connected_countdown_counter':5,'add_suggest_callback':true,'huffpo_loggedin':false,'backup':{'username':null,'zip':null},'load':function()
{var QTSU=QuickTwitterSignup;QTSU.current_vertical=HPConfig.current_vertical_name;$(QTSU.lightbox_id).innerHTML=QTSU.lightbox_html;$('twsu_firstname').value='';$('twsu_lastname').value='';$('twsu_zip').value='';$('twsu_username').value='';$('twsu_password').value='';$('twsu_rpassword').value='';$('twsu_email').value='';if(QTSU.backup.username)$('twsu_username').value=QTSU.backup.username;if(QTSU.backup.zip)$('twsu_zip').value=QTSU.backup.zip;if(QTSU.huffpo_loggedin)
{$('twsu_form_pwd_expl').innerHTML='(for Twitter)';QTSU._yellowFade('twsu_form_pwd');}
QTSU.Form.filter();return false;},'Form':{'filter':function()
{if(HPUser.is_logged_in())
{if(!HuffPrefs.get('facebook'))
{var email_form_field=$('twsu_form_email');var email_field=$('twsu_email');if(email_form_field&&email_field)
{email_form_field.style.display='none';email_field.value='nonfbnull';}}
var fl_form_field=$('twsu_form_firstname');if(fl_form_field)fl_form_field.style.display='none';var username_field_expl=$('twsu_username_explanation');if(username_field_expl)username_field_expl.innerHTML='(<strong>Twitter\'s</strong> username)';var signup_form_title=$('twsu_signup_title');if(signup_form_title)signup_form_title.innerHTML='Hi '+HuffCookies.getUserName().replace(/_/,' ')+', let\'s get your Twitter account';}},'show':function(o)
{var QTSU=QuickTwitterSignup;QTSU.lightbox_html=o.responseText;$(QTSU.lightbox_id).innerHTML=QTSU.lightbox_html;QTSU.lightbox_loaded=true;QTSU.Form.filter();},'fail':function(o)
{var QTSU=QuickTwitterSignup;var HPE=HPError;QTSU.Loading.hide();HPE.e();Modal.hideMask();},'submit':function()
{var QTSU=QuickTwitterSignup;QTSU.Loading.show();QTSU.Error.hide();var params=[];params.push('twsu_username='+$('twsu_username').value);params.push('twsu_email='+$('twsu_email').value);params.push('twsu_zip='+$('twsu_zip').value);params.push('twsu_password='+$('twsu_password').value);params.push('twsu_rpassword='+$('twsu_rpassword').value);params.push('twsu_email='+$('twsu_email').value);params.push('twsu_firstname='+$('twsu_firstname').value);params.push('twsu_lastname='+$('twsu_lastname').value);var url='/users/signup/twitter_signup.php';YAHOO.util.Connect.asyncRequest('POST',url,{success:QTSU.Form.register,failure:QTSU.Form.fail,cache:false},params.join('&'));return false;},'register':function(o)
{var QTSU=QuickTwitterSignup;var HPE=HPError;QTSU.Loading.hide();try
{o=eval("("+o.responseText+")");}
catch(err)
{QTSU.Error.show('Sorry, we couldn\'t complete your registration request. Our engineers have been warned about this issue.<br />Please try again later.');HPE.e();return null;}
if(!o)
{QTSU.Error.show('Sorry, we couldn\'t complete your registration request. Our engineers have been warned about this issue.<br />Please try again later.');HPE.e();return null;}
if(o.errors)
{switch(o.errors)
{case'used email':var msg='Sorry, the email you entered is already used.<br />Change it or if its yours then please <a href="#" onclick="QuickTwitterSignup.login_handler(); return false;" style="color: yellow;">click here to Log in</a> with that account.';QTSU.Error.show(msg);break;case'no huffpo':var msg='Sorry, an internal error didn\' allow us to register your HuffPost account, but your Twitter account was successfully registered.';QTSU.Error.show(msg);break;case'used username':QTSU.Error.show('Sorry, the screen name you picked is already used, please choose another one');$('twsu_username').focus();break;case'not logged in':QTSU.Error.show('Sorry, you must be logged in on HuffPost to create a twitter account with us.');break;case'already twitter connected':QTSU.Error.show('You already have a Twitter account associated to your HuffPost account.');setTimeout(QTSU.connected_countdown,2000);break;case'no username':QTSU.Error.show('Sorry, you must provide an screen name.');$('twsu_username').focus();break;case'invalid username':QTSU.Error.show('Sorry, your screen name can only contain alphanumeric characters, underscores, and spaces.');$('twsu_username').focus();break;case'long username':QTSU.Error.show('Sorry, your screen name can only contain up to 15 characters.');$('twsu_username').focus();break;case'fake blogger':QTSU.Error.show('Sorry, your screen name can not start with <strong>hp_blogger</strong>.');$('twsu_username').focus();break;case'no zip':QTSU.Error.show('Sorry, you must provide an Zip code.');$('twsu_zip').focus();break;case'no email':QTSU.Error.show('Sorry, you must provide an email address.');$('twsu_email').focus();break;case'invalid email':QTSU.Error.show('Sorry but the email you entered is not correct. Please change it');break;case'no password':QTSU.Error.show('Sorry, you must provide a password.');$('twsu_password').focus();break;case'no rpassword':QTSU.Error.show('Sorry, you must repeat the password.');$('twsu_rpassword').focus();break;case'short password':QTSU.Error.show('Sorry, password must be at least 6 characters long.');$('twsu_password').focus();break;case'different passwords':QTSU.Error.show('Sorry, both passwords must be equal.');$('twsu_password').focus();break;case'twitter connect internal error':QTSU.Error.show('Sorry, we couldn\'t complete your registration request. Our engineers have been warned about this issue.<br />Please try again later.');break;case'no ajax':QTSU.Error.show('Sorry, we couldn\'t complete your registration request. Our engineers have been warned about this issue.<br />Please try again later.');break;case'twitter disabled':QTSU.Error.show('Sorry, but our integration with Twitter is currently down for maintenance. This shouldn\'t take long so please try again later.');break;default:if(/has already been taken on Twitter/.test(o.errors))
{var email_form_field=$('twsu_form_email');var email_field=$('twsu_email');if(email_form_field&&email_field)
{email_form_field.style.display='block';email_field.value='';$('twsu_email').focus();}}
QTSU.Error.show(o.errors.replace(/\n/g,"<br />"));break;}
HPE.e();return null;}
var suggest_params={'screen_name':o.twitter_screen_name,'new_user':true};var suggest_callback=function()
{var QS=QuickSignup;var QL=QuickLogin;var SNP=SNProject;QL.calledBySNN=true;QS.selectedService='twitter';QL.TwitterInfo={};QL.TwitterInfo.twitter_id=o.twitter_id;QL.TwitterInfo.twitter_screen_name=o.twitter_screen_name;QL.TwitterInfo.oauth_token=o.twitter_oauth_token;QL.TwitterInfo.oauth_secret=o.twitter_oauth_secret;HPFBQuickIntroduce.signUpMode='twitter';HPFBQuickIntroduce.modified_modal_params={close_button:false,use_logo_remove_button:false,inner_class:'modal_quick_introduce',width:'530',after_cb:function()
{$('modal_su_fp_container').style.display='none';Dom.addClass('fb_init_right_pane','customize_right_pane');Dom.addClass('fb_init_left_pane_title','customize_left_pane_title');Dom.addClass('fb_init_left_pane','customize_left_pane');Dom.removeClass('fb_init_left_pane','float_left');Dom.removeClass('init_preferences_form_submit','display_none');$('modal_su_fp_container').style.display='block';}};SNP._postJoin();return false;};if(QTSU.add_suggest_callback)suggest_params.callback=suggest_callback;QuickTwitterSuggest.load(suggest_params);return false;}},'test_spj':function()
{var QS=QuickSignup;var QL=QuickLogin;var SNP=SNProject;QL.calledBySNN=true;QS.selectedService='twitter';HPFBQuickIntroduce.signUpMode='twitter';HPFBQuickIntroduce.modified_modal_params={close_button:false,use_logo_remove_button:false,inner_class:'modal_quick_introduce',width:'530',after_cb:function()
{$('modal_su_fp_container').style.display='none';Dom.addClass('fb_init_right_pane','customize_right_pane');Dom.addClass('fb_init_left_pane_title','customize_left_pane_title');Dom.addClass('fb_init_left_pane','customize_left_pane');Dom.removeClass('init_preferences_form_submit','display_none');Dom.removeClass('fb_init_left_pane','float_left');$('modal_su_fp_container').style.display='block';}};SNP._postJoin();},'login_handler':function()
{var QL=QuickLogin;QuickTwitterSignup.FBLoginCallback=QL.OnSuccessCallback=function()
{var QTSU=QuickTwitterSignup;QTSU.add_suggest_callback=false,QTSU.huffpo_loggedin=true;QuickLogin.pop(false,{signup:true,force_twitter:true});QTSU.load();if(HuffPrefs.get('twitter'))
{QTSU.Error.show('You already have a Twitter account associated to your HuffPost account.');setTimeout(QTSU.connected_countdown,2000);}
return false;};var ql_callback=function()
{var tw_login_button=$('twitter_fast_login_connect');if(tw_login_button)tw_login_button.style.display='none';return false;};var QTSU=QuickTwitterSignup;QTSU.Error.hide();QTSU.lightbox_html=$(QTSU.lightbox_id).innerHTML;QTSU.backup.username=$('twsu_username').value;QTSU.backup.zip=$('twsu_zip').value;QuickSNProject.showModal('/users/login/really_fast_login.php',{inner_class:'service_select_modal',width:850,after_cb:ql_callback,cb:function(){QuickLogin.pop(false,{signup:true,force_twitter:true});QuickTwitterSignup.load();}});return false;},'connected_countdown':function()
{var QTSU=QuickTwitterSignup;if(QTSU.connected_countdown_counter==0)
{window.location='/users/preferences/';return null;}
var msg='You already have a Twitter account associated to your HuffPost account.<br />';msg+='Redirecting you to your preferences in '+QTSU.connected_countdown_counter+' seconds...';QTSU.Error.show(msg);QTSU.connected_countdown_counter-=1;setTimeout(QTSU.connected_countdown,1000);},'Loading':{'show':function()
{var loading=$('twsu_loading');var button=$('twsu_button');var tos=$('twsu_tos');if(!loading||!button)
return false;$('twsu_submit').style.display='none';Dom.removeClass(tos,'twsu_tos');Dom.addClass(tos,'twsu_tos_loading');loading.style.display='inline';button.style.display='none';$('twsu_submit').style.display='block';},'hide':function()
{var loading=$('twsu_loading');var button=$('twsu_button');var tos=$('twsu_tos');if(!loading||!button)
return false;$('twsu_submit').style.display='none';Dom.removeClass(tos,'twsu_tos_loading');Dom.addClass(tos,'twsu_tos');loading.style.display='none';button.style.display='inline';$('twsu_submit').style.display='block';}},'Error':{'show':function(msg)
{if(!msg)return null;var error_el=$('twsu_error');error_el.innerHTML=msg;error_el.style.display='block';},'hide':function()
{var error_el=$('twsu_error');error_el.innerHTML='';error_el.style.display='none';}},_yellowFade:function(id)
{if(!id)return null;var el=$(id);if(el)
{var orig_bgcolor='#efefef';el.style.background='#ffff00';var attributes={backgroundColor:{to:orig_bgcolor}};var anim=new YAHOO.util.ColorAnim(id,attributes);anim.animate();}
return false;}};var QuickTwitterSuggest={'callback':null,'lightbox_loaded':false,'lightbox_html':'','lightbox_id':'huff_snn_modal_common','loading_feedback':null,'page_vertical':null,'new_user':true,'currently_loaded_vertical':null,'vertical_loaded':{'politics':false},'followed_by_vertical':new Array(),'twitter_screen_name':null,'default_vertical':'politics','scrollbar':null,'follow_counter':0,'backup':{'follow_counter':0},'test':function(screen_name)
{var id='huff_snn_modal_common';Modal.id=id;Modal.setWidth(500);Modal.showMask(Modal.id);if(!screen_name)screen_name='huffporamtest10';this.load({'screen_name':screen_name,'new_user':true});},'load':function(prefs)
{var QTS=QuickTwitterSuggest;if(prefs)
{if(prefs.callback)QTS.callback=prefs.callback;if(prefs.lightbox_id)QTS.lightbox_id=prefs.lightbox_id;if(prefs.screen_name)QTS.twitter_screen_name=prefs.screen_name;if(prefs.new_user)QTS.new_user=prefs.new_user;}
this.page_vertical=HPConfig.current_vertical_name;if(this.page_vertical=='homepage')this.page_vertical=this.default_vertical;QuickSNProject.hideMask_cb.push(function()
{window.location='/social/';});if(!this.lightbox_loaded)
{YAHOO.util.Connect.asyncRequest('GET','/twitter/quicktwitter_suggestion.php',{success:QTS.show,failure:QTS.fail});}
else
{QTS.show();}},'show':function(o)
{var QTS=QuickTwitterSuggest;if(o&&o.responseText)
{QTS.lightbox_html=o.responseText;}
$(QTS.lightbox_id).innerHTML=QTS.lightbox_html;if(QTS.twitter_screen_name)
$('twsu_suggestions_title').innerHTML='Welcome to Twitter and HuffPost '+QTS.twitter_screen_name;else
$('twsu_suggestions_title').innerHTML='HuffPost\'s picked Twitter users';if(QTS.new_user&&QTS.twitter_screen_name)
{$('twsu_suggestions_desc').innerHTML='You now have a Twitter account with the username "'+QTS.twitter_screen_name+'", and the password you entered previously.<br />You can log in to Huffington Post in future by clicking <img class="twsu_login_butt" src="/images/twsu_login_butt.gif" alt="twitter login" height="16" width="16" /> or hitting login and clicking "Sign in with Twitter".';}
else
{$('twsu_suggestions_desc').innerHTML='Here on HuffPost we thought you\'d like to follow some of these hand-picked Twitter users...';}
QTS.lightbox_loaded=true;if(QTS.backup.follow_counter>0)
{QTS.follow_counter=QTS.backup.follow_counter;QTS.Friendship.updateCounter();}
if(!QTS.scrollbar)
{var fileref=document.createElement("link");fileref.setAttribute("rel","stylesheet");fileref.setAttribute("type","text/css");fileref.setAttribute("href",'/css/v/hp_scrollbar.css');if(typeof fileref!="undefined")document.getElementsByTagName("head")[0].appendChild(fileref)
HuffPoUtil.loadAndRun('/include/lib/hp_scrollbar.js',function()
{var QTS=QuickTwitterSuggest;QTS.scrollbar=new HPScrollbar('twsu_suggestions_users','twsu_suggestions_scroll',610);QTS.Vertical.load();});}
else
QTS.Vertical.load();return false;},'fail':function(o)
{alert('Sorry but this process has been halted. Your twitter accounts has been successfully created and you can use it later to log in on HuffPost as well.');HPError.e();Modal.hideMask();},'next_step':function()
{var QTS=QuickTwitterSuggest;var modal_close=$('huff_snn_modal_common_close');if(modal_close)modal_close.style.display='block';if(QTS.callback)
QTS.callback();else
window.location='/social/';return false;},'Vertical':{'refresh_list':function(vertical)
{var QTS=QuickTwitterSuggest;if(!vertical)vertical=QTS.page_vertical;var list=$('twsu_verticals_list');Dom.getElementsByClassName('selected','li',list,function(o)
{Dom.removeClass(o,'selected');var link=$(o.id+'_link');link.innerHTML=link.innerHTML.substr(0,link.innerHTML.length-2);Dom.removeClass(link,'selected');});var el=$('twsu_vertical_'+vertical);var link=$('twsu_vertical_'+vertical+'_link');if(!el||!link)
{QTS.Vertical.load(QTS.default_vertical);return false;}
Dom.addClass(el,'selected');Dom.addClass(link,'selected');link.innerHTML+=' &raquo;';return false;},'load':function(vertical)
{var QTS=QuickTwitterSuggest;QTS.Loading.show();QTS.Error.hide();if(!vertical)vertical=QTS.page_vertical;QTS.Vertical.refresh_list(vertical);if(QTS.vertical_loaded[vertical])
{var obj={'argument':{'vertical':vertical}};QTS.Vertical.get(obj);return false;}
var url='/twitter/twitter_suggestions.php?vertical='+vertical;YAHOO.util.Connect.asyncRequest('GET',url,{success:QTS.Vertical.get,failure:QTS.Vertical.fail,argument:{'vertical':vertical,'track':true}});return false;},'get':function(o)
{var QTS=QuickTwitterSuggest;var HPE=HPError;QTS.Loading.hide();var this_vertical=o.argument.vertical;var track_suggested=o.argument.track;if(!QTS.vertical_loaded[o.argument.vertical])
{try
{o=eval("("+o.responseText+")");}
catch(err)
{QTS.Error.show('Sorry, we couldn\'t retrieve the suggested users list. Our engineers have been warned about this issue.<br />Please try again later.');HPE.e();return false;}
if(!o)
{QTS.Error.show('Sorry, we couldn\'t retrieve the suggested users list. Our engineers have been warned about this issue.<br />Please try again later.');HPE.e();return false;}
if(o.errors)
{switch(o.errors)
{case'twitter disabled':QTS.Error.show('Sorry, currently we have our Twitter features disabled. Please try again later.');break;default:QTS.Error.show('Sorry, we couldn\'t complete your registration request. Our engineers have been warned about this issue.<br />Please try again later.');break;}
HPE.e();return false;}
QTS.vertical_loaded[this_vertical]=o.html;QTS.Vertical.hide();QTS.Vertical.show(o.vertical,o.html);QTS.currently_loaded_vertical=o.vertical;}
else
{QTS.Vertical.hide();QTS.Vertical.show(o.argument.vertical);if(QTS.followed_by_vertical[o.argument.vertical])
{var followed_in_array=QTS.followed_by_vertical[o.argument.vertical];var followed_in_array_len=followed_in_array.length;for(var i=0;i<followed_in_array_len;i++)
{QTS.Friendship.createSuccess(followed_in_array[i],o.argument.vertical);}}
QTS.currently_loaded_vertical=o.argument.vertical;}
if(QTS.scrollbar)
{QTS.scrollbar.reset();QTS.scrollbar.update();}
if(track_suggested)
{QTS.track(this_vertical);}
return true;},'show':function(vertical,html)
{if(!vertical)return false;var vert=$('twsu_suggested_'+vertical);if(vert)
{if(!html)html=QuickTwitterSuggest.vertical_loaded[vertical];vert.innerHTML=html;vert.style.display='inline';}
return false;},'hide':function(vertical)
{var QTS=QuickTwitterSuggest;if(!vertical)vertical=QTS.currently_loaded_vertical;var vert=$('twsu_suggested_'+vertical);if(vert)vert.style.display='none';},'fail':function(o)
{var QTS=QuickTwitterSuggest;QTS.Loading.hide();alert('Sorry couldn\'t load this vertical suggested users');HPError.e();Modal.hideMask();}},'track':function(vertical)
{if(!vertical)return false;var url='/twitter/track_twitter_suggestions.php';var params='vertical='+vertical;YAHOO.util.Connect.asyncRequest('POST',url,{success:function(o){},failure:function(o){}},params);return false;},'Friendship':{'trackFollowedUser':function(screen_name,vertical)
{var QTS=QuickTwitterSuggest;if(!QTS.followed_by_vertical[vertical])QTS.followed_by_vertical[vertical]=new Array();QTS.followed_by_vertical[vertical].push(screen_name);},'createFail':function(screen_name,vertical)
{var root='tw_suggested_'+vertical.toLowerCase()+'_'+screen_name.toLowerCase();$(root+'_waiting').style.display='none';$(root+'_follow').style.display='inline';},'createSuccess':function(screen_name,vertical)
{var root='tw_suggested_'+vertical.toLowerCase()+'_'+screen_name.toLowerCase();$(root+'_follow_container').style.color='green';$(root+'_follow_container').style.fontWeight='bold';$(root+'_follow_container').innerHTML='Following!';},'decrementCounter':function()
{var QTS=QuickTwitterSuggest;QTS.follow_counter--;QTS.Friendship.updateCounter();QTS.backup.follow_counter=QTS.follow_counter;return false;},'incrementCounter':function()
{var QTS=QuickTwitterSuggest;QTS.follow_counter++;QTS.Friendship.updateCounter();QTS.backup.follow_counter=QTS.follow_counter;return false;},'updateCounter':function()
{var QTS=QuickTwitterSuggest;var fcontainer=$('tw_suggested_follow_count');if(fcontainer)fcontainer.innerHTML=QTS.follow_counter;return false;},'create':function(tw_id,tw_screen_name,vertical)
{if(!tw_id||!tw_screen_name)return null;var QTF=QuickTwitterFriendship;var params={'pre_callback':function(id,screen_name,args)
{var QTS=QuickTwitterSuggest;QTS.Error.hide();var vertical=args.vertical
var root='tw_suggested_'+vertical.toLowerCase()+'_'+screen_name.toLowerCase();$(root+'_waiting').style.display='inline';$(root+'_follow').style.display='none';QTS.Friendship.incrementCounter();return false;},'error_callback':function(errmsg,id,screen_name,args)
{var vertical=args.vertical;var QTS=QuickTwitterSuggest;QTS.Friendship.decrementCounter();switch(errmsg)
{case'already following':QTS.Friendship.createSuccess(screen_name,vertical);QTS.Friendship.trackFollowedUser(screen_name,vertical);break;case'not authenticated':QTS.Error.show("Sorry, but you must be authenticated with Twitter to follow some user. Please be sure to do it first.");QTS.Friendship.createFail(screen_name,vertical);break;default:QTS.Error.show("Sorry, we got an internal error and couldn't help you to follow this user. Please try again later :(");QTS.Friendship.createFail(screen_name,vertical);}
return false;},'post_callback':function(id,screen_name,args)
{var QTS=QuickTwitterSuggest;var vertical=args.vertical;QTS.Friendship.createSuccess(screen_name,vertical);QTS.Friendship.trackFollowedUser(screen_name,vertical);return false;},'arguments':{'vertical':vertical},'querystring':'track_hp_follow=1&vertical='+vertical};QTF.create(tw_id,tw_screen_name,params);return false;}},'Loading':{'show':function()
{var QTS=QuickTwitterSuggest;if(QTS.currently_loaded_vertical)
{QTS.Vertical.hide();}
if($('twsu_suggestions_loading'))
{$('twsu_suggestions_loading').style.display='block';}},'hide':function()
{if($('twsu_suggestions_loading'))
{$('twsu_suggestions_loading').style.display='none';}}},'Error':{'show':function(msg)
{if(!msg)return null;var error_el=$('twsu_error');error_el.innerHTML=msg;error_el.style.display='block';},'hide':function()
{var error_el=$('twsu_error');error_el.innerHTML='';error_el.style.display='none';}}};var QuickTwitterFriendship={'action':function(what,tw_id,tw_screen_name,params)
{if(!tw_id||!tw_screen_name)return null;if(!HPUser.is_logged_in())
{var callback=function()
{Modal.hideMask();QuickTwitterFriendship.action(what,tw_id,tw_screen_name,params);HPUtil.reinit();};linkSocialAccount.onLinkSuccess=SNProject.finalSignupCallback=QuickTwitterSuggest.callback=callback;QuickLogin.pop(false,{signup:true,force_twitter:true});return false;}
else
{if(!HuffPrefs.get('twitter'))
{var ans=confirm('You don\'t have a connected Twitter account. Would you like to go to your preferences to connect one?');if(ans)
{window.location='/users/preferences/';return true;}
return false;}}
var pre_callback=params.pre_callback||function(tw_id,tw_screen_name,args){};var post_callback=params.post_callback||function(tw_id,tw_screen_name,args){};var error_callback=params.error_callback||function(errmsg,tw_id,tw_screen_name,args){};if(!params.arguments)params.arguments={};pre_callback(tw_id,tw_screen_name,params.arguments);var callback={'success':function(o)
{try
{o=eval("("+o.responseText+")");}
catch(err)
{error_callback('bad response',tw_id,tw_screen_name,params.arguments);return false;}
if(!o)
{error_callback('response not parsed',tw_id,tw_screen_name,params.arguments);return false;}
if(o.error)
{error_callback(o.error,tw_id,tw_screen_name,params.arguments);return false;}
if(o.resp&&o.resp=='ok')
{post_callback(tw_id,tw_screen_name,params.arguments);}
else
{error_callback('internal error',tw_id,tw_screen_name,params.arguments);}
return false;},'failure':function(o)
{error_callback('request failure',tw_id,tw_screen_name,params.arguments);return false;},'cache':false};var url='/users/social_news_project/twitter/follow_user.php?follow_user_id='+tw_id+'&follow_screen_name='+tw_screen_name;if(what=='destroy')
url='/users/social_news_project/twitter/unfollow_user.php?unfollow_user_id='+tw_id+'&unfollow_screen_name='+tw_screen_name;if(params.querystring)url+='&'+params.querystring;YAHOO.util.Connect.asyncRequest('GET',url,callback);return false;},'create':function(tw_id,tw_screen_name,params)
{return this.action('create',tw_id,tw_screen_name,params);},'destroy':function(tw_id,tw_screen_name,params)
{return this.action('destroy',tw_id,tw_screen_name,params);}};
var Provider={user_provider_info:{'twitter':{},'yahoo':{},'google':{},'linkedin':{}},SignUp:function(parameters)
{var get_data='';if("object"==typeof parameters)
{for(var i in parameters)
{get_data='&'+i+'='+parameters[i]+',';}
get_data=get_data.substr(0,get_data.length-1);}
var url="http://"+HPConfig.current_web_address+"/users/signup/provider/index.php?type="+QuickSignup.selectedService+get_data+'&'+Math.random();var w=500;if(QuickSignup.selectedService=='twitter')
w=800;PopupManager.open(url,w,500);PopupManager.onClose=function(){Provider.Connect();};},Connect:function()
{var QS=QuickSignup;if(!QS.initted)
QS.init();if("undefined"!=typeof(Provider.user_provider_info[QS.selectedService].id))
{if(QS.selectedService=='twitter')
{$('modal_su_inner_twitter_dual').style.display='none';$('modal_su_inner').style.display='block';}
QS.setConnected(QS.selectedService);QS.fadeForm(false);var userinfo=$('modal_su_userinfo_'+QS.selectedService);if(!userinfo)return;userinfo.parentNode.style.display='block';}
return;},QuickLogin:function(provider)
{var QS=QuickSignup;if("undefined"==typeof provider){QS.selectedService='yahoo';}else{QS.selectedService=provider;}
var url="http://"+HPConfig.current_web_address+"/users/login/provider/index.php?type="+QS.selectedService+'&'+Math.random();var w=500;if(provider=='twitter')
w=800;PopupManager.open(url,w,500);PopupManager.onClose=function(){Provider.LoginConnect();};},LoginConnect:function()
{var QL=QuickLogin;var QS=QuickSignup;if("undefined"!=typeof(Provider.user_provider_info[QS.selectedService].Status))
{if(Provider.user_provider_info[QS.selectedService].Status=="existed_user")
QL.onLoginSuccess();else if(Provider.user_provider_info[QS.selectedService].Status=="new_user")
{Modal.hideMask();var provider=QS.selectedService;var callback=function()
{QuickSignup.selectedService=provider;var huff_snn_modal_common=$('huff_snn_modal_common')||false;var modal_su_service=$('modal_su_'+QS.selectedService)||false;if(huff_snn_modal_common&&modal_su_service)
{modal_su_service.style.display='none';if(QS.selectedService=="twitter")
{$('modal_su_inner_twitter_dual').style.display='none';$('modal_su_inner').style.display='block';}
QS.setConnected(QS.selectedService);QS.showUserInfo();QS.fadeForm(false);}
return;};QuickLogin.pop(false,{signup:true,show_tab:QS.selectedService,callback:callback});}
else{HPError.e('something went wrong');}}
else
HPError.e('something else went wrong');}};var linkSocialAccount={provider:'',facebookInfo:{},gfcInfo:{},onLinkSuccess:false,checkLoginStatus:function(provider,callbacks){var QL=QuickLogin;var SNP=SNProject;if(undefined===provider)
return false;if(callbacks&&typeof callbacks.onLinkSuccess=='function')
{this.onLinkSuccess=callbacks.onLinkSuccess;}
if(HuffCookies.getUserName())
{if(HuffPrefs.get(provider+''))
{if(callbacks&&typeof callbacks.linked==='function')
callbacks.linked();return false;}
if('facebook'===provider){this.provider='facebook';linkSocialAccount.FacebookPromtLogin();}
else if('twitter'===provider){this.provider='twitter';linkSocialAccount.PromptLogin();}
else if('yahoo'===provider){this.provider='yahoo';linkSocialAccount.PromptLogin();}
else if('google'===provider){this.provider='google';linkSocialAccount.PromptLogin();}
else if('linkedin'===provider){this.provider='linkedin';linkSocialAccount.PromptLogin();}}
else
{if('facebook'===provider){QL.avoidFBCallbackBeforeHPLogin=true;QL.FacebookLoginCallback=SNP._tryToJoinUser;HPFB.login(QL.FacebookLoginCallback);}
else if('twitter'===provider){Provider.QuickLogin('twitter');}
else if('yahoo'===provider){Provider.QuickLogin('yahoo');}
else if('google'===provider){Provider.QuickLogin('google');}
else if('linkedin'===provider){Provider.QuickLogin('linkedin');}}},FacebookPromtLogin:function(){HPFB.waitForSession(function()
{if('connected'==HPFB.user_status)
{var rt=new Date().getTime();var session=HPFB.getSessionForServer();YAHOO.util.Connect.asyncRequest('POST','/users/login/provider/check_user_status.php',{success:linkSocialAccount.FacebookSuccess,failure:QuickLogin.ServiceLoginFail},'provider=facebook'+(session?'&'+session:''));}
else if('notConnected'==HPFB.user_status)
{if(!QuickLogin.bIsLoggedInFacebook)return false;QuickLogin.bIsLoggedInFacebook=false;return false;}});},FacebookSuccess:function(o){var QL=QuickLogin;var result=JSON.parse(o.responseText);switch(result.msg)
{case'existed_user':case'new_user':linkSocialAccount.facebookInfo.fb_id=result.fb_id||'';linkSocialAccount.facebookInfo.user_id=result.user_id||'';linkSocialAccount.facebookInfo.user_name=result.user_name||'';linkSocialAccount.facebookInfo.Status=result.msg;Modal.hideMask();linkSocialAccount.PromptForConnectPop();break;case'current_user':Modal.hideMask();break;default:QL.ServiceLoginFail(result);break;}
return;},PromptLogin:function(){var url="http://"+HPConfig.current_web_address+"/users/login/provider/link_login.php?type="+linkSocialAccount.provider+'&'+Math.random();if("yahoo"==linkSocialAccount.provider)
PopupManager.open(url,500,500);else if("twitter"==linkSocialAccount.provider)
PopupManager.open(url,800,500);else if("google"==linkSocialAccount.provider)
PopupManager.open(url,550,550);else if("linkedin"==linkSocialAccount.provider)
PopupManager.open(url,550,550);PopupManager.onClose=function(){linkSocialAccount.PromptLoginConnect();};},PromptLoginConnect:function(){if(Provider.user_provider_info[linkSocialAccount.provider].Status&&"undefined"!=typeof(Provider.user_provider_info[linkSocialAccount.provider]))
{linkSocialAccount.PromptForConnectPop();}
else{Modal.hideMask();HPError.e('something went wrong');}
return;},PromptForConnectPop:function()
{if(linkSocialAccount.provider=='facebook'){var status=linkSocialAccount.facebookInfo.Status;}
else{var status=Provider.user_provider_info[linkSocialAccount.provider].Status;}
var html=this.getPromptPopHtml(status);if(html!="")
{var param={width:550,use_logo_remove_button:false,inner_class:'modal_link_your_social_account'};if(/existed_user/.test(status))
var param={width:550,cb:linkSocialAccount.callback,inner_class:'modal_link_your_social_account'};QuickSNProject.showModal(html,param);}
else
{Modal.hideMask();HPError.e('something went wrong');}
return;},getPromptPopHtml:function(status)
{var html="";var userName=HuffCookies.getUserName().replace('hp_blogger_','').replace('_',' ');var provider=linkSocialAccount.provider.charAt(0).toUpperCase()+linkSocialAccount.provider.substr(1);if(/new_user/.test(status))
{html+="<div class=\"connect_pop_head\">Link your "+provider+" account?</div>"+
"<p class=\"connect_pop_name\">Hi "+userName+",</p>"+
"<br />"+
"<p class=\"connect_pop_main_text\">Would you like to link your account to your Huffington Post account?</p>"+
"<br />"+
"<p class=\"connect_pop_sub_text\">By linking your "+provider+" account to your Huffington Post account, you will be able to log in to Huffpost using your "+provider+" credentials. You will also gain access to new features and be able to more easily see what your "+provider+" friends are up to on this site.</p>"+
"<br />"+
"<div id=\"user_link_reaction\">"+
"<div class=\"connect_pop_yes\" onclick=\"linkSocialAccount.ConnectProvider(); return false;\">Yes</div>"+
"<div class=\"connect_pop_no\" onclick=\"QuickSNProject.hideMask(); return false;\">No</div>"+
"</div>"+
"<div class=\"clear\"></div>"+
"<br /><br />"+
"<p class=\"connect_pop_notyou\">Not "+userName+"? Please <a href=\"/users/logout\">click here</a> to log out, then log back in with your correct account.</p>"+
"</div><br />";}
else if(/existed_user/.test(status))
{if('facebook'==linkSocialAccount.provider){oldUserName=linkSocialAccount.facebookInfo.user_name;}else{oldUserName=Provider.user_provider_info[linkSocialAccount.provider].user_name;}
html+="<div class=\"connect_pop_head\">Do you wish to re-link your "+provider+" account?</div>"+
"<p class=\"connect_pop_name\">Hi "+userName+",</p>"+
"<br />"+
"<p class=\"connect_pop_sub_text\">This "+provider+" account is already linked to the Huffington Post username '"+oldUserName+"' . Would you like to instead associate it with your current account '"+userName+"' ?</p>"+
"<br />"+
"<div id=\"user_link_reaction\">"+
"<div class=\"connect_pop_yes\" onclick=\"linkSocialAccount.ConnectProvider(); return false;\">Yes</div>"+
"<div class=\"connect_pop_no\" onclick=\"QuickSNProject.hideMask(); return false;\">No</div>"+
"</div>"+
"<div class=\"clear\"></div>"+
"</div><br /><br />";}
return html;},ConnectProvider:function()
{var SA=linkSocialAccount;if(null!=$('huffpo_snn_is_loading'))HuffPoUtil.show('huffpo_snn_is_loading');if(null!=$('user_link_reaction'))HuffPoUtil.hide('user_link_reaction');var provider_uid=0;var uid=0;var uname='';var custom_data='';var post_data='';var status='';var rt=new Date().getTime();switch(SA.provider)
{case'facebook':provider_uid=SA.facebookInfo.fb_id;status=SA.facebookInfo.Status;uid=SA.facebookInfo.user_id||'';uname=SA.facebookInfo.user_name||'';custom_data='&'+HPFB.getSessionForServer();break;case'twitter':provider_uid=Provider.user_provider_info[SA.provider].id;status=Provider.user_provider_info[SA.provider].Status;uid=Provider.user_provider_info[SA.provider].user_id||'';uname=Provider.user_provider_info[SA.provider].user_name||'';custom_data='&name='+Provider.user_provider_info.twitter.screen_name+
'&t='+encodeURIComponent(Provider.user_provider_info.twitter.oauth_token)+
'&s='+encodeURIComponent(Provider.user_provider_info.twitter.oauth_token_secret)+
'&img='+escape(Provider.user_provider_info.twitter.profile_image);break;case'yahoo':case'google':case'linkedin':provider_uid=Provider.user_provider_info[SA.provider].id;status=Provider.user_provider_info[SA.provider].Status;uid=Provider.user_provider_info[SA.provider].user_id||'';uname=Provider.user_provider_info[SA.provider].user_name||'';custom_data='&access_token='+encodeURIComponent(Provider.user_provider_info[SA.provider].access_token);break;default:Modal.hideMask();HPError.e('something went wrong');return;}
post_data="provider="+SA.provider+"&puid="+provider_uid+"&status="+status+"&uid="+uid+"&uname="+uname+custom_data+"&r="+rt;C.asyncRequest('POST','/users/login/provider/link_provider.php',{success:linkSocialAccount.LinkSuccess,failure:QuickLogin.ServiceLoginFail},post_data);return;},LinkSuccess:function(o){if(null!=$('huffpo_snn_is_loading'))
HuffPoUtil.hide('huffpo_snn_is_loading');if(null!=$('user_link_reaction'))
HuffPoUtil.show('user_link_reaction');if(null!=$('user_relink_reaction'))
HuffPoUtil.show('user_relink_reaction');switch(o.responseText)
{case"success":QuickSNProject.hideMask();HuffCookies.setCookie('check_for_fans',1);if(typeof linkSocialAccount.onLinkSuccess=='function')
{return linkSocialAccount.onLinkSuccess();}
else
{location.href=location.href;}
break;case"error":QuickSNProject.hideMask();break;default:QuickSNProject.hideMask();break;}},callback:function(){QuickSNProject.hideMask();location.href=location.href;}};
PlaceTools=function(seed,soil,adjacent){ps=soil.getElementsByTagName('P');id=seed.id;if(ps.length>2)
{ps[2].parentNode.insertBefore(seed,ps[2]);HuffPoUtil.show(seed.id);}
else
if(ps.length>1)
{ps[1].parentNode.insertBefore(seed,ps[1]);HuffPoUtil.show(seed.id);}
else if(ps.length==1&&ps[0].innerHTML.match(/(<br.?>\s*?<br.?>)/))
{outerHTML='<div class="'+seed.className+'" id="'+seed.id+'">'+seed.innerHTML+'</div>';seed.parentNode.removeChild(seed);ps[0].innerHTML=ps[0].innerHTML.replace(/(<br.?>\s*?<br.?>)/,'<br><br>'+outerHTML);HuffPoUtil.show(seed.id);}
y1=Dom.getY(id);y2=Dom.getY(adjacent);if(y1&&y2&&(y1+150)>=y2)
{HuffPoUtil.hide(id);}};function addBookmark(url,title){title=title||"HuffingtonPost";url=(!url)?location.href:url;title=(!title)?document.title:title;if((typeof window.sidebar=="object")&&(typeof window.sidebar.addPanel=="function")){}
else if(typeof window.external=="object"){window.external.AddFavorite(url,title);}
else if(window.opera&&document.createElement){return true;}else{return false;}
return false;};function addBookmark_mac(url,title){if(document.all){window.external.AddFavorite(url,title);}else{window.sidebar.addPanel(url,title);}};SharePost={share_form_ajax_response:false,pop:function(eid,vert,big_news_title)
{this.trackingPixelOnShareAction();this.image_loaded=false;Modal.showMask('huff_modal_common');HuffPoUtil.hide('message_sent');if(vert!=""&&vert.toLowerCase().replace(/ /g,'-'))
{$('close_share').innerHTML='<img src="/images/quickread/closeqr-'+vert.toLowerCase().replace(/ /g,'-')+'.gif?ver=2" onload="SharePost.image_loaded = true;" id="close_share" align="right" alt=""/>';}
else
{$('close_share').innerHTML='<img src="/images/quickread/closeqr-home.gif" id="close_share" align="right" alt=""/>';}
vert=vert||"home";if($('modal_inner_share')!="")
{Dom.addClass('modal_inner_share',vert.toLowerCase().replace(/ /g,'-'));}
else
{Dom.addClass('modal_inner',vert.toLowerCase().replace(/ /g,'-'));}
E.onAvailable('modal_inner_share',function(){SharePost._pop(eid,vert,big_news_title)});},_pop:function(eid,vert,big_news_title)
{this.share_id=eid;this.big_news_title=big_news_title;if(!this.image_loaded)
{window.setTimeout(function(){SharePost._pop(eid,vert,big_news_title)},10);return;}
HuffPoUtil.show('menu_im_email');HuffPoUtil.show('share_tool_form');HPTrack.trackPageview('/t/a/initiate_share');YAHOO.util.Dom.setStyle('huff_modal_common','visibility','hidden');if(typeof($('huff_modal_share'))!="undefined")
{Modal.showMask('huff_modal_share');}
else
{Modal.showMask('huff_modal');}
var url='/social/entry_share.php?share_id='+eid;if(!this.share_form_ajax_response)
{YAHOO.util.Connect.asyncRequest('GET',url,{success:SharePost.showShareFormSuccess,failure:SharePost.showShareFormFail});}
else
{this.showShareFormSuccess(this.share_form_ajax_response);}
return false;},showShareFormSuccess:function(o)
{SharePost.share_form_ajax_response=o;if(o.responseText)
{Dom.addClass('share_tools_loader','display_none');Dom.removeClass('share_tools','display_none');var el=$('share_tools');if(el)
{el.innerHTML=o.responseText;ShareBox.chooseShareVia('email');if($('error_message_share'))
{$('error_message_share').innerHTML='';}
$('entry_id_share').value=SharePost.share_id;$('im_message_share').value=document.location.href;if(SharePost.big_news_title!=""&&$('share_head')!="undefined")
{if($('share_head')){$('share_head').innerHTML=SharePost.big_news_title;}}
else
{if($('title_permalink'))
{if($('share_head')){$('share_head').innerHTML=$('title_permalink').innerHTML;}}
else if($('title_permalink_bold'))
{if($('share_head')){$('share_head').innerHTML=$('title_permalink_bold').innerHTML;}}}}
else
SharePost.showShareFormFail();}
else
SharePost.showShareFormFail();},showShareFormFail:function()
{Modal.hideMask();return;},submitShare:function()
{HPTrack.trackPageview('/t/a/finish_share');post_body='';SharePost.killSubmitButton('post_button','post_spinner');Dom.batch(Dom.getElementsByClassName('share_field',null,'share_email'),function(el){post_body+=escape(el.name)+"="+escape(el.value)+"&";});YAHOO.util.Connect.asyncRequest('POST',$('share_email').action,{success:SharePost.shareSuccess,failure:SharePost.shareFail},post_body);},shareSuccess:function(o)
{if(o.responseText!='success')
return SharePost.shareFail(o);$('error_message_share').innerHTML="<h3>Your message has been sent!</h3>";SharePost.restoreSubmitButton('post_button','post_spinner');},shareFail:function(o)
{$('error_message_share').innerHTML="<h5>There was a problem:</h5><p>"+o.responseText+"</p>";SharePost.restoreSubmitButton('post_button','post_spinner');},killSubmitButton:function(button_id,wait_id)
{$(button_id).disabled=true;HuffPoUtil.hide(button_id);Dom.setStyle(wait_id,'display','inline');},restoreSubmitButton:function(button_id,wait_id)
{$(button_id).disabled=false;Dom.setStyle(wait_id,'display','none');Dom.setStyle(button_id,'display','inline');},trackingPixelOnShareAction:function(){if(this.tracking_pixel_url){if(this.tracking_pixel_url["common"]&&this.tracking_pixel_url["common"]!='')
{HPUtil.trackerImg(this.tracking_pixel_url["common"],document.body);}
if(this.tracking_pixel_url["email_share"]&&this.tracking_pixel_url["email_share"]!='')
{HPUtil.trackerImg(this.tracking_pixel_url["email_share"],document.body);}
if(this.tracking_pixel_url["name"]&&this.tracking_pixel_url["name"]!='')
{HPUtil.trackerImg("http://pixel.quantserve.com/pixel/p-4azu6n0QT1rbs.gif?labels=social_action/"+this.tracking_pixel_url["name"]+"/email",document.body);}}}
};function prepare_and_show_blogs_table_new(page){if(blogs_amount==0){return;}
var show_table='';var innerhtml='';var tds=0;page--;var forstop=rows_in_the_blogs_table*tds_in_the_blogs_table;var forstart=page*forstop+1;forstop=forstop+forstart-1;if(page>1&&null==document.getElementById('related_blogs_'+forstart)&&typeof prepare_and_show_blogs_table_new.pagination_requested=='undefined')
{prepare_and_show_blogs_table_new.pagination_requested=true;$('related_blogs').innerHTML="";$('related_blogs').style.background="transparent url('http://s.huffpost.com/images/loader.gif') no-repeat center top";$('related_blogs').style.height="60px";var request_url='/entries/pagination_load.php?module=linked_entries&entry_id='+HPUtil.GetEntryID()+'&blog_id=3&load_from='+loaded_blogs_amount+'&showed_expanded_blogs_amount='+showed_expanded_blogs_amount;C.asyncRequest('GET',request_url,{success:function(transport)
{if(transport.responseText)
{$('related_blogs').style.background="transparent";$('related_blogs').style.height="auto";$('related_blogs_ajax_loaded').innerHTML=transport.responseText;prepare_and_show_blogs_table_new(page+1);}},failure:function(){}});return;}
for(i=forstart;i<=forstop;i++){var news_html=i>blogs_amount?'':document.getElementById('related_blogs_'+i).innerHTML;innerhtml+=news_html;if((0==i%2)&&(i!=forstart))
{innerhtml+='<div class="clear"></div>';}
if(i>blogs_amount){break;}}
tds=0;document.getElementById('related_blogs').innerHTML=innerhtml;innerhtml='';if(blogs_amount<=(rows_in_the_blogs_table*tds_in_the_blogs_table)){return;}
i--;var pagination='';if(page>0){pagination=pagination+"&nbsp;<a href=\"#\" onclick=\"prepare_and_show_blogs_table_new("+1+"); return false;\">&laquo;&nbsp;First</a>&nbsp;";var prev_page=page;pagination=pagination+"&nbsp;<a href=\"#\" onclick=\"prepare_and_show_blogs_table_new("+prev_page+"); return false;\">&nbsp;Prev</a>&nbsp;";}else{pagination=pagination+"&nbsp;&laquo;&nbsp;First&nbsp;&nbsp;&nbsp;Prev&nbsp;";}
var cur_page=page+1;var j;var half_pages=show_pages_amount/2;forstart=cur_page-half_pages+1;if(forstart<1){forstart=1;}
forstop=forstart+half_pages;if((forstop-forstart+1)<show_pages_amount){forstop=forstop+show_pages_amount-(forstop-forstart+1);}
if(forstop>pages_amount){forstop=pages_amount;}
if((forstop-forstart+1)<show_pages_amount){forstart=forstart-(show_pages_amount-(forstop-forstart+1));}
if(forstart<1){forstart=1;}
for(j=forstart;j<=forstop;j++){if(j>pages_amount){break;}
if(j==cur_page){pagination=pagination+"&nbsp;"+j+"&nbsp;";}else{pagination=pagination+"&nbsp;<a href=\"#\" onclick=\"prepare_and_show_blogs_table_new("+j+"); return false;\">"+j+"</a>&nbsp;";}}
if(i<blogs_amount){var next_page=page+2;pagination=pagination+"&nbsp;<a href=\"#\" onclick=\"prepare_and_show_blogs_table_new("+next_page+"); return false;\">Next&nbsp;</a>&nbsp;";pagination=pagination+"&nbsp;<a href=\"#\" onclick=\"prepare_and_show_blogs_table_new("+pages_amount+"); return false;\">Last&nbsp;&raquo;</a>&nbsp";}else{pagination=pagination+"&nbsp;Next&nbsp;&nbsp;&nbsp;Last&nbsp;&raquo;&nbsp";}
document.getElementById('blogs_pages').innerHTML="More Blog Posts:&nbsp;"+pagination+"<br />";}
function prepare_and_show_news_table_original(page){if(news_amount==0){return;}
var show_table='';var innerhtml='';var tds=0;page--;var forstop=rows_in_the_news_table*tds_in_the_news_table;var forstart=page*forstop+1;forstop=forstop+forstart-1;if(page>1&&null==document.getElementById('related_news_'+forstart)&&typeof prepare_and_show_news_table_original.pagination_requested=='undefined')
{prepare_and_show_news_table_original.pagination_requested=true;$('related_news').innerHTML="";$('related_news').style.background="transparent url('http://s.huffpost.com/images/loader.gif') no-repeat center top";$('related_news').style.height="60px";var request_url='/entries/pagination_load.php?module=linked_entries&entry_id='+HPUtil.GetEntryID()+'&blog_id=2&load_from='+loaded_news_amount;C.asyncRequest('GET',request_url,{success:function(transport)
{if(transport.responseText)
{$('related_news').style.background="transparent";$('related_news').style.height="auto";$('related_news_ajax_loaded').innerHTML=transport.responseText;prepare_and_show_news_table_original(page+1);}},failure:function(){}});return;}
for(i=forstart;i<=forstop;i++){var html=i>news_amount?'':document.getElementById('related_news_'+i).innerHTML;innerhtml+=html;if(i>news_amount){break;}}
document.getElementById('related_news').innerHTML=innerhtml;innerhtml='';tds=0;if(news_amount<=(rows_in_the_news_table*tds_in_the_news_table)){return;}
i--;var pagination='';if(page>0){pagination=pagination+"&nbsp;<a href=\"#\" onclick=\"prepare_and_show_news_table_original("+1+"); return false;\">&laquo;&nbsp;First</a>&nbsp;";var prev_page=page;pagination=pagination+"&nbsp;<a href=\"#\" onclick=\"prepare_and_show_news_table_original("+prev_page+"); return false;\">&nbsp;Prev</a>&nbsp;";}else{pagination=pagination+"&nbsp;&laquo;&nbsp;First&nbsp;&nbsp;&nbsp;Prev&nbsp;";}
var cur_page=page+1;var j;var half_pages=show_pages_amount/2;forstart=cur_page-half_pages+1;if(forstart<1){forstart=1;}
forstop=forstart+half_pages;if((forstop-forstart+1)<show_pages_amount){forstop=forstop+show_pages_amount-(forstop-forstart+1);}
if(forstop>news_pages_amount){forstop=news_pages_amount;}
if((forstop-forstart+1)<show_pages_amount){forstart=forstart-(show_pages_amount-(forstop-forstart+1));}
if(forstart<1){forstart=1;}
for(j=forstart;j<=forstop;j++){if(j>news_pages_amount){break;}
if(j==cur_page){pagination=pagination+"&nbsp;"+j+"&nbsp;";}else{pagination=pagination+"&nbsp;<a href=\"#\" onclick=\"prepare_and_show_news_table_original("+j+"); return false;\">"+j+"</a>&nbsp;";}}
if(i<news_amount){var next_page=page+2;pagination=pagination+"&nbsp;<a href=\"#\" onclick=\"prepare_and_show_news_table_original("+next_page+"); return false;\">Next&nbsp;</a>&nbsp;";pagination=pagination+"&nbsp;<a href=\"#\" onclick=\"prepare_and_show_news_table_original("+news_pages_amount+"); return false;\">Last&nbsp;&raquo;</a>&nbsp";}else{pagination=pagination+"&nbsp;Next&nbsp;&nbsp;&nbsp;Last&nbsp;&raquo;&nbsp";}
document.getElementById('news_pages').innerHTML="More News Posts:&nbsp;"+pagination+"<br />";}
var ShareBox={submitFlag:false,checkMail:false,count:false,chooseShareVia:function(via)
{via=(via==undefined)?'email':via;if(via=='email')
{ShareBox.set_email_class();this.ad('ad_email');HuffPoUtil.show($('all_email'));HuffPoUtil.hide($('all_im'));if($('ad_im')==undefined)return;$('ad_im').className='';$('ad_email').className='show_flash_mask';}
else
{ShareBox.set_im_class();this.ad('ad_im');HuffPoUtil.show($('all_im'));HuffPoUtil.hide($('all_email'));$('ad_email').className='';$('ad_im').className='show_flash_mask';}},triggerStepFourIM:function()
{if($('share_screen_name').value!=''&&$('share_im_service').value!='')
{if($('share_im_option_blank'))
{el=$('share_im_option_blank');el.parentNode.removeChild(el);}
this.submitFlag=true;return true;}},triggerStepThreeEmail:function(login,pass,service)
{if($("login").value=="")
{alert("Please enter your login for "+service+".");$("login").focus();return false;}
if($("pass").value=="")
{alert("Please enter your password.");$("pass").focus();return false;}
HuffPoUtil.show($('share_email_spinner'));var uri='/_share_email.php?login='+login+'&pass='+pass+'&service='+service+'';var conn=YAHOO.util.Connect.asyncRequest('GET',uri,{success:function(o)
{HuffPoUtil.hide($('share_email_spinner'));$('share_email_inner').innerHTML=o.responseText;finishLoading();},failure:function(o)
{}});},triggerStepFourEmail:function()
{var els=document.getElementsByName('more_friends[]');for(var i=0;i<els.length;i++)
{if(els[i].value=="")continue;if(!HPUtil.checkEmail(els[i].value))
{alert("Please specify a valid e-mail.");els[i].focus();return false;}
this.count=true;}
this.triggerStepFour();this.showSend();return true;},triggerImport:function()
{if($('login').value!=''&&$('pass').value!='')
{HuffPoUtil.show_inline($('importButton'));}
else
{HuffPoUtil.hide($('importButton'));}
return true;},triggerStepFour:function()
{HuffPoUtil.show($('share_note'));this.submitFlag=true;},showSend:function()
{HuffPoUtil.show($('share_send'));},doDebug:function()
{alert($('im_message_share').value);alert($('entry_id_share').value);},checkSubmit:function(id,flag,tag)
{var check=false;var count=false;var post_data=false;var more_friends=false;if(flag=="email")
{if($('share_your_name').value=="")
{alert("Please enter your name");$('share_your_name').focus();return false;}
if($('share_your_email').value=="")
{alert("Please enter your email");$('share_your_email').focus();return false;}
else
{if(!($('share_your_email')&&HPUtil.checkEmail($('share_your_email').value)))
{alert("Please specify a valid e-mail.");$('share_your_email').focus();return false;}}
if($('share_friends_email'))
{if($('share_friends_email').value!='')
{check=true;}}
var els=document.getElementsByName('more_friends[]');for(var i=0;i<els.length;i++)
{if(els[i].value!='')
{count=true;break;}}
if(!check&&!count)
{alert("Please enter or import email(s)");return false;}
if(count&&!this.triggerStepFourEmail())
{count=0;return false;}
if((0==id)&&(null!=$('quickread_entry_id')))
{id=$('quickread_entry_id').innerHTML;}
postBoby="id"+"="+escape(id)+"&"+
"mode"+"="+"submit_form"+"&"+
"type"+"="+"email";if(tag!='')
{postBoby+="&p=big_news";}
if(SharePost.share_email_comm_text)
{postBoby+="&share_ad_text="+encodeURIComponent(SharePost.share_email_comm_text);}
YAHOO.util.Connect.setForm('share_tool_form');var conn=YAHOO.util.Connect.asyncRequest('POST','/_share_email.php',{success:function(o)
{HuffPoUtil.show('message_sent');$('menu_title_share').innerHTML=o.responseText;if($('share_tool_form'))
{$('share_friends_email_1').value='';$('share_friends_email_2').value='';$('login').value='';$('pass').value='';$('share_note').value='';}},failure:function(o){alert("Something went wrong");}},postBoby);}
else if(flag=="im")
{YAHOO.util.Connect.setForm('share_tool_form');var conn=YAHOO.util.Connect.asyncRequest('POST','/_share_email.php?mode=submit_form&type=im',{success:function(o)
{$('share_tool_form').innerHTML=o.responseText;HuffPoUtil.hide('menu_im_email');},failure:function(o){alert("Something went wrong");}})}
HuffPoUtil.hide('bottom_notes');return false;},set_im_class:function()
{document.getElementById("email_b_page").className='im_b_page';document.getElementById("im_b_page").className='email_b_page';},set_email_class:function()
{if($('email_b_page'))
{document.getElementById("email_b_page").className='email_b_page';}
if($('im_b_page'))
{document.getElementById("im_b_page").className='im_b_page';}}}
function getCheckboxes(form,checkbox){var str='';for(var i=0;i<getElementsByName_iefix('input',checkbox).length;i++){if(getElementsByName_iefix('input',checkbox)[i].checked)str+=getElementsByName_iefix('input',checkbox)[i].value+", ";}
document.getElementById('share_friends_email_1').value=str;ShareBox.triggerStepFourEmail();}
function checkAll(form,checkbox){for(var i=0;i<getElementsByName_iefix('input',checkbox).length;i++){getElementsByName_iefix('input',checkbox)[i].checked='false';getElementsByName_iefix('input',checkbox)[i].checked=getElementsByName_iefix('input','checkall')[0].checked;}}
function getElementsByName_iefix(tag,name){var elem=document.getElementsByTagName(tag);var arr=new Array();for(i=0,iarr=0;i<elem.length;i++){att=elem[i].getAttribute("name");if(att==name){arr[iarr]=elem[i];iarr++;}}
return arr;}
function clearAdressBook(form,checkbox,div){for(var i=0;i<document.forms[form].elements[checkbox].length;i++){document.forms[form].elements[checkbox][i].checked='false';}
$(div).innerHTML='';}
function startLoading(){if($("login").value==""&&$("pass").value==""){return false;}
if($('adressBookMails')){$('adressBookMails').innerHTML='';}
HuffPoUtil.show('load_contacts');$('load').innerHTML="<img src=\"/images/ajax-loader.gif\" /><em>Loading...</em>";}
function finishLoading(){if(getElementsByName_iefix('input','checkmail').length>=1)$('load').innerHTML="<em><strong>success</strong></em>";else $('load').innerHTML="<em><strong>none</strong></em>";}
var Y=YAHOO;var E=Y.util.Event;var R=Y.util.Region;var Dom=Y.util.Dom;var A=Y.util.Anim;var $=Dom.get;var loaded=false;var ready=0;YAHOO.namespace('headline_links');var QV=Y.headline_links;QV.show_quickread_ads=false;QV.share_form_ajax_response=false;QV.changeTab=function(tab_name,entry_id){Dom.batch(Dom.getElementsByClassName('qr_tab'),function(el){matched_item=el.id.match(/qr_tab_(.*)/).pop();if(matched_item==tab_name){Dom.addClass('qr_tab_for_'+matched_item,'current');if(tab_name=='share')
{var url='/social/front_page_share.php';QV.shared_entry_id=entry_id;if(!QV.share_form_ajax_response)
{YAHOO.util.Connect.asyncRequest('GET',url,{success:QV.showShareFormSuccess,failure:QV.showShareFormFail});}
else
{QV.showShareFormSuccess(QV.share_form_ajax_response);}}
HuffPoUtil.show('qr_tab_'+matched_item);}else{Dom.removeClass('qr_tab_for_'+matched_item,'current');HuffPoUtil.hide('qr_tab_'+matched_item);}});return false;};QV.showShareFormSuccess=function(o)
{QV.share_form_ajax_response=o;if(o.responseText)
{Dom.addClass('share_tools_loader','display_none');Dom.removeClass('share_tools','display_none');var el=$('share_tools');if(el)
{el.innerHTML=o.responseText;ShareBox.set_email_class();HuffPoUtil.show($('all_email'));HuffPoUtil.hide($('all_im'));$('ad_email').innerHTML='';$('menu_title_share').innerHTML='';$('share_note_textarea').value='';if(QV.shared_entry_id!=null)
{var temp_div=document.createElement('div');temp_div.id='quickread_entry_id';temp_div.style.display='none';temp_div.innerHTML=QV.shared_entry_id;$('qr_tab_read_col1').appendChild(temp_div);}
if($('title_permalink'))
$('share_head').innerHTML=$('title_permalink').innerHTML;else if($('title_permalink_bold'))
$('share_head').innerHTML=$('title_permalink_bold').innerHTML;HuffPoUtil.hide('qr_tab_read');HuffPoUtil.hide('modal_footer');HuffPoUtil.hide('qr_tab_news');ShareBox.ad('ad_email');}
else
QV.showShareFormFail();}
else
QV.showShareFormFail();return;};QV.showShareFormFail=function()
{Modal.hideMask();return;};QV.pop=function(caller,entry_link){if(undefined==caller&&undefined==entry_link)return false;if(Dom.hasClass(document.body,'masked'))
HPTrack.trackPageview("/t/a/quickread/"+document.body.id+"/internal");else
HPTrack.trackPageview("/t/a/quickread/"+document.body.id);currentHeight=(document.body&&document.body.scrollTop)?document.body.scrollTop:document.documentElement.scrollTop;YAHOO.util.Dom.setStyle('huff_modal','top',(currentHeight+20)+"px");YAHOO.util.Dom.setStyle('huff_modal_common','top',(currentHeight+40)+"px");Modal.showMask('huff_modal_common');if($('error_message'))
$('error_message').innerHTML='';E.stopEvent(caller);QV.callback={success:QV.fillPanel,failure:QV.failedView,scope:QV};if(undefined!=entry_link)
eid=entry_link.match(/_([n|b])_(\d{2})(\d+)\./);else
eid=caller.href.match(/_([n|b])_(\d{2})(\d+)\./);if(eid[1]=='n'||eid[1]=='b')
{dest="/entries_js/"+eid[2]+"/"+eid[2]+''+eid[3]+'.json';YAHOO.util.Connect.asyncRequest('GET',dest,QV.callback);QV.changeTab('read');}
else
{HuffPoUtil.hide('qr_tab_for_read');}
QV.loadImageNav(eid[2]+''+eid[3]);Dom.setStyle('curtainunit','visibility','hidden');HuffPoUtil.show('modal_footer');return false;};QV.popHomepageTrailer=function(trailer_id,caller){Dom.setStyle($('quickread_head_tip'),'display','none');currentHeight=(document.body&&document.body.scrollTop)?document.body.scrollTop:document.documentElement.scrollTop;YAHOO.util.Dom.setStyle('huff_modal','top',(currentHeight+60)+"px");YAHOO.util.Dom.setStyle('huff_modal_common','top',(currentHeight+80)+"px");if($('modal_inner'))
$('modal_inner').className='';if($('error_message'))
$('error_message').innerHTML='';E.stopEvent(caller);HuffPoUtil.hide('modal_footer');var panel=$('qr_tab_read');var trailer=HPAds.homepage_trailer[trailer_id];var h1_trailer_title=(trailer.trailer_click_url)?'<a>'+trailer.title+'</a>':trailer.title;panelbody="<h1 style=\"font-size:1.6em;margin: 20px 0px 20px 0px\">"+h1_trailer_title+"<\/h1>";panelbody+="<div style=\"width:500px;;margin:0px auto\" id=\"trailer_wrapper\"><div id=\"trailer_target\"></div></div>";if(trailer.video_params){if(!trailer.video_params.no_see_more){panelbody+="<div align=\"center\" style=\"margin-top: 20px;\"><a style=\"font-size: 24pt; color: #000000;\"  href=\"#\">CLICK HERE TO SEE MORE</a></div>";}}
var entry_category='entertainment';Dom.addClass('modal_inner',entry_category);Dom.addClass('qr_tab_read','ad_trailer_qv');Modal.showMask('huff_modal');E.removeListener("wrapper_mask","click");panel.innerHTML=panelbody;if(trailer.code){if(trailer.video_params){if(trailer.video_params.footer){Dom.setStyle('modal_footer','background',"url('"+trailer.video_params.footer+"') repeat scroll 0 0 transparent");}
if(trailer.video_params.header){Dom.setStyle('modal_inner','background',"url('"+trailer.video_params.header+"') no-repeat scroll 0 0 transparent");}
if(trailer.video_params.background_url){Dom.setStyle('content','background',"url('"+trailer.video_params.background_url+"') no-repeat scroll 0 0 transparent");}
if(trailer.video_params.background_color){Dom.setStyle('content','background-color',trailer.video_params.background_color);Dom.setStyle('content','border-color',trailer.video_params.background_color);}}
HuffPoUtil.show('modal_footer');$('trailer_wrapper').innerHTML='<object width="500" height="300"><param name="movie" value="http://www.youtube.com/v/'+trailer.code+'&hl=en_EN&fs=1&autoplay=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+trailer.code+'&hl=en_EN&fs=1&autoplay=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="300"></embed></object>';YAHOO.util.Event.addListener('modal_footer',"click",function(){location.href='http://www.youtube.com/user/HP'});}else{var flashvars={image:trailer.postroll,file:trailer.flv_file,autostart:"true"};if(trailer.trailer_click_url){flashvars.displayclick='link';flashvars.linktarget='_self';flashvars.link=escape(trailer.trailer_click_url);}
swfobject.embedSWF("http://big.assets.huffingtonpost.com/player-licensed.swf","trailer_target",500,300,"8.0.0",false,flashvars,{scale:"noScale",allowScriptAccess:"always",salign:"t",wmode:"transparent",bgcolor:"#ffffff"});}
HPUtil.trackerImg(trailer.preview_tracking_pixel,document.body);if(trailer.play_tracking_string)
{HPTrack.trackPageview('/t/a/ads/trailers/'+trailer.play_tracking_string+'/played')}
if(trailer.trailer_click_url){YAHOO.util.Event.addListener('qr_tab_read','click',function(e,param){E.preventDefault(e);E.stopEvent(e);if(param.trailer_click_tracking_url){HPUtil.trackerImg(param.trailer_click_tracking_url,document.body);}
location.href=param.trailer_click_url;},trailer);YAHOO.util.Dom.setStyle('qr_tab_read','cursor','pointer');}
return false;};QV.submitShare=function(){post_body='';QV.killSubmitButton('post_button','post_spinner');Dom.batch(Dom.getElementsByClassName('share_field',null,'share_email'),function(el){post_body+=escape(el.name)+"="+escape(el.value)+"&";});YAHOO.util.Connect.asyncRequest('POST',$('share_email').action,{success:QV.shareSuccess,failure:QV.shareFail},post_body);}
QV.loadImageNav=function(entry_id)
{if($('qr_slide_wrapper_'+entry_id))
{Dom.removeClass(Dom.getElementsByClassName('qr_slide_wrapper','div','modal_footer'),'selected');Dom.addClass('qr_slide_wrapper_'+entry_id,'selected');Dom.removeClass(Dom.getElementsByClassName('qr_shadow_default','div','modal_footer'),'qr_shadow');Dom.addClass('qr_shadow_'+entry_id,'qr_shadow');var oEntry=$('qr_slide_wrapper_'+entry_id),el;if(oEntry.style.display=="none")
{Dom.insertBefore(oEntry,Dom.getFirstChild($('modal_footer_container')));for(var i=0;i<4;i++)
{if(!el){el=Dom.getFirstChild($('modal_footer_container'));el.style.left='0px';}
el=Dom.getNextSibling(el);if(i<3){el.style.left='-'+(i+1)+'px';}}
el.style.display='none';oEntry.style.display='block';}}
else
{QV.fetchImageNav(entry_id);}};QV.fetchImageNav=function(entry_id)
{YAHOO.util.Connect.asyncRequest('GET',"/include/just_related.php?format=json&need_images=1&entry_id="+entry_id+'&lastn=14',{success:function(o){Posts=eval("("+o.responseText+")");var html='',len=Posts.News.length,hide;if(Posts.News&&len>0)
for(i=0;(i<len&&i<14);i++)
{if(!Posts.News[i].entry_id)continue;if(!Posts.News[i].vertical)
Posts.News[i].vertical='Generic';if(null==Posts.News[i].teaser)
Posts.News[i].teaser=Posts.News[i].entry_title.substr(0,41);hide=(i>2)?'style="display:none"':'';html+='<div id="qr_slide_wrapper_'+Posts.News[i].entry_id+'" '+hide+' class="qr_slide_wrapper qr_slide_wrapper_'+i+' qr_slide_wrapper_'+Posts.News[i].vertical.toLowerCase().replace(/ /g,'-')+'"><div id="qr_slide_'+Posts.News[i].entry_id+'" class="qr_slide"><a onclick="return QV.pop(this);" href="'+Posts.News[i].link+'"><img src="'+Posts.News[i].image+'" class="img_border" width="112" height="82" /></a><a class="qr_caption caption_'+Posts.News[i].vertical.toLowerCase()+'" href="'+Posts.News[i].link+'" onclick="return QV.pop(this);">'+Posts.News[i].teaser+'</a></div>';html+='<div class="qr_shadow_default" id="qr_shadow_'+Posts.News[i].entry_id+'"></div>';html+='</div>';}
if(html.length>1)
E.onAvailable('qr_slide_wrapper_'+entry_id,function(){if($('modal_footer_container'))
$('modal_footer_container').innerHTML+=html;else
$('modal_footer').innerHTML+=html;})}});}
QV.shareSuccess=function(o){if(o.responseText!='success')
return QV.shareFail(o);$('error_message').innerHTML="<h3>Your message has been sent!</h3>";QV.restoreSubmitButton('post_button','post_spinner');}
QV.shareFail=function(o){$('error_message').innerHTML="<h5>There was a problem:</h5><p>"+o.responseText+"</p>";QV.restoreSubmitButton('post_button','post_spinner');}
QV.killSubmitButton=function(button_id,wait_id)
{$(button_id).disabled=true;HuffPoUtil.hide(button_id);Dom.setStyle(wait_id,'display','inline');}
QV.restoreSubmitButton=function(button_id,wait_id)
{$(button_id).disabled=false;Dom.setStyle(wait_id,'display','none');Dom.setStyle(button_id,'display','inline');}
QV.fillPanel=function(o)
{if(Modal.mask)
{this.panel_data=JSON.parse(o.responseText);if(!this.panel_data)
{return this.failedView();}
var entry_category_lower=(this.panel_data.entry_category)?this.panel_data.entry_category.toLowerCase().replace(/ /g,'-'):'home';if(this.panel_data.entry_category)
{$('modal_inner').className=entry_category_lower;}
if(!$('qr_slide_wrapper_'+this.panel_data.entry_id))
{if(null==this.panel_data.entry_teaser)
this.panel_data.entry_teaser=this.panel_data.entry_title.substr(0,41);thumbHTML='<div id="qr_slide_wrapper_'+this.panel_data.entry_id+'" class="qr_slide_wrapper qr_slide_wrapper_'+entry_category_lower;if(!$('qr_slide_wrapper_'+this.panel_data.entry_id)&&this.panel_data.entry_image&&(image=new StructuredImage(this.panel_data.entry_image)))
{thumbHTML+=' selected"><div id="qr_slide_'+this.panel_data.entry_id+'" class="qr_slide"><a onclick="return QV.pop(this);" href="'+this.panel_data.entry_permalink+'"><img src="';thumbHTML+=image.Url('s','small')+'" width="112" height="82" class="img_border" /></a><a class="qr_caption caption_'+entry_category_lower+'" href="'+this.panel_data.entry_permalink+'" onclick="return QV.pop(this);">';thumbHTML+=this.panel_data.entry_teaser+'</a></div>';thumbHTML+='<div class="qr_shadow qr_shadow_default" id="qr_shadow_'+this.panel_data.entry_id+'"></div>';thumbHTML+='</div>';}
else if(!$('qr_slide_wrapper_'+this.panel_data.entry_id)&&this.panel_data.entry_blog_id==3)
{thumbHTML+=' qr_slide_wrapper_headshot selected"><div id="qr_slide_'+this.panel_data.entry_id+'" class="qr_slide"><a onclick="return QV.pop(this);" href="'+this.panel_data.entry_permalink+'"><img src="';thumbHTML+='http://s.huffpost.com/contributors/'+this.panel_data.entry_author_nickname+'/headshot.jpg" class="img_border" /></a><a class="qr_caption caption_'+entry_category_lower+'" href="'+this.panel_data.entry_permalink+'" onclick="return QV.pop(this);">'
+this.panel_data.entry_author+': '+this.panel_data.entry_teaser+'</a></div></div>';}
else if(!$('qr_slide_wrapper_'+this.panel_data.entry_id))
{thumbHTML+=' qr_slide_wrapper_spacer selected"><div id="qr_slide_'+this.panel_data.entry_id+'" class="qr_slide"><a onclick="return QV.pop(this);" href="'+this.panel_data.entry_permalink+'"><img src="';thumbHTML+='/images/quickview/dummy.gif" width="112" height="82" /></a><a class="qr_caption caption_'+entry_category_lower+'" href="'+this.panel_data.entry_permalink+'" onclick="return QV.pop(this);">'
+this.panel_data.entry_teaser+'</a></div></div>';}
if($('modal_footer_container'))
$('modal_footer_container').innerHTML=thumbHTML;else
$('modal_footer').innerHTML=thumbHTML;}
if($('qr_tab_read')){panel=$('qr_tab_read');panel.style.height='auto';}
entry_link=this.panel_data.entry_source_link?this.panel_data.entry_source_link:this.panel_data.entry_permalink;if(this.panel_data.entry_brief)
this.panel_data.entry_body=this.panel_data.entry_brief;this.panel_data.entry_body=this.panel_data.entry_body.replace(/<object width="\d+" height="\d+"><param name="movie" value="([^"]*)">.*<\/object>/g,"<center><iframe marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"no\" style=\"visibility: visible; z-index: 15;\" width='425' height='350' src=\"/include/youtubeloader.php?path=$1\"><\/iframe></center>");this.videoPost=(this.panel_data.entry_body.match(/<HH--HUFFPOSTVIDEO--/)||this.panel_data.entry_body.match(/youtube.com\/v\//));panelbody='';if(bcid=this.panel_data.entry_body.match(/<iframe[^>]+src="http:\/\/link.brightcove.com\/services\/player\/bcpid(\d+)"[^>]+><\/iframe>/,''))
{this.panel_data.entry_body=this.panel_data.entry_body.replace(/<iframe[^>]+src="http:\/\/link.brightcove.com\/services\/player\/bcpid(\d+)"[^>]+><\/iframe>/,'');this.panel_data.entry_body=this.panel_data.entry_body.replace(/<iframe[^>]+src="http:\/\/link.brightcove.com\/services\/player\/bcpid(\d+)"[^>]+><\/iframe>/g,'<p><a href="'+entry_link+'" onclick="HPTrack.trackPageview(\'/t/a/quick/\' + document.body.id + \'/whole\');">See the whole post for another video</a></p>');}
if(this.show_quickread_ads&&!this.videoPost)
{panelbody+="<div id=\"qr_tab_read_col1\" class=\"column first\">";}
else
{panelbody+="<div id=\"qr_tab_read_col_only\" class=\"column first\">";}
panelbody+="<h1><a href=\""+entry_link+"\" id='title_permalink' onclick=\"HPTrack.trackPageview('/t/a/quick/' + document.body.id + '/whole/head');\">"+this.panel_data.entry_title+" &raquo;<\/a><\/h1>";panelbody+='<div class="read_more_top"></div>';panelbody+='<div class="comments_datetime"><p>';if(this.panel_data.entry_source_org)
panelbody+="<b>"+this.panel_data.entry_source_org+"<\/b>&nbsp; | &nbsp;";if(this.panel_data.entry_source_author)
panelbody+=this.panel_data.entry_source_author+"&nbsp; | &nbsp;";if(this.panel_data.entry_ap_date_issued)
panelbody+=this.panel_data.entry_ap_date_issued;else
panelbody+=this.panel_data.entry_created_on;panelbody+='<\/p><\/div>';panelbody+='<div class="entry_content qr_entry_content">';ads_display=this.panel_data.show_video_ads?'on':'off';if((vid_match=this.panel_data.entry_body.match(/.*<HH--HUFFPOSTVIDEO--(\d+)--HH>.*/m)))
{vid_id=vid_match.pop();panelbody+="<div class=\"videowrapper vid320\"  style=\"width: 350px\"><div class=\"videoinner\"><iframe  marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"no\" style=\"visibility: visible; z-index: 2;\" width='320' height='310' src=\"/include/adloader.php?id="+vid_id+"&ads="+ads_display+"\"><\/iframe><\/div><\/div>";}
else
{panelbody+=this.panel_data.entry_body;}
panelbody+='<\/div>';panelbody+='<div class="qr_entry_meta"><a href="'+entry_link+'" onclick="HPTrack.trackPageview(\'/t/a/quick/\' + document.body.id + \'/whole\');" id="qr_read">Read Whole Post<\/a><\/div>';panelbody+="<\/div>";if(this.show_quickread_ads&&!this.videoPost&&!bcid)
{panelbody+="<div class=\"column last\">";panelbody+=this.ad();panelbody+='<div id="quickread_badges"><\/div>';panelbody+="<\/div>";}
if(bcid)
{panelbody+="<div class=\"column last\" id=\"qr_vid_col\">";panelbody+="<iframe src=\"/include/brightcove_qr.php?pid="+bcid[1]+"\" width=\"300\" height=\"250\" frameborder=\"0\" scrolling=\"no\"></iframe>";panelbody+="<\/div>";}
panel.innerHTML=panelbody;if(this.show_quickread_ads&&!this.videoPost&&!bcid){HPAds.ad_reload('quickread','qr_ad');insertBadgesInContainer('quickread_badges',{entry_id:this.panel_data.entry_id,entry_url:entry_link,entry_title:this.panel_data.entry_title,entry_vertical:entry_category_lower,css_style:'quickread'});}
YAHOO.util.Dom.setStyle('huff_modal_common','visibility','hidden');Modal.showMask('huff_modal');var new_stats_image=document.createElement('img');new_stats_image.src="http://entry-stats.huffpost.com/?"+this.panel_data.entry_id+"&"+Math.random().toString(16).replace('0.','')+'&'+escape(location.href.replace(/#.*/,''))+'&false';Dom.get('_snp_tracking').appendChild(new_stats_image);}};QV.failedView=function(o)
{YAHOO.util.Dom.setStyle('huff_modal_common','visibility','hidden');panel=$('qr_tab_read');panelbody="<h2>Problem loading Quick View<\/h2><p>We encountered a problem loading the Quick View for this story. If you would like more information, please close this view and click the headline or comments link for the story.<\/p>";Modal.movePanel();YAHOO.util.Dom.setStyle('huff_modal','visibility','visible');panel.innerHTML=panelbody;return false;};Modal.hideQVMask=function()
{if($('trailer_wrapper'))
{$('trailer_wrapper').innerHTML='';};if(Modal.mask)
{this.mask=Modal.mask
YAHOO.util.Dom.setStyle('huff_modal','visibility','hidden');Modal.mask.style.display="none";YAHOO.util.Dom.removeClass(document.body,"masked");}
if($('qr_tab_read_col1'))
{$('qr_tab_read_col1').innerHTML='';}
else if($('qr_tab_read_col_only'))
{$('qr_tab_read_col_only').innerHTML='';}
HuffPoUtil.show('qr_tab_for_read');if($('qr_ad'))
{$('qr_ad').innerHTML='';}
if($('qr_vid_col'))
{$('qr_vid_col').innerHTML='';}
if($('qr_frame'))
{$('qr_frame').src='';}
Dom.setStyle('curtainunit','visibility','visible');Modal.hideMask();};QV.next=function(){var first=Dom.getFirstChild($('modal_footer_container')),el;$('modal_footer_container').appendChild(first);for(var i=0;i<3;i++)
{if(!el){el=Dom.getFirstChild($('modal_footer_container'));el.style.left='0px';}
el=Dom.getNextSibling(el);el.style.left='-'+(i+1)+'px';}
first.style.display='none';el.style.display='block';}
QV.prev=function(){var last=Dom.getLastChild($('modal_footer_container')),first=Dom.getFirstChild($('modal_footer_container')),el;Dom.insertBefore(last,first);for(var i=0;i<4;i++)
{if(!el){el=Dom.getFirstChild($('modal_footer_container'));el.style.left='0px';}
el=Dom.getNextSibling(el);el.style.left='-'+(i+1)+'px';}
el.style.display='none';last.style.display='block';}
QV.hideMask=Modal.hideQVMask;QV.ad=function(){ad='<div class="ad_block ad_wide top" id="qr_ad">';ad+='</div>';return ad;};QV.ad_button=function(){ad='<iframe id="ad_button" src="http://ad.doubleclick.net/adi/huffingtonpost/homepage/quickread;tile=6;sz=88x31;ord='+ord+'?" width="88" height="31" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe>';return ad;};QV.initShare=function(id,permalink){HPTrack.trackPageview("/t/a/quick/"+document.body.id+"/share");share="<iframe id=\"qr_frame\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"no\" style=\"visibility: visible; z-index: 2;\" ";share+="width='"+$('quickread_tabs').offsetWidth+"' height='275' src=\"/send/builder.php?id="+id+"&link="+permalink+"\"><\/iframe>";$('qr_tab_share').innerHTML=share;QV.changeTab('share');};Y.namespace('Blogroll');Y.Blogroll.fillRoll=function(o){newRollLeft=document.createElement('UL');newRollLeft.className='blogroll_left';newRollRight=document.createElement('UL');newRollRight.className='blogroll_right';$('blogroll_lower').innerHTML="<ul>"+o.responseText+"<\/ul>";extendedLinks=$('blogroll_lower').getElementsByTagName('LI');for(i=0;i<extendedLinks.length;i++)
{if(i%2==0)
{newRollLeft.appendChild(extendedLinks[i].cloneNode(true));}
else
{newRollRight.appendChild(extendedLinks[i].cloneNode(true));}}
$('blogroll_lower').innerHTML='';$('blogroll_lower').appendChild(newRollLeft);$('blogroll_lower').appendChild(newRollRight);Dom.setStyle('blogroll_header_lower','display','block');Dom.setStyle('blogroll_lower','display','block');Dom.setStyle('extendedroll','display','none');};Y.Blogroll.badRoll=function(o){newRoll=document.createElement('UL');newRoll.innerHTML="<li>Problem loading Blogroll<\/li>";$('blogroll_header_lower').parentNode.appendChild(newRoll);};Y.Blogroll.expand=function(){Y.util.Connect.asyncRequest('GET','/blogrolls/blogs-long.html',{success:Y.Blogroll.fillRoll,failure:Y.Blogroll.badRoll,scope:Y.Blogroll});}
var Curtain={};Curtain.collapseAnim=new Y.util.Anim("curtainunit",{height:{to:30}},0.5),Curtain.expandAnim=new Y.util.Anim("curtainunit",{height:{to:200}},0.5)
Curtain.collapse=function(){collapsed.write("curtainunit");};Curtain.collapsed=function(){collapsed.write("curtainunit");};Curtain.expand=function(){expanded.write('curtainunit');if($('curtain_collapsed'))
$('curtain_collapsed').style.height='200px';};var Tomfoolery=HuffCookies;YAHOO.namespace('IA');var IA=YAHOO.IA;IA.campaignName=null;IA.fireRedirect=true;IA.attach=function(campaign){IA.campaignName=campaign;YAHOO.util.Event.addListener(document.getElementsByTagName('A'),"click",IA.testIA);};IA.testIA=function(e){if(this.href.match(new RegExp('http://([^\\.]+\\.)?'+document.domain))&&this.innerHTML!='Quick Read')
{if(IA.dartI)
{IA.dartImageObj=new Image();IA.dartImageObj.src=IA.dartI;}
if(IA.dartI||IA.fireRedirect)
{HuffCookies.set('huffpo_interstitial','set',24);}
if(IA.fireRedirect)
{this.href="/bumper.php?campaign="+IA.campaignName+"&dest="+this.href;}}};
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();var FlashObject=swfobject;
var LazyLoad=function(){var E=document,D=null,A=[],C;function B(){if(C){return}var G=navigator.userAgent,F;C={gecko:0,ie:0,webkit:0};F=G.match(/AppleWebKit\/(\S*)/);if(F&&F[1]){C.webkit=parseFloat(F[1])}else{F=G.match(/MSIE\s([^;]*)/);if(F&&F[1]){C.ie=parseFloat(F[1])}else{if((/Gecko\/(\S*)/).test(G)){C.gecko=1;F=G.match(/rv:([^\s\)]*)/);if(F&&F[1]){C.gecko=parseFloat(F[1])}}}}}return{load:function(K,L,J,I){var H=E.getElementsByTagName("head")[0],G,F;if(K){K=K.constructor===Array?K:[K];for(G=0;G<K.length;++G){A.push({url:K[G],callback:G===K.length-1?L:null,obj:J,scope:I})}}if(D||!(D=A.shift())){return}B();F=E.createElement("script");F.src=D.url;if(C.ie){F.onreadystatechange=function(){if(this.readyState==="loaded"||this.readyState==="complete"){LazyLoad.requestComplete()}}}else{if(C.gecko||C.webkit>=420){F.onload=LazyLoad.requestComplete;F.onerror=LazyLoad.requestComplete}}H.appendChild(F);if(!C.ie&&!C.gecko&&!(C.webkit>=420)){F=E.createElement("script");F.appendChild(E.createTextNode("LazyLoad.requestComplete();"));H.appendChild(F)}},loadOnce:function(N,O,L,P,G){var H=[],I=E.getElementsByTagName("script"),M,J,K,F;N=N.constructor===Array?N:[N];for(M=0;M<N.length;++M){K=false;F=N[M];for(J=0;J<I.length;++J){if(F===I[J].src){K=true;break}}if(!K){H.push(F)}}if(H.length>0){LazyLoad.load(H,O,L,P)}else{if(G){if(L){if(P){O.call(L)}else{O.call(window,L)}}else{O.call()}}}},requestComplete:function(){if(D.callback){if(D.obj){if(D.scope){D.callback.call(D.obj)}else{D.callback.call(window,D.obj)}}else{D.callback.call()}}D=null;if(A.length){LazyLoad.load()}}}}();
var HPFB=Y.namespace('HP.FB');HPFB={_redirect:'',enabled:true,session:false,api_key:false,initialized:false,is_logged_in_on_huffpost:false,user_status:"unknown",user_just_login:false,callback_init:null,maybeFacebookConnected:function()
{var regex=/(fbcdn|facebook\.com)/;if(HPFB.session||regex.test(HuffCookies.getBigAvatar())||regex.test(HuffCookies.getSmallAvatar()))
{return true;}
return false;},init:function(user_id)
{if(!user_id){el=document.getElementById('fConnect_img_container');if(el)el.style.display="block";}
if("undefined"!==typeof FB)
{HPFB.initUser();}
else
{window.fbAsyncInit=function()
{FB.init({apiKey:HPFB.api_key,cookies:false,xfbml:true});HPFB.initEvents();HPFB.initUser();};(function(){var e=document.createElement('script');e.type='text/javascript';e.src='http://connect.facebook.net/en_US/all.js';e.async=true;document.getElementById('fb-root').appendChild(e);}());}},initEvents:function()
{FB.Event.subscribe('auth.login',HPFB.handleStateChange);},handleStateChange:function(response)
{HPFB.session=response.session;HPFB.user_status=response.status;},initUser:function(manual_login_response,params)
{this.initialized=true;var callback=function(response,is_manual_login)
{var HC=HuffCookies;var QL=QuickLogin;SNProject.fanCheck();HPFB.user_status=response.status;if(response.status=='notConnected')
{E.onAvailable('fb_faces_login',function()
{this.style.display='block';});}
else if(response.status=='connected')
{HPFB.session=response.session;if(!HC.getUserName()&&(is_manual_login||!HC.getCookie('autologin')))
{if(HPUtil.GetEntryID())
{QL.OnSuccessCallback=function()
{var cb=HPFB.callback_init||function(){if(HPFB.user_just_login)
{location.href=location.href;return;}
if(-1===window.location.href.indexOf('just_reloaded'))
window.location.href=HPUtil.AddStringToQueryString(window.location.href,'just_reloaded=1');};cb();if(HPFB.callback_init)
{HPFB.callback_init=null;}}}
else
{QL.OnSuccessCallback=function()
{HPUtil.reinit();if(HPFB.callback_init)
{HPFB.callback_init();HPFB.callback_init=null;}}}
HPFB.authenticate(!!!is_manual_login,params);}
else if(HC.getUserName())
{HPFB.is_logged_in_on_huffpost=true;if(HPFB.callback_init)
{HPFB.callback_init();HPFB.callback_init=null;}}}
else
{if(response.status=='unknown'&&HuffPrefs.get('facebook')&&SNProject.popup_needed)
{SNProject.linkAccountsBar('special');}}};if(manual_login_response)
{callback(manual_login_response,true);}
else
{FB.getLoginStatus(callback);}}}
HPFB.login=function(callback,needed_session,params)
{var func_params=params||{};if(!HPFB.enabled)
{HPFB.showErrorLightbox();return;}
var ab_tests=new Array();ab_tests[0]={'attempt_key':'/t/a/facebook/perms-test/lots/attempt','success_key':'/t/a/facebook/perms-test/lots/success','permissions':'user_about_me,user_birthday,user_interests,user_likes,user_location,read_stream'};ab_tests[1]={'attempt_key':'/t/a/facebook/perms-test/some/attempt','success_key':'/t/a/facebook/perms-test/some/success','permissions':'user_birthday,user_location'};HPFB.ab_set=ab_tests[Math.floor(Math.random()*2)];needed_session=undefined===needed_session?true:needed_session;HPFB.is_logged_in_on_huffpost=HuffCookies.getUserName()?true:false;callback="function"==typeof callback?callback:undefined;var QL=QuickLogin;if(!HPFB.session)
{FB.login(function(response)
{HPTrack.trackPageview(HPFB.ab_set.attempt_key);var perm_array=HPFB.ab_set.permissions.split(',');var perm_array_len=perm_array.length;var granted_perms=response.perms;var not_found=0;for(var i=perm_array_len;i--;)
{var perm=perm_array[i];var check_perm=granted_perms.indexOf(perm);if(check_perm==-1)
{not_found++;}}
if(not_found==0)
{HPTrack.trackPageview(HPFB.ab_set.success_key);}
if(callback)
HPFB.callback_init=callback;QL.FacebookLoginCallback=callback;var fb_init_callback=function(response)
{HPFB.initUser(response,func_params);FB.Event.unsubscribe('auth.sessionChange',arguments.callee);}
if(response.session)
{fb_init_callback(response);}
else if(response.status==='connected')
{FB.Event.subscribe('auth.sessionChange',fb_init_callback);FB.init({appId:HPFB.api_key,cookies:false,status:true,xfbml:true});}},{'perms':HPFB.ab_set.permissions});}
else if(!HPFB.is_logged_in_on_huffpost&&needed_session)
{QL.FacebookLoginCallback=callback;HPFB.authenticate(false,func_params);}
else if(callback&&needed_session)
{callback();}
else if(HPFB.user_just_login)
{location.href=location.href;}}
HPFB.authenticate=function(is_automatic_login,params)
{var func_params=params||{};if(!HPFB.enabled)
{HPFB.showErrorLightbox();return;}
HPFB.is_logged_in_on_huffpost=HuffCookies.getUserName()?true:false;var QL=QuickLogin;if(!HPFB.session)
return false;if(HPFB.is_logged_in_on_huffpost)
{if(QL.FacebookLoginCallback){QL.FacebookLoginCallback();return false;}
Modal.hideMask();QL.onLoginSuccess();return false;}
if(is_automatic_login)
QL._auto_login=true;var autologin='';var args={};var post_string=HPFB.getSessionForServer();if(QL._auto_login)
{post_string+='&autologin=1';args.autologin=true;}
if(func_params&&func_params.fb_signup)
post_string+='&not_login_to_huff=1';delete(QL._auto_login);YAHOO.util.Connect.asyncRequest('POST','/commentsv3/_facebookLogin.php',{success:function(response)
{var result=JSON.parse(response.responseText);switch(result.msg)
{case'success':case'new_user':HPFB.user_just_login=true;break;default:HPFB.user_just_login=false;break;}
QL.FacebookSuccess(response);},failure:QL.ServiceLoginFail,argument:args},post_string);};HPFB.getSessionForServer=function()
{if(!HPFB.enabled)
{HPFB.showErrorLightbox();return;}
var session=HPFB.session;if(!session)
return'';var prefix='fb_sig';var str='';for(var key in session)
{if(!YAHOO.lang.hasOwnProperty(session,key))
continue;if(str)
str+='&';var full_key=prefix+'_'+key;if(key=='sig')
full_key=prefix;str+=encodeURIComponent(full_key)+'='+encodeURIComponent(session[key]);}
return str;}
HPFB.authenticate.setCallback=function()
{}
HPFB.showErrorLightbox=function()
{QuickSNProject.showModal('Sorry, this feature is temporarily disabled due to technical difficulties.  Please check back soon!');}
HPFB.markFBDisabled=function()
{HPFB.ensureInit=HPFB.showErrorLightbox;if(typeof(FB)=='undefined')FB={};FB.ensureInit=HPFB.showErrorLightbox;HPFB.enabled=false;}
HPFB.ensureInit=function(callback,deprecated_param)
{if(!HPFB.enabled)
{HPFB.showErrorLightbox();return;}
HPFB.is_logged_in_on_huffpost=HuffCookies.getUserName()?true:false;var me=this;HPUtil.WaitForCondition.apply(this,[callback,10,function(){return me.initialized;}]);}
HPFB.waitForSession=function(callback,params)
{var func_params=params||{};if(!HPFB.enabled)
{HPFB.showErrorLightbox();return;}
HPFB.is_logged_in_on_huffpost=HuffCookies.getUserName()?true:false;if(HPFB.session)
{callback();return;}
HPFB.login(callback,false,func_params);}
HPFB.getFBInfo=function(success_callback,failure_callback)
{if(!HPFB.enabled)
{HPFB.showErrorLightbox();return;}
success_callback=success_callback||function(){};failure_callback=failure_callback||function(){};if(!HPFB.session)
return false;var user_id=HPFB.session.uid;var query=FB.Data.query('SELECT name, pic_square, pic_square_with_logo, uid FROM user WHERE uid = {0}',user_id);function make_callback(success_callback,failure_callback)
{function callback(o)
{if(o&&o[0])
success_callback(o);else
failure_callback(o);}
return callback;}
query.wait(make_callback(success_callback,failure_callback));};HPFB.streamPublish=function(user_message,feed_data,action_links,target_id,user_message_prompt,callback,auto_publish,actor_id)
{if(!HPFB.enabled)
{HPFB.showErrorLightbox();return;}
Modal.HideEmbed();Modal.hideMask();if(feed_data&&feed_data.description&&feed_data.description.length>139)
{feed_data.description=feed_data.description.substr(0,137)+'...';}
if(user_message&&user_message.length>139)
{user_message=user_message.substr(0,137)+'...';}
if(feed_data&&feed_data.media&&feed_data.media[0]&&!feed_data.media[0].src)
{feed_data.media=[];}
HPFB.is_logged_in_on_huffpost=HuffCookies.getUserName()?true:false;if(HPFB.session)
{FB.ui({method:'stream.publish',message:user_message,attachment:feed_data,action_links:action_links,target_id:target_id,user_message_prompt:user_message_prompt,actor_id:actor_id},function(response)
{callback(response);});return;}
HPFB.login(function()
{FB.ui({method:'stream.publish',message:user_message,attachment:feed_data,action_links:action_links,target_id:target_id,user_message_prompt:user_message_prompt,actor_id:actor_id},function(response)
{callback(response);});},false);}
HPFacebookVote={init:function(feedTmplBundleId,entryId,entryTitle,entryBrief,permalink,entryImgSrc,inviteContent){HPFacebookVote.userLoggedIn=HuffCookies.getUserName();HPFacebookVote.voteUpCalled=false;HPFacebookVote.feedTmplBundleId=feedTmplBundleId;HPFacebookVote.entryId=entryId;HPFacebookVote.entryTitle=entryTitle;HPFacebookVote.entryBrief=entryBrief;HPFacebookVote.permalink=permalink;HPFacebookVote.entryImgSrc=entryImgSrc;HPFacebookVote.inviteContent=inviteContent;HPFacebookVote.userDefaultComment='';if(HPFacebookVote.userLoggedIn&&HuffCookies.get('voted_down')){HuffCookies.del('voted_down');HPFacebookVote.postVote('down');}
else if(HPFacebookVote.userLoggedIn&&HuffCookies.get('voted_up')){HuffCookies.del('voted_up');HPFacebookVote.postVote('up');}
else if(!HPFacebookVote.userLoggedIn&&window.location.hash=='#require-fbconnect'){HuffPoUtil.onPageReady(function(){HPFB.login();});}},postVoteCallback:{vote:'',success:function(o){if(!HPFacebookVote.userLoggedIn&&this.vote.length!=0){window.location.href=window.location.href;}
else{try{eval('oVoteData = '+o.responseText);}catch(err){return;}
if(oVoteData.error)return;if(oVoteData.current_user_voted){Dom.get('link_vote_up').innerHTML=oVoteData.up+' Like It';Dom.get('link_vote_down').innerHTML=oVoteData.down+' Don\'t';Dom.get('link_vote_up').onclick=function(){return false;};Dom.get('link_vote_down').onclick=function(){return false;};SNProject.track(HPFacebookVote.entryId,(this.vote=='up'?'entry_like':'entry_unlike'));}}},timeout:7000},postVote:function(v){var q='/include/vote.php?entry_id=';q+=HPFacebookVote.entryId;if(v=='up')q+='&vote=up';if(v=='down')q+='&vote=down';HPFacebookVote.postVoteCallback.vote=v;var cObj=C.asyncRequest('GET',q,HPFacebookVote.postVoteCallback);},onFeedDialogClosed:function(response){HPFacebookVote.voteUpCalled=false;HuffCookies.set('voted_up',1);QuickFacebookInvite.invitationContent=HPFacebookVote.inviteContent;QuickFacebookInvite.pop(function(){HPFacebookVote.postVote('up');});},onFacebookVoteUp:function(){if(HPFacebookVote.voteUpCalled)return;HuffCookies.del('snn_popup_needed');HPFB.ensureInit(function(){HPFB.waitForSession(function(){if('connected'==HPFB.user_status){HPFacebookVote.voteUpCalled=true;feedData={"name":HPFacebookVote.entryTitle,"description":HPFacebookVote.entryBrief,"href":HPFacebookVote.permalink,"media":[{"type":"image","src":HPFacebookVote.entryImgSrc,"href":HPFacebookVote.permalink}]};HPFB.streamPublish(HPFacebookVote.userDefaultComment,feedData,null,null,'Your comment is here',HPFacebookVote.onFeedDialogClosed);}
else{alert('You\'re not connected to Facebook. Please try again.');FB.logout(function(){});}})});},onVoteUp:function(){Dom.get('link_vote_up').onclick=function(){return false;};if(!HPFacebookVote.userLoggedIn){HuffCookies.set('voted_up',1);}
HPFB.ensureInit(function(){HPFB.waitForSession(function(){HPFacebookVote.onFacebookVoteUp();});});},onVoteDown:function(){if(!HPFacebookVote.userLoggedIn){HuffCookies.set('voted_down',1);QuickLogin.pop();}
else{HPFacebookVote.postVote('down');}}}
HPFacebookVoteV2={status:0,status_limit:0,vote_status:[],lock:false,init_done:false,init:function(entryId,entryTitle,entryBrief,permalink,entryImgSrc,inviteContent,bpage,vote_words){if(this.init_done===true){return;}
this.init_done=true;this.userLoggedIn=HuffCookies.getUserName();this.voteUpCalled=false;this.entryId=entryId;this.entryTitle=entryTitle;this.entryBrief=entryBrief;this.permalink=permalink;this.entryImgSrc=entryImgSrc;this.inviteContent=inviteContent;this.userDefaultComment='';if("undefined"!=typeof(bpage))
{this.bpage=bpage;}else{this.bpage='';}
if("undefined"!=typeof(vote_words))
{this.vote_status=vote_words;}
else
{this.vote_status=['Amazing','Inspiring','Funny','Scary','Hot','Crazy','Important','Weird'];}
this.status_limit=this.vote_status.length;if(HuffCookies.get('facebook_user_has_voted')&&null==HuffCookies.get('facebook_user_is_voting'))
{this.status=HuffCookies.get('facebook_user_has_voted');HuffCookies.del('facebook_user_has_voted');HuffPoUtil.onPageReady(HPFacebookVoteV2.postVote());return;}
if(this.userLoggedIn&&null!=HuffCookies.get('facebook_user_is_voting'))
{this.status=HuffCookies.get('facebook_user_is_voting');HuffCookies.del('facebook_user_is_voting');HPFacebookVoteV2.onFacebookVote();}},postVoteCallback:{success:function(o)
{try{eval('oVoteData = '+o.responseText);}catch(err){return;}
if(oVoteData.error)
{HPError.e(oVoteData.error);return;}
if(oVoteData.total_votes){if("news"==HPFacebookVoteV2.bpage)
{if($('link_vote_0'))
{for(var i=0;i<HPFacebookVoteV2.status_limit;i++)
{if("undefined"!=typeof(oVoteData[i]))
{$('link_vote_'+oVoteData[i].status).innerHTML=HPFacebookVoteV2.vote_status[oVoteData[i].status]+"<br/>"+" ("+oVoteData[i].count+")";}else{$('link_vote_'+i).innerHTML=HPFacebookVoteV2.vote_status[i];}}}
if($('bottom_link_vote_0'))
{for(i=0;i<HPFacebookVoteV2.status_limit;i++)
{if("undefined"!=typeof(oVoteData[i]))
{$('bottom_link_vote_'+oVoteData[i].status).innerHTML=HPFacebookVoteV2.vote_status[oVoteData[i].status]+"<br/>"+" ("+oVoteData[i].count+")";}else{$('bottom_link_vote_'+i).innerHTML=HPFacebookVoteV2.vote_status[i];}}}}
}},timeout:7000},postVote:function(update){var q='/include/vote.php?entry_id=';q+=this.entryId;q+='&vote_status='+this.status;q+=("undefined"!=typeof(update))?'&update=1':'';q+="&v=2";var cObj=C.asyncRequest('GET',q,HPFacebookVoteV2.postVoteCallback);},onFeedDialogClosed:function(response){Modal.ShowEmbed();if(response&&response.post_id)
{HuffCookies.set('facebook_user_has_voted',HPFacebookVoteV2.status);HuffCookies.del('facebook_user_is_voting');HPFacebookVoteV2.voteUpCalled=false;QuickFacebookInvite.invitationContent=HPFacebookVoteV2.inviteContent;QuickFacebookInvite.pop();HPFacebookVoteV2.lock=false;}
else
{HPFacebookVoteV2.lock=false;if(HPFB.user_just_login)
location.href=location.href;}},onFacebookVote:function(){HuffCookies.del('snn_popup_needed');HuffCookies.del('facebook_user_is_voting');if(HPFacebookVoteV2.voteUpCalled)return;HPFacebookVoteV2.postVote(true);HPFB.ensureInit(function(){HPFB.waitForSession(function()
{if('connected'==HPFB.user_status)
{HPFacebookVoteV2.voteUpCalled=true;feedData={"name":HPFacebookVoteV2.entryTitle,"description":HPFacebookVoteV2.entryBrief,"href":HPFacebookVoteV2.permalink,"media":[{"type":"image","src":HPFacebookVoteV2.entryImgSrc,"href":HPFacebookVoteV2.permalink}]};Modal.HideEmbed();HPFB.streamPublish(HPFacebookVoteV2.vote_status[HPFacebookVoteV2.status]+'... '+HPFacebookVoteV2.userDefaultComment,feedData,null,null,'Your comment is here',HPFacebookVoteV2.onFeedDialogClosed);}
else{alert('You\'re not connected to Facebook. Please try again.');FB.logout(function(){});}});})},onVote:function(vote_status){if(this.lock)return;this.lock=true;HPFacebookVoteV2.voteUpCalled=false;this.status=vote_status;if(this.status>this.status_limit)return;if(HPFB.session)
{HuffCookies.set('facebook_user_is_voting',this.status);HPFB.ensureInit(function(){HPFB.waitForSession(function(){HPFacebookVoteV2.onFacebookVote();});});}
else if(this.userLoggedIn)
{HPFacebookVoteV2.postVote(true);this.lock=false;}
else
{var me=this;HPFB.ensureInit(function(){HPFB.waitForSession(function(){me.lock=false;HPFacebookVoteV2.onFacebookVote();});});}}}
var HPFBQuickIntroduce={finalCallback:function(){return true;},uploadFile:false,oForm:null,formUrl:'/users/signup/fb_init_signup_form.php',isEmailSpecified:false,pop:function(){var QI=HPFBQuickIntroduce;Modal.setMaskListener(function(){return false;});if(QI.shown||!HPUtil.isWWW())
{QI.finalCallback();return false;}
if(QuickLogin.calledBySNN)
QI.formUrl=QI.formUrl.replace(/php\??.*$/,'php?snn=1');if(QI.signUpMode)
QI.formUrl+='&mode='+QI.signUpMode;if(QI.html){QI.success({responseText:QI.html});}
else{C.asyncRequest('GET',QI.formUrl,HPFBQuickIntroduce);}},failure:function(o){HPError.e();},success:function(o){if(o.responseText!='')
{var modal_params={close_button:false,use_logo_remove_button:false,inner_class:'modal_quick_introduce'};if(typeof(HPFBQuickIntroduce.modified_modal_params)!='undefined')
{modal_params=HPFBQuickIntroduce.modified_modal_params;}
QuickSNProject.showModal(o.responseText,modal_params);Dom.setStyle($('huff_modal_common_inner'),'font-size','12px');if($('privacy_field'))$('privacy_field').style.visibility='visible';E.on('init_preferences_form_submit','click',function(){HPFBQuickIntroduce.onSubmit();return false;});E.on('user_photo','change',function(){var QI=HPFBQuickIntroduce;var valid_extensions={'.gif':1,'.jpeg':1,'.jpg':1,'.png':1};var re=/\..+$/;var ext=this.value.match(re);if(valid_extensions[ext]){QI.uploadFile=true;}else{QI.uploadFile=false;alert('Please select a valid image file');}});E.on('bio_field','keyup',HPUtil.enforceTextAreaLimit,{chars:120});HPFBQuickIntroduce.loadFriends();}},loadFriends:function(){var QI=HPFBQuickIntroduce;var QS=QuickSignup;if(QS.selectedService=='direct'){Dom.removeClass('init_preferences_form_submit','display_none');return;}
var fb_session=HPFB.getSessionForServer();var post_data="service="+QS.selectedService+"&showall=1&sign_up_friends=1"+(fb_session.length?'&'+fb_session:'');var url='/users/social_news_project/make_friends_fans.php';delay=15E3;if(QS.selectedService=='twitter')
delay=50E3;var callback={success:QI.loadFriendsSuccess,failure:QI.loadFriendsFailure,timeout:delay};C.asyncRequest('POST',url,callback,post_data);return;},loadFriendsSuccess:function(o){var resp=o.responseText.split(":::");var div_el=$('new_friends_found');if(div_el)
{if(resp.length<2||typeof(resp[1])=='undefined')
{HPFBQuickIntroduce.loadFriendsFailure();}
else if(/none_found/.test(resp[1])){HPFBQuickIntroduce.loadFriendsFailure();}
else
{Dom.replaceClass('fb_init_right_pane','su_modal2_right_panel_s1','su_modal2_right_panel');div_el.innerHTML=resp[1];if(QuickSignup.selectedService=='facebook'&&"undefined"!=typeof(FB))
setTimeout(function(){FB.XFBML.parse($('huff_snn_modal_common_inner'));},500);}
Dom.removeClass('init_preferences_form_submit','display_none');}
return;},loadFriendsFailure:function(){var div_el=$('new_friends_found');if(div_el)
{div_el.innerHTML="<span class='su_modal2_no_friends'>None Found</span>";Dom.removeClass('init_preferences_form_submit','display_none');}
return;},onSubmit:function(){var QI=HPFBQuickIntroduce;var oEml=$('email_field');if(oEml&&oEml.value!=''){if(!HPUtil.checkEmail(oEml.value)){HPError.e('Please specify a valid e-mail address');oEml.value='';oEml.focus();return;}
QI.isEmailSpecified=true;}
QI.showSpinner();QI.oForm=$('init_preferences_form');C.setForm(QI.oForm,(QI.uploadFile));C.asyncRequest('POST',QI.formUrl,{success:QI.onSubmitSuccess,upload:QI.onSubmitSuccess,failure:function(o){HPError.e();}});},showSpinner:function(){$('btn_save_and_continue').style.display='none';$('form_posting_indicator').style.display='block';},hideSpinner:function(){$('btn_save_and_continue').style.display='block';$('form_posting_indicator').style.display='none';},onSubmitSuccess:function(o){var QI=HPFBQuickIntroduce;switch(o.responseText){case'success':Modal.hideMask();QI.finalCallback();QI.shown=true;break;case'invalid_email':HPError.e('Please specify a valid e-mail address');QI.hideSpinner();$('email_field').select();break;case'duplicate_email':HPError.e('Specified e-mail address is already used, please choose another one');QI.hideSpinner();$('email_field').select();break;case'photo_upload_failed':HPError.e('There was an error uploading your photo, please try again');QI.hideSpinner();break;default:HPError.e('Saving is failed, please try again');QI.hideSpinner();}},onFBPhotoCheckbox:function(){var box=$('photo_upload_box');if($('use_fb_avatar').checked){box.style.display='none';}else{box.style.display='block';}}};
var SNProject={join_max_tries:5,service_bar:false,comm_bar_cookie_name:'commercial_bar',comm_bar_cookie_lifetime:72,facebook_join_retried:0,popup_needed:HuffCookies.get('snn_popup_needed'),callFunctions:function(functions)
{for(var k=0;k<functions.length;k++)
{if(typeof(functions[k])=='function')functions[k]();}},init:function()
{this.user_logged_in=!!HuffCookies.getUserName();this.maybe_facebook=HPFB.maybeFacebookConnected();this.snp_cookie=HuffCookies.getSNPstatus();this.read_tracking_enabled=HuffPrefs.get('read_tracking');},_join:function()
{HPError.d('Calling SNProject.join');QuickLogin.calledBySNN=true;if($('snp_con'))
$('snp_con').innerHTML='<img src="/images/ajax-loader.gif" alt="" />';this.postJoinSuccess=function(o)
{var SNP=SNProject;if(/user:::done/.test(o.responseText))
{var resparr=o.responseText.split(':::');HPError.d('SNProject.postJoinSuccess',resparr);SNP.members_count=resparr[2];SNP._postJoin();}
else
{if(o.responseText=='error:::nofacebook'||o.responseText=='error:::nouser')
{if(SNProject.facebook_join_retried>1)
{SNProject.facebook_join_retried=0;HPError.e("This feature requires a Facebook account to be linked to your HuffPo account");}
else
{SNProject.facebook_join_retried++;SNProject.joinCheckingUserStatus();}}
else
{HPError.e();}
if($('snp_con'))
{if(-1!==$('snp_con').innerHTML.search(/^<img src="\/images\/ajax-loader.gif" alt="" \/>$/))
{window.location.href=window.location.href;}}
Modal.hideMask();}};return false;},refuse:function()
{return;},_postJoin:function()
{var SNP=SNProject;var QI=HPFBQuickIntroduce;var QS=QuickSignup;SNP._formatStreamMessage(SNP.members_count);SNP.track(HuffCookies.getUserId(),'user_snp_join');Modal.hideMask();var mail_callback=function(){};if(QuickSignup.selectedService=='facebook')
{mail_callback=function()
{Modal.hideMask();var SNP=SNProject;SNP.tellFriends(QuickFacebookInvite.pop);}}
else if(QuickSignup.selectedService=='twitter')
{mail_callback=function()
{Modal.hideMask();var SNP=SNProject;SNP.tellTwitterFriends(SNP.happyJoin);}}
else if(QuickSignup.selectedService=='yahoo')
{mail_callback=function()
{Modal.hideMask();var SNP=SNProject;SNP.getYahooApp(SNP.YahooTellFriends);}}
else if(QuickSignup.selectedService=='google')
{mail_callback=function()
{Modal.hideMask();SNP.happyJoin();}}
else if(QuickSignup.selectedService=='linkedin')
{mail_callback=function()
{Modal.hideMask();var SNP=SNProject;SNP.tellLinkedinFriends(SNP.happyJoin);}}
else
{mail_callback=function()
{Modal.hideMask();SNProject.happyJoin();}}
QI.finalCallback=mail_callback;QI.pop();},_tryToJoinUser:function()
{var SNP=SNProject;var HC=HuffCookies;HPError.d('snn join callback');if(SNP.join_max_tries>0)
{if(HC.getUserId())
{if(HC.getSNPstatus()!=1)
{return SNP._join();}
else
{if(HPUtil.GetEntryID(window.location.href))
{window.location.href=window.location.href;}
else
{window.location='/social/'+HC.getUserName();}}}
else
{SNP.join_max_tries--;setTimeout(SNP._tryToJoinUser,200);}}
else
{window.location='/social/join.html?autojoin=1';}},joinCheckingUserStatus:function(params)
{var SNP=SNProject;var QL=QuickLogin;params=params||{};var service=params['service']||false;if(HuffCookies.getSNPstatus()==1&&HuffCookies.getUserName()&&!HuffPrefs.get('yahoo'))
{location.href=location.href;return false;}
if(!service)
{QuickSNProject.showModal('/users/login/really_fast_login.php?linkedin=1',{inner_class:'service_select_modal',width:820});return false;}
QuickSignup.selectedService=service;QL.calledBySNN=true;if(params.signup)QL.selectedTab='signup';if(HuffCookies.getUserName())
{if(service=='facebook')
{QL.FacebookLoginCallback=SNP._tryToJoinUser;HPFB.login();}
else
{SNP._join();}}
else
{if(service=='facebook')
{QL.FacebookLoginCallback=SNP._tryToJoinUser;HPFB.login();}
else
{QL.OnSuccessCallback=SNP._tryToJoinUser;if(params.signup)
QL.pop(false,{'signup':true});else
QL.pop();}}
return false;},_formatStreamMessage:function(snp_members)
{referral_url=HuffPoUtil.getHostName()+'/social/?r='+escape(HuffCookies.getUserGuid());SNProject.joinMessage={intro:'',message:'',attachment:{name:'Huffington Post Social News',description:'With '+snp_members+' members and counting, Huffington Post Social News is the future of social news.',href:''+referral_url,media:[{type:'image',src:'http://www.huffingtonpost.com/images/social-profile/network.png',href:''+referral_url}]},meta:{type:'join'},action_links:[{text:'Join HuffPost Social News',href:referral_url}]};},showStreamDialog:function()
{var stream_cb=function(response)
{var callbacks=SNProject.showStreamDialog.cbs;if(response&&response.post_id)
{SNProject.callFunctions(callbacks);}
else if('facebook'==QuickSignup.selectedService&&QuickLogin.FacebookLoginCallback&&HPFB.session)
{QuickLogin.FacebookLoginCallback();QuickLogin.FacebookLoginCallback=null;}};var msg=SNProject.joinMessage;HPFB.ensureInit(function(){HPFB.waitForSession(function()
{HPFB.streamPublish(msg.message,msg.attachment,msg.action_links,null,msg.intro,stream_cb);});});},tellFriends:function(friends_callback)
{SNProject.showStreamDialog.cbs=[Modal.hideMask,friends_callback];QuickSNProject.showModal('<h1>Tell Your Friends</h1>'+
'<p>The best part of HuffPost Social News is expanding your network and getting more of your Facebook friends to sign up! By posting to your Facebook wall that you\'ve joined HuffPost Social News, your Facebook friends will want to join as well.</p>'+
'<div class="huff_snn_modal_friend_buttons"><p><a onclick="SNProject.showStreamDialog();return false;" href="#" class="modal_tell_friends_button"><img src="http://s.huffpost.com/images/bookmarking/facebook.gif" width="16" height="16" class="modal_tell_friends_image"/>Post to My Wall</a></p>'+
'<p><a onclick="SNProject.callFunctions(SNProject.showStreamDialog.cbs);return false;" href="#" class="modal_tell_friends_button modal_tell_friends_button_cancel">Skip &raquo;</a></p></div>',{cb:friends_callback,inner_class:'modal_tell_friends'});},tellTwitterFriendsSetAvatar:function(obj)
{var SNP=SNProject;var avatar=null;if(obj)
{if(obj.profile_image_url)
{avatar=obj.profile_image_url;}}
return SNP.tellTwitterFriends(SNP.tTF_friends_callback,SNP.tTF_tweet_text,avatar,false);},tellTwitterFriends:function(friends_callback,tweet_text,avatar,ask_twitter)
{SNProject.twitter_callbacks=[Modal.hideMask,friends_callback];if(ask_twitter==null)ask_twitter=1;if(!tweet_text)
{tweet_text='Join me on @HuffingtonPost Social News';}
avatar=avatar||HuffCookies.getCookie("huffpost_bigphoto");if(!avatar&&ask_twitter)
{var QL=QuickLogin;var screen_name='';var random=Math.floor(Math.random()*1000000);var SNP=SNProject;SNP.tTF_friends_callback=friends_callback;SNP.tTF_tweet_text=tweet_text;if(screen_name)
{var url='http://api.twitter.com/1/users/show.json?screen_name='+screen_name+'&callback=SNProject.tellTwitterFriendsSetAvatar&rnd='+random
HuffPoUtil.loadAndRun(url);return false;}}
if(!avatar)
{avatar='http://s.twimg.com/a/1274144130/images/default_profile_6_bigger.png';}
var modal_theme={ids:{},html:"",close_button_id:""};modal_theme.ids={top_container:'huff_snn_modal_common',error_msg:"basic_twitter_modal_window_error_msg",comm_text:"basic_twitter_modal_window_comm_text",comm_checkbox:"basic_twitter_modal_window_share_checkbox",textarea:"signup_tweet",chars_left_title:"basic_twitter_modal_window_chars_left",close_button:"basic_twitter_modal_window_close_button",submit_button:"basic_twitter_modal_window_submit_button",submit_button_hider:"basic_twitter_modal_window_submit_button_hider",skip_button:"basic_twitter_modal_window_skip_button",loader_icon:"basic_twitter_modal_window_loader_icon",status_text:"basic_twitter_modal_window_status_text"};modal_theme.close_button_id=modal_theme.ids.close_button;modal_theme.html="\
					<div id='"+modal_theme.ids.top_container+"' class='twitter_modal_window_new'>\
                        <div class='border_top'></div>\
                        <div class='main_container'>\
                                <div id='"+modal_theme.ids.close_button+"' class='close_button'></div>\
                                <div class='title'><img class='img' src='/images/social-profile/lightbox2/hp_twitter_title_beta.png'></div>\
                                <div id='"+modal_theme.ids.chars_left_title+"' class='counter_container' style='padding-right:48px'></div>\
                                <div class='avatar'><img width='50' height='50' style='position: absolute; left: 34px; top: 93px;' src='"+avatar+"' /></div> <div class='textarea_container'><textarea id='signup_tweet' class='textarea'></textarea></div>\
                                <div style='clear: both;'></div>\
                                <div id='"+modal_theme.ids.comm_block+"' style='display: none;'>\
	                                <div class='checkbox_container'>\
	                                    <input id='"+modal_theme.ids.comm_checkbox+"' type='checkbox'>\
	                                </div>\
	                                <div id='"+modal_theme.ids.comm_text+"' class='checkbox_label_container'></div>\
	                                <div style='clear: both;'></div>\
	                            </div>\
								<div class='post_twitter_loader center padding_5_0' id='sup_pt_loader'><img src='/images/profile/spinner.gif' /></div>\
                                <div class='ttf_submit_container display_none' id='sup_pt_buttons'>\
                                    <div id='"+modal_theme.ids.skip_button+"' class='ttf_skip_button'>&nbsp;</div>\
									<div id='"+modal_theme.ids.submit_button+"' class='ttf_submit_button'>&nbsp;</div>\
                                </div>\
                        </div>\
                        <div class='border_bottom'></div>\
                    </div>";QuickSNProject.showModal("",{window_theme:'basic_twitter',cb:friends_callback,theme_params:{inner_html:modal_theme.html,close_button_id:modal_theme.close_button_id}});var twitter_link_url="http://"+HPConfig.current_web_address+"/?twitsign="+Provider.user_provider_info.twitter.screen_name;YAHOO.util.Event.onAvailable(modal_theme.ids.top_container,function()
{this.prepareTweet(modal_theme,{tweet:tweet_text,url:twitter_link_url});},null,this);return false;},prepareTweet:function(modal_theme,params)
{var text_limit=140;key_up_handler=function(){var maxlimit=text_limit;var textarea=$(modal_theme.ids.textarea);var chars_left_title=$(modal_theme.ids.chars_left_title);if(textarea.value.length>maxlimit){chars_left_title.innerHTML=0;}
else{chars_left_title.innerHTML=maxlimit-textarea.value.length;}};var callback=function(){tweet_text=params.tweet;BitlyCB.shortenResponse=function(data){var surl='';var first_result;for(var r in data.results){first_result=data.results[r];break;}
surl=first_result["shortUrl"].toString();var textarea=$(modal_theme.ids.textarea);if(textarea){textarea.value=params.tweet+" "+surl;E.on(textarea,"keyup",key_up_handler,null);E.on(textarea,"keyup",HPUtil.enforceTextAreaLimit,{chars:text_limit});E.on(textarea,"change",HPUtil.enforceTextAreaLimit,{chars:text_limit});}
Dom.addClass('sup_pt_loader','display_none');Dom.removeClass('sup_pt_buttons','display_none');var chars_left_title=$(modal_theme.ids.chars_left_title);if(chars_left_title){chars_left_title.innerHTML=text_limit-textarea.value.length;}
var submit_button=$(modal_theme.ids.submit_button);if(submit_button){E.on(submit_button,"click",SNProject.postToTwitter,null);}
var skip_button=$(modal_theme.ids.skip_button);if(skip_button)
{E.on(skip_button,"click",SNProject.skipTwitterStatus,null);}}
BitlyClient.shorten(params.url,'BitlyCB.shortenResponse');};var load_bitly="http://bit.ly/javascript-api.js?version=latest&login=huffpost&apiKey=R_3db9b90fe8f78f0f2b180e72055462c8";HuffPoUtil.loadAndRun(load_bitly,callback);},postToTwitter:function(e)
{var QS=QuickSignup;var callbacks=SNProject.twitter_callbacks;var tweet_text=$('signup_tweet').value;if(tweet_text!=""&&tweet_text.length<140)
{var get_data="tid="+Provider.user_provider_info.twitter.id+"&toauth_token="+Provider.user_provider_info.twitter.oauth_token+"&toauth_secret="+Provider.user_provider_info.twitter.oauth_token_secret+"&tweet="+encodeURIComponent(tweet_text);C.asyncRequest('GET','/users/social_news_project/twitter/post_to_twitter.php?'+get_data,{success:SNProject.callFunctions(callbacks),failure:function(){HPError.e();},timeout:5000});}
else if(tweet_text=="")
{alert("Please enter some text");return false;}
else
{alert("Status limit exceeded");return false;}},tellLinkedinFriends:function(friends_callback)
{SNProject.linkedin_callbacks=[Modal.hideMask,friends_callback];var link_url="http://"+HPConfig.current_web_address;QuickSNProject.showModal("<h1>Tell Your Friends</h1>"+
"<p>Set status on LinkedIn (Not more than 140 letters)</p>"+
"<p><textarea id=\"signup_lin\" class=\"tweet_textarea\">Join me on HuffingtonPost Social News "+link_url+" </textarea></p>"+
"<p class=\"\" id=\"post_li_response\"><a onclick=\"SNProject.postToLinkedin();return false;\" href=\"#\" class=\"modal_tell_friends_button\"><img src=\"/images/linkedin_16x16.gif\" width=\"16\" height=\"16\" class=\"modal_tell_friends_image\"/>Post to LinkedIn</a></p><div class=\"modal_tell_friends_skip_button\" id=\"post_li_skip\"><a onclick=\"SNProject.skipLinkedinStatus();return false;\" href=\"#\"><img src=\"/images/social-profile/lightbox/snn_lightbox_skip_little.png\" alt=\"Skip\" /></a></div>",{cb:friends_callback,inner_class:'modal_tell_friends'});E.on($('signup_lin'),'keyup',HPUtil.enforceTextAreaLimit,{chars:140});E.on($('signup_lin'),'change',HPUtil.enforceTextAreaLimit,{chars:140});},postToLinkedin:function()
{var QS=QuickSignup;var callbacks=SNProject.linkedin_callbacks;var status_text=$('signup_lin').value;if(status_text!=""&&status_text.length<140)
{var get_data="status="+encodeURIComponent(status_text);$('post_li_response').innerHTML="Updating...";$('post_li_skip').innerHTML="";C.asyncRequest('GET','/users/social_news_project/post_to_linkedin.php?'+get_data,{success:function(o){if(/success/.test(o.responseText))
$('post_li_response').innerHTML="<p class=\"li_status_response\">Status updated successfully</p>";else
$('post_li_response').innerHTML="<p class=\"li_status_response\">Unable to process</p>";setTimeout(function(){SNProject.callFunctions(callbacks);},3000);},failure:function(){HPError.e();setTimeout(function(){SNProject.callFunctions(callbacks);},3000);},timeout:5000});}
else if(status_text=="")
{alert("Please enter some text");return false;}
else
{alert("Status limit exceeded");return false;}},skipTwitterStatus:function(e)
{var callbacks=SNProject.twitter_callbacks;SNProject.callFunctions(callbacks);},skipLinkedinStatus:function()
{SNProject.callFunctions(SNProject.linkedin_callbacks);},getYahooApp:function(callback)
{var yid='';if(typeof Provider.user_provider_info.yahoo.id!="undefined")
{yid="?yid="+Provider.user_provider_info.yahoo.id;}
var link_url="http://"+HPConfig.current_web_address+"/social/"+yid;QuickSNProject.showModal("<div style=\"background:url('/images/widget/yahoo/ybang_51x51.png') no-repeat 0 0; width:315px; height:51px; color:#6a3c92; margin:0px auto; padding:7px 10px 0 55px; font:bold 33px Arial;\">Get our Yahoo! App</div>"+
"<p style=\"text-align:center;\"><a href=\"http://apps.yahoo.com/-yYovYr64\" onclick=\"SNProject.installYApp(); return false;\" ><img src=\"/images/widget/yahoo/hp_yahoo_screenshot.png\" alt=\"The Huffington Post\" \></a></p>"+
"<p style=\"text-align:center;\"><a href=\"http://apps.yahoo.com/-yYovYr64\" onclick=\"SNProject.installYApp(); return false;\" ><img src=\"/images/widget/yahoo/add_to_yahoo.png\" alt=\"Add to Yahoo!\"></a></p>"+
"<div style='clear:both; margin-bottom:10px'></div>"+
"<p style=\"text-align:center;\"><a href=\"#\" onclick=\"QuickSNProject.hideMask(); return false;\" style=\"color:#787d81; font-size:11px;\" >Skip This Step</a></p>",{cb:callback,inner_class:'modal_tell_friends'});},YahooTellFriends:function(callback)
{if(undefined===callback)
callback=SNProject.happyJoin;QuickSNProject.showModal("<div style='font:bold 16px Arial; text-transform: uppercase; color:#7842a7; margin:30px 0pt 7px 0pt;'>tell your friends about huffpost social news</div>"+
"<p>Set status on Yahoo! (Not more than 140 letters)</p>"+
"<p><textarea id=\"signup_yahoo\" class=\"tweet_textarea\">Join me on HuffPost!</textarea></p>"+
"<p style=\"text-align:center;\"><a onclick=\"SNProject.updateYahooActivity(); return false;\" style='display:block; background-color:#7943a8; width:75px; color:#FFFFFF; font-size:18px; padding:6px; margin:auto; text-align:center;' href=\"#\">Update</a></p>"+
"<div id='yahoo_update_status'></div><br/>"+
"<p style=\"text-align:center;\"><a href=\"#\" onclick=\"QuickSNProject.hideMask(); return false;\" style=\"color:#787d81; font-size:11px;\" >Skip This Step</a></p>",{cb:callback,inner_class:'modal_tell_friends'});E.on($('signup_yahoo'),'keyup',HPUtil.enforceTextAreaLimit,{chars:140});E.on($('signup_yahoo'),'change',HPUtil.enforceTextAreaLimit,{chars:140});},installYApp:function()
{var url='http://apps.yahoo.com/-AIjuiA4o';PopupManager.open(url,800,600);QuickSNProject.hideMask();},updateYahooStatus:function(status_text)
{if("undefined"==typeof status_text)
{if($('signup_yahoo'))
{var status_text=$('signup_yahoo').value;}
else
{var status_text="";}}
if(status_text!=""&&status_text.length<140)
{var get_data="update="+encodeURIComponent(status_text);C.asyncRequest('GET','/users/social_news_project/yahoo/update_yahoo_status.php?'+get_data,{success:function(){$('yahoo_update_status').innerHTML='<b style="font:l2px Tahoma; color:#FFDD66;">The status was updated.</b>';setTimeout(QuickSNProject.hideMask,1500);},failure:function(){HPError.e();},timeout:5000});}
else if(status_text=="")
{alert("Please enter some text");return false;}
else
{alert("Status limit exceeded");return false;}},updateYahooActivity:function(activity_text,activity_image)
{if("undefined"==typeof activity_text)
{var activity_text="";if($('signup_yahoo'))
activity_text=": "+$('signup_yahoo').value;}
if(activity_text!=""&&activity_text.length<140)
{var get_data="update="+encodeURIComponent(activity_text);if("undefined"!=typeof activity_image)
get_data+="&imageURL="+encodeURIComponent(activity_image);C.asyncRequest('GET','/users/social_news_project/yahoo/update_yahoo_activity.php?'+get_data,{success:function(o){if("success"==o.responseText)
$('yahoo_update_status').innerHTML='<b style="font:l2px Tahoma; color:#108d7c;">We have shared your message</b>';setTimeout(QuickSNProject.hideMask,1500);},failure:function(){HPError.e();},timeout:5000});}
else if(status_text=="")
{$('yahoo_update_status').innerHTML='<b style="font:l4px Arial; color:red;">Please enter some text</b>';return false;}
else
{$('yahoo_update_status').innerHTML='<b style="font:l4px Arial; color:red;">Status limit exceeded</b>';return false;}},happyJoinMessage:'Welcome to HuffPost Social News! You\'ll notice that a few things have changed now that you\'ve joined. On most Huffington Post pages you visit, you\'ll notice a new module for HuffPost Social News to view your activity and your friends\' activity. From there you can view your HuffPost Social News profile page, change your Social preferences and see what stories on HuffPost are most popular in your network. Other than that, all you have to do is browse HuffPost like you always do. Enjoy!',happyJoinResizeModal:function(inner_height)
{if(Y.util.Event.isIE){$('huff_snn_modal_common').style.height=inner_height+'px';}else{inner_height+=10;$('huff_snn_modal_common').style.height=inner_height+'px';}},happyJoin:function()
{if('facebook'==QuickSignup.selectedService&&QuickLogin.FacebookLoginCallback)
{QuickLogin.FacebookLoginCallback();QuickLogin.FacebookLoginCallback=null;return;}
var on_story=HPUtil.GetEntryID(window.location.href);if(on_story)
{QuickSNProject.showModal();YAHOO.util.Event.removeListener("wrapper_mask","click");YAHOO.util.Event.removeListener("huff_snn_modal_common_close","click");YAHOO.util.Event.addListener("wrapper_mask","click",SNProject.happyJoinOnClose);YAHOO.util.Event.addListener("huff_snn_modal_common_close","click",SNProject.happyJoinOnClose);YAHOO.util.Event.addListener("modal_choose_fans","click",SNProject.happyJoinOnClose);SNProject.happyJoinCallback();}
else
SNProject.happyJoinOnClose();return;},happyJoinCallback:function()
{if(SNProject.finalSignupCallback&&typeof(SNProject.finalSignupCallback)=='function')
{return SNProject.finalSignupCallback();}
else
{$('huffpo_snn_is_loading').style.display='none';$('huff_snn_modal_common_inner').innerHTML=SNProject.happyJoinMessage;var on_story=HPUtil.GetEntryID(window.location.href);$('huff_snn_modal_common_inner').innerHTML+='<div id="huff_snn_modal_common_buttons"'+
(on_story?' class="btns_wide"':'')+'>'+
(on_story?'<div><a href="#" onclick="window.location.reload(); return false;"><big>&larr;</big> Return to <strong>article</strong></strong></a></div>':'')+
'<div class="btn_right"><a href="/social/'+HuffCookies.getUserName()+'">Go to <strong>Social Profile <big>&rarr;</big></strong></a></div>'+
'</div>';}},happyJoinOnClose:function()
{location.href='/social/'+HuffCookies.getUserName();},checkFriendsFansOnJoin:function()
{C.asyncRequest('POST','/users/social_news_project/make_friends_fans.php',{success:function(o){if(HuffPoUtil.trim(o.responseText)!=''){var splits=o.responseText.split(':::::');QuickSNProject.showModal();$('huffpo_snn_is_loading').style.display='none';$('huff_snn_modal_common_inner').innerHTML=splits[0];if("undefined"!=typeof(FB))
setTimeout(function(){FB.XFBML.parse($('huff_snn_modal_common_inner'));},500);SocialFriends.init();}},timeout:30000},HPFB.getSessionForServer()||'');},checkFriendsFansOnLogin:function()
{if(Modal.id){setTimeout(function(){SNProject.checkFriendsFansOnLogin();},3000);}
else{SNProject.checkFriendsFansOnJoin();}},track:function(id,action,reference)
{var snp=SNProject;if(window.location.host!='www.huffingtonpost.com')return true;if(!id||id==''){id=0;}
if(!reference||reference==''){reference=0;}
if(/[^\d+]/.test(id)||/[^\d+]/.test(reference)||(action!='delete_entry_view'&&action!='entry_view'&&action!='entry_like'&&action!='entry_unlike'
&&action!='comment_comment'&&action!='entry_vote'&&action!='slideshow_poll_vote'&&action!='slideshow_poll_facebook_share'&&action!='user_snp_join'&&action!='hufflist_item_added'&&action!='comment_favored'&&action!='user_log_in'&&action!='user_log_out'&&action!='user_follow'&&action!='poll_vote'&&action!='prediction_vote'))
{return false;}
can_track=true;if(action=='entry_view')
{can_track=HuffPrefs.get('read_tracking');}
if(HuffCookies.getUserId()&&can_track)
{var func=function()
{var user_stats_project_image_src="http://user-stats.huffpost.com/?"+HuffCookies.getUserId()+"&"+Math.random().toString(16).replace('0.','')+'&'+escape(id)+'&'+escape(action)+'&'+escape(reference);my_img=document.createElement('img');my_img.setAttribute('src',user_stats_project_image_src);my_img.setAttribute('style',"height:1px; line-height:1px; overflow:hidden");$('_snp_tracking').appendChild(my_img);}
if(action=='entry_view')
{setTimeout(func,1000);}
else
{func();}}
return true;},fanCheck:function(){if(SNProject.user_logged_in&&1==HuffCookies.getCookie('check_for_fans'))
SNProject.checkFriendsFansOnLogin();else if(SNProject.user_logged_in&&SNProject.snp_cookie==1&&HuffCookies.get('snn_popup_needed')){HPFB.ensureInit(function(){if('connected'==HPFB.user_status)
setTimeout(function(){SNProject.checkFriendsFansOnLogin();},3000);});}
HuffCookies.del('snn_popup_needed');HuffCookies.destroyCookie('check_for_fans');},linkAccountsBar:function(bar)
{if(this.service_bar||!(YAHOO.env.ua.gecko||navigator.userAgent.toLowerCase().match('chrome')))
return false;var user_id=HuffCookies.getUserId();var service_bar=document.createElement("div");Dom.addClass(service_bar,"service_bar");service_bar.id="service_bottom_bar";var bar_cookie=HuffCookies.getCookie('service_bar');var bar_properties={};var comm_bar_cookie=HuffCookies.getCookie(this.comm_bar_cookie_name);service_bar.innerHTML="";switch(bar)
{case"regular":if(user_id)
{if(HuffPrefs.get('facebook')===false)
bar_properties={bar_type:bar,show:'facebook',service_bar_cookie:bar_cookie,track:'/t/a/bar/fb-link',img:'/images/fb-large.gif',bar_text:'Sign in now using your facebook account to integrate HuffPost and Facebook!'};else if(HuffPrefs.get('twitter')===false)
bar_properties={bar_type:bar,show:'twitter',service_bar_cookie:bar_cookie,track:'/t/a/bar/twitter-link',img:'/images/Sign-in-with-Twitter-darker.png',bar_text:'You\'re connected to HuffPost with Facebook...now add your Twitter account!'};}
else
bar_properties={bar_type:bar,show:'random',service_bar_cookie:bar_cookie};break;case"special":bar_properties={bar_type:bar,show:'facebook_special',service_bar_cookie:bar_cookie,track:'/t/a/bar/fb-login',img:'/images/fb-large.gif',bar_text:'Please log back in to Facebook to ensure that your HuffPost profile photo and other features continue to function'};break;case"comm_service_bar":bar_properties={bar_type:bar,show:'commercial',service_bar_cookie:comm_bar_cookie};break;default:return false;}
this.drawBottomBar(service_bar,bar_properties);return;},drawBottomBar:function(service_bar,bar_properties)
{var bar_html=false;var inner_text=false;var body=document.body;if(bar_properties.show=="random")
{var random=Math.floor(Math.random()*2);if(random==0)
{bar_properties.show='facebook';bar_properties.track='/t/a/bar/fb-join';bar_properties.bar_text='Join HuffPost Social News and connect with your friends on Facebook';bar_properties.img='/images/fb-large.gif';}
else
{bar_properties.show='twitter';bar_properties.track='/t/a/bar/twitter-join';bar_properties.bar_text='Join HuffPost Social News and connect with your friends on Twitter';bar_properties.img='/images/Sign-in-with-Twitter-darker.png';}}
if(!bar_properties||!this.showServiceBar(bar_properties.show,bar_properties.service_bar_cookie))
return false;if(bar_properties.bar_type=="regular")
{var onclick_js="HPTrack.trackPageview('"+bar_properties.track+"'); linkSocialAccount.checkLoginStatus('"+bar_properties.show+"'); return false;";inner_text=bar_properties.bar_text+"</td><td class=\"service_bar_img\"><a href=\"/social/join.html?autojoin=1\" onclick=\""+onclick_js+"\"><img border=\"0\" src=\""+bar_properties.img+"\" alt=\"Connect\" /></a>";this.service_bar=bar_properties.show;this.setLinkBarCookie(bar_properties.show);}
else if(bar_properties.bar_type=="special")
{HuffCookies.setCookie('service_bar','111',48);var onclick_js="HuffCookies.destroyCookie('service_bar');HPTrack.trackPageview('"+bar_properties.track+"');HPFB.login(); return false;";inner_text=bar_properties.bar_text+"</td><td class=\"service_bar_img\"><a href=\"javascript:void(0);\" onclick=\""+onclick_js+"\"><img border=\"0\" src=\""+bar_properties.img+"\" alt=\"Connect\" /></a>";this.service_bar=bar_properties.show;}
else if(bar_properties.bar_type=="comm_service_bar")
{branding_img=comm_service_bar.branding_img;message=comm_service_bar.message;landing_url=comm_service_bar.landing_url;bg_color=comm_service_bar.bg_color;if(comm_service_bar.tracking_pixel)
{HPUtil.trackerImg(comm_service_bar.tracking_pixel);}
bar_html="<div class=\"link_service\" style=\"cursor:pointer;padding:0\"><table height=\"40\" width=\"100%\" style=\"height:40px\;background-image:url('http://www.huffingtonpost.com/images/trans.gif')\"><tr><td width=\"50%\" onclick=\"SNProject.closeLinkBar('comm', true, '"+landing_url+"');\" ></td><td style=\"width:500px\" class=\"service_bar_text\" onclick=\"SNProject.closeLinkBar('comm', true, '"+landing_url+"');\" style=\"cursor:pointer;\"><div><img src=\"http://www.huffingtonpost.com/images/trans.gif\" height=\"1\" width=\"500\"/></div>"+message+"</td><td width=\"120\" class=\"service_bar_img\" onclick=\"SNProject.closeLinkBar('comm', true, '"+landing_url+"');\" style=\"cursor:pointer;\"><img style=\"padding:0px 10px\" border=\"0\" src=\""+branding_img+"\" alt=\"\" /></td><td width=\"60\" class=\"close_bar_img\"><img src=\"/images/close_service_bar.gif\" onclick=\"SNProject.closeLinkBar('comm', true);\" /></td><td width=\"50%\" onclick=\"SNProject.closeLinkBar('comm', true, '"+landing_url+"');\"></td></tr></table></div>";this.service_bar='comm';Dom.setStyle(service_bar,'background-color',bg_color);Dom.setStyle(service_bar,'padding',0);}
if(inner_text&&!bar_html)
bar_html="<div class=\"link_service\"><table><tr><td class=\"service_bar_text\">"+inner_text+"</td><td class=\"close_bar_img\"><a href=\"javascript:void(0);\" onclick=\"SNProject.closeLinkBar('"+bar_properties.show+"', true);\"><img src=\"/images/close_service_bar.gif\" /></a></td></tr></div>";if(bar_html)
{service_bar.innerHTML=bar_html;body.appendChild(service_bar);}
return;},showServiceBar:function(service,cookie)
{switch(service)
{case"facebook":return!(cookie&&cookie.charAt(0)=="1");break;case"twitter":return!(cookie&&cookie.charAt(1)=="1");break;case"facebook_special":return!(cookie&&cookie.charAt(2)=="1");break;case"commercial":return!(cookie);break;default:return false;break;}},closeLinkBar:function(type,user_closed,popup_url)
{if(type)
{this.setLinkBarCookie(type,user_closed);if((type=='comm')&&(typeof(popup_url)!='undefined'))
window.open(popup_url);}
if($('service_bottom_bar'))
$('service_bottom_bar').style.display="none";},setLinkBarCookie:function(type,user_closed)
{if(type=='comm')
{HuffCookies.setCookie(this.comm_bar_cookie_name,'1',this.comm_bar_cookie_lifetime);return;}
var cookie_lifetime=(24*7);var bar_cookie=HuffCookies.getCookie('service_bar');if(!bar_cookie)bar_cookie="000";var facebook_link_bit=bar_cookie.charAt(0);var twitter_link_bit=bar_cookie.charAt(1);var facebook_login_reminder_bit=bar_cookie.charAt(2);switch(type)
{case'facebook':facebook_link_bit="1";break;case'twitter':twitter_link_bit="1";break;case'facebook_special':facebook_login_reminder_bit="1";break;}
var new_cookie=""+facebook_link_bit+""+twitter_link_bit+""+facebook_login_reminder_bit;HuffCookies.setCookie('service_bar',new_cookie,cookie_lifetime);},showTopTwitterInfo:function(twitter_name)
{if(twitter_name)
{if(!($('top_twitter_info')))
return;C.asyncRequest('GET','/users/social_news_project/twitter/get_twitter_info.php?tname='+twitter_name,{success:function(o){if(o.responseText)
$('top_twitter_info').innerHTML=o.responseText;},failure:function(){HPError.e();},timeout:5000});}}}
SNProject.init();var SNPstream={social_first_load:true,social_last_date:null,social_is_requested:false,social_c_request:1,social_max_requests:100,get_more_entries:true,num_entries_per_request:50,username:null,last_el:null,first_id:null,get_snn_update_delay:60,counter_new_items:0,update_in_progress:false,init_snn_update:function()
{setTimeout(function(){SNPstream.retrieve_snn_update();},SNPstream.get_snn_update_delay*1000);},retrieve_snn_update:function()
{setTimeout(function(){SNPstream.retrieve_snn_update();},SNPstream.get_snn_update_delay*1000);SNPstream.newest_public_stream();},get_stream:function(social_profile_url,username,from_date,callback)
{if(!social_profile_url)social_profile_url='/users/social_news_project/social_stream.php';this.feedback_show('','',false);var params=new Array();if(username!=null)params.push('username='+username);if(!from_date)
{if(from_date==null)
if(this.social_last_date)params.push('after='+this.social_last_date);}
else
params.push('after='+from_date);if(!callback)
callback=SNPstream.process_snp_response;if(HuffPoUtil.getUrlVar('action'))params.push('who='+HuffPoUtil.getUrlVar('action'));if(params.length>0)social_profile_url+='?'+params.join('&');YAHOO.util.Connect.asyncRequest('GET',social_profile_url,{success:function(o){callback(o);}});},public_stream:function()
{this.get_stream('/users/social_news_project/public_stream.php');YAHOO.util.Event.addListener(window,'scroll',function(){SNPstream.social_scroll_window(true);});},social_stream:function(username)
{if(!username)
{if(this.username)
username=this.username;}
else
this.username=username;this.get_stream('/users/social_news_project/social_stream.php',username);YAHOO.util.Event.addListener(window,'scroll',function(){SNPstream.social_scroll_window();});},newest_public_stream:function(from_date,override_restrictions)
{if(!HPDocStatus.on_focus&&!SNPstream.update_in_progress&&!override_restrictions)return null;if(!from_date)
from_date=0;SNPstream.update_in_progress=true;this.get_stream('/users/social_news_project/public_stream.php',null,from_date,SNPstream.process_newest_stream);},update_counter:function()
{if($('snp_new_items'))
{if(SNPstream.counter_new_items>0)
{var msg='Show '+SNPstream.counter_new_items+' new posts';if(SNPstream.counter_new_items==1)
{msg='Show 1 new post';}
$('snp_new_items').innerHTML='<a href="#" onclick="SNPstream.show_new_posts(); return false;">'+msg+'</a>';}
else
{$('snp_new_items').innerHTML='';}}},show_new_posts:function()
{els=Dom.getElementsByClassName('snn_hidden','li','snp_items_ul');for(var i=0;i<els.length;i++)
Dom.removeClass(els[i],'snn_hidden');SNPstream.counter_new_items=0;SNPstream.update_counter();},process_newest_stream:function(o)
{try
{o=eval("("+o.responseText+")");}
catch(err)
{return null;}
if(!o)
return null;if(o.error)
{SNPstream.get_more_entries=false;switch(o.error)
{case'downtime':default:}
return;}
if(o.snn_total_items!=null)
{if(o.snn_total_items<SNPstream.num_entries_per_request)
{}}
if(o.snn&&o.snn!='')
{var last_update_stream_date=o.snn_last_date;$('hpsn_update_temp').innerHTML=o.snn;var snn_items_temp=Dom.getChildren($('hpsn_update_temp'));var counter_coincidences=0;for(var i=0;i<snn_items_temp.length;i++)
{if(SNPstream.get_item_snn_id(snn_items_temp[i].id)>SNPstream.get_item_snn_id(SNPstream.first_id))
{SNPstream.append_to_repo(snn_items_temp[i]);}
else
{counter_coincidences++;}}
if(counter_coincidences==0)
{SNPstream.newest_public_stream(last_update_stream_date,true);}
else
{var repo_children=Dom.getChildren($('hpsn_update_repo'));if(repo_children.length>0)
{var first_stream_el=Dom.getFirstChild('snp_items_ul');for(var i=0;i<repo_children.length;i++)
Dom.insertBefore(repo_children[i],first_stream_el);var new_first_stream_item=Dom.getFirstChild('snp_items_ul');SNPstream.first_id=new_first_stream_item.id;$('hpsn_update_repo').innerHTML='';}
SNPstream.update_counter();SNPstream.update_in_progress=false;}}
else
{}},append_to_repo:function(el)
{Dom.addClass(el,'snn_hidden');repo_children=Dom.getChildren($('hpsn_update_repo'));if(repo_children.length>0)
{Dom.insertAfter(el,repo_children[(repo_children.length-1)]);}
else
{$('hpsn_update_repo').appendChild(el);}
SNPstream.counter_new_items++;},get_item_snn_id:function(el_id)
{el_id_arr=el_id.split('-');return parseInt(el_id_arr[1]);},process_snp_response:function(o)
{window.setTimeout(function()
{SNPstream.social_is_requested=false;},1500);if(o=='')
{if(SNPstream.social_first_load)
{SNPstream.feedback_show("Currently, there is no activity for this user.","Currently, there is no activity for this user's friends.",false);SNPstream.get_more_entries=false;}
if($('wait_image'))$('wait_image').style.display='none';}
try
{o=eval("("+o.responseText+")");}
catch(err)
{if(SNPstream.social_first_load)
{SNPstream.feedback_show("Currently, there is no activity for this user.","Currently, there is no activity for this user's friends.",false);SNPstream.get_more_entries=false;}
SNPstream.feedback_hide_image();}
if(!o)
{if(SNPstream.social_first_load)
{SNPstream.feedback_show("Currently, there is no activity for this user.","Currently, there is no activity for this user's friends.",false);SNPstream.get_more_entries=false;}
SNPstream.feedback_hide_image();}
if(o.error)
{SNPstream.get_more_entries=false;switch(o.error)
{case'access denied':var link="";if(HuffCookies.getUserId()){link="<div class='friend_accept_button' onClick='window.location = \"/users/becomeFan.php?of="+o.username+"\"'></div>";}
var friend_request_html="\
						<div class='friend_request'>\
							<div class='text' style='width: "+(link?"360":"530")+"px;'>You must be friends with "+HPUtil.getDisplayName(o.username)+" to view this Social News profile</div>\
						"+(link?link:"")+"\
					</div>";SNPstream.feedback_show(friend_request_html);break;case'downtime':SNPstream.feedback_show('Sorry but we are running some maintenance work here. <br />Please check again later.');break;case'profile removed':SNPstream.feedback_show('Sorry but this user has been removed from HuffingtonPost');break;case'profile not found':SNPstream.feedback_show('Sorry but the user you are looking for doesn\'t exist. <br />Maybe you mispelled the username?');break;case'private profile':SNPstream.feedback_show('Sorry, but this user\'s updates are private');break;default:if(SNPstream.social_first_load)
SNPstream.feedback_show('This social profile failed to load. Our team has been alerted of this error and we\'ll be looking into it right away. Please also feel free to email socialnews@huffingtonpost.com with any additional information or feedback.',null,false);SNPstream.feedback_hide_image();}
return;}
document.documentElement.scrollTop-=10;SNPstream.social_c_request++;if(o.user)
{user=o.user;if(user.pending_pic&&user.pending_pic!=''&&user.same)
{$('user_profile_pic').src=user.pending_pic;$('pending_approval').style.display='inline';}
}
if(o.snn_total_items!=null)
{if(o.snn_total_items<SNPstream.num_entries_per_request)
{SNPstream.get_more_entries=false;}}
if(o.snn&&o.snn!='')
{SNPstream.social_last_date=o.snn_last_date;SNPstream.feedback_hide();if(SNPstream.last_el)
{$('snp_items_temp').innerHTML=o.snn;var snn_items_temp=Dom.getChildren($('snp_items_temp'));for(var i=(snn_items_temp.length-1);i>=0;i--)
Dom.insertAfter(snn_items_temp[i],SNPstream.last_el);}
else
if($('snp_items_ul'))$('snp_items_ul').innerHTML+=o.snn;if(!SNPstream.first_id)
{var first_el=Dom.getFirstChild('snp_items_ul');SNPstream.first_id=first_el.id;}
SNPstream.last_el=Dom.getLastChild('snp_items_ul');if(SNPstream.social_first_load)
{SNPstream.social_first_load=false;if(o.snn=='')
{SNPstream.feedback_show("Currently, there is no activity for this user.","Currently, there is no activity for this user's friends.",false);SNPstream.get_more_entries=false;}}}
else
{if(SNPstream.social_first_load)
{SNPstream.feedback_show("Currently, there is no activity for this user.","Currently, there is no activity for this user's friends.",false);SNPstream.get_more_entries=false;SNPstream.feedback_hide_image();}
else
{SNPstream.feedback_hide();}}},show_more:function(what)
{if(what!='friends'&&what!='fan'&&what!='following')
return true;var flist=$('hpsn_'+what);if(!flist)return true;var friends=YAHOO.util.Dom.getChildren(flist);for(var i=friends.length;i--;)
{friends[i].style.display='inline';if(YAHOO.util.Dom.hasClass(friends[i],'hpsn_friends_hiddeme'))friends[i].style.display='none';}
return false;},show_followed:function(id)
{$('show_all_followed_'+id).style.display='none';Dom.getElementsByClassName('snn_item_uname_hidden','span',id,function(o)
{Dom.removeClass(o,'snn_item_uname_hidden');Dom.addClass(o,'snn_item_uname');});return false;},show_friends:function(id)
{if(!id)return null;var flist=$('friends-list-'+id);if(!flist)return null;var friends=YAHOO.util.Dom.getChildren(flist);for(var i=friends.length;i--;)
{friends[i].style.display='inline';}
if($('more-friends-'+id))$('more-friends-'+id).style.display='none';return false;},social_scroll_window:function(public_mode)
{if(this.social_first_load)
{return false;}
var viewHeight=YAHOO.util.Dom.getViewportHeight();var scrollWithViewHeight=YAHOO.util.DragDropMgr.getScrollTop()+viewHeight;var documentHeight=YAHOO.util.Dom.getDocumentHeight();var tmp=documentHeight-1500;if(tmp<scrollWithViewHeight&&!this.social_is_requested&&this.social_c_request<=this.social_max_requests&&this.get_more_entries)
{this.social_is_requested=true;this.feedback_show('','',false);if(public_mode)
this.public_stream();else
this.social_stream();}},feedback_hide_image:function()
{if($('wait_image'))$('wait_image').style.display='none';},feedback_hide:function()
{if($('e_buffering'))$('e_buffering').style.display='none';},feedback_show:function(my_activity_feedback,my_friends_activity_feedback,hide_wait)
{if($("e_buffering"))$("e_buffering").style.display='block';if(hide_wait==null)hide_wait=true;if(!my_activity_feedback||my_activity_feedback=='')my_activity_feedback='Loading...';if(my_friends_activity_feedback==null||my_friends_activity_feedback=='')
my_friends_activity_feedback=my_activity_feedback;switch(HuffPoUtil.getUrlVar('action'))
{case'profile':if($('wait_message'))$('wait_message').innerHTML=my_activity_feedback;break;case'friends':default:if($('wait_message'))$('wait_message').innerHTML=my_friends_activity_feedback;}
if(hide_wait)
SNPstream.feedback_hide_image();return true;}};var SNPprofile={profile_username:null,is_my_profile:false,tab_prefix_who:'',init:function(profile_config)
{var profile_username=profile_config.username;this.profile_username=profile_username;var current_hpusername=HPUser.username;if(current_hpusername)current_hpusername=current_hpusername.replace(/\+/g,' ');this.is_my_profile=(this.profile_username!=''&&current_hpusername!=''&&this.profile_username==current_hpusername);if(this.is_my_profile)
{if(profile_config&&profile_config.badge_participation)
HPConfig.user_badges_participation=profile_config.badge_participation;$('profile_stealth_main').style.display='block';this.show_profile_owner_options();var snntabs=Dom.getElementsByClassName('snnopttab');for(var i=0;i<snntabs.length;i++)
{snntabs[i].innerHTML='My '+snntabs[i].innerHTML;}
if(HuffPoUtil.getUrlVar('action')=='comments'&&this.is_my_profile)
{$('snncommopt_pending').style.display='inline';}
if(HuffPoUtil.getUrlVar('action')=='fans'&&this.is_my_profile)
{var manage_ignored_el=$("manage_rel_link");manage_ignored_el.innerHTML="<a href=\"javascript:void(0);\" onclick=\"SNPprofile.showIgnoredUsers();\">Manage the users you have ignored&nbsp;&raquo</a>";this.loadFriendsFans();}
YAHOO.util.Event.onDOMReady(function(){if($('snp_fans_friends')){SidebarRelations.loadRightRailFanbase();}});}
else
{$('report_abusive').style.display='block';$('snn_become_fan').style.display='block';if(HuffPoUtil.getUrlVar('action')=='fans')
{Dom.setStyle("social_fan_base","display","block");this.initProfileFriendsPager();}
YAHOO.util.Event.onDOMReady(function(){if($('snp_fans_friends'))
Dom.setStyle("snp_fans_friends","display","block");});}
this.update_facebook_connect_button();if(current_hpusername)
{YAHOO.util.Event.onDOMReady(function(){FriendsBanner.load();});}},initProfileFriendsPager:function(config)
{YAHOO.util.Event.onDOMReady(function()
{if(config){var page_config=config;}
else{var page_el=$('profile_page_config');if(page_el&&page_el.innerHTML!="")
var page_config=JSON.parse(page_el.innerHTML);}
page_config.sort=HuffPoUtil.getUrlVar('fSort');FriendsPagination.init(page_config);});return;},loadFriendsFans:function()
{var el=$('social_fan_base');el.innerHTML="<div style='padding:80px 0; font-size:20px; color:#333;'><div style='text-align:center; padding:10px 0;'> Loading fan base... </div><div class='center'><img src='/images/spinner.gif' /></div></div>";Dom.setStyle(el,"display","block");var callback={success:function(o){SNPprofile.loadFriendsFansSuccess(o,el);},failure:function()
{HPError.e();return;}};var url='/users/get_current_user_fan_base.php?user_id='+HPUser.user_id();if(HuffPoUtil.getUrlVar('fSort'))
url+='&fsort='+HuffPoUtil.getUrlVar('fSort');url+="&r="+new Date().getTime();YAHOO.util.Connect.asyncRequest('GET',url,callback);return;},loadFriendsFansSuccess:function(o,el)
{var resp=o.responseText;if(resp!='')
{var response_data=JSON.parse(resp);if(response_data.status=='success')
{el.innerHTML=response_data.html;var page_config=JSON.parse(response_data.page_config);page_config.attach_fan_hover_listeners=true;page_config.on_my_profile=true;SNPprofile.initProfileFriendsPager(page_config);setTimeout(function(){FriendsManager.holders.friendshipControls={};if(response_data.fan_ids!="")
{var fan_id_obj=JSON.parse(response_data.fan_ids);var fan_list_obj=JSON.parse(response_data.fan_list);if(fan_id_obj){for(var i=0;i<fan_id_obj.length;i++)
{var fan_id=fan_id_obj[i];FriendsManager.attachControlListeners(fan_id_obj[i],fan_list_obj[fan_id]);}}}},2000);}
else
{switch(response_data.error)
{case"invalid_user":var msg="Not logged in or this is not your profile";break;case"invalid":var msg="Invalid user";break;default:var msg="An error occurred.Please check back after some time";break;}
el.innerHTML="<div class=\"error_friends\">"+msg+"</div>";}}
else
el.innerHTML="<div class=\"error_friends\">An error occurred.Please check back after some time</div>";return;},showIgnoredUsers:function()
{var el=$('ignored_user_div');var manage_ignored_el=$("manage_rel_link");var uid=HPUser.user_id();if(uid)
{var callback={success:function(o)
{var response_obj=eval(" ( "+o.responseText+" ) ");if(response_obj.error)
{switch(response_obj.error)
{case"invalid":el.innerHTML="<div class='error_msg'>Invalid</div>";break;case"invalid_profile":el.innerHTML="<div class='error_msg'>Not logged in OR Not your profile</div>";break;default:el.innerHTML="<div class='error_msg'>An unknown error occurred...please check later on</div>";break;}}
else
{el.innerHTML=response_obj.response;manage_ignored_el.innerHTML="";}
return;},failure:function()
{HPError.e();return;}};el.innerHTML="<div class='loading_ignored center'>Loading ignored users...</div><div class='center'><img src='/images/spinner.gif' /></div>";YAHOO.util.Connect.asyncRequest('GET','/users/get_ignored_users.php?user_id='+uid+"&r="+new Date().getTime(),callback);}
return;},show_profile_owner_options:function()
{if(HPUser.is_logged_in()&&this.is_my_profile)
{if(HuffPrefs.get('read_tracking'))
{$('profile_snn_stealth_status').style.backgroundPosition='-70px'+' '+0;SNPModule.stealth.close();}
else
{HuffPoUtil.show('snp_stealth_bubble');$('profile_snn_stealth_status').style.backgroundPosition=0+' '+0;if(E.onDOMReady)
{if(!Y.util.Event.isIE)
{SNPModule.animatePage(1,'snp_stealth_bubble',null,1.3);}
setTimeout(function(){SNPModule.stealth.close()},12000);}
else
{HuffPoUtil.onPageReady(function()
{if(!Y.util.Event.isIE){SNPModule.animatePage(1,'snp_stealth_bubble',null,1.3);}
setTimeout(function(){SNPModule.stealth.close()},12000);});}}
if($('top-links-container'))$('top-links-container').style.display='block';if($('profile_stealth_main'))$('profile_stealth_main').style.display='block';if($('badges_participate_switcher'))Dom.removeClass('badges_participate_switcher','display_none');YAHOO.util.Event.onAvailable("snn-header-actions",function()
{UserLevels.Agreement.activate({slider:true,checkbox:false});});}},stealth_mode:function()
{var current_stealth=!!!HuffPrefs.get('read_tracking');var url='/users/social_news_project/SNPactions.php?do=change_stealth&value='+(current_stealth?'0':'1');YAHOO.util.Connect.asyncRequest('GET',url,{success:SNPprofile.stealth_mode_change_success,failure:SNPprofile.stealth_mode_change_failure,cache:false});},stealth_mode_change_success:function(o)
{if(HuffPoUtil.trim(o.responseText)=='ok')
{if(null==$('stealth_holder'))
{holder=document.createElement('div');holder.id='stealth_holder';holder.style.display='none';document.body.appendChild(holder);}
if(HuffPrefs.get('read_tracking'))
{var animation=new Y.util.Anim(holder,{width:{to:70}},.7,YAHOO.util.Easing.bounceOut);animation.onTween.subscribe(function(){$('profile_snn_stealth_status').style.backgroundPosition='-'+$(holder).style.width+' '+0;},animation,true);animation.animate();SNPModule.stealth.close()}
else
{var animation=new Y.util.Anim(holder,{width:{from:70,to:0}},.7,YAHOO.util.Easing.bounceOut);animation.onTween.subscribe(function(){var prefix=(0!=$(holder).style.width)?'-':'';$('profile_snn_stealth_status').style.backgroundPosition=prefix+$(holder).style.width+' '+0;},animation,true);animation.animate();if(!Y.util.Event.isIE)
{SNPModule.animatePage(1,'snp_stealth_bubble',null,1.3);}
HuffPoUtil.show('snp_stealth_bubble');setTimeout(function(){SNPModule.stealth.close()},10000);}}
else
{HPError.e();}
if(SNPModule.animation&&0)
{SNPModule.animation.stop();}},stealth_mode_change_failure:function(o)
{HPError.e();},update_facebook_connect_button:function(){if(HPUser.is_logged_in()&&$('header_connect_button'))
{$('header_connect_button').style.display='none';$('social_news_page').style.height='60px';}}};var Partners={limit:0,id:2,scroll_timeout:"",displacement:0,start_displacement:0,step:"",next:function()
{if(this.id==this.limit)
{return false;this.id=0;}
else
{$('prev_snn_quotes').src="/images/social-profile/join/icon-prev-hover.png";this.id++;}
if(0!=this.id)
{$("snn_show_img"+this.id).src=$("snn_show_img"+this.id).longDesc;if(!Y.util.Event.isIE)
{SNPModule.animatePage(1,'snn_partner'+this.id,null,1.3);}}
this.step='next';this.start_displacement-=293;this.scrolling();if(this.id==this.limit)
{$('next_snn_quotes').src="/images/social-profile/join/icon-next.png";}},prev:function()
{if(this.id==2)
{$('prev_snn_quotes').src="/images/social-profile/join/icon-prev.png";return false;this.id=this.limit;}
else
{$('next_snn_quotes').src="/images/social-profile/join/icon-next-hover.png";this.id--;}
if(!Y.util.Event.isIE)
{var animate_id=this.id-2;SNPModule.animatePage(1,'snn_partner'+animate_id,null,0.7);}
this.step='prev';this.start_displacement+=293;this.scrolling();if(2==this.id)
{$('prev_snn_quotes').src="/images/social-profile/join/icon-prev.png";}},scrolling:function()
{if(this.step=='next')
{this.displacement-=7;value=this.displacement+'px';if(parseInt(this.displacement)>=this.start_displacement)
{var elements=YAHOO.util.Dom.getElementsByClassName('about_snn_partner_inner','div');var count_elements=elements.length;for(var i=0;i<count_elements;i++)
{elements[i].style.left=value;}
this.scroll_timeout=setTimeout("Partners.scrolling()",1);}
else
{var elements=YAHOO.util.Dom.getElementsByClassName('about_snn_partner_inner','div');var count_elements=elements.length;for(var i=0;i<count_elements;i++)
{elements[i].style.left=this.start_displacement+'px';}}}
else
{this.displacement+=7;value=this.displacement+'px';if(parseInt(this.displacement)<=this.start_displacement)
{var elements=YAHOO.util.Dom.getElementsByClassName('about_snn_partner_inner','div');var count_elements=elements.length;for(var i=0;i<count_elements;i++)
{elements[i].style.left=value;}
this.scroll_timeout=setTimeout("Partners.scrolling()",1);}
else
{var elements=YAHOO.util.Dom.getElementsByClassName('about_snn_partner_inner','div');var count_elements=elements.length;for(var i=0;i<count_elements;i++)
{elements[i].style.left=this.start_displacement+'px';}}}},init:function()
{this.limit=$('partners_count_itens').innerHTML;}};
var SNPModule={current_page:0,max_page:-1,pages:Array(),snn_mpr_pages:Array(),comment_pages:Array(),snp_mp_bn_pages:Array(),notSNN_mp_pages:Array(),notSNN_mbc_pages:Array(),notSNN_mbf_pages:Array(),notSNN_mbt_pages:Array(),notSNN_mpr_pages:Array(),notSNN_dm_pages:Array(),entry_inside_comment_pages:Array(),animation:null,url_user_id:'',current_notSNN_vertical:'',current_notSNN_mp_page:0,max_notSNN_mp_page:-1,current_notSNN_mbc_page:0,max_notSNN_mbc_page:-1,current_notSNN_mbf_page:0,max_notSNN_mbf_page:-1,current_notSNN_mbt_page:0,max_notSNN_mbt_page:-1,current_notSNN_dm_page:0,max_notSNN_dm_page:-1,current_notSNN_mpr_page:0,max_notSNN_mpr_page:-1,current_mp_page:0,max_mp_page:-1,current_mp_bn_page:0,max_mp_bn_page:-1,current_mp_hp_page:0,max_mp_hp_page:-1,current_mbc_page:0,max_mbc_page:-1,current_mbf_page:0,max_mbf_page:-1,current_mbt_page:0,max_mbt_page:-1,current_mpr_page:0,max_mpr_page:-1,current_dm_hp_page:0,max_dm_hp_page:-1,current_act_page:0,max_act_page:-1,current_comment_page:0,max_comment_page:-1,current_twitter_page:0,max_twitter_page:-1,entry_inside_current_comment_page:1,entry_inside_max_comment_page:-1,made_init:0,isFormLoaded:false,isFrontPage:false,mpTimeout:null,ms:24000,twitter_timeline_type:'home',loop_page:false,tweetout_module_div:'hidden_twitter_module',skin:null,hide_hp_module:true,current_follower_page:0,max_follower_page:-1,load:function(trends_mode)
{if(!HPConfig.no_social_module&&SNProject.snp_cookie==1&&SNProject.user_logged_in==1&&document.domain!='preview.huffingtonpost.com')
{if((document.domain=="www.huffingtonpost.com"||document.domain=="www.beta.huffingtonpost.com")&&(document.location.pathname==""||document.location.pathname=="/"))
{this.isFrontPage=true;}
var get_data='';var entry_id=0;get_data='?v='+HPConfig.current_vertical_name;var path=window.location.pathname.split('/');if(typeof path[1]!=="undefined"&&path[1]=='big-news'){get_data+='&page_type=big_news_list';}else if(typeof path[1]!=="undefined"&&path[1]=='social'){get_data+='&page_type=profile_page';}else if(typeof path[1]!=="undefined"&&path[1]=='theblog'){get_data+='&page_type=theblog';}
if(false!=(entry_id=HuffPoUtil.GetEntryID(location.href)))
{get_data+=(''!=get_data)?'&entry_id='+entry_id:'?entry_id='+entry_id;}
if(trends_mode)get_data+='&hot_trends_mode='+trends_mode;if(HuffPoUtil.getUrlVar("level"))get_data+='&level=1';if(HPAds.snpmodule_skin=='motorola')
{get_data+='&skin=moto';}
C.asyncRequest('GET','/users/social_news_project/snp_module.php'+get_data,{success:function(o){if(o.responseText!=''){var display_module_arr=o.responseText.split('::module_to_disp::');var display_module=display_module_arr[1];var response=o.responseText.replace('::module_to_disp::'+display_module,'');var temp=new Array();temp=response.split('dlHkvmjso1egjcotPmug0');if(display_module=="snn")
{if("undefined"!=typeof(temp[0]))
{var ffu=Dom.get('facebook_friends_unit_wrapper');if(ffu)
ffu.innerHTML=temp[0];}
if("undefined"!=typeof(temp[1]))
{HPUtil.loadAndRun('/assets/js.php?f=yui_2.7.0/build/tabview/tabview-min.js',function(){SNPModule.entryInside.loading(temp[1])},null,this);}}
else if(display_module=="twitter_popular")
{SNPModule.hide_hp_module=false;SNPModule.tweetout_module_div="hidden_twitter_module_frontpage";}
else if(display_module=="popular")
SNPModule.hide_hp_module=false;SNPModule.made_init=false;SNPModule.init();if(SNPModule.skin)
{setTimeout("SNPModule.show_skinned_module()",1000);setTimeout("HPAds.ad_reload('snn_234x60_req','ad_snn_234x60_req')",3000);return;}
setTimeout("HPAds.ad_reload('snn_234x60_req','ad_snn_234x60_req')",2000);}},failure:function(o){if($('hidden_snp_body'))
{HuffPoUtil.hide('hidden_snp_body');HPError.e();}},timeout:20000});}
else
{this.trackLoaded();}
if(HuffCookies.getSNPstatus()==1)
{HuffPoUtil.hide('snn_fb_promo_box');}
if(HPConfig.current_vertical_name=='entertainment'){this.autoFeedItems('not_signed_mp_','#frontpage_module_header .snp_module_pagination');}},skin_click_handler_flag:false,skin_click_handler:function(check_flag)
{if(check_flag&&this.skin_click_handler_flag)
{this.skin_click_handler_flag=false;return;}
if((typeof(HPAds.snpmodule_skinhref)!="undefined")&&(HPAds.snpmodule_skinhref!=''))
location.href=HPAds.snpmodule_skinhref;},show_skinned_module:function()
{var skin=this.skin;var is_bpage=HuffPoUtil.GetEntryID(location.href);this.animatePage(0,'facebook_friends_unit_wrapper');var module_body_el=Dom.get('snp_friends_module');var module_logo_top=document.createElement('div');var module_top_wrap=document.createElement('div');var module_body_wrap=document.createElement('div');var module_bottom_wrap=document.createElement('div');var head_stealth_mode_sw=document.createElement('div');var mp_copy=document.createElement('div');mp_copy.id='mp_module_copy_holder';Dom.addClass(mp_copy,'mp_module_copy_holder');Dom.addClass(module_logo_top,skin+'-logo-top');Dom.addClass(module_top_wrap,skin+'-top-wrap');Dom.addClass(module_body_wrap,skin+'-body-wrap');Dom.addClass(module_bottom_wrap,skin+'-bottom-wrap');Dom.addClass(module_body_el,skin);var ffu=Dom.get('facebook_friends_unit_wrapper');ffu.appendChild(mp_copy);ffu.appendChild(module_logo_top);ffu.appendChild(module_top_wrap);ffu.appendChild(module_body_wrap);ffu.appendChild(module_bottom_wrap);module_body_wrap.appendChild(module_body_el);module_body_el.insertBefore(head_stealth_mode_sw,module_body_el.firstChild);head_stealth_mode_sw.id=skin+'_stealth_mode_switcher';Dom.addClass(head_stealth_mode_sw,'border_bottom_ccc');module_logo_top.innerHTML='&nbsp;';module_top_wrap.innerHTML='&nbsp;';module_bottom_wrap.innerHTML='&nbsp;';E.on(module_top_wrap,"click",function(){this.skin_click_handler();},null,this);E.on(module_bottom_wrap,"click",function(){this.skin_click_handler();},null,this);E.on(module_body_wrap,"click",function(e,param){this.skin_click_handler(param);},true,this);E.on(module_body_el,"click",function(){this.skin_click_handler_flag=true;},null,this);HPUtil.hide('snn_frontpage_widget_make_home');HPUtil.hide('snp_title');HPUtil.hide('snp_module_header');HPUtil.hide('snp_huffpo_bloggers_module_here');HPUtil.hide('snn_frontpage_widget_sub_footer');mp_copy.appendChild(Dom.get('huffpo_mp_module_here'));if(is_bpage)
{this.animatePage(0,'all_frontpage_widgets');HPUtil.show('all_frontpage_widgets');var hide_it=Dom.getElementsByClassName('unique_identifier_for_mp');if(hide_it[0])
hide_it[0].style.display='none';this.animatePage(1,'all_frontpage_widgets');}
this.animatePage(1,'facebook_friends_unit_wrapper');this.skinned_module_stealth.init();},skinned_module_stealth:{id:null,init:function()
{var skin=SNPModule.skin;if(Dom.get(skin+'_stealth_mode_switcher'))
{this.id=skin+'_stealth_mode_switcher';if(HuffPrefs.get('read_tracking')===true)
{Dom.get(this.id).innerHTML='<div class="moto-head-stealth-off" onclick="SNPModule.stealth.update(); return false;">Stealth Mode (Off)</div>';}
else
{Dom.get(this.id).innerHTML='<div class="moto-head-stealth-on" onclick="SNPModule.stealth.update(); return false;">Stealth Mode (On)</div>';}}},onUpdated:function()
{if(Dom.get(this.id))
{if('on'==SNPModule.stealth.current_status)
{Dom.get(this.id).innerHTML='<div class="moto-head-stealth-off" onclick="SNPModule.stealth.update(); return false;">Stealth Mode (Off)</div>';}
else
{Dom.get(this.id).innerHTML='<div class="moto-head-stealth-on" onclick="SNPModule.stealth.update(); return false;">Stealth Mode (On)</div>';}}}},show_skinned_twitter_module:function()
{if(Dom.get('main_snn_twitter_module'))
{anch_to_find=Dom.get('main_snn_twitter_module').getElementsByTagName('a');for(var j=0;j<anch_to_find.length;j++)
{if(Dom.hasClass(anch_to_find[j],'twitter_snn_name'))
{var tname=anch_to_find[j].innerHTML;if(tname.length>18)anch_to_find[j].innerHTML=tname.slice(0,17)+'&hellip;';break;}}}},init:function()
{if(this.made_init)return false;if(HPAds.snpmodule_skin=='motorola'&&Dom.get('snp_module_pages'))
{this.skin='moto';}
if(!this.url_user_id&&$('snp_module_user_id'))
{this.url_user_id=$('snp_module_user_id').innerHTML;}
HpMessage.Init();this.lightbox.init();this.stealth.init();if(this.max_comment_page<0)
{if($('snp_comment_max_page_counter'))
{this.max_comment_page=parseInt($('snp_comment_max_page_counter').innerHTML)-1;for(var i=0;i<=this.max_comment_page;i++)
{this.comment_pages[i]=$('snp_module_comment_activity_page_'+i).innerHTML;}}
else
{this.max_comment_page=0;}}
if(this.max_page<0)
{if($('snp_max_page_counter'))
{this.max_page=parseInt($('snp_max_page_counter').innerHTML)-1;for(var i=0;i<=this.max_page;i++)
{this.pages[i]=$('snp_module_page_ids_'+i).innerHTML;}}
else
{this.max_page=0;}}
if(this.max_mp_page<0)
{if($('snp_mp_max_page_counter'))
{this.max_mp_page=parseInt($('snp_mp_max_page_counter').innerHTML)-1;}
else
{this.max_mp_page=0;}}
if(this.max_mp_bn_page<0)
{if($('snp_mp_bn_max_page_counter'))
{this.max_mp_bn_page=parseInt($('snp_mp_bn_max_page_counter').innerHTML)-1;for(var i=0;i<=this.max_mp_bn_page;i++)
{this.snp_mp_bn_pages[i]=$('snp_mp_bn_page_ids_'+i).innerHTML;}}
else
{this.max_mp_bn_page=0;}}
if(this.max_mp_hp_page<0)
{if($('snp_mp_hp_max_page_counter'))
{this.max_mp_hp_page=parseInt($('snp_mp_hp_max_page_counter').innerHTML)-1;}
else
{this.max_mp_hp_page=0;}}
if(this.max_follower_page<0)
{if($('snp_follower_max_page_counter'))
{this.max_follower_page=parseInt($('snp_follower_max_page_counter').innerHTML)-1;}
else
{this.max_follower_page=0;}}
if(this.max_dm_hp_page<0)
{if($('snp_dm_hp_max_page_counter'))
{this.max_dm_hp_page=parseInt($('snp_dm_hp_max_page_counter').innerHTML)-1;}
else
{this.max_dm_hp_page=0;}}
if(this.max_mbc_page<0)
{if($('snp_mbc_max_page_counter'))
{this.max_mbc_page=parseInt($('snp_mbc_max_page_counter').innerHTML)-1;}
else
{this.max_mbc_page=0;}}
if(this.max_mbf_page<0)
{if($('snp_mbf_max_page_counter'))
{this.max_mbf_page=parseInt($('snp_mbf_max_page_counter').innerHTML)-1;}
else
{this.max_mbf_page=0;}}
if(this.max_mbt_page<0)
{if($('snp_mbt_max_page_counter'))
{this.max_mbt_page=parseInt($('snp_mbt_max_page_counter').innerHTML)-1;}
else
{this.max_mbt_page=0;}}
if(this.max_mpr_page<0)
{if($('snp_mpr_max_page_counter'))
{this.max_mpr_page=parseInt($('snp_mpr_max_page_counter').innerHTML)-1;for(var i=0;i<=this.max_mpr_page;i++)
{var elm=$('snp_mpr_module_page_ids_'+i);if(elm)this.snn_mpr_pages[i]=elm.innerHTML;}}
else
{this.max_mpr_page=0;}}
if(this.max_act_page<0)
{if($('snp_act_max_page_counter'))
{this.max_act_page=parseInt($('snp_act_max_page_counter').innerHTML)-1;}
else
{this.max_act_page=0;}}
var entry_id=HuffPoUtil.GetEntryID(window.location.href);if(SNProject.read_tracking_enabled==1&&entry_id&&!$('snp_activity_read_entry_'+entry_id)&&$('snp_current_reading_entry_title'))
{this.current_reading_entry_id=entry_id;$('snp_current_reading_entry_title').innerHTML=document.title;$('snp_current_reading_entry').style.display='block';}
this.made_init=1;this.hideHpModules();if($('most_popular_ad_stub')&&HuffPoUtil.trim($('most_popular_ad_stub').innerHTML)=='')
{$('most_popular_ad_stub').innerHTML='<iframe src="http://ad.doubleclick.net/adi/huffpost.socialnews;tile=1;sz=234x60;ord='+HuffPoUtil.WEDGJE.ord()+'?" width="234" height="60" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" name="social_news_234x60" id="social_news_234x60"></iframe>';}
this.networkToLink();if(HuffPrefs.get('twitter')&&!HPConfig.no_twitter)
{SNPModule.twitterModule(function()
{if(SNPModule.max_twitter_page<0)
{if($('snp_twitter_max_page_counter'))
{SNPModule.max_twitter_page=parseInt($('snp_twitter_max_page_counter').innerHTML)-1;}
else
{SNPModule.max_twitter_page=0;}}
E.on('tweet_status','keyup',HPUtil.enforceTextAreaLimit,{chars:140});E.on('tweet_status','change',HPUtil.enforceTextAreaLimit,{chars:140});});}
this.trackLoaded();if(HuffPoUtil.getUrlVar("level")||HPConfig.user_show_levels_and_badges_disabled==false){var my_level=$("snn_module_my_level");if(my_level){my_level=my_level.innerHTML;Y.util.Event.onDOMReady(SNPModule.show_user_level_box);}}
if($('snp_mp_page_0'))
HuffPoUtil.ImageLoader.foldCheck("snp_mp_page_0");if($('snp_mp_hp_page_0'))
HuffPoUtil.ImageLoader.foldCheck("snp_mp_hp_page_0");if($('snp_page_0'))
HuffPoUtil.ImageLoader.foldCheck("snp_page_0");if($('snp_mpr_page_0'))
HuffPoUtil.ImageLoader.foldCheck("snp_mpr_page_0");if(typeof balanceColumns=='function')
balanceColumns();},trackEvent:function(action,label)
{var category=this.made_init?'Sidebar - Social':'Sidebar - non-Social';HPTrack.trackEvent(category,action,label);},trackLoaded:function()
{if(typeof HPTrack!='undefined')
HPTrack.modules.push(this.made_init?'sb-social':'sb-mostpop');HPTrack.trackModules();E.on('snp_friends_module','click',this._eventHandler,this,true);},networkToLink:function()
{if(HuffPrefs.get('facebook')===false)
{if($('sidebar_service_connect'))
{$('sidebar_service_connect').innerHTML="<div style=\"text-align:center\"><a href=\"/social/join.html?autojoin=1\" onclick=\"HPFB.login(QuickLogin.FacebookLoginCallback);return false;\" target=\"_blank\"><img border=\"0\" src=\"/images/fb-large.gif\" alt=\"Connect with Facebook\" style=\"padding: 16px;\"/></a></div>";}}
else if(HuffPrefs.get('twitter')===false)
{if($('sidebar_service_connect'))
{$('sidebar_service_connect').innerHTML="<div style=\"text-align:center\"><a href=\"javascript:void(0);\" onclick=\"QuickLogin.TwitterOauthSNNLinking(); return false;\" target=\"_blank\"><img border=\"0\" src=\"/images/Sign-in-with-Twitter-darker.png\" alt=\"Connect with Twitter\" style=\"padding: 16px;\"/></a></div>";}}
else
if($('sidebar_service_connect'))$('sidebar_service_connect').style.display="none";return;},not_snn_init:function()
{if(this.max_notSNN_mp_page<0)
{if($('snp_not_signed_mp_max_page_counter'))
{this.max_notSNN_mp_page=parseInt($('snp_not_signed_mp_max_page_counter').innerHTML)-1;for(var i=0;i<=this.max_notSNN_mp_page;i++)
{this.notSNN_mp_pages[i]=$('snp_not_signed_mp_page_ids_'+i).innerHTML;}}
else
{this.max_notSNN_mp_page=0;}}
if(this.max_notSNN_mbc_page<0)
{if($('snp_not_signed_mbc_max_page_counter'))
{this.max_notSNN_mbc_page=parseInt($('snp_not_signed_mbc_max_page_counter').innerHTML)-1;for(var i=0;i<=this.max_notSNN_mbc_page;i++)
{this.notSNN_mbc_pages[i]=$('snp_not_signed_mbc_page_ids_'+i).innerHTML;}}
else
{this.max_notSNN_mbc_page=0;}}
if(this.max_notSNN_mbf_page<0)
{if($('snp_not_signed_mbf_max_page_counter'))
{this.max_notSNN_mbf_page=parseInt($('snp_not_signed_mbf_max_page_counter').innerHTML)-1;for(var i=0;i<=this.max_notSNN_mbf_page;i++)
{this.notSNN_mbf_pages[i]=$('snp_not_signed_mbf_page_ids_'+i).innerHTML;}}
else
{this.max_notSNN_mbf_page=0;}}
if(this.max_notSNN_mbt_page<0)
{if($('snp_not_signed_mbt_max_page_counter'))
{this.max_notSNN_mbt_page=parseInt($('snp_not_signed_mbt_max_page_counter').innerHTML)-1;for(var i=0;i<=this.max_notSNN_mbt_page;i++)
{this.notSNN_mbt_pages[i]=$('snp_not_signed_mbt_page_ids_'+i).innerHTML;}}
else
{this.max_notSNN_mbt_page=0;}}
if(this.max_notSNN_mpr_page<0)
{if($('snp_not_signed_mpr_max_page_counter'))
{this.max_notSNN_mpr_page=parseInt($('snp_not_signed_mpr_max_page_counter').innerHTML)-1;for(var i=0;i<=this.max_notSNN_mpr_page;i++)
{this.notSNN_mpr_pages[i]=$('snp_not_signed_mpr_page_ids_'+i).innerHTML;}}
else
{this.max_notSNN_mpr_page=0;}}
if(this.max_notSNN_dm_page<0)
{if($('snp_not_signed_dm_max_page_counter'))
{this.max_notSNN_dm_page=parseInt($('snp_not_signed_dm_max_page_counter').innerHTML)-1;for(var i=0;i<=this.max_notSNN_dmr_page;i++)
{this.notSNN_mpr_pages[i]=$('snp_not_signed_dm_page_ids_'+i).innerHTML;}}
else
{this.max_notSNN_dm_page=0;}}},hideHpModules:function()
{if(this.hide_hp_module)
HuffPoUtil.hide('all_frontpage_widgets');return;},showHpModules:function()
{HuffPoUtil.show('all_frontpage_widgets');},refreshPagination:function(page,type)
{if(!type)type='';if($('snp_'+type+'page_counter'))
{$('snp_'+type+'page_counter').innerHTML=page+1;}
switch(type)
{case'':var max_page=this.max_page;var current_page=this.current_page;this.current_page=page;break;case'mp_':var max_page=this.max_mp_page;var current_page=this.current_mp_page;this.current_mp_page=page;break;case'mp_bn_':var max_page=this.max_mp_bn_page;var current_page=this.current_mp_bn_page;this.current_mp_bn_page=page;break;case'mbc_':var max_page=this.max_mbc_page;var current_page=this.current_mbc_page;this.current_mbc_page=page;break;case'mbf_':var max_page=this.max_mbf_page;var current_page=this.current_mbf_page;this.current_mbf_page=page;break;case'mbt_':var max_page=this.max_mbt_page;var current_page=this.current_mbt_page;this.current_mbt_page=page;break;case'mpr_':var max_page=this.max_mpr_page;var current_page=this.current_mpr_page;this.current_mpr_page=page;break;case'mp_hp_':var max_page=this.max_mp_hp_page;var current_page=this.current_mp_hp_page;this.current_mp_hp_page=page;break;case'not_signed_mp_':var max_page=this.max_notSNN_mp_page;var current_page=this.current_notSNN_mp_page;this.current_notSNN_mp_page=page;break;case'not_signed_mbc_':var max_page=this.max_notSNN_mbc_page;var current_page=this.current_notSNN_mbc_page;this.current_notSNN_mbc_page=page;break;case'not_signed_mbf_':var max_page=this.max_notSNN_mbf_page;var current_page=this.current_notSNN_mbf_page;this.current_notSNN_mbf_page=page;break;case'not_signed_mbt_':var max_page=this.max_notSNN_mbt_page;var current_page=this.current_notSNN_mbt_page;this.current_notSNN_mbt_page=page;break;case'not_signed_dm_':var max_page=this.max_notSNN_dm_page;var current_page=this.current_notSNN_dm_page;this.current_notSNN_dm_page=page;break;case'not_signed_mpr_':var max_page=this.max_notSNN_mpr_page;var current_page=this.current_notSNN_mpr_page;this.current_notSNN_mpr_page=page;break;case'dm_hp_':var max_page=this.max_dm_hp_page;var current_page=this.current_dm_hp_page;this.current_dm_hp_page=page;break;case'act_':var max_page=this.max_act_page;var current_page=this.current_act_page;this.current_act_page=page;break;case'comment_':var max_page=this.max_comment_page;var current_page=this.current_comment_page;this.current_comment_page=page;break;case'twitter_friends_':var max_page=this.max_twitter_page;var current_page=this.current_twitter_page;this.current_twitter_page=page;break;case'follower_':var max_page=this.max_follower_page;var current_page=this.current_follower_page;this.current_follower_page=page;break;}
if(type=='mp_')return;if(type=='not_signed_mp_'||type=='not_signed_mpr_'||type=='not_signed_dm_'||type=='not_signed_mbc_'||type=='not_signed_mbf_'||type=='not_signed_mbt_')return;if(type=='twitter_friends_')
{if(max_page>0&&0)
{if(current_page==0)
{Dom.removeClass('snp_'+type+'left_arrow','tmod_left_arrow_disabled');$('snp_'+type+'left_arrow').style.visibility="visible";}
if(page==0)
{if(!this.loop_page)
{Dom.addClass('snp_'+type+'left_arrow','tmod_left_arrow_disabled');$('snp_'+type+'left_arrow').style.visibility="hidden";}}
if(current_page==max_page)
{Dom.removeClass('snp_'+type+'act_right_arrow','tmod_right_arrow_disabled');}
if(page==max_page)
{}}
return;}
if(max_page>0&&0)
{if(current_page==0)
{Dom.removeClass('snp_'+type+'left_arrow','left_arrow_disabled');}
if(page==0)
{Dom.addClass('snp_'+type+'left_arrow','left_arrow_disabled');}
if(current_page==max_page)
{Dom.removeClass('snp_'+type+'right_arrow','right_arrow_disabled');}
if(page==max_page)
{Dom.addClass('snp_'+type+'right_arrow','right_arrow_disabled');}}},load_module_page:function(page,type,callback){if(!$('snp_'+type+'page_'+page)){var url_to_call=SNPModule.get_url_to_call(page,type);if(typeof(url_to_call)!="string"){return url_to_call;}
C.asyncRequest('GET',url_to_call,{success:function(o)
{if(o.responseText!='')
{if(!$('snp_'+type+'page_'+page)){var divElement=document.createElement('div');divElement.innerHTML=o.responseText;for(var divChildIdx=0;divChildIdx<divElement.childNodes.length;divChildIdx++){$('snp_'+type+'module_all_pages_here').appendChild(divElement.childNodes[divChildIdx]);}
HuffPoUtil.hide('snp_'+type+'page_'+page);if(typeof(callback)=="function"){callback();}}}},timeout:5000});}},autoFeedItems:function(type,page_navigator){var mp_element=$('huffpo_mp_module_here');if(mp_element==null){YAHOO.util.Event.onDOMReady(function(){SNPModule.autoFeedItems(type,page_navigator);});return;}
SNPModule.not_snn_init();var max_feed_page=SNPModule.get_max_page(type);var current_feed_page=SNPModule.get_current_page(-1,type);var first_feed_page=current_feed_page;var FeededItemsQueue=[];if(current_feed_page<max_feed_page){var target_page=$('snp_'+type+'page_'+first_feed_page);if(target_page){if(page_navigator){var page_nav=YAHOO.util.Selector.query(page_navigator);YAHOO.util.Dom.setStyle(page_nav,"display","none");}
var pages_container=target_page.parentNode;SNPModule.lock_autopfeeding=0;YAHOO.util.Event.addListener(pages_container,'mouseover',function(){SNPModule.lock_autopfeeding++;});YAHOO.util.Event.addListener(pages_container,'mouseout',function(){SNPModule.lock_autopfeeding--;});var scroller=document.createElement("div");scroller.id=type+"scroller";YAHOO.util.Dom.setStyle(pages_container.parentNode,"position","relative");pages_container.parentNode.appendChild(scroller);YAHOO.util.Dom.setStyle(scroller,"position","absolute");YAHOO.util.Dom.setStyle(scroller,"top","0");YAHOO.util.Dom.setStyle(scroller,"right","0");var target_page_client_height=target_page.clientHeight>0?target_page.clientHeight:700;YAHOO.util.Dom.setStyle(target_page,"height",target_page_client_height+"px");YAHOO.util.Dom.setStyle(target_page,"width","110%");YAHOO.util.Dom.setStyle(target_page,"overflow-y","scroll");YAHOO.util.Dom.setStyle(pages_container,"overflow-x","hidden");var hpscrollbar=new HPScrollbar(target_page,scroller);var next_runtime=0;var interval_run=3000;setTimeout(function(){var auto_paging_interval=setInterval(function(){if(SNPModule.lock_autopfeeding<=0&&(new Date()).getTime()>=next_runtime){SNPModule.lock_autopfeeding++;if(FeededItemsQueue.length==0){var page=current_feed_page+1;if(page<=max_feed_page){SNPModule.load_module_page(page,type,function(){if($('snp_'+type+'page_'+page)){FeededItemsQueue=YAHOO.util.Dom.getChildren('snp_'+type+'page_'+page);for(var qidx=0;qidx<FeededItemsQueue.length;qidx++){$('snp_'+type+'page_'+page).removeChild(FeededItemsQueue[qidx]);}
current_feed_page++;SNPModule.lock_autopfeeding--;}});}else{clearInterval(auto_paging_interval);SNPModule.lock_autopfeeding--;}}else{var qItem;while((qItem=FeededItemsQueue.shift())&&YAHOO.util.Dom.hasClass(qItem,'clear')){};if(qItem){var target_page=$('snp_'+type+'page_'+first_feed_page);target_page.appendChild(qItem);hpscrollbar.update(function(){var targetChildren=YAHOO.util.Dom.getChildren(target_page);var scrollTop=target_page.scrollTop;if(!scrollTop){scrollTop=0;}
var hasScroll=false;for(var qidx=1;qidx<targetChildren.length;qidx++){var temptScrollTop=targetChildren[qidx].offsetTop;if(temptScrollTop>scrollTop+20){hasScroll=true;var attributes={scroll:{to:[scrollTop,temptScrollTop]}};var anim_cnt=new YAHOO.util.Scroll(target_page,attributes,0.75);anim_cnt.onComplete.subscribe(function(){hpscrollbar.update(function(){next_runtime=(new Date()).getTime()+interval_run;SNPModule.lock_autopfeeding--;});});anim_cnt.animate();break;}}
if(!hasScroll){SNPModule.lock_autopfeeding--;}});HuffPoUtil.ImageLoader.foldCheck(qItem);}else{SNPModule.lock_autopfeeding--;}}}},interval_run);},5000);}}},get_url_to_call:function(page,type){var get_data='';if(''!=HuffPoUtil.trim(this.current_notSNN_vertical))
{get_data='&is_frontpage=1';}
switch(type)
{case'':return'/users/social_news_project/snp_module_page.php?page='+page+'&page_ids='+this.pages[page]+'&user_id='+this.url_user_id;break;case'mp_':return true;break;case'act_':return'/users/social_news_project/snp_module_page.php?type=act&page='+page+'&user_id='+this.url_user_id;break;case'comment_':return'/users/social_news_project/snp_module_page.php?type=comment&page='+page+'&page_ids='+this.comment_pages[page]+'&user_id='+this.url_user_id;break;case'mpr_':return'/widget/frontpage/frontpage_widgets_update.php?type=mpr&page='+page+'&entry_ids='+this.snn_mpr_pages[page]+'&status=snp'+get_data;break;case'entry_inside_comment_':return'/users/social_news_project/snp_module_page.php?type=entry_inside_comment&page='+page+'&page_ids='+this.entry_inside_comment_pages[page]+'&user_id='+this.url_user_id;break;case'mp_bn_':return'/widget/big_news_mp_update.php?type=mp&page='+page+'&entry_ids='+this.snp_mp_bn_pages[page]+get_data;break;case'not_signed_mp_':return'/widget/frontpage/frontpage_widgets_update.php?type=mp&page='+page+'&entry_ids='+this.notSNN_mp_pages[page]+get_data;break;case'not_signed_dm_':return'/widget/frontpage/frontpage_widgets_update.php?type=dm&page='+page+'&entry_ids='+this.notSNN_dm_pages[page]+get_data;break;case'not_signed_mpr_':return'/widget/frontpage/frontpage_widgets_update.php?type=mpr&page='+page+'&entry_ids='+this.notSNN_mpr_pages[page]+get_data;break;case'twitter_friends_':return'/users/social_news_project/twitter/snn_twitter_page.php?page='+page+"&type="+this.twitter_timeline_type;break;}},get_current_page:function(page,type){switch(type)
{case'':if(page==this.current_page)return false;return this.current_page;break;case'mp_':if(page==this.current_mp_page)return false;return this.current_mp_page;break;case'mbc_':if(page==this.current_mbc_page)return false;return this.current_mbc_page;break;case'mbf_':if(page==this.current_mbf_page)return false;return this.current_mbf_page;break;case'mbt_':if(page==this.current_mbt_page)return false;return this.current_mbt_page;break;case'mpr_':if(page==this.current_mpr_page)return false;return this.current_mpr_page;break;case'mp_bn_':if(page==this.current_mp_bn_page)return false;return this.current_mp_bn_page;break;case'mp_hp_':if(page==this.current_mp_hp_page)return false;return this.current_mp_hp_page;break;case'not_signed_mp_':if(page==this.current_notSNN_mp_page)return false;return this.current_notSNN_mp_page;break;case'not_signed_mbc_':if(page==this.current_notSNN_mbc_page)return false;return this.current_notSNN_mbc_page;break;case'not_signed_mbf_':if(page==this.current_notSNN_mbf_page)return false;return this.current_notSNN_mbf_page;break;case'not_signed_mbt_':if(page==this.current_notSNN_mbt_page)return false;return this.current_notSNN_mbt_page;break;case'not_signed_dm_':if(page==this.current_notSNN_dm_page)return false;return this.current_notSNN_dm_page;break;case'not_signed_mpr_':if(page==this.current_notSNN_mpr_page)return false;return this.current_notSNN_mpr_page;break;case'dm_hp_':if(page==this.current_dm_hp_page)return false;return this.current_dm_hp_page;break;case'act_':if(page==this.current_act_page)return false;return this.current_act_page;break;case'comment_':if(page==this.current_comment_page)return false;return this.current_comment_page;break;case'entry_inside_comment_':if(page==this.entry_inside_current_comment_page)return false;return this.entry_inside_current_comment_page;break;case'twitter_friends_':if(page==this.current_twitter_page)return false;return this.current_twitter_page;case'follower_':if(page==this.current_follower_page)return false;return this.current_follower_page;break;}},get_max_page:function(type){switch(type)
{case'':return this.max_page;break;case'mp_':return this.max_mp_page;break;case'mbc_':return this.max_mbc_page;break;case'mbf_':return this.max_mbf_page;break;case'mbt_':return this.max_mbt_page;break;case'mpr_':return this.max_mpr_page;break;case'mp_hp_':return this.max_mp_hp_page;break;case'not_signed_mp_':return this.max_notSNN_mp_page;break;case'not_signed_mbc_':return this.max_notSNN_mbc_page;break;case'not_signed_mbf_':return this.max_notSNN_mbf_page;break;case'not_signed_mbt_':return this.max_notSNN_mbt_page;break;case'not_signed_dm_':return this.max_notSNN_dm_page;break;case'not_signed_mpr_':return this.max_notSNN_mpr_page;break;case'dm_hp_':return this.max_dm_hp_page;break;case'act_':return this.max_act_page;break;case'comment_':return this.max_comment_page;break;case'entry_inside_comment_':return this.entry_inside_max_comment_page;break;case'twitter_friends_':return this.max_twitter_page;case'follower_':return this.max_follower_page;break;}},setPage:function(page,type)
{if(!type)type='';var current_page=this.get_current_page(page,type);if(current_page===false){return false;}
if(this.isLocked(type))return false;this.animatePage(0,'snp_'+type+'module_all_pages_here');if($('snp_'+type+'page_'+page))
{HuffPoUtil.hide('snp_'+type+'page_'+current_page);HuffPoUtil.show('snp_'+type+'page_'+page);this.refreshPagination(page,type);this.animatePage(1,'snp_'+type+'module_all_pages_here');if($('snp_'+type+'page_'+page))
HuffPoUtil.ImageLoader.foldCheck('snp_'+type+'page_'+page);}
else
{this.setLock(type);var url_to_call=this.get_url_to_call(page,type);if(typeof(url_to_call)!="string"){return url_to_call;}
if(SNPModule.skin)
{url_to_call+='&skin='+SNPModule.skin;}
if(null!=$("snp_twitter_friends_left_arrow"))
{$("snp_twitter_friends_left_arrow").style.visibility="hidden";}
if(null!=$("snp_twitter_friends_act_right_arrow"))
{$("snp_twitter_friends_act_right_arrow").style.visibility="hidden";}
var content_container=$('snp_'+type+'module_all_pages_here').parentNode;YAHOO.util.Dom.addClass(content_container,"mp-ajax-notify");C.asyncRequest('GET',url_to_call,{success:function(o)
{YAHOO.util.Dom.removeClass(content_container,"mp-ajax-notify");if(o.responseText!='')
{HuffPoUtil.hide('snp_'+type+'page_'+current_page);$('snp_'+type+'module_all_pages_here').innerHTML+=o.responseText;SNPModule.animatePage(1,'snp_'+type+'module_all_pages_here');SNPModule.refreshPagination(page,type);SNPModule.releaseLock(type);if(null!=$("snp_twitter_friends_left_arrow"))
{$("snp_twitter_friends_act_right_arrow").style.visibility="visible";}
if(null!=$("snp_twitter_friends_act_right_arrow"))
{$("snp_twitter_friends_left_arrow").style.visibility="visible";}
if($('snp_'+type+'page_'+page))
HuffPoUtil.ImageLoader.foldCheck('snp_'+type+'page_'+page);}
else
{HPError.e();SNPModule.animatePage(1,'snp_'+type+'module_all_pages_here');SNPModule.releaseLock(type);}},failure:function(o)
{YAHOO.util.Dom.removeClass(content_container,"mp-ajax-notify");if(SNPModule.mpTimeout)
{clearTimeout(SNPModule.mpTimeout);}
SNPModule.animatePage(1,'snp_'+type+'module_all_pages_here');SNPModule.releaseLock(type);},timeout:5000});setTimeout('SNPModule.checkTwitterPage()',5000);}
return true;},checkTwitterPage:function()
{if($("snp_twitter_friends_left_arrow")&&$("snp_twitter_friends_left_arrow").style.visibility=="hidden")
{if(this.loop_page)
$("snp_twitter_friends_left_arrow").style.visibility="visible";}
if($("snp_twitter_friends_act_right_arrow")&&$("snp_twitter_friends_act_right_arrow").style.visibility=="hidden")
{$("snp_twitter_friends_act_right_arrow").style.visibility="visible";}
return;},animatePage:function(enable,id,callback,set_time)
{if(id=="snp_twitter_friends_module_all_pages_here"&&Y.util.Event.isIE)
{return;}
else
{if(this.animation)
{this.animation.stop(true);}
var direction={from:0,to:1};var time=0.5;if("undefined"!=set_time)
{time=set_time;}
if(!enable)
{direction={from:1,to:0};time=0.9;}
this.animation=new Y.util.Anim($(id),{opacity:direction},time,Y.util.Easing.easeOut);if(typeof(callback)=='function')
{this.animation.onComplete.subscribe(callback);}
this.animation.animate();}},setLock:function(type)
{switch(type)
{case'':this.nav_locked=1;break;case'mp_':this.nav_mp_locked=1;break;case'mp_bn_':this.nav_mp_bn_locked=1;break;case'act_':this.nav_act_locked=1;break;case'comment_':this.nav_comment_locked=1;break;case'entry_inside_comment_':this.entry_inside_locked=1;break;}},releaseLock:function(type)
{switch(type)
{case'':this.nav_locked=0;break;case'mp_':this.nav_mp_locked=0;break;case'mp_bn_':this.nav_mp_bn_locked=0;break;case'act_':this.nav_act_locked=0;break;case'comment_':this.nav_comment_locked=0;break;case'entry_inside_comment_':this.entry_inside_locked=0;break;}},isLocked:function(type)
{switch(type)
{case'':if(this.nav_locked)return true;break;case'mp_':if(this.nav_mp_locked)return true;break;case'mp_bn_':if(this.nav_mp_locked)return true;break;case'act_':if(this.nav_act_locked)return true;break;case'comment_':if(this.nav_comment_locked)return true;break;case'entry_inside_comment_':if(this.entry_inside_locked)return true;break;}
return false;},nextPage:function()
{this.init();var next_index=this.current_page+1;if(next_index>this.max_page)
{next_index=this.max_page;}
this.setPage(next_index);},prevPage:function()
{this.init();var prev_index=this.current_page-1;if(prev_index<0)
{prev_index=0;}
this.setPage(prev_index);},nextMpPage:function()
{this.init();var next_index=this.current_mp_page+1;if(next_index>this.max_mp_page)
{next_index=0;}
this.setPage(next_index,'mp_');},prevMpPage:function()
{this.init();var prev_index=this.current_mp_page-1;if(prev_index<0)
{prev_index=this.max_mp_page;}
this.setPage(prev_index,'mp_');},nextMpReportersPage:function()
{this.init();var next_index=this.current_mpr_page+1;if(next_index>this.max_mpr_page)
{next_index=0;}
this.setPage(next_index,'mpr_');},prevMpReportersPage:function()
{this.init();var prev_index=this.current_mpr_page-1;if(prev_index<0)
{prev_index=this.max_mpr_page;}
this.setPage(prev_index,'mpr_');},nextMpBNPage:function()
{this.init();var next_index=this.current_mp_bn_page+1;if(next_index>this.max_mp_bn_page)
{next_index=this.max_mp_bn_page;}
this.setPage(next_index,'mp_bn_');},prevMpBNPage:function()
{this.init();var prev_index=this.current_mp_bn_page-1;if(prev_index<0)
{prev_index=0;}
this.setPage(prev_index,'mp_bn_');},nextMpHPPage:function()
{this.init();var next_index=this.current_mp_hp_page+1;if(next_index>this.max_mp_hp_page)
{next_index=this.max_mp_hp_page;}
this.setPage(next_index,'mp_hp_');},prevMpHPPage:function()
{this.init();var prev_index=this.current_mp_hp_page-1;if(prev_index<0)
{prev_index=0;}
this.setPage(prev_index,'mp_hp_');},nextFollowerPage:function()
{this.init();var next_index=this.current_follower_page+1;if(next_index>this.max_follower_page)next_index=this.max_follower_page;this.setPage(next_index,'follower_');},prevFollowerPage:function()
{this.init();var prev_index=this.current_follower_page-1;if(prev_index<0)prev_index=0;this.setPage(prev_index,'follower_');},removeCurrentFollower:function(){if(this.max_follower_page==0){HuffPoUtil.hide('snp_follower');}else{var page=$('snp_follower_page_'+this.current_follower_page);if(this.max_follower_page!=this.current_follower_page){SNPModule.nextFollowerPage();this.current_follower_page--;}else SNPModule.prevFollowerPage();this.max_follower_page--;var parent=page.parentNode;parent.removeChild(page);for(var i=0,j=0;i<parent.childNodes.length;i++)if(parent.childNodes[i].nodeName=='DIV')
parent.childNodes[i].id='snp_follower_page_'+j++;if(this.max_follower_page==0){HuffPoUtil.hide('snp_follower_pagination');}else{$('snp_follower_max_page_counter').innerHTML=this.max_follower_page+1;$('snp_follower_page_counter').innerHTML=this.current_follower_page+1;}}},acceptFollower:function(e,userid){SocialFriends.acceptFollower(userid,function(){SNPModule.removeCurrentFollower();},function(){});},declineFollower:function(e,userid){SocialFriends.declineFollower(userid,function(){SNPModule.removeCurrentFollower();},function(){});},nextMBCPage:function()
{this.init();var next_index=this.current_mbc_page+1;if(next_index>this.max_mbc_page)
{next_index=0;}
this.setPage(next_index,'mbc_');},prevMBCPage:function()
{this.init();var prev_index=this.current_mbc_page-1;if(prev_index<0)
{prev_index=this.max_mbc_page;}
this.setPage(prev_index,'mbc_');},nextMBFPage:function()
{this.init();var next_index=this.current_mbf_page+1;if(next_index>this.max_mbf_page)
{next_index=0;}
this.setPage(next_index,'mbf_');},prevMBFPage:function()
{this.init();var prev_index=this.current_mbf_page-1;if(prev_index<0)
{prev_index=this.max_mbf_page;}
this.setPage(prev_index,'mbf_');},nextMBTPage:function()
{this.init();var next_index=this.current_mbt_page+1;if(next_index>this.max_mbt_page)
{next_index=0;}
this.setPage(next_index,'mbt_');},prevMBTPage:function()
{this.init();var prev_index=this.current_mbt_page-1;if(prev_index<0)
{prev_index=this.max_mbt_page;}
this.setPage(prev_index,'mbt_');},initAutoClickMpPage:function()
{this.nextNotSnnMpPage();this.mpTimeout=setTimeout("SNPModule.initAutoClickMpPage()",this.ms);},nextNotSnnMpPage:function(vertical,user_click)
{if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var next_index=this.current_notSNN_mp_page+1;if(next_index>this.max_notSNN_mp_page)
{next_index=0;}
this.setPage(next_index,'not_signed_mp_');},prevNotSnnMpPage:function(vertical,user_click)
{if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var prev_index=this.current_notSNN_mp_page-1;if(prev_index<0)
{prev_index=this.max_notSNN_mp_page;}
this.setPage(prev_index,'not_signed_mp_');},initAutoClickMBCPage:function()
{this.nextNotSnnMBCommentsPage();this.mpTimeout=setTimeout("SNPModule.initAutoClickMBCPage()",this.ms);},nextNotSnnMBCommentsPage:function(vertical,user_click)
{if("undefined"!=typeof(user_click))
{}
if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var next_index=this.current_notSNN_mbc_page+1;if(next_index>this.max_notSNN_mbc_page)
{next_index=0;}
this.setPage(next_index,'not_signed_mbc_');},prevNotSnnMBCommentsPage:function(vertical,user_click)
{if("undefined"!=typeof(user_click))
{}
if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var prev_index=this.current_notSNN_mbc_page-1;if(prev_index<0)
{prev_index=this.max_notSNN_mbc_page;}
this.setPage(prev_index,'not_signed_mbc_');},initAutoClickMBFPage:function()
{this.nextNotSnnMBFacebookPage();this.mpTimeout=setTimeout("SNPModule.initAutoClickMBFPage()",this.ms);},nextNotSnnMBFacebookPage:function(vertical,user_click)
{if("undefined"!=typeof(user_click))
{}
if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var next_index=this.current_notSNN_mbf_page+1;if(next_index>this.max_notSNN_mbf_page)
{next_index=0;}
this.setPage(next_index,'not_signed_mbf_');},prevNotSnnMBFacebookPage:function(vertical,user_click)
{if("undefined"!=typeof(user_click))
{}
if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var prev_index=this.current_notSNN_mbf_page-1;if(prev_index<0)
{prev_index=this.max_notSNN_mbf_page;}
this.setPage(prev_index,'not_signed_mbf_');},initAutoClickMBTPage:function()
{this.nextNotSnnMBTwitterPage();this.mpTimeout=setTimeout("SNPModule.initAutoClickMBTPage()",this.ms);},nextNotSnnMBTwitterPage:function(vertical,user_click)
{if("undefined"!=typeof(user_click))
{}
if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var next_index=this.current_notSNN_mbt_page+1;if(next_index>this.max_notSNN_mbt_page)
{next_index=0;}
this.setPage(next_index,'not_signed_mbt_');},prevNotSnnMBTwitterPage:function(vertical,user_click)
{if("undefined"!=typeof(user_click))
{}
if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var prev_index=this.current_notSNN_mbt_page-1;if(prev_index<0)
{prev_index=this.max_notSNN_mbt_page;}
this.setPage(prev_index,'not_signed_mbt_');},nextNotSnnMpReportersPage:function(vertical)
{if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var next_index=this.current_notSNN_mpr_page+1;if(next_index>this.max_notSNN_mpr_page)
{next_index=0;}
this.setPage(next_index,'not_signed_mpr_');},prevNotSnnMpReportersPage:function(vertical)
{if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var prev_index=this.current_notSNN_mpr_page-1;if(prev_index<0)
{prev_index=this.max_notSNN_mpr_page;}
this.setPage(prev_index,'not_signed_mpr_');},nextNotSnnDontMissPage:function(){if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var next_index=this.current_notSNN_dm_page+1;if(next_index>this.max_notSNN_dm_page)
{next_index=0;}
this.setPage(next_index,'not_signed_dm_');},prevNotSnnDontMissPage:function(){if("undefined"!=typeof(vertical))
{this.current_notSNN_vertical=vertical;}
this.not_snn_init();var prev_index=this.current_notSNN_dm_page-1;if(prev_index<0)
{prev_index=this.max_notSNN_dm_page;}
this.setPage(prev_index,'not_signed_dm_');},nextDMPage:function()
{this.init();var next_index=this.current_dm_hp_page+1;if(next_index>this.max_dm_hp_page)
{next_index=this.max_dm_hp_page;}
this.setPage(next_index,'dm_hp_');},prevDMPage:function()
{this.init();var prev_index=this.current_dm_hp_page-1;if(prev_index<0)
{prev_index=0;}
this.setPage(prev_index,'dm_hp_');},nextActPage:function()
{this.init();var next_index=this.current_act_page+1;if(next_index>this.max_act_page)
{next_index=this.max_act_page;}
this.setPage(next_index,'act_');},prevActPage:function()
{this.init();var prev_index=this.current_act_page-1;if(prev_index<0)
{prev_index=0;}
this.setPage(prev_index,'act_');},nextCommentPage:function()
{this.init();var next_index=this.current_comment_page+1;if(next_index>this.max_comment_page)
{next_index=this.max_comment_page;}
this.setPage(next_index,'comment_');},prevCommentPage:function()
{this.init();var prev_index=this.current_comment_page-1;if(prev_index<0)
{prev_index=0;}
this.setPage(prev_index,'comment_');},nextTwitterPage:function()
{this.init();var next_index=this.current_twitter_page+1;if(next_index>this.max_twitter_page)
{next_index=0;this.loop_page=false;}
this.setPage(next_index,'twitter_friends_');},prevTwitterPage:function()
{this.init();var prev_index=this.current_twitter_page-1;if(prev_index<0)
{prev_index=0;if(this.loop_page)
prev_index=this.max_twitter_page;}
this.setPage(prev_index,'twitter_friends_');},removeRecentActivity:function(id,is_first)
{this.init();var o_id='snp_recent_activity_'+id;var get_url='/users/social_news_project/snp_module_action.php?action=delete&id='+id+'&user_id='+this.url_user_id+'&page='+this.current_act_page;if(is_first)
{o_id='snp_current_reading_entry';get_url+='&type=entry';SNProject.track(id,'delete_entry_view');}
SNPModule.animatePage(0,o_id);C.asyncRequest('GET',get_url,{success:function(o)
{if(o.responseText!='')
{if(SNPModule.animation)
{SNPModule.animation.stop();}
var obj=$(o_id);var p=obj.parentNode;p.removeChild(obj);if(o.responseText!='ok')
{p.innerHTML+=o.responseText;SNPModule.animatePage(1,p.lastChild.id);for(var i=SNPModule.current_act_page+1;i<=SNPModule.max_act_page;i++)
{var tmp='';if(tmp=$('snp_act_page_'+i))
{var parent=tmp.parentNode;parent.removeChild(tmp);}}}
else
{var last_child=Dom.getLastChild(p);if(!last_child||last_child.id=='snp_current_reading_entry')
{p.innerHTML='You have no recorded activities';}}}
else
{HPError.e();SNPModule.animatePage(1,o_id);}},failure:function(o)
{HPError.e();SNPModule.animatePage(1,o_id);},timeout:5000});},show_user_level_box:function(){var height=173;var animation=new Y.util.Anim($("snn_module_user_badge"),{height:{to:height}},1,Y.util.Easing.easeOut);animation.animate();},hide_user_level_box:function(my_level){var animation=new Y.util.Anim($("snn_module_user_badge"),{height:{to:0}},1,Y.util.Easing.bounceOut);HuffCookies.setCookie("level_knowledge",my_level);animation.animate();},lightbox:{isFormLoaded:false,zone_info:'',init:function(){if(typeof(zone_info)!="undefined")
this.zone_info=zone_info;else if(typeof(QV)!="undefined"&&typeof(QV.ad_zone)!="undefined")
this.zone_info=QV.ad_zone;else
this.zone_info='huffpost.general/general';Modal.hideMaskCustom.push(this.close);},show:function(ltype,entry_id,entity_id,friend_user_id,identification){Modal.id='huff_snn_modal_common';Modal.setWidth(750);Modal.showMask(Modal.id);if(!this.isFormLoaded)
{var me=this;var url='/users/social_news_project/snp_module_lightbox.php?type=entry_details&entry_id='+entry_id+'&user_id='+SNPModule.url_user_id;switch(ltype)
{case'comment_details':url='/users/social_news_project/snp_module_lightbox.php?type=comment_details&entry_id='+entry_id+'&user_id='+SNPModule.url_user_id+'&comment_id='+entity_id;break;case'vote_details':url='/users/social_news_project/snp_module_lightbox.php?type=vote_details&entry_id='+entry_id+'&user_id='+SNPModule.url_user_id+'&friend_user_id='+friend_user_id+'&slideshow_id='+entity_id;break;case'poll_vote_details':url='/users/social_news_project/snp_module_lightbox.php?type=poll_vote_details&entry_id='+entry_id+'&user_id='+SNPModule.url_user_id+'&friend_user_id='+friend_user_id+'&user_answer_id='+entity_id;break;case'comment_activity_details':url='/users/social_news_project/snp_module_lightbox.php?type=comment_activity_details&entry_id='+entry_id+'&user_id='+SNPModule.url_user_id+'&parent_id='+entity_id+'&reply_user_id='+friend_user_id+'&comment_id='+identification;break;case'contribute_details':url='/users/social_news_project/snp_module_lightbox.php?type=contribute_details&entry_id='+entry_id+'&user_id='+SNPModule.url_user_id+'&contribute_id='+entity_id+'&friend_user_id='+friend_user_id;break;}
HuffPoUtil.show("huffpo_snn_is_loading");$('huff_snn_modal_common_inner').innerHTML="";YAHOO.util.Connect.asyncRequest('GET',url,{success:function(o){me.onLoadSuccess(o);},failure:function(o){me.onLoadFail(o);}});}},onLoadSuccess:function(o){HuffPoUtil.hide("huffpo_snn_is_loading");$('huff_snn_modal_common_inner').innerHTML=o.responseText;this.isFormLoaded=true;this.show();if(HuffPoUtil.trim($('snn_qr_ad').innerHTML)==""){$('snn_qr_ad').innerHTML='<iframe src="http://ad.doubleclick.net/adi/'+this.zone_info+';ptile=4;sz=300x250;ord='+HuffPoUtil.WEDGJE.ord()+'?" width="300" height="250" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" name="social_news_300x250" id="social_news_300x250"></iframe>';}else{$('snn_qr_ad').style.display="block";}
Modal.ShowIframe();},onLoadFail:function(o){HPError.e();Modal.hideMask();},close:function(){SNPModule.lightbox.isFormLoaded=false;}
},stealth:{current_status:'',hidden:false,init:function(){if($('stealth_mode'))
{if(HuffPrefs.get('read_tracking')===true)
{$('stealth_mode').checked=false;$('stealth_mode_status').innerHTML='Off';this.current_status='off';}
else
{$('stealth_mode').checked=true;$('stealth_mode_status').innerHTML='On';this.current_status='on';if(E.onDOMReady)
{HuffPoUtil.show('snp_stealth_bubble');if(!Y.util.Event.isIE)
{SNPModule.animatePage(1,'snp_stealth_bubble',null,1.3);}}
else
{HuffPoUtil.onPageReady(function(){HuffPoUtil.show('snp_stealth_bubble');if(!Y.util.Event.isIE){SNPModule.animatePage(1,'snp_stealth_bubble',null,1.3);}});}}}},update:function(){var url='';switch(this.current_status)
{case'on':url='/users/social_news_project/snp_module_action.php?action=change_stealth&user_id='+SNPModule.url_user_id+'&value='+1;break;default:url='/users/social_news_project/snp_module_action.php?action=change_stealth&user_id='+SNPModule.url_user_id+'&value='+0;break;}
var me=this;YAHOO.util.Connect.asyncRequest('GET',url,{success:function(o){me.onSuccess(o);},failure:function(o){me.onFail(o);}});},onSuccess:function(o){if('ok'==o.responseText)
{if(SNPModule.skin)
{SNPModule.skinned_module_stealth.onUpdated();}
if('on'==SNPModule.stealth.current_status)
{$('stealth_mode').checked=false;$('stealth_mode_status').innerHTML='Off';SNPModule.stealth.current_status='off';}
else
{$('stealth_mode').checked=true;$('stealth_mode_status').innerHTML='On';SNPModule.stealth.current_status='on';}}
else
{HPError.e();}},onFail:function(o){},close:function(){HuffPoUtil.hide('snp_stealth_bubble');this.hidden=true;}},entryInside:{entry_max_comments:0,current_page:1,loading:function(responseText){if($('huffpost_snn_entry_inside'))
{var removed=$('huffpost_snn_entry_inside').parentNode.removeChild($('huffpost_snn_entry_inside'));}
var div=document.createElement('div');div.setAttribute('id','huffpost_snn_entry_inside');div.innerHTML='<br/>'+responseText+'<br/>';if(HPConfig.wide_format)
{if(2==HPConfig.blog_id)
{var news_content=Dom.get('news_content');var news_content_first_child=Dom.getFirstChild(news_content);if(HPConfig.entry_expanded>0){var element=Dom.getElementsByClassName('link_entries','DIV',news_content_first_child)[0];if(element)news_content_first_child.insertBefore(div,element.nextSibling);else news_content.insertBefore(div,news_content_first_child);}else{news_content.insertBefore(div,news_content_first_child);}}
else if(3==HPConfig.blog_id)
{Dom.get('blog_content').insertBefore(div,Dom.get('blog_content').firstChild);}}
else if($('entry_12345'))
{$('entry_12345').appendChild(div);}
else if($('entry_body'))
{var added=$('entry_body').appendChild(div);}
var tabView=new YAHOO.widget.TabView('snn_entry_inside');this.init();},init:function(){this.entry_max_comments=$('count_how_page_commented').innerHTML;if($('snp_module_user_id'))
{SNPModule.url_user_id=$('snp_module_user_id').innerHTML;}
if(SNPModule.entry_inside_max_comment_page<0)
{if($('snp_entry_inside_comment_module_pages'))
{SNPModule.entry_inside_max_comment_page=this.entry_max_comments;for(var i=1;i<=this.entry_max_comments;i++)
{SNPModule.entry_inside_comment_pages[i]=$('snp_entry_inside_comment_module_page_ids_'+i).innerHTML;}}
else
{SNPModule.entry_inside_max_comment_page=0;}}
if(this.entry_max_comments>9)
{$('entry_inside_all_pages').style.width="140px";}},next:function(){if(SNPModule.isLocked('entry_inside_comment_'))return false;if(this.current_page==this.entry_max_comments)return false;var next_page=this.current_page+1;this.update_font(next_page);SNPModule.setPage(next_page,'entry_inside_comment_');if(next_page>9)
{HuffPoUtil.hide('count_comment_'+(next_page-9));$('count_comment_'+next_page).style.display="inline-block";}
this.current_page=next_page;SNPModule.entry_inside_current_comment_page=next_page;},prev:function(){if(SNPModule.isLocked('entry_inside_comment_'))return false;if(1==this.current_page)return false;var prev_page=this.current_page-1;SNPModule.setPage(prev_page,'entry_inside_comment_');if("none"==$('count_comment_'+prev_page).style.display)
{HuffPoUtil.hide('count_comment_'+(prev_page+9));$('count_comment_'+prev_page).style.display="inline-block";}
this.update_font(prev_page);this.current_page=prev_page;SNPModule.entry_inside_current_comment_page=prev_page;},set_page:function(page){if(SNPModule.isLocked('entry_inside_comment_'))return false;if(page==this.current_page)return false;SNPModule.setPage(page,'entry_inside_comment_');this.update_font(page);this.current_page=page;SNPModule.entry_inside_current_comment_page=page;},update_font:function(page){$("count_comment_"+this.current_page).className="";$("count_comment_"+page).className="entry_inside_current_page";}},snnTwitterStatus:function(params){var url_to_short=(params&&params.url_to_short)||false;var status=$('tweet_status').value;status=status.replace(/^\s+/g,"");status=status.replace(/\s+$/g,"");Dom.removeClass('tweetoutmodule','tweet_out_module');if(status.length<=140&&status!='')
{status=encodeURIComponent(status);var get_data="?tweet="+status+"&eid="+HuffPoUtil.GetEntryID();if(url_to_short)
{get_data+="&url_to_short="+encodeURIComponent(url_to_short);}
$('snn_resp_tweet').innerHTML="<div style=\"text-align:center\"><img src=\"/images/ajax-loader.gif\" /></div>";C.asyncRequest('GET','/users/social_news_project/twitter/post_to_twitter.php'+get_data,{success:function(o){var response_obj=eval(" ( "+o.responseText+" ) ");if(response_obj&&response_obj.response_code=="200")
{$('snn_resp_tweet').innerHTML="Twitter status set!";HuffPoUtil.flash($('snn_resp_tweet'));$('tweet_status').value="";SNPModule.textCounter();}
else
{$('snn_resp_tweet').innerHTML="Unable to process!";HuffPoUtil.hide('hidden_snp_body');}},failure:function(o){if($('hidden_snp_body'))
{HuffPoUtil.hide('hidden_snp_body');HPError.e();}},timeout:20000});}
else if(status.length>140)
{$('snn_resp_tweet').innerHTML="Tweet limit exceeded!";$('tweet_status').focus();}
else
{$('snn_resp_tweet').innerHTML="Please enter some text!";$('tweet_status').focus();}
if($('snn_resp_tweet'))
setTimeout("$('snn_resp_tweet').innerHTML=''; Dom.addClass('tweetoutmodule', 'tweet_out_module');",15000);return false;},twitterModule:function(callback)
{var entry=HuffPoUtil.GetEntryID();this.twitter_timeline_type='home';var mod_el=$(this.tweetout_module_div);if(mod_el)
{mod_el.style.display="block";mod_el.innerHTML='<div style="text-align:center; padding:20px 0;"><div class="snn_twitter_loading">Loading twitter module...</div><div class="snn_twitter_loading_img"><img width="32" height="32" src="http://s.huffpost.com/images/loader.gif" alt="" /></div></div>';var callback={argument:[callback],success:function(o){var callback=o.argument[0];SNPModule.TwitterCallbacks(o,callback);},failure:function(o){if($('hidden_snp_body'))
{HuffPoUtil.hide('hidden_snp_body');HPError.e();}}};var url='/users/social_news_project/twitter/show_twitter_module.php'+(entry?'?entry_id='+entry:'');if(SNPModule.skin)
url+=((/\?/.test(url))?'&':'?')+'skin='+SNPModule.skin;var co=YAHOO.util.Connect.asyncRequest('GET',url,callback);}},TwitterCallbacks:function(o,callback)
{var callback_type=typeof(callback);var response=o.responseText;var error_msg='Sorry, we had some trouble getting your Tweets. Please check back soon!';if(response!="")
{var js_resp=eval("("+response+")");var resp=js_resp.html;var resp_code=js_resp.response_code;var mod_el=$(this.tweetout_module_div);if(resp&&resp_code==200)
{if(mod_el)
{mod_el.innerHTML=resp;if($('top_twitter_info'))
Dom.setStyle($('top_twitter_info'),'display','none');if($('service_bottom_bar')&&SNProject.service_bar=='twitter')
Dom.setStyle($('service_bottom_bar'),'display','none');if(callback_type=='function')
callback();if(SNPModule.max_twitter_page<0)
{if($('snp_twitter_max_page_counter'))
{SNPModule.max_twitter_page=parseInt($('snp_twitter_max_page_counter').innerHTML)-1;}
else
{SNPModule.max_twitter_page=0;}}
SNPModule.current_twitter_page=0;SNPModule.loop_page=false;HuffPoUtil.yellowFlash(this.tweetout_module_div);E.on($('tweet_status'),'keyup',HPUtil.enforceTextAreaLimit,{chars:140});E.on($('tweet_status'),'change',HPUtil.enforceTextAreaLimit,{chars:140});if($('twitter_linked_status'))
{if(parseInt($('twitter_linked_status').innerHTML)==0)
{mod_el.innerHTML="";Dom.setStyle(mod_el,'display','none');SNPModule.networkToLink();HuffCookies.setCookie('twitter_linked','0');}}
SNPModule.resetTwitterModuleValues();if(typeof balanceColumns=='function')
balanceColumns();if($('max_tweet_id'))
SNPModule.max_tweet_id=parseInt($('max_tweet_id').innerHTML);if(SNPModule.check_new_tweets_flag)
setTimeout('SNPModule.checkNewTweets()',SNPModule.check_tweets_rate);SNPModule.check_new_tweets_flag=false;SNPModule.new_tweets_found=false;if(SNPModule.skin)
{SNPModule.show_skinned_twitter_module();}
if(HPAds.tweet_comm_info&&$('tweet_status'))
{$('tweet_status').value+=' '+HPAds.tweet_comm_info.hash;$('snn_twitter_comm_text').innerHTML=HPAds.tweet_comm_info.text;$('snn_twitter_comm_text_cb').checked=true;Dom.removeClass('snn_twitter_comm_text_wrapper','hidden');E.on('snn_twitter_comm_text_cb','click',function(){if($('snn_twitter_comm_text_cb').checked)
{if(!$('tweet_status').value.match(HPAds.tweet_comm_info.hash))$('tweet_status').value+=' '+HPAds.tweet_comm_info.hash;}
else
{$('tweet_status').value=$('tweet_status').value.replace(' '+HPAds.tweet_comm_info.hash,'');}
SNPModule.textCounter();});}}}
else
{mod_el.innerHTML="<div class='module_error_response' style='text-align:center; padding:5px 0; color:#444;'><div class='error_message'>Unable to load the twitter module</div></div>";HPError.e({msg:error_msg,obj:response});}}
else
{HPError.e(error_msg);}},check_new_tweets_flag:true,max_tweet_id:0,check_tweets_rate:300000,new_tweets_found:false,new_tweet_call_status:false,times:1,checkNewTweets:function()
{if(HPConfig&&HPConfig.no_twitter_refresh)
return false;if(this.max_tweet_id&&!this.new_tweet_call_status)
{var url="/users/social_news_project/twitter/check_new_tweets.php";url+="?since_id="+this.max_tweet_id+"&type="+this.twitter_timeline_type;var cObj=C.asyncRequest('GET',url,{success:function(o){var new_tweets=parseInt(o.responseText);if(new_tweets&&SNPModule.max_tweet_id)
{SNPModule.new_tweets_found=true;if($("more_friend_tweets"))
{if(SNPModule.twitter_timeline_type=='home')
{var ttext="New tweets!";if(new_tweets==1)
ttext="New tweet!";}
else if(SNPModule.twitter_timeline_type=='mentions')
{var ttext="New mentions!";if(new_tweets==1)
ttext="New mention!";}
$('more_friend_tweets').innerHTML="<a style=\"color:#222;\" href=\"javascript:void(0);\" onclick=\"SNPModule.twitterTimeline('"+SNPModule.twitter_timeline_type+"')\"><div class=\"some_new_tweets\">"+new_tweets+" "+ttext+"</div></a>";}}
SNPModule.new_tweet_call_status=false;},failure:function(o){if($('hidden_snp_body'))
{HuffPoUtil.hide('hidden_snp_body');HPError.e();SNPModule.new_tweet_call_status=false;}},timeout:10000});this.new_tweet_call_status=YAHOO.util.Connect.isCallInProgress(cObj);}
setTimeout('SNPModule.checkNewTweets()',SNPModule.check_tweets_rate);return;},textCounter:function(){var maxlimit=140;var field=$('tweet_status');var countField=$('tweet_char_limit');if(field)
{if(field.value.length>maxlimit)
{countField.innerHTML=0;new YAHOO.util.ColorAnim(field,{backgroundColor:{from:'#26CFCC',to:'#FFFFFF'}});}
else
countField.innerHTML=maxlimit-field.value.length;}},reTweetLink:function(params){var status_id=params.status;var show=params.show;var unique_part='';if(params.unique_part){unique_part='_'+params.unique_part;}
var div_img=$('snnt_profpic_'+status_id+unique_part);var div_links=$('snnt_links_'+status_id+unique_part);if(show)
{div_img.style.display="none";div_links.style.display="block";}
else
{div_img.style.display="block";div_links.style.display="none";}},favoriteTweet:function(status_id,cb){if(cb==null)cb=function(){};var get_data="?status_id="+status_id;var el=$('fav_span_'+status_id);Dom.removeClass('tweetoutmodule','tweet_out_module');C.asyncRequest('GET','/users/social_news_project/twitter/favorite_tweet.php'+get_data,{success:function(o){if(o.responseText&&/success_favorited/.test(o.responseText)){if(el)el.innerHTML="<img src=\"/images/tfaved.gif\" />";$('snn_resp_tweet').innerHTML="Already a favorite!";HuffPoUtil.flash($('snn_resp_tweet'));}
else if(o.responseText&&/success/.test(o.responseText)){if(el)el.innerHTML="<img src=\"/images/tfaved.gif\" />";$('snn_resp_tweet').innerHTML="Tweet added to Favorites";HuffPoUtil.flash($('snn_resp_tweet'));}
else{$('snn_resp_tweet').innerHTML="Unable to process!";HuffPoUtil.hide('hidden_snp_body');}
cb(o.responseText);if($('snn_resp_tweet'))
setTimeout("if($('snn_resp_tweet')){$('snn_resp_tweet').innerHTML=''; Dom.addClass('tweetoutmodule', 'tweet_out_module');}",15000);},failure:function(o){if($('hidden_snp_body'))
{HuffPoUtil.hide('hidden_snp_body');HPError.e();}
cb('failure');},timeout:20000});},reTweet:function(status_id)
{var screen_name=$('username_'+status_id).innerHTML;var tweet=$('plain_tweet_'+status_id).innerHTML;var el=$('tweet_status');if(tweet&&screen_name)
{el.value="RT @"+screen_name+" "+tweet;if(el.value.length>140)
{el.value=el.value.substr(0,137)+"...";}
this.textCounter();}
return;},replyTweet:function(status_id)
{var screen_name=$('username_'+status_id).innerHTML;var el=$('tweet_status');if(el&&screen_name)
{el.value="@"+screen_name+" ";var end=el.value.length;if(el.setSelectionRange)
el.setSelectionRange(end,end);}
return false;},twitterTimeline:function(type)
{if(type==this.twitter_timeline_type&&!this.new_tweets_found)
return;else if(this.new_tweets_found)
{if($("more_friend_tweets"))$("more_friend_tweets").innerHTML="";}
this.max_tweet_id=0;if(type=='mentions')
{$('ttop_links').innerHTML="<a href=\"javascript:void(0);\" id=\"tmore_links\" onclick=\"SNPModule.twitterTimeline('home');\"><span class=\"small_ttext\">Get Back</span></a>";}
else if(type=='home')
{$('ttop_links').innerHTML="";}
var entry=HuffPoUtil.GetEntryID();var get_data="?type="+type+"&new_tweets_found="+this.new_tweets_found+(entry?'&entry_id='+entry:'');this.twitter_timeline_type=type;$('snp_twitter_friends_module_all_pages_here').innerHTML='<div style="text-align:center; padding:15px 0;"><div class="snn_twitter_loading_img"><img width="32" height="32" src="http://s.huffpost.com/images/loader.gif" alt="" /></div></div>';HuffPoUtil.hide('tmodpaging');C.asyncRequest('GET','/users/social_news_project/twitter/twitter_timeline.php'+get_data,{success:function(o){var response=o.responseText;if(response!="")
{var js_resp=eval("("+response+")");var resp=js_resp.html;var resp_code=js_resp.response_code;if(resp_code==200)
{if($('snp_twitter_friends_module_all_pages_here'))
$('snp_twitter_friends_module_all_pages_here').innerHTML=resp;if($('snp_twitter_max_page_counter'))
$('snp_twitter_max_page_counter').innerHTML=js_resp.total_pages;if($('snp_twitter_friends_page_counter'))
$('snp_twitter_friends_page_counter').innerHTML=1;SNPModule.max_twitter_page=parseInt(js_resp.total_pages)-1;SNPModule.current_twitter_page=0;HuffPoUtil.show('tmodpaging');SNPModule.loop_page=false;SNPModule.new_tweets_found=false;SNPModule.max_tweet_id=js_resp.max_tweet_id;}
else
{HPError.e({msg:'An error occurred while loading the twitter timeline',obj:response});}}
else
HPError.e("An error occurred while loading the twitter timeline");},failure:function(o){HPError.e();},timeout:20000});},replyToUser:function(status_id)
{var screen_name=$('username_'+status_id).innerHTML;var el=$('tweet_status');if(screen_name)
{el.value="@"+screen_name+" ";this.textCounter();el.focus();}
return;},favoriteTweetModule:function(status_id,type)
{var get_data="?status_id="+status_id+"&type="+type;var el=$('fav_span_'+status_id);Dom.removeClass('tweetoutmodule','tweet_out_module');el.innerHTML='<img src="/images/twitter_snn/icon-favorite.gif" />';C.asyncRequest('GET','/users/social_news_project/twitter/favorite_tweet.php'+get_data,{success:function(o){if(o.responseText&&/success/.test(o.responseText)){if(type==1)
{if(el)el.innerHTML='<a title="Remove from favorite" href="javascript:void(0);" onclick="SNPModule.favoriteTweetModule('+status_id+', 0)"><img src="/images/twitter_snn/icon-favorited.gif" /></a>';$('snn_resp_tweet').innerHTML="Tweet added to favorites";}
else if(type==0)
{if(el)el.innerHTML='<a title="Add to favorite" href="javascript:void(0);" onclick="SNPModule.favoriteTweetModule('+status_id+', 1)"><img src="/images/twitter_snn/icon-favorite.gif" /></a>';$('snn_resp_tweet').innerHTML="Tweet removed from favorites";}
HuffPoUtil.flash($('snn_resp_tweet'));}
else if(o.responseText&&/success_favorited/.test(o.responseText)){if(el)el.innerHTML='<a title="Remove from favorite" href="javascript:void(0);" onclick="SNPModule.favoriteTweetModule('+status_id+', 0)"><img src="/images/twitter_snn/icon-favorited.gif" /></a>';$('snn_resp_tweet').innerHTML="Already a favorite!";HuffPoUtil.flash($('snn_resp_tweet'));}
else{$('snn_resp_tweet').innerHTML="Unable to process!";HuffPoUtil.hide('hidden_snp_body');}
if(null!=$('snn_resp_tweet'))
setTimeout("$('snn_resp_tweet').innerHTML=''; Dom.addClass('tweetoutmodule', 'tweet_out_module');",15000);},failure:function(o){if($('hidden_snp_body'))
{HuffPoUtil.hide('hidden_snp_body');HPError.e();}},timeout:20000});},user_profile_open:false,twitter_id_opened:0,user_profile_call_status:false,show_user_bio:false,resetTwitterModuleValues:function()
{this.user_profile_open=false;this.twitter_id_opened=0;this.user_profile_call_status=false;this.show_user_bio=false;},user_profile_error:false,userProfile:function(tid)
{var prof_box='twitter_profile_box';var twitter_user_bio='twitter_user_bio';var twitter_following_count='twitter_following_count';var twitter_follower_count='twitter_follower_count';this.hideUserBio();if(null!=$(prof_box)&&(this.twitter_id_opened!=tid))
{$('t_patience_div').style.display='none';this.hideUserBio();if(!this.user_profile_call_status)
{var el=$(prof_box);var get_data="?tid="+tid;if(this.user_profile_open)
el.innerHTML="<div class=\"tinfo_loader\"><img src='/images/ajax-loader.gif' /></div>";var cObj=C.asyncRequest('GET','/users/social_news_project/twitter/get_twitter_info_module.php'+get_data,{success:function(o){var resp=eval("("+o.responseText+")");if(resp.response_message=="success")
{el.innerHTML='<div class="user_tprof_image floatleft"><img src="'+resp.profile_image_url+'" class="img_border" width="35" height="35" /></div><div class="user_tprof_dets"><div class="user_tname">'+resp.name+'</div><div class="user_tprof_name"><a href="/twitter/'+resp.screen_name+'">'+resp.screen_name+'</a></div><div class="user_tprof_statuses"><span class="total_tweets">Tweets - '+resp.statuses_count+'</span>&nbsp;|&nbsp;<a href="javascript:void(0);" onclick="SNPModule.userBio()">Bio</a></div><div class="clear">';var bio_el=$(twitter_user_bio);var twitter_following_count_el=$(twitter_following_count);var twitter_follower_count_el=$(twitter_follower_count);if(bio_el!=null&&twitter_following_count_el!=null&&twitter_follower_count_el!=null)
{var prof_desc=resp.description;var prof_desc_length=0;if(prof_desc!=null)
var prof_desc_length=prof_desc.length;var bio_bubble=$('twitter_bio_bubble_main_content');if(prof_desc_length>144)
bio_bubble.style.top="-72px";else if(prof_desc_length>=109&&prof_desc_length<=144)
bio_bubble.style.top="-59px";else if(prof_desc_length>=73&&prof_desc_length<=108)
bio_bubble.style.top="-46px";else if(prof_desc_length>=37&&prof_desc_length<=72)
bio_bubble.style.top="-33px";else
bio_bubble.style.top="-20px";bio_el.innerHTML=prof_desc;twitter_following_count_el.innerHTML=resp.friends_count;twitter_follower_count_el.innerHTML=resp.followers_count;}
if(!SNPModule.user_profile_open)
{var attributes={height:{to:52}};SNPModule.user_profile_open=true;var anim=new YAHOO.util.Anim(prof_box,attributes,0.7,YAHOO.util.Easing.easeIn);anim.animate();}
$('t_patience_div').style.display='none';setTimeout('SNPModule.userBio()',2000);SNPModule.user_profile_error=false;SNPModule.twitter_id_opened=tid;}
else
{el.innerHTML="An error occurred, please try in few minutes";el.style.height="20px";$('t_patience_div').style.display='none';SNPModule.hideUserBio();SNPModule.user_profile_open=false;SNPModule.user_profile_error=true;SNPModule.twitter_id_opened=0;}
SNPModule.user_profile_call_status=false;},failure:function(o){el.innerHTML="An error occurred, please try in few minutes";el.style.height="20px";$('t_patience_div').style.display='none';SNPModule.hideUserBio();SNPModule.user_profile_open=false;SNPModule.user_profile_error=true;SNPModule.user_profile_call_status=false;SNPModule.twitter_id_opened=0;},timeout:10000});this.user_profile_call_status=YAHOO.util.Connect.isCallInProgress(cObj);}
else
{SNPModule.hideUserBio();$('t_patience_div').style.display='block';}}
else
{if(this.twitter_id_opened==tid)
{$('t_patience_div').style.display='none';if(this.user_profile_open)
{SNPModule.hideUserBio();var attributes={height:{to:0}};SNPModule.user_profile_open=false;setTimeout('SNPModule.hideUserBio()',2000);}
else
{var attributes={height:{to:52}};SNPModule.user_profile_open=true;setTimeout('SNPModule.userBio()',2000);}
var anim=new YAHOO.util.Anim(prof_box,attributes,0.7,YAHOO.util.Easing.easeIn);anim.animate();}}
return;},userBio:function()
{var el=$('twitter_bio_bubble');if(el!=null&&!this.user_profile_error)
{if(!show_user_bio)
{el.style.display="block";show_user_bio=true;}
else
{el.style.display="none";show_user_bio=false;}}
return;},hideUserBio:function()
{var el=$('twitter_bio_bubble');if(el!=null)
{el.style.display="none";show_user_bio=false;}
return;},_eventHandler:function(e)
{var target=E.getTarget(e);if(target&&(target.tagName=='IMG'||target.tagName=='SPAN'))
target=target.parentNode||false;if(target&&target.tagName=='A')
{var action='';var label='';if(target.className)
{var matches=target.className.match(/track_([^_]+)_?([^ ]*)/);if(matches)
{var action=matches[1];if(matches[2])
label=matches[2];}}
var mappings={'page':'Clickthrough','lightbox':'Lightbox Open','action':'Action'};if(!mappings[action+''])
return;this.trackEvent(mappings[action+''],label);}}};
var HPUser={'is_logged_in':function()
{if(HuffCookies.get('huffpost_user')&&HuffCookies.get('huffpost_pass')&&HuffCookies.get('huffpost_user_id'))
return true;return false;},'user_id':function(){return HuffCookies.getUserId()},'username':HuffCookies.getUserName(),'user_guid':HuffCookies.getUserGuid(),'password':HuffCookies.getPass(),'last_login':function(){return HuffCookies.getLastLogin()},'big_avatar':function(){return HuffCookies.getBigAvatar()},'small_avatar':function(){return HuffCookies.getSmallAvatar()},'logout':function(logout_by_url,logout_facebook)
{SNProject.track(HuffCookies.getUserId(),'user_log_out',1);if($('avatar_logged_in'))$('avatar_logged_in').style.display='none';if($("wendybird_user"))$("wendybird_user").style.display='none';if($('not_logged_user'))$('not_logged_user').style.display='block';var el=document.getElementById('fbook_main_text_notloggedin');if(el)el.style.display="block";el=document.getElementById('join_login_fbook_notloggedin');if(el)el.style.display="block";el=document.getElementById('fConnect_img_container');if(el)el.style.display="block";el=document.getElementById('fbook_main_text_loggedin');if(el)el.style.display="none";el=document.getElementById('join_login_fbook_loggedin');if(el)el.style.display="none";el=document.getElementById('fbook_main_text_name');if(el)el.innerHTML=HuffCookies.getUserName().replace(/[\+_]/g,' ');el=document.getElementById('fConnect_img_container');if(el)el.style.display="block";var cookie_names=new Array('huffpost_user','huffpost_pass','huffpost_lastlogin','huffpost_bigphoto','huffpost_smallphoto','huffpost_snp_status','huffpost_snp_read','huffpost_user_id','huffpost_user_guid');for(var c=0;c<cookie_names.length;c++)
{HuffCookies.destroyCookie(cookie_names[c]);}
el=$('facebook_friends_unit_wrapper');if(el)HuffPoUtil.hide('facebook_friends_unit_wrapper');el=$('snn_entry_inside_module');if(el)HuffPoUtil.hide(el);SNPModule.showHpModules();return true;}};
var HuffpickComments={topicName:'',topicDir:'',bFacebookConnected:false,maxWords:250,lengthOkay:function(el){over=0;trimmed=el.value;if(trimmed.match(/\S/)){trimmed=trimmed.replace(/^[\s._\-*+&?\/\\]+/,'');trimmed=trimmed.replace(/[\s._\-*+&?\/\\]$/,'');}
chunkedText=trimmed.split(/[\s._\-*+&?\/\\]+/);if(chunkedText.length>this.maxWords)
return(chunkedText.length-this.maxWords);else if(trimmed==''||!el.value||el.value=='')
return-1;else
return 0;},alertEmpty:function(){alert("Your comment is empty. Please type a comment, then click POST again.");},alertTooLong:function(over){alert("Your comment is too long by "+over+" "+(over==1?'word':'words')+". The maximum length is "+this.maxWords+" words. Please edit your comment and click POST again.");},addComment:function(parent_id){if(!this.is_post_completed)return;txt_el=$('huffpick_comment_text_'+parent_id);var over=this.lengthOkay(txt_el);if(over==0){this.is_post_completed=false;HuffPoUtil.hide('huffpick_post_button_'+parent_id);Dom.setStyle('huffpick_post_spinner_'+parent_id,'display','inline');YAHOO.util.Connect.setForm('huffpick_comment_form_'+parent_id);var co=YAHOO.util.Connect.asyncRequest('POST','/commentsv3/postComment.php',this);}else if(over>0){this.alertTooLong(over);}else if(over<0)
this.alertEmpty();},success:function(o){var _this=this;var splits=o.responseText.split(':::');var message=splits[0];var cmt_parent_id=parseInt(splits[1]);var cmt_id=parseInt(splits[2]);var cmt_entry_id=splits[3];$('huffpick_comment_form_'+cmt_parent_id).style.display='none';if(typeof LOTCC!='undefined')LOTCC.bcpw("act","reply");if(cmt_id&&SNProject)
{SNProject.track(cmt_id,'comment_comment',cmt_entry_id);}
var doFacebookPublish=(splits.length>6);if(doFacebookPublish){var feedData={"name":splits[7],"description":splits[10],"href":splits[9],"media":[{"type":"image","src":splits[11],"href":splits[9]}]};var feedMessage=splits[8];if(!this.is_facebook_id_saved){HPFB.ensureInit(function(){HPFB.waitForSession(function()
{var nFaceBookId=HPFB.session.uid;if(nFaceBookId){YAHOO.util.Connect.asyncRequest('POST','/commentsv3/_saveFacebookId.php',{success:function(){_this.is_facebook_id_saved=true;}},'facebook_id='+nFaceBookId);HPFB.streamPublish(feedMessage,feedData,null,null,'Your comment is here');}});});}
else{if(!document.getElementById('fb_login_image')){HPFB.waitForSession(function()
{HPFB.streamPublish(feedMessage,feedData,null,null,'Your comment is here');});}}}
this.is_post_completed=true;if(!cmt_id)alert(message)
else alert('Your post was completed successfully but probably this comment is pending approval and won\'t be displayed until it is approved.');},failure:function(o)
{this.is_post_completed=true;},displayReplyBox:function(EntryId,CommentId){var _this=this;var el=$('huffpick_comment_form_div_'+CommentId);if(el.style.display=='block'){el.style.display='none';return;}
var co=YAHOO.util.Connect.asyncRequest('POST','/commentsv3/commentForm.php',{success:function(o){if(o.responseText.substr(0,8)=='login:::'){QuickSNProject.showModal('/users/login/really_fast_login.php',{inner_class:'service_select_modal',width:790});}
else{el.innerHTML=o.responseText;el.style.display='block';if(HuffPrefs.get('yahoo')){$('huffpick_post_to_yahoo_box_'+CommentId).style.display='block';$('huffpick_post_to_yahoo_'+CommentId).checked=_this.is_yahoo_checked;}
HPFB.ensureInit(function(){FB.XFBML.parse();if(!HPFB.session)
return false;var nFacebookId=HPFB.session.uid;if(nFacebookId&&_this.is_facebook_checked){var checkBox=$('huffpick_post_to_facebook_'+CommentId);if(checkBox)checkBox.checked=true;var fbDiv=$('huffpick_facebook_data_'+CommentId);if(fbDiv)fbDiv.style.display='block';}});}},failure:function(o){alert('Internal server error. Please try later.');}},'entry_id='+EntryId+'&comment_id='+CommentId+'&module=huffpick');return false;},onFacebookConnect:function(fb_container_id){var _this=this;if(this.is_facebook_id_saved)return;var newHTML='<table border="0"><tr>'
+'<td>Facebook account: </td>'
+'<td><fb:name uid="loggedinuser" useyou="false" linked="false" /></td>'
+'<td><fb:profile-pic uid="loggedinuser" facebook-logo="true" size="square" linked="false" ></fb:profile-pic></td>'
+'</tr></table>';fb_container_el=$(fb_container_id);if(fb_container_el)fb_container_el.innerHTML=newHTML;fb_root_container_el=$('facebook_data_root');if(fb_root_container_el)fb_root_container_el.innerHTML=newHTML;HPFB.ensureInit(function(){FB.XFBML.parse();if(!HPFB.session)
return false;var nFacebookId=HPFB.session.uid;if(nFaceBookId){YAHOO.util.Connect.asyncRequest('POST','/commentsv3/_saveFacebookId.php',{success:function(){_this.is_facebook_id_saved=true;}},'facebook_id='+nFaceBookId);}});},onFacebookChecked:function(parent_id){var suffix=parent_id;var checkBoxEl=$('huffpick_post_to_facebook_'+suffix);$('huffpick_facebook_data_'+suffix).style.display=(checkBoxEl.checked?'block':'none');this.is_facebook_checked=checkBoxEl.checked;if(HPFB.maybeFacebookConnected()){HuffCookies.set('is_post_to_fb_checked',checkBoxEl.checked?1:0,365*24);}},onYahooChecked:function(parent_id){var suffix=parent_id;var checkBoxEl=$('huffpick_post_to_yahoo_'+suffix);this.is_yahoo_checked=checkBoxEl.checked;if(HuffPrefs.get('yahoo')){HuffCookies.set('is_post_to_yahoo_checked',checkBoxEl.checked?1:0,365*24);}},is_post_completed:true,is_facebook_id_saved:false,is_facebook_checked:((HuffCookies.get('is_post_to_fb_checked')===null)?HPFB.maybeFacebookConnected():parseInt(HuffCookies.get('is_post_to_fb_checked'))&&HPFB.maybeFacebookConnected()),is_yahoo_checked:((HuffCookies.get('is_post_to_yahoo_checked')===null)?HuffPrefs.get('yahoo'):parseInt(HuffCookies.get('is_post_to_yahoo_checked'))&&HuffPrefs.get('yahoo'))};
var HpMessage={message_ids:Array(),contacts:Array(),my_id:0,reply_id:0,reply_type:null,reply_all_str:'',first_unread:0,Init:function()
{if($('hp_message_ids')){if(!HuffPoUtil.getUrlVar('dm')&&!$('hp_message_ids').innerHTML.length)
{HuffPoUtil.hide('snp_message_notice');return false;}
var div_inner=$('hp_message_ids');if(div_inner)
{this.InitNotice(div_inner.innerHTML);}
this.lightbox.init();this.my_id=HuffCookies.getUserId();}},InitNotice:function(str_ids)
{if(!str_ids.length)
{HuffPoUtil.hide('snp_message_notice_a');this.message_ids=new Array();}
else
{this.message_ids=str_ids.split(',');$('snp_message_notice_a').innerHTML='(read '+this.message_ids.length+' new message'+(this.message_ids.length>1?'s':'')+')';HuffPoUtil.show('snp_message_notice_a','inline');}},ReadNext:function()
{if(!this.message_ids.length)return false;this.lightbox.show(this.message_ids[0]);},ReplyBoxEdited:function()
{HpMessage.reply_type='custom';},ShowReplyBox:function(message_id)
{var rbox=$('hp_message_reply_box');var new_parent=$('hpm_message_'+message_id);if(!rbox)return false;if(new_parent)
{rbox.parentNode.removeChild(rbox);new_parent.appendChild(rbox);}
HuffPoUtil.show('hp_message_reply_box');$('hpm_reply_box').focus();Modal.sizeMask();if(message_id>0)
{$('hpm_reply_box_subject').value='Re: '+HuffPoUtil.trim($('hpm_subject_text').innerHTML);var btn_y=Dom.getY('hpm_btn_submit');var mess_y=Dom.getY('hpm_message_'+message_id);var scroll_top=Dom.getDocumentScrollTop()
var viewport_y=Dom.getViewportHeight();var d_offset=scroll_top+viewport_y;if(btn_y>d_offset-20)
{if(btn_y-mess_y>viewport_y)
{HuffPoUtil.ScrollTo('hp_message_reply_box');}
else
{HuffPoUtil.ScrollTo('hpm_message_'+message_id);}}
else
{if(mess_y<scroll_top&&viewport_y<mess_y-btn_y)
{console.log('scroll (2) to hpm_message_'+message_id);HuffPoUtil.ScrollTo('hpm_message_'+message_id);}}}
(function(){var oDS=new YAHOO.util.LocalDataSource(HpMessage.contacts);oDS.responseSchema={fields:["name"]};var oAC=new YAHOO.widget.AutoComplete("hpm_reply_box_to","hpm_reply_box_to_container",oDS);oAC.prehighlightClassName="yui-ac-prehighlight";oAC.delimChar=[","];oAC.animSpeed=0.2;oAC.autoHighlight=true;oAC.useIFrame=true;oAC.queryMatchContains=true;oAC.animVert=false;oAC.queryDelay=0;oAC.resultTypeList=false;var highlightMatch=function(full,snippet,matchindex){return full.substring(0,matchindex)+
"<span style='font-weight:bold;'>"+
full.substr(matchindex,snippet.length)+
"</span>"+
full.substring(matchindex+snippet.length);};oAC.formatResult=function(oResultData,sQuery,sResultMatch)
{var data=oResultData.name;var display='';var index=data.toLowerCase().indexOf(sQuery);if(index>-1){display=highlightMatch(data,sQuery,index);}
else{display=data;}
return display;};return{oDS:oDS,oAC:oAC};})();},EmptyMessageForm:function(message_id)
{if(!this.reply_id||this.reply_id==message_id)return true;var rbox=$('hpm_reply_box');if(HuffPoUtil.trim(rbox.value)!='')
{if(confirm('You have not sent a message, do you want to discard it?'))
{rbox.value='';return true;}
else
{rbox.focus();return false;}}
return true;},WriteNew:function(loaded)
{if(!loaded)
this.lightbox.show(0)
else
{if(!this.LoadContacts(1,null,0))
{HpMessage.ShowReplyBox(0);HpMessage.reply_type='custom';HpMessage.reply_id=0;}}},Reply:function(message_id)
{if(!this.EmptyMessageForm(message_id))return false;if(!this.LoadContacts(1,function(){HpMessage.FillReplyToBox(0,message_id)},message_id))
{HpMessage.ShowReplyBox(message_id);HpMessage.FillReplyToBox(0,message_id);}
this.reply_id=message_id;this.reply_type='reply_to_author';if(HuffPoUtil.trim($('hpm_reply_box_to').value)==this.reply_all_str)
{this.reply_type='reply_to_all';}},ReplyAll:function(message_id)
{if(!this.EmptyMessageForm(message_id))return false;if(!this.LoadContacts(1,function(){HpMessage.FillReplyToBox(1,message_id)},message_id))
{HpMessage.ShowReplyBox(message_id);HpMessage.FillReplyToBox(1,message_id);}
this.reply_id=message_id;this.reply_type='reply_to_all';},Send:function()
{var txt=HuffPoUtil.trim($('hpm_reply_box_to').value);if(!txt.length)
{HPError.e('Please set recipients (Tip: try to type any of your friends and you get a list of matched names)',1);return false;}
txt=HuffPoUtil.trim($('hpm_reply_box_subject').value);if(!txt.length)
{HPError.e('Please write a subject',1);return false;}
txt=HuffPoUtil.trim($('hpm_reply_box').value);if(!txt.length)
{HPError.e('Please write a message',1);return false;}
if(txt.length>1000)
{HPError.e('Your message is too long. Please remove '+(txt.length-1000)+' characters',1);return false;}
$('hpm_btn_submit').src='/images/v/btn_submit.png';var me=this;var url='/users/direct_message/send.php?user_id='+this.lightbox.url_user_id;var post_body='reply_id='+encodeURIComponent(this.reply_id)+'&reply_type='+encodeURIComponent(this.reply_type)+'&to='+encodeURIComponent($('hpm_reply_box_to').value)+'&text='+encodeURIComponent($('hpm_reply_box').value)+'&subject='+encodeURIComponent($('hpm_reply_box_subject').value);YAHOO.util.Connect.asyncRequest('POST',url,{success:function(o){me.sendSuccess(o);},failure:function(o){me.sendFail(o);}},post_body);},sendSuccess:function(o)
{$('hpm_btn_submit').src='/images/v/btn_submit-blue.png';var response=JSON.parse(o.responseText);if(!response)
{HPError.e(o.responseText,1);}
else if(typeof(response.message_id)=="undefined"||response.message_id<=0)
{HPError.e(response.error_message,1)}
else
{HuffPoUtil.hide('hp_message_reply_box');$('hpm_reply_box').value='';if(response.parent_id)
{var parent_node=$('hpm_message_'+response.parent_id);var p=document.createElement('p');p.className='comment-posted';p.innerHTML='You just replied ';if(HpMessage.reply_type=='reply_to_all')
{p.innerHTML+='to all';}
else
{p.innerHTML+='to '+$('hpm_reply_box_to').value;}
p.innerHTML+=': '+response.message;parent_node.appendChild(p);}
else
{Modal.hideMask();}}},sendFail:function(o)
{HPError.e(null,1);$('hpm_btn_submit').src='/images/v/btn_submit-blue.png';},FillReplyToBox:function(type,message_id)
{if(type==0)
{$('hpm_reply_box_to').value=$('hpm_user_from_'+message_id).innerHTML;}
else
{$('hpm_reply_box_to').value=this.reply_all_str;}},LoadContacts:function(display_spinner,callback,message_id)
{if(this.contacts.length)
{HuffPoUtil.hide('hp_message_contacts_loading');return false;}
if(this.contacts==-1)
{return false;}
if(display_spinner)
{var spinner=$('hp_message_contacts_loading');var new_parent=$('hpm_message_'+message_id);if(spinner&&new_parent)
{spinner.parentNode.removeChild(spinner);new_parent.appendChild(spinner);HuffPoUtil.show('hp_message_contacts_loading');}}
this.contacts=-1;var me=this;var url='/users/direct_message/get_contacts.php?user_id='+this.lightbox.url_user_id;YAHOO.util.Connect.asyncRequest('GET',url,{success:function(o){me.contactsLoadSuccess(o,display_spinner,callback,message_id);},failure:function(o){me.contactsLoadFail(o,display_spinner,callback,message_id);}});return true;},contactsLoadSuccess:function(o,display_spinner,callback,message_id)
{HpMessage.contacts=JSON.parse(o.responseText);HuffPoUtil.hide('hp_message_contacts_loading');if(display_spinner)
{HpMessage.ShowReplyBox(message_id);}
if(typeof(callback)=="function")
{callback();}},contactsLoadFail:function(o,display_spinner,callback,message_id)
{HPError.e('Sorry, can\'t get your contacts list',1);HuffPoUtil.hide('hp_message_contacts_loading');if(display_spinner)
{HpMessage.ShowReplyBox(message_id);}
if(typeof(callback)=="function")
{callback();}},ScrollToUnread:function()
{if(!this.first_unread)return false;HuffPoUtil.ScrollTo('hpm_message_'+this.first_unread);},lightbox:{isFormLoaded:false,zone_info:'',url_user_id:'',init:function()
{if(typeof(zone_info)!="undefined")
this.zone_info=zone_info;else if(typeof(QV)!="undefined"&&typeof(QV.ad_zone)!="undefined")
this.zone_info=QV.ad_zone;else
this.zone_info='huffpost.general/general';this.url_user_id=SNPModule.url_user_id;Modal.hideMaskCustom.push(this.close);},show:function(message_id)
{if(HpMessage.contacts!=0)
{}
Modal.id='huff_snn_modal_common';Modal.setWidth(780);Modal.showMask(Modal.id);if(!this.isFormLoaded)
{var me=this;var url='/users/direct_message/show_message.php?id='+message_id+'&user_id='+this.url_user_id+(new Date()).getTime();HuffPoUtil.show("huffpo_snn_is_loading");$('huff_snn_modal_common_inner').innerHTML="";YAHOO.util.Connect.asyncRequest('GET',url,{success:function(o){me.onLoadSuccess(o,message_id);},failure:function(o){me.onLoadFail(o);}});}},onLoadSuccess:function(o,message_id){HuffPoUtil.hide("huffpo_snn_is_loading");$('huff_snn_modal_common_inner').innerHTML=o.responseText;var hpm_all_other_users=$('hpm_all_other_users');if(hpm_all_other_users)
HpMessage.reply_all_str=HuffPoUtil.trim(hpm_all_other_users.innerHTML);this.isFormLoaded=true;this.show();var snn_qr_ad=$('snn_qr_ad');if(HuffPoUtil.trim(snn_qr_ad.innerHTML)==""){snn_qr_ad.innerHTML='<iframe src="http://ad.doubleclick.net/adi/'+this.zone_info+';ptile=4;sz=300x250;ord='+HuffPoUtil.WEDGJE.ord()+'?" width="300" height="250" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe>';}else{snn_qr_ad.style.display="block";}
Modal.ShowIframe();var el=$('_hp_message_ids_update');if(el)
{var update=HuffPoUtil.trim(el.innerHTML);if(!update.length)
{HuffPoUtil.hide('snp_message_notice_a','inline');}
else
{HpMessage.InitNotice(update);}}
if(message_id)
{E.addListener('hpm_reply_box_to','change',HpMessage.ReplyBoxEdited);HpMessage.first_unread=message_id;}
else
{HpMessage.WriteNew(1);}},onLoadFail:function(o){HPError.e(null,1);Modal.hideMask();},close:function(){HpMessage.lightbox.isFormLoaded=false;}
}}
var SocialFriends={total_mutual_pages:0,total_fan_of_pages:0,total_fanned_by_pages:0,made_init:false,mutual_notation:false,current_mutual_page:0,set_mutual_page:0,fan_of_notation:false,current_fan_of_page:0,set_fanof_page:0,fan_by_notation:false,current_fan_by_page:0,set_fanby_page:0,fan_by_per_page:0,add_friend_ids:false,ignore_friend_ids:false,happy_join:false,init:function()
{if(this.made_init)
return;if($('mutual_page_current'))
this.current_mutual_page=parseInt($('mutual_page_current').innerHTML);if($('total_mutual_pages'))
this.total_mutual_pages=parseInt($('total_mutual_pages').innerHTML);if(this.total_mutual_pages)
{var mutual_notation=$('mutual_notation').innerHTML;if(mutual_notation!="")
{this.mutual_notation=eval("("+mutual_notation+")");}}
if($('fan_of_page_current'))
this.current_fan_of_page=parseInt($('fan_of_page_current').innerHTML);if($('total_fan_of_pages'))
this.total_fanof_pages=parseInt($('total_fan_of_pages').innerHTML);if(this.total_fanof_pages)
{var fan_of_notation=$('fan_of_notation').innerHTML;if(fan_of_notation!="")
{this.fan_of_notation=eval("("+fan_of_notation+")");}}
if($('fan_by_page_current'))
this.current_fan_by_page=parseInt($('fan_by_page_current').innerHTML);if($('total_fan_by_pages'))
this.total_fanby_pages=parseInt($('total_fan_by_pages').innerHTML);if($('fan_by_per_page'))
this.fan_by_per_page=parseInt($('fan_by_per_page').innerHTML);if(this.total_fanby_pages)
{var fan_by_notation=$('fan_by_notation').innerHTML;if(fan_by_notation)
{this.fan_by_notation=eval("("+fan_by_notation+")");}}
var f2f=$('followers_to_fans');this.add_friend_ids=f2f?f2f.value:'';if(this.total_mutual_pages==1)
$('mutual_paging_div').style.display="none";if(this.total_fanof_pages==1)
$('fan_of_paging_div').style.display="none";if(this.total_fanby_pages==1)
$('fan_by_paging_div').style.display="none";this.made_init=true;return;},setPage:function(page_type)
{this.init();var getdata="";switch(page_type)
{case"mutual":var obj=this.mutual_notation;var page=this.set_mutual_page-1;var page_viewed=this.set_mutual_page;var unames=friendtypes=socialids=twitternames="";for(var i=0;i<obj[page].length;i++)
{unames+=obj[page][i].UserName+"|";friendtypes+=obj[page][i].friend_type+"|";socialids+=obj[page][i].social_id+"|";twitternames+=obj[page][i].TwitterName+"|";}
var getdata="?type="+page_type+"&unames="+unames+"&friendtypes="+friendtypes+"&socialids="+socialids+"&twitternames="+twitternames+"&page="+page;var current_total=this.total_mutual_pages;break;case"fan_of":var obj=this.fan_of_notation;var page=this.set_fanof_page-1;var page_viewed=this.set_fanof_page;var unames=friendtypes=socialids=twitternames="";for(var i=0;i<obj[page].length;i++)
{unames+=obj[page][i].UserName+"|";friendtypes+=obj[page][i].friend_type+"|";socialids+=obj[page][i].social_id+"|";twitternames+=obj[page][i].TwitterName+"|";}
var getdata="?type="+page_type+"&unames="+unames+"&friendtypes="+friendtypes+"&socialids="+socialids+"&twitternames="+twitternames+"&page="+page;var current_total=this.total_fanof_pages;break;case"fan_by":var obj=this.fan_by_notation;var page=this.set_fanby_page-1;var page_viewed=this.set_fanby_page;var unames=friendtypes=socialids=twitternames=userids="";for(var i=0;i<obj[page].length;i++)
{unames+=obj[page][i].UserName+"|";friendtypes+=obj[page][i].friend_type+"|";socialids+=obj[page][i].social_id+"|";twitternames+=obj[page][i].TwitterName+"|";userids+=obj[page][i].UserId+"|";}
var getdata="?type="+page_type+"&unames="+unames+"&friendtypes="+friendtypes+"&socialids="+socialids+"&twitternames="+twitternames+"&page="+page+"&userids="+userids;var current_total=this.total_fanby_pages;break;default:break;}
this.hideDivs(page_type,current_total);var show_div=page_type+"_friend_page_"+page;if($(show_div))
{$(show_div).style.display="block";this.resetPagination(page_type,page_viewed,current_total);}
else
{var div=page_type+"_friend_page";var url="/users/social_news_project/friends_page.php"+getdata;$(page_type+'_friends_loading').style.display="block";$(page_type+'_paging_div').style.display="none";C.asyncRequest('GET',url+'',{success:function(o){if(o.responseText)
{$(page_type+'_friends_loading').style.display="none";$(page_type+'_paging_div').style.display="block";$(div).innerHTML=$(div).innerHTML+o.responseText;SocialFriends.resetPagination(page_type,page_viewed,current_total);if(page_type=="mutual")
setTimeout(function(){if(FB){FB.XFBML.parse($('mutual_friend_page'));}},500);if(page_type=="fan_by")
SocialFriends.add_friend_ids=SocialFriends.add_friend_ids+userids;}
return false;},failure:function(o){HPError.e();}});}},hideDivs:function(page_type,total)
{for(var i=0;i<total;i++)
{var hd=$(page_type+"_friend_page_"+i);if(hd)
{hd.style.display="none";}}
return;},resetPagination:function(page_type,page,total)
{$(page_type+'_page_current').innerHTML=page;Dom.replaceClass(page_type+'_prev_friends','disabled','enabled');Dom.replaceClass(page_type+'_next_friends','disabled','enabled');$(page_type+'_prev_friends_img').src="/images/friends_lb/prev_enabled.gif";$(page_type+'_next_friends_img').src="/images/friends_lb/next_enabled.gif";if(page==1)
{$(page_type+'_prev_friends_img').src="/images/friends_lb/prev_disabled.gif";Dom.replaceClass(page_type+'_prev_friends','enabled','disabled');}
if(page==total)
{$(page_type+'_next_friends_img').src="/images/friends_lb/next_disabled.gif";Dom.replaceClass(page_type+'_next_friends','enabled','disabled');}
switch(page_type)
{case"mutual":this.current_mutual_page=page;break;case"fan_of":this.current_fan_of_page=page;break;case"fan_by":this.current_fan_by_page=page;break;}
return;},prevMutualPage:function()
{this.init();this.set_mutual_page=this.current_mutual_page-1;if(this.set_mutual_page>=1)
{this.setPage('mutual');}
return;},nextMutualPage:function()
{this.init();this.set_mutual_page=this.current_mutual_page+1;if(this.set_mutual_page<=this.total_mutual_pages)
{this.setPage('mutual');}
return;},prevFanofPage:function()
{this.init();this.set_fanof_page=this.current_fan_of_page-1;if(this.set_fanof_page>=1)
{this.setPage('fan_of');}
return;},nextFanofPage:function()
{this.init();this.set_fanof_page=this.current_fan_of_page+1;if(this.set_fanof_page<=this.total_fanof_pages)
{this.setPage('fan_of');}
return;},prevFanbyPage:function()
{this.init();this.set_fanby_page=this.current_fan_by_page-1;if(this.set_fanby_page>=1)
{this.setPage('fan_by');}
return;},nextFanbyPage:function()
{this.init();this.set_fanby_page=this.current_fan_by_page+1;if(this.set_fanby_page<=this.total_fanby_pages)
{this.setPage('fan_by');}
return;},setFriends:function(user_id)
{this.init();var div_id="follower_"+user_id;var replace_id=user_id+"|";if(Dom.hasClass(div_id,"friend_to_fan_checked"))
{if(this.ignore_friend_ids==false)
this.ignore_friend_ids="";Dom.replaceClass(div_id,"friend_to_fan_checked","friend_to_fan_not_checked");this.add_friend_ids=this.add_friend_ids.replace(replace_id,"");this.ignore_friend_ids+=replace_id;}
else
{if(this.ignore_friend_ids=="")
this.ignore_friend_ids=false;Dom.replaceClass(div_id,"friend_to_fan_not_checked","friend_to_fan_checked");this.add_friend_ids+=replace_id;this.ignore_friend_ids=this.ignore_friend_ids.replace(replace_id,"");}
return;},saveFriends:function()
{this.init();var ids=this.add_friend_ids;var ig_ids=this.ignore_friend_ids;if(ids||ig_ids)
{var obj=this.fan_by_notation;var unames=friendtypes=socialids=twitternames=userids="";for(var i=0;i<obj.length;i++)
{for(var j=0;j<obj[i].length;j++)
{unames+=obj[i][j].UserName+"|";friendtypes+=obj[i][j].friend_type+"|";socialids+=obj[i][j].social_id+"|";twitternames+=obj[i][j].TwitterName+"|";userids+=obj[i][j].UserId+"|";}}
var getdata="?user_ids="+ids+"&unames="+unames+"&friendtypes="+friendtypes+"&socialids="+socialids+"&twitternames="+twitternames+"&alluserids="+userids+"&per_page="+this.fan_by_per_page+"&ignore_ids="+ig_ids;var url="/users/social_news_project/followers_to_friends.php";if($('fan_by_paging_div'))
$('fan_by_paging_div').style.display="none";$('fan_by_friend_page').style.display="none";$('add_friend_link').style.display="none";$('fan_by_friends_loading').style.display="block";C.asyncRequest('GET',url+getdata,{success:function(o){$('fan_by_friends_loading').style.display="none";var response=o.responseText;var r_arr=response.split(":::");$('follower_added_message').innerHTML=r_arr[0];var total=parseInt(r_arr[1]);if(total>0)
{SocialFriends.add_friend_ids=false;SocialFriends.ignore_friend_ids=false;if($('fan_by_page_current'))
$('fan_by_page_current').innerHTML=2;if($('total_fan_by_pages'))
$('total_fan_by_pages').innerHTML=total;if($('total_fan_by_pages'))
$('fan_by_notation').innerHTML=r_arr[2];if($('followers_to_fans'))
$('followers_to_fans').value="";$('fan_by_friend_page').innerHTML="";SocialFriends.made_init=false;SocialFriends.prevFanbyPage();if($('fan_by_paging_div'))
$('fan_by_paging_div').style.display="block";$('add_friend_link').style.display="inline";$('fan_by_friend_page').style.display="block";}
else
{SocialFriends.add_friend_ids=false;SocialFriends.ignore_friend_ids=false;$('add_friend_link').innerHTML="Close";if(SocialFriends.happy_join)
YAHOO.util.Event.addListener("add_friend_link","click",SNProject.happyJoinOnClose);$('add_friend_link').style.display="inline";}},failure:function(o){HPError.e();}});}
else
{if($('add_friend_link').innerHTML=="Close")
Modal.hideMask();else
{$('js_msg').style.display="block";setTimeout("$('js_msg').style.display='none'",5000);}
return;}},acceptFollower:function(userid,onsuccess,onerror){var url="/users/friend_relations.php?fan_id="+userid+"&action=accept";YAHOO.util.Connect.asyncRequest("GET",url,{success:function(o){if(onsuccess)onsuccess(userid);},failure:function(){if(onerror)onsuccess(onerror);},scope:this});},declineFollower:function(userid,onsuccess,onerror){var url="/users/friend_relations.php?fan_id="+userid+"&action=ignore";YAHOO.util.Connect.asyncRequest("GET",url,{success:function(o){if(onsuccess)onsuccess(userid);},failure:function(){if(onerror)onsuccess(onerror);},scope:this});}};var ProviderFriends={inited:false,init:function(type){if(this.inited)return;if($('su2_total_mutual_pages'))this.total_mutual_pages=parseInt($('su2_total_mutual_pages').innerHTML);if($('su2_total_following_pages'))this.total_following_pages=parseInt($('su2_total_following_pages').innerHTML);if($('su2_total_followers_pages'))this.total_followers_pages=parseInt($('su2_total_followers_pages').innerHTML);this.current_mutual_page=this.current_following_page=this.current_followers_page=1;this.inited=true;return;},nextMutualPage:function(){this.init();var page=this.current_mutual_page+1;if(page>this.total_mutual_pages)
return;this.showPage('mutual',page);this.setMutualPagination(page);return;},prevMutualPage:function(){this.init();var page=this.current_mutual_page-1;if(page<1)
return;this.showPage('mutual',page);this.setMutualPagination(page);return;},setMutualPagination:function(page){var prev_el=$('su_modal2_prev_link_mutual');var next_el=$('su_modal2_next_link_mutual');if(page<=1){Dom.replaceClass(prev_el,'su_modal2_prev_enabled','su_modal2_prev_disabled');Dom.replaceClass(next_el,'su_modal2_next_disabled','su_modal2_next_enabled');this.current_mutual_page=1;}
if(page>1&&page<this.total_mutual_pages){Dom.replaceClass(prev_el,'su_modal2_prev_disabled','su_modal2_prev_enabled');Dom.replaceClass(next_el,'su_modal2_next_disabled','su_modal2_next_enabled');this.current_mutual_page=page;}
if(page>=this.total_mutual_pages){Dom.replaceClass(prev_el,'su_modal2_prev_disabled','su_modal2_prev_enabled');Dom.replaceClass(next_el,'su_modal2_next_enabled','su_modal2_next_disabled');this.current_mutual_page=this.total_mutual_pages;}
return;},nextFollowingPage:function(){this.init();var page=this.current_following_page+1;if(page>this.total_following_pages)
return;this.showPage('following',page);this.setFollowingPagination(page);return;},prevFollowingPage:function(){this.init();var page=this.current_following_page-1;if(page<1)
return;this.showPage('following',page);this.setFollowingPagination(page);return;},setFollowingPagination:function(page){var prev_el=$('su_modal2_prev_link_following');var next_el=$('su_modal2_next_link_following');if(page<=1){Dom.replaceClass(prev_el,'su_modal2_prev_enabled','su_modal2_prev_disabled');Dom.replaceClass(next_el,'su_modal2_next_disabled','su_modal2_next_enabled');this.current_following_page=1;}
if(page>1&&page<this.total_following_pages){Dom.replaceClass(prev_el,'su_modal2_prev_disabled','su_modal2_prev_enabled');Dom.replaceClass(next_el,'su_modal2_next_disabled','su_modal2_next_enabled');this.current_following_page=page;}
if(page>=this.total_following_pages){Dom.replaceClass(prev_el,'su_modal2_prev_disabled','su_modal2_prev_enabled');Dom.replaceClass(next_el,'su_modal2_next_enabled','su_modal2_next_disabled');this.current_following_page=this.total_following_pages;}
return;},nextFollowersPage:function(){this.init();var page=this.current_followers_page+1;if(page>this.total_followers_pages)
return;this.showPage('followers',page);this.setFollowersPagination(page);return;},prevFollowersPage:function(){this.init();var page=this.current_followers_page-1;if(page<1)
return;this.showPage('followers',page);this.setFollowersPagination(page);return;},setFollowersPagination:function(page){var prev_el=$('su_modal2_prev_link_followers');var next_el=$('su_modal2_next_link_followers');if(page<=1){Dom.replaceClass(prev_el,'su_modal2_prev_enabled','su_modal2_prev_disabled');Dom.replaceClass(next_el,'su_modal2_next_disabled','su_modal2_next_enabled');this.current_followers_page=1;}
if(page>1&&page<this.total_followers_pages){Dom.replaceClass(prev_el,'su_modal2_prev_disabled','su_modal2_prev_enabled');Dom.replaceClass(next_el,'su_modal2_next_disabled','su_modal2_next_enabled');this.current_followers_page=page;}
if(page>=this.total_followers_pages){Dom.replaceClass(prev_el,'su_modal2_prev_disabled','su_modal2_prev_enabled');Dom.replaceClass(next_el,'su_modal2_next_enabled','su_modal2_next_disabled');this.current_followers_page=this.total_followers_pages;}
return;},showPage:function(type,page){if(type=='mutual')
total=this.total_mutual_pages;if(type=='following')
total=this.total_following_pages;if(type=='followers')
total=this.total_followers_pages;for(var i=1;i<=total;i++){if(i==page)
Dom.setStyle('su2_'+type+'_page_'+i,'display','block');else
Dom.setStyle('su2_'+type+'_page_'+i,'display','none');}},setFollowersToFans:function(user_id,el){var div_el=el.firstChild;var input_el=$('followers_to_fans_box');var val=user_id+"|";if(input_el)
var user_ids=input_el.value;if(Dom.hasClass(div_el,'friend_to_fan_checked_small')){Dom.replaceClass(div_el,'friend_to_fan_checked_small','friend_to_fan_checked_small_disabled');input_el.value=user_ids.replace(val,"");}
else{Dom.replaceClass(div_el,'friend_to_fan_checked_small_disabled','friend_to_fan_checked_small');input_el.value+=val;}
this.updateTwitterFriendCount();return;},checkAllTwitterFollower:function(str){var input_el=$('followers_to_fans_box');input_el.value=str;this.updateTwitterFriendCount();var ids=str.split("|");for(var i=0;i<ids.length;i++){var el=$('twitter_check_'+ids[i]);if(el){if(Dom.hasClass(el,'friend_to_fan_checked_small_disabled')){Dom.replaceClass(el,'friend_to_fan_checked_small_disabled','friend_to_fan_checked_small');}}}
return;},unCheckAllTwitterFollower:function(str){var input_el=$('followers_to_fans_box');input_el.value="";this.updateTwitterFriendCount();var ids=str.split("|");for(var i=0;i<ids.length;i++){var el=$('twitter_check_'+ids[i]);if(el){if(Dom.hasClass(el,'friend_to_fan_checked_small')){Dom.replaceClass(el,'friend_to_fan_checked_small','friend_to_fan_checked_small_disabled');}}}
return;},updateTwitterFriendCount:function(){var input_el=$('followers_to_fans_box');var str=input_el.value;var id_arr=str.split("|");var total=id_arr.length-1;$('twitter_selected_count').innerHTML=total;return;},setCustomFans:function(user_id,el){var div_el=el.firstChild;var input_el=$('custom_friends_box');var val=user_id+"|";if(input_el)
var user_ids=input_el.value;if(Dom.hasClass(div_el,'friend_to_fan_checked_small')){Dom.replaceClass(div_el,'friend_to_fan_checked_small','friend_to_fan_checked_small_disabled');input_el.value=user_ids.replace(val,"");}
else{Dom.replaceClass(div_el,'friend_to_fan_checked_small_disabled','friend_to_fan_checked_small');input_el.value+=val;}
this.updateGooleFriendCount();return;},checkAllCustom:function(str){var input_el=$('custom_friends_box');input_el.value=str;this.updateGooleFriendCount();var ids=str.split("|");for(var i=0;i<ids.length;i++){var el=$('google_check_'+ids[i]);if(el){if(Dom.hasClass(el,'friend_to_fan_checked_small_disabled')){Dom.replaceClass(el,'friend_to_fan_checked_small_disabled','friend_to_fan_checked_small');}}}
return;},unCheckAllCustom:function(str){var input_el=$('custom_friends_box');input_el.value="";this.updateGooleFriendCount();var ids=str.split("|");for(var i=0;i<ids.length;i++){var el=$('google_check_'+ids[i]);if(el){if(Dom.hasClass(el,'friend_to_fan_checked_small')){Dom.replaceClass(el,'friend_to_fan_checked_small','friend_to_fan_checked_small_disabled');}}}
return;},updateGooleFriendCount:function(){var input_el=$('custom_friends_box');var str=input_el.value;var id_arr=str.split("|");var total=id_arr.length-1;$('google_selected_count').innerHTML=total;return;}};
var Lang=YAHOO.lang;function SplashSlideshow()
{this.slideshow_id=0;this.navFirstEl=this.navLastEl=null;this.animating=false;this.aSlides={};this.all_images=[];this.images=[];this.domain='';this.carousel=false;this.play=true;this.current_image=0;this.current_number=0;this.loopcount=3;this.currentloop=0;this.delay=8;}
SplashSlideshow.prototype.SlideShow=function(slideimage_id)
{this.carousel=true;this.current_number=this.aSlides[slideimage_id].number;this.SwitchImage(0);}
SplashSlideshow.prototype.SwitchImage=function(number)
{var me=this;if(number==this.c_slides)
{number=0;this.currentloop++;}
this.current_number=number;if(this.current_number>0)this.MoveLeftStep();if(this.current_number==0&this.currentloop>0)this.MoveLeftStep();var prev_id=number-1;if(number==0)var prev_id=this.c_slides-1;var p_element_id='slide_image_'+this.images[prev_id];var element_id='slide_image_'+this.images[number];var slideimage_id=this.images[this.current_number];this.image_id=slideimage_id;if('image'==this.aSlides[slideimage_id].content_type)
{Dom.get('slide_image_'+this.slideshow_id).src=this.domain+'gadgets/slideshows/'+this.slideshow_id+'/slide_'+this.slideshow_id+'_'+slideimage_id+'_large.jpg';Dom.get('image_cont_'+this.slideshow_id).style.display='block';Dom.get('video_cont_'+this.slideshow_id).style.display='none';Dom.setStyle(element_id,'opacity',0.5);Dom.setStyle(p_element_id,'opacity',1);if(this.aSlides[slideimage_id].title)
{Dom.get('slide_image_'+this.slideshow_id).title=this.aSlides[slideimage_id].title;}
else
{Dom.get('slide_image_'+this.slideshow_id).title='';}}
else
{Dom.get('image_cont_'+this.slideshow_id).style.display='none';Dom.get('video_cont_'+this.slideshow_id).style.display='block';if(-1!==this.aSlides[slideimage_id].video_code.indexOf('<script'))
HPUtil.EvalScript(this.aSlides[slideimage_id].video_code);if(HPBrowser.isIE6())
Dom.get('video_cont_'+this.slideshow_id).innerHTML=HPUtil.getCorrectVideoContentForIE6(this.aSlides[slideimage_id].video_code);else
Dom.get('video_cont_'+this.slideshow_id).innerHTML=this.aSlides[slideimage_id].video_code;}
number++;if(this.currentloop<this.loopcount)this.timer=setTimeout(function(){splash_slideshow.SwitchImage(number);},(this.delay*1000));this.current_number++;}
SplashSlideshow.prototype.Initialize=function(slideshow_id)
{splash_slideshow.changeOpac(this.current_image,0.7);for(var i in this.aSlides)
{if(!this.aSlides.hasOwnProperty(i))continue;this.images[this.aSlides[i].number]=i;}
this.slideshow_id=slideshow_id;this.anim_container=Dom.get('slideshow_splash_navigation_slides_container');HuffPoUtil.ImageLoader.foldCheck(this.anim_container,true);var me=this;E.on(Dom.getElementsByClassName('slide_image','img',this.anim_container),'mouseover',function(){var slideimage_id=(new RegExp(/(\d+)_small/)).exec(this.src)[1];if(!this.getAttribute('floating_id')&&me.aSlides[slideimage_id].caption)
{var stripped_title=HPUtil.Strip_Tags(me.aSlides[slideimage_id].caption);var html='<div style="position:absolute;width:200px;"><span style="'+(stripped_title.length?'padding-right:2px;':'')+'">'+stripped_title.substr(0,28)+'</span></div><div><div class="floatleft"></div><div class="clear"></div><div class="floatright" style="font-weight:bold; height:20px"></div></div>';FloatingPrompt.embed(this,html,undefined,'top',{width:200,add_xy:[0,-40],class_name:'fp_splash_slideshow'});}});E.on(Dom.getElementsByClassName('slide_image','img',this.anim_container),'click',function(){var slideimage_id=(new RegExp(/(\d+)_small/)).exec(this.src);if(me.carousel==true)
{clearTimeout(me.timer);me.image_id=slideimage_id[1];Dom.get('slide_loading_spinner_'+me.slideshow_id).style.display='none';me.timer=setTimeout(function(){me.SwitchImage((me.aSlides[slideimage_id[1]].number+1))},15000);}
splash_slideshow.changeOpac(this.id,0.7);splash_slideshow.changeOpac(me.current_image,1);if('image'==me.aSlides[slideimage_id[1]].content_type)
{if(me.aSlides[slideimage_id[1]].title)
{Dom.get('slide_image_'+slideshow_id).title=me.aSlides[slideimage_id[1]].title;}
else
{Dom.get('slide_image_'+slideshow_id).title='';}
Dom.get('slide_image_'+slideshow_id).src=this.src.replace('_small','_large');Dom.get('image_cont_'+slideshow_id).style.display='block';Dom.get('video_cont_'+slideshow_id).style.display='none';splash_slideshow.changeOpac(this.id,0.7);splash_slideshow.changeOpac(me.current_image,1);}
else
{Dom.get('image_cont_'+slideshow_id).style.display='none';Dom.get('video_cont_'+slideshow_id).style.display='block';if(-1!==me.aSlides[slideimage_id[1]].video_code.indexOf('<script'))
HPUtil.EvalScript(me.aSlides[slideimage_id[1]].video_code);if(HPBrowser.isIE6())
Dom.get('video_cont_'+slideshow_id).innerHTML=HPUtil.getCorrectVideoContentForIE6(me.aSlides[slideimage_id[1]].video_code);else
Dom.get('video_cont_'+slideshow_id).innerHTML=me.aSlides[slideimage_id[1]].video_code;}
me.current_image=this.id;});if(this.c_slides>9)
{E.on(Dom.get('slideshow_splash_navigation_left_button'),'click',function(e)
{E.preventDefault(e);this.MoveLeft();},{},this);E.on(Dom.get('slideshow_splash_navigation_right_button'),'click',function(e)
{E.preventDefault(e);this.MoveRight();},{},this);}}
SplashSlideshow.prototype.FindFirstAndLast=function()
{this.navFirstEl=this.anim_container.firstChild;this.navLastEl=this.anim_container.lastChild;}
SplashSlideshow.prototype.MoveLeft=function()
{if(this.animating)
return;var me=this;this.animating=true;this.all_images=this.anim_container.getElementsByTagName('img');for(var i=0;i<8;++i)
{this.FindFirstAndLast();this.anim_container.removeChild(this.navLastEl);this.anim_container.insertBefore(this.navLastEl,this.navFirstEl);}
this.FindFirstAndLast();HuffPoUtil.ImageLoader.foldCheck(this.anim_container,true,[-100*8,0]);this.animating=false;}
SplashSlideshow.prototype.MoveLeftStep=function()
{this.FindFirstAndLast();this.anim_container.removeChild(this.navFirstEl);this.anim_container.insertBefore(this.navFirstEl,this.navLastEl.nextSibling);HuffPoUtil.ImageLoader.foldCheck(this.anim_container,true,[-100*8,0]);}
SplashSlideshow.prototype.MoveRight=function()
{if(this.animating)
return;var me=this;this.animating=true;for(var i=0;i<8;++i)
{this.FindFirstAndLast();this.anim_container.removeChild(this.navFirstEl);this.anim_container.insertBefore(this.navFirstEl,this.navLastEl.nextSibling);}
this.FindFirstAndLast();HuffPoUtil.ImageLoader.foldCheck(this.anim_container,true,[100*8,0]);this.animating=false;}
SplashSlideshow.prototype.changeOpac=function(el,opacity)
{element=Dom.get(el);var object=element.style;object.opacity=(opacity);object.MozOpacity=(opacity);object.KhtmlOpacity=(opacity);object.filter="alpha(opacity="+opacity*100+")";}
SplashSlideshow.prototype.fade=function(el,start,stop)
{time=0.5;direction={from:start,to:stop};this.animation=new Y.util.Anim($(el),{opacity:direction},time,Y.util.Easing.easeOut);this.animation.onComplete.subscribe(this.changeBackGround);this.animation.animate();}
SplashSlideshow.prototype.changeBackGround=function()
{if(!splash_slideshow.carousel)
{Dom.get('slide_loading_spinner_'+splash_slideshow.slideshow_id).style.display='none';return true;}
Dom.get('slide_loading_spinner_'+splash_slideshow.slideshow_id).style.zIndex=-100;Dom.get('slide_loading_spinner_'+splash_slideshow.slideshow_id).style.padding='0px';Dom.get('back_ground').src=splash_slideshow.domain+'gadgets/slideshows/'+splash_slideshow.slideshow_id+'/slide_'+splash_slideshow.slideshow_id+'_'+splash_slideshow.image_id+'_large.jpg';Dom.setAttribute(Dom.get('back_ground'),'width','900');Dom.setAttribute(Dom.get('back_ground'),'height','360');Dom.get('slide_loading_spinner_'+splash_slideshow.slideshow_id).style.zIndex=1;}
function Badges(params){this.unique_id="";if(params.unique_id){this.unique_id=params.unique_id;}
this.lazy_slices=[];this.holders={};this.holder_id="";this.holder=false;if(params.holder_id){this.holder_id=params.holder_id;this.holder=document.getElementById(this.holder_id);if(!this.holder){this.holder=false;}}
this.entry_params={};if(params.entry_params){this.entry_params=params.entry_params;}
this.comment_params={};if(params.comment_params){this.comment_params=params.comment_params;}
this.global_object_name="";if(params.global_name){this.global_object_name=params.global_name;}
this.force_link_to_share=false;if(params.force_link_to_share){this.force_link_to_share=params.force_link_to_share;}
this.complete_callback_func_name=false;if(params.complete_callback_func_name){this.complete_callback_func_name=params.complete_callback_func_name;}
this.complete_callback=false;if(params.complete_callback){this.complete_callback=params.complete_callback;}
this.share_details_callback=false;if(params.share_details_callback){this.share_details_callback=params.share_details_callback;}
this.additional_panel_classes="";if(params.additional_panel_classes){this.additional_panel_classes=params.additional_panel_classes;}
this.slices={};this.slice_params={};this.panel_border_style="standard";HPFB.ensureInit(function(){var callback=function(url,o){var dom=o.dom;if(!Badges._like_tracked&&dom&&dom.className&&dom.className.match(/badges_like/)){Badges._like_tracked=true;Badges.trackEvent('Liked','Facebook');C.asyncRequest('GET',"/include/share_track.php?a=post&eid="+HPUtil.GetEntryID(url)+"&b=fblike");}}
FB.Event.subscribe('edge.create',callback);});}
Badges.trackEvent=function(action,label){HPTrack.trackEvent('Badges',action,label);}
Badges.prototype={};Badges.prototype.setPanelBorderStyle=function(panel_border_style){this.panel_border_style=panel_border_style;};Badges.prototype.setSlices=function(slices){this.slices=slices;};Badges.prototype.applyHolderStyle=function(){Dom.addClass(this.holder,"badges_v2 "+this.panel_border_style+" "+this.additional_panel_classes);if(this.entry_params.force_fb_like)
Dom.addClass(this.holder,"fb_like_contain");};Badges.prototype.getShareArticleTitle=function(){var title=this.entry_params.title;return escape(title);};Badges.prototype.getArticleLink=function(append_param,badge_type){var url=this.entry_params.url;if(append_param){url=HuffPoUtil.AddStringToQueryString(url,append_param);}
var user_id=HuffCookies.getUserId();if(user_id&&badge_type){url+="#sb="+user_id+",b="+badge_type;}
return escape(url);};Badges.prototype.getCommentLink=function(append_param,badge_type){var url=this.comment_params.url;if(append_param){url=HuffPoUtil.AddStringToQueryString(url,append_param);}
var user_id=HuffCookies.getUserId();if(user_id&&badge_type){url+="#sb="+user_id+",b="+badge_type;}
return escape(url);};Badges.prototype.getShareArticleLink=function(append_param,badge_type){if(this.force_link_to_share){return this.force_link_to_share;}
return this.getArticleLink(append_param,badge_type);};Badges.prototype.getShareCommentLink=function(append_param,badge_type){if(this.force_link_to_share){return this.force_link_to_share;}
return this.getCommentLink(append_param,badge_type);};Badges.prototype.getShareCommentData=function(){var def_mock={title:"",link:""};if(!this.share_details_callback)return def_mock;var sharing_data=window[this.share_details_callback](def_mock);if(!sharing_data)return def_mock;return sharing_data;};Badges.prototype.slicesCallback=function(cb_params){var me,func_name,slice_holder_id,i,slice_name;if(typeof(cb_params)!=="object"){return;}
me=eval(cb_params.global_name);for(i=0;i<cb_params.slice_names.length;i++){slice_name=cb_params.slice_names[i];func_name="sliceHandler_"+slice_name;if(typeof(me[func_name])=="function"&&cb_params.slice_params[slice_name]){slice_holder_id=me.slice_params[slice_name].slice_holder_id;me[func_name](slice_holder_id,cb_params.slice_params[slice_name]);}}};Badges.prototype.start=function(){if(!this.holder){return false;}
this.applyHolderStyle();var slice_id,slice,slice_name,slice_holder_id,script,need_param_flag,func_name,i;for(slice_id in this.slices){if(this.slices.hasOwnProperty(slice_id)){slice_name=this.slices[slice_id];slice_holder_id=this.holder_id+"_slice_"+slice_id;this.slice_params[slice_name]={"slice_holder_id":slice_holder_id};slice=document.createElement("div");slice.setAttribute("id",slice_holder_id);Dom.addClass(slice,"slice slice_"+slice_id);this.holder.appendChild(slice);need_param_flag="sliceHandler_"+slice_name+"_needParams";if(typeof(this[need_param_flag])!=="undefined"){this.lazy_slices.push(slice_name);}else{func_name="sliceHandler_"+slice_name;if(typeof(this[func_name])=="function"){this[func_name](slice_holder_id,false);}}}}
if(this.lazy_slices.length>0){var _slices_string="",_url;for(i=0;i<this.lazy_slices.length;i++){if(_slices_string!=="")_slices_string+=",";_slices_string+=this.lazy_slices[i];}
script=document.createElement("script");script.setAttribute("type","text/javascript");this.holder.appendChild(script);_url="/badge/badges_json_v2.php?sn="+_slices_string+"&gn="+this.global_object_name+"&eu="+this.getArticleLink()+"&id="+this.entry_params.id+"&eco="+this.entry_params.created_on+"&cb="+this.global_object_name+".slicesCallback";if(this.comment_params.id!=undefined){_url+="&cd="+this.comment_params.id+"&cu="+this.comment_params.url+"&cco="+this.comment_params.created_on;}
script.setAttribute("src",_url);}
if(this.complete_callback_func_name){window[this.complete_callback_func_name]({badge_object:this,badge_holder_id:this.holder_id});}
if(this.complete_callback){this.complete_callback({badge_object:this,badge_holder_id:this.holder_id});}
return true;};Badges.prototype.HpBuildIfr=function(w,h,src){var ifrm=document.createElement("iframe");ifrm.height=h;ifrm.width=w;ifrm.src=src;ifrm.frameBorder='0';ifrm.scrolling='no';ifrm.style.border="0px";ifrm.setAttribute("frameBorder","0");return ifrm;};Badges.prototype.newWindow=function(url,width,height,xpos,ypos){width=width||750;height=height||325;xpos=xpos||(screen.width/2)-(width/2);ypos=ypos||(screen.height/2)-(height/2)-150;var winopts="scrollbars=0,width="+width+",height="+height+",top="+ypos+",left="+xpos;var new_window=window.open(url,"badge_v2_share_window",winopts);new_window.focus();}
Badges.prototype.trackBadgeClick=function(slice_name){var renameSliceForTracking=function(slice_name)
{var slice_name=slice_name.charAt(0).toUpperCase()+slice_name.substr(1)
if(slice_name=='retweet')
slice_name='Twitter';return slice_name;}
var renameSliceForQuant=function(slice_name)
{if(slice_name=='retweet')
return"twitter";else if(slice_name=='facebook')
return"fb";return false;}
if(slice_name)
Badges.trackEvent('Click',renameSliceForTracking(slice_name));if(this.tracking_pixel_url){if(this.tracking_pixel_url["common"]&&this.tracking_pixel_url["common"]!='')
{HPUtil.trackerImg(this.tracking_pixel_url["common"],document.body);}
if(slice_name&&this.tracking_pixel_url[slice_name]&&this.tracking_pixel_url[slice_name]!='')
{HPUtil.trackerImg(this.tracking_pixel_url[slice_name],document.body);}
var nslice=renameSliceForQuant(slice_name);if(this.tracking_pixel_url["name"]&&this.tracking_pixel_url["name"]!=''&&nslice)
{HPUtil.trackerImg("http://pixel.quantserve.com/pixel/p-4azu6n0QT1rbs.gif?labels=social_action/"+this.tracking_pixel_url["name"]+"/"+nslice,document.body);}}};Badges.prototype.sliceHandler_tweetmeme=function(holder_id,params){var ifrm=this.HpBuildIfr(50,62,"http://api.tweetmeme.com/button.js?url="+this.getShareArticleLink(null,"tweetmeme")+"&style=normal&source=huffingtonpost");document.getElementById(holder_id).appendChild(ifrm);};Badges.prototype.sliceHandler_yahoo=function(holder_id,params){var yahoo_div=document.getElementById(this.holder_id+"_yahoo_hidden_div");if(!yahoo_div){return;}
document.getElementById(holder_id).appendChild(yahoo_div.parentNode.removeChild(yahoo_div));yahoo_div.style.display="block";yahoo_div.setAttribute("id",this.holder_id+"_yahoo_"+this.unique_id);Dom.addClass(yahoo_div,"badge_v2_yahoo");setTimeout(this.global_object_name+".userFunc_yahoo_add_events(0)",100);};Badges.prototype.userFunc_yahoo_add_events=function(checks){var ybuzz=Dom.getElementsByClassName("yahooBuzzBadge-square");if(!ybuzz){checks=checks+1;setTimeout(this.global_object_name+".userFunc_yahoo_add_events("+checks+")",100);return;}
E.on(ybuzz[0].firstChild,"click",function(e,eid)
{Badges.trackEvent('Click','Yahoo');C.asyncRequest('GET',"/include/share_track.php?a=post&eid="+eid+"&b=ybuzz");return false;},this.entry_params.id,this);};Badges.prototype.sliceHandler_facebook_needParams=true;Badges.prototype.sliceHandler_facebook=function(holder_id,params){var div=document.createElement("div");Dom.addClass(div,"badge_v2_facebook");div.innerHTML=params.share_amount;E.on(div,"click",function(e,params){var url=params[0],slice_name=params[1];this.userFunc_facebook_share_url(url);this.trackBadgeClick(slice_name);return false;},["http://www.facebook.com/sharer.php?u="+this.getShareArticleLink("ref=fb&src=sp","facebook"),'facebook'],this);document.getElementById(holder_id).appendChild(div);};Badges.prototype.userFunc_facebook_show_sharer=function(url){this.newWindow(url);C.asyncRequest('GET',"/include/share_track.php?a=post&eid="+this.entry_params.id+"&b=facebook");};Badges.prototype.userFunc_facebook_show_modal=function(){var SNP=QuickSNProject;var html='<div style="font-size: 14pt; font-weight: bold">Do you want to connect to HuffPost using Facebook?</div>';html+='<a class="login_light_link" ';html+='href="/social/join.html?autojoin=1" ';html+='onclick="linkSocialAccount.checkLoginStatus(\'facebook\'); return false;"';html+='target="_blank">';html+='<img border="0" src="/images/fb-large.gif" alt="Connect with Facebook" style="padding: 16px;"/>';html+='</a>';if("quickread_badges"==this.holder_id)
SNP.showModal(html,{social_logo:false,show_qr_ad:true,show_mask:true});else
SNP.showModal(html,{social_logo:false});};Badges.prototype.userFunc_facebook_share_url=function(url){this.userFunc_facebook_show_sharer(url);if(HuffCookies.getUserId()&&!HuffPrefs.get('facebook')){this.userFunc_facebook_show_modal();}
else if(HuffCookies.getUserId()==null){ConnectOverview.showBenefits({provider:'facebook'});}
return false;};Badges.prototype.sliceHandler_facebook_comment_needParams=true;Badges.prototype.sliceHandler_facebook_comment=function(holder_id,params){var div=document.createElement("div");Dom.addClass(div,"badge_v2_facebook");this.holders["facebook_comment"]=div;div.innerHTML=params.share_amount;E.on(div,"click",this.userFunc_facebook_comment_url,null,this);document.getElementById(holder_id).appendChild(div);};Badges.prototype.userFunc_facebook_comment_url=function(){this.newWindow("http://www.facebook.com/sharer.php?u="+this.getShareCommentLink());this.trackBadgeClick("facebook_comment");};Badges.prototype.sliceHandler_facebook_comment_share=function(holder_id,params){var div=document.createElement("div");Dom.addClass(div,"badge_v2_facebook");this.holders["facebook_comment_share"]=div;div.innerHTML=0;E.on(div,"click",this.userFunc_facebook_comment_share_share_url,null,this);document.getElementById(holder_id).appendChild(div);};Badges.prototype.sliceHandler_facebook_comment_update_numbers=function(number){this.holders["facebook_comment_share"].innerHTML=HuffPoUtil.number_format(number);};Badges.prototype.userFunc_facebook_comment_share_share_url=function(){var sharing_data=this.getShareCommentData();this.newWindow("http://www.facebook.com/sharer.php?u="+sharing_data.link);C.asyncRequest('GET',"/include/share_track.php?a=post&eid="+this.entry_params.id+"&b=facebook");this.trackBadgeClick("facebook_comment_share");};Badges.prototype.sliceHandler_buzz_needParams=true;Badges.prototype.sliceHandler_buzz=function(holder_id,params){var div=document.createElement("div");div.setAttribute("id","badge_v2_buzz"+this.unique_id);Dom.addClass(div,"badge_v2_buzz");if(params.buzz_clicks>9){div.innerHTML=params.buzz_clicks;}
$(holder_id+'').appendChild(div);E.on(div,"click",this.userFunc_buzz_share,null,this);E.on(div,"click",function(e,eid){C.asyncRequest('GET',"/include/share_track.php?a=post&eid="+eid+"&b=gbuzz");return false;},this.entry_params.id,this);};Badges.prototype.userFunc_buzz_share=function(e){var description='';var thumbnail=(HPConfig&&HPConfig.image)?HPConfig.image:'';var meta=document.getElementsByTagName('meta');var c=meta.length;for(var i=0;i<c;i++)
{if(!meta[i].name)
continue;if(meta[i].name=='description')
{description=meta[i].content;}}
var content=encodeURIComponent(description);var url="http://www.google.com/buzz/post?url="+this.getShareArticleLink('utm_source=buzz',"gbuzz")+"&message="+content+(thumbnail?"&imageurl="+encodeURIComponent(thumbnail):'');this.newWindow(url);this.trackBadgeClick('buzz');C.asyncRequest('GET',"/include/google_buzz.php?entry_id="+this.entry_params.id);C.asyncRequest('GET',"/include/share_track.php?a=post&eid="+this.entry_params.id+"&b=gbuzz");var div=$("badge_v2_buzz"+this.unique_id);E.removeListener(div,"click");if(div.innerHTML!==""){div.innerHTML=parseInt(div.innerHTML)+1;}};Badges.prototype.sliceHandler_linkedin_needParams=true;Badges.prototype.sliceHandler_linkedin=function(holder_id,params){var div=document.createElement("div");div.setAttribute("id","badge_v2_linkedin"+this.unique_id);Dom.addClass(div,"badge_v2_linkedin");if(params.linkedin_views>3){div.innerHTML=params.linkedin_views;}
else{Dom.addClass(div,"badge_v2_linkedin_zero");}
$(holder_id+'').appendChild(div);E.on(div,"click",this.userFunc_linkedin_share,null,this);E.on(div,"click",function(e,eid){C.asyncRequest('GET',"/include/share_track.php?a=post&eid="+eid+"&b=linkedin");return false;},this.entry_params.id,this);};Badges.prototype.userFunc_linkedin_share=function(e){this.trackBadgeClick('linkedin');var description='';var thumbnail=(HPConfig&&HPConfig.image)?HPConfig.image:'';var meta=document.getElementsByTagName('meta');var c=meta.length;for(var i=0;i<c;i++){if(!meta[i].name)
continue;if(meta[i].name=='description'){description=meta[i].content;}}
var content=encodeURIComponent(description);var bdiv=$("badge_v2_linkedin"+this.unique_id);var linkedin_share_config={comment:'',entry_id:this.entry_params.id,url:this.getShareArticleLink(),title:this.getShareArticleTitle(),content:content,thumbnail:thumbnail,badge_divel:bdiv,on_success:function(){},holder_id:this.holder_id};if(!(HuffCookies.getUserId()&&HuffPrefs.get("linkedin")))
{linkedin_share_config.on_success=this.userFunc_linkedin_show_modal;linkedin_share_config.on_success_params=this.holder_id;linkedin_share_config.on_success_timeout=1000;}
Sharer.Linkedin.share(linkedin_share_config);return false;};Badges.prototype.userFunc_linkedin_show_modal=function(holder_id){var SNP=QuickSNProject;var html='<div style="font-size: 14pt; font-weight: bold">Do you want to connect to HuffPost using Linkedin?</div>';html+='<a class="login_light_link" ';html+='href="/social/join.html?autojoin=1" ';html+='onclick="linkSocialAccount.checkLoginStatus(\'linkedin\'); return false;"';html+='target="_blank">';html+='<img border="0" src="/images/login/linkedin_connect.png" alt="Connect with LinkedIn" style="padding: 16px;"/>';html+='</a>';if(holder_id&&"quickread_badges"==holder_id)
SNP.showModal(html,{social_logo:false,show_qr_ad:true,show_mask:true});else
SNP.showModal(html,{social_logo:false});return;};Badges.prototype.sliceHandler_retweet_needParams=true;Badges.prototype.sliceHandler_retweet=function(holder_id,params){this.userFunc_prepare_tweet(params);var div=document.createElement("div");div.setAttribute("id","badge_v2_retweet_"+this.unique_id);Dom.addClass(div,"badge_v2_retweet");E.on(div,"click",this.userFunc_post_tweet,null,this);E.on(div,"click",function(e,slice_name){this.trackBadgeClick(slice_name);return false;},"retweet",this);E.on(div,"click",function(e,params){C.asyncRequest('GET',"/include/share_track.php?a=post&eid="+params.eid+"&b=twitter");},{eid:this.entry_params.id},this);div.appendChild(document.createTextNode(HuffPoUtil.number_format(params.views_amount)));var span=document.createElement("span");span.innerHTML="views";div.appendChild(span);document.getElementById(holder_id).appendChild(div);};Badges.prototype.userFunc_prepare_tweet=function(params){this.tweet_descr={is_ready:false,maxLimit:140,shortUrl:params.short_url||"",tweet_text:""};var tweet=params.tweet_text||'';if(tweet.length>this.tweet_descr.maxLimit){tweet=tweet.substr(0,this.tweet_descr.maxLimit-3)+'...';}
this.tweet_descr.tweet_text=tweet;};Badges.prototype.userFunc_post_tweet=function(){var comm_info=false,links;if(this.entry_params.tweet_comm_hash&&(this.tweet_descr.tweet_text.search(this.entry_params.tweet_comm_hash)==-1)){comm_info={text:this.entry_params.tweet_comm_text,hash:this.entry_params.tweet_comm_hash}}
var url_to_share="";switch(this.tweet_descr.url_mode){case"comment_share":var sharing_data=this.getShareCommentData();url_to_share=sharing_data.link;break;case"comment":url_to_share=this.getShareCommentLink();break;default:url_to_share=this.getShareArticleLink();break;}
var short_url=false;if(this.tweet_descr.shortUrl==""){links=[{insert_type:"add_to_end",make_short:true,url:url_to_share}];}else{links=[{insert_type:"add_to_end",url:this.tweet_descr.shortUrl}];var short_url=this.tweet_descr.shortUrl;}
var on_success_cb=function(){Badges.trackEvent('Shared','Twitter');};var on_success_tout=25;var on_success_cb_params="";if(HuffCookies.getUserId()&&!HuffPrefs.get("twitter")){on_success_cb=Badges.prototype.userFunc_twitter_show_modal;on_success_tout=1000;on_success_cb_params=this.holder_id;}else if(HuffCookies.getUserId()==null){on_success_cb=function(){ConnectOverview.showBenefits({provider:'twitter'})};on_success_tout=1000;on_success_cb_params=this.holder_id;}
Sharer.Twitter.share({tweet_text:this.tweet_descr.tweet_text,commercial_info:comm_info,links:links,on_success_callback:on_success_cb,on_success_timeout:on_success_tout,on_success_callback_params:on_success_cb_params,badge_holder_id:this.holder_id,entry_url:this.entry_params.url,entry_short_url:short_url});return false;};Badges.prototype.userFunc_twitter_show_modal=function(holder_id){var SNP=QuickSNProject;var html='<div style="font-size: 14pt; font-weight: bold">Do you want to connect to HuffPost using Twitter?</div>';html+='<a class="login_light_link" ';html+='href="/social/join.html?autojoin=1" ';html+='onclick="linkSocialAccount.checkLoginStatus(\'twitter\'); return false;"';html+='target="_blank">';html+='<img border="0" src="/images/Sign-in-with-Twitter-darker.png" alt="Connect with Twitter" style="padding: 16px;"/>';html+='</a>';if(holder_id&&"quickread_badges"==holder_id)
SNP.showModal(html,{social_logo:false,show_qr_ad:true,show_mask:true});else
SNP.showModal(html,{social_logo:false});return;};Badges.prototype.sliceHandler_retweet_comment_needParams=true;Badges.prototype.sliceHandler_retweet_comment=function(holder_id,params){this.tweet_descr={is_ready:false,maxLimit:140,shortUrl:"",tweet_text:"",url_mode:"comment"};var tweet="via @huffingtonpost: "+this.comment_params.title||'';if(tweet.length>this.tweet_descr.maxLimit){tweet=tweet.substr(0,this.tweet_descr.maxLimit-3)+'...';}
this.tweet_descr.tweet_text=tweet;var div=document.createElement("div");div.setAttribute("id","badge_v2_retweet_"+this.unique_id);this.holders["retweet_comment"]=div;Dom.addClass(div,"badge_v2_retweet");E.on(div,"click",this.userFunc_post_tweet,null,this);E.on(div,"click",function(e,slice_name){this.trackBadgeClick(slice_name);return false;},"retweet",this);div.appendChild(document.createTextNode(HuffPoUtil.number_format(params.views_amount)));var span=document.createElement("span");span.innerHTML="views";div.appendChild(span);document.getElementById(holder_id).appendChild(div);};Badges.prototype.sliceHandler_retweet_comment_share=function(holder_id,params){var div=document.createElement("div");div.setAttribute("id","badge_v2_retweet_"+this.unique_id);this.holders["retweet_comment_share"]=div;Dom.addClass(div,"badge_v2_retweet");E.on(div,"click",this.userFunc_prepare_tweet_comment_share,null,this);E.on(div,"click",function(e,slice_name){this.trackBadgeClick(slice_name);return false;},"retweet",this);div.appendChild(document.createTextNode("0"));var span=document.createElement("span");span.innerHTML="views";div.appendChild(span);document.getElementById(holder_id).appendChild(div);};Badges.prototype.userFunc_retweet_comment_share_update_numbers=function(number){var div=this.holders["retweet_comment_share"];while(div.children.length){div.removeChild(div.firstChild);}
div.appendChild(document.createTextNode(HuffPoUtil.number_format(number)));var span=document.createElement("span");span.innerHTML="views";div.appendChild(span);};Badges.prototype.userFunc_prepare_tweet_comment_share=function(params){var sharing_data=this.getShareCommentData();this.tweet_descr={is_ready:false,maxLimit:140,shortUrl:"",tweet_text:"",url_mode:"comment_share"};var tweet="via @huffingtonpost: "+sharing_data.title||'';if(tweet.length>this.tweet_descr.maxLimit){tweet=tweet.substr(0,this.tweet_descr.maxLimit-3)+'...';}
this.tweet_descr.tweet_text=tweet;this.userFunc_post_tweet();};Badges.prototype.sliceHandler_comments_needParams=true;Badges.prototype.sliceHandler_comments=function(holder_id,params){var div=document.createElement("div");div.setAttribute("id","badge_v2_comments_"+this.unique_id);Dom.addClass(div,"badge_v2_comments_arc");div.innerHTML=params.comments_amount;var a=document.createElement("a");Dom.addClass(a,"badge_v2_comments");if(HuffCookies.getUserId()){a.setAttribute("href","#postComment");}else{a.setAttribute("href","#comments");}
a.appendChild(div);document.getElementById(holder_id).appendChild(a);if(typeof(document.badgeCommentAmountIncrease)=="undefined"){document.badge_comment_panels=[];document.badgeCommentRegisterPanel=function(panel){document.badge_comment_panels.push(panel);};document.badgeCommentAmountIncrease=function(amount){var panel,panel_id;for(panel_id in document.badge_comment_panels){if(document.badge_comment_panels.hasOwnProperty(panel_id)){panel=document.badge_comment_panels[panel_id];panel.userFunc_set_comments_amount(amount);}}};}
document.badgeCommentRegisterPanel(this);E.on(a,"click",function(e,slice_name){this.trackBadgeClick(slice_name);return false;},"comments",this);this.userFunc_set_comments_amount=function(number){var holder=document.getElementById("badge_v2_comments_"+this.unique_id);if(!holder)return;while(holder.childNodes.length>=1)holder.removeChild(holder.firstChild);holder.appendChild(document.createTextNode(number));};};Badges.prototype.sliceHandler_comments_comment_share_needParams=true;Badges.prototype.sliceHandler_comments_comment_share=function(holder_id,params){var div=document.createElement("div");div.setAttribute("id","badge_v2_comments_"+this.unique_id);this.holders["comments_comment_share"]=div;Dom.addClass(div,"badge_v2_comments_arc");div.innerHTML=params.comments_amount;var a=document.createElement("a");Dom.addClass(a,"badge_v2_comments");if(HuffCookies.getUserId()){a.setAttribute("href","#postComment");}else{a.setAttribute("href","#comments");}
a.appendChild(div);document.getElementById(holder_id).appendChild(a);if(typeof(document.badgeCommentAmountIncrease)=="undefined"){document.badge_comment_panels=[];document.badgeCommentRegisterPanel=function(panel){document.badge_comment_panels.push(panel);};document.badgeCommentAmountIncrease=function(amount){var panel,panel_id;for(panel_id in document.badge_comment_panels){if(document.badge_comment_panels.hasOwnProperty(panel_id)){panel=document.badge_comment_panels[panel_id];panel.userFunc_set_comments_amount(amount);}}};}
document.badgeCommentRegisterPanel(this);this.userFunc_set_comments_amount=function(number){var holder=document.getElementById("badge_v2_comments_"+this.unique_id);if(!holder)return;while(holder.childNodes.length>=1)holder.removeChild(holder.firstChild);holder.appendChild(document.createTextNode(number));};};Badges.prototype._createDiggButton=function(holder,params,custom_params)
{var link=document.createElement("a");link.href='http://digg.com/submit?url='+escape(params.url)+'&title='+encodeURIComponent(params.title);link.className='DiggThisButton DiggThisButtonMedium';if(custom_params&&custom_params.class_name)
{var container=document.createElement('div');container.className=custom_params.class_name;container.appendChild(link);holder.appendChild(container);}
else
{holder.appendChild(link);}
HPUtil.loadAndRun('http://widgets.digg.com/buttons.js');};Badges.prototype._innerHandler_digg_small=function(holder,params,custom_params){var custom_params=custom_params||{};var param={url:Sharer.Digg.get_share_link(),title:this.entry_params.title};this._createDiggButton(holder,param,custom_params);this._digg_track(holder);return;}
Badges.prototype._digg_track=function(holder)
{E.on(holder,'click',function(e)
{var entry_id=HuffPoUtil.GetEntryID();if(!entry_id)
return;var target=e.target||e.srcElement;if(target.className&&target.className.indexOf('db-')===0)
this.trackEvent('Click','Digg');C.asyncRequest('GET',"/include/share_track.php?a=post&eid="+entry_id+"&b=digg");},Badges,true);}
Badges.prototype.sliceHandler_digg_small=function(holder_id,params){var holder=$(holder_id);this._innerHandler_digg_small(holder,params,{});return;};Badges.prototype.sliceHandler_digg_small_surge=function(holder_id,params){var holder=$(holder_id);this._innerHandler_digg_small(holder,params,{class_name:"badges_v2_digg_container"});return;};Badges.prototype.surgingDigg_module=function(holder_id,params){var holder=$(holder_id);this._createDiggButton(holder,params,{class_name:"badges_v2_digg_surging_container"});return;};Badges.prototype.sliceHandler_wide_tiny_four_badges_needParams=true;Badges.prototype.sliceHandler_wide_tiny_four_badges=function(holder_id,params){var div,a;div=document.createElement("div");div.innerHTML="Share";E.on(div,"click",function(e,params){SharePost.pop(params.id,params.vert,"");return false;},{id:this.entry_params.id,vert:this.entry_params.vertical_name},this);Dom.addClass(div,"share_div");document.getElementById(holder_id).appendChild(div);var div=document.createElement("div");div.innerHTML="Facebook";Dom.addClass(div,"facebook_div");E.on(div,"click",function(e,url){this.userFunc_facebook_share_url(url);return false;},"http://www.facebook.com/sharer.php?u="+this.getShareArticleLink("ref=fb&src=sp","facebook"),this);E.on(div,"click",function(e,slice_name){this.trackBadgeClick(slice_name);return false;},'facebook',this);document.getElementById(holder_id).appendChild(div);div=document.createElement("div");div.innerHTML="Twitter";E.on(div,"click",this.userFunc_post_tweet,null,this);E.on(div,"click",function(e,slice_name){this.trackBadgeClick(slice_name);return false;},'retweet',this);Dom.addClass(div,"twitter_div");document.getElementById(holder_id).appendChild(div);this.userFunc_prepare_tweet(params);var yahoo_div=document.getElementById(this.holder_id+"_yahoo_hidden_div");if(yahoo_div){document.getElementById(holder_id).appendChild(yahoo_div.parentNode.removeChild(yahoo_div));yahoo_div.style.display="inline";yahoo_div.setAttribute("id",this.holder_id+"_yahoo_"+this.unique_id);Dom.addClass(yahoo_div,"badge_v2_yahoo");}
};Badges.prototype.sliceHandler_stumble_needParams=true;Badges.prototype.sliceHandler_stumble=function(holder_id,params){var div=document.createElement("div");if(params.stumble_views>9){Dom.addClass(div,"badge_v2_stumble_count_div");div.innerHTML=params.stumble_views;}else{Dom.addClass(div,"badge_v2_stumble_no_count_div");}
E.on(div,"click",function(e,params){Badges.trackEvent('Click','Stumble');C.asyncRequest('GET',"/include/share_track.php?a=post&eid="+params.eid+"&b=stumble");this.newWindow(params.url);return false;},{url:"http://www.stumbleupon.com/toolbar/badge_click.php?r="+this.getShareArticleLink(null,"stumble"),eid:this.entry_params.id},this);$(holder_id+'').appendChild(div);};Badges.prototype.sliceHandler_stumble_comment_needParams=true;Badges.prototype.sliceHandler_stumble_comment=function(holder_id,params){var div=document.createElement("div");if(params.stumble_views>9){Dom.addClass(div,"badge_v2_stumble_count_div");div.innerHTML=params.stumble_views;}else{Dom.addClass(div,"badge_v2_stumble_no_count_div");}
E.on(div,"click",function(e,params){Badges.trackEvent('Click','Stumble');this.newWindow(params.url);return false;},{url:"http://www.stumbleupon.com/toolbar/badge_click.php?r="+this.getShareCommentLink(null,"stumble"),cid:this.comment_params.id},this);$(holder_id+'').appendChild(div);};Badges.prototype.sliceHandler_stumble_comment_share=function(holder_id,params){var div=document.createElement("div");this.holders["stumble_comment_share"]=div;if(params.stumble_views>9){Dom.addClass(div,"badge_v2_stumble_count_div");div.innerHTML=params.stumble_views;}else{Dom.addClass(div,"badge_v2_stumble_no_count_div");}
E.on(div,"click",function(e,params){Badges.trackEvent('Click','Stumble');var sharing_data=this.getShareCommentData();var url="http://www.stumbleupon.com/toolbar/badge_click.php?r="+sharing_data.link;this.newWindow(params.url);return false;},{cid:this.comment_params.id},this);$(holder_id+'').appendChild(div);};Badges.prototype.userFunc_stumble_comment_update_numbers=function(number){var div=this.holders["stumble_comment_share"];if(number>9){Dom.removeClass(div,"badge_v2_stumble_no_count_div");Dom.addClass(div,"badge_v2_stumble_count_div");div.innerHTML=HuffPoUtil.number_format(number);}else{Dom.removeClass(div,"badge_v2_stumble_count_div");Dom.addClass(div,"badge_v2_stumble_no_count_div");div.innerHTML="";}};
var Sharer={check_incomplete_sessions:function(){this.Twitter.check_incomplete_session();},Facebook:{links:[],facebook_post:{message:"",attachment:{"name":"","description":"","href":""},action_links:[{"text":"Join HuffPost Social News now!","href":HuffPoUtil.getHostName()+'/social/?r='+escape(HuffCookies.getUserGuid())}],target_id:null,user_message_prompt:null,callback:null,auto_publish:false,actor_id:null},share:function(params){for(var property in params.facebook_post){if(params.facebook_post.hasOwnProperty(property)){this.facebook_post[property]=params.facebook_post[property];}}
if(params.links){Sharer.Links.process(params.links,Sharer.Facebook.real_share,Sharer.Facebook);return false;}
this.real_share();},real_share:function(){HPFB.ensureInit(function(){HPFB.waitForSession(function()
{if(Sharer.Facebook.facebook_post.attachment.description){var _tmp=Sharer.Facebook.facebook_post.attachment.description;_tmp=Sharer.Links.expand_text_with_links(_tmp);Sharer.Facebook.facebook_post.attachment.description=_tmp;}
HPFB.streamPublish(Sharer.Facebook.facebook_post.message,Sharer.Facebook.facebook_post.attachment,Sharer.Facebook.facebook_post.action_links,Sharer.Facebook.facebook_post.target_id,Sharer.Facebook.facebook_post.user_message_prompt,Sharer.Facebook.facebook_post.callback,Sharer.Facebook.facebook_post.auto_publish,Sharer.Facebook.facebook_post.actor_id);});});}},Twitter:{hp_cookie_continue:"hp_sharer_twitter_sharing",hp_cookie_continue_obj:"hp_sharer_twitter_share_text",twitter_messg_limit:140,modal_element_ids:{},oauthInfo:{},user_supply_vars:["tweet_text","commercial_info","links","on_success_callback","on_success_timeout","on_success_callback_params","badge_holder_id","entry_url","entry_short_url"],tweet_text:"",links:[],commercial_info:false,on_success_callback:false,on_success_timeout:25,on_success_callback_params:false,badge_holder_id:null,entry_url:null,entry_short_url:false,check_incomplete_session:function(){if(HuffCookies.getCookie(this.hp_cookie_continue)){this.load_last_share_session();HuffCookies.destroyCookie(this.hp_cookie_continue);if(HuffCookies.getUserId()&&HuffPrefs.get('twitter')){this.check_credentials();}}},load_last_share_session:function(){var text=HuffCookies.getCookie(this.hp_cookie_continue_obj);if(!text)return;var obj_to_restore=JSON.parse(text);if(!obj_to_restore)return;var property,i;for(i=0;i<this.user_supply_vars.length;i++){property=this.user_supply_vars[i];if(obj_to_restore[property]){this[property]=obj_to_restore[property];}}
HuffCookies.destroyCookie(this.hp_cookie_continue_obj);},save_session:function(){HuffCookies.setCookie(this.hp_cookie_continue,1,2);var obj_to_save={},property,i;for(i=0;i<this.user_supply_vars.length;i++){property=this.user_supply_vars[i];if(this[property]){obj_to_save[property]=this[property];}}
HuffCookies.setCookie(this.hp_cookie_continue_obj,JSON.stringify(obj_to_save),2);},get_theme_descr:function(theme_to_use){var theme={ids:{},html:"",close_button_id:""};if(theme_to_use=="basic_twitter"||theme_to_use=="basic_twitter_frontpage"){theme.ids={top_container:QuickSNProject.returnModalContainer(),error_msg:theme_to_use+"_modal_window_error_msg",comm_text:theme_to_use+"_modal_window_comm_text",comm_checkbox:theme_to_use+"_modal_window_share_checkbox",textarea:theme_to_use+"_modal_window_text_area",chars_left_title:theme_to_use+"_modal_window_chars_left",close_button:theme_to_use+"_modal_window_close_button",submit_button:theme_to_use+"_modal_window_submit_button",submit_button_hider:theme_to_use+"_modal_window_submit_button_hider",loader_icon:theme_to_use+"_modal_window_loader_icon",status_text:theme_to_use+"_modal_window_status_text",comm_block:theme_to_use+"_modal_window_comm_block"};theme.close_button_id=theme.ids.close_button;var avatar_cookie=HuffCookies.getCookie("huffpost_bigphoto")||this.oauthInfo.twitter_pic;theme.html="\
					<div id='"+theme.ids.top_container+"' class='twitter_modal_window_new'>\
                        <div class='border_top'></div>\
                        <div class='main_container'>\
                                <div id='"+theme.ids.close_button+"' class='close_button'></div>\
                                <div class='title'><img class='img' src='/images/social-profile/lightbox2/hp_twitter_title_beta.png'></div>\
                                <div id='"+theme.ids.chars_left_title+"' class='counter_container'></div>\
                                <div class='avatar'"+(avatar_cookie?" style='background: url(\""+avatar_cookie+"\") no-repeat scroll 0pt 0pt transparent;'></div>":"></div>")+"<div class='textarea_container'><textarea id='"+theme.ids.textarea+"' class='textarea'></textarea></div>\
                                <div style='clear: both;'></div>\
                                <div id='"+theme.ids.comm_block+"' style='display: none;'>\
	                                <div class='checkbox_container'>\
	                                    <input id='"+theme.ids.comm_checkbox+"' type='checkbox'>\
	                                </div>\
	                                <div id='"+theme.ids.comm_text+"' class='checkbox_label_container'></div>\
	                                <div style='clear: both;'></div>\
	                            </div>\
                                <div class='submit_container'>\
                                    <div id='"+theme.ids.loader_icon+"' class='loader_icon'></div>\
                                    <div id='"+theme.ids.error_msg+"' class='error_msg'></div>\
                                    <div id='"+theme.ids.submit_button+"' class='submit_button'>&nbsp;</div>\
                                    <div id='"+theme.ids.status_text+"' class='status_text'></div>\
                                </div>\
                        </div>\
                        <div class='border_bottom'></div>\
                    </div>";}
HuffCookies.getCookie("huffpost_bigphoto");return theme;},share:function(params){var property,i;for(i=0;i<this.user_supply_vars.length;i++){property=this.user_supply_vars[i];if(params[property]){this[property]=params[property];}}
Sharer.Twitter.check_credentials();},check_credentials:function(){if((HuffCookies.getUserId()&&HuffPrefs.get("twitter"))||this.oauthInfo.token){if(this.links){Sharer.Links.process(this.links,Sharer.Twitter.show_modal_window,Sharer.Twitter);return false;}
this.show_modal_window();}else if(HPConfig.fast_retweet_from_badge){this.fasterRetweet();}else{this.fasterRetweet();}
return false;},connect_modal:function(){if(HuffCookies.getUserId()&&!HuffPrefs.get("twitter")){Badges.prototype.userFunc_twitter_show_modal(this.badge_holder_id);}
else if(HuffCookies.getUserId()==null){setTimeout(function(){ConnectOverview.showBenefits({provider:'twitter'});},500);}
return;},linkedinSharePopup:function(params)
{var url=encodeURIComponent(params.url);var tweet=params.tweet_text;var twitter_share_url="http://twitter.com/share?";var parameters=['url='+url,'via=huffingtonpost','text='+tweet];twitter_share_url+=parameters.join('&');PopupManager.open(twitter_share_url,600,300);PopupManager.onCloseParams=this;PopupManager.onClose=function(_this){_this.connect_modal();};},fasterRetweet:function()
{var cv=HPConfig.current_vertical_name||'';if((cv=="technology"||cv=="entertainment")&&!this.commercial_info)
{if(this.entry_short_url)
{var params={url:this.entry_short_url,tweet_text:this.tweet_text.replace("via @huffingtonpost","")};this.linkedinSharePopup(params);}
else
{var params={url:this.entry_url,tweet_text:this.tweet_text.replace("via @huffingtonpost","")};this.linkedinSharePopup(params);}
return;}
else
{var pop_url="http://"+HPConfig.current_web_address+"/users/social_news_project/twitter/_twitter_snn_module_receiver.html?request=oauth&fast_retweet=1";PopupManager.open(pop_url,850,500);PopupManager.onCloseParams=this;PopupManager.onClose=function(_this){if(_this.oauthInfo.token){_this.check_credentials();}else{_this.connect_modal();}
return false;}}},show_modal_window:function(){var limit_for_inserting_links=this.twitter_messg_limit;if(this.commercial_info){limit_for_inserting_links-=(this.commercial_info.hash.length+1);}
this.tweet_text=Sharer.Links.expand_text_with_links(this.tweet_text,limit_for_inserting_links);if(this.commercial_info){this.tweet_text=this.tweet_text+" "+this.commercial_info.hash;}
var window_theme="";if(HuffPoUtil.GetEntryID(location.href))
window_theme="basic_twitter";else
window_theme="basic_twitter_frontpage";var theme_descr=this.get_theme_descr(window_theme);QuickSNProject.showModal("",{window_theme:window_theme,theme_params:{inner_html:theme_descr.html,close_button_id:theme_descr.close_button_id}});this.modal_element_ids=theme_descr.ids;YAHOO.util.Event.onAvailable(this.modal_element_ids.top_container,function(){Dom.setStyle($(this.modal_element_ids.top_container).parentNode,'zIndex','1000');var textarea=$(this.modal_element_ids.textarea);if(textarea){textarea.value=this.tweet_text+" via @huffingtonpost";E.on(textarea,"keyup",this.key_up_handler,null,this);E.on(textarea,"keyup",HPUtil.enforceTextAreaLimit,{chars:this.twitter_messg_limit});E.on(textarea,"change",HPUtil.enforceTextAreaLimit,{chars:this.twitter_messg_limit});}
var chars_left_title=$(this.modal_element_ids.chars_left_title);if(chars_left_title){chars_left_title.innerHTML=this.twitter_messg_limit-this.tweet_text.length;}
var submit_button=$(this.modal_element_ids.submit_button);if(submit_button){E.on(submit_button,"click",this.submit_handler,null,this);}
if(this.commercial_info){Dom.setStyle(this.modal_element_ids.comm_block,'display','block');var comm_text=$(this.modal_element_ids.comm_text);if(comm_text){comm_text.innerHTML=this.commercial_info.text;var checkbox=$(this.modal_element_ids.comm_checkbox);checkbox.checked=true;E.on(comm_text,"click",this.commercial_checkbox_handler,null,this);E.on(checkbox,"click",this.commercial_checkbox_handler,null,this);}}
if(this.badge_holder_id){E.addListener($(this.modal_element_ids.close_button),"click",function(e,_this){_this.connect_modal();},this);}},null,this);},commercial_checkbox_handler:function(e){var textarea=$(this.modal_element_ids.textarea);var checkbox=$(this.modal_element_ids.comm_checkbox);var hash=this.commercial_info.hash;if(checkbox.disabled){return;}
var nodeName=(e.srcElement||e.target).nodeName.toLowerCase();if(nodeName!="input"){if(HPBrowser.isIE6()||HPBrowser.isIE7()){if(checkbox.checked)checkbox.setAttribute("checked",false);else checkbox.setAttribute("checked",true);}else{if(checkbox.checked)checkbox.checked=false;else checkbox.checked=true;}}
if(checkbox.checked){textarea.value+=' '+hash;}else{textarea.value=textarea.value.replace(' '+hash,'');}},key_up_handler:function(){var maxlimit=this.twitter_messg_limit;var textarea=$(this.modal_element_ids.textarea);var chars_left_title=$(this.modal_element_ids.chars_left_title);if(textarea.value.length>maxlimit){chars_left_title.innerHTML=0;}
else{chars_left_title.innerHTML=maxlimit-textarea.value.length;}},submit_handler:function(){var textarea=$(this.modal_element_ids.textarea);var error_msg_div=$(this.modal_element_ids.error_msg);var twitter_tweet=textarea.value;if(twitter_tweet==""){error_msg_div.innerHTML="Please enter some text!";textarea.focus();return false;}
if(twitter_tweet.length>this.twitter_messg_limit){error_msg_div.innerHTML="Tweet limit exceeded!";textarea.focus();return false;}
this.show_sibmitting_proccess();var postdata="tweet="+encodeURIComponent(twitter_tweet);if(this.oauthInfo.token){postdata+="&user_ot="+this.oauthInfo.token+"&user_os="+this.oauthInfo.secret;}
C.asyncRequest("POST","/badge/post_to_twitter.php",{success:function(o){if(o.responseText&&/success/.test(o.responseText)){Sharer.Twitter.show_successfull_final();}else{Sharer.Twitter.show_failure_final();}},failure:function(o){Sharer.Twitter.show_failure_final();HPError.e();},timeout:20000},postdata);return false;},show_sibmitting_proccess:function(){var submit_button=$(this.modal_element_ids.submit_button);var loader_icon=$(this.modal_element_ids.loader_icon);var textarea=$(this.modal_element_ids.textarea);var checkbox=$(this.modal_element_ids.comm_checkbox);if(HPBrowser.isIE6()||HPBrowser.isIE7()){loader_icon.style.display="block";}
$(this.modal_element_ids.error_msg).innerHTML='';submit_button.style.display="none";loader_icon.style.display="block";textarea.disabled=true;if(checkbox)checkbox.disabled=true;},show_successfull_final:function(){var loader_icon=$(this.modal_element_ids.loader_icon);var status_text=$(this.modal_element_ids.status_text);if(HPBrowser.isIE6()||HPBrowser.isIE7()){loader_icon.style.display="none";}
loader_icon.style.display="none";status_text.innerHTML="Posted successfully on twitter!";status_text.style.display="block";if(typeof this.on_success_callback=="function")
setTimeout(function(){Sharer.Twitter.on_success_callback(Sharer.Twitter.on_success_callback_params)},Sharer.Twitter.on_success_timeout);},show_failure_final:function(){var loader_icon=$(this.modal_element_ids.loader_icon);var status_text=$(this.modal_element_ids.status_text);if(HPBrowser.isIE6()||HPBrowser.isIE7()){loader_icon.style.display="none";}
loader_icon.style.display="none";status_text.innerHTML="Unable to process your request!";status_text.style.display="block";}},Links:{links:[],not_completed:true,need_to_short:0,shorten:0,check_for_complete:function(){if(this.shorten==this.need_to_short){this.not_completed=false;return true;}
return false;},bitly_shorten_complete:function(data){var s='',r,i,key,first_result,longUrl,shortUrl="",link;for(r in data.results){first_result=data.results[r];longUrl=r;break;}
for(key in first_result){s+=key+":"+first_result[key].toString()+"\n";if(key=="shortUrl")
shortUrl=first_result[key].toString();}
for(i=0;i<Sharer.Links.links.length;i++){link=Sharer.Links.links[i];if(link.url==longUrl){link.long_url=link.url;link.url=shortUrl;Sharer.Links.shorten++;break;}}},process:function(links,callback_action,scope){var i,link_desc,short_url,url,jsonp_script;if(links){this.links=links;}
for(i=0;i<this.links.length;i++){link_desc=this.links[i];if(link_desc.make_short&&link_desc.url){url="http://api.bit.ly/shorten?version=2.0.1&longUrl="+escape(link_desc.url)+"&login="+HPConfig.bit_ly_key.user_name+"&apiKey="+HPConfig.bit_ly_key.user_key+"&callback=Sharer.Links.bitly_shorten_complete";jsonp_script=document.createElement("script");jsonp_script.setAttribute("type","text/javascript");document.getElementsByTagName("head")[0].appendChild(jsonp_script);jsonp_script.setAttribute("src",url);this.need_to_short++;}}
this.wait_for_completed(callback_action,scope,10,Sharer.Links.check_for_complete);},wait_for_completed:function(callback_action,scope,interval,condition){if(this.check_for_complete()){callback_action.apply(scope);return;}
setTimeout(function(){Sharer.Links.wait_for_completed(callback_action,scope,interval,condition);},interval);},expand_text_with_links:function(text,max_text_length){var new_text=text,i,link_desc;if(!text){return"";}
max_text_length=max_text_length||false;for(i=0;i<this.links.length;i++){link_desc=this.links[i];if(link_desc.insert_type=="add_to_end"){if(max_text_length&&(new_text.length>(max_text_length-(link_desc.url.length+1)))){new_text=new_text.substr(0,(max_text_length-(link_desc.url.length+1))-3)+"...";}
new_text=new_text+" "+link_desc.url;}else if(link_desc.insert_type=="replace_mock"){new_text=new_text.replace(link_desc.mock,link_desc.url);if(max_text_length&&(new_text.length>max_text_length)){new_text=new_text.substr(0,max_text_length-3)+"...";}}else if(link_desc.insert_type=="add_to_begining"){new_text=link_desc.url+" "+new_text;if(max_text_length&&(new_text.length>max_text_length)){new_text=new_text.substr(0,max_text_length-3)+"...";}}}
return new_text;}},Digg:{get_share_link:function(){var share_entry_url="";if(HPConfig.slideshow_individual_slide_link||!HPConfig.entry_digg_promo_url){share_entry_url=window.location;}else{share_entry_url=HPConfig.entry_digg_promo_url;}
return share_entry_url;},digg_it:function(entry_title,entry_url){var digg_base_url="http://digg.com/submit?phase=2&title="+entry_title+"&url="+(entry_url?escape(entry_url):escape(this.get_share_link()));window.open(digg_base_url,"digg_window","width=650,height=520,status=yes,location=no,left=0,top=0");}},Linkedin:{UserData:null,AccessTokens:null,modal_element_ids:{},linkedin_messg_limit:700,share:function(config)
{this.entry_id=config.entry_id||null;this.title=config.title||null;this.url=config.url||null;this.content=config.content||null;this.thumbnail=config.thumbnail||null;this.on_success=config.on_success||null;this.on_success_params=config.on_success_params||null;this.on_success_timeout=config.on_success_timeout||25;this.badge_div_el=config.badge_div_el||null;this.comment=config.comment||'';this.holder_id=config.holder_id||'';this.startShare();return;},startShare:function(){if(this.entry_id&&this.title&&this.url&&this.content)
{if((HuffCookies.getUserId()&&HuffPrefs.get("linkedin"))||(this.AccessTokens&&this.AccessTokens.oauth_token)){this.showShareModal();}
else{var url=HuffPoUtil.getHostName()+"/users/linkedin/index.php?action=auth&step=1";PopupManager.open(url,750,325);PopupManager.onCloseParams=this;PopupManager.onClose=function(_this){if(QuickLogin.LinkedinData){_this.UserData=JSON.parse(QuickLogin.LinkedinData.UserData);_this.AccessTokens=JSON.parse(QuickLogin.LinkedinData.AccessTokens);if(_this.UserData&&_this.AccessTokens)
_this.showShareModal();}
return;}}}
else
return false;},showShareModal:function()
{var window_theme="";if(HuffPoUtil.GetEntryID(location.href))
window_theme="basic_linkedin";else
window_theme="basic_linkedin_frontpage";var theme_descr=this.get_theme_descr(window_theme);QuickSNProject.showModal("",{window_theme:window_theme,theme_params:{inner_html:theme_descr.html,close_button_id:theme_descr.close_button_id}});this.modal_element_ids=theme_descr.ids;YAHOO.util.Event.onAvailable(this.modal_element_ids.top_container,function(){Dom.setStyle($(this.modal_element_ids.top_container).parentNode,'zIndex','1000');var textarea=$(this.modal_element_ids.textarea);if(textarea){textarea.value=this.comment;E.on(textarea,"keyup",this.key_up_handler,null,this);E.on(textarea,"keyup",HPUtil.enforceTextAreaLimit,{chars:this.linkedin_messg_limit});E.on(textarea,"change",HPUtil.enforceTextAreaLimit,{chars:this.linkedin_messg_limit});}
var chars_left_title=$(this.modal_element_ids.chars_left_title);if(chars_left_title){chars_left_title.innerHTML=this.linkedin_messg_limit-this.comment.length;}
var submit_button=$(this.modal_element_ids.submit_button);if(submit_button){E.on(submit_button,"click",this.submit_handler,null,this);}
var preview_block_el=$(this.modal_element_ids.preview_block);if(preview_block_el){var preview_html="";if(this.thumbnail&&this.thumbnail!="")
preview_html+="<div class='lin_share_pic float_left'><img src='"+this.thumbnail+"' /></div>";preview_html+="\
									<div class='lin_share_top'>\
										<span class='lin_share_title'>"+unescape(this.title)+"</span>\
										<span class='lin_share_small'>"+unescape(document.location.hostname)+"</div>\
									</div>\
									<div class='lin_share_text'>"+unescape(this.content)+"</div>\
									<div style='clear: both;'></div>";preview_block_el.innerHTML=preview_html;}
if(this.holder_id){E.addListener($(this.modal_element_ids.close_button),"click",function(e,_this){_this.connect_modal();},this);}},null,this);return;},connect_modal:function()
{if(!(HuffCookies.getUserId()&&HuffPrefs.get("linkedin")))
{Badges.prototype.userFunc_linkedin_show_modal(this.badge_holder_id);}
return;},get_theme_descr:function(theme_to_use){var theme={ids:{},html:"",close_button_id:""};if(theme_to_use=="basic_linkedin"||theme_to_use=="basic_linkedin_frontpage"){theme.ids={top_container:QuickSNProject.returnModalContainer(),error_msg:theme_to_use+"_modal_window_error_msg",comm_text:theme_to_use+"_modal_window_comm_text",comm_checkbox:theme_to_use+"_modal_window_share_checkbox",textarea:theme_to_use+"_modal_window_text_area",chars_left_title:theme_to_use+"_modal_window_chars_left",close_button:theme_to_use+"_modal_window_close_button",submit_button:theme_to_use+"_modal_window_submit_button",submit_button_hider:theme_to_use+"_modal_window_submit_button_hider",loader_icon:theme_to_use+"_modal_window_loader_icon",status_text:theme_to_use+"_modal_window_status_text",comm_block:theme_to_use+"_modal_window_comm_block",preview_block:theme_to_use+"_modal_window_preview_block"};theme.close_button_id=theme.ids.close_button;var avatar_cookie=HuffCookies.getCookie("huffpost_bigphoto");if(!avatar_cookie){if(this.UserData&&this.UserData.profile_picture)
avatar_cookie=this.UserData.profile_picture;else
avatar_cookie="http://s.huffpost.com/images/profile/user_placeholder.gif";}
theme.html="\
					<div id='"+theme.ids.top_container+"' class='twitter_modal_window_new linkedin_modal_window_new'>\
                        <div class='border_top'></div>\
                        <div class='main_container'>\
                                <div id='"+theme.ids.close_button+"' class='close_button'></div>\
                                <div class='title'><img class='img' src='/images/social-profile/lightbox2/hp_twitter_title_beta.png?v2'></div>\
                                <div id='"+theme.ids.chars_left_title+"' class='counter_container'></div>\
                                <div class='avatar' style='margin-right:1px;'><img style='border:1px solid #ccc;' src='"+avatar_cookie+"' width='48' height='48' /></div><div class='textarea_container'><textarea id='"+theme.ids.textarea+"' class='textarea'></textarea></div>\
                                <div style='clear: both;'></div>\
								<div class='preview_separator'></div>\
								<div class='linkedin_share_preview' id='"+theme.ids.preview_block+"'></div>\
                                <div id='"+theme.ids.comm_block+"' style='display: none;'>\
	                                <div class='checkbox_container'>\
	                                    <input id='"+theme.ids.comm_checkbox+"' type='checkbox'>\
	                                </div>\
	                                <div id='"+theme.ids.comm_text+"' class='checkbox_label_container'></div>\
	                                <div style='clear: both;'></div>\
	                            </div>\
                                <div class='submit_container'>\
                                    <div id='"+theme.ids.loader_icon+"' class='loader_icon'></div>\
                                    <div id='"+theme.ids.error_msg+"' class='error_msg'></div>\
                                    <div id='"+theme.ids.submit_button+"' class='submit_button'>&nbsp;</div>\
                                    <div id='"+theme.ids.status_text+"' class='status_text'></div>\
                                </div>\
                        </div>\
                        <div class='border_bottom'></div>\
                    </div>";}
return theme;},key_up_handler:function(){var maxlimit=this.linkedin_messg_limit;var textarea=$(this.modal_element_ids.textarea);var chars_left_title=$(this.modal_element_ids.chars_left_title);if(textarea.value.length>maxlimit){chars_left_title.innerHTML=0;}
else{chars_left_title.innerHTML=maxlimit-textarea.value.length;}},submit_handler:function()
{var oauth_token=null;var oauth_token_secret=null;if(this.AccessTokens)
{oauth_token=this.AccessTokens.oauth_token;oauth_token_secret=this.AccessTokens.oauth_token_secret;}
var textarea=$(this.modal_element_ids.textarea);var error_msg_div=$(this.modal_element_ids.error_msg);var linkedin_comment=textarea.value;if(linkedin_comment.length>this.linkedin_messg_limit){error_msg_div.innerHTML="Please shorten your comment text";textarea.focus();return false;}
this.show_sibmitting_proccess();var postdata='1=1';if(linkedin_comment)postdata+="&comment="+encodeURIComponent(linkedin_comment);postdata+="&eid="+this.entry_id;if(this.url)postdata+="&url="+this.url;if(this.title)postdata+="&title="+this.title;if(this.content)postdata+="&content="+this.content;if(this.thumbnail)postdata+="&thumbnail="+this.thumbnail;if(oauth_token&&oauth_token_secret){postdata+="&user_ot="+oauth_token+"&user_os="+oauth_token_secret;}
C.asyncRequest("POST","/badge/post_to_linkedin.php",{success:function(o){if(o.responseText&&/success/.test(o.responseText)){Sharer.Linkedin.show_successfull_final();}else{Sharer.Linkedin.show_failure_final();}},failure:function(o){Sharer.Linkedin.show_failure_final();HPError.e();},timeout:20000},postdata);},show_sibmitting_proccess:function(){var submit_button=$(this.modal_element_ids.submit_button);var loader_icon=$(this.modal_element_ids.loader_icon);var textarea=$(this.modal_element_ids.textarea);var checkbox=$(this.modal_element_ids.comm_checkbox);if(HPBrowser.isIE6()||HPBrowser.isIE7()){loader_icon.style.display="block";}
$(this.modal_element_ids.error_msg).innerHTML='';submit_button.style.display="none";loader_icon.style.display="block";textarea.disabled=true;return;},show_successfull_final:function(){var loader_icon=$(this.modal_element_ids.loader_icon);var status_text=$(this.modal_element_ids.status_text);if(HPBrowser.isIE6()||HPBrowser.isIE7()){loader_icon.style.display="none";}
loader_icon.style.display="none";status_text.innerHTML="Posted successfully on linkedin!";status_text.style.display="block";Sharer.Linkedin.AccessTokens=null;if(typeof Sharer.Linkedin.on_success=="function")
setTimeout(function(){Sharer.Linkedin.on_success(Sharer.Linkedin.on_success_params)},Sharer.Linkedin.on_success_timeout);},show_failure_final:function(){var loader_icon=$(this.modal_element_ids.loader_icon);var status_text=$(this.modal_element_ids.status_text);if(HPBrowser.isIE6()||HPBrowser.isIE7()){loader_icon.style.display="none";}
loader_icon.style.display="none";status_text.innerHTML="Unable to process your request!";status_text.style.display="block";Sharer.Linkedin.UserData="";Sharer.Linkedin.AccessTokens="";}}};Sharer.hp_amazing_video_module_fb_share=function(message,name,description,href,media_src)
{Sharer.Facebook.share({'facebook_post':{'message':message,'attachment':{'name':name,'description':description,'href':href,'media':[{'type':'image','src':media_src,'href':href}]},'callback':function(){}},'links':[]});};YAHOO.util.Event.onDOMReady(function(){Sharer.check_incomplete_sessions();});
var HuffPromo={placeholder:"huff_promo_space",placeholder_el:false,promo_displayed:false,init:function()
{if(this.placeholder_el)
return true;var el=$(this.placeholder);if(el)
this.placeholder_el=el;else
return false;return true},ieUpgradePromo:function()
{var ie_version=YAHOO.env.ua.ie;if(!this.init()||this.promo_displayed==true||ie_version!=6)
return;var promo_cookie=HuffCookies.getCookie('ieupgrade_promo');if(promo_cookie!="1")
{var promo_html="\
			<div>\
				<div class='close_promo_link'><a href='javascript:HuffPromo.closePromo(\"ie_upgrade\");'><img src='/images/close-black.png' /></a></div>\
				<div class='float_left ie_icon'></div>\
				<div class='float_left ie_icon_text'><span class='ie_promo_bold'>Enhance your web experience!</span>&nbsp;Huffpost recommends that users&nbsp;<a href='http://www.microsoft.com/nz/windows/internet-explorer/default.aspx' target='_blank'>upgrade to the latest version of Internet Explorer.</a></div>\
				<div class='ie_icon_link'></div>\
				<div class='clear'></div>\
			</div>\
			";var promo_el=document.createElement('div');promo_el.id="ieupgrade_promo";promo_el.className="ieupgrade_promo_main promo_blue";promo_el.innerHTML=promo_html;this.displayPromo('ieupgrade_promo',promo_el);}
return;},displayPromo:function(promo_name,el)
{if($('service_bottom_bar'))
return;if(el&&this.placeholder_el)
{this.placeholder_el.appendChild(el);this.promo_displayed=true;switch(promo_name)
{case"gbuzz_promo":var cookie_duration=24;HuffCookies.setCookie(promo_name,1,cookie_duration);break;default:break;}}
return;},closePromo:function(type)
{if(type=='ie_upgrade')
{el=$('ieupgrade_promo');var cookie_name="ieupgrade_promo";}
if(el&&this.placeholder_el)
{this.placeholder_el.removeChild(el);HuffCookies.setCookie(cookie_name,1);}
return;},chromeExtensionPromo:function()
{if(navigator.userAgent.toLowerCase().indexOf('chrome')>-1&&typeof(localStorage)!='undefined'&&localStorage['show-chrome-popup']!='0')
{var install_url='https://chrome.google.com/extensions/detail/oflealpdpfgibekadpjikgfmiphhdkdg';var dismiss=function()
{$('chrome_extension_promo').style.display='none';localStorage['show-chrome-popup']=0;}
var container=document.createElement('div');container.id='chrome_extension_promo';var label=document.createElement('span');label.innerHTML='Check out our <a id="goog_ch" href="'+install_url+'" target="_blank">Google Chrome Extension</a>. Get up to-the-minute reports, blogs and analysis with quick-view articles from all sections.';container.appendChild(label);var install_button=document.createElement('a');install_button.href=install_url;install_button.id='install_button';install_button.target='_blank';install_button.onclick=dismiss;container.appendChild(install_button);var close_button=document.createElement('a');close_button.href='#';close_button.id='close_button';close_button.onclick=dismiss;container.appendChild(close_button);document.body.insertBefore(container,document.body.firstChild);$('goog_ch').onclick=dismiss;HuffPromo.animateHuffPromo();}},animateHuffPromo:function()
{var container_id='chrome_extension_promo';$(container_id).style.display='block';var a=new Y.util.Anim(container_id,{height:{to:37}},1,Y.util.Easing.easeOut);a.animate();}};HuffPoUtil.onPageReady(function()
{HuffPromo.ieUpgradePromo();HuffPromo.chromeExtensionPromo();});
var UserLevels={BadgePopup:{timeout:500,badge_popup_timer_id:0,showBadgePopup:function(params){leftside_popup=params.leftside_popup||false;badge_el=params.badge_el||false;badge_el_offset_x=params.badge_el_offset_x||(leftside_popup?-302:28);badge_el_offset_y=params.badge_el_offset_y||(leftside_popup?170:55);user_name=params.user_name||false;user_type=params.user_type||false;user_level=params.user_level||0;comments_cnt=params.comments_cnt||0;fans_cnt=params.fans_cnt||0;friends_cnt=params.friends_cnt||0;following_cnt=params.following_cnt||0;shares_cnt=params.shares_cnt||0;twitter_id=params.twitter_id||0;facebook_id=params.facebook_id||0;level_aquired=params.level_aquired===false?false:true;hide_learn_more=params.hide_learn_more||false;sponsor_display_name=params.sponsor_display_name||'';if(this.badge_popup_timer_id){clearTimeout(this.badge_popup_timer_id);this.badge_popup_timer_id=0;}
var popup_div=(leftside_popup?$('left_badge_popup'):$('badge_popup'));var popup_text_div=(leftside_popup?$('left_badge_popup_text'):$('badge_popup_text'));var popup_top_div=(leftside_popup?$('left_badge_popup_top'):$('badge_popup_top'));if(!popup_div||!badge_el)return;var text="";if(leftside_popup){text+='<div class="badge_sprite big_badge_'+user_type+user_level+' margin_right_10 float_left"></div>';}
else{popup_top_div.innerHTML='<div class="badge_sprite big_badge_'+user_type+user_level+'"></div>';}
if(user_type=='sponsor')level_aquired=false;if(level_aquired){if(leftside_popup)text+='<div class="clear"></div>'
text+='<span class="'+user_type+'_title">'+user_name;}
var colored_user_name='<span class="'+user_type+'_name"><b>'+user_name+'</b></span>';switch(user_type){case'networker':if(level_aquired){text+=' is a Level '+user_level+' Networker!</span><br/><br/>';switch(user_level){case 1:text+=colored_user_name+' has earned the Level 1 Networker Badge! '+colored_user_name+' has <b>'+friends_cnt+' friends and '+fans_cnt+' followers</b>.';text+="<br/><br/>Networkers with a Level 1 Badge are very socially connected users on the site—with lots of friends and followers.";break;case 2:var social='';if((twitter_id>0)&&(facebook_id>0))social='Twitter and Facebook';else if(twitter_id>0)social='Twitter';else if(facebook_id>0)social='Facebook';text+=colored_user_name+' has earned the Level 2 Networker Badge! With <b>'+friends_cnt+' friends and '+fans_cnt+' followers</b>, '+colored_user_name+' has comments featured in red. '+colored_user_name+' has created a HuffPost account using '+social+'.';text+="<br/><br/>Networkers with a Level 2 Badge are among the most socially connected users on the site—with tons of friends and followers. They have also created a HuffPost account using Twitter or Facebook, and their comments are featured in red.";break;}}else{text+='Networkers are very socially connected users on the site—with lots of friends and followers! Users who connect with Facebook and Twitter can earn higher levels of this badge.';}
break;case'superuser':if(level_aquired){text+=' is a Level '+user_level+' Superuser!</span><br/><br/>';switch(user_level){case 1:text+=colored_user_name+' has earned the Level 1 Superuser Badge! '+colored_user_name+' has <b>'+comments_cnt+' comments</b> and <b>'+shares_cnt+' shares</b> to a social network.';break;case 2:var social='';if((twitter_id>0)&&(facebook_id>0))social='Twitter and Facebook';else if(twitter_id>0)social='Twitter';else if(facebook_id>0)social='Facebook';text+=colored_user_name+' has earned the Level 2 Superuser Badge! With <b>'+comments_cnt+' comments</b> and <b>'+shares_cnt+' shares</b> to a social network, '+colored_user_name+' has comments featured in purple. '+colored_user_name+' has created a HuffPost account using '+social+'.';break;}}else{text+='Superusers are very engaged users on the site-with lots of comments and shares! Users who connect with Facebook and Twitter can earn higher levels of this badge.';}
break;case'moderator':if(level_aquired){text+=' is a Level '+user_level+' Community Moderator!</span><br/><br/>';switch(user_level){case 1:text+=colored_user_name+' has earned the Level 1 Community Moderator Badge! '+colored_user_name+' flagged at least 20 comments that we deleted and has a high ratio of good flags to mistaken flags, so <span class="'+user_type+'_name">'+user_name+'\'s</span> flags carry five times the weight as standard flags.';break;case 2:text+=colored_user_name+' has earned the Level 2 Community Moderator Badge! '+colored_user_name+' flagged at least <b>100 comments</b> that we deleted and has a very high ratio of good flags to mistaken flags, so '+colored_user_name+' is trusted to delete inappropriate comments from the site. '+colored_user_name+' has maintained the ability to delete inappropriate comments by handling it responsibly.';break;}}else{text+='Moderators have flagged at least 20 comments that we deleted and have a strong ratio of good flags to mistaken flags. Their flags carry five times the weight as standard flags. Users who earn higher levels of the Moderator badge can directly delete comments.';}
break;case'expert':if(level_aquired){text='<span class="'+user_type+'_title">';text+=colored_user_name+' is a Politics Pundit!</span><br/><br/>';text+=colored_user_name+' has earned a Politics Pundit Badge. HuffPost Pundits are our most engaged and thought-provoking commenters. Pundit Badges are awarded based on a strong history of insightful comments.';}
break;case'predictor':text='<span class="'+user_type+'_title">';text+=colored_user_name+' is a Predictor!</span><br/><br/>';text+=colored_user_name+' has an amazing track record predicting the future on HuffPost\'s Predict the News -- play now!';break;case'pledge':if(level_aquired){switch(user_level){case 1:text='<span class="'+user_type+'_title">';text+=colored_user_name+' has taken the Third World America pledge!</span><br/><br/>';text+=colored_user_name+' pledges to rebuild the American Dream and prevent a Third World America.';break;}}
break;case'sponsor':text+='<span class="sponsor_badge_title">Sponsor Badge</span><br/><br/><div class="clear"></div>'
text+='<span class="arial_16 bold">What is this?</span><br/>This comments thread is brought to you by <span class="sponsor_name">'+sponsor_display_name+'</span>.<br/><br/>We offer our advertisers the opportunity to facilitate meaningful discussion around issues that are relevant to them and our community.<br/><br/>All sponsored comments are clearly marked as such and solely reflect the views of the advertiser. If you have feedback about sponsored comments, please <a href="#" class="sponsor_link">contact us</a>.';break;}
if(!hide_learn_more){text+='<br/><br/><a target="_hplink" class="'+user_type+'_link" href="http://www.huffingtonpost.com/p/frequently-asked-question.html#socialnews">Learn more about Badges</a>';}
popup_text_div.innerHTML=text;var badge_position=YAHOO.util.Dom.getXY(badge_el);var popup_x=badge_position[0]+badge_el_offset_x;var popup_y=badge_position[1]-badge_el_offset_y;popup_div.style.display='block';YAHOO.util.Dom.setXY(popup_div,[popup_x,popup_y]);YAHOO.util.Event.addListener(popup_div,'mouseover',this.onMouseOverBadgePopup,null,this);YAHOO.util.Event.addListener(popup_div,'mouseout',this.onMouseOutBadgePopup,null,this);},getActivePopupDiv:function(){var popup_div=$('badge_popup');if(!popup_div||(popup_div.style.display=='none')){popup_div=$('left_badge_popup');if(!popup_div||(popup_div.style.display=='none'))return null;}
return popup_div;},hideBadgePopup:function(){UserLevels.BadgePopup.badge_popup_timer_id=0;var popup_div=this.getActivePopupDiv();if(!popup_div)return;YAHOO.util.Event.purgeElement(popup_div);popup_div.style.display='none';YAHOO.util.Dom.setXY(popup_div,[-1000,-1000]);},cancelBadgePopupHiding:function(){if(this.badge_popup_timer_id){clearTimeout(this.badge_popup_timer_id);this.badge_popup_timer_id=0;}},onMouseOutBadge:function(){this.cancelBadgePopupHiding();this.badge_popup_timer_id=setTimeout('UserLevels.BadgePopup.hideBadgePopup()',this.timeout);},onMouseOverBadgePopup:function(e){var popup_div=this.getActivePopupDiv();if(!popup_div)return;var pointer=new YAHOO.util.Point(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));var popup_rec=YAHOO.util.Dom.getRegion(popup_div);var popup_body_rec=new YAHOO.util.Region(popup_rec.top,popup_rec.right+((popup_div.id=='left_badge_popup')?-35:0),popup_rec.bottom,popup_rec.left+40);if(popup_body_rec.contains(pointer)){this.cancelBadgePopupHiding();}},onMouseOutBadgePopup:function(e){this.cancelBadgePopupHiding();var popup_div=this.getActivePopupDiv();if(!popup_div)return;var pointer=new YAHOO.util.Point(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));var popup_rec=YAHOO.util.Dom.getRegion(popup_div);var popup_body_rec=new YAHOO.util.Region(popup_rec.top,popup_rec.right+((popup_div.id=='left_badge_popup')?-35:0),popup_rec.bottom,popup_rec.left+((popup_div.id=='left_badge_popup')?0:40));if(popup_body_rec.contains(pointer)){return;}
this.badge_popup_timer_id=setTimeout('UserLevels.BadgePopup.hideBadgePopup()',this.timeout);},onBadgeClick:function(user_name){new_window=window.open('http://www.huffingtonpost.com/p/frequently-asked-question.html#socialnews','');new_window.focus();}},Agreement:{participation:false,badges_box_enabled:false,box_animation:false,activate:function(params){if(!HuffCookies.getUserId()){return;}
if(HPConfig.user_badges_participation){this.participation=true;}
if(params.slider==true){this.Slider.activate(this);}
if(params.checkbox){this.Checkbox.activate(this,params.checkbox.listen_on_id,params.checkbox.input_id);}},set_participation:function(mode){this.participation=mode;this.update_badges_box();},flip_participation:function(){this.set_participation(!this.get_participation());},get_participation:function(){return this.participation;},update_badges_box:function(){var box=$("all_user_levels");if(!box){return;}
if(!this.box_animation){this.box_animation=new Y.util.Anim(box,{},1.5,YAHOO.util.Easing.bounceOut);this.box_animation.onComplete.subscribe(function(){if(parseInt(Dom.getStyle(this.getEl(),"height"))<10){Dom.setStyle(this.getEl(),"display","none");}},this.box_animation,true);}
if(this.get_participation()){box.style.height="0px";box.style.display="block";this.box_animation.attributes={height:{from:0,to:134}};}else{this.box_animation.attributes={height:{from:134,to:0}};}
this.box_animation.animate();},update_server_side:function(){var url="/users/user_level_json.php?action=badges_participate&state="+(this.participation==true?"true":"false");var callbacks={cache:false,success:function(){},failure:function(){}};YAHOO.util.Connect.asyncRequest("GET",url,callbacks);},Checkbox:{A:false,activated:false,checkbox:false,nodeName:false,activate:function(A,listen_on_id,checkbox_id){this.A=A;if(!HuffCookies.getUserId()){return;}
this.checkbox=$(checkbox_id);if(!this.checkbox){return;}
if(HPBrowser.isIE6()||HPBrowser.isIE7()){if(!this.A.get_participation())this.checkbox.setAttribute("checked",false);else this.checkbox.setAttribute("checked",true);}else{if(!this.A.get_participation())this.checkbox.checked=false;else this.checkbox.checked=true;}
E.on(listen_on_id,"click",this.catch_click,null,this);this.activated=true;},catch_click:function(e){this.nodeName=(e.srcElement||e.target).nodeName.toLowerCase();this.A.flip_participation();this.Hint.show();this.change_state();this.A.Slider.change_state();this.A.update_server_side();},change_state:function(){if(!this.activated||!this.checkbox){return;}
if(this.nodeName!="input"){if(HPBrowser.isIE6()||HPBrowser.isIE7()){if(!this.A.get_participation())this.checkbox.setAttribute("checked",false);else this.checkbox.setAttribute("checked",true);}else{if(!this.A.get_participation())this.checkbox.checked=false;else this.checkbox.checked=true;}}},Hint:{activated:false,hint:false,animation:false,hint_timer:false,activate:function(){if(this.activated){return;}
if(!this.hint){this.hint=$("badge_participating_updated");if(!this.hint){return;}}
this.animation=new Y.util.Anim(this.hint,{},1.5,YAHOO.util.Easing.easeOut);this.animation.onComplete.subscribe(function(){if(Dom.getStyle(this.getEl(),"opacity")<0.5){Dom.setStyle(this.getEl(),"display","none");}},this.animation,true);this.activated=true;},show:function(){this.activate();if(!this.activated){return;}
this.animation.attributes={opacity:{from:0,to:1}};this.animation.animate();this.hint.style.display="block";clearTimeout(this.hint_timer);this.hint_timer=setTimeout('UserLevels.Agreement.Checkbox.Hint.hide()',3000);},hide:function(){this.activate();if(!this.activated){return;}
clearTimeout(this.hint_timer);this.animation.attributes={opacity:{from:1,to:0}};this.animation.animate();}}},Slider:{A:false,activated:false,slider_holder:false,amination:false,activate:function(A){this.A=A;this.slider_holder=$("badges_participate_slider");if(!this.slider_holder){return;}
if(this.A.get_participation()){this.slider_holder.style.backgroundPosition="0px 0px";}else{this.slider_holder.style.backgroundPosition="-70px 0px";}
this.Tip.activate();this.animation=new Y.util.Anim(this.slider_holder,{},.7,YAHOO.util.Easing.bounceOut);this.animation.onTween.subscribe(function(){this.getEl().style.backgroundPosition=this.getEl().style.top+" 0";},this.animation,true);E.on("badges_participate_slider","click",this.catch_click,null,this);$("badges_participate_switcher").style.display="block";this.activated=true;},catch_click:function(){this.A.flip_participation();if(!this.A.get_participation()){this.Tip.show();}
this.change_state();this.A.Checkbox.change_state();this.A.update_server_side();},change_state:function(){if(!this.activated||!this.slider_holder){return;}
if(this.A.get_participation()){this.animation.attributes={top:{from:-70,to:0}};}else{this.animation.attributes={top:{from:0,to:-70}};}
this.animation.animate();},Tip:{state:false,activated:false,tip:false,triangle:false,close_button:false,animation:false,tri_animation:false,tip_timer:false,activate:function(){if(this.activated)return;if(!this.tip){this.tip=$("badges_participate_tip");if(!this.tip){return;}}
if(!this.close_button){this.close_button=$("badges_participate_tip_close");if(!this.close_button){return;}}
if(!this.triangle){this.triangle=$("badges_participate_tip_triangle");if(!this.triangle){return;}}
Dom.setStyle(this.tip,"display","none");Dom.setStyle(this.triangle,"display","none");E.on(this.close_button,"click",this.hide,null,this);this.animation=new Y.util.Anim(this.tip,{},1.5,YAHOO.util.Easing.easeOut);this.animation.onComplete.subscribe(function(){if(Dom.getStyle(this.getEl(),"opacity")<0.5){Dom.setStyle(this.getEl(),"display","none");}},this.animation,true);this.tri_animation=new Y.util.Anim(this.triangle,{},1.5,YAHOO.util.Easing.easeOut);this.tri_animation.onComplete.subscribe(function(){if(Dom.getStyle(this.getEl(),"opacity")<0.5){Dom.setStyle(this.getEl(),"display","none");}},this.tri_animation,true);this.activated=true;},show:function(){this.activate();if(!this.activated)return;Dom.setStyle(this.tip,"display","block");this.animation.attributes={opacity:{from:0,to:1}};this.animation.animate();Dom.setStyle(this.triangle,"display","block");this.tri_animation.attributes={opacity:{from:0,to:1}};this.tri_animation.animate();clearTimeout(this.tip_timer);this.tip_timer=setTimeout('UserLevels.Agreement.Slider.Tip.hide()',5000);},hide:function(){this.activate();if(!this.activated)return;clearTimeout(this.tip_timer);this.animation.attributes={opacity:{from:1,to:0}};this.animation.animate();this.tri_animation.attributes={opacity:{from:1,to:0}};this.tri_animation.animate();}}}}};
function PopUp(params){this.activated=false;this.wrong_params=false;this.opts={};this.holders={};var args_to_get=["display_mode","lazy_init","place_type","offset","position","timeout_id","popup_event_callback"];var args_amount=args_to_get.length,property;for(var a=0;a<args_amount;a++){property=args_to_get[a];if(params[property]){this.opts[property]=params[property];}}
if(!this.opts.place_type){this.wrong_params=true;return false;}
var tmp=$(params.target);if(!tmp){this.opts.lazy_init=true;}else{this.holders.target_id=params.target;this.holders.target=tmp;}
if(!params.trigger){params.trigger=[];}else if(!Y.lang.isArray(params.trigger)){params.trigger=[params.trigger];}
this.holders.triggers={};this.holders.triggers_ids=[];var _len=params.trigger.length,_test;for(var _i=0;_i<_len;_i++){_test=$(params.trigger[_i]);if(_test){this.holders.triggers[params.trigger[_i]]=_test;this.holders.triggers_ids.push(params.trigger[_i]);}}
if(!this.opts.timeout){this.opts.timeout=500;}
if(this.opts.display_mode){this.opts.display_mode="advanced";}
switch(this.opts.place_type){case"at_position":if(!params.position){this.wrong_params=true;return false;}
this.opts.position=params.position;break;case"near_trigger":if(!params.offset){this.wrong_params=true;return false;}
this.opts.offset=params.offset;break;}
if(!this.opts.lazy_init){this.activate();}};PopUp.prototype={};PopUp.prototype.activate=function(){if(this.activated)return true;if(this.wrong_params)return false;var holder_id="popup_"+this.holders.target_id;var holder=document.createElement("div");this.holders.holder_id=holder_id;this.holders.holder=holder;holder.setAttribute("id",holder_id);Dom.setStyle(holder,"display","none");Dom.setStyle(holder,"zIndex","4");switch(this.opts.place_type){case"at_position":Dom.setStyle(holder,"position","absolute");Dom.setXY(holder,[this.opts.position.x,this.opts.position.y]);break;case"near_trigger":Dom.setStyle(holder,"position","absolute");break;}
if(this.opts.display_mode=="advanced"){}
this.holders.target.parentNode.appendChild(holder);this.holders.target.parentNode.removeChild(this.holders.target);holder.appendChild(this.holders.target);E.on(holder,"mouseover",this.show,{esource:"holder"},this);E.on(holder,"mouseout",this.start_hide,{esource:"holder"},this);var _len=this.holders.triggers_ids.length,trigger;for(var _i=0;_i<_len;_i++){E.on(this.holders.triggers[this.holders.triggers_ids[_i]],"mouseover",this.show,{esource:"trigger",trigger_id:this.holders.triggers_ids[_i]},this);E.on(this.holders.triggers[this.holders.triggers_ids[_i]],"mouseout",this.start_hide,{esource:"trigger",trigger_id:this.holders.triggers_ids[_i]},this);}
this.activated=true;};PopUp.prototype.addTrigger=function(trigger_id){var trigger=$(trigger_id);if(!trigger)return false;this.holders.triggers_ids.push(trigger_id);this.holders.triggers[trigger_id]=trigger;E.on(trigger,"mouseover",this.show,{esource:"trigger",trigger_id:trigger_id},this);E.on(trigger,"mouseout",this.start_hide,{esource:"trigger",trigger_id:trigger_id},this);};PopUp.prototype.setTarget=function(target_id){var tmp=$(target_id);if(!tmp){return false;}
this.holders.target_id=target_id;this.holders.target=tmp;this.activate();};PopUp.prototype.show=function(e,params){this.cancelHiding();Dom.setStyle(this.holders.holder,"display","block");if(this.opts.display_mode=="advanced"){Dom.setStyle(this.holders.target,"display","block");}
if(this.opts.place_type=="near_trigger"&&params.esource=="trigger"){var trigger_pos=Dom.getXY(this.holders.triggers[params.trigger_id]);Dom.setXY(this.holders.holder,[parseInt(trigger_pos[0])+parseInt(this.opts.offset.x),parseInt(trigger_pos[1])+parseInt(this.opts.offset.y)]);if(this.opts.popup_event_callback){this.opts.popup_event_callback.funct.apply(this.opts.popup_event_callback.scope,[{"trigger_id":params.trigger_id},this.opts.popup_event_callback.params]);}}
clearTimeout(this.timeout_id);};PopUp.prototype.cancelHiding=function(){if(this.timeout_id){clearTimeout(this.timeout_id);this.timeout_id=0;}},PopUp.prototype.start_hide=function(e,params){this.cancelHiding();var _this=this;this.timeout_id=setTimeout(function(){_this.hide()},this.opts.timeout);};PopUp.prototype.hide=function(){Dom.setStyle(this.holders.holder,"display","none");if(this.opts.display_mode=="advanced"){Dom.setStyle(this.holders.target,"display","none");}
clearTimeout(this.timeout_id);};
var ConnectOverview={social_inner_logo:'/images/social/benefits/social_logo_inner.png',config:null,current_page:null,interval_id:null,auto_paging_timeout_id:null,continue_slideshow:true,showBenefits:function(params)
{var type=params.provider||null;this.configureModal(type);this.clearIntervals();this.auto_paging_timeout_id=setTimeout(function(){ConnectOverview.startAutoPaging();},5000);return;},configureModal:function(provider)
{var page_path="/images/social/benefits/"+provider+"/";switch(provider)
{case"facebook":var config={type:'facebook',text:'Connect to the Huffington Post through Facebook',slides:[page_path+"facebook_benefit1.jpg",page_path+"facebook_benefit2.jpg",page_path+"facebook_benefit3.jpg"]};break;case"twitter":var config={type:'twitter',text:'Connect to the Huffington Post through Twitter',slides:[page_path+"twitter_benefit1.jpg",page_path+"twitter_benefit2.jpg",page_path+"twitter_benefit3.jpg",page_path+"twitter_benefit4.jpg"]};break;case"signup":var config={type:'signup',text:'Connect to the Huffington Post through:',slides:[page_path+"signup_benefit1.jpg",page_path+"signup_benefit2.jpg",page_path+"signup_benefit3.jpg",page_path+"signup_benefit4.jpg",page_path+"signup_benefit5.jpg"]};break;default:return;}
if(config){this.config=config;var html=this.getHtml();this.showLightbox(html);}
return;},showLightbox:function(html){var _this=this;var SNP=QuickSNProject;var onclose_cb=function(){ConnectOverview.clearIntervals(_this);};SNP.showModal(html,{social_logo_inner:this.social_inner_logo,width:680,inner_class:'social_benefit_modal',cb:onclose_cb});if(_this.config.type=='signup')
{E.onAvailable("benefits_lb",function(o){E.addListener("sup_fb_login_btn","click",function(){linkSocialAccount.checkLoginStatus('facebook');});E.addListener("sup_tw_login_btn","click",function(){linkSocialAccount.checkLoginStatus('twitter');});E.addListener("sup_show_options_btn","mouseover",function(){Dom.removeClass('sup_hover_buttons','display_none');});E.addListener("sup_hover_buttons","mouseover",function(){Dom.removeClass('sup_hover_buttons','display_none');});E.addListener("sup_show_options_btn","mouseout",function(){Dom.addClass('sup_hover_buttons','display_none');});E.addListener("sup_hover_buttons","mouseout",function(){Dom.addClass('sup_hover_buttons','display_none');});E.addListener("sup_google_acc","click",function(){linkSocialAccount.checkLoginStatus('google');});E.addListener("sup_huffpo_acc","click",function(){SNProject.joinCheckingUserStatus();return false;});E.addListener("sup_yahoo_acc","click",function(){linkSocialAccount.checkLoginStatus('yahoo');});if($('sup_in_login_btn'))E.addListener("sup_in_login_btn","click",function(){linkSocialAccount.checkLoginStatus('linkedin');});return;},this);}
E.onAvailable("benefits_lb",function(o){E.addListener("slideshow_div","mouseover",function(){o.continue_slideshow=false;});E.addListener("slideshow_div","mouseout",function(){o.continue_slideshow=true;});return;},this);return;},showPage:function(p){for(var i=0;i<this.config.slides.length;i++)
{if(i==p){Dom.removeClass('benefit_slide_'+i,"display_none");Dom.replaceClass('benefit_page_'+i,"active_page_link","passive_page_link");E.removeListener('benefit_page_'+i,"click");this.current_page=p;}
else{Dom.addClass('benefit_slide_'+i,"display_none");Dom.replaceClass('benefit_page_'+i,"passive_page_link","active_page_link");E.addListener('benefit_page_'+i,"click",function(e,obj){ConnectOverview.showPage(obj.page);},{page:i});}}
return;},prevPage:function(){var page=this.current_page-1;if(page<0)
page=(this.config.slides.length-1);this.showPage(page);},nextPage:function(){var page=this.current_page+1;if(page>=this.config.slides.length)
page=0;this.showPage(page);},autoPaging:function()
{if(!this.continue_slideshow)return;this.nextPage();return;},getHtml:function()
{var config=this.config;var html="";var paging_html="";var content_html="";var button_html="";var p=1;content_html+='<div class="float_left benefit_bg benft_left_arr" onclick="ConnectOverview.prevPage();"></div>';for(var i=0;i<config.slides.length;i++)
{if(i==0){content_html+='<div class="single_slide float_left" id="benefit_slide_'+i+'"><img id="benefit_img_src_'+i+'" src="'+config.slides[i]+'" /></div>';paging_html+='<span class="benefit_pages passive_page_link" id="benefit_page_'+i+'">'+p+'</span>';this.current_page=i;}
else{content_html+='<div class="single_slide float_left display_none" id="benefit_slide_'+i+'"><img id="benefit_img_src_'+i+'" src="'+config.slides[i]+'" /></div>';paging_html+='<span class="benefit_pages active_page_link" id="benefit_page_'+i+'" onclick="ConnectOverview.showPage('+i+')">'+p+'</span>';}
p++;}
content_html+='<div class="float_left benefit_bg benft_right_arr" onclick="ConnectOverview.nextPage();"></div>';content_html+='<div class="clear" style="clear:both;"></div>';html+='<div class="social_benefits social_benefits_lightbox" id="benefits_lb">';html+='<div class="social_link_text center">'+config.text+'</div>';var added_class="";if(config.type=='signup')
{button_html+=this.linkButtons_v2();added_class="sup_hover_links_v2";button_html+='<br class="clear" />';button_html+='<div class="display_none sup_hover_links '+added_class+'" id="sup_hover_buttons">';button_html+='<div class="sup_hover_text">Connect with:</div>';button_html+='<div class="sup_hover_inner">';button_html+='<div class="sup_hover_link cursor_pointer" id="sup_google_acc"><div class="float_left sup_small_buttons sup_google_btn"></div><div class="sup_tiny_btn_text">Google Account</div><div class="clear"></div></div>';button_html+='<div class="sup_hover_link cursor_pointer" id="sup_huffpo_acc"><div class="float_left sup_small_buttons sup_huffpo_btn"></div><div class="sup_tiny_btn_text">HuffPost Account</div><div class="clear"></div></div>';button_html+='<div class="sup_hover_link cursor_pointer" id="sup_yahoo_acc"><div class="float_left sup_small_buttons sup_yahoo_btn"></div><div class="sup_tiny_btn_text">Yahoo Account</div><div class="clear"></div></div>';button_html+='</div>';button_html+='</div>';}
else
{button_html='<div class="center"><a href="javascript:void(0);" onclick="linkSocialAccount.checkLoginStatus(\''+config.type+'\')"><img src="/images/social/benefits/'+config.type+'_button_big.png" /></a></div>';}
html+=button_html;html+='<div class="benefit_paging" style="text-align:right">'+paging_html+'<div class="clear"></div></div>';html+='<div class="benefit_slides" id="slideshow_div">'+content_html+'</div>';html+='<div class="clear"></div><br class="clear" />';html+='</div>';return html;},linkButtons_v1:function()
{var button_html="";button_html+='<div class="sup_main_btns float_left">';button_html+='<div id="sup_fb_login_btn" class="float_left sup_bg_btns sup_fb_btn cursor_pointer"></div>';button_html+='<div id="sup_tw_login_btn" class="float_left sup_bg_btns sup_tw_btn cursor_pointer"></div>';button_html+='<br class="clear" /></div>';button_html+='<div id="sup_show_options_btn" class="float_left sup_bg_btns sup_option_btn cursor_pointer"></div>';return button_html;},linkButtons_v2:function()
{var button_html="";button_html+='<div class="sup_main_btns float_left">';button_html+='<div id="sup_fb_login_btn" class="float_left sup_bg_btns_v2 sup_fb_btn_v2 cursor_pointer"></div>';button_html+='<div id="sup_tw_login_btn" class="float_left sup_bg_btns_v2 sup_tw_btn_v2 cursor_pointer"></div>';button_html+='<div id="sup_in_login_btn" class="float_left sup_bg_btns_v2 sup_in_btn_v2 cursor_pointer"></div>';button_html+='<br class="clear" /></div>';button_html+='<div id="sup_show_options_btn" class="float_left sup_bg_btns_v2 sup_option_btn_v2 cursor_pointer"></div>';return button_html;},startAutoPaging:function(){this.interval_id=self.setInterval(function(){ConnectOverview.autoPaging();},5000);},clearIntervals:function(_this){var obj=_this||this;if(obj.auto_paging_timeout_id)clearTimeout(obj.auto_paging_timeout_id);if(obj.interval_id)clearInterval(obj.interval_id);}};
var FriendsManager={counter:0,holders:{friendshipControls:{}},fan_ids:[],fan_list:{},current_fan:{},forceAttachControlHolders:false,callback:false,simpleUpdateRelation:function(fan_id,action){this.detachFriendshipControlListeners(fan_id);this.showFriendshipControlLoader(fan_id);var callbacks={success:function(o){response=JSON.parse(o.responseText);if(typeof(response)=="object"||o.responseText=="[]"){this.deactivateFriendshipControl(fan_id,this.current_action);this.attachFriendshipControlListeners(fan_id);this.hideFriendshipControlLoader(fan_id);}},failure:function()
{},scope:this};this.current_action=action;var url="/users/friend_relations.php?fan_id="+fan_id+"&action="+action;YAHOO.util.Connect.asyncRequest("GET",url,callbacks);FriendsPagination.exclude_fan_ids.push(fan_id);return;},showMessageDiv:function(message,counter)
{pop_message=$("friend_fan_main_pop_message");Dom.setStyle(pop_message,"display","block");var sub_message_box="friend_sub_message_"+counter;var new_div=document.createElement("div");new_div.className="friend_sub_message";new_div.id=sub_message_box;Dom.setStyle(new_div,"height","0px");Dom.setStyle(new_div,"overflow","hidden");new_div.innerHTML=message;pop_message.appendChild(new_div);var attributes={height:{to:20}};var anim=new YAHOO.util.Anim(sub_message_box,attributes,0.7,YAHOO.util.Easing.easeIn);anim.animate();setTimeout("FriendsManager.hideSubMsgDiv('"+new_div.id+"')",10000);return;},hideSubMsgDiv:function(div_id)
{var pop_message=$("friend_fan_main_pop_message");if($(div_id))
{var msg_div_height=$(div_id).style.height;if(msg_div_height=="20px")
{var attributes={height:{to:0}};var anim=new YAHOO.util.Anim(div_id,attributes,0.7,YAHOO.util.Easing.easeIn);anim.animate();$(div_id).style.border="0px";setTimeout("FriendsManager.removeElement('"+div_id+"')",2000);}}
return;},removeElement:function(div_id)
{var pop_message=$("friend_fan_main_pop_message");var subpop_message=$(div_id);if(subpop_message)
{var msg_div_height=subpop_message.style.height;if(msg_div_height=="0px")
{pop_message.removeChild(subpop_message);}}
return;},findFriendshipControlHolders:function(fan_id){if(this.holders.friendshipControls&&this.holders.friendshipControls[fan_id]&&!this.forceAttachControlHolders)return;holder=$("single_fan_of_user_"+fan_id);text_holder=$("hover_link_"+fan_id);control_holder=$("hover_link_control_"+fan_id);loader_holder=$("hover_link_control_loader_"+fan_id);control_accept_holder=$("hover_link_control_accept_"+fan_id);control_ignore_holder=$("hover_link_control_ignore_"+fan_id);control_friends_holder=$("hover_link_control_friends_"+fan_id);if(!holder||!text_holder||!control_holder||!loader_holder)return;if(!control_accept_holder||!control_ignore_holder||!control_friends_holder)return;this.holders.friendshipControls[fan_id]={whole:holder,text:text_holder,control:control_holder,loader:loader_holder,control_accept:control_accept_holder,control_ignore:control_ignore_holder,control_friends:control_friends_holder};},attachFriendshipControlListeners:function(fan_id){var fan_ids=fan_id?[fan_id]:this.fan_ids,i,fan_id;for(i=0;i<fan_ids.length;i++){fan_id=fan_ids[i];this.findFriendshipControlHolders(fan_id);if(!this.holders.friendshipControls[fan_id])continue;E.on(this.holders.friendshipControls[fan_id].whole,"mouseover",function(e,fan_id){FriendsManager.showFriendshipControl(fan_id);return false;},fan_id,this);E.on(this.holders.friendshipControls[fan_id].whole,"mouseout",function(e,fan_id){FriendsManager.hideFriendshipControl(fan_id);return false;},fan_id,this);E.on(this.holders.friendshipControls[fan_id].control_accept,"click",function(e,fan_id){FriendsManager.simpleUpdateRelation(fan_id,"accept");return false;},fan_id,this);E.on(this.holders.friendshipControls[fan_id].control_ignore,"click",function(e,fan_id){FriendsManager.simpleUpdateRelation(fan_id,"ignore");return false;},fan_id,this);E.on(this.holders.friendshipControls[fan_id].control_friends,"click",function(e,fan_name){window.location="/social/"+fan_name+"?action=fans";return false;},this.fan_list[fan_id].name,this);}},attachControlListeners:function(fan_id,fan_list){holder=$("single_fan_of_user_"+fan_id);text_holder=$("hover_link_"+fan_id);control_holder=$("hover_link_control_"+fan_id);loader_holder=$("hover_link_control_loader_"+fan_id);control_accept_holder=$("hover_link_control_accept_"+fan_id);control_ignore_holder=$("hover_link_control_ignore_"+fan_id);control_friends_holder=$("hover_link_control_friends_"+fan_id);if(!holder||!text_holder||!control_holder||!loader_holder)return;if(!control_accept_holder||!control_ignore_holder||!control_friends_holder)return;this.holders.friendshipControls[fan_id]={whole:holder,text:text_holder,control:control_holder,loader:loader_holder,control_accept:control_accept_holder,control_ignore:control_ignore_holder,control_friends:control_friends_holder};this.fan_list[fan_id]={name:fan_list.name,display_name:fan_list.display_name,avatar:fan_list.avatar};E.on(this.holders.friendshipControls[fan_id].whole,"mouseover",function(e,fan_id){FriendsManager.showFriendshipControl(fan_id);return false;},fan_id,this);E.on(this.holders.friendshipControls[fan_id].whole,"mouseout",function(e,fan_id){FriendsManager.hideFriendshipControl(fan_id);return false;},fan_id,this);E.on(this.holders.friendshipControls[fan_id].control_accept,"click",function(e,fan_id){FriendsManager.simpleUpdateRelation(fan_id,"accept");return false;},fan_id,this);E.on(this.holders.friendshipControls[fan_id].control_ignore,"click",function(e,fan_id){FriendsManager.simpleUpdateRelation(fan_id,"ignore");return false;},fan_id,this);E.on(this.holders.friendshipControls[fan_id].control_friends,"click",function(e,fan_name){window.location="/social/"+fan_name+"?action=fans";return false;},this.fan_list[fan_id].name,this);},detachFriendshipControlListeners:function(fan_id){var fan_ids=fan_id?[fan_id]:this.fan_ids,i,fan_id;for(i=0;i<fan_ids.length;i++){fan_id=fan_ids[i];if(!this.holders.friendshipControls[fan_id])continue;E.removeListener(this.holders.friendshipControls[fan_id].whole,"mouseover");E.removeListener(this.holders.friendshipControls[fan_id].whole,"mouseout");E.removeListener(this.holders.friendshipControls[fan_id].control_accept,"click");E.removeListener(this.holders.friendshipControls[fan_id].control_ignore,"click");E.removeListener(this.holders.friendshipControls[fan_id].control_friends,"click");}},deactivateFriendshipControl:function(fan_id,action){if(!this.holders.friendshipControls[fan_id])return;var control=this.holders.friendshipControls[fan_id].control;var message="Friend with";if(action=="ignore")
message="Ignored";message+=" ";while(control.childNodes.length){control.removeChild(control.firstChild);}
control.appendChild(document.createTextNode(message));var link=document.createElement("a");link.href="/social/"+this.fan_list[fan_id].name;link.innerHTML=this.fan_list[fan_id].display_name;control.appendChild(link);Dom.setStyle(control,"marginLeft","50px");},showFriendshipControl:function(fan_id){if(!this.holders.friendshipControls[fan_id])return;var holders=this.holders.friendshipControls[fan_id];holders.text.style.display="none";holders.control.style.display="block";holders.loader.style.display="none";return;},hideFriendshipControl:function(fan_id){if(!this.holders.friendshipControls[fan_id])return;var holders=this.holders.friendshipControls[fan_id];holders.text.style.display="block";holders.control.style.display="none";return;},showFriendshipControlLoader:function(fan_id){if(!this.holders.friendshipControls[fan_id])return;var holders=this.holders.friendshipControls[fan_id];holders.text.style.display="none";holders.control.style.display="none";holders.loader.style.display="block";return;},hideFriendshipControlLoader:function(fan_id){if(!this.holders.friendshipControls[fan_id])return;var holders=this.holders.friendshipControls[fan_id];holders.text.style.display="block";holders.control.style.display="none";holders.loader.style.display="none";return;}
};var FriendsPagination={total_friends_pages:null,total_fans_pages:null,total_favored_pages:null,profile_user_id:null,attach_fan_hover_listeners:false,on_my_profile:false,sort:null,exclude_fan_ids:[],exclude_friends_ids:[],exclude_favored_ids:[],init:function(config)
{this.total_friends_pages=config.total_friends_pages;this.total_fans_pages=config.total_fans_pages;this.total_favored_pages=config.total_favored_pages;this.profile_user_id=config.profile_user_id;this.attach_fan_hover_listeners=config.attach_fan_hover_listeners||false;this.on_my_profile=config.on_my_profile||false;this.sort=config.sort||"newest";this.exclude_fan_ids=[];this.exclude_friends_ids=[];this.exclude_favored_ids=[];var els=Dom.getElementsByClassName("profile_base_pagination");for(var i=0;i<els.length;i++)
{Dom.removeClass(els[i],"display_none");}
return;},viewFriendPage:function(page_num)
{this.loadPage("friends",page_num,this.total_friends_pages);return;},viewFanPage:function(page_num)
{this.loadPage("fans",page_num,this.total_fans_pages);return;},viewFavoredPage:function(page_num)
{this.loadPage("favored",page_num,this.total_favored_pages);return;},loadPage:function(type,page_num,total_pages)
{var div_id="profile_"+type+"_module";if($(div_id)&&page_num>0)
{var el=$(div_id);var stash=el.innerHTML;el.innerHTML="<div class=\"profile_page_loader\"><div class=\"page_loader_text\">Loading</div><div class=\"page_loader_image\"><img src=\"/images/spinner.gif\"></div></div>";var get_data="?type="+type+"&page_num="+page_num+"&total_pages="+total_pages+"&profile_user_id="+this.profile_user_id+"&sort="+this.sort;var url="/users/social_news_project/profile/load_friends.php"+get_data;var callback={success:function(o)
{FriendsPagination.loadFriendsSuccess(o,el,stash,type);},failure:function()
{FriendsPagination.loadFriendsFailure(el,stash);}};YAHOO.util.Connect.asyncRequest("GET",url,callback);}
return;},loadFriendsSuccess:function(o,el,html,type)
{if(o.responseText!="")
{var resp=JSON.parse(o.responseText);if(/success/.test(resp.status))
{el.innerHTML=resp.html;if(FriendsPagination.on_my_profile&&type=="fans"&&FriendsPagination.attach_fan_hover_listeners&&resp.fan_ids&&resp.fan_list)
{var fan_id_obj=JSON.parse(resp.fan_ids);var fan_list_obj=JSON.parse(resp.fan_list);var exclude_str=FriendsPagination.exclude_fan_ids.join();for(var i=0;i<fan_id_obj.length;i++)
{if(exclude_str.indexOf(fan_id_obj[i])==-1)
FriendsManager.attachControlListeners(fan_id_obj[i],fan_list_obj[fan_id_obj[i]]);}}
if(FriendsPagination.on_my_profile&&(type=="friends"||type=="favored"))
{var controls=Dom.getElementsByClassName('fansremoveitem');for(var i=0;i<controls.length;i++)
{controls[i].style.display='inline';}
var removed_favored_ids=FriendsPagination.exclude_favored_ids;for(var i=0;i<removed_favored_ids.length;i++)
{var fav_link=$('fan_remove_'+removed_favored_ids[i]);if(fav_link)
fav_link.innerHTML='<a href="#" onclick="javascript:void(0);return false;"><img class="remove_fan" border="0" alt="Action taken" src="/images/profile/delete_icon_faded.gif"/></a>';}
var removed_friend_ids=FriendsPagination.exclude_friends_ids;for(var i=0;i<removed_friend_ids.length;i++)
{var fav_link=$('fan_remove_'+removed_friend_ids[i]);if(fav_link)
fav_link.innerHTML='<a href="#" onclick="javascript:void(0);return false;"><img class="remove_fan" border="0" alt="Action taken" src="/images/profile/delete_icon_faded.gif"/></a>';}}}
else
FriendsPagination.loadFriendsFailure(el,html);}
else
FriendsPagination.loadFriendsFailure(el,html);},loadFriendsFailure:function(el,html)
{alert("Unable to process!");el.innerHTML=html;return;}};var SidebarRelations={init:function(config)
{this.friends=config.friends;this.fans=config.fans;this.favors=config.favors;this.profile_id=config.profile_id;return;},loadPage:function(rel,type)
{switch(rel)
{case"friends":var current_page=this.friends.current_page;var total_pages=this.friends.total_pages;break;case"fans":var current_page=this.fans.current_page;var total_pages=this.fans.total_pages;break;case"favors":var current_page=this.favors.current_page;var total_pages=this.favors.total_pages;break;}
if(type=='prev'){var page_num=current_page-1;if(page_num<1)return;}
else if(type=='next'){var page_num=current_page+1;if(page_num>total_pages)return;}
this.showPage(rel,type,current_page,page_num);this.setPage(rel,page_num);return;},showPage:function(rel,type,current_page,page_num){var old_el=$(rel+"_set_"+current_page);var new_el=$(rel+"_set_"+page_num);var el=$('new_sidebar_'+rel);if(new_el){this.fadeInAndOut(old_el,new_el);}else{this.hideControls(rel);var callbacks={success:function(o){var resp=JSON.parse(o.responseText);if(/success/.test(resp.message))
{var new_el=document.createElement('div');new_el.id=rel+"_set_"+page_num;new_el.className="relationship_set display_none";new_el.innerHTML=resp.html;el.appendChild(new_el);SidebarRelations.fadeInAndOut(old_el,new_el);if(resp.fan_ids&&resp.fan_ids.length)
SidebarRelations.attachEvents(resp.fan_ids);}else{alert("An error occurred while loading "+rel+"!");SidebarRelations.showPage(rel,type,current_page-1,current_page);SidebarRelations.setPage(rel,current_page);}
SidebarRelations.showControls(rel);return;},failure:function(){alert("An error occurred while loading "+rel+"!");SidebarRelations.showPage(rel,type,current_page-1,current_page);SidebarRelations.setPage(rel,current_page);HPError.e();SidebarRelations.showControls(rel);return;}};var url='/users/social_news_project/profile/load_sidebar_friends.php?uid='+this.profile_id+'&type='+rel+'&page='+page_num;if(SNPprofile.is_my_profile)
url+="&check_profile=current";C.asyncRequest("GET",url,callbacks);}},fadeInAndOut:function(fade_out_div,fade_in_div){var fadeOut=new YAHOO.util.Anim(fade_out_div,{opacity:{to:0}},0.5);var fadeIn=function(){Dom.replaceClass(fade_out_div,"display_block","display_none");Dom.replaceClass(fade_in_div,"display_none","display_block");var fadeIn=new YAHOO.util.Anim(fade_in_div,{opacity:{to:1}},0.5);fadeIn.animate();};fadeOut.onComplete.subscribe(fadeIn);fadeOut.animate();return;},hideControls:function(rel){var prev_el='prof_prev_'+rel+'_page';var next_el='prof_next_'+rel+'_page';var loading_el='right_'+rel+'_loading';Dom.replaceClass(loading_el,"display_none","display_block");Dom.setStyle(prev_el,"visibility","hidden");Dom.setStyle(next_el,"visibility","hidden");},showControls:function(rel){var prev_el='prof_prev_'+rel+'_page';var next_el='prof_next_'+rel+'_page';var loading_el='right_'+rel+'_loading';Dom.replaceClass(loading_el,"display_block","display_none");Dom.setStyle(prev_el,"visibility","visible");Dom.setStyle(next_el,"visibility","visible");},setPage:function(rel,page_num){switch(rel){case"friends":this.friends.current_page=page_num;var total_pages=this.friends.total_pages;break;case"fans":this.fans.current_page=page_num;var total_pages=this.fans.total_pages;break;case"favors":this.favors.current_page=page_num;var total_pages=this.favors.total_pages;break;}
var page_el=$('prof_'+rel+'_curr_page');var prev_el='prof_prev_'+rel+'_page';var next_el='prof_next_'+rel+'_page';if(page_num==1){Dom.replaceClass(prev_el,"prev_page_enabled","prev_page_disabled");Dom.replaceClass(next_el,"next_page_disabled","next_page_enabled");Dom.addClass(next_el,"cursor_pointer");Dom.removeClass(prev_el,"cursor_pointer");}
else if(page_num==total_pages){Dom.replaceClass(prev_el,"prev_page_disabled","prev_page_enabled");Dom.replaceClass(next_el,"next_page_enabled","next_page_disabled");Dom.addClass(prev_el,"cursor_pointer");Dom.removeClass(next_el,"cursor_pointer");}
else{Dom.replaceClass(prev_el,"prev_page_disabled","prev_page_enabled");Dom.replaceClass(next_el,"next_page_disabled","next_page_enabled");Dom.addClass(prev_el,"cursor_pointer");Dom.addClass(next_el,"cursor_pointer");}
page_el.innerHTML=page_num;return;},loadRightRailFanbase:function()
{var el=$("snp_fans_friends");el.innerHTML="<div class='loading_right_friends center'>Loading fan base <img src='/images/v/ajax-loader-video.gif'></div>";Dom.setStyle("snp_fans_friends","display","block");var callbacks={success:function(o){SidebarRelations.loadRightRailFanbaseSuccess(o,el);return;},failure:function(){SidebarRelations.loadRightRailFanbaseFailure(el);HPError.e();return;}};C.asyncRequest("GET",'/users/social_news_project/profile/load_fan_base_sidebar.php',callbacks);return;},loadRightRailFanbaseSuccess:function(o,el){if(o.responseText!=""){var resp=JSON.parse(o.responseText);if(/success/.test(resp.message)){el.innerHTML=resp.html;SidebarRelations.init(resp.config);SidebarRelations.attachEvents(resp.config.fan_ids);}
else
SidebarRelations.loadRightRailFanbaseFailure(el);}
else
SidebarRelations.loadRightRailFanbaseFailure(el);return;},loadRightRailFanbaseFailure:function(el){el.innerHTML="<div class='prof_right_error center'>Unable to load the fan base!</div>";return;},attachEvents:function(fan_ids){for(var i=0;i<fan_ids.length;i++){Dom.removeClass("right_rail_follower_"+fan_ids[i],"display_none");E.addListener($("right_rail_follower_"+fan_ids[i]),"click",function(e,fan_id){SidebarRelations.followUser(fan_id);return false;},fan_ids[i],this);}
return;},followUser:function(fan_id)
{var divid="right_rail_follower_"+fan_id;var el=$(divid);E.removeListener(el,"click");Dom.removeClass(divid,"right_follow_button");Dom.removeClass(divid,"cursor_pointer");el.innerHTML="<div class=\"add_follower_loading\"><img src='/images/spinner.gif' /></div>";var callbacks={success:function(o){if(o.responseText=='[]'){el.innerHTML="<div class=\"add_follower_done\">Followed</div>";}else{alert("An error occurred with the request!");Dom.addClass(divid,"right_follow_button");Dom.addClass(divid,"cursor_pointer");E.addListener(el,"click",function(e,fan_id){SidebarRelations.followUser(fan_id);return false;},fan_id,this);el.innerHTML="";}
return;},failure:function(){alert("Unable to process!");Dom.addClass(divid,"right_follow_button");Dom.addClass(divid,"cursor_pointer");E.addListener(el,"click",function(e,fan_id){SidebarRelations.followUser(fan_id);return false;},fan_id,this);el.innerHTML="";HPError.e();}};var url="/users/friend_relations.php?fan_id="+fan_id+"&action=accept";C.asyncRequest("GET",url,callbacks);return;}};var FriendsBanner={total_fan_ids:false,total_ids_related:new Array(),user_loads:false,load:function()
{var url="/users/social_news_project/profile/get_user_fans.php";if(this.user_loads){Dom.removeClass('loading_banner_main','display_none');}
var callback={success:function(o){var o_resp=JSON.parse(o.responseText);if(/success/.test(o_resp.status)){FriendsBanner.fan_config={};FriendsBanner.fan_config.fan_ids=JSON.parse(o_resp.fan_ids);FriendsBanner.fan_config.fan_list=JSON.parse(o_resp.fan_list);FriendsBanner.total_fan_ids=FriendsBanner.fan_config.fan_ids.length;if(FriendsBanner.total_fan_ids>0)
FriendsBanner.init();else
Dom.addClass("loading_banner_main","display_none");}else{if(FriendsBanner.user_loads)
$('loading_banner_main').innerHTML="Thanks! all done";}
return;},failure:function(){HPError.e();return;}}
C.asyncRequest("GET",url,callback);return;},init:function()
{this.holder_config={};this.holder_config.fan_banner_v2_holder=$('fan_banner_v2_holder')||false;this.holder_config.fan_overview_holder=$('fan_overview_holder')||false;this.holder_config.relation_banner_holder=$('relation_banner_holder')||false;this.holder_config.banner_fan_1=$('banner_fan_1')||false;this.holder_config.banner_fan_2=$('banner_fan_2')||false;this.holder_config.banner_fan_3=$('banner_fan_3')||false;if(!this.holder_config.banner_fan_3||!this.holder_config.banner_fan_2||!this.holder_config.banner_fan_1||!this.holder_config.relation_banner_holder||!this.holder_config.fan_overview_holder||!this.holder_config.fan_banner_v2_holder)return;var num=(this.total_fan_ids<3)?this.total_fan_ids:3;var mid_text=(num==1)?'&nbsp;new user is':'&nbsp;new people are';var last_text=" now following you on HuffPost Social News.";var fan_overview_holder_text=num+mid_text+last_text;this.holder_config.fan_overview_holder.innerHTML=fan_overview_holder_text;this.loadThreeUsers();Dom.removeClass("fan_banner_v2_holder","display_none");Dom.addClass("loading_banner_main","display_none");return;},loadThreeUsers:function()
{var id1=this.fan_config.fan_ids[0]||false;var id2=this.fan_config.fan_ids[1]||false;var id3=this.fan_config.fan_ids[2]||false;if(id1&&this.fan_config.fan_list[id1].id){this.prepareFan(id1,this.holder_config.banner_fan_1);}
if(id2&&this.fan_config.fan_list[id2].id){this.prepareFan(id2,this.holder_config.banner_fan_2);}
if(id3&&this.fan_config.fan_list[id3].id){this.prepareFan(id3,this.holder_config.banner_fan_3);}
return;},prepareFan:function(id,el,type){if(this.fan_config.fan_list[id]&&this.fan_config.fan_list[id].id){var pic=this.fan_config.fan_list[id].avatar;var big_name=this.fan_config.fan_list[id].name.replace('hp_blogger_','');var name=big_name;if(big_name.length>12)
name=big_name.substr(0,9)+"...";el.childNodes[0].firstChild.src=pic;el.childNodes[1].innerHTML="<a href=\"/social/"+this.fan_config.fan_list[id].name+"\" title=\""+big_name+"\">"+name+"</a>";E.removeListener(el.childNodes[2].firstChild,"click");E.removeListener(el.childNodes[2].lastChild,"click");E.addListener(el.childNodes[2].firstChild,"click",function(e,obj){FriendsBanner.updateRelation(obj.fan_id,obj.holder,"accept");return;},{fan_id:id,holder:el});E.addListener(el.childNodes[2].lastChild,"click",function(e,obj){FriendsBanner.updateRelation(obj.fan_id,obj.holder,"ignore");return;},{fan_id:id,holder:el});Dom.removeClass(el.childNodes[2],"visibility_hidden");this.resetFanConfig(id);if(type=='slow')
this.fadeInAndOut(el,el);else
Dom.removeClass(el,"visibility_hidden");}
return;},resetFanConfig:function(id){var fan_ids=new Array();for(var i=0;i<this.fan_config.fan_ids.length;i++)
{if(this.fan_config.fan_ids[i]!=id)
fan_ids.push(this.fan_config.fan_ids[i]);}
this.fan_config.fan_ids=fan_ids;this.fan_config.fan_list[id]={};return;},updateRelation:function(id,el,action){if(!id)return;this.showLoading('load');Dom.addClass(el.childNodes[2],"visibility_hidden");var url="/users/friend_relations.php?fan_id="+id+"&action="+action;C.asyncRequest("GET",url,{success:function(o){FriendsBanner.updateRelationSuccess(o,el,id,action);},failure:function(){HPError.e();return;}});},showLoading:function(type,msg){if(type=='load'){$('fan_banner_v2_loader').innerHTML="<span class='saving_relation'><img src=\"/images/spinner.gif\" />&nbsp;Loading...</span>";}
else if(type=='done'){$('fan_banner_v2_loader').innerHTML="<span class='saved_relation'>"+msg+"</span>";}
Dom.removeClass("fan_banner_v2_loader","display_none");return;},updateRelationSuccess:function(o,el,id,action){if(o.responseText=="[]"){var message=(action=='accept')?"Following user - ":"Ignored user - ";message+=el.childNodes[1].firstChild.title;FriendsBanner.showLoading('done',message);FriendsBanner.total_ids_related.push(id);FriendsPagination.exclude_fan_ids.push(id);FriendsManager.deactivateFriendshipControl(id,action);setTimeout(function(){FriendsBanner.loadNextFan(id,el);},1000);}
return;},loadNextFan:function(id,el)
{var acted_upon_count=this.total_ids_related.length;var fan_count_left=this.total_fan_ids-acted_upon_count;var num=(fan_count_left<3)?fan_count_left:3;var mid_text=(num==1)?'&nbsp;new user is':'&nbsp;new people are';var last_text=" now following you on HuffPost Social News.";var fan_overview_holder_text=num+mid_text+last_text;this.holder_config.fan_overview_holder.innerHTML=fan_overview_holder_text;var next_id=this.fan_config.fan_ids[0];if(next_id){Dom.addClass(el,"visibility_hidden");this.prepareFan(next_id,el,'slow');}
if(acted_upon_count==this.total_fan_ids){this.user_loads=true;this.total_fan_ids=false;this.total_ids_related=new Array();setTimeout(function(){Dom.addClass("fan_banner_v2_holder","display_none");FriendsBanner.load();},2000);}
return;},fadeInAndOut:function(hide,show){var fadeOut=new YAHOO.util.Anim(hide,{opacity:{to:0}},0.5);var fadeIn=function(){Dom.removeClass(show,"visibility_hidden");var fadeIn=new YAHOO.util.Anim(show,{opacity:{to:1}},0.5);fadeIn.animate();};fadeOut.onComplete.subscribe(fadeIn);fadeOut.animate();return;}};

/* From: wfe9-nyc : 23818 */