if(window.Evri===undefined){window.Evri={};}
if(window.Evri.defineNamespace===undefined){window.Evri.defineNamespace=function(root,namespace,items){items=items||{};if(root[namespace]===undefined){root[namespace]=items;}};window.Evri.extendNamespace=function(namespace,extensions){for(var i in extensions){if(namespace[i]===undefined){namespace[i]=extensions[i];}}};window.Evri.defineClass=function(root,className,constructor){if(root[className]===undefined){root[className]=function(){constructor.apply(this,arguments);};}};window.Evri.extendClass=function(klass,extensions){for(var i in extensions){if(klass.prototype[i]===undefined){klass.prototype[i]=extensions[i];}}};};Evri.defineNamespace(Evri,"API");Evri.extendNamespace(Evri.API,{isSetup:false,requestFailed:function(options){console.log(options.httpCode+": "+options.message);},setup:function(options){options=options||{};Evri.API.Environment.setTransport(options.transport);if(Evri.API.isSetup===false){Evri.API.Transport.setup();Evri.API.isSetup=true;}}});Evri.defineNamespace(Evri.API,"Environment");Evri.extendNamespace(Evri.API.Environment,{apiHost:"api.evri.com",apiPort:80,apiVersion:"v1",staticAssetBaseUrl:"http://www.evri.com/widget",portalHost:"www.evri.com",swfProxyHost:"www.evri.com",articleInIframe:false,set:function(key,value){if(key=="Transport"){alert("Use setTransport to change transport.");}else{Evri.API.Environment[key]=value;}
return Evri.API.Environment;},setTransport:function(transport){switch(transport){case"XmlHttp":Evri.API.Transport=Evri.API.XmlHttp;break;default:Evri.API.Transport=Evri.API.CrossDomain;break;}
return Evri.API.Environment;}});Evri.defineNamespace(Evri.API,"Utilities");Evri.extendNamespace(Evri.API.Utilities,{articleTracker:{'evri-washington-post':'waporef=evri.widget.1'},Date:{relativeDate:function(date,options){var displayDate="";options=options||{};if(date!==undefined){var nowDate=new Date();var pubDate=new Date(date);var nowDateUTCEpoch=Evri.API.Utilities.Date.utcEpochFor(nowDate);var pubDateUTCEpoch=Evri.API.Utilities.Date.utcEpochFor(pubDate);var epochDiff=Math.abs(nowDateUTCEpoch-pubDateUTCEpoch);var minute=60;var hour=60*minute;var day=24*hour;var week=7*day;var months=['January','February','March','April','May','June','July','August','September','October','November','December'];if(epochDiff<week){if(epochDiff<minute){displayDate="less than a minute ago";}else if(epochDiff<hour){var minutesAgo=Math.floor(epochDiff/minute);displayDate=""+minutesAgo+" minute"+(minutesAgo==1?'':'s')+" ago";}else if(epochDiff<day){var hoursAgo=Math.floor(epochDiff/hour);displayDate=""+hoursAgo+" hour"+(hoursAgo==1?'':'s')+" ago";}else{var daysAgo=Math.floor(epochDiff/day)
displayDate=""+daysAgo+" day"+(daysAgo==1?'':'s')+" ago";}}else{displayDate=months[pubDate.getUTCMonth()]+" "+pubDate.getUTCDate()+", "+pubDate.getUTCFullYear();}}
return displayDate;},utcEpochFor:function(date){return parseInt(Date.UTC(date.getFullYear(),date.getMonth(),date.getDate(),date.getHours(),date.getMinutes(),date.getSeconds(),date.getMilliseconds())/1000);}},HTML:{attributesFrom:function(attrs){var attrString="";for(var attrName in attrs){switch(attrName){case'class':attrString+=" "+attrName+'="'+attrs[attrName].replace(/\"/,'&quot;')+'"';break;default:break;}}
return attrString;},tokenizeStringHighlights:function(session,content,matches){var tokens=[];if(matches.length>0){var startPosition=0;for(var i=0;i<matches.length;i++){var match=matches[i];if(match.start>startPosition){tokens.push(new session.models.ContentRange(content.substr(startPosition,(match.start-startPosition))));}
tokens.push(new session.models.ContentRange(content.substr(match.start,match.snippetLength),match));startPosition=match.start+match.snippetLength;}
if(startPosition<content.length){tokens.push(new session.models.ContentRange(content.substr(startPosition,(content.length-startPosition))));}}else{tokens.push(new session.models.ContentRange(content));}
return tokens;},highlightContent:function(session,content,matches,tag,attrs){attrs=attrs||{};var tokens=Evri.API.Utilities.HTML.tokenizeStringHighlights(session,content,matches);var newContent="";var startTag="<"+tag+Evri.API.Utilities.HTML.attributesFrom(attrs)+">";var endTag="</"+tag+">";for(var i=0;i<tokens.length;i++){var range=tokens[i];newContent+=(range.matchedLocation!==undefined?startTag+range.content+endTag:range.content)}
return newContent;}},String:{capitalize:function(content){return content.charAt(0).toUpperCase()+content.substring(1).toLowerCase();}},URI:{cleanDomain:function(possibleDomain){return possibleDomain;},params:function(url){var hasQueryString=url.indexOf('?')>-1?true:false;var queryParams={};if(hasQueryString){var queryString=url.substring(url.indexOf('?')+1);var queryItems=queryString.split('&');for(var i=0;i<queryItems.length;i++){var queryItem=queryItems[i].split('=');queryParams[queryItem[0]]=decodeURIComponent(queryItem[1]);}}
return queryParams;}},baseUrl:function(){var url="http://"
+Evri.API.Environment.apiHost
+(isNaN(Evri.API.Environment.apiPort)==true||parseInt(Evri.API.Environment.apiPort)==80?"":":"+Evri.API.Environment.apiPort)
+"/"
+Evri.API.Environment.apiVersion;return url;},toQueryString:function(params,options){var prefix='?';options=options||{};if(options.truncateLongValues===undefined){options.truncateLongValues=false;}
if(options.hasQueryString!==undefined&&options.hasQueryString===true){prefix='&';}
var paramsList=[];for(var key in params){if(params[key]!==undefined){if((params[key]instanceof Array)===true){for(var i=0;i<params[key].length;i++){var value=encodeURIComponent(params[key][i]);paramsList.push(key+"="+value);}}else{var value=params[key];if(typeof(value)==="string"){if(key=="text"&&options.truncateLongValues===true){value=value.substr(0,1250).replace(/\s\S+?$/,'');}}
value=encodeURIComponent(value);paramsList.push(key+"="+value);}}}
var queryString=paramsList.join("&");return prefix+queryString;},currentURI:function(){return window.location.href.split('#')[0];},getRequestDuration:function(requestKey){return((new Date()).getTime()-(parseInt(requestKey.split("_")[0])))/1000;},apiURIForPath:function(uriPath){return window.location.protocol+"//"+Evri.API.Environment.apiHost+"/"+Evri.API.Environment.apiVersion+uriPath;},portalURIForPath:function(uriPath){var hasQueryString=uriPath.indexOf('?')>-1?true:false;return window.location.protocol+"//"
+Evri.API.Environment.portalHost+uriPath
+Evri.API.Utilities.toQueryString({jsapi:window.location.host},{hasQueryString:hasQueryString});},Class:{create:function(klassName){function klass(){this.klass=klassName;this.initialize.apply(this,arguments);}
return klass;}},JSON:{bindChildrenAndAttributesToObject:function(jsonNode,target){if(target.instanceAttributes===undefined){}
for(var member in jsonNode){if(Evri.API.Utilities.JSON.isAttribute(member)===true){target[member.substring(1)]=Evri.API.Utilities.JSON.getAttributeForNode(jsonNode,member);}else{target[member]=Evri.API.Utilities.JSON.getValueForPath(jsonNode,member);}}},getAttributeForNode:function(jsonNode,attr){return jsonNode[attr];},getNodeForPath:function(jsonNode,path){var nodeSet=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,path);var node=undefined;if(nodeSet!==undefined&&nodeSet.length>0){node=nodeSet[0];}
return node;},getNodeSetForPath:function(jsonNode,path){var traversal=Evri.API.Utilities.JSON.__traversal(jsonNode,path);var referenceNodeSet=[];if(traversal.status===true){referenceNodeSet=traversal.referenceNodeSet;}
return referenceNodeSet;},getValueForPath:function(jsonNode,path){var referenceNodeSet=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,path);var value=null;if(referenceNodeSet!==undefined&&referenceNodeSet.length>0&&referenceNodeSet[0]['$']!==undefined){value=referenceNodeSet[0]['$'];}
return value;},getValueForNode:function(jsonNode){return(jsonNode.$===undefined?undefined:jsonNode.$);},getValueForNodeSet:function(jsonNode,path){var nodeSet=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,path);var values=[];if(nodeSet.length>0){for(var cntr=0;cntr<nodeSet.length;cntr++){values.push(Evri.API.Utilities.JSON.getValueForNode(nodeSet[cntr]));}}
return values;},hasDescendantsForPath:function(jsonNode,path){return Evri.API.Utilities.JSON.__traversal(jsonNode,path).status;},isAttribute:function(path){return path.substring(0,1)=='@';},__traversal:function(jsonNode,path){var pathItems=path.split('/');var status=true;var referenceNode=jsonNode;var referenceNodeSet=[];for(var i=0;i<pathItems.length;i++){var pathItem=pathItems[i];if(referenceNode[pathItem]!==undefined){if((referenceNode[pathItem]instanceof Array)===true){referenceNodeSet=referenceNode[pathItem];referenceNode=referenceNodeSet[0];}else{referenceNodeSet=[referenceNode[pathItem]];referenceNode=referenceNodeSet[0];}}else{status=false;}}
return{referenceNode:referenceNode,referenceNodeSet:referenceNodeSet,status:status};}},buildMediaSourceUrl:function(pageUrl,title,defaultUrl,articleLinkTrackerKey){var mediaSourceUrl=defaultUrl;if(Evri.API.Environment.articleInIframe===true){if(articleLinkTrackerKey){var hasQueryString=pageUrl.indexOf('?')>-1?true:false;var articleLinkTrackerToken='';if(hasQueryString){articleLinkTrackerToken="&"+articleLinkTrackerKey;}
else{articleLinkTrackerToken="?"+articleLinkTrackerKey;}
pageUrl+=articleLinkTrackerToken;}
var portalUrl=window.location.protocol+"//"+Evri.API.Environment.portalHost;var widgetHostUrl=window.location.protocol+"//"+window.location.host;var mediaIFramePath="/media/article?page="+encodeURIComponent(pageUrl)+"&source="+encodeURIComponent(widgetHostUrl)+"&title="+encodeURIComponent(title);mediaSourceUrl=portalUrl+mediaIFramePath;}
else{if(articleLinkTrackerKey){var hasQueryString=mediaSourceUrl.indexOf('?')>-1?true:false;if(hasQueryString){var queryParams=Evri.API.Utilities.URI.params(mediaSourceUrl);var mediaSourceUrlStrippedQueryString=mediaSourceUrl.substring(0,mediaSourceUrl.indexOf('?'));var urlqueryTokenValue=queryParams["url"];if(urlqueryTokenValue){var articleLinkTrackerToken='';var hasQueryString=urlqueryTokenValue.indexOf('?')>-1?true:false;if(hasQueryString){articleLinkTrackerToken="&"+articleLinkTrackerKey;}
else{articleLinkTrackerToken="?"+articleLinkTrackerKey;}
queryParams["url"]=urlqueryTokenValue+articleLinkTrackerToken;mediaSourceUrlStrippedQueryString+=Evri.API.Utilities.toQueryString(queryParams);mediaSourceUrl=mediaSourceUrlStrippedQueryString;}}}}
return mediaSourceUrl;}});Evri.defineNamespace(Evri.API,"CrossDomain");Evri.extendNamespace(Evri.API.CrossDomain,{Model:{KeyGenerator:Evri.API.Utilities.Class.create('KeyGenerator')},Callbacks:{},setup:function(){Evri.API.CrossDomain.Model.KeyGenerator.prototype={initialize:function(){var self=this;var requestCounter=0;self.generateKey=function(){return""+(new Date()).getTime()+"_"+(++requestCounter);};}};Evri.API.CrossDomain.KeyGenerator=new Evri.API.CrossDomain.Model.KeyGenerator();},request:function(resource,params){if(params.uri===undefined&&params.queryToken===undefined){params.uri=Evri.API.Utilities.currentURI();}
Evri.API.CrossDomain.requestViaScriptTag(resource,params);},requestViaScriptTag:function(resource,params){var requestUrl='';if(params.isThirdPartyAPICall===true){params.appId=undefined;params.isThirdPartyAPICall=undefined;params.uri=undefined;var options={truncateLongValues:true};if(params.hasQueryString!==undefined&&params.hasQueryString===true){options.hasQueryString=true;params.hasQueryString=undefined;}
requestUrl=resource+Evri.API.Utilities.toQueryString(params,options);}
else{requestUrl=Evri.API.Utilities.baseUrl()+resource+".json"+Evri.API.Utilities.toQueryString(params,{truncateLongValues:true});}
var script=document.createElement("script");script.type="text/javascript";script.src=requestUrl;script.setAttribute("class","evri-jsonp-request");document.body.appendChild(script);},callRemoteMethod:function(session,resource,jsonpCallback,params,responseCallbacks){var requestKey=Evri.API.CrossDomain.KeyGenerator.generateKey();Evri.API.CrossDomain.Callbacks["_"+requestKey]={handler:function(responseJSON){responseJSON.requestDuration=Evri.API.Utilities.getRequestDuration(requestKey);jsonpCallback.call(null,responseJSON,responseCallbacks);}};for(var paramKey in session.sharedQueryStringParameters){params[paramKey]=session.sharedQueryStringParameters[paramKey];}
params.callback="Evri.API.CrossDomain.Callbacks._"+requestKey+".handler";if(responseCallbacks.onCreate!==undefined){responseCallbacks.onCreate.call();}
Evri.API.CrossDomain.request(resource,params);},handleJSONResponse:function(session,responseJSON,callbacks,responseHandler){var evriThingNode=responseJSON.evriThing;var responseStatus=Evri.API.Utilities.JSON.getAttributeForNode(evriThingNode,'@status');var requestDuration=responseJSON.requestDuration;if(callbacks!==undefined){var responseMessages=Evri.API.Utilities.JSON.getNodeSetForPath(evriThingNode,"messages/message");var errorMessages=[];if(responseStatus!="OK"&&responseMessages.length>1){for(var i=0;i<responseMessages.length;i++){var message=responseMessages[i];if(parseInt(message["@code"])!==0){errorMessages.push(Evri.API.Utilities.JSON.getValueForNode(message));}}}
if(responseStatus=="ERROR"&&callbacks.onFailure!==undefined){var errorMessage="An error occurred";if(errorMessages.length>=1){errorMessage=errorMessages.join("; ");}
var error=new session.models.APIError(errorMessages,{"responseJSON":responseJSON});error.requestDuration=requestDuration;callbacks.onFailure.call(null,error);return;}
var responseItem=null;if(callbacks.onLoaded!==undefined){callbacks.onLoaded.call(null,responseJSON);}
responseItem=responseHandler.call(null,responseJSON.evriThing);if(responseItem===null||responseItem===undefined){if(callbacks.onFailure!==undefined){var error=new session.models.APIError("Response object could not be instantiated",{"responseJSON":responseJSON});error.requestDuration=requestDuration;callbacks.onFailure.call(null,error);}}else{responseItem.requestDuration=requestDuration;if(callbacks.bindWith!==undefined){callbacks.bindWith.call(null,responseItem);}
callbacks.onComplete.call(null,responseItem);}}}});Evri.defineNamespace(Evri.API,"XmlHttp");Evri.defineNamespace(Evri.API,"Model");Evri.extendNamespace(Evri.API.Model,{entityTypes:['animal','bacterium','chemical','concept','condition','disorder','event','location','organism','organization','person','plant','product','substance','virus'],classes:['APIError','Article','ArticleLink','ArticleList','ContentRange','Entity','EntityConstraint','EntityList','EntityHistories','EntityHistory','EntityHistoryMention','EntityProperty','EntityPropertyList','EntityRelation','EntityRelationList','EntitySet','Facet','Graph','Image','ImageList','MatchedLocation','Media','MediaConstraint','Pair','Product','ProductList','Quote','QuoteList','Sentiment','SentimentList','SentimentSummary','SentimentSummaryList','Target','TargetList','Tweet','TweetList','TwitterQuery','TweetMatchedLocation','Video','VideoList','VideoStillImage','Zeitgeist'],generateForSession:function(session){session.models={};for(var i=0;i<Evri.API.Model.classes.length;i++){var klassName=Evri.API.Model.classes[i];Evri.API.Model.Class.create(klassName,session);}},generateResponseHandler:function(session,klass,handlerOptions){handlerOptions=handlerOptions||{};return function(responseJSON,responseCallbacks){Evri.API.Transport.handleJSONResponse(session,responseJSON,responseCallbacks,function(jsonNode){if(handlerOptions.beforeInstantiate!==undefined){switch(typeof(handlerOptions.beforeInstantiate)){case"function":jsonNode=handlerOptions.beforeInstantiate.call(null,jsonNode);break;case"string":jsonNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,handlerOptions.beforeInstantiate);break;default:break;}}
return new(session.models[klass])(jsonNode);});};}});Evri.defineNamespace(Evri.API.Model,"Class");Evri.extendNamespace(Evri.API.Model.Class,{create:function(klassName,session){if(Evri.API.Model[klassName]._prototypeWith!==undefined){session.models[klassName]=function(){this.klass=klassName;this.session=session;this.documentationUrl=Evri.API.Utilities.portalURIForPath("/developer/jsapi/index")+"#"+klassName+"Model";this.initialize.apply(this,arguments);};for(var prototypeDef in Evri.API.Model[klassName]._prototypeWith){session.models[klassName].prototype[prototypeDef]=Evri.API.Model[klassName]._prototypeWith[prototypeDef];}}else{session.models[klassName]={};}
for(var classMethodName in Evri.API.Model[klassName]._classMethodGenerators){session.models[klassName][classMethodName]=Evri.API.Model[klassName]._classMethodGenerators[classMethodName](session);}}});Evri.defineNamespace(Evri.API.Model,"APIError");Evri.extendNamespace(Evri.API.Model.APIError,{_classMethodGenerators:{},_prototypeWith:{initialize:function(message,options){var self=this;options=options||{};self.message=message;for(var key in options){if(self[key]===undefined){self[key]=options[key];}}
return self;},instanceAttributes:['documentationUrl','klass','message'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Article");Evri.extendNamespace(Evri.API.Model.Article,{_classMethodGenerators:{},_prototypeWith:{initialize:function(articleJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(articleJSON,self);var linkNode=Evri.API.Utilities.JSON.getNodeForPath(articleJSON,"link");if(linkNode!==undefined){self.link=new self.session.models.ArticleLink(linkNode,self);}
self.titleMatchedLocations=[];self.contentMatchedLocations=[];var titleMatchedLocationJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(articleJSON,"titleMatchedLocations/matchedLoc");var contentMatchedLocationJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(articleJSON,"contentMatchedLocations/matchedLoc");for(var i=0;i<titleMatchedLocationJSONNodes.length;i++){self.titleMatchedLocations.push(new self.session.models.MatchedLocation(titleMatchedLocationJSONNodes[i]));}
for(var i=0;i<contentMatchedLocationJSONNodes.length;i++){self.contentMatchedLocations.push(new self.session.models.MatchedLocation(contentMatchedLocationJSONNodes[i]));}
self.titleQueryMatches=[];self.contentQueryMatches=[];for(var i=0;i<self.titleMatchedLocations.length;i++){var match=self.titleMatchedLocations[i];if(match.matchType!='nonQueryEntity'){self.titleQueryMatches.push(match);}}
for(var i=0;i<self.contentMatchedLocations.length;i++){var match=self.contentMatchedLocations[i];if(match.matchType!='nonQueryEntity'){self.contentQueryMatches.push(match);}}
self.topEntities=[];var topEntitiesJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(articleJSON,"topEntities/entity");for(var i=0;i<topEntitiesJSONNodes.length;i++){self.topEntities.push(new self.session.models.Entity(topEntitiesJSONNodes[i]));}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','author','content','contentMatchedLocations','link','mentionedEntities','published','title','titleMatchedLocations'],instanceMethods:['getContentRanges','getGraph','getHighlightedContent','getHighlightedTitle','getRelativePublicationDate','getTitleRanges'],getGraph:function(callbacks,options){var self=this;self.session.models.Graph.getForURI(self.link.sourceUrl,callbacks,options);},getHighlightedTitle:function(tag,attrs){var self=this;return Evri.API.Utilities.HTML.highlightContent(self.session,self.title,self.titleQueryMatches,tag,attrs);},getTitleRanges:function(){var self=this;return Evri.API.Utilities.HTML.tokenizeStringHighlights(self.session,self.title,self.titleMatchedLocations);},getHighlightedContent:function(tag,attrs){var self=this;return Evri.API.Utilities.HTML.highlightContent(self.session,self.content,self.contentQueryMatches,tag,attrs);},getContentRanges:function(){var self=this;return Evri.API.Utilities.HTML.tokenizeStringHighlights(self.session,self.content,self.contentMatchedLocations);},getRelativePublicationDate:function(options){var self=this;return Evri.API.Utilities.Date.relativeDate(self.published,options);}}});Evri.defineNamespace(Evri.API.Model,"Quote");Evri.extendNamespace(Evri.API.Model.Quote,{_classMethodGenerators:{findQuotesAboutEntity:function(session){return function(resource,callbacks,options){var params={};options=options||{};params["entityURI"]=resource;session.models.QuoteList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(session,"/quotes/about",session.models.QuoteList.handleResponse,params,callbacks);};},findQuotesByEntity:function(session){return function(resource,callbacks,options){var params={};options=options||{};params["speaker"]=resource;session.models.QuoteList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(session,"/quotes",session.models.QuoteList.handleResponse,params,callbacks);};}},_prototypeWith:{initialize:function(quoteJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(quoteJSON,self);var articleNode=Evri.API.Utilities.JSON.getNodeForPath(quoteJSON,"article");self.article=new self.session.models.Article(articleNode);var entityNode=Evri.API.Utilities.JSON.getNodeForPath(quoteJSON,"speaker/entity");if(entityNode!==undefined){self.speaker=new self.session.models.Entity(entityNode);}
self.quoteBoundaryMatchedLocations=[];var quoteBoundaryMatchedLocationJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(quoteJSON,"quoteBoundaryMatchedLocations/matchedLoc");self.quoteBoundaryQueryMatches=[];for(var i=0;i<quoteBoundaryMatchedLocationJSONNodes.length;i++){self.quoteBoundaryMatchedLocations.push(new self.session.models.MatchedLocation(quoteBoundaryMatchedLocationJSONNodes[i]));}
for(var i=0;i<self.quoteBoundaryMatchedLocations.length;i++){var match=self.quoteBoundaryMatchedLocations[i];if(match.matchType!='nonQueryEntity'){self.quoteBoundaryQueryMatches.push(match);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','content','quoteBoundaryMatchedLocations','article','speaker'],instanceMethods:['getQuoteBoundaryRanges','getHighlightedContent','getRelativePublicationDate'],getQuoteBoundaryRanges:function(){var self=this;return Evri.API.Utilities.HTML.tokenizeStringHighlights(self.session,self.content,self.quoteBoundaryMatchedLocations);},getHighlightedContent:function(tag,attrs){var self=this;return Evri.API.Utilities.HTML.highlightContent(self.session,self.content,self.quoteBoundaryQueryMatches,tag,attrs);},getRelativePublicationDate:function(options){var self=this;return Evri.API.Utilities.Date.relativeDate(self.article.published,options);}}});Evri.defineNamespace(Evri.API.Model,"Sentiment");Evri.extendNamespace(Evri.API.Model.Sentiment,{findSentimentsAboutEntity:function(session,params,options,callbacks){session.models.SentimentList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(session,"/sentiment/about",session.models.SentimentList.handleResponse,params,callbacks);},setParamameter:function(entityURI,sentimentSource,sentimentType){var params={};if(entityURI){params.entityURI=entityURI;}
if(sentimentSource){params.sentimentSource=sentimentSource;}
if(sentimentType){params.sentimentType=sentimentType;}
return params;},_classMethodGenerators:{findPositiveSentiments:function(session){return function(entityURI,sentimentSource,callbacks,options){options=options||{};var params=Evri.API.Model.Sentiment.setParamameter(entityURI,sentimentSource,"positive");Evri.API.Model.Sentiment.findSentimentsAboutEntity(session,params,options,callbacks);};},findNegativeSentiments:function(session){return function(entityURI,sentimentSource,callbacks,options){options=options||{};var params=Evri.API.Model.Sentiment.setParamameter(entityURI,sentimentSource,"negative");Evri.API.Model.Sentiment.findSentimentsAboutEntity(session,params,options,callbacks);};},findPositiveSentimentsAboutEverything:function(session){return function(sentimentSource,callbacks,options){this.findPositiveSentiments(null,sentimentSource,callbacks,options);};},findNegativeSentimentsAboutEverything:function(session){return function(sentimentSource,callbacks,options){this.findNegativeSentiments(null,sentimentSource,callbacks,options);};},findPositiveSentimentsByEverything:function(session){return function(entityURI,callbacks,options){this.findPositiveSentiments(entityURI,null,callbacks,options);};},findNegativeSentimentsByEverything:function(session){return function(entityURI,callbacks,options){this.findNegativeSentiments(entityURI,null,callbacks,options);};}}});Evri.defineNamespace(Evri.API.Model,"SentimentSummary");Evri.extendNamespace(Evri.API.Model.SentimentSummary,{_classMethodGenerators:{findSentimentsSummaryAboutEntity:function(session){return function(resource,callbacks,options){var params={};options=options||{};params.entityURI=resource;params.includeSummaryDetails=true;session.models.SentimentSummaryList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(session,"/sentiment/summary/about",session.models.SentimentSummaryList.handleResponse,params,callbacks);};},findSentimentsSummaryByEntity:function(session){return function(resource,callbacks,options){var params={};options=options||{};params.sentimentSource=resource;params.includeSummaryDetails=true;session.models.SentimentSummaryList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(session,"/sentiment/summary",session.models.SentimentSummaryList.handleResponse,params,callbacks);};}},_prototypeWith:{initialize:function(sentimentSummaryJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(sentimentSummaryJSON,self);self.entityList=new Array();var sentimentSourceEntityList=Evri.API.Utilities.JSON.getNodeForPath(sentimentSummaryJSON,"sentimentSourceEntityList");if(sentimentSourceEntityList===undefined){sentimentSourceEntityList=Evri.API.Utilities.JSON.getNodeForPath(sentimentSummaryJSON,"sentimentSubjectEntityList");}
if(sentimentSourceEntityList){var entityList=Evri.API.Utilities.JSON.getNodeSetForPath(sentimentSourceEntityList,"entity");if(entityList!==undefined){for(var j=0;j<entityList.length;j++){var entity=new self.session.models.Entity(entityList[j]);entity.belongsTo=self;self.entityList.push(entity);}}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','entityList'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"ArticleLink");Evri.extendNamespace(Evri.API.Model.ArticleLink,{_classMethodGenerators:{},_prototypeWith:{initialize:function(linkJSONNode,article){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(linkJSONNode,self);self.sourceUrl="http://"+self.hostName+self.path;var articleLinkTrackerKey=Evri.API.Utilities.articleTracker[self.session.sharedQueryStringParameters["appId"]];var defaultArticleUrl=window.location.protocol+"//"+Evri.API.Environment.portalHost+self.href;self.href=Evri.API.Utilities.buildMediaSourceUrl(self.sourceUrl,article.title,defaultArticleUrl,articleLinkTrackerKey);return self;},instanceAttributes:['documentationUrl','klass','href','path','sourceUrl'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"ArticleList");Evri.extendNamespace(Evri.API.Model.ArticleList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ArticleList',{beforeInstantiate:"mediaResult"});},handleEntityRelationResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ArticleList',{beforeInstantiate:"relations/relation"});},handleTargetRelationResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ArticleList',{beforeInstantiate:"relations/relation/targets/entity"});},handleRequestOptions:function(session){return function(params,options){var boolean_params=['includeMatchedLocations','includeTopEntities'];for(var i=0;i<boolean_params.length;i++){var paramKey=boolean_params[i];if(params[paramKey]===undefined&&options[paramKey]===true){params[paramKey]=true;}}
if(options.mediaConstraint!==undefined&&options.mediaConstraint.klass=="MediaConstraint"){var constraints=options.mediaConstraint.toParams();if(constraints.includeDomains!==undefined){params.includeDomains=constraints.includeDomains;}
if(constraints.excludedDomains!==undefined){params.excludedDomains=constraints.excludedDomains;}}
if(options.articleSnippetLength!==undefined){params.articleSnippetLength=parseInt(options.articleSnippetLength);}
if(options.resultsPerPage!==undefined){params.resultsPerPage=parseInt(options.resultsPerPage);}
if(options.includeDates!==undefined){params.includeDates=options.includeDates;}};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.articles=[];var articleListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"articleList");if(articleListNode!==undefined){var articleJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(articleListNode,"article");for(var i=0;i<articleJSONNodes.length;i++){var article=new self.session.models.Article(articleJSONNodes[i]);article.belongsTo=self;self.articles.push(article);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','articles'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"QuoteList");Evri.extendNamespace(Evri.API.Model.QuoteList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'QuoteList',{beforeInstantiate:"mediaResult"});},handleRequestOptions:function(session){return function(params,options){var boolean_params=['includeMatchedLocations'];for(var i=0;i<boolean_params.length;i++){var paramKey=boolean_params[i];if(params[paramKey]===undefined&&options[paramKey]===true){params[paramKey]=true;}}
if(options.resultsPerPage!==undefined){params.resultsPerPage=parseInt(options.resultsPerPage);}};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.quotes=[];var quoteListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"quoteList");if(quoteListNode!==undefined){var quoteJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(quoteListNode,"quote");for(var i=0;i<quoteJSONNodes.length;i++){var quote=new self.session.models.Quote(quoteJSONNodes[i]);quote.belongsTo=self;self.quotes.push(quote);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','quotes'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"SentimentList");Evri.extendNamespace(Evri.API.Model.SentimentList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'SentimentList',{beforeInstantiate:"mediaResult"});},handleRequestOptions:function(session){return function(params,options){if(params.includeMatchedLocations===undefined&&options.includeMatchedLocations===true){params.includeMatchedLocations=true;}
if(options.mediaConstraint!==undefined&&options.mediaConstraint.klass==="MediaConstraint"){var constraints=options.mediaConstraint.toParams();if(constraints.includeDomains!==undefined){params.includeDomains=constraints.includeDomains;}
if(constraints.excludedDomains!==undefined){params.excludedDomains=constraints.excludedDomains;}}
if(options.articleSnippetLength!==undefined){params.articleSnippetLength=parseInt(options.articleSnippetLength);}
if(options.resultsPerPage!==undefined){params.resultsPerPage=parseInt(options.resultsPerPage);}
if(options.sentimentType!==undefined){params.sentimentType=options.sentimentType;}
if(options.sort!==undefined){params.sort=options.sort;}};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.articles=[];var sentimentListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"sentimentList");var sentimentNodes=Evri.API.Utilities.JSON.getNodeSetForPath(sentimentListNode,"sentiment");if(sentimentNodes!==undefined){for(var i=0;i<sentimentNodes.length;i++){var articleJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(sentimentNodes[i],"article");for(var j=0;j<articleJSONNodes.length;j++){var article=new self.session.models.Article(articleJSONNodes[j]);article.belongsTo=self;self.articles.push(article);}}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','articles'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"SentimentSummaryList");Evri.extendNamespace(Evri.API.Model.SentimentSummaryList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,"SentimentSummaryList",{beforeInstantiate:"mediaResult"});},handleRequestOptions:function(session){return function(params,options){if(params.includeMatchedLocations===undefined&&options.includeMatchedLocations===true){params.includeMatchedLocations=true;}
if(options.mediaConstraint!==undefined&&options.mediaConstraint.klass==="MediaConstraint"){var constraints=options.mediaConstraint.toParams();if(constraints.includeDomains!==undefined){params.includeDomains=constraints.includeDomains;}
if(constraints.excludedDomains!==undefined){params.excludedDomains=constraints.excludedDomains;}}
if(options.resultsPerPage!==undefined){params.resultsPerPage=parseInt(options.resultsPerPage);}
if(options.sentimentType!==undefined){params.sentimentType=options.sentimentType;}
if(options.sort!==undefined){params.sort=options.sort;}
if(options.includeSummaryDetails!==undefined){params.includeSummaryDetails=options.includeSummaryDetails;}};}},_prototypeWith:{initialize:function(jsonNode){var self=this;var sentimentSummaryListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"sentimentSummaryList");var sentimentSummaryNodes=Evri.API.Utilities.JSON.getNodeSetForPath(sentimentSummaryListNode,"sentimentSummary");for(var i=0;i<sentimentSummaryNodes.length;i++){var summaryDetail=new self.session.models.SentimentSummary(sentimentSummaryNodes[i]);if(summaryDetail.type==="positive"){self.positiveSummaryDetail=summaryDetail;}
else if(summaryDetail.type==="negative"){self.negativeSummaryDetail=summaryDetail;}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','positiveSummaryDetail','negativeSummaryDetail'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"ContentRange");Evri.extendNamespace(Evri.API.Model.ContentRange,{_classMethodGenerators:{},_prototypeWith:{initialize:function(content,matchedLocation,options){var self=this;options=options||{};self.content=content||"";self.matchedLocation=matchedLocation||undefined;return self;},instanceAttributes:['documentationUrl','klass','content','matchedLocation'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Entity");Evri.extendNamespace(Evri.API.Model.Entity,{_classMethodGenerators:{getById:function(session){return function(entityIds,property,callbacks){Evri.API.Transport.callRemoteMethod(session,"/entities",session.models.Entity.handleResponse,{entityId:entityIds,property:property},callbacks);};},findByName:function(session){return function(name,callbacks){Evri.API.Transport.callRemoteMethod(session,"/entities/find",session.models.EntityList.handleResponse,{name:name},callbacks);};},findById:function(session){return function(entityIds,callbacks){Evri.API.Transport.callRemoteMethod(session,"/entities/find",session.models.EntityList.handleResponse,{'entityId':entityIds},callbacks);};},findByPrefix:function(session){return function(prefix,callbacks){Evri.API.Transport.callRemoteMethod(session,"/entities/find",session.models.EntityList.handleResponse,{prefix:prefix},callbacks);};},findByResource:function(session){return function(resource,callbacks){Evri.API.Transport.callRemoteMethod(session,resource,session.models.Entity.handleResponse,{},callbacks);};},handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,"Entity",{beforeInstantiate:"entity"});},parseIdFromResource:function(session){return function(resource){var entityId=undefined;if(resource.match(/0x[A-Fa-f0-9]+$/)!==null){entityId=parseInt(resource.match(/0x[A-Fa-f0-9]+$/)[0],16)}
return entityId;};}},_prototypeWith:{initialize:function(entityJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(entityJSON,self);self.resource=self.href;self.relationsResource=self.resource+"/relations"
self.mediaResource=self.resource+"/media/related"
self.relatedEntitiesResource=self.resource+"/related/entities";self.known=false;if(self.resource!==undefined&&self.resource.match(/0x[a-fA-F0-9]+$/)!==null){self.known=true;if(self.id===undefined){self.id=self.session.models.Entity.parseIdFromResource(self.resource);}}
self.portalURI=self.resource===undefined?undefined:Evri.API.Utilities.portalURIForPath(self.resource);self.relationsServiceURI=Evri.API.Utilities.apiURIForPath(self.resource+"/relations");self.media=new self.session.models.Media(self);self.facets=[];var facetNodes=Evri.API.Utilities.JSON.getNodeSetForPath(entityJSON,"facets/facet");for(var i=0;i<facetNodes.length;i++){self.facets.push(new self.session.models.Facet(facetNodes[i]));}
self.propertyList=new self.session.models.EntityPropertyList(Evri.API.Utilities.JSON.getNodeForPath(entityJSON,"properties"));if(self.propertyList.findByName('wikipedia_paragraph').length>0){self.description=self.propertyList.findByName('wikipedia_paragraph')[0].value;}
else if(self.propertyList.findByName('crunchbase_paragraph').length>0){self.description=self.propertyList.findByName('crunchbase_paragraph')[0].value;}
return self;},instanceAttributes:['documentationUrl','klass','description','facets','href','id','known','media','mediaResource','name','portalURI','properties','relatedEntitiesResource','relationsResource','relationsServiceURI','resource','type'],instanceMethods:['getMentionStatistics','getName','getRelatedEntities','getRelations','getTopRelationsTargets','getTweetsAbout'],getRelatedEntities:function(callbacks,options){var self=this;options=options||{}
callbacks.bindWith=function(graph){self.graph=graph;graph.belongsTo=self;};if(self.queryToken!==undefined){Evri.API.Transport.callRemoteMethod(self.session,self.relatedEntitiesResource,self.session.models.Graph.handleResponse,{queryToken:self.queryToken},callbacks);}else{Evri.API.Transport.callRemoteMethod(self.session,self.relationsResource,self.session.models.EntityList.handleEntityRelationsGraphResponse,{'graphRelationsCount':(options.count!==undefined?options.count:10)},callbacks);}},getTopRelationsTargets:function(callbacks,options){var self=this;var params={};options=options||{};callbacks.bindWith=function(targetList){self.topTargetsList=targetList;targetList.belongsTo=self;};self.session.models.EntityList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(self.session,self.relationsResource,self.session.models.TargetList.handleEntityRelationsGraphResponse,params,callbacks);},getRelations:function(callbacks,options){var self=this;options=options||{};callbacks.bindWith=function(relationList){self.relationList=relationList;relationList.belongsTo=self;};Evri.API.Transport.callRemoteMethod(self.session,self.relationsResource,self.session.models.EntityRelationList.handleResponse,{},callbacks);},getName:function(){var self=this;return self.name;},getMentionStatistics:function(callbacks,options){var self=this;options=options||{};callbacks.bindWith=function(entityHistory){entityHistory.belongsTo=self;};Evri.API.Transport.callRemoteMethod(self.session,"/zeitgeist/entity-history",self.session.models.EntityHistory.handleResponse,{data:"mentions",uri:self.resource,count:30,timeSpan:"day"},callbacks);},getTweetsAbout:function(callbacks,options){var self=this;options=options||{};callbacks.bindWith=function(tweetList){tweetList.belongsTo=self;};self.session.models.Tweet.findForEntityResource(self.resource,callbacks);}}});Evri.defineNamespace(Evri.API.Model,"EntityList");Evri.extendNamespace(Evri.API.Model.EntityList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityList',{beforeInstantiate:"entities"});},handleZeitgeistEntitiesPopularResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityList',{beforeInstantiate:"zeitgeist/popular/entities"});},handleZeitgeistEntitiesRisingResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityList',{beforeInstantiate:"zeitgeist/rising/entities"});},handleZeitgeistEntitiesFallingResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityList',{beforeInstantiate:"zeitgeist/falling/entities"});},handleEntityRelationsGraphResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityList',{beforeInstantiate:function(jsonNode){var relationNodes=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,"relations/graph/relation");var responseNode={entity:[]};if(relationNodes.length>0){for(var i=0;i<relationNodes.length;i++){var entityNodes=Evri.API.Utilities.JSON.getNodeSetForPath(relationNodes[i],"targets/entity");if(entityNodes.length>0){for(var j=0;j<entityNodes.length;j++){responseNode.entity.push(entityNodes[j]);}}}}
return responseNode;}});},handleRequestOptions:function(session){return function(params,options){if(options.entityConstraint!==undefined&&options.entityConstraint.klass=="EntityConstraint"){var constraints=options.entityConstraint.toParams();if(constraints.includeDomains!==undefined){params.includeDomains=constraints.includeDomains;}
if(constraints.excludedDomains!==undefined){params.excludedDomains=constraints.excludedDomains;}}
params.graphRelationsCount=(options.count!==undefined?options.count:10);};}},_prototypeWith:{initialize:function(listJSON){var self=this;var entityNodes=Evri.API.Utilities.JSON.getNodeSetForPath(listJSON,"entity");self.entities=[];for(var i=0;i<entityNodes.length;i++){self.entities.push(new self.session.models.Entity(entityNodes[i]));}
return self;},instanceAttributes:['documentationUrl','klass','entities'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"EntityHistories");Evri.extendNamespace(Evri.API.Model.EntityHistories,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityHistories',{beforeInstantiate:"entityHistories"});},findByEntityResource:function(session){return function(entityResources,callbacks,options){options=options||{};if(typeof(entityResources)==="string"){entityResources=[entityResources];}
Evri.API.Transport.callRemoteMethod(session,"/zeitgeist/entity-history",session.models.EntityHistories.handleResponse,{data:"mentions",uri:entityResources,count:30,timeSpan:"day"},callbacks);};},findForEntityList:function(session){return function(entityList,callbacks,options){options=options||{};var entityResources=[];for(var i=0;i<entityList.entities.length;i++){entityResources.push(entityList.entities[i].resource);}
Evri.API.Transport.callRemoteMethod(session,"/zeitgeist/entity-history",session.models.EntityHistories.handleResponse,{data:"mentions",uri:entityResources,count:30,timeSpan:"day"},callbacks);};}},_prototypeWith:{initialize:function(historiesJSON){var self=this;var historyJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(historiesJSON,"entityHistory");self.histories=[];self.historyMapByEntityResource={};for(var i=0;i<historyJSONNodes.length;i++){var history=new self.session.models.EntityHistory(historyJSONNodes[i])
self.histories.push(history);self.historyMapByEntityResource[history.entityResource]=history;}
return self;},instanceAttributes:['documentationUrl','klass','histories','historyMapByEntityResource'],instanceMethods:['getStatisticsForEntity'],getStatisticsForEntity:function(entity){var self=this;return self.historyMapByEntityResource[entity.resource];}}});Evri.defineNamespace(Evri.API.Model,"EntityHistory");Evri.extendNamespace(Evri.API.Model.EntityHistory,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityHistory',{beforeInstantiate:"entityHistories/entityHistory"});}},_prototypeWith:{initialize:function(historyJSON){var self=this;self.entityResource=Evri.API.Utilities.JSON.getAttributeForNode(historyJSON,"@href");self.mentions=[];var mentionData=Evri.API.Utilities.JSON.getValueForPath(historyJSON,"mentions");var now=(new Date()).getTime();var dayLength=24*60*60*1000;if(mentionData!==null){var mentions=mentionData.split(/,/);var mentionsLastIndex=mentions.length-1;for(var i=0;i<=mentionsLastIndex;i++){var count=parseInt(mentions[i]);var date=new Date(now-(dayLength*(mentionsLastIndex-i)));self.mentions.push(new self.session.models.EntityHistoryMention(count,date));}}
return self;},instanceAttributes:['documentationUrl','klass','mentions'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"EntityHistoryMention");Evri.extendNamespace(Evri.API.Model.EntityHistoryMention,{_classMethodGenerators:{},_prototypeWith:{initialize:function(count,date){var self=this;self.count=count;self.date=date;return self;},instanceAttributes:['documentationUrl','klass','count','date'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"EntityProperty");Evri.extendNamespace(Evri.API.Model.EntityProperty,{_classMethodGenerators:{},_prototypeWith:{initialize:function(propertyJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(propertyJSON,self);if(self.linkHref!==undefined){self.resource=self.linkHref;self.portalURI=Evri.API.Utilities.portalURIForPath(self.resource);}
return self;},instanceAttributes:['documentationUrl','klass','linkObjectName','linkHref','portalURI','name','resource','value'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"EntityPropertyList");Evri.extendNamespace(Evri.API.Model.EntityPropertyList,{_classMethodGenerators:{},_prototypeWith:{initialize:function(propertyListJSON){var self=this;self.properties=[];self.propertyNames=[];self.propertyMap={};if(propertyListJSON!==undefined){var propertyJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(propertyListJSON,"property");for(var i=0;i<propertyJSONNodes.length;i++){self.properties.push(new self.session.models.EntityProperty(propertyJSONNodes[i]));}
for(var i=0;i<self.properties.length;i++){var property=self.properties[i];if(self.propertyMap[property.name]===undefined){self.propertyMap[property.name]=[];}
self.propertyMap[property.name].push(property);}
for(var name in self.propertyMap){self.propertyNames.push(name);}
self.propertyNames=self.propertyNames.sort();}
return self;},instanceAttributes:['documentationUrl','klass','properties','propertyMap','propertyNames'],instanceMethods:['findByName','findHavingResource'],findByName:function(name){var self=this;var matchProperties=[];if(self.propertyMap[name]!==undefined){matchProperties=self.propertyMap[name];}
return matchProperties;},findHavingResource:function(){var self=this;var propertiesHavingResources=[];for(var i=0;i<self.properties.length;i++){var property=self.properties[i];if(property.resource!==undefined){propertiesHavingResources.push(property);}}
return propertiesHavingResources;}}});Evri.defineNamespace(Evri.API.Model,"EntityRelation");Evri.extendNamespace(Evri.API.Model.EntityRelation,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityRelation');}},_prototypeWith:{initialize:function(relationJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(relationJSON,self);self.resource=self.href;self.mediaResource=self.resource;self.portalURI=Evri.API.Utilities.portalURIForPath(self.resource);self.media=new self.session.models.Media(self,{responseHandlerMethod:"handleEntityRelationResponse",mediaTypeSpecifier:'media'});return self;},instanceAttributes:['documentationUrl','klass','href','media','mediaResource','portalURI','resource'],instanceMethods:['getName','getTargets'],getName:function(){var self=this;return self.name;},getTargets:function(callbacks,options){var self=this;options=options||{};callbacks.bindWith=function(targetList){self.targetList=targetList;targetList.belongsTo=self;};Evri.API.Transport.callRemoteMethod(self.session,self.resource,self.session.models.TargetList.handleResponse,{},callbacks);}}});Evri.defineNamespace(Evri.API.Model,"EntityRelationList");Evri.extendNamespace(Evri.API.Model.EntityRelationList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityRelationList');}},_prototypeWith:{initialize:function(listJSON){var self=this;var relationsNodeSet=Evri.API.Utilities.JSON.getNodeSetForPath(listJSON,"relations/relation");var graphNode=Evri.API.Utilities.JSON.getNodeForPath(listJSON,"relations/graph");self.relations=[];for(var i=0;i<relationsNodeSet.length;i++){self.relations.push(new self.session.models.EntityRelation(relationsNodeSet[i]));}
return self;},instanceAttributes:['documentationUrl','klass','relations'],instanceMethods:['getFacets','getVerbs'],getFacets:function(){var self=this;var facets=[];for(var i=0;i<self.relations.length;i++){var relation=self.relations[i];switch(relation.type.toLowerCase()){case"facet":facets.push(relation);break;default:break;}}
return facets;},getVerbs:function(){var self=this;var verbs=[];for(var i=0;i<self.relations.length;i++){var relation=self.relations[i];switch(relation.type.toLowerCase()){case"verb":case"qt":verbs.push(relation);break;default:break;}}
return verbs;}}});Evri.defineNamespace(Evri.API.Model,"EntitySet");Evri.extendNamespace(Evri.API.Model.EntitySet,{_classMethodGenerators:{},_prototypeWith:{initialize:function(entityResources){var self=this;self.mediaResource="/entity-set/media";var entityIds=[];for(var cntr=0;cntr<entityResources.length;cntr++){var entityId=self.session.models.Entity.parseIdFromResource(entityResources[cntr]);if(entityId!==undefined){entityIds.push(entityId);}}
self.entityIdList=entityIds.join(",");self.media=new self.session.models.Media(self);return self;},instanceAttributes:['documentationUrl','klass'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Facet");Evri.extendNamespace(Evri.API.Model.Facet,{_classMethodGenerators:{},_prototypeWith:{initialize:function(facetJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(facetJSON,self);return self;},instanceAttributes:['documentationUrl','klass','name'],instanceMethods:['getName'],getName:function(){return self.name;}}});Evri.defineNamespace(Evri.API.Model,"Graph");Evri.extendNamespace(Evri.API.Model.Graph,{_classMethodGenerators:{getForContent:function(session){return function(content,callbacks,options){options=options||{};var remoteMethodParams={text:content};if(options.uri!==undefined){remoteMethodParams.uri=options.uri;}
Evri.API.Transport.callRemoteMethod(session,"/media/entities",session.models.Graph.handleResponse,remoteMethodParams,callbacks);};},getForURI:function(session){return function(uri,callbacks,options){var params={uri:uri};options=options||{};if(options.nocache===true){params.nocache=true;if(uri.match(/\?/)===null){params.uri+='?nocache='+(new Date()).getTime();}else{params.uri+='&nocache='+(new Date()).getTime();}}
Evri.API.Transport.callRemoteMethod(session,"/media/entities",session.models.Graph.handleResponse,params,callbacks);};},getForCurrentPage:function(session){return function(callbacks,options){session.models.Graph.getForURI(Evri.API.Utilities.currentURI(),callbacks,options);};},handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'Graph');}},_prototypeWith:{initialize:function(jsonNode){var self=this;var entityJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,"graph/entities/entity");self.belongsTo=undefined;self.entities=[];self.pairs=[];for(var i=0;i<entityJSONNodes.length;i++){self.entities.push(new self.session.models.Entity(entityJSONNodes[i]));};var pairJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,"graph/pairs/pair");if(pairJSONNodes!==undefined){for(var i=0;i<pairJSONNodes.length;i++){var pairJSONNode=pairJSONNodes[i];var pairEntityNodes=Evri.API.Utilities.JSON.getNodeSetForPath(pairJSONNode,"entity");var entities=[];for(var j=0;j<pairEntityNodes.length;j++){entities.push(new self.session.models.Entity(pairEntityNodes[j]));}
self.pairs.push(new self.session.models.Pair(entities[0],entities[1],pairJSONNode));}}
self.queryToken=Evri.API.Utilities.JSON.getValueForPath(jsonNode,"graph/queryToken");self.media=new self.session.models.Media(self);return self;},instanceAttributes:['documentationUrl','klass','entities','media','pairs','queryToken'],instanceMethods:['getName'],getName:function(){var self=this;return self.belongsTo===undefined?"Text Content Graph":self.belongsTo.getName()+" "+self.belongsTo.klass+" Graph";}}});Evri.defineNamespace(Evri.API.Model,"Image");Evri.extendNamespace(Evri.API.Model.Image,{_classMethodGenerators:{},_prototypeWith:{initialize:function(imageJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(imageJSON,self);var thumbnailNode=Evri.API.Utilities.JSON.getNodeForPath(imageJSON,"thumbnail");if(thumbnailNode!==undefined){self.thumbnail=new self.session.models.Image(thumbnailNode);self.clickUrl=Evri.API.Utilities.buildMediaSourceUrl(self.clickUrl,self.title,self.clickUrl);self.thumbnail.belongsTo=self;}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','articleHref','clickUrl','content','date','height','mimeType','size','thumbnail','title','url','width'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"ImageList");Evri.extendNamespace(Evri.API.Model.ImageList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ImageList',{beforeInstantiate:"mediaResult"});},handleTargetRelationResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ImageList',{beforeInstantiate:"relations/relation/targets/entity"});},handleRequestOptions:function(session){return function(params,options){var acceptedOptions=['resultsPerPage'];for(var i=0;i<acceptedOptions.length;i++){var key=acceptedOptions[i];if(options[key]!==undefined){params[key]=options[key];}}
if(options.page!==undefined){var page=parseInt(options.page);var resultsPerPage=params.resultsPerPage||10;params.startId=((page-1)*resultsPerPage);}};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.images=[];var listNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"imageList");if(listNode!==undefined){var imageJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(listNode,"image");for(var i=0;i<imageJSONNodes.length;i++){var image=new self.session.models.Image(imageJSONNodes[i]);image.belongsTo=self;self.images.push(image);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','images'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"MatchedLocation");Evri.extendNamespace(Evri.API.Model.MatchedLocation,{_classMethodGenerators:{},_prototypeWith:{initialize:function(jsonNode){var self=this;self.start=parseInt(jsonNode["@startPtr"]);self.end=parseInt(jsonNode["@endPtr"]);self.href=jsonNode["@href"];self.portalURI=undefined;self.matchType=jsonNode["@matchType"];self.snippetLength=self.end-self.start+1;if(self.href!==undefined&&self.href.length>0){self.portalURI=Evri.API.Utilities.portalURIForPath(self.href);}
return self;},instanceAttributes:['documentationUrl','klass','end','href','matchType','portalURI','snippetLength','start'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Media");Evri.extendNamespace(Evri.API.Model.Media,{getMediaByTypeGenerator:function(mediaListClass,mediaType,listsContainer){return function(callbacks,options){var self=this;var params={};options=options||{};params[self.mediaTypeSpecifier]=mediaType;if(self.belongsTo.queryToken!==undefined){params.queryToken=self.belongsTo.queryToken;}
if(self.belongsTo.entityIdList!==undefined){params.entityIdList=self.belongsTo.entityIdList;}
if(self.belongsTo.mediaParams!==undefined){for(var paramKey in self.belongsTo.mediaParams){params[paramKey]=self.belongsTo.mediaParams[paramKey];}}
callbacks.bindWith=function(list){list.belongsTo=self;self[listsContainer].push(list);};self.session.models[mediaListClass].handleRequestOptions(params,options)
Evri.API.Transport.callRemoteMethod(self.session,self.resource,self.session.models[mediaListClass][self.responseHandlerMethod],params,callbacks);};}});Evri.extendNamespace(Evri.API.Model.Media,{_classMethodGenerators:{},_prototypeWith:{initialize:function(belongsTo,options){var self=this;options=options||{}
self.belongsTo=belongsTo;self.mediaTypeSpecifier=options.mediaTypeSpecifier!==undefined?options.mediaTypeSpecifier:'type';self.responseHandlerMethod=(options.responseHandlerMethod!==undefined?options.responseHandlerMethod:"handleResponse");self.articleLists=[];self.imageLists=[];self.videoLists=[];self.productLists=[];self.tweetLists=[];self.resource=(belongsTo.mediaResource||"/media/related");return self;},instanceAttributes:['belongsTo','documentationUrl','klass','articleLists','imageLists','videoLists','productLists','tweetLists'],instanceMethods:['getArticles','getImages','getName','getVideos','getProducts','getRecommendedProducts','getTweets'],getArticles:Evri.API.Model.Media.getMediaByTypeGenerator("ArticleList","article","articleLists"),getImages:Evri.API.Model.Media.getMediaByTypeGenerator("ImageList","image","imageLists"),getVideos:Evri.API.Model.Media.getMediaByTypeGenerator("VideoList","video","videoLists"),getProducts:Evri.API.Model.Media.getMediaByTypeGenerator("ProductList","product","productLists"),getRecommendedProducts:Evri.API.Model.Media.getMediaByTypeGenerator("ProductList","productad","productLists"),getTweets:Evri.API.Model.Media.getMediaByTypeGenerator("TweetList","tweet","tweetLists"),getName:function(){var self=this;return self.belongsTo.getName()+" Media";}}});Evri.defineNamespace(Evri.API.Model,"MediaConstraint");Evri.extendNamespace(Evri.API.Model.MediaConstraint,{_classMethodGenerators:{},_prototypeWith:{initialize:function(){var self=this;self.includedDomains=[];self.excludedDomains=[];return self;},instanceAttributes:['documentationUrl','klass','excludedDomains','includedDomains'],instanceMethods:['excludeDomain','includeDomain','toParams'],excludeDomain:function(domain){var self=this;if(typeof(domain)==="string"){self.excludedDomains.push(Evri.API.Utilities.URI.cleanDomain(domain));}
return self;},includeDomain:function(domain){var self=this;if(typeof(domain)==="string"){self.includedDomains.push(Evri.API.Utilities.URI.cleanDomain(domain));}
return self;},toParams:function(){var self=this;var params={};if(self.includedDomains.length>0){params.includeDomains=self.includedDomains.join(',');}
if(self.excludedDomains.length>0){params.excludeDomains=self.excludedDomains.join(',');}
return params;}}});Evri.defineNamespace(Evri.API.Model,"EntityConstraint",Evri.API.Model.MediaConstraint);Evri.defineNamespace(Evri.API.Model,"Product");Evri.extendNamespace(Evri.API.Model.Product,{_classMethodGenerators:{},_prototypeWith:{initialize:function(productJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(productJSON,self);var productCreatorData=["author","artist","composer","creator","director","manufacturer"];for(var cntr=0;cntr<productCreatorData.length;cntr++){var nodeName=productCreatorData[cntr];var key=nodeName.toLowerCase()+"s";self[key]=Evri.API.Utilities.JSON.getValueForNodeSet(productJSON,nodeName);}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','name','id','group','url','imageurl','rating','price','label','releaseDate','height','width','referringUri','authors','artists','composers','directors','manufacturers','creators'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"ProductList");Evri.extendNamespace(Evri.API.Model.ProductList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ProductList',{beforeInstantiate:"mediaResult"});},handleRequestOptions:function(session){return function(params,options){};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.products=[];var productListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"productList");if(productListNode!==undefined){var productJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(productListNode,"product");for(var i=0;i<productJSONNodes.length;i++){var product=new self.session.models.Product(productJSONNodes[i]);product.belongsTo=self;self.products.push(product);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','products'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Pair");Evri.extendNamespace(Evri.API.Model.Pair,{_classMethodGenerators:{},_prototypeWith:{initialize:function(entity1,entity2,pairJSON){var self=this;self.entity1=entity1;self.entity2=entity2;if(pairJSON!==undefined){Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(pairJSON,self);}
if(self.queryToken===undefined){self.mediaParams={'entityURI':[self.entity1.resource,self.entity2.resource]};}
self.media=new self.session.models.Media(self);return self;},instanceAttributes:['documentationUrl','klass','entity1','entity2','media','mediaParams','queryToken'],instanceMethods:['getName'],getName:function(){var self=this;return self.entity1.name+" => "+self.entity2.name;}}});Evri.defineNamespace(Evri.API.Model,"Target");Evri.extendNamespace(Evri.API.Model.Target,{_classMethodGenerators:{},_prototypeWith:{initialize:function(entityJSON){var self=this;self.entity=new self.session.models.Entity(entityJSON);self.href=self.entity.targetHref;self.resource=self.href;self.portalURI=Evri.API.Utilities.portalURIForPath(self.resource);self.mediaResource=self.resource;self.media=new self.session.models.Media(self,{responseHandlerMethod:"handleTargetRelationResponse",mediaTypeSpecifier:'media'});return self;},instanceAttributes:['documentationUrl','klass','entity','href','media','mediaResource','portalURI','resource'],instanceMethods:['getName'],getName:function(){var self=this;return self.entity.getName();}}});Evri.defineNamespace(Evri.API.Model,"TargetList");Evri.extendNamespace(Evri.API.Model.TargetList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'TargetList',{beforeInstantiate:"relations/relation/targets"});},handleEntityRelationsGraphResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'TargetList',{beforeInstantiate:function(jsonNode){var relationNodes=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,"relations/graph/relation");var responseNode={entity:[]};if(relationNodes.length>0){for(var i=0;i<relationNodes.length;i++){var entityNodes=Evri.API.Utilities.JSON.getNodeSetForPath(relationNodes[i],"targets/entity");if(entityNodes.length>0){for(var j=0;j<entityNodes.length;j++){responseNode.entity.push(entityNodes[j]);}}}}
return responseNode;}});}},_prototypeWith:{initialize:function(targetsJSON){var self=this;var targetNodes=Evri.API.Utilities.JSON.getNodeSetForPath(targetsJSON,"entity");self.targets=[];for(var i=0;i<targetNodes.length;i++){self.targets.push(new self.session.models.Target(targetNodes[i]));}
return self;},instanceAttributes:['documentationUrl','klass','targets'],instanceMethods:['getName'],getName:function(){var self=this;return"Targets for '"+self.belongsTo.getName()+"' EntityRelation";}}});Evri.defineNamespace(Evri.API.Model,"Tweet");Evri.extendNamespace(Evri.API.Model.Tweet,{_classMethodGenerators:{findForQuery:function(session){return function(query,callbacks){Evri.API.Transport.callRemoteMethod(session,"/mashups/twitter/tag",session.models.TweetList.handleResponse,{'q':query},callbacks);};},findForEntityResource:function(session){return function(entityResource,callbacks){Evri.API.Transport.callRemoteMethod(session,"/mashups/twitter/tag",session.models.TweetList.handleResponse,{'entityURI':entityResource},callbacks);};},findFromUsername:function(session){return function(username,callbacks){var query="from:"+username.replace('@','');session.models.Tweet.findForQuery(query,callbacks);};},findToUsername:function(session){return function(username,callbacks){var query="to:"+username.replace('@','');session.models.Tweet.findForQuery(query,callbacks);};},getFindForEntityResourceFunction:function(session){return function(entityResource,callbacks){Evri.API.Transport.callRemoteMethod(session,"/mashups/twitter/query",session.models.TwitterQuery.handleResponse,{'entityURI':entityResource},callbacks);};},callTwitterForEntityResource:function(session){return function(twitterQuery,callbacks){Evri.API.Transport.callRemoteMethod(session,twitterQuery,session.models.TweetList.handleTwitterResponse,{isThirdPartyAPICall:true,hasQueryString:true},callbacks);};}},_prototypeWith:{initialize:function(tweetJSON){var self=this;var twitterEntryJSON=Evri.API.Utilities.JSON.getNodeForPath(tweetJSON,"twitterEntry");Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(twitterEntryJSON,self);self.matchedLocations=[];self.entityResources=[];self.entityIds=[];var entityResourcesNodes=Evri.API.Utilities.JSON.getNodeSetForPath(tweetJSON,"entities/taggedEntityData/entityUris/string");for(var i=0;i<entityResourcesNodes.length;i++){var resource=Evri.API.Utilities.JSON.getValueForNode(entityResourcesNodes[i]);self.entityResources.push(resource);var entityId=self.session.models.Entity.parseIdFromResource(resource);if(entityId!==undefined){self.entityIds.push(entityId);}}
var entityMatchedLocations=Evri.API.Utilities.JSON.getNodeSetForPath(tweetJSON,"entities/taggedEntityData/entityLocations/location");for(var i=0;i<entityMatchedLocations.length;i++){self.matchedLocations.push(new self.session.models.TweetMatchedLocation(entityMatchedLocations[i],self.entityResources));}
return self;},instanceAttributes:['documentationUrl','klass','belongsTo','authorName','authorURI','content','entityIds','entityResources','id','imageURI','matchedLocations','permalink','published','title','updated'],instanceMethods:['getEntityDetails','getRelativePublicationDate','getTitleRanges'],getEntityDetails:function(callbacks){var self=this;self.session.models.Entity.findById(self.entityIds,callbacks)},getRelativePublicationDate:function(options){var self=this;return Evri.API.Utilities.Date.relativeDate(self.published,options);},getTitleRanges:function(){var self=this;return Evri.API.Utilities.HTML.tokenizeStringHighlights(self.session,self.title,self.matchedLocations);}}});Evri.defineNamespace(Evri.API.Model,"TweetList");Evri.extendNamespace(Evri.API.Model.TweetList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,"TweetList",{beforeInstantiate:"twitterNet/twitterEntryData"});},handleTwitterResponse:function(session){return function(responseJSON,responseCallbacks){if(responseCallbacks!==undefined){if(responseJSON!==null){if(responseJSON.error!==undefined){var error=new session.models.APIError(responseJSON.error,{"responseJSON":responseJSON});responseCallbacks.onFailure.call(null,error);}
else{var responseItem=new(session.models["TweetList"])(responseJSON,{twitterResponse:true});responseCallbacks.onComplete.call(null,responseItem);}}
else{var error=new session.models.APIError("Response object is null");responseCallbacks.onFailure.call(null,error);}}};},handleRequestOptions:function(session){return function(params,options){};}},_prototypeWith:{initialize:function(tweetListJSON,options){var self=this;options=options||{};self.tweets=[];self.entityIds=[];self.entityResources=[];var tweetNodes=[];if(options.twitterResponse===true){tweetNodes=Evri.API.Utilities.JSON.getNodeSetForPath(tweetListJSON,"results");}
else{tweetNodes=Evri.API.Utilities.JSON.getNodeSetForPath(tweetListJSON,"taggedTwitterEntryData");}
var entityIdsMap={};var entityResourcesMap={};for(var i=0;i<tweetNodes.length;i++){var tweetNode=tweetNodes[i];var tweet=new self.session.models.Tweet(tweetNode);if(options.twitterResponse===true){tweet.authorName=tweetNode.from_user;tweet.authorURI="http://www.twitter.com/"+tweetNode.from_user;tweet.content=tweetNode.text;tweet.title=tweetNode.text;tweet.imageURI=tweetNode.profile_image_url;tweet.published=tweetNode.created_at;tweet.id=tweetNode.id;tweet.permalink='';tweet.updated='';}
self.tweets.push(tweet);for(var j=0;j<tweet.entityIds.length;j++){var entityId=tweet.entityIds[j];if(entityIdsMap[entityId]===undefined){entityIdsMap[entityId]=1;self.entityIds.push(entityId);}}
for(var j=0;j<tweet.entityResources.length;j++){var resource=tweet.entityResources[j];if(entityResourcesMap[resource]===undefined){entityResourcesMap[resource]=1;self.entityResources.push(resource);}}}
return self;},instanceAttributes:['entityIds','entityResources','tweets'],instanceMethods:['getEntityDetails'],getEntityDetails:function(callbacks){var self=this;self.session.models.Entity.findById(self.entityIds,callbacks)}}});Evri.defineNamespace(Evri.API.Model,"TweetMatchedLocation");Evri.extendNamespace(Evri.API.Model.TweetMatchedLocation,{_classMethodGenerators:{},_prototypeWith:{initialize:function(locationJSON,entityResources){var self=this;var entityIndex=parseInt(Evri.API.Utilities.JSON.getValueForPath(locationJSON,"ei"));self.href=entityResources[entityIndex];self.start=parseInt(Evri.API.Utilities.JSON.getValueForPath(locationJSON,"sp"));self.end=parseInt(Evri.API.Utilities.JSON.getValueForPath(locationJSON,"ep"));self.snippetLength=self.end-self.start;self.portalURI=Evri.API.Utilities.portalURIForPath(self.href);return self;},instanceAttributes:['documentationUrl','klass','end','href','portalURI','snippetLength','start',],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"TwitterQuery");Evri.extendNamespace(Evri.API.Model.TwitterQuery,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,"TwitterQuery",{beforeInstantiate:"twitterResult"});},handleRequestOptions:function(session){return function(params,options){};}},_prototypeWith:{initialize:function(twitterQueryJSON){var self=this;var twitterQueryJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(twitterQueryJSON,"query");if(twitterQueryJSONNodes.length>0){self.twitterSearchAPI=Evri.API.Utilities.JSON.getValueForNode(twitterQueryJSONNodes[0]);self.callTwitterForEntityResource=function(callbacks){self.session.models.Tweet.callTwitterForEntityResource(self.twitterSearchAPI,callbacks);};}
return self;},instanceAttributes:['twitterSearchAPI'],instanceMethods:['findByResource']}});Evri.defineNamespace(Evri.API.Model,"Video");Evri.extendNamespace(Evri.API.Model.Video,{_classMethodGenerators:{},_prototypeWith:{initialize:function(videoJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(videoJSON,self);var thumbnailNodes=Evri.API.Utilities.JSON.getNodeSetForPath(videoJSON,"thumbnails/image");self.thumbnails=[];for(var i=0;i<thumbnailNodes.length;i++){var thumbnail=new self.session.models.VideoStillImage(thumbnailNodes[i]);thumbnail.belongsTo=self;self.thumbnails.push(thumbnail);}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','author','content','duration','id','medium','thumbnails','title','type','url'],instanceMethods:['getSourceUrl'],getSourceUrl:function(){var self=this;var sourceUrl="";if(self.id.match(/gdata\.youtube\.com/)!==-1){var youtubeBaseUrl="http://www.youtube.com/watch?v=";var urlComponents=self.id.split("/");var youtubeVideoId=urlComponents[urlComponents.length-1];sourceUrl=youtubeBaseUrl+youtubeVideoId;}
return sourceUrl;}}});Evri.defineNamespace(Evri.API.Model,"VideoList");Evri.extendNamespace(Evri.API.Model.VideoList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'VideoList',{beforeInstantiate:"mediaResult"});},handleTargetRelationResponse:function(session){Evri.API.Model.generateResponseHandler(session,'VideoList',{beforeInstantiate:"relations/relation/targets/entity"});},handleRequestOptions:function(session){return function(params,options){};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.videos=[];var videoListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"videoList");if(videoListNode!==undefined){var videoJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(videoListNode,"video");for(var i=0;i<videoJSONNodes.length;i++){var video=new self.session.models.Video(videoJSONNodes[i]);video.belongsTo=self;self.videos.push(video);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','videos'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"VideoStillImage");Evri.extendNamespace(Evri.API.Model.VideoStillImage,{_classMethodGenerators:{},_prototypeWith:{initialize:function(jsonNode){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(jsonNode,self);return self;},instanceAttributes:['belongsTo','documentationUrl','klass','height','size','time','url','width'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Zeitgeist");Evri.extendNamespace(Evri.API.Model.Zeitgeist,{getEntitiesByEntityTypeAndZeitgeistTypeGenerator:function(session,zeitgeistType){return function(entityType,callbacks,options){var params={};options=options||{};if(options.resultsPerPage!==undefined){params.max=parseInt(options.resultsPerPage);}
if(options.facet!==undefined){params.facet=options.facet;}
Evri.API.Transport.callRemoteMethod(session,"/zeitgeist/entities/"+entityType+"/"+zeitgeistType,session.models.EntityList["handleZeitgeistEntities"+Evri.API.Utilities.String.capitalize(zeitgeistType)+"Response"],params,callbacks);};},_classMethodGenerators:{getPopularEntitiesByType:function(session){return Evri.API.Model.Zeitgeist.getEntitiesByEntityTypeAndZeitgeistTypeGenerator(session,'popular');},getRisingEntitiesByType:function(session){return Evri.API.Model.Zeitgeist.getEntitiesByEntityTypeAndZeitgeistTypeGenerator(session,'rising');},getFallingEntitiesByType:function(session){return Evri.API.Model.Zeitgeist.getEntitiesByEntityTypeAndZeitgeistTypeGenerator(session,'falling');}}});Evri.defineClass(Evri.API,"Session",function(options){var self=this;self.klass="Session";self.requiredQueryStringParameterKeys=['appId'];self.sharedQueryStringParameters={};for(var i=0;i<self.requiredQueryStringParameterKeys.length;i++){var key=self.requiredQueryStringParameterKeys[i];if(options[key]===undefined){alert(key+" is a required to create an Evri.API.Session");return undefined;}else{self.sharedQueryStringParameters[key]=options[key];}}
Evri.API.Model.generateForSession(self);return self;});Evri.API.setup({'transport':'CrossDomain'});Evri.jQuery||(function(){var
window=this,undefined,jQuery=window.Evri.jQuery=window.Evri.$=function(selector,context){return new jQuery.fn.init(selector,context);},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;this.context=selector;return this;}
if(typeof selector==="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])
selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem&&elem.id!=match[3])
return jQuery().find(selector);var ret=jQuery(elem||[]);ret.context=document;ret.selector=selector;return ret;}}else
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))
return jQuery(document).ready(selector);if(selector.selector&&selector.context){this.selector=selector.selector;this.context=selector.context;}
return this.setArray(jQuery.isArray(selector)?selector:jQuery.makeArray(selector));},selector:"",jquery:"1.3.2",size:function(){return this.length;},get:function(num){return num===undefined?Array.prototype.slice.call(this):this[num];},pushStack:function(elems,name,selector){var ret=jQuery(elems);ret.prevObject=this;ret.context=this.context;if(name==="find")
ret.selector=this.selector+(this.selector?" ":"")+selector;else if(name)
ret.selector=this.selector+"."+name+"("+selector+")";return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(typeof name==="string")
if(value===undefined)
return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}
return this.each(function(i){for(name in options)
jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)
value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!=="object"&&text!=null)
return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)
ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).clone();if(this[0].parentNode)
wrap.insertBefore(this[0]);wrap.map(function(){var elem=this;while(elem.firstChild)
elem=elem.firstChild;return elem;}).append(this);}
return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1)
this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1)
this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},push:[].push,sort:[].sort,splice:[].splice,find:function(selector){if(this.length===1){var ret=this.pushStack([],"find",selector);ret.length=0;jQuery.find(selector,this[0],ret);return ret;}else{return this.pushStack(jQuery.unique(jQuery.map(this,function(elem){return jQuery.find(selector,elem);})),"find",selector);}},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML;if(!html){var div=this.ownerDocument.createElement("div");div.appendChild(this.cloneNode(true));html=div.innerHTML;}
return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0];}else
return this.cloneNode(true);});if(events===true){var orig=this.find("*").andSelf(),i=0;ret.find("*").andSelf().each(function(){if(this.nodeName!==orig[i].nodeName)
return;var events=jQuery.data(orig[i],"events");for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data);}}
i++;});}
return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,jQuery.grep(this,function(elem){return elem.nodeType===1;})),"filter",selector);},closest:function(selector){var pos=jQuery.expr.match.POS.test(selector)?jQuery(selector):null,closer=0;return this.map(function(){var cur=this;while(cur&&cur.ownerDocument){if(pos?pos.index(cur)>-1:jQuery(cur).is(selector)){jQuery.data(cur,"closest",closer);return cur;}
cur=cur.parentNode;closer++;}});},not:function(selector){if(typeof selector==="string")
if(isSimple.test(selector))
return this.pushStack(jQuery.multiFilter(selector,this,true),"not",selector);else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector==="string"?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return!!selector&&this.is("."+selector);},val:function(value){if(value===undefined){var elem=this[0];if(elem){if(jQuery.nodeName(elem,'option'))
return(elem.attributes.value||{}).specified?elem.value:elem.text;if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)
return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery(option).val();if(one)
return value;values.push(value);}}
return values;}
return(elem.value||"").replace(/\r/g,"");}
return undefined;}
if(typeof value==="number")
value+='';return this.each(function(){if(this.nodeType!=1)
return;if(jQuery.isArray(value)&&/radio|checkbox/.test(this.type))
this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)
this.selectedIndex=-1;}else
this.value=value;});},html:function(value){return value===undefined?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,+i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},domManip:function(args,table,callback){if(this[0]){var fragment=(this[0].ownerDocument||this[0]).createDocumentFragment(),scripts=jQuery.clean(args,(this[0].ownerDocument||this[0]),fragment),first=fragment.firstChild;if(first)
for(var i=0,l=this.length;i<l;i++)
callback.call(root(this[i],first),this.length>1||i>0?fragment.cloneNode(true):fragment);if(scripts)
jQuery.each(scripts,evalScript);}
return this;function root(elem,cur){return table&&jQuery.nodeName(elem,"table")&&jQuery.nodeName(cur,"tr")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem;}}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)
jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)
elem.parentNode.removeChild(elem);}
function now(){return+new Date;}
jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2;}
if(typeof target!=="object"&&!jQuery.isFunction(target))
target={};if(length==i){target=this;--i;}
for(;i<length;i++)
if((options=arguments[i])!=null)
for(var name in options){var src=target[name],copy=options[name];if(target===copy)
continue;if(deep&&copy&&typeof copy==="object"&&!copy.nodeType)
target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)
target[name]=copy;}
return target;};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{},toString=Object.prototype.toString;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)
window.jQuery=_jQuery;return jQuery;},isFunction:function(obj){return toString.call(obj)==="[object Function]";},isArray:function(obj){return toString.call(obj)==="[object Array]";},isXMLDoc:function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&jQuery.isXMLDoc(elem.ownerDocument);},globalEval:function(data){if(data&&/\S/.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.support.scriptEval)
script.appendChild(document.createTextNode(data));else
script.text=data;head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length===undefined){for(name in object)
if(callback.apply(object[name],args)===false)
break;}else
for(;i<length;)
if(callback.apply(object[i++],args)===false)
break;}else{if(length===undefined){for(name in object)
if(callback.call(object[name],name,object[name])===false)
break;}else
for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}
return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))
value=value.call(elem,i);return typeof value==="number"&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))
elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)
elem.className=classNames!==undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return elem&&jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}
callback.call(elem);for(var name in options)
elem.style[name]=old[name];},css:function(elem,name,force,extra){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;if(extra==="border")
return;jQuery.each(which,function(){if(!extra)
val-=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;if(extra==="margin")
val+=parseFloat(jQuery.curCSS(elem,"margin"+this,true))||0;else
val-=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});}
if(elem.offsetWidth!==0)
getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,Math.round(val));}
return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;if(name=="opacity"&&!jQuery.support.opacity){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}
if(name.match(/float/i))
name=styleFloat;if(!force&&style&&style[name])
ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))
name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle)
ret=computedStyle.getPropertyValue(name);if(name=="opacity"&&ret=="")
ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}
return ret;},clean:function(elems,context,fragment){context=context||document;if(typeof context.createElement==="undefined")
context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;if(!fragment&&elems.length===1&&typeof elems[0]==="string"){var match=/^<(\w+)\s*\/?>$/.exec(elems[0]);if(match)
return[context.createElement(match[1])];}
var ret=[],scripts=[],div=context.createElement("div");jQuery.each(elems,function(i,elem){if(typeof elem==="number")
elem+='';if(!elem)
return;if(typeof elem==="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=elem.replace(/^\s+/,"").substring(0,10).toLowerCase();var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!jQuery.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)
div=div.lastChild;if(!jQuery.support.tbody){var hasBody=/<tbody/i.test(elem),tbody=!tags.indexOf("<table")&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&!hasBody?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)
if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)
tbody[j].parentNode.removeChild(tbody[j]);}
if(!jQuery.support.leadingWhitespace&&/^\s/.test(elem))
div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);elem=jQuery.makeArray(div.childNodes);}
if(elem.nodeType)
ret.push(elem);else
ret=jQuery.merge(ret,elem);});if(fragment){for(var i=0;ret[i];i++){if(jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i]);}else{if(ret[i].nodeType===1)
ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))));fragment.appendChild(ret[i]);}}
return scripts;}
return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)
return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&elem.parentNode)
elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)
throw"type property can't be changed";elem[name]=value;}
if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))
return elem.getAttributeNode(name).nodeValue;if(name=="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");return attributeNode&&attributeNode.specified?attributeNode.value:elem.nodeName.match(/(button|input|object|select|textarea)/i)?0:elem.nodeName.match(/^(a|area)$/i)&&elem.href?0:undefined;}
return elem[name];}
if(!jQuery.support.style&&notxml&&name=="style")
return jQuery.attr(elem.style,"cssText",value);if(set)
elem.setAttribute(name,""+value);var attr=!jQuery.support.hrefNormalized&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}
if(!jQuery.support.opacity&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+
(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}
return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}
name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)
elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||typeof array==="string"||jQuery.isFunction(array)||array.setInterval)
ret[0]=array;else
while(i)
ret[--i]=array[i];}
return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)
if(array[i]===elem)
return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(!jQuery.support.getAll){while((elem=second[i++])!=null)
if(elem.nodeType!=8)
first[pos++]=elem;}else
while((elem=second[i++])!=null)
first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}
return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)
if(!inv!=!callback(elems[i],i))
ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)
ret[ret.length]=value;}
return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,'0'])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")
ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret),name,selector);};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector);for(var i=0,l=insert.length;i<l;i++){var elems=(i>0?this.clone(true):this).get();jQuery.fn[original].apply(jQuery(insert[i]),elems);ret=ret.concat(elems);}
return this.pushStack(ret,name,selector);};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)
this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames,state){if(typeof state!=="boolean")
state=!jQuery.className.has(this,classNames);jQuery.className[state?"add":"remove"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).length){jQuery("*",this).add([this]).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)
this.parentNode.removeChild(this);}},empty:function(){jQuery(this).children().remove();while(this.firstChild)
this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}
var expando="jQuery"+now(),uuid=0,windowData={};jQuery.extend({cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)
id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])
jQuery.cache[id]={};if(data!==undefined)
jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])
break;if(!name)
jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)
elem.removeAttribute(expando);}
delete jQuery.cache[id];}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";var q=jQuery.data(elem,type);if(!q||jQuery.isArray(data))
q=jQuery.data(elem,type,jQuery.makeArray(data));else if(data)
q.push(data);}
return q;},dequeue:function(elem,type){var queue=jQuery.queue(elem,type),fn=queue.shift();if(!type||type==="fx")
fn=queue[0];if(fn!==undefined)
fn.call(elem);}});jQuery.fn.extend({data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)
data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},queue:function(type,data){if(typeof type!=="string"){data=type;type="fx";}
if(data===undefined)
return jQuery.queue(this[0],type);return this.each(function(){var queue=jQuery.queue(this,type,data);if(type=="fx"&&queue.length==1)
queue[0].call(this);});},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type);});}});(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,done=0,toString=Object.prototype.toString;var Sizzle=function(selector,context,results,seed){results=results||[];context=context||document;if(context.nodeType!==1&&context.nodeType!==9)
return[];if(!selector||typeof selector!=="string"){return results;}
var parts=[],m,set,checkSet,check,mode,extra,prune=true;chunker.lastIndex=0;while((m=chunker.exec(selector))!==null){parts.push(m[1]);if(m[2]){extra=RegExp.rightContext;break;}}
if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context);}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector])
selector+=parts.shift();set=posProcess(selector,set);}}}else{var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&context.parentNode?context.parentNode:context,isXML(context));set=Sizzle.filter(ret.expr,ret.set);if(parts.length>0){checkSet=makeArray(set);}else{prune=false;}
while(parts.length){var cur=parts.pop(),pop=cur;if(!Expr.relative[cur]){cur="";}else{pop=parts.pop();}
if(pop==null){pop=context;}
Expr.relative[cur](checkSet,pop,isXML(context));}}
if(!checkSet){checkSet=set;}
if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector);}
if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet);}else if(context.nodeType===1){for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i]);}}}else{for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i]);}}}}else{makeArray(checkSet,results);}
if(extra){Sizzle(extra,context,results,seed);if(sortOrder){hasDuplicate=false;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1);}}}}}
return results;};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set);};Sizzle.find=function(expr,context,isXML){var set,match;if(!expr){return[];}
for(var i=0,l=Expr.order.length;i<l;i++){var type=Expr.order[i],match;if((match=Expr.match[type].exec(expr))){var left=RegExp.leftContext;if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break;}}}}
if(!set){set=context.getElementsByTagName("*");}
return{set:set,expr:expr};};Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;anyFound=false;if(curLoop==result){result=[];}
if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true;}else if(match===true){continue;}}
if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true;}else{curLoop[i]=false;}}else if(pass){result.push(item);anyFound=true;}}}}
if(found!==undefined){if(!inplace){curLoop=result;}
expr=expr.replace(Expr.match[type],"");if(!anyFound){return[];}
break;}}}
if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr;}else{break;}}
old=expr;}
return curLoop;};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href");}},relative:{"+":function(checkSet,part,isXML){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag&&!isXML){part=part.toUpperCase();}
for(var i=0,l=checkSet.length,elem;i<l;i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}
checkSet[i]=isPartStrNotTag||elem&&elem.nodeName===part?elem||false:elem===part;}}
if(isPartStrNotTag){Sizzle.filter(part,checkSet,true);}},">":function(checkSet,part,isXML){var isPartStr=typeof part==="string";if(isPartStr&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName===part?parent:false;}}}else{for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part;}}
if(isPartStr){Sizzle.filter(part,checkSet,true);}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck;}
checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML);},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck;}
checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML);}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?[m]:[];}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i]);}}
return ret.length===0?null:ret;}},TAG:function(match,context){return context.getElementsByTagName(match[1]);}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";if(isXML){return match;}
for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").indexOf(match)>=0)){if(!inplace)
result.push(elem);}else if(inplace){curLoop[i]=false;}}}
return false;},ID:function(match){return match[1].replace(/\\/g,"");},TAG:function(match,curLoop){for(var i=0;curLoop[i]===false;i++){}
return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase();},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0;}
match[0]=done++;return match;},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name];}
if(match[2]==="~="){match[4]=" "+match[4]+" ";}
return match;},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if(match[3].match(chunker).length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop);}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret);}
return false;}}else if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true;}
return match;},POS:function(match){match.unshift(true);return match;}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden";},disabled:function(elem){return elem.disabled===true;},checked:function(elem){return elem.checked===true;},selected:function(elem){elem.parentNode.selectedIndex;return elem.selected===true;},parent:function(elem){return!!elem.firstChild;},empty:function(elem){return!elem.firstChild;},has:function(elem,i,match){return!!Sizzle(match[3],elem).length;},header:function(elem){return/h\d/i.test(elem.nodeName);},text:function(elem){return"text"===elem.type;},radio:function(elem){return"radio"===elem.type;},checkbox:function(elem){return"checkbox"===elem.type;},file:function(elem){return"file"===elem.type;},password:function(elem){return"password"===elem.type;},submit:function(elem){return"submit"===elem.type;},image:function(elem){return"image"===elem.type;},reset:function(elem){return"reset"===elem.type;},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON";},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName);}},setFilters:{first:function(elem,i){return i===0;},last:function(elem,i,match,array){return i===array.length-1;},even:function(elem,i){return i%2===0;},odd:function(elem,i){return i%2===1;},lt:function(elem,i,match){return i<match[3]-0;},gt:function(elem,i,match){return i>match[3]-0;},nth:function(elem,i,match){return match[3]-0==i;},eq:function(elem,i,match){return match[3]-0==i;}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array);}else if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0;}else if(name==="not"){var not=match[3];for(var i=0,l=not.length;i<l;i++){if(not[i]===elem){return false;}}
return true;}},CHILD:function(elem,match){var type=match[1],node=elem;switch(type){case'only':case'first':while(node=node.previousSibling){if(node.nodeType===1)return false;}
if(type=='first')return true;node=elem;case'last':while(node=node.nextSibling){if(node.nodeType===1)return false;}
return true;case'nth':var first=match[2],last=match[3];if(first==1&&last==0){return true;}
var doneName=match[0],parent=elem.parentNode;if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count;}}
parent.sizcache=doneName;}
var diff=elem.nodeIndex-last;if(first==0){return diff==0;}else{return(diff%first==0&&diff/first>=0);}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match;},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match;},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1;},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false;},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array);}}}};var origPOS=Expr.match.POS;for(var type in Expr.match){Expr.match[type]=RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source);}
var makeArray=function(array,results){array=Array.prototype.slice.call(array);if(results){results.push.apply(results,array);return results;}
return array;};try{Array.prototype.slice.call(document.documentElement.childNodes);}catch(e){makeArray=function(array,results){var ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array);}else{if(typeof array.length==="number"){for(var i=0,l=array.length;i<l;i++){ret.push(array[i]);}}else{for(var i=0;array[i];i++){ret.push(array[i]);}}}
return ret;};}
var sortOrder;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;if(ret===0){hasDuplicate=true;}
return ret;};}else if("sourceIndex"in document.documentElement){sortOrder=function(a,b){var ret=a.sourceIndex-b.sourceIndex;if(ret===0){hasDuplicate=true;}
return ret;};}else if(document.createRange){sortOrder=function(a,b){var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();aRange.selectNode(a);aRange.collapse(true);bRange.selectNode(b);bRange.collapse(true);var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);if(ret===0){hasDuplicate=true;}
return ret;};}
(function(){var form=document.createElement("form"),id="script"+(new Date).getTime();form.innerHTML="<input name='"+id+"'/>";var root=document.documentElement;root.insertBefore(form,root.firstChild);if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[];}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match;};}
root.removeChild(form);})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i]);}}
results=tmp;}
return results;};}
div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2);};}})();if(document.querySelectorAll)(function(){var oldSizzle=Sizzle,div=document.createElement("div");div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return;}
Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra);}catch(e){}}
return oldSizzle(query,context,extra,seed);};Sizzle.find=oldSizzle.find;Sizzle.filter=oldSizzle.filter;Sizzle.selectors=oldSizzle.selectors;Sizzle.matches=oldSizzle.matches;})();if(document.getElementsByClassName&&document.documentElement.getElementsByClassName)(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(div.getElementsByClassName("e").length===0)
return;div.lastChild.className="e";if(div.getElementsByClassName("e").length===1)
return;Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1]);}};})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i;}
elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(elem.nodeName===cur){match=elem;break;}
elem=elem[dir];}
checkSet[i]=match;}}}
function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i;}
elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(typeof cur!=="string"){if(elem===cur){match=true;break;}}else if(Sizzle.filter(cur,[elem]).length>0){match=elem;break;}}
elem=elem[dir];}
checkSet[i]=match;}}}
var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16;}:function(a,b){return a!==b&&(a.contains?a.contains(b):true);};var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&isXML(elem.ownerDocument);};var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"");}
selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet);}
return Sizzle.filter(later,tmpSet);};jQuery.find=Sizzle;jQuery.filter=Sizzle.filter;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;Sizzle.selectors.filters.hidden=function(elem){return elem.offsetWidth===0||elem.offsetHeight===0;};Sizzle.selectors.filters.visible=function(elem){return elem.offsetWidth>0||elem.offsetHeight>0;};Sizzle.selectors.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};jQuery.multiFilter=function(expr,elems,not){if(not){expr=":not("+expr+")";}
return Sizzle.matches(expr,elems);};jQuery.dir=function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)
matched.push(cur);cur=cur[dir];}
return matched;};jQuery.nth=function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])
if(cur.nodeType==1&&++num==result)
break;return cur;};jQuery.sibling=function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)
r.push(n);}
return r;};return;window.Sizzle=Sizzle;})();jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)
return;if(elem.setInterval&&elem!=window)
elem=window;if(!handler.guid)
handler.guid=this.guid++;if(data!==undefined){var fn=handler;handler=this.proxy(fn);handler.data=data;}
var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(arguments.callee.elem,arguments):undefined;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");type=namespaces.shift();handler.type=namespaces.slice().sort().join(".");var handlers=events[type];if(jQuery.event.specialAll[type])
jQuery.event.specialAll[type].setup.call(elem,data,namespaces);if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem,data,namespaces)===false){if(elem.addEventListener)
elem.addEventListener(type,handle,false);else if(elem.attachEvent)
elem.attachEvent("on"+type,handle);}}
handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)
return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types===undefined||(typeof types==="string"&&types.charAt(0)=="."))
for(var type in events)
this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}
jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");type=namespaces.shift();var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");if(events[type]){if(handler)
delete events[type][handler.guid];else
for(var handle in events[type])
if(namespace.test(events[type][handle].type))
delete events[type][handle];if(jQuery.event.specialAll[type])
jQuery.event.specialAll[type].teardown.call(elem,namespaces);for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem,namespaces)===false){if(elem.removeEventListener)
elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)
elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}
ret=null;delete events[type];}}});}
for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(event,data,elem,bubbling){var type=event.type||event;if(!bubbling){event=typeof event==="object"?event[expando]?event:jQuery.extend(jQuery.Event(type),event):jQuery.Event(type);if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);event.exclusive=true;}
if(!elem){event.stopPropagation();if(this.global[type])
jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type])
jQuery.event.trigger(event,data,this.handle.elem);});}
if(!elem||elem.nodeType==3||elem.nodeType==8)
return undefined;event.result=undefined;event.target=elem;data=jQuery.makeArray(data);data.unshift(event);}
event.currentTarget=elem;var handle=jQuery.data(elem,"handle");if(handle)
handle.apply(elem,data);if((!elem[type]||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)
event.result=false;if(!bubbling&&elem[type]&&!event.isDefaultPrevented()&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}
this.triggered=false;if(!event.isPropagationStopped()){var parent=elem.parentNode||elem.ownerDocument;if(parent)
jQuery.event.trigger(event,data,parent,true);}},handle:function(event){var all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);event.currentTarget=this;var namespaces=event.type.split(".");event.type=namespaces.shift();all=!namespaces.length&&!event.exclusive;var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||namespace.test(handler.type)){event.handler=handler;event.data=handler.data;var ret=handler.apply(this,arguments);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}
if(event.isImmediatePropagationStopped())
break;}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando])
return event;var originalEvent=event;event=jQuery.Event(originalEvent);for(var i=this.props.length,prop;i;){prop=this.props[--i];event[prop]=originalEvent[prop];}
if(!event.target)
event.target=event.srcElement||document;if(event.target.nodeType==3)
event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)
event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}
if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))
event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)
event.metaKey=event.ctrlKey;if(!event.which&&event.button)
event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy=proxy||function(){return fn.apply(this,arguments);};proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:bindReady,teardown:function(){}}},specialAll:{live:{setup:function(selector,namespaces){jQuery.event.add(this,namespaces[0],liveHandler);},teardown:function(namespaces){if(namespaces.length){var remove=0,name=RegExp("(^|\\.)"+namespaces[0]+"(\\.|$)");jQuery.each((jQuery.data(this,"events").live||{}),function(){if(name.test(this.type))
remove++;});if(remove<1)
jQuery.event.remove(this,namespaces[0],liveHandler);}}}}};jQuery.Event=function(src){if(!this.preventDefault)
return new jQuery.Event(src);if(src&&src.type){this.originalEvent=src;this.type=src.type;}else
this.type=src;this.timeStamp=now();this[expando]=true;};function returnFalse(){return false;}
function returnTrue(){return true;}
jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e)
return;if(e.preventDefault)
e.preventDefault();e.returnValue=false;},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e)
return;if(e.stopPropagation)
e.stopPropagation();e.cancelBubble=true;},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation();},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var withinElement=function(event){var parent=event.relatedTarget;while(parent&&parent!=this)
try{parent=parent.parentNode;}
catch(e){parent=this;}
if(parent!=this){event.type=event.data;jQuery.event.handle.apply(this,arguments);}};jQuery.each({mouseover:'mouseenter',mouseout:'mouseleave'},function(orig,fix){jQuery.event.special[fix]={setup:function(){jQuery.event.add(this,orig,withinElement,fix);},teardown:function(){jQuery.event.remove(this,orig,withinElement);}};});jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);event.preventDefault();event.stopPropagation();jQuery.event.trigger(event,data,this[0]);return event.result;}},toggle:function(fn){var args=arguments,i=1;while(i<args.length)
jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)
fn.call(document,jQuery);else
jQuery.readyList.push(fn);return this;},live:function(type,fn){var proxy=jQuery.event.proxy(fn);proxy.guid+=this.selector+type;jQuery(document).bind(liveConvert(type,this.selector),this.selector,proxy);return this;},die:function(type,fn){jQuery(document).unbind(liveConvert(type,this.selector),fn?{guid:fn.guid+this.selector+type}:null);return this;}});function liveHandler(event){var check=RegExp("(^|\\.)"+event.type+"(\\.|$)"),stop=true,elems=[];jQuery.each(jQuery.data(this,"events").live||[],function(i,fn){if(check.test(fn.type)){var elem=jQuery(event.target).closest(fn.data)[0];if(elem)
elems.push({elem:elem,fn:fn});}});elems.sort(function(a,b){return jQuery.data(a.elem,"closest")-jQuery.data(b.elem,"closest");});jQuery.each(elems,function(){if(this.fn.call(this.elem,event,this.fn.data)===false)
return(stop=false);});return stop;}
function liveConvert(type,selector){return["live",type,selector.replace(/\./g,"`").replace(/ /g,"|")].join(".");}
jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document,jQuery);});jQuery.readyList=null;}
jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);jQuery.ready();},false);}else if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);jQuery.ready();}});if(document.documentElement.doScroll&&window==window.top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}
jQuery.ready();})();}
jQuery.event.add(window,"load",jQuery.ready);}
jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,"+"change,select,submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});jQuery(window).bind('unload',function(){for(var id in jQuery.cache)
if(id!=1&&jQuery.cache[id].handle)
jQuery.event.remove(jQuery.cache[id].handle.elem);});(function(){jQuery.support={};var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+(new Date).getTime();div.style.display="none";div.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return;}
jQuery.support={leadingWhitespace:div.firstChild.nodeType==3,tbody:!div.getElementsByTagName("tbody").length,objectAll:!!div.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:a.style.opacity==="0.5",cssFloat:!!a.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};script.type="text/javascript";try{script.appendChild(document.createTextNode("window."+id+"=1;"));}catch(e){}
root.insertBefore(script,root.firstChild);if(window[id]){jQuery.support.scriptEval=true;delete window[id];}
root.removeChild(script);if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function(){jQuery.support.noCloneEvent=false;div.detachEvent("onclick",arguments.callee);});div.cloneNode(true).fireEvent("onclick");}
jQuery(function(){var div=document.createElement("div");div.style.width=div.style.paddingLeft="1px";document.body.appendChild(div);jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;document.body.removeChild(div).style.display='none';});})();var styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat";jQuery.props={"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!=="string")
return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}
var type="GET";if(params)
if(jQuery.isFunction(params)){callback=params;params=null;}else if(typeof params==="object"){params=jQuery.param(params);type="POST";}
var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")
self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);if(callback)
self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}
return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}
return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!=="string")
s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))
s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))
s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}
if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)
s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}
if(head)
head.removeChild(script);};}
if(s.dataType=="script"&&s.cache==null)
s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}
if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}
if(s.global&&!jQuery.active++)
jQuery.event.trigger("ajaxStart");var parts=/^(\w+:)?\/\/([^\/?#]+)/.exec(s.url);if(s.dataType=="script"&&type=="GET"&&parts&&(parts[1]&&parts[1]!=location.protocol||parts[2]!=location.host)){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)
script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();script.onload=script.onreadystatechange=null;head.removeChild(script);}};}
head.appendChild(script);return undefined;}
var requestDone=false;var xhr=s.xhr();if(s.username)
xhr.open(type,s.url,s.async,s.username,s.password);else
xhr.open(type,s.url,s.async);try{if(s.data)
xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)
xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}
if(s.beforeSend&&s.beforeSend(xhr,s)===false){if(s.global&&!--jQuery.active)
jQuery.event.trigger("ajaxStop");xhr.abort();return false;}
if(s.global)
jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(xhr.readyState==0){if(ival){clearInterval(ival);ival=null;if(s.global&&!--jQuery.active)
jQuery.event.trigger("ajaxStop");}}else if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}
status=isTimeout=="timeout"?"timeout":!jQuery.httpSuccess(xhr)?"error":s.ifModified&&jQuery.httpNotModified(xhr,s.url)?"notmodified":"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s);}catch(e){status="parsererror";}}
if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}
if(s.ifModified&&modRes)
jQuery.lastModified[s.url]=modRes;if(!jsonp)
success();}else
jQuery.handleError(s,xhr,status);complete();if(isTimeout)
xhr.abort();if(s.async)
xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)
setTimeout(function(){if(xhr&&!requestDone)
onreadystatechange("timeout");},s.timeout);}
try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}
if(!s.async)
onreadystatechange();function success(){if(s.success)
s.success(data,status);if(s.global)
jQuery.event.trigger("ajaxSuccess",[xhr,s]);}
function complete(){if(s.complete)
s.complete(xhr,status);if(s.global)
jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)
jQuery.event.trigger("ajaxStop");}
return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)
jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223;}catch(e){}
return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url];}catch(e){}
return false;},httpData:function(xhr,type,s){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")
throw"parsererror";if(s&&s.dataFilter)
data=s.dataFilter(data,type);if(typeof data==="string"){if(type=="script")
jQuery.globalEval(data);if(type=="json")
data=window["eval"]("("+data+")");}
return data;},param:function(a){var s=[];function add(key,value){s[s.length]=encodeURIComponent(key)+'='+encodeURIComponent(value);};if(jQuery.isArray(a)||a.jquery)
jQuery.each(a,function(){add(this.name,this.value);});else
for(var j in a)
if(jQuery.isArray(a[j]))
jQuery.each(a[j],function(){add(j,this);});else
add(j,jQuery.isFunction(a[j])?a[j]():a[j]);return s.join("&").replace(/%20/g,"+");}});var elemdisplay={},timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type;});return obj;}
jQuery.fn.extend({show:function(speed,callback){if(speed){return this.animate(genFx("show",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");this[i].style.display=old||"";if(jQuery.css(this[i],"display")==="none"){var tagName=this[i].tagName,display;if(elemdisplay[tagName]){display=elemdisplay[tagName];}else{var elem=jQuery("<"+tagName+" />").appendTo("body");display=elem.css("display");if(display==="none")
display="block";elem.remove();elemdisplay[tagName]=display;}
jQuery.data(this[i],"olddisplay",display);}}
for(var i=0,l=this.length;i<l;i++){this[i].style.display=jQuery.data(this[i],"olddisplay")||"";}
return this;}},hide:function(speed,callback){if(speed){return this.animate(genFx("hide",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");if(!old&&old!=="none")
jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"));}
for(var i=0,l=this.length;i<l;i++){this[i].style.display="none";}
return this;}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn==null||bool?this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]();}):this.animate(genFx("toggle",3),fn,fn2);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType==1&&jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)
return opt.complete.call(this);if((p=="height"||p=="width")&&this.style){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}
if(opt.overflow!=null)
this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))
e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}
if(parts[1])
end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)
this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)
if(timers[i].elem==this){if(gotoEnd)
timers[i](true);timers.splice(i,1);}});if(!gotoEnd)
this.dequeue();return this;}});jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback);};});jQuery.extend({speed:function(speed,easing,fn){var opt=typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)
jQuery(this).dequeue();if(jQuery.isFunction(opt.old))
opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)
options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)
this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style)
this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))
return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;var self=this;function t(gotoEnd){return self.step(gotoEnd);}
t.elem=this.elem;if(t()&&jQuery.timers.push(t)&&!timerId){timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)
if(!timers[i]())
timers.splice(i--,1);if(!timers.length){clearInterval(timerId);timerId=undefined;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)
if(this.options.curAnim[i]!==true)
done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")
this.elem.style.display="block";}
if(this.options.hide)
jQuery(this.elem).hide();if(this.options.hide||this.options.show)
for(var p in this.options.curAnim)
jQuery.attr(this.elem.style,p,this.options.orig[p]);this.options.complete.call(this.elem);}
return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}
return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null)
fx.elem.style[fx.prop]=fx.now+fx.unit;else
fx.elem[fx.prop]=fx.now;}}});if(document.documentElement["getBoundingClientRect"])
jQuery.fn.offset=function(){if(!this[0])return{top:0,left:0};if(this[0]===this[0].ownerDocument.body)return jQuery.offset.bodyOffset(this[0]);var box=this[0].getBoundingClientRect(),doc=this[0].ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;return{top:top,left:left};};else
jQuery.fn.offset=function(){if(!this[0])return{top:0,left:0};if(this[0]===this[0].ownerDocument.body)return jQuery.offset.bodyOffset(this[0]);jQuery.offset.initialized||jQuery.offset.initialize();var elem=this[0],offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView.getComputedStyle(elem,null),top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){computedStyle=defaultView.getComputedStyle(elem,null);top-=elem.scrollTop,left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop,left+=elem.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.tagName)))
top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0;prevOffsetParent=offsetParent,offsetParent=elem.offsetParent;}
if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible")
top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0;prevComputedStyle=computedStyle;}
if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static")
top+=body.offsetTop,left+=body.offsetLeft;if(prevComputedStyle.position==="fixed")
top+=Math.max(docElem.scrollTop,body.scrollTop),left+=Math.max(docElem.scrollLeft,body.scrollLeft);return{top:top,left:left};};jQuery.offset={initialize:function(){if(this.initialized)return;var body=document.body,container=document.createElement('div'),innerDiv,checkDiv,table,td,rules,prop,bodyMarginTop=body.style.marginTop,html='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';rules={position:'absolute',top:0,left:0,margin:0,border:0,width:'1px',height:'1px',visibility:'hidden'};for(prop in rules)container.style[prop]=rules[prop];container.innerHTML=html;body.insertBefore(container,body.firstChild);innerDiv=container.firstChild,checkDiv=innerDiv.firstChild,td=innerDiv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(checkDiv.offsetTop!==5);this.doesAddBorderForTableAndCells=(td.offsetTop===5);innerDiv.style.overflow='hidden',innerDiv.style.position='relative';this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);body.style.marginTop='1px';this.doesNotIncludeMarginInBodyOffset=(body.offsetTop===0);body.style.marginTop=bodyMarginTop;body.removeChild(container);this.initialized=true;},bodyOffset:function(body){jQuery.offset.initialized||jQuery.offset.initialize();var top=body.offsetTop,left=body.offsetLeft;if(jQuery.offset.doesNotIncludeMarginInBodyOffset)
top+=parseInt(jQuery.curCSS(body,'marginTop',true),10)||0,left+=parseInt(jQuery.curCSS(body,'marginLeft',true),10)||0;return{top:top,left:left};}};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}
return results;},offsetParent:function(){var offsetParent=this[0].offsetParent||document.body;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))
offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return null;return val!==undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom",lower=name.toLowerCase();jQuery.fn["inner"+name]=function(){return this[0]?jQuery.css(this[0],lower,false,"padding"):null;};jQuery.fn["outer"+name]=function(margin){return this[0]?jQuery.css(this[0],lower,false,margin?"margin":"border"):null;};var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(document.documentElement["client"+name],document.body["scroll"+name],document.documentElement["scroll"+name],document.body["offset"+name],document.documentElement["offset"+name]):size===undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,typeof size==="string"?size:size+"px");};});})();Evri.jQuery.browser.msie6=Evri.jQuery.browser.msie&&(parseInt(Evri.jQuery.browser.version)<=6);Evri.jQuery.browser.msie7=Evri.jQuery.browser.msie&&(parseInt(Evri.jQuery.browser.version)==7);Evri.jQuery.browser.msie8=Evri.jQuery.browser.msie&&(parseInt(Evri.jQuery.browser.version)==8);Evri.jQuery.windowDimensions=function(){var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}
return{width:myWidth,height:myHeight};};Evri.jQuery.windowScroll=function()
{var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}
else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}
else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}
return{x:scrOfX,y:scrOfY};};Evri.jQuery.fn.center=function()
{this.each(function(){var el=Evri.jQuery(this);var winH=Evri.jQuery.windowDimensions().height;var winW=Evri.jQuery.windowDimensions().width;if(winH<el.height())
{var y=0;}
else
{var y=winH/2-el.height()/2;}
if(winW<el.width())
{var x=winW-el.width();}
else
{var x=winW/2-el.width()/2;}
if(Evri.jQuery.browser.msie6)
{el.css('position','absolute');y+=Evri.jQuery.windowScroll().y;x+=Evri.jQuery.windowScroll().x;}
el.css("top",y);el.css("left",x);});return this;};Evri.jQuery.fn.mergeHtml=function(){var text='';var textForNodes={};this.each(function(index,element){var nodeText=Evri.$(element).text();if(textForNodes[nodeText]===undefined){text+=nodeText+'\n\n';textForNodes[nodeText]=1;}});return text;};Evri.jQuery.fn.forceLayout=function(defer){if(Evri.jQuery.browser.msie6){defer=defer||0;setTimeout(function(){this.css("zoom",1);},defer);}
return this;};Evri.jQuery.fn.pngFix=function(){var $=Evri.jQuery;if(!Evri.jQuery.browser.msie6)return this;function fixImage(img)
{var imgName=img.src.toUpperCase();if(imgName.substring(imgName.length-3,imgName.length)=="PNG")
{var span=$("<span />");var properties=["id","class","title","alt","style"];$.each(properties,function(i,prop){span.attr(prop,$(img).attr(prop));});var filter="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+"(src=\'"+img.src+"\', sizingMethod='scale');";span.attr("style",span.attr("style")+filter);$(img).replaceWith(span);}}
this.each(function(){fixImage(this);});return this;};Evri.jQuery.browser.macFirefox=function(){var userAgent=navigator.userAgent.toLowerCase();if(userAgent.indexOf('mac')!=-1&&userAgent.indexOf('firefox')!=-1){return true;}
return false;};Evri.jQuery.fn.browserClass=function(){var self=this;var browsers=["msie","mozilla","safari"];Evri.jQuery.each(browsers,function(){Evri.jQuery.browser[this]&&self.addClass(this);});return self;};Evri.jQuery.parseQueryString=function(str){var value={};var items=str.split("&");Evri.$.each(items,function(k,v){var vals=v.split("=");value[vals[0]]=decodeURIComponent(vals[1]);});return value;};(function($){$.fn.onScrollIntoView=function(callback,options){var $selection=this;var $window=Evri.$(window);options=options||{};options.topOffset=options.topOffset||0;options.interval=options.interval||2500;$selection.each(function(index,item){var $container=$(item);var scrollIntoViewProcessId=undefined;scrollIntoViewProcessId=setInterval(function(){var windowScrollBottom=$window.scrollTop()+$window.height();var containerTop=$container.offset().top;if(windowScrollBottom>(containerTop+options.topOffset)){callback.call();clearInterval(scrollIntoViewProcessId);}},options.interval);});return $selection;};})(Evri.$);Evri.defineNamespace(Evri,'Widget');Evri.defineNamespace(Evri.Widget,"Utilities");Evri.extendNamespace(Evri.Widget.Utilities,{getContent:function(){return Evri.$("h1, p").mergeHtml();},toQueryString:function(params){var paramItems=[];for(var key in params){paramItems.push(key+"="+encodeURIComponent(params[key]));}
return paramItems.join('&');},useStylesheet:function(url){Evri.$("head").append(Evri.$('<link rel="stylesheet" type="text/css" href="'+url+'" />'));}});Evri.defineNamespace(Evri.Widget,"Environment",{set:function(name,value){Evri.Widget.Environment[name]=value;},apiURL:"http://api.evri.com",domainURL:"http://www.evri.com",verticalWidgetURL:"http://www.evri.com/widget/swfs/VerticalSidebar.swf",widgetURL:"http://www.evri.com/widget/swfs/WidgetBase.swf",youTubePlayerURL:"http://www.evri.com/widget/swfs/YouTube.swf"});Evri.defineClass(Evri.Widget,"Analytics",function(widgetName){var self=this;self.name=widgetName;self.host=window.location.hostname;self.path=window.location.pathname;self.loggingDomain=Evri.Widget.Environment.domainURL;return self;});Evri.extendClass(Evri.Widget.Analytics,{log:function(eventName,params){var self=this;params=params||{};var iframe=document.createElement('iframe');iframe.style.position='absolute';iframe.style.height='1px';iframe.style.width='1px';iframe.style.top='0px';iframe.style.left='-10px';iframe.setAttribute("src",self.loggingStatement(eventName,params));document.body.appendChild(iframe);iframe.blur();},logTest:function(eventName,params){var self=this;var statement=self.loggingStatement(eventName,params);try{console.log(statement);}catch(e){};},loggingStatement:function(eventName,params){var self=this;params=params||{};var statement=self.loggingDomain+"/analytics/"+self.name+"/"+self.host+"/-/"+eventName;params.path=self.path;statement+='?'+Evri.Widget.Utilities.toQueryString(params);return statement;},trackDHTML:function(eventName,params){var self=this;params=params||{};self.log("DHTML/"+eventName,params);},trackReferral:function(eventName,params){var self=this;params=params||{};self.log("REFERRAL/"+eventName,params);},trackError:function(name,params){var self=this;params=params||{};self.log("ERROR/"+name,params);},setTestMode:function(){var self=this;self.log=self.logTest;}});Evri.defineClass(Evri.Widget,"MediaViewSet",function(session){var self=this;self.views=[new Evri.Widget.MediaView('From the web')];self.currentView=self.views[0];self.session=session;return self;});Evri.extendClass(Evri.Widget.MediaViewSet,{clear:function(){var self=this;self.views=[];self.currentView=undefined;return self;},addView:function(label){var self=this;var mc=new self.session.models.MediaConstraint();var mediaView=new Evri.Widget.MediaView(label,mc);if(self.views.length===0){self.currentView=mediaView;}
self.views.push(mediaView);return mediaView;},setView:function(view){var self=this;for(var i=0;i<self.views.length;i++){if(self.views[i]===view){self.currentView=view;}}
if(self.currentView===undefined&&self.views.length>0){self.currentView=view;}
return self;}});Evri.defineClass(Evri.Widget,"MediaView",function(label,constraint){var self=this;self.label=label;self.mediaConstraint=constraint;return self;});Evri.extendClass(Evri.Widget.MediaView,{clearConstraints:function(){var self=this;self.mediaConstraint=undefined;return self;},includeDomain:function(domain){var self=this;self.mediaConstraint.includeDomain(domain);return self;},excludeDomain:function(domain){var self=this;self.mediaConstraint.excludeDomain(domain);return self;}});Evri.defineNamespace(Evri.Widget,"Assets",{launcher:function(){return Evri.$("<a />").attr("href","javascript:").attr("class","evri-widget-invocation-point").append(Evri.$('<img/>').attr("src",(Evri.Widget.Environment.domainURL+"/images/buttons/widget_launcher.gif")).attr("alt","Get content recommendations from Evri"));}});Evri.extendNamespace(Evri,{JSTweener:(function(){var JSTweener={looping:false,frameRate:60,objects:[],defaultOptions:{time:1,transition:'easeoutexpo',delay:0,prefix:{},suffix:{},onStart:undefined,onStartParams:undefined,onUpdate:undefined,onUpdateParams:undefined,onComplete:undefined,onCompleteParams:undefined},inited:false,easingFunctionsLowerCase:{},init:function(){this.inited=true;for(var key in JSTweener.easingFunctions){this.easingFunctionsLowerCase[key.toLowerCase()]=JSTweener.easingFunctions[key];}},toNumber:function(value,prefix,suffix){if(!suffix)suffix='px';return value.toString().match(/[0-9]/)?Number(value.toString().replace(new RegExp(suffix+'$'),'').replace(new RegExp('^'+(prefix?prefix:'')),'')):0;},addTween:function(obj,options){var self=this;if(!this.inited)this.init();var o={};o.target=obj;o.targetPropeties={};for(var key in this.defaultOptions){if(typeof options[key]!='undefined'){o[key]=options[key];delete options[key];}else{o[key]=this.defaultOptions[key];}}
if(typeof o.transition=='function'){o.easing=o.transition;}else{o.easing=this.easingFunctionsLowerCase[o.transition.toLowerCase()];}
for(var key in options){if(!o.prefix[key])o.prefix[key]='';if(!o.suffix[key])o.suffix[key]='';var sB=this.toNumber(obj[key],o.prefix[key],o.suffix[key]);o.targetPropeties[key]={b:sB,c:options[key]-sB};}
setTimeout(function(){o.startTime=(new Date()-0);o.endTime=o.time*1000+o.startTime;if(typeof o.onStart=='function'){if(o.onStartParams){o.onStart.apply(o,o.onStartParams);}else{o.onStart();}}
self.objects.push(o);if(!self.looping){self.looping=true;self.eventLoop.call(self);}},o.delay*1000);},eventLoop:function(){var now=(new Date()-0);for(var i=0;i<this.objects.length;i++){var o=this.objects[i];var t=now-o.startTime;var d=o.endTime-o.startTime;if(t>=d){for(var property in o.targetPropeties){var tP=o.targetPropeties[property];try{o.target[property]=o.prefix[property]+(tP.b+tP.c)+o.suffix[property];}catch(e){}}
this.objects.splice(i,1);if(typeof o.onUpdate=='function'){if(o.onUpdateParams){o.onUpdate.apply(o,o.onUpdateParams);}else{o.onUpdate();}}
if(typeof o.onComplete=='function'){if(o.onCompleteParams){o.onComplete.apply(o,o.onCompleteParams);}else{o.onComplete();}}}else{for(var property in o.targetPropeties){var tP=o.targetPropeties[property];var val=o.easing(t,tP.b,tP.c,d);try{o.target[property]=o.prefix[property]+val+o.suffix[property];}catch(e){}}
if(typeof o.onUpdate=='function'){if(o.onUpdateParams){o.onUpdate.apply(o,o.onUpdateParams);}else{o.onUpdate();}}}}
if(this.objects.length>0){var self=this;setTimeout(function(){self.eventLoop()},1000/self.frameRate);}else{this.looping=false;}}};JSTweener.Utils={bezier2:function(t,p0,p1,p2){return(1-t)*(1-t)*p0+2*t*(1-t)*p1+t*t*p2;},bezier3:function(t,p0,p1,p2,p3){return Math.pow(1-t,3)*p0+3*t*Math.pow(1-t,2)*p1+3*t*t*(1-t)*p2+t*t*t*p3;},allSetStyleProperties:function(element){var css;if(document.defaultView&&document.defaultView.getComputedStyle){css=document.defaultView.getComputedStyle(element,null);}else{css=element.currentStyle}
for(var key in css){if(!key.match(/^\d+$/)){try{element.style[key]=css[key];}catch(e){};}}}}
JSTweener.easingFunctions={easeNone:function(t,b,c,d){return c*t/d+b;},easeInQuad:function(t,b,c,d){return c*(t/=d)*t+b;},easeOutQuad:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOutQuad:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInCubic:function(t,b,c,d){return c*(t/=d)*t*t+b;},easeOutCubic:function(t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},easeInOutCubic:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b;},easeOutInCubic:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutCubic(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInCubic((t*2)-d,b+c/2,c/2,d);},easeInQuart:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutQuart:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOutQuart:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},easeOutInQuart:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutQuart(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInQuart((t*2)-d,b+c/2,c/2,d);},easeInQuint:function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOutQuint:function(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOutQuint:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},easeOutInQuint:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutQuint(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInQuint((t*2)-d,b+c/2,c/2,d);},easeInSine:function(t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b;},easeOutSine:function(t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b;},easeInOutSine:function(t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b;},easeOutInSine:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutSine(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInSine((t*2)-d,b+c/2,c/2,d);},easeInExpo:function(t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b-c*0.001;},easeOutExpo:function(t,b,c,d){return(t==d)?b+c:c*1.001*(-Math.pow(2,-10*t/d)+1)+b;},easeInOutExpo:function(t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b-c*0.0005;return c/2*1.0005*(-Math.pow(2,-10*--t)+2)+b;},easeOutInExpo:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutExpo(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInExpo((t*2)-d,b+c/2,c/2,d);},easeInCirc:function(t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;},easeOutCirc:function(t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b;},easeInOutCirc:function(t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;},easeOutInCirc:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutCirc(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInCirc((t*2)-d,b+c/2,c/2,d);},easeInElastic:function(t,b,c,d,a,p){var s;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;s=p/4;}else s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},easeOutElastic:function(t,b,c,d,a,p){var s;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;s=p/4;}else s=p/(2*Math.PI)*Math.asin(c/a);return(a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b);},easeInOutElastic:function(t,b,c,d,a,p){var s;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(!a||a<Math.abs(c)){a=c;s=p/4;}else s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},easeOutInElastic:function(t,b,c,d,a,p){if(t<d/2)return JSTweener.easingFunctions.easeOutElastic(t*2,b,c/2,d,a,p);return JSTweener.easingFunctions.easeInElastic((t*2)-d,b+c/2,c/2,d,a,p);},easeInBack:function(t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},easeOutBack:function(t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},easeInOutBack:function(t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},easeOutInBack:function(t,b,c,d,s){if(t<d/2)return JSTweener.easingFunctions.easeOutBack(t*2,b,c/2,d,s);return JSTweener.easingFunctions.easeInBack((t*2)-d,b+c/2,c/2,d,s);},easeInBounce:function(t,b,c,d){return c-JSTweener.easingFunctions.easeOutBounce(d-t,0,c,d)+b;},easeOutBounce:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},easeInOutBounce:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeInBounce(t*2,0,c,d)*.5+b;else return JSTweener.easingFunctions.easeOutBounce(t*2-d,0,c,d)*.5+c*.5+b;},easeOutInBounce:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutBounce(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInBounce((t*2)-d,b+c/2,c/2,d);}};JSTweener.easingFunctions.linear=JSTweener.easingFunctions.easeNone;return JSTweener;})()});Evri.Raphael=(function(){var separator=/[, ]+/,create,doc=document,win=window,R=function(){return create.apply(R,arguments);};R.version="0.7.2";R.type=(win.SVGAngle?"SVG":"VML");R.svg=!(R.vml=R.type=="VML");R.idGenerator=0;var paper={};R.fn={};var availableAttrs={cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10",gradient:0,height:0,opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,translation:"0 0",width:0,x:0,y:0},availableAnimAttrs={cx:"number",cy:"number",fill:"colour","fill-opacity":"number","font-size":"number",height:"number",opacity:"number",path:"path",r:"number",rotation:"csv",rx:"number",ry:"number",scale:"csv",stroke:"colour","stroke-opacity":"number","stroke-width":"number",translation:"csv",width:"number",x:"number",y:"number"},events=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup"];R.toString=function(){return"Your browser "+(this.vml?"doesn't ":"")+"support"+(this.svg?"s":"")+" SVG.\nYou are running "+unescape("Rapha%EBl%20")+this.version;};R.setWindow=function(newwin){win=newwin;doc=win.document;};R.hsb2rgb=function(hue,saturation,brightness){if(typeof hue=="object"&&"h"in hue&&"s"in hue&&"b"in hue){brightness=hue.b;saturation=hue.s;hue=hue.h;}
var red,green,blue;if(brightness==0){return{r:0,g:0,b:0,hex:"#000"};}
if(hue>1||saturation>1||brightness>1){hue/=255;saturation/=255;brightness/=255;}
var i=Math.floor(hue*6),f=(hue*6)-i,p=brightness*(1-saturation),q=brightness*(1-(saturation*f)),t=brightness*(1-(saturation*(1-f)));red=[brightness,q,p,p,t,brightness,brightness][i];green=[t,brightness,brightness,q,p,p,t][i];blue=[p,p,t,brightness,brightness,q,p][i];red*=255;green*=255;blue*=255;var rgb={r:red,g:green,b:blue};var r=Math.round(red).toString(16);if(r.length==1){r="0"+r;}
var g=Math.round(green).toString(16);if(g.length==1){g="0"+g;}
var b=Math.round(blue).toString(16);if(b.length==1){b="0"+b;}
rgb.hex="#"+r+g+b;return rgb;};R.rgb2hsb=function(red,green,blue){if(typeof red=="object"&&"r"in red&&"g"in red&&"b"in red){blue=red.b;green=red.g;red=red.r;}
if(typeof red=="string"){var clr=getRGB(red);red=clr.r;green=clr.g;blue=clr.b;}
if(red>1||green>1||blue>1){red/=255;green/=255;blue/=255;}
var max=Math.max(red,green,blue),min=Math.min(red,green,blue),hue,saturation,brightness=max;if(min==max){return{h:0,s:0,b:max};}else{var delta=(max-min);saturation=delta/max;if(red==max){hue=(green-blue)/delta;}else if(green==max){hue=2+((blue-red)/delta);}else{hue=4+((red-green)/delta);}
hue/=6;if(hue<0){hue+=1;}
if(hue>1){hue-=1;}}
return{h:hue,s:saturation,b:brightness};};var getRGB=function(colour){var htmlcolors={aliceblue:"#f0f8ff",amethyst:"#96c",antiquewhite:"#faebd7",aqua:"#0ff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000",blanchedalmond:"#ffebcd",blue:"#00f",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#f0f",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#789",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#0f0",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#f0f",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#f00",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#fff",whitesmoke:"#f5f5f5",yellow:"#ff0",yellowgreen:"#9acd32"};if(colour.toString().toLowerCase()in htmlcolors){colour=htmlcolors[colour.toString().toLowerCase()];}
if(!colour){return{r:0,g:0,b:0,hex:"#000"};}
if(colour=="none"){return{r:-1,g:-1,b:-1,hex:"none"};}
var red,green,blue,rgb=colour.match(/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgb\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|rgb\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hsb\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsb\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i);if(rgb){if(rgb[2]){blue=parseInt(rgb[2].substring(5),16);green=parseInt(rgb[2].substring(3,5),16);red=parseInt(rgb[2].substring(1,3),16);}
if(rgb[3]){blue=parseInt(rgb[3].substring(3)+rgb[3].substring(3),16);green=parseInt(rgb[3].substring(2,3)+rgb[3].substring(2,3),16);red=parseInt(rgb[3].substring(1,2)+rgb[3].substring(1,2),16);}
if(rgb[4]){rgb=rgb[4].split(/\s*,\s*/);red=parseFloat(rgb[0],10);green=parseFloat(rgb[1],10);blue=parseFloat(rgb[2],10);}
if(rgb[5]){rgb=rgb[5].split(/\s*,\s*/);red=parseFloat(rgb[0],10)*2.55;green=parseFloat(rgb[1],10)*2.55;blue=parseFloat(rgb[2],10)*2.55;}
if(rgb[6]){rgb=rgb[6].split(/\s*,\s*/);red=parseFloat(rgb[0],10);green=parseFloat(rgb[1],10);blue=parseFloat(rgb[2],10);return Raphael.hsb2rgb(red,green,blue);}
if(rgb[7]){rgb=rgb[7].split(/\s*,\s*/);red=parseFloat(rgb[0],10)*2.55;green=parseFloat(rgb[1],10)*2.55;blue=parseFloat(rgb[2],10)*2.55;return Raphael.hsb2rgb(red,green,blue);}
var rgb={r:red,g:green,b:blue};var r=Math.round(red).toString(16);(r.length==1)&&(r="0"+r);var g=Math.round(green).toString(16);(g.length==1)&&(g="0"+g);var b=Math.round(blue).toString(16);(b.length==1)&&(b="0"+b);rgb.hex="#"+r+g+b;return rgb;}else{return{r:-1,g:-1,b:-1,hex:"none"};}};R.getColor=function(value){var start=arguments.callee.start=arguments.callee.start||{h:0,s:1,b:value||.75};var rgb=Raphael.hsb2rgb(start.h,start.s,start.b);start.h+=.075;if(start.h>1){start.h=0;start.s-=.2;if(start.s<=0){arguments.callee.start={h:0,s:1,b:start.b};}}
return rgb.hex;};R.getColor.reset=function(){this.start=undefined;};R.parsePathString=function(pathString){var paramCounts={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},data=[],toString=function(){var res="";for(var i=0,ii=this.length;i<ii;i++){res+=this[i][0]+this[i].join(",").substring(2);}
return res;};if(pathString.toString.toString()==toString.toString()){return pathString;}
pathString.replace(/([achlmqstvz])[\s,]*((-?\d*(?:e-?\d+|\.?\d*)\s*,?\s*)+)/ig,function(a,b,c){var params=[],name=b.toLowerCase();c.replace(/(-?\d*(?:e-?\d+|\.?\d*))\s*,?\s*/ig,function(a,b){b&&params.push(+b);});while(params.length>=paramCounts[name]){data.push([b].concat(params.splice(0,paramCounts[name])));if(!paramCounts[name]){break;};}});data.toString=toString;return data;};var pathDimensions=function(path){var pathArray=path;if(typeof path=="string"){pathArray=Raphael.parsePathString(path);}
pathArray=pathToAbsolute(pathArray);var x=[],y=[],length=0;for(var i=0,ii=pathArray.length;i<ii;i++){switch(pathArray[i][0]){case"Z":break;case"A":x.push(pathArray[i][pathArray[i].length-2]);y.push(pathArray[i][pathArray[i].length-1]);break;default:for(var j=1,jj=pathArray[i].length;j<jj;j++){if(j%2){x.push(pathArray[i][j]);}else{y.push(pathArray[i][j]);}}}}
var minx=Math.min.apply(Math,x),miny=Math.min.apply(Math,y);return{x:minx,y:miny,width:Math.max.apply(Math,x)-minx,height:Math.max.apply(Math,y)-miny,X:x,Y:y};};var pathToRelative=function(pathArray){var res=[];if(typeof pathArray=="string"){pathArray=R.parsePathString(pathArray);}
var x=0,y=0,start=0;if(pathArray[0][0]=="M"){x=pathArray[0][1];y=pathArray[0][2];start++;res.push(pathArray[0]);}
for(var i=start,ii=pathArray.length;i<ii;i++){res[i]=[];if(pathArray[i][0]!=pathArray[i][0].toLowerCase()){res[i][0]=pathArray[i][0].toLowerCase();switch(res[i][0]){case"a":res[i][1]=pathArray[i][1];res[i][2]=pathArray[i][2];res[i][3]=0;res[i][4]=pathArray[i][4];res[i][5]=pathArray[i][5];res[i][6]=+(pathArray[i][6]-x).toFixed(3);res[i][7]=+(pathArray[i][7]-y).toFixed(3);break;case"v":res[i][1]=+(pathArray[i][1]-y).toFixed(3);break;default:for(var j=1,jj=pathArray[i].length;j<jj;j++){res[i][j]=+(pathArray[i][j]-((j%2)?x:y)).toFixed(3);}}}else{res[i]=pathArray[i];}
switch(res[i][0]){case"z":break;case"h":x+=res[i][res[i].length-1];break;case"v":y+=res[i][res[i].length-1];break;default:x+=res[i][res[i].length-2];y+=res[i][res[i].length-1];}}
res.toString=pathArray.toString;return res;};var pathToAbsolute=function(pathArray){var res=[];if(typeof pathArray=="string"){pathArray=R.parsePathString(pathArray);}
var x=0,y=0,start=0;if(pathArray[0][0]=="M"){x=+pathArray[0][1];y=+pathArray[0][2];start++;res[0]=pathArray[0];}
for(var i=start,ii=pathArray.length;i<ii;i++){res[i]=[];if(pathArray[i][0]!=(pathArray[i][0]+"").toUpperCase()){res[i][0]=(pathArray[i][0]+"").toUpperCase();switch(res[i][0]){case"A":res[i][1]=pathArray[i][1];res[i][2]=pathArray[i][2];res[i][3]=0;res[i][4]=pathArray[i][4];res[i][5]=pathArray[i][5];res[i][6]=+(pathArray[i][6]+x).toFixed(3);res[i][7]=+(pathArray[i][7]+y).toFixed(3);break;case"V":res[i][1]=+pathArray[i][1]+y;break;default:for(var j=1,jj=pathArray[i].length;j<jj;j++){res[i][j]=+pathArray[i][j]+((j%2)?x:y);}}}else{res[i]=pathArray[i];}
switch(res[i][0]){case"Z":break;case"H":x=res[i][1];break;case"V":y=res[i][1];break;default:x=res[i][res[i].length-2];y=res[i][res[i].length-1];}}
res.toString=pathArray.toString;return res;};var pathEqualiser=function(path1,path2){var data=[pathToAbsolute(Raphael.parsePathString(path1)),pathToAbsolute(Raphael.parsePathString(path2))],attrs=[{x:0,y:0,bx:0,by:0,X:0,Y:0},{x:0,y:0,bx:0,by:0,X:0,Y:0}],processPath=function(path,d){if(!path){return["U"];}
switch(path[0]){case"M":d.X=path[1];d.Y=path[2];break;case"S":var nx=d.x+(d.x-(d.bx||d.x));var ny=d.y+(d.y-(d.by||d.y));path=["C",nx,ny,path[1],path[2],path[3],path[4]];break;case"T":var nx=d.x+(d.x-(d.bx||d.x));var ny=d.y+(d.y-(d.by||d.y));path=["Q",nx,ny,path[1],path[2]];break;case"H":path=["L",path[1],d.y];break;case"V":path=["L",d.x,path[1]];break;case"Z":path=["L",d.X,d.Y];break;}
return path;},edgeCases=function(a,b,i){if(data[a][i][0]=="M"&&data[b][i][0]!="M"){data[b].splice(i,0,["M",attrs[b].x,attrs[b].y]);attrs[a].bx=data[a][i][data[a][i].length-4]||0;attrs[a].by=data[a][i][data[a][i].length-3]||0;attrs[a].x=data[a][i][data[a][i].length-2];attrs[a].y=data[a][i][data[a][i].length-1];return true;}else if(data[a][i][0]=="L"&&data[b][i][0]=="C"){data[a][i]=["C",attrs[a].x,attrs[a].y,data[a][i][1],data[a][i][2],data[a][i][1],data[a][i][2]];}else if(data[a][i][0]=="L"&&data[b][i][0]=="Q"){data[a][i]=["Q",data[a][i][1],data[a][i][2],data[a][i][1],data[a][i][2]];}else if(data[a][i][0]=="Q"&&data[b][i][0]=="C"){var x=data[b][i][data[b][i].length-2];var y=data[b][i][data[b][i].length-1];data[b].splice(i+1,0,["Q",x,y,x,y]);data[a].splice(i,0,["C",attrs[a].x,attrs[a].y,attrs[a].x,attrs[a].y,attrs[a].x,attrs[a].y]);i++;attrs[b].bx=data[b][i][data[b][i].length-4]||0;attrs[b].by=data[b][i][data[b][i].length-3]||0;attrs[b].x=data[b][i][data[b][i].length-2];attrs[b].y=data[b][i][data[b][i].length-1];return true;}else if(data[a][i][0]=="A"&&data[b][i][0]=="C"){var x=data[b][i][data[b][i].length-2];var y=data[b][i][data[b][i].length-1];data[b].splice(i+1,0,["A",0,0,data[a][i][3],data[a][i][4],data[a][i][5],x,y]);data[a].splice(i,0,["C",attrs[a].x,attrs[a].y,attrs[a].x,attrs[a].y,attrs[a].x,attrs[a].y]);i++;attrs[b].bx=data[b][i][data[b][i].length-4]||0;attrs[b].by=data[b][i][data[b][i].length-3]||0;attrs[b].x=data[b][i][data[b][i].length-2];attrs[b].y=data[b][i][data[b][i].length-1];return true;}else if(data[a][i][0]=="U"){data[a][i][0]=data[b][i][0];for(var j=1,jj=data[b][i].length;j<jj;j++){data[a][i][j]=(j%2)?attrs[a].x:attrs[a].y;}}
return false;};for(var i=0;i<Math.max(data[0].length,data[1].length);i++){data[0][i]=processPath(data[0][i],attrs[0]);data[1][i]=processPath(data[1][i],attrs[1]);if(data[0][i][0]!=data[1][i][0]&&(edgeCases(0,1,i)||edgeCases(1,0,i))){continue;}
attrs[0].bx=data[0][i][data[0][i].length-4]||0;attrs[0].by=data[0][i][data[0][i].length-3]||0;attrs[0].x=data[0][i][data[0][i].length-2];attrs[0].y=data[0][i][data[0][i].length-1];attrs[1].bx=data[1][i][data[1][i].length-4]||0;attrs[1].by=data[1][i][data[1][i].length-3]||0;attrs[1].x=data[1][i][data[1][i].length-2];attrs[1].y=data[1][i][data[1][i].length-1];}
return data;};var toGradient=function(gradient){if(typeof gradient=="string"){gradient=gradient.split(/\s*\-\s*/);var angle=gradient.shift();if(angle.toLowerCase()=="v"){angle=90;}else if(angle.toLowerCase()=="h"){angle=0;}else{angle=parseFloat(angle,10);}
angle=-angle;var grobj={angle:angle,type:"linear",dots:[],vector:[0,0,Math.cos(angle*Math.PI/180).toFixed(3),Math.sin(angle*Math.PI/180).toFixed(3)]};var max=1/(Math.max(Math.abs(grobj.vector[2]),Math.abs(grobj.vector[3]))||1);grobj.vector[2]*=max;grobj.vector[3]*=max;if(grobj.vector[2]<0){grobj.vector[0]=-grobj.vector[2];grobj.vector[2]=0;}
if(grobj.vector[3]<0){grobj.vector[1]=-grobj.vector[3];grobj.vector[3]=0;}
grobj.vector[0]=grobj.vector[0].toFixed(3);grobj.vector[1]=grobj.vector[1].toFixed(3);grobj.vector[2]=grobj.vector[2].toFixed(3);grobj.vector[3]=grobj.vector[3].toFixed(3);for(var i=0,ii=gradient.length;i<ii;i++){var dot={};var par=gradient[i].match(/^([^:]*):?([\d\.]*)/);dot.color=getRGB(par[1]).hex;par[2]&&(dot.offset=par[2]+"%");grobj.dots.push(dot);}
for(var i=1,ii=grobj.dots.length-1;i<ii;i++){if(!grobj.dots[i].offset){var start=parseFloat(grobj.dots[i-1].offset||0,10),end=false;for(var j=i+1;j<ii;j++){if(grobj.dots[j].offset){end=grobj.dots[j].offset;break;}}
if(!end){end=100;j=ii;}
end=parseFloat(end,10);var d=(end-start)/(j-i+1);for(;i<j;i++){start+=d;grobj.dots[i].offset=start+"%";}}}
return grobj;}else{return gradient;}};if(R.svg){var thePath=function(params,pathString,SVG){var el=doc.createElementNS(SVG.svgns,"path");el.setAttribute("fill","none");if(SVG.canvas){SVG.canvas.appendChild(el);}
var p=new Element(el,SVG);p.isAbsolute=true;p.type="path";p.last={x:0,y:0,bx:0,by:0};p.absolutely=function(){this.isAbsolute=true;return this;};p.relatively=function(){this.isAbsolute=false;return this;};p.moveTo=function(x,y){var d=this.isAbsolute?"M":"m";d+=parseFloat(x,10).toFixed(3)+" "+parseFloat(y,10).toFixed(3)+" ";var oldD=this[0].getAttribute("d")||"";(oldD=="M0,0")&&(oldD="");this[0].setAttribute("d",oldD+d);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y,10);this.attrs.path=oldD+d;return this;};p.lineTo=function(x,y){this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y,10);var d=this.isAbsolute?"L":"l";d+=parseFloat(x,10).toFixed(3)+" "+parseFloat(y,10).toFixed(3)+" ";var oldD=this[0].getAttribute("d")||"";this[0].setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;};p.arcTo=function(rx,ry,large_arc_flag,sweep_flag,x,y){var d=this.isAbsolute?"A":"a";d+=[parseFloat(rx,10).toFixed(3),parseFloat(ry,10).toFixed(3),0,large_arc_flag,sweep_flag,parseFloat(x,10).toFixed(3),parseFloat(y,10).toFixed(3)].join(" ");var oldD=this[0].getAttribute("d")||"";this[0].setAttribute("d",oldD+d);this.last.x=parseFloat(x,10);this.last.y=parseFloat(y,10);this.attrs.path=oldD+d;return this;};p.cplineTo=function(x1,y1,w1){if(!w1){return this.lineTo(x1,y1);}else{var p={};var x=parseFloat(x1,10);var y=parseFloat(y1,10);var w=parseFloat(w1,10);var d=this.isAbsolute?"C":"c";var attr=[+this.last.x+w,+this.last.y,x-w,y,x,y];for(var i=0,ii=attr.length;i<ii;i++){d+=attr[i].toFixed(3)+" ";}
this.last.x=(this.isAbsolute?0:this.last.x)+attr[4];this.last.y=(this.isAbsolute?0:this.last.y)+attr[5];this.last.bx=attr[2];this.last.by=attr[3];var oldD=this[0].getAttribute("d")||"";this[0].setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;}};p.curveTo=function(){var p={},command=[0,1,2,3,"s",5,"c"];var d=command[arguments.length];if(this.isAbsolute){d=d.toUpperCase();}
for(var i=0,ii=arguments.length;i<ii;i++){d+=parseFloat(arguments[i],10).toFixed(3)+" ";}
this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[arguments.length-2],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[arguments.length-1],10);this.last.bx=parseFloat(arguments[arguments.length-4],10);this.last.by=parseFloat(arguments[arguments.length-3],10);var oldD=this.node.getAttribute("d")||"";this.node.setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;};p.qcurveTo=function(){var p={},command=[0,1,"t",3,"q"];var d=command[arguments.length];if(this.isAbsolute){d=d.toUpperCase();}
for(var i=0,ii=arguments.length;i<ii;i++){d+=parseFloat(arguments[i],10).toFixed(3)+" ";}
this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[arguments.length-2],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[arguments.length-1],10);if(arguments.length!=2){this.last.qx=parseFloat(arguments[arguments.length-4],10);this.last.qy=parseFloat(arguments[arguments.length-3],10);}
var oldD=this.node.getAttribute("d")||"";this.node.setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;};p.addRoundedCorner=function(r,dir){var R=.5522*r,rollback=this.isAbsolute,o=this;if(rollback){this.relatively();rollback=function(){o.absolutely();};}else{rollback=function(){};}
var actions={l:function(){return{u:function(){o.curveTo(-R,0,-r,-(r-R),-r,-r);},d:function(){o.curveTo(-R,0,-r,r-R,-r,r);}};},r:function(){return{u:function(){o.curveTo(R,0,r,-(r-R),r,-r);},d:function(){o.curveTo(R,0,r,r-R,r,r);}};},u:function(){return{r:function(){o.curveTo(0,-R,-(R-r),-r,r,-r);},l:function(){o.curveTo(0,-R,R-r,-r,-r,-r);}};},d:function(){return{r:function(){o.curveTo(0,R,-(R-r),r,r,r);},l:function(){o.curveTo(0,R,R-r,r,-r,r);}};}};actions[dir[0]]()[dir[1]]();rollback();return o;};p.andClose=function(){var oldD=this[0].getAttribute("d")||"";this[0].setAttribute("d",oldD+"Z ");this.attrs.path=oldD+"Z ";return this;};if(pathString){p.attrs.path=""+pathString;p.absolutely();paper.pathfinder(p,p.attrs.path);}
if(params){setFillAndStroke(p,params);}
return p;};var addGrdientFill=function(o,gradient,SVG){gradient=toGradient(gradient);var el=doc.createElementNS(SVG.svgns,(gradient.type||"linear")+"Gradient");el.id="raphael-gradient-"+Raphael.idGenerator++;if(gradient.vector&&gradient.vector.length){el.setAttribute("x1",gradient.vector[0]);el.setAttribute("y1",gradient.vector[1]);el.setAttribute("x2",gradient.vector[2]);el.setAttribute("y2",gradient.vector[3]);}
SVG.defs.appendChild(el);var isopacity=true;for(var i=0,ii=gradient.dots.length;i<ii;i++){var stop=doc.createElementNS(SVG.svgns,"stop");if(gradient.dots[i].offset){isopacity=false;}
stop.setAttribute("offset",gradient.dots[i].offset?gradient.dots[i].offset:(i==0)?"0%":"100%");stop.setAttribute("stop-color",getRGB(gradient.dots[i].color).hex||"#fff");el.appendChild(stop);};if(isopacity&&typeof gradient.dots[ii-1].opacity!="undefined"){stop.setAttribute("stop-opacity",gradient.dots[ii-1].opacity);}
o.setAttribute("fill","url(#"+el.id+")");o.style.opacity=1;o.style.fillOpacity=1;o.setAttribute("opacity",1);o.setAttribute("fill-opacity",1);};var updatePosition=function(o){if(o.pattern){var bbox=o.node.getBBox();o.pattern.setAttribute("patternTransform","translate("+[bbox.x,bbox.y].join(",")+")");}};var setFillAndStroke=function(o,params){var dasharray={"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},addDashes=function(o,value){value=dasharray[value.toString().toLowerCase()];if(value){var width=o.attrs["stroke-width"]||"1",butt={round:width,square:width,butt:0}[o.attrs["stroke-linecap"]||params["stroke-linecap"]]||0,dashes=[];for(var i=0,ii=value.length;i<ii;i++){dashes.push(value[i]*width+((i%2)?1:-1)*butt);}
value=dashes.join(",");o.node.setAttribute("stroke-dasharray",value);}};for(var att in params){var value=params[att];o.attrs[att]=value;switch(att){case"path":if(o.type=="path"){o.node.setAttribute("d","M0,0");paper.pathfinder(o,value);}
case"rx":case"cx":case"x":o.node.setAttribute(att,value);updatePosition(o);break;case"ry":case"cy":case"y":o.node.setAttribute(att,value);updatePosition(o);break;case"width":o.node.setAttribute(att,value);break;case"height":o.node.setAttribute(att,value);break;case"src":if(o.type=="image"){o.node.setAttributeNS(svg.xlink,"href",value);}
break;case"stroke-width":o.node.style.strokeWidth=value;o.node.setAttribute(att,value);if(o.attrs["stroke-dasharray"]){addDashes(o,o.attrs["stroke-dasharray"]);}
break;case"stroke-dasharray":addDashes(o,value);break;case"rotation":o.rotate(value,true);break;case"translation":var xy=(value+"").split(separator);o.translate((+xy[0]+1||2)-1,(+xy[1]+1||2)-1);break;case"scale":var xy=(value+"").split(separator);o.scale(+xy[0]||1,+xy[1]||+xy[0]||1);break;case"fill":var isURL=value.match(/^url\(([^\)]+)\)$/i);if(isURL){var el=doc.createElementNS(o.svg.svgns,"pattern");var ig=doc.createElementNS(o.svg.svgns,"image");el.id="raphael-pattern-"+Raphael.idGenerator++;el.setAttribute("x",0);el.setAttribute("y",0);el.setAttribute("patternUnits","userSpaceOnUse");ig.setAttribute("x",0);ig.setAttribute("y",0);ig.setAttributeNS(o.svg.xlink,"href",isURL[1]);el.appendChild(ig);var img=doc.createElement("img");img.style.position="absolute";img.style.top="-9999em";img.style.left="-9999em";img.onload=function(){el.setAttribute("width",this.offsetWidth);el.setAttribute("height",this.offsetHeight);ig.setAttribute("width",this.offsetWidth);ig.setAttribute("height",this.offsetHeight);doc.body.removeChild(this);paper.safari();};doc.body.appendChild(img);img.src=isURL[1];o.svg.defs.appendChild(el);o.node.style.fill="url(#"+el.id+")";o.node.setAttribute("fill","url(#"+el.id+")");o.pattern=el;updatePosition(o);break;}
delete params.gradient;delete o.attrs.gradient;if(typeof o.attrs.opacity!="undefined"&&typeof params.opacity=="undefined"){o.node.style.opacity=o.attrs.opacity;o.node.setAttribute("opacity",o.attrs.opacity);}
if(typeof o.attrs["fill-opacity"]!="undefined"&&typeof params["fill-opacity"]=="undefined"){o.node.style.fillOpacity=o.attrs["fill-opacity"];o.node.setAttribute("fill-opacity",o.attrs["fill-opacity"]);}
case"stroke":o.node.style[att]=getRGB(value).hex;o.node.setAttribute(att,getRGB(value).hex);break;case"gradient":addGrdientFill(o.node,value,o.svg);break;case"opacity":case"fill-opacity":if(o.attrs.gradient){var gradient=doc.getElementById(o.node.getAttribute("fill").replace(/^url\(#|\)$/g,""));if(gradient){var stops=gradient.getElementsByTagName("stop");stops[stops.length-1].setAttribute("stop-opacity",value);}
break;}
default:var cssrule=att.replace(/(\-.)/g,function(w){return w.substring(1).toUpperCase();});o.node.style[cssrule]=value;o.node.setAttribute(att,value);break;}}
tuneText(o,params);};var leading=1.2;var tuneText=function(element,params){if(element.type!="text"||!("text"in params||"font"in params||"font-size"in params||"x"in params)){return;}
var fontSize=element.node.firstChild?parseInt(doc.defaultView.getComputedStyle(element.node.firstChild,"").getPropertyValue("font-size"),10):10;var height=0;if("text"in params){while(element.node.firstChild){element.node.removeChild(element.node.firstChild);}
var texts=(params.text+"").split("\n");for(var i=0,ii=texts.length;i<ii;i++){var tspan=doc.createElementNS(element.svg.svgns,"tspan");i&&tspan.setAttribute("dy",fontSize*leading);i&&tspan.setAttribute("x",element.attrs.x);tspan.appendChild(doc.createTextNode(texts[i]));element.node.appendChild(tspan);height+=fontSize*leading;}}else{var texts=element.node.getElementsByTagName("tspan");for(var i=0,ii=texts.length;i<ii;i++){i&&texts[i].setAttribute("dy",fontSize*leading);i&&texts[i].setAttribute("x",element.attrs.x);height+=fontSize*leading;}}
height-=fontSize*(leading-1);var dif=height/2-fontSize;if(dif){element.node.setAttribute("y",element.attrs.y-dif);}
setTimeout(function(){});};var Element=function(node,svg){var X=0,Y=0;this[0]=node;this.node=node;this.svg=svg;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,x:0,y:0},sx:1,sy:1};};Element.prototype.rotate=function(deg,cx,cy){if(deg==null){return this._.rt.deg;}
var bbox=this.getBBox();deg=deg.toString().split(separator);if(deg.length-1){cx=parseFloat(deg[1],10);cy=parseFloat(deg[2],10);}
deg=parseFloat(deg[0],10);if(cx!=null){this._.rt.deg=deg;}else{this._.rt.deg+=deg;}
if(cy==null){cx=null;}
cx=cx==null?bbox.x+bbox.width/2:cx;cy=cy==null?bbox.y+bbox.height/2:cy;if(this._.rt.deg){this.transformations[0]=("rotate("+this._.rt.deg+" "+cx+" "+cy+")");}else{this.transformations[0]="";}
this.node.setAttribute("transform",this.transformations.join(" "));return this;};Element.prototype.hide=function(){this.node.style.display="none";return this;};Element.prototype.show=function(){this.node.style.display="block";return this;};Element.prototype.remove=function(){this.node.parentNode.removeChild(this.node);};Element.prototype.getBBox=function(){return this.node.getBBox();};Element.prototype.attr=function(){if(arguments.length==1&&typeof arguments[0]=="string"){if(arguments[0]=="translation"){return this.translate();}
return this.attrs[arguments[0]];}
if(arguments.length==1&&arguments[0]instanceof Array){var values={};for(var j in arguments[0]){values[arguments[0][j]]=this.attrs[arguments[0][j]];}
return values;}
if(arguments.length==2){var params={};params[arguments[0]]=arguments[1];setFillAndStroke(this,params);}else if(arguments.length==1&&typeof arguments[0]=="object"){setFillAndStroke(this,arguments[0]);}
return this;};Element.prototype.toFront=function(){this.node.parentNode.appendChild(this.node);return this;};Element.prototype.toBack=function(){if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);}
return this;};Element.prototype.insertAfter=function(element){if(element.node.nextSibling){element.node.parentNode.insertBefore(this.node,element.node.nextSibling);}else{element.node.parentNode.appendChild(this.node);}
return this;};Element.prototype.insertBefore=function(element){element.node.parentNode.insertBefore(this.node,element.node);return this;};var theCircle=function(svg,x,y,r){var el=doc.createElementNS(svg.svgns,"circle");el.setAttribute("cx",x);el.setAttribute("cy",y);el.setAttribute("r",r);el.setAttribute("fill","none");el.setAttribute("stroke","#000");if(svg.canvas){svg.canvas.appendChild(el);}
var res=new Element(el,svg);res.attrs=res.attrs||{};res.attrs.cx=x;res.attrs.cy=y;res.attrs.r=r;res.attrs.stroke="#000";res.type="circle";return res;};var theRect=function(svg,x,y,w,h,r){var el=doc.createElementNS(svg.svgns,"rect");el.setAttribute("x",x);el.setAttribute("y",y);el.setAttribute("width",w);el.setAttribute("height",h);if(r){el.setAttribute("rx",r);el.setAttribute("ry",r);}
el.setAttribute("fill","none");el.setAttribute("stroke","#000");if(svg.canvas){svg.canvas.appendChild(el);}
var res=new Element(el,svg);res.attrs=res.attrs||{};res.attrs.x=x;res.attrs.y=y;res.attrs.width=w;res.attrs.height=h;res.attrs.stroke="#000";if(r){res.attrs.rx=res.attrs.ry=r;}
res.type="rect";return res;};var theEllipse=function(svg,x,y,rx,ry){var el=doc.createElementNS(svg.svgns,"ellipse");el.setAttribute("cx",x);el.setAttribute("cy",y);el.setAttribute("rx",rx);el.setAttribute("ry",ry);el.setAttribute("fill","none");el.setAttribute("stroke","#000");if(svg.canvas){svg.canvas.appendChild(el);}
var res=new Element(el,svg);res.attrs=res.attrs||{};res.attrs.cx=x;res.attrs.cy=y;res.attrs.rx=rx;res.attrs.ry=ry;res.attrs.stroke="#000";res.type="ellipse";return res;};var theImage=function(svg,src,x,y,w,h){var el=doc.createElementNS(svg.svgns,"image");el.setAttribute("x",x);el.setAttribute("y",y);el.setAttribute("width",w);el.setAttribute("height",h);el.setAttribute("preserveAspectRatio","none");el.setAttributeNS(svg.xlink,"href",src);if(svg.canvas){svg.canvas.appendChild(el);}
var res=new Element(el,svg);res.attrs=res.attrs||{};res.attrs.x=x;res.attrs.y=y;res.attrs.width=w;res.attrs.height=h;res.type="image";return res;};var theText=function(svg,x,y,text){var el=doc.createElementNS(svg.svgns,"text");el.setAttribute("x",x);el.setAttribute("y",y);el.setAttribute("text-anchor","middle");if(svg.canvas){svg.canvas.appendChild(el);}
var res=new Element(el,svg);res.attrs=res.attrs||{};res.attrs.x=x;res.attrs.y=y;res.type="text";setFillAndStroke(res,{font:availableAttrs.font,stroke:"none",fill:"#000",text:text});return res;};var theGroup=function(svg){var el=doc.createElementNS(svg.svgns,"g");if(svg.canvas){svg.canvas.appendChild(el);}
var i=new Element(el,svg);for(var f in svg){if(f[0]!="_"&&typeof svg[f]=="function"){i[f]=(function(f){return function(){var e=svg[f].apply(svg,arguments);el.appendChild(e[0]);return e;};})(f);}}
i.type="group";return i;};var setSize=function(width,height){this.width=width||this.width;this.height=height||this.height;this.canvas.setAttribute("width",this.width);this.canvas.setAttribute("height",this.height);return this;};var create=function(){if(typeof arguments[0]=="string"){var container=doc.getElementById(arguments[0]);var width=arguments[1];var height=arguments[2];}
if(typeof arguments[0]=="object"){var container=arguments[0];var width=arguments[1];var height=arguments[2];}
if(typeof arguments[0]=="number"){var container=1,x=arguments[0],y=arguments[1],width=arguments[2],height=arguments[3];}
if(!container){throw new Error("SVG container not found.");}
paper.canvas=doc.createElementNS(paper.svgns,"svg");paper.canvas.setAttribute("width",width||320);paper.width=width||320;paper.canvas.setAttribute("height",height||200);paper.height=height||200;if(container==1){doc.body.appendChild(paper.canvas);paper.canvas.style.position="absolute";paper.canvas.style.left=x+"px";paper.canvas.style.top=y+"px";}else{if(container.firstChild){container.insertBefore(paper.canvas,container.firstChild);}else{container.appendChild(paper.canvas);}}
container={canvas:paper.canvas,clear:function(){while(this.canvas.firstChild){this.canvas.removeChild(this.canvas.firstChild);}
this.defs=doc.createElementNS(paper.svgns,"defs");this.canvas.appendChild(this.defs);}};for(var prop in paper){if(prop!="create"){container[prop]=paper[prop];}}
for(var prop in R.fn){if(!container[prop]){container[prop]=R.fn[prop];}}
container.clear();return container;};paper.remove=function(){this.canvas.parentNode.removeChild(this.canvas);};paper.svgns="http://www.w3.org/2000/svg";paper.xlink="http://www.w3.org/1999/xlink";paper.safari=function(){if(navigator.vendor=="Apple Computer, Inc."){var rect=this.rect(-this.width,-this.height,this.width*3,this.height*3).attr({stroke:"none"});setTimeout(function(){rect.remove();},0);}};}
if(R.vml){thePath=function(params,pathString,VML){var g=createNode("group"),gl=g.style;gl.position="absolute";gl.left=0;gl.top=0;gl.width=VML.width+"px";gl.height=VML.height+"px";var el=createNode("shape"),ol=el.style;ol.width=VML.width+"px";ol.height=VML.height+"px";el.path="";if(params["class"]){el.className="rvml "+params["class"];}
el.coordsize=this.coordsize;el.coordorigin=this.coordorigin;g.appendChild(el);VML.canvas.appendChild(g);var p=new Element(el,g,VML);p.isAbsolute=true;p.type="path";p.path=[];p.last={x:0,y:0,bx:0,by:0,isAbsolute:true};p.Path="";p.absolutely=function(){this.isAbsolute=true;return this;};p.relatively=function(){this.isAbsolute=false;return this;};p.moveTo=function(x,y){var d=this.isAbsolute?"m":"t";d+=Math.round(parseFloat(x,10))+" "+Math.round(parseFloat(y,10));this.node.path=this.Path+=d;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y,10);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"M":"m")+[x,y];return this;};p.lineTo=function(x,y){var d=this.isAbsolute?"l":"r";d+=Math.round(parseFloat(x,10))+" "+Math.round(parseFloat(y,10));this[0].path=this.Path+=d;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y,10);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"L":"l")+[x,y];return this;};p.arcTo=function(rx,ry,large_arc_flag,sweep_flag,x2,y2){x2=(this.isAbsolute?0:this.last.x)+x2;y2=(this.isAbsolute?0:this.last.y)+y2;var x1=this.last.x,y1=this.last.y,x=(x1-x2)/2,y=(y1-y2)/2,k=(large_arc_flag==sweep_flag?-1:1)*Math.sqrt(Math.abs(rx*rx*ry*ry-rx*rx*y*y-ry*ry*x*x)/(rx*rx*y*y+ry*ry*x*x)),cx=k*rx*y/ry+(x1+x2)/2,cy=k*-ry*x/rx+(y1+y2)/2,d=sweep_flag?(this.isAbsolute?"wa":"wr"):(this.isAbsolute?"at":"ar"),left=Math.round(cx-rx),top=Math.round(cy-ry);d+=[left,top,Math.round(left+rx*2),Math.round(top+ry*2),Math.round(x1),Math.round(y1),Math.round(parseFloat(x2,10)),Math.round(parseFloat(y2,10))].join(", ");this.node.path=this.Path+=d;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x2,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y2,10);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"A":"a")+[rx,ry,0,large_arc_flag,sweep_flag,x2,y2];return this;};p.cplineTo=function(x1,y1,w1){if(!w1){return this.lineTo(x1,y1);}else{var x=Math.round(Math.round(parseFloat(x1,10)*100)/100),y=Math.round(Math.round(parseFloat(y1,10)*100)/100),w=Math.round(Math.round(parseFloat(w1,10)*100)/100),d=this.isAbsolute?"c":"v",attr=[Math.round(this.last.x)+w,Math.round(this.last.y),x-w,y,x,y],svgattr=[this.last.x+w1,this.last.y,x1-w1,y1,x1,y1];d+=attr.join(" ")+" ";this.last.x=(this.isAbsolute?0:this.last.x)+attr[4];this.last.y=(this.isAbsolute?0:this.last.y)+attr[5];this.last.bx=attr[2];this.last.by=attr[3];this.node.path=this.Path+=d;this.attrs.path+=(this.isAbsolute?"C":"c")+svgattr;return this;}};p.curveTo=function(){var d=this.isAbsolute?"c":"v";if(arguments.length==6){this.last.bx=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[2],10);this.last.by=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[3],10);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[4],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[5],10);d+=[Math.round(parseFloat(arguments[0],10)),Math.round(parseFloat(arguments[1],10)),Math.round(parseFloat(arguments[2],10)),Math.round(parseFloat(arguments[3],10)),Math.round(parseFloat(arguments[4],10)),Math.round(parseFloat(arguments[5],10))].join(" ")+" ";this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"C":"c")+Array.prototype.splice.call(arguments,0,arguments.length);}
if(arguments.length==4){var bx=this.last.x*2-this.last.bx;var by=this.last.y*2-this.last.by;this.last.bx=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[0],10);this.last.by=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[1],10);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[2],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[3],10);d+=[Math.round(bx),Math.round(by),Math.round(parseFloat(arguments[0],10)),Math.round(parseFloat(arguments[1],10)),Math.round(parseFloat(arguments[2],10)),Math.round(parseFloat(arguments[3],10))].join(" ")+" ";this.attrs.path+=(this.isAbsolute?"S":"s")+Array.prototype.splice.call(arguments,0,arguments.length);}
this.node.path=this.Path+=d;return this;};p.qcurveTo=function(){var d="qb";if(arguments.length==4){this.last.qx=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[0],10);this.last.qy=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[1],10);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[2],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[3],10);d+=[Math.round(this.last.qx),Math.round(this.last.qy),Math.round(this.last.x),Math.round(this.last.y)].join(" ")+" ";this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"Q":"q")+Array.prototype.splice.call(arguments,0,arguments.length);}
if(arguments.length==2){this.last.qx=this.last.x*2-this.last.qx;this.last.qy=this.last.y*2-this.last.qy;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[2],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[3],10);d+=[Math.round(this.last.qx),Math.round(this.last.qy),Math.round(this.last.x),Math.round(this.last.y)].join(" ")+" ";this.attrs.path+=(this.isAbsolute?"T":"t")+Array.prototype.splice.call(arguments,0,arguments.length);}
this.node.path=this.Path+=d;this.path.push({type:"qcurve",arg:[].slice.call(arguments,0),pos:this.isAbsolute});return this;};p.addRoundedCorner=function(r,dir){var R=.5522*r,rollback=this.isAbsolute,o=this;if(rollback){this.relatively();rollback=function(){o.absolutely();};}else{rollback=function(){};}
var actions={l:function(){return{u:function(){o.curveTo(-R,0,-r,-(r-R),-r,-r);},d:function(){o.curveTo(-R,0,-r,r-R,-r,r);}};},r:function(){return{u:function(){o.curveTo(R,0,r,-(r-R),r,-r);},d:function(){o.curveTo(R,0,r,r-R,r,r);}};},u:function(){return{r:function(){o.curveTo(0,-R,-(R-r),-r,r,-r);},l:function(){o.curveTo(0,-R,R-r,-r,-r,-r);}};},d:function(){return{r:function(){o.curveTo(0,R,-(R-r),r,r,r);},l:function(){o.curveTo(0,R,R-r,r,-r,r);}};}};actions[dir.charAt(0)]()[dir.charAt(1)]();rollback();return o;};p.andClose=function(){this.node.path=(this.Path+="x e");this.attrs.path+="z";return this;};if(pathString){p.absolutely();p.attrs.path="";paper.pathfinder(p,""+pathString);}
setFillAndStroke(p,params);if(params.gradient){addGrdientFill(p,params.gradient);}
return p;};var setFillAndStroke=function(o,params){var s=o.node.style,res=o;o.attrs=o.attrs||{};for(var par in params){o.attrs[par]=params[par];}
if(params.path&&o.type=="path"){o.Path="";o.path=[];paper.pathfinder(o,params.path);}
if(params.rotation!=null){o.rotate(params.rotation,true);}
if(params.translation){var xy=(params.translation+"").split(separator);o.translate(xy[0],xy[1]);}
if(params.scale){var xy=(params.scale+"").split(separator);o.scale(xy[0],xy[1]);}
if(o.type=="image"&&params.src){o.node.src=params.src;}
if(o.type=="image"&&params.opacity){o.node.filterOpacity=" progid:DXImageTransform.Microsoft.Alpha(opacity="+(params.opacity*100)+")";o.node.style.filter=(o.node.filterMatrix||"")+(o.node.filterOpacity||"");}
params.font&&(s.font=params.font);params["font-family"]&&(s.fontFamily=params["font-family"]);params["font-size"]&&(s.fontSize=params["font-size"]);params["font-weight"]&&(s.fontWeight=params["font-weight"]);params["font-style"]&&(s.fontStyle=params["font-style"]);if(typeof params.opacity!="undefined"||typeof params["stroke-width"]!="undefined"||typeof params.fill!="undefined"||typeof params.stroke!="undefined"||params["stroke-width"]||params["stroke-opacity"]||params["stroke-dasharray"]||params["stroke-miterlimit"]||params["stroke-linejoin"]||params["stroke-linecap"]){o=o.shape||o.node;var fill=(o.getElementsByTagName("fill")&&o.getElementsByTagName("fill")[0])||createNode("fill");if("fill-opacity"in params||"opacity"in params){fill.opacity=((+params["fill-opacity"]+1||2)-1)*((+params.opacity+1||2)-1);}
if(params.fill){fill.on=true;}
if(typeof fill.on=="undefined"||params.fill=="none"){fill.on=false;}
if(fill.on&&params.fill){var isURL=params.fill.match(/^url\(([^\)]+)\)$/i);if(isURL){fill.src=isURL[1];fill.type="tile";}else{fill.color=getRGB(params.fill).hex;fill.src="";fill.type="solid";}}
o.appendChild(fill);var stroke=(o.getElementsByTagName("stroke")&&o.getElementsByTagName("stroke")[0])||createNode("stroke");if((params.stroke&&params.stroke!="none")||params["stroke-width"]||typeof params["stroke-opacity"]!="undefined"||params["stroke-dasharray"]||params["stroke-miterlimit"]||params["stroke-linejoin"]||params["stroke-linecap"]){stroke.on=true;}
if(params.stroke=="none"||typeof stroke.on=="undefined"||params.stroke==0){stroke.on=false;}
if(stroke.on&&params.stroke){stroke.color=getRGB(params.stroke).hex;}
stroke.opacity=((+params["stroke-opacity"]+1||2)-1)*((+params.opacity+1||2)-1);params["stroke-linejoin"]&&(stroke.joinstyle=params["stroke-linejoin"]||"miter");stroke.miterlimit=params["stroke-miterlimit"]||8;params["stroke-linecap"]&&(stroke.endcap={butt:"flat",square:"square",round:"round"}[params["stroke-linecap"]]||"miter");params["stroke-width"]&&(stroke.weight=(parseFloat(params["stroke-width"],10)||1)*12/16);if(params["stroke-dasharray"]){var dasharray={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};stroke.dashstyle=dasharray[params["stroke-dasharray"]]||"";}
o.appendChild(stroke);}
if(res.type=="text"){var span=doc.createElement("span"),s=span.style;res.attrs.font&&(s.font=res.attrs.font);res.attrs["font-family"]&&(s.fontFamily=res.attrs["font-family"]);res.attrs["font-size"]&&(s.fontSize=res.attrs["font-size"]);res.attrs["font-weight"]&&(s.fontWeight=res.attrs["font-weight"]);res.attrs["font-style"]&&(s.fontStyle=res.attrs["font-style"]);res.node.parentNode.appendChild(span);span.innerText=res.node.string;res.W=res.attrs.w=span.offsetWidth;res.H=res.attrs.h=span.offsetHeight;res.X=res.attrs.x-Math.round(res.W/2);res.Y=res.attrs.y-Math.round(res.H/2);res.node.parentNode.removeChild(span);}};var getAngle=function(a,b,c,d){var angle=Math.round(Math.atan((parseFloat(c,10)-parseFloat(a,10))/(parseFloat(d,10)-parseFloat(b,10)))*57.29)||0;if(!angle&&parseFloat(a,10)<parseFloat(b,10)){angle=180;}
angle-=180;if(angle<0){angle+=360;}
return angle;};var addGrdientFill=function(o,gradient){gradient=toGradient(gradient);o.attrs=o.attrs||{};var attrs=o.attrs;o.attrs.gradient=gradient;o=o.shape||o[0];var fill=o.getElementsByTagName("fill");if(fill.length){fill=fill[0];}else{fill=createNode("fill");}
if(gradient.dots.length){fill.on=true;fill.method="none";fill.type=((gradient.type+"").toLowerCase()=="radial")?"gradientTitle":"gradient";if(typeof gradient.dots[0].color!="undefined"){fill.color=getRGB(gradient.dots[0].color).hex;}
if(typeof gradient.dots[gradient.dots.length-1].color!="undefined"){fill.color2=getRGB(gradient.dots[gradient.dots.length-1].color).hex;}
var colors=[];for(var i=0,ii=gradient.dots.length;i<ii;i++){if(gradient.dots[i].offset){colors.push(gradient.dots[i].offset+" "+getRGB(gradient.dots[i].color).hex);}};var fillOpacity=typeof gradient.dots[gradient.dots.length-1].opacity=="undefined"?(typeof attrs.opacity=="undefined"?1:attrs.opacity):gradient.dots[gradient.dots.length-1].opacity;if(colors.length){fill.colors.value=colors.join(",");fillOpacity=typeof attrs.opacity=="undefined"?1:attrs.opacity;}else{fill.colors.value="0% "+fill.color;}
fill.opacity=fillOpacity;if(typeof gradient.angle!="undefined"){fill.angle=(-gradient.angle+270)%360;}else if(gradient.vector){fill.angle=getAngle.apply(null,gradient.vector);}
if((gradient.type+"").toLowerCase()=="radial"){fill.focus="100%";fill.focusposition="0.5 0.5";}}};var Element=function(node,group,vml){var Rotation=0,RotX=0,RotY=0,Scale=1;this[0]=node;this.node=node;this.X=0;this.Y=0;this.attrs={};this.Group=group;this.vml=vml;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};};Element.prototype.rotate=function(deg,cx,cy){if(deg==null){return this._.rt.deg;}
deg=deg.toString().split(separator);if(deg.length-1){cx=parseFloat(deg[1],10);cy=parseFloat(deg[2],10);}
deg=parseFloat(deg[0],10);if(cy==null){cx=null;}
if(cx!=null){this._.rt.deg=deg;}else{this._.rt.deg+=deg;}
this._.rt.cx=cx;this._.rt.cy=cy;this.setBox(null,cx,cy);this.Group.style.rotation=this._.rt.deg;return this;};Element.prototype.setBox=function(params,cx,cy){var gs=this.Group.style,os=(this.shape&&this.shape.style)||this.node.style;for(var i in params){this.attrs[i]=params[i];}
cx=cx||this._.rt.cx;cy=cy||this._.rt.cy;var attr=this.attrs,x,y,w,h;switch(this.type){case"circle":x=attr.cx-attr.r;y=attr.cy-attr.r;w=h=attr.r*2;break;case"ellipse":x=attr.cx-attr.rx;y=attr.cy-attr.ry;w=attr.rx*2;h=attr.ry*2;break;case"rect":case"image":x=attr.x;y=attr.y;w=attr.width||0;h=attr.height||0;break;case"text":this.textpath.v=["m",Math.round(attr.x),", ",Math.round(attr.y-2),"l",Math.round(attr.x)+1,", ",Math.round(attr.y-2)].join("");x=attr.x-Math.round(this.W/2);y=attr.y-this.H/2;w=this.W;h=this.H;break;case"path":if(!this.attrs.path){x=0;y=0;w=this.vml.width;h=this.vml.height;}else{var dim=pathDimensions(this.attrs.path),x=dim.x;y=dim.y;w=dim.width;h=dim.height;}
break;default:x=0;y=0;w=this.vml.width;h=this.vml.height;break;}
cx=(cx==null)?x+w/2:cx;cy=(cy==null)?y+h/2:cy;var left=cx-this.vml.width/2,top=cy-this.vml.height/2;if(this.type=="path"||this.type=="text"){gs.left=left+"px";gs.top=top+"px";this.X=this.type=="text"?x:-left;this.Y=this.type=="text"?y:-top;this.W=w;this.H=h;os.left=-left+"px";os.top=-top+"px";}else{gs.left=left+"px";gs.top=top+"px";this.X=x;this.Y=y;this.W=w;this.H=h;gs.width=this.vml.width+"px";gs.height=this.vml.height+"px";os.left=x-left+"px";os.top=y-top+"px";os.width=w+"px";os.height=h+"px";}};Element.prototype.hide=function(){this.Group.style.display="none";return this;};Element.prototype.show=function(){this.Group.style.display="block";return this;};Element.prototype.getBBox=function(){return{x:this.X,y:this.Y,width:this.W,height:this.H};};Element.prototype.remove=function(){this[0].parentNode.removeChild(this[0]);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);};Element.prototype.attr=function(){if(arguments.length==1&&typeof arguments[0]=="string"){if(arguments[0]=="translation"){return this.translate();}
return this.attrs[arguments[0]];}
if(this.attrs&&arguments.length==1&&arguments[0]instanceof Array){var values={};for(var i=0,ii=arguments[0].length;i<ii;i++){values[arguments[0][i]]=this.attrs[arguments[0][i]];};return values;}
var params;if(arguments.length==2){params={};params[arguments[0]]=arguments[1];}
if(arguments.length==1&&typeof arguments[0]=="object"){params=arguments[0];}
if(params){if(params.gradient){addGrdientFill(this,params.gradient);}
if(params.text&&this.type=="text"){this.node.string=params.text;}
if(params.id){this.node.id=params.id;}
setFillAndStroke(this,params);this.setBox(params);}
return this;};Element.prototype.toFront=function(){this.Group.parentNode.appendChild(this.Group);return this;};Element.prototype.toBack=function(){if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);}
return this;};Element.prototype.insertAfter=function(element){if(element.Group.nextSibling){element.Group.parentNode.insertBefore(this.Group,element.Group.nextSibling);}else{element.Group.parentNode.appendChild(this.Group);}
return this;};Element.prototype.insertBefore=function(element){element.Group.parentNode.insertBefore(this.Group,element.Group);return this;};var theCircle=function(vml,x,y,r){var g=createNode("group");var o=createNode("oval");g.appendChild(o);vml.canvas.appendChild(g);var res=new Element(o,g,vml);res.type="circle";setFillAndStroke(res,{stroke:"#000",fill:"none"});res.attrs.cx=x;res.attrs.cy=y;res.attrs.r=r;res.setBox({x:x-r,y:y-r,width:r*2,height:r*2});return res;};var theRect=function(vml,x,y,w,h,r){var g=createNode("group");var o=createNode(r?"roundrect":"rect");if(r){o.arcsize=r/(Math.min(w,h));}
g.appendChild(o);vml.canvas.appendChild(g);var res=new Element(o,g,vml);res.type="rect";setFillAndStroke(res,{stroke:"#000"});res.attrs.x=x;res.attrs.y=y;res.attrs.w=w;res.attrs.h=h;res.attrs.r=r;res.setBox({x:x,y:y,width:w,height:h});return res;};var theEllipse=function(vml,x,y,rx,ry){var g=createNode("group");var o=createNode("oval");g.appendChild(o);vml.canvas.appendChild(g);var res=new Element(o,g,vml);res.type="ellipse";setFillAndStroke(res,{stroke:"#000"});res.attrs.cx=x;res.attrs.cy=y;res.attrs.rx=rx;res.attrs.ry=ry;res.setBox({x:x-rx,y:y-ry,width:rx*2,height:ry*2});return res;};var theImage=function(vml,src,x,y,w,h){var g=createNode("group");var o=createNode("image");o.src=src;g.appendChild(o);vml.canvas.appendChild(g);var res=new Element(o,g,vml);res.type="image";res.attrs.x=x;res.attrs.y=y;res.attrs.w=w;res.attrs.h=h;res.setBox({x:x,y:y,width:w,height:h});return res;};var theText=function(vml,x,y,text){var g=createNode("group"),gs=g.style;var el=createNode("shape"),ol=el.style;var path=createNode("path"),ps=path.style;path.v=["m",Math.round(x),", ",Math.round(y-2),"l",Math.round(x)+1,", ",Math.round(y-2)].join("");path.textpathok=true;ol.width=vml.width;ol.height=vml.height;gs.position="absolute";gs.left=0;gs.top=0;gs.width=vml.width;gs.height=vml.height;var o=createNode("textpath");o.string=text;o.on=true;o.coordsize=vml.coordsize;o.coordorigin=vml.coordorigin;el.appendChild(o);el.appendChild(path);g.appendChild(el);vml.canvas.appendChild(g);var res=new Element(o,g,vml);res.shape=el;res.textpath=path;res.type="text";res.attrs.x=x;res.attrs.y=y;res.attrs.w=1;res.attrs.h=1;setFillAndStroke(res,{font:availableAttrs.font,stroke:"none",fill:"#000"});return res;};var setSize=function(width,height){this.width=width||this.width;this.height=height||this.height;this.canvas.style.width=this.width+"px";this.canvas.style.height=this.height+"px";this.canvas.parentNode.style.clip="rect(0 "+this.width+" "+this.height+" 0)";this.canvas.coordsize=this.width+" "+this.height;return this;};doc.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{if(!doc.namespaces.rvml){doc.namespaces.add("rvml","urn:schemas-microsoft-com:vml");}
var createNode=function(tagName){return doc.createElement('<rvml:'+tagName+' class="rvml">');};}catch(e){var createNode=function(tagName){return doc.createElement('<'+tagName+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');};}
var create=function(){var container,width,height;if(typeof arguments[0]=="string"){container=doc.getElementById(arguments[0]);width=arguments[1];height=arguments[2];}
if(typeof arguments[0]=="object"){container=arguments[0];width=arguments[1];height=arguments[2];}
if(typeof arguments[0]=="number"){container=1;x=arguments[0];y=arguments[1];width=arguments[2];height=arguments[3];}
if(!container){throw new Error("VML container not found.");}
var c=doc.createElement("div"),d=doc.createElement("div"),r=paper.canvas=createNode("group"),cs=c.style,rs=r.style;paper.width=width;paper.height=height;width=width||"320px";height=height||"200px";cs.clip="rect(0 "+width+"px "+height+"px 0)";cs.top="-2px";cs.left="-2px";cs.position="absolute";rs.position="absolute";d.style.position="relative";rs.width=width;rs.height=height;r.coordsize=(/%$/.test(width)?width:parseFloat(width,10))+" "+(/%$/.test(height)?height:parseFloat(height,10));r.coordorigin="0 0";var b=createNode("rect"),bs=b.style;bs.left=bs.top=0;bs.width=rs.width;bs.height=rs.height;b.filled=b.stroked="f";r.appendChild(b);c.appendChild(r);d.appendChild(c);if(container==1){doc.body.appendChild(d);cs.position="absolute";cs.left=x+"px";cs.top=y+"px";cs.width=width;cs.height=height;container={style:{width:width,height:height}};}else{cs.width=container.style.width=width;cs.height=container.style.height=height;if(container.firstChild){container.insertBefore(d,container.firstChild);}else{container.appendChild(d);}}
for(var prop in paper){container[prop]=paper[prop];}
for(var prop in R.fn){if(!container[prop]){container[prop]=R.fn[prop];}}
container.clear=function(){var todel=[];for(var i=0,ii=r.childNodes.length;i<ii;i++){if(r.childNodes[i]!=b){todel.push(r.childNodes[i]);}}
for(i=0,ii=todel.length;i<ii;i++){r.removeChild(todel[i]);}};return container;};paper.remove=function(){this.canvas.parentNode.parentNode.parentNode.removeChild(this.canvas.parentNode.parentNode);};paper.safari=function(){};}
var addEvent=(function(){if(doc.addEventListener){return function(obj,type,fn,element){var f=function(e){return fn.call(element,e);};obj.addEventListener(type,f,false);return function(){obj.removeEventListener(type,f,false);return true;};};}else if(doc.attachEvent){return function(obj,type,fn,element){var f=function(e){return fn.call(element,e||win.event);};obj.attachEvent("on"+type,f);var detacher=function(){obj.detachEvent("on"+type,f);return true;};if(type=="mouseover"){obj.attachEvent("onmouseenter",f);return function(){obj.detachEvent("onmouseenter",f);return detacher();};}else if(type=="mouseout"){obj.attachEvent("onmouseleave",f);return function(){obj.detachEvent("onmouseleave",f);return detacher();};}
return detacher;};}})();for(var i=events.length;i--;){(function(eventName){Element.prototype[eventName]=function(fn){if(typeof fn=="function"){this.events=this.events||{};this.events[eventName]=this.events[eventName]||{};this.events[eventName][fn]=this.events[eventName][fn]||[];this.events[eventName][fn].push(addEvent(this.shape||this.node,eventName,fn,this));}
return this;};Element.prototype["un"+eventName]=function(fn){this.events&&this.events[eventName]&&this.events[eventName][fn]&&this.events[eventName][fn].length&&this.events[eventName][fn].shift()()&&!this.events[eventName][fn].length&&delete this.events[eventName][fn];};})(events[i]);}
paper.circle=function(x,y,r){return theCircle(this,x,y,r);};paper.rect=function(x,y,w,h,r){return theRect(this,x,y,w,h,r);};paper.ellipse=function(x,y,rx,ry){return theEllipse(this,x,y,rx,ry);};paper.path=function(params,pathString){return thePath(params,pathString,this);};paper.image=function(src,x,y,w,h){return theImage(this,src,x,y,w,h);};paper.text=function(x,y,text){return theText(this,x,y,text);};paper.group=function(){return this;};paper.drawGrid=function(x,y,w,h,wv,hv,color){color=color||"#000";var path=["M",x,y,"L",x+w,y,x+w,y+h,x,y+h,x,y],rowHeight=h/hv,columnWidth=w/wv;for(var i=1;i<hv;i++){path=path.concat(["M",x,y+i*rowHeight,"L",x+w,y+i*rowHeight]);}
for(var i=1;i<wv;i++){path=path.concat(["M",x+i*columnWidth,y,"L",x+i*columnWidth,y+h]);}
return this.path({stroke:color,"stroke-width":1},path.join(","));};paper.pathfinder=function(p,path){var commands={M:function(x,y){this.moveTo(x,y);},C:function(x1,y1,x2,y2,x3,y3){this.curveTo(x1,y1,x2,y2,x3,y3);},Q:function(x1,y1,x2,y2){this.qcurveTo(x1,y1,x2,y2);},T:function(x,y){this.qcurveTo(x,y);},S:function(x1,y1,x2,y2){p.curveTo(x1,y1,x2,y2);},L:function(x,y){p.lineTo(x,y);},H:function(x){this.lineTo(x,this.last.y);},V:function(y){this.lineTo(this.last.x,y);},A:function(rx,ry,xaxisrotation,largearcflag,sweepflag,x,y){this.arcTo(rx,ry,largearcflag,sweepflag,x,y);},Z:function(){this.andClose();}};path=pathToAbsolute(path);for(var i=0,ii=path.length;i<ii;i++){var b=path[i].shift();commands[b].apply(p,path[i]);}};paper.set=function(itemsArray){return new Set(itemsArray);};paper.setSize=setSize;Element.prototype.stop=function(){clearTimeout(this.animation_in_progress);};Element.prototype.scale=function(x,y){if(x==undefined&&y==undefined){return{x:this._.sx,y:this._.sy};}
y=y||x;isNaN(y)&&(y=x);var dx,dy,cx,cy;if(x!=0){var dirx=Math.round(x/Math.abs(x)),diry=Math.round(y/Math.abs(y)),s=this.node.style;dx=this.attr("x");dy=this.attr("y");cx=this.attr("cx");cy=this.attr("cy");if(dirx!=1||diry!=1){if(this.transformations){this.transformations[2]="scale("+[dirx,diry]+")";this.node.setAttribute("transform",this.transformations.join(" "));dx=(dirx<0)?-this.attr("x")-this.attrs.width*x*dirx/this._.sx:this.attr("x");dy=(diry<0)?-this.attr("y")-this.attrs.height*y*diry/this._.sy:this.attr("y");cx=this.attr("cx")*dirx;cy=this.attr("cy")*diry;}else{this.node.filterMatrix=" progid:DXImageTransform.Microsoft.Matrix(M11="+dirx+", M12=0, M21=0, M22="+diry+", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')";s.filter=(this.node.filterMatrix||"")+(this.node.filterOpacity||"");}}else{if(this.transformations){this.transformations[2]="";this.node.setAttribute("transform",this.transformations.join(" "));}else{this.node.filterMatrix="";s.filter=(this.node.filterMatrix||"")+(this.node.filterOpacity||"");}}
switch(this.type){case"rect":case"image":this.attr({width:this.attrs.width*x*dirx/this._.sx,height:this.attrs.height*y*diry/this._.sy,x:dx,y:dy});break;case"circle":case"ellipse":this.attr({rx:this.attrs.rx*x*dirx/this._.sx,ry:this.attrs.ry*y*diry/this._.sy,r:this.attrs.r*x*diry/this._.sx,cx:cx,cy:cy});break;case"path":var path=pathToRelative(Raphael.parsePathString(this.attr("path"))),skip=true,dim=pathDimensions(this.attrs.path),dx=-dim.width*(x-1)/2,dy=-dim.height*(y-1)/2;for(var i=0,ii=path.length;i<ii;i++){if(path[i][0].toUpperCase()=="M"&&skip){continue;}else{skip=false;}
if(path[i][0].toUpperCase()=="A"){path[i][path[i].length-2]*=x*dirx;path[i][path[i].length-1]*=y*diry;}else{for(var j=1,jj=path[i].length;j<jj;j++){path[i][j]*=(j%2)?x*dirx/this._.sx:y*diry/this._.sy;}}}
var dim2=pathDimensions(path),dx=dim.x+dim.width/2-dim2.x-dim2.width/2,dy=dim.y+dim.height/2-dim2.y-dim2.height/2;path=pathToRelative(path);path[0][1]+=dx;path[0][2]+=dy;this.attr({path:path.join(" ")});}}
this._.sx=x;this._.sy=y;return this;};Element.prototype.animate=function(params,ms,callback){clearTimeout(this.animation_in_progress);var from={},to={},diff={},t={x:0,y:0};for(var attr in params){if(attr in availableAnimAttrs){from[attr]=this.attr(attr);if(typeof from[attr]=="undefined"){from[attr]=availableAttrs[attr];}
to[attr]=params[attr];switch(availableAnimAttrs[attr]){case"number":diff[attr]=(to[attr]-from[attr])/ms;break;case"colour":from[attr]=getRGB(from[attr]);var toColour=getRGB(to[attr]);diff[attr]={r:(toColour.r-from[attr].r)/ms,g:(toColour.g-from[attr].g)/ms,b:(toColour.b-from[attr].b)/ms};break;case"path":var pathes=pathEqualiser(from[attr],to[attr]);from[attr]=pathes[0];to[attr]=pathes[1];diff[attr]=[];for(var i=0,ii=from[attr].length;i<ii;i++){diff[attr][i]=[0];for(var j=1,jj=from[attr][i].length;j<jj;j++){diff[attr][i][j]=(to[attr][i][j]-from[attr][i][j])/ms;}}
break;case"csv":var values=params[attr].toString().split(separator),from2=from[attr].toString().split(separator);if(attr=="translation"){from[attr]=[0,0];diff[attr]=[values[0]/ms,values[1]/ms];}else if(attr=="rotation"){from[attr]=(from2[1]==values[1]&&from2[2]==values[2])?from2:[0,values[1],values[2]];diff[attr]=[(values[0]-from[attr][0])/ms,0,0];}else{from[attr]=(from[attr]+"").split(separator);diff[attr]=[(values[0]-from[attr][0])/ms,(values[1]-from[attr][0])/ms];}
to[attr]=values;}}}
var start=new Date(),prev=0,that=this;(function(){var time=(new Date()).getTime()-start.getTime(),set={},now;if(time<ms){for(var attr in from){switch(availableAnimAttrs[attr]){case"number":now=+from[attr]+time*diff[attr];break;case"colour":now="rgb("+[Math.round(from[attr].r+time*diff[attr].r),Math.round(from[attr].g+time*diff[attr].g),Math.round(from[attr].b+time*diff[attr].b)].join(",")+")";break;case"path":now=[];for(var i=0,ii=from[attr].length;i<ii;i++){now[i]=[from[attr][i][0]];for(var j=1,jj=from[attr][i].length;j<jj;j++){now[i][j]=from[attr][i][j]+time*diff[attr][i][j];}
now[i]=now[i].join(" ");}
now=now.join(" ");break;case"csv":if(attr=="translation"){var x=diff[attr][0]*(time-prev),y=diff[attr][1]*(time-prev);t.x+=x;t.y+=y;now=[x,y].join(" ");}else if(attr=="rotation"){now=+from[attr][0]+time*diff[attr][0];from[attr][1]&&(now+=","+from[attr][1]+","+from[attr][2]);}else{now=[+from[attr][0]+time*diff[attr][0],+from[attr][1]+time*diff[attr][1]].join(" ");}
break;}
if(attr=="font-size"){set[attr]=now+"px";}else{set[attr]=now;}}
that.attr(set);that.animation_in_progress=setTimeout(arguments.callee,0);paper.safari();}else{(t.x||t.y)&&that.translate(-t.x,-t.y);that.attr(params);clearTimeout(that.animation_in_progress);paper.safari();(typeof callback=="function")&&callback.call(that);}
prev=time;})();return this;};Element.prototype.translate=function(x,y){if(x==null){return{x:this._.tx,y:this._.ty};}
this._.tx+=+x;this._.ty+=+y;switch(this.type){case"circle":case"ellipse":this.attr({cx:this.attrs.cx+x,cy:this.attrs.cy+y});break;case"rect":case"image":case"text":this.attr({x:this.attrs.x+(+x),y:this.attrs.y+(+y)});break;case"path":var path=pathToRelative(this.attrs.path);path[0][1]+=+x;path[0][2]+=+y;this.attr({path:path.join(" ")});break;}
return this;};var Set=function(itemsArray){this.items=[];this.length=(itemsArray&&itemsArray.length)||0;if(itemsArray&&itemsArray.constructor==Array){for(var i=itemsArray.length;i--;){if(itemsArray[i].constructor==Element){this.items[this.items.length]=itemsArray[i];}}}};Set.prototype.push=function(item){if(item&&item.constructor==Element){var len=this.items.length;this.items[len]=item;this[len]=item;this.length++;}
return this;};Set.prototype.pull=function(id){var res=this.items.splice(id,1)[0];for(var j=id,jj=this.items.length;j<jj;j++){this[j]=this[j+1];}
delete this[jj+1];this.length--;return res;};for(var method in Element.prototype){Set.prototype[method]=(function(methodname){return function(){for(var i=this.items.length;i--;){this.items[i][methodname].apply(this.items[i],arguments);}
return this;};})(method);}
Set.prototype.getBBox=function(){var x=[],y=[],w=[],h=[];for(var i=this.items.length;i--;){var box=this.items[i].getBBox();x.push(box.x);y.push(box.y);w.push(box.x+box.width);h.push(box.y+box.height);}
x=Math.min.apply(Math,x);y=Math.min.apply(Math,y);return{x:x,y:y,width:Math.max.apply(Math,w)-x,height:Math.max.apply(Math,h)-y};};return R;})();(function($){$.facebox=function(data,klass){$.facebox.loading()
if(data.ajax)fillFaceboxFromAjax(data.ajax)
else if(data.image)fillFaceboxFromImage(data.image)
else if(data.div)fillFaceboxFromHref(data.div)
else if($.isFunction(data))data.call($)
else $.facebox.reveal(data,klass)}
$.extend($.facebox,{settings:{opacity:0,overlay:true,loadingImage:'/images/facebox/loading.gif',closeImage:'/images/facebox/closelabel.gif',imageTypes:['png','jpg','jpeg','gif'],faceboxHtml:'\
    <div id="facebox" style="display:none;z-index:9999;position:absolute;"> \
      <div class="popup"> \
        <table> \
          <tbody> \
            <tr> \
              <td class="tl"/><td class="b"/><td class="tr"/> \
            </tr> \
            <tr> \
              <td class="b"/> \
              <td class="body"> \
                <div class="content"> \
                </div> \
                <div class="footer"> \
                  <a href="#" class="close"> \
                    <img src="/facebox/closelabel.gif" title="close" class="close_image" /> \
                  </a> \
                </div> \
              </td> \
              <td class="b"/> \
            </tr> \
            <tr> \
              <td class="bl"/><td class="b"/><td class="br"/> \
            </tr> \
          </tbody> \
        </table> \
      </div> \
    </div>'},loading:function(){init()
if($('#facebox .loading').length==1)return true
showOverlay()
$('#facebox .content').empty()
$('#facebox .body').children().hide().end().append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')
$('#facebox').css({top:getPageScroll()[1]+(getPageHeight()/10),left:385.5}).show()
$(document).bind('keydown.facebox',function(e){if(e.keyCode==27)$.facebox.close()
return true})
$(document).trigger('loading.facebox')},reveal:function(data,klass){$(document).trigger('beforeReveal.facebox')
if(klass)$('#facebox .content').addClass(klass)
$('#facebox .content').append(data)
$('#facebox .loading').remove()
$('#facebox .body').children().fadeIn('normal')
$('#facebox').css('left',$(window).width()/2-($('#facebox table').width()/2))
$(document).trigger('reveal.facebox').trigger('afterReveal.facebox')},close:function(){$(document).trigger('close.facebox')
return false}})
$.fn.facebox=function(settings){init(settings)
function clickHandler(){$.facebox.loading(true)
var klass=this.rel.match(/facebox\[?\.(\w+)\]?/)
if(klass)klass=klass[1]
fillFaceboxFromHref(this.href,klass)
return false}
return this.click(clickHandler)}
function init(settings){if($.facebox.settings.inited)return true
else $.facebox.settings.inited=true
$(document).trigger('init.facebox')
makeCompatible()
var imageTypes=$.facebox.settings.imageTypes.join('|')
$.facebox.settings.imageTypesRegexp=new RegExp('\.'+imageTypes+'$','i')
if(settings)$.extend($.facebox.settings,settings)
$('body').append($.facebox.settings.faceboxHtml)
var preload=[new Image(),new Image()]
preload[0].src=$.facebox.settings.closeImage
preload[1].src=$.facebox.settings.loadingImage
$('#facebox').find('.b:first, .bl, .br, .tl, .tr').each(function(){preload.push(new Image())
preload.slice(-1).src=$(this).css('background-image').replace(/url\((.+)\)/,'$1')})
$('#facebox .close').click($.facebox.close)
$('#facebox .close_image').attr('src',$.facebox.settings.closeImage)}
function getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
return new Array(xScroll,yScroll)}
function getPageHeight(){var windowHeight
if(self.innerHeight){windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowHeight=document.documentElement.clientHeight;}else if(document.body){windowHeight=document.body.clientHeight;}
return windowHeight}
function makeCompatible(){var $s=$.facebox.settings
$s.loadingImage=$s.loading_image||$s.loadingImage
$s.closeImage=$s.close_image||$s.closeImage
$s.imageTypes=$s.image_types||$s.imageTypes
$s.faceboxHtml=$s.facebox_html||$s.faceboxHtml}
function fillFaceboxFromHref(href,klass){if(href.match(/#/)){var url=window.location.href.split('#')[0]
var target=href.replace(url,'')
$.facebox.reveal($(target).clone().show(),klass)}else if(href.match($.facebox.settings.imageTypesRegexp)){fillFaceboxFromImage(href,klass)}else{fillFaceboxFromAjax(href,klass)}}
function fillFaceboxFromImage(href,klass){var image=new Image()
image.onload=function(){$.facebox.reveal('<div class="image"><img src="'+image.src+'" /></div>',klass)}
image.src=href}
function fillFaceboxFromAjax(href,klass){$.get(href,function(data){$.facebox.reveal(data,klass)})}
function skipOverlay(){return $.facebox.settings.overlay==false||$.facebox.settings.opacity===null}
function showOverlay(){if(skipOverlay())return
if($('facebox_overlay').length==0)
$("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')
$('#facebox_overlay').hide().addClass("facebox_overlayBG").css('opacity',$.facebox.settings.opacity).click(function(){$(document).trigger('close.facebox')}).fadeIn(200)
return false}
function hideOverlay(){if(skipOverlay())return
$('#facebox_overlay').fadeOut(200,function(){$("#facebox_overlay").removeClass("facebox_overlayBG")
$("#facebox_overlay").addClass("facebox_hide")
$("#facebox_overlay").remove()})
return false}
$(document).bind('close.facebox',function(){$(document).unbind('keydown.facebox')
$('#facebox').fadeOut(function(){$('#facebox .content').removeClass().addClass('content')
hideOverlay()
$('#facebox .loading').remove()})})})(Evri.jQuery);Evri.extendNamespace(Evri.Widget,{ContentRecommendation:function(options){var jQuery=Evri.jQuery;IS_IE6=false;isPopupWidget=true;EVRI_CONTENT_EMBEDDED_WIDGET_WRAPPER="evri-content-embedded-content-widget-wrapper";EVRI_CONTENT_MAIN_DIV="evri-content-main-div";EVRI_CONTENT_LOADING_WIDGET="evri-content-loading-widget";EVRI_CONTENT_TRANSPARENT_DIV="evri-content-transparent-div";EVRI_CONTENT_LEFT_TOP="evri-content-left-top";EVRI_CONTENT_RIGHT_TOP="evri-content-right-top";EVRI_CONTENT_VIDEOS_LOADING="evri-content-videos-loading";EVRI_CONTENT_VIDEO_THUMBNAIL_DETAIL="evri-content-video-thumbnail-detail";EVRI_CONTENT_ARTICLES="evri-content-articles";EVRI_CONTENT_ARTICLES_LOADING="evri-content-articles-loading";EVRI_CONTENT_FULL_PROFILE="evri-content-full-profile";EVRI_CONTENT_LEFT_BOTTOM="evri-content-left-bottom";EVRI_CONTENT_VIDEO_PLAYER="evri-content-video-player";EVRI_CONTENT_VIDEOS="evri-content-videos";EVRI_CONTENT_PLAYER_CONTROLS="evri-content-player-controls";EVRI_CONTENT_RIGHT="evri-content-right";DIVNAME_CONNECTIONGRAPH="connectionGraph";EVRI_CONTENT_CONNECTIONS_LOADING="evri-content-connectionss-loading";EVRI_CONTENT_RIGHT_BOTTOM="evri-content-right-bottom";EVRI_CONETNT_TOP_RELATED_SPAN="evri-conetnt-top-related-span";ARTICLES_NOT_FOUND="No articles available.";VIDEOS_NOT_FOUND="No videos available.";IMAGES_NOT_FOUND="No images available.";ENTITIES_NOT_FOUND="No entities available.";CONNECTION_ENTITY_NOT_FOUND="No connections available.";EVRI_WIDGET_HEADER_POPUP="evri-widget-header-popup";EVRI_WIDGET_FEEDBACK_FORM_CONTAINER="evri-widget-feedback-form-container";CSS_LOADING_MESSAGE_DIV="loading-message-div";EVRI_VIDEOS_LOADING="... loading video ...";EVRI_ENTITIES_LOADING="... loading entities ...";EVRI_ARTICLES_LOADING="... loading related articles ...";EVRI_CONNECTIONS_LOADING="... loading connections ...";EVRI_CONTENT_CONNECTION_DEFAULT_MESSAGE="Select a person, place or thing above to see a map of connections.";videoPlayinProcess=false;evriBaseURL=undefined;isContentLoaded=undefined;EVRI_WIDGET_ABOUT_US="http://www.evri.com/about.html";EVRI_SEND_FEEDBACK_FORM_URL="/mail/feedback_form";EVRI_CONTENTRECOMMENDATION_JS_URL="/javascripts/contentRecommendation.1.js";evriWidgetCSSFile=undefined;imagesHost=undefined;EVRI_PORTAL_URL="http://www.evri.com";EVRI_ANALYTICS_LOGGER_STATUS=true;EVRI_WHAT_THIS_IFRAME_SRC_FILE="whats-this.html";NUMBER_ENTITIES_SHOW=6;IS_CONTENT_WIDGET=true;ANIMATION_TIMEOUT=600;ARTICLE_TITLE_LENGTH=40;THUMBNAIL_TITLE_LENGTH=50;ARTICLES_CONTENT_LENGTH=100;ENTITY_NAME_LENGTH=20;SEE_FULLPROFILE_ENTITY_NAME_LENGTH=12;NUMBER_TOP_ARTICLE_SHOW=3;NUMBER_VIDEO_SHOW=4;EVRI_THUMBNAIL_WIDTH=74;EVRI_THUMBNAIL_HEIGHT=56;TOP_RELATED_ENTITY_NAME_LENGTH=25;EVRI_ARTICLE_SOURCE_LENGTH=45;activeEntity=undefined;videoPlayInProgressNumber=-1;entityObjectArray=new Array();analyticsLogger=undefined;evriContentGraph=undefined;finalTextContent="";NODETYPE_ELEMENT=1;NODETYPE_TEXTNODE=3;MINIMUM_WORDLENGTH=4;TEXTSEPERATOR_STRING=" ";MINIMUM_WORDCOUNT=20;applyWordCountFilter=true;widgetClosedWhileLoading=false;apiSession=new Evri.API.Session({'appId':'evri-crw'});defaults={"environment":Evri.API.Environment.portalHost};options=options||{};Evri.jQuery.extend(defaults,options);Evri.jQuery.extend(defaults,{"assetsHost":"http://"+defaults.environment+"/widget","stylesheet":"http://"+defaults.environment+"/widget/stylesheets/contentRecommendation.1.css","imagesHost":"http://"+defaults.environment+"/widget/images/contentRecommendation/"});ignoreTagsList={script:'script',iframe:'iframe',embed:'embed',object:'object',script:'script',style:'style',input:'input',noscript:'noscript',noembed:'noembed',option:'option',select:'select',head:'head',link:'link',title:'title',textarea:'textarea'};allowedAnchorProximityTags={p:'p',span:'span',td:'td'};setupOptions=function(){if(defaults['assetsHost']){self.evriBaseURL=defaults['assetsHost'];}
if(defaults['stylesheet']){self.evriWidgetCSSFile=defaults['stylesheet'];}
if(defaults['imagesHost']){self.imagesHost=defaults['imagesHost'];}};setupOptions();useStylesheet=function(){if(self.evriWidgetCSSFile!==undefined){Evri.Widget.Utilities.useStylesheet(self.evriWidgetCSSFile);}};useStylesheet();loadWidget=function(){var self=this;var embeddedWidget=jQuery('#'+self.EVRI_CONTENT_EMBEDDED_WIDGET_WRAPPER).empty();embeddedWidget.append(jQuery('<div/>').attr('id','stringWidth').css({'visibility':'hidden','position':'absolute'}));embeddedWidget.append(jQuery('<div/>').attr('id','evri-article-content-truncation-div').css({'visibility':'hidden','position':'absolute'}));var mainDivObject=self.createWidget();embeddedWidget.append(mainDivObject);mainDivObject.append(self.createWidgetProgressDialog());embeddedWidget.append(mainDivObject);};getWidgetInstallationCode=function(){var self=this;var widgetCodeContainer=jQuery('#'+self.EVRI_CONTENT_MAIN_DIV).find('.widget-code-container');if(widgetCodeContainer.length==0){var url="http://"+Evri.API.Environment.portalHost+"/widget_utilities/instantiation_code/content_recommendation";jQuery.getJSON(url+"?callback=?",function(widgetInstallationCode){var widgetInstallationCodeObject=jQuery(widgetInstallationCode);self.getWidgetCodeContainer(widgetInstallationCodeObject);self.renderWidgetInstallationCode();});}else{self.renderWidgetInstallationCode();}};renderWidgetInstallationCode=function(){var self=this;var widgetCodeContainer=jQuery('#'+self.EVRI_CONTENT_MAIN_DIV).find('.widget-code-container');widgetCodeContainer.find('.installation-notes-content').hide();widgetCodeContainer.find('.widget-code-content-container').css('top','0');widgetCodeContainer.find('.view-installation-notes').show();widgetCodeContainer.find('.hide-installation-notes').hide();widgetCodeContainer.find('.widget-code-modal-dialog').height('300px');widgetCodeContainer.find('.other-widgets-container').show();self.renderStaticContent('widget-code-container');},createWidgetStatusDialog=function(){var self=this;var mainLoadingWidget=jQuery('<div/>').attr('id',self.EVRI_CONTENT_LOADING_WIDGET).css({'width':'530px','height':'412px','border':'0px solid #333','display':'block'}).css({'background':'#fff url('+self.imagesHost+'loading-img.png) center no-repeat'});if(self.isPopupWidget){var closewidgetImage=jQuery('<img/>').attr('src',self.imagesHost+'close.png').addClass('evri-content-close-widget').css({"float":"right","margin":"7px 11px 0 0"}).hover(function(){jQuery(this).attr('src',self.imagesHost+'close_over.png');},function(){jQuery(this).attr('src',self.imagesHost+'close.png');}).click(function(){self.closeWidget();self.trackDHTML("contentWidget/Close/click",{});});mainLoadingWidget.append(closewidgetImage);}
var subLoadingwidget=jQuery('<div/>');subLoadingwidget.css({'position':'relative','left':'295px','top':'250px','width':'100px'});var img=jQuery('<img/>').attr('src',self.imagesHost+'loading.gif');subLoadingwidget.append(img);mainLoadingWidget.append(subLoadingwidget);return mainLoadingWidget;};createWidgetProgressDialog=function(){var self=this;var transparentDiv=jQuery('<div/>').attr('id',self.EVRI_CONTENT_TRANSPARENT_DIV);transparentDiv.hide();return transparentDiv;};createWidget=function(){var self=this;var mainDivObject=jQuery('<div/>').addClass('main-div').attr('id',self.EVRI_CONTENT_MAIN_DIV);if(self.IS_IE6){}
var topDivObject=jQuery('<div/>').addClass('div-top');var logoDivObject=jQuery('<div/>').addClass('logo clearfix').css({'background':'#fff url('+self.imagesHost+'62X36-evri-logo.gif) no-repeat'}).appendTo(topDivObject).click(function(){self.trackReferral("evriLogo/click",{});window.open(self.EVRI_PORTAL_URL);});var headerDivLinksObject=jQuery('<div/>').addClass('evri-header-links');var ulObject=jQuery('<ul/>').attr('id','toplink');var liObject=jQuery('<li/>');var getThisWidget=jQuery('<a/>').attr('href','javascript:void(0);').text('Get this widget').click(function(){if(!self.isContentLoaded){self.getWidgetInstallationCode();}});liObject.append(getThisWidget);ulObject.append(liObject);var dividerSpan=jQuery('<span/>').addClass('evri-header-link-divider').text('|');liObject=jQuery('<li/>').append(dividerSpan);ulObject.append(liObject);liObject=jQuery('<li/>');var whatThisLink=jQuery('<a/>').attr('href','javascript:void(0);').text('What\'s this?').click(function(){if(!self.isContentLoaded){self.isContentLoaded=true;if(jQuery('#'+self.EVRI_WIDGET_HEADER_POPUP).find('.main-div-whats').length==0){var url="http://"+Evri.API.Environment.portalHost+"/widget_utilities/help/content_recommendation";jQuery.getJSON(url+"?callback=?",function(helpData){var contentRecommendationHelp=jQuery(helpData);var closeButton=contentRecommendationHelp.find('a.close-button');closeButton.click(function(){self.closeStaticPopup('evri-widget-what-this-popup');});jQuery('#'+self.EVRI_WIDGET_HEADER_POPUP).append(contentRecommendationHelp);self.renderStaticContent('evri-widget-what-this-popup');});}else{self.renderStaticContent('evri-widget-what-this-popup');}}});liObject.append(whatThisLink);ulObject.append(liObject);dividerSpan=jQuery('<span/>').addClass('evri-header-link-divider').text('|');liObject=jQuery('<li/>').append(dividerSpan);ulObject.append(liObject);liObject=jQuery('<li>');var sendFeedbackLink=jQuery('<a/>').attr('href','javascript:void(0);').text('Send Feedback').click(function(){if(!self.isContentLoaded){self.isContentLoaded=true;self.closeVideoPlayerIfOpen();jQuery('#'+self.EVRI_CONTENT_TRANSPARENT_DIV).css({'background-color':'#CCC','opacity':'0.8'});Evri.Widget.ContentRecommendation.Feedback.instantiate(self);self.trackReferral("link/Send Feedback/click",{});}});liObject.append(sendFeedbackLink);ulObject.append(liObject);headerDivLinksObject.append(ulObject);topDivObject.append(headerDivLinksObject);if(self.isPopupWidget){var closewidgetImage=jQuery('<img/>').attr('src',self.imagesHost+'close.png').addClass('evri-content-close-widget').hover(function(){jQuery(this).attr('src',self.imagesHost+'close_over.png');},function(){jQuery(this).attr('src',self.imagesHost+'close.png');}).click(function(){self.closeWidget();self.trackDHTML("contentWidget/Close/click",{});});topDivObject.append(closewidgetImage);}
mainDivObject.append(topDivObject);var contentLeftDiv=jQuery('<div/>').addClass('evri-content-left');if(self.IS_IE6){contentLeftDiv.css('margin-left','7px');}
var contentLeftTop=jQuery('<div/>').attr('id',self.EVRI_CONTENT_LEFT_TOP).addClass(self.EVRI_CONTENT_LEFT_TOP);var topRelatedArticles=jQuery('<span/>').addClass('span-title span-content');var topRelatedArticlesInnerSpan=jQuery('<span/>').attr('id',self.EVRI_CONETNT_TOP_RELATED_SPAN).text('Related News: ');var currentArticle=jQuery('<span/>').attr('id','currentArticle');topRelatedArticles.append(topRelatedArticlesInnerSpan,currentArticle);contentLeftTop.append(topRelatedArticles);var articlesDiv=jQuery('<div/>').attr('id',self.EVRI_CONTENT_ARTICLES).addClass('evri-content-articles-div');if(self.IS_IE6){}
contentLeftTop.append(articlesDiv);var seeFullProfileDiv=jQuery('<div/>').attr('id',self.EVRI_CONTENT_FULL_PROFILE).addClass('evri-see-fullprofile-div');if(self.IS_IE6){seeFullProfileDiv.css('float','none');}
contentLeftTop.append(seeFullProfileDiv);var articlesLoadingDiv=jQuery('<div/>').attr('id',self.EVRI_CONTENT_ARTICLES_LOADING).addClass('evri-content-left-top-center');contentLeftTop.append(articlesLoadingDiv);contentLeftDiv.append(contentLeftTop);var contentLeftBottomDiv=jQuery('<div/>').addClass(self.EVRI_CONTENT_LEFT_BOTTOM).attr('id',self.EVRI_CONTENT_LEFT_BOTTOM);var videoLabelSpan=jQuery('<span/>').addClass('span-title span-content').text('Video:').appendTo(contentLeftBottomDiv);var videosContainerDiv=jQuery('<div/>').attr('id',self.EVRI_CONTENT_VIDEOS).addClass('evri-content-videos');contentLeftBottomDiv.append(videosContainerDiv);var videoLoadingDiv=jQuery('<div/>').attr('id',self.EVRI_CONTENT_VIDEOS_LOADING).addClass('evri-content-left-bottom-center');contentLeftBottomDiv.append(videoLoadingDiv);var thumbnailDetail=jQuery('<a/>').attr({'id':self.EVRI_CONTENT_VIDEO_THUMBNAIL_DETAIL,'href':'javascript:void(0);'}).appendTo(contentLeftBottomDiv);var ytplayerDivObject=jQuery('<div/>').attr('id',self.EVRI_CONTENT_VIDEO_PLAYER);ytplayerDivObject.addClass('evri-content-inline-video-player');var playerControlsDivObject=jQuery('<div/>').attr('id',self.EVRI_CONTENT_PLAYER_CONTROLS).append('<span class="player-video-span">Video:</span>');var videoCloseLink='<a class="video-close-link" href="javascript:void(0);"'
+'OnClick="javascript:closeVideo();">Close</a>';playerControlsDivObject.append(videoCloseLink);ytplayerDivObject.append(playerControlsDivObject);contentLeftBottomDiv.append(ytplayerDivObject);contentLeftDiv.append(contentLeftBottomDiv);mainDivObject.append(contentLeftDiv);var contentRightDiv=jQuery('<div/>').addClass(self.EVRI_CONTENT_RIGHT).attr('id',self.EVRI_CONTENT_RIGHT);var contentRightTopDiv=jQuery('<div/>').addClass(self.EVRI_CONTENT_RIGHT_TOP).attr('id',self.EVRI_CONTENT_RIGHT_TOP).append(jQuery('<span/>').addClass('span-title span-content').text('Focus On:'));ulObject=jQuery('<ul/>').attr('id','rightlink');contentRightTopDiv.append(ulObject);contentRightDiv.append(contentRightTopDiv);var contentRightBottomDiv=jQuery('<div/>').addClass('evri-content-right-bottom').attr('id',self.EVRI_CONTENT_RIGHT_BOTTOM).append(jQuery('<span/>').addClass('span-title span-content').text('Connections:'));var connectionDiv=jQuery('<div/>').attr('id',self.DIVNAME_CONNECTIONGRAPH).addClass('connection-graph');contentRightBottomDiv.append(connectionDiv);var connectionLoadingDiv=jQuery('<div/>').attr('id',self.EVRI_CONTENT_CONNECTIONS_LOADING).addClass('evri-content-right-bottom-center evri-entity-section-message').html(self.EVRI_CONTENT_CONNECTION_DEFAULT_MESSAGE);contentRightBottomDiv.append(connectionLoadingDiv);contentRightDiv.append(contentRightBottomDiv);mainDivObject.append(contentRightDiv);mainDivObject.append(self.getEvriHelpPage());var feedbackFormcontainer=jQuery('<span/>').attr('id',self.EVRI_WIDGET_FEEDBACK_FORM_CONTAINER).css('display','none');mainDivObject.append(feedbackFormcontainer);return mainDivObject;};fillTopArticles=function(articleList,success){var self=this;if(jQuery('#'+self.EVRI_CONTENT_VIDEO_PLAYER).is(':visible')){self.closeVideo();}
var articlesContainer=jQuery('#'+self.EVRI_CONTENT_LEFT_TOP);var topArticles=articlesContainer.find('#'+
self.EVRI_CONTENT_ARTICLES);var count=1;if(success==true&&(!articleList||articleList.articles.length==0)){self.loadWidgetMessage(self.EVRI_CONTENT_ARTICLES_LOADING,self.ARTICLES_NOT_FOUND,self.CSS_LOADING_MESSAGE_DIV);return false;}
topArticles.empty().show();self.showHideDiv(self.EVRI_CONTENT_ARTICLES_LOADING,false);var articleAuthor;var articlePublished;var articleTitle;var articleContent;var articleTitleWithoutTruncaton;jQuery.each(articleList.articles,function(index,article){if(count>self.NUMBER_TOP_ARTICLE_SHOW){return false;}
articleTitleWithoutTruncaton='';articleAuthor=article.author;articlePublished=article.published;articleTitleWithoutTruncaton=article.title;articleTitle=self.truncateString(article.title,self.ARTICLE_TITLE_LENGTH);article.title=articleTitle;articleTitle=article.getHighlightedTitle('evri-bold-tag',{});articleContent="";if(article.content!==undefined){articleContent=self.trimArticleContent(article,30,{'font-family':'Lucida Grande, Tahoma, Myriad, Arial','font-weight':'normal','font-size':'11px','width':'275px','line-height':'13px'});}
article.content=articleContent;articleContent=article.getHighlightedContent('evri-bold-tag',{});var articleSource=article.link.href;articlePublished=article.getRelativePublicationDate();if(articlePublished==''){articlePublished='';}
if(articleAuthor===undefined||articleAuthor==''){articleAuthor=articleSource.match(/:\/\/(.[^/]+)/)[1];}
if(articlePublished==''){articlePublished=articleAuthor;}else{articlePublished=articlePublished+" | "+articleAuthor;}
var articlePara=jQuery('<p/>').addClass('evri-content-aricles-para');var articleTitleSpan=jQuery('<span/>');var articleTitleLink=jQuery('<a/>').attr({'target':'_blank','href':articleSource,'title':articleTitleWithoutTruncaton}).append(self.htmlEscape(articleTitle)).click(function(){self.trackReferral("article/title/click",{index:index});});articleTitleSpan.append(articleTitleLink);var contentDiv=jQuery('<div/>').addClass('evri-content-article-content-div').append(self.htmlEscape(articleContent));articlePublished=self.truncateString(articlePublished,self.EVRI_ARTICLE_SOURCE_LENGTH);var articleSourceSpan=jQuery('<span/>').addClass('day-source').text(articlePublished);var dividerDiv=jQuery('<div/>').addClass('div-divider');articlePara.append(articleTitleSpan,contentDiv,articleSourceSpan,dividerDiv);topArticles.append(articlePara);count++;});};htmlEscape=function(text){if(text){text=text.split("<").join("&lt;").split(">").join("&gt;");text=text.replace(/&lt;evri-bold-tag&gt;/g,'<em class="emphasize">').replace(/&lt;\/evri-bold-tag&gt;/g,'</em>');}
return text;};fillVideos=function(videoList,success){var self=this;var videosContainer=jQuery('#'+self.EVRI_CONTENT_LEFT_BOTTOM);var topVideos=videosContainer.find('#'+self.EVRI_CONTENT_VIDEOS);var count=1;if(success==true&&(!videoList||videoList.videos.length==0)){self.loadWidgetMessage(self.EVRI_CONTENT_VIDEOS_LOADING,self.VIDEOS_NOT_FOUND,self.CSS_LOADING_MESSAGE_DIV);self.showhideProgressDialog(false,false);return false;}
topVideos.empty().show();topVideos.css('visibility','hidden');var totalThumbnailShowing=self.NUMBER_VIDEO_SHOW;if(videoList.videos.length<totalThumbnailShowing){totalThumbnailShowing=videoList.videos.length;}
var videoTitle,videoDuration,videoThumbnails,videoTitle;var newVideoDiv,imageLink,imgThumbnail,playButton,playButtonDiv;var thumbnailLoadedCount=0,thumbnailURL;var firstThumbnailTitle='';jQuery.each(videoList.videos,function(index,video){if(count>self.NUMBER_VIDEO_SHOW){return false;}
var videoTitle=video.title;videoDuration=video.duration;videoThumbnails=video.thumbnails;jQuery.each(video.thumbnails,function(imageIndex,image){videoTitle=videoTitle+" "+image.time;thumbnailURL=image.url;newVideoDiv=jQuery('<div/>').click(function(){if(!self.isContentLoaded){self.playVideo(video.url,index);return false;}}).hover(function(){self.showVideoThumbnailDetail(escape(videoTitle),index);},function(){self.hideVideoThumbnailDetail(index);});if(index==0){firstThumbnailTitle=videoTitle;newVideoDiv.addClass('div-video-wrapper-first')}else{newVideoDiv.addClass('div-video-wrapper')}
imageLink=jQuery('<a/>').attr('href','javascript:void(0);');imgThumbnail=jQuery('<img/>').addClass('video-thumbnail');imageLink.append(imgThumbnail);playButtonDiv=jQuery('<div/>').attr('id','play_button_'+index).addClass('div-play').css('text-align','center');playButton=jQuery('<img/>').attr('src',self.imagesHost+'play-icon.gif').addClass('play-button');playButtonDiv.append(playButton);newVideoDiv.append(imageLink,playButtonDiv);return false;});topVideos.append(newVideoDiv);imgThumbnail.load(function(){thumbnailLoadedCount++;if(thumbnailLoadedCount==totalThumbnailShowing){self.resizeThumbnail(topVideos,'.video-thumbnail',self.EVRI_THUMBNAIL_WIDTH,self.EVRI_THUMBNAIL_HEIGHT);self.showHideDiv(self.EVRI_CONTENT_VIDEOS_LOADING,false);self.showhideProgressDialog(false,false);self.showVideoThumbnailDetail(escape(firstThumbnailTitle));}}).attr('src',thumbnailURL);count++;});self.setVideoPlayerTop();};resetWizard=function(complete){var self=this;if(complete){jQuery('#'+self.EVRI_CONTENT_EMBEDDED_WIDGET_WRAPPER).empty();}else{jQuery('#'+self.EVRI_CONTENT_VIDEOS).empty();jQuery('#'+self.EVRI_CONTENT_ARTICLES).empty();}};showhideProgressDialog=function(complete,show){var self=this;if(complete){if(show){jQuery('#'+self.EVRI_CONTENT_EMBEDDED_WIDGET_WRAPPER).show();jQuery('#'+self.EVRI_CONTENT_LOADING_WIDGET).hide();}else{jQuery('#'+self.EVRI_CONTENT_LOADING_WIDGET).hide();jQuery('#'+self.EVRI_CONTENT_EMBEDDED_WIDGET_WRAPPER).show();}}else{if(show){jQuery('#'+self.EVRI_CONTENT_VIDEO_THUMBNAIL_DETAIL).hide();self.loadWidgetMessage(self.EVRI_CONTENT_ARTICLES_LOADING,self.EVRI_ARTICLES_LOADING,self.CSS_LOADING_MESSAGE_DIV);self.loadWidgetMessage(self.EVRI_CONTENT_VIDEOS_LOADING,self.EVRI_VIDEOS_LOADING,self.CSS_LOADING_MESSAGE_DIV);}else{}}};playVideo=function(videoSource,index){var self=this;if(self.videoPlayinProcess)return false;var objectYTPlayer=document.getElementById("objytplayer");var videoSourceToCompare=videoSource+'&autoplay=1';if(objectYTPlayer&&videoSourceToCompare==objectYTPlayer.getAttribute("data")){return false;}
var previousPlayButton=jQuery('#play_button_'+self.videoPlayInProgressNumber);if(previousPlayButton.length!=0){self.hidePlayButton(self.videoPlayInProgressNumber);}
self.videoPlayInProgressNumber=index;self.videoPlayinProcess=true;var videoElm='<object id="objytplayer" type="application/x-shockwave-flash" style="width:311px; height:220px; top:25px; left:5px; position:absolute;" data="'
+videoSource+'&autoplay=1"><param name="movie" value="'+videoSource
+'&autoplay=1" /></object>';var videoPlayerDiv=jQuery('#'+self.EVRI_CONTENT_VIDEO_PLAYER).show();var temp=jQuery('#'+self.EVRI_CONTENT_PLAYER_CONTROLS).clone();videoPlayerDiv.empty().append(temp);jQuery('a#goto-youtube').attr('href',videoSource);var upperTop=videoPlayerDiv.attr('ytPlayerTop');var videoPlayerHeight=videoPlayerDiv.attr('ytPlayerHeight');videoPlayerDiv.animate({top:upperTop,height:videoPlayerHeight},self.ANIMATION_TIMEOUT,null,function(){videoPlayerDiv.append(videoElm);self.videoPlayinProcess=false;self.trackDHTML("video/thumbnail/click",{index:index});});};closeVideo=function(){var self=this;self.hidePlayButton(self.videoPlayInProgressNumber);self.videoPlayInProgressNumber=-1;var temp=jQuery("div#"+self.EVRI_CONTENT_PLAYER_CONTROLS).clone();var videoPlayerDiv=jQuery('#'+self.EVRI_CONTENT_VIDEO_PLAYER);videoPlayerDiv.animate({top:'0px',height:"23px"},self.ANIMATION_TIMEOUT,null,function(){videoPlayerDiv.find('.flash-div').remove();videoPlayerDiv.hide();self.trackDHTML("video/close/click",{});});videoPlayerDiv.html(temp);};fillProfileLink=function(entity,pairEntity){var self=this;var fullProfilePara=jQuery('#'+self.EVRI_CONTENT_FULL_PROFILE).empty().show();if(entity.href!=""){var fullProfileSpan;var fullProfileEntity;var topRelatedSpan=jQuery('#'+self.EVRI_CONETNT_TOP_RELATED_SPAN).empty();var topRelatedLink=jQuery('<a/>').text('Related News:').attr('href','javascript:void(0);').addClass('evri-top-related-articles-link').click(function(){if(self.apiCallInProgress()){return false;}
topRelatedSpan.empty().text('Related News:');self.activeEntity=undefined;jQuery('#currentArticle').empty();jQuery('#'+self.EVRI_CONTENT_FULL_PROFILE).hide();self.showLoadingMessages(false);jQuery('#'+self.EVRI_CONTENT_CONNECTIONS_LOADING).empty().html(self.EVRI_CONTENT_CONNECTION_DEFAULT_MESSAGE).show();var jsapiHelper=new Evri.Widget.ContentRecommendation.JSAPIHelper();jsapiHelper.displayGraph(self.evriContentGraph,self);return false;}).appendTo(topRelatedSpan);if(!pairEntity){fullProfileSpan=jQuery('<span/>').text('See full profile: ').addClass('day-source');var entityName=self.truncateString(entity.name,(2*self.SEE_FULLPROFILE_ENTITY_NAME_LENGTH));fullProfileEntity=jQuery('<a/>').attr({'target':'_blank','href':entity.portalURI,'title':entity.name}).text(entityName);fullProfilePara.append(fullProfileSpan,fullProfileEntity);entityName=self.trimLongText(entity.name,180,{'font-weight':'normal','font-size':'12px'});jQuery('#currentArticle').text(' '+entityName).attr('title',entity.name);;}
if(pairEntity){var firstEntityLength=self.SEE_FULLPROFILE_ENTITY_NAME_LENGTH;var secondEntityLength=self.SEE_FULLPROFILE_ENTITY_NAME_LENGTH;if(entity.name.length<firstEntityLength){firstEntityLength=entity.name.length;secondEntityLength+=(self.SEE_FULLPROFILE_ENTITY_NAME_LENGTH-firstEntityLength)}
if(pairEntity.name.length<self.SEE_FULLPROFILE_ENTITY_NAME_LENGTH){secondEntityLength=pairEntity.name.length;firstEntityLength+=(self.SEE_FULLPROFILE_ENTITY_NAME_LENGTH-secondEntityLength)}
var mainEntityName=self.trimLongText(entity.name,75,{'font-weight':'normal','font-size':'12px'});var selectedEntityName=self.trimLongText(pairEntity.name,70,{'font-weight':'normal','font-size':'12px'});fullProfileSpan=jQuery('<span/>').text('See full profile: ');fullProfileEntity=jQuery('<a/>').attr({'target':'_blank','href':entity.portalURI,'title':entity.name}).text(mainEntityName);var fullProfileRelatedEntity=jQuery('<a/>').attr({'target':'_blank','href':pairEntity.portalURI,'title':pairEntity.name}).text(selectedEntityName);var entitySeparator=jQuery('<span/>').text(' | ').css('color','#8d8d8d');fullProfilePara.append(fullProfileSpan,fullProfileEntity,entitySeparator,fullProfileRelatedEntity);var relatedEntityName=mainEntityName+' > '+selectedEntityName;jQuery('#currentArticle').text(' '+relatedEntityName).attr('title',entity.name+' > '+pairEntity.name);}}};fillEntities=function(graph,success){var self=this;jQuery('#rightlink').empty();if(success==true&&((!graph||graph.entities.length==0)&&(!self.entityObjectArray||self.entityObjectArray.length==0))){self.loadWidgetMessage(self.EVRI_CONTENT_RIGHT_TOP,self.ENTITIES_NOT_FOUND,self.CSS_LOADING_MESSAGE_DIV,true);return false;}
jQuery('#'+self.EVRI_CONTENT_RIGHT_TOP).find('.'+self.CSS_LOADING_MESSAGE_DIV).remove();if(self.entityObjectArray!=null&&self.entityObjectArray.length>0){for(var count=0;count<self.entityObjectArray.length;count++){self.renderEntities(self.entityObjectArray[count]);}}else{var count=0;jQuery.each(graph.entities,function(index,entity){if(count>=self.NUMBER_ENTITIES_SHOW){return false;}
if(entity.known){if(count==0){}
self.renderEntities(entity);self.entityObjectArray[count]=entity;count++;}});}
if(count==0){self.loadWidgetMessage(self.EVRI_CONTENT_RIGHT_TOP,self.ENTITIES_NOT_FOUND,self.CSS_LOADING_MESSAGE_DIV,true);}};renderEntities=function(entity){var self=this;var entityName=entity.name;entityName=self.truncateString(entityName,self.ENTITY_NAME_LENGTH);var entityContainer=jQuery('ul#rightlink');if(self.activeEntity&&self.activeEntity.name==entity.name){var selectedEntitySpan=jQuery('<li/>').append(jQuery('<span/>').text(entityName).attr('title',entity.name));entityContainer.append(selectedEntitySpan);}else{var entityLink=jQuery('<a/>').attr({'href':'javascript:void(0);','title':entity.name}).text(entityName).click(function(){if(self.apiCallInProgress()){return false;}
self.activeEntity=entity;if(jQuery('#'+self.EVRI_CONTENT_VIDEO_PLAYER).is(":visible")){self.closeVideo();}
self.showLoadingMessages(true);var jsapiHelper=new Evri.Widget.ContentRecommendation.JSAPIHelper();jsapiHelper.getRelatedEntities(entity,true,self);self.trackDHTML("FocusOn/entity/click",{});return false;});var entityLinkContainer=jQuery('<li/>').append(entityLink);entityContainer.append(entityLinkContainer);}};apiCallInProgress=function(){var self=this;if(self.articlesApiInProgress||self.entityApiInProgress||self.entityRelationsApiInProgress||self.relatedVideosApiInProgress||self.widgetApiInProgress){return true;}
return false;};hideVideoThumbnailDetail=function(index){var self=this;if(self.videoPlayInProgressNumber!=index){self.hidePlayButton(index);}};showVideoThumbnailDetail=function(videoTitle,index){var self=this;videoTitle=unescape(videoTitle);videoTitle=videoTitle.toLowerCase();var thumbnailDetail=jQuery('#'+self.EVRI_CONTENT_VIDEO_THUMBNAIL_DETAIL).show();thumbnailDetail.empty();videoTitle=self.truncateString(videoTitle,self.THUMBNAIL_TITLE_LENGTH);thumbnailDetail.append(videoTitle);if(self.videoPlayInProgressNumber!=index){self.showPlayButton(index);}};truncateString=function(stringToTruncate,lengthRequired){var self=this;if(stringToTruncate!==undefined&&stringToTruncate.length>lengthRequired){stringToTruncate=stringToTruncate.substr(0,lengthRequired)+"...";}
return stringToTruncate;};removePartialWord=function(truncatedString){var self=this;var stringToTruncate=jQuery.trim(truncatedString).replace(/(\s*\w*)$/,"...");if(stringToTruncate.length<4){stringToTruncate=truncatedString+"...";}
return stringToTruncate;};loadWidgetMessage=function(parentDivId,message,className,isEntity){var self=this;var parentDiv=jQuery('#'+parentDivId);var messageDivTopMargin=(parentDiv.height()-12)/2;if(isEntity!=true){parentDiv.empty();}else{if(self.isIE()){messageDivTopMargin=messageDivTopMargin-32;}else{messageDivTopMargin=messageDivTopMargin-16;}
parentDiv.find("div."+self.CSS_LOADING_MESSAGE_DIV).remove();}
var messageDiv=jQuery('<div/>').addClass(className).text(message).css('margin-top',messageDivTopMargin);parentDiv.append(messageDiv).show();};closeWidget=function(){var self=this;jQuery.facebox.close();return false;};checkWidgetExist=function(){return jQuery('#'+self.EVRI_CONTENT_EMBEDDED_WIDGET_WRAPPER).find('#'+self.EVRI_CONTENT_MAIN_DIV).length!=0;};isIE=function(){var self=this;if(jQuery.browser.msie){return true;}else{return false;}};evriAboutUs=function(){var self=this;window.open(self.EVRI_WIDGET_ABOUT_US);};getEvriHelpPage=function(){var self=this;var headerPopupDiv=jQuery('<div/>').attr('id',self.EVRI_WIDGET_HEADER_POPUP).addClass('evri-widget-what-this-popup');return headerPopupDiv;};closeStaticPopup=function(containerClass){var self=this;var whatThisDiv=jQuery('#'+self.EVRI_CONTENT_MAIN_DIV).find('.'+containerClass);var whatThisDivTop=-1*whatThisDiv.height();whatThisDiv.animate({top:whatThisDivTop},self.ANIMATION_TIMEOUT-50,null,function(){whatThisDiv.hide();self.trackDHTML("sendFeedback/close/click",{});});var transparentDiv=jQuery('#'+self.EVRI_CONTENT_TRANSPARENT_DIV);var transparentDivTop=-1*transparentDiv.height();transparentDiv.animate({top:transparentDivTop},400,null,function(){jQuery('#'+self.EVRI_CONTENT_TRANSPARENT_DIV).css({'background-color':'#ffffff','opacity':'0.5','top':'0px'}).hide();});self.isContentLoaded=false;};renderStaticContent=function(containerClass,containerTop){var self=this;self.isContentLoaded=true;self.closeVideoPlayerIfOpen();var transparentDiv=jQuery('#'+self.EVRI_CONTENT_TRANSPARENT_DIV);transparentDiv.css({'background-color':'#CCC','opacity':'0.8'});var mainDiv=jQuery('#'+self.EVRI_CONTENT_MAIN_DIV);transparentDiv.height('0px');var transparentDivTop=-1*mainDiv.height();var transparentDivHeight=mainDiv.height();transparentDiv.css('top',transparentDivTop);transparentDiv.show();transparentDiv.animate({top:"0px",height:transparentDivHeight},400,null,null);self.showEvriHelpText(containerClass,containerTop);};showEvriHelpText=function(containerClass,containerTop){var self=this;var whatThisDiv=jQuery('.'+containerClass);var whatThisDivHeight=whatThisDiv.height();whatThisDiv.css('top',-1*whatThisDivHeight).show();if(!containerTop){containerTop='51px';}
whatThisDiv.animate({top:containerTop},400,null,function(){self.trackDHTML("link/What's this/click",{});});};createPopoverWidget=function(){var self=this;popupWidget=jQuery('<div/>').attr("id",self.EVRI_CONTENT_EMBEDDED_WIDGET_WRAPPER).addClass('evri-content-popup-widget-wrapper').css({'font-family':'Lucida Grande, Tahoma, Myriad, Arial','z-index':'99999','text-align':'left','line-height':'normal','height':'412px','width':'531px','display':'block','position':'relative'});jQuery.facebox(popupWidget);jQuery('#facebox').find('.footer').hide();jQuery(window).resize(function(){});};setAnalyticsLogger=function(){var self=this;self.analyticsLogger=new Evri.Widget.Analytics("ContentWidget");self.trackDHTML("Instantiate");};trackDHTML=function(logStatement,options){var self=this;if(self.EVRI_ANALYTICS_LOGGER_STATUS){self.analyticsLogger.trackDHTML(logStatement,options);}};trackReferral=function(logStatement,options){var self=this;if(self.EVRI_ANALYTICS_LOGGER_STATUS){self.analyticsLogger.trackReferral(logStatement,options);}};getContentFor=function(contentToAnalyze,forURI){var self=this;self.isContentLoaded=false;self.videoPlayInProgressNumber=-1;var embeddedWidgetDiv=jQuery('#'+self.EVRI_CONTENT_EMBEDDED_WIDGET_WRAPPER).empty();var loadingWidget=self.createWidgetStatusDialog();embeddedWidgetDiv.append(loadingWidget);jQuery('#'+self.EVRI_CONTENT_LOADING_WIDGET).show();self.setWidgetPosition('facebox');var contentLocation=document.location.href+"?randid="+self.getUniqueId();var jsapiHelper=new Evri.Widget.ContentRecommendation.JSAPIHelper();if(forURI){jsapiHelper.getGraphForURL(contentToAnalyze,self,true);}else{jsapiHelper.loadContentForWidget(contentToAnalyze,contentLocation,self,true);}};self.renderWidget=function(){var self=this;var embeddedWidgetDiv=jQuery('#'+self.EVRI_CONTENT_EMBEDDED_WIDGET_WRAPPER);if(embeddedWidgetDiv.length>0){embeddedWidgetDiv.empty();}
var contentToAnalyze=self.getDocText();self.setupWidget(contentToAnalyze,false);};self.renderWidgetForGivenContent=function(contentToAnalyze){self.setupWidget(contentToAnalyze,false);};self.getGraphForURL=function(url){self.setupWidget(url,true);};self.setupWidget=function(contentToAnalyze,forURI){if(self.isIE()&&jQuery.browser.msie6){self.IS_IE6=true;}
self.activeEntity=undefined;self.setAnalyticsLogger();jQuery('#'+self.EVRI_CONTENT_EMBEDDED_WIDGET_WRAPPER).remove();var containerDiv=jQuery('#evri-content-widget-container-div');if(containerDiv&&containerDiv.attr('widget-type')=='inline'){self.isPopupWidget=false;var embeddedWidgetWrapperDiv=jQuery('<div/>').attr('id',self.EVRI_CONTENT_EMBEDDED_WIDGET_WRAPPER);containerDiv.append(embeddedWidgetWrapperDiv);}else{self.createPopoverWidget();}
self.getContentFor(contentToAnalyze,forURI);};loadConnectionGraph=function(entityList,connectionForEntity,graph){var self=this;var connectionForIndex=0;var count=0;var entityDataList=[];var entityType;self.showHideDiv(self.EVRI_CONTENT_CONNECTIONS_LOADING,false);self.showHideDiv(self.DIVNAME_CONNECTIONGRAPH,true);var entityConnections=new Evri.Widget.ContentRecommendation.Connections();if(entityList&&entityList.length!=0)
{jQuery.each(entityList,function(index,entity){if(count>=self.NUMBER_ENTITIES_SHOW){return false;}
if(entity.known){entityType=entityConnections.getEntityType(entity.href);entityDataList[count]={name:entity.name,href:entity.href,entityType:entityType,portalURI:Evri.API.Utilities.portalURIForPath(entity.href)};if(connectionForEntity.href==entity.href){connectionForIndex=count;}
count++;}});if(connectionForIndex>0){var tempEntity=entityDataList[connectionForIndex];entityDataList[0]=connectionForEntity;entityDataList[connectionForIndex]=tempEntity;}
entityConnections.loadConnections(entityDataList,connectionForEntity,count,graph,self);}};closeVideoPlayerIfOpen=function(){var self=this;if(jQuery('#'+self.EVRI_CONTENT_VIDEO_PLAYER).is(":visible")){self.closeVideo();}};setVideoPlayerTop=function(){var self=this;var mainDiv=self.mainDiv;var ytplayerDivObject=jQuery('#'+self.EVRI_CONTENT_VIDEO_PLAYER);var contentLeftTopDiv=jQuery('#'+self.EVRI_CONTENT_LEFT_TOP);var top=-1*contentLeftTopDiv.height()+'px';var height=contentLeftTopDiv.height()+20+'px';ytplayerDivObject.attr('ytPlayerTop',top);ytplayerDivObject.attr('ytPlayerHeight',height);ytplayerDivObject.css('top','0px');ytplayerDivObject.css('width',contentLeftTopDiv.width()-2);};showLoadingMessages=function(showConnectionMessage){var self=this;self.showhideProgressDialog(false,true);jQuery('#'+self.EVRI_CONTENT_VIDEOS).empty();jQuery('#'+self.EVRI_CONTENT_ARTICLES).empty();jQuery('#'+self.DIVNAME_CONNECTIONGRAPH).empty();jQuery('#'+self.EVRI_CONTENT_VIDEO_THUMBNAIL_DETAIL).hide();self.loadWidgetMessage(self.EVRI_CONTENT_ARTICLES_LOADING,self.EVRI_ARTICLES_LOADING,self.CSS_LOADING_MESSAGE_DIV);self.loadWidgetMessage(self.EVRI_CONTENT_VIDEOS_LOADING,self.EVRI_VIDEOS_LOADING,self.CSS_LOADING_MESSAGE_DIV);if(showConnectionMessage){self.loadWidgetMessage(self.EVRI_CONTENT_CONNECTIONS_LOADING,self.EVRI_CONNECTIONS_LOADING,self.CSS_LOADING_MESSAGE_DIV);}else{self.loadWidgetMessage(self.EVRI_CONTENT_RIGHT_TOP,self.EVRI_ENTITIES_LOADING,self.CSS_LOADING_MESSAGE_DIV,true);}};showHideDiv=function(DivId,isShow){var self=this;if(isShow){jQuery('#'+DivId).show();}else{jQuery('#'+DivId).hide();}};resizeThumbnail=function(parentDiv,thumbnailClass,maxWidth,maxHeight){var self=this;var thumbnail;var thumbnailWidth=0;var thumbnailHeight=0;parentDiv.find(thumbnailClass).each(function(){thumbnail=jQuery(this);thumbnailWidth=thumbnail.width();if(thumbnail.width()>maxWidth){thumbnail.width(maxWidth);thumbnail.css('height','auto');while(thumbnail.height()>maxHeight){thumbnailWidth--;thumbnail.width(thumbnailWidth);}}else if(thumbnail.height()>maxHeight){var thumbnailHeight=thumbnail.height();thumbnail.height(maxHeight);thumbnail.css('width','auto');while(thumbnail.width()>maxWidth){thumbnailHeight--;thumbnail.height(thumbnailHeight);}}
thumbnailHeight=thumbnail.height();if(thumbnailHeight<maxHeight){var marginTop=(maxHeight-thumbnailHeight)/2;if(self.isIE()&&thumbnailClass=='expanded-image'){marginTop-=20;}
thumbnail.css('margin-top',marginTop);}});parentDiv.css('visibility','visible');};getUniqueId=function()
{var dateObject=new Date();var uniqueId="_"+
dateObject.getFullYear()+''+
dateObject.getMonth()+''+
dateObject.getDate()+''+
dateObject.getTime();return uniqueId;};showPlayButton=function(index){var self=this;var thumbnailTransparentDiv=jQuery('#play_button_'+index).show();var thumbnailTransparentDivParent=thumbnailTransparentDiv.parent();thumbnailTransparentDiv.css('top',thumbnailTransparentDivParent.height());var divHeight=20;var divTop=parseInt(thumbnailTransparentDivParent.height())-divHeight;thumbnailTransparentDiv.animate({top:divTop,height:divHeight},100,null,null);};hidePlayButton=function(index){var self=this;var thumbnailTransparentDiv=jQuery('#play_button_'+index).show();var thumbnailTransparentDivParent=thumbnailTransparentDiv.parent();var divHeight=20;var divTop=parseInt(thumbnailTransparentDivParent.height());thumbnailTransparentDiv.animate({top:divTop,height:divHeight},100,null,null);};getDocText=function(){var self=this;self.finalTextContent="";try{self.parseTag(document.body);}catch(ex){self.logError("ex:  "+ex.message);}
return self.finalTextContent;};parseTag=function(tagToParse){var self=this;var index;if(tagToParse.nodeType==self.NODETYPE_TEXTNODE){if(!self.checkAndAppendAnchorTextProximity(tagToParse)){self.appendData(tagToParse.nodeValue);}}else if(tagToParse.nodeType==self.NODETYPE_ELEMENT){var tagName=tagToParse.tagName.toLowerCase();if(tagName=='a'){self.parseAnchorTag(tagToParse);}
else if(typeof self.ignoreTagsList[tagName]!='undefined'){return;}
else{self.recurseForChildNodes(tagToParse);}}};recurseForChildNodes=function(parentTag){var self=this;if(parentTag.nodeType==self.NODETYPE_ELEMENT&&parentTag.childNodes.length>0){var childNodes=parentTag.childNodes;var index;for(index=0;index<childNodes.length;index++){if(childNodes[index].parentNode==parentTag){self.parseTag(childNodes[index]);}}}};checkAndAppendAnchorTextProximity=function(tagToParse){var self=this;try{if(tagToParse.nodeType==self.NODETYPE_TEXTNODE){var parentNode=tagToParse.parentNode;if(parentNode!=='undefined'&&parentNode!=='null'){if(parentNode.tagName.toLowerCase()=='a'){var anchorTagToParse=parentNode;var anchorParentNode=anchorTagToParse.parentNode;if(anchorParentNode!=='undefined'&&anchorParentNode!=='null'){var anchorParentNodeTagName=anchorParentNode.tagName.toLowerCase();if(typeof self.allowedAnchorProximityTags[anchorParentNodeTagName]!='undefined'){self.appendDataWithoutApplyingRules(tagToParse.nodeValue);return true;}}}}}
return false;}catch(ex){self.logError(ex.message);return false;}};parseAnchorTag=function(anchorTagToParse){var self=this;try{if(self.shouldParseAnchorTag(anchorTagToParse)){self.recurseForChildNodes(anchorTagToParse);}}catch(ex){self.logError("ex:  "+ex.message);}};shouldParseAnchorTag=function(anchorTag){var self=this;var anchorDestinationURL=anchorTag.href;if(typeof anchorDestinationURL=='undefined'||anchorDestinationURL==''){return true;}
if(self.isAnchorTagHrefRelevant(anchorDestinationURL)){return true;}
return false;};isAnchorTagHrefRelevant=function(hrefToCheck){var self=this;if(hrefToCheck!=''&&self.isIntraDomainReferenceURL(hrefToCheck)){return true;}
return false;};isIntraDomainReferenceURL=function(urlToCheck){var currentDomain=window.location.hostname;if(currentDomain!=''){if(urlToCheck.indexOf("http")!=-1||urlToCheck.indexOf("https")!=-1||urlToCheck.indexOf("www")!=-1){if(urlToCheck.indexOf(currentDomain)==-1){return false;}}}
return true;};appendData=function(rawString){var self=this;var filteredString=self.applyStringRules(rawString);if(filteredString==''||filteredString.length==0||filteredString==' '){return;}
self.finalTextContent+=filteredString+self.TEXTSEPERATOR_STRING;};appendDataWithoutApplyingRules=function(rawString){var self=this;if(rawString!=''&&rawString.length!=0){self.finalTextContent+=rawString+self.TEXTSEPERATOR_STRING;}};applyStringRules=function(rawText){var self=this;var filteredText=rawText;if(rawText.split(' ').length<self.MINIMUM_WORDLENGTH){return"";}
return filteredText;};initWidgetForBookmarklet=function(){var self=this;var contentSelector='h1, p';var $doc=jQuery(document.body);self.renderWidgetForGivenContent($doc.find(contentSelector).mergeHtml(),window.location.href+"#doc-"+self.getUniqueId());return false;};trimLongText=function(oldText,textWidth,spanCSS){var self=this;var span=jQuery("#stringWidth").css(spanCSS).empty();span.html(oldText);var initialWidth=span.get(0).offsetWidth;if(initialWidth<textWidth){return oldText;}else{oldText=oldText.substr(0,oldText.length-3);for(var cntr=oldText.length;cntr>=0;cntr--){span.empty();var newText=oldText.substr(0,cntr);span.html(newText);initialWidth=span.get(0).offsetWidth;if(initialWidth<textWidth){return newText+"...";}}}};trimArticleContent=function(article,textHeight,divCSS){var self=this;var contentWithoutHighlight=article.content;var div=jQuery("#evri-article-content-truncation-div").css(divCSS).empty();div.html(self.htmlEscape(article.getHighlightedContent('evri-bold-tag',{})));var initialHeight=div.get(0).offsetHeight;if(initialHeight<textHeight){div.empty();return contentWithoutHighlight;}
else{for(var cntr=contentWithoutHighlight.length;cntr>=0;cntr--){div.empty();var newText=contentWithoutHighlight.substr(0,cntr);article.content=newText;div.html(self.htmlEscape(article.getHighlightedContent('evri-bold-tag',{})));var currentHeight=div.get(0).offsetHeight;if(currentHeight<textHeight){div.empty();return self.removePartialWord(newText);}}}};renderArticlesError=function(jsapiHelper,graph,reLoadWidget,contentToAnalyze){var self=this;var messageDiv=self.getErrorDiv(self.EVRI_CONTENT_ARTICLES_LOADING,false)
var tryAgainLink=messageDiv.find('a');if(reLoadWidget){var contentLocation=document.location.href+"?randid="+self.getUniqueId();tryAgainLink.click(function(){self.showLoadingMessages(false);jsapiHelper.loadContentForWidget(contentToAnalyze,contentLocation,self,false);return false;});}else{tryAgainLink.click(function(){jsapiHelper.getRelatedArticles(graph,true,self);return false;});}};renderVideosError=function(jsapiHelper,graph,reLoadWidget,contentToAnalyze){var self=this;var messageDiv=self.getErrorDiv(self.EVRI_CONTENT_VIDEOS_LOADING,false);var tryAgainLink=messageDiv.find('a');if(reLoadWidget){var contentLocation=document.location.href+"?randid="+self.getUniqueId();tryAgainLink.click(function(){self.showLoadingMessages(false);jsapiHelper.loadContentForWidget(contentToAnalyze,contentLocation,self,false);return false;});}else{tryAgainLink.click(function(){jsapiHelper.getRelatedVideos(graph,self);return false;});}};renderEntitesError=function(jsapiHelper,entity,reLoadWidget,contentToAnalyze){var self=this;var messageDiv=self.getErrorDiv(self.EVRI_CONTENT_RIGHT_TOP,true);var tryAgainLink=messageDiv.find('a');tryAgainLink.click(function(){var contentLocation=document.location.href+"?randid="+self.getUniqueId();self.showLoadingMessages(false);jsapiHelper.loadContentForWidget(contentToAnalyze,contentLocation,self,false);return false;});};renderConnectionsError=function(jsapiHelper,entity,reLoadWidget,contentToAnalyze){var self=this;var messageDiv=self.getErrorDiv(self.EVRI_CONTENT_CONNECTIONS_LOADING,false);var tryAgainLink=messageDiv.find('a');tryAgainLink.click(function(){jsapiHelper.getEntityRelations(entity,self);return false;});};getErrorDiv=function(parentDivId,isEntity){var self=this;var evriAPItimeoutMessage='There was an error loading this section. ';var parentDiv=jQuery('#'+parentDivId)
var messageDivTopMargin=0;if(!isEntity){parentDiv.empty();}else{messageDivTopMargin=48;parentDiv.find("div."+self.CSS_LOADING_MESSAGE_DIV).remove();}
var tryAgainLink=jQuery('<a/>').attr('href','javascript:void(0);').text('Click here to try again.');var messageDiv=jQuery('<div/>').addClass(self.CSS_LOADING_MESSAGE_DIV).append(evriAPItimeoutMessage,tryAgainLink);parentDiv.append(messageDiv).show();messageDivTopMargin=(parentDiv.height()-messageDivTopMargin-messageDiv.height())/2;messageDiv.css('margin-top',messageDivTopMargin);return parentDiv;};setWidgetPosition=function(elementId){var self=this;var windowDimensions=jQuery.windowDimensions();var windowScroll=jQuery.windowScroll();var windowScrollX=windowScroll.x;var windowScrolly=windowScroll.y;var windowHeight=windowDimensions.height;var windowWidth=windowDimensions.width;var element=jQuery('#'+elementId);element.center();if(!jQuery.browser.msie6){element.css('top',Math.round(element.offset().top+windowScrolly));element.css('left',Math.round(element.offset().left+windowScrollX));}
if(self.isIE()){jQuery('#facebox_overlay').css({'height':jQuery(window.document).height()});}};popover=function(){var self=this;self.isPopupWidget=true;};placeInvocationPoints=function(documentSelector,contentSelector,options){options=options||{};jQuery("div.evri-widget-launcher").remove();jQuery(documentSelector).each(function(index,doc){var $doc=jQuery(doc);var launcher=options.launcher===undefined?Evri.Widget.Assets.launcher():options.launcher;jQuery(launcher).click(function(clickEvent){self.renderWidgetForGivenContent($doc.find(contentSelector).mergeHtml(),window.location.href+"#doc-"+index);return false;}).appendTo($doc);});};getWidgetCodeContainer=function(widgetCodeData){var self=this;var mainDiv=jQuery('#'+self.EVRI_CONTENT_MAIN_DIV);mainDiv.find('div.div-top').find('a.disabled-get-this-widget').removeClass('disabled-get-this-widget');var widgetCodeContainer=jQuery('<div/>').attr('id','evri-widget-code-container').addClass('widget-code-container');var modalDialog=jQuery('<div/>').addClass('widget-code-modal-dialog').appendTo(widgetCodeContainer);var CloseButton=jQuery('<a/>').attr({'href':'javascript:void(0);'}).addClass('close-button close').hover(function(){jQuery(this).removeClass('close-button').addClass('close-button-over');},function(){jQuery(this).removeClass('close-button-over').addClass('close-button');}).click(function(){self.closeStaticPopup('widget-code-container');});var mainHeading=jQuery('<h2/>').text('Get the Popover Recommendations Button').addClass('main-heading');var divTop=jQuery('<div/>').addClass('code-container-top').append(CloseButton,mainHeading);var contentContainer=jQuery('<div/>').addClass('widget-code-content-container');if(jQuery.browser.msie&&(parseInt(jQuery.browser.version)>=7)){contentContainer.css('height','350px');}
modalDialog.append(divTop,contentContainer);var firstSubHeading=jQuery('<h2/>').text('Pick your platform...').addClass('sub-heading first-sub-heading');var bloggingContainer=jQuery('<div/>').addClass('blogging-platform-installers-container');var bloggingContentContainer=jQuery('<ul/>').addClass('blogging-platform-installers');bloggingContainer.append(bloggingContentContainer);var li=jQuery('<li/>');var blogger=jQuery('<a/>').addClass('blogger-quick-install').attr({'href':'javascript:void(0);'}).html('<em>Blogger</em>').appendTo(li).click(function(){var bloggerForm=widgetCodeContainer.find('.blogger-form-container').find('.widget-installer');bloggerForm.submit();return false;});bloggingContentContainer.append(li);li=jQuery('<li/>');var typePad=jQuery('<a/>').addClass('typepad-quick-install').attr({'href':'javascript:void(0);'}).html('<em>TypePad</em>').appendTo(li).click(function(){var typePadForm=widgetCodeContainer.find('.typepad-form-container').find('.widget-installer');typePadForm.submit();return false;});bloggingContentContainer.append(li);li=jQuery('<li/>');var wordPress=jQuery('<a/>').addClass('wordpress-quick-install').attr({'href':'http://blog.evri.com/index.php/widget-wordpress/','target':'_blank'}).html('<em>WordPress</em>').appendTo(li);bloggingContentContainer.append(li);var secondSubHeading=jQuery('<h2/>').text('... grab the code ...').addClass('sub-heading');var userText=jQuery('<div/>').addClass('user-text show-hide-contents').text('Cut and paste the following code into the footer of your rich content website.');contentContainer.append(firstSubHeading,bloggingContainer,secondSubHeading,userText);var installationNotesLinkContainer=jQuery('<div/>').addClass('show-hide-links-container');var viewInstallationNotes=jQuery('<a/>').attr('href','javascript:void(0);').addClass('view-installation-notes').text('View installation notes').appendTo(installationNotesLinkContainer).click(function(){var showInstallationNotesLink=jQuery(this);if(!showInstallationNotesLink.hasClass('disabled')){var slideUpTop=-1*widgetCodeContainer.find('.show-hide-contents').get(0).offsetTop;if(self.isIE()){slideUpTop=-72;}
showInstallationNotesLink.addClass('disabled');var installationNoteContainer=widgetCodeContainer.find('.installation-notes-content');contentContainer.animate({top:slideUpTop},600,null,null);modalDialog.animate({height:'337px'},600,null,null);installationNoteContainer.slideDown("slow",function(){widgetCodeContainer.find('.other-widgets-container').hide();showInstallationNotesLink.hide().removeClass('disabled');widgetCodeContainer.find('.hide-installation-notes').show();});}});var hideInstallationNotes=jQuery('<a/>').attr('href','javascript:void(0);').addClass('hide-installation-notes').text('Hide installation notes').appendTo(installationNotesLinkContainer).click(function(){var hideInstallationNotesLink=jQuery(this);if(!hideInstallationNotesLink.hasClass('disabled')){widgetCodeContainer.find('.other-widgets-container').show();hideInstallationNotesLink.addClass('disabled');modalDialog.animate({height:'300px'},600,null,null);var installationNoteContainer=jQuery('#'+self.EVRI_CONTENT_MAIN_DIV).find('.installation-notes-content');contentContainer.animate({top:'0px'},600,null,null);installationNoteContainer.slideUp("slow",function(){hideInstallationNotesLink.hide().removeClass('disabled');widgetCodeContainer.find('.view-installation-notes').show();});}});contentContainer.append(installationNotesLinkContainer);contentContainer.append(self.getInstallationNotes());var codeContainer=jQuery('<div/>').addClass('textarea-container');var codeContent=jQuery('<textarea readonly="readonly"/>').addClass('cut-and-paste').click(function(){this.select();}).val(widgetCodeData.find('.any-web-page-form-container').text()).appendTo(codeContainer);contentContainer.append(codeContainer);var thirdSubHeading=jQuery('<h2/>').text('... or check out our other widgets').addClass('sub-heading');var div=jQuery('<div/>').addClass('user-text').html("We've got a whole <a href='http://evri.com/partners-and-bloggers.html' target='_blank'>widget gallery</a> waiting for you.")
var otherWidgetsContainer=jQuery('<div/>').addClass('other-widgets-container').append(thirdSubHeading,div);contentContainer.append(otherWidgetsContainer)
contentContainer.append(widgetCodeData.find('.blogger-form-container'));contentContainer.append(widgetCodeData.find('.typepad-form-container'));mainDiv.append(widgetCodeContainer);};getInstallationNotes=function(){var self=this;var installationNotesContentContainer=jQuery('<ul/>').addClass('installation-notes-content');var installationNodesContent=jQuery('<li/>').text('By default, the contentCSSSelector variable is set to pull all the content in h1 and p tags in the body element. The contentCSSSelector variable can be changed to select any content on your page using standard Cascading Stylesheets Selectors.').appendTo(installationNotesContentContainer);installationNodesContent=jQuery('<li/>').text('By default, the documentCSSSelector variable is set to the body tag of your website. The documentCSSSelector variable should only be changed if you have multiple documents on a page (such as the index page of a blog which could have multiple posts) and you would like to have a separate invocation point for each document on that page.').appendTo(installationNotesContentContainer);installationNodesContent=jQuery('<li/>').text('For more information about installing on any Web page, please visit the ').appendTo(installationNotesContentContainer);var evriBlog=jQuery('<a/>').text('Evri blog.').attr({'href':'http://blog.evri.com/index.php/widget-webpage/','target':'_blank'}).appendTo(installationNodesContent);installationNodesContent=jQuery('<li/>').text('For help with installation, please visit our ').appendTo(installationNotesContentContainer);var supportPage=jQuery('<a/>').text('support page.').attr({'href':'http://blog.evri.com/index.php/widget-support/','target':'_blank'}).appendTo(installationNodesContent);return installationNotesContentContainer;};jQuery.extend(this,self);return self;}});Evri.defineClass(Evri.Widget.ContentRecommendation,"JSAPIHelper",function(){});Evri.extendClass(Evri.Widget.ContentRecommendation.JSAPIHelper,{JSAPI_MAX_TIME_IN_MILIS:10000,displayGraph:function(graph,contentWidget){var self=this;self.displayEntities(graph,contentWidget);},displayEntities:function(graph,contentWidget){var self=this;if(graph&&graph.entities&&graph.entities.length>0){var profileEntity=graph.entities[0];self.getRelatedArticles(graph,true,contentWidget);self.displayRelatedEntities(graph,true,contentWidget);}else{contentWidget.loadWidgetMessage(contentWidget.EVRI_CONTENT_RIGHT_TOP,contentWidget.ENTITIES_NOT_FOUND,contentWidget.CSS_LOADING_MESSAGE_DIV,true);self.apiError(null,contentWidget);}},displaySelectedEntityGraph:function(graph,reLoadConnectionGraph,contentWidget){var self=this;if(graph&&graph.entities&&graph.entities.length>0){var profileEntity=graph.entities[0];self.getRelatedArticles(profileEntity,true,contentWidget);self.displayRelatedEntities(graph,true,contentWidget);contentWidget.fillProfileLink(profileEntity);if(reLoadConnectionGraph){self.getEntityRelations(profileEntity,contentWidget);}}else{self.apiError(null,contentWidget);}},getEntityRelations:function(entityDetail,contentWidget){var self=this;contentWidget.entityRelationsApiInProgress=true;clearTimeout(self.entityRelationsApiTimer);self.entityRelationsApiTimer=null;contentWidget.loadWidgetMessage(contentWidget.EVRI_CONTENT_CONNECTIONS_LOADING,contentWidget.EVRI_CONNECTIONS_LOADING,contentWidget.CSS_LOADING_MESSAGE_DIV);entityDetail.getRelatedEntities({onComplete:function(graph){contentWidget.entityRelationsApiInProgress=false;contentWidget.loadConnectionGraph(graph.entities,entityDetail,graph);},onFailure:function(error){contentWidget.entityRelationsApiInProgress=false;contentWidget.renderConnectionsError(self,entityDetail);}});self.entityRelationsApiTimer=setTimeout(function(){if(contentWidget.entityRelationsApiInProgress){contentWidget.entityRelationsApiInProgress=false;contentWidget.renderConnectionsError(self,entityDetail);}},self.JSAPI_MAX_TIME_IN_MILIS);},displayEntityGraph:function(entity,reLoadConnectionGraph,contentWidget){var self=this;contentWidget.entityApiInProgress=true;clearTimeout(self.entityApiTimer);self.entityApiTimer=null;if(reLoadConnectionGraph){contentWidget.showLoadingMessages(true);}else{contentWidget.loadWidgetMessage(contentWidget.EVRI_CONTENT_ARTICLES_LOADING,contentWidget.EVRI_ARTICLES_LOADING,contentWidget.CSS_LOADING_MESSAGE_DIV);contentWidget.loadWidgetMessage(contentWidget.EVRI_CONTENT_VIDEOS_LOADING,contentWidget.EVRI_VIDEOS_LOADING,contentWidget.CSS_LOADING_MESSAGE_DIV);}
entity.getRelatedEntities({onComplete:function(graph){contentWidget.entityApiInProgress=false;self.displaySelectedEntityGraph(graph,reLoadConnectionGraph,contentWidget);},onFailure:function(error){contentWidget.entityApiInProgress=false;self.entityGraphError(entity,reLoadConnectionGraph,contentWidget,error);}});self.entityApiTimer=setTimeout(function(){if(contentWidget.entityApiInProgress){contentWidget.entityApiInProgress=false;self.entityGraphError(entity,reLoadConnectionGraph,contentWidget);}},self.JSAPI_MAX_TIME_IN_MILIS);},entityGraphError:function(entity,reLoadConnectionGraph,contentWidget,error){var self=this;contentWidget.showhideProgressDialog(false,false);contentWidget.fillProfileLink(entity);contentWidget.fillEntities(contentWidget.evriContentGraph,true);var messageDiv=contentWidget.getErrorDiv(contentWidget.EVRI_CONTENT_ARTICLES_LOADING);var tryAgainLink=messageDiv.find('a');tryAgainLink.click(function(){self.displayEntityGraph(entity,reLoadConnectionGraph,contentWidget);return false;});messageDiv=contentWidget.getErrorDiv(contentWidget.EVRI_CONTENT_VIDEOS_LOADING);tryAgainLink=messageDiv.find('a');tryAgainLink.click(function(){self.displayEntityGraph(entity,reLoadConnectionGraph,contentWidget);return false;});if(reLoadConnectionGraph){messageDiv=contentWidget.getErrorDiv(contentWidget.EVRI_CONTENT_CONNECTIONS_LOADING);tryAgainLink=messageDiv.find('a');tryAgainLink.click(function(){self.displayEntityGraph(entity,reLoadConnectionGraph,contentWidget);return false;});}},getRelatedEntities:function(entity,reLoadConnectionGraph,contentWidget){var self=this;contentWidget.resetWizard(false);contentWidget.showhideProgressDialog(false,true);self.displayEntityGraph(entity,reLoadConnectionGraph,contentWidget);},displayRelatedEntities:function(graph,success,contentWidget){contentWidget.fillEntities(graph,success);},displayRelatedArticles:function(articleList,success,contentWidget){contentWidget.fillTopArticles(articleList,success);},getRelatedArticles:function(item,reLoadVideos,contentWidget){var self=this;contentWidget.articlesApiInProgress=true;clearTimeout(self.articlesApiTimer);self.articlesApiTimer=null;contentWidget.loadWidgetMessage(contentWidget.EVRI_CONTENT_ARTICLES_LOADING,contentWidget.EVRI_ARTICLES_LOADING,contentWidget.CSS_LOADING_MESSAGE_DIV);item.media.getArticles({onComplete:function(articleList){contentWidget.articlesApiInProgress=false;self.displayRelatedArticles(articleList,true,contentWidget);if(reLoadVideos){self.getRelatedVideos(item,contentWidget);}},onFailure:function(error){contentWidget.articlesApiInProgress=false;self.relatedArticlesError(item,reLoadVideos,contentWidget,error);}},{includeMatchedLocations:true});self.articlesApiTimer=setTimeout(function(){if(contentWidget.articlesApiInProgress){contentWidget.articlesApiInProgress=false;self.relatedArticlesError(item,reLoadVideos,contentWidget);}},self.JSAPI_MAX_TIME_IN_MILIS);},relatedArticlesError:function(item,reLoadVideos,contentWidget,error){var self=this;contentWidget.renderArticlesError(self,item);if(reLoadVideos){self.getRelatedVideos(item,contentWidget);}},displayRelatedVideos:function(videoList,success,contentWidget){contentWidget.fillVideos(videoList,success);},getRelatedVideos:function(item,contentWidget){var self=this;contentWidget.relatedVideosApiInProgress=true;clearTimeout(self.relatedVideosApiTimer);self.relatedVideosApiTimer=null;contentWidget.loadWidgetMessage(contentWidget.EVRI_CONTENT_VIDEOS_LOADING,contentWidget.EVRI_VIDEOS_LOADING,contentWidget.CSS_LOADING_MESSAGE_DIV);item.media.getVideos({onComplete:function(videoList){contentWidget.relatedVideosApiInProgress=false;self.displayRelatedVideos(videoList,true,contentWidget);},onFailure:function(error){contentWidget.relatedVideosApiInProgress=false;self.relatedVideoError(item,contentWidget);}});self.relatedVideosApiTimer=setTimeout(function(){if(contentWidget.relatedVideosApiInProgress){contentWidget.relatedVideosApiInProgress=false;self.relatedVideoError(item,contentWidget);}},self.JSAPI_MAX_TIME_IN_MILIS);},relatedVideoError:function(item,contentWidget){var self=this;contentWidget.showhideProgressDialog(false,false);contentWidget.renderVideosError(self,item);},loadContentForWidget:function(content,contentLocation,contentWidget,reloadWidget){var self=this;contentWidget.widgetApiInProgress=true;clearTimeout(self.widgetApiTimer);self.widgetApiTimer=null;contentWidget.entityObjectArray=new Array();contentWidget.apiSession.models.Graph.getForContent(content,{onComplete:function(graph){contentWidget.widgetApiInProgress=false;if(contentWidget.widgetClosedWhileLoading){return;}
contentWidget.showhideProgressDialog(true,false);if(reloadWidget){contentWidget.loadWidget();}
contentWidget.showLoadingMessages(false);contentWidget.evriContentGraph=graph;self.displayGraph(graph,contentWidget);},onFailure:function(error){contentWidget.widgetApiInProgress=false;self.loadContentForWidgetError(content,contentLocation,contentWidget,reloadWidget,error);}},{'uri':contentLocation});self.widgetApiTimer=setTimeout(function(){if(contentWidget.widgetApiInProgress){contentWidget.widgetApiInProgress=false;self.loadContentForWidgetError(content,contentLocation,contentWidget,reloadWidget);}},self.JSAPI_MAX_TIME_IN_MILIS);},loadContentForWidgetError:function(content,contentLocation,contentWidget,reloadWidget){var self=this;contentWidget.showhideProgressDialog(true,false);if(reloadWidget){contentWidget.loadWidget();}
contentWidget.renderArticlesError(self,null,true,content);contentWidget.renderVideosError(self,null,true,content);contentWidget.renderEntitesError(self,null,true,content);},apiError:function(error,contentWidget){var errorMessage='';if(error){errorMessage=error.message;}
contentWidget.loadWidgetMessage(contentWidget.EVRI_CONTENT_VIDEOS_LOADING,contentWidget.VIDEOS_NOT_FOUND+errorMessage,contentWidget.CSS_LOADING_MESSAGE_DIV);contentWidget.loadWidgetMessage(contentWidget.EVRI_CONTENT_ARTICLES_LOADING,contentWidget.ARTICLES_NOT_FOUND+errorMessage,contentWidget.CSS_LOADING_MESSAGE_DIV);contentWidget.loadWidgetMessage(contentWidget.EVRI_CONTENT_CONNECTIONS_LOADING,contentWidget.CONNECTION_ENTITY_NOT_FOUND+errorMessage,contentWidget.CSS_LOADING_MESSAGE_DIV);},getRelatedEntitiesForPair:function(pair,contentWidget){var self=this;contentWidget.resetWizard(false);contentWidget.showhideProgressDialog(false,true);self.getRelatedArticles(pair,true,contentWidget);},getErrorMessage:function(APIError,userError1,userError2){if(APIError&&APIError.responseJSON&&APIError.responseJSON.responseStatus=="Success"){return userError1;}else{return userError2+APIError.message;}},getGraphForURL:function(uri,contentWidget,reloadWidget){var self=this;contentWidget.widgetApiInProgress=true;clearTimeout(self.widgetApiTimer);self.widgetApiTimer=null;contentWidget.entityObjectArray=new Array();contentWidget.apiSession.models.Graph.getForURI(uri,{onComplete:function(graph){contentWidget.widgetApiInProgress=false;if(contentWidget.widgetClosedWhileLoading){return;}
contentWidget.showhideProgressDialog(true,false);if(reloadWidget){contentWidget.loadWidget();}
contentWidget.showLoadingMessages(false);contentWidget.evriContentGraph=graph;self.displayGraph(graph,contentWidget);},onFailure:function(error){contentWidget.widgetApiInProgress=false;self.loadContentForWidgetError(content,uri,contentWidget,reloadWidget,error);}},{'uri':uri});self.widgetApiTimer=setTimeout(function(){if(contentWidget.widgetApiInProgress){contentWidget.widgetApiInProgress=false;self.loadContentForWidgetError(content,uri,contentWidget,reloadWidget);}},self.JSAPI_MAX_TIME_IN_MILIS);}});Evri.defineNamespace(Evri.Widget.ContentRecommendation,"Animator");Evri.defineClass(Evri.Widget.ContentRecommendation.Animator,"Node",function(nodeObject,toRadius,startCX,startCY,endCX,endCY,animationDuration,name){var self=this;self.klass="Node";self.nodeObject=nodeObject;self.radius=0;self.toRadius=toRadius;self.x=startCX;self.endCX=endCX;self.y=startCY;self.endCY=endCY;self.animationDuration=animationDuration;self.name=name;return self;});Evri.extendClass(Evri.Widget.ContentRecommendation.Animator.Node,{animate:function(){var self=this;Evri.JSTweener.addTween(self,{x:self.endCX,y:self.endCY,radius:self.toRadius,time:self.animationDuration,transition:'easeOutBack',onUpdate:function(){try{self.nodeObject.attr("cx",self.x);self.nodeObject.attr("cy",self.y);self.nodeObject.attr("r",self.radius);}catch(ex){};}});}});Evri.defineClass(Evri.Widget.ContentRecommendation.Animator,"Line",function(lineObject,fromX,fromY,toX,toY,animationDuration,name){var self=this;self.klass="Line";self.lineObject=lineObject;self.fromX=fromX;self.fromY=fromY
self.toX=toX;self.toY=toY;self.animationDuration=animationDuration;self.name=name;return self;});Evri.extendClass(Evri.Widget.ContentRecommendation.Animator.Line,{animate:function(){var self=this;self.lineObject.lineTo(self.fromX,self.fromY);var temp={x:self.fromX,y:self.fromY};Evri.JSTweener.addTween(temp,{x:self.toX,y:self.toY,time:self.animationDuration,transition:'easeOutBack',onUpdate:function(){try{self.lineObject.lineTo(temp.x,temp.y);}catch(ex){};}});}});Evri.defineClass(Evri.Widget.ContentRecommendation.Animator,"Label",function(rectangleObject,nodeLabelObject,fromX,fromY,toX,toY,startWidth,startHeight,endWidth,endHeight,animationDuration){var self=this;self.klass="Label";self.rectangleObject=rectangleObject;self.nodeLabelObject=nodeLabelObject;self.fromX=fromX;self.fromY=fromY;self.toX=toX;self.toY=toY;self.startWidth=startWidth;self.endWidth=endWidth;self.startHeight=startHeight;self.endHeight=endHeight;self.animationDuration=animationDuration;return self;});Evri.extendClass(Evri.Widget.ContentRecommendation.Animator.Label,{animate:function(){var self=this;var tempObj={x:self.fromX,y:self.fromY,w:self.startWidth,h:self.startHeight};Evri.JSTweener.addTween(tempObj,{x:self.toX,y:self.toY,w:self.endWidth,h:self.endHeight,time:self.animationDuration,transition:'easeOutBack',onUpdate:function(){try{self.rectangleObject.css('display',"inline");self.nodeLabelObject.css('visibility','hidden');self.rectangleObject.css("left",Math.round(tempObj.x)+"px");self.rectangleObject.css("top",Math.round(tempObj.y)+"px");self.rectangleObject.css("width",Math.round(tempObj.w)+"px");self.rectangleObject.css("height",Math.round(tempObj.h)+"px");}catch(ex){};},onComplete:function(){self.nodeLabelObject.css('visibility','visible');}});}});Evri.defineClass(Evri.Widget.ContentRecommendation,"Connections",function(){});Evri.extendClass(Evri.Widget.ContentRecommendation.Connections,{jQuery:Evri.jQuery,ENTITYTYPE_PERSON:"person",ENTITYTYPE_LOCATION:"location",ENTITYTYPE_ORGANIZATION:"organization",ENTITYTYPE_EVENT:"event",ENTITYTYPE_PRODUCT:"product",ENTITYTYPE_CONCEPT:"concept",ENTITYTYPE_ACTION:"action",ENTITYTYPE_OTHER:"other",COLORCODE_GREEN:"#b1d535",COLORCODE_RED:"#eb122f",COLORCODE_LAVENDER:"#a56eca",COLORCODE_BLUE:"#7bc2ff",COLORCODE_BLUEGRAY:"#48628e",COLORCODE_PALEYELLOW:"#f6eaa7",COLORCODE_ORANGE:"#ff9c34",COLORCODE_LIGHTGRAY:"#b1b1b1",COLORCODE_GREEN_LIGHT:"#d8ea9a",COLORCODE_RED_LIGHT:"#f58897",COLORCODE_LAVENDER_LIGHT:"#d2b6e4",COLORCODE_BLUE_LIGHT:"#bde0ff",COLORCODE_BLUEGRAY_LIGHT:"#a3b0c6",COLORCODE_PALEYELLOW_LIGHT:"#faf4d3",COLORCODE_ORANGE_LIGHT:"#ffcd99",COLORCODE_LIGHTGRAY_LIGHT:"#d8d8d8",COLORCODE_DEFAULT:"#666666",COLORCODE_WHITE:"#ffffff",COLORCODE_MILDBLACK:"#333333",COLORCODE_CONNECTIONSTROKE:"#ff9933",COLORCODE_LABELBORDER:"#ccc",STROKEWIDTH_CONNECTIONLINE:4,STROKEWIDTH_RECTANGLE:1,STROKEWIDTH_NODE:3,ANIMATIONDURATION_MAINNODE:1,ANIMATIONDURATION_CONNECTIONS:1,ANIMATIONDURATION_TEXTEXPANSION_EFFECT:2,nodeCoordinates:{},nodeCoordinates_verticalOrientation:{6:[[41,82],[43,25],[121,43],[134,79],[132,116],[53,138]],5:[[41,82],[121,43],[134,77],[132,116],[56,138]],4:[[41,82],[121,43],[134,77],[132,116]],3:[[41,82],[121,43],[132,116]],2:[[41,82],[134,77]],1:[[41,82]]},nodeCoordinates_horizontalOrientation:{6:[[136,110],[51,110],[76,50],[136,25],[196,50],[221,110]],5:[[136,110],[76,50],[136,25],[196,50],[221,110]],4:[[136,110],[76,50],[136,25],[196,50]],3:[[136,110],[76,50],[196,50]],2:[[136,110],[136,25]],1:[[136,110]]},coordiantes_Rectangles:{},totalPositions:0,nodeRadius:15,mainNodeRadius:25,paper:null,lines:{},nodes:{},rectangles:{},text_nodes:{},entityDataList:{},maxConnections:0,textFontSize_mainNode:9,textFontSize_connectionNode:9,fontWeight_mainNode:"normal",fontWeight_connectionNode:"normal",textFont:"Lucida Grande, Tahoma, Myriad, Arial",m_graph:null,circleIDPrefix:"circle_",rectangleIDPrefix:"rectangle_",textNodeIDPrefix:"text_",lineIDPrefix:"line_",currentPair:null,loadPairRelatedEntities:false,scrollTextTimeout:120,entityObject:null,jsapi:new Evri.Widget.ContentRecommendation.JSAPIHelper(),allowAnimations:true,mouseCursor:"hand",lineHeight:11,rectangle_padding_leftRight:3,rectangle_padding_topBottom:0,textLabelMaxWidth:65,loadConnections:function(entityList,connectionForEntity,totalEntities,graph,contentWidget){var connectionForIndex=0;var self=this;self.m_graph=graph;self.entityObject=contentWidget;self.m_connectionForEntity=connectionForEntity;connectionForEntity.entityType=self.getEntityType(connectionForEntity.href);self.paper=null;self.nodeCoordinates=self.nodeCoordinates_verticalOrientation;var connectionGraphDiv=self.jQuery("div#"+self.entityObject.DIVNAME_CONNECTIONGRAPH);connectionGraphDiv.empty();if(!self.entityObject.isIE()){self.mouseCursor="pointer";}
var paperCounter=0;for(var cntr=1;cntr<=4;cntr++){setTimeout(function(){paperCounter++;if(self.paper==null){try{self.jQuery('#'+self.entityObject.EVRI_CONTENT_CONNECTIONS_LOADING).hide();self.jQuery('#'+self.entityObject.DIVNAME_CONNECTIONGRAPH).show();self.paper=Evri.Raphael(self.entityObject.DIVNAME_CONNECTIONGRAPH,connectionGraphDiv.width(),connectionGraphDiv.height());if(self.paper!=null){var count=totalEntities;self.entityDataList=entityList;self.maxConnections=count-1;self.totalPositions=self.maxConnections+1;if(count>0){self.showConnections();if(self.allowAnimations){self.animateConnections(self.entityDataList,count);}}}}catch(error){}}
if(paperCounter==4&&self.paper==null){self.jQuery('#'+self.entityObject.DIVNAME_CONNECTIONGRAPH).hide();self.entityObject.setConnectionError(entityList,connectionForEntity,totalEntities,graph);}},500*cntr);}},getEntityType:function(entityHref){var self=this;var textToSplit=entityHref;var entityType=textToSplit.split("/",2)[1];switch(entityType.toLowerCase()){case self.ENTITYTYPE_PERSON:return self.ENTITYTYPE_PERSON;case self.ENTITYTYPE_LOCATION:return self.ENTITYTYPE_LOCATION;case self.ENTITYTYPE_ORGANIZATION:return self.ENTITYTYPE_ORGANIZATION;case self.ENTITYTYPE_EVENT:return self.ENTITYTYPE_EVENT;case self.ENTITYTYPE_PRODUCT:return self.ENTITYTYPE_PRODUCT;case self.ENTITYTYPE_CONCEPT:return self.ENTITYTYPE_CONCEPT;case self.ENTITYTYPE_ACTION:return self.ENTITYTYPE_ACTION;case self.ENTITYTYPE_OTHER:return self.ENTITYTYPE_OTHER;default:return self.ENTITYTYPE_OTHER;}},showConnections:function(count){var self=this;var nodePositions=self.nodeCoordinates[self.totalPositions];var index;for(index=1;index<=self.maxConnections;index++){if(self.allowAnimations){self.lines[index]=self.drawLine(nodePositions[0][0],nodePositions[0][1],nodePositions[0][0],nodePositions[0][1],{stroke:self.COLORCODE_CONNECTIONSTROKE,"stroke-width":self.STROKEWIDTH_CONNECTIONLINE});}else{self.lines[index]=self.drawLine(nodePositions[0][0],nodePositions[0][1],nodePositions[index][0],nodePositions[index][1],{stroke:self.COLORCODE_CONNECTIONSTROKE,"stroke-width":self.STROKEWIDTH_CONNECTIONLINE});}
self.jQuery(self.lines[index]).attr("id",self.lineIDPrefix+index);}
self.showNodes();},drawLine:function(fromX,fromY,toX,toY,params){var self=this;var line=self.paper.path(params).moveTo(fromX,fromY).lineTo(toX,toY);return line;},showNodes:function(){var self=this;var nodePositions=self.nodeCoordinates[self.totalPositions];if(self.allowAnimations){self.drawNode(nodePositions[0][0],nodePositions[0][1],0,{fill:self.getFillColor(self.entityDataList[0].entityType),stroke:self.getStrokeColor(self.entityDataList[0].entityType),"stroke-width":self.STROKEWIDTH_NODE},0,self.entityDataList[0]);}else{self.drawNode(nodePositions[0][0],nodePositions[0][1],self.mainNodeRadius,{fill:self.getFillColor(self.entityDataList[0].entityType),stroke:self.getStrokeColor(self.entityDataList[0].entityType),"stroke-width":self.STROKEWIDTH_NODE},0,self.entityDataList[0]);}
var index;for(index=1;index<=self.maxConnections;index++){if(self.allowAnimations){self.drawNode(nodePositions[index][0],nodePositions[index][1],0,{fill:self.COLORCODE_WHITE,stroke:self.getStrokeColor(self.entityDataList[index].entityType),"stroke-width":self.STROKEWIDTH_NODE},index,self.entityDataList[index]);}else{self.drawNode(nodePositions[index][0],nodePositions[index][1],self.nodeRadius,{fill:self.COLORCODE_WHITE,stroke:self.getStrokeColor(self.entityDataList[index].entityType),"stroke-width":self.STROKEWIDTH_NODE},index,self.entityDataList[index]);}}},getRelatedEntitiesForPair:function(entityData){var self=this;self.entityObject.closeVideoPlayerIfOpen();var baseEntity=self.entityDataList[0];if(baseEntity.href==entityData.href){if(self.loadPairRelatedEntities||self.currentPair!=null){self.loadPairRelatedEntities=false;self.currentPair=null;self.jsapi.getRelatedEntities(self.m_connectionForEntity,false,self.entityObject);}
return;}
var pair=null;pair=self.getPairForEntity(baseEntity.href,entityData.href);self.loadPairRelatedEntities=true;if(pair&&self.currentPair!=pair){self.currentPair=pair;self.jsapi.getRelatedEntitiesForPair(pair,self.entityObject);}else{self.entityObject.resetWizard(false);self.jQuery('#'+self.entityObject.EVRI_CONTENT_VIDEO_THUMBNAIL_DETAIL).hide();self.entityObject.loadWidgetMessage(self.entityObject.EVRI_CONTENT_ARTICLES_LOADING,self.entityObject.ARTICLES_NOT_FOUND,self.entityObject.CSS_LOADING_MESSAGE_DIV);self.entityObject.loadWidgetMessage(self.entityObject.EVRI_CONTENT_VIDEOS_LOADING,self.entityObject.VIDEOS_NOT_FOUND,self.entityObject.CSS_LOADING_MESSAGE_DIV);}
self.entityObject.fillProfileLink(baseEntity,entityData);},nodeFocusedIn:function(nodeIndex){var self=this;if(nodeIndex!=0&&eval(self.jQuery(self.nodes[nodeIndex][0]).attr("isNodeSelected"))==false){var fadingTimeout=1.5;var startOpacity=0.3;var endOpacity=0.9;self.nodes[nodeIndex].attr({fill:self.getFillColor(self.entityDataList[nodeIndex].entityType),stroke:self.getStrokeColor(self.entityDataList[nodeIndex].entityType),'stroke-width':self.STROKEWIDTH_NODE});}},nodeFocusedOut:function(nodeIndex){var self=this;if(nodeIndex!=0&&(eval(self.jQuery(self.nodes[nodeIndex][0]).attr("isNodeSelected"))==false)){self.nodes[nodeIndex].attr({fill:self.COLORCODE_WHITE,stroke:self.getStrokeColor(self.entityDataList[nodeIndex].entityType),'stroke-width':self.STROKEWIDTH_NODE});}},selectNode:function(nodeIndex){var self=this;for(var idx=1;idx<=self.maxConnections;idx++){if(idx==nodeIndex){self.jQuery(self.nodes[idx][0]).attr("isNodeSelected",true);}else{self.jQuery(self.nodes[idx][0]).attr("isNodeSelected",false);}
if(idx!=nodeIndex){self.nodeFocusedOut(idx);}}},drawNode:function(centerX,centerY,radius,params,nodeIndex,entityData){var self=this;self.nodes[nodeIndex]=self.paper.circle(centerX,centerY,radius);self.nodes[nodeIndex].attr(params);self.nodes[nodeIndex][0].id=self.circleIDPrefix+nodeIndex;self.jQuery(self.nodes[nodeIndex][0]).attr("isNodeSelected",false);if(nodeIndex!=0){self.jQuery(self.nodes[nodeIndex][0]).css("cursor",self.mouseCursor);}
self.nodes[nodeIndex][0].onmouseover=function(){self.nodeFocusedIn(nodeIndex);}
self.nodes[nodeIndex][0].onmouseout=function(){self.nodeFocusedOut(nodeIndex);}
self.nodes[nodeIndex][0].onclick=function(){self.handleNodeClick(nodeIndex);};self.drawRectangle(centerX,centerY,nodeIndex,entityData.name);},handleNodeClick:function(nodeIndex){var self=this;if(self.entityObject.apiCallInProgress()){return;}
if(self.isNodeSelected(nodeIndex)){return;}
var entityData=self.entityDataList[nodeIndex];self.selectNode(nodeIndex);for(var cntr=0;cntr<self.maxConnections+1;cntr++){self.jQuery(self.nodes[cntr][0]).css("cursor",self.mouseCursor);self.rectangles[cntr].css("cursor",self.mouseCursor);}
self.jQuery(self.nodes[nodeIndex][0]).css("cursor",'default');self.rectangles[nodeIndex].css('cursor','default');self.getRelatedEntitiesForPair(entityData);self.entityObject.trackDHTML("connection/entity/click",{index:nodeIndex});},isNodeSelected:function(nodeIndex){var self=this;return eval(self.jQuery(self.nodes[nodeIndex][0]).attr("isNodeSelected"));},getPairForEntity:function(entity1href,entity2href){var self=this;var temp=null;self.jQuery.each(self.m_graph.pairs,function(){var pair=this;if((pair.entity1.href==entity1href||pair.entity2.href==entity1href)&&(pair.entity1.href==entity2href||pair.entity2.href==entity2href)){temp=pair;return false;}});return temp;},drawRectangle:function(cornerX,cornerY,nodeIndex,text){var self=this;var self=this;var fontSize;var fontWeight;if(nodeIndex==0){fontSize=self.textFontSize_mainNode;fontWeight=self.fontWeight_mainNode;}else{fontSize=self.textFontSize_connectionNode;fontWeight=self.fontWeight_connectionNode;}
var rect;rect=self.jQuery("<div />").text(text);rect.css({'position':"relative",'overflow':"hidden",'border-width':0+"px",'padding':0+"px","line-height":self.lineHeight+"px",'font-size':fontSize+"px",'font-family':self.textFont,'font-weight':fontWeight,'text-align':"center"});var wrapper=self.jQuery("<div />").attr('id',self.rectangleIDPrefix+nodeIndex).append(rect);wrapper.css({"cursor":self.mouseCursor,'position':"absolute",'overflow':"visible",'background-color':self.COLORCODE_WHITE,'border-style':'solid','border-color':self.COLORCODE_LABELBORDER,'border-width':self.STROKEWIDTH_RECTANGLE+"px",'padding':self.rectangle_padding_topBottom+"px "+self.rectangle_padding_leftRight+"px "+self.rectangle_padding_topBottom+"px "+self.rectangle_padding_leftRight+"px"});if(nodeIndex==0){wrapper.css('cursor','default');}
self.jQuery("div#"+self.entityObject.DIVNAME_CONNECTIONGRAPH).append(wrapper);if(rect.width()>self.textLabelMaxWidth){rect.width(self.textLabelMaxWidth);}else{rect.width(rect.width());}
rect.height("auto");if(rect.height()>=self.lineHeight*2){rect.height(self.lineHeight*2);}
var wrapperWidth=Math.round(rect.width());var wrapperHeight=Math.round(rect.height());var wrapperLeft=Math.round(cornerX-wrapperWidth/2-4);var wrapperTop=Math.round(cornerY-wrapperHeight/2);if(self.jQuery.browser.msie){wrapperTop-=2;wrapperLeft-=1;}
wrapper.css({'width':wrapperWidth+"px",'height':wrapperHeight+"px",'left':wrapperLeft+"px",'top':wrapperTop+"px"});var midReference=wrapperTop+(wrapperHeight/2);wrapper.attr("midReferenceY",midReference);rect.attr({'hiding':"false",'showing':"false"});self.rectangles[nodeIndex]=wrapper;self.coordiantes_Rectangles[nodeIndex]=[wrapperLeft,wrapperTop,wrapperWidth,wrapperHeight];self.text_nodes[nodeIndex]=rect;if(self.allowAnimations){wrapper.css('display','none');}
rect.hover(function(){self.showLabel(wrapper,rect);self.nodeFocusedIn(nodeIndex);},function(){self.hideLabel(wrapper,rect);self.nodeFocusedOut(nodeIndex);}).click(function(){self.handleNodeClick(nodeIndex);});},hideLabel:function(rectangleObject,innerRectangle){var self=this;var hiding=rectangleObject.attr('hiding');var showing=rectangleObject.attr('showing');if(hiding=="true"){return;}
hiding=true;showing=false;rectangleObject.attr('hiding',true);rectangleObject.attr('showing',false);var currentHeight=innerRectangle.height();var minHeight=self.lineHeight;if(currentHeight>=self.lineHeight*2){minHeight=self.lineHeight*2;}
var midReference=parseInt(rectangleObject.attr("midReferenceY"));var previousHeight=currentHeight;var obj={height:currentHeight};Evri.JSTweener.addTween(obj,{height:minHeight,time:self.ANIMATIONDURATION_TEXTEXPANSION_EFFECT,onUpdate:function(){if(!showing)
{if(Math.abs(previousHeight-obj.height)>=0.5){rectangleObject.height(obj.height+"px");innerRectangle.height(obj.height+"px");var newTop=midReference-(innerRectangle.height()/2);rectangleObject.css({'top':newTop+"px"});previousHeight=obj.height;}}},onComplete:function(){hiding=false;rectangleObject.attr('hiding',"false");}});},showLabel:function(rectangleObject,innerRectangle){var self=this;var hiding=rectangleObject.attr('hiding');var showing=rectangleObject.attr('showing');if(showing=="true"){return;}
showing=true;hiding=false;rectangleObject.attr('showing',"true");rectangleObject.attr('hiding',"false");var originalHeight=innerRectangle.height();var finalHeight=innerRectangle.css("overflow","visible").height("auto").height();innerRectangle.css("overflow","hidden").height(originalHeight);var previousHeight=originalHeight;var midReference=parseInt(rectangleObject.attr("midReferenceY"));var obj={height:originalHeight};Evri.JSTweener.addTween(obj,{height:finalHeight,time:self.ANIMATIONDURATION_TEXTEXPANSION_EFFECT,onUpdate:function(){if(!hiding)
{if(Math.abs(previousHeight-obj.height)>=0.5){rectangleObject.height(obj.height+"px");innerRectangle.height(obj.height+"px");var newTop=midReference-(innerRectangle.height()/2);rectangleObject.css({'top':newTop+"px"});previousHeight=obj.height;}}},onComplete:function(){showing=false;rectangleObject.attr('showing',"false");}});},getFillColor:function(entitytype){var self=this;switch(entitytype){case self.ENTITYTYPE_PERSON:return self.COLORCODE_GREEN_LIGHT;case self.ENTITYTYPE_LOCATION:return self.COLORCODE_BLUE_LIGHT;case self.ENTITYTYPE_EVENT:return self.COLORCODE_BLUEGRAY_LIGHT;case self.ENTITYTYPE_ORGANIZATION:return self.COLORCODE_RED_LIGHT;case self.ENTITYTYPE_PRODUCT:return self.COLORCODE_LAVENDER_LIGHT;case self.ENTITYTYPE_CONCEPT:return self.COLORCODE_PALEYELLOW_LIGHT;case self.ENTITYTYPE_ACTION:return self.COLORCODE_ORANGE_LIGHT;case self.ENTITYTYPE_OTHER:return self.COLORCODE_LIGHTGRAY_LIGHT;default:return COLORCODE_DEFAULT;}},getStrokeColor:function(entitytype){var self=this;switch(entitytype){case self.ENTITYTYPE_PERSON:return self.COLORCODE_GREEN;case self.ENTITYTYPE_LOCATION:return self.COLORCODE_BLUE;case self.ENTITYTYPE_EVENT:return self.COLORCODE_BLUEGRAY;case self.ENTITYTYPE_ORGANIZATION:return self.COLORCODE_RED;case self.ENTITYTYPE_PRODUCT:return self.COLORCODE_LAVENDER;case self.ENTITYTYPE_CONCEPT:return self.COLORCODE_PALEYELLOW;case self.ENTITYTYPE_ACTION:return self.COLORCODE_ORANGE;case self.ENTITYTYPE_OTHER:return self.COLORCODE_LIGHTGRAY;default:return COLORCODE_DEFAULT;}},animateConnections:function(entityDataList,count){var self=this;var nodePositions=self.nodeCoordinates[count];var centerRectanglePositions=self.coordiantes_Rectangles[0];var mainNodeAnim=new Evri.Widget.ContentRecommendation.Animator.Node(self.nodes[0],self.mainNodeRadius,nodePositions[0][0],nodePositions[0][1],nodePositions[0][0],nodePositions[0][1],self.ANIMATIONDURATION_MAINNODE,0);mainNodeAnim.animate();var mainRectangleAnim=new Evri.Widget.ContentRecommendation.Animator.Label(self.rectangles[0],self.text_nodes[0],nodePositions[0][0],nodePositions[0][1],centerRectanglePositions[0],centerRectanglePositions[1],0,0,centerRectanglePositions[2],centerRectanglePositions[3],self.ANIMATIONDURATION_MAINNODE);mainRectangleAnim.animate();setTimeout(function(){var index;for(index=1;index<count;index++){var fromNodePosition=nodePositions[0];var toNodePosition=nodePositions[index];var connectionNodeAnim=new Evri.Widget.ContentRecommendation.Animator.Node(self.nodes[index],self.nodeRadius,fromNodePosition[0],fromNodePosition[1],toNodePosition[0],toNodePosition[1],self.ANIMATIONDURATION_CONNECTIONS,index);connectionNodeAnim.animate();var lineAnim=new Evri.Widget.ContentRecommendation.Animator.Line(self.lines[index],fromNodePosition[0],fromNodePosition[1],toNodePosition[0],toNodePosition[1],self.ANIMATIONDURATION_CONNECTIONS,index);lineAnim.animate();var connectionRectanglePositions=self.coordiantes_Rectangles[index];var connectionRectAnim=new Evri.Widget.ContentRecommendation.Animator.Label(self.rectangles[index],self.text_nodes[index],fromNodePosition[0],fromNodePosition[1],connectionRectanglePositions[0],connectionRectanglePositions[1],0,0,connectionRectanglePositions[2],connectionRectanglePositions[3],self.ANIMATIONDURATION_CONNECTIONS);connectionRectAnim.animate();}},(self.ANIMATIONDURATION_MAINNODE)*1000);},fillNodeColor:function(fillColor,nodeIndex){var self=this;if(nodeIndex!=0){self.nodes[nodeIndex].attr({fill:fillColor});}}});Evri.Widget.ContentRecommendation.Feedback={$:Evri.jQuery,ANIMATION_TIMEOUT:400,widgetObject:undefined,Form:function(){var self=this;return self.$('#modal-feedback-form');},errorMessage:["Unfortunately, there was an error sending your message.","Please try again or come back later."].join(" "),resetInstructions:function(){var self=this;self.$(".radio-form .instructions").html(self.$("<p/>").addClass("light").text("Please select one of the following options:"));self.$(".optional-form .instructions").html(self.$("<p/>").addClass("light").text("Enter optional information here:"));},submit:function(){var self=this;var $=Evri.jQuery;Evri.Widget.ContentRecommendation.Feedback.resetInstructions();var emailRegexp=/^\s*[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\s*$/i;var optionalFields=$("#feedback-form .tell-us-more").length===0;if($.fn.validate===undefined){$.fn.validate=function(regularExpression){return this.filter(function(){return!regularExpression.test(Evri.jQuery(this).val());}).length===0;};}
if($.trim($("#email-field").val())!=""&&!$("#email-field").validate(emailRegexp)){$("#email-field").addClass("error");$("#feedback-form .optional-form .message-display-area").html($("<p/>").addClass("error").text("The email address below is invalid. Please verify or retype the address."));}
else{$('#feedback-form .submit-link').addClass("disabled");var feedback=Evri.PageSession.session;$.extend(feedback,{selection:$(".feedback-type:checked").val(),message:$("#message-field").val(),from_email:$("#email-field").val(),href:window.location.href});$.extend(feedback,Evri.PageSession.session);var queryParams=Evri.API.Utilities.toQueryString({"selection":feedback.selection,"message":feedback.message,"from_email":feedback.from_email,"href":feedback.href})
var url="http://"+Evri.API.Environment.portalHost+"/widget_utilities/feedback"+queryParams;$.getJSON(url+"&callback=?",function(feedbackSent){var feedbackSentObject=$(feedbackSent);Evri.Widget.ContentRecommendation.Feedback.feedbackPost(feedbackSentObject);});}
Evri.Widget.ContentRecommendation.Feedback.trackEvent("FeedbackPost",feedback)
return false;},feedbackPostError:function(){var self=this;var errorMessage=$("<p/>").addClass("error").text(Evri.Widget.ContentRecommendation.Feedback.errorMessage);var optionalFields=$("#feedback-form .tell-us-more").length===0;if(optionalFields){$(".optional-form .instructions").html(errorMessage);}
else{$(".radio-form .instructions").html(errorMessage);}},feedbackPost:function(response){var self=this;var $=Evri.jQuery;var feedbackSuccess=$(response);var feedbackForm=$('#'+Evri.Widget.ContentRecommendation.Feedback.widgetObject.EVRI_CONTENT_MAIN_DIV).find("#feedback-form");var feedbackFormHeight=feedbackForm.height();$('#'+Evri.Widget.ContentRecommendation.Feedback.widgetObject.EVRI_CONTENT_MAIN_DIV).find('#feedback-form form').remove();feedbackForm.append(feedbackSuccess.find(".form-result")).height(feedbackFormHeight);feedbackForm.find(".close").click(function(){Evri.Widget.ContentRecommendation.Feedback.cancel();});},dismiss:function()
{var self=this;self.hideFeedbackForm();},cancel:function(){Evri.Widget.ContentRecommendation.Feedback.trackEvent("Cancel",{})
Evri.Widget.ContentRecommendation.Feedback.dismiss();},instantiate:function(widgetObject){var self=this;var jQuery=Evri.jQuery;self.widgetObject=widgetObject;self.widgetObject.trackDHTML(self.$('a#feedback-trigger')[0],'OpenFeedbackForm',{});var url="http://"+Evri.API.Environment.portalHost+"/widget_utilities/feedback/content_recommendation";jQuery.getJSON(url+"?callback=?",function(feedbackForm){var feedbackFormObject=jQuery(feedbackForm);self.loadFeedback(feedbackFormObject);});return false;},loadFeedback:function(data){var self=this;var dialog=self.$(data);dialog.removeClass('modal-dialog');var sendFeedbackButton=dialog.find('.submit-link');var tellUsMoreButton=dialog.find('.tell-us-more');var cancelButton=dialog.find('.close');sendFeedbackButton.replaceWith(self.$("<a/>").text("Send Feedback").addClass("disabled submit-link").attr('href','javascript:void(0);').click(function(){!self.$(this).hasClass("disabled")&&self.$("#feedback-form form").submit();return false;}));if(cancelButton){cancelButton.removeAttr('onclick');cancelButton.bind('click',function(){Evri.Widget.ContentRecommendation.Feedback.cancel();});}
dialog.find('.radio-form label').click(function(){self.$(this).parent().find("input").click();})
dialog.find('.radio-form input').click(function(){self.$(".submit-area .submit-link").removeClass("disabled");self.$(".radio-form label").removeClass("selected");self.$(this).parent().find("label").addClass("selected");self.$(".optional-form #user-selection").text(self.$(this).parent().find("label").text());})
dialog.find("form").submit(Evri.Widget.ContentRecommendation.Feedback.submit);self.$(document.body).append(" ");self.$('#'+self.widgetObject.EVRI_CONTENT_MAIN_DIV).append(dialog);self.showFeedbackForm();},cancel:function(){Evri.Widget.ContentRecommendation.Feedback.trackEvent("Cancel",{})
Evri.Widget.ContentRecommendation.Feedback.dismiss();},close:function(){Evri.Widget.ContentRecommendation.Feedback.trackEvent("Close",{})
Evri.Widget.ContentRecommendation.Feedback.dismiss();},complete:function(){Evri.Widget.ContentRecommendation.Feedback.trackEvent("CloseForComplete",{})
Evri.Widget.ContentRecommendation.Feedback.dismiss();},trackEvent:function(name,options){var self=this;self.widgetObject.trackDHTML(Evri.Widget.ContentRecommendation.Feedback.Form()[0],name,options);},showFeedbackForm:function(){var self=this;var transparentDiv=self.$('#'+self.widgetObject.EVRI_CONTENT_TRANSPARENT_DIV);var mainDiv=self.$('#'+self.widgetObject.EVRI_CONTENT_MAIN_DIV);transparentDiv.height('0px');var transparentDivTop=-1*mainDiv.height();var transparentDivHeight=mainDiv.height();transparentDiv.css('top',transparentDivTop);transparentDiv.show();transparentDiv.animate({top:"0px",height:transparentDivHeight},self.ANIMATION_TIMEOUT,null,null);var feedbackForm=self.$('#'+self.widgetObject.EVRI_CONTENT_MAIN_DIV).find('#feedback-form');feedbackForm.css('top','-170px').show();feedbackForm.animate({top:'51px'},self.ANIMATION_TIMEOUT,null,null);},hideFeedbackForm:function(){var self=this;var transparentDiv=self.$('#'+self.widgetObject.EVRI_CONTENT_TRANSPARENT_DIV);var transparentDivTop=-1*transparentDiv.height();transparentDiv.animate({top:transparentDivTop},self.ANIMATION_TIMEOUT,null,function(){transparentDiv.css({'background-color':'#ffffff','opacity':'0.5','top':'0px'}).hide();});var feedbackForm=self.$('#'+self.widgetObject.EVRI_CONTENT_MAIN_DIV).find('#feedback-form');var feedbackFormTop=-1*feedbackForm.height();feedbackForm.animate({top:feedbackFormTop},self.ANIMATION_TIMEOUT,null,function(){feedbackForm.remove();});self.widgetObject.isContentLoaded=false;}};Evri.PageSession={session:{url:document.location.href,timeLoaded:(new Date()).toString()},store:function(key,value){var self=this;self.session[key]=value;}};