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",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,{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;}},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]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.$);},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};}}});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=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','EntityList','EntityHistories','EntityHistory','EntityHistoryMention','EntityProperty','EntityPropertyList','EntityRelation','EntityRelationList','Facet','Graph','Image','ImageList','MatchedLocation','Media','MediaConstraint','Pair','Product','ProductList','Target','TargetList','Tweet','TweetList','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.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);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','author','content','contentMatchedLocations','link','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,"ArticleLink");Evri.extendNamespace(Evri.API.Model.ArticleLink,{_classMethodGenerators:{},_prototypeWith:{initialize:function(linkJSONNode){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(linkJSONNode,self);self.sourceUrl="http://"+self.hostName+self.path;self.href=window.location.protocol+"//"+Evri.API.Environment.portalHost+self.href;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){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);}};}},_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,"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:{findByName:function(session){return function(name,callbacks){Evri.API.Transport.callRemoteMethod(session,"/entities/find",session.models.EntityList.handleResponse,{name:name},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"});}},_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;}
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;}
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;options=options||{};callbacks.bindWith=function(targetList){self.topTargetsList=targetList;targetList.belongsTo=self;};Evri.API.Transport.callRemoteMethod(self.session,self.relationsResource,self.session.models.TargetList.handleEntityRelationsGraphResponse,{'graphRelationsCount':(options.count!==undefined?options.count:10)},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||{};Evri.API.Transport.callRemoteMethod(self.session,"/mashups/twitter/tag",self.session.models.TweetList.handleResponse,{'q':self.name},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;}});}},_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,"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.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){};}},_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.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.resource=(belongsTo.mediaResource||"/media/related");return self;},instanceAttributes:['belongsTo','documentationUrl','klass','articleLists','imageLists','videoLists','productLists'],instanceMethods:['getArticles','getImages','getName','getVideos','getProducts','getRecommendedProducts'],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"),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,"Product");Evri.extendNamespace(Evri.API.Model.Product,{_classMethodGenerators:{},_prototypeWith:{initialize:function(productJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(productJSON,self);return self;},instanceAttributes:['belongsTo','documentationUrl','klass','name','id','group','url','imageurl','rating','price','label','author','artist','director','composer','manufacturer','creator','releasedate','height','width','referringUri'],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);};},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);};}},_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=[];var entityResources=[];var entityResourcesNodes=Evri.API.Utilities.JSON.getNodeSetForPath(tweetJSON,"entities/taggedEntityData/entityUris/string");for(var i=0;i<entityResourcesNodes.length;i++){entityResources.push(Evri.API.Utilities.JSON.getValueForNode(entityResourcesNodes[i]));}
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],entityResources));}
return self;},instanceAttributes:['documentationUrl','klass','belongsTo','authorName','authorURI','content','entityResources','id','imageURI','matchedLocations','permalink','published','title','updated'],instanceMethods:['getRelativePublicationDate','getTitleRanges'],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"});}},_prototypeWith:{initialize:function(tweetListJSON){var self=this;self.tweets=[];var tweetNodes=Evri.API.Utilities.JSON.getNodeSetForPath(tweetListJSON,"taggedTwitterEntryData");for(var i=0;i<tweetNodes.length;i++){self.tweets.push(new self.session.models.Tweet(tweetNodes[i]));}
return self;},instanceAttributes:['tweets'],instanceMethods:[]}});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,"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,"Components");Evri.defineNamespace(Evri.Widget.Components,"Behaviors",{bindable:function(self){var bindings={};self.addBinding=function(bindingName,callback){bindings[bindingName]=bindings[bindingName]||[];bindings[bindingName].push(callback);};self.executeBinding=function(bindingName){var binding=bindings[bindingName];if(binding===undefined){return;}
for(var i=0;i<binding.length;i++){binding[i].call(self,self);}};return self;}});Evri.defineNamespace(Evri.Widget.Components,"Helpers",{jQueryBaconl:function(template){var tokens=Evri.Widget.Components.Helpers.baconl(template);var element=Evri.jQuery("<"+tokens.tag+"/>");if(tokens.id){element.attr("id",tokens.id);}
if(tokens.classes.length>0){element.addClass(tokens.classes.join(" "));}
return element;},baconl:function(template){if(template===undefined){return undefined;}
var tokens={id:undefined,classes:[],tag:undefined,innerHTML:""};var tagDefinition=/^\s*%([A-Za-z][A-Za-z0-9]*)/;var idDefinition=/^\#([A-Za-z][A-Za-z0-9:_\-]*)/;var classDefinition=/^\.([A-Za-z][A-Za-z0-9:_\-]*)/;var innerHTMLDefinition=/\s*\\?((.|[\n])+)/m;var nextToken=template.match(tagDefinition);if(!!nextToken){tokens.tag=nextToken[1];}
template=template.replace(tagDefinition,"");nextToken=template.match(idDefinition);tokens.id=!!nextToken?nextToken[1]:undefined;template=template.replace(idDefinition,"");nextToken=template.match(classDefinition);while(!!nextToken){tokens.classes.push(nextToken[1]);template=template.replace(classDefinition,"");nextToken=template.match(classDefinition);}
if(tokens.tag===undefined){tokens.tag="div";}
nextToken=template.match(innerHTMLDefinition);tokens.innerHTML=!!nextToken?nextToken[1]:undefined;return tokens;},wordTruncateString:function(string,length){if(string.length<length)return string;var truncatedString=string.substring(0,length);truncatedString=truncatedString.replace(/(\s*\w*)$/,"...");return truncatedString;},scrollAnalytics:function(self,section,analytics){var $=Evri.$;self.find(".evri-component-up-scroll").bind("click.analytics",function(){if(!$(this).is(".evri-component-up-scroll-disabled")){analytics.trackDHTML(section+"/ScrollUp");}}).end().find(".evri-component-down-scroll").bind("click.analytics",function(){if(!$(this).is(".evri-component-down-scroll-disabled")){analytics.trackDHTML(section+"/ScrollDown");}});},createScrollButtonsForList:function(list,analyticsSection){var $=Evri.jQuery;list.css({top:0});var upButton=$("<a />").addClass("evri-component-up-scroll").attr({'href':'javascript:void(0);'}).append($("<div />").addClass("evri-component-arrow-icon").css("zoom",1));var downButton=$("<a />").addClass("evri-component-down-scroll").attr({'href':'javascript:void(0);'}).append($("<div />").addClass("evri-component-arrow-icon"));var listItems=list.children("li");var scrollDownFocusIndex=undefined;var scrollUpFocusIndex=0;function scrollDown(){var listOffsetTop=Math.abs(parseInt(list.css('top')));var viewPaneHeight=list.parent().outerHeight();var viewPaneIntersectHeight=listOffsetTop+viewPaneHeight;var veryLastItem=list.children("li:last");var lastItemInView=undefined;var lastItemIndexInView=undefined;$.each(listItems,function(index,item){var position=$(item).position();if(position.top<viewPaneIntersectHeight){lastItemInView=item;lastItemIndexInView=index;}});if((scrollDownFocusIndex===undefined||scrollDownFocusIndex===lastItemIndexInView)&&lastItemInView!==veryLastItem[0]){lastItemInView=$(lastItemInView).next()[0];lastItemIndexInView++;scrollDownFocusIndex=lastItemIndexInView;scrollUpFocusIndex=undefined;var newListOffsetTop=0-($(lastItemInView).position().top+$(lastItemInView).outerHeight()-viewPaneHeight);scrollToTopPosition(newListOffsetTop);}};function scrollUp(){var listOffsetTop=Math.abs(parseInt(list.css('top')));var firstItemInView=undefined;if(scrollUpFocusIndex!==0){if(scrollUpFocusIndex!==undefined&&scrollUpFocusIndex>0){scrollUpFocusIndex--;firstItemInView=listItems[scrollUpFocusIndex];}
else{scrollDownFocusIndex=undefined;$.each(listItems,function(index,item){var position=$(item).position();if(position.top<listOffsetTop){firstItemInView=item;scrollUpFocusIndex=index;}});}
var newListOffsetTop=0-($(firstItemInView).position().top);scrollToTopPosition(newListOffsetTop);}};function scrollToTopPosition(topPosition){while(list.is(":animated"))list.stop();list.animate({"top":topPosition});};function resetButtons(){if(scrollUpFocusIndex!==0){upButton.removeClass("evri-component-up-scroll-disabled");}
else{upButton.addClass("evri-component-up-scroll-disabled");}
if(scrollDownFocusIndex!==(listItems.length-1)){downButton.removeClass("evri-component-down-scroll-disabled");}
else{downButton.addClass("evri-component-down-scroll-disabled");}}
downButton.click(function(){if(scrollDownFocusIndex===undefined||scrollDownFocusIndex<(listItems.length-1)){downButton.blur();scrollDown();resetButtons();}});upButton.click(function(){if(scrollUpFocusIndex===undefined||scrollUpFocusIndex>0){upButton.blur();scrollUp();resetButtons();}});resetButtons();return{up:upButton,down:downButton};},makeVerticalCarousel:function(orderedList){var Helpers=Evri.Widget.Components.Helpers;return Helpers.createScrollButtonsForList(orderedList,"");},generateVerticalCarousel:function(itemsList,itemBuilder){var Helpers=Evri.Widget.Components.Helpers;var listViewport=Helpers.generateItemsList(itemsList,itemBuilder);var buttons=Helpers.makeVerticalCarousel(listViewport.find("ol"));return[buttons.up,listViewport,buttons.down];},expandVerticalCarrousel:function(object){var buttons=object.children(".evri-component-button");var listHeight=0;object.height(object.parent().height());listHeight=object.height();buttons.each(function(index,object){listHeight-=Evri.jQuery(object).height();});object.children(".evri-component-viewport").height(listHeight);},generateItemsList:function(items,itemGenerator){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var $=Evri.jQuery;var orderedList=baconl("%ol");var viewport=baconl("%div.evri-component-viewport");viewport.append(orderedList);$.each(items,function(index,article){orderedList.append(itemGenerator(article));});return viewport;},generateArticleListItem:function(article){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var listItem=baconl("%li");var attribution=baconl("%p.evri-component-attribution");var hasAuthor=(article.author!==undefined&&article.author.length)||(article.link&&article.link.hostName&&article.link.hostName.length);attribution.append(article.getRelativePublicationDate());if(hasAuthor&&article.getRelativePublicationDate().length>0){attribution.append(" | ");}
attribution.append(article.author||article.link.hostName);listItem.append(baconl("%h3").html(baconl("%a").html(article.title).attr({"href":article.link.href,"target":"_blank"})),baconl("%p.evri-component-snippet").html(article.getHighlightedContent('em')),attribution);return listItem;},createHorizontalScrollButtonsForList:function(list,analyticsSection){var $=Evri.jQuery;list.css({left:0});var leftButton=$("<a />").addClass("evri-component-left-scroll").attr({'href':'javascript:void(0);'}).append($("<div />").addClass("evri-component-arrow-icon").css("zoom",1));var rightButton=$("<a />").addClass("evri-component-right-scroll").attr({'href':'javascript:void(0);'}).append($("<div />").addClass("evri-component-arrow-icon"));var listItems=list.children("li");var scrollRightFocusIndex=undefined;var scrollLeftFocusIndex=0;function scrollRight(){var listOffsetleft=Math.abs(parseInt(list.css('left')));var viewPaneWidth=list.parent().outerWidth();var viewPaneIntersectWidth=listOffsetleft+viewPaneWidth;var veryLastItem=list.children("li:last");var lastItemInView=undefined;var lastItemIndexInView=undefined;$.each(listItems,function(index,item){var position=$(item).position();if(position.left<viewPaneIntersectWidth){lastItemInView=item;lastItemIndexInView=index;}});if((scrollRightFocusIndex==undefined||scrollRightFocusIndex===lastItemIndexInView)&&lastItemInView!==veryLastItem[0]){lastItemInView=$(lastItemInView).next()[0];lastItemIndexInView++;scrollRightFocusIndex=lastItemIndexInView;scrollLeftFocusIndex=undefined;var newListOffsetLeft=0-($(lastItemInView).position().left+$(lastItemInView).outerWidth()-viewPaneWidth);scrollToLeftPosition(newListOffsetLeft);}};function scrollLeft(){var listOffsetleft=Math.abs(parseInt(list.css('left')));var firstItemInView=undefined;if(scrollLeftFocusIndex!==0){if(scrollLeftFocusIndex!==undefined&&scrollLeftFocusIndex>0){scrollLeftFocusIndex--;firstItemInView=listItems[scrollLeftFocusIndex];}
else{scrollRightFocusIndex=undefined;$.each(listItems,function(index,item){var position=$(item).position();if(position.left<listOffsetleft){firstItemInView=item;scrollLeftFocusIndex=index;}});}
var newListOffsetLeft=0-($(firstItemInView).position().left);scrollToLeftPosition(newListOffsetLeft);}};function scrollToLeftPosition(leftPosition){while(list.is(":animated"))list.stop();list.animate({"left":leftPosition});};function resetButtons(){if(scrollLeftFocusIndex!==0){leftButton.removeClass("evri-component-left-scroll-disabled");}
else{leftButton.addClass("evri-component-left-scroll-disabled");}
if(scrollRightFocusIndex!==(listItems.length-1)){rightButton.removeClass("evri-component-right-scroll-disabled");}
else{rightButton.addClass("evri-component-right-scroll-disabled");}}
rightButton.click(function(){if(scrollRightFocusIndex===undefined||scrollRightFocusIndex<(listItems.length-1)){rightButton.blur();scrollRight();resetButtons();}});leftButton.click(function(){if(scrollLeftFocusIndex===undefined||scrollLeftFocusIndex>0){leftButton.blur();scrollLeft();resetButtons();}});resetButtons();return{left:leftButton,right:rightButton};},makeHorizontalCarousel:function(orderedList){var Helpers=Evri.Widget.Components.Helpers;return Helpers.createHorizontalScrollButtonsForList(orderedList,"");},generateHorizontalItemsList:function(items,itemBuilder){var Helpers=Evri.Widget.Components.Helpers;var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var $=Evri.$;var viewport=baconl("%div.evri-component-horizontal-viewport");viewport.append(itemBuilder(items));var buttons=Helpers.makeHorizontalCarousel(viewport.find("ol"));return[buttons.left,viewport,buttons.right];},trimLongText:function(text,heightAvailable,styles){var self=this;self.$=Evri.$;if(self.$("#evri-ph-for-stringWidth").length==0){self.$(document.body).append(self.$('<div/>').attr('id','evri-ph-for-stringWidth').css({'visibility':'hidden','position':'absolute'}));}
var div=self.$("#evri-ph-for-stringWidth").css(styles).empty();div.html(text);var initialHeight=div.get(0).offsetHeight;if(initialHeight<=heightAvailable){div.empty();return text;}else{for(var cntr=text.length;cntr>=0;cntr--){div.empty();var newText=text.substr(0,cntr);div.html(newText);var currentHeight=div.get(0).offsetHeight;if(currentHeight<=heightAvailable){div.empty();newText=newText.substr(0,newText.length-3);return newText+"...";}}}}});Evri.defineClass(Evri.Widget.Components,"MediaList",function(){var self=this;var options=Evri.$.extend({analytics:new Evri.Widget.Analytics(self.componentName)},arguments[0]||{});self.analytics=options.analytics;var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;Evri.$.extend(self,baconl("%div").addClass(self.componentClass));Evri.Widget.Components.Behaviors.bindable(self);});Evri.extendClass(Evri.Widget.Components.MediaList,{componentClass:"evri-component",render:function(list){var self=this;var Helpers=Evri.Widget.Components.Helpers;self.empty();var listViewport=Helpers.generateItemsList(list,function(){return self.itemGenerator.apply(self,arguments);});self.append(listViewport);self.afterRender&&self.afterRender();self.executeBinding("render");return self;},renderHorizontal:function(list){var self=this;var Helpers=Evri.Widget.Components.Helpers;self.empty();var listViewport=Helpers.generateHorizontalItemsList(list,function(){return self.itemGenerator.apply(self,arguments);});self.append.apply(self,listViewport);self.afterRender&&self.afterRender();return self;},renderMessage:function(str){var b=Evri.Widget.Components.Helpers.jQueryBaconl;var self=this;self.html(b("%div.evri-info-message.centered").html(str));return self;}});Evri.defineClass(Evri.Widget.Components,"ArticlesList",Evri.Widget.Components.MediaList);Evri.extendClass(Evri.Widget.Components.ArticlesList,Evri.Widget.Components.MediaList.prototype);Evri.extendClass(Evri.Widget.Components.ArticlesList,{itemGenerator:Evri.Widget.Components.Helpers.generateArticleListItem,setArticles:function(list){var self=this;var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;list.articles.length>0?self.render(list.articles):self.renderMessage(baconl("%p.light").text("No related articles"));return self;},afterRender:function(){var self=this;self.find("h3 a").bind("click.analytics",function(){self.analytics.trackReferral("Article/ListItem");});}});Evri.$.extend(Evri.Widget.Components.ArticlesList.prototype,{componentName:'ComponentArticlesList',componentClass:"evri-component-articles"});Evri.defineClass(Evri.Widget.Components,"ArticlesVerticalCarousel",Evri.Widget.Components.ArticlesList);Evri.extendClass(Evri.Widget.Components.ArticlesVerticalCarousel,Evri.Widget.Components.ArticlesList.prototype);Evri.$.extend(Evri.Widget.Components.ArticlesVerticalCarousel.prototype,{componentName:'ComponentArticlesVerticalCarousel',componentClass:"evri-component-articles evri-component-articles-vertical-carousel",afterRender:function(){var self=this;var Helpers=Evri.Widget.Components.Helpers;var buttons=Helpers.makeVerticalCarousel(self.find("ol"));self.prepend(buttons.up);self.append(buttons.down);Helpers.scrollAnalytics(self,"ArticlesCarousel",self.analytics);}});Evri.defineClass(Evri.Widget.Components,"ArticlesColumn",function(){var self=this;var options=arguments[0]||{};var analytics=options.analytics||new Evri.Widget.Analytics('ComponentArticlesColumn');var $=Evri.jQuery;var Helpers=Evri.Widget.Components.Helpers;var baconl=Helpers.jQueryBaconl;Evri.Widget.Components.Behaviors.bindable(self);$.extend(self,baconl("%div.evri-component.evri-component-articles-column"));function render(list){var listElement=baconl("%ol");$.each(list,function(index,article){listElement.append(Helpers.generateArticleListItem(article));});self.html(listElement);self.find("h3 a").bind("click.analytics",function(){analytics.trackReferral("ComponentArticlesColumn/OpenArticle");});self.executeBinding("render",self);return self;}
self.renderMessage=function(str){self.html(baconl("%div.evri-info-message.centered").html(str));};self.setArticles=function(list){if(list.articles.length>0){render(list.articles);}
else{self.renderMessage(baconl("%p.light").text("No related articles"));}
return self;};});Evri.defineClass(Evri.Widget.Components,"ImagesList",Evri.Widget.Components.MediaList);Evri.extendClass(Evri.Widget.Components.ImagesList,Evri.Widget.Components.MediaList.prototype);Evri.$.extend(Evri.Widget.Components.ImagesList.prototype,{componentName:'ComponentImagesList',componentClass:"evri-component-images"});Evri.extendClass(Evri.Widget.Components.ImagesList,{setImages:function(list){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;list.images.length>0?this.render(list.images):this.renderMessage(baconl("%p.light").text("No images found"));return this;},itemGenerator:function(image){var self=this;var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var thumbnail=baconl("%img").attr("src",image.thumbnail.url);if(parseInt(image.thumbnail.width)>(self.width()*2/3))
{thumbnail.width(self.width()*(2/3));}
return baconl("%li").append(baconl("%a.centered").attr("href",image.clickUrl).attr("target","_blank").append(thumbnail));}});Evri.defineClass(Evri.Widget.Components,"VideosList",Evri.Widget.Components.MediaList);Evri.extendClass(Evri.Widget.Components.VideosList,Evri.Widget.Components.MediaList.prototype);Evri.$.extend(Evri.Widget.Components.VideosList.prototype,{componentName:'ComponentVideosList',componentClass:"evri-component-videos"});Evri.extendClass(Evri.Widget.Components.VideosList,{setVideos:function(list){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;list.videos.length>0?this.render(list.videos):this.renderMessage(baconl("%p.light").text("No videos found"));return this;},itemGenerator:function(video){var self=this;var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var image=video.thumbnails[0];var thumbnail=baconl("%img").attr("src",image.url);return baconl("%li").append(baconl("%a.centered").attr("href",video.url).attr("target","_blank").append(thumbnail));}});Evri.defineClass(Evri.Widget.Components,"ImagesVerticalCarousel",Evri.Widget.Components.ImagesList);Evri.extendClass(Evri.Widget.Components.ImagesVerticalCarousel,Evri.Widget.Components.ImagesList.prototype);Evri.$.extend(Evri.Widget.Components.ImagesVerticalCarousel.prototype,{componentName:'ComponentImagesVerticalCarousel',componentClass:"evri-component-images evri-component-images-vertical-carousel",afterRender:function(){var self=this;var Helpers=Evri.Widget.Components.Helpers;var buttons=Helpers.makeVerticalCarousel(self.find("ol"));self.prepend(buttons.up);self.append(buttons.down);Helpers.scrollAnalytics(self,"ImagesCarousel",self.analytics);}});Evri.defineClass(Evri.Widget.Components,"MediaListColumns",function(options){options=options||{};var analytics=options.analytics||new Evri.Widget.Analytics(this.componentName);var columns=options.columns||1;var $=Evri.jQuery;var Helpers=Evri.Widget.Components.Helpers;var baconl=Helpers.jQueryBaconl;var self=this;$.extend(self,baconl("%div").addClass(this.componentClass));self.columns=function(){return columns;}
self.analytics=function(){return analytics;}});Evri.extendClass(Evri.Widget.Components.MediaListColumns,{render:function(list){var Helpers=Evri.Widget.Components.Helpers;var self=this;self.empty();var mediaRows=[];var currentRow=[];Evri.$.each(list,function(i){currentRow.push(this);if(currentRow.length===self.columns()||i===(list.length-1)){mediaRows.push(currentRow);currentRow=[];}});var items=self.generateListItems(mediaRows);self.append.apply(self,items);self.bindAnalytics()},renderMessage:function(str){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;this.html(baconl("%div.evri-info-message.centered").html(str));},generateListItems:function(mediaRows){var Helpers=Evri.Widget.Components.Helpers;var baconl=Helpers.jQueryBaconl;var self=this;return Helpers.generateVerticalCarousel(mediaRows,function(videos){var wrapper=baconl("%li");Evri.$.each(videos,function(i,video){var thumbnail=self.generateItemCell(video);wrapper.append(thumbnail);});return wrapper;});}});Evri.defineClass(Evri.Widget.Components,"VideosListColumns",Evri.Widget.Components.MediaListColumns);Evri.extendClass(Evri.Widget.Components.VideosListColumns,Evri.Widget.Components.MediaListColumns.prototype);Evri.extendClass(Evri.Widget.Components.VideosListColumns,{componentName:'ComponentVideosListColumns',componentClass:"evri-component evri-component-videos",setVideos:function(list){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var message=baconl("%p.light").text("No videos found")
list.videos.length>0?this.render(list.videos):this.renderMessage(message);return this;},generateItemCell:function(video){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var t=baconl("%img").attr("src",video.thumbnails[0].url);return baconl("%a").attr("href",video.url).attr("target","_blank").append(t);},bindAnalytics:function(){var Helpers=Evri.Widget.Components.Helpers;var self=this;self.find("li a").bind("click.analytics",function(){self.analytics().trackDHTML("ComponentVideosList/OpenVideo");});Helpers.scrollAnalytics(self,"VideosCarousel",self.analytics());}});Evri.defineClass(Evri.Widget.Components,"ImagesListColumns",Evri.Widget.Components.MediaListColumns);Evri.extendClass(Evri.Widget.Components.ImagesListColumns,Evri.Widget.Components.MediaListColumns.prototype);Evri.extendClass(Evri.Widget.Components.ImagesListColumns,{componentName:'ComponentImagesListColumns',componentClass:"evri-component evri-component-images",setImages:function(list){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var message=baconl("%p.light").text("No images found")
list.images.length>0?this.render(list.images):this.renderMessage(message);return this;},generateItemCell:function(image){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var thumb=baconl("%img").attr("src",image.thumbnail.url);return baconl("%a").attr("href",image.clickUrl).attr("target","_blank").append(thumb);},bindAnalytics:function(){var Helpers=Evri.Widget.Components.Helpers;var self=this;self.find("li a").bind("click.analytics",function(){self.analytics().trackDHTML("ComponentImagesList/OpenImage");});Helpers.scrollAnalytics(self,"ImagesCarousel",self.analytics());}});Evri.defineClass(Evri.Widget.Components,"VideoPlayer",function(video,opts){var options=Evri.$.extend({analytics:new Evri.Widget.Analytics('VideoPlayer')},opts);var b=Evri.Widget.Components.Helpers.jQueryBaconl;Evri.$.extend(this,b("%div.evri-component.evri-component-video-player"));this.renderMarkup(video);});Evri.extendClass(Evri.Widget.Components.VideoPlayer,{insertVideo:function(vid){var self=this;var randomId="evri-video-player"+(new Date).getTime();var youtubeURL=vid.url+"&enablejsapi=1";var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var player=baconl("%div.evri-video-player").attr("id",randomId);var embedArea=self.find(".evri-video-player-embed-area").append(player);setTimeout(function(){Evri.Flash.swfobject.embedSWF(youtubeURL,randomId,embedArea.width(),embedArea.height(),"8",null,null,{allowScriptAccess:"always"},{},true);},300)
return self;},renderMarkup:function(video){var b=Evri.Widget.Components.Helpers.jQueryBaconl;var self=this;var seconds=parseInt(video.duration%60);seconds=seconds<10?("0"+seconds):(""+seconds);var minutes=parseInt(video.duration/60);var duration=""+minutes+":"+seconds;function link(text){return b("%a").attr("href",video.url).text(text);}
self.append(b("%a.evri-video-player-close"),b(".evri-video-player-embed-area"),b(".evri-video-data").append(b("%h3").html(link(video.title)),b("%p.evri-video-duration").text(duration),b(".evri-video-description").text(video.content),b("%p.evri-video-source").append("Source: ",link("YouTube"))));self.insertVideo(video);return self;}});Evri.defineClass(Evri.Widget.Components,"Tabs",function(options){var self=this;options=options||{};var analytics=options.analytics||new Evri.Widget.Analytics('ComponentTabs');var $=Evri.jQuery;var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;Evri.Widget.Components.Behaviors.bindable(self);$.extend(self,baconl("%div.evri-component.evri-component-tabs"));var tabsList=baconl("%ul");var viewArea=baconl("%div.evri-component-tabs-view");var views=[];var selectedIndex=0;self.addTab=function(label,view){var listItem=baconl("%li.evri-component-button.evri-component-tab").append(baconl("%p.evri-component-tab-label").text(label));listItem.bind("click.analytics",function(){analytics.trackDHTML("ComponentTabs/"+label);});listItem.bind("click",function(){selectedIndex=$(tabsList).children().index(this);tabsList.find(".evri-component-tab").removeClass("evri-component-tab-selected");listItem.addClass("evri-component-tab-selected");viewArea.children().hide();view.show();});views.push(view);tabsList.append(listItem);viewArea.append(view);return listItem;};self.selectTab=function(index){if(index===undefined)return selectedIndex;tabsList.children("li").eq(index).trigger("click.");};self.append(tabsList,viewArea);});Evri.defineClass(Evri.Widget.Components,"SourceConstrainedArticles",function(options){var self=this;options=Evri.$.extend({analytics:new Evri.Widget.Analytics(self.componentName)},options||{});Evri.$.extend(this,Evri.$("<div/>").addClass(this.componentClass));});Evri.extendClass(Evri.Widget.Components.SourceConstrainedArticles,{componentName:'SourceConstrainedArticles',componentClass:"evri-source-constrained-articles",setMediaSet:function(ms){this.mediaSet=ms;this.render(ms);},retrieveArticles:function(model,view,carousel){var self=this;var tab=self.find(".evri-component-tab-selected");var errorCallb=arguments.callee;carousel.renderMessage("... loading ...");model.media.getArticles({onError:function(){var link=self.errorHandler(function(){errorCallb.call(self,model,view,carousel);});carousel.html(link);},onComplete:function(a){if(a.articles.length){carousel.setArticles(a);}
else{tab.next().trigger("click.").length&&tab.addClass("evri-component-tab-disabled");carousel.renderMessage("No articles found.");}}},{articleSnippetLength:80,mediaConstraint:view.mediaConstraint,includeMatchedLocations:true});},articlesFor:function(model){this.currentModel=model;this.find(".evri-component-tab-selected").trigger("click.");},errorHandler:function(callb){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var errorMessage="There was an error loading this section.";return baconl(".evri-info-message.centered").append(baconl("%p").text(errorMessage),baconl("%a").text("Click here to try again").click(callb));},addTabFor:function(view,tabsPanel){var self=this;var c=new Evri.Widget.Components.ArticlesVerticalCarousel();c.attr("data-label-name",view.label);tabsPanel.addTab(view.label,c);tabsPanel.find(".evri-component-tab:last").click(function(){self.retrieveArticles(self.currentModel,view,c);});},render:function(ms){var self=this;var mediaSetTabs=new Evri.Widget.Components.Tabs();mediaSetTabs.addClass("evri-articles-tabs").find(".evri-component-tabs-view").addClass("evri-media-viewport");Evri.$.each(ms.views,function(i,view){self.addTabFor(view,mediaSetTabs);});this.html(mediaSetTabs);}});Evri.defineClass(Evri.Widget.Components,"ProductsList",Evri.Widget.Components.MediaList);Evri.extendClass(Evri.Widget.Components.ProductsList,Evri.Widget.Components.MediaList.prototype);Evri.$.extend(Evri.Widget.Components.ProductsList.prototype,{componentName:'ComponentProductsList',componentClass:"evri-horizontal-component evri-component-horizontal-products"});Evri.extendClass(Evri.Widget.Components.ProductsList,{rows:1,$:Evri.$,setProducts:function(list,rows){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;this.rows=rows;list.length>0?this.renderHorizontal(list):this.renderMessage(baconl("%p.light").text("No products found"));return this;},afterRender:function(){var self=this;self.find("div.product-div a").bind("click.analytics",function(){self.analytics.trackReferral("Products/ListItem");});},itemGenerator:function(items){var self=this;var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var orderedList=baconl("%ol");var rows=self.rows;var li=undefined;var totalRows=0;self.$.each(items,function(index,product){if(index%rows==0){li=baconl("%li");orderedList.append(li);totalRows++;}
var truncatedTitle=Evri.Widget.Components.Helpers.trimLongText(product.title,14,{'line-height':'12px','font-size':'12px','font-weight':'normal','width':260});var titleDiv=baconl(".title").append(baconl("%a").text(truncatedTitle).attr({"target":"_blank","title":product.title}).attr("href",product.detailPageURL));var thumb=baconl(".img").append(baconl("%a").attr({"target":"_blank","href":product.detailPageURL,"title":product.title}).append(baconl("%img").attr({"src":product.imageurl})));thumb.find("img").load(function(){if(self.$(this).height()>60){self.$(this).width("auto").height(60);}});var subTitle="";if(product.subtitle){subTitle=baconl("%div").text(product.subtitle);}
var rating='';if(product.rating_img_src){var ratingImg=baconl("%img").attr("src",product.rating_img_src);rating=baconl("%div.rating-img").append(ratingImg);}
var productInfo=baconl("%div.product-info").append(subTitle).append("("+product.productGroup+")").append(rating);var titleImgDiv=baconl("%div.product-title-img").append(titleDiv,thumb,productInfo);var priceDiv="";if(product.price){priceDiv=baconl("%div.product-price").text(product.price);}
li.append(baconl("%div.product-div").append(titleImgDiv.append(priceDiv)));});orderedList.width(298*totalRows);return orderedList;}});Evri.defineClass(Evri.Widget.Components,"ProductListColumns",Evri.Widget.Components.MediaListColumns);Evri.extendClass(Evri.Widget.Components.ProductListColumns,Evri.Widget.Components.MediaListColumns.prototype);Evri.extendClass(Evri.Widget.Components.ProductListColumns,{componentName:'ComponentProductListColumns',componentClass:"evri-component evri-component-products",setProducts:function(list){var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var message=baconl("%p.light").text("No products found")
list.length>0?this.render(list):this.renderMessage(message);return this;},generateItemCell:function(product){var self=this;self.$=Evri.$;var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;var truncatedTitle=Evri.Widget.Components.Helpers.trimLongText(product.title,14,{'line-height':'12px','font-size':'12px','font-weight':'normal','width':240});var titleDiv=baconl(".title").append(baconl("%a").text(truncatedTitle).attr({"target":"_blank","title":product.title}).attr("href",product.detailPageURL));var thumb=baconl(".img").append(baconl("%a").attr("target","_blank").attr({"href":product.detailPageURL,"title":product.title}).append(baconl("%img").attr({"src":product.imageurl})));thumb.find("img").load(function(){if(self.$(this).height()>60){self.$(this).width("auto").height(60);}});var subTitle="";if(product.subtitle){subTitle=baconl("%div").text(product.subtitle);}
var rating='';if(product.rating_img_src){var ratingImg=baconl("%img").attr("src",product.rating_img_src);rating=baconl("%div.rating-img").append(ratingImg);}
var productInfo=baconl("%div.product-info").append(subTitle).append("("+product.productGroup+")").append(rating);var titleImgDiv=baconl("%div.product-title-img").append(titleDiv,thumb,productInfo);var priceDiv="";if(product.price){priceDiv=baconl("%div.product-price").text(product.price);}
return baconl("%div.product-div").append(titleImgDiv.append(priceDiv));},bindAnalytics:function(){var Helpers=Evri.Widget.Components.Helpers;var self=this;self.find("li a").bind("click.analytics",function(){self.analytics().trackDHTML("ComponentProductList/OpenProduct");});Helpers.scrollAnalytics(self,"ProductsCarousel",self.analytics());}});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.defineClass(Evri.Widget,"TimesOnline",function(options){var self=this;var $=Evri.jQuery;self.shouldRenderWidget=!!window.location.pathname.match(/.ece$/);self.analytics=new Evri.Widget.Analytics('TOL');self.analytics.trackDHTML("Instantiate");self.interstitial=new Evri.Widget.TimesOnline.Interstitial(self);self.session=new Evri.API.Session({'appId':'evri-tol'});var Helpers=Evri.Widget.Components.Helpers;var baconl=Helpers.jQueryBaconl;$.extend(self,baconl("%div.evri-component.evri-widget-times-of-london"));var defaultOptions={stylesheet:Evri.API.Environment.staticAssetBaseUrl+"/stylesheets/TimesOfLondon.1.css",articlesDisplayType:"VerticalCarousel",defaultView:{label:"Times Online",sites:["timesonline.co.uk"]},secondView:{label:"From the web",sites:['ew.com','thisislondon.co.uk','bbc.co.uk','nme.com','telegraph.co.uk','rollingstone.com','people.com','imdb.com','itn.co.uk','guardian.co.uk','thesun.co.uk','guardian.co.uk','independent.co.uk','dailymail.co.uk','nytimes.com','washingtonpost.com','latimes.com','reuters.com']},articlesOptions:{}};options=options||{};var defaults=$.extend(defaultOptions,options);Evri.Widget.Utilities.useStylesheet(defaults.stylesheet);var tabViews={};var mediaViewSet=initMediaSet();var mediaConstraintTabs=initTabs();var entitiesList=baconl("%div.evri-entities-list-area");function availableContentHeight(){var nonContentItemsSpace=entitiesList.outerHeight()+
self.children("p.signature").outerHeight()+
mediaConstraintTabs.children("ul").find("li.evri-component-tab").outerHeight()
return self.height()-nonContentItemsSpace;}
function initMediaSet(){var ms=new Evri.Widget.MediaViewSet(self.session);ms.clear();var defaultView=ms.addView(defaults.defaultView.label);$.each(defaults.defaultView.sites,function(index,site){defaultView.includeDomain(site);});var webView=ms.addView(defaults.secondView.label);var webViewSites=defaults.secondView.sites;$.each(webViewSites,function(index,site){webView.includeDomain(site);});return ms;}
function initArticlesList(tabs,tabView){var articlesColumn=new Evri.Widget.Components.ArticlesVerticalList({analytics:self.analytics});tabViews[tabView.label]=articlesColumn;tabs.addTab(tabView.label,articlesColumn);articlesColumn.addBinding("render",function(){var availableHeight=availableContentHeight();articlesColumn.height(availableHeight);});}
function initArticlesVerticalCarousel(tabs,tabView){var articlesColumn=new Evri.Widget.Components.ArticlesVerticalCarousel({analytics:self.analytics});tabViews[tabView.label]=articlesColumn;tabs.addTab(tabView.label,articlesColumn);articlesColumn.addBinding("render",function(){var availableHeight=availableContentHeight()-2;if(articlesColumn.find("ol").height()>availableHeight)
{articlesColumn.find(".evri-component-button").show();}
else
{buttonHeight=0;articlesColumn.find(".evri-component-button").hide();}
articlesColumn.find("div.evri-component-viewport").height(availableHeight-30);});}
function initTabs(){var tabs=new Evri.Widget.Components.Tabs();tabs.children("div").addClass("clear");var cachedArticles={};$.each(mediaViewSet.views,function(index,view){if(defaults.articlesDisplayType==="List"){initArticlesList(tabs,view);}
else{initArticlesVerticalCarousel(tabs,view);}
tabs.children("ul").find("li.evri-component-tab:last").click(function(){mediaViewSet.setView(view);if(currentModel!==undefined){displayArticles(currentModel);}});});tabs.children("ul").find("li.evri-component-tab:first").addClass("evri-tab-first").end().find("li.evri-component-tab:last").addClass("evri-tab-last");return tabs;}
var currentModel;function displayArticles(model){currentModel=model;var view=mediaViewSet.currentView;var articlesOptions={mediaConstraint:view.mediaConstraint,includeMatchedLocations:true};articlesOptions=$.extend(articlesOptions,defaults.articlesOptions);function loadArticles(){tabViews[view.label].renderMessage(baconl("%p").text("...loading..."));model.media.getArticles({onFailure:function(){var articlesView=tabViews[view.label];articlesView.renderMessage(baconl("%p").append("There was an error loading this section. ",$("<a />").attr("href","javascript:;").text("Click here to try again.").click(loadArticles)));},onComplete:function(list){var articlesView=tabViews[view.label];if(view===mediaViewSet.currentView&&list.articles.length===0)
{mediaConstraintTabs.selectTab(1);}
if(view.label==="Times Online"){$.each(list.articles,function(i,article){if(article.author===undefined){article.author=view.label}});}
articlesView.setArticles(list);articlesView.find("h3 a").removeAttr("target","");if(view.label!=="Times Online"){articlesView.find("h3 a").each(function(articleIndex,articleLink){var $link=$(articleLink);var articleURI=$link.attr("href");$link.click(function(){self.interstitial.block(articleURI,"ArticleReferral");$link.blur();return false;});});}
if(defaults.headersLength!==undefined)
{articlesView.find(".evri-component-viewport ol li h3 a").each(function(i,header){$(header).text(Helpers.wordTruncateString($(header).text(),defaults.headersLength));});}
if(defaults.attributionLength!==undefined){articlesView.find(".evri-component-viewport ol li p.evri-component-attribution").each(function(i,attribution){$(attribution).text(Helpers.wordTruncateString($(attribution).text(),defaults.attributionLength));});}}},articlesOptions);}
loadArticles();}
function getMediaForGraph(graph){var backButton=baconl("%div.reset-graph").hide().append(baconl(".button-back.left"),baconl(".button-back-text.left").text("to original articles"),baconl(".clear.no-height")).hover(function(){backButton.addClass("reset-graph-hover");},function(){backButton.removeClass("reset-graph-hover");}).click(function(){getMediaForGraph(graph);backButton.blur();backButton.hide();focusTitle.show();self.analytics.trackDHTML("EntitiesList/Reset");});var focusTitle=baconl("%h2.focus-on").text("See full profile:");function generateEntitiesList(entities){var listElement=baconl("%ol.entities-list");$.each(entities,function(i,entity){var entityPortalURI=entity.portalURI+"&articleURI="+encodeURIComponent(window.location.href);var $listItem=baconl("%li").hover(function(){$(this).addClass("evri-hover");},function(){$(this).removeClass("evri-hover");}).append(baconl("%a.evri-component-button.evri-filter-entity").append(baconl("%span").text(entity.name)).attr("title","See full profile at evri.com").click(function(){self.interstitial.block(entityPortalURI,"EDPReferral");}).click(function(){self.analytics.trackReferral("EntitiesList/EntityName",{});}));$listItem.prepend(baconl("%a.right.evri-edp-link").attr({"href":"javascript:void(0);","title":"See full profile at evri.com"}).append(baconl(".evri-component-button")).hover(function(){$(this).addClass("evri-edp-link-hover");},function(){$(this).removeClass("evri-edp-link-hover");}).click(function(){self.interstitial.block(entityPortalURI,"EDPReferral");self.analytics.trackReferral("EntitiesList/EntityPointer",{});}));listElement.append($listItem);});return listElement;};function displaySingleEntity(entity){displayArticles(entity);backButton.show();focusTitle.hide();};function displayTopEntities(list){var entities=list.slice(0,5);var logoImage=baconl("%img").attr("src",Evri.API.Environment.staticAssetBaseUrl+"/images/logo48x27.png");var tagline=baconl("%div.evri-logo").append(baconl("%a").click(function(){self.analytics.trackReferral("Logo/PortalHome");}).attr({"href":"http://www.evri.com/?jsapi="+encodeURIComponent(window.location.hostname)+"&articleURI="+encodeURIComponent(window.location.href)}).append(logoImage),baconl("%div.evri-tagline").append(baconl("%p").text("search less"),baconl("%p").text("understand more")));logoImage.pngFix();entitiesList.empty().append(focusTitle,backButton,generateEntitiesList(entities),tagline,baconl(".clear.no-height"));if(entities.length===0){focusTitle.empty();}}
displayArticles(graph);displayTopEntities(graph.entities);};function graphLoadingFailure(errorType,callb){return function(){self.analytics.trackError(errorType);entitiesList.empty().append(baconl("%p").append("There was an error loading this section. ",$("<a />").attr("href","javascript:;").text("Click here to try again.").click(callb)));}};self.graphReceived=function(callback){callback?self.bind("graphReceived",callback):self.trigger("graphReceived");return self;};function processGlobalGraph(graph){getMediaForGraph(graph);self.graphReceived();};self.getGraphForContent=function(content,uri){uri=uri||window.location.href;self.session.models.Graph.getForContent(content,{onComplete:processGlobalGraph,onFailure:graphLoadingFailure("FailedToLoadGraphForContent",function(){self.sendContent(content,uri);})},{'uri':uri});};self.sendContent=self.getGraphForContent;self.getGraphForCSSSelector=function(selector){var content=$(selector).mergeHtml();if(content.match(/\w+/)!==null){self.getGraphForContent(content);}}
self.sendContentForCSSSelector=self.getGraphForCSSSelector;self.getGraphForURL=function(address){address=address||window.location.href;self.session.models.Graph.getForURI(address,{onComplete:processGlobalGraph,onFailure:graphLoadingFailure("FailedToLoadGraphForURL",function(){self.getContentForURL(address);})},{});};self.getGraphForCurrentPage=function(){if(self.shouldRenderWidget){self.session.models.Graph.getForCurrentPage({onComplete:processGlobalGraph,onFailure:graphLoadingFailure("FailedToLoadGraphForURL",self.getGraphForCurrentPage)},{});}};self.namespace=function(){var browser="";if(Evri.$.browser.msie)browser="msie";if(Evri.$.browser.mozilla){browser=navigator.userAgent.match(/Firefox\/3/)?"firefox firefox3":"firefox firefox2";}
if(Evri.$.browser.safari)browser="safari";return baconl("#evri").addClass(browser).append(baconl("#evri").append(baconl("#evri").append(baconl("#evri").append(self).addClass("times-online"))));};self.renderIn=function(selector){var $container=Evri.$(selector);$container.onScrollIntoView(function(){self.analytics.trackDHTML("WidgetVisible");$container.one("mouseover",function(){self.analytics.trackDHTML("WidgetMouseOver");});},{'topOffset':200});$container.append(self.namespace());return self;};self.append(self.interstitial.$container,baconl("%p.signature").text("understand more:"),mediaConstraintTabs,entitiesList);mediaConstraintTabs.selectTab(0);});Evri.extendNamespace(Evri.Widget.TimesOnline,{init:function(){Evri.Widget.TimesOnline.initEntertainment();},createDefaultWidgetInstance:function(sources){var widget=new Evri.Widget.TimesOnline({headersLength:50,articlesOptions:{articleSnippetLength:110},secondView:{label:"From the web",sites:sources}});if(Evri.$("div#evri-times").length===0){Evri.$("div#editors-box").after(Evri.$("<div />").attr("id","evri-times"));}else{Evri.$("div#evri-times").empty();}
return widget;},renderWidget:function(sources){var widget=this.createDefaultWidgetInstance(sources);if(widget.shouldRenderWidget){widget.graphReceived(function(){widget.renderIn("#evri-times");});}
else{Evri.$("#evri-times").empty();}
return widget;},initWithSources:function(sources){sources=sources||[];return Evri.Widget.TimesOnline.renderWidget(sources);},initEntertainment:function(){var sources=['ew.com',"thisislondon.co.uk","bbc.co.uk","nme.com","telegraph.co.uk","rollingstone.com","people.com","imdb.com","itn.co.uk","guardian.co.uk"];return Evri.Widget.TimesOnline.initWithSources(sources);},initPolitics:function(){var sources=['thesun.co.uk',"guardian.co.uk","independent.co.uk","telegraph.co.uk","dailymail.co.uk","bbc.co.uk","nytimes.com","washingtonpost.com","latimes.com","reuters.com"];return Evri.Widget.TimesOnline.initWithSources(sources);}});Evri.defineClass(Evri.Widget.TimesOnline,"Interstitial",function($belongsTo){var self=this;var $=Evri.jQuery;var baconl=Evri.Widget.Components.Helpers.jQueryBaconl;;self.$belongsTo=$belongsTo;self.analytics=$belongsTo.analytics;self.$container=baconl("%div.evri-tol-interstitial-container");self.$closeButton=baconl("%a.close-button").attr({"href":"javascript:void(0);","title":"close"}).click(function(){var $button=$(this);self.close();$button.blur();}).appendTo(self.$container);self.$continueButton=baconl("%a.continue-to-evri-button").attr({"href":"javascript:void(0);","title":"Continue"}).text("Continue").append(baconl("%div.button-right")).click(function(){self.continueToURI();return false;});self.$container.append(baconl("%div.interstitial-body").append(baconl("%h3").text("You're leaving TimesOnline"),baconl("%p").text("TimesOnline is not responsible for this content."),baconl("%p").text("TimesOnline has not selected or endorsed this content."),self.$continueButton,baconl("%p.or").text("or"),baconl("%a.cancel-link").attr({"href":"javascript:void(0);"}).text("Stay on this page").click(function(){var $link=$(this);self.close();$link.blur();})));return self;});Evri.extendClass(Evri.Widget.TimesOnline.Interstitial,{block:function(uri,analyticsLabel){var self=this;self.continueURI=uri;self.labelForAnalytics=analyticsLabel;self.$container.css({height:self.$belongsTo.height(),width:self.$belongsTo.width()}).show();return self;},close:function(){var self=this;self.$container.hide();self.analytics.trackDHTML("Interstitial/Cancel/"+self.labelForAnalytics);return self;},continueToURI:function(){var self=this;self.analytics.trackReferral("Interstitial/Continue/"+self.labelForAnalytics);window.location.href=self.continueURI;return self;}});
