if(window.Evri===undefined){window.Evri={};}
if(window.Evri.defineNamespace===undefined){window.Evri.defineNamespace=function(root,namespace,items){items=items||{};if(root[namespace]===undefined){root[namespace]=items;}};window.Evri.extendNamespace=function(namespace,extensions){for(var i in extensions){if(namespace[i]===undefined){namespace[i]=extensions[i];}}};window.Evri.defineClass=function(root,className,constructor){if(root[className]===undefined){root[className]=function(){constructor.apply(this,arguments);};}};window.Evri.extendClass=function(klass,extensions){for(var i in extensions){if(klass.prototype[i]===undefined){klass.prototype[i]=extensions[i];}}};};Evri.defineNamespace(Evri,"API");Evri.extendNamespace(Evri.API,{isSetup:false,requestFailed:function(options){console.log(options.httpCode+": "+options.message);},setup:function(options){options=options||{};Evri.API.Environment.setTransport(options.transport);if(Evri.API.isSetup===false){Evri.API.Transport.setup();Evri.API.isSetup=true;}}});Evri.defineNamespace(Evri.API,"Environment");Evri.extendNamespace(Evri.API.Environment,{apiHost:"api.evri.com",apiPort:80,apiVersion:"v1",staticAssetBaseUrl:"http://www.evri.com/widget",portalHost:"www.evri.com",swfProxyHost:"www.evri.com",articleInIframe:false,set:function(key,value){if(key=="Transport"){alert("Use setTransport to change transport.");}else{Evri.API.Environment[key]=value;}
return Evri.API.Environment;},setTransport:function(transport){switch(transport){case"XmlHttp":Evri.API.Transport=Evri.API.XmlHttp;break;default:Evri.API.Transport=Evri.API.CrossDomain;break;}
return Evri.API.Environment;}});Evri.defineNamespace(Evri.API,"Utilities");Evri.extendNamespace(Evri.API.Utilities,{articleTracker:{'evri-washington-post':'waporef=evri.widget.1'},Date:{relativeDate:function(date,options){var displayDate="";options=options||{};if(date!==undefined){var nowDate=new Date();var pubDate=new Date(date);var nowDateUTCEpoch=Evri.API.Utilities.Date.utcEpochFor(nowDate);var pubDateUTCEpoch=Evri.API.Utilities.Date.utcEpochFor(pubDate);var epochDiff=Math.abs(nowDateUTCEpoch-pubDateUTCEpoch);var minute=60;var hour=60*minute;var day=24*hour;var week=7*day;var months=['January','February','March','April','May','June','July','August','September','October','November','December'];if(epochDiff<week){if(epochDiff<minute){displayDate="less than a minute ago";}else if(epochDiff<hour){var minutesAgo=Math.floor(epochDiff/minute);displayDate=""+minutesAgo+" minute"+(minutesAgo==1?'':'s')+" ago";}else if(epochDiff<day){var hoursAgo=Math.floor(epochDiff/hour);displayDate=""+hoursAgo+" hour"+(hoursAgo==1?'':'s')+" ago";}else{var daysAgo=Math.floor(epochDiff/day)
displayDate=""+daysAgo+" day"+(daysAgo==1?'':'s')+" ago";}}else{displayDate=months[pubDate.getUTCMonth()]+" "+pubDate.getUTCDate()+", "+pubDate.getUTCFullYear();}}
return displayDate;},utcEpochFor:function(date){return parseInt(Date.UTC(date.getFullYear(),date.getMonth(),date.getDate(),date.getHours(),date.getMinutes(),date.getSeconds(),date.getMilliseconds())/1000);}},HTML:{attributesFrom:function(attrs){var attrString="";for(var attrName in attrs){switch(attrName){case'class':attrString+=" "+attrName+'="'+attrs[attrName].replace(/\"/,'&quot;')+'"';break;default:break;}}
return attrString;},tokenizeStringHighlights:function(session,content,matches){var tokens=[];if(matches.length>0){var startPosition=0;for(var i=0;i<matches.length;i++){var match=matches[i];if(match.start>startPosition){tokens.push(new session.models.ContentRange(content.substr(startPosition,(match.start-startPosition))));}
tokens.push(new session.models.ContentRange(content.substr(match.start,match.snippetLength),match));startPosition=match.start+match.snippetLength;}
if(startPosition<content.length){tokens.push(new session.models.ContentRange(content.substr(startPosition,(content.length-startPosition))));}}else{tokens.push(new session.models.ContentRange(content));}
return tokens;},highlightContent:function(session,content,matches,tag,attrs){attrs=attrs||{};var tokens=Evri.API.Utilities.HTML.tokenizeStringHighlights(session,content,matches);var newContent="";var startTag="<"+tag+Evri.API.Utilities.HTML.attributesFrom(attrs)+">";var endTag="</"+tag+">";for(var i=0;i<tokens.length;i++){var range=tokens[i];newContent+=(range.matchedLocation!==undefined?startTag+range.content+endTag:range.content)}
return newContent;}},String:{capitalize:function(content){return content.charAt(0).toUpperCase()+content.substring(1).toLowerCase();}},URI:{cleanDomain:function(possibleDomain){return possibleDomain;},params:function(url){var hasQueryString=url.indexOf('?')>-1?true:false;var queryParams={};if(hasQueryString){var queryString=url.substring(url.indexOf('?')+1);var queryItems=queryString.split('&');for(var i=0;i<queryItems.length;i++){var queryItem=queryItems[i].split('=');queryParams[queryItem[0]]=decodeURIComponent(queryItem[1]);}}
return queryParams;}},baseUrl:function(){var url="http://"
+Evri.API.Environment.apiHost
+(isNaN(Evri.API.Environment.apiPort)==true||parseInt(Evri.API.Environment.apiPort)==80?"":":"+Evri.API.Environment.apiPort)
+"/"
+Evri.API.Environment.apiVersion;return url;},toQueryString:function(params,options){var prefix='?';options=options||{};if(options.truncateLongValues===undefined){options.truncateLongValues=false;}
if(options.hasQueryString!==undefined&&options.hasQueryString===true){prefix='&';}
var paramsList=[];for(var key in params){if(params[key]!==undefined){if((params[key]instanceof Array)===true){for(var i=0;i<params[key].length;i++){var value=encodeURIComponent(params[key][i]);paramsList.push(key+"="+value);}}else{var value=params[key];if(typeof(value)==="string"){if(key=="text"&&options.truncateLongValues===true){value=value.substr(0,1250).replace(/\s\S+?$/,'');}}
value=encodeURIComponent(value);paramsList.push(key+"="+value);}}}
var queryString=paramsList.join("&");return prefix+queryString;},currentURI:function(){return window.location.href.split('#')[0];},getRequestDuration:function(requestKey){return((new Date()).getTime()-(parseInt(requestKey.split("_")[0])))/1000;},apiURIForPath:function(uriPath){return window.location.protocol+"//"+Evri.API.Environment.apiHost+"/"+Evri.API.Environment.apiVersion+uriPath;},portalURIForPath:function(uriPath){var hasQueryString=uriPath.indexOf('?')>-1?true:false;return window.location.protocol+"//"
+Evri.API.Environment.portalHost+uriPath
+Evri.API.Utilities.toQueryString({jsapi:window.location.host},{hasQueryString:hasQueryString});},Class:{create:function(klassName){function klass(){this.klass=klassName;this.initialize.apply(this,arguments);}
return klass;}},JSON:{bindChildrenAndAttributesToObject:function(jsonNode,target){if(target.instanceAttributes===undefined){}
for(var member in jsonNode){if(Evri.API.Utilities.JSON.isAttribute(member)===true){target[member.substring(1)]=Evri.API.Utilities.JSON.getAttributeForNode(jsonNode,member);}else{target[member]=Evri.API.Utilities.JSON.getValueForPath(jsonNode,member);}}},getAttributeForNode:function(jsonNode,attr){return jsonNode[attr];},getNodeForPath:function(jsonNode,path){var nodeSet=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,path);var node=undefined;if(nodeSet!==undefined&&nodeSet.length>0){node=nodeSet[0];}
return node;},getNodeSetForPath:function(jsonNode,path){var traversal=Evri.API.Utilities.JSON.__traversal(jsonNode,path);var referenceNodeSet=[];if(traversal.status===true){referenceNodeSet=traversal.referenceNodeSet;}
return referenceNodeSet;},getValueForPath:function(jsonNode,path){var referenceNodeSet=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,path);var value=null;if(referenceNodeSet!==undefined&&referenceNodeSet.length>0&&referenceNodeSet[0]['$']!==undefined){value=referenceNodeSet[0]['$'];}
return value;},getValueForNode:function(jsonNode){return(jsonNode.$===undefined?undefined:jsonNode.$);},getValueForNodeSet:function(jsonNode,path){var nodeSet=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,path);var values=[];if(nodeSet.length>0){for(var cntr=0;cntr<nodeSet.length;cntr++){values.push(Evri.API.Utilities.JSON.getValueForNode(nodeSet[cntr]));}}
return values;},hasDescendantsForPath:function(jsonNode,path){return Evri.API.Utilities.JSON.__traversal(jsonNode,path).status;},isAttribute:function(path){return path.substring(0,1)=='@';},__traversal:function(jsonNode,path){var pathItems=path.split('/');var status=true;var referenceNode=jsonNode;var referenceNodeSet=[];for(var i=0;i<pathItems.length;i++){var pathItem=pathItems[i];if(referenceNode[pathItem]!==undefined){if((referenceNode[pathItem]instanceof Array)===true){referenceNodeSet=referenceNode[pathItem];referenceNode=referenceNodeSet[0];}else{referenceNodeSet=[referenceNode[pathItem]];referenceNode=referenceNodeSet[0];}}else{status=false;}}
return{referenceNode:referenceNode,referenceNodeSet:referenceNodeSet,status:status};}},buildMediaSourceUrl:function(pageUrl,title,defaultUrl,articleLinkTrackerKey){var mediaSourceUrl=defaultUrl;if(Evri.API.Environment.articleInIframe===true){if(articleLinkTrackerKey){var hasQueryString=pageUrl.indexOf('?')>-1?true:false;var articleLinkTrackerToken='';if(hasQueryString){articleLinkTrackerToken="&"+articleLinkTrackerKey;}
else{articleLinkTrackerToken="?"+articleLinkTrackerKey;}
pageUrl+=articleLinkTrackerToken;}
var portalUrl=window.location.protocol+"//"+Evri.API.Environment.portalHost;var widgetHostUrl=window.location.protocol+"//"+window.location.host;var mediaIFramePath="/media/article?page="+encodeURIComponent(pageUrl)+"&source="+encodeURIComponent(widgetHostUrl)+"&title="+encodeURIComponent(title);mediaSourceUrl=portalUrl+mediaIFramePath;}
else{if(articleLinkTrackerKey){var hasQueryString=mediaSourceUrl.indexOf('?')>-1?true:false;if(hasQueryString){var queryParams=Evri.API.Utilities.URI.params(mediaSourceUrl);var mediaSourceUrlStrippedQueryString=mediaSourceUrl.substring(0,mediaSourceUrl.indexOf('?'));var urlqueryTokenValue=queryParams["url"];if(urlqueryTokenValue){var articleLinkTrackerToken='';var hasQueryString=urlqueryTokenValue.indexOf('?')>-1?true:false;if(hasQueryString){articleLinkTrackerToken="&"+articleLinkTrackerKey;}
else{articleLinkTrackerToken="?"+articleLinkTrackerKey;}
queryParams["url"]=urlqueryTokenValue+articleLinkTrackerToken;mediaSourceUrlStrippedQueryString+=Evri.API.Utilities.toQueryString(queryParams);mediaSourceUrl=mediaSourceUrlStrippedQueryString;}}}}
return mediaSourceUrl;}});Evri.defineNamespace(Evri.API,"CrossDomain");Evri.extendNamespace(Evri.API.CrossDomain,{Model:{KeyGenerator:Evri.API.Utilities.Class.create('KeyGenerator')},Callbacks:{},setup:function(){Evri.API.CrossDomain.Model.KeyGenerator.prototype={initialize:function(){var self=this;var requestCounter=0;self.generateKey=function(){return""+(new Date()).getTime()+"_"+(++requestCounter);};}};Evri.API.CrossDomain.KeyGenerator=new Evri.API.CrossDomain.Model.KeyGenerator();},request:function(resource,params){if(params.uri===undefined&&params.queryToken===undefined){params.uri=Evri.API.Utilities.currentURI();}
Evri.API.CrossDomain.requestViaScriptTag(resource,params);},requestViaScriptTag:function(resource,params){var requestUrl='';if(params.isThirdPartyAPICall===true){params.appId=undefined;params.isThirdPartyAPICall=undefined;params.uri=undefined;var options={truncateLongValues:true};if(params.hasQueryString!==undefined&&params.hasQueryString===true){options.hasQueryString=true;params.hasQueryString=undefined;}
requestUrl=resource+Evri.API.Utilities.toQueryString(params,options);}
else{requestUrl=Evri.API.Utilities.baseUrl()+resource+".json"+Evri.API.Utilities.toQueryString(params,{truncateLongValues:true});}
var script=document.createElement("script");script.type="text/javascript";script.src=requestUrl;script.setAttribute("class","evri-jsonp-request");document.body.appendChild(script);},callRemoteMethod:function(session,resource,jsonpCallback,params,responseCallbacks){var requestKey=Evri.API.CrossDomain.KeyGenerator.generateKey();Evri.API.CrossDomain.Callbacks["_"+requestKey]={handler:function(responseJSON){responseJSON.requestDuration=Evri.API.Utilities.getRequestDuration(requestKey);jsonpCallback.call(null,responseJSON,responseCallbacks);}};for(var paramKey in session.sharedQueryStringParameters){params[paramKey]=session.sharedQueryStringParameters[paramKey];}
params.callback="Evri.API.CrossDomain.Callbacks._"+requestKey+".handler";if(responseCallbacks.onCreate!==undefined){responseCallbacks.onCreate.call();}
Evri.API.CrossDomain.request(resource,params);},handleJSONResponse:function(session,responseJSON,callbacks,responseHandler){var evriThingNode=responseJSON.evriThing;var responseStatus=Evri.API.Utilities.JSON.getAttributeForNode(evriThingNode,'@status');var requestDuration=responseJSON.requestDuration;if(callbacks!==undefined){var responseMessages=Evri.API.Utilities.JSON.getNodeSetForPath(evriThingNode,"messages/message");var errorMessages=[];if(responseStatus!="OK"&&responseMessages.length>1){for(var i=0;i<responseMessages.length;i++){var message=responseMessages[i];if(parseInt(message["@code"])!==0){errorMessages.push(Evri.API.Utilities.JSON.getValueForNode(message));}}}
if(responseStatus=="ERROR"&&callbacks.onFailure!==undefined){var errorMessage="An error occurred";if(errorMessages.length>=1){errorMessage=errorMessages.join("; ");}
var error=new session.models.APIError(errorMessages,{"responseJSON":responseJSON});error.requestDuration=requestDuration;callbacks.onFailure.call(null,error);return;}
var responseItem=null;if(callbacks.onLoaded!==undefined){callbacks.onLoaded.call(null,responseJSON);}
responseItem=responseHandler.call(null,responseJSON.evriThing);if(responseItem===null||responseItem===undefined){if(callbacks.onFailure!==undefined){var error=new session.models.APIError("Response object could not be instantiated",{"responseJSON":responseJSON});error.requestDuration=requestDuration;callbacks.onFailure.call(null,error);}}else{responseItem.requestDuration=requestDuration;if(callbacks.bindWith!==undefined){callbacks.bindWith.call(null,responseItem);}
callbacks.onComplete.call(null,responseItem);}}}});Evri.defineNamespace(Evri.API,"XmlHttp");Evri.defineNamespace(Evri.API,"Model");Evri.extendNamespace(Evri.API.Model,{entityTypes:['animal','bacterium','chemical','concept','condition','disorder','event','location','organism','organization','person','plant','product','substance','virus'],classes:['APIError','Article','ArticleLink','ArticleList','ContentRange','Entity','EntityConstraint','EntityList','EntityHistories','EntityHistory','EntityHistoryMention','EntityProperty','EntityPropertyList','EntityRelation','EntityRelationList','EntitySet','Facet','Graph','Image','ImageList','MatchedLocation','Media','MediaConstraint','Pair','Product','ProductList','Quote','QuoteList','Sentiment','SentimentList','SentimentSummary','SentimentSummaryList','Target','TargetList','Tweet','TweetList','TwitterQuery','TweetMatchedLocation','Video','VideoList','VideoStillImage','Zeitgeist'],generateForSession:function(session){session.models={};for(var i=0;i<Evri.API.Model.classes.length;i++){var klassName=Evri.API.Model.classes[i];Evri.API.Model.Class.create(klassName,session);}},generateResponseHandler:function(session,klass,handlerOptions){handlerOptions=handlerOptions||{};return function(responseJSON,responseCallbacks){Evri.API.Transport.handleJSONResponse(session,responseJSON,responseCallbacks,function(jsonNode){if(handlerOptions.beforeInstantiate!==undefined){switch(typeof(handlerOptions.beforeInstantiate)){case"function":jsonNode=handlerOptions.beforeInstantiate.call(null,jsonNode);break;case"string":jsonNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,handlerOptions.beforeInstantiate);break;default:break;}}
return new(session.models[klass])(jsonNode);});};}});Evri.defineNamespace(Evri.API.Model,"Class");Evri.extendNamespace(Evri.API.Model.Class,{create:function(klassName,session){if(Evri.API.Model[klassName]._prototypeWith!==undefined){session.models[klassName]=function(){this.klass=klassName;this.session=session;this.documentationUrl=Evri.API.Utilities.portalURIForPath("/developer/jsapi/index")+"#"+klassName+"Model";this.initialize.apply(this,arguments);};for(var prototypeDef in Evri.API.Model[klassName]._prototypeWith){session.models[klassName].prototype[prototypeDef]=Evri.API.Model[klassName]._prototypeWith[prototypeDef];}}else{session.models[klassName]={};}
for(var classMethodName in Evri.API.Model[klassName]._classMethodGenerators){session.models[klassName][classMethodName]=Evri.API.Model[klassName]._classMethodGenerators[classMethodName](session);}}});Evri.defineNamespace(Evri.API.Model,"APIError");Evri.extendNamespace(Evri.API.Model.APIError,{_classMethodGenerators:{},_prototypeWith:{initialize:function(message,options){var self=this;options=options||{};self.message=message;for(var key in options){if(self[key]===undefined){self[key]=options[key];}}
return self;},instanceAttributes:['documentationUrl','klass','message'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Article");Evri.extendNamespace(Evri.API.Model.Article,{_classMethodGenerators:{},_prototypeWith:{initialize:function(articleJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(articleJSON,self);var linkNode=Evri.API.Utilities.JSON.getNodeForPath(articleJSON,"link");if(linkNode!==undefined){self.link=new self.session.models.ArticleLink(linkNode,self);}
self.titleMatchedLocations=[];self.contentMatchedLocations=[];var titleMatchedLocationJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(articleJSON,"titleMatchedLocations/matchedLoc");var contentMatchedLocationJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(articleJSON,"contentMatchedLocations/matchedLoc");for(var i=0;i<titleMatchedLocationJSONNodes.length;i++){self.titleMatchedLocations.push(new self.session.models.MatchedLocation(titleMatchedLocationJSONNodes[i]));}
for(var i=0;i<contentMatchedLocationJSONNodes.length;i++){self.contentMatchedLocations.push(new self.session.models.MatchedLocation(contentMatchedLocationJSONNodes[i]));}
self.titleQueryMatches=[];self.contentQueryMatches=[];for(var i=0;i<self.titleMatchedLocations.length;i++){var match=self.titleMatchedLocations[i];if(match.matchType!='nonQueryEntity'){self.titleQueryMatches.push(match);}}
for(var i=0;i<self.contentMatchedLocations.length;i++){var match=self.contentMatchedLocations[i];if(match.matchType!='nonQueryEntity'){self.contentQueryMatches.push(match);}}
self.topEntities=[];var topEntitiesJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(articleJSON,"topEntities/entity");for(var i=0;i<topEntitiesJSONNodes.length;i++){self.topEntities.push(new self.session.models.Entity(topEntitiesJSONNodes[i]));}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','author','content','contentMatchedLocations','link','mentionedEntities','published','title','titleMatchedLocations'],instanceMethods:['getContentRanges','getGraph','getHighlightedContent','getHighlightedTitle','getRelativePublicationDate','getTitleRanges'],getGraph:function(callbacks,options){var self=this;self.session.models.Graph.getForURI(self.link.sourceUrl,callbacks,options);},getHighlightedTitle:function(tag,attrs){var self=this;return Evri.API.Utilities.HTML.highlightContent(self.session,self.title,self.titleQueryMatches,tag,attrs);},getTitleRanges:function(){var self=this;return Evri.API.Utilities.HTML.tokenizeStringHighlights(self.session,self.title,self.titleMatchedLocations);},getHighlightedContent:function(tag,attrs){var self=this;return Evri.API.Utilities.HTML.highlightContent(self.session,self.content,self.contentQueryMatches,tag,attrs);},getContentRanges:function(){var self=this;return Evri.API.Utilities.HTML.tokenizeStringHighlights(self.session,self.content,self.contentMatchedLocations);},getRelativePublicationDate:function(options){var self=this;return Evri.API.Utilities.Date.relativeDate(self.published,options);}}});Evri.defineNamespace(Evri.API.Model,"Quote");Evri.extendNamespace(Evri.API.Model.Quote,{_classMethodGenerators:{findQuotesAboutEntity:function(session){return function(resource,callbacks,options){var params={};options=options||{};params["entityURI"]=resource;session.models.QuoteList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(session,"/quotes/about",session.models.QuoteList.handleResponse,params,callbacks);};},findQuotesByEntity:function(session){return function(resource,callbacks,options){var params={};options=options||{};params["speaker"]=resource;session.models.QuoteList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(session,"/quotes",session.models.QuoteList.handleResponse,params,callbacks);};}},_prototypeWith:{initialize:function(quoteJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(quoteJSON,self);var articleNode=Evri.API.Utilities.JSON.getNodeForPath(quoteJSON,"article");self.article=new self.session.models.Article(articleNode);var entityNode=Evri.API.Utilities.JSON.getNodeForPath(quoteJSON,"speaker/entity");if(entityNode!==undefined){self.speaker=new self.session.models.Entity(entityNode);}
self.quoteBoundaryMatchedLocations=[];var quoteBoundaryMatchedLocationJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(quoteJSON,"quoteBoundaryMatchedLocations/matchedLoc");self.quoteBoundaryQueryMatches=[];for(var i=0;i<quoteBoundaryMatchedLocationJSONNodes.length;i++){self.quoteBoundaryMatchedLocations.push(new self.session.models.MatchedLocation(quoteBoundaryMatchedLocationJSONNodes[i]));}
for(var i=0;i<self.quoteBoundaryMatchedLocations.length;i++){var match=self.quoteBoundaryMatchedLocations[i];if(match.matchType!='nonQueryEntity'){self.quoteBoundaryQueryMatches.push(match);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','content','quoteBoundaryMatchedLocations','article','speaker'],instanceMethods:['getQuoteBoundaryRanges','getHighlightedContent','getRelativePublicationDate'],getQuoteBoundaryRanges:function(){var self=this;return Evri.API.Utilities.HTML.tokenizeStringHighlights(self.session,self.content,self.quoteBoundaryMatchedLocations);},getHighlightedContent:function(tag,attrs){var self=this;return Evri.API.Utilities.HTML.highlightContent(self.session,self.content,self.quoteBoundaryQueryMatches,tag,attrs);},getRelativePublicationDate:function(options){var self=this;return Evri.API.Utilities.Date.relativeDate(self.article.published,options);}}});Evri.defineNamespace(Evri.API.Model,"Sentiment");Evri.extendNamespace(Evri.API.Model.Sentiment,{findSentimentsAboutEntity:function(session,params,options,callbacks){session.models.SentimentList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(session,"/sentiment/about",session.models.SentimentList.handleResponse,params,callbacks);},setParamameter:function(entityURI,sentimentSource,sentimentType){var params={};if(entityURI){params.entityURI=entityURI;}
if(sentimentSource){params.sentimentSource=sentimentSource;}
if(sentimentType){params.sentimentType=sentimentType;}
return params;},_classMethodGenerators:{findPositiveSentiments:function(session){return function(entityURI,sentimentSource,callbacks,options){options=options||{};var params=Evri.API.Model.Sentiment.setParamameter(entityURI,sentimentSource,"positive");Evri.API.Model.Sentiment.findSentimentsAboutEntity(session,params,options,callbacks);};},findNegativeSentiments:function(session){return function(entityURI,sentimentSource,callbacks,options){options=options||{};var params=Evri.API.Model.Sentiment.setParamameter(entityURI,sentimentSource,"negative");Evri.API.Model.Sentiment.findSentimentsAboutEntity(session,params,options,callbacks);};},findPositiveSentimentsAboutEverything:function(session){return function(sentimentSource,callbacks,options){this.findPositiveSentiments(null,sentimentSource,callbacks,options);};},findNegativeSentimentsAboutEverything:function(session){return function(sentimentSource,callbacks,options){this.findNegativeSentiments(null,sentimentSource,callbacks,options);};},findPositiveSentimentsByEverything:function(session){return function(entityURI,callbacks,options){this.findPositiveSentiments(entityURI,null,callbacks,options);};},findNegativeSentimentsByEverything:function(session){return function(entityURI,callbacks,options){this.findNegativeSentiments(entityURI,null,callbacks,options);};}}});Evri.defineNamespace(Evri.API.Model,"SentimentSummary");Evri.extendNamespace(Evri.API.Model.SentimentSummary,{_classMethodGenerators:{findSentimentsSummaryAboutEntity:function(session){return function(resource,callbacks,options){var params={};options=options||{};params.entityURI=resource;params.includeSummaryDetails=true;session.models.SentimentSummaryList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(session,"/sentiment/summary/about",session.models.SentimentSummaryList.handleResponse,params,callbacks);};},findSentimentsSummaryByEntity:function(session){return function(resource,callbacks,options){var params={};options=options||{};params.sentimentSource=resource;params.includeSummaryDetails=true;session.models.SentimentSummaryList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(session,"/sentiment/summary",session.models.SentimentSummaryList.handleResponse,params,callbacks);};}},_prototypeWith:{initialize:function(sentimentSummaryJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(sentimentSummaryJSON,self);self.entityList=new Array();var sentimentSourceEntityList=Evri.API.Utilities.JSON.getNodeForPath(sentimentSummaryJSON,"sentimentSourceEntityList");if(sentimentSourceEntityList===undefined){sentimentSourceEntityList=Evri.API.Utilities.JSON.getNodeForPath(sentimentSummaryJSON,"sentimentSubjectEntityList");}
if(sentimentSourceEntityList){var entityList=Evri.API.Utilities.JSON.getNodeSetForPath(sentimentSourceEntityList,"entity");if(entityList!==undefined){for(var j=0;j<entityList.length;j++){var entity=new self.session.models.Entity(entityList[j]);entity.belongsTo=self;self.entityList.push(entity);}}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','entityList'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"ArticleLink");Evri.extendNamespace(Evri.API.Model.ArticleLink,{_classMethodGenerators:{},_prototypeWith:{initialize:function(linkJSONNode,article){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(linkJSONNode,self);self.sourceUrl="http://"+self.hostName+self.path;var articleLinkTrackerKey=Evri.API.Utilities.articleTracker[self.session.sharedQueryStringParameters["appId"]];var defaultArticleUrl=window.location.protocol+"//"+Evri.API.Environment.portalHost+self.href;self.href=Evri.API.Utilities.buildMediaSourceUrl(self.sourceUrl,article.title,defaultArticleUrl,articleLinkTrackerKey);return self;},instanceAttributes:['documentationUrl','klass','href','path','sourceUrl'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"ArticleList");Evri.extendNamespace(Evri.API.Model.ArticleList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ArticleList',{beforeInstantiate:"mediaResult"});},handleEntityRelationResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ArticleList',{beforeInstantiate:"relations/relation"});},handleTargetRelationResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ArticleList',{beforeInstantiate:"relations/relation/targets/entity"});},handleRequestOptions:function(session){return function(params,options){var boolean_params=['includeMatchedLocations','includeTopEntities'];for(var i=0;i<boolean_params.length;i++){var paramKey=boolean_params[i];if(params[paramKey]===undefined&&options[paramKey]===true){params[paramKey]=true;}}
if(options.mediaConstraint!==undefined&&options.mediaConstraint.klass=="MediaConstraint"){var constraints=options.mediaConstraint.toParams();if(constraints.includeDomains!==undefined){params.includeDomains=constraints.includeDomains;}
if(constraints.excludedDomains!==undefined){params.excludedDomains=constraints.excludedDomains;}}
if(options.articleSnippetLength!==undefined){params.articleSnippetLength=parseInt(options.articleSnippetLength);}
if(options.resultsPerPage!==undefined){params.resultsPerPage=parseInt(options.resultsPerPage);}
if(options.includeDates!==undefined){params.includeDates=options.includeDates;}};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.articles=[];var articleListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"articleList");if(articleListNode!==undefined){var articleJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(articleListNode,"article");for(var i=0;i<articleJSONNodes.length;i++){var article=new self.session.models.Article(articleJSONNodes[i]);article.belongsTo=self;self.articles.push(article);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','articles'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"QuoteList");Evri.extendNamespace(Evri.API.Model.QuoteList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'QuoteList',{beforeInstantiate:"mediaResult"});},handleRequestOptions:function(session){return function(params,options){var boolean_params=['includeMatchedLocations'];for(var i=0;i<boolean_params.length;i++){var paramKey=boolean_params[i];if(params[paramKey]===undefined&&options[paramKey]===true){params[paramKey]=true;}}
if(options.resultsPerPage!==undefined){params.resultsPerPage=parseInt(options.resultsPerPage);}};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.quotes=[];var quoteListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"quoteList");if(quoteListNode!==undefined){var quoteJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(quoteListNode,"quote");for(var i=0;i<quoteJSONNodes.length;i++){var quote=new self.session.models.Quote(quoteJSONNodes[i]);quote.belongsTo=self;self.quotes.push(quote);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','quotes'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"SentimentList");Evri.extendNamespace(Evri.API.Model.SentimentList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'SentimentList',{beforeInstantiate:"mediaResult"});},handleRequestOptions:function(session){return function(params,options){if(params.includeMatchedLocations===undefined&&options.includeMatchedLocations===true){params.includeMatchedLocations=true;}
if(options.mediaConstraint!==undefined&&options.mediaConstraint.klass==="MediaConstraint"){var constraints=options.mediaConstraint.toParams();if(constraints.includeDomains!==undefined){params.includeDomains=constraints.includeDomains;}
if(constraints.excludedDomains!==undefined){params.excludedDomains=constraints.excludedDomains;}}
if(options.articleSnippetLength!==undefined){params.articleSnippetLength=parseInt(options.articleSnippetLength);}
if(options.resultsPerPage!==undefined){params.resultsPerPage=parseInt(options.resultsPerPage);}
if(options.sentimentType!==undefined){params.sentimentType=options.sentimentType;}
if(options.sort!==undefined){params.sort=options.sort;}};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.articles=[];var sentimentListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"sentimentList");var sentimentNodes=Evri.API.Utilities.JSON.getNodeSetForPath(sentimentListNode,"sentiment");if(sentimentNodes!==undefined){for(var i=0;i<sentimentNodes.length;i++){var articleJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(sentimentNodes[i],"article");for(var j=0;j<articleJSONNodes.length;j++){var article=new self.session.models.Article(articleJSONNodes[j]);article.belongsTo=self;self.articles.push(article);}}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','articles'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"SentimentSummaryList");Evri.extendNamespace(Evri.API.Model.SentimentSummaryList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,"SentimentSummaryList",{beforeInstantiate:"mediaResult"});},handleRequestOptions:function(session){return function(params,options){if(params.includeMatchedLocations===undefined&&options.includeMatchedLocations===true){params.includeMatchedLocations=true;}
if(options.mediaConstraint!==undefined&&options.mediaConstraint.klass==="MediaConstraint"){var constraints=options.mediaConstraint.toParams();if(constraints.includeDomains!==undefined){params.includeDomains=constraints.includeDomains;}
if(constraints.excludedDomains!==undefined){params.excludedDomains=constraints.excludedDomains;}}
if(options.resultsPerPage!==undefined){params.resultsPerPage=parseInt(options.resultsPerPage);}
if(options.sentimentType!==undefined){params.sentimentType=options.sentimentType;}
if(options.sort!==undefined){params.sort=options.sort;}
if(options.includeSummaryDetails!==undefined){params.includeSummaryDetails=options.includeSummaryDetails;}};}},_prototypeWith:{initialize:function(jsonNode){var self=this;var sentimentSummaryListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"sentimentSummaryList");var sentimentSummaryNodes=Evri.API.Utilities.JSON.getNodeSetForPath(sentimentSummaryListNode,"sentimentSummary");for(var i=0;i<sentimentSummaryNodes.length;i++){var summaryDetail=new self.session.models.SentimentSummary(sentimentSummaryNodes[i]);if(summaryDetail.type==="positive"){self.positiveSummaryDetail=summaryDetail;}
else if(summaryDetail.type==="negative"){self.negativeSummaryDetail=summaryDetail;}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','positiveSummaryDetail','negativeSummaryDetail'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"ContentRange");Evri.extendNamespace(Evri.API.Model.ContentRange,{_classMethodGenerators:{},_prototypeWith:{initialize:function(content,matchedLocation,options){var self=this;options=options||{};self.content=content||"";self.matchedLocation=matchedLocation||undefined;return self;},instanceAttributes:['documentationUrl','klass','content','matchedLocation'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Entity");Evri.extendNamespace(Evri.API.Model.Entity,{_classMethodGenerators:{getById:function(session){return function(entityIds,property,callbacks){Evri.API.Transport.callRemoteMethod(session,"/entities",session.models.Entity.handleResponse,{entityId:entityIds,property:property},callbacks);};},findByName:function(session){return function(name,callbacks){Evri.API.Transport.callRemoteMethod(session,"/entities/find",session.models.EntityList.handleResponse,{name:name},callbacks);};},findById:function(session){return function(entityIds,callbacks){Evri.API.Transport.callRemoteMethod(session,"/entities/find",session.models.EntityList.handleResponse,{'entityId':entityIds},callbacks);};},findByPrefix:function(session){return function(prefix,callbacks){Evri.API.Transport.callRemoteMethod(session,"/entities/find",session.models.EntityList.handleResponse,{prefix:prefix},callbacks);};},findByResource:function(session){return function(resource,callbacks){Evri.API.Transport.callRemoteMethod(session,resource,session.models.Entity.handleResponse,{},callbacks);};},handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,"Entity",{beforeInstantiate:"entity"});},parseIdFromResource:function(session){return function(resource){var entityId=undefined;if(resource.match(/0x[A-Fa-f0-9]+$/)!==null){entityId=parseInt(resource.match(/0x[A-Fa-f0-9]+$/)[0],16)}
return entityId;};}},_prototypeWith:{initialize:function(entityJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(entityJSON,self);self.resource=self.href;self.relationsResource=self.resource+"/relations"
self.mediaResource=self.resource+"/media/related"
self.relatedEntitiesResource=self.resource+"/related/entities";self.known=false;if(self.resource!==undefined&&self.resource.match(/0x[a-fA-F0-9]+$/)!==null){self.known=true;if(self.id===undefined){self.id=self.session.models.Entity.parseIdFromResource(self.resource);}}
self.portalURI=self.resource===undefined?undefined:Evri.API.Utilities.portalURIForPath(self.resource);self.relationsServiceURI=Evri.API.Utilities.apiURIForPath(self.resource+"/relations");self.media=new self.session.models.Media(self);self.facets=[];var facetNodes=Evri.API.Utilities.JSON.getNodeSetForPath(entityJSON,"facets/facet");for(var i=0;i<facetNodes.length;i++){self.facets.push(new self.session.models.Facet(facetNodes[i]));}
self.propertyList=new self.session.models.EntityPropertyList(Evri.API.Utilities.JSON.getNodeForPath(entityJSON,"properties"));if(self.propertyList.findByName('wikipedia_paragraph').length>0){self.description=self.propertyList.findByName('wikipedia_paragraph')[0].value;}
else if(self.propertyList.findByName('crunchbase_paragraph').length>0){self.description=self.propertyList.findByName('crunchbase_paragraph')[0].value;}
return self;},instanceAttributes:['documentationUrl','klass','description','facets','href','id','known','media','mediaResource','name','portalURI','properties','relatedEntitiesResource','relationsResource','relationsServiceURI','resource','type'],instanceMethods:['getMentionStatistics','getName','getRelatedEntities','getRelations','getTopRelationsTargets','getTweetsAbout'],getRelatedEntities:function(callbacks,options){var self=this;options=options||{}
callbacks.bindWith=function(graph){self.graph=graph;graph.belongsTo=self;};if(self.queryToken!==undefined){Evri.API.Transport.callRemoteMethod(self.session,self.relatedEntitiesResource,self.session.models.Graph.handleResponse,{queryToken:self.queryToken},callbacks);}else{Evri.API.Transport.callRemoteMethod(self.session,self.relationsResource,self.session.models.EntityList.handleEntityRelationsGraphResponse,{'graphRelationsCount':(options.count!==undefined?options.count:10)},callbacks);}},getTopRelationsTargets:function(callbacks,options){var self=this;var params={};options=options||{};callbacks.bindWith=function(targetList){self.topTargetsList=targetList;targetList.belongsTo=self;};self.session.models.EntityList.handleRequestOptions(params,options);Evri.API.Transport.callRemoteMethod(self.session,self.relationsResource,self.session.models.TargetList.handleEntityRelationsGraphResponse,params,callbacks);},getRelations:function(callbacks,options){var self=this;options=options||{};callbacks.bindWith=function(relationList){self.relationList=relationList;relationList.belongsTo=self;};Evri.API.Transport.callRemoteMethod(self.session,self.relationsResource,self.session.models.EntityRelationList.handleResponse,{},callbacks);},getName:function(){var self=this;return self.name;},getMentionStatistics:function(callbacks,options){var self=this;options=options||{};callbacks.bindWith=function(entityHistory){entityHistory.belongsTo=self;};Evri.API.Transport.callRemoteMethod(self.session,"/zeitgeist/entity-history",self.session.models.EntityHistory.handleResponse,{data:"mentions",uri:self.resource,count:30,timeSpan:"day"},callbacks);},getTweetsAbout:function(callbacks,options){var self=this;options=options||{};callbacks.bindWith=function(tweetList){tweetList.belongsTo=self;};self.session.models.Tweet.findForEntityResource(self.resource,callbacks);}}});Evri.defineNamespace(Evri.API.Model,"EntityList");Evri.extendNamespace(Evri.API.Model.EntityList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityList',{beforeInstantiate:"entities"});},handleZeitgeistEntitiesPopularResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityList',{beforeInstantiate:"zeitgeist/popular/entities"});},handleZeitgeistEntitiesRisingResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityList',{beforeInstantiate:"zeitgeist/rising/entities"});},handleZeitgeistEntitiesFallingResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityList',{beforeInstantiate:"zeitgeist/falling/entities"});},handleEntityRelationsGraphResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityList',{beforeInstantiate:function(jsonNode){var relationNodes=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,"relations/graph/relation");var responseNode={entity:[]};if(relationNodes.length>0){for(var i=0;i<relationNodes.length;i++){var entityNodes=Evri.API.Utilities.JSON.getNodeSetForPath(relationNodes[i],"targets/entity");if(entityNodes.length>0){for(var j=0;j<entityNodes.length;j++){responseNode.entity.push(entityNodes[j]);}}}}
return responseNode;}});},handleRequestOptions:function(session){return function(params,options){if(options.entityConstraint!==undefined&&options.entityConstraint.klass=="EntityConstraint"){var constraints=options.entityConstraint.toParams();if(constraints.includeDomains!==undefined){params.includeDomains=constraints.includeDomains;}
if(constraints.excludedDomains!==undefined){params.excludedDomains=constraints.excludedDomains;}}
params.graphRelationsCount=(options.count!==undefined?options.count:10);};}},_prototypeWith:{initialize:function(listJSON){var self=this;var entityNodes=Evri.API.Utilities.JSON.getNodeSetForPath(listJSON,"entity");self.entities=[];for(var i=0;i<entityNodes.length;i++){self.entities.push(new self.session.models.Entity(entityNodes[i]));}
return self;},instanceAttributes:['documentationUrl','klass','entities'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"EntityHistories");Evri.extendNamespace(Evri.API.Model.EntityHistories,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityHistories',{beforeInstantiate:"entityHistories"});},findByEntityResource:function(session){return function(entityResources,callbacks,options){options=options||{};if(typeof(entityResources)==="string"){entityResources=[entityResources];}
Evri.API.Transport.callRemoteMethod(session,"/zeitgeist/entity-history",session.models.EntityHistories.handleResponse,{data:"mentions",uri:entityResources,count:30,timeSpan:"day"},callbacks);};},findForEntityList:function(session){return function(entityList,callbacks,options){options=options||{};var entityResources=[];for(var i=0;i<entityList.entities.length;i++){entityResources.push(entityList.entities[i].resource);}
Evri.API.Transport.callRemoteMethod(session,"/zeitgeist/entity-history",session.models.EntityHistories.handleResponse,{data:"mentions",uri:entityResources,count:30,timeSpan:"day"},callbacks);};}},_prototypeWith:{initialize:function(historiesJSON){var self=this;var historyJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(historiesJSON,"entityHistory");self.histories=[];self.historyMapByEntityResource={};for(var i=0;i<historyJSONNodes.length;i++){var history=new self.session.models.EntityHistory(historyJSONNodes[i])
self.histories.push(history);self.historyMapByEntityResource[history.entityResource]=history;}
return self;},instanceAttributes:['documentationUrl','klass','histories','historyMapByEntityResource'],instanceMethods:['getStatisticsForEntity'],getStatisticsForEntity:function(entity){var self=this;return self.historyMapByEntityResource[entity.resource];}}});Evri.defineNamespace(Evri.API.Model,"EntityHistory");Evri.extendNamespace(Evri.API.Model.EntityHistory,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityHistory',{beforeInstantiate:"entityHistories/entityHistory"});}},_prototypeWith:{initialize:function(historyJSON){var self=this;self.entityResource=Evri.API.Utilities.JSON.getAttributeForNode(historyJSON,"@href");self.mentions=[];var mentionData=Evri.API.Utilities.JSON.getValueForPath(historyJSON,"mentions");var now=(new Date()).getTime();var dayLength=24*60*60*1000;if(mentionData!==null){var mentions=mentionData.split(/,/);var mentionsLastIndex=mentions.length-1;for(var i=0;i<=mentionsLastIndex;i++){var count=parseInt(mentions[i]);var date=new Date(now-(dayLength*(mentionsLastIndex-i)));self.mentions.push(new self.session.models.EntityHistoryMention(count,date));}}
return self;},instanceAttributes:['documentationUrl','klass','mentions'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"EntityHistoryMention");Evri.extendNamespace(Evri.API.Model.EntityHistoryMention,{_classMethodGenerators:{},_prototypeWith:{initialize:function(count,date){var self=this;self.count=count;self.date=date;return self;},instanceAttributes:['documentationUrl','klass','count','date'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"EntityProperty");Evri.extendNamespace(Evri.API.Model.EntityProperty,{_classMethodGenerators:{},_prototypeWith:{initialize:function(propertyJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(propertyJSON,self);if(self.linkHref!==undefined){self.resource=self.linkHref;self.portalURI=Evri.API.Utilities.portalURIForPath(self.resource);}
return self;},instanceAttributes:['documentationUrl','klass','linkObjectName','linkHref','portalURI','name','resource','value'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"EntityPropertyList");Evri.extendNamespace(Evri.API.Model.EntityPropertyList,{_classMethodGenerators:{},_prototypeWith:{initialize:function(propertyListJSON){var self=this;self.properties=[];self.propertyNames=[];self.propertyMap={};if(propertyListJSON!==undefined){var propertyJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(propertyListJSON,"property");for(var i=0;i<propertyJSONNodes.length;i++){self.properties.push(new self.session.models.EntityProperty(propertyJSONNodes[i]));}
for(var i=0;i<self.properties.length;i++){var property=self.properties[i];if(self.propertyMap[property.name]===undefined){self.propertyMap[property.name]=[];}
self.propertyMap[property.name].push(property);}
for(var name in self.propertyMap){self.propertyNames.push(name);}
self.propertyNames=self.propertyNames.sort();}
return self;},instanceAttributes:['documentationUrl','klass','properties','propertyMap','propertyNames'],instanceMethods:['findByName','findHavingResource'],findByName:function(name){var self=this;var matchProperties=[];if(self.propertyMap[name]!==undefined){matchProperties=self.propertyMap[name];}
return matchProperties;},findHavingResource:function(){var self=this;var propertiesHavingResources=[];for(var i=0;i<self.properties.length;i++){var property=self.properties[i];if(property.resource!==undefined){propertiesHavingResources.push(property);}}
return propertiesHavingResources;}}});Evri.defineNamespace(Evri.API.Model,"EntityRelation");Evri.extendNamespace(Evri.API.Model.EntityRelation,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityRelation');}},_prototypeWith:{initialize:function(relationJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(relationJSON,self);self.resource=self.href;self.mediaResource=self.resource;self.portalURI=Evri.API.Utilities.portalURIForPath(self.resource);self.media=new self.session.models.Media(self,{responseHandlerMethod:"handleEntityRelationResponse",mediaTypeSpecifier:'media'});return self;},instanceAttributes:['documentationUrl','klass','href','media','mediaResource','portalURI','resource'],instanceMethods:['getName','getTargets'],getName:function(){var self=this;return self.name;},getTargets:function(callbacks,options){var self=this;options=options||{};callbacks.bindWith=function(targetList){self.targetList=targetList;targetList.belongsTo=self;};Evri.API.Transport.callRemoteMethod(self.session,self.resource,self.session.models.TargetList.handleResponse,{},callbacks);}}});Evri.defineNamespace(Evri.API.Model,"EntityRelationList");Evri.extendNamespace(Evri.API.Model.EntityRelationList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'EntityRelationList');}},_prototypeWith:{initialize:function(listJSON){var self=this;var relationsNodeSet=Evri.API.Utilities.JSON.getNodeSetForPath(listJSON,"relations/relation");var graphNode=Evri.API.Utilities.JSON.getNodeForPath(listJSON,"relations/graph");self.relations=[];for(var i=0;i<relationsNodeSet.length;i++){self.relations.push(new self.session.models.EntityRelation(relationsNodeSet[i]));}
return self;},instanceAttributes:['documentationUrl','klass','relations'],instanceMethods:['getFacets','getVerbs'],getFacets:function(){var self=this;var facets=[];for(var i=0;i<self.relations.length;i++){var relation=self.relations[i];switch(relation.type.toLowerCase()){case"facet":facets.push(relation);break;default:break;}}
return facets;},getVerbs:function(){var self=this;var verbs=[];for(var i=0;i<self.relations.length;i++){var relation=self.relations[i];switch(relation.type.toLowerCase()){case"verb":case"qt":verbs.push(relation);break;default:break;}}
return verbs;}}});Evri.defineNamespace(Evri.API.Model,"EntitySet");Evri.extendNamespace(Evri.API.Model.EntitySet,{_classMethodGenerators:{},_prototypeWith:{initialize:function(entityResources){var self=this;self.mediaResource="/entity-set/media";var entityIds=[];for(var cntr=0;cntr<entityResources.length;cntr++){var entityId=self.session.models.Entity.parseIdFromResource(entityResources[cntr]);if(entityId!==undefined){entityIds.push(entityId);}}
self.entityIdList=entityIds.join(",");self.media=new self.session.models.Media(self);return self;},instanceAttributes:['documentationUrl','klass'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Facet");Evri.extendNamespace(Evri.API.Model.Facet,{_classMethodGenerators:{},_prototypeWith:{initialize:function(facetJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(facetJSON,self);return self;},instanceAttributes:['documentationUrl','klass','name'],instanceMethods:['getName'],getName:function(){return self.name;}}});Evri.defineNamespace(Evri.API.Model,"Graph");Evri.extendNamespace(Evri.API.Model.Graph,{_classMethodGenerators:{getForContent:function(session){return function(content,callbacks,options){options=options||{};var remoteMethodParams={text:content};if(options.uri!==undefined){remoteMethodParams.uri=options.uri;}
Evri.API.Transport.callRemoteMethod(session,"/media/entities",session.models.Graph.handleResponse,remoteMethodParams,callbacks);};},getForURI:function(session){return function(uri,callbacks,options){var params={uri:uri};options=options||{};if(options.nocache===true){params.nocache=true;if(uri.match(/\?/)===null){params.uri+='?nocache='+(new Date()).getTime();}else{params.uri+='&nocache='+(new Date()).getTime();}}
Evri.API.Transport.callRemoteMethod(session,"/media/entities",session.models.Graph.handleResponse,params,callbacks);};},getForCurrentPage:function(session){return function(callbacks,options){session.models.Graph.getForURI(Evri.API.Utilities.currentURI(),callbacks,options);};},handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'Graph');}},_prototypeWith:{initialize:function(jsonNode){var self=this;var entityJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,"graph/entities/entity");self.belongsTo=undefined;self.entities=[];self.pairs=[];for(var i=0;i<entityJSONNodes.length;i++){self.entities.push(new self.session.models.Entity(entityJSONNodes[i]));};var pairJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,"graph/pairs/pair");if(pairJSONNodes!==undefined){for(var i=0;i<pairJSONNodes.length;i++){var pairJSONNode=pairJSONNodes[i];var pairEntityNodes=Evri.API.Utilities.JSON.getNodeSetForPath(pairJSONNode,"entity");var entities=[];for(var j=0;j<pairEntityNodes.length;j++){entities.push(new self.session.models.Entity(pairEntityNodes[j]));}
self.pairs.push(new self.session.models.Pair(entities[0],entities[1],pairJSONNode));}}
self.queryToken=Evri.API.Utilities.JSON.getValueForPath(jsonNode,"graph/queryToken");self.media=new self.session.models.Media(self);return self;},instanceAttributes:['documentationUrl','klass','entities','media','pairs','queryToken'],instanceMethods:['getName'],getName:function(){var self=this;return self.belongsTo===undefined?"Text Content Graph":self.belongsTo.getName()+" "+self.belongsTo.klass+" Graph";}}});Evri.defineNamespace(Evri.API.Model,"Image");Evri.extendNamespace(Evri.API.Model.Image,{_classMethodGenerators:{},_prototypeWith:{initialize:function(imageJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(imageJSON,self);var thumbnailNode=Evri.API.Utilities.JSON.getNodeForPath(imageJSON,"thumbnail");if(thumbnailNode!==undefined){self.thumbnail=new self.session.models.Image(thumbnailNode);self.clickUrl=Evri.API.Utilities.buildMediaSourceUrl(self.clickUrl,self.title,self.clickUrl);self.thumbnail.belongsTo=self;}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','articleHref','clickUrl','content','date','height','mimeType','size','thumbnail','title','url','width'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"ImageList");Evri.extendNamespace(Evri.API.Model.ImageList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ImageList',{beforeInstantiate:"mediaResult"});},handleTargetRelationResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ImageList',{beforeInstantiate:"relations/relation/targets/entity"});},handleRequestOptions:function(session){return function(params,options){var acceptedOptions=['resultsPerPage'];for(var i=0;i<acceptedOptions.length;i++){var key=acceptedOptions[i];if(options[key]!==undefined){params[key]=options[key];}}
if(options.page!==undefined){var page=parseInt(options.page);var resultsPerPage=params.resultsPerPage||10;params.startId=((page-1)*resultsPerPage);}};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.images=[];var listNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"imageList");if(listNode!==undefined){var imageJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(listNode,"image");for(var i=0;i<imageJSONNodes.length;i++){var image=new self.session.models.Image(imageJSONNodes[i]);image.belongsTo=self;self.images.push(image);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','images'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"MatchedLocation");Evri.extendNamespace(Evri.API.Model.MatchedLocation,{_classMethodGenerators:{},_prototypeWith:{initialize:function(jsonNode){var self=this;self.start=parseInt(jsonNode["@startPtr"]);self.end=parseInt(jsonNode["@endPtr"]);self.href=jsonNode["@href"];self.portalURI=undefined;self.matchType=jsonNode["@matchType"];self.snippetLength=self.end-self.start+1;if(self.href!==undefined&&self.href.length>0){self.portalURI=Evri.API.Utilities.portalURIForPath(self.href);}
return self;},instanceAttributes:['documentationUrl','klass','end','href','matchType','portalURI','snippetLength','start'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Media");Evri.extendNamespace(Evri.API.Model.Media,{getMediaByTypeGenerator:function(mediaListClass,mediaType,listsContainer){return function(callbacks,options){var self=this;var params={};options=options||{};params[self.mediaTypeSpecifier]=mediaType;if(self.belongsTo.queryToken!==undefined){params.queryToken=self.belongsTo.queryToken;}
if(self.belongsTo.entityIdList!==undefined){params.entityIdList=self.belongsTo.entityIdList;}
if(self.belongsTo.mediaParams!==undefined){for(var paramKey in self.belongsTo.mediaParams){params[paramKey]=self.belongsTo.mediaParams[paramKey];}}
callbacks.bindWith=function(list){list.belongsTo=self;self[listsContainer].push(list);};self.session.models[mediaListClass].handleRequestOptions(params,options)
Evri.API.Transport.callRemoteMethod(self.session,self.resource,self.session.models[mediaListClass][self.responseHandlerMethod],params,callbacks);};}});Evri.extendNamespace(Evri.API.Model.Media,{_classMethodGenerators:{},_prototypeWith:{initialize:function(belongsTo,options){var self=this;options=options||{}
self.belongsTo=belongsTo;self.mediaTypeSpecifier=options.mediaTypeSpecifier!==undefined?options.mediaTypeSpecifier:'type';self.responseHandlerMethod=(options.responseHandlerMethod!==undefined?options.responseHandlerMethod:"handleResponse");self.articleLists=[];self.imageLists=[];self.videoLists=[];self.productLists=[];self.tweetLists=[];self.resource=(belongsTo.mediaResource||"/media/related");return self;},instanceAttributes:['belongsTo','documentationUrl','klass','articleLists','imageLists','videoLists','productLists','tweetLists'],instanceMethods:['getArticles','getImages','getName','getVideos','getProducts','getRecommendedProducts','getTweets'],getArticles:Evri.API.Model.Media.getMediaByTypeGenerator("ArticleList","article","articleLists"),getImages:Evri.API.Model.Media.getMediaByTypeGenerator("ImageList","image","imageLists"),getVideos:Evri.API.Model.Media.getMediaByTypeGenerator("VideoList","video","videoLists"),getProducts:Evri.API.Model.Media.getMediaByTypeGenerator("ProductList","product","productLists"),getRecommendedProducts:Evri.API.Model.Media.getMediaByTypeGenerator("ProductList","productad","productLists"),getTweets:Evri.API.Model.Media.getMediaByTypeGenerator("TweetList","tweet","tweetLists"),getName:function(){var self=this;return self.belongsTo.getName()+" Media";}}});Evri.defineNamespace(Evri.API.Model,"MediaConstraint");Evri.extendNamespace(Evri.API.Model.MediaConstraint,{_classMethodGenerators:{},_prototypeWith:{initialize:function(){var self=this;self.includedDomains=[];self.excludedDomains=[];return self;},instanceAttributes:['documentationUrl','klass','excludedDomains','includedDomains'],instanceMethods:['excludeDomain','includeDomain','toParams'],excludeDomain:function(domain){var self=this;if(typeof(domain)==="string"){self.excludedDomains.push(Evri.API.Utilities.URI.cleanDomain(domain));}
return self;},includeDomain:function(domain){var self=this;if(typeof(domain)==="string"){self.includedDomains.push(Evri.API.Utilities.URI.cleanDomain(domain));}
return self;},toParams:function(){var self=this;var params={};if(self.includedDomains.length>0){params.includeDomains=self.includedDomains.join(',');}
if(self.excludedDomains.length>0){params.excludeDomains=self.excludedDomains.join(',');}
return params;}}});Evri.defineNamespace(Evri.API.Model,"EntityConstraint",Evri.API.Model.MediaConstraint);Evri.defineNamespace(Evri.API.Model,"Product");Evri.extendNamespace(Evri.API.Model.Product,{_classMethodGenerators:{},_prototypeWith:{initialize:function(productJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(productJSON,self);var productCreatorData=["author","artist","composer","creator","director","manufacturer"];for(var cntr=0;cntr<productCreatorData.length;cntr++){var nodeName=productCreatorData[cntr];var key=nodeName.toLowerCase()+"s";self[key]=Evri.API.Utilities.JSON.getValueForNodeSet(productJSON,nodeName);}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','name','id','group','url','imageurl','rating','price','label','releaseDate','height','width','referringUri','authors','artists','composers','directors','manufacturers','creators'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"ProductList");Evri.extendNamespace(Evri.API.Model.ProductList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'ProductList',{beforeInstantiate:"mediaResult"});},handleRequestOptions:function(session){return function(params,options){};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.products=[];var productListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"productList");if(productListNode!==undefined){var productJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(productListNode,"product");for(var i=0;i<productJSONNodes.length;i++){var product=new self.session.models.Product(productJSONNodes[i]);product.belongsTo=self;self.products.push(product);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','products'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Pair");Evri.extendNamespace(Evri.API.Model.Pair,{_classMethodGenerators:{},_prototypeWith:{initialize:function(entity1,entity2,pairJSON){var self=this;self.entity1=entity1;self.entity2=entity2;if(pairJSON!==undefined){Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(pairJSON,self);}
if(self.queryToken===undefined){self.mediaParams={'entityURI':[self.entity1.resource,self.entity2.resource]};}
self.media=new self.session.models.Media(self);return self;},instanceAttributes:['documentationUrl','klass','entity1','entity2','media','mediaParams','queryToken'],instanceMethods:['getName'],getName:function(){var self=this;return self.entity1.name+" => "+self.entity2.name;}}});Evri.defineNamespace(Evri.API.Model,"Target");Evri.extendNamespace(Evri.API.Model.Target,{_classMethodGenerators:{},_prototypeWith:{initialize:function(entityJSON){var self=this;self.entity=new self.session.models.Entity(entityJSON);self.href=self.entity.targetHref;self.resource=self.href;self.portalURI=Evri.API.Utilities.portalURIForPath(self.resource);self.mediaResource=self.resource;self.media=new self.session.models.Media(self,{responseHandlerMethod:"handleTargetRelationResponse",mediaTypeSpecifier:'media'});return self;},instanceAttributes:['documentationUrl','klass','entity','href','media','mediaResource','portalURI','resource'],instanceMethods:['getName'],getName:function(){var self=this;return self.entity.getName();}}});Evri.defineNamespace(Evri.API.Model,"TargetList");Evri.extendNamespace(Evri.API.Model.TargetList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'TargetList',{beforeInstantiate:"relations/relation/targets"});},handleEntityRelationsGraphResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'TargetList',{beforeInstantiate:function(jsonNode){var relationNodes=Evri.API.Utilities.JSON.getNodeSetForPath(jsonNode,"relations/graph/relation");var responseNode={entity:[]};if(relationNodes.length>0){for(var i=0;i<relationNodes.length;i++){var entityNodes=Evri.API.Utilities.JSON.getNodeSetForPath(relationNodes[i],"targets/entity");if(entityNodes.length>0){for(var j=0;j<entityNodes.length;j++){responseNode.entity.push(entityNodes[j]);}}}}
return responseNode;}});}},_prototypeWith:{initialize:function(targetsJSON){var self=this;var targetNodes=Evri.API.Utilities.JSON.getNodeSetForPath(targetsJSON,"entity");self.targets=[];for(var i=0;i<targetNodes.length;i++){self.targets.push(new self.session.models.Target(targetNodes[i]));}
return self;},instanceAttributes:['documentationUrl','klass','targets'],instanceMethods:['getName'],getName:function(){var self=this;return"Targets for '"+self.belongsTo.getName()+"' EntityRelation";}}});Evri.defineNamespace(Evri.API.Model,"Tweet");Evri.extendNamespace(Evri.API.Model.Tweet,{_classMethodGenerators:{findForQuery:function(session){return function(query,callbacks){Evri.API.Transport.callRemoteMethod(session,"/mashups/twitter/tag",session.models.TweetList.handleResponse,{'q':query},callbacks);};},findForEntityResource:function(session){return function(entityResource,callbacks){Evri.API.Transport.callRemoteMethod(session,"/mashups/twitter/tag",session.models.TweetList.handleResponse,{'entityURI':entityResource},callbacks);};},findFromUsername:function(session){return function(username,callbacks){var query="from:"+username.replace('@','');session.models.Tweet.findForQuery(query,callbacks);};},findToUsername:function(session){return function(username,callbacks){var query="to:"+username.replace('@','');session.models.Tweet.findForQuery(query,callbacks);};},getFindForEntityResourceFunction:function(session){return function(entityResource,callbacks){Evri.API.Transport.callRemoteMethod(session,"/mashups/twitter/query",session.models.TwitterQuery.handleResponse,{'entityURI':entityResource},callbacks);};},callTwitterForEntityResource:function(session){return function(twitterQuery,callbacks){Evri.API.Transport.callRemoteMethod(session,twitterQuery,session.models.TweetList.handleTwitterResponse,{isThirdPartyAPICall:true,hasQueryString:true},callbacks);};}},_prototypeWith:{initialize:function(tweetJSON){var self=this;var twitterEntryJSON=Evri.API.Utilities.JSON.getNodeForPath(tweetJSON,"twitterEntry");Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(twitterEntryJSON,self);self.matchedLocations=[];self.entityResources=[];self.entityIds=[];var entityResourcesNodes=Evri.API.Utilities.JSON.getNodeSetForPath(tweetJSON,"entities/taggedEntityData/entityUris/string");for(var i=0;i<entityResourcesNodes.length;i++){var resource=Evri.API.Utilities.JSON.getValueForNode(entityResourcesNodes[i]);self.entityResources.push(resource);var entityId=self.session.models.Entity.parseIdFromResource(resource);if(entityId!==undefined){self.entityIds.push(entityId);}}
var entityMatchedLocations=Evri.API.Utilities.JSON.getNodeSetForPath(tweetJSON,"entities/taggedEntityData/entityLocations/location");for(var i=0;i<entityMatchedLocations.length;i++){self.matchedLocations.push(new self.session.models.TweetMatchedLocation(entityMatchedLocations[i],self.entityResources));}
return self;},instanceAttributes:['documentationUrl','klass','belongsTo','authorName','authorURI','content','entityIds','entityResources','id','imageURI','matchedLocations','permalink','published','title','updated'],instanceMethods:['getEntityDetails','getRelativePublicationDate','getTitleRanges'],getEntityDetails:function(callbacks){var self=this;self.session.models.Entity.findById(self.entityIds,callbacks)},getRelativePublicationDate:function(options){var self=this;return Evri.API.Utilities.Date.relativeDate(self.published,options);},getTitleRanges:function(){var self=this;return Evri.API.Utilities.HTML.tokenizeStringHighlights(self.session,self.title,self.matchedLocations);}}});Evri.defineNamespace(Evri.API.Model,"TweetList");Evri.extendNamespace(Evri.API.Model.TweetList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,"TweetList",{beforeInstantiate:"twitterNet/twitterEntryData"});},handleTwitterResponse:function(session){return function(responseJSON,responseCallbacks){if(responseCallbacks!==undefined){if(responseJSON!==null){if(responseJSON.error!==undefined){var error=new session.models.APIError(responseJSON.error,{"responseJSON":responseJSON});responseCallbacks.onFailure.call(null,error);}
else{var responseItem=new(session.models["TweetList"])(responseJSON,{twitterResponse:true});responseCallbacks.onComplete.call(null,responseItem);}}
else{var error=new session.models.APIError("Response object is null");responseCallbacks.onFailure.call(null,error);}}};},handleRequestOptions:function(session){return function(params,options){};}},_prototypeWith:{initialize:function(tweetListJSON,options){var self=this;options=options||{};self.tweets=[];self.entityIds=[];self.entityResources=[];var tweetNodes=[];if(options.twitterResponse===true){tweetNodes=Evri.API.Utilities.JSON.getNodeSetForPath(tweetListJSON,"results");}
else{tweetNodes=Evri.API.Utilities.JSON.getNodeSetForPath(tweetListJSON,"taggedTwitterEntryData");}
var entityIdsMap={};var entityResourcesMap={};for(var i=0;i<tweetNodes.length;i++){var tweetNode=tweetNodes[i];var tweet=new self.session.models.Tweet(tweetNode);if(options.twitterResponse===true){tweet.authorName=tweetNode.from_user;tweet.authorURI="http://www.twitter.com/"+tweetNode.from_user;tweet.content=tweetNode.text;tweet.title=tweetNode.text;tweet.imageURI=tweetNode.profile_image_url;tweet.published=tweetNode.created_at;tweet.id=tweetNode.id;tweet.permalink='';tweet.updated='';}
self.tweets.push(tweet);for(var j=0;j<tweet.entityIds.length;j++){var entityId=tweet.entityIds[j];if(entityIdsMap[entityId]===undefined){entityIdsMap[entityId]=1;self.entityIds.push(entityId);}}
for(var j=0;j<tweet.entityResources.length;j++){var resource=tweet.entityResources[j];if(entityResourcesMap[resource]===undefined){entityResourcesMap[resource]=1;self.entityResources.push(resource);}}}
return self;},instanceAttributes:['entityIds','entityResources','tweets'],instanceMethods:['getEntityDetails'],getEntityDetails:function(callbacks){var self=this;self.session.models.Entity.findById(self.entityIds,callbacks)}}});Evri.defineNamespace(Evri.API.Model,"TweetMatchedLocation");Evri.extendNamespace(Evri.API.Model.TweetMatchedLocation,{_classMethodGenerators:{},_prototypeWith:{initialize:function(locationJSON,entityResources){var self=this;var entityIndex=parseInt(Evri.API.Utilities.JSON.getValueForPath(locationJSON,"ei"));self.href=entityResources[entityIndex];self.start=parseInt(Evri.API.Utilities.JSON.getValueForPath(locationJSON,"sp"));self.end=parseInt(Evri.API.Utilities.JSON.getValueForPath(locationJSON,"ep"));self.snippetLength=self.end-self.start;self.portalURI=Evri.API.Utilities.portalURIForPath(self.href);return self;},instanceAttributes:['documentationUrl','klass','end','href','portalURI','snippetLength','start',],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"TwitterQuery");Evri.extendNamespace(Evri.API.Model.TwitterQuery,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,"TwitterQuery",{beforeInstantiate:"twitterResult"});},handleRequestOptions:function(session){return function(params,options){};}},_prototypeWith:{initialize:function(twitterQueryJSON){var self=this;var twitterQueryJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(twitterQueryJSON,"query");if(twitterQueryJSONNodes.length>0){self.twitterSearchAPI=Evri.API.Utilities.JSON.getValueForNode(twitterQueryJSONNodes[0]);self.callTwitterForEntityResource=function(callbacks){self.session.models.Tweet.callTwitterForEntityResource(self.twitterSearchAPI,callbacks);};}
return self;},instanceAttributes:['twitterSearchAPI'],instanceMethods:['findByResource']}});Evri.defineNamespace(Evri.API.Model,"Video");Evri.extendNamespace(Evri.API.Model.Video,{_classMethodGenerators:{},_prototypeWith:{initialize:function(videoJSON){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(videoJSON,self);var thumbnailNodes=Evri.API.Utilities.JSON.getNodeSetForPath(videoJSON,"thumbnails/image");self.thumbnails=[];for(var i=0;i<thumbnailNodes.length;i++){var thumbnail=new self.session.models.VideoStillImage(thumbnailNodes[i]);thumbnail.belongsTo=self;self.thumbnails.push(thumbnail);}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','author','content','duration','id','medium','thumbnails','title','type','url'],instanceMethods:['getSourceUrl'],getSourceUrl:function(){var self=this;var sourceUrl="";if(self.id.match(/gdata\.youtube\.com/)!==-1){var youtubeBaseUrl="http://www.youtube.com/watch?v=";var urlComponents=self.id.split("/");var youtubeVideoId=urlComponents[urlComponents.length-1];sourceUrl=youtubeBaseUrl+youtubeVideoId;}
return sourceUrl;}}});Evri.defineNamespace(Evri.API.Model,"VideoList");Evri.extendNamespace(Evri.API.Model.VideoList,{_classMethodGenerators:{handleResponse:function(session){return Evri.API.Model.generateResponseHandler(session,'VideoList',{beforeInstantiate:"mediaResult"});},handleTargetRelationResponse:function(session){Evri.API.Model.generateResponseHandler(session,'VideoList',{beforeInstantiate:"relations/relation/targets/entity"});},handleRequestOptions:function(session){return function(params,options){};}},_prototypeWith:{initialize:function(jsonNode){var self=this;self.videos=[];var videoListNode=Evri.API.Utilities.JSON.getNodeForPath(jsonNode,"videoList");if(videoListNode!==undefined){var videoJSONNodes=Evri.API.Utilities.JSON.getNodeSetForPath(videoListNode,"video");for(var i=0;i<videoJSONNodes.length;i++){var video=new self.session.models.Video(videoJSONNodes[i]);video.belongsTo=self;self.videos.push(video);}}
return self;},instanceAttributes:['belongsTo','documentationUrl','klass','videos'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"VideoStillImage");Evri.extendNamespace(Evri.API.Model.VideoStillImage,{_classMethodGenerators:{},_prototypeWith:{initialize:function(jsonNode){var self=this;Evri.API.Utilities.JSON.bindChildrenAndAttributesToObject(jsonNode,self);return self;},instanceAttributes:['belongsTo','documentationUrl','klass','height','size','time','url','width'],instanceMethods:[]}});Evri.defineNamespace(Evri.API.Model,"Zeitgeist");Evri.extendNamespace(Evri.API.Model.Zeitgeist,{getEntitiesByEntityTypeAndZeitgeistTypeGenerator:function(session,zeitgeistType){return function(entityType,callbacks,options){var params={};options=options||{};if(options.resultsPerPage!==undefined){params.max=parseInt(options.resultsPerPage);}
if(options.facet!==undefined){params.facet=options.facet;}
Evri.API.Transport.callRemoteMethod(session,"/zeitgeist/entities/"+entityType+"/"+zeitgeistType,session.models.EntityList["handleZeitgeistEntities"+Evri.API.Utilities.String.capitalize(zeitgeistType)+"Response"],params,callbacks);};},_classMethodGenerators:{getPopularEntitiesByType:function(session){return Evri.API.Model.Zeitgeist.getEntitiesByEntityTypeAndZeitgeistTypeGenerator(session,'popular');},getRisingEntitiesByType:function(session){return Evri.API.Model.Zeitgeist.getEntitiesByEntityTypeAndZeitgeistTypeGenerator(session,'rising');},getFallingEntitiesByType:function(session){return Evri.API.Model.Zeitgeist.getEntitiesByEntityTypeAndZeitgeistTypeGenerator(session,'falling');}}});Evri.defineClass(Evri.API,"Session",function(options){var self=this;self.klass="Session";self.requiredQueryStringParameterKeys=['appId'];self.sharedQueryStringParameters={};for(var i=0;i<self.requiredQueryStringParameterKeys.length;i++){var key=self.requiredQueryStringParameterKeys[i];if(options[key]===undefined){alert(key+" is a required to create an Evri.API.Session");return undefined;}else{self.sharedQueryStringParameters[key]=options[key];}}
Evri.API.Model.generateForSession(self);return self;});Evri.API.setup({'transport':'CrossDomain'});Evri.jQuery||(function(){var
window=this,undefined,jQuery=window.Evri.jQuery=window.Evri.$=function(selector,context){return new jQuery.fn.init(selector,context);},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;this.context=selector;return this;}
if(typeof selector==="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])
selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem&&elem.id!=match[3])
return jQuery().find(selector);var ret=jQuery(elem||[]);ret.context=document;ret.selector=selector;return ret;}}else
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))
return jQuery(document).ready(selector);if(selector.selector&&selector.context){this.selector=selector.selector;this.context=selector.context;}
return this.setArray(jQuery.isArray(selector)?selector:jQuery.makeArray(selector));},selector:"",jquery:"1.3.2",size:function(){return this.length;},get:function(num){return num===undefined?Array.prototype.slice.call(this):this[num];},pushStack:function(elems,name,selector){var ret=jQuery(elems);ret.prevObject=this;ret.context=this.context;if(name==="find")
ret.selector=this.selector+(this.selector?" ":"")+selector;else if(name)
ret.selector=this.selector+"."+name+"("+selector+")";return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(typeof name==="string")
if(value===undefined)
return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}
return this.each(function(i){for(name in options)
jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)
value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!=="object"&&text!=null)
return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)
ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).clone();if(this[0].parentNode)
wrap.insertBefore(this[0]);wrap.map(function(){var elem=this;while(elem.firstChild)
elem=elem.firstChild;return elem;}).append(this);}
return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1)
this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1)
this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},push:[].push,sort:[].sort,splice:[].splice,find:function(selector){if(this.length===1){var ret=this.pushStack([],"find",selector);ret.length=0;jQuery.find(selector,this[0],ret);return ret;}else{return this.pushStack(jQuery.unique(jQuery.map(this,function(elem){return jQuery.find(selector,elem);})),"find",selector);}},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML;if(!html){var div=this.ownerDocument.createElement("div");div.appendChild(this.cloneNode(true));html=div.innerHTML;}
return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0];}else
return this.cloneNode(true);});if(events===true){var orig=this.find("*").andSelf(),i=0;ret.find("*").andSelf().each(function(){if(this.nodeName!==orig[i].nodeName)
return;var events=jQuery.data(orig[i],"events");for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data);}}
i++;});}
return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,jQuery.grep(this,function(elem){return elem.nodeType===1;})),"filter",selector);},closest:function(selector){var pos=jQuery.expr.match.POS.test(selector)?jQuery(selector):null,closer=0;return this.map(function(){var cur=this;while(cur&&cur.ownerDocument){if(pos?pos.index(cur)>-1:jQuery(cur).is(selector)){jQuery.data(cur,"closest",closer);return cur;}
cur=cur.parentNode;closer++;}});},not:function(selector){if(typeof selector==="string")
if(isSimple.test(selector))
return this.pushStack(jQuery.multiFilter(selector,this,true),"not",selector);else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector==="string"?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return!!selector&&this.is("."+selector);},val:function(value){if(value===undefined){var elem=this[0];if(elem){if(jQuery.nodeName(elem,'option'))
return(elem.attributes.value||{}).specified?elem.value:elem.text;if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)
return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery(option).val();if(one)
return value;values.push(value);}}
return values;}
return(elem.value||"").replace(/\r/g,"");}
return undefined;}
if(typeof value==="number")
value+='';return this.each(function(){if(this.nodeType!=1)
return;if(jQuery.isArray(value)&&/radio|checkbox/.test(this.type))
this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)
this.selectedIndex=-1;}else
this.value=value;});},html:function(value){return value===undefined?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,+i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},domManip:function(args,table,callback){if(this[0]){var fragment=(this[0].ownerDocument||this[0]).createDocumentFragment(),scripts=jQuery.clean(args,(this[0].ownerDocument||this[0]),fragment),first=fragment.firstChild;if(first)
for(var i=0,l=this.length;i<l;i++)
callback.call(root(this[i],first),this.length>1||i>0?fragment.cloneNode(true):fragment);if(scripts)
jQuery.each(scripts,evalScript);}
return this;function root(elem,cur){return table&&jQuery.nodeName(elem,"table")&&jQuery.nodeName(cur,"tr")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem;}}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)
jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)
elem.parentNode.removeChild(elem);}
function now(){return+new Date;}
jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2;}
if(typeof target!=="object"&&!jQuery.isFunction(target))
target={};if(length==i){target=this;--i;}
for(;i<length;i++)
if((options=arguments[i])!=null)
for(var name in options){var src=target[name],copy=options[name];if(target===copy)
continue;if(deep&&copy&&typeof copy==="object"&&!copy.nodeType)
target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)
target[name]=copy;}
return target;};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{},toString=Object.prototype.toString;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)
window.jQuery=_jQuery;return jQuery;},isFunction:function(obj){return toString.call(obj)==="[object Function]";},isArray:function(obj){return toString.call(obj)==="[object Array]";},isXMLDoc:function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&jQuery.isXMLDoc(elem.ownerDocument);},globalEval:function(data){if(data&&/\S/.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.support.scriptEval)
script.appendChild(document.createTextNode(data));else
script.text=data;head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length===undefined){for(name in object)
if(callback.apply(object[name],args)===false)
break;}else
for(;i<length;)
if(callback.apply(object[i++],args)===false)
break;}else{if(length===undefined){for(name in object)
if(callback.call(object[name],name,object[name])===false)
break;}else
for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}
return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))
value=value.call(elem,i);return typeof value==="number"&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))
elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)
elem.className=classNames!==undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return elem&&jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}
callback.call(elem);for(var name in options)
elem.style[name]=old[name];},css:function(elem,name,force,extra){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;if(extra==="border")
return;jQuery.each(which,function(){if(!extra)
val-=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;if(extra==="margin")
val+=parseFloat(jQuery.curCSS(elem,"margin"+this,true))||0;else
val-=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});}
if(elem.offsetWidth!==0)
getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,Math.round(val));}
return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;if(name=="opacity"&&!jQuery.support.opacity){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}
if(name.match(/float/i))
name=styleFloat;if(!force&&style&&style[name])
ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))
name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle)
ret=computedStyle.getPropertyValue(name);if(name=="opacity"&&ret=="")
ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}
return ret;},clean:function(elems,context,fragment){context=context||document;if(typeof context.createElement==="undefined")
context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;if(!fragment&&elems.length===1&&typeof elems[0]==="string"){var match=/^<(\w+)\s*\/?>$/.exec(elems[0]);if(match)
return[context.createElement(match[1])];}
var ret=[],scripts=[],div=context.createElement("div");jQuery.each(elems,function(i,elem){if(typeof elem==="number")
elem+='';if(!elem)
return;if(typeof elem==="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=elem.replace(/^\s+/,"").substring(0,10).toLowerCase();var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!jQuery.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)
div=div.lastChild;if(!jQuery.support.tbody){var hasBody=/<tbody/i.test(elem),tbody=!tags.indexOf("<table")&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&!hasBody?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)
if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)
tbody[j].parentNode.removeChild(tbody[j]);}
if(!jQuery.support.leadingWhitespace&&/^\s/.test(elem))
div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);elem=jQuery.makeArray(div.childNodes);}
if(elem.nodeType)
ret.push(elem);else
ret=jQuery.merge(ret,elem);});if(fragment){for(var i=0;ret[i];i++){if(jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i]);}else{if(ret[i].nodeType===1)
ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))));fragment.appendChild(ret[i]);}}
return scripts;}
return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)
return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&elem.parentNode)
elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)
throw"type property can't be changed";elem[name]=value;}
if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))
return elem.getAttributeNode(name).nodeValue;if(name=="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");return attributeNode&&attributeNode.specified?attributeNode.value:elem.nodeName.match(/(button|input|object|select|textarea)/i)?0:elem.nodeName.match(/^(a|area)$/i)&&elem.href?0:undefined;}
return elem[name];}
if(!jQuery.support.style&&notxml&&name=="style")
return jQuery.attr(elem.style,"cssText",value);if(set)
elem.setAttribute(name,""+value);var attr=!jQuery.support.hrefNormalized&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}
if(!jQuery.support.opacity&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+
(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}
return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}
name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)
elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||typeof array==="string"||jQuery.isFunction(array)||array.setInterval)
ret[0]=array;else
while(i)
ret[--i]=array[i];}
return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)
if(array[i]===elem)
return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(!jQuery.support.getAll){while((elem=second[i++])!=null)
if(elem.nodeType!=8)
first[pos++]=elem;}else
while((elem=second[i++])!=null)
first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}
return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)
if(!inv!=!callback(elems[i],i))
ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)
ret[ret.length]=value;}
return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,'0'])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")
ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret),name,selector);};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector);for(var i=0,l=insert.length;i<l;i++){var elems=(i>0?this.clone(true):this).get();jQuery.fn[original].apply(jQuery(insert[i]),elems);ret=ret.concat(elems);}
return this.pushStack(ret,name,selector);};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)
this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames,state){if(typeof state!=="boolean")
state=!jQuery.className.has(this,classNames);jQuery.className[state?"add":"remove"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).length){jQuery("*",this).add([this]).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)
this.parentNode.removeChild(this);}},empty:function(){jQuery(this).children().remove();while(this.firstChild)
this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}
var expando="jQuery"+now(),uuid=0,windowData={};jQuery.extend({cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)
id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])
jQuery.cache[id]={};if(data!==undefined)
jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])
break;if(!name)
jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)
elem.removeAttribute(expando);}
delete jQuery.cache[id];}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";var q=jQuery.data(elem,type);if(!q||jQuery.isArray(data))
q=jQuery.data(elem,type,jQuery.makeArray(data));else if(data)
q.push(data);}
return q;},dequeue:function(elem,type){var queue=jQuery.queue(elem,type),fn=queue.shift();if(!type||type==="fx")
fn=queue[0];if(fn!==undefined)
fn.call(elem);}});jQuery.fn.extend({data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)
data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},queue:function(type,data){if(typeof type!=="string"){data=type;type="fx";}
if(data===undefined)
return jQuery.queue(this[0],type);return this.each(function(){var queue=jQuery.queue(this,type,data);if(type=="fx"&&queue.length==1)
queue[0].call(this);});},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type);});}});(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,done=0,toString=Object.prototype.toString;var Sizzle=function(selector,context,results,seed){results=results||[];context=context||document;if(context.nodeType!==1&&context.nodeType!==9)
return[];if(!selector||typeof selector!=="string"){return results;}
var parts=[],m,set,checkSet,check,mode,extra,prune=true;chunker.lastIndex=0;while((m=chunker.exec(selector))!==null){parts.push(m[1]);if(m[2]){extra=RegExp.rightContext;break;}}
if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context);}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector])
selector+=parts.shift();set=posProcess(selector,set);}}}else{var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&context.parentNode?context.parentNode:context,isXML(context));set=Sizzle.filter(ret.expr,ret.set);if(parts.length>0){checkSet=makeArray(set);}else{prune=false;}
while(parts.length){var cur=parts.pop(),pop=cur;if(!Expr.relative[cur]){cur="";}else{pop=parts.pop();}
if(pop==null){pop=context;}
Expr.relative[cur](checkSet,pop,isXML(context));}}
if(!checkSet){checkSet=set;}
if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector);}
if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet);}else if(context.nodeType===1){for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i]);}}}else{for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i]);}}}}else{makeArray(checkSet,results);}
if(extra){Sizzle(extra,context,results,seed);if(sortOrder){hasDuplicate=false;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1);}}}}}
return results;};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set);};Sizzle.find=function(expr,context,isXML){var set,match;if(!expr){return[];}
for(var i=0,l=Expr.order.length;i<l;i++){var type=Expr.order[i],match;if((match=Expr.match[type].exec(expr))){var left=RegExp.leftContext;if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break;}}}}
if(!set){set=context.getElementsByTagName("*");}
return{set:set,expr:expr};};Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;anyFound=false;if(curLoop==result){result=[];}
if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true;}else if(match===true){continue;}}
if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true;}else{curLoop[i]=false;}}else if(pass){result.push(item);anyFound=true;}}}}
if(found!==undefined){if(!inplace){curLoop=result;}
expr=expr.replace(Expr.match[type],"");if(!anyFound){return[];}
break;}}}
if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr;}else{break;}}
old=expr;}
return curLoop;};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href");}},relative:{"+":function(checkSet,part,isXML){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag&&!isXML){part=part.toUpperCase();}
for(var i=0,l=checkSet.length,elem;i<l;i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}
checkSet[i]=isPartStrNotTag||elem&&elem.nodeName===part?elem||false:elem===part;}}
if(isPartStrNotTag){Sizzle.filter(part,checkSet,true);}},">":function(checkSet,part,isXML){var isPartStr=typeof part==="string";if(isPartStr&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName===part?parent:false;}}}else{for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part;}}
if(isPartStr){Sizzle.filter(part,checkSet,true);}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck;}
checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML);},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck;}
checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML);}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?[m]:[];}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i]);}}
return ret.length===0?null:ret;}},TAG:function(match,context){return context.getElementsByTagName(match[1]);}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";if(isXML){return match;}
for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").indexOf(match)>=0)){if(!inplace)
result.push(elem);}else if(inplace){curLoop[i]=false;}}}
return false;},ID:function(match){return match[1].replace(/\\/g,"");},TAG:function(match,curLoop){for(var i=0;curLoop[i]===false;i++){}
return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase();},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0;}
match[0]=done++;return match;},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name];}
if(match[2]==="~="){match[4]=" "+match[4]+" ";}
return match;},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if(match[3].match(chunker).length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop);}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret);}
return false;}}else if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true;}
return match;},POS:function(match){match.unshift(true);return match;}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden";},disabled:function(elem){return elem.disabled===true;},checked:function(elem){return elem.checked===true;},selected:function(elem){elem.parentNode.selectedIndex;return elem.selected===true;},parent:function(elem){return!!elem.firstChild;},empty:function(elem){return!elem.firstChild;},has:function(elem,i,match){return!!Sizzle(match[3],elem).length;},header:function(elem){return/h\d/i.test(elem.nodeName);},text:function(elem){return"text"===elem.type;},radio:function(elem){return"radio"===elem.type;},checkbox:function(elem){return"checkbox"===elem.type;},file:function(elem){return"file"===elem.type;},password:function(elem){return"password"===elem.type;},submit:function(elem){return"submit"===elem.type;},image:function(elem){return"image"===elem.type;},reset:function(elem){return"reset"===elem.type;},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON";},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName);}},setFilters:{first:function(elem,i){return i===0;},last:function(elem,i,match,array){return i===array.length-1;},even:function(elem,i){return i%2===0;},odd:function(elem,i){return i%2===1;},lt:function(elem,i,match){return i<match[3]-0;},gt:function(elem,i,match){return i>match[3]-0;},nth:function(elem,i,match){return match[3]-0==i;},eq:function(elem,i,match){return match[3]-0==i;}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array);}else if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0;}else if(name==="not"){var not=match[3];for(var i=0,l=not.length;i<l;i++){if(not[i]===elem){return false;}}
return true;}},CHILD:function(elem,match){var type=match[1],node=elem;switch(type){case'only':case'first':while(node=node.previousSibling){if(node.nodeType===1)return false;}
if(type=='first')return true;node=elem;case'last':while(node=node.nextSibling){if(node.nodeType===1)return false;}
return true;case'nth':var first=match[2],last=match[3];if(first==1&&last==0){return true;}
var doneName=match[0],parent=elem.parentNode;if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count;}}
parent.sizcache=doneName;}
var diff=elem.nodeIndex-last;if(first==0){return diff==0;}else{return(diff%first==0&&diff/first>=0);}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match;},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match;},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1;},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false;},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array);}}}};var origPOS=Expr.match.POS;for(var type in Expr.match){Expr.match[type]=RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source);}
var makeArray=function(array,results){array=Array.prototype.slice.call(array);if(results){results.push.apply(results,array);return results;}
return array;};try{Array.prototype.slice.call(document.documentElement.childNodes);}catch(e){makeArray=function(array,results){var ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array);}else{if(typeof array.length==="number"){for(var i=0,l=array.length;i<l;i++){ret.push(array[i]);}}else{for(var i=0;array[i];i++){ret.push(array[i]);}}}
return ret;};}
var sortOrder;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;if(ret===0){hasDuplicate=true;}
return ret;};}else if("sourceIndex"in document.documentElement){sortOrder=function(a,b){var ret=a.sourceIndex-b.sourceIndex;if(ret===0){hasDuplicate=true;}
return ret;};}else if(document.createRange){sortOrder=function(a,b){var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();aRange.selectNode(a);aRange.collapse(true);bRange.selectNode(b);bRange.collapse(true);var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);if(ret===0){hasDuplicate=true;}
return ret;};}
(function(){var form=document.createElement("form"),id="script"+(new Date).getTime();form.innerHTML="<input name='"+id+"'/>";var root=document.documentElement;root.insertBefore(form,root.firstChild);if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[];}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match;};}
root.removeChild(form);})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i]);}}
results=tmp;}
return results;};}
div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2);};}})();if(document.querySelectorAll)(function(){var oldSizzle=Sizzle,div=document.createElement("div");div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return;}
Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra);}catch(e){}}
return oldSizzle(query,context,extra,seed);};Sizzle.find=oldSizzle.find;Sizzle.filter=oldSizzle.filter;Sizzle.selectors=oldSizzle.selectors;Sizzle.matches=oldSizzle.matches;})();if(document.getElementsByClassName&&document.documentElement.getElementsByClassName)(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(div.getElementsByClassName("e").length===0)
return;div.lastChild.className="e";if(div.getElementsByClassName("e").length===1)
return;Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1]);}};})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i;}
elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(elem.nodeName===cur){match=elem;break;}
elem=elem[dir];}
checkSet[i]=match;}}}
function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i;}
elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(typeof cur!=="string"){if(elem===cur){match=true;break;}}else if(Sizzle.filter(cur,[elem]).length>0){match=elem;break;}}
elem=elem[dir];}
checkSet[i]=match;}}}
var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16;}:function(a,b){return a!==b&&(a.contains?a.contains(b):true);};var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&isXML(elem.ownerDocument);};var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"");}
selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet);}
return Sizzle.filter(later,tmpSet);};jQuery.find=Sizzle;jQuery.filter=Sizzle.filter;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;Sizzle.selectors.filters.hidden=function(elem){return elem.offsetWidth===0||elem.offsetHeight===0;};Sizzle.selectors.filters.visible=function(elem){return elem.offsetWidth>0||elem.offsetHeight>0;};Sizzle.selectors.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};jQuery.multiFilter=function(expr,elems,not){if(not){expr=":not("+expr+")";}
return Sizzle.matches(expr,elems);};jQuery.dir=function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)
matched.push(cur);cur=cur[dir];}
return matched;};jQuery.nth=function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])
if(cur.nodeType==1&&++num==result)
break;return cur;};jQuery.sibling=function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)
r.push(n);}
return r;};return;window.Sizzle=Sizzle;})();jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)
return;if(elem.setInterval&&elem!=window)
elem=window;if(!handler.guid)
handler.guid=this.guid++;if(data!==undefined){var fn=handler;handler=this.proxy(fn);handler.data=data;}
var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(arguments.callee.elem,arguments):undefined;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");type=namespaces.shift();handler.type=namespaces.slice().sort().join(".");var handlers=events[type];if(jQuery.event.specialAll[type])
jQuery.event.specialAll[type].setup.call(elem,data,namespaces);if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem,data,namespaces)===false){if(elem.addEventListener)
elem.addEventListener(type,handle,false);else if(elem.attachEvent)
elem.attachEvent("on"+type,handle);}}
handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)
return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types===undefined||(typeof types==="string"&&types.charAt(0)=="."))
for(var type in events)
this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}
jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");type=namespaces.shift();var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");if(events[type]){if(handler)
delete events[type][handler.guid];else
for(var handle in events[type])
if(namespace.test(events[type][handle].type))
delete events[type][handle];if(jQuery.event.specialAll[type])
jQuery.event.specialAll[type].teardown.call(elem,namespaces);for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem,namespaces)===false){if(elem.removeEventListener)
elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)
elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}
ret=null;delete events[type];}}});}
for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(event,data,elem,bubbling){var type=event.type||event;if(!bubbling){event=typeof event==="object"?event[expando]?event:jQuery.extend(jQuery.Event(type),event):jQuery.Event(type);if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);event.exclusive=true;}
if(!elem){event.stopPropagation();if(this.global[type])
jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type])
jQuery.event.trigger(event,data,this.handle.elem);});}
if(!elem||elem.nodeType==3||elem.nodeType==8)
return undefined;event.result=undefined;event.target=elem;data=jQuery.makeArray(data);data.unshift(event);}
event.currentTarget=elem;var handle=jQuery.data(elem,"handle");if(handle)
handle.apply(elem,data);if((!elem[type]||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)
event.result=false;if(!bubbling&&elem[type]&&!event.isDefaultPrevented()&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}
this.triggered=false;if(!event.isPropagationStopped()){var parent=elem.parentNode||elem.ownerDocument;if(parent)
jQuery.event.trigger(event,data,parent,true);}},handle:function(event){var all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);event.currentTarget=this;var namespaces=event.type.split(".");event.type=namespaces.shift();all=!namespaces.length&&!event.exclusive;var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||namespace.test(handler.type)){event.handler=handler;event.data=handler.data;var ret=handler.apply(this,arguments);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}
if(event.isImmediatePropagationStopped())
break;}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando])
return event;var originalEvent=event;event=jQuery.Event(originalEvent);for(var i=this.props.length,prop;i;){prop=this.props[--i];event[prop]=originalEvent[prop];}
if(!event.target)
event.target=event.srcElement||document;if(event.target.nodeType==3)
event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)
event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}
if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))
event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)
event.metaKey=event.ctrlKey;if(!event.which&&event.button)
event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy=proxy||function(){return fn.apply(this,arguments);};proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:bindReady,teardown:function(){}}},specialAll:{live:{setup:function(selector,namespaces){jQuery.event.add(this,namespaces[0],liveHandler);},teardown:function(namespaces){if(namespaces.length){var remove=0,name=RegExp("(^|\\.)"+namespaces[0]+"(\\.|$)");jQuery.each((jQuery.data(this,"events").live||{}),function(){if(name.test(this.type))
remove++;});if(remove<1)
jQuery.event.remove(this,namespaces[0],liveHandler);}}}}};jQuery.Event=function(src){if(!this.preventDefault)
return new jQuery.Event(src);if(src&&src.type){this.originalEvent=src;this.type=src.type;}else
this.type=src;this.timeStamp=now();this[expando]=true;};function returnFalse(){return false;}
function returnTrue(){return true;}
jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e)
return;if(e.preventDefault)
e.preventDefault();e.returnValue=false;},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e)
return;if(e.stopPropagation)
e.stopPropagation();e.cancelBubble=true;},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation();},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var withinElement=function(event){var parent=event.relatedTarget;while(parent&&parent!=this)
try{parent=parent.parentNode;}
catch(e){parent=this;}
if(parent!=this){event.type=event.data;jQuery.event.handle.apply(this,arguments);}};jQuery.each({mouseover:'mouseenter',mouseout:'mouseleave'},function(orig,fix){jQuery.event.special[fix]={setup:function(){jQuery.event.add(this,orig,withinElement,fix);},teardown:function(){jQuery.event.remove(this,orig,withinElement);}};});jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);event.preventDefault();event.stopPropagation();jQuery.event.trigger(event,data,this[0]);return event.result;}},toggle:function(fn){var args=arguments,i=1;while(i<args.length)
jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)
fn.call(document,jQuery);else
jQuery.readyList.push(fn);return this;},live:function(type,fn){var proxy=jQuery.event.proxy(fn);proxy.guid+=this.selector+type;jQuery(document).bind(liveConvert(type,this.selector),this.selector,proxy);return this;},die:function(type,fn){jQuery(document).unbind(liveConvert(type,this.selector),fn?{guid:fn.guid+this.selector+type}:null);return this;}});function liveHandler(event){var check=RegExp("(^|\\.)"+event.type+"(\\.|$)"),stop=true,elems=[];jQuery.each(jQuery.data(this,"events").live||[],function(i,fn){if(check.test(fn.type)){var elem=jQuery(event.target).closest(fn.data)[0];if(elem)
elems.push({elem:elem,fn:fn});}});elems.sort(function(a,b){return jQuery.data(a.elem,"closest")-jQuery.data(b.elem,"closest");});jQuery.each(elems,function(){if(this.fn.call(this.elem,event,this.fn.data)===false)
return(stop=false);});return stop;}
function liveConvert(type,selector){return["live",type,selector.replace(/\./g,"`").replace(/ /g,"|")].join(".");}
jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document,jQuery);});jQuery.readyList=null;}
jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);jQuery.ready();},false);}else if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);jQuery.ready();}});if(document.documentElement.doScroll&&window==window.top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}
jQuery.ready();})();}
jQuery.event.add(window,"load",jQuery.ready);}
jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,"+"change,select,submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});jQuery(window).bind('unload',function(){for(var id in jQuery.cache)
if(id!=1&&jQuery.cache[id].handle)
jQuery.event.remove(jQuery.cache[id].handle.elem);});(function(){jQuery.support={};var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+(new Date).getTime();div.style.display="none";div.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return;}
jQuery.support={leadingWhitespace:div.firstChild.nodeType==3,tbody:!div.getElementsByTagName("tbody").length,objectAll:!!div.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:a.style.opacity==="0.5",cssFloat:!!a.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};script.type="text/javascript";try{script.appendChild(document.createTextNode("window."+id+"=1;"));}catch(e){}
root.insertBefore(script,root.firstChild);if(window[id]){jQuery.support.scriptEval=true;delete window[id];}
root.removeChild(script);if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function(){jQuery.support.noCloneEvent=false;div.detachEvent("onclick",arguments.callee);});div.cloneNode(true).fireEvent("onclick");}
jQuery(function(){var div=document.createElement("div");div.style.width=div.style.paddingLeft="1px";document.body.appendChild(div);jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;document.body.removeChild(div).style.display='none';});})();var styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat";jQuery.props={"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!=="string")
return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}
var type="GET";if(params)
if(jQuery.isFunction(params)){callback=params;params=null;}else if(typeof params==="object"){params=jQuery.param(params);type="POST";}
var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")
self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);if(callback)
self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}
return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}
return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!=="string")
s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))
s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))
s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}
if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)
s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}
if(head)
head.removeChild(script);};}
if(s.dataType=="script"&&s.cache==null)
s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}
if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}
if(s.global&&!jQuery.active++)
jQuery.event.trigger("ajaxStart");var parts=/^(\w+:)?\/\/([^\/?#]+)/.exec(s.url);if(s.dataType=="script"&&type=="GET"&&parts&&(parts[1]&&parts[1]!=location.protocol||parts[2]!=location.host)){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)
script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();script.onload=script.onreadystatechange=null;head.removeChild(script);}};}
head.appendChild(script);return undefined;}
var requestDone=false;var xhr=s.xhr();if(s.username)
xhr.open(type,s.url,s.async,s.username,s.password);else
xhr.open(type,s.url,s.async);try{if(s.data)
xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)
xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}
if(s.beforeSend&&s.beforeSend(xhr,s)===false){if(s.global&&!--jQuery.active)
jQuery.event.trigger("ajaxStop");xhr.abort();return false;}
if(s.global)
jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(xhr.readyState==0){if(ival){clearInterval(ival);ival=null;if(s.global&&!--jQuery.active)
jQuery.event.trigger("ajaxStop");}}else if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}
status=isTimeout=="timeout"?"timeout":!jQuery.httpSuccess(xhr)?"error":s.ifModified&&jQuery.httpNotModified(xhr,s.url)?"notmodified":"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s);}catch(e){status="parsererror";}}
if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}
if(s.ifModified&&modRes)
jQuery.lastModified[s.url]=modRes;if(!jsonp)
success();}else
jQuery.handleError(s,xhr,status);complete();if(isTimeout)
xhr.abort();if(s.async)
xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)
setTimeout(function(){if(xhr&&!requestDone)
onreadystatechange("timeout");},s.timeout);}
try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}
if(!s.async)
onreadystatechange();function success(){if(s.success)
s.success(data,status);if(s.global)
jQuery.event.trigger("ajaxSuccess",[xhr,s]);}
function complete(){if(s.complete)
s.complete(xhr,status);if(s.global)
jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)
jQuery.event.trigger("ajaxStop");}
return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)
jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223;}catch(e){}
return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url];}catch(e){}
return false;},httpData:function(xhr,type,s){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")
throw"parsererror";if(s&&s.dataFilter)
data=s.dataFilter(data,type);if(typeof data==="string"){if(type=="script")
jQuery.globalEval(data);if(type=="json")
data=window["eval"]("("+data+")");}
return data;},param:function(a){var s=[];function add(key,value){s[s.length]=encodeURIComponent(key)+'='+encodeURIComponent(value);};if(jQuery.isArray(a)||a.jquery)
jQuery.each(a,function(){add(this.name,this.value);});else
for(var j in a)
if(jQuery.isArray(a[j]))
jQuery.each(a[j],function(){add(j,this);});else
add(j,jQuery.isFunction(a[j])?a[j]():a[j]);return s.join("&").replace(/%20/g,"+");}});var elemdisplay={},timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type;});return obj;}
jQuery.fn.extend({show:function(speed,callback){if(speed){return this.animate(genFx("show",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");this[i].style.display=old||"";if(jQuery.css(this[i],"display")==="none"){var tagName=this[i].tagName,display;if(elemdisplay[tagName]){display=elemdisplay[tagName];}else{var elem=jQuery("<"+tagName+" />").appendTo("body");display=elem.css("display");if(display==="none")
display="block";elem.remove();elemdisplay[tagName]=display;}
jQuery.data(this[i],"olddisplay",display);}}
for(var i=0,l=this.length;i<l;i++){this[i].style.display=jQuery.data(this[i],"olddisplay")||"";}
return this;}},hide:function(speed,callback){if(speed){return this.animate(genFx("hide",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");if(!old&&old!=="none")
jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"));}
for(var i=0,l=this.length;i<l;i++){this[i].style.display="none";}
return this;}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn==null||bool?this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]();}):this.animate(genFx("toggle",3),fn,fn2);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType==1&&jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)
return opt.complete.call(this);if((p=="height"||p=="width")&&this.style){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}
if(opt.overflow!=null)
this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))
e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}
if(parts[1])
end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)
this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)
if(timers[i].elem==this){if(gotoEnd)
timers[i](true);timers.splice(i,1);}});if(!gotoEnd)
this.dequeue();return this;}});jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback);};});jQuery.extend({speed:function(speed,easing,fn){var opt=typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)
jQuery(this).dequeue();if(jQuery.isFunction(opt.old))
opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)
options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)
this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style)
this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))
return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;var self=this;function t(gotoEnd){return self.step(gotoEnd);}
t.elem=this.elem;if(t()&&jQuery.timers.push(t)&&!timerId){timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)
if(!timers[i]())
timers.splice(i--,1);if(!timers.length){clearInterval(timerId);timerId=undefined;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)
if(this.options.curAnim[i]!==true)
done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")
this.elem.style.display="block";}
if(this.options.hide)
jQuery(this.elem).hide();if(this.options.hide||this.options.show)
for(var p in this.options.curAnim)
jQuery.attr(this.elem.style,p,this.options.orig[p]);this.options.complete.call(this.elem);}
return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}
return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null)
fx.elem.style[fx.prop]=fx.now+fx.unit;else
fx.elem[fx.prop]=fx.now;}}});if(document.documentElement["getBoundingClientRect"])
jQuery.fn.offset=function(){if(!this[0])return{top:0,left:0};if(this[0]===this[0].ownerDocument.body)return jQuery.offset.bodyOffset(this[0]);var box=this[0].getBoundingClientRect(),doc=this[0].ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;return{top:top,left:left};};else
jQuery.fn.offset=function(){if(!this[0])return{top:0,left:0};if(this[0]===this[0].ownerDocument.body)return jQuery.offset.bodyOffset(this[0]);jQuery.offset.initialized||jQuery.offset.initialize();var elem=this[0],offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView.getComputedStyle(elem,null),top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){computedStyle=defaultView.getComputedStyle(elem,null);top-=elem.scrollTop,left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop,left+=elem.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.tagName)))
top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0;prevOffsetParent=offsetParent,offsetParent=elem.offsetParent;}
if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible")
top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0;prevComputedStyle=computedStyle;}
if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static")
top+=body.offsetTop,left+=body.offsetLeft;if(prevComputedStyle.position==="fixed")
top+=Math.max(docElem.scrollTop,body.scrollTop),left+=Math.max(docElem.scrollLeft,body.scrollLeft);return{top:top,left:left};};jQuery.offset={initialize:function(){if(this.initialized)return;var body=document.body,container=document.createElement('div'),innerDiv,checkDiv,table,td,rules,prop,bodyMarginTop=body.style.marginTop,html='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';rules={position:'absolute',top:0,left:0,margin:0,border:0,width:'1px',height:'1px',visibility:'hidden'};for(prop in rules)container.style[prop]=rules[prop];container.innerHTML=html;body.insertBefore(container,body.firstChild);innerDiv=container.firstChild,checkDiv=innerDiv.firstChild,td=innerDiv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(checkDiv.offsetTop!==5);this.doesAddBorderForTableAndCells=(td.offsetTop===5);innerDiv.style.overflow='hidden',innerDiv.style.position='relative';this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);body.style.marginTop='1px';this.doesNotIncludeMarginInBodyOffset=(body.offsetTop===0);body.style.marginTop=bodyMarginTop;body.removeChild(container);this.initialized=true;},bodyOffset:function(body){jQuery.offset.initialized||jQuery.offset.initialize();var top=body.offsetTop,left=body.offsetLeft;if(jQuery.offset.doesNotIncludeMarginInBodyOffset)
top+=parseInt(jQuery.curCSS(body,'marginTop',true),10)||0,left+=parseInt(jQuery.curCSS(body,'marginLeft',true),10)||0;return{top:top,left:left};}};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}
return results;},offsetParent:function(){var offsetParent=this[0].offsetParent||document.body;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))
offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return null;return val!==undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom",lower=name.toLowerCase();jQuery.fn["inner"+name]=function(){return this[0]?jQuery.css(this[0],lower,false,"padding"):null;};jQuery.fn["outer"+name]=function(margin){return this[0]?jQuery.css(this[0],lower,false,margin?"margin":"border"):null;};var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(document.documentElement["client"+name],document.body["scroll"+name],document.documentElement["scroll"+name],document.body["offset"+name],document.documentElement["offset"+name]):size===undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,typeof size==="string"?size:size+"px");};});})();Evri.jQuery.browser.msie6=Evri.jQuery.browser.msie&&(parseInt(Evri.jQuery.browser.version)<=6);Evri.jQuery.browser.msie7=Evri.jQuery.browser.msie&&(parseInt(Evri.jQuery.browser.version)==7);Evri.jQuery.browser.msie8=Evri.jQuery.browser.msie&&(parseInt(Evri.jQuery.browser.version)==8);Evri.jQuery.windowDimensions=function(){var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}
return{width:myWidth,height:myHeight};};Evri.jQuery.windowScroll=function()
{var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}
else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}
else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}
return{x:scrOfX,y:scrOfY};};Evri.jQuery.fn.center=function()
{this.each(function(){var el=Evri.jQuery(this);var winH=Evri.jQuery.windowDimensions().height;var winW=Evri.jQuery.windowDimensions().width;if(winH<el.height())
{var y=0;}
else
{var y=winH/2-el.height()/2;}
if(winW<el.width())
{var x=winW-el.width();}
else
{var x=winW/2-el.width()/2;}
if(Evri.jQuery.browser.msie6)
{el.css('position','absolute');y+=Evri.jQuery.windowScroll().y;x+=Evri.jQuery.windowScroll().x;}
el.css("top",y);el.css("left",x);});return this;};Evri.jQuery.fn.mergeHtml=function(){var text='';var textForNodes={};this.each(function(index,element){var nodeText=Evri.$(element).text();if(textForNodes[nodeText]===undefined){text+=nodeText+'\n\n';textForNodes[nodeText]=1;}});return text;};Evri.jQuery.fn.forceLayout=function(defer){if(Evri.jQuery.browser.msie6){defer=defer||0;setTimeout(function(){this.css("zoom",1);},defer);}
return this;};Evri.jQuery.fn.pngFix=function(){var $=Evri.jQuery;if(!Evri.jQuery.browser.msie6)return this;function fixImage(img)
{var imgName=img.src.toUpperCase();if(imgName.substring(imgName.length-3,imgName.length)=="PNG")
{var span=$("<span />");var properties=["id","class","title","alt","style"];$.each(properties,function(i,prop){span.attr(prop,$(img).attr(prop));});var filter="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+"(src=\'"+img.src+"\', sizingMethod='scale');";span.attr("style",span.attr("style")+filter);$(img).replaceWith(span);}}
this.each(function(){fixImage(this);});return this;};Evri.jQuery.browser.macFirefox=function(){var userAgent=navigator.userAgent.toLowerCase();if(userAgent.indexOf('mac')!=-1&&userAgent.indexOf('firefox')!=-1){return true;}
return false;};Evri.jQuery.fn.browserClass=function(){var self=this;var browsers=["msie","mozilla","safari"];Evri.jQuery.each(browsers,function(){Evri.jQuery.browser[this]&&self.addClass(this);});return self;};Evri.jQuery.parseQueryString=function(str){var value={};var items=str.split("&");Evri.$.each(items,function(k,v){var vals=v.split("=");value[vals[0]]=decodeURIComponent(vals[1]);});return value;};(function($){$.fn.onScrollIntoView=function(callback,options){var $selection=this;var $window=Evri.$(window);options=options||{};options.topOffset=options.topOffset||0;options.interval=options.interval||2500;$selection.each(function(index,item){var $container=$(item);var scrollIntoViewProcessId=undefined;scrollIntoViewProcessId=setInterval(function(){var windowScrollBottom=$window.scrollTop()+$window.height();var containerTop=$container.offset().top;if(windowScrollBottom>(containerTop+options.topOffset)){callback.call();clearInterval(scrollIntoViewProcessId);}},options.interval);});return $selection;};})(Evri.$);Evri.defineNamespace(Evri,'Widget');Evri.defineNamespace(Evri.Widget,"Utilities");Evri.extendNamespace(Evri.Widget.Utilities,{getContent:function(){return Evri.$("h1, p").mergeHtml();},toQueryString:function(params){var paramItems=[];for(var key in params){paramItems.push(key+"="+encodeURIComponent(params[key]));}
return paramItems.join('&');},useStylesheet:function(url){Evri.$("head").append(Evri.$('<link rel="stylesheet" type="text/css" href="'+url+'" />'));}});Evri.defineNamespace(Evri.Widget,"Environment",{set:function(name,value){Evri.Widget.Environment[name]=value;},apiURL:"http://api.evri.com",domainURL:"http://www.evri.com",verticalWidgetURL:"http://www.evri.com/widget/swfs/VerticalSidebar.swf",widgetURL:"http://www.evri.com/widget/swfs/WidgetBase.swf",youTubePlayerURL:"http://www.evri.com/widget/swfs/YouTube.swf"});Evri.defineClass(Evri.Widget,"Analytics",function(widgetName){var self=this;self.name=widgetName;self.host=window.location.hostname;self.path=window.location.pathname;self.loggingDomain=Evri.Widget.Environment.domainURL;return self;});Evri.extendClass(Evri.Widget.Analytics,{log:function(eventName,params){var self=this;params=params||{};var iframe=document.createElement('iframe');iframe.style.position='absolute';iframe.style.height='1px';iframe.style.width='1px';iframe.style.top='0px';iframe.style.left='-10px';iframe.setAttribute("src",self.loggingStatement(eventName,params));document.body.appendChild(iframe);iframe.blur();},logTest:function(eventName,params){var self=this;var statement=self.loggingStatement(eventName,params);try{console.log(statement);}catch(e){};},loggingStatement:function(eventName,params){var self=this;params=params||{};var statement=self.loggingDomain+"/analytics/"+self.name+"/"+self.host+"/-/"+eventName;params.path=self.path;statement+='?'+Evri.Widget.Utilities.toQueryString(params);return statement;},trackDHTML:function(eventName,params){var self=this;params=params||{};self.log("DHTML/"+eventName,params);},trackReferral:function(eventName,params){var self=this;params=params||{};self.log("REFERRAL/"+eventName,params);},trackError:function(name,params){var self=this;params=params||{};self.log("ERROR/"+name,params);},setTestMode:function(){var self=this;self.log=self.logTest;}});Evri.defineClass(Evri.Widget,"MediaViewSet",function(session){var self=this;self.views=[new Evri.Widget.MediaView('From the web')];self.currentView=self.views[0];self.session=session;return self;});Evri.extendClass(Evri.Widget.MediaViewSet,{clear:function(){var self=this;self.views=[];self.currentView=undefined;return self;},addView:function(label){var self=this;var mc=new self.session.models.MediaConstraint();var mediaView=new Evri.Widget.MediaView(label,mc);if(self.views.length===0){self.currentView=mediaView;}
self.views.push(mediaView);return mediaView;},setView:function(view){var self=this;for(var i=0;i<self.views.length;i++){if(self.views[i]===view){self.currentView=view;}}
if(self.currentView===undefined&&self.views.length>0){self.currentView=view;}
return self;}});Evri.defineClass(Evri.Widget,"MediaView",function(label,constraint){var self=this;self.label=label;self.mediaConstraint=constraint;return self;});Evri.extendClass(Evri.Widget.MediaView,{clearConstraints:function(){var self=this;self.mediaConstraint=undefined;return self;},includeDomain:function(domain){var self=this;self.mediaConstraint.includeDomain(domain);return self;},excludeDomain:function(domain){var self=this;self.mediaConstraint.excludeDomain(domain);return self;}});Evri.extendNamespace(Evri,{JSTweener:(function(){var JSTweener={looping:false,frameRate:60,objects:[],defaultOptions:{time:1,transition:'easeoutexpo',delay:0,prefix:{},suffix:{},onStart:undefined,onStartParams:undefined,onUpdate:undefined,onUpdateParams:undefined,onComplete:undefined,onCompleteParams:undefined},inited:false,easingFunctionsLowerCase:{},init:function(){this.inited=true;for(var key in JSTweener.easingFunctions){this.easingFunctionsLowerCase[key.toLowerCase()]=JSTweener.easingFunctions[key];}},toNumber:function(value,prefix,suffix){if(!suffix)suffix='px';return value.toString().match(/[0-9]/)?Number(value.toString().replace(new RegExp(suffix+'$'),'').replace(new RegExp('^'+(prefix?prefix:'')),'')):0;},addTween:function(obj,options){var self=this;if(!this.inited)this.init();var o={};o.target=obj;o.targetPropeties={};for(var key in this.defaultOptions){if(typeof options[key]!='undefined'){o[key]=options[key];delete options[key];}else{o[key]=this.defaultOptions[key];}}
if(typeof o.transition=='function'){o.easing=o.transition;}else{o.easing=this.easingFunctionsLowerCase[o.transition.toLowerCase()];}
for(var key in options){if(!o.prefix[key])o.prefix[key]='';if(!o.suffix[key])o.suffix[key]='';var sB=this.toNumber(obj[key],o.prefix[key],o.suffix[key]);o.targetPropeties[key]={b:sB,c:options[key]-sB};}
setTimeout(function(){o.startTime=(new Date()-0);o.endTime=o.time*1000+o.startTime;if(typeof o.onStart=='function'){if(o.onStartParams){o.onStart.apply(o,o.onStartParams);}else{o.onStart();}}
self.objects.push(o);if(!self.looping){self.looping=true;self.eventLoop.call(self);}},o.delay*1000);},eventLoop:function(){var now=(new Date()-0);for(var i=0;i<this.objects.length;i++){var o=this.objects[i];var t=now-o.startTime;var d=o.endTime-o.startTime;if(t>=d){for(var property in o.targetPropeties){var tP=o.targetPropeties[property];try{o.target[property]=o.prefix[property]+(tP.b+tP.c)+o.suffix[property];}catch(e){}}
this.objects.splice(i,1);if(typeof o.onUpdate=='function'){if(o.onUpdateParams){o.onUpdate.apply(o,o.onUpdateParams);}else{o.onUpdate();}}
if(typeof o.onComplete=='function'){if(o.onCompleteParams){o.onComplete.apply(o,o.onCompleteParams);}else{o.onComplete();}}}else{for(var property in o.targetPropeties){var tP=o.targetPropeties[property];var val=o.easing(t,tP.b,tP.c,d);try{o.target[property]=o.prefix[property]+val+o.suffix[property];}catch(e){}}
if(typeof o.onUpdate=='function'){if(o.onUpdateParams){o.onUpdate.apply(o,o.onUpdateParams);}else{o.onUpdate();}}}}
if(this.objects.length>0){var self=this;setTimeout(function(){self.eventLoop()},1000/self.frameRate);}else{this.looping=false;}}};JSTweener.Utils={bezier2:function(t,p0,p1,p2){return(1-t)*(1-t)*p0+2*t*(1-t)*p1+t*t*p2;},bezier3:function(t,p0,p1,p2,p3){return Math.pow(1-t,3)*p0+3*t*Math.pow(1-t,2)*p1+3*t*t*(1-t)*p2+t*t*t*p3;},allSetStyleProperties:function(element){var css;if(document.defaultView&&document.defaultView.getComputedStyle){css=document.defaultView.getComputedStyle(element,null);}else{css=element.currentStyle}
for(var key in css){if(!key.match(/^\d+$/)){try{element.style[key]=css[key];}catch(e){};}}}}
JSTweener.easingFunctions={easeNone:function(t,b,c,d){return c*t/d+b;},easeInQuad:function(t,b,c,d){return c*(t/=d)*t+b;},easeOutQuad:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOutQuad:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInCubic:function(t,b,c,d){return c*(t/=d)*t*t+b;},easeOutCubic:function(t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},easeInOutCubic:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b;},easeOutInCubic:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutCubic(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInCubic((t*2)-d,b+c/2,c/2,d);},easeInQuart:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutQuart:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOutQuart:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},easeOutInQuart:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutQuart(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInQuart((t*2)-d,b+c/2,c/2,d);},easeInQuint:function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOutQuint:function(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOutQuint:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},easeOutInQuint:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutQuint(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInQuint((t*2)-d,b+c/2,c/2,d);},easeInSine:function(t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b;},easeOutSine:function(t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b;},easeInOutSine:function(t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b;},easeOutInSine:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutSine(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInSine((t*2)-d,b+c/2,c/2,d);},easeInExpo:function(t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b-c*0.001;},easeOutExpo:function(t,b,c,d){return(t==d)?b+c:c*1.001*(-Math.pow(2,-10*t/d)+1)+b;},easeInOutExpo:function(t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b-c*0.0005;return c/2*1.0005*(-Math.pow(2,-10*--t)+2)+b;},easeOutInExpo:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutExpo(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInExpo((t*2)-d,b+c/2,c/2,d);},easeInCirc:function(t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;},easeOutCirc:function(t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b;},easeInOutCirc:function(t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;},easeOutInCirc:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutCirc(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInCirc((t*2)-d,b+c/2,c/2,d);},easeInElastic:function(t,b,c,d,a,p){var s;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;s=p/4;}else s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},easeOutElastic:function(t,b,c,d,a,p){var s;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;s=p/4;}else s=p/(2*Math.PI)*Math.asin(c/a);return(a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b);},easeInOutElastic:function(t,b,c,d,a,p){var s;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(!a||a<Math.abs(c)){a=c;s=p/4;}else s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},easeOutInElastic:function(t,b,c,d,a,p){if(t<d/2)return JSTweener.easingFunctions.easeOutElastic(t*2,b,c/2,d,a,p);return JSTweener.easingFunctions.easeInElastic((t*2)-d,b+c/2,c/2,d,a,p);},easeInBack:function(t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},easeOutBack:function(t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},easeInOutBack:function(t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},easeOutInBack:function(t,b,c,d,s){if(t<d/2)return JSTweener.easingFunctions.easeOutBack(t*2,b,c/2,d,s);return JSTweener.easingFunctions.easeInBack((t*2)-d,b+c/2,c/2,d,s);},easeInBounce:function(t,b,c,d){return c-JSTweener.easingFunctions.easeOutBounce(d-t,0,c,d)+b;},easeOutBounce:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},easeInOutBounce:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeInBounce(t*2,0,c,d)*.5+b;else return JSTweener.easingFunctions.easeOutBounce(t*2-d,0,c,d)*.5+c*.5+b;},easeOutInBounce:function(t,b,c,d){if(t<d/2)return JSTweener.easingFunctions.easeOutBounce(t*2,b,c/2,d);return JSTweener.easingFunctions.easeInBounce((t*2)-d,b+c/2,c/2,d);}};JSTweener.easingFunctions.linear=JSTweener.easingFunctions.easeNone;return JSTweener;})()});Evri.Raphael=(function(){var separator=/[, ]+/,create,doc=document,win=window,R=function(){return create.apply(R,arguments);};R.version="0.7.2";R.type=(win.SVGAngle?"SVG":"VML");R.svg=!(R.vml=R.type=="VML");R.idGenerator=0;var paper={};R.fn={};var availableAttrs={cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10",gradient:0,height:0,opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,translation:"0 0",width:0,x:0,y:0},availableAnimAttrs={cx:"number",cy:"number",fill:"colour","fill-opacity":"number","font-size":"number",height:"number",opacity:"number",path:"path",r:"number",rotation:"csv",rx:"number",ry:"number",scale:"csv",stroke:"colour","stroke-opacity":"number","stroke-width":"number",translation:"csv",width:"number",x:"number",y:"number"},events=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup"];R.toString=function(){return"Your browser "+(this.vml?"doesn't ":"")+"support"+(this.svg?"s":"")+" SVG.\nYou are running "+unescape("Rapha%EBl%20")+this.version;};R.setWindow=function(newwin){win=newwin;doc=win.document;};R.hsb2rgb=function(hue,saturation,brightness){if(typeof hue=="object"&&"h"in hue&&"s"in hue&&"b"in hue){brightness=hue.b;saturation=hue.s;hue=hue.h;}
var red,green,blue;if(brightness==0){return{r:0,g:0,b:0,hex:"#000"};}
if(hue>1||saturation>1||brightness>1){hue/=255;saturation/=255;brightness/=255;}
var i=Math.floor(hue*6),f=(hue*6)-i,p=brightness*(1-saturation),q=brightness*(1-(saturation*f)),t=brightness*(1-(saturation*(1-f)));red=[brightness,q,p,p,t,brightness,brightness][i];green=[t,brightness,brightness,q,p,p,t][i];blue=[p,p,t,brightness,brightness,q,p][i];red*=255;green*=255;blue*=255;var rgb={r:red,g:green,b:blue};var r=Math.round(red).toString(16);if(r.length==1){r="0"+r;}
var g=Math.round(green).toString(16);if(g.length==1){g="0"+g;}
var b=Math.round(blue).toString(16);if(b.length==1){b="0"+b;}
rgb.hex="#"+r+g+b;return rgb;};R.rgb2hsb=function(red,green,blue){if(typeof red=="object"&&"r"in red&&"g"in red&&"b"in red){blue=red.b;green=red.g;red=red.r;}
if(typeof red=="string"){var clr=getRGB(red);red=clr.r;green=clr.g;blue=clr.b;}
if(red>1||green>1||blue>1){red/=255;green/=255;blue/=255;}
var max=Math.max(red,green,blue),min=Math.min(red,green,blue),hue,saturation,brightness=max;if(min==max){return{h:0,s:0,b:max};}else{var delta=(max-min);saturation=delta/max;if(red==max){hue=(green-blue)/delta;}else if(green==max){hue=2+((blue-red)/delta);}else{hue=4+((red-green)/delta);}
hue/=6;if(hue<0){hue+=1;}
if(hue>1){hue-=1;}}
return{h:hue,s:saturation,b:brightness};};var getRGB=function(colour){var htmlcolors={aliceblue:"#f0f8ff",amethyst:"#96c",antiquewhite:"#faebd7",aqua:"#0ff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000",blanchedalmond:"#ffebcd",blue:"#00f",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#f0f",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#789",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#0f0",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#f0f",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#f00",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#fff",whitesmoke:"#f5f5f5",yellow:"#ff0",yellowgreen:"#9acd32"};if(colour.toString().toLowerCase()in htmlcolors){colour=htmlcolors[colour.toString().toLowerCase()];}
if(!colour){return{r:0,g:0,b:0,hex:"#000"};}
if(colour=="none"){return{r:-1,g:-1,b:-1,hex:"none"};}
var red,green,blue,rgb=colour.match(/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgb\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|rgb\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hsb\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsb\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i);if(rgb){if(rgb[2]){blue=parseInt(rgb[2].substring(5),16);green=parseInt(rgb[2].substring(3,5),16);red=parseInt(rgb[2].substring(1,3),16);}
if(rgb[3]){blue=parseInt(rgb[3].substring(3)+rgb[3].substring(3),16);green=parseInt(rgb[3].substring(2,3)+rgb[3].substring(2,3),16);red=parseInt(rgb[3].substring(1,2)+rgb[3].substring(1,2),16);}
if(rgb[4]){rgb=rgb[4].split(/\s*,\s*/);red=parseFloat(rgb[0],10);green=parseFloat(rgb[1],10);blue=parseFloat(rgb[2],10);}
if(rgb[5]){rgb=rgb[5].split(/\s*,\s*/);red=parseFloat(rgb[0],10)*2.55;green=parseFloat(rgb[1],10)*2.55;blue=parseFloat(rgb[2],10)*2.55;}
if(rgb[6]){rgb=rgb[6].split(/\s*,\s*/);red=parseFloat(rgb[0],10);green=parseFloat(rgb[1],10);blue=parseFloat(rgb[2],10);return Raphael.hsb2rgb(red,green,blue);}
if(rgb[7]){rgb=rgb[7].split(/\s*,\s*/);red=parseFloat(rgb[0],10)*2.55;green=parseFloat(rgb[1],10)*2.55;blue=parseFloat(rgb[2],10)*2.55;return Raphael.hsb2rgb(red,green,blue);}
var rgb={r:red,g:green,b:blue};var r=Math.round(red).toString(16);(r.length==1)&&(r="0"+r);var g=Math.round(green).toString(16);(g.length==1)&&(g="0"+g);var b=Math.round(blue).toString(16);(b.length==1)&&(b="0"+b);rgb.hex="#"+r+g+b;return rgb;}else{return{r:-1,g:-1,b:-1,hex:"none"};}};R.getColor=function(value){var start=arguments.callee.start=arguments.callee.start||{h:0,s:1,b:value||.75};var rgb=Raphael.hsb2rgb(start.h,start.s,start.b);start.h+=.075;if(start.h>1){start.h=0;start.s-=.2;if(start.s<=0){arguments.callee.start={h:0,s:1,b:start.b};}}
return rgb.hex;};R.getColor.reset=function(){this.start=undefined;};R.parsePathString=function(pathString){var paramCounts={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},data=[],toString=function(){var res="";for(var i=0,ii=this.length;i<ii;i++){res+=this[i][0]+this[i].join(",").substring(2);}
return res;};if(pathString.toString.toString()==toString.toString()){return pathString;}
pathString.replace(/([achlmqstvz])[\s,]*((-?\d*(?:e-?\d+|\.?\d*)\s*,?\s*)+)/ig,function(a,b,c){var params=[],name=b.toLowerCase();c.replace(/(-?\d*(?:e-?\d+|\.?\d*))\s*,?\s*/ig,function(a,b){b&&params.push(+b);});while(params.length>=paramCounts[name]){data.push([b].concat(params.splice(0,paramCounts[name])));if(!paramCounts[name]){break;};}});data.toString=toString;return data;};var pathDimensions=function(path){var pathArray=path;if(typeof path=="string"){pathArray=Raphael.parsePathString(path);}
pathArray=pathToAbsolute(pathArray);var x=[],y=[],length=0;for(var i=0,ii=pathArray.length;i<ii;i++){switch(pathArray[i][0]){case"Z":break;case"A":x.push(pathArray[i][pathArray[i].length-2]);y.push(pathArray[i][pathArray[i].length-1]);break;default:for(var j=1,jj=pathArray[i].length;j<jj;j++){if(j%2){x.push(pathArray[i][j]);}else{y.push(pathArray[i][j]);}}}}
var minx=Math.min.apply(Math,x),miny=Math.min.apply(Math,y);return{x:minx,y:miny,width:Math.max.apply(Math,x)-minx,height:Math.max.apply(Math,y)-miny,X:x,Y:y};};var pathToRelative=function(pathArray){var res=[];if(typeof pathArray=="string"){pathArray=R.parsePathString(pathArray);}
var x=0,y=0,start=0;if(pathArray[0][0]=="M"){x=pathArray[0][1];y=pathArray[0][2];start++;res.push(pathArray[0]);}
for(var i=start,ii=pathArray.length;i<ii;i++){res[i]=[];if(pathArray[i][0]!=pathArray[i][0].toLowerCase()){res[i][0]=pathArray[i][0].toLowerCase();switch(res[i][0]){case"a":res[i][1]=pathArray[i][1];res[i][2]=pathArray[i][2];res[i][3]=0;res[i][4]=pathArray[i][4];res[i][5]=pathArray[i][5];res[i][6]=+(pathArray[i][6]-x).toFixed(3);res[i][7]=+(pathArray[i][7]-y).toFixed(3);break;case"v":res[i][1]=+(pathArray[i][1]-y).toFixed(3);break;default:for(var j=1,jj=pathArray[i].length;j<jj;j++){res[i][j]=+(pathArray[i][j]-((j%2)?x:y)).toFixed(3);}}}else{res[i]=pathArray[i];}
switch(res[i][0]){case"z":break;case"h":x+=res[i][res[i].length-1];break;case"v":y+=res[i][res[i].length-1];break;default:x+=res[i][res[i].length-2];y+=res[i][res[i].length-1];}}
res.toString=pathArray.toString;return res;};var pathToAbsolute=function(pathArray){var res=[];if(typeof pathArray=="string"){pathArray=R.parsePathString(pathArray);}
var x=0,y=0,start=0;if(pathArray[0][0]=="M"){x=+pathArray[0][1];y=+pathArray[0][2];start++;res[0]=pathArray[0];}
for(var i=start,ii=pathArray.length;i<ii;i++){res[i]=[];if(pathArray[i][0]!=(pathArray[i][0]+"").toUpperCase()){res[i][0]=(pathArray[i][0]+"").toUpperCase();switch(res[i][0]){case"A":res[i][1]=pathArray[i][1];res[i][2]=pathArray[i][2];res[i][3]=0;res[i][4]=pathArray[i][4];res[i][5]=pathArray[i][5];res[i][6]=+(pathArray[i][6]+x).toFixed(3);res[i][7]=+(pathArray[i][7]+y).toFixed(3);break;case"V":res[i][1]=+pathArray[i][1]+y;break;default:for(var j=1,jj=pathArray[i].length;j<jj;j++){res[i][j]=+pathArray[i][j]+((j%2)?x:y);}}}else{res[i]=pathArray[i];}
switch(res[i][0]){case"Z":break;case"H":x=res[i][1];break;case"V":y=res[i][1];break;default:x=res[i][res[i].length-2];y=res[i][res[i].length-1];}}
res.toString=pathArray.toString;return res;};var pathEqualiser=function(path1,path2){var data=[pathToAbsolute(Raphael.parsePathString(path1)),pathToAbsolute(Raphael.parsePathString(path2))],attrs=[{x:0,y:0,bx:0,by:0,X:0,Y:0},{x:0,y:0,bx:0,by:0,X:0,Y:0}],processPath=function(path,d){if(!path){return["U"];}
switch(path[0]){case"M":d.X=path[1];d.Y=path[2];break;case"S":var nx=d.x+(d.x-(d.bx||d.x));var ny=d.y+(d.y-(d.by||d.y));path=["C",nx,ny,path[1],path[2],path[3],path[4]];break;case"T":var nx=d.x+(d.x-(d.bx||d.x));var ny=d.y+(d.y-(d.by||d.y));path=["Q",nx,ny,path[1],path[2]];break;case"H":path=["L",path[1],d.y];break;case"V":path=["L",d.x,path[1]];break;case"Z":path=["L",d.X,d.Y];break;}
return path;},edgeCases=function(a,b,i){if(data[a][i][0]=="M"&&data[b][i][0]!="M"){data[b].splice(i,0,["M",attrs[b].x,attrs[b].y]);attrs[a].bx=data[a][i][data[a][i].length-4]||0;attrs[a].by=data[a][i][data[a][i].length-3]||0;attrs[a].x=data[a][i][data[a][i].length-2];attrs[a].y=data[a][i][data[a][i].length-1];return true;}else if(data[a][i][0]=="L"&&data[b][i][0]=="C"){data[a][i]=["C",attrs[a].x,attrs[a].y,data[a][i][1],data[a][i][2],data[a][i][1],data[a][i][2]];}else if(data[a][i][0]=="L"&&data[b][i][0]=="Q"){data[a][i]=["Q",data[a][i][1],data[a][i][2],data[a][i][1],data[a][i][2]];}else if(data[a][i][0]=="Q"&&data[b][i][0]=="C"){var x=data[b][i][data[b][i].length-2];var y=data[b][i][data[b][i].length-1];data[b].splice(i+1,0,["Q",x,y,x,y]);data[a].splice(i,0,["C",attrs[a].x,attrs[a].y,attrs[a].x,attrs[a].y,attrs[a].x,attrs[a].y]);i++;attrs[b].bx=data[b][i][data[b][i].length-4]||0;attrs[b].by=data[b][i][data[b][i].length-3]||0;attrs[b].x=data[b][i][data[b][i].length-2];attrs[b].y=data[b][i][data[b][i].length-1];return true;}else if(data[a][i][0]=="A"&&data[b][i][0]=="C"){var x=data[b][i][data[b][i].length-2];var y=data[b][i][data[b][i].length-1];data[b].splice(i+1,0,["A",0,0,data[a][i][3],data[a][i][4],data[a][i][5],x,y]);data[a].splice(i,0,["C",attrs[a].x,attrs[a].y,attrs[a].x,attrs[a].y,attrs[a].x,attrs[a].y]);i++;attrs[b].bx=data[b][i][data[b][i].length-4]||0;attrs[b].by=data[b][i][data[b][i].length-3]||0;attrs[b].x=data[b][i][data[b][i].length-2];attrs[b].y=data[b][i][data[b][i].length-1];return true;}else if(data[a][i][0]=="U"){data[a][i][0]=data[b][i][0];for(var j=1,jj=data[b][i].length;j<jj;j++){data[a][i][j]=(j%2)?attrs[a].x:attrs[a].y;}}
return false;};for(var i=0;i<Math.max(data[0].length,data[1].length);i++){data[0][i]=processPath(data[0][i],attrs[0]);data[1][i]=processPath(data[1][i],attrs[1]);if(data[0][i][0]!=data[1][i][0]&&(edgeCases(0,1,i)||edgeCases(1,0,i))){continue;}
attrs[0].bx=data[0][i][data[0][i].length-4]||0;attrs[0].by=data[0][i][data[0][i].length-3]||0;attrs[0].x=data[0][i][data[0][i].length-2];attrs[0].y=data[0][i][data[0][i].length-1];attrs[1].bx=data[1][i][data[1][i].length-4]||0;attrs[1].by=data[1][i][data[1][i].length-3]||0;attrs[1].x=data[1][i][data[1][i].length-2];attrs[1].y=data[1][i][data[1][i].length-1];}
return data;};var toGradient=function(gradient){if(typeof gradient=="string"){gradient=gradient.split(/\s*\-\s*/);var angle=gradient.shift();if(angle.toLowerCase()=="v"){angle=90;}else if(angle.toLowerCase()=="h"){angle=0;}else{angle=parseFloat(angle,10);}
angle=-angle;var grobj={angle:angle,type:"linear",dots:[],vector:[0,0,Math.cos(angle*Math.PI/180).toFixed(3),Math.sin(angle*Math.PI/180).toFixed(3)]};var max=1/(Math.max(Math.abs(grobj.vector[2]),Math.abs(grobj.vector[3]))||1);grobj.vector[2]*=max;grobj.vector[3]*=max;if(grobj.vector[2]<0){grobj.vector[0]=-grobj.vector[2];grobj.vector[2]=0;}
if(grobj.vector[3]<0){grobj.vector[1]=-grobj.vector[3];grobj.vector[3]=0;}
grobj.vector[0]=grobj.vector[0].toFixed(3);grobj.vector[1]=grobj.vector[1].toFixed(3);grobj.vector[2]=grobj.vector[2].toFixed(3);grobj.vector[3]=grobj.vector[3].toFixed(3);for(var i=0,ii=gradient.length;i<ii;i++){var dot={};var par=gradient[i].match(/^([^:]*):?([\d\.]*)/);dot.color=getRGB(par[1]).hex;par[2]&&(dot.offset=par[2]+"%");grobj.dots.push(dot);}
for(var i=1,ii=grobj.dots.length-1;i<ii;i++){if(!grobj.dots[i].offset){var start=parseFloat(grobj.dots[i-1].offset||0,10),end=false;for(var j=i+1;j<ii;j++){if(grobj.dots[j].offset){end=grobj.dots[j].offset;break;}}
if(!end){end=100;j=ii;}
end=parseFloat(end,10);var d=(end-start)/(j-i+1);for(;i<j;i++){start+=d;grobj.dots[i].offset=start+"%";}}}
return grobj;}else{return gradient;}};if(R.svg){var thePath=function(params,pathString,SVG){var el=doc.createElementNS(SVG.svgns,"path");el.setAttribute("fill","none");if(SVG.canvas){SVG.canvas.appendChild(el);}
var p=new Element(el,SVG);p.isAbsolute=true;p.type="path";p.last={x:0,y:0,bx:0,by:0};p.absolutely=function(){this.isAbsolute=true;return this;};p.relatively=function(){this.isAbsolute=false;return this;};p.moveTo=function(x,y){var d=this.isAbsolute?"M":"m";d+=parseFloat(x,10).toFixed(3)+" "+parseFloat(y,10).toFixed(3)+" ";var oldD=this[0].getAttribute("d")||"";(oldD=="M0,0")&&(oldD="");this[0].setAttribute("d",oldD+d);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y,10);this.attrs.path=oldD+d;return this;};p.lineTo=function(x,y){this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y,10);var d=this.isAbsolute?"L":"l";d+=parseFloat(x,10).toFixed(3)+" "+parseFloat(y,10).toFixed(3)+" ";var oldD=this[0].getAttribute("d")||"";this[0].setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;};p.arcTo=function(rx,ry,large_arc_flag,sweep_flag,x,y){var d=this.isAbsolute?"A":"a";d+=[parseFloat(rx,10).toFixed(3),parseFloat(ry,10).toFixed(3),0,large_arc_flag,sweep_flag,parseFloat(x,10).toFixed(3),parseFloat(y,10).toFixed(3)].join(" ");var oldD=this[0].getAttribute("d")||"";this[0].setAttribute("d",oldD+d);this.last.x=parseFloat(x,10);this.last.y=parseFloat(y,10);this.attrs.path=oldD+d;return this;};p.cplineTo=function(x1,y1,w1){if(!w1){return this.lineTo(x1,y1);}else{var p={};var x=parseFloat(x1,10);var y=parseFloat(y1,10);var w=parseFloat(w1,10);var d=this.isAbsolute?"C":"c";var attr=[+this.last.x+w,+this.last.y,x-w,y,x,y];for(var i=0,ii=attr.length;i<ii;i++){d+=attr[i].toFixed(3)+" ";}
this.last.x=(this.isAbsolute?0:this.last.x)+attr[4];this.last.y=(this.isAbsolute?0:this.last.y)+attr[5];this.last.bx=attr[2];this.last.by=attr[3];var oldD=this[0].getAttribute("d")||"";this[0].setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;}};p.curveTo=function(){var p={},command=[0,1,2,3,"s",5,"c"];var d=command[arguments.length];if(this.isAbsolute){d=d.toUpperCase();}
for(var i=0,ii=arguments.length;i<ii;i++){d+=parseFloat(arguments[i],10).toFixed(3)+" ";}
this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[arguments.length-2],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[arguments.length-1],10);this.last.bx=parseFloat(arguments[arguments.length-4],10);this.last.by=parseFloat(arguments[arguments.length-3],10);var oldD=this.node.getAttribute("d")||"";this.node.setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;};p.qcurveTo=function(){var p={},command=[0,1,"t",3,"q"];var d=command[arguments.length];if(this.isAbsolute){d=d.toUpperCase();}
for(var i=0,ii=arguments.length;i<ii;i++){d+=parseFloat(arguments[i],10).toFixed(3)+" ";}
this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[arguments.length-2],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[arguments.length-1],10);if(arguments.length!=2){this.last.qx=parseFloat(arguments[arguments.length-4],10);this.last.qy=parseFloat(arguments[arguments.length-3],10);}
var oldD=this.node.getAttribute("d")||"";this.node.setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;};p.addRoundedCorner=function(r,dir){var R=.5522*r,rollback=this.isAbsolute,o=this;if(rollback){this.relatively();rollback=function(){o.absolutely();};}else{rollback=function(){};}
var actions={l:function(){return{u:function(){o.curveTo(-R,0,-r,-(r-R),-r,-r);},d:function(){o.curveTo(-R,0,-r,r-R,-r,r);}};},r:function(){return{u:function(){o.curveTo(R,0,r,-(r-R),r,-r);},d:function(){o.curveTo(R,0,r,r-R,r,r);}};},u:function(){return{r:function(){o.curveTo(0,-R,-(R-r),-r,r,-r);},l:function(){o.curveTo(0,-R,R-r,-r,-r,-r);}};},d:function(){return{r:function(){o.curveTo(0,R,-(R-r),r,r,r);},l:function(){o.curveTo(0,R,R-r,r,-r,r);}};}};actions[dir[0]]()[dir[1]]();rollback();return o;};p.andClose=function(){var oldD=this[0].getAttribute("d")||"";this[0].setAttribute("d",oldD+"Z ");this.attrs.path=oldD+"Z ";return this;};if(pathString){p.attrs.path=""+pathString;p.absolutely();paper.pathfinder(p,p.attrs.path);}
if(params){setFillAndStroke(p,params);}
return p;};var addGrdientFill=function(o,gradient,SVG){gradient=toGradient(gradient);var el=doc.createElementNS(SVG.svgns,(gradient.type||"linear")+"Gradient");el.id="raphael-gradient-"+Raphael.idGenerator++;if(gradient.vector&&gradient.vector.length){el.setAttribute("x1",gradient.vector[0]);el.setAttribute("y1",gradient.vector[1]);el.setAttribute("x2",gradient.vector[2]);el.setAttribute("y2",gradient.vector[3]);}
SVG.defs.appendChild(el);var isopacity=true;for(var i=0,ii=gradient.dots.length;i<ii;i++){var stop=doc.createElementNS(SVG.svgns,"stop");if(gradient.dots[i].offset){isopacity=false;}
stop.setAttribute("offset",gradient.dots[i].offset?gradient.dots[i].offset:(i==0)?"0%":"100%");stop.setAttribute("stop-color",getRGB(gradient.dots[i].color).hex||"#fff");el.appendChild(stop);};if(isopacity&&typeof gradient.dots[ii-1].opacity!="undefined"){stop.setAttribute("stop-opacity",gradient.dots[ii-1].opacity);}
o.setAttribute("fill","url(#"+el.id+")");o.style.opacity=1;o.style.fillOpacity=1;o.setAttribute("opacity",1);o.setAttribute("fill-opacity",1);};var updatePosition=function(o){if(o.pattern){var bbox=o.node.getBBox();o.pattern.setAttribute("patternTransform","translate("+[bbox.x,bbox.y].join(",")+")");}};var setFillAndStroke=function(o,params){var dasharray={"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},addDashes=function(o,value){value=dasharray[value.toString().toLowerCase()];if(value){var width=o.attrs["stroke-width"]||"1",butt={round:width,square:width,butt:0}[o.attrs["stroke-linecap"]||params["stroke-linecap"]]||0,dashes=[];for(var i=0,ii=value.length;i<ii;i++){dashes.push(value[i]*width+((i%2)?1:-1)*butt);}
value=dashes.join(",");o.node.setAttribute("stroke-dasharray",value);}};for(var att in params){var value=params[att];o.attrs[att]=value;switch(att){case"path":if(o.type=="path"){o.node.setAttribute("d","M0,0");paper.pathfinder(o,value);}
case"rx":case"cx":case"x":o.node.setAttribute(att,value);updatePosition(o);break;case"ry":case"cy":case"y":o.node.setAttribute(att,value);updatePosition(o);break;case"width":o.node.setAttribute(att,value);break;case"height":o.node.setAttribute(att,value);break;case"src":if(o.type=="image"){o.node.setAttributeNS(svg.xlink,"href",value);}
break;case"stroke-width":o.node.style.strokeWidth=value;o.node.setAttribute(att,value);if(o.attrs["stroke-dasharray"]){addDashes(o,o.attrs["stroke-dasharray"]);}
break;case"stroke-dasharray":addDashes(o,value);break;case"rotation":o.rotate(value,true);break;case"translation":var xy=(value+"").split(separator);o.translate((+xy[0]+1||2)-1,(+xy[1]+1||2)-1);break;case"scale":var xy=(value+"").split(separator);o.scale(+xy[0]||1,+xy[1]||+xy[0]||1);break;case"fill":var isURL=value.match(/^url\(([^\)]+)\)$/i);if(isURL){var el=doc.createElementNS(o.svg.svgns,"pattern");var ig=doc.createElementNS(o.svg.svgns,"image");el.id="raphael-pattern-"+Raphael.idGenerator++;el.setAttribute("x",0);el.setAttribute("y",0);el.setAttribute("patternUnits","userSpaceOnUse");ig.setAttribute("x",0);ig.setAttribute("y",0);ig.setAttributeNS(o.svg.xlink,"href",isURL[1]);el.appendChild(ig);var img=doc.createElement("img");img.style.position="absolute";img.style.top="-9999em";img.style.left="-9999em";img.onload=function(){el.setAttribute("width",this.offsetWidth);el.setAttribute("height",this.offsetHeight);ig.setAttribute("width",this.offsetWidth);ig.setAttribute("height",this.offsetHeight);doc.body.removeChild(this);paper.safari();};doc.body.appendChild(img);img.src=isURL[1];o.svg.defs.appendChild(el);o.node.style.fill="url(#"+el.id+")";o.node.setAttribute("fill","url(#"+el.id+")");o.pattern=el;updatePosition(o);break;}
delete params.gradient;delete o.attrs.gradient;if(typeof o.attrs.opacity!="undefined"&&typeof params.opacity=="undefined"){o.node.style.opacity=o.attrs.opacity;o.node.setAttribute("opacity",o.attrs.opacity);}
if(typeof o.attrs["fill-opacity"]!="undefined"&&typeof params["fill-opacity"]=="undefined"){o.node.style.fillOpacity=o.attrs["fill-opacity"];o.node.setAttribute("fill-opacity",o.attrs["fill-opacity"]);}
case"stroke":o.node.style[att]=getRGB(value).hex;o.node.setAttribute(att,getRGB(value).hex);break;case"gradient":addGrdientFill(o.node,value,o.svg);break;case"opacity":case"fill-opacity":if(o.attrs.gradient){var gradient=doc.getElementById(o.node.getAttribute("fill").replace(/^url\(#|\)$/g,""));if(gradient){var stops=gradient.getElementsByTagName("stop");stops[stops.length-1].setAttribute("stop-opacity",value);}
break;}
default:var cssrule=att.replace(/(\-.)/g,function(w){return w.substring(1).toUpperCase();});o.node.style[cssrule]=value;o.node.setAttribute(att,value);break;}}
tuneText(o,params);};var leading=1.2;var tuneText=function(element,params){if(element.type!="text"||!("text"in params||"font"in params||"font-size"in params||"x"in params)){return;}
var fontSize=element.node.firstChild?parseInt(doc.defaultView.getComputedStyle(element.node.firstChild,"").getPropertyValue("font-size"),10):10;var height=0;if("text"in params){while(element.node.firstChild){element.node.removeChild(element.node.firstChild);}
var texts=(params.text+"").split("\n");for(var i=0,ii=texts.length;i<ii;i++){var tspan=doc.createElementNS(element.svg.svgns,"tspan");i&&tspan.setAttribute("dy",fontSize*leading);i&&tspan.setAttribute("x",element.attrs.x);tspan.appendChild(doc.createTextNode(texts[i]));element.node.appendChild(tspan);height+=fontSize*leading;}}else{var texts=element.node.getElementsByTagName("tspan");for(var i=0,ii=texts.length;i<ii;i++){i&&texts[i].setAttribute("dy",fontSize*leading);i&&texts[i].setAttribute("x",element.attrs.x);height+=fontSize*leading;}}
height-=fontSize*(leading-1);var dif=height/2-fontSize;if(dif){element.node.setAttribute("y",element.attrs.y-dif);}
setTimeout(function(){});};var Element=function(node,svg){var X=0,Y=0;this[0]=node;this.node=node;this.svg=svg;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,x:0,y:0},sx:1,sy:1};};Element.prototype.rotate=function(deg,cx,cy){if(deg==null){return this._.rt.deg;}
var bbox=this.getBBox();deg=deg.toString().split(separator);if(deg.length-1){cx=parseFloat(deg[1],10);cy=parseFloat(deg[2],10);}
deg=parseFloat(deg[0],10);if(cx!=null){this._.rt.deg=deg;}else{this._.rt.deg+=deg;}
if(cy==null){cx=null;}
cx=cx==null?bbox.x+bbox.width/2:cx;cy=cy==null?bbox.y+bbox.height/2:cy;if(this._.rt.deg){this.transformations[0]=("rotate("+this._.rt.deg+" "+cx+" "+cy+")");}else{this.transformations[0]="";}
this.node.setAttribute("transform",this.transformations.join(" "));return this;};Element.prototype.hide=function(){this.node.style.display="none";return this;};Element.prototype.show=function(){this.node.style.display="block";return this;};Element.prototype.remove=function(){this.node.parentNode.removeChild(this.node);};Element.prototype.getBBox=function(){return this.node.getBBox();};Element.prototype.attr=function(){if(arguments.length==1&&typeof arguments[0]=="string"){if(arguments[0]=="translation"){return this.translate();}
return this.attrs[arguments[0]];}
if(arguments.length==1&&arguments[0]instanceof Array){var values={};for(var j in arguments[0]){values[arguments[0][j]]=this.attrs[arguments[0][j]];}
return values;}
if(arguments.length==2){var params={};params[arguments[0]]=arguments[1];setFillAndStroke(this,params);}else if(arguments.length==1&&typeof arguments[0]=="object"){setFillAndStroke(this,arguments[0]);}
return this;};Element.prototype.toFront=function(){this.node.parentNode.appendChild(this.node);return this;};Element.prototype.toBack=function(){if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);}
return this;};Element.prototype.insertAfter=function(element){if(element.node.nextSibling){element.node.parentNode.insertBefore(this.node,element.node.nextSibling);}else{element.node.parentNode.appendChild(this.node);}
return this;};Element.prototype.insertBefore=function(element){element.node.parentNode.insertBefore(this.node,element.node);return this;};var theCircle=function(svg,x,y,r){var el=doc.createElementNS(svg.svgns,"circle");el.setAttribute("cx",x);el.setAttribute("cy",y);el.setAttribute("r",r);el.setAttribute("fill","none");el.setAttribute("stroke","#000");if(svg.canvas){svg.canvas.appendChild(el);}
var res=new Element(el,svg);res.attrs=res.attrs||{};res.attrs.cx=x;res.attrs.cy=y;res.attrs.r=r;res.attrs.stroke="#000";res.type="circle";return res;};var theRect=function(svg,x,y,w,h,r){var el=doc.createElementNS(svg.svgns,"rect");el.setAttribute("x",x);el.setAttribute("y",y);el.setAttribute("width",w);el.setAttribute("height",h);if(r){el.setAttribute("rx",r);el.setAttribute("ry",r);}
el.setAttribute("fill","none");el.setAttribute("stroke","#000");if(svg.canvas){svg.canvas.appendChild(el);}
var res=new Element(el,svg);res.attrs=res.attrs||{};res.attrs.x=x;res.attrs.y=y;res.attrs.width=w;res.attrs.height=h;res.attrs.stroke="#000";if(r){res.attrs.rx=res.attrs.ry=r;}
res.type="rect";return res;};var theEllipse=function(svg,x,y,rx,ry){var el=doc.createElementNS(svg.svgns,"ellipse");el.setAttribute("cx",x);el.setAttribute("cy",y);el.setAttribute("rx",rx);el.setAttribute("ry",ry);el.setAttribute("fill","none");el.setAttribute("stroke","#000");if(svg.canvas){svg.canvas.appendChild(el);}
var res=new Element(el,svg);res.attrs=res.attrs||{};res.attrs.cx=x;res.attrs.cy=y;res.attrs.rx=rx;res.attrs.ry=ry;res.attrs.stroke="#000";res.type="ellipse";return res;};var theImage=function(svg,src,x,y,w,h){var el=doc.createElementNS(svg.svgns,"image");el.setAttribute("x",x);el.setAttribute("y",y);el.setAttribute("width",w);el.setAttribute("height",h);el.setAttribute("preserveAspectRatio","none");el.setAttributeNS(svg.xlink,"href",src);if(svg.canvas){svg.canvas.appendChild(el);}
var res=new Element(el,svg);res.attrs=res.attrs||{};res.attrs.x=x;res.attrs.y=y;res.attrs.width=w;res.attrs.height=h;res.type="image";return res;};var theText=function(svg,x,y,text){var el=doc.createElementNS(svg.svgns,"text");el.setAttribute("x",x);el.setAttribute("y",y);el.setAttribute("text-anchor","middle");if(svg.canvas){svg.canvas.appendChild(el);}
var res=new Element(el,svg);res.attrs=res.attrs||{};res.attrs.x=x;res.attrs.y=y;res.type="text";setFillAndStroke(res,{font:availableAttrs.font,stroke:"none",fill:"#000",text:text});return res;};var theGroup=function(svg){var el=doc.createElementNS(svg.svgns,"g");if(svg.canvas){svg.canvas.appendChild(el);}
var i=new Element(el,svg);for(var f in svg){if(f[0]!="_"&&typeof svg[f]=="function"){i[f]=(function(f){return function(){var e=svg[f].apply(svg,arguments);el.appendChild(e[0]);return e;};})(f);}}
i.type="group";return i;};var setSize=function(width,height){this.width=width||this.width;this.height=height||this.height;this.canvas.setAttribute("width",this.width);this.canvas.setAttribute("height",this.height);return this;};var create=function(){if(typeof arguments[0]=="string"){var container=doc.getElementById(arguments[0]);var width=arguments[1];var height=arguments[2];}
if(typeof arguments[0]=="object"){var container=arguments[0];var width=arguments[1];var height=arguments[2];}
if(typeof arguments[0]=="number"){var container=1,x=arguments[0],y=arguments[1],width=arguments[2],height=arguments[3];}
if(!container){throw new Error("SVG container not found.");}
paper.canvas=doc.createElementNS(paper.svgns,"svg");paper.canvas.setAttribute("width",width||320);paper.width=width||320;paper.canvas.setAttribute("height",height||200);paper.height=height||200;if(container==1){doc.body.appendChild(paper.canvas);paper.canvas.style.position="absolute";paper.canvas.style.left=x+"px";paper.canvas.style.top=y+"px";}else{if(container.firstChild){container.insertBefore(paper.canvas,container.firstChild);}else{container.appendChild(paper.canvas);}}
container={canvas:paper.canvas,clear:function(){while(this.canvas.firstChild){this.canvas.removeChild(this.canvas.firstChild);}
this.defs=doc.createElementNS(paper.svgns,"defs");this.canvas.appendChild(this.defs);}};for(var prop in paper){if(prop!="create"){container[prop]=paper[prop];}}
for(var prop in R.fn){if(!container[prop]){container[prop]=R.fn[prop];}}
container.clear();return container;};paper.remove=function(){this.canvas.parentNode.removeChild(this.canvas);};paper.svgns="http://www.w3.org/2000/svg";paper.xlink="http://www.w3.org/1999/xlink";paper.safari=function(){if(navigator.vendor=="Apple Computer, Inc."){var rect=this.rect(-this.width,-this.height,this.width*3,this.height*3).attr({stroke:"none"});setTimeout(function(){rect.remove();},0);}};}
if(R.vml){thePath=function(params,pathString,VML){var g=createNode("group"),gl=g.style;gl.position="absolute";gl.left=0;gl.top=0;gl.width=VML.width+"px";gl.height=VML.height+"px";var el=createNode("shape"),ol=el.style;ol.width=VML.width+"px";ol.height=VML.height+"px";el.path="";if(params["class"]){el.className="rvml "+params["class"];}
el.coordsize=this.coordsize;el.coordorigin=this.coordorigin;g.appendChild(el);VML.canvas.appendChild(g);var p=new Element(el,g,VML);p.isAbsolute=true;p.type="path";p.path=[];p.last={x:0,y:0,bx:0,by:0,isAbsolute:true};p.Path="";p.absolutely=function(){this.isAbsolute=true;return this;};p.relatively=function(){this.isAbsolute=false;return this;};p.moveTo=function(x,y){var d=this.isAbsolute?"m":"t";d+=Math.round(parseFloat(x,10))+" "+Math.round(parseFloat(y,10));this.node.path=this.Path+=d;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y,10);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"M":"m")+[x,y];return this;};p.lineTo=function(x,y){var d=this.isAbsolute?"l":"r";d+=Math.round(parseFloat(x,10))+" "+Math.round(parseFloat(y,10));this[0].path=this.Path+=d;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y,10);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"L":"l")+[x,y];return this;};p.arcTo=function(rx,ry,large_arc_flag,sweep_flag,x2,y2){x2=(this.isAbsolute?0:this.last.x)+x2;y2=(this.isAbsolute?0:this.last.y)+y2;var x1=this.last.x,y1=this.last.y,x=(x1-x2)/2,y=(y1-y2)/2,k=(large_arc_flag==sweep_flag?-1:1)*Math.sqrt(Math.abs(rx*rx*ry*ry-rx*rx*y*y-ry*ry*x*x)/(rx*rx*y*y+ry*ry*x*x)),cx=k*rx*y/ry+(x1+x2)/2,cy=k*-ry*x/rx+(y1+y2)/2,d=sweep_flag?(this.isAbsolute?"wa":"wr"):(this.isAbsolute?"at":"ar"),left=Math.round(cx-rx),top=Math.round(cy-ry);d+=[left,top,Math.round(left+rx*2),Math.round(top+ry*2),Math.round(x1),Math.round(y1),Math.round(parseFloat(x2,10)),Math.round(parseFloat(y2,10))].join(", ");this.node.path=this.Path+=d;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x2,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y2,10);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"A":"a")+[rx,ry,0,large_arc_flag,sweep_flag,x2,y2];return this;};p.cplineTo=function(x1,y1,w1){if(!w1){return this.lineTo(x1,y1);}else{var x=Math.round(Math.round(parseFloat(x1,10)*100)/100),y=Math.round(Math.round(parseFloat(y1,10)*100)/100),w=Math.round(Math.round(parseFloat(w1,10)*100)/100),d=this.isAbsolute?"c":"v",attr=[Math.round(this.last.x)+w,Math.round(this.last.y),x-w,y,x,y],svgattr=[this.last.x+w1,this.last.y,x1-w1,y1,x1,y1];d+=attr.join(" ")+" ";this.last.x=(this.isAbsolute?0:this.last.x)+attr[4];this.last.y=(this.isAbsolute?0:this.last.y)+attr[5];this.last.bx=attr[2];this.last.by=attr[3];this.node.path=this.Path+=d;this.attrs.path+=(this.isAbsolute?"C":"c")+svgattr;return this;}};p.curveTo=function(){var d=this.isAbsolute?"c":"v";if(arguments.length==6){this.last.bx=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[2],10);this.last.by=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[3],10);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[4],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[5],10);d+=[Math.round(parseFloat(arguments[0],10)),Math.round(parseFloat(arguments[1],10)),Math.round(parseFloat(arguments[2],10)),Math.round(parseFloat(arguments[3],10)),Math.round(parseFloat(arguments[4],10)),Math.round(parseFloat(arguments[5],10))].join(" ")+" ";this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"C":"c")+Array.prototype.splice.call(arguments,0,arguments.length);}
if(arguments.length==4){var bx=this.last.x*2-this.last.bx;var by=this.last.y*2-this.last.by;this.last.bx=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[0],10);this.last.by=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[1],10);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[2],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[3],10);d+=[Math.round(bx),Math.round(by),Math.round(parseFloat(arguments[0],10)),Math.round(parseFloat(arguments[1],10)),Math.round(parseFloat(arguments[2],10)),Math.round(parseFloat(arguments[3],10))].join(" ")+" ";this.attrs.path+=(this.isAbsolute?"S":"s")+Array.prototype.splice.call(arguments,0,arguments.length);}
this.node.path=this.Path+=d;return this;};p.qcurveTo=function(){var d="qb";if(arguments.length==4){this.last.qx=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[0],10);this.last.qy=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[1],10);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[2],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[3],10);d+=[Math.round(this.last.qx),Math.round(this.last.qy),Math.round(this.last.x),Math.round(this.last.y)].join(" ")+" ";this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"Q":"q")+Array.prototype.splice.call(arguments,0,arguments.length);}
if(arguments.length==2){this.last.qx=this.last.x*2-this.last.qx;this.last.qy=this.last.y*2-this.last.qy;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[2],10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[3],10);d+=[Math.round(this.last.qx),Math.round(this.last.qy),Math.round(this.last.x),Math.round(this.last.y)].join(" ")+" ";this.attrs.path+=(this.isAbsolute?"T":"t")+Array.prototype.splice.call(arguments,0,arguments.length);}
this.node.path=this.Path+=d;this.path.push({type:"qcurve",arg:[].slice.call(arguments,0),pos:this.isAbsolute});return this;};p.addRoundedCorner=function(r,dir){var R=.5522*r,rollback=this.isAbsolute,o=this;if(rollback){this.relatively();rollback=function(){o.absolutely();};}else{rollback=function(){};}
var actions={l:function(){return{u:function(){o.curveTo(-R,0,-r,-(r-R),-r,-r);},d:function(){o.curveTo(-R,0,-r,r-R,-r,r);}};},r:function(){return{u:function(){o.curveTo(R,0,r,-(r-R),r,-r);},d:function(){o.curveTo(R,0,r,r-R,r,r);}};},u:function(){return{r:function(){o.curveTo(0,-R,-(R-r),-r,r,-r);},l:function(){o.curveTo(0,-R,R-r,-r,-r,-r);}};},d:function(){return{r:function(){o.curveTo(0,R,-(R-r),r,r,r);},l:function(){o.curveTo(0,R,R-r,r,-r,r);}};}};actions[dir.charAt(0)]()[dir.charAt(1)]();rollback();return o;};p.andClose=function(){this.node.path=(this.Path+="x e");this.attrs.path+="z";return this;};if(pathString){p.absolutely();p.attrs.path="";paper.pathfinder(p,""+pathString);}
setFillAndStroke(p,params);if(params.gradient){addGrdientFill(p,params.gradient);}
return p;};var setFillAndStroke=function(o,params){var s=o.node.style,res=o;o.attrs=o.attrs||{};for(var par in params){o.attrs[par]=params[par];}
if(params.path&&o.type=="path"){o.Path="";o.path=[];paper.pathfinder(o,params.path);}
if(params.rotation!=null){o.rotate(params.rotation,true);}
if(params.translation){var xy=(params.translation+"").split(separator);o.translate(xy[0],xy[1]);}
if(params.scale){var xy=(params.scale+"").split(separator);o.scale(xy[0],xy[1]);}
if(o.type=="image"&&params.src){o.node.src=params.src;}
if(o.type=="image"&&params.opacity){o.node.filterOpacity=" progid:DXImageTransform.Microsoft.Alpha(opacity="+(params.opacity*100)+")";o.node.style.filter=(o.node.filterMatrix||"")+(o.node.filterOpacity||"");}
params.font&&(s.font=params.font);params["font-family"]&&(s.fontFamily=params["font-family"]);params["font-size"]&&(s.fontSize=params["font-size"]);params["font-weight"]&&(s.fontWeight=params["font-weight"]);params["font-style"]&&(s.fontStyle=params["font-style"]);if(typeof params.opacity!="undefined"||typeof params["stroke-width"]!="undefined"||typeof params.fill!="undefined"||typeof params.stroke!="undefined"||params["stroke-width"]||params["stroke-opacity"]||params["stroke-dasharray"]||params["stroke-miterlimit"]||params["stroke-linejoin"]||params["stroke-linecap"]){o=o.shape||o.node;var fill=(o.getElementsByTagName("fill")&&o.getElementsByTagName("fill")[0])||createNode("fill");if("fill-opacity"in params||"opacity"in params){fill.opacity=((+params["fill-opacity"]+1||2)-1)*((+params.opacity+1||2)-1);}
if(params.fill){fill.on=true;}
if(typeof fill.on=="undefined"||params.fill=="none"){fill.on=false;}
if(fill.on&&params.fill){var isURL=params.fill.match(/^url\(([^\)]+)\)$/i);if(isURL){fill.src=isURL[1];fill.type="tile";}else{fill.color=getRGB(params.fill).hex;fill.src="";fill.type="solid";}}
o.appendChild(fill);var stroke=(o.getElementsByTagName("stroke")&&o.getElementsByTagName("stroke")[0])||createNode("stroke");if((params.stroke&&params.stroke!="none")||params["stroke-width"]||typeof params["stroke-opacity"]!="undefined"||params["stroke-dasharray"]||params["stroke-miterlimit"]||params["stroke-linejoin"]||params["stroke-linecap"]){stroke.on=true;}
if(params.stroke=="none"||typeof stroke.on=="undefined"||params.stroke==0){stroke.on=false;}
if(stroke.on&&params.stroke){stroke.color=getRGB(params.stroke).hex;}
stroke.opacity=((+params["stroke-opacity"]+1||2)-1)*((+params.opacity+1||2)-1);params["stroke-linejoin"]&&(stroke.joinstyle=params["stroke-linejoin"]||"miter");stroke.miterlimit=params["stroke-miterlimit"]||8;params["stroke-linecap"]&&(stroke.endcap={butt:"flat",square:"square",round:"round"}[params["stroke-linecap"]]||"miter");params["stroke-width"]&&(stroke.weight=(parseFloat(params["stroke-width"],10)||1)*12/16);if(params["stroke-dasharray"]){var dasharray={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};stroke.dashstyle=dasharray[params["stroke-dasharray"]]||"";}
o.appendChild(stroke);}
if(res.type=="text"){var span=doc.createElement("span"),s=span.style;res.attrs.font&&(s.font=res.attrs.font);res.attrs["font-family"]&&(s.fontFamily=res.attrs["font-family"]);res.attrs["font-size"]&&(s.fontSize=res.attrs["font-size"]);res.attrs["font-weight"]&&(s.fontWeight=res.attrs["font-weight"]);res.attrs["font-style"]&&(s.fontStyle=res.attrs["font-style"]);res.node.parentNode.appendChild(span);span.innerText=res.node.string;res.W=res.attrs.w=span.offsetWidth;res.H=res.attrs.h=span.offsetHeight;res.X=res.attrs.x-Math.round(res.W/2);res.Y=res.attrs.y-Math.round(res.H/2);res.node.parentNode.removeChild(span);}};var getAngle=function(a,b,c,d){var angle=Math.round(Math.atan((parseFloat(c,10)-parseFloat(a,10))/(parseFloat(d,10)-parseFloat(b,10)))*57.29)||0;if(!angle&&parseFloat(a,10)<parseFloat(b,10)){angle=180;}
angle-=180;if(angle<0){angle+=360;}
return angle;};var addGrdientFill=function(o,gradient){gradient=toGradient(gradient);o.attrs=o.attrs||{};var attrs=o.attrs;o.attrs.gradient=gradient;o=o.shape||o[0];var fill=o.getElementsByTagName("fill");if(fill.length){fill=fill[0];}else{fill=createNode("fill");}
if(gradient.dots.length){fill.on=true;fill.method="none";fill.type=((gradient.type+"").toLowerCase()=="radial")?"gradientTitle":"gradient";if(typeof gradient.dots[0].color!="undefined"){fill.color=getRGB(gradient.dots[0].color).hex;}
if(typeof gradient.dots[gradient.dots.length-1].color!="undefined"){fill.color2=getRGB(gradient.dots[gradient.dots.length-1].color).hex;}
var colors=[];for(var i=0,ii=gradient.dots.length;i<ii;i++){if(gradient.dots[i].offset){colors.push(gradient.dots[i].offset+" "+getRGB(gradient.dots[i].color).hex);}};var fillOpacity=typeof gradient.dots[gradient.dots.length-1].opacity=="undefined"?(typeof attrs.opacity=="undefined"?1:attrs.opacity):gradient.dots[gradient.dots.length-1].opacity;if(colors.length){fill.colors.value=colors.join(",");fillOpacity=typeof attrs.opacity=="undefined"?1:attrs.opacity;}else{fill.colors.value="0% "+fill.color;}
fill.opacity=fillOpacity;if(typeof gradient.angle!="undefined"){fill.angle=(-gradient.angle+270)%360;}else if(gradient.vector){fill.angle=getAngle.apply(null,gradient.vector);}
if((gradient.type+"").toLowerCase()=="radial"){fill.focus="100%";fill.focusposition="0.5 0.5";}}};var Element=function(node,group,vml){var Rotation=0,RotX=0,RotY=0,Scale=1;this[0]=node;this.node=node;this.X=0;this.Y=0;this.attrs={};this.Group=group;this.vml=vml;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};};Element.prototype.rotate=function(deg,cx,cy){if(deg==null){return this._.rt.deg;}
deg=deg.toString().split(separator);if(deg.length-1){cx=parseFloat(deg[1],10);cy=parseFloat(deg[2],10);}
deg=parseFloat(deg[0],10);if(cy==null){cx=null;}
if(cx!=null){this._.rt.deg=deg;}else{this._.rt.deg+=deg;}
this._.rt.cx=cx;this._.rt.cy=cy;this.setBox(null,cx,cy);this.Group.style.rotation=this._.rt.deg;return this;};Element.prototype.setBox=function(params,cx,cy){var gs=this.Group.style,os=(this.shape&&this.shape.style)||this.node.style;for(var i in params){this.attrs[i]=params[i];}
cx=cx||this._.rt.cx;cy=cy||this._.rt.cy;var attr=this.attrs,x,y,w,h;switch(this.type){case"circle":x=attr.cx-attr.r;y=attr.cy-attr.r;w=h=attr.r*2;break;case"ellipse":x=attr.cx-attr.rx;y=attr.cy-attr.ry;w=attr.rx*2;h=attr.ry*2;break;case"rect":case"image":x=attr.x;y=attr.y;w=attr.width||0;h=attr.height||0;break;case"text":this.textpath.v=["m",Math.round(attr.x),", ",Math.round(attr.y-2),"l",Math.round(attr.x)+1,", ",Math.round(attr.y-2)].join("");x=attr.x-Math.round(this.W/2);y=attr.y-this.H/2;w=this.W;h=this.H;break;case"path":if(!this.attrs.path){x=0;y=0;w=this.vml.width;h=this.vml.height;}else{var dim=pathDimensions(this.attrs.path),x=dim.x;y=dim.y;w=dim.width;h=dim.height;}
break;default:x=0;y=0;w=this.vml.width;h=this.vml.height;break;}
cx=(cx==null)?x+w/2:cx;cy=(cy==null)?y+h/2:cy;var left=cx-this.vml.width/2,top=cy-this.vml.height/2;if(this.type=="path"||this.type=="text"){gs.left=left+"px";gs.top=top+"px";this.X=this.type=="text"?x:-left;this.Y=this.type=="text"?y:-top;this.W=w;this.H=h;os.left=-left+"px";os.top=-top+"px";}else{gs.left=left+"px";gs.top=top+"px";this.X=x;this.Y=y;this.W=w;this.H=h;gs.width=this.vml.width+"px";gs.height=this.vml.height+"px";os.left=x-left+"px";os.top=y-top+"px";os.width=w+"px";os.height=h+"px";}};Element.prototype.hide=function(){this.Group.style.display="none";return this;};Element.prototype.show=function(){this.Group.style.display="block";return this;};Element.prototype.getBBox=function(){return{x:this.X,y:this.Y,width:this.W,height:this.H};};Element.prototype.remove=function(){this[0].parentNode.removeChild(this[0]);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);};Element.prototype.attr=function(){if(arguments.length==1&&typeof arguments[0]=="string"){if(arguments[0]=="translation"){return this.translate();}
return this.attrs[arguments[0]];}
if(this.attrs&&arguments.length==1&&arguments[0]instanceof Array){var values={};for(var i=0,ii=arguments[0].length;i<ii;i++){values[arguments[0][i]]=this.attrs[arguments[0][i]];};return values;}
var params;if(arguments.length==2){params={};params[arguments[0]]=arguments[1];}
if(arguments.length==1&&typeof arguments[0]=="object"){params=arguments[0];}
if(params){if(params.gradient){addGrdientFill(this,params.gradient);}
if(params.text&&this.type=="text"){this.node.string=params.text;}
if(params.id){this.node.id=params.id;}
setFillAndStroke(this,params);this.setBox(params);}
return this;};Element.prototype.toFront=function(){this.Group.parentNode.appendChild(this.Group);return this;};Element.prototype.toBack=function(){if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);}
return this;};Element.prototype.insertAfter=function(element){if(element.Group.nextSibling){element.Group.parentNode.insertBefore(this.Group,element.Group.nextSibling);}else{element.Group.parentNode.appendChild(this.Group);}
return this;};Element.prototype.insertBefore=function(element){element.Group.parentNode.insertBefore(this.Group,element.Group);return this;};var theCircle=function(vml,x,y,r){var g=createNode("group");var o=createNode("oval");g.appendChild(o);vml.canvas.appendChild(g);var res=new Element(o,g,vml);res.type="circle";setFillAndStroke(res,{stroke:"#000",fill:"none"});res.attrs.cx=x;res.attrs.cy=y;res.attrs.r=r;res.setBox({x:x-r,y:y-r,width:r*2,height:r*2});return res;};var theRect=function(vml,x,y,w,h,r){var g=createNode("group");var o=createNode(r?"roundrect":"rect");if(r){o.arcsize=r/(Math.min(w,h));}
g.appendChild(o);vml.canvas.appendChild(g);var res=new Element(o,g,vml);res.type="rect";setFillAndStroke(res,{stroke:"#000"});res.attrs.x=x;res.attrs.y=y;res.attrs.w=w;res.attrs.h=h;res.attrs.r=r;res.setBox({x:x,y:y,width:w,height:h});return res;};var theEllipse=function(vml,x,y,rx,ry){var g=createNode("group");var o=createNode("oval");g.appendChild(o);vml.canvas.appendChild(g);var res=new Element(o,g,vml);res.type="ellipse";setFillAndStroke(res,{stroke:"#000"});res.attrs.cx=x;res.attrs.cy=y;res.attrs.rx=rx;res.attrs.ry=ry;res.setBox({x:x-rx,y:y-ry,width:rx*2,height:ry*2});return res;};var theImage=function(vml,src,x,y,w,h){var g=createNode("group");var o=createNode("image");o.src=src;g.appendChild(o);vml.canvas.appendChild(g);var res=new Element(o,g,vml);res.type="image";res.attrs.x=x;res.attrs.y=y;res.attrs.w=w;res.attrs.h=h;res.setBox({x:x,y:y,width:w,height:h});return res;};var theText=function(vml,x,y,text){var g=createNode("group"),gs=g.style;var el=createNode("shape"),ol=el.style;var path=createNode("path"),ps=path.style;path.v=["m",Math.round(x),", ",Math.round(y-2),"l",Math.round(x)+1,", ",Math.round(y-2)].join("");path.textpathok=true;ol.width=vml.width;ol.height=vml.height;gs.position="absolute";gs.left=0;gs.top=0;gs.width=vml.width;gs.height=vml.height;var o=createNode("textpath");o.string=text;o.on=true;o.coordsize=vml.coordsize;o.coordorigin=vml.coordorigin;el.appendChild(o);el.appendChild(path);g.appendChild(el);vml.canvas.appendChild(g);var res=new Element(o,g,vml);res.shape=el;res.textpath=path;res.type="text";res.attrs.x=x;res.attrs.y=y;res.attrs.w=1;res.attrs.h=1;setFillAndStroke(res,{font:availableAttrs.font,stroke:"none",fill:"#000"});return res;};var setSize=function(width,height){this.width=width||this.width;this.height=height||this.height;this.canvas.style.width=this.width+"px";this.canvas.style.height=this.height+"px";this.canvas.parentNode.style.clip="rect(0 "+this.width+" "+this.height+" 0)";this.canvas.coordsize=this.width+" "+this.height;return this;};doc.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{if(!doc.namespaces.rvml){doc.namespaces.add("rvml","urn:schemas-microsoft-com:vml");}
var createNode=function(tagName){return doc.createElement('<rvml:'+tagName+' class="rvml">');};}catch(e){var createNode=function(tagName){return doc.createElement('<'+tagName+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');};}
var create=function(){var container,width,height;if(typeof arguments[0]=="string"){container=doc.getElementById(arguments[0]);width=arguments[1];height=arguments[2];}
if(typeof arguments[0]=="object"){container=arguments[0];width=arguments[1];height=arguments[2];}
if(typeof arguments[0]=="number"){container=1;x=arguments[0];y=arguments[1];width=arguments[2];height=arguments[3];}
if(!container){throw new Error("VML container not found.");}
var c=doc.createElement("div"),d=doc.createElement("div"),r=paper.canvas=createNode("group"),cs=c.style,rs=r.style;paper.width=width;paper.height=height;width=width||"320px";height=height||"200px";cs.clip="rect(0 "+width+"px "+height+"px 0)";cs.top="-2px";cs.left="-2px";cs.position="absolute";rs.position="absolute";d.style.position="relative";rs.width=width;rs.height=height;r.coordsize=(/%$/.test(width)?width:parseFloat(width,10))+" "+(/%$/.test(height)?height:parseFloat(height,10));r.coordorigin="0 0";var b=createNode("rect"),bs=b.style;bs.left=bs.top=0;bs.width=rs.width;bs.height=rs.height;b.filled=b.stroked="f";r.appendChild(b);c.appendChild(r);d.appendChild(c);if(container==1){doc.body.appendChild(d);cs.position="absolute";cs.left=x+"px";cs.top=y+"px";cs.width=width;cs.height=height;container={style:{width:width,height:height}};}else{cs.width=container.style.width=width;cs.height=container.style.height=height;if(container.firstChild){container.insertBefore(d,container.firstChild);}else{container.appendChild(d);}}
for(var prop in paper){container[prop]=paper[prop];}
for(var prop in R.fn){if(!container[prop]){container[prop]=R.fn[prop];}}
container.clear=function(){var todel=[];for(var i=0,ii=r.childNodes.length;i<ii;i++){if(r.childNodes[i]!=b){todel.push(r.childNodes[i]);}}
for(i=0,ii=todel.length;i<ii;i++){r.removeChild(todel[i]);}};return container;};paper.remove=function(){this.canvas.parentNode.parentNode.parentNode.removeChild(this.canvas.parentNode.parentNode);};paper.safari=function(){};}
var addEvent=(function(){if(doc.addEventListener){return function(obj,type,fn,element){var f=function(e){return fn.call(element,e);};obj.addEventListener(type,f,false);return function(){obj.removeEventListener(type,f,false);return true;};};}else if(doc.attachEvent){return function(obj,type,fn,element){var f=function(e){return fn.call(element,e||win.event);};obj.attachEvent("on"+type,f);var detacher=function(){obj.detachEvent("on"+type,f);return true;};if(type=="mouseover"){obj.attachEvent("onmouseenter",f);return function(){obj.detachEvent("onmouseenter",f);return detacher();};}else if(type=="mouseout"){obj.attachEvent("onmouseleave",f);return function(){obj.detachEvent("onmouseleave",f);return detacher();};}
return detacher;};}})();for(var i=events.length;i--;){(function(eventName){Element.prototype[eventName]=function(fn){if(typeof fn=="function"){this.events=this.events||{};this.events[eventName]=this.events[eventName]||{};this.events[eventName][fn]=this.events[eventName][fn]||[];this.events[eventName][fn].push(addEvent(this.shape||this.node,eventName,fn,this));}
return this;};Element.prototype["un"+eventName]=function(fn){this.events&&this.events[eventName]&&this.events[eventName][fn]&&this.events[eventName][fn].length&&this.events[eventName][fn].shift()()&&!this.events[eventName][fn].length&&delete this.events[eventName][fn];};})(events[i]);}
paper.circle=function(x,y,r){return theCircle(this,x,y,r);};paper.rect=function(x,y,w,h,r){return theRect(this,x,y,w,h,r);};paper.ellipse=function(x,y,rx,ry){return theEllipse(this,x,y,rx,ry);};paper.path=function(params,pathString){return thePath(params,pathString,this);};paper.image=function(src,x,y,w,h){return theImage(this,src,x,y,w,h);};paper.text=function(x,y,text){return theText(this,x,y,text);};paper.group=function(){return this;};paper.drawGrid=function(x,y,w,h,wv,hv,color){color=color||"#000";var path=["M",x,y,"L",x+w,y,x+w,y+h,x,y+h,x,y],rowHeight=h/hv,columnWidth=w/wv;for(var i=1;i<hv;i++){path=path.concat(["M",x,y+i*rowHeight,"L",x+w,y+i*rowHeight]);}
for(var i=1;i<wv;i++){path=path.concat(["M",x+i*columnWidth,y,"L",x+i*columnWidth,y+h]);}
return this.path({stroke:color,"stroke-width":1},path.join(","));};paper.pathfinder=function(p,path){var commands={M:function(x,y){this.moveTo(x,y);},C:function(x1,y1,x2,y2,x3,y3){this.curveTo(x1,y1,x2,y2,x3,y3);},Q:function(x1,y1,x2,y2){this.qcurveTo(x1,y1,x2,y2);},T:function(x,y){this.qcurveTo(x,y);},S:function(x1,y1,x2,y2){p.curveTo(x1,y1,x2,y2);},L:function(x,y){p.lineTo(x,y);},H:function(x){this.lineTo(x,this.last.y);},V:function(y){this.lineTo(this.last.x,y);},A:function(rx,ry,xaxisrotation,largearcflag,sweepflag,x,y){this.arcTo(rx,ry,largearcflag,sweepflag,x,y);},Z:function(){this.andClose();}};path=pathToAbsolute(path);for(var i=0,ii=path.length;i<ii;i++){var b=path[i].shift();commands[b].apply(p,path[i]);}};paper.set=function(itemsArray){return new Set(itemsArray);};paper.setSize=setSize;Element.prototype.stop=function(){clearTimeout(this.animation_in_progress);};Element.prototype.scale=function(x,y){if(x==undefined&&y==undefined){return{x:this._.sx,y:this._.sy};}
y=y||x;isNaN(y)&&(y=x);var dx,dy,cx,cy;if(x!=0){var dirx=Math.round(x/Math.abs(x)),diry=Math.round(y/Math.abs(y)),s=this.node.style;dx=this.attr("x");dy=this.attr("y");cx=this.attr("cx");cy=this.attr("cy");if(dirx!=1||diry!=1){if(this.transformations){this.transformations[2]="scale("+[dirx,diry]+")";this.node.setAttribute("transform",this.transformations.join(" "));dx=(dirx<0)?-this.attr("x")-this.attrs.width*x*dirx/this._.sx:this.attr("x");dy=(diry<0)?-this.attr("y")-this.attrs.height*y*diry/this._.sy:this.attr("y");cx=this.attr("cx")*dirx;cy=this.attr("cy")*diry;}else{this.node.filterMatrix=" progid:DXImageTransform.Microsoft.Matrix(M11="+dirx+", M12=0, M21=0, M22="+diry+", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')";s.filter=(this.node.filterMatrix||"")+(this.node.filterOpacity||"");}}else{if(this.transformations){this.transformations[2]="";this.node.setAttribute("transform",this.transformations.join(" "));}else{this.node.filterMatrix="";s.filter=(this.node.filterMatrix||"")+(this.node.filterOpacity||"");}}
switch(this.type){case"rect":case"image":this.attr({width:this.attrs.width*x*dirx/this._.sx,height:this.attrs.height*y*diry/this._.sy,x:dx,y:dy});break;case"circle":case"ellipse":this.attr({rx:this.attrs.rx*x*dirx/this._.sx,ry:this.attrs.ry*y*diry/this._.sy,r:this.attrs.r*x*diry/this._.sx,cx:cx,cy:cy});break;case"path":var path=pathToRelative(Raphael.parsePathString(this.attr("path"))),skip=true,dim=pathDimensions(this.attrs.path),dx=-dim.width*(x-1)/2,dy=-dim.height*(y-1)/2;for(var i=0,ii=path.length;i<ii;i++){if(path[i][0].toUpperCase()=="M"&&skip){continue;}else{skip=false;}
if(path[i][0].toUpperCase()=="A"){path[i][path[i].length-2]*=x*dirx;path[i][path[i].length-1]*=y*diry;}else{for(var j=1,jj=path[i].length;j<jj;j++){path[i][j]*=(j%2)?x*dirx/this._.sx:y*diry/this._.sy;}}}
var dim2=pathDimensions(path),dx=dim.x+dim.width/2-dim2.x-dim2.width/2,dy=dim.y+dim.height/2-dim2.y-dim2.height/2;path=pathToRelative(path);path[0][1]+=dx;path[0][2]+=dy;this.attr({path:path.join(" ")});}}
this._.sx=x;this._.sy=y;return this;};Element.prototype.animate=function(params,ms,callback){clearTimeout(this.animation_in_progress);var from={},to={},diff={},t={x:0,y:0};for(var attr in params){if(attr in availableAnimAttrs){from[attr]=this.attr(attr);if(typeof from[attr]=="undefined"){from[attr]=availableAttrs[attr];}
to[attr]=params[attr];switch(availableAnimAttrs[attr]){case"number":diff[attr]=(to[attr]-from[attr])/ms;break;case"colour":from[attr]=getRGB(from[attr]);var toColour=getRGB(to[attr]);diff[attr]={r:(toColour.r-from[attr].r)/ms,g:(toColour.g-from[attr].g)/ms,b:(toColour.b-from[attr].b)/ms};break;case"path":var pathes=pathEqualiser(from[attr],to[attr]);from[attr]=pathes[0];to[attr]=pathes[1];diff[attr]=[];for(var i=0,ii=from[attr].length;i<ii;i++){diff[attr][i]=[0];for(var j=1,jj=from[attr][i].length;j<jj;j++){diff[attr][i][j]=(to[attr][i][j]-from[attr][i][j])/ms;}}
break;case"csv":var values=params[attr].toString().split(separator),from2=from[attr].toString().split(separator);if(attr=="translation"){from[attr]=[0,0];diff[attr]=[values[0]/ms,values[1]/ms];}else if(attr=="rotation"){from[attr]=(from2[1]==values[1]&&from2[2]==values[2])?from2:[0,values[1],values[2]];diff[attr]=[(values[0]-from[attr][0])/ms,0,0];}else{from[attr]=(from[attr]+"").split(separator);diff[attr]=[(values[0]-from[attr][0])/ms,(values[1]-from[attr][0])/ms];}
to[attr]=values;}}}
var start=new Date(),prev=0,that=this;(function(){var time=(new Date()).getTime()-start.getTime(),set={},now;if(time<ms){for(var attr in from){switch(availableAnimAttrs[attr]){case"number":now=+from[attr]+time*diff[attr];break;case"colour":now="rgb("+[Math.round(from[attr].r+time*diff[attr].r),Math.round(from[attr].g+time*diff[attr].g),Math.round(from[attr].b+time*diff[attr].b)].join(",")+")";break;case"path":now=[];for(var i=0,ii=from[attr].length;i<ii;i++){now[i]=[from[attr][i][0]];for(var j=1,jj=from[attr][i].length;j<jj;j++){now[i][j]=from[attr][i][j]+time*diff[attr][i][j];}
now[i]=now[i].join(" ");}
now=now.join(" ");break;case"csv":if(attr=="translation"){var x=diff[attr][0]*(time-prev),y=diff[attr][1]*(time-prev);t.x+=x;t.y+=y;now=[x,y].join(" ");}else if(attr=="rotation"){now=+from[attr][0]+time*diff[attr][0];from[attr][1]&&(now+=","+from[attr][1]+","+from[attr][2]);}else{now=[+from[attr][0]+time*diff[attr][0],+from[attr][1]+time*diff[attr][1]].join(" ");}
break;}
if(attr=="font-size"){set[attr]=now+"px";}else{set[attr]=now;}}
that.attr(set);that.animation_in_progress=setTimeout(arguments.callee,0);paper.safari();}else{(t.x||t.y)&&that.translate(-t.x,-t.y);that.attr(params);clearTimeout(that.animation_in_progress);paper.safari();(typeof callback=="function")&&callback.call(that);}
prev=time;})();return this;};Element.prototype.translate=function(x,y){if(x==null){return{x:this._.tx,y:this._.ty};}
this._.tx+=+x;this._.ty+=+y;switch(this.type){case"circle":case"ellipse":this.attr({cx:this.attrs.cx+x,cy:this.attrs.cy+y});break;case"rect":case"image":case"text":this.attr({x:this.attrs.x+(+x),y:this.attrs.y+(+y)});break;case"path":var path=pathToRelative(this.attrs.path);path[0][1]+=+x;path[0][2]+=+y;this.attr({path:path.join(" ")});break;}
return this;};var Set=function(itemsArray){this.items=[];this.length=(itemsArray&&itemsArray.length)||0;if(itemsArray&&itemsArray.constructor==Array){for(var i=itemsArray.length;i--;){if(itemsArray[i].constructor==Element){this.items[this.items.length]=itemsArray[i];}}}};Set.prototype.push=function(item){if(item&&item.constructor==Element){var len=this.items.length;this.items[len]=item;this[len]=item;this.length++;}
return this;};Set.prototype.pull=function(id){var res=this.items.splice(id,1)[0];for(var j=id,jj=this.items.length;j<jj;j++){this[j]=this[j+1];}
delete this[jj+1];this.length--;return res;};for(var method in Element.prototype){Set.prototype[method]=(function(methodname){return function(){for(var i=this.items.length;i--;){this.items[i][methodname].apply(this.items[i],arguments);}
return this;};})(method);}
Set.prototype.getBBox=function(){var x=[],y=[],w=[],h=[];for(var i=this.items.length;i--;){var box=this.items[i].getBBox();x.push(box.x);y.push(box.y);w.push(box.x+box.width);h.push(box.y+box.height);}
x=Math.min.apply(Math,x);y=Math.min.apply(Math,y);return{x:x,y:y,width:Math.max.apply(Math,w)-x,height:Math.max.apply(Math,h)-y};};return R;})();Evri.defineNamespace(Evri,'Flash');Evri.extendNamespace(Evri.Flash,{swfobject:function(){var UNDEF="undefined",OBJECT="object",SHOCKWAVE_FLASH="Shockwave Flash",SHOCKWAVE_FLASH_AX="ShockwaveFlash.ShockwaveFlash",FLASH_MIME_TYPE="application/x-shockwave-flash",EXPRESS_INSTALL_ID="SWFObjectExprInst",win=window,doc=document,nav=navigator,domLoadFnArr=[],regObjArr=[],objIdArr=[],listenersArr=[],script,timer=null,storedAltContent=null,storedAltContentId=null,isDomLoaded=false,isExpressInstallActive=false;var ua=function(){var w3cdom=typeof doc.getElementById!=UNDEF&&typeof doc.getElementsByTagName!=UNDEF&&typeof doc.createElement!=UNDEF,playerVersion=[0,0,0],d=null;if(typeof nav.plugins!=UNDEF&&typeof nav.plugins[SHOCKWAVE_FLASH]==OBJECT){d=nav.plugins[SHOCKWAVE_FLASH].description;if(d&&!(typeof nav.mimeTypes!=UNDEF&&nav.mimeTypes[FLASH_MIME_TYPE]&&!nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)){d=d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");playerVersion[0]=parseInt(d.replace(/^(.*)\..*$/,"$1"),10);playerVersion[1]=parseInt(d.replace(/^.*\.(.*)\s.*$/,"$1"),10);playerVersion[2]=/r/.test(d)?parseInt(d.replace(/^.*r(.*)$/,"$1"),10):0;}}
else if(typeof win.ActiveXObject!=UNDEF){var a=null,fp6Crash=false;try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX+".7");}
catch(e){try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX+".6");playerVersion=[6,0,21];a.AllowScriptAccess="always";}
catch(e){if(playerVersion[0]==6){fp6Crash=true;}}
if(!fp6Crash){try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX);}
catch(e){}}}
if(!fp6Crash&&a){try{d=a.GetVariable("$version");if(d){d=d.split(" ")[1].split(",");playerVersion=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)];}}
catch(e){}}}
var u=nav.userAgent.toLowerCase(),p=nav.platform.toLowerCase(),webkit=/webkit/.test(u)?parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,ie=(/msie/.test(u)&&!/opera/.test(u)),windows=p?/win/.test(p):/win/.test(u),mac=p?/mac/.test(p):/mac/.test(u);return{w3cdom:w3cdom,pv:playerVersion,webkit:webkit,ie:ie,win:windows,mac:mac};}();var onDomLoad=function(){if(!ua.w3cdom){return;}
addDomLoadEvent(main);if(ua.ie&&ua.win){try{doc.write("<scr"+"ipt id=__ie_ondomload defer=true src=//:></scr"+"ipt>");script=getElementById("__ie_ondomload");if(script){addListener(script,"onreadystatechange",checkReadyState);}}
catch(e){}}
if(ua.webkit&&typeof doc.readyState!=UNDEF){timer=setInterval(function(){if(/loaded|complete/.test(doc.readyState)){callDomLoadFunctions();}},10);}
if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("DOMContentLoaded",callDomLoadFunctions,null);}
addLoadEvent(callDomLoadFunctions);}();function checkReadyState(){if(script.readyState=="complete"){if(script.parentNode){script.parentNode.removeChild(script);}
callDomLoadFunctions();}}
function callDomLoadFunctions(){if(isDomLoaded){return;}
if(ua.ie&&ua.win){var s=createElement("span");try{var t=doc.getElementsByTagName("body")[0].appendChild(s);t.parentNode.removeChild(t);}
catch(e){return;}}
isDomLoaded=true;if(timer){clearInterval(timer);timer=null;}
var dl=domLoadFnArr.length;for(var i=0;i<dl;i++){domLoadFnArr[i]();}}
function addDomLoadEvent(fn,forceLoad){forceLoad=!!forceLoad;if(isDomLoaded||forceLoad){fn();}
else{domLoadFnArr[domLoadFnArr.length]=fn;}}
function addLoadEvent(fn){if(typeof win.addEventListener!=UNDEF){win.addEventListener("load",fn,false);}
else if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("load",fn,false);}
else if(typeof win.attachEvent!=UNDEF){addListener(win,"onload",fn);}
else if(typeof win.onload=="function"){var fnOld=win.onload;win.onload=function(){fnOld();fn();};}
else{win.onload=fn;}}
function main(){var rl=regObjArr.length;for(var i=0;i<rl;i++){var id=regObjArr[i].id;if(ua.pv[0]>0){var obj=getElementById(id);if(obj){regObjArr[i].width=obj.getAttribute("width")?obj.getAttribute("width"):"0";regObjArr[i].height=obj.getAttribute("height")?obj.getAttribute("height"):"0";if(hasPlayerVersion(regObjArr[i].swfVersion)){if(ua.webkit&&ua.webkit<312){fixParams(obj);}
setVisibility(id,true);}
else if(regObjArr[i].expressInstall&&!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac)){showExpressInstall(regObjArr[i]);}
else{displayAltContent(obj);}}}
else{setVisibility(id,true);}}}
function fixParams(obj){var nestedObj=obj.getElementsByTagName(OBJECT)[0];if(nestedObj){var e=createElement("embed"),a=nestedObj.attributes;if(a){var al=a.length;for(var i=0;i<al;i++){if(a[i].nodeName=="DATA"){e.setAttribute("src",a[i].nodeValue);}
else{e.setAttribute(a[i].nodeName,a[i].nodeValue);}}}
var c=nestedObj.childNodes;if(c){var cl=c.length;for(var j=0;j<cl;j++){if(c[j].nodeType==1&&c[j].nodeName=="PARAM"){e.setAttribute(c[j].getAttribute("name"),c[j].getAttribute("value"));}}}
obj.parentNode.replaceChild(e,obj);}}
function showExpressInstall(regObj){isExpressInstallActive=true;var obj=getElementById(regObj.id);if(obj){if(regObj.altContentId){var ac=getElementById(regObj.altContentId);if(ac){storedAltContent=ac;storedAltContentId=regObj.altContentId;}}
else{storedAltContent=abstractAltContent(obj);}
if(!(/%$/.test(regObj.width))&&parseInt(regObj.width,10)<310){regObj.width="310";}
if(!(/%$/.test(regObj.height))&&parseInt(regObj.height,10)<137){regObj.height="137";}
doc.title=doc.title.slice(0,47)+" - Flash Player Installation";var pt=ua.ie&&ua.win?"ActiveX":"PlugIn",dt=doc.title,fv="MMredirectURL="+win.location+"&MMplayerType="+pt+"&MMdoctitle="+dt,replaceId=regObj.id;if(ua.ie&&ua.win&&obj.readyState!=4){var newObj=createElement("div");replaceId+="SWFObjectNew";newObj.setAttribute("id",replaceId);obj.parentNode.insertBefore(newObj,obj);obj.style.display="none";var fn=function(){obj.parentNode.removeChild(obj);};addListener(win,"onload",fn);}
createSWF({data:regObj.expressInstall,id:EXPRESS_INSTALL_ID,width:regObj.width,height:regObj.height},{flashvars:fv},replaceId);}}
function displayAltContent(obj){if(ua.ie&&ua.win&&obj.readyState!=4){var el=createElement("div");obj.parentNode.insertBefore(el,obj);el.parentNode.replaceChild(abstractAltContent(obj),el);obj.style.display="none";var fn=function(){obj.parentNode.removeChild(obj);};addListener(win,"onload",fn);}
else{obj.parentNode.replaceChild(abstractAltContent(obj),obj);}}
function abstractAltContent(obj){var ac=createElement("div");if(ua.win&&ua.ie){ac.innerHTML=obj.innerHTML;}
else{var nestedObj=obj.getElementsByTagName(OBJECT)[0];if(nestedObj){var c=nestedObj.childNodes;if(c){var cl=c.length;for(var i=0;i<cl;i++){if(!(c[i].nodeType==1&&c[i].nodeName=="PARAM")&&!(c[i].nodeType==8)){ac.appendChild(c[i].cloneNode(true));}}}}}
return ac;}
function createSWF(attObj,parObj,id){var r,el=getElementById(id);if(el){if(typeof attObj.id==UNDEF){attObj.id=id;}
if(ua.ie&&ua.win){var att="";for(var i in attObj){if(attObj[i]!=Object.prototype[i]){if(i.toLowerCase()=="data"){parObj.movie=attObj[i];}
else if(i.toLowerCase()=="styleclass"){att+=' class="'+attObj[i]+'"';}
else if(i.toLowerCase()!="classid"){att+=' '+i+'="'+attObj[i]+'"';}}}
var par="";for(var j in parObj){if(parObj[j]!=Object.prototype[j]){par+='<param name="'+j+'" value="'+parObj[j]+'" />';}}
el.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+att+'>'+par+'</object>';objIdArr[objIdArr.length]=attObj.id;r=getElementById(attObj.id);}
else if(ua.webkit&&ua.webkit<312){var e=createElement("embed");e.setAttribute("type",FLASH_MIME_TYPE);for(var k in attObj){if(attObj[k]!=Object.prototype[k]){if(k.toLowerCase()=="data"){e.setAttribute("src",attObj[k]);}
else if(k.toLowerCase()=="styleclass"){e.setAttribute("class",attObj[k]);}
else if(k.toLowerCase()!="classid"){e.setAttribute(k,attObj[k]);}}}
for(var l in parObj){if(parObj[l]!=Object.prototype[l]){if(l.toLowerCase()!="movie"){e.setAttribute(l,parObj[l]);}}}
el.parentNode.replaceChild(e,el);r=e;}
else{var o=createElement(OBJECT);o.setAttribute("type",FLASH_MIME_TYPE);for(var m in attObj){if(attObj[m]!=Object.prototype[m]){if(m.toLowerCase()=="styleclass"){o.setAttribute("class",attObj[m]);}
else if(m.toLowerCase()!="classid"){o.setAttribute(m,attObj[m]);}}}
for(var n in parObj){if(parObj[n]!=Object.prototype[n]&&n.toLowerCase()!="movie"){createObjParam(o,n,parObj[n]);}}
el.parentNode.replaceChild(o,el);r=o;}}
return r;}
function createObjParam(el,pName,pValue){var p=createElement("param");p.setAttribute("name",pName);p.setAttribute("value",pValue);el.appendChild(p);}
function removeSWF(id){var obj=getElementById(id);if(obj&&(obj.nodeName=="OBJECT"||obj.nodeName=="EMBED")){if(ua.ie&&ua.win){if(obj.readyState==4){removeObjectInIE(id);}
else{win.attachEvent("onload",function(){removeObjectInIE(id);});}}
else{obj.parentNode.removeChild(obj);}}}
function removeObjectInIE(id){var obj=getElementById(id);if(obj){for(var i in obj){if(typeof obj[i]=="function"){obj[i]=null;}}
obj.parentNode.removeChild(obj);}}
function getElementById(id){var el=null;try{el=doc.getElementById(id);}
catch(e){}
return el;}
function createElement(el){return doc.createElement(el);}
function addListener(target,eventType,fn){target.attachEvent(eventType,fn);listenersArr[listenersArr.length]=[target,eventType,fn];}
function hasPlayerVersion(rv){var pv=ua.pv,v=rv.split(".");v[0]=parseInt(v[0],10);v[1]=parseInt(v[1],10)||0;v[2]=parseInt(v[2],10)||0;return(pv[0]>v[0]||(pv[0]==v[0]&&pv[1]>v[1])||(pv[0]==v[0]&&pv[1]==v[1]&&pv[2]>=v[2]))?true:false;}
function createCSS(sel,decl){if(ua.ie&&ua.mac){return;}
var h=doc.getElementsByTagName("head")[0],s=createElement("style");s.setAttribute("type","text/css");s.setAttribute("media","screen");if(!(ua.ie&&ua.win)&&typeof doc.createTextNode!=UNDEF){s.appendChild(doc.createTextNode(sel+" {"+decl+"}"));}
h.appendChild(s);if(ua.ie&&ua.win&&typeof doc.styleSheets!=UNDEF&&doc.styleSheets.length>0){var ls=doc.styleSheets[doc.styleSheets.length-1];if(typeof ls.addRule==OBJECT){ls.addRule(sel,decl);}}}
function setVisibility(id,isVisible){var v=isVisible?"visible":"hidden";if(isDomLoaded&&getElementById(id)){getElementById(id).style.visibility=v;}
else{createCSS("#"+id,"visibility:"+v);}}
function urlEncodeIfNecessary(s){var regex=/[\\\"<>\.;]/;var hasBadChars=regex.exec(s)!=null;return hasBadChars?encodeURIComponent(s):s;}
var cleanup=function(){if(ua.ie&&ua.win){window.attachEvent("onunload",function(){var ll=listenersArr.length;for(var i=0;i<ll;i++){listenersArr[i][0].detachEvent(listenersArr[i][1],listenersArr[i][2]);}
var il=objIdArr.length;for(var j=0;j<il;j++){removeSWF(objIdArr[j]);}
for(var k in ua){ua[k]=null;}
ua=null;for(var l in Evri.Flash.swfobject){Evri.Flash.swfobject[l]=null;}
Evri.Flash.swfobject=null;});}}();return{registerObject:function(objectIdStr,swfVersionStr,xiSwfUrlStr){if(!ua.w3cdom||!objectIdStr||!swfVersionStr){return;}
var regObj={};regObj.id=objectIdStr;regObj.swfVersion=swfVersionStr;regObj.expressInstall=xiSwfUrlStr?xiSwfUrlStr:false;regObjArr[regObjArr.length]=regObj;setVisibility(objectIdStr,false);},getObjectById:function(objectIdStr){var r=null;if(ua.w3cdom){var o=getElementById(objectIdStr);if(o){var n=o.getElementsByTagName(OBJECT)[0];if(!n||(n&&typeof o.SetVariable!=UNDEF)){r=o;}
else if(typeof n.SetVariable!=UNDEF){r=n;}}}
return r;},embedSWF:function(swfUrlStr,replaceElemIdStr,widthStr,heightStr,swfVersionStr,xiSwfUrlStr,flashvarsObj,parObj,attObj,forceLoad){forceLoad=!!forceLoad;if(!ua.w3cdom||!swfUrlStr||!replaceElemIdStr||!widthStr||!heightStr||!swfVersionStr){return;}
widthStr+="";heightStr+="";if(hasPlayerVersion(swfVersionStr)){setVisibility(replaceElemIdStr,false);var att={};if(attObj&&typeof attObj===OBJECT){for(var i in attObj){if(attObj[i]!=Object.prototype[i]){att[i]=attObj[i];}}}
att.data=swfUrlStr;att.width=widthStr;att.height=heightStr;var par={};if(parObj&&typeof parObj===OBJECT){for(var j in parObj){if(parObj[j]!=Object.prototype[j]){par[j]=parObj[j];}}}
if(flashvarsObj&&typeof flashvarsObj===OBJECT){for(var k in flashvarsObj){if(flashvarsObj[k]!=Object.prototype[k]){if(typeof par.flashvars!=UNDEF){par.flashvars+="&"+k+"="+flashvarsObj[k];}
else{par.flashvars=k+"="+flashvarsObj[k];}}}}
addDomLoadEvent(function(){createSWF(att,par,replaceElemIdStr);if(att.id==replaceElemIdStr){setVisibility(replaceElemIdStr,true);}},forceLoad);}
else if(xiSwfUrlStr&&!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac)){isExpressInstallActive=true;setVisibility(replaceElemIdStr,false);addDomLoadEvent(function(){var regObj={};regObj.id=regObj.altContentId=replaceElemIdStr;regObj.width=widthStr;regObj.height=heightStr;regObj.expressInstall=xiSwfUrlStr;showExpressInstall(regObj);});}},getFlashPlayerVersion:function(){return{major:ua.pv[0],minor:ua.pv[1],release:ua.pv[2]};},hasFlashPlayerVersion:hasPlayerVersion,createSWF:function(attObj,parObj,replaceElemIdStr){if(ua.w3cdom){return createSWF(attObj,parObj,replaceElemIdStr);}
else{return undefined;}},removeSWF:function(objElemIdStr){if(ua.w3cdom){removeSWF(objElemIdStr);}},createCSS:function(sel,decl){if(ua.w3cdom){createCSS(sel,decl);}},addDomLoadEvent:addDomLoadEvent,addLoadEvent:addLoadEvent,getQueryParamValue:function(param){var q=doc.location.search||doc.location.hash;if(param==null){return urlEncodeIfNecessary(q);}
if(q){var pairs=q.substring(1).split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=")+1)));}}}
return"";},expressInstallCallback:function(){if(isExpressInstallActive&&storedAltContent){var obj=getElementById(EXPRESS_INSTALL_ID);if(obj){obj.parentNode.replaceChild(storedAltContent,obj);if(storedAltContentId){setVisibility(storedAltContentId,true);if(ua.ie&&ua.win){storedAltContent.style.display="block";}}
storedAltContent=null;storedAltContentId=null;isExpressInstallActive=false;}}}};}()});Evri.defineClass(Evri.Widget,"Jirafa",function(options){var $=Evri.jQuery;var swfobject=Evri.Flash.swfobject;var JSTweener=Evri.JSTweener;var NS=Evri.Widget.Jirafa;var apiSession=new Evri.API.Session({'appId':this.appId});this.apiSession=apiSession;var analyticsObject=new Evri.Widget.Analytics("jirafa");this.analyticsObject=analyticsObject;var defaults={height:"auto",assetsHost:"http://"+Evri.API.Environment.portalHost,assetsDirectory:"/widget",imagesDirectory:"/widget/images",disabledTabs:[]};options=options||{};$.extend(defaults,options);var imagesPath=defaults.assetsHost+defaults.imagesDirectory;var defaultImages={evriLogoImage:imagesPath+"/logo.png",playButtonImage:imagesPath+"/play.gif",pauseButtonImage:imagesPath+"/pause.gif",backButtonImage:imagesPath+"/back.gif",popupButtonImage:imagesPath+"/view-in-new-window.gif"};analyticsObject.trackDHTML("Instantiate");Evri.Widget.Utilities.useStylesheet(defaults.assetsHost+defaults.assetsDirectory+"/stylesheets/jirafa.1.css");if(defaults.stylesheet!==undefined){Evri.Widget.Utilities.useStylesheet(defaults.stylesheet);}
var self=$.extend(this,$("<div />").attr("id","evri-jirafa-widget"));self.defaults=defaults;self.widgetTabs=["news","images","videos"];var headerImage=$("<img />").attr({src:defaultImages.evriLogoImage,alt:"Evri",height:52}).css({display:"block",margin:"0 auto"});var headerImageLink=$('<a />').attr({"href":Evri.Widget.Environment.domainURL,"target":"_blank"}).append(headerImage).click(function(link){analyticsObject.trackReferral("Logo/PortalHome");});var entitiesList=$("<ol />").attr("id","evri-entities-list");var mediaTabs=$("<ul />").addClass("evri-media-tabs");var mediaContent=$("<div />").addClass("evri-media-content");var graphWrapper=$("<div />").addClass("evri-graph");var tabsAreaWrapper=$("<div/>").addClass("evri-tabs-wrapper");var articlesContent=$("<div/>");var imagesContent=$("<div/>");var videosContent=$("<div/>");self.articlesContent=articlesContent;self.imagesContent=imagesContent;self.videosContent=videosContent;self.append(headerImageLink,graphWrapper,entitiesList,tabsAreaWrapper.append(mediaTabs,mediaContent));self.defaultStyle=function()
{self.width(defaults.width);self.height(defaults.height);return self;};self.defaultStyle();self.mediaSet=self.initMediaSet();function populateArticles(articleListObject,constraints){constraints=constraints||$("<div />");var list=$("<ol />").addClass("evri-articles-list");var ownerEntity=articleListObject.belongsTo.belongsTo;$.each(articleListObject.articles,function(index,article){var publisher=article.author!==undefined?article.author:article.link.hostName;var publicationDate=article.getRelativePublicationDate();var articleInfo=$("<p/>").addClass("light");if(publicationDate.length>0){articleInfo.append(publicationDate);articleInfo.append(" | ");}
articleInfo.append(publisher);list.append($("<li />").append($("<h2 />").append($("<a/>").html(article.getHighlightedTitle('em',{'class':'emphasize'})).attr("href",article.link.href).attr("target","_blank").click(function(){analyticsObject.trackReferral("Articles/ListItem",{index:index});})),$("<p />").html(article.getHighlightedContent('em',{'class':'emphasize'})),articleInfo,$("<div/>").addClass("separator")));});var buttons=NS.createScrollButtonsForList(list,"Articles",analyticsObject);var scrollarea=$("<div />").addClass("scrollable-section").append(list);articlesContent.removeClass("no-constraint-articles").empty().append(constraints,buttons.up,scrollarea,buttons.down);var showing=true;if(articlesContent.css("display")==="none"){showing=false;articlesContent.show()}
scrollAreaHeight=mediaContent.height()-constraints.height()-buttons.up.height()-buttons.down.height()-13;if(!showing){articlesContent.hide();}
scrollarea.height(scrollAreaHeight);if(articleListObject.articles.length===0){articlesContent.addClass("no-constraint-articles");self.find(".web-source-constraint").click();self.getMessageArea(articlesContent).text("No articles found.");return;}}
function displayConstrainedArticles(articleListObject){var constraints=$("<div />").addClass("evri-source-constraints");if(self.mediaSet&&self.mediaSet.currentView&&self.mediaSet.currentView.mediaConstraint.includedDomains.length>0){var sourceConstraintLink=$("<a/>").addClass("web-source-constraint").text("From web");constraints.append(self.mediaSet.currentView.label+" | ",sourceConstraintLink);sourceConstraintLink.click(function(){var message=$("<p />").css({color:"#888",position:"absolute"}).text("... loading ...");articlesContent.empty().html(message);message.css("top",articlesContent.parent().height()/2-message.height()/2);message.css("margin","0 -10px");message.css("text-align","center").width("100%");articleListObject.belongsTo.getArticles({onComplete:displayArticles},{includeMatchedLocations:true});}).click(function(){analyticsObject.trackDHTML("Articles/SourceConstraint",{});});}
populateArticles(articleListObject,constraints);}
function displayArticles(articleListObject){var constraints=$("<div />").addClass("evri-source-constraints");if(self.mediaSet&&self.mediaSet.currentView&&self.mediaSet.currentView.mediaConstraint.includedDomains.length>0){var sourceConstraintLink=$("<a/>").text(self.mediaSet.currentView.label);articlesContent.is(".no-constraint-articles")&&sourceConstraintLink.addClass("disabled");constraints.append(sourceConstraintLink," | From web");!sourceConstraintLink.is(".disabled")&&sourceConstraintLink.click(function(){var constraint=self.mediaSet.currentView.mediaConstraint;var message=$("<p />").css({color:"#888",position:"absolute"}).text("... loading ...");articlesContent.empty().html(message);message.css("top",articlesContent.parent().height()/2-message.height()/2);message.css("margin","0 -10px");message.css("text-align","center").width("100%");articleListObject.belongsTo.getArticles({onComplete:displayConstrainedArticles},{mediaConstraint:constraint,includeMatchedLocations:true});}).click(function(){analyticsObject.trackDHTML("Articles/SourceConstraint",{});});}
populateArticles(articleListObject,constraints);}
function displayVideos(videosListObject){if(videosListObject.videos.length===0){self.getMessageArea(videosContent).text("No videos found.");return;}
var videoList=$("<ol />").addClass("evri-videos-list");$.each(videosListObject.videos,function(index,videoObject){var thumbnail=$("<img />").attr("src",videoObject.thumbnails[0].url);var itemWidth=self.width()/2-16;if($.browser.msie&&$.browser.version<=6){itemWidth=self.width()/2-17;}
var itemHeight=itemWidth*3/4;var videoListItem=$("<li/>").append(thumbnail);videoListItem.width(itemWidth);videoListItem.height(itemHeight);if(parseInt(videoObject.thumbnails[0].height)*4/3>itemHeight)
{thumbnail.height(itemHeight).width("auto");}
else
{thumbnail.width(itemWidth).height("auto");}
videoListItem.click(function(){playVideo(videoObject);}).click(function(){analyticsObject.trackDHTML("Videos/ListItem",{index:index});});videoList.append(videoListItem);});videoList.find("li:odd").css("margin-right",0);videoList.find("li:even").css("margin-left",0);videosContent.empty().append(videoList,$("<div/>").addClass("clear"));videosContent.css("position","relative");}
function playVideo(videoObject)
{var randomId="evriVideoPlayer"+new Date().getTime();var youTubeId=videoObject.id.match(/[^\/]+$/);function getVideoPlayerWrapper()
{var videoPlayerWrapper=videosContent.find(".evri-video-player-wrapper");if(videoPlayerWrapper.length==0)
{videoPlayerWrapper=$("<div/>").addClass("evri-video-player-wrapper").width(self.width()-2).css({position:"relative",bottom:"0",left:"2px",overflow:"hidden"});videosContent.append(videoPlayerWrapper);}
return videoPlayerWrapper.empty().show();}
function intToTimeString(time)
{var duration=""+parseInt(time/60)+":";duration+=time%60>=10?time%60:"0"+time%60;return duration;}
var videoPlayerWrapper=getVideoPlayerWrapper();var videoPlayer=$("<div />").attr("id",randomId).addClass("evri-video-player");var closeButton=$("<p />").text("Close").addClass('right evri-video-control close-button');var playButton=$("<p />").addClass("left evri-video-control").hide().append($("<img />").attr("src",defaultImages.pauseButtonImage)," Pause").toggle(function(){document.getElementById(randomId).pauseVideo();playButton.empty().append($("<img />").attr("src",defaultImages.playButtonImage)," Play");},function(){document.getElementById(randomId).playVideo();playButton.empty().append($("<img />").attr("src",defaultImages.pauseButtonImage)," Pause");});videoPlayerWrapper.append(playButton,closeButton,$("<div />").append(videoPlayer).height(self.width()*3/4).addClass("clear"));var params={allowScriptAccess:"always"};var atts={};var duration=intToTimeString(videoObject.duration)
swfobject.embedSWF("http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid="+randomId,randomId,self.width(),self.width()*3/4,"8",null,null,params,atts);var videoLink=$('<a />').attr({'href':videoObject.getSourceUrl(),'target':'_blank'}).text("YouTube").click(function(link){analyticsObject.trackReferral("Videos/SourceURL");});var videoMetaContent=$("<div />").css("overflow","auto").append($("<p/>").text(videoObject.title),$("<p/>").text(duration),$("<p/>").text(videoObject.content).addClass("padded"),$("<p/>").text("Source: ").append(videoLink).addClass("padded"));videoPlayerWrapper.append(videoMetaContent);var wrapperProperties={height:0};JSTweener.addTween(wrapperProperties,{height:videoPlayerWrapper.parent().parent().height(),onUpdate:function(){videoPlayerWrapper.height(""+wrapperProperties.height+"px");},onComplete:function(){videoMetaContent.height(wrapperProperties.height-self.width()*3/4-closeButton.outerHeight()-6);}});function closeVideo(){document.getElementById(randomId).stopVideo();var wrapperProperties={height:videoPlayerWrapper.height()}
JSTweener.addTween(wrapperProperties,{height:0,onUpdate:function(){videoPlayerWrapper.height(""+wrapperProperties.height+"px");},onComplete:function(){videoPlayerWrapper.empty().hide();}});}
closeButton.click(closeVideo).click(function(){analyticsObject.trackDHTML("Video/Close",{});});window["onEvriLoadError"+randomId]=function(state){setTimeout(function(){var ytplayer=document.getElementById(randomId);ytplayer.loadVideoById(youTubeId);},300);}
window["onEvriStateChange"+randomId]=function(status)
{if(status==1)
{playButton.show();}}
var originalPlayerReady=window.onYouTubePlayerReady;window.onYouTubePlayerReady=function(playerid){if(playerid==randomId)
{var ytplayer=document.getElementById(randomId);ytplayer.addEventListener("onError","onEvriLoadError"+randomId);ytplayer.addEventListener("onStateChange","onEvriStateChange"+randomId);ytplayer.loadVideoById(youTubeId);}
else
{originalPlayerReady(playerId);}}}
function displayImages(imagesList)
{if(imagesList.images.length===0)
{if(imagesList.belongsTo.belongsTo.klass==="Graph"&&imagesList.belongsTo.belongsTo.entities.length>0){imagesList.belongsTo.belongsTo.entities[0].media.getImages({onComplete:displayImages,onFailure:function(error){self.getMessageArea(imagesContent).text("No images found.");}});}else{self.getMessageArea(imagesContent).text("No images found.");}
return;}
var list=$("<ol />").addClass("evri-images-list");$.each(imagesList["images"],function(index,imageObject){var icon=$("<img/>").attr("src",defaultImages.popupButtonImage).addClass("evri-popup-button").css("left",(mediaContent.width()-37)/2);var thumbnail=$("<img/>").attr("src",imageObject.thumbnail.url);if(parseInt(imageObject.thumbnail.width)>(self.width()*2/3))
{thumbnail.width(self.width()*(2/3));}
list.append($("<li/>").append($("<a />").attr("href",imageObject.clickUrl).attr("target","_blank").append(thumbnail,icon).addClass("evri-image-thumbnail-link").click(function(){analyticsObject.trackReferral("Images/ListItem",{index:index});}),$("<div/>").addClass("separator")).hover(function(){icon.show();},function(){icon.hide();}));});var buttons=NS.createScrollButtonsForList(list,"Images",analyticsObject);var scrollarea=$("<div />").addClass("scrollable-section").append(list);imagesContent.empty().append(buttons.up,scrollarea,buttons.down);var scrollAreaHeight=mediaContent.height()-buttons.up.height()-buttons.down.height()-30;scrollarea.height(scrollAreaHeight);list.find("img.evri-popup-button").hide();}
function addTab(title,content)
{var tab=$("<li />").addClass("tab-"+title.toLowerCase()).append($("<a/>").text(title)).click(function(){mediaTabs.children("li").removeClass("active-tab");mediaContent.children("div").hide();content.show();$(this).addClass("active-tab");}).click(function(){analyticsObject.trackDHTML("MediaTabs/"+title,{});});mediaTabs.children("li").removeClass("first last")
mediaTabs.children("li:first").addClass("first");mediaTabs.append(tab.addClass("last"));mediaContent.append(content.addClass("media-content-tab"));styleTabs();return tab;}
function styleTabs()
{mediaTabs.width(self.width()-5);mediaTabs.height(21);}
self.populateTabs=function(tabs)
{return $.map(tabs,function(object,index){return addTab(object.name,object.content);});}
function createGraph(analyticsObject,graphObject)
{var center=graphObject.belongsTo;var leaves=graphObject.pairs.slice(0,5);var leafNodes;var graphHeight=self.width()*1.25;var graphWidth=self.width();var nodeRadius=self.width()*0.10;var centerNodeRadius=self.width()*0.17;graphWrapper.empty().css("position","relative");graphWrapper.height(graphHeight);graphWrapper.append($("<a />").html($("<img />").attr("src",defaultImages.backButtonImage).css("background-color","#aaa").css("cursor","pointer").hover(function(){$(this).css("background-color","#000");},function(){$(this).css("background-color","#aaa");})).css("position","absolute").css("top",graphHeight/2-40).css("left",6).click(function(){graphWrapper.animatedEmpty(function(){self.selectGlobal();})}).click(function(){analyticsObject.trackDHTML("Graph/Back",{});}));var centerX=graphWidth/4-2;var centerY=graphHeight/2;var paper=Evri.Raphael(graphWrapper[0],graphWidth,graphHeight);var centerNode=NS.nodeWithLabel(graphWrapper,paper,centerX,centerY,0,center.name,{labelWidth:70});centerNode.label.css("opacity",0).bind("mouseover",centerNode.showLabel).bind("mouseout",centerNode.hideLabel);centerNode.selectable(center.href).select().bind("click",function(){$.each(leafNodes,function(i,node){node.unselect();node.bind("mouseout",node.unselect);});displayLoadingMessage();getAllMediaFor(center.media);entitiesList.empty().append(NS.seeFullProfileLink(analyticsObject,center));$.each(leafNodes,function(i,node){node.circle.unselect();});}).bind("click",function(){analyticsObject.trackDHTML("Graph/Entity/Source",{});});graphWrapper.animatedEmpty=function(callb){var callbackCalled=false;var obj={radius:nodeRadius,opacity:1.0,centerNodeRadius:centerNodeRadius};JSTweener.addTween(obj,{opacity:0,radius:0,centerNodeRadius:0,transition:"easeInBack",onComplete:function(){graphWrapper.empty();var message=$("<p />").css({color:"#888",position:"absolute"}).text("... loading ...");graphWrapper.append(message);message.css("top",graphWrapper.height()/2-message.height()/2);message.css("margin","0");message.css("text-align","center").width("100%");if(!callbackCalled)
{callb();callbackCalled=true;}},onUpdate:function(){$.each(leafNodes,function(index,circle){circle.circle.attr({r:obj.radius});});centerNode.circle.attr({r:obj.centerNodeRadius});centerNode.label.css({opacity:obj.opacity});}});}
leafNodes=$.map(leaves,function(leaf,index){var x=(graphWidth/2)*Math.cos(index*Math.PI/5+(1-leaves.length)*Math.PI/10)+centerX;var y=(graphWidth*0.45)*Math.sin(index*Math.PI/5+(1-leaves.length)*Math.PI/10)+centerY;var nodeEntity=leaf.entity1.href==center.href?leaf.entity2:leaf.entity1;var leafNode=NS.nodeWithLabel(graphWrapper,paper,x,y,0,nodeEntity.name,{labelWidth:70});leafNode.label.css("opacity",0).bind("mouseover",leafNode.showLabel).bind("mouseout",leafNode.hideLabel);leafNode.selectable(nodeEntity.href).unselect().bind("mouseover",leafNode.select).bind("mouseout",leafNode.unselect).bind("click",function(){$.each(leafNodes,function(i,node){node.unselect();node.bind("mouseout",node.unselect);});leafNode.select();leafNode.unbind("mouseout",leafNode.unselect);displayLoadingMessage();entitiesList.empty().append(NS.seeFullProfileLink(analyticsObject,leaf.entity1,leaf.entity2));getAllMediaFor(leaf.media);}).bind("click",function(){analyticsObject.trackDHTML("Graph/Entity/Target",{});});var path=paper.path({stroke:"#FCA240","stroke-width":4}).moveTo(centerX,centerY).lineTo(x,y);leafNode.path=path;var obj={x:centerX,y:centerY,radius:0,opacity:0};JSTweener.addTween(obj,{x:x,y:y,radius:nodeRadius,opacity:1.0,transition:"easeOutBack",onUpdate:function(){leafNode.circle.attr("r",obj.radius);leafNode.label.css("opacity",obj.opacity);centerNode.circle.toFront();leafNode.circle.toFront();}});return leafNode;});centerNode.circle.toFront();var centerNodeAnimator={radius:20,opacity:0.0};JSTweener.addTween(centerNodeAnimator,{radius:centerNodeRadius,opacity:1.0,onUpdate:function(){centerNode.label.css("opacity",centerNodeAnimator.opacity);centerNode.circle.attr("r",centerNodeAnimator.radius);}});}
function selectEntity(entity)
{function updateGraph(){self.graphWrapperMessageArea().append("... loading ...");entity.getRelatedEntities({onComplete:function(obj){createGraph(analyticsObject,obj);entitiesList.empty().append(NS.seeFullProfileLink(analyticsObject,entity));},onFailure:function(){self.displayErrorMessage(function(){updateGraph()});}});}
displayLoadingMessage();updateGraph();getAllMediaFor(entity.media);}
function displayLoadingMessage()
{self.find("div.media-content-tab").each(function(){self.getMessageArea($(this)).text("... loading ...");});}
function selectGlobal()
{if(!$.browser.msie||document.namespaces){displayGlobalGraph(analyticsObject,self.globalGraph);var availableTab=self.getFirstAvailableTab();if(availableTab!=-1){displayLoadingMessage();getAllMediaFor(self.globalGraph.media);}
entitiesList.empty();}
else{setTimeout(function(){self.selectGlobal()},1000);}}
self.selectGlobal=selectGlobal;function processGraphObject(graphObject)
{$.each(graphObject.entities,function(index,entity){addEntity(entity).click(function(){if(!$(this).hasClass("selected"))
{selectEntity(entity);$(this).parent().children("li").removeClass("selected");$(this).addClass("selected");}
else
{$(this).removeClass("selected");self.selectGlobal();}});});}
function displayGlobalGraph(analyticsObject,graphObject)
{var graphHeight=self.width()*1.25;var graphWidth=self.width();graphWrapper.empty().css("position","relative");graphWrapper.height(graphHeight);var canvas=Evri.Raphael(graphWrapper[0],graphWidth,graphHeight);var circles=[];var entitiesForGraph=graphObject.entities.slice(0,5);var nodesPerLine=2;var horizontalDistanceBetweenNodes=graphWidth*0.4;var verticalDistanceBetweenNodes=graphWidth*0.4;var leftMargin=(graphWidth-horizontalDistanceBetweenNodes)/2;var nodeRadius=self.width()*0.17;var topMargin=graphHeight/2-(entitiesForGraph.length-1)*nodeRadius/2-5;var currentNode=0;function nodeForEntity(entity,index)
{var x=leftMargin+(index%nodesPerLine)*horizontalDistanceBetweenNodes;var y=topMargin+parseInt(index/nodesPerLine)*verticalDistanceBetweenNodes+(index%2)*verticalDistanceBetweenNodes/2;var entityCircle=NS.nodeWithLabel(graphWrapper,canvas,x,y,0,entity.name,{labelWidth:70});entityCircle.label.css("opacity",0).bind("mouseover",entityCircle.showLabel).bind("mouseout",entityCircle.hideLabel);entityCircle.selectable(entity.href).unselect().bind("mouseover",entityCircle.select).bind("mouseout",entityCircle.unselect).bind("click",function(){graphWrapper.animatedEmpty(function(){selectEntity(entity);});}).bind("click",function(){analyticsObject.trackDHTML("Graph/Global/Entity",{});});circles.push(entityCircle);}
$.each(entitiesForGraph,function(index,entity){var node=nodeForEntity(entity,index);var obj={radius:0,opacity:0.0};JSTweener.addTween(obj,{opacity:1.0,radius:nodeRadius,transition:"easeOutBack",onUpdate:function(){$.each(circles,function(i,node){node.circle.attr("r",obj.radius);node.label.css({opacity:obj.opacity});});}});});graphWrapper.animatedEmpty=function(callb){var callbackCalled=false;var obj={radius:nodeRadius,opacity:1.0};JSTweener.addTween(obj,{opacity:0.0,radius:0,transition:"easeInBack",onComplete:function(){graphWrapper.empty();var message=$("<p />").css({color:"#888",position:"absolute"}).text("... loading ...");graphWrapper.append(message);message.css("top",graphWrapper.height()/2-message.height()/2);message.css("margin","0");message.css("text-align","center").width("100%");if(!callbackCalled)
{callb();callbackCalled=true;}},onUpdate:function(){$.each(circles,function(index,shape){shape.circle.attr({r:obj.radius});shape.label.css({opacity:obj.opacity});});}});}}
self.sendURI=function(uri){uri=(uri!==undefined)?uri:window.location.href;self.reset();apiSession.models.Graph.getForURI(uri,{onComplete:function(graph){self.globalGraph=graph;self.selectGlobal();self.enableGetWidgetButton();},onFailure:function(error){self.enableGetWidgetButton();self.displayErrorMessage(function(){self.sendURI(uri);});}});};function getAllMediaFor(media){var constraint;if(self.mediaSet&&self.mediaSet.currentView&&self.mediaSet.currentView.mediaConstraint.includedDomains.length>0){constraint=self.mediaSet.currentView.mediaConstraint;}
self.getMediaFor(media,"getArticles",displayConstrainedArticles,articlesContent,{mediaConstraint:constraint,includeMatchedLocations:true});self.getMediaFor(media,"getVideos",displayVideos,videosContent);self.getMediaFor(media,"getImages",displayImages,imagesContent);}
self.wrapInner($("<div />").attr("id","evri-jirafa-widget").append($("<div />").attr("id","evri-jirafa-widget").addClass("evri-tall-widget")));displayLoadingMessage();function createWidgetFooter(){var footer=Evri.$("<div/>").addClass("evri-jirafa-footer");var getThisWidgetContainer=Evri.$("<div/>").addClass("get-this-widget-container disabled-link");var options={widgetName:"Jirafa"}
var callBeforeGetWidgetLoad=function(){if(self.find("div.evri-video-player-wrapper").is(":visible")){Evri.$(this).attr('delay',700);self.find("div.evri-video-player-wrapper").find("p.close-button").trigger("click");}else{Evri.$(this).attr('delay',0);}}
var instantiation=new Evri.Widget.Instantiation(self.find("div.evri-tall-widget"),options);instantiation.initializeGetThisWidget(getThisWidgetContainer,"evri-jirafa-footer",callBeforeGetWidgetLoad);getThisWidgetContainer.appendTo(footer)
if(!Evri.$.browser.msie){footer.append(Evri.$("<div/>").addClass("clear"));}
return footer;}
self.find("div.evri-tall-widget").append(createWidgetFooter());});Evri.extendClass(Evri.Widget.Jirafa,{appId:"evri-jirafa",sendContentForCSSSelector:function(selector){this.sendContent(Evri.$(selector).mergeHtml());},displayErrorMessage:function(callb)
{var self=this;self.graphWrapperMessageArea().append("There was an error loading this section.",Evri.$("<a/>").attr("href","javascript:;").text("Click here to try again").click(callb));},resetMediaSet:function(){var self=this;self.articlesContent.empty();},initMediaSet:function(){var self=this;var ms=new Evri.Widget.MediaViewSet(self.apiSession);ms.clear();return ms;},render:function(selector){var self=this;if(Evri.$(selector)[0]===document){return Evri.$(".evri-widget-launcher:first").empty().html(self);}
return Evri.$(selector).empty().html(self);},renderForBlog:function(selector){var self=this;var $widgetLauncher;if(selector){$widgetLauncher=Evri.$(selector).empty();}else{$widgetLauncher=Evri.$("div.evri-jirafa-widget-container:first").empty();}
$widgetLauncher.html(self);self.sendURI();},getMessageArea:function(tab){var message=Evri.$("<p />").css({color:"#888",position:"absolute"});tab.html(message);message.css("top",tab.parent().height()/2-message.height()/2);message.css("margin","0 -10px");message.css("text-align","center").width("100%");return message;},graphWrapperMessageArea:function(){var self=this;var graphWrapper=self.find(".evri-graph");graphWrapper.empty().css("position","relative");var graphHeight=self.width()*1.25;graphWrapper.height(graphHeight);var message=Evri.$("<p />").css({color:"#888",position:"absolute"});graphWrapper.append(message);message.css("top",graphWrapper.height()/2-message.height()/2);message.css("margin","0");message.css("text-align","center").width("100%");return message;},sendContent:function(text,uri){var self=this;uri=uri||window.location.href;self.reset();self.getGraphForContent(text);},getGraphForContent:function(text){var self=this;self.graphWrapperMessageArea().append("... loading ...");var uri=document.location.href;if(uri.match(/\?/)===null){uri+='?nocache='+(new Date()).getTime();}else{uri+='&nocache='+(new Date()).getTime();}
self.apiSession.models.Graph.getForContent(text,{onFailure:function(error){self.enableGetWidgetButton()
self.displayErrorMessage(function(){self.getGraphForContent(text);});},onComplete:function(graphObject){self.enableGetWidgetButton()
self.globalGraph=graphObject;self.selectGlobal();}},{uri:uri});},getMediaFor:function(mediaObject,functionName,callback,fallbackMessageArea,options){var self=this;options=options||{};function getMedia(){self.getMessageArea(fallbackMessageArea).text("... loading ...");mediaObject[functionName]({onComplete:callback,onFailure:function(){self.getMessageArea(fallbackMessageArea).empty().append("There was an error loading this section. ",Evri.$("<a />").attr("href","javascript:;").text("Click here to try again.").click(getMedia));}},options);}
getMedia();},reset:function(){var self=this;var entitiesList=self.find(".evri-entities-list");var mediaTabs=self.find(".evri-media-tabs");var mediaContent=self.find(".evri-media-content");var graphWrapper=self.find(".evri-graph");var tabsAreaWrapper=self.find(".evri-tabs-wrapper");entitiesList.empty();mediaTabs.empty();mediaContent.empty();graphWrapper.empty();var tabs=self.populateTabs([{name:"News",content:self.articlesContent.empty()},{name:"Images",content:self.imagesContent.empty()},{name:"Videos",content:self.videosContent.empty()}]);var availableTab=self.getFirstAvailableTab();if(availableTab!=-1){tabs[availableTab].click();}
self.width(self.parent().width());self.disableTabs();},enableGetWidgetButton:function(){var self=this;self.parent().find("div.evri-jirafa-footer").find("div.disabled-link").removeClass("disabled-link");},disabledTabsList:function(){var self=this;return self.defaults.disabledTabs;},disableTabs:function(){var self=this;Evri.$.each(self.disabledTabsList(),function(i,tab){self.find(".tab-"+tab).hide();});},getFirstAvailableTab:function(){var self=this;var disabledTabs=self.disabledTabsList();var availableTab=-1;Evri.$.each(self.widgetTabs,function(i,tab){var found=false;Evri.$.each(disabledTabs,function(j,disabledTab){if(tab.toLowerCase()==disabledTab.toLowerCase()){found=true;}});if(!found){availableTab=i;return false;}});return availableTab;}});Evri.extendNamespace(Evri.Widget.Jirafa,{nodeWithLabel:function(graphWrapper,paper,x,y,radius,text,opts){var JSTweener=Evri.JSTweener;var NS=this;opts=opts||{};var lineHeight=11;function nodeLabel()
{var shadow=Evri.$("<div />").addClass("evri-graph-label-shadow");var t=Evri.$("<div />").text(text).addClass("evri-graph-label");var nodeLabelWrapper=Evri.$("<div />").addClass("evri-graph-label-wrapper").css({position:"absolute",overflow:"visible"});graphWrapper.append(nodeLabelWrapper.append(shadow,t));if(opts.labelWidth!==undefined&&t.outerWidth()>opts.labelWidth)
{t.width(opts.labelWidth);}
else
{t.width(t.width());}
t.height("auto").css({"font-size":""+(lineHeight-2)+"px","line-height":""+lineHeight+"px"});if(t.height()>=lineHeight*2)
{t.height(lineHeight*2);}
nodeLabelWrapper.css({"left":x-t.outerWidth()/2,"top":y-t.outerHeight()/2});shadow.width(t.outerWidth());shadow.height(t.outerHeight());nodeLabelWrapper.width(t.outerWidth()+3).height(t.outerHeight()+3);return nodeLabelWrapper;}
var shape={circle:paper.circle(x,y,radius),label:nodeLabel(),selectable:makeSelectable,bind:function(ev,f){Evri.$(shape.circle[0]).bind(ev,f);shape.label.bind(ev,f);return shape;},unbind:function(ev,f)
{Evri.$(shape.circle[0]).unbind(ev,f);shape.label.unbind(ev,f);return shape;},trigger:function(ev){Evri.$(shape.circle[0]).trigger(ev);shape.label.trigger(ev);},showLabel:showLabel,hideLabel:hideLabel};var hiding=false;var showing=false;function hideLabel()
{if(hiding===true){return;}
var t=shape.label.children(".evri-graph-label");hiding=true;showing=false;var h=t.height();t.height("auto");var minHeight=lineHeight;if(t.height()>=lineHeight*2)
{minHeight=lineHeight*2;}
t.height(h);var obj={height:h};JSTweener.addTween(obj,{height:minHeight,onUpdate:function(){if(!showing)
{shape.label.height(""+(parseInt(obj.height)+3)+"px");shape.label.children().each(function(index,object){Evri.$(object).height(""+obj.height+"px");});shape.label.css("top",y-t.height()/2-1);}},onComplete:function(){hiding=false;}});}
function showLabel()
{if(showing===true){return}
var t=shape.label.children(".evri-graph-label");showing=true;hiding=false;var originalHeight=t.height();var h=t.height("auto").height();t.height(originalHeight);var obj={height:originalHeight};JSTweener.addTween(obj,{height:h,onUpdate:function(){if(!hiding)
{shape.label.height(""+(parseInt(obj.height)+3)+"px");shape.label.children().each(function(index,object){Evri.$(object).height(""+obj.height+"px");});shape.label.css("top",y-t.height()/2-1);}},onComplete:function(){showing=false;}});}
function makeSelectable(href)
{shape.select=function(){var style=NS.styleForSelectedEntityType(href.split("/")[1]);shape.circle.attr({fill:style["background-color"],stroke:style["border-color"],"stroke-width":"3px"});return shape;}
shape.unselect=function(){var style=NS.styleForSelectedEntityType(href.split("/")[1]);shape.circle.attr({fill:"#FFF",stroke:style["border-color"],"stroke-width":"3px"});return shape;}
return shape;}
return shape;}});Evri.extendNamespace(Evri.Widget.Jirafa,{seeFullProfileLink:function(analyticsObject,entity1,entity2){if(!entity1.known&&(entity2===undefined||!entity2.known)){return"";}
var sentence=Evri.$("<li />").attr({"id":"selected-entities"}).append("See full profile: ");if(entity1.known){Evri.$("<a/>").attr({"href":entity1.portalURI,"target":"_blank"}).text(entity1.name).click(function(){analyticsObject.trackReferral("GraphBreadcrumb/EDP/Source",{});}).appendTo(sentence);}
if(entity1.known&&entity2!==undefined&&entity2.known){sentence.append(", ");}
if(entity2!==undefined&&entity2.known)
{Evri.$("<a/>").attr({"href":entity2.portalURI,"target":"_blank"}).text(entity2.name).click(function(){analyticsObject.trackReferral("GraphBreadcrumb/EDP/Target",{});}).appendTo(sentence);}
return sentence;},styleForSelectedEntityType:function(type){var properties={"organization":{"border-color":"#EB122F","background-color":"#FFC4CC"},"product":{"border-color":"#A56ECA","background-color":"#E8C5FF"},"person":{"border-color":"#B1D535","background-color":"#E9FF9F"},"location":{"border-color":"#7BC2FF","background-color":"#BDE0FF"},"event":{"border-color":"#48628E","background-color":"#C0D7FF"},"concept":{"border-color":"#F6EAA7","background-color":"#FFF9D6"},"action":{"border-color":"#FF9C34","background-color":"#FFCE9A"},"other":{"border-color":"#B1B1B1","background-color":"#CCCCCC"}};return properties[type]||properties["other"];},createScrollButtonsForList:function(list,analyticsSection,analyticsObject)
{list.css({top:0});var upButton=Evri.$("<div />").addClass("up-scroll-button");var downButton=Evri.$("<div />").addClass("down-scroll-button");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;Evri.$.each(listItems,function(index,item){var position=Evri.$(item).position();if(position.top<viewPaneIntersectHeight){lastItemInView=item;lastItemIndexInView=index;}});if(scrollDownFocusIndex===lastItemIndexInView&&lastItemInView!==veryLastItem[0]){lastItemInView=Evri.$(lastItemInView).next()[0];lastItemIndexInView++;}
scrollDownFocusIndex=lastItemIndexInView;scrollUpFocusIndex=undefined;var newListOffsetTop=0-(Evri.$(lastItemInView).position().top+Evri.$(lastItemInView).outerHeight()-viewPaneHeight);scrollToTopPosition(newListOffsetTop);};function scrollUp(){var listOffsetTop=Math.abs(parseInt(list.css('top')));var veryFirstItem=listItems[0];var firstItemInView=undefined;if(scrollUpFocusIndex!==0){if(scrollUpFocusIndex!==undefined&&scrollUpFocusIndex>0){scrollUpFocusIndex--;firstItemInView=listItems[scrollUpFocusIndex];}else{scrollDownFocusIndex=undefined;Evri.$.each(listItems,function(index,item){var position=Evri.$(item).position();if(position.top<listOffsetTop){firstItemInView=item;scrollUpFocusIndex=index;}});}
var newListOffsetTop=0-(Evri.$(firstItemInView).position().top);scrollToTopPosition(newListOffsetTop);}};function scrollToTopPosition(topPosition){list.animate({top:topPosition});};function resetButtons(){if(scrollUpFocusIndex!==0){upButton.css("opacity",1.0);}else{upButton.css("opacity",0.20);}
if(scrollDownFocusIndex!==(listItems.length-1)){downButton.css("opacity",1.0);}else{downButton.css("opacity",0.20);}}
downButton.click(function(){if((scrollDownFocusIndex===undefined||scrollDownFocusIndex<(listItems.length-1))&&list.height()>list.parent().height()){scrollDown();resetButtons();analyticsObject.trackDHTML(analyticsSection+"/ScrollDown",{index:scrollDownFocusIndex});}});upButton.click(function(){if((scrollUpFocusIndex===undefined||scrollUpFocusIndex>0)&&list.height()>list.parent().height()){scrollUp();resetButtons();analyticsObject.trackDHTML(analyticsSection+"/ScrollUp",{index:scrollUpFocusIndex});}});resetButtons();return{up:upButton,down:downButton};}});Evri.defineClass(Evri.Widget,"Instantiation",function(parentObject,options){var self=this;self.$=Evri.$;self.parentObject=parentObject;self.imagesPath=Evri.API.Environment.staticAssetBaseUrl+"/images/";self.componentClass=options.componentClass||self.componentClass;var widgetCodeContainer=self.$('<div/>').addClass(self.componentClass);if(options.widgetWidth){widgetCodeContainer.width(options.widgetWidth);}
self.parentObject.append(widgetCodeContainer);var widgetInstantiationSourceUrl={"Gamera":"http://"+Evri.API.Environment.portalHost+"/widget_utilities/instantiation_code/gamera?callback=?","Jirafa":"http://"+Evri.API.Environment.portalHost+"/widget_utilities/instantiation_code/jirafa?all&callback=?","Single_Subject":"http://"+Evri.API.Environment.portalHost+"/widget_utilities/instantiation_code/single_subject"+options.queryParams+"&callback=?","Multi_Subject":"http://"+Evri.API.Environment.portalHost+"/widget_utilities/instantiation_code/multi_subject?callback=?","Quotes":"http://"+Evri.API.Environment.portalHost+"/widget_utilities/instantiation_code/quotes"+options.queryParams+"&callback=?","Twitter":"http://"+Evri.API.Environment.portalHost+"/widget_utilities/instantiation_code/twitter"+options.queryParams+"&callback=?","Sentiment":"http://"+Evri.API.Environment.portalHost+"/widget_utilities/instantiation_code/sentiment"+options.queryParams+"&callback=?"};self.WEB_BLOG_DESCRIPTION='Copy the code below and paste it into your web page or blog:';self.WORDPRESS_DESCRIPTION='Copy the code below and paste it into your WordPress blog:';self.BLOGGER_DESCRIPTION='Click the "Add Evri Widget" button to bring up the Blogger installer page:';self.TYPEPAD_DESCRIPTION='Click the "Add Evri Widget" button to bring up the TypePad installer page:';self.$.extend(self,widgetCodeContainer);self.widgetInstantiationSourceUrl=widgetInstantiationSourceUrl[options.widgetName];return self;});Evri.extendClass(Evri.Widget.Instantiation,{componentClass:"evri-widget-installation-script-container",initializeGetThisWidget:function(buttonsParent,buttonsContainerClass,callBeforeGetWidgetLoad){var self=this;self.addGetWidgetButton(buttonsParent,buttonsContainerClass,callBeforeGetWidgetLoad);},renderWidgetInstantiationContainer:function(widgetInstallationScript){var self=this;self.empty();var widgetCodeDescriptionDiv=self.$('<div/>').addClass('evri-widget-installation-script-description');widgetCodeDescriptionDiv.html(self.getWidgetCodeDescription());var tabContainerDiv=self.getTabContainer(widgetInstallationScript);self.append(widgetCodeDescriptionDiv,tabContainerDiv);self.selectTab(0);},getWidgetCodeDescription:function(){var text='Pick the blogging platform you use,or pick "&lt;/&gt;" to put this widget anywhere javascript is allowed.<br><br>Want to get a widget about something else? We have even more widgets <a target="_new" href="http://www.evri.com/partners-and-bloggers.html">here</a>.';return text;},getTabContainer:function(widgetInstallationScript){var self=this;var tabsUL=self.$('<ul/>').addClass('evri-widget-installation-script-tabs');var tabsContainer=self.$('<div/>').addClass('evri-tabs-container');var tabLi=self.addTab('tab_1_contents','logo.code.gif');tabLi.addClass('evri-active-tab');tabsUL.append(tabLi);tabsUL.append(self.addTab('tab_2_contents','logo.blogger.gif'));tabsUL.append(self.addTab('tab_3_contents','logo.tp.gif'));tabsUL.append(self.addTab('tab_4_contents','logo.wp.gif'));var clearDiv=self.$('<div/>').addClass('evri-widget-tab-clear');var tabContentsContainer=self.$('<div/>').addClass('evri-tab-contents-container');for(var tabCntr=1;tabCntr<5;tabCntr++){var tabContents=self.$('<div/>').addClass('evri-tab-contents tab_'+tabCntr+'_contents');self.getTabContent(tabCntr,tabContents,widgetInstallationScript);tabContentsContainer.append(tabContents);}
tabsContainer.append(tabsUL,clearDiv,tabContentsContainer);return tabsContainer;},getTabContent:function(tabIndex,tabContents,widgetInstallationScript){var self=this;switch(tabIndex){case 1:self.setWebContent(tabContents,widgetInstallationScript,self.WEB_BLOG_DESCRIPTION);break;case 2:self.setBlogContent(tabContents,widgetInstallationScript,self.BLOGGER_DESCRIPTION,true);break;case 3:self.setBlogContent(tabContents,widgetInstallationScript,self.TYPEPAD_DESCRIPTION,false);break;case 4:self.setWebContent(tabContents,widgetInstallationScript,self.WORDPRESS_DESCRIPTION);break;}},addTab:function(linkRel,imageSrc){var self=this;self.$=Evri.$;var img=self.$('<img/>').attr('src',self.imagesPath+imageSrc);var tabLink=self.$('<a/>').addClass('evri-multientity-tab').attr({'href':'javascript:void(0);','rel':linkRel}).click(function(){self.find('.evri-widget-installation-script-tabs li').removeClass('evri-active-tab');self.$(this).parent().addClass('evri-active-tab');self.find('.evri-tab-contents-active').removeClass('evri-tab-contents-active');var tabContentsContainer=self.find('.'+linkRel).addClass('evri-tab-contents-active');var textArea=tabContentsContainer.find(".evri-widget-installation-script-textarea");if(textArea.length>0){textArea.height(self.height()-textArea.position().top-10);}
self.find("div.add-evri-widget-div").css('visibility','hidden');tabContentsContainer.find("div.add-evri-widget-div").css({'visibility':'visible','display':'block'});}).append(img);var tabLi=self.$('<li/>').append(tabLink);return tabLi;},setWebContent:function(tabContentsContainer,widgetInstallationScript,description){var self=this;var descriptionDiv=self.$('<div/>').addClass('evri-widget-javascript-code-description').text(description);var widgetCode=widgetInstallationScript.find('.any-web-page-form-container').text();var codeDiv=self.$('<textarea/>').attr("readonly","true").addClass('evri-widget-installation-script-textarea').css('width',self.width()-20).text(widgetCode).click(function(){this.select();});var codeDivContainer=self.$('<div/>').append(codeDiv);tabContentsContainer.append(descriptionDiv,codeDivContainer);},setBlogContent:function(tabContentsContainer,widgetInstallationScript,description,isBlogger){var self=this;var descriptionDiv=self.$('<div/>').addClass('evri-widget-javascript-code-description').text(description);var addEvriWidgetDiv=self.$('<div/>').addClass('add-evri-widget-div');var blogInstallationButton=self.$('<a/>').attr('href','javascript:void(0);').addClass('blog-installation-button').css({'background':"url("+self.imagesPath+'add-ongray.gif) right bottom no-repeat'}).hover(function(){self.$(this).css("background-position","right top");},function(){self.$(this).css("background-position","right bottom");});blogInstallationButton.click(function(){var bloggerForm=self.$(tabContentsContainer).find('.widget-installer');bloggerForm.submit();return false;});addEvriWidgetDiv.append(blogInstallationButton);var form=undefined;if(isBlogger){form=widgetInstallationScript.find('.blogger-form-container');}else{form=widgetInstallationScript.find('.typepad-form-container');}
tabContentsContainer.append(descriptionDiv,addEvriWidgetDiv,form);},selectTab:function(index){var self=this;var activeTab=self.find('.evri-multientity-tab').eq(index);if(activeTab.length>0){activeTab.trigger("click");}
return false;},showHide:function(buttonsContainerClass){var self=this;if(self.parentObject.find("."+buttonsContainerClass).length>0){self.css({'height':self.parentObject.find("."+buttonsContainerClass).position().top});}else{self.css({'height':self.parentObject.height()-2});}
self.find("div.add-evri-widget-div").hide();self.toggle();},addGetWidgetButton:function(buttonsParent,buttonsContainerClass,callBeforeGetWidgetLoad){var self=this;var buttonCss={"background-color":"#fff","position":"relative","cursor":"pointer","border":"none","float":"right","width":"93px","height":"11px"};var getButton=self.$('<a/>').css(buttonCss).css("background","url("+self.imagesPath+"get-ongray.gif) right bottom no-repeat");buttonCss.width="39px";var backButton=self.$('<a/>').css(buttonCss).css("background","url("+self.imagesPath+"back-ongray.gif) right bottom no-repeat").hide();getButton.click(function(e){if(callBeforeGetWidgetLoad){callBeforeGetWidgetLoad.call();}
if(!self.$(this).parent().hasClass("disabled-link")){buttonsParent.find("a").toggle();self.showHide(buttonsContainerClass);if(self.find(".evri-widget-installation-script-textarea").length==0){self.renderLoadingMessage();self.$.getJSON(self.widgetInstantiationSourceUrl,function(data){if(self.parentObject.afterWidgetInstallationScriptLoad){data=self.parentObject.afterWidgetInstallationScriptLoad(data);}
self.renderWidgetInstantiationContainer(self.$(data));});}else{self.selectTab(0);}}});getButton.hover(function(){self.$(this).css("background-position","right top");},function(){self.$(this).css("background-position","right bottom");});backButton.click(function(e){buttonsParent.find("a").toggle();self.showHide(buttonsContainerClass);});backButton.hover(function(){self.$(this).css("background-position","right top");},function(){self.$(this).css("background-position","right bottom");});buttonsParent.append(getButton,backButton);},renderLoadingMessage:function(){var self=this;var messageContainer=self.$("<div/>").addClass("evri-info-message").addClass("centered").html(self.$("<p/>").addClass("evri-loading-message").text("... loading ..."));self.empty();self.append(messageContainer);var mainContainerHeight=self.height();var messageContainerHeight=messageContainer.height();var top=((mainContainerHeight-messageContainerHeight)/2);messageContainer.css("top",top);}});