/*
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}
var HPFBConfig={FACEBOOK_COMMENTS_BUNDLE_ID:48114987133,FACEBOOK_PLEDGE_BUNDLE_ID:48114517133,FACEBOOK_JOIN_PLEDGE_BUNDLE_ID:48114517133,FACEBOOK_VOTE_BUNDLE_ID:81637352133,FACEBOOK_VOTEPREVIEW_BUNDLE_ID:53483022133,FACEBOOK_POLL_BUNDLE_ID:81637352133,FACEBOOK_SLIDESHOW_POLL_BUNDLE_ID:95176577133}
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){var expireString,timerObj,expireAt,pathString,domainString,secureString,setCookieString;if(!hoursToLive||typeof hoursToLive!='number'||parseInt(hoursToLive)=='NaN'){expireString="";}
else{timerObj=new Date();timerObj.setTime(timerObj.getTime()+(parseInt(hoursToLive)*60*60*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.getUserName=function(){return this.get(((/\.beta\./.test(location.hostname))?'beta'+location.port+'_huffpost_user':'huffpost_user'));};HuffCookies.getUserGuid=function(){return this.get(((/\.beta\./.test(location.hostname))?'beta'+location.port+'_huffpost_user_guid':'huffpost_user_guid'));};HuffCookies.getPass=function(){return this.get(((/\.beta\./.test(location.hostname))?'beta'+location.port+'_huffpost_pass':'huffpost_pass'));};HuffCookies.getLastLogin=function(){return this.get(((/\.beta\./.test(location.hostname))?'beta'+location.port+'_huffpost_lastlogin':'huffpost_lastlogin'));};HuffCookies.getBigAvatar=function(){var c=this.get(((/\.beta\./.test(location.hostname))?'beta'+location.port+'_huffpost_bigphoto':'huffpost_bigphoto'));if(!c||c==''){return'';}else{return c;}};HuffCookies.getSmallAvatar=function(){var c=this.get(((/\.beta\./.test(location.hostname))?'beta'+location.port+'_huffpost_smallphoto':'huffpost_smallphoto'));if(!c||c==''){return'';}else{return c;}};HuffCookies.getSNPstatus=function(){return this.get(((/\.beta\./.test(location.hostname))?'beta'+location.port+'_huffpost_snp_status':'huffpost_snp_status'));};HuffCookies.getReadTrackingStatus=function(){return this.get(((/\.beta\./.test(location.hostname))?'beta'+location.port+'_huffpost_snp_read':'huffpost_snp_read'));};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;return this.set(cookie_preffix+cookieName,value,ttl,'/','.'+domain);};HuffCookies.getCookie=function(cookieName){var cookie_preffix=(/\.beta\./.test(location.hostname))?'beta'+location.port+'_':'';var domain=location.hostname;domain=domain.replace(/www\./,'');return this.get(cookie_preffix+cookieName);};HuffCookies.domainCookie=function(){var domain=location.hostname;domain=domain.replace(/www\./,'');return domain;};HuffCookies.getUserId=function(){return this.get(((/\.beta\./.test(location.hostname))?'beta'+location.port+'_huffpost_user_id':'huffpost_user_id'));};HuffCookies.destroyCookie=function(name){var prefix=(/\.beta\./.test(location.hostname))?'beta'+location.port+'_':'';return this.del(prefix+name,'/','.'+HuffCookies.domainCookie());};
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 Y=YAHOO;var E=Y.util.Event;var R=Y.util.Region;var D=Y.util.Dom;var C=Y.util.Connect;if("undefined"==typeof(dont_identify_dget_function))
{var $=D.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 FloatingPrompt={type:'bottom',container:null,html_or_url:'',embed:function(container,html,url,type,params)
{this.type=type||this.type;params=params||{};var floating_prompt=document.createElement('div');if(params.width)
floating_prompt.style.width=params.width+'px';D.addClass(floating_prompt,'prompting_overlay');var embed_id=D.generateId(floating_prompt);E.on(floating_prompt,'mouseout',function(){if(this.parentNode){this.parentNode.removeChild(this);container.removeAttribute('floating_id');}});container.setAttribute('floating_id',embed_id);E.on(container,'mouseout',function(){if(D.get(this.getAttribute('floating_id'))){D.get(this.getAttribute('floating_id')).parentNode.removeChild(D.get(this.getAttribute('floating_id')));this.removeAttribute('floating_id');}});var arrow_style='';var type_embedding='';var 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;}
if(params.css)
{for(var parameter in params.css)
{D.setStyle(floating_prompt,parameter,params.css[parameter]);}}
if(''!=html)
{floating_prompt.innerHTML+=this._GetContent(arrow_style,html);document.body.appendChild(floating_prompt);HPUtil.ShowNearElement(type_embedding,container,floating_prompt,add_xy);}
else
{var me=this;C.asyncRequest('GET',url,{success:function(o){floating_prompt.innerHTML+=me._GetContent(arrow_style,o.responseText);document.body.appendChild(floating_prompt);HPUtil.ShowNearElement(type_embedding,container,floating_prompt,add_xy);},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':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'}}}},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_modules'))
{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.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.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)
{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);}
else if(e.show)
{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)
document.onfocusin=hpcallback;else
YAHOO.util.Event.addListener(document,"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)
document.onfocusout=hpcallback;else
YAHOO.util.Event.addListener(document,"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){var i;for(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:[],url_hashes:[],body_element:YAHOO.env.ua.gecko?document.documentElement:document.body,ShowNearElement:function(position,container,element_to_show,add_xy)
{var element_position=D.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;}
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(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,D.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':'images.huffingtonpost.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){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){D.setStyle(id,'display','none');},show:function(id,type){if(typeof(type)=="undefined")
type='block';D.setStyle(id,'display',type);},show_inline:function(id){D.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){D.batch(id,function(el){if(el.style.display=='none')el.style.display='block';else el.style.display='none';});},toggleReply:function(id){D.batch('reply_'+id,function(el){if(el.style.display=='none')el.style.display='block';else el.style.display='none';});},toggleTopPosts:function(caller){if(!D.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(D.hasClass(el1,className))
{D.addClass(el2,className);D.removeClass(el1,className);}
else
{D.addClass(el1,className);D.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(){D.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(){D.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){url=url.replace(/%n/,ord);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;},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()||!HuffCookies.getUserName())return;if(HuffCookies.getSNPstatus()==1)
{D.addClass(document.body,'sn_signed_in');}
var this_user_profile_link=HuffCookies.getSNPstatus()?'/social/':'/users/profile/';this_user_profile_link+=HuffCookies.getUserName();if(vert_header)
{D.setStyle('n_pre_nav','marginTop','-3px');HuffPoUtil.AvatarLoader.loadAvatarArticleStyle();}
else
{D.setStyle('pre_nav','paddingBottom','15px');}
var welcome='<a href="'+this_user_profile_link+'"';welcome+=(vert_header?' style="margin-left: 20px;"':'')+'>';welcome+='Welcome '+HuffCookies.getUserName().replace(/[\+_]/g,' ')+'</a>';$('wendybird_user_name').innerHTML=welcome;$('wendybird_user').style.display='block';$('not_logged_user').style.display='none';SNProject.closeLinkBar();},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.reload();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)
{D.addClass(document.body,'sn_signed_in');}
if(!updating&&HuffCookies.getUserId()&&(HuffCookies.getSNPstatus()==null||HuffCookies.getReadTrackingStatus()==null))
{var cv=HuffCookies.get('snp_for_cookie_restore');var d=new Date();if(!cv)
{HuffCookies.set('snp_for_cookie_restore',d.getTime());}
else if(d.getTime()-cv>5*60*1000)
{C.asyncRequest('GET','/users/social_news_project/snp_cookie_restore.php',{success:function(o){}});if(HuffCookies.getSNPstatus()==null||HuffCookies.getReadTrackingStatus()==null)
{var d=new Date();HuffCookies.set('snp_for_cookie_restore',d.getTime());}
else
{HuffCookies.del('snp_for_cookie_restore');}}}
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))
{FB.ensureInit(function()
{FB.Connect.ifUserConnected(function()
{FB_RequireFeatures(["Api"],function()
{var api=FB.Facebook.apiClient;var fbuid=api.get_session().uid;var square_pic;try
{api.users_getInfo(Array(fbuid+''),Array('pic_square_with_logo'),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);}});}catch(err){}});});});}}}}},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=HuffCookies.getUserName().replace(/[\+_]/g,' ');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=D.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.externalLinks();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+'" /></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;}
D.setStyle(profile_pic,'position','absolute');D.setStyle(profile_pic,'right',0);D.setStyle(profile_pic,'top',''+el_height+'px');D.setStyle(profile_pic,'opacity','0.5');$('masthead_inner').appendChild(profile_pic);}
else
{D.setStyle(profile_pic,'top','-65px');}
D.setStyle(profile_pic,'float','right');D.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();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=D.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=D.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]);D.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');},externalLinks:function()
{E.addListener(document.getElementsByTagName("a"),'click',function(e){if(this.href&&this.rel=="popup")
{E.stopEvent(e);var height=430;var width=450;if(this.className=='commentpop')
height=430;if(this.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(this.href,'bio','toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=1,resizable=1,width='+width+',height='+height+',top='+top+',left='+left);}
if(this.href&&typeof(urchinTracker)!="undefined")
{urchinTracker("/out/?u="+this.href);}});},SharePollToFacebook:function(feed_bundle_id,vote_text,poll_question)
{vote_link='<a href="'+location.href+'">'+poll_question+'</a>';var feed_tokens={'vote_text':'voted: "'+vote_text+'" You take the poll - ','vote_link':vote_link};FB.ensureInit(function(){Modal.HideEmbed();FB.Connect.showFeedDialog(feed_bundle_id,feed_tokens,null,null,null,FB.RequireConnect.promptConnect,function(){Modal.ShowEmbed();});});},vote:function(pollId){form=$('poll_form_'+pollId);requestUrl='/polls/add_stats.php?pid='+pollId;var checked=false;var show_facebook=false;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[pollId]=document.getElementById('poll_'+pollId+'_'+form.elements[i].value).innerHTML;show_facebook=true;}
checked=true;}}
if(checked)
{C.asyncRequest('GET',requestUrl,{success:function(transport){$('poll_'+pollId).innerHTML=transport.responseText;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('POST','/commentsv3/ajax/get_number_comments_by_entries.php',{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(D.get('comment_count_'+entry_id))
{changed_els[changed_els.length]='comment_count_'+entry_id;D.get('comment_count_'+entry_id).innerHTML=response[entry_id];}
all_entries=D.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){}},'entry_ids='+comments_ids_string);}
}
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(D.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&&!D.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(urchinTracker)
{if(D.hasClass(document.body,'frontpage'))
{if(D.hasClass(document.body,'homepage'))
{ticker_area="front";}
else
{ticker_area=document.body.id;}}
else
{ticker_area='secondary';}
urchinTracker("/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;D.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;D.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;D.addClass('best_'+comment_id,'flagged');$('best_'+comment_id).innerHTML='Marked as favorite';SNProject.track(comment_id,'comment_favored',entry_id);},initRelatedTracker:function(){lists=D.getElementsByClassName("relatedposts","ul");for(var i=0;i<lists.length;i++)
{D.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=D.getElementsByClassName("topposts","ul");for(var i=0;i<lists.length;i++)
{D.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=(D.hasClass(document.body,'frontpage')&&(lottery||ClickTracker.debug));if(ClickTracker.trackClicks)
ClickTracker.init();D.batch(document.getElementsByTagName('UL'),function(el){if(el&&el.getElementsByTagName)
{lis=el.getElementsByTagName('LI');if(lis[0])
{D.addClass(lis[0],'first');D.addClass(lis[lis.length-1],'last');}}});lists=D.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(D.hasClass(o,'widget_item')){wi_els.push(o);}}
for(var k=0;k<wi_els.length;k++){o=wi_els[k];if(k==0)
D.addClass(o,'first_child');if(k==wi_els.length-1)
D.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':'3','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(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%';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){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];}};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);D.setStyle(D.getElementsByClassName('slider_slide','div','slider_'+vertical),'display','none');D.setStyle('slider_'+vertical+"_slide_"+Slider.Positions[vertical],'display','block');if(Slider.Positions[vertical]==Slider.Lengths[vertical]-1)
{D.addClass('slider_right_'+vertical,'slider_off');}
D.removeClass('slider_left_'+vertical,'slider_off');},Previous:function(vertical)
{if(Slider.Positions[vertical]>0)
{Slider.Positions[vertical]--;}
else
{return false;}
Slider.LoadImage(vertical);D.setStyle(D.getElementsByClassName('slider_slide','div','slider_'+vertical),'display','none');D.setStyle('slider_'+vertical+"_slide_"+Slider.Positions[vertical],'display','block');if(Slider.Positions[vertical]==0)
{D.addClass('slider_left_'+vertical,'slider_off');}
D.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 APwires={limit:0,Next:function(id,v_name)
{if(!this.limit)
{this.limit=$('ap_array_size').innerHTML;}
if(id!=this.limit)
{D.setStyle('ap-wires-'+id,'display','none');id++;if(id==this.limit)
{$('ap-wires-Rimg'+id).style.backgroundPosition='-60px -326px';}
D.setStyle('ap-wires-'+id,'display','block');}
else
{return false;}},Prev:function(id)
{if(id!=1)
{D.setStyle('ap-wires-'+id,'display','none');id--;D.setStyle('ap-wires-'+id,'display','block');}
else
{return false;}}};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':'images.huffingtonpost.com';this.path="http://"+this.domain+"/gen/"+this.id+"/thumbs/";},Url:function(aspect,size){return this.path+aspect+"-"+this.keywords+"-"+size+".jpg";}}
var FanSystem={linkClass:'becomefan_link',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);return false;},success:function(o){if(o.responseText=='')return false;splits=o.responseText.split(':::');if(splits[0]=='updated'){userid=splits[1];if(!userid)return false;SNProject.track(userid,'user_follow');FanSystem.notificationsPop();return this.updateLinks(userid);}else if(splits[0]=='login'){QuickLogin.pop();}},failure:function(o){HPError.e('Sorry, unable to process your request');},timeout:5000,updateLinks:function(userid){links=D.getElementsByClassName(this.linkClass,'a');if(!links.length)return false;for(var i=0,len=links.length;i<len;i++){ls=links[i].id.split('_');if(!(ls[0]==this.becomeIdPrefix&&ls[1]==userid))continue;updatedLink=$(this.updatedIdPrefix+'_'+ls[1]+'_'+ls[2]);if(!updatedLink)continue;updatedLink.style.display='inline';D.setStyle(links[i].id,'display','none');}
return true;},notificationsPop:function(){C.asyncRequest('GET','/users/notifications/form.php?blogger=&user='+FanSystem.fanof_username+'&ajax=1',{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';}}
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=D.getElementsByClassName('threeup_entries','div',this.container);isDOM=document.getElementById;isOpera=window.opera&&isDOM;Y.threeup.isMSIE=document.all&&document.all.item&&!isOpera;}};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){D.replaceClass(prev_anchor,"blogroll_tab_anchor","blogroll_tab_anchor_visited");}
if(vertical!="home"){var anchor=document.getElementById("blogroll_tab_"+vertical);D.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=D.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);}
var SocialNetworkBadge={digg_flag:'',url:'',title:'',parent_elem:"",clicks:"",show_just_digg_badge:0,dont_show_digg:0,brief_mode_digg:0,standart_way:1,init:function(tmp_url,tmp_title,show_digg,get_clicks,show_just_digg_badge,dont_show_digg,brief_mode_digg){this.url=tmp_url;this.title=tmp_title;this.digg_flag=show_digg;this.write_table=false;this.clicks=get_clicks;this.show_just_digg_badge=show_just_digg_badge;this.dont_show_digg=dont_show_digg;this.brief_mode_digg=brief_mode_digg;this.standart_way=!dont_show_digg&&!show_just_digg_badge;},make_iframe: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;},make_element:function(type,params)
{var params=params||{};var el=document.createElement(type+'');if(params.className)el.className=params.className+'';if(params.id)el.id=params.id+'';if(params.html)el.innerHTML=params.html+'';return el;},write_badge_to:function(tmp_div){this.parent_elem=document.getElementById(tmp_div);var tbl=document.createElement("table");tbl.border=3;var row=document.createElement("tr");this.tbl=tbl;this.row=row;var badge="facebook_badge";var result=false;if(result=this.check_referrals()){badge=result;}else if(this.digg_flag){badge="digg_badge";}else if(result=this.check_history()){badge=result;}
badge=HPUtil.getUrlVar('testbadge')?HPUtil.getUrlVar('testbadge'):badge;if(this.dont_show_digg&&"digg_badge"==badge)
{badge="facebook_badge";}
if(this.show_just_digg_badge)
{badge="digg_badge";}
if(this.standart_way||(this.dont_show_digg&&"digg_badge"!=badge)||(this.show_just_digg_badge&&"digg_badge"==badge))
eval("this."+badge+"()");if(this.show_just_digg_badge&&"digg_badge"==badge)
{this.parent_elem.parentNode.style.width="60px";this.parent_elem.parentNode.style.height="80px";}
if(this.dont_show_digg&&"digg_badge"!=badge)
{if(D.hasClass(this.parent_elem.parentNode.parentNode.parentNode,'spoll_sf_block'))
{this.parent_elem.parentNode.style.width="280px";}
else
{this.parent_elem.parentNode.style.width="260px";}
this.parent_elem.parentNode.style.height="auto";}
if(this.write_table){var tblBody=document.createElement("tbody");tblBody.appendChild(this.row);this.tbl.appendChild(tblBody);this.parent_elem.appendChild(this.tbl);}},ybuzz_badge:function(){ACTIVEHISTORY.run();if(!Array.indexOf)
{Array.prototype.indexOf=function(obj){for(var i=0;i<this.length;i++){if(this[i]==obj){return i;}}
return-1;}}
if((ACTIVEHISTORY.runstate.visitedlinks.indexOf("digg")))
{if((0<=this.clicks&&3>=this.clicks))
{var spn=this.make_element('span',{id:'new_digg_story',className:'right_now_yahoo'});spn.innerHTML="<img src='/images/bookmarking/digg-submit.png' align='left' alt='' /> <a href='http://digg.com/submit?phase=2&url="+this.url+"&title="+this.title+"' onclick='SocialNetworkBadge.digg_start_clicks(\""+this.url+"\");' target='_blank'>Be the First to Submit<br/>This Story to Digg</a>";this.parent_elem.appendChild(spn);document.write("<script showbranding='0' src='http://d.yimg.com/ds/badge.js' badgetype='small'>huffington_post:"+
this.url
+"</scr"+"ipt>");return;}
else if(4==this.clicks)
{this.digg_badge();return;}}
document.write("<script showbranding='0' src='http://d.yimg.com/ds/badge.js' badgetype='small'>huffington_post:"+
this.url
+"</scr"+"ipt>");var spn=this.make_element('span',{className:"right_now_yahoo",id:"message_digg",html:'Show your support.<br>Buzz this article up.'});if(/WebKit/.test(navigator.userAgent)){spn.setAttribute("style","position:relative; top: -25px;");}
this.parent_elem.appendChild(spn);},digg_start_clicks:function(url){var d=new Date();uri='/badge/digg.php?link='+this.url+'&t='+d.getTime();YAHOO.util.Connect.asyncRequest('GET',uri,{success:function(o){},failure:function(){}});delete d;},digg_badge:function(){var ds=typeof digg_skin=='string'?digg_skin:'';var h=82;var w=51;var digg_url=this.url;var digg_title=this.title;var digg_img=document.createElement("img");digg_img.src="/images/bookmarking/digg-ready.gif";var tmp_link=document.createElement("a");tmp_link.href="http://digg.com/submit?phase=2&url="+digg_url;tmp_link.innerHTML="Show your support.<br>Digg this article.";var img_cell=document.createElement("td");var ifrm_cell=document.createElement("td");ifrm_cell.width="52px";var txt_cell=document.createElement("td");txt_cell.className="right_now";var u=typeof digg_url=='string'?digg_url:(typeof DIGG_URL=='string'?DIGG_URL:window.location.href);var digg_url="http://digg.com/tools/diggthis.php?u="+u+
(typeof digg_title=='string'?('&t='+digg_title):'')+
(typeof digg_window=='string'?('&w='+escape(digg_window)):'')+
(typeof digg_bodytext=='string'?('&b='+escape(digg_bodytext)):'')+
(typeof digg_media=='string'?('&m='+escape(digg_media)):'')+
(typeof digg_topic=='string'?('&c='+escape(digg_topic)):'')+
(typeof digg_bgcolor=='string'?('&k='+escape(digg_bgcolor)):'')+
(ds?('&s='+ds):'');var ifrm=this.make_iframe(w,h,digg_url);img_cell.appendChild(digg_img);ifrm_cell.appendChild(ifrm);txt_cell.appendChild(tmp_link);if(!this.brief_mode_digg)
this.row.appendChild(img_cell);this.row.appendChild(ifrm_cell);if(!this.brief_mode_digg)
this.row.appendChild(txt_cell);this.parent_elem.className="blog_digg digg_string_def";this.write_table=true;},facebook_badge:function(){var fb_div=this.make_element('div',{className:"new_fb_badge",html:'<a type="box_count" share_url='+this.url+' name="fb_share"></a>'});var twitr_div=this.make_element('div',{className:"new_twitr_badge floatright"});document.write('<scr'+'ipt src="http://www.facebook.com/connect.php/js/FB.SharePro/" type="text/javascript"></scr'+'ipt>');this.parent_elem.appendChild(fb_div);document.write('<scr'+'ipt type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype="square">'+this.url+'</scr'+'ipt>');this.parent_elem.appendChild(twitr_div);this._add_twitter_frame(twitr_div);var ldiv=this.parent_elem;D.addClass(ldiv,"display_none");D.addClass(ldiv,"new_badge_frameset");HPUtil.onPageReady(function(){var div_content=ldiv.innerHTML;ldiv.style.paddingBottom="5px";if(HPBrowser.isIE6())
{twitr_div.style.paddingRight='hp_social_network'==ldiv.id?"25px":"13px";}
else
{twitr_div.style.paddingRight='hp_social_network'==ldiv.id?"20px":"8px";}
D.removeClass(ldiv,"display_none");});return;},reddit_badge:function(){var spn=this.make_element('span',{className:"right_now_reddit",id:"message_digg",html:"Vote this story up on Reddit.com!"});this.parent_elem.appendChild(spn);reddit_url=this.url;reddit_title=this.title;document.write("<script src='http://reddit.com/button.js?t=3'></scr"+"ipt>");this.parent_elem.className="reddit_string_def";return;},twitter_badge:function(){var ldiv=this.parent_elem;var spn=this.make_element('span',{className:"right_now_twitter",id:"message_twitter",html:"Retweet this story!"});this.parent_elem.appendChild(spn);var outer_div=this.make_element('div',{id:"twitter_badge_frame"});this.parent_elem.appendChild(outer_div);this._add_twitter_frame(outer_div);return;},_add_twitter_frame:function(parent_el){this._twitter_parent=parent_el;E.onDOMReady(function()
{var twitter_id='huffingtonpost';var badge_iframe=this.make_iframe(50,61,'http://api.tweetmeme.com/button.js?url='+encodeURIComponent(this.url)+'&style=normal&source='+twitter_id);this._twitter_parent.appendChild(badge_iframe);},this,true);},check_referrals:function(){if(/yahoo.com/.test(document.referrer)){return"ybuzz_badge";}else if(/digg.com/.test(document.referrer)){return"digg_badge";}else if(/facebook.com/.test(document.referrer)){return"facebook_badge";}else if(/reddit.com/.test(document.referrer)){return"reddit_badge";}
return false;},check_history:function(){ACTIVEHISTORY.run();if(!Array.indexOf)
{Array.prototype.indexOf=function(obj){for(var i=0;i<this.length;i++){if(this[i]==obj){return i;}}
return-1;}}
if(ACTIVEHISTORY.runstate.visitedlinks.indexOf("facebook")>-1){return"facebook_badge";}else if(ACTIVEHISTORY.runstate.visitedlinks.indexOf("buzz")>-1){return"ybuzz_badge";}else if(ACTIVEHISTORY.runstate.visitedlinks.indexOf("twitter")>-1){return"twitter_badge";}else if(ACTIVEHISTORY.runstate.visitedlinks.indexOf("yahoo")>-1){return"ybuzz_badge";}else if(ACTIVEHISTORY.runstate.visitedlinks.indexOf("reddit")>-1){return"reddit_badge";}else if(ACTIVEHISTORY.runstate.visitedlinks.indexOf("digg")>-1){return"digg_badge";}
return false;}}
function removeDiggIframe()
{ACTIVEHISTORY.run();var result=ACTIVEHISTORY.runstate.visitedlinks.toString();if(-1==result.indexOf("digg"))
{top.location.replace(self.location.href);}}
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=D.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);D.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);D.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];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=[];
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)
{D.getElementsByClassName('hp_common_message','div','hp_vertical_common_lightbox')[0].getElementsByTagName('span')[0].innerHTML=data.title;}
if(data.vertical)
{D.getElementsByClassName('close_modal','a','hp_vertical_common_lightbox')[0].getElementsByTagName('img')[0].src='/images/modal/close-'+data.vertical+'.gif';D.addClass(D.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.SetHtml=function(html)
{E.onAvailable('hp_vertical_common_lightbox',function(data)
{var content_containers=D.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;}
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.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(){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');Modal.mask.style.display="none";YAHOO.util.Dom.removeClass(document.body,"masked");}
if($('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.ShowEmbed();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.ShowEmbed=function()
{objects=document.getElementsByTagName('object');for(i=0;i<objects.length;i++)
{objects[i].style.visibility='visible';}
embeds=document.getElementsByTagName('embed');for(i=0;i<embeds.length;i++)
{embeds[i].style.visibility='visible';}
D.setStyle('curtainunit','visibility','visible');};Modal.HideEmbed=function()
{objects=document.getElementsByTagName('object');for(i=0;i<objects.length;i++)
{objects[i].style.visibility='hidden';}
embeds=document.getElementsByTagName('embed');for(i=0;i<embeds.length;i++)
{embeds[i].style.visibility='hidden';}
D.setStyle('curtainunit','visibility','hidden');};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(!D.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=function()
{Modal.hideMask();var cb=QuickSNProject.hideMask_cb;if(typeof(cb)=='function')
{cb();QuickSNProject.hideMask_cb=undefined;}}
QuickSNProject.modalCache=[];QuickSNProject.showModal=function(html_or_url,params)
{var QSN=QuickSNProject;var html='';var url='';params=params||{};var cb=params['cb']||false;var after_cb=params['after_cb']||false;var pre_cb=params['pre_cb']||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'];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);QuickSNProject.hideMask_cb=cb;Modal.setMaskListener(cb);var inner_html="\
        <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\""+table_width+"\" id=\"lightbox_table\">\
            <tr id=\"top_pop_lightbox\">\
                <td class=\"huff_snn_modal_common_corner huff_snn_modal_common_north_west\"></td>\
                <td class=\"huff_snn_modal_common_north\"></td>\
                <td class=\"huff_snn_modal_common_corner huff_snn_modal_common_north_east\"></td>\
            </tr>\
            <tr id=\"content_pop_lightbox\">\
                <td class=\"huff_snn_modal_common_west\"></td>\
                <td class=\"huff_snn_modal_common_zero_point\">\
    ";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>\
                        <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>\
                        <br />\
                        <div class=\"huffpo_snn_hr\"></div>\
                    </div>\
                    ";}
else{if(close_button){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=\"QuickSNProject.hideMask(); return false;\"></a>\
                        </div>\
                    </div>\
                    ";}}
inner_html+="\
                    <div id=\"huffpo_snn_is_loading\" style=\"display:"+display_loading+";width:100%; text-align:center;\"><img src=\"/images/social-profile/lightbox/ajax-loader.gif\" /></div>\
                    <div id=\"huff_snn_modal_common_inner\" "+style+">"+html+"</div>\
                    <div class=\"clear\"></div>\
                </td>\
                <td class=\"huff_snn_modal_common_east\"></td>\
            </tr>\
            <tr id=\"bottom_pop_lightbox\">\
                <td class=\"huff_snn_modal_common_corner huff_snn_modal_common_south_west\"></td>\
                <td class=\"huff_snn_modal_common_south\"></td>\
                <td class=\"huff_snn_modal_common_corner huff_snn_modal_common_south_east\"></td>\
            </tr>\
        </table>\
    ";$('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;D.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+"|";D.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 src=\"/images/social-profile/lightbox/ajax-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.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.reload();}
HuffCookies.setCookie('check_for_fans',1);};QuickLogin.pop=function(is_become_fan,params)
{var QS=QuickSignup;Modal.id='huff_snn_modal_common';Modal.setWidth(555);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.force_twitter)
{params.signup=true;QuickLogin.show_twitter=true;}
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',{success:QuickLogin.GetFormSuccess,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');this.TabClick(QuickLogin.activeTab);if(QS.selectedService&&QS.selectedService=='direct')
{QS.tabClick('subtab_direct');}
if(QuickLogin.show_twitter)
QuickSignup.tabClick('subtab_twitter');}
return false;};QuickLogin.RunCallbacksOrRefresh=function(o)
{if(QuickLogin.onLoginSuccess)
{QuickLogin.onLoginSuccess();return;}
window.location.reload();};QuickLogin.GetFormSuccess=function(o)
{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_direct'),'click',handler,'subtab_direct');if(QuickLogin.activeTab=='signup')
QuickLogin.pop(undefined,{signup:true});else
QuickLogin.pop();};QuickLogin.GetFormFail=function(o)
{HPError.e();Modal.hideMask();};QuickLogin.checkSubmit=function(link_form,postfix)
{var QS=QuickSignup;var field;if(link_form==true)postfix='_fb_link';else if(link_form=='_tc_link')postfix='_tc_link';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);if(login_field.value==''||login_field.value=='ENTER USERNAME')
{alert('Please enter your login');login_field.focus();return false;}
if(password_field.value=='')
{alert('Please enter your password');password_field.focus();return false;}
login_field.focus();if(login_field.value=='')
{var s='Please enter your username';if(link_form)
{QS.notify(s);}
else
{alert(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
{alert(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);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.LinkSuccess=function(o)
{if(o.responseText!='success')return QuickLogin.LinkFail(o);Modal.hideMask();if(QuickLogin.ServiceToLink=='tc')
QuickLogin.TwitterPromptForConnectPop();else if(QuickLogin.ServiceToLink=='fb')
QuickLogin.FacebookPromptForConnectPop();}
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)
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_cell=$('modal_tab_'+tabs[i]+'_link').parentNode;if(tabs[i]==tabTag&&!D.hasClass(el_cell,'current')){D.addClass(el_cell,'current');}
else if(tabs[i]!=tabTag&&D.hasClass(el_cell,'current')){D.removeClass(el_cell,'current');}}
QS.init();if(QS._force_click_fb)QS.FBConnect();if(QuickSignup._force_click_fb)QuickSignup.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(QL.is_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.FacebookLogin=function(){if(QuickLogin.bIsLoggedInFacebook&&!QuickLogin.avoidFBCallbackBeforeHPLogin)
{if(typeof(QuickLogin.FacebookLoginCallback)!="undefined"){FB.ensureInit(function(){QuickLogin.FacebookLoginCallback();});return;}
return;}
FB.ensureInit(function(){FB.Connect.ifUserConnected(function(nFaceBookId){if(QuickLogin.bIsLoggedInFacebook){return;}
QuickLogin.bIsLoggedInFacebook=true;var rt=new Date().getTime();YAHOO.util.Connect.asyncRequest('GET','/commentsv3/_facebookLogin.php?r='+rt,{success:QuickLogin.FacebookSuccess,failure:QuickLogin.ServiceLoginFail});},function(){if(!QuickLogin.bIsLoggedInFacebook)return;QuickLogin.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(QL.is_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(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(){Modal.id='huff_modal_common';Modal.setWidth(500);Modal.showMask(Modal.id);var userName=HuffCookies.getUserName().replace('hp_blogger_','').replace('_',' ');$('huff_modal_common_inner').innerHTML="\
        <div>\
                <div id=\"modal_login_content\" class=\"modal_content\">\
                        <h1>Link your Facebook account?</h1><hr /><br />\
                        Hi "+userName+",\
                        <br /><br />Would you like to link your Facebook account <span id=\"mlc_facebookname\"> <img src=\"/images/ajax-loader.gif\" alt=\"\" style=\"display:inline\" /> </span> to your Huffington Post account?\
                        <br /><br />By linking your Facebook account to your Huffington Post account, you will be able to log in to Huffpost using your Facebook credentials. You will also gain access to new features and be able to more easily see what your Facebook friends are up to on this site.\
                        <br /><br />\
                        <div>\
                                <div style=\"float:left;width:70px;height:20px;color:#fff;background:#8D8D8D;margin:0 10px;padding-top:3px;text-align:center;font-weight:bold;cursor:pointer;\" onclick=\"QuickLogin.FacebookDoConnect(true); return false;\">Yes</div>\
                                <div style=\"float:left;width:70px;height:20px;color:#fff;background:#8D8D8D;margin:0 10px;padding-top:3px;text-align:center;font-weight:bold;cursor:pointer;\" onclick=\"QuickLogin.FacebookDoConnect(false); return false;\">No</div>\
                                <div class=\"clear\"></div>\
                        </div>\
                        <br />\
                        Not "+userName+"? Please <a href=\"/users/logout\">click here</a> to log out, then log back in with your correct account.\
                </div>\
                <div class=\"clear\"></div>\
        </div>\
    ";if(QuickLogin.FacebookName){$('mlc_facebookname').innerHTML='"'+QuickLogin.FacebookName+'" ';}
else{LazyFB.getFBInfo(function(o)
{$('mlc_facebookname').innerHTML='"'+o[0].name+'" ';QuickLogin.FacebookName=o[0].name;},function()
{$('mlc_facebookname').innerHTML='';});}};QuickLogin.TwitterPromptForConnectPop=function(){Modal.id='huff_modal_common';Modal.setWidth(500);Modal.showMask(Modal.id);var userName=HuffCookies.getUserName().replace('hp_blogger_','').replace('_',' ');$('huff_modal_common_inner').innerHTML="\
        <div>\
                <div id=\"modal_login_content\" class=\"modal_content\">\
                        <h1>Link your Twitter account?</h1><hr /><br />\
                        Hi "+userName+",\
                        <br /><br />Would you like to link your Twitter account <span id=\"mlc_twittername\"> <img src=\"/images/ajax-loader.gif\" alt=\"\" style=\"display:inline\" /> </span> to your Huffington Post account?\
						<br /><br />\
						By linking your Twitter account to your Huffington Post account, you will be able to log in to Huffpost using your Twitter credentials. You will also gain access to new features and be able to more easily see what your Twitter friends are up to on this site.\
                        <br /><br />\
                        <div>\
                                <div style=\"float:left;width:70px;height:20px;color:#fff;background:#8D8D8D;margin:0 10px;padding-top:3px;text-align:center;font-weight:bold;cursor:pointer;\" onclick=\"QuickLogin.TwitterDoConnect(true); return false;\">Yes</div>\
                                <div style=\"float:left;width:70px;height:20px;color:#fff;background:#8D8D8D;margin:0 10px;padding-top:3px;text-align:center;font-weight:bold;cursor:pointer;\" onclick=\"QuickLogin.TwitterDoConnect(false); return false;\">No</div>\
                                <div class=\"clear\"></div>\
                        </div>\
                        <br />\
                        Not "+userName+"? Please <a href=\"/users/logout\">click here</a> to log out, then log back in with your correct account.\
                </div>\
                <div class=\"clear\"></div>\
        </div>\
    ";if(QuickLogin.twitterScreenName){$('mlc_twittername').innerHTML='"'+QuickLogin.twitterScreenName+'" ';}
else{$('mlc_twittername').innerHTML="";}};QuickLogin.FacebookDoConnect=function(doConnect){if(doConnect){var rt=new Date().getTime();C.asyncRequest('GET','/commentsv3/_facebookLogin.php?connect_me=1&r='+rt,{success:QuickLogin.FacebookDoConnectSuccess,failure:QuickLogin.ServiceLoginFail});}
else
{Modal.hideMask();QuickLogin.bIsLoggedInFacebook=false;if(QuickLogin.calledBySNN)
{HPError.e('A Facebook-linked account is currently required to use SNN. Please link your account or check back later.');window.location=window.location;}}}
QuickLogin.FacebookDoConnectSuccess=function(o){var response=JSON.parse(o.responseText);switch(response.msg){case'success':HuffCookies.set('snn_popup_needed','1','1');Modal.hideMask();FB.ensureInit(function(){FB.Connect.showPermissionDialog('read_stream',function(isAccepted){if(typeof(QuickLogin.FacebookLoginCallback)!="undefined"){QuickLogin.FacebookLoginCallback();return;}
QuickLogin.onLoginSuccess();return;});});break;default:QuickLogin.Fail(response);break;}}
QuickLogin.TwitterDoConnect=function(doConnect){if(doConnect){var rt=new Date().getTime();C.asyncRequest('GET','/users/login/link_twitter.php?r='+rt+'&tname='+QuickLogin.twitterScreenName+'&tid='+QuickLogin.twitterId+'&oauth_token='+QuickLogin.oauthToken+'&oauth_secret='+QuickLogin.oauthSecret,{success:QuickLogin.TwitterDoConnectSuccess,failure:QuickLogin.Fail});}
else
{Modal.hideMask();window.location=window.location;}}
QuickLogin.TwitterDoConnectSuccess=function(o){switch(o.responseText){case'success':HuffCookies.setCookie('check_for_fans',1);HuffCookies.setCookie('twitter_linked',1);Modal.hideMask();QuickLogin.onLoginSuccess();QuickLogin.flushValues();break;default:QuickLogin.Fail(o);break;}}
QuickLogin.flushValues=function()
{QuickSignup.twitterScreenName=null;QuickLogin.twitterScreenName=null;QuickLogin.twitterId=null;QuickLogin.oauthToken=null;QuickLogin.oauthSecret=null;}
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();HuffCookies.setCookie('twitter_linked',1);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()
{Modal.id='huff_modal_common';Modal.setWidth(550);Modal.showMask(Modal.id);C.asyncRequest('GET','/users/favorite-bloggers/get_subscribe_user.php?email=&hide_close_button=1&third_party_user=1&f32=1',{success:function(o){QuickSubscribeUser.Success(o);$('check_all').checked=true;QuickSubscribeUser.checkAll();Modal.setMaskListener(function(){var email=QuickSignup._email||$('email').value;QuickSignup.Subscribe(email);});},failure:QuickSubscribeUser.Fail});};QuickLogin.GoogleLogout=function(link){if(-1!==document.cookie.indexOf('fcauth')&&typeof(google)!='undefined')
{google.friendconnect.requestSignOut();}}
QuickLogin.SocialLogout=function(sRedirect){HuffCookies.destroyCookie('twitter_linked');SNProject.track(HuffCookies.getUserId(),'user_log_out');QuickLogin.GoogleLogout(sRedirect);QuickLogin.FacebookLogout(sRedirect);}
QuickLogin.FacebookLogout=function(sRedirect){if(!sRedirect)sRedirect='';LazyFB.loadWhenReady(function()
{FB.ensureInit(function()
{setTimeout(function()
{location.href=((sRedirect.length>0)?sRedirect:location.href);},5000);QuickLogin.bIsLoggedInFacebook=false;FB.Connect.ifUserConnected(function(nFaceBookId)
{if(sRedirect.length>0)
{FB.Connect.logoutAndRedirect(sRedirect);}
else
{FB.Connect.logout(function(){});}},function()
{location.href=((sRedirect.length>0)?sRedirect:location.href);});});});}
QuickLogin.GoogleLoginCallback=null;QuickLogin.FriendConnectInit=function(){google.load('friendconnect','0.8');google.setOnLoadCallback(function(){google.friendconnect.container.setParentUrl('/');google.friendconnect.container.loadOpenSocialApi({site:HPFB.friendconnect_id,onload:QuickLogin.OnLoadFriendConnect});});}
QuickLogin.clickedFriendConnectButton=false;QuickLogin.OnClickFriendConnectButton=function(){QuickLogin.clickedFriendConnectButton=true;google.friendconnect.requestSignIn();return false;}
QuickLogin.OnLoadFriendConnect=function(token){try{if(-1!==document.cookie.indexOf('fcauth'))
{QuickLogin.IsGoogleUserLogged=true;function onRecieveHint(resp)
{gfcHint='';var hintResp=resp.get('hint');if(!hintResp.hadError())
{var hintPacket=hintResp.getData();var googleAdClient=hintPacket['publisherId'];if(hintPacket['hint']&&hintPacket['hint']!='')
{QuickLogin.googleAdsExec(','+hintPacket['hint'],',8903417086');}
}}
var req=opensocial.newDataRequest();req.add(google.friendconnect.newFetchInterestHintRequest(),'hint');req.send(onRecieveHint);}
else
{QuickLogin.IsGoogleUserLogged=false;}}
catch(e)
{QuickLogin.IsGoogleUserLogged=false;}
if(!window.timesloaded){window.timesloaded=1;}else{window.timesloaded++;}
if(window.timesloaded>1){if(HuffCookies.getUserId()==null&&QuickLogin.clickedFriendConnectButton){YAHOO.util.Connect.asyncRequest('POST','/users/login/gfc/',{success:QuickLogin.FriendConnectSuccess,failure:QuickLogin.Fail},'gfc_login=1');}}}
QuickLogin.FriendConnectSuccess=function(o){switch(o.responseText){case'success':Modal.hideMask();if(QuickLogin.GoogleLoginCallback)
{QuickLogin.GoogleLoginCallback();return;}
if(QuickLogin.onLoginSuccess)
{QuickLogin.onLoginSuccess();return;}
window.location.reload();break;case'new_user':Modal.hideMask();QuickLogin.FriendConnectChangeUserNamePop();break;default:QuickLogin.Fail(o);break;}}
QuickLogin.googleAdsExec=function(_gfcHint)
{_google_vertical_name=(typeof _google_vertical_name!='undefined')?_google_vertical_name:'';_google_hints=(typeof _google_hints!='undefined')?_google_hints:'';if(document.getElementById('contextual_ad_unit_1'))
{HuffPoUtil.WEDGJE.google_ads.init({'ad_channel':'8073093451,'+_google_vertical_name+',9299244974','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','hints':_google_hints+' '+_gfcHint,'max_num_ads':'1','hp_dest_id':'contextual_ad_unit_2'});}
HuffPoUtil.WEDGJE.google_ads.exec();}
QuickLogin.FriendConnectChangeUserNamePop=function(){Modal.id='huff_modal_common';Modal.setWidth(500);Modal.showMask(Modal.id);QuickLogin.modalContent=$('huff_modal_common_inner');YAHOO.util.Connect.asyncRequest('POST','/users/login/gfc/',{success:function(o){QuickLogin.modalContent.innerHTML=o.responseText;},failure:function(){HPError.e();}},'newuser=1');}
QuickLogin.FriendConnectSignupUser=function(){YAHOO.util.Connect.setForm($('changename_form'));$('modal_changename_submit').style.visibility='hidden';$('subscribe_loader').style.display='block';callback={success:function(o){if(/<form[^>]*>/.test(o.responseText)){QuickLogin.modalContent.innerHTML=o.responseText;}
else{switch(o.responseText){case'success':Modal.hideMask();if(QuickLogin.GoogleLoginCallback)
{QuickLogin.GoogleLoginCallback();return;}
QuickLogin.FriendConnectSubscribe();break;default:$('modal_changename_submit').style.visibility='visible';$('subscribe_loader').style.display='none';alert(o.responseText);break;}}},failure:function(){HPError.e();}}
YAHOO.util.Connect.asyncRequest('POST','/users/login/gfc/',callback);}
QuickLogin.FriendConnectSubscribe=function()
{QuickSignup.SubscribeSuccessEmail=function()
{Modal.hideMask();QuickLogin.RunCallbacksOrRefresh();}
QuickSignup.SubscribeFailEmail=QuickSignup.SubscribeSuccessEmail;QuickLogin.SubscribeHandler();}
QuickLogin.TwitterOauthLogin=function()
{var oauth_url="http://"+HPConfig.current_web_address+"/users/social_news_project/twitter/_twitter_login_receiver.html?request=oauth";window.open(oauth_url,'_blank','height=500,width=850,location=0,top=50,left=100');QuickLogin.TwitterOauthLoginStatus();if(QuickSignup.connected['twitter'])
QuickSignup.TwitterUnconnect();}
QuickLogin.TwitterOauthLoginStatus=function()
{var tl_state=$('twitter_status_flag');if(tl_state!=null)
{if(tl_state.value==1)
{HuffCookies.setCookie('twitter_linked',1);QuickLogin.onLoginSuccess();}
else if(tl_state.value==2)
{QuickLogin.TabClick('signup');QuickSignup.tabClick('subtab_twitter');QuickSignup.selectedService='twitter';QuickSignup.TwitterConnect();}
else
{setTimeout('QuickLogin.TwitterOauthLoginStatus()',1000);}}}
QuickLogin.TwitterOauthFastLogin=function()
{var oauth_url="http://"+HPConfig.current_web_address+"/users/social_news_project/twitter/_twitter_fast_login_receiver.html?request=oauth";window.open(oauth_url,'_blank','height=500,width=850,location=0,top=50,left=100');QuickLogin.TwitterOauthFastLoginStatus();if(QuickSignup.connected['twitter'])
QuickSignup.TwitterUnconnect();}
QuickLogin.TwitterOauthFastLoginStatus=function()
{var tl_state=$('twitter_status_flag_fast_login')||$('twitter_status_flag_top_login')||$('twitter_status_flag_signup');if(tl_state!=null)
{if(tl_state.value==1)
{HuffCookies.setCookie('twitter_linked',1);QuickLogin.onLoginSuccess();}
else if(tl_state.value==2)
{var info_input=$('twitter_user_info')||$('twitter_top_user_info')||$('twitter_user_info_bar');var quick_twitter_info=info_input.value;var twitter_info_obj=eval("("+quick_twitter_info+")");QuickLogin.TwitterInfo=twitter_info_obj;Modal.hideMask();QuickLogin.pop('',{force_twitter:true});QuickLogin.ActivateTwitterBox();}
else
setTimeout('QuickLogin.TwitterOauthFastLoginStatus()',1000);}}
QuickLogin.ActivateTwitterBox=function()
{if($('huff_snn_modal_common')!=null&&$('modal_su_twitter')!=null&&$('twitterId')!=null&&$('oauthToken')!=null&&$('oauthSecret')!=null&&$('F_USERNAME')!=null)
{var twitter_info_obj=QuickLogin.TwitterInfo;$('modal_su_twitter').style.display='none';$('twitterId').value=twitter_info_obj.twitter_id;$('oauthToken').value=twitter_info_obj.oauth_token;$('oauthSecret').value=twitter_info_obj.oauth_secret;$('F_USERNAME').value=twitter_info_obj.twitter_screen_name;var userinfo=$('modal_su_userinfo_twitter');userinfo.firstChild.src=twitter_info_obj.twitter_profile_image;userinfo.lastChild.innerHTML=twitter_info_obj.twitter_screen_name;QuickSignup.selectedService='twitter';QuickSignup.TwitterConnect();}
else
setTimeout('QuickLogin.ActivateTwitterBox()',1000);}
QuickLogin.TwitterOauthSNNLinking=function()
{var oauth_url="http://"+HPConfig.current_web_address+"/users/social_news_project/twitter/_twitter_snn_module_receiver.html?request=oauth";window.open(oauth_url,'_blank','height=500,width=850,location=0,top=50,left=100');QuickLogin.TwitterOauthSNNLinkingStatus();}
QuickLogin.TwitterOauthSNNLinkingStatus=function()
{if($('twitter_snn_status')!=null)
{var val=$('twitter_snn_status').value;if(val==0)
setTimeout('QuickLogin.TwitterOauthSNNLinkingStatus()',1000);else
{var element=$('sidebar_service_connect');var flashwarn=new YAHOO.util.ColorAnim(element,{backgroundColor:{from:'#F9E801',to:'#FFFFFF'}});flashwarn.animate();HuffCookies.setCookie('twitter_linked',1);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";});setTimeout('SNProject.checkFriendsFansOnJoin()',10000);}}}
QuickLogin.TwitterOauthCommentLinking=function(comment_id)
{QuickLogin.twitter_link_comment_id=comment_id;var oauth_url="http://"+HPConfig.current_web_address+"/users/social_news_project/twitter/_twitter_comments_receiver.html?request=oauth";window.open(oauth_url,'_blank','height=500,width=850,location=0,top=50,left=100');QuickLogin.TwitterOauthCommentLinkingStatus();}
QuickLogin.TwitterOauthCommentLinkingStatus=function()
{if($('common_twitter_receiver')!=null)
{var val=$('common_twitter_receiver').value;if(val==0)
setTimeout('QuickLogin.TwitterOauthCommentLinkingStatus()',1000);else
{var twitter_info_obj=eval("("+val+")");$('comment_connect_twitter'+QuickLogin.twitter_link_comment_id).innerHTML="<table border=\"0\"><tr><td>Twitter account: </td><td><div d=\"field_fb_name\">"+twitter_info_obj.twitter_screen_name+"</div></td><td><div id=\"field_fb_ppic\"><img src=\""+twitter_info_obj.twitter_profile_image+"\" /></div></td></tr></table>";HuffCookies.setCookie('twitter_linked',1);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";});if($('sidebar_service_connect'))
$('sidebar_service_connect').style.display="none";$('common_twitter_receiver').value=0;}}}
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){FB.ensureInit(function(){var callback={success:function(o){if(o.responseText=='all'){if(typeof(callbackChain)=="function"){callbackChain();}}
else{QuickFacebookInvite.showInviteForm(o.responseText);}},timeout:7000}
var q='/include/facebook.php?app_friends='+FB.Connect.get_loggedInUser();var cObj=C.asyncRequest('GET',q,callback);});},showInviteForm:function(appUsers){FB.ensureInit(function(){var dialogHeight=575+((appUsers!='')?(appUsers.split(',').length/4*20):0);var dialog=new FB.UI.FBMLPopupDialog('Invite your Friends to Join You on HuffPost','');var fbml="<fb:request-form style=\"width:760px; height:"+dialogHeight+"px;\" 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+="<fb:multi-friend-selector showborder=\"false\" exclude_ids=\""+appUsers+"\" ";fbml+="actiontext=\"Invite your friends to HuffPost\" rows=\"3\" bypass=\"cancel\" showborder=\"false\">";fbml+="</fb:multi-friend-selector>";fbml+="</fb:request-form>";dialog.setFBMLContent(fbml);dialog.setContentWidth(760);dialog.setContentHeight(dialogHeight);Modal.HideEmbed();dialog.show();FB.XFBML.Host.parseDomTree();});}};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},selectedService:'facebook',services:['facebook','twitter','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();FB.ensureInit(function()
{var if_session=function()
{if(HPBrowser.isIE6())
{QS.setConnected(QS.selectedService);}
else
{LazyFB.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.Connect.requireSession(if_session);});},FBUnconnect:function()
{var QS=QuickSignup;QS.connected[QS.selectedService]=false;QS._fb_cache=false;FB.Connect.logout(function(){QuickSignup.toggleOverlays('facebook');});QS.fadeForm(true);},showUserInfo:function(name,pic)
{var QS=QuickSignup;if(!QS.initted)QS.init();if(QS.selectedService!='twitter')
{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='/images/profile/user_placeholder.gif';userinfo=$('modal_su_userinfo_'+QuickSignup.selectedService);if(!userinfo)return;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.selectedService=='twitter'&&QS.connected[QS.selectedService])
{QS.fadeForm(false);if($('F_USERNAME')!=null)
$('F_USERNAME').value=QS.twitterScreenName;}
else
return;},hideUserInfo:function()
{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&&!D.hasClass(QS.inner,'modal_su_faded'))
D.addClass(QS.inner,'modal_su_faded');else if(!fade)
D.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=D.getElementsByClassName('service_only',null,QS.inner);for(i=0;i<service_els.length;i++)
{var cur=service_els[i];if(D.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)
{D.removeClass(tab,normal);D.addClass(tab,selected);current=tabs[i];}
else
{if(D.hasClass(tab,selected))
{D.removeClass(tab,selected);D.addClass(tab,normal);}}}
var direct_signup=(current=='direct');var form_els=QS.fieldset.getElementsByTagName('DIV');QS.fadeForm(!direct_signup);if(QS.connected[current])
{QuickSignup.toggleOverlays();}
else
{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)&&(D.hasClass(form_els[i],'modal_su_direct_only')))
{D.addClass(form_els[i],'modal_su_hidden');}else
D.removeClass(form_els[i],'modal_su_hidden');}}
QS.showUserInfo();},toggleOverlays:function(current_tab)
{var QS=QuickSignup;if(!QS.initted)QS.init();var overlays=D.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'];var post_data="email="+encodeURIComponent(email);for(i=0;i<form_fields.length;i++)
{var field=$(form_fields[i]+'');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.value==''&&!D.hasClass(el.parentNode,'modal_su_hidden'))
{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)
{D.setStyle('modal_signup_form_submit','display',(isLoading?'none':'block'));D.setStyle('modal_signup_form_spinner','display',(isLoading?'block':'none'));}
var callback={success:function(o)
{if(o.responseText!='')
{var splits=o.responseText.split(':::');if(splits[0]=='success')
{var QL=QuickLogin;if(QuickSignup.selectedService=='twitter')
{HuffCookies.setCookie('twitter_linked',1);}
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(splits[0]=='error')
{if(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 getdata="";if(QuickSignup.selectedService=='twitter')
{var getdata="&tid="+QuickSignup.twitterId+"&tname="+QuickSignup.twitterScreenName+"&oauth_token="+QuickSignup.oauthToken+"&oauth_secret="+QuickSignup.oauthSecret;}
C.setForm($('modal_signup_form'));C.asyncRequest('POST',$('modal_signup_form').action+'?mode='+QuickSignup.selectedService+getdata,callback);return false;}
switchFormLoading(false);return false;},CheckUsername:function(uname){if(uname!="")
{$('ajax_uname').innerHTML='<img src="/images/social-profile/lightbox/ajax-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 src="/images/social-profile/lightbox/ajax-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()
{var QS=QuickSignup;if(!QS.initted)
QS.init();if(QS.connected['twitter'])
QS.TwitterUnconnect();QS.selectedService='twitter';var oauth_url="http://"+HPConfig.current_web_address+"/users/social_news_project/twitter/_twitter_receiver.html?request=oauth";window.open(oauth_url,'_blank','height=500,width=850,location=0,top=50,left=100');QuickSignup.TwitterConnect();return;},TwitterConnect:function()
{var QS=QuickSignup;if(!QS.initted)
QS.init();var twitter_id=$('twitterId').value;var oauth_token=$('oauthToken').value;var oauth_secret=$('oauthSecret').value;if(twitter_id!=0&&oauth_token!=0&&oauth_secret!=0)
{QS.twitterScreenName=$('F_USERNAME').value;QuickLogin.twitterScreenName=QS.twitterScreenName;QuickLogin.twitterId=twitter_id;QuickLogin.oauthToken=oauth_token;QuickLogin.oauthSecret=oauth_secret;QS.twitterId=twitter_id;QS.oauthToken=oauth_token;QS.oauthSecret=oauth_secret;QS.setConnected(QS.selectedService);QS.fadeForm(false);var userinfo=$('modal_su_userinfo_'+QS.selectedService);if(!userinfo)return;userinfo.parentNode.style.display='block';}
else
setTimeout('QuickSignup.TwitterConnect()',3000);},TwitterUnconnect:function()
{var QS=QuickSignup;QS.connected[QS.selectedService]=false;$('twitterId').value=0;$('oauthToken').value=0;$('oauthSecret').value=0;QS.toggleOverlays('twitter');QS.fadeForm(true);}};QuickFan={pop_similar:function(blogger)
{Modal.id='huff_modal_common';Modal.setWidth(400);Modal.showMask(Modal.id);if(urchinTracker)
urchinTracker('/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(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();},onFormSubmitFail:function(error){HPError.e(error);}};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('twitter_linked');HuffCookies.destroyCookie('is_post_to_twitter_checked');}
HuffPoUtil.onPageReady(function(){SNProject.linkAccountsBar('regular');});var twitsign=HuffPoUtil.getUrlVar("twitsign");if(twitsign)
{HuffPoUtil.onPageReady(function(){SNProject.showTopTwitterInfo(twitsign);});}
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=D.getY(id);y2=D.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={pop:function(eid,vert,big_news_title)
{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')!="")
{D.addClass('modal_inner_share',vert.toLowerCase().replace(/ /g,'-'));}
else
{D.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)
{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');ShareBox.chooseShareVia('email');if(urchinTracker)
urchinTracker('/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');}
if($('error_message_share'))
{$('error_message_share').innerHTML='';}
$('entry_id_share').value=eid;$('im_message_share').value=document.location.href;if(big_news_title!=""&&$('share_head')!="undefined")
{if($('share_head')){$('share_head').innerHTML=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;}}}
return false;},submitShare:function()
{if(urchinTracker)
urchinTracker('/t/a/finish_share');post_body='';SharePost.killSubmitButton('post_button','post_spinner');D.batch(D.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);D.setStyle(wait_id,'display','inline');},restoreSubmitButton:function(button_id,wait_id)
{$(button_id).disabled=false;D.setStyle(wait_id,'display','none');D.setStyle(button_id,'display','inline');}
};var VideoPost={providers:{'brightcove':"http://admin.brightcove.com/js/experience_util.js",'comedy-central':"http://www.comedycentral.com/sitewide/video_player/view/default/swf.jhtml",'voxant':"http://thenewsroom.com/mash/swf/voxant_player.js",'reuters':"http://www.reuters.com/resources/flash/includevideo.swf",'msnbc':'src="http://www.msnbc.msn.com/id/','redlasso':"http://media.redlasso.com/xdrive/WEB/",'abc':"http://a.abcnews.com/javascript/portableplayer",'youtube':"http://www.youtube.com/v/",'cbs':'http://www.cbs.com/thunder/swf/','hulu':"http://www.hulu.com/embed/",'nbc':"http://widgets.nbc.com/o/"},checkpost:function(){if(!urchinTracker)
return false;if(!(entry=$('entry_body')))
{entries=D.getElementsByClassName("entry_content",'div','entry_12345');if(entries)
entry=entries[0];}
if(!entry)
return false;haystack=entry.innerHTML;for(provider in this.providers)
{if(typeof provider=='string'&&haystack.match(this.providers[provider]))
{urchinTracker('/t/v/'+provider);}}}}
E.onAvailable('footer',VideoPost.checkpost,{},VideoPost);
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";}
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').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 D=Y.util.Dom;var A=Y.util.Anim;var $=D.get;var loaded=false;var ready=0;YAHOO.namespace('headline_links');var QV=Y.headline_links;QV.show_quickread_ads=false;QV.changeTab=function(tab_name,entry_id){D.batch(D.getElementsByClassName('qr_tab'),function(el){matched_item=el.id.match(/qr_tab_(.*)/).pop();if(matched_item==tab_name){D.addClass('qr_tab_for_'+matched_item,'current');if(tab_name=='share')
{ShareBox.set_email_class();HuffPoUtil.show($('all_email'));HuffPoUtil.hide($('all_im'));$('ad_email').innerHTML='';$('menu_title_share').innerHTML='';$('share_note_textarea').value='';if(entry_id!=null)
{var temp_div=document.createElement('div');temp_div.id='quickread_entry_id';temp_div.style.display='none';temp_div.innerHTML=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');}
HuffPoUtil.show('qr_tab_'+matched_item);}else{D.removeClass('qr_tab_for_'+matched_item,'current');HuffPoUtil.hide('qr_tab_'+matched_item);}});return false;}
QV.pop=function(caller){ready=0;if(urchinTracker)
{if(D.hasClass(document.body,'masked'))
urchinTracker("/t/a/quickread/"+document.body.id+"/internal");else
urchinTracker("/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($('modal_inner'))
{$('modal_inner').className='';}
if($('error_message'))
$('error_message').innerHTML='';E.stopEvent(caller);QV.callback={success:QV.fillPanel,failure:QV.failedView,scope:QV};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]);D.setStyle('curtainunit','visibility','hidden');HuffPoUtil.show('modal_footer');return false;};QV.submitShare=function(){post_body='';QV.killSubmitButton('post_button','post_spinner');D.batch(D.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))
{D.removeClass(D.getElementsByClassName('qr_slide_wrapper','div','modal_footer'),'selected');D.addClass('qr_slide_wrapper_'+entry_id,'selected');}
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,{success:function(o){Posts=eval("("+o.responseText+")");inner='';if(Posts.News&&Posts.News.length>0)
for(i=0;(i<Posts.News.length&&i<4);i++)
{if(!Posts.News[i].entry_id)continue;if(!Posts.News[i].vertical)
Posts.News[i].vertical='Generic';inner+='<div id="qr_slide_wrapper_'+Posts.News[i].entry_id+'" class="qr_slide_wrapper qr_slide_wrapper_'+Posts.News[i].vertical.toLowerCase()+'"><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+'" /></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></div>';}
if(inner.length>1)
E.onAvailable('qr_slide_wrapper_'+entry_id,function(){$('modal_footer').innerHTML+=inner;})}});}
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);D.setStyle(wait_id,'display','inline');}
QV.restoreSubmitButton=function(button_id,wait_id)
{$(button_id).disabled=false;D.setStyle(wait_id,'display','none');D.setStyle(button_id,'display','inline');}
QV.closeButtons=['business','entertainment','home','living','media','politics','style','chicago','green','world','comedy'];QV.fillPanel=function(o)
{if(Modal.mask)
{this.panel_data=JSON.parse(o.responseText);if(!this.panel_data)
{return this.failedView();}
entry_category=(this.panel_data.entry_category)?this.panel_data.entry_category:'';if(this.panel_data.entry_category)
{D.addClass('modal_inner',this.panel_data.entry_category.toLowerCase().replace(/ /g,'-'));}
var date=new Date();if(this.panel_data.entry_category&&QV.closeButtons.inArray(this.panel_data.entry_category.toLowerCase().replace(/ /g,'-')))
{$('close_qread').src='/images/quickread/closeqr-'+this.panel_data.entry_category.toLowerCase().replace(/ /g,'-')+'.gif?ver='+date.getTime();}
else
{$('close_qread').src='/images/quickread/closeqr-home.gif?ver='+date.getTime();}
delete date;if(!$('qr_slide_wrapper_'+this.panel_data.entry_id))
{thumbHTML='<div id="qr_slide_wrapper_'+this.panel_data.entry_id+'" class="qr_slide_wrapper qr_slide_wrapper_'+entry_category.toLowerCase();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')+'" /></a><a class="qr_caption caption_'+entry_category.toLowerCase()+'" href="'+this.panel_data.entry_permalink+'" onclick="return QV.pop(this);">';thumbHTML+=this.panel_data.entry_teaser+'</a></div></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+='/contributors/'+this.panel_data.entry_author_nickname+'/headshot.jpg" /></a><a class="qr_caption caption_'+entry_category.toLowerCase()+'" href="'+this.panel_data.entry_permalink+'" onclick="return QV.pop(this);">'
+this.panel_data.entry_author+'</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.toLowerCase()+'" href="'+this.panel_data.entry_permalink+'" onclick="return QV.pop(this);">'
+this.panel_data.entry_teaser+'</a></div></div>';}
$('modal_footer').innerHTML=thumbHTML;}
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="if (urchinTracker) urchinTracker(\'/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=\"if (urchinTracker) urchinTracker('/t/a/quick/' + document.body.id + '/whole/head');\">"+this.panel_data.entry_title+" &raquo;<\/a><\/h1>";panelbody+='<div class="read_more_top"><hr /></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="if (urchinTracker) urchinTracker(\'/t/a/quick/\' + document.body.id + \'/whole\');" id="qr_read"><img src="/images/quickread/read.png" />Read Whole Post<\/a><a href="#" onclick="QV.changeTab(\'share\', '+this.panel_data.entry_id+'); return false;" id="qr_share"><img src="/images/quickread/share.png" />Share (Email, IM)</a><\/div>';panelbody+="<\/div>";if(this.show_quickread_ads&&!this.videoPost&&!bcid)
{panelbody+="<div class=\"column last\">";panelbody+=this.ad();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;ready++;if(ready==2)
{YAHOO.util.Dom.setStyle('huff_modal_common','visibility','hidden');Modal.showMask('huff_modal');}}};QV.imageLoaded=function()
{if(!loaded)
{loaded=true;return;}
ready++;if(ready==2)
{YAHOO.util.Dom.setStyle('huff_modal_common','visibility','hidden');Modal.showMask('huff_modal');}};QV.docLoaded=function()
{loaded=false;};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(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='';}
D.setStyle('curtainunit','visibility','visible');Modal.hideMask();};QV.hideMask=Modal.hideQVMask;QV.ad=function(){ad='<div class="ad_block ad_wide top" id="qr_ad">';ad+='<iframe src="http://ad.doubleclick.net/adi/'+QV.ad_zone+';ptile=4;sz=300x250;ord='+HuffPoUtil.WEDGJE.ord()+'?" width="300" height="250" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe>';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){if(urchinTracker)
{urchinTracker("/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);D.setStyle('blogroll_header_lower','display','block');D.setStyle('blogroll_lower','display','block');D.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;}}};
if(typeof deconcept=="undefined")var deconcept=new Object();if(typeof deconcept.util=="undefined")deconcept.util=new Object();if(typeof deconcept.SWFObjectUtil=="undefined")deconcept.SWFObjectUtil=new Object();deconcept.SWFObject=function(swf,id,w,h,ver,c,quality,xiRedirectUrl,redirectUrl,detectKey){if(!document.getElementById){return;}
this.DETECT_KEY=detectKey?detectKey:'detectflash';this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(swf){this.setAttribute('swf',swf);}
if(id){this.setAttribute('id',id);}
if(w){this.setAttribute('width',w);}
if(h){this.setAttribute('height',h);}
if(ver){this.setAttribute('version',new deconcept.PlayerVersion(ver.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}
if(c){this.addParam('bgcolor',c);}
var q=quality?quality:'high';this.addParam('quality',q);this.setAttribute('useExpressInstall',false);this.setAttribute('doExpressInstall',false);var xir=(xiRedirectUrl)?xiRedirectUrl:window.location;this.setAttribute('xiRedirectUrl',xir);this.setAttribute('redirectUrl','');if(redirectUrl){this.setAttribute('redirectUrl',redirectUrl);}}
deconcept.SWFObject.prototype={useExpressInstall:function(path){this.xiSWFPath=!path?"expressinstall.swf":path;this.setAttribute('useExpressInstall',true);},setAttribute:function(name,value){this.attributes[name]=value;},getAttribute:function(name){return this.attributes[name];},addParam:function(name,value){this.params[name]=value;},getParams:function(){return this.params;},addVariable:function(name,value){this.variables[name]=value;},getVariable:function(name){return this.variables[name];},getVariables:function(){return this.variables;},getVariablePairs:function(){var variablePairs=new Array();var key;var variables=this.getVariables();for(key in variables){variablePairs[variablePairs.length]=key+"="+variables[key];}
return variablePairs;},getSWFHTML:function(){var swfNode="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute('swf',this.xiSWFPath);}
swfNode='<embed type="application/x-shockwave-flash" src="'+this.getAttribute('swf')+'" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+this.getAttribute('style')+'"';swfNode+=' id="'+this.getAttribute('id')+'" name="'+this.getAttribute('id')+'" ';var params=this.getParams();for(var key in params){swfNode+=[key]+'="'+params[key]+'" ';}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='flashvars="'+pairs+'"';}
swfNode+='/>';}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute('swf',this.xiSWFPath);}
swfNode='<object id="'+this.getAttribute('id')+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+this.getAttribute('style')+'">';swfNode+='<param name="movie" value="'+this.getAttribute('swf')+'" />';var params=this.getParams();for(var key in params){swfNode+='<param name="'+key+'" value="'+params[key]+'" />';}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='<param name="flashvars" value="'+pairs+'" />';}
swfNode+="</object>";}
return swfNode;},write:function(elementId){if(this.getAttribute('useExpressInstall')){var expressInstallReqVer=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(expressInstallReqVer)&&!this.installedVer.versionIsValid(this.getAttribute('version'))){this.setAttribute('doExpressInstall',true);this.addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute('doExpressInstall')||this.installedVer.versionIsValid(this.getAttribute('version'))){var n=(typeof elementId=='string')?document.getElementById(elementId):elementId;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute('redirectUrl')!=""){document.location.replace(this.getAttribute('redirectUrl'));}}
return false;}}
deconcept.SWFObjectUtil.getPlayerVersion=function(){var PlayerVersion=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){PlayerVersion=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var counter=3;while(axo){try{counter++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+counter);PlayerVersion=new deconcept.PlayerVersion([counter,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");PlayerVersion=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(PlayerVersion.major==6){return PlayerVersion;}}
try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}
if(axo!=null){PlayerVersion=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return PlayerVersion;}
deconcept.PlayerVersion=function(arrVersion){this.major=arrVersion[0]!=null?parseInt(arrVersion[0]):0;this.minor=arrVersion[1]!=null?parseInt(arrVersion[1]):0;this.rev=arrVersion[2]!=null?parseInt(arrVersion[2]):0;}
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major)return false;if(this.major>fv.major)return true;if(this.minor<fv.minor)return false;if(this.minor>fv.minor)return true;if(this.rev<fv.rev)return false;return true;}
deconcept.util={getRequestParameter:function(param){var q=document.location.search||document.location.hash;if(param==null){return q;}
if(q){var pairs=q.substring(1).split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return pairs[i].substring((pairs[i].indexOf("=")+1));}}}
return"";}}
deconcept.SWFObjectUtil.cleanupSWFs=function(){var objects=document.getElementsByTagName("OBJECT");for(var i=objects.length-1;i>=0;i--){objects[i].style.display='none';for(var x in objects[i]){if(typeof objects[i][x]=='function'){objects[i][x]=function(){};}}}}
if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);}
window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}
if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];}}
var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.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()}}}}();
Y.namespace('LazyFB');var LazyFB=Y.LazyFB;Y.namespace('HPFacebookWrapper');var HPFacebookWrapper=Y.HPFacebookWrapper;var HPFB={api_key:false,init:function(user_id){if(!user_id){el=document.getElementById('fConnect_img_container');if(el)el.style.display="block";}},maybeFacebookConnected:function(){if(HuffPoUtil.getCookie(HPFB.api_key)!=''&&HuffPoUtil.getCookie(HPFB.api_key+'_expires')!=''&&HuffPoUtil.getCookie(HPFB.api_key+'_session_key')!=''&&HuffPoUtil.getCookie(HPFB.api_key+'_ss')!=''&&HuffPoUtil.getCookie(HPFB.api_key+'_user')!='')
{return true;}
else if(/fbcdn/.test(HuffCookies.getBigAvatar())||/facebook\.com/.test(HuffCookies.getBigAvatar())||/fbcdn/.test(HuffCookies.getSmallAvatar())||/facebook\.com/.test(HuffCookies.getSmallAvatar()))
{return true;}
return false;}};LazyFB.postLoad=[];LazyFB.callPostLoad=function(fb_id)
{var HC=HuffCookies;var QL=QuickLogin;SNProject.fanCheck();if((!fb_id)&&HPUser.is_facebook())
{if(SNProject.popup_needed)
{SNProject.linkAccountsBar('special');}}
else if(fb_id&&!HC.getUserName()&&!HC.getCookie('autologin'))
{QL.is_autologin=true;if(HPUtil.GetEntryID())
{QL.OnSuccessCallback=function(){window.location.href=window.location.href;};}
else
{QL.OnSuccessCallback=HPUtil.reinit;}
QL.FacebookLogin();}
for(var i=0;i<LazyFB.postLoad.length;i++)
{if(typeof(LazyFB.postLoad[i])=='function')
{LazyFB.postLoad[i]();}}};LazyFB.loadWhenReady=function(function_using_fb_api)
{if(typeof(FB)=='undefined'||typeof(FB.ensureInit)!=='function')
{LazyFB.postLoad.push(function_using_fb_api);return false;}
else
{return function_using_fb_api();}}
LazyFB.isEnabled=true;LazyFB.showErrorLightbox=function()
{QuickSNProject.showModal('Sorry, this feature is temporarily disabled due to technical difficulties.  Please check back soon!');}
LazyFB.markFBDisabled=function()
{LazyFB.ensureInit=LazyFB.showErrorLightbox;if(typeof(FB)=='undefined')FB={};FB.ensureInit=LazyFB.showErrorLightbox;LazyFB.isEnabled=false;}
LazyFB.ensureInit=function(callback,force_callback)
{return FB.ensureInit(callback);}
LazyFB.smartyFBLogin=function(unset_callback)
{if(!LazyFB.isEnabled)return LazyFB.showErrorLightbox();if(typeof(unset_callback)=='undefined')
unset_callback=true;if(unset_callback)
{if(typeof(QuickLogin.FacebookLoginCallback)=='function')
{QuickLogin.avoidFBCallbackBeforeHPLogin=false;QuickLogin.FacebookLoginCallback=undefined;}}
Modal.hideMask();LazyFB.loadWhenReady(function()
{FB.ensureInit(function(){FB.Connect.requireSession(QuickLogin.FacebookLogin)});});}
LazyFB.getFBInfo=function(success_callback,failure_callback)
{this.getFBInfo_success=success_callback;this.getFBInfo_failure=function(){return;};if(failure_callback)this.getFBInfo_failure=failure_callback;try
{FB.ensureInit(function()
{var api=FB.Facebook.apiClient;var user_id=api.get_session().uid;var fql="SELECT name, pic_square FROM user WHERE uid ="+user_id;api.fql_query(fql+'',function(o)
{var LFB=LazyFB;if(!(o&&o[0]))
{LFB.getFBInfo_failure();LFB.getFBInfo_failure=function(){return;};}
else
{LFB.getFBInfo_success(o);LFB.getFBInfo_success=function(){return;};}});});}
catch(e)
{LazyFB.getFBInfo_failure();LazyFB.getFBInfo_failure=function(){return;};}};HPFacebookWrapper.showFeedDialog=function(template_bundle_id,template_data,target_id,body_general,story_size,require_connect,callback,user_message_prompt,user_message)
{template_data=template_data||null;target_id=target_id||null;body_general=body_general||null;story_size=story_size||null;require_connect=require_connect||null;callback=callback||null;user_message_prompt=user_message_prompt||null;user_message=user_message||null;Modal.HideEmbed();FB.ensureInit(function(){FB.Connect.showFeedDialog(template_bundle_id,template_data,target_id,body_general,story_size,require_connect,function(){callback();Modal.ShowEmbed();},user_message_prompt,user_message);});}
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(){FB.ensureInit(function(){FB.Connect.requireSession(function(){QuickLogin.FacebookLogin();})},true)});}},postVoteCallback:{vote:'',success:function(o){if(!HPFacebookVote.userLoggedIn&&this.vote.length!=0){window.location.reload();}
else{try{eval('oVoteData = '+o.responseText);}catch(err){return;}
if(oVoteData.error)return;if(oVoteData.current_user_voted){D.get('link_vote_up').innerHTML=oVoteData.up+' Like It';D.get('link_vote_down').innerHTML=oVoteData.down+' Don\'t';D.get('link_vote_up').onclick=function(){return false;};D.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(){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');FB.ensureInit(function(){FB.Connect.get_status().waitUntilReady(function(status){if(status==FB.ConnectState.connected){HPFacebookVote.voteUpCalled=true;feedData={"entry_title":HPFacebookVote.entryTitle,"entry_desc":HPFacebookVote.entryBrief,"entry_link":HPFacebookVote.permalink,"images":[{"src":HPFacebookVote.entryImgSrc,"href":HPFacebookVote.permalink}]};FB.Connect.showFeedDialog(HPFacebookVote.feedTmplBundleId,feedData,null,null,null,FB.RequireConnect.require,HPFacebookVote.onFeedDialogClosed,'Your comment is here',{value:HPFacebookVote.userDefaultComment});}
else{alert('You\'re not connected to Facebook. Please try again.');FB.Connect.logout(function(){});}});})},onVoteUp:function(){D.get('link_vote_up').onclick=function(){return false;};if(!HPFacebookVote.userLoggedIn){HuffCookies.set('voted_up',1);}
FB.ensureInit(function(){FB.Connect.requireSession(function(){QuickLogin.FacebookLoginCallback=HPFacebookVote.onFacebookVoteUp;QuickLogin.FacebookLogin();});});},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(publish){if("null"!=publish)
{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;}},onFacebookVote:function(){if(!HPFacebookVoteV2.userLoggedIn&&null!=HuffCookies.get('facebook_user_is_voting')){window.location.reload();return;}
HuffCookies.del('snn_popup_needed');HuffCookies.del('facebook_user_is_voting');if(HPFacebookVoteV2.voteUpCalled)return;HPFacebookVoteV2.postVote(true);FB.ensureInit(function(){FB.Connect.get_status().waitUntilReady(function(status)
{if(status==FB.ConnectState.connected)
{HPFacebookVoteV2.voteUpCalled=true;feedData={"name":HPFacebookVoteV2.entryTitle,"description":HPFacebookVoteV2.entryBrief,"href":HPFacebookVoteV2.permalink,"media":[{"type":"image","src":HPFacebookVoteV2.entryImgSrc,"href":HPFacebookVoteV2.permalink}]};FB.Connect.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.Connect.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.maybeFacebookConnected())
{HuffCookies.set('facebook_user_is_voting',this.status);FB.ensureInit(function(){FB.Connect.requireSession(function(){QuickLogin.FacebookLoginCallback=HPFacebookVoteV2.onFacebookVote;QuickLogin.FacebookLogin();});});}
else if(this.userLoggedIn)
{HPFacebookVoteV2.postVote(true);this.lock=false;}
else
{SNProject.joinCheckingUserStatus();this.lock=false;}}}
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.html){QI.success({responseText:QI.html});}
else{C.asyncRequest('GET',QI.formUrl,HPFBQuickIntroduce);}},failure:function(o){HPError.e();},success:function(o){if(o.responseText!=''){if(Modal.id){Modal.hideMask();}
Modal.id='huff_modal_common';Modal.setWidth(410);Modal.showMask(Modal.id);$('huff_modal_common_inner').innerHTML=o.responseText;D.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});}},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,(!($('use_fb_avatar').checked)&&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:'',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=HuffCookies.getReadTrackingStatus();},_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($('snp_con').innerHTML=='<img src="/images/ajax-loader.gif" alt="" />')
window.location.reload();}
Modal.hideMask();}};YAHOO.util.Connect.asyncRequest('GET','/users/social_news_project/SNPactions.php?do=join',{success:this.postJoinSuccess,failure:QuickSNProject.GetDialogFail});return false;},refuse:function()
{YAHOO.util.Connect.asyncRequest('GET','/users/social_news_project/SNPactions.php?do=refuse',{success:function(o)
{if(/user:::done/.test(o.responseText))
{setInterval("Modal.hideMask()",1500);}else{HPError.e();Modal.hideMask();}},failure:QuickSNProject.GetDialogFail});return false;},_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(SNP.happyJoin);}}
else if(QuickSignup.selectedService=='twitter')
{mail_callback=function()
{Modal.hideMask();var SNP=SNProject;SNP.tellTwitterFriends(SNP.happyJoin);}}
else
{mail_callback=function()
{Modal.hideMask();SNProject.happyJoin();}}
QS.SubscribeSuccessEmail=mail_callback;QS.SubscribeFailEmail=mail_callback;QI.finalCallback=function(){QuickLogin.SubscribeHandler();};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.reload();}
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())
{Modal.hideMask();return false;}
if(!service)
{QuickSNProject.showModal('/users/login/really_fast_login.php',{inner_class:'service_select_modal',width:790});return;}
QuickSignup.selectedService=service;QL.calledBySNN=true;if(params.signup)QL.selectedTab='signup';if(HuffCookies.getUserName())
{if(service=='facebook')
{QL.avoidFBCallbackBeforeHPLogin=true;QL.FacebookLoginCallback=SNP._tryToJoinUser;LazyFB.smartyFBLogin(false);}
else
{SNP._join();}}
else
{if(service=='facebook')
{QL.avoidFBCallbackBeforeHPLogin=true;QL.FacebookLoginCallback=SNP._tryToJoinUser;LazyFB.smartyFBLogin(false);}
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:'Join me and '+snp_members+' others in the Future of News!',caption:'HuffPost Social News',description:'HuffingtonPost and Facebook power the future of social news. Follow what your friends are reading, vote on the news you think is important, and stay up-to-the-moment on the biggest news events and fun, buzz-worthy stories.',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 now!',href:referral_url}]};},showStreamDialog:function()
{var stream_cb=function(published)
{var callbacks=SNProject.showStreamDialog.cbs;if(published&&published!='null')
{SNProject.callFunctions(callbacks);}};var msg=SNProject.joinMessage;FB.ensureInit(function(){FB.Connect.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>Don't skip this step so fast! 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. Will you publish to your wall that you've joined HuffPost Social News?</p>"+
"<p><a onclick=\"SNProject.showStreamDialog();return false;\" href=\"#\" class=\"modal_tell_friends_button\"><img src=\"/images/bookmarking/facebook.gif\" class=\"modal_tell_friends_button\"/>Post to My Wall</a></p>",{cb:friends_callback,inner_class:'modal_tell_friends'});SNProject.showStreamDialog();},tellTwitterFriends:function(friends_callback)
{SNProject.twitter_callbacks=[Modal.hideMask,friends_callback];var twitter_link_url="http://"+HPConfig.current_web_address+"?twitsign="+QuickSignup.twitterScreenName;QuickSNProject.showModal("<h1>Tell Your Friends</h1>"+
"<p>Set status on twitter (Not more than 140 letters)</p>"+
"<p><textarea id=\"signup_tweet\" class=\"tweet_textarea\">Join me on #HuffPost Social News: "+twitter_link_url+"</textarea></p>"+
"<p><a onclick=\"SNProject.postToTwitter();return false;\" href=\"#\" class=\"modal_tell_friends_button\"><img src=\"/images/twitter_16x16.gif\" class=\"modal_tell_friends_button\"/>Post to Twitter</a></p><div class=\"modal_tell_friends_skip_button\"><a onclick=\"SNProject.skipTwitterStatus();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_tweet'),'keyup',HPUtil.enforceTextAreaLimit,{chars:140});E.on($('signup_tweet'),'change',HPUtil.enforceTextAreaLimit,{chars:140});},postToTwitter:function()
{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="+QS.twitterId+"&toauth_token="+QS.oauthToken+"&toauth_secret="+QS.oauthSecret+"&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;}},skipTwitterStatus:function()
{var callbacks=SNProject.twitter_callbacks;SNProject.callFunctions(callbacks);},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()
{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);C.asyncRequest('GET','/users/social_news_project/make_friends_fans.php?showall=1',{success:SNProject.happyJoinCallback,failure:SNProject.happyJoinCallback,timeout:5000});},happyJoinCallback:function(o)
{$('huffpo_snn_is_loading').style.display='none';$('huff_snn_modal_common_inner').innerHTML=SNProject.happyJoinMessage;var on_story=HPUtil.GetEntryID(window.location.href);if(o&&o.responseText!='undefined')
{var splits=o.responseText.split(':::::');$('huff_snn_modal_common_inner').innerHTML+='<br /><br />'+splits[0];setTimeout(function(){FB.XFBML.Host.parseDomElement($('huff_snn_modal_common_inner'));},500);SocialFriends.init();SocialFriends.happy_join=true;}
$('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('GET','/users/social_news_project/make_friends_fans.php',{success:function(o){if(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.Host.parseDomElement($('huff_snn_modal_common_inner'));},500);SocialFriends.init();}},timeout:8000});},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'))
{return false;}
can_track=true;if(action=='entry_view')
{can_track=(HuffCookies.getSNPstatus()==1&&HuffCookies.getReadTrackingStatus()==1);}
if(HuffCookies.getUserId()&&can_track)
{var func=function()
{var user_stats_project_image_src="http://user-stats.huffingtonpost.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')){FB.ensureInit(function(){FB.Connect.ifUserConnected(function(){setTimeout(function(){SNProject.checkFriendsFansOnLogin();},3000);},function(){});});}
HuffCookies.del('snn_popup_needed');HuffCookies.destroyCookie('check_for_fans');},linkAccountsBar:function(bar)
{if(Y.util.Event.isIE)
return false;var user_id=HuffCookies.getUserId();var body=document.body;var service_bar=document.createElement("div");D.addClass(service_bar,"service_bar");service_bar.id="service_bottom_bar";var bar_cookie=HuffCookies.getCookie('service_bar');if(bar=='regular'&&!this.service_bar)
{if(user_id)
{if(!HPUser.is_facebook()&&!(bar_cookie&&bar_cookie.charAt(0)=="1"))
{service_bar.innerHTML="<div class=\"link_service\"><table><tr><td class=\"service_bar_text\">Sign in now using your facebook account to integrate HuffPost and Facebook!</td><td class=\"service_bar_img\"><a href=\"/social/join.html?autojoin=1\" onclick=\"LazyFB.smartyFBLogin(false); return false;\" target=\"_blank\"><img border=\"0\" src=\"/images/fb-large.gif\" alt=\"Connect with Facebook\" /></a></td><td class=\"close_bar_img\"><a href=\"javascript:void(0);\" onclick=\"SNProject.closeLinkBar('fb_lin');\"><img src=\"/images/close_service_bar.gif\" /></a></td></tr></div>";this.service_bar='facebook';body.appendChild(service_bar);this.setLinkBarCookie('fb_lin');}
else
{HPUser.if_twitter(function()
{service_bar.innerHTML="<div class=\"link_service\"><table><tr><td class=\"service_bar_text\">You're connected to HuffPost with Facebook...now add your Twitter account!</td><td class=\"service_bar_img\"><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\" /></a></td><td class=\"close_bar_img\"><a href=\"javascript:void(0);\" onclick=\"SNProject.closeLinkBar('tw_lin');\"><img src=\"/images/close_service_bar.gif\" /></a></td></tr></div>";if(!(bar_cookie&&bar_cookie.charAt(1)))
{body.appendChild(service_bar);SNProject.service_bar='twitter';this.setLinkBarCookie('tw_lin');}},function()
{D.setStyle($('sidebar_service_connect'),'display','none');HuffCookies.setCookie('twitter_linked',1);});}}
else
{var r=Math.floor(Math.random()*2);if(r==0&&(!(bar_cookie&&bar_cookie.charAt(0)=="1")))
{service_bar.innerHTML="<div class=\"link_service\"><table><tr><td class=\"service_bar_text\">Join HuffPost Social News and connect with your friends on Facebook</td><td class=\"service_bar_img\"><a href=\"/social/join.html?autojoin=1\" onclick=\"LazyFB.smartyFBLogin(false); return false;\" target=\"_blank\"><img border=\"0\" src=\"/images/fb-large.gif\" alt=\"Connect with Facebook\" /></a></td><td class=\"close_bar_img\"><a href=\"javascript:void(0);\" onclick=\"SNProject.closeLinkBar('fb_lin', true);\"><img src=\"/images/close_service_bar.gif\" /></a></td></tr></div>";this.service_bar='facebook';body.appendChild(service_bar);this.setLinkBarCookie('fb_lin');}
else if(!(bar_cookie&&bar_cookie.charAt(1)=="1"))
{service_bar.innerHTML="<div class=\"link_service\"><table><tr><td class=\"service_bar_text\">Join HuffPost Social News and connect with your friends on Twitter</td><td class=\"service_bar_img\"><a href=\"javascript:void(0);\" onclick=\"QuickLogin.TwitterOauthFastLogin(); return false;\" target=\"_blank\"><img border=\"0\" src=\"/images/Sign-in-with-Twitter-darker.png\" alt=\"Connect with Twitter\" /></a></td><td class=\"close_bar_img\"><a href=\"javascript:void(0);\" onclick=\"SNProject.closeLinkBar('tw_lin', true);\"><img src=\"/images/close_service_bar.gif\" /></a></td></tr><input type=\"hidden\" id=\"twitter_status_flag_signup\" value=\"0\" /><input type=\"hidden\" id=\"twitter_user_info_bar\" value=\"\" /></div>";body.appendChild(service_bar);SNProject.service_bar='twitter';this.setLinkBarCookie('tw_lin');}}}
else if((bar=='special'&&!this.service_bar)&&!(bar_cookie&&bar_cookie.charAt(2)=="1"))
{HuffCookies.setCookie('service_bar','111',48);var onclick_js="HuffCookies.destroyCookie('service_bar');LazyFB.smartyFBLogin(false); return false;";service_bar.innerHTML="<div class=\"link_service_special\"><table><tr><td class=\"service_bar_text\">Please log back in to Facebook to ensure that your HuffPost profile photo and other features continue to function.</td><td class=\"service_bar_img\"><a href=\"/social/join.html?autojoin=1\" onclick=\""+onclick_js+"\" target=\"_blank\"><img border=\"0\" src=\"/images/fb-large.gif\" alt=\"Connect with Facebook\" /></a></td><td class=\"close_bar_img\"><a href=\"javascript:void(0);\" onclick=\"SNProject.closeLinkBar('fb_lout', true);\"><img src=\"/images/close_service_bar.gif\" /></a></td></tr></div>";body.appendChild(service_bar);this.service_bar='facebook';}},closeLinkBar:function(type,user_closed)
{if(type)
this.setLinkBarCookie(type,user_closed);if($('service_bottom_bar'))
$('service_bottom_bar').style.display="none";},setLinkBarCookie:function(type,user_closed)
{var cookie_lifetime=(user_closed?(24*7):48);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'fb_lin':facebook_link_bit="1";break;case'tw_lin':twitter_link_bit="1";break;case'fb_lout':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)
{HPUser.if_twitter(function()
{if(!($('top_twitter_info')))
return;C.asyncRequest('GET','/users/social_news_project/twitter/get_twitter_info.php?tname='+twitter_name,{success:function(o){$('top_twitter_info').innerHTML=o.responseText;},failure:function(){HPError.e();},timeout:5000});},function()
{HuffCookies.setCookie('twitter_linked',1);});}}}
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=D.getElementsByClassName('snn_hidden','li','snp_items_ul');for(var i=0;i<els.length;i++)
D.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=D.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=D.getChildren($('hpsn_update_repo'));if(repo_children.length>0)
{var first_stream_el=D.getFirstChild('snp_items_ul');for(var i=0;i<repo_children.length;i++)
D.insertBefore(repo_children[i],first_stream_el);var new_first_stream_item=D.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)
{D.addClass(el,'snn_hidden');repo_children=D.getChildren($('hpsn_update_repo'));if(repo_children.length>0)
{D.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':SNPstream.feedback_show("If you'd like to view this user's HuffPost Social News activity, you must be friends on Facebook");break;case'downtime':SNPstream.feedback_show('Sorry but we are running some maintenance work here. <br />Please check again later.');break;case'no hpsn':SNPstream.feedback_show('Sorry but this user is not part of HuffPost Social News');break;case'profile removed':SNPstream.feedback_show('Sorry but this user has been removed from HuffingtonPost');break;case'profile not found':SNPstram.feedback_show('Sorry but the user you are looking for doesn\'t exist. <br />Maybe you mispelled the username?');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=D.getChildren($('snp_items_temp'));for(var i=(snn_items_temp.length-1);i>=0;i--)
D.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=D.getFirstChild('snp_items_ul');SNPstream.first_id=first_el.id;}
SNPstream.last_el=D.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_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_username)
{this.profile_username=profile_username;var current_hpusername=HPUser.username;if(current_hpusername)
current_hpusername=current_hpusername.replace('+',' ');this.is_my_profile=(this.profile_username!=''&&current_hpusername!=''&&this.profile_username==current_hpusername);if(HPUser.is_logged_in()&&this.is_my_profile)
this.tab_prefix_who='My';if(HPUser.is_logged_in()&&$('header_connect_button'))
{$('header_connect_button').style.display='none';$('social_news_page').style.height='60px';}},show_profile_owner_options:function()
{if(HPUser.is_logged_in()&&this.is_my_profile)
{if(HPUser.is_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';}},show_profile_actions:function()
{if(HPUser.is_logged_in()&&!this.is_my_profile)
document.write('<a id="report_abusive" style="display: block" class="sm-link" onclick="window.open(\'/contact/pop/tech/?section=Comments&amp;email=%%EMAIL%%&amp;url='+escape(document.location.href)+'&amp;problem=Report%20abuse%20of%20comments\', \'contact\', \'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=1,resizable=1,width=450,height=720\')" href="javascript:void(0)">Report Abusive Profile</a>');else
document.write('&nbsp;');if(HPUser.is_logged_in()&&!this.is_my_profile)
document.write('<a class="sm-link-accent becomefanof" style="margin: 0 0 0 7px;" href="/users/becomeFan.php?of='+this.profile_username+'">Become a Fan of this Member </a>');else
document.write('&nbsp;');},stealth_mode:function()
{if(HPUser.is_read_tracking())
mode='off'
else
mode='on'
var url='/users/social_news_project/SNPactions.php?do=change_stealth&value=0';if(mode=='on')
url='/users/social_news_project/SNPactions.php?do=change_stealth&value=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(o.responseText=='ok')
{if(null==$('stealth_holder'))
{holder=document.createElement('div');holder.id='stealth_holder';holder.style.display='none';document.body.appendChild(holder);}
if(HPUser.is_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();}};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(),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_hp_page:0,max_mp_hp_page:-1,current_mbc_page:0,max_mbc_page:-1,current_mbf_page:0,max_mbc_page:-1,current_mbt_page:0,max_mbc_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_more_links:'hide',twitter_timeline_type:'home',loop_page:false,load:function()
{if(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='';get_data='?v='+HPConfig.current_vertical_name;var entry_id=0;if(false!=(entry_id=HuffPoUtil.GetEntryID(location.href)))
{get_data+=(''!=get_data)?'&entry_id='+entry_id:'?entry_id='+entry_id;}
C.asyncRequest('GET','/users/social_news_project/snp_module.php'+get_data,{success:function(o){if(o.responseText!=''){var temp=new Array();temp=o.responseText.split('dlHkvmjso1egjcotPmug0');if("undefined"!=typeof(temp[0]))
{D.get('facebook_friends_unit_wrapper').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);}
SNPModule.made_init=false;SNPModule.init();}},failure:function(o){if($('hidden_snp_body'))
{HuffPoUtil.hide('hidden_snp_body');HPError.e();}},timeout:20000});}},init:function()
{if(this.made_init)return false;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_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_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;for(var i=0;i<=this.max_mbc_page;i++)
{this.snn_mbc_pages[i]=$('snp_mbc_module_page_ids_'+i).innerHTML;}}
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;for(var i=0;i<=this.max_mbf_page;i++)
{this.snn_mbf_pages[i]=$('snp_mbf_module_page_ids_'+i).innerHTML;}}
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;for(var i=0;i<=this.max_mpr_page;i++)
{this.snn_mbt_pages[i]=$('snp_mbt_module_page_ids_'+i).innerHTML;}}
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++)
{this.snn_mpr_pages[i]=$('snp_mpr_module_page_ids_'+i).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(document.getElementById('most_popular_ad_stub'))
{ad_spec={"zone_info":"huffpost.socialnews","tile":2,"width":234,"height":60,"el_id":"ear","interstitial":false,"class_name":"","no_container":false,"type":"iframe"}
HuffPoUtil.WEDGJE.write(ad_spec,"most_popular_ad_stub");}
if(!HPUser.is_facebook())
{if($('sidebar_service_connect')!=null)
{$('sidebar_service_connect').innerHTML="<div style=\"text-align:center\"><a href=\"/social/join.html?autojoin=1\" onclick=\"LazyFB.smartyFBLogin(false); return false;\" target=\"_blank\"><img border=\"0\" src=\"/images/fb-large.gif\" alt=\"Connect with Facebook\" style=\"padding: 16px;\"/></a></div>";}}
else
{HPUser.if_twitter
(function()
{$('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>";},function()
{D.setStyle($('sidebar_service_connect'),'display','none');HuffCookies.setCookie('twitter_linked',1);});}
if(HuffCookies.getCookie('twitter_linked')==1)
{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});});}},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()
{HuffPoUtil.hide('all_frontpage_widgets');},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'mbc_':var max_page=this.max_mpr_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;}
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)
{if(current_page==0)
{D.removeClass('snp_'+type+'left_arrow','tmod_left_arrow_disabled');$('snp_'+type+'left_arrow').style.visibility="visible";}
if(page==0)
{if(!this.loop_page)
{D.addClass('snp_'+type+'left_arrow','tmod_left_arrow_disabled');$('snp_'+type+'left_arrow').style.visibility="hidden";}}
if(current_page==max_page)
{D.removeClass('snp_'+type+'act_right_arrow','tmod_right_arrow_disabled');}
if(page==max_page)
{}}
return;}
if(max_page>0)
{if(current_page==0)
{D.removeClass('snp_'+type+'left_arrow','left_arrow_disabled');}
if(page==0)
{D.addClass('snp_'+type+'left_arrow','left_arrow_disabled');}
if(current_page==max_page)
{D.removeClass('snp_'+type+'right_arrow','right_arrow_disabled');}
if(page==max_page)
{D.addClass('snp_'+type+'right_arrow','right_arrow_disabled');}}},setPage:function(page,type)
{if(!type)type='';switch(type)
{case'':if(page==this.current_page)return false;var current_page=this.current_page;break;case'mp_':if(page==this.current_mp_page)return false;var current_page=this.current_mp_page;break;case'mbc_':if(page==this.current_mbc_page)return false;var current_page=this.current_mbc_page;break;case'mbf_':if(page==this.current_mbf_page)return false;var current_page=this.current_mbf_page;break;case'mbt_':if(page==this.current_mp_page)return false;var current_page=this.current_mbt_page;break;case'mpr_':if(page==this.current_mpr_page)return false;var current_page=this.current_mpr_page;break;case'mp_hp_':if(page==this.current_mp_hp_page)return false;var current_page=this.current_mp_hp_page;break;case'not_signed_mp_':if(page==this.current_notSNN_mp_page)return false;var current_page=this.current_notSNN_mp_page;break;case'not_signed_mbc_':if(page==this.current_notSNN_mbc_page)return false;var current_page=this.current_notSNN_mbc_page;break;case'not_signed_mbf_':if(page==this.current_notSNN_mbf_page)return false;var current_page=this.current_notSNN_mbf_page;break;case'not_signed_mbt_':if(page==this.current_notSNN_mbt_page)return false;var current_page=this.current_notSNN_mbt_page;break;case'not_signed_dm_':if(page==this.current_notSNN_dm_page)return false;var current_page=this.current_notSNN_dm_page;break;case'not_signed_mpr_':if(page==this.current_notSNN_mpr_page)return false;var current_page=this.current_notSNN_mpr_page;break;case'dm_hp_':if(page==this.current_dm_hp_page)return false;var current_page=this.current_dm_hp_page;break;case'act_':if(page==this.current_act_page)return false;var current_page=this.current_act_page;break;case'comment_':if(page==this.current_comment_page)return false;var current_page=this.current_comment_page;break;case'entry_inside_comment_':if(page==this.entry_inside_current_comment_page)return false;var current_page=this.entry_inside_current_comment_page;break;case'twitter_friends_':if(page==this.current_twitter_page)return false;var current_page=this.current_twitter_page;break;}
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');}
else
{this.setLock(type);var get_data='';if(''!=HuffPoUtil.trim(this.current_notSNN_vertical))
{get_data='&is_frontpage=1'}
switch(type)
{case'':var url_to_call='/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_':var url_to_call='/users/social_news_project/snp_module_page.php?type=act&page='+page+'&user_id='+this.url_user_id;break;case'comment_':var url_to_call='/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_':var url_to_call='/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_':var url_to_call='/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'not_signed_mp_':var url_to_call='/widget/frontpage/frontpage_widgets_update.php?type=mp&page='+page+'&entry_ids='+this.notSNN_mp_pages[page]+get_data;break;case'not_signed_dm_':var url_to_call='/widget/frontpage/frontpage_widgets_update.php?type=dm&page='+page+'&entry_ids='+this.notSNN_dm_pages[page]+get_data;break;case'not_signed_mpr_':var url_to_call='/widget/frontpage/frontpage_widgets_update.php?type=mpr&page='+page+'&entry_ids='+this.notSNN_mpr_pages[page]+get_data;break;case'twitter_friends_':var url_to_call='/users/social_news_project/twitter/snn_twitter_page.php?page='+page+"&type="+this.twitter_timeline_type;break;}
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";}
C.asyncRequest('GET',url_to_call,{success:function(o)
{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";}}
else
{HPError.e();SNPModule.animatePage(1,'snp_'+type+'module_all_pages_here');SNPModule.releaseLock(type);}},failure:function(o)
{if(SNPModule.mpTimeout)
{clearTimeout(SNPModule.mpTimeout);}
SNPModule.animatePage(1,'snp_'+type+'module_all_pages_here');SNPModule.releaseLock(type);},timeout:5000});setTimeout('SNPModule.checkTwitterFriendsPage()',2000);}
return true;},checkTwitterFriendsPage:function()
{if($("snp_twitter_friends_left_arrow").style.visibility=="hidden")
{$("snp_twitter_friends_left_arrow").style.visibility="visible";}
if($("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'act_':this.nav_act_locked=1;break;case'comment_':this.nav_comment_locked=1;break;}},releaseLock:function(type)
{switch(type)
{case'':this.nav_locked=0;break;case'mp_':this.nav_mp_locked=0;break;case'act_':this.nav_act_locked=0;break;case'comment_':this.nav_comment_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'act_':if(this.nav_act_locked)return true;break;case'comment_':if(this.nav_comment_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_');},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_');},nextMBCPage:function()
{this.init();var next_index=this.current_mbc_page+1;if(next_index>this.max_mbc_page)
{next_index=this.max_mbc_page;}
this.setPage(next_index,'mbc_');},prevMBCPage:function()
{this.init();var prev_index=this.current_mbc_page-1;if(prev_index<0)
{prev_index=0;}
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=this.max_mbf_page;}
this.setPage(next_index,'mbf_');},prevMBFPage:function()
{this.init();var prev_index=this.current_mbf_page-1;if(prev_index<0)
{prev_index=0;}
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=this.max_mbt_page;}
this.setPage(next_index,'mbt_');},prevMBTPage:function()
{this.init();var prev_index=this.current_mbt_page-1;if(prev_index<0)
{prev_index=0;}
this.setPage(prev_index,'mbt_');},initAutoClickMpPage:function()
{this.nextNotSnnMpPage();this.mpTimeout=setTimeout("SNPModule.initAutoClickMpPage()",this.ms);},nextNotSnnMpPage:function(vertical,user_click)
{if("undefined"!=typeof(user_click)&&0)
{clearTimeout(this.mpTimeout);this.ms=50000;this.mpTimeout=setTimeout("SNPModule.initAutoClickMpPage()",this.ms);}
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(user_click)&&0)
{clearTimeout(this.mpTimeout);this.ms=50000;this.mpTimeout=setTimeout("SNPModule.initAutoClickMpPage()",this.ms);}
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=true;}
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=D.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});},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'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"></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('1'==HuffCookies.get('huffpost_snp_read'))
{$('stealth_mode').innerHTML='<a href="#" id="snn_stealth_status" onclick="SNPModule.stealth.update(); return false;">off</a>';$('snn_stealth_status').style.backgroundPosition='-70px'+' '+0;this.current_status='off';}
else
{$('stealth_mode').innerHTML='<a href="#" id="snn_stealth_status" onclick="SNPModule.stealth.update(); return false;">on</a>';$('snn_stealth_status').style.backgroundPosition=0+' '+0;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(null==$('stealth_holder'))
{holder=document.createElement('div');holder.id='stealth_holder';holder.style.display='none';document.body.appendChild(holder);}
if('on'==SNPModule.stealth.current_status)
{HuffPoUtil.hide('snp_stealth_bubble');var animation=new Y.util.Anim(holder,{width:{to:70}},.7,YAHOO.util.Easing.bounceOut);animation.onTween.subscribe(function(){$('snn_stealth_status').style.backgroundPosition='-'+$(holder).style.width+' '+0;},animation,true);animation.animate();SNPModule.stealth.current_status='off';}
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)?'-':'';$('snn_stealth_status').style.backgroundPosition=prefix+$(holder).style.width+' '+0;},animation,true);animation.animate();if(!SNPModule.stealth.hidden)
{HuffPoUtil.show('snp_stealth_bubble');if(!Y.util.Event.isIE)
{SNPModule.animatePage(1,'snp_stealth_bubble',null,1);}}
SNPModule.stealth.current_status='on';}}
else
{HPError.e();}
if(SNPModule.animation&&0)
{SNPModule.animation.stop();}
},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($('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(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(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(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(){var status=$('tweet_status').value;status=status.replace(/^\s+/g,"");status=status.replace(/\s+$/g,"");D.removeClass('tweetoutmodule','tweet_out_module');if(status.length<=140&&status!='')
{status=encodeURIComponent(status);var get_data="?tweet="+status;$('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){if(o.responseText=='success'){$('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=''; D.addClass('tweetoutmodule', 'tweet_out_module');",15000);return false;},twitterModule:function(callback)
{var entry_id=HuffPoUtil.GetEntryID(location.href);this.twitter_timeline_type='home';$('hidden_twitter_module').style.display="block";$('hidden_twitter_module').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 src="/images/social-profile/lightbox/ajax-loader.gif"></div></div>';var callback={argument:[callback],success:function(o){var callback=o.argument[0];if(o.responseText!="")
{$('hidden_twitter_module').innerHTML=o.responseText;if(entry_id)
{var BITLY_USER='huffpost';var BITLY_KEY='R_3db9b90fe8f78f0f2b180e72055462c8';this.current_reading_entry_id=entry_id;var entry_title=(document.title);var entry_url=(location.href);var tweet_field=$('tweet_status');if(tweet_field)
{HPUtil.loadAndRun('http://bit.ly/javascript-api.js?version=latest&login='+BITLY_USER+'&apiKey='+BITLY_KEY,function()
{BitlyCB.shortenResponse=function(data){var s='';var first_result;for(var r in data.results){first_result=data.results[r];break;}
for(var key in first_result){s+=key+":"+first_result[key].toString()+"\n";if(key=="shortUrl")
var shortUrl=first_result[key].toString();}
var tweet="via @huffingtonpost: "+entry_title+" "+shortUrl;tweet_field.value=tweet;SNPModule.textCounter();}
BitlyClient.shorten(location.href,'BitlyCB.shortenResponse');},this,true);}}
if($('top_twitter_info'))
D.setStyle($('top_twitter_info'),'display','none');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;HuffPoUtil.yellowFlash('hidden_twitter_module');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';if(SNPModule.twitter_more_links=="show")
SNPModule.easeTwitterLinks();SNPModule.loop_page=false;}},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';var co=YAHOO.util.Connect.asyncRequest('GET',url,callback);},textCounter:function(){var maxlimit=140;var field=$('tweet_status');var countField=$('tweet_char_limit');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 div_img=$('snnt_profpic_'+status_id);var div_links=$('snnt_links_'+status_id);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){var get_data="?status_id="+status_id;var el=$('fav_span_'+status_id);D.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'){el.innerHTML="<img src=\"/images/tfav.gif\" />";$('snn_resp_tweet').innerHTML="Tweet added to Favorites";HuffPoUtil.flash($('snn_resp_tweet'));}
else if(o.responseText=='success_favorited'){el.innerHTML="<img src=\"/images/tfav.gif\" />";$('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($('snn_resp_tweet'))
setTimeout("$('snn_resp_tweet').innerHTML=''; D.addClass('tweetoutmodule', 'tweet_out_module');",15000);},failure:function(o){if($('hidden_snp_body'))
{HuffPoUtil.hide('hidden_snp_body');HPError.e();}},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;},easeTwitterLinks:function()
{if($('tmore_links').innerHTML=="(More)")
{var attributes={height:{to:20}};$('tmore_links').innerHTML="(Less)";this.twitter_more_links="show";}
else
{var attributes={height:{to:0}};$('tmore_links').innerHTML="(More)";this.twitter_more_links="hide";}
var anim=new YAHOO.util.Anim('more_twitter_links',attributes,0.5,YAHOO.util.Easing.easeIn);anim.animate();return;},twitterTimeline:function(type)
{if(type==this.twitter_timeline_type)
return;if(type=='mentions')
{$('ttop_links').innerHTML="Twitter <a href=\"javascript:void(0);\" id=\"tmore_links\" style=\"color:#FFF;\" onclick=\"SNPModule.twitterTimeline('home');\"><span class=\"small_ttext\">(Friends)</span></a>";}
else if(type=='home')
{$('ttop_links').innerHTML="Twitter <a href=\"javascript:void(0);\" id=\"tmore_links\" style=\"color:#FFF;\" onclick=\"SNPModule.twitterTimeline('mentions');\"><span class=\"small_ttext\">(Mentions)</span></a>";}
var get_data="?type="+type;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 src="/images/social-profile/lightbox/ajax-loader.gif"></div></div>';HuffPoUtil.hide('tmodpaging');C.asyncRequest('GET','/users/social_news_project/twitter/twitter_timeline.php'+get_data,{success:function(o){var resp=o.responseText;var resp_arr=resp.split(":::");$('snp_twitter_friends_module_all_pages_here').innerHTML=resp_arr[0];$('snp_twitter_max_page_counter').innerHTML=resp_arr[1];SNPModule.max_twitter_page=parseInt(resp_arr[1]);SNPModule.current_twitter_page=0;D.addClass('snp_twitter_friends_left_arrow','tmod_left_arrow_disabled');if(SNPModule.max_twitter_page<=1)
{D.addClass('snp_twitter_friends_act_right_arrow','tmod_right_arrow_disabled');}
else
D.removeClass('snp_twitter_friends_act_right_arrow','tmod_right_arrow_disabled');HuffPoUtil.show('tmodpaging');$('snp_twitter_friends_left_arrow').style.visibility="hidden";SNPModule.loop_page=false;},failure:function(o){HPError.e();},timeout:20000});}
}
var HPUser={'is_facebook':function()
{if(HuffPoUtil.getCookie(HPFB.api_key)!=''&&HuffPoUtil.getCookie(HPFB.api_key+'_expires')!=''&&HuffPoUtil.getCookie(HPFB.api_key+'_session_key')!=''&&HuffPoUtil.getCookie(HPFB.api_key+'_ss')!=''&&HuffPoUtil.getCookie(HPFB.api_key+'_user')!='')
{return true;}
else if(/fbcdn/.test(HuffCookies.getBigAvatar())||/facebook\.com/.test(HuffCookies.getBigAvatar())||/fbcdn/.test(HuffCookies.getSmallAvatar())||/facebook\.com/.test(HuffCookies.getSmallAvatar()))
{return true;}
return false;},'if_twitter':function(no_cb,yes_cb)
{var linked=HuffCookies.getCookie('twitter_linked');if(linked==="1")
{yes_cb();return;}
else if(linked==="0")
{no_cb();return;}
else
{var callback={argument:[no_cb,yes_cb],success:function(o){var no_cb=o.argument[0];var yes_cb=o.argument[1];if(o.responseText=='linked')
{HuffCookies.setCookie('twitter_linked','1');yes_cb();}
else
{HuffCookies.setCookie('twitter_linked','0');no_cb();}},failure:function(o){o.argument[0];return;}};var url="/users/social_news_project/twitter/twitter_status.php";var co=YAHOO.util.Connect.asyncRequest('GET',url,callback);}},'is_googlefc':function(){},'is_logged_in':function()
{if(HuffCookies.get('huffpost_user')&&HuffCookies.get('huffpost_pass')&&HuffCookies.get('huffpost_user_id'))
return true;return false;},'is_hpsn_member':function(){return(HuffCookies.get('huffpost_snp_status')==1)?true:false;},'is_read_tracking':function(){return(HuffCookies.get('huffpost_snp_read')==1)?true: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={_this:this,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);D.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 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 FbFeedBundleId=splits[6];var FbFeedTokens={"entry_title":splits[7],"entry_desc":splits[10],"entry_link":splits[9],"images":[{"src":splits[11],"href":splits[9]}]};if(!this.is_facebook_id_saved){LazyFB.ensureInit(function(){nFaceBookId=FB.Connect.get_loggedInUser();if(nFaceBookId){YAHOO.util.Connect.asyncRequest('POST','/commentsv3/_saveFacebookId.php',{success:function(){_this.is_facebook_id_saved=true;}},'facebook_id='+nFaceBookId);FB.Connect.showFeedDialog(FbFeedBundleId,FbFeedTokens,null,null,null,FB.RequireConnect.require,null,'Your comment is here',{value:splits[8]});}});}
else{if(!document.getElementById('fb_login_image')){LazyFB.ensureInit(function(){FB.Connect.showFeedDialog(FbFeedBundleId,FbFeedTokens,null,null,null,FB.RequireConnect.require,null,'Your comment is here',{value:splits[8]});});}}}
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 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){el.innerHTML=o.responseText;el.style.display='block';LazyFB.ensureInit(function(){FB.XFBML.Host.parseDomTree();var nFacebookId=FB.Connect.get_loggedInUser();if(nFacebookId&&_this.bIsFacebookChecked){var checkBox=$('huffpick_post_to_facebook_'+CommentId);if(checkBox)checkBox.checked=true;var fbDiv=$('huffpick_facebook_data_'+CommentId);if(fbDiv)fbDiv.style.display='block';}},true);},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){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;LazyFB.ensureInit(function(){FB.XFBML.Host.parseDomTree();nFaceBookId=FB.Connect.get_loggedInUser();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);}},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())};
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(!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');Modal.sizeMask();if(message_id>0)
{$('hpm_reply_box_subject').value='Re: '+HuffPoUtil.trim($('hpm_subject_text').innerHTML);var el_y=D.getY('hpm_btn_submit');var mess_y=D.getY('hpm_message_'+message_id);var scroll_top=D.getDocumentScrollTop()
var viewport_y=D.getViewportHeight();var d_offset=scroll_top+viewport_y;if(el_y>d_offset-20)
{if(el_y-mess_y>viewport_y)
{HuffPoUtil.ScrollTo('hp_message_reply_box');}
else
{HuffPoUtil.ScrollTo('hpm_message_'+message_id);}
}
else
{if(mess_y<scroll_top)
{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)');return false;}
txt=HuffPoUtil.trim($('hpm_reply_box_subject').value);if(!txt.length)
{HPError.e('Please write a subject');return false;}
txt=HuffPoUtil.trim($('hpm_reply_box').value);if(!txt.length)
{HPError.e('Please write a message');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);}
else if(typeof(response.message_id)=="undefined"||response.message_id<=0)
{HPError.e(response.error_message)}
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();$('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');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(740);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;if($('hpm_all_other_users'))
HpMessage.reply_all_str=HuffPoUtil.trim($('hpm_all_other_users').innerHTML);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"></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();Modal.hideMask();},close:function(){HpMessage.lightbox.isFormLoaded=false;}
}}
