
/*wikinvest/javascript/hooks.js*/

if(typeof(nv.Hooks)=='undefined'){nv.Hooks={};}
nv.Hooks={hooks:new Array(),addToHook:function(hookName,fn){if(nv.Hooks.hooks[hookName]==null){nv.Hooks.hooks[hookName]=new Array();}
nv.Hooks.hooks[hookName].push(fn);},runHooks:function(hookName,args){var fns=nv.Hooks.hooks[hookName];if(fns!=null){for(var i=0;i<fns.length;i++){var fn=fns[i];fn.call(null,args);}}}};
/* /wikinvest/javascript/hooks.js*/

/*wikinvest/javascript/reason/Reason.js*/

nv.CreateNamespace("nv.Reason");nv.Reason.Message={empty_headline:'Please enter a headline',empty_reason_text:'Please enter a reason',headline_conflict:'A reason with this headline already exists',edit_conflict:'Another user was editing this reason at the same time',edit_not_allowed:'This reason has been protected and cannot be edited'};nv.Reason.Reason=function(reasonId,currentVote,inlineEditor,reasonTitleText){var $this=this;var jQuery=nv.JQuery;var __construct=function(){$this._reasonId=reasonId;$this._currentVote=currentVote;$this.inlineEditor=inlineEditor;$this._voteUpImg=jQuery('#reason_vote_up_'+reasonId);$this._voteDownImg=jQuery('#reason_vote_down_'+reasonId);$this._voteStarburst=jQuery('#reason_vote_starburst_'+reasonId);$this._totalContainer=jQuery('#reason_vote_total_'+reasonId);$this._percentContainers=new Array();$this._percentContainers.push(jQuery('#reason_vote_percent_'+reasonId));if(jQuery('#reason_vote_percent_toc_'+reasonId)){$this._percentContainers.push(jQuery('#reason_vote_percent_toc_'+reasonId));}
nv.Hooks.addToHook('TranscludedArticleUpdated',function(args){var oldTitleText=args[0];var newTitleText=args[1];if(oldTitleText!=newTitleText&&oldTitleText==reasonTitleText){jQuery('#reasonTocTitle_'+reasonId).html(args[2]);reasonTitleText=newTitleText;}});};$this.voteUp=function(partnerId,userToken){if($this._currentVote==nv.Reason.Reason.VOTE_UP){$this.vote(nv.Reason.Reason.VOTE_NONE,partnerId,userToken);}
else{$this.vote(nv.Reason.Reason.VOTE_UP,partnerId,userToken);}};$this.voteDown=function(partnerId,userToken){if($this._currentVote==nv.Reason.Reason.VOTE_DOWN){$this.vote(nv.Reason.Reason.VOTE_NONE,partnerId,userToken);}
else{$this.vote(nv.Reason.Reason.VOTE_DOWN,partnerId,userToken);}};$this.vote=function(newVote,partnerId,userToken){var args={'action':'voteForReason','reasonID':$this._reasonId,'vote':newVote};if(partnerId!=null&&userToken!=null){args['partnerId']=partnerId;args['userToken']=userToken;}
$this._voteStarburst.show();nv.http.request({url:nv.APIUrl,method:'GET',data:args,success:$this.voteCallback,error:$this.voteErrorCallback});};$this.voteCallback=function(data){$this._currentVote=data.vote;$this._totalContainer.html(data.upCount+data.downCount);for(var i=0;i<$this._percentContainers.length;i++){$this._percentContainers[i].html(data.percent);}
$this.refreshVoteImages();$this._voteStarburst.hide();};$this.voteErrorCallback=function(data){$this._voteStarburst.hide();};$this.refreshVoteImages=function(){if($this._currentVote==nv.Reason.Reason.VOTE_NONE){$this._voteUpImg.attr('src',nv.Reason.Reason.VOTE_UP_IMG_UNSELECTED);$this._voteDownImg.attr('src',nv.Reason.Reason.VOTE_DOWN_IMG_UNSELECTED);$this._voteUpImg.removeClass('reason_vote_button_up_selected');$this._voteDownImg.removeClass('reason_vote_button_down_selected');}
else if($this._currentVote==nv.Reason.Reason.VOTE_UP){$this._voteUpImg.attr('src',nv.Reason.Reason.VOTE_UP_IMG_SELECTED);$this._voteDownImg.attr('src',nv.Reason.Reason.VOTE_DOWN_IMG_UNSELECTED);$this._voteUpImg.addClass('reason_vote_button_up_selected');$this._voteDownImg.removeClass('reason_vote_button_down_selected');}
else if($this._currentVote==nv.Reason.Reason.VOTE_DOWN){$this._voteUpImg.attr('src',nv.Reason.Reason.VOTE_UP_IMG_UNSELECTED);$this._voteDownImg.attr('src',nv.Reason.Reason.VOTE_DOWN_IMG_SELECTED);$this._voteUpImg.removeClass('reason_vote_button_up_selected');$this._voteDownImg.addClass('reason_vote_button_down_selected');}};$this.hoverVoteUp=function(){if($this._currentVote!=nv.Reason.Reason.VOTE_UP){$this._voteUpImg.attr('src',nv.Reason.Reason.VOTE_UP_IMG_HOVER);}};$this.hoverVoteDown=function(){if($this._currentVote!=nv.Reason.Reason.VOTE_DOWN){$this._voteDownImg.attr('src',nv.Reason.Reason.VOTE_DOWN_IMG_HOVER);}};__construct();};nv.Reason.Reason.VOTE_NONE=0;nv.Reason.Reason.VOTE_UP=1;nv.Reason.Reason.VOTE_DOWN=2;nv.Reason.Reason.VOTE_UP_IMG_SELECTED="http://cdn.wikinvest.com/wikinvest/images/reason/vote_up_selected.png";nv.Reason.Reason.VOTE_UP_IMG_UNSELECTED="http://cdn.wikinvest.com/wikinvest/images/reason/vote_up_unselected.png";nv.Reason.Reason.VOTE_UP_IMG_HOVER="http://cdn.wikinvest.com/wikinvest/images/reason/vote_up_hover.png";nv.Reason.Reason.VOTE_DOWN_IMG_SELECTED="http://cdn.wikinvest.com/wikinvest/images/reason/vote_down_selected.png";nv.Reason.Reason.VOTE_DOWN_IMG_UNSELECTED="http://cdn.wikinvest.com/wikinvest/images/reason/vote_down_unselected.png";nv.Reason.Reason.VOTE_DOWN_IMG_HOVER="http://cdn.wikinvest.com/wikinvest/images/reason/vote_down_hover.png";
/* /wikinvest/javascript/reason/Reason.js*/

/*wikinvest/javascript/reason/WidgetReason.js*/

nv.CreateNamespace("nv.Reason.Widget");nv.Reason.Widget.Reason=function(reasonId,currentVote,reasonTitleText){nv.util.OOP.extend(this,nv.Reason.Reason,reasonId,currentVote,null,reasonTitleText);var $this=this;var $=nv.$;var __construct=function(){$this._contractedDiv=$('#reasonContracted_'+reasonId);$this._expandedDiv=$('#reasonExpanded_'+reasonId);$this._percentContainers.push($('#reason_vote_percent_contracted_'+reasonId));$this._isExpanded=false;};$this.hover=function(inOrOut){if($this._isExpanded==true){$this.hoverExpanded(inOrOut);}
else{$this.hoverContracted(inOrOut);}};$this.hoverExpanded=function(inOrOut){};$this.hoverContracted=function(inOrOut){if(inOrOut=='in'){$this._contractedDiv.addClass('reasonContractedHover');}
else if(inOrOut=='out'){$this._contractedDiv.removeClass('reasonContractedHover');}};$this.expand=function(){$this.hoverContracted('out');$this._contractedDiv.hide();$this._expandedDiv.show();$this._isExpanded=true;};$this.contract=function(){$this._expandedDiv.hide();$this._contractedDiv.show();$this._isExpanded=false;};__construct();};
/* /wikinvest/javascript/reason/WidgetReason.js*/

/*wikinvest/javascript/reason/WidgetReasonManager.js*/

nv.CreateNamespace("nv.Reason.Widget");nv.Reason.Widget.ReasonManager=function(jsManagerVarName){nv.util.OOP.extend(this,nv.Reason.AbstractReasonManager,jsManagerVarName);var $this=this;var __construct=function(){$this._expandedId=null;};$this.contract=function(reasonId){if($this._expandedId!=null){$this._reasons['r'+$this._expandedId].contract();$this._expandedId=null;}};$this.expand=function(reasonId){if($this._expandedId!=null){$this._reasons['r'+$this._expandedId].contract();}
$this._reasons['r'+reasonId].expand();$this._expandedId=reasonId;};$this.hoverIn=function(reasonId){$this._reasons['r'+reasonId].hover('in');};$this.hoverOut=function(reasonId){$this._reasons['r'+reasonId].hover('out');};__construct();};
/* /wikinvest/javascript/reason/WidgetReasonManager.js*/

/*wikinvest/export/v2/custom/usaToday/overrides.js*/

if(typeof g_usat_resource_version=='undefined')g_usat_resource_version="";nv.Reason.Reason.VOTE_UP_IMG_SELECTED=g_partnerapi_baseURL+"/custom/usaToday/images/reason/agree_depressed"+g_usat_resource_version+".gif";nv.Reason.Reason.VOTE_UP_IMG_UNSELECTED=g_partnerapi_baseURL+"/custom/usaToday/images/reason/agree_default"+g_usat_resource_version+".gif";nv.Reason.Reason.VOTE_UP_IMG_HOVER=g_partnerapi_baseURL+"/custom/usaToday/images/reason/agree_highlight"+g_usat_resource_version+".gif";nv.Reason.Reason.VOTE_DOWN_IMG_SELECTED=g_partnerapi_baseURL+"/custom/usaToday/images/reason/disagree_depressed"+g_usat_resource_version+".gif";nv.Reason.Reason.VOTE_DOWN_IMG_UNSELECTED=g_partnerapi_baseURL+"/custom/usaToday/images/reason/disagree_default"+g_usat_resource_version+".gif";nv.Reason.Reason.VOTE_DOWN_IMG_HOVER=g_partnerapi_baseURL+"/custom/usaToday/images/reason/disagree_highlight"+g_usat_resource_version+".gif";nv.API_URL=g_server+nv.API_URL;
/* /wikinvest/export/v2/custom/usaToday/overrides.js*/

/*wikinvest/export/v2/custom/usaToday/offsiteVoting.js*/

if(typeof(nv)=='undefined'){nv={};}
if(typeof(nv.Reason)=='undefined'){nv.Reason={};}
if(typeof(nv.Reason.VotingManager)=='undefined'){nv.Reason.VotingManager={};}
if(typeof(nv.Reason.OffsiteVoting)=='undefined'){nv.Reason.OffsiteVoting={};}
nv.Reason.OffsiteVoting.getCookie=function(pKey)
{var allCookies=document.cookie.split(';');var thisCookie='';var cookieName='';var cookieValue='';for(i=0;i<allCookies.length;i++)
{thisCookie=allCookies[i].split('=');cookieName=thisCookie[0].replace(/^\s+|\s+$/g,'');if(cookieName==pKey)
{if(thisCookie.length>1)
{cookieValue=unescape(thisCookie[1].replace(/^\s+|\s+$/g,''));return cookieValue;}}}
return"";};nv.Reason.VotingManager.getPartnerIdForOffsiteVote=function(){return"USA Today";};nv.Reason.VotingManager.getUserTokenForOffsiteVote=function(){var cookieName='wikinvestOffisteVoting';var offsiteVotingId=nv.Reason.OffsiteVoting.getCookie(cookieName);if(offsiteVotingId!=""){return offsiteVotingId;}
else{var rmid=nv.Reason.OffsiteVoting.getCookie("RMID");if(rmid==""){rmid=""+(new Date()).getTime()+Math.floor(Math.random()*9999999999);}
var cookieLifeDays=365;offsiteVotingId='nv'+rmid;var date=new Date();date.setTime(date.getTime()+(cookieLifeDays*24*60*60*1000));var expires="; expires="+date.toGMTString();document.cookie=cookieName+'='+escape(offsiteVotingId)+expires;return offsiteVotingId;}
return"CookiesWereNotAvailable";};
/* /wikinvest/export/v2/custom/usaToday/offsiteVoting.js*/
