(function(){var
window=this,undefined,_jQuery=window.jQuery,_$=window.$,jQuery=window.jQuery=window.$=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");};});})();jQuery(function(){jQuery("html").addBrowserClasses();jQuery(document.body).pngFix();jQuery(document.body).addClass('javascript-enabled');window.addthis_pub='Evri';window.addthis_logo=document.location.protocol+"//"+
document.location.host+'/images/logos/header.gif';window.addthis_brand='<a href="http://www.evri.com/">evri.com</a>';window.addthis_options=["facebook","myspace","digg","stumbleupon","more"].join(", ");jQuery.getScript('http://s7.addthis.com/js/250/addthis_widget.js?pub=Evri');jQuery("img[data-constrain-size-to]").each(function(index,image){var $image=$(image);var size=px($image.attr("data-constrain-size-to"));image.style.height='auto';image.style.width='auto';if(image.height>image.width){image.style.height=size;}else{image.style.width=size;}});dp.SyntaxHighlighter.ClipboardSwf='/swfs/clipboard.swf';dp.SyntaxHighlighter.HighlightAll('code');EventTracker.bindToPage();EventTracker.markReferrerLinks(jQuery('#body'));});jQuery.fn.autocomplete=function(url,settings)
{return this.each(function()
{var textInput=$(this);textInput.after('<input type=hidden name="'+textInput.attr("name")+'_text"/>');var valueInput=$(this).next();var list=$('<ul class="autocomplete"></ul>').hide();valueInput.after(list);var oldText='';var typingTimeout;var size=0;var selected=Number.MAX_VALUE;settings=jQuery.extend({minChars:1,timeout:1000,after:null,before:null,validSelection:true,parameters:{'inputName':valueInput.attr('name'),'inputId':textInput.attr('id')}},settings);function getData(text)
{window.clearInterval(typingTimeout);if(text!=oldText&&(settings.minChars!=null&&text.length>=settings.minChars))
{clear();if(settings.before=="function")
{settings.before(textInput,text);}
textInput.addClass('autocomplete-loading');settings.parameters.query=text;$.getJSON(url,settings.parameters,function(data)
{var items='';if(data)
{size=data.length;for(var i=0;i<data.length;i++)
{for(var key in data[i])
{items+='<li value="'+key+'">'+data[i][key].replace(new RegExp("("+text+")","i"),"<strong>$1</strong>")+'</li>';}
list.html(items);list.show();list.children().hover(function(){$(this).addClass("selected").siblings().removeClass("selected");},function(){$(this).removeClass("selected");}).click(function(){valueInput.val($(this).attr('value'));textInput.val($(this).text());clear();});}
if(settings.after=="function")
{settings.after(textInput,text);}}
textInput.removeClass('autocomplete-loading');});oldText=text;}}
function clear()
{list.hide();size=0;selected=Number.MAX_VALUE;}
textInput.keydown(function(e)
{window.clearInterval(typingTimeout);if(e.which==27)
{clear();}else if(e.which==46||e.which==8)
{clear();if(settings.validSelection)valueInput.val('');}
else if(e.which==13)
{if(list.css("display")=="none")
{return true;}else
{clear();e.preventDefault();return false;}}
else if(e.which==40||e.which==9||e.which==38)
{switch(e.which)
{case 40:case 9:selected=selected>=size-1?0:selected+1;break;case 38:selected=selected<=0?size-1:selected-1;break;default:break;}
textInput.val(list.children().removeClass('selected').eq(selected).addClass('selected').text());valueInput.val(list.children().eq(selected).attr('value'));}else
{if(settings.validSelection)valueInput.val('');typingTimeout=window.setTimeout(function(){getData(textInput.val());},settings.timeout);}});});};jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};(function($){$.fn.expander=function(options){var opts=$.extend({},$.fn.expander.defaults,options);var delayedCollapse;return this.each(function(){var $this=$(this);var o=$.meta?$.extend({},opts,$this.data()):opts;var cleanedTag,startTags,endTags;var allText=$this.html();var startText=allText.slice(0,o.slicePoint).replace(/(\w)$/,'');startTags=startText.match(/<\w[^>]*>/g);if(startTags){startText=allText.slice(0,o.slicePoint+startTags.join('').length).replace(/\w+$/,'');}
if(startText.lastIndexOf('<')>startText.lastIndexOf('>')){startText=startText.slice(0,startText.lastIndexOf('<'));}
var endText=allText.slice(startText.length);if(!$('span.details',this).length){if(endText.replace(/\s+$/,'').split(' ').length<o.widow){return;}
if(endText.indexOf('</')>-1){endTags=endText.match(/<(\/)?[^>]*>/g);for(var i=0;i<endTags.length;i++){if(endTags[i].indexOf('</')>-1){var startTag,startTagExists=false;for(var j=0;j<i;j++){startTag=endTags[j].slice(0,endTags[j].indexOf(' ')).replace(/(\w)$/,'$1>');if(startTag==rSlash(endTags[i])){startTagExists=true;}}
if(!startTagExists){startText=startText+endTags[i];var matched=false;for(var s=startTags.length-1;s>=0;s--){if(startTags[s].slice(0,startTags[s].indexOf(' ')).replace(/(\w)$/,'$1>')==rSlash(endTags[i])&&matched==false){cleanedTag=cleanedTag?startTags[s]+cleanedTag:startTags[s];matched=true;}};}}}
endText=cleanedTag+endText;}
$this.html([startText,'<a href="#" class="read-more">',o.expandText,'</a>','<span class="details">',endText,'</span>'].join(''));}
$this.find('span.details').hide().end().find('a.read-more').click(function(){$(this).hide().next('span.details')[o.expandEffect](o.expandSpeed,function(){var $self=$(this);$self.css({zoom:''});if(o.collapseTimer){delayedCollapse=setTimeout(function(){reCollapse($self);},o.collapseTimer);}});return false;});if(o.userCollapse){$this.find('span.details').append(' <a class="re-collapse" href="#">'+o.userCollapseText+'</a>').find('a.re-collapse').click(function(){clearTimeout(delayedCollapse);var $spanCollapse=$(this).parent();reCollapse($spanCollapse);return false;});}});function reCollapse(el){el.hide().prev('a.read-more').show();}
function rSlash(rString){return rString.replace(/\//,'');}};$.fn.expander.defaults={slicePoint:100,widow:4,expandText:'read more...',collapseTimer:0,expandEffect:'fadeIn',expandSpeed:'',userCollapse:true,userCollapseText:'[collapse expanded text]'};})(jQuery);(function($){$.fn.example=function(text,args){var options=$.extend({},$.fn.example.defaults,args,{example_text:text});var callback=$.isFunction(options.example_text);if(!$.fn.example.bound_class_names[options.class_name]){$(window).unload(function(){$('.'+options.class_name).val('');});$('form').submit(function(){$(this).find('.'+options.class_name).val('');});$.fn.example.bound_class_names[options.class_name]=true;}
return this.each(function(){var $this=$(this);var o=$.metadata?$.extend({},options,$this.metadata()):options;if($.browser.msie&&!$this.attr('defaultValue')&&(callback?$this.val()!='':$this.val()==o.example_text)){$this.val('');}
if($this.val()==''){$this.addClass(options.class_name);$this.val(callback?o.example_text.call(this):o.example_text);}
if(options.hide_label){var label=$('label[@for='+$this.attr('id')+']');label.next('br').hide();label.hide();}
$this.focus(function(){if($(this).is('.'+options.class_name)){$(this).val('');$(this).removeClass(options.class_name);}});$this.blur(function(){if($(this).val()==''){$(this).addClass(options.class_name);$(this).val(callback?o.example_text.call(this):o.example_text);}});});};$.fn.example.defaults={example_text:'',class_name:'example',hide_label:false};$.fn.example.bound_class_names=[];})(jQuery);(function($){$.fn.hideDropdownList=function(){this.hide();this.trigger('hide.shim');return this;};$.fn.showDropdownList=function(){this.show().trigger('show.shim');return this;};$.fn.shimWithIframe=function(){var $selection=this;$selection.css('z-index','100')
$selection.each(function(index,item){var $container=$(item);var $shim=$('<iframe />').attr({'frameborder':0}).height($selection.height()).addClass('shim');$shim.hide().prependTo($selection);$container.bind('hide.shim',function(){$shim.hide();});$container.bind('show.shim',function(){$shim.show();});});return $selection;};})(jQuery);(function($){jQuery.fn.pngFix=function(settings){settings=jQuery.extend({blankgif:'/images/blank.gif'},settings);var ie55=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1);var ie6=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1);if(jQuery.browser.msie&&(ie55||ie6)){jQuery(this).find("img[src$='.png']").each(function(){jQuery(this).attr('width',jQuery(this).width());jQuery(this).attr('height',jQuery(this).height());var prevStyle='';var strNewHTML='';var imgId=(jQuery(this).attr('id'))?'id="'+jQuery(this).attr('id')+'" ':'';var imgClass=(jQuery(this).attr('class'))?'class="'+jQuery(this).attr('class')+'" ':'';var imgTitle=(jQuery(this).attr('title'))?'title="'+jQuery(this).attr('title')+'" ':'';var imgAlt=(jQuery(this).attr('alt'))?'alt="'+jQuery(this).attr('alt')+'" ':'';var imgAlign=(jQuery(this).attr('align'))?'float:'+jQuery(this).attr('align')+';':'';var imgHand=(jQuery(this).parent().attr('href'))?'cursor:hand;':'';if(this.style.border){prevStyle+='border:'+this.style.border+';';this.style.border='';}
if(this.style.padding){prevStyle+='padding:'+this.style.padding+';';this.style.padding='';}
if(this.style.margin){prevStyle+='margin:'+this.style.margin+';';this.style.margin='';}
var imgStyle=(this.style.cssText);strNewHTML+='<span '+imgId+imgClass+imgTitle+imgAlt;strNewHTML+='style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;strNewHTML+='width:'+jQuery(this).width()+'px;'+'height:'+jQuery(this).height()+'px;';strNewHTML+='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader'+'(src=\''+jQuery(this).attr('src')+'\', sizingMethod=\'scale\');';strNewHTML+=imgStyle+'"></span>';if(prevStyle!=''){strNewHTML='<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:'+jQuery(this).width()+'px;'+'height:'+jQuery(this).height()+'px;'+'">'+strNewHTML+'</span>';}
jQuery(this).hide();jQuery(this).after(strNewHTML);});jQuery(this).find("*").each(function(){var bgIMG=jQuery(this).css('background-image');if(bgIMG.indexOf(".png")!=-1){var iebg=bgIMG.split('url("')[1].split('")')[0];jQuery(this).css('background-image','none');jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+iebg+"',sizingMethod='scale')";}});jQuery(this).find("input[src$='.png']").each(function(){var bgIMG=jQuery(this).attr('src');jQuery(this).get(0).runtimeStyle.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader'+'(src=\''+bgIMG+'\', sizingMethod=\'scale\');';jQuery(this).attr('src',settings.blankgif);});}
return jQuery;};})(jQuery);(function($){$.fn.maskItem=function(){$('<div />').appendTo(this).attr('id','facebox_overlay').addClass('facebox_overlayBG').hide().css('opacity',$.facebox.settings.opacity).click(function(){$(document).trigger('close.facebox');}).show();return this;}
$.maskScreen=function(){$(document.body).maskItem()
$(document).bind('keydown.facebox',function(event){if(event.keyCode==27){$.unmaskScreen();}
return true;});$(document).bind('close.facebox',function(){$.unmaskScreen();});};$.unmaskScreen=function(){$('.facebox_overlayBG').remove();$(document).trigger('unmask.screen');};})(jQuery);jQuery.jScrollPane={active:[]};jQuery.fn.jScrollPane=function(settings)
{settings=jQuery.extend({wheelSpeed:18,showArrows:false,arrowSize:0,animateTo:false,dragMinHeight:1,dragMaxHeight:99999,animateInterval:100,animateStep:3,maintainPosition:true,scrollbarOnLeft:false,arrowsPosition:0},settings);return this.each(function()
{var $this=jQuery(this);if(jQuery(this).parent().is('.jScrollPaneContainer')){var currentScrollPosition=settings.maintainPosition?$this.offset({relativeTo:jQuery(this).parent()[0]}).top:0;var $c=jQuery(this).parent();var paneWidth=$c.width();var paneHeight=$c.height();var trackHeight=paneHeight;if($c.unmousewheel){$c.unmousewheel();}
jQuery('>.jScrollPaneTrack, >.jScrollArrows',$c).remove();$this.css({'top':0});}else{var currentScrollPosition=0;this.originalPadding=$this.css('paddingTop')+' '+$this.css('paddingRight')+' '+$this.css('paddingBottom')+' '+$this.css('paddingLeft');this.originalSidePaddingTotal=(parseInt($this.css('paddingLeft'))||0)+(parseInt($this.css('paddingRight'))||0);var paneWidth=$this.width();var paneHeight=$this.height();var trackHeight=paneHeight;$this.wrap(jQuery('<div></div>').attr({'className':'jScrollPaneContainer'}).css({'height':paneHeight+'px','width':paneWidth+'px'}));jQuery(document).bind('emchange',function(e,cur,prev)
{$this.jScrollPane(settings);});}
$this.css('height','auto');if($.browser.msie)
{$this.css('zoom','1');}
var p=this.originalSidePaddingTotal;var contentHeight=$this.innerHeight();var percentInView=paneHeight/contentHeight;if(percentInView<1.00){var $container=$this.parent();$container.append(jQuery('<div></div>').attr({'className':'jScrollPaneTrack'}).append(jQuery('<div></div>').attr({'className':'jScrollPaneDrag'}).append(jQuery('<div></div>').attr({'className':'jScrollPaneDragTop'}),jQuery('<div></div>').attr({'className':'jScrollPaneDragBottom'}))));var $track=jQuery('>.jScrollPaneTrack',$container);var $drag=jQuery('>.jScrollPaneTrack .jScrollPaneDrag',$container);if(settings.showArrows){var currentArrowButton;var currentArrowDirection;var currentArrowInterval;var currentArrowInc;var whileArrowButtonDown=function()
{if(currentArrowInc>4||currentArrowInc%4==0){positionDrag(dragPosition+currentArrowDirection*mouseWheelMultiplier);}
currentArrowInc++;};var onArrowMouseUp=function(event)
{jQuery('html').unbind('mouseup',onArrowMouseUp);currentArrowButton.removeClass('jScrollActiveArrowButton');clearInterval(currentArrowInterval);};var onArrowMouseDown=function(){jQuery('html').bind('mouseup',onArrowMouseUp);currentArrowButton.addClass('jScrollActiveArrowButton');currentArrowInc=0;whileArrowButtonDown();currentArrowInterval=setInterval(whileArrowButtonDown,100);};var $arrowsWrapper=$('<div class="jScrollArrows"></div>');$container.append($arrowsWrapper);$arrowsWrapper.append(jQuery('<a></a>').attr({'href':'javascript:;','className':'jScrollArrowUp'}).html('Scroll up').bind('mousedown',function()
{currentArrowButton=jQuery(this);currentArrowDirection=-1;onArrowMouseDown();this.blur();return false;}),jQuery('<span></span>').addClass('jScrollSeparator'),jQuery('<a></a>').attr({'href':'javascript:;','className':'jScrollArrowDown'}).html('Scroll down').bind('mousedown',function()
{currentArrowButton=jQuery(this);currentArrowDirection=1;onArrowMouseDown();this.blur();return false;}));var $upArrow=jQuery('> div > .jScrollArrowUp',$container);var $downArrow=jQuery('> div > .jScrollArrowDown',$container);var $separator=jQuery('> div > .jScrollSeparator',$container);$arrowsWrapper.css('height',($upArrow.height()+$downArrow.height()+$separator.height())+'px');if(settings.arrowSize){trackHeight=paneHeight-settings.arrowSize-settings.arrowSize;$track.css({'height':trackHeight+'px',top:settings.arrowSize+'px'})}else{var topArrowHeight=$upArrow.height();settings.arrowSize=topArrowHeight;trackHeight=paneHeight-$arrowsWrapper.height();$track.css({'height':trackHeight+'px',top:0+'px'});if(settings.arrowsPosition)
{$arrowsWrapper.css('top',settings.arrowsPosition+'px')}
else
{$arrowsWrapper.css('top',trackHeight+'px')}}}
var $pane=jQuery(this).css({'position':'absolute','overflow':'visible'});var currentOffset;var maxY;var mouseWheelMultiplier;var dragPosition=0;var dragMiddle=percentInView*paneHeight/2;var getPos=function(event,c){var p=c=='X'?'Left':'Top';return event['page'+c]||(event['client'+c]+(document.documentElement['scroll'+p]||document.body['scroll'+p]))||0;};var ignoreNativeDrag=function(){return false;};var initDrag=function()
{ceaseAnimation();currentOffset=$drag.offset(false);currentOffset.top-=dragPosition;maxY=trackHeight-$drag[0].offsetHeight;mouseWheelMultiplier=2*settings.wheelSpeed*maxY/contentHeight;};var onStartDrag=function(event)
{initDrag();dragMiddle=getPos(event,'Y')-dragPosition-currentOffset.top;jQuery('html').bind('mouseup',onStopDrag).bind('mousemove',updateScroll);if(jQuery.browser.msie){jQuery('html').bind('dragstart',ignoreNativeDrag).bind('selectstart',ignoreNativeDrag);}
return false;};var onStopDrag=function()
{jQuery('html').unbind('mouseup',onStopDrag).unbind('mousemove',updateScroll);dragMiddle=percentInView*paneHeight/2;if(jQuery.browser.msie){jQuery('html').unbind('dragstart',ignoreNativeDrag).unbind('selectstart',ignoreNativeDrag);}};var positionDrag=function(destY)
{destY=destY<0?0:(destY>maxY?maxY:destY);dragPosition=destY;$drag.css({'top':destY+'px'});var p=destY/maxY;$pane.css({'top':((paneHeight-contentHeight)*p)+'px'});$this.trigger('scroll');if(settings.showArrows){$upArrow[destY==0?'addClass':'removeClass']('jScrollArrowUp-disabled');$downArrow[destY==maxY?'addClass':'removeClass']('jScrollArrowDown-disabled');}};var updateScroll=function(e)
{positionDrag(getPos(e,'Y')-currentOffset.top-dragMiddle);};var dragH=Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2),settings.dragMaxHeight),settings.dragMinHeight);$drag.height(dragH).bind('mousedown',onStartDrag);var trackScrollInterval;var trackScrollInc;var trackScrollMousePos;var doTrackScroll=function()
{if(trackScrollInc>8||trackScrollInc%4==0){positionDrag((dragPosition-((dragPosition-trackScrollMousePos)/2)));}
trackScrollInc++;};var onStopTrackClick=function()
{clearInterval(trackScrollInterval);jQuery('html').unbind('mouseup',onStopTrackClick).unbind('mousemove',onTrackMouseMove);};var onTrackMouseMove=function(event)
{trackScrollMousePos=getPos(event,'Y')-currentOffset.top-dragMiddle;};var onTrackClick=function(event)
{initDrag();onTrackMouseMove(event);trackScrollInc=0;jQuery('html').bind('mouseup',onStopTrackClick).bind('mousemove',onTrackMouseMove);trackScrollInterval=setInterval(doTrackScroll,100);doTrackScroll();};$track.bind('mousedown',onTrackClick);if($container.mousewheel){$container.mousewheel(function(event,delta){initDrag();ceaseAnimation();var d=dragPosition;positionDrag(dragPosition-delta*mouseWheelMultiplier);var dragOccured=d!=dragPosition;return!dragOccured;},false);}
var _animateToPosition;var _animateToInterval;function animateToPosition()
{var diff=(_animateToPosition-dragPosition)/settings.animateStep;if(diff>1||diff<-1){positionDrag(dragPosition+diff);}else{positionDrag(_animateToPosition);ceaseAnimation();}}
var ceaseAnimation=function()
{if(_animateToInterval){clearInterval(_animateToInterval);delete _animateToPosition;}};var scrollTo=function(pos,preventAni)
{if(typeof pos=="string"){$e=jQuery(pos,this);if(!$e.length)return;pos=$e.offset().top-$this.offset().top;}
ceaseAnimation();var destDragPosition=-pos/(paneHeight-contentHeight)*maxY;if(!preventAni||settings.animateTo){_animateToPosition=destDragPosition;_animateToInterval=setInterval(animateToPosition,settings.animateInterval);}else{positionDrag(destDragPosition);}};$this[0].scrollTo=scrollTo;$this[0].scrollBy=function(delta)
{var currentPos=-parseInt($pane.css('top'))||0;scrollTo(currentPos+delta);};initDrag();scrollTo(-currentScrollPosition,true);jQuery.jScrollPane.active.push($this[0]);}else{$this.css({'height':paneHeight+'px','width':paneWidth-(this.originalSidePaddingTotal||0)+'px','padding':(this.originalPadding||0)});var $container=$this.parent();$container.append(jQuery('<div></div>').attr({'className':'jScrollPaneTrack'}).append(jQuery('<div></div>').attr({'className':'jScrollPaneDrag'}).append(jQuery('<div></div>').attr({'className':'jScrollPaneDragTop'}),jQuery('<div></div>').attr({'className':'jScrollPaneDragBottom'}))));}})};jQuery(window).bind('unload',function(){var els=jQuery.jScrollPane.active;for(var i=0;i<els.length;i++){els[i].scrollTo=els[i].scrollBy=null;}});(function($){$.event.special.mousewheel={setup:function(){var handler=$.event.special.mousewheel.handler;if($.browser.mozilla)
$(this).bind('mousemove.mousewheel',function(event){$.data(this,'mwcursorposdata',{pageX:event.pageX,pageY:event.pageY,clientX:event.clientX,clientY:event.clientY});});if(this.addEventListener)
this.addEventListener(($.browser.mozilla?'DOMMouseScroll':'mousewheel'),handler,false);else
this.onmousewheel=handler;},teardown:function(){var handler=$.event.special.mousewheel.handler;$(this).unbind('mousemove.mousewheel');if(this.removeEventListener)
this.removeEventListener(($.browser.mozilla?'DOMMouseScroll':'mousewheel'),handler,false);else
this.onmousewheel=function(){};$.removeData(this,'mwcursorposdata');},handler:function(event){var args=Array.prototype.slice.call(arguments,1);event=$.event.fix(event||window.event);$.extend(event,$.data(this,'mwcursorposdata')||{});var delta=0,returnValue=true;if(event.wheelDelta)delta=event.wheelDelta/120;if(event.detail)delta=-event.detail/3;if($.browser.opera)delta=-event.wheelDelta;event.data=event.data||{};event.type="mousewheel";args.unshift(delta);args.unshift(event);return $.event.handle.apply(this,args);}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel");},unmousewheel:function(fn){return this.unbind("mousewheel",fn);}});})(jQuery);;(function($){var _remove=$.fn.remove,isFF2=$.browser.mozilla&&(parseFloat($.browser.version)<1.9);$.ui={version:"1.6rc6",plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set){return;}
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b);},cssCache:{},css:function(name){if($.ui.cssCache[name]){return $.ui.cssCache[name];}
var tmp=$('<div class="ui-gen"></div>').addClass(name).css({position:'absolute',top:'-5000px',left:'-5000px',display:'block'}).appendTo('body');$.ui.cssCache[name]=!!((!(/auto|default/).test(tmp.css('cursor'))||(/^[1-9]/).test(tmp.css('height'))||(/^[1-9]/).test(tmp.css('width'))||!(/none/).test(tmp.css('backgroundImage'))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))));try{$('body').get(0).removeChild(tmp.get(0));}catch(e){}
return $.ui.cssCache[name];},hasScroll:function(el,a){if($(el).css('overflow')=='hidden'){return false;}
var scroll=(a&&a=='left')?'scrollLeft':'scrollTop',has=false;if(el[scroll]>0){return true;}
el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;return has;},isOverAxis:function(x,reference,size){return(x>reference)&&(x<(reference+size));},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width);},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(isFF2){var attr=$.attr,removeAttr=$.fn.removeAttr,ariaNS="http://www.w3.org/2005/07/aaa",ariaState=/^aria-/,ariaRole=/^wairole:/;$.attr=function(elem,name,value){var set=value!==undefined;return(name=='role'?(set?attr.call(this,elem,name,"wairole:"+value):(attr.apply(this,arguments)||"").replace(ariaRole,"")):(ariaState.test(name)?(set?elem.setAttributeNS(ariaNS,name.replace(ariaState,"aaa:"),value):attr.call(this,elem,name.replace(ariaState,"aaa:"))):attr.apply(this,arguments)));};$.fn.removeAttr=function(name){return(ariaState.test(name)?this.each(function(){this.removeAttributeNS(ariaNS,name.replace(ariaState,""));}):removeAttr.call(this,name));};}
$.fn.extend({remove:function(){$("*",this).add(this).each(function(){$(this).triggerHandler("remove");});return _remove.apply(this,arguments);},enableSelection:function(){return this.attr('unselectable','off').css('MozUserSelect','').unbind('selectstart.ui');},disableSelection:function(){return this.attr('unselectable','on').css('MozUserSelect','none').bind('selectstart.ui',function(){return false;});},scrollParent:function(){var scrollParent;if(($.browser.msie&&(/(static|relative)/).test(this.css('position')))||(/absolute/).test(this.css('position'))){scrollParent=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test($.curCSS(this,'position',1))&&(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}else{scrollParent=this.parents().filter(function(){return(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}
return(/fixed/).test(this.css('position'))||!scrollParent.length?$(document):scrollParent;}});$.extend($.expr[':'],{data:function(elem,i,match){return!!$.data(elem,match[3]);},focusable:function(element){var nodeName=element.nodeName.toLowerCase(),tabIndex=$.attr(element,'tabindex');return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:'a'==nodeName||'area'==nodeName?element.href||!isNaN(tabIndex):!isNaN(tabIndex))&&!$(element)['area'==nodeName?'parents':'closest'](':hidden').length;},tabbable:function(element){var tabIndex=$.attr(element,'tabindex');return(isNaN(tabIndex)||tabIndex>=0)&&$(element).is(':focusable');}});function getter(namespace,plugin,method,args){function getMethods(type){var methods=$[namespace][plugin][type]||[];return(typeof methods=='string'?methods.split(/,?\s+/):methods);}
var methods=getMethods('getter');if(args.length==1&&typeof args[0]=='string'){methods=methods.concat(getMethods('getterSetter'));}
return($.inArray(method,methods)!=-1);}
$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=='string'),args=Array.prototype.slice.call(arguments,1);if(isMethodCall&&options.substring(0,1)=='_'){return this;}
if(isMethodCall&&getter(namespace,name,options,args)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined);}
return this.each(function(){var instance=$.data(this,name);(!instance&&!isMethodCall&&$.data(this,name,new $[namespace][name](this,options))._init());(instance&&isMethodCall&&$.isFunction(instance[options])&&instance[options].apply(instance,args));});};$[namespace]=$[namespace]||{};$[namespace][name]=function(element,options){var self=this;this.namespace=namespace;this.widgetName=name;this.widgetEventPrefix=$[namespace][name].eventPrefix||name;this.widgetBaseClass=namespace+'-'+name;this.options=$.extend({},$.widget.defaults,$[namespace][name].defaults,$.metadata&&$.metadata.get(element)[name],options);this.element=$(element).bind('setData.'+name,function(event,key,value){if(event.target==element){return self._setData(key,value);}}).bind('getData.'+name,function(event,key){if(event.target==element){return self._getData(key);}}).bind('remove',function(){return self.destroy();});};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);$[namespace][name].getterSetter='option';};$.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+'-disabled'+' '+this.namespace+'-state-disabled').removeAttr('aria-disabled');},option:function(key,value){var options=key,self=this;if(typeof key=="string"){if(value===undefined){return this._getData(key);}
options={};options[key]=value;}
$.each(options,function(key,value){self._setData(key,value);});},_getData:function(key){return this.options[key];},_setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.element
[value?'addClass':'removeClass'](this.widgetBaseClass+'-disabled'+' '+
this.namespace+'-state-disabled').attr("aria-disabled",value);}},enable:function(){this._setData('disabled',false);},disable:function(){this._setData('disabled',true);},_trigger:function(type,event,data){var callback=this.options[type],eventName=(type==this.widgetEventPrefix?type:this.widgetEventPrefix+type);event=$.Event(event);event.type=eventName;if(event.originalEvent){for(var i=$.event.props.length,prop;i;){prop=$.event.props[--i];event[prop]=event.originalEvent[prop];}}
this.element.trigger(event,data);return!($.isFunction(callback)&&callback.call(this.element[0],event,data)===false||event.isDefaultPrevented());}};$.widget.defaults={disabled:false};$.ui.mouse={_mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(event){return self._mouseDown(event);}).bind('click.'+this.widgetName,function(event){if(self._preventClickEvent){self._preventClickEvent=false;return false;}});if($.browser.msie){this._mouseUnselectable=this.element.attr('unselectable');this.element.attr('unselectable','on');}
this.started=false;},_mouseDestroy:function(){this.element.unbind('.'+this.widgetName);($.browser.msie&&this.element.attr('unselectable',this._mouseUnselectable));},_mouseDown:function(event){if(event.originalEvent.mouseHandled){return;}
(this._mouseStarted&&this._mouseUp(event));this._mouseDownEvent=event;var self=this,btnIsLeft=(event.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(event.target).parents().add(event.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true;}
this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self.mouseDelayMet=true;},this.options.delay);}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(event)!==false);if(!this._mouseStarted){event.preventDefault();return true;}}
this._mouseMoveDelegate=function(event){return self._mouseMove(event);};this._mouseUpDelegate=function(event){return self._mouseUp(event);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);($.browser.safari||event.preventDefault());event.originalEvent.mouseHandled=true;return true;},_mouseMove:function(event){if($.browser.msie&&!event.button){return this._mouseUp(event);}
if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault();}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);(this._mouseStarted?this._mouseDrag(event):this._mouseUp(event));}
return!this._mouseStarted;},_mouseUp:function(event){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=true;this._mouseStop(event);}
return false;},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance);},_mouseDelayMet:function(event){return this.mouseDelayMet;},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){$.widget("ui.tabs",{_init:function(){this._tabify(true);},_setData:function(key,value){if((/^selected/).test(key))
this.select(value);else{this.options[key]=value;this._tabify();}},_tabId:function(a){return a.title&&a.title.replace(/\s/g,'_').replace(/[^A-Za-z0-9\-_:\.]/g,'')||this.options.idPrefix+$.data(a);},_sanitizeSelector:function(hash){return hash.replace(/:/g,'\\:');},_cookie:function(){var cookie=this.cookie||(this.cookie=this.options.cookie.name||'ui-tabs-'+$.data(this.list[0]));return $.cookie.apply(null,[cookie].concat($.makeArray(arguments)));},_ui:function(tab,panel){return{tab:tab,panel:panel,index:this.$tabs.index(tab)};},_tabify:function(init){this.list=this.element.is('div')?this.element.children('ul:first, ol:first').eq(0):this.element;this.$lis=$('li:has(a[href])',this.list);this.$tabs=this.$lis.map(function(){return $('a',this)[0];});this.$panels=$([]);var self=this,o=this.options;var fragmentId=/^#.+/;this.$tabs.each(function(i,a){var href=$(a).attr('href');if(fragmentId.test(href))
self.$panels=self.$panels.add(self._sanitizeSelector(href));else if(href!='#'){$.data(a,'href.tabs',href);$.data(a,'load.tabs',href.replace(/#.*$/,''));var id=self._tabId(a);a.href='#'+id;var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom').insertAfter(self.$panels[i-1]||self.list);$panel.data('destroy.tabs',true);}
self.$panels=self.$panels.add($panel);}
else
o.disabled.push(i+1);});if(init){if(this.element.is('div')){this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');}
this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');this.$lis.addClass('ui-state-default ui-corner-top');this.$panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom');if(o.selected===undefined){if(location.hash){this.$tabs.each(function(i,a){if(a.hash==location.hash){o.selected=i;return false;}});}
else if(o.cookie)
o.selected=parseInt(self._cookie(),10);else if(this.$lis.filter('.ui-tabs-selected').length)
o.selected=this.$lis.index(this.$lis.filter('.ui-tabs-selected'));else
o.selected=0;}
else if(o.selected===null)
o.selected=-1;o.selected=((o.selected>=0&&this.$tabs[o.selected])||o.selected<0)?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.$lis.filter('.ui-state-disabled'),function(n,i){return self.$lis.index(n);}))).sort();if($.inArray(o.selected,o.disabled)!=-1)
o.disabled.splice($.inArray(o.selected,o.disabled),1);this.$panels.addClass('ui-tabs-hide');this.$lis.removeClass('ui-tabs-selected ui-state-active');if(o.selected>=0&&this.$tabs.length){this.$panels.eq(o.selected).removeClass('ui-tabs-hide');var classes=['ui-tabs-selected ui-state-active'];if(o.deselectable)classes.push('ui-tabs-deselectable');this.$lis.eq(o.selected).addClass(classes.join(' '));var onShow=function(){self._trigger('show',null,self._ui(self.$tabs[o.selected],self.$panels[o.selected]));};if($.data(this.$tabs[o.selected],'load.tabs'))
this.load(o.selected,onShow);else onShow();}
if(o.event!='mouseover'){var handleState=function(state,el){if(el.is(':not(.ui-state-disabled)'))el.toggleClass('ui-state-'+state);};this.$lis.bind('mouseover.tabs mouseout.tabs',function(){handleState('hover',$(this));});this.$tabs.bind('focus.tabs blur.tabs',function(){handleState('focus',$(this).parents('li:first'));});}
$(window).bind('unload',function(){self.$lis.add(self.$tabs).unbind('.tabs');self.$lis=self.$tabs=self.$panels=null;});}
else
o.selected=this.$lis.index(this.$lis.filter('.ui-tabs-selected'));if(o.cookie)this._cookie(o.selected,o.cookie);for(var i=0,li;li=this.$lis[i];i++)
$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass('ui-tabs-selected')?'addClass':'removeClass']('ui-state-disabled');if(o.cache===false)this.$tabs.removeData('cache.tabs');var hideFx,showFx;if(o.fx){if($.isArray(o.fx)){hideFx=o.fx[0];showFx=o.fx[1];}
else hideFx=showFx=o.fx;}
function resetStyle($el,fx){$el.css({display:''});if($.browser.msie&&fx.opacity)$el[0].style.removeAttribute('filter');}
var showTab=showFx?function(clicked,$show){$show.hide().removeClass('ui-tabs-hide').animate(showFx,500,function(){resetStyle($show,showFx);self._trigger('show',null,self._ui(clicked,$show[0]));});}:function(clicked,$show){$show.removeClass('ui-tabs-hide');self._trigger('show',null,self._ui(clicked,$show[0]));};var hideTab=hideFx?function(clicked,$hide,$show){$hide.animate(hideFx,hideFx.duration||'normal',function(){$hide.addClass('ui-tabs-hide');resetStyle($hide,hideFx);if($show)showTab(clicked,$show);});}:function(clicked,$hide,$show){$hide.addClass('ui-tabs-hide');if($show)showTab(clicked,$show);};function switchTab(clicked,$li,$hide,$show){var classes=['ui-tabs-selected ui-state-active'];if(o.deselectable)classes.push('ui-tabs-deselectable');$li.removeClass('ui-state-default').addClass(classes.join(' ')).siblings().removeClass(classes.join(' ')).addClass('ui-state-default');hideTab(clicked,$hide,$show);}
this.$tabs.unbind('.tabs').bind(o.event+'.tabs',function(){var $li=$(this).parents('li:eq(0)'),$hide=self.$panels.filter(':visible'),$show=$(self._sanitizeSelector(this.hash));if(($li.hasClass('ui-state-active')&&!o.deselectable)||$li.hasClass('ui-state-disabled')||$(this).hasClass('ui-tabs-loading')||self._trigger('select',null,self._ui(this,$show[0]))===false){this.blur();return false;}
o.selected=self.$tabs.index(this);if(o.deselectable){if($li.hasClass('ui-state-active')){o.selected=-1;if(o.cookie)self._cookie(o.selected,o.cookie);$li.removeClass('ui-tabs-selected ui-state-active ui-tabs-deselectable').addClass('ui-state-default');self.$panels.stop();hideTab(this,$hide);this.blur();return false;}else if(!$hide.length){if(o.cookie)self._cookie(o.selected,o.cookie);self.$panels.stop();var a=this;self.load(self.$tabs.index(this),function(){$li.addClass('ui-tabs-selected ui-state-active ui-tabs-deselectable').removeClass('ui-state-default');showTab(a,$show);});this.blur();return false;}}
if(o.cookie)self._cookie(o.selected,o.cookie);self.$panels.stop();if($show.length){var a=this;self.load(self.$tabs.index(this),$hide.length?function(){switchTab(a,$li,$hide,$show);}:function(){$li.addClass('ui-tabs-selected ui-state-active').removeClass('ui-state-default');showTab(a,$show);});}else
throw'jQuery UI Tabs: Mismatching fragment identifier.';if($.browser.msie)this.blur();return false;});if(o.event!='click')this.$tabs.bind('click.tabs',function(){return false;});},destroy:function(){var o=this.options;this.element.removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all');this.list.unbind('.tabs').removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all').removeData('tabs');this.$tabs.each(function(){var href=$.data(this,'href.tabs');if(href)
this.href=href;var $this=$(this).unbind('.tabs');$.each(['href','load','cache'],function(i,prefix){$this.removeData(prefix+'.tabs');});});this.$lis.unbind('.tabs').add(this.$panels).each(function(){if($.data(this,'destroy.tabs'))
$(this).remove();else
$(this).removeClass('ui-state-default '+'ui-corner-top '+'ui-tabs-selected '+'ui-state-active '+'ui-tabs-deselectable '+'ui-state-disabled '+'ui-tabs-panel '+'ui-widget-content '+'ui-corner-bottom '+'ui-tabs-hide');});if(o.cookie)
this._cookie(null,o.cookie);},add:function(url,label,index){if(index==undefined)
index=this.$tabs.length;var self=this,o=this.options;var $li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label));$li.addClass('ui-state-default ui-corner-top').data('destroy.tabs',true);var id=url.indexOf('#')==0?url.replace('#',''):this._tabId($('a:first-child',$li)[0]);var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).data('destroy.tabs',true);}
$panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide');if(index>=this.$lis.length){$li.appendTo(this.list);$panel.appendTo(this.list[0].parentNode);}
else{$li.insertBefore(this.$lis[index]);$panel.insertBefore(this.$panels[index]);}
o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n});this._tabify();if(this.$tabs.length==1){$li.addClass('ui-tabs-selected ui-state-active');$panel.removeClass('ui-tabs-hide');var href=$.data(this.$tabs[0],'load.tabs');if(href)this.load(0,function(){self._trigger('show',null,self._ui(self.$tabs[0],self.$panels[0]));});}
this._trigger('add',null,this._ui(this.$tabs[index],this.$panels[index]));},remove:function(index){var o=this.options,$li=this.$lis.eq(index).remove(),$panel=this.$panels.eq(index).remove();if($li.hasClass('ui-tabs-selected')&&this.$tabs.length>1)
this.select(index+(index+1<this.$tabs.length?1:-1));o.disabled=$.map($.grep(o.disabled,function(n,i){return n!=index;}),function(n,i){return n>=index?--n:n});this._tabify();this._trigger('remove',null,this._ui($li.find('a')[0],$panel[0]));},enable:function(index){var o=this.options;if($.inArray(index,o.disabled)==-1)
return;this.$lis.eq(index).removeClass('ui-state-disabled');o.disabled=$.grep(o.disabled,function(n,i){return n!=index;});this._trigger('enable',null,this._ui(this.$tabs[index],this.$panels[index]));},disable:function(index){var self=this,o=this.options;if(index!=o.selected){this.$lis.eq(index).addClass('ui-state-disabled');o.disabled.push(index);o.disabled.sort();this._trigger('disable',null,this._ui(this.$tabs[index],this.$panels[index]));}},select:function(index){if(typeof index=='string')
index=this.$tabs.index(this.$tabs.filter('[href$='+index+']'));this.$tabs.eq(index).trigger(this.options.event+'.tabs');},load:function(index,callback){var self=this,o=this.options,$a=this.$tabs.eq(index),a=$a[0],bypassCache=callback==undefined||callback===false,url=$a.data('load.tabs');callback=callback||function(){};if(!url||!bypassCache&&$.data(a,'cache.tabs')){callback();return;}
var inner=function(parent){var $parent=$(parent),$inner=$parent.find('*:last');return $inner.length&&$inner.is(':not(img)')&&$inner||$parent;};var cleanup=function(){self.$tabs.filter('.ui-tabs-loading').removeClass('ui-tabs-loading').each(function(){if(o.spinner)
inner(this).parent().html(inner(this).data('label.tabs'));});self.xhr=null;};if(o.spinner){var label=inner(a).html();inner(a).wrapInner('<em></em>').find('em').data('label.tabs',label).html(o.spinner);}
var ajaxOptions=$.extend({},o.ajaxOptions,{url:url,success:function(r,s){$(self._sanitizeSelector(a.hash)).html(r);cleanup();if(o.cache)
$.data(a,'cache.tabs',true);self._trigger('load',null,self._ui(self.$tabs[index],self.$panels[index]));try{o.ajaxOptions.success(r,s);}
catch(er){}
callback();}});if(this.xhr){this.xhr.abort();cleanup();}
$a.addClass('ui-tabs-loading');self.xhr=$.ajax(ajaxOptions);},url:function(index,url){this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs',url);},length:function(){return this.$tabs.length;}});$.extend($.ui.tabs,{version:'1.6rc6',getter:'length',defaults:{ajaxOptions:null,cache:false,cookie:null,deselectable:false,disabled:[],event:'click',fx:null,idPrefix:'ui-tabs-',panelTemplate:'<div></div>',spinner:'Loading&#8230;',tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){var self=this,t=this.options.selected;function rotate(){clearTimeout(self.rotation);self.rotation=setTimeout(function(){t=++t<self.$tabs.length?t:0;self.select(t);},ms);}
if(ms){this.element.bind('tabsshow',rotate);this.$tabs.bind(this.options.event+'.tabs',!continuing?function(e){if(e.clientX){clearTimeout(self.rotation);self.element.unbind('tabsshow',rotate);}}:function(e){t=self.options.selected;rotate();});rotate();}
else{clearTimeout(self.rotation);this.element.unbind('tabsshow',rotate);this.$tabs.unbind(this.options.event+'.tabs',stop);}}});})(jQuery);jQuery.richTooltips={tooltips:{},mousePoint:{},toString:function(){return"jQuery.richTooltips";},prepareEntityTooltips:function(){var self=this;self.FADE_IN="fast";self.FADE_OUT="slow";self.TOGGLE_DELAY_IN_MILLIS=500;self.REACQUIRE_DELAY_IN_MILLIS=250;self.EFFECTS_DURATION_IN_MILLIS=500;self.IMAGE_WIDTH_IN_PIXELS=60;self.DESCRIPTION_LENGH_IN_CHARS=256;self.REMOTELY_LOADED=["loading-data","loading-image"];self.POINTER_URL="/images/zeitgeist/up_arrow.gif";var $body=$(document.body);$body.append($("<div/>").attr("id","richToolTip"));self.addTooltipToEntityLinks($body);},addTooltipToEntityLinks:function($selector){var self=this;this.$tooltip=$("#richToolTip");self.initialized=false;self.timeoutId=NaN;this.mousePoint={};self.cachedResource=null;if(!self.initialized){self.initialized=true;$(document.body).click(function(evt){if(self.cachedResource&&!$(evt.target).parents().is("#richToolTip")){self.hideTooltip();}});}
$selector.find("a[data-entity-resource]").each(function(index,anchor){var $anchor=$(anchor).addClass("richToolTip");var resource=$anchor.attr("data-entity-resource");var name=$anchor.text();var href=$anchor.attr("href");var $element=createDefaultTooltip(name,href).addClass(self.REMOTELY_LOADED.join(" "));jQuery.richTooltips.tooltips[resource]={element:$element,entity:null};$anchor.mouseover(function(e){self.cachedResource=resource;$(document).bind("mousemove",setMousePosition);if(!isNaN(self.timeoutId)){clearTimeout(self.timeoutId);}
if(self.cachedResource!=resource){jQuery.richTooltips.resetTooltip();}
var show=function(){showTooltip($anchor);};self.timeoutId=setTimeout(show,jQuery.richTooltips.TOGGLE_DELAY_IN_MILLIS);});$anchor.mouseout(function(){$(document).unbind("mousemove",setMousePosition);var reset=function(){jQuery.richTooltips.resetTooltip();};self.timeoutId=setTimeout(reset,self.REACQUIRE_DELAY_IN_MILLIS);});});this.$tooltip.mouseover(function(){clearTimeout(jQuery.richTooltips.timeoutId);});this.$tooltip.mouseout(function(){var hide=function(){self.hideTooltip();};self.timeoutId=setTimeout(hide,self.TOGGLE_DELAY_IN_MILLIS);});function createDefaultTooltip(name,href){return $("<div/>").addClass("wrapper").append($("<a/>").attr("href",href).append($("<img/>").addClass("entity"))).append($("<div/>").addClass("content").append($("<h3/>").addClass("name").append($("<a/>").attr("href",href).text(name)).append($("<em/>").addClass("facets"))).append($("<p/>").text("Loading...").addClass("description"))).append($("<br/>"));}
function setMousePosition(event){self.mousePoint={x:event.pageX,y:event.pageY};}
function showTooltip($anchor){var resource=$anchor.attr("data-entity-resource");if(resource!=self.cachedResource){return;}
var $element=self.tooltips[resource].element;if(!$element){return;}
self.resetTooltip();self.$tooltip.append($element);self.$tooltip.fadeIn(self.FADE_IN);self.$tooltip.css(self.getPosition($anchor));if($element.hasClass("loading-image")){$element.find("img.entity").load(function(){$element.removeClass("loading-image");var $img=$(this);var w=$img.width();var h=$img.height();var r=(h==0)?0:1/(w/h);$img.width(self.IMAGE_WIDTH_IN_PIXELS);$img.height(self.IMAGE_WIDTH_IN_PIXELS*r);jQuery.richTooltips.loadEntityData(resource);}).error(function(){$element.removeClass("loading-image");var $img=$(this);$img.width(0);$img.height(0);jQuery.richTooltips.loadEntityData(resource);}).attr("src","http://"+window.location.host+"/entity-images"+resource+".jpg");}
if($element.hasClass("loading-data")){apiSession.models.Entity.findByResource(resource,{onComplete:function(response){$element.removeClass("loading-data");self.tooltips[resource].entity=response;jQuery.richTooltips.loadEntityData(resource);},onFailure:function(error){$element.removeClass("loading-data");jQuery.richTooltips.loadEntityData(resource);}});}}},hideTooltip:function(){this.$tooltip.fadeOut(jQuery.richTooltips.FADE_OUT,jQuery.richTooltips.resetTooltip());},resetTooltip:function(){if(!isNaN(this.timeoutId)){clearTimeout(this.timeoutId);}
this.$tooltip.stop();this.$tooltip.hide();this.$tooltip.find(".wrapper").remove();this.$tooltip.css("opacity",1);},loadEntityData:function(resource){if(!this.isLoaded(resource)){return;}
var $element=this.tooltips[resource].element;var entity=this.tooltips[resource].entity;if($element.find("img.entity").height()>0){$element.find("div.content").css({marginLeft:this.IMAGE_WIDTH_IN_PIXELS+10});$element.find("img.entity").show();}
if(entity){$element.find("h3 > a").text(entity.name);$element.find("em.facets").text(entity.facets.toSentence(function(facet){return facet.name;}));$element.find("p.description").text(entity.description.wordTruncate(this.DESCRIPTION_LENGH_IN_CHARS)+"...");}else{$element.find("p.description").remove();}
this.tooltips[resource].entity=null;},getPosition:function($anchor){var self=jQuery.richTooltips;var $pointer=$("#richToolTip").find("img.pointer");var offset={left:self.mousePoint.x,top:$anchor.offset().top};var localY=self.mousePoint.y-offset.top;var textMetrics=self.getTextMetrics($anchor);if(isNaN(textMetrics.fontSize)||isNaN(textMetrics.lineHeight)){offset.top=this.mousePoint.y-20;}else{var leading=textMetrics.lineHeight-textMetrics.fontSize;var baseline=(localY-(localY%textMetrics.lineHeight))+textMetrics.lineHeight;offset.top+=(baseline-leading);}
offset.left+=18;offset.top+=6;return offset;},getTextMetrics:function($tag){var $helper=$("#text-helper");if($helper.length==0){$(document.body).append('<div id="text-helper"></div>');$helper=$("#text-helper");}
$helper.empty();$helper.append("<span>Mq</span>");$helper.show();$helper.css("font-size",$tag.css("font-size"));$helper.css("line-height","1em");var fontSize=$helper.height();$helper.css("line-height",$tag.css("line-height"));var lineHeight=$helper.height();$helper.hide();return{fontSize:fontSize,lineHeight:lineHeight};},isLoaded:function(resource){var $element=this.tooltips[resource]["element"];var finished=true;$.each(this.REMOTELY_LOADED,function(index,item){if($element.hasClass(item)){finished=false;return false;}});return finished;}};(function($){$.fn.richTooltip=function(options){this.each(function(){$.richTooltips.prepareEntityTooltips();return this;});};})(jQuery);var 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=[],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&&typeof doc.appendChild!=UNDEF&&typeof doc.replaceChild!=UNDEF&&typeof doc.removeChild!=UNDEF&&typeof doc.cloneNode!=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){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=jQuery.browser.msie,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>");var s=getElementById("__ie_ondomload");if(s){s.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);callDomLoadFunctions();}};}}
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 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){if(isDomLoaded){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){win.attachEvent("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.toLowerCase()=="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.toLowerCase()=="param"){e.setAttribute(c[j].getAttribute("name"),c[j].getAttribute("value"));}}}
obj.parentNode.replaceChild(e,obj);}}
function fixObjectLeaks(id){if(ua.ie&&ua.win&&hasPlayerVersion("8.0.0")){win.attachEvent("onunload",function(){var obj=getElementById(id);if(obj){for(var i in obj){if(typeof obj[i]=="function"){obj[i]=function(){};}}
obj.parentNode.removeChild(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";win.attachEvent("onload",function(){obj.parentNode.removeChild(obj);});}
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";win.attachEvent("onload",function(){obj.parentNode.removeChild(obj);});}
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.toLowerCase()=="param")&&!(c[i].nodeType==8)){ac.appendChild(c[i].cloneNode(true));}}}}}
return ac;}
function createSWF(attObj,parObj,id){var r,el=getElementById(id);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=="data"){parObj.movie=attObj[i];}
else if(i.toLowerCase()=="styleclass"){att+=' class="'+attObj[i]+'"';}
else if(i!="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>';fixObjectLeaks(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=="data"){e.setAttribute("src",attObj[k]);}
else if(k.toLowerCase()=="styleclass"){e.setAttribute("class",attObj[k]);}
else if(k!="classid"){e.setAttribute(k,attObj[k]);}}}
for(var l in parObj){if(parObj[l]!=Object.prototype[l]){if(l!="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!="classid"){o.setAttribute(m,attObj[m]);}}}
for(var n in parObj){if(parObj[n]!=Object.prototype[n]&&n!="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 getElementById(id){return doc.getElementById(id);}
function createElement(el){return doc.createElement(el);}
function hasPlayerVersion(rv){var pv=ua.pv,v=rv.split(".");v[0]=parseInt(v[0],10);v[1]=parseInt(v[1],10);v[2]=parseInt(v[2],10);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).style.visibility=v;}
else{createCSS("#"+id,"visibility:"+v);}}
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&&isDomLoaded){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){if(!ua.w3cdom||!swfUrlStr||!replaceElemIdStr||!widthStr||!heightStr||!swfVersionStr){return;}
widthStr+="";heightStr+="";if(hasPlayerVersion(swfVersionStr)){setVisibility(replaceElemIdStr,false);var att=(typeof attObj==OBJECT)?attObj:{};att.data=swfUrlStr;att.width=widthStr;att.height=heightStr;var par=(typeof parObj==OBJECT)?parObj:{};if(typeof flashvarsObj==OBJECT){for(var i in flashvarsObj){if(flashvarsObj[i]!=Object.prototype[i]){if(typeof par.flashvars!=UNDEF){par.flashvars+="&"+i+"="+flashvarsObj[i];}
else{par.flashvars=i+"="+flashvarsObj[i];}}}}
addDomLoadEvent(function(){createSWF(att,par,replaceElemIdStr);if(att.id==replaceElemIdStr){setVisibility(replaceElemIdStr,true);}});}
else if(xiSwfUrlStr&&!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac)){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&&isDomLoaded){return createSWF(attObj,parObj,replaceElemIdStr);}
else{return undefined;}},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 q;}
if(q){var pairs=q.substring(1).split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return pairs[i].substring((pairs[i].indexOf("=")+1));}}}
return"";},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;}}}};}();window.Raphael=(function(){var separator=/[, ]+/,doc=document,win=window,oldRaphael={was:"Raphael"in window,is:window.Raphael},R=function(){return create.apply(R,arguments);},paper={},availableAttrs={cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",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,target:"_blank","text-anchor":"middle",title:"Raphael",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.version="0.8.6";R.type=(window.SVGAngle||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML");R.svg=!(R.vml=R.type=="VML");R.idGenerator=0;R.fn={};R.isArray=function(arr){return Object.prototype.toString.call(arr)=="[object Array]";};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},r=Math.round(red).toString(16),g=Math.round(green).toString(16),b=Math.round(blue).toString(16);if(r.length==1){r="0"+r;}
if(g.length==1){g="0"+g;}
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=R.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 getRGBcache={},getRGBcount=[];R.getRGB=function(colour){if(colour in getRGBcache){return getRGBcache[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"},res;if((colour+"").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]);green=parseFloat(rgb[1]);blue=parseFloat(rgb[2]);}
if(rgb[5]){rgb=rgb[5].split(/\s*,\s*/);red=parseFloat(rgb[0])*2.55;green=parseFloat(rgb[1])*2.55;blue=parseFloat(rgb[2])*2.55;}
if(rgb[6]){rgb=rgb[6].split(/\s*,\s*/);red=parseFloat(rgb[0]);green=parseFloat(rgb[1]);blue=parseFloat(rgb[2]);return R.hsb2rgb(red,green,blue);}
if(rgb[7]){rgb=rgb[7].split(/\s*,\s*/);red=parseFloat(rgb[0])*2.55;green=parseFloat(rgb[1])*2.55;blue=parseFloat(rgb[2])*2.55;return R.hsb2rgb(red,green,blue);}
var rgb={r:red,g:green,b:blue},r=Math.round(red).toString(16),g=Math.round(green).toString(16),b=Math.round(blue).toString(16);(r.length==1)&&(r="0"+r);(g.length==1)&&(g="0"+g);(b.length==1)&&(b="0"+b);rgb.hex="#"+r+g+b;res=rgb;}else{res={r:-1,g:-1,b:-1,hex:"none"};}
if(getRGBcount.length>20){delete getRGBcache[getRGBcount.unshift()];}
getRGBcount.push(colour);getRGBcache[colour]=res;return res;};R.getColor=function(value){var start=this.getColor.start=this.getColor.start||{h:0,s:1,b:value||.75},rgb=this.hsb2rgb(start.h,start.s,start.b);start.h+=.075;if(start.h>1){start.h=0;start.s-=.2;if(start.s<=0){this.getColor.start={h:0,s:1,b:start.b};}}
return rgb.hex;};R.getColor.reset=function(){delete this.start;};var pathcache={},pathcount=[];R.parsePathString=function(pathString){if(pathString in pathcache){return pathcache[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()){data=pathString;}
if(!data.length){pathString.replace(/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,function(a,b,c){var params=[],name=b.toLowerCase();c.replace(/(-?\d*\.?\d*(?:e[-+]?\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;}
if(pathcount.length>20){delete pathcache[pathcount.unshift()];}
pathcount.push(pathString);pathcache[pathString]=data;return data;};var pathDimensions=function(path){var pathArray=path;if(typeof path=="string"){pathArray=R.parsePathString(path);}
pathArray=pathToAbsolute(pathArray);var x=[],y=[],length=0;for(var i=0,ii=pathArray.length;i<ii;i++){var pa=pathArray[i];switch(pa[0]){case"Z":break;case"A":x.push(pa[pa.length-2]);y.push(pa[pa.length-1]);break;default:for(var j=1,jj=pa.length;j<jj;j++){(j%2?x:y).push(pa[j]);}}}
var minx=Math.min.apply(Math,x),miny=Math.min.apply(Math,y);if(!x.length){return{x:0,y:0,width:0,height:0,X:0,Y:0};}else{return{x:minx,y:miny,width:Math.max.apply(Math,x)-minx,height:Math.max.apply(Math,y)-miny,X:x,Y:y};}},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;},pathToRelative=function(pathArray){var res=[],x=0,y=0,start=0;if(typeof pathArray=="string"){pathArray=R.parsePathString(pathArray);}
if(pathArray[0][0]=="M"){x=pathArray[0][1];y=pathArray[0][2];start++;res.push(["M",x,y]);}
for(var i=start,ii=pathArray.length;i<ii;i++){var r=res[i]=[],pa=pathArray[i];if(pa[0]!=pa[0].toLowerCase()){r[0]=pa[0].toLowerCase();switch(r[0]){case"a":r[1]=pa[1];r[2]=pa[2];r[3]=pa[3];r[4]=pa[4];r[5]=pa[5];r[6]=+(pa[6]-x).toFixed(3);r[7]=+(pa[7]-y).toFixed(3);break;case"v":r[1]=+(pa[1]-y).toFixed(3);break;default:for(var j=1,jj=pa.length;j<jj;j++){r[j]=+(pa[j]-((j%2)?x:y)).toFixed(3);}}}else{r=res[i]=[];for(var k=0,kk=pa.length;k<kk;k++){res[i][k]=pa[k];}}
var len=res[i].length;switch(res[i][0]){case"z":break;case"h":x+=+res[i][len-1];break;case"v":y+=+res[i][len-1];break;default:x+=+res[i][len-2];y+=+res[i][len-1];}}
res.toString=pathArray.toString;return res;},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]=["M",x,y];}
for(var i=start,ii=pathArray.length;i<ii;i++){var r=res[i]=[],pa=pathArray[i];if(pa[0]!=(pa[0]+"").toUpperCase()){r[0]=(pa[0]+"").toUpperCase();switch(r[0]){case"A":r[1]=pa[1];r[2]=pa[2];r[3]=0;r[4]=pa[4];r[5]=pa[5];r[6]=+(pa[6]+x).toFixed(3);r[7]=+(pa[7]+y).toFixed(3);break;case"V":r[1]=+pa[1]+y;break;case"H":r[1]=+pa[1]+x;break;default:for(var j=1,jj=pa.length;j<jj;j++){r[j]=+pa[j]+((j%2)?x:y);}}}else{r=res[i]=[];for(var k=0,kk=pa.length;k<kk;k++){res[i][k]=pa[k];}}
switch(r[0]){case"Z":break;case"H":x=r[1];break;case"V":y=r[1];break;default:x=res[i][res[i].length-2];y=res[i][res[i].length-1];}}
res.toString=pathArray.toString;return res;},pecache={},pecount=[],pathEqualiser=function(path1,path2){if((path1+path2)in pecache){return pecache[path1+path2];}
var data=[pathToAbsolute(R.parsePathString(path1)),pathToAbsolute(R.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)),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)),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],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],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];}
if(pecount.length>20){delete pecache[pecount.unshift()];}
pecount.push(path1+path2);pecache[path1+path2]=data;return data;},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);}
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)]},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={},par=gradient[i].match(/^([^:]*):?([\d\.]*)/);dot.color=R.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),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);var d=(end-start)/(j-i+1);for(;i<j;i++){start+=d;grobj.dots[i].offset=start+"%";}}}
return grobj;}else{return gradient;}},getContainer=function(){var container,x,y,width,height;if(typeof arguments[0]=="string"||typeof arguments[0]=="object"){if(typeof arguments[0]=="string"){container=doc.getElementById(arguments[0]);}else{container=arguments[0];}
if(container.tagName){if(arguments[1]==null){return{container:container,width:container.style.pixelWidth||container.offsetWidth,height:container.style.pixelHeight||container.offsetHeight};}else{return{container:container,width:arguments[1],height:arguments[2]};}}}else if(typeof arguments[0]=="number"&&arguments.length>3){return{container:1,x:arguments[0],y:arguments[1],width:arguments[2],height:arguments[3]};}},plugins=function(con,add){var that=this;for(var prop in add)if(add.hasOwnProperty(prop)&&!(prop in con)){switch(typeof add[prop]){case"function":(function(f){con[prop]=con===that?f:function(){return f.apply(that,arguments);};})(add[prop]);break;case"object":con[prop]=con[prop]||{};plugins.call(this,con[prop],add[prop]);break;default:con[prop]=add[prop];break;}}};if(R.svg){R.toString=function(){return"Your browser supports SVG.\nYou are running Rapha\u00ebl "+this.version;};var pathMethods={absolutely:function(){this.isAbsolute=true;return this;},relatively:function(){this.isAbsolute=false;return this;},moveTo:function(x,y){var d=this.isAbsolute?"M":"m";d+=parseFloat(x).toFixed(3)+" "+parseFloat(y).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);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y);this.attrs.path=oldD+d;return this;},lineTo:function(x,y){this.last.x=(!this.isAbsolute*this.last.x)+parseFloat(x);this.last.y=(!this.isAbsolute*this.last.y)+parseFloat(y);var d=this.isAbsolute?"L":"l";d+=parseFloat(x).toFixed(3)+" "+parseFloat(y).toFixed(3)+" ";var oldD=this.node.getAttribute("d")||"";this.node.setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;},arcTo:function(rx,ry,large_arc_flag,sweep_flag,x,y){var d=this.isAbsolute?"A":"a";d+=[parseFloat(rx).toFixed(3),parseFloat(ry).toFixed(3),0,large_arc_flag,sweep_flag,parseFloat(x).toFixed(3),parseFloat(y).toFixed(3)].join(" ");var oldD=this[0].getAttribute("d")||"";this.node.setAttribute("d",oldD+d);this.last.x=parseFloat(x);this.last.y=parseFloat(y);this.attrs.path=oldD+d;return this;},cplineTo:function(x1,y1,w1){if(!w1){return this.lineTo(x1,y1);}else{var p={},x=parseFloat(x1),y=parseFloat(y1),w=parseFloat(w1),d=this.isAbsolute?"C":"c",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]+" ";}
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.node.getAttribute("d")||"";this.node.setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;}},curveTo:function(){var p={},d=[0,1,2,3,"s",5,"c"][arguments.length];if(this.isAbsolute){d=d.toUpperCase();}
for(var i=0,ii=arguments.length;i<ii;i++){d+=parseFloat(arguments[i]).toFixed(3)+" ";}
this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[arguments.length-2]);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[arguments.length-1]);this.last.bx=parseFloat(arguments[arguments.length-4]);this.last.by=parseFloat(arguments[arguments.length-3]);var oldD=this.node.getAttribute("d")||"";this.node.setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;},qcurveTo:function(){var p={},d=[0,1,"t",3,"q"][arguments.length];if(this.isAbsolute){d=d.toUpperCase();}
for(var i=0,ii=arguments.length;i<ii;i++){d+=parseFloat(arguments[i]).toFixed(3)+" ";}
this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[arguments.length-2]);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[arguments.length-1]);if(arguments.length!=2){this.last.qx=parseFloat(arguments[arguments.length-4]);this.last.qy=parseFloat(arguments[arguments.length-3]);}
var oldD=this.node.getAttribute("d")||"";this.node.setAttribute("d",oldD+d);this.attrs.path=oldD+d;return this;},addRoundedCorner:addRoundedCorner,andClose:function(){var oldD=this[0].getAttribute("d")||"";this[0].setAttribute("d",oldD+"Z ");this.attrs.path=oldD+"Z ";return this;}};var thePath=function(params,pathString,SVG){params=params||{};var el=doc.createElementNS(SVG.svgns,"path");if(SVG.canvas){SVG.canvas.appendChild(el);}
var p=new Element(el,SVG);p.isAbsolute=true;for(var method in pathMethods){p[method]=pathMethods[method];}
p.type="path";p.last={x:0,y:0,bx:0,by:0};if(pathString){p.attrs.path=""+pathString;p.absolutely();paper.pathfinder(p,p.attrs.path);}
if(params){!params.gradient&&(params.fill=params.fill||"none");params.stroke=params.stroke||"#000";}else{params={fill:"none",stroke:"#000"};}
setFillAndStroke(p,params);return p;};var addGradientFill=function(o,gradient,SVG){gradient=toGradient(gradient);var el=doc.createElementNS(SVG.svgns,(gradient.type||"linear")+"Gradient");el.id="raphael-gradient-"+R.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",R.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.fill="";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.getBBox();o.pattern.setAttribute("patternTransform","translate(".concat(bbox.x,",",bbox.y,")"));}};var setFillAndStroke=function(o,params){var dasharray={"":[0],"none":[0],"-":[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]},node=o.node,attrs=o.attrs,rot=attrs.rotation,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(",");node.setAttribute("stroke-dasharray",value);}};o.rotate(0,true);for(var att in params){if(!(att in availableAttrs)){continue;}
var value=params[att];attrs[att]=value;switch(att){case"href":case"title":case"target":var pn=node.parentNode;if(pn.tagName.toLowerCase()!="a"){var hl=doc.createElementNS(o.paper.svgns,"a");pn.insertBefore(hl,node);hl.appendChild(node);pn=hl;}
pn.setAttributeNS(o.paper.xlink,att,value);break;case"path":if(o.type=="path"){node.setAttribute("d","M0,0");paper.pathfinder(o,value);}
case"width":node.setAttribute(att,value);if(attrs.fx){att="x";value=attrs.x;}else{break;}
case"x":if(attrs.fx){value=-attrs.x-(attrs.width||0);}
case"rx":case"cx":node.setAttribute(att,value);updatePosition(o);break;case"height":node.setAttribute(att,value);if(attrs.fy){att="y";value=attrs.y;}else{break;}
case"y":if(attrs.fy){value=-attrs.y-(attrs.height||0);}
case"ry":case"cy":node.setAttribute(att,value);updatePosition(o);break;case"r":if(o.type=="rect"){node.setAttribute("rx",value);node.setAttribute("ry",value);}else{node.setAttribute(att,value);}
break;case"src":if(o.type=="image"){node.setAttributeNS(o.paper.xlink,"href",value);}
break;case"stroke-width":node.style.strokeWidth=value;node.setAttribute(att,value);if(attrs["stroke-dasharray"]){addDashes(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,+xy[2]||null,+xy[3]||null);break;case"fill":var isURL=(value+"").match(/^url\(([^\)]+)\)$/i);if(isURL){var el=doc.createElementNS(o.paper.svgns,"pattern"),ig=doc.createElementNS(o.paper.svgns,"image");el.id="raphael-pattern-"+R.idGenerator++;el.setAttribute("x",0);el.setAttribute("y",0);el.setAttribute("patternUnits","userSpaceOnUse");ig.setAttribute("x",0);ig.setAttribute("y",0);ig.setAttributeNS(o.paper.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.paper.defs.appendChild(el);node.style.fill="url(#"+el.id+")";node.setAttribute("fill","url(#"+el.id+")");o.pattern=el;updatePosition(o);break;}
delete params.gradient;delete attrs.gradient;if(typeof attrs.opacity!="undefined"&&typeof params.opacity=="undefined"){node.style.opacity=attrs.opacity;node.setAttribute("opacity",attrs.opacity);}
if(typeof attrs["fill-opacity"]!="undefined"&&typeof params["fill-opacity"]=="undefined"){node.style.fillOpacity=o.attrs["fill-opacity"];node.setAttribute("fill-opacity",attrs["fill-opacity"]);}
case"stroke":node.style[att]=R.getRGB(value).hex;node.setAttribute(att,R.getRGB(value).hex);break;case"gradient":addGradientFill(node,value,o.paper);break;case"opacity":case"fill-opacity":if(attrs.gradient){var gradient=doc.getElementById(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();});node.style[cssrule]=value;node.setAttribute(att,value);break;}}
tuneText(o,params);o.rotate(attrs.rotation,true);};var leading=1.2;var tuneText=function(el,params){if(el.type!="text"||!("text"in params||"font"in params||"font-size"in params||"x"in params||"y"in params)){return;}
var a=el.attrs,node=el.node,fontSize=node.firstChild?parseInt(doc.defaultView.getComputedStyle(node.firstChild,"").getPropertyValue("font-size"),10):10;if("text"in params){while(node.firstChild){node.removeChild(node.firstChild);}
var texts=(params.text+"").split("\n");for(var i=0,ii=texts.length;i<ii;i++){var tspan=doc.createElementNS(el.paper.svgns,"tspan");i&&tspan.setAttribute("dy",fontSize*leading);i&&tspan.setAttribute("x",a.x);tspan.appendChild(doc.createTextNode(texts[i]));node.appendChild(tspan);}}else{var texts=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",a.x);}}
node.setAttribute("y",a.y);var bb=el.getBBox(),dif=a.y-(bb.y+bb.height/2);dif&&node.setAttribute("y",a.y+dif);};var Element=function(node,svg){var X=0,Y=0;this[0]=node;this.node=node;this.paper=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]);cy=parseFloat(deg[2]);}
deg=parseFloat(deg[0]);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(){if(this.node.style.display=="none"){this.show();var hide=true;}
var bbox={};try{bbox=this.node.getBBox();}catch(e){}finally{bbox=bbox||{};}
if(this.type=="text"){bbox={x:bbox.x,y:Infinity,width:bbox.width,height:0};for(var i=0,ii=this.node.getNumberOfChars();i<ii;i++){var bb=this.node.getExtentOfChar(i);(bb.y<bbox.y)&&(bbox.y=bb.y);(bb.y+bb.height-bbox.y>bbox.height)&&(bbox.height=bb.y+bb.height-bbox.y);}}
hide&&this.hide();return bbox;};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&&R.isArray(arguments[0])){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){var node=element.node;node.parentNode.insertBefore(this.node,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 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(){var con=getContainer.apply(null,arguments),container=con.container,x=con.x,y=con.y,width=con.width,height=con.height;if(!container){throw new Error("SVG container not found.");}
paper.canvas=doc.createElementNS(paper.svgns,"svg");paper.canvas.setAttribute("width",width||512);paper.width=width||512;paper.canvas.setAttribute("height",height||342);paper.height=height||342;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];}}
plugins.call(container,container,R.fn);container.clear();container.raphael=R;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({"Apple Computer, Inc.":1,"Google Inc.":1}[navigator.vendor]){var rect=this.rect(-this.width,-this.height,this.width*3,this.height*3).attr({stroke:"none"});setTimeout(function(){rect.remove();});}};}
if(R.vml){R.toString=function(){return"Your browser doesn\u2019t support SVG. Assuming it is Internet Explorer and falling down to VML.\nYou are running Rapha\u00ebl "+this.version;};var pathMethods={absolutely:function(){this.isAbsolute=true;return this;},relatively:function(){this.isAbsolute=false;return this;},moveTo:function(x,y){var X=Math.round(parseFloat(x))-1,Y=Math.round(parseFloat(y))-1,d=this.isAbsolute?"m":"t";d+=X+" "+Y;this.node.path=this.Path+=d;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"M":"m")+[x,y];return this;},lineTo:function(x,y){var X=Math.round(parseFloat(x))-1,Y=Math.round(parseFloat(y))-1,d=this.isAbsolute?"l":"r";d+=X+" "+Y;this.node.path=this.Path+=d;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(x);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(y);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"L":"l")+[x,y];return this;},arcTo:function(rx,ry,large_arc_flag,sweep_flag,x2,y2){var x22=(this.isAbsolute?0:this.last.x)+parseFloat(x2)-1,y22=(this.isAbsolute?0:this.last.y)+parseFloat(y2)-1,x1=this.last.x-1,y1=this.last.y-1,x=(x1-x22)/2,y=(y1-y22)/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+x22)/2,cy=k*-ry*x/rx+(y1+y22)/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(x22),Math.round(y22)].join(", ");this.node.path=this.Path+=d;this.last.x=(this.isAbsolute?0:this.last.x)+x2;this.last.y=(this.isAbsolute?0:this.last.y)+y2;this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"A":"a")+[rx,ry,0,large_arc_flag,sweep_flag,x2,y2];return this;},cplineTo:function(x1,y1,w1){if(!w1){return this.lineTo(x1,y1);}else{var x=Math.round(parseFloat(x1))-1,y=Math.round(parseFloat(y1))-1,w=Math.round(parseFloat(w1)),d=this.isAbsolute?"c":"v",attr=[Math.round(this.last.x)-1+w,Math.round(this.last.y)-1,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;}},curveTo:function(){var d=this.isAbsolute?"c":"v";if(arguments.length==6){this.last.bx=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[2]);this.last.by=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[3]);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[4]);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[5]);d+=[Math.round(parseFloat(arguments[0]))-1,Math.round(parseFloat(arguments[1]))-1,Math.round(parseFloat(arguments[2]))-1,Math.round(parseFloat(arguments[3]))-1,Math.round(parseFloat(arguments[4]))-1,Math.round(parseFloat(arguments[5]))-1].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,by=this.last.y*2-this.last.by;this.last.bx=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[0]);this.last.by=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[1]);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(arguments[2]);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(arguments[3]);d+=[Math.round(bx)-1,Math.round(by)-1,Math.round(parseFloat(arguments[0]))-1,Math.round(parseFloat(arguments[1]))-1,Math.round(parseFloat(arguments[2]))-1,Math.round(parseFloat(arguments[3]))-1].join(" ")+" ";this.attrs.path+=(this.isAbsolute?"S":"s")+Array.prototype.splice.call(arguments,0,arguments.length);}
this.node.path=this.Path+=d;return this;},qcurveTo:function(){var lx=Math.round(this.last.x)-1,ly=Math.round(this.last.y)-1,res=[];if(arguments.length==4){this.last.qx=(!this.isAbsolute*this.last.x)+parseFloat(arguments[0]);this.last.qy=(!this.isAbsolute*this.last.y)+parseFloat(arguments[1]);this.last.x=(!this.isAbsolute*this.last.x)+parseFloat(arguments[2]);this.last.y=(!this.isAbsolute*this.last.y)+parseFloat(arguments[3]);res=[this.last.qx,this.last.qy,this.last.x,this.last.y];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*this.last.x)+parseFloat(arguments[2]);this.last.y=(!this.isAbsolute*this.last.y)+parseFloat(arguments[3]);res=[this.last.qx,this.last.qy,this.last.x,this.last.y];this.attrs.path+=(this.isAbsolute?"T":"t")+Array.prototype.splice.call(arguments,0,arguments.length);}
var d="c"+[Math.round(2/3*res[0]+1/3*lx)-1,Math.round(2/3*res[1]+1/3*ly)-1,Math.round(2/3*res[0]+1/3*res[2])-1,Math.round(2/3*res[1]+1/3*res[3])-1,Math.round(res[2])-1,Math.round(res[3])-1].join(" ")+" ";this.node.path=this.Path+=d;return this;},addRoundedCorner:addRoundedCorner,andClose:function(){this.node.path=(this.Path+="x");this.attrs.path+="z";return this;}};var thePath=function(params,pathString,VML){params=params||{};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";g.coordsize=VML.coordsize;g.coordorigin=VML.coordorigin;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);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="";for(var method in pathMethods){p[method]=pathMethods[method];}
if(pathString){p.absolutely();p.attrs.path="";paper.pathfinder(p,""+pathString);}
if(params){params.fill=params.fill||"none";params.stroke=params.stroke||"#000";}else{params={fill:"none",stroke:"#000"};}
setFillAndStroke(p,params);if(params.gradient){addGradientFill(p,params.gradient);}
p.setBox();VML.canvas.appendChild(g);return p;};var setFillAndStroke=function(o,params){var node=o.node,s=node.style,xy,res=o;o.attrs=o.attrs||{};for(var par in params){o.attrs[par]=params[par];}
params.href&&(node.href=params.href);params.title&&(node.title=params.title);params.target&&(node.target=params.target);if(params.path&&o.type=="path"){o.Path="";o.path=[];o.attrs.path="";paper.pathfinder(o,params.path);}
if(params.rotation!=null){o.rotate(params.rotation,true);}
if(params.translation){xy=(params.translation+"").split(separator);o.translate(xy[0],xy[1]);}
if(params.scale){xy=(params.scale+"").split(separator);o.scale(+xy[0]||1,+xy[1]||+xy[0]||1,+xy[2]||null,+xy[3]||null);}
if(o.type=="image"&&params.src){node.src=params.src;}
if(o.type=="image"&&params.opacity){node.filterOpacity=" progid:DXImageTransform.Microsoft.Alpha(opacity="+(params.opacity*100)+")";node.style.filter=(node.filterMatrix||"")+(node.filterOpacity||"");}
params.font&&(s.font=params.font);params["font-family"]&&(s.fontFamily='"'+params["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,"")+'"');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["fill-opacity"]||params["stroke-dasharray"]||params["stroke-miterlimit"]||params["stroke-linejoin"]||params["stroke-linecap"]){o=o.shape||node;var fill=(o.getElementsByTagName("fill")&&o.getElementsByTagName("fill")[0])||createNode("fill");if("fill-opacity"in params||"opacity"in params){var opacity=((+params["fill-opacity"]+1||2)-1)*((+params.opacity+1||2)-1);opacity<0&&(opacity=0);opacity>1&&(opacity=1);fill.opacity=opacity;}
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=R.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=R.getRGB(params.stroke).hex;}
var opacity=((+params["stroke-opacity"]+1||2)-1)*((+params.opacity+1||2)-1);opacity<0&&(opacity=0);opacity>1&&(opacity=1);stroke.opacity=opacity;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"])||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 s=paper.span.style,a=res.attrs;a.font&&(s.font=a.font);a["font-family"]&&(s.fontFamily=a["font-family"]);a["font-size"]&&(s.fontSize=a["font-size"]);a["font-weight"]&&(s.fontWeight=a["font-weight"]);a["font-style"]&&(s.fontStyle=a["font-style"]);paper.span.innerText=res.node.string;res.W=a.w=paper.span.offsetWidth;res.H=a.h=paper.span.offsetHeight;res.X=a.x;res.Y=a.y+Math.round(res.H/2);switch(a["text-anchor"]){case"start":res.node.style["v-text-align"]="left";res.bbx=Math.round(res.W/2);break;case"end":res.node.style["v-text-align"]="right";res.bbx=-Math.round(res.W/2);break;default:res.node.style["v-text-align"]="center";break;}}};var getAngle=function(a,b,c,d){var angle=Math.round(Math.atan((parseFloat(c)-parseFloat(a))/(parseFloat(d)-parseFloat(b)))*57.29)||0;if(!angle&&parseFloat(a)<parseFloat(b)){angle=180;}
angle-=180;if(angle<0){angle+=360;}
return angle;};var addGradientFill=function(o,gradient){gradient=toGradient(gradient);o.attrs=o.attrs||{};var attrs=o.attrs,fill=o.node.getElementsByTagName("fill");o.attrs.gradient=gradient;o=o.shape||o.node;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=R.getRGB(gradient.dots[0].color).hex;}
if(typeof gradient.dots[gradient.dots.length-1].color!="undefined"){fill.color2=R.getRGB(gradient.dots[gradient.dots.length-1].color).hex;}
var clrs=[];for(var i=0,ii=gradient.dots.length;i<ii;i++){if(gradient.dots[i].offset){clrs.push(gradient.dots[i].offset+" "+R.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(clrs.length){fill.colors.value=clrs.join(",");fillOpacity=typeof attrs.opacity=="undefined"?1:attrs.opacity;}else{fill.colors&&(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.paper=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+"").split(separator);if(deg.length-1){cx=parseFloat(deg[1]);cy=parseFloat(deg[2]);}
deg=parseFloat(deg[0]);if(cx!=null){this._.rt.deg=deg;}else{this._.rt.deg+=deg;}
if(cy==null){cx=null;}
this._.rt.cx=cx;this._.rt.cy=cy;this.setBox(this.attrs,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;params=params||{};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.paper.width;h=this.paper.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.paper.width;h=this.paper.height;break;}
cx=(cx==null)?x+w/2:cx;cy=(cy==null)?y+h/2:cy;var left=cx-this.paper.width/2,top=cy-this.paper.height/2;if(this.type=="path"||this.type=="text"){(gs.left!=left+"px")&&(gs.left=left+"px");(gs.top!=top+"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.left=-left+"px");(os.top!=-top+"px")&&(os.top=-top+"px");}else{(gs.left!=left+"px")&&(gs.left=left+"px");(gs.top!=top+"px")&&(gs.top=top+"px");this.X=x;this.Y=y;this.W=w;this.H=h;(gs.width!=this.paper.width+"px")&&(gs.width=this.paper.width+"px");(gs.height!=this.paper.height+"px")&&(gs.height=this.paper.height+"px");(os.left!=x-left+"px")&&(os.left=x-left+"px");(os.top!=y-top+"px")&&(os.top=y-top+"px");(os.width!=w+"px")&&(os.width=w+"px");(os.height!=h+"px")&&(os.height=h+"px");var arcsize=(+params.r||0)/(Math.min(w,h));if(this.type=="rect"&&this.arcsize!=arcsize&&(arcsize||this.arcsize)){var o=createNode(arcsize?"roundrect":"rect");o.arcsize=arcsize;this.Group.appendChild(o);this.node.parentNode.removeChild(this.node);this.node=o;this.arcsize=arcsize;setFillAndStroke(this,this.attrs);this.setBox(this.attrs);}}};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(){if(this.type=="path"){return pathDimensions(this.attr("path"));}
return{x:this.X+(this.bbx||0),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&&R.isArray(arguments[0])){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){addGradientFill(this,params.gradient);}
if(params.text&&this.type=="text"){this.node.string=params.text;}
setFillAndStroke(this,params);this.setBox(this.attrs);}
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"),gl=g.style,o=createNode("oval"),ol=o.style;gl.position="absolute";gl.left=0;gl.top=0;gl.width=vml.width+"px";gl.height=vml.height+"px";g.coordsize=vml.coordsize;g.coordorigin=vml.coordorigin;g.appendChild(o);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});vml.canvas.appendChild(g);return res;};var theRect=function(vml,x,y,w,h,r){var g=createNode("group"),gl=g.style,o=createNode(r?"roundrect":"rect"),arcsize=(+r||0)/(Math.min(w,h));o.arcsize=arcsize;gl.position="absolute";gl.left=0;gl.top=0;gl.width=vml.width+"px";gl.height=vml.height+"px";g.coordsize=vml.coordsize;g.coordorigin=vml.coordorigin;g.appendChild(o);var res=new Element(o,g,vml);res.type="rect";setFillAndStroke(res,{stroke:"#000"});res.arcsize=arcsize;res.setBox({x:x,y:y,width:w,height:h,r:+r});vml.canvas.appendChild(g);return res;};var theEllipse=function(vml,x,y,rx,ry){var g=createNode("group"),gl=g.style,o=createNode("oval"),ol=o.style;gl.position="absolute";gl.left=0;gl.top=0;gl.width=vml.width+"px";gl.height=vml.height+"px";g.coordsize=vml.coordsize;g.coordorigin=vml.coordorigin;g.appendChild(o);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});vml.canvas.appendChild(g);return res;};var theImage=function(vml,src,x,y,w,h){var g=createNode("group"),gl=g.style,o=createNode("image"),ol=o.style;gl.position="absolute";gl.left=0;gl.top=0;gl.width=vml.width+"px";gl.height=vml.height+"px";g.coordsize=vml.coordsize;g.coordorigin=vml.coordorigin;o.src=src;g.appendChild(o);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});vml.canvas.appendChild(g);return res;};var theText=function(vml,x,y,text){var g=createNode("group"),gs=g.style,el=createNode("shape"),ol=el.style,path=createNode("path"),ps=path.style,o=createNode("textpath");gs.position="absolute";gs.left=0;gs.top=0;gs.width=vml.width+"px";gs.height=vml.height+"px";g.coordsize=vml.coordsize;g.coordorigin=vml.coordorigin;path.v=["m",Math.round(x),", ",Math.round(y),"l",Math.round(x)+1,", ",Math.round(y)].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;o.string=text;o.on=true;el.appendChild(o);el.appendChild(path);g.appendChild(el);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"});res.setBox();vml.canvas.appendChild(g);return res;};var setSize=function(width,height){var cs=this.canvas.style;this.width=width||this.width;this.height=height||this.height;cs.width=this.width+"px";cs.height=this.height+"px";cs.clip="rect(0 "+this.width+"px "+this.height+"px 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 con=getContainer.apply(null,arguments),container=con.container,x=con.x,y=con.y,width=con.width,s,height=con.height;if(!container){throw new Error("VML container not found.");}
var c=paper.canvas=doc.createElement("div"),cs=c.style;width=parseFloat(width)||"512px";height=parseFloat(height)||"342px";paper.width=width;paper.height=height;paper.coordsize=width+" "+height;paper.coordorigin="0 0";paper.span=doc.createElement("span");s=paper.span.style;c.appendChild(paper.span);s.position="absolute";s.left="-99999px";s.top="-99999px";s.padding=0;s.margin=0;s.lineHeight=1;s.display="inline";cs.width=width+"px";cs.height=height+"px";cs.position="absolute";cs.clip="rect(0 "+width+"px "+height+"px 0)";if(container==1){doc.body.appendChild(c);cs.left=x+"px";cs.top=y+"px";container={style:{width:width,height:height}};}else{container.style.width=width;container.style.height=height;if(container.firstChild){container.insertBefore(c,container.firstChild);}else{container.appendChild(c);}}
for(var prop in paper){container[prop]=paper[prop];}
plugins.call(container,container,R.fn);container.clear=function(){while(c.firstChild){c.removeChild(c.firstChild);}};container.raphael=R;return container;};paper.remove=function(){this.canvas.parentNode.removeChild(this.canvas);};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.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]);path[i].unshift(b);}};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,cx,cy){if(x==null&&y==null){return{x:this._.sx,y:this._.sy,toString:function(){return this.x.toFixed(3)+" "+this.y.toFixed(3);}};}
y=y||x;!+y&&(y=x);var dx,dy,dcx,dcy,a=this.attrs;if(x!=0){var bb=this.type=="path"?pathDimensions(a.path):this.getBBox(),rcx=bb.x+bb.width/2,rcy=bb.y+bb.height/2,kx=x/this._.sx,ky=y/this._.sy;cx=(+cx||cx==0)?cx:rcx;cy=(+cy||cy==0)?cy:rcy;var dirx=Math.round(x/Math.abs(x)),diry=Math.round(y/Math.abs(y)),s=this.node.style,ncx=cx+(rcx-cx)*dirx*kx,ncy=cy+(rcy-cy)*diry*ky;switch(this.type){case"rect":case"image":var neww=a.width*dirx*kx,newh=a.height*diry*ky,newx=ncx-neww/2,newy=ncy-newh/2;this.attr({width:neww,height:newh,x:newx,y:newy});break;case"circle":case"ellipse":this.attr({rx:a.rx*kx,ry:a.ry*ky,r:a.r*kx,cx:ncx,cy:ncy});break;case"path":var path=pathToRelative(a.path),skip=true;for(var i=0,ii=path.length;i<ii;i++){var p=path[i];if(p[0].toUpperCase()=="M"&&skip){continue;}else{skip=false;}
if(R.svg&&p[0].toUpperCase()=="A"){p[path[i].length-2]*=kx;p[path[i].length-1]*=ky;p[1]*=kx;p[2]*=ky;p[5]=+(dirx+diry?!!+p[5]:!+p[5]);}else{for(var j=1,jj=p.length;j<jj;j++){p[j]*=(j%2)?kx:ky;}}}
var dim2=pathDimensions(path),dx=ncx-dim2.x-dim2.width/2,dy=ncy-dim2.y-dim2.height/2;path=pathToRelative(path);path[0][1]+=dx;path[0][2]+=dy;this.attr({path:path.join(" ")});break;}
if(this.type in{text:1,image:1}&&(dirx!=1||diry!=1)){if(this.transformations){this.transformations[2]="scale(".concat(dirx,",",diry,")");this.node.setAttribute("transform",this.transformations.join(" "));dx=(dirx==-1)?-a.x-(neww||0):a.x;dy=(diry==-1)?-a.y-(newh||0):a.y;this.attr({x:dx,y:dy});a.fx=dirx-1;a.fy=diry-1;}else{this.node.filterMatrix=" progid:DXImageTransform.Microsoft.Matrix(M11=".concat(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(" "));a.fx=0;a.fy=0;}else{this.node.filterMatrix="";s.filter=(this.node.filterMatrix||"")+(this.node.filterOpacity||"");}}
a.scale=[x,y,cx,cy].join(" ");this._.sx=x;this._.sy=y;}
return this;};R.easing_formulas={linear:function(n){return n;},"<":function(n){return Math.pow(n,3);},">":function(n){return Math.pow(n-1,3)+1;},"<>":function(n){n=n*2;if(n<1){return Math.pow(n,3)/2;}
n-=2;return(Math.pow(n,3)+2)/2;},backIn:function(n){var s=1.70158;return Math.pow(n,2)*((s+1)*n-s);},backOut:function(n){n=n-1;var s=1.70158;return Math.pow(n,2)*((s+1)*n+s)+1;},elastic:function(n){if(n==0||n==1){return n;}
var p=.3,s=p/4;return Math.pow(2,-10*n)*Math.sin((n-s)*(2*Math.PI)/p)+1;},bounce:function(n){var s=7.5625,p=2.75,l;if(n<(1/p)){l=s*Math.pow(n,2);}else{if(n<(2/p)){n-=(1.5/p);l=s*Math.pow(n,2)+.75;}else{if(n<(2.5/p)){n-=(2.25/p);l=s*Math.pow(n,2)+.9375;}else{n-=(2.625/p);l=s*Math.pow(n,2)+.984375;}}}
return l;}};R.easing=function(easing,n){return R.easing_formulas[easing]?R.easing_formulas[easing](n):n;};Element.prototype.animate=function(params,ms,easing,callback){clearTimeout(this.animation_in_progress);if(typeof easing=="function"||!easing){callback=easing||null;easing="linear";}
var from={},to={},diff={},t={x:0,y:0};for(var attr in params){if(attr in availableAnimAttrs){from[attr]=this.attr(attr);(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]=R.getRGB(from[attr]);var toColour=R.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]+"").split(separator),from2=(from[attr]+"").split(separator);switch(attr){case"translation":from[attr]=[0,0];diff[attr]=[values[0]/ms,values[1]/ms];break;case"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];break;case"scale":params[attr]=values;from[attr]=(from[attr]+"").split(separator);diff[attr]=[(values[0]-from[attr][0])/ms,(values[1]-from[attr][1])/ms,0,0];}
to[attr]=values;}}}
var start=+new Date,prev=0,that=this;(function tick(){var time=new Date-start,set={},now;if(time<ms){pos=R.easing(easing,time/ms);for(var attr in from){switch(availableAnimAttrs[attr]){case"number":now=+from[attr]+pos*ms*diff[attr];break;case"colour":now="rgb("+[Math.round(from[attr].r+pos*ms*diff[attr].r),Math.round(from[attr].g+pos*ms*diff[attr].g),Math.round(from[attr].b+pos*ms*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]+pos*ms*diff[attr][i][j];}
now[i]=now[i].join(" ");}
now=now.join(" ");break;case"csv":switch(attr){case"translation":var x=diff[attr][0]*(time-prev),y=diff[attr][1]*(time-prev);t.x+=x;t.y+=y;now=[x,y].join(" ");break;case"rotation":now=+from[attr][0]+pos*ms*diff[attr][0];from[attr][1]&&(now+=","+from[attr][1]+","+from[attr][2]);break;case"scale":now=[+from[attr][0]+pos*ms*diff[attr][0],+from[attr][1]+pos*ms*diff[attr][1],(2 in params[attr]?params[attr][2]:""),(3 in params[attr]?params[attr][3]:"")].join(" ");}
break;}
if(attr=="font-size"){set[attr]=now+"px";}else{set[attr]=now;}}
that.attr(set);that.animation_in_progress=setTimeout(tick);R.svg&&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:+x+this.attrs.cx,cy:+y+this.attrs.cy});break;case"rect":case"image":case"text":this.attr({x:+x+this.attrs.x,y:+y+this.attrs.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(items){this.items=[];this.length=0;if(items){for(var i=0,ii=items.length;i<ii;i++){if(items[i]&&(items[i].constructor==Element||items[i].constructor==Set)){this[this.items.length]=this.items[this.items.length]=items[i];this.length++;}}}};Set.prototype.push=function(){var item,len;for(var i=0,ii=arguments.length;i<ii;i++){item=arguments[i];if(item&&(item.constructor==Element||item.constructor==Set)){len=this.items.length;this[len]=this.items[len]=item;this.length++;}}
return this;};Set.prototype.pop=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=0,ii=this.items.length;i<ii;i++){this.items[i][methodname].apply(this.items[i],arguments);}
return this;};})(method);}
Set.prototype.attr=function(name,value){if(name&&R.isArray(name)&&typeof name[0]=="object"){for(var j=0,jj=name.length;j<jj;j++){this.items[j].attr(name[j]);}}else{for(var i=0,ii=this.items.length;i<ii;i++){this.items[i].attr.apply(this.items[i],arguments);}}
return this;};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};};R.registerFont=function(font){if(!font.face){return font;}
this.fonts=this.fonts||{};var fontcopy={w:font.w,face:{},glyphs:{}},family=font.face["font-family"];for(var prop in font.face){fontcopy.face[prop]=font.face[prop];}
if(this.fonts[family]){this.fonts[family].push(fontcopy);}else{this.fonts[family]=[fontcopy];}
if(!font.svg){fontcopy.face["units-per-em"]=parseInt(font.face["units-per-em"],10);for(var glyph in font.glyphs){var path=font.glyphs[glyph];fontcopy.glyphs[glyph]={w:path.w,k:{},d:path.d&&"M"+path.d.replace(/[mlcxtrv]/g,function(command){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[command]||"M";})+"z"};if(path.k){for(var k in path.k){fontcopy.glyphs[glyph].k[k]=path.k[k];}}}}
return font;};paper.getFont=function(family,weight,style,stretch){stretch=stretch||"normal";style=style||"normal";weight=+weight||{normal:400,bold:700,lighter:300,bolder:800}[weight]||400;var font=R.fonts[family];if(!font){var name=new RegExp("(^|\\s)"+family.replace(/[^\w\d\s+!~.:_-]/g,"")+"(\\s|$)","i");for(var fontName in R.fonts){if(name.test(fontName)){font=R.fonts[fontName];break;}}}
var thefont;if(font){for(var i=0,ii=font.length;i<ii;i++){thefont=font[i];if(thefont.face["font-weight"]==weight&&(thefont.face["font-style"]==style||!thefont.face["font-style"])&&thefont.face["font-stretch"]==stretch){break;}}}
return thefont;};paper.print=function(x,y,string,font,size){var out=this.set(),letters=(string+"").split(""),shift=0,path="",scale;if(font){scale=(size||16)/font.face["units-per-em"];for(var i=0,ii=letters.length;i<ii;i++){var prev=i&&font.glyphs[letters[i-1]]||{},curr=font.glyphs[letters[i]];shift+=i?(prev.w||font.w)+(prev.k&&prev.k[letters[i]]||0):0;curr&&curr.d&&out.push(this.path({fill:"#000",stroke:"none"},curr.d).translate(shift,0));}
out.scale(scale,scale,0,y).translate(x,(size||16)/2);}
return out;};R.ninja=function(){var r=window.Raphael;if(oldRaphael.was){window.Raphael=oldRaphael.is;}else{try{delete window.Raphael;}catch(e){window.Raphael=void(0);}}
return r;};R.el=Element.prototype;return R;})();var MediaIframe={initialize:function(pageUrl){$("a#sharemail-trigger").click(function(){return Evri.ShareMail.instantiate({pageURL:pageUrl});});$('.dropdown-trigger').each(function(index,item){var $item=$(item);var $list=$item.find('.dropdown-list');if($list.children().length>0){$list.css('left',$item.offset().left).shimWithIframe();$item.click(function(event){$item.addClass('selected');$.maskScreen();$(".evri-frame").maskItem();$list.showDropdownList();});}else{$item.css("cursor","default");}});$(document).bind('unmask.screen',function(){$('.dropdown-trigger.selected').removeClass('selected').find('.dropdown-list').hideDropdownList();});}};(function($){$.fn.sparkline=function(uservalues,options){var options=$.extend({lineColor:'#00f',fillColor:'#cdf',width:600,height:400,barSpacing:2,barWidth:4,xOffset:0,yOffset:0},options?options:{});return this.each(function(){var values=(uservalues=='html'||uservalues==undefined)?$(this).text().split(','):uservalues;values=$.map(values,Number);options.width=options.width-options.xOffset;options.height=options.height-options.yOffset;$(this).text('');var canvas=Raphael(this,options.width,options.height);if(options.moreInit)options.moreInit(canvas);var max=Math.max.apply(Math,values);var min=Math.min.apply(Math,values);var range=max-min+1;$.each(values,function(i,e){var height=Math.round(canvas.height*((e-min)/range))+1;var x=i*(options.barWidth+options.barSpacing)+options.xOffset;var y=canvas.height-height+options.yOffset;var rect=canvas.rect(x,y,options.barWidth,height);var width=options.barWidth;rect.attr({fill:options.fillColor,stroke:options.lineColor});rect.x=function(){return x;};rect.y=function(){return y;};rect.width=function(){return width;};rect.height=function(){return height;};if(options.initBar){options.initBar(rect,canvas,i,e);}});});};})(jQuery);if(window.Evri==undefined)window.Evri={};Evri.MILLIS_PER_SECOND=1000;Evri.MILLIS_PER_MINUTE=Evri.MILLIS_PER_SECOND*60;Evri.MILLIS_PER_HOUR=Evri.MILLIS_PER_MINUTE*60;Evri.MILLIS_PER_DAY=Evri.MILLIS_PER_HOUR*24;Evri.MILLIS_PER_WEEK=Evri.MILLIS_PER_DAY*7;Evri.MILLIS_PER_MONTH=Evri.MILLIS_PER_DAY*30;Evri.MILLIS_PER_YEAR=Evri.MILLIS_PER_DAY*365;Evri.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"];Evri.Class={create:function(name){this.name=name;function klass(){this.initialize.apply(this,arguments);}
return klass;}};Evri.EventDispatcher={buildHandlersMap:function(){if(!this.handlers){this.handlers={};}},addEventHandler:function(type,handler){if(!handler instanceof Function){throw new Error("handler must be a Function");}
this.buildHandlersMap();if(!this.handlers[type]){this.handlers[type]=[handler];}else{this.handlers[type].push(handler);}},dispatchEvent:function(type,args){this.buildHandlersMap();if(!this.hasEventHandler(type)){return false;}
var n=this.handlers[type].length;for(var i=0;i<n;i++){this.handlers[type][i].call(null,args);}},hasEventHandler:function(type){return(typeof this.handlers[type]!="undefined");},removeEventHandler:function(type,handler){this.buildHandlersMap();if(!this.hasEventHandler(type)){return false;}
var n=this.handlers[type].length;for(var i=0;i<n;i++){if(this.handlers[type][i]===handler){this.handlers[type].slice(i,1);}}},mixin:function(subject){for(var p in Evri.EventDispatcher){if(p=="mixin"){continue;}
subject[p]=Evri.EventDispatcher[p];}}};Evri.Util={dateToString:function(date){return Evri.MONTH_NAMES[date.getMonth()]+" "+date.getDate()+", "+date.getFullYear();},dateAgoToString:function(date){if(date.constructor!=Date){throw new Error("Date object is required");}
var string="some";var now=new Date();var delta=Math.round(now.getTime()-date.getTime());var isPast=delta>0;delta=Math.abs(delta);if(delta==0){return"now";}else if(delta>0&&delta<5*Evri.MILLIS_PER_SECOND){return isPast?"less than 5 seconds ago":"less than 5 seconds from now";}else if(delta>=5*Evri.MILLIS_PER_SECOND&&delta<10*Evri.MILLIS_PER_SECOND){return isPast?"less than 10 seconds ago":"less than 10 seconds from now";}else if(delta>=10*Evri.MILLIS_PER_SECOND&&delta<20*Evri.MILLIS_PER_SECOND){return isPast?"less than 20 seconds ago":"less than 20 seconds from now";}else if(delta>=20*Evri.MILLIS_PER_SECOND&&delta<40*Evri.MILLIS_PER_SECOND){return isPast?"half a minute ago":"half a minute from now";}else if(delta>=40*Evri.MILLIS_PER_SECOND&&delta<Evri.MILLIS_PER_MINUTE){return isPast?"less than a minute ago":"less than a minute from now";}else if(delta==Evri.MILLIS_PER_MINUTE){return isPast?"1 minute ago":"1 minute from now";}else if(delta>=Evri.MILLIS_PER_MINUTE&&delta<45*Evri.MILLIS_PER_MINUTE){string=Math.round(delta/Evri.MILLIS_PER_MINUTE).toString();return isPast?string+" minutes ago":string+" minutes from now";}else if(delta>=45*Evri.MILLIS_PER_MINUTE&&delta<90*Evri.MILLIS_PER_MINUTE){return isPast?"about an hour ago":"about an hour from now";}else if(delta>=90*Evri.MILLIS_PER_MINUTE&&delta<Evri.MILLIS_PER_DAY){string=Math.round(delta/Evri.MILLIS_PER_HOUR).toString();return isPast?string+" hours ago":string+" hours from now";}else if(delta>=Evri.MILLIS_PER_DAY&&delta<2*Evri.MILLIS_PER_DAY){return isPast?"1 day ago":"1 day from now";}else if(delta>=2*Evri.MILLIS_PER_DAY&&delta<Evri.MILLIS_PER_MONTH){string=Math.round(delta/Evri.MILLIS_PER_DAY).toString();return isPast?string+" days ago":string+" days from now";}else if(delta>=Evri.MILLIS_PER_MONTH&&delta<2*Evri.MILLIS_PER_MONTH){return isPast?"about 1 month ago":"about 1 month from now";}else if(delta>=2*Evri.MILLIS_PER_MONTH&&delta<Evri.MILLIS_PER_YEAR){string=Math.round(delta/Evri.MILLIS_PER_MONTH).toString();return isPast?string+" months ago":string+" months from now";}else if(delta>=Evri.MILLIS_PER_HOUR&&delta<2*Evri.MILLIS_PER_YEAR){return isPast?"about 1 year ago":"about 1 year from now";}else{string=Math.round(delta/Evri.MILLIS_PER_YEAR).toString();return isPast?string+" years ago":string+" years from now";}},globalToLocal:function(point,element){var localPoint={x:0,y:0};var offset=jQuery(element).offset();localPoint.x=point.x-offset.left;localPoint.y=point.y-offset.top;return localPoint;},localToGlobal:function(point,element){var globalPoint={x:0,y:0};var offset=jQuery(element).offset();globalPoint.x=point.x+offset.left;globalPoint.y=point.y+offset.top;return globalPoint;},htmlEscape:function(string){return string.toString().replace(/</,'&lt;').replace(/>/,'&gt;');},paramsToMap:function(queryString){var string=queryString.replace(/^\?/,"");var pairs=string.split("&");var params={};for(var i=0;i<pairs.length;i++){var param=pairs[i].split("=",2);params[param[0]]=param[1];}
return params;},toSentence:function(array,property){var sentence="";var items=[];if(property){var n=array.length;for(var i=0;i<n;i++){items.push(array[i][property]);}}else{items=array;}
if(items.length==1){sentence=items[0];}else if(items.length==2){sentence=items.join(" and ");}else if(items.length>2){var last=items.pop();sentence=items.join(", ")+", and "+last;}
return sentence;}};if(window.Evri==undefined)window.Evri={};if(jQuery==undefined)throw new Error("jQuery is required");Evri.Find=Evri.Class.create("Evri.Find");Evri.Find.prototype={initialize:function(container,appId){Evri.EventDispatcher.mixin(this);Evri.Find.LOADED="loaded";Evri.Find.VIEWED="viewed";Evri.Find.ENTITY_CLICKED="entityClicked";Evri.Find.ENTITY_MOUSE_OVER="entityMouseOver";Evri.Find.ENTITY_MOUSE_OUT="entityMouseOut";Evri.Find.SUBMIT="submit";var PROMPT_TEXT="Find\u200B";var NO_MATCH_TEXT='<strong>No matches for "${term}"</strong><em>Click to see all results.</em>';var that=this;var $container=jQuery(container).removeClass("truncated").append("<ol/>");var $query=$container.find("input[type='text']").val(PROMPT_TEXT).addClass("prompt").removeAttr("disabled");var $results=$container.find("ol").addClass("results").hide().css("position","absolute");var session=new Evri.API.Session({appId:appId});var noMatchText=NO_MATCH_TEXT;var promptText=PROMPT_TEXT;var blacklist={};var cachedQuery=null;var timeoutId=NaN;var currentEntity=null;var responseCache={};$query.bind("blur",function(event){that._query_blurHandler(event);});$query.bind("focus",function(event){that._query_focusHandler(event);});$query.bind("keydown",function(event){that._query_keyDownHandler(event);});that.getNoMatchText=function(){return noMatchText;};that.setNoMatchText=function(text){noMatchText=text;};that.getPromptText=function(){return promptText.replace("\u200B","");};that.setPromptText=function(text){var newPrompt=text+"\u200B";if($query.val()==promptText){$query.val(newPrompt);}
promptText=newPrompt;};that.setBlacklist=function(uris){if(uris.constructor!=Array){return;}
blacklist={};for(var i=0;i<uris.length;i++){blacklist[uris[i]]=true;}};that._makeRequest=function(){var query=$query.val().replace(/^[\s]+/,'');if(query.length==0){$results.fadeOut("slow");cachedQuery=null;return;}
if(cachedQuery==query){return;}
cachedQuery=query;var prefix=query.toLowerCase();if(responseCache[prefix]){that._handleResponse(responseCache[prefix]);}else{$query.addClass("loading");session.models.Entity.findByPrefix(prefix,{onComplete:function(response){responseCache[prefix]=response;that._handleResponse(response);},onFailure:function(error){alert("Error: "+error);$query.removeClass("loading");}});}};that._handleResponse=function(response){$query.removeClass("loading");var entities=[];jQuery.each(response.entities,function(index,entity){if(blacklist[entity.href]==undefined){entities.push(entity);}});that._showResults(entities);};that._showResults=function(entities){$results.empty().removeClass("empty");if(entities.length>0){jQuery.each(entities,function(index,entity){var $item=jQuery("<li><a><strong/><em/></a></li>").appendTo($results);$item.data("entity",entity);$item.find("strong").text(entity.name).addClass("truncated");$item.find("em").text(Evri.Util.toSentence(entity.facets,"name")).addClass("truncated");var $a=$item.find("a");$a.attr("href","javascript:void(0);");$a.bind("mouseenter",entity,that._entity_mouseEnterHandler);$a.bind("mouseleave",entity,that._entity_mouseLeaveHandler);$a.bind("click",entity,that._entity_clickHandler);});}else{var term=$query.val();var $empty=jQuery("<li/>").html(noMatchText.replace("${term}",Evri.Util.htmlEscape(term)));$empty.bind("click",null,that._entity_clickHandler);$results.append($empty).addClass("empty");}
$results.show(10,function(){var offset=$query.position();$results.css({left:offset.left,top:offset.top+$query.outerHeight()});$results.width($query.outerWidth()-2);$results.find("li:first").addClass("first");$results.find("li:last").addClass("last");});};that._focusOnEntity=function(jQuery){if(jQuery){var $target=that._getJQueryListItem(jQuery);$target.addClass("selected").siblings().removeClass("selected");currentEntity=$target.data("entity");}else{$results.children().removeClass("selected");currentEntity=null;}
if(currentEntity){$query.val(currentEntity.name);}else{if(cachedQuery){$query.val(cachedQuery);}else{$query.val(promptText);$query.addClass("prompt");}}};that._getJQueryListItem=function(jQuery){if(jQuery[0].nodeName.toLowerCase()=="li"){return jQuery;}else{return jQuery.parents('li:eq(0)');}};that._query_focusHandler=function(evt){$query.addClass("active");if($query.val()==promptText){$query.val("");$query.removeClass("prompt");}else{that._makeRequest();}};that._query_blurHandler=function(evt){$query.removeClass("active");$results.fadeOut("slow");$query.val(cachedQuery);if($query.val().length==0){$query.val(promptText);$query.addClass("prompt");}};that._query_keyDownHandler=function(evt){var ESCAPE=27;var DOWN_ARROW=40;var UP_ARROW=38;var ENTER=13;var TAB=9;clearTimeout(timeoutId);var $selection=$results.find("li.selected");switch(evt.keyCode){case ESCAPE:$query.val(cachedQuery);$query.blur();that._focusOnEntity(null);break;case DOWN_ARROW:if($selection.length>0){var $next=$selection.next();if($next.length>0){that._focusOnEntity($next);}}else{that._focusOnEntity($results.find("li:first"));}
break;case UP_ARROW:if($selection.length>0){if($selection.prev().length==0){that._focusOnEntity(null);}else{var $previous=$selection.prev();that._focusOnEntity($previous);}}
break;case ENTER:if(currentEntity){$query.blur();$selection.find("a").click();}else{var event={};event.type=Evri.Find.SUBMIT;event.query=$query.val();event.target=$container[0];that.dispatchEvent(event.type,event);}
evt.preventDefault();break;case TAB:return true;default:timeoutId=setTimeout(that._makeRequest,250);return true;}
return false;};that._entity_clickHandler=function(evt){var event={};if(evt.data){var $target=that._getJQueryListItem(jQuery(evt.target));event.type=Evri.Find.ENTITY_CLICKED;event.target=$target.find("a")[0];event.entity=evt.data;}else{event.type=Evri.Find.SUBMIT;event.query=$query.val();event.target=$container[0];}
that.dispatchEvent(event.type,event);};that._entity_mouseEnterHandler=function(evt){var $target=that._getJQueryListItem(jQuery(evt.target));that._focusOnEntity($target);var event={};event.type=Evri.Find.ENTITY_MOUSE_OVER;event.target=$target.find("a")[0];event.entity=evt.data;that.dispatchEvent(event.type,event);};that._entity_mouseLeaveHandler=function(evt){var $target=that._getJQueryListItem(jQuery(evt.target));$target.removeClass("selected");var event={};event.type=Evri.Find.ENTITY_MOUSE_OUT;event.target=$target.find("a")[0];event.entity=evt.data;that.dispatchEvent(event.type,event);};}};if(window.Evri==undefined)window.Evri={};if(window.jQuery==undefined)throw new Error("jQuery is required");if(window.Raphael==undefined)throw new Error("Rapha\u00ebl is required");Evri.Trends=Evri.Class.create("Evri.Trends");Evri.Trends.prototype={initialize:function(container,appId){Evri.EventDispatcher.mixin(this);Evri.Trends.LOADED="loaded";Evri.Trends.VIEWED="viewed";Evri.Trends.CHART_ITEM_CLICKED="chartItemClicked";Evri.Trends.CHART_ITEM_MOUSE_OVER="chartItemMouseOver";Evri.Trends.CHART_ITEM_MOUSE_OUT="chartItemMouseOut";Evri.Trends.ARTICLE_CLICKED="articleClicked";Evri.Trends.ARTICLE_MOUSE_OVER="articleMouseOver";Evri.Trends.ARTICLE_MOUSE_OUT="articleMouseOut";var BAR_SPACING=2;var BAR_STYLE={fill:"#CCCCCC",stroke:"#CCCCCC","stroke-width":1};var BAR_HOVER_STYLE={fill:"#2B6CD5",stroke:"#2B6CD5","stroke-width":1};var ICON_PREFIX="http://www.google.com/s2/favicons?domain=";var that=this;var $container=jQuery(container).removeClass("truncated").css("position","relative");var session=new Evri.API.Session({appId:appId});var entity=null;var paper=null;var barElements=null;var pointerDimension;that.render=function(entityUri){that._setAxisLabel.apply(that,["Loading&hellip;"]);session.models.Entity.findByResource(entityUri,{onComplete:function(response){entity=response;entity.getMentionStatistics({onComplete:function(response){that._draw(response.mentions);},onFailure:function(error){alert("Error: "+error);that._setAxisLabel.apply(that,["Error retrieving trend"]);}});},onFailure:function(error){alert("Error: "+error);that._setAxisLabel.apply(that,["Error retrieving trends"]);}});};that._reset=function(){that._setAxisLabel.apply(that,[""]);if(paper){paper.remove();}
paper=new Raphael($container[0],$container.width(),$container.height());$container.siblings(".caption").show();$container.siblings(".media").hide();barElements=paper.set();};that._draw=function(mentions){that._reset();var values=jQuery.map(mentions,function(item){return item.count;});var maxValue=Math.max.apply(Math,values);var minValue=Math.min.apply(Math,values);var range=maxValue-minValue;var count=values.length;var space=paper.width-(BAR_SPACING*(count-1));var barWidth=Math.floor(space/count);pointerDimension=Math.floor(barWidth/2);var totalHeight=paper.height-pointerDimension;var startX=0;var startY=0;var height=0;for(var i=0;i<values.length;i++){var mention=mentions[i];height=Math.round(totalHeight*((values[i]-minValue)/range))+1;startX=(i*barWidth)+(i*BAR_SPACING);startY=totalHeight-height+pointerDimension;barElements.push(that._drawBar(startX,startY,barWidth,height,mention));}
barElements.attr(BAR_STYLE);var label="Mentions in the last "+mentions.length+" days";that._setAxisLabel.apply(that,[label]);};that._drawBar=function(x,y,width,height,mention){var target=paper.rect(x,pointerDimension-1,width,paper.height);target.attr(BAR_STYLE).attr("opacity",0.001);var $target=jQuery(target.node);$target.css("cursor","pointer");var bar=paper.rect(x,y,width,height);var $bar=jQuery(bar.node);$bar.css("cursor","pointer");$bar.data("mention",mention);var click=function(e){that._bar_clickHandler.apply(that,[e,mention]);that._showArticles(mention);};$target.bind("click",click);$bar.bind("click",click);var mouseover=function(e){bar.attr(BAR_HOVER_STYLE);target.attr("opacity",0.5);that._showDataTip.apply(that,[bar,mention]);that._bar_mouseOverHandler.apply(that,[e,mention]);};$target.bind("mouseover",mouseover);$bar.bind("mouseover",mouseover);var mouseout=function(e){bar.attr(BAR_STYLE);target.attr("opacity",0.001);that._hideDataTip.apply(that);that._bar_mouseOutHandler.apply(that,[e,mention]);};$target.bind("mouseout",mouseout);$bar.bind("mouseout",mouseout);return bar;};that._setAxisLabel=function(string){var $axisLabel=$container.siblings(".caption");if($axisLabel.length==0){$axisLabel=jQuery("<p/>").addClass("caption");$container.after($axisLabel);}
$axisLabel.html(string);};that._showDataTip=function(bar,mention){var x=bar.attr("x")+pointerDimension;var y=bar.attr("y")+1;var $dataTip=$container.find("#dataTip");if($dataTip.length==0){$dataTip=jQuery("<div id='dataTip'/>").hide();$dataTip.css("position","absolute");$container.append($dataTip);}
var dateString=Evri.Util.dateToString(mention.date);if($dataTip.text==dateString){return;}
$dataTip.text(dateString);$dataTip.show();var point={x:x,y:y};point.x-=$dataTip.outerWidth()/2;$dataTip.css({left:point.x,top:0-$dataTip.outerHeight()});$dataTip.bind("click",function(e){that._bar_clickHandler(e,mention);that._showArticles(mention);});$dataTip.bind("mouseout",function(){$dataTip.hide();});$dataTip.bind("mousemove",function(e){if(!document.elementFromPoint)return;$dataTip.hide();var $bar=jQuery(document.elementFromPoint(e.pageX,e.pageY));if($bar.data("mention")==mention){$dataTip.show();}});};that._hideDataTip=function(){$container.find("#dataTip").hide();};that._showArticles=function(mention){var $viewer=that._getArticleViewer();$viewer.slideDown();$viewer.addClass("loading");var $header=$viewer.find(".header");$header.text("Headlines for "+Evri.Util.dateToString(mention.date));var $menu=$viewer.find(".menu");$menu.html("&#215;");$menu.bind("click",function(){$viewer.slideUp();});var year=mention.date.getFullYear().toString();var month=mention.date.getMonth()+1;month=month<10?"0"+month:month;var date=mention.date.getDate();date=date<10?"0"+date:date;if(mention.count>0){var options={};options.includeDates=year+month+date;options.includeMatchedLocations=true;entity.media.getArticles({onComplete:function(response){that._buildArticles(response.articles,$viewer);}},options);}else{setTimeout(that._buildArticles,250,[],$viewer);}};that._getArticleViewer=function(){var $viewer=$container.siblings(".media");if($viewer.length==0){$viewer=jQuery("<div/>").addClass("media").hide();$viewer.append("<p class='header'/><a class='menu'/><ul class='articles'/>");$container.after($viewer);}
return $viewer;};that._buildArticles=function(articles,$viewer){var $list=$viewer.find(".articles").empty();if(articles.length==0){$list.append("<li class='empty'>No articles</li>");}else{jQuery.each(articles,function(index,article){var $item=jQuery("<li/>").addClass("article");var icon=jQuery("<img/>").attr("src",ICON_PREFIX+article.link.hostName);var author=article.author;$item.append(jQuery("<cite/>").addClass("byline").append(icon).append(author));var title=that._buildTitle(article);$item.append(jQuery("<p/>").addClass("title").html(title));$item.bind("click",function(e){that._article_clickHandler.apply(that,[e,article]);});$list.bind("mouseover",function(e){that._article_mouseOverHandler.apply(that,[e,article]);});$list.bind("mouseout",function(e){that._article_mouseOutHandler.apply(that,[e,article]);});$list.append($item);});}
$viewer.removeClass("loading");$list.scrollTop(0);};that._buildTitle=function(article){var title="";var index=0;var locations=article.titleQueryMatches;for(var i=0;i<locations.length;i++){var match=locations[i];var start=match.start;var end=match.end+1;if(start>index){title+=article.title.substr(index,(start-index));}
title+="<strong>"+article.title.substr(start,end-start)+"</strong>";index=end;}
if(index<article.title.length){title+=article.title.substr(index);}
return title;};that._buildEvent=function(type,mouseEvent){var event={};event.type=type;event.target=mouseEvent.target;var point=Evri.Util.globalToLocal({x:mouseEvent.pageX,y:mouseEvent.pageY},$container[0]);event.mouseX=point.x;event.mouseY=point.y;event.pageX=mouseEvent.pageX;event.pageY=mouseEvent.pageY;return event;};that._bar_clickHandler=function(mouseEvent,mention){var event=that._buildEvent(Evri.Trends.CHART_ITEM_CLICKED,mouseEvent);event.mention=mention;that.dispatchEvent(event.type,event);};that._bar_mouseOverHandler=function(mouseEvent,mention){var event=that._buildEvent(Evri.Trends.CHART_ITEM_MOUSE_OVER,mouseEvent);event.mention=mention;that.dispatchEvent(event.type,event);};that._bar_mouseOutHandler=function(mouseEvent,mention){var event=that._buildEvent(Evri.Trends.CHART_ITEM_MOUSE_OUT,mouseEvent);event.mention=mention;that.dispatchEvent(event.type,event);};that._article_clickHandler=function(mouseEvent,article){var event=that._buildEvent(Evri.Trends.ARTICLE_CLICKED,mouseEvent);event.article=article;that.dispatchEvent(event.type,event);};that._article_mouseOverHandler=function(mouseEvent,article){var event=that._buildEvent(Evri.Trends.ARTICLE_MOUSE_OVER,mouseEvent);event.article=article;that.dispatchEvent(event.type,event);};that._article_mouseOutHandler=function(mouseEvent,article){var event=that._buildEvent(Evri.Trends.ARTICLE_MOUSE_OUT,mouseEvent);event.article=article;that.dispatchEvent(event.type,event);};}};if(window.Evri==undefined)window.Evri={};if(window.jQuery==undefined)throw new Error("jQuery is required");if(window.Raphael==undefined)throw new Error("Rapha\u00ebl is required");Evri.Visualization=Evri.Class.create("Evri.Visualization");Evri.Visualization.prototype={initialize:function(container,appId){Evri.EventDispatcher.mixin(this);Evri.Visualization.LOADED="loaded";Evri.Visualization.VIEWED="viewed";Evri.Visualization.RENDERED="rendered";Evri.Visualization.GRAPH_ITEM_CLICKED="itemClicked";Evri.Visualization.GRAPH_ITEM_MOUSE_OVER="itemMouseOver";Evri.Visualization.GRAPH_ITEM_MOUSE_OUT="itemMouseOut";var SVG_PATH_STRING="M{0},{1} L{2},{3}";var ENTITY_RADIUS=30;var RELATED_ENTITY_RADIUS=20;var MAX_LABEL_WIDTH=75;var EDGE_STYLE={stroke:"#FCA240","stroke-width":4};var ENTITY_NODE_STYLES={ORGANIZATION:{stroke:"#EB122F",fill:"#FFC4CC"},PRODUCT:{stroke:"#A56ECA",fill:"#E8C5FF"},PERSON:{stroke:"#B1D535",fill:"#E9FF9F"},LOCATION:{stroke:"#7BC2FF",fill:"#BDE0FF"},EVENT:{stroke:"#48628E",fill:"#C0D7FF"},CONCEPT:{stroke:"#F6EAA7",fill:"#FFF9D6"},OTHER:{stroke:"#B1B1B1",fill:"#CCCCCC"}};var that=this;var $container=jQuery(container).removeClass("truncated").css("position","relative");var session=new Evri.API.Session({appId:appId});var paper=null;var relatedElements=null;that.render=function(entityUri,referringEntityUri){var pending=1;var entity=null;var referringEntity=null;var relatedEntities=[];if(referringEntityUri){pending++;session.models.Entity.findByResource(referringEntityUri,{onComplete:function(response){referringEntity=response;if(!--pending){that._draw(entity,referringEntity,relatedEntities);}},onFailure:function(error){alert("Error: "+error);if(!--pending){that._draw(entity,referringEntity,relatedEntities);}}});}
session.models.Entity.findByResource(entityUri,{onComplete:function(response){entity=response;entity.getTopRelationsTargets({onComplete:function(targetList){var n=targetList.targets.length;for(var i=0;i<n&&relatedEntities.length<5;i++){var target=targetList.targets[i].entity;if(target.href.match(/-0x[a-f0-9]+$/i)){relatedEntities.push(target);}}
if(!--pending){that._draw(entity,referringEntity,relatedEntities);}},onFailure:function(error){alert("Error: "+error);if(!--pending){that._draw(entity,referringEntity,relatedEntities);}}},{count:10});},onFailure:function(error){alert("Error: "+error);}});};that._reset=function(){$container.find(".label").remove();if(paper){paper.remove();}
paper=new Raphael($container[0],$container.width(),$container.height());relatedElements=paper.set();};that._draw=function(entity,referringEntity,relatedEntities){that._reset();var centerPoint={x:paper.width/2,y:paper.height/2};var x=0;var y=0;var r=0;if(referringEntity){x=centerPoint.x/3;y=centerPoint.y;r=RELATED_ENTITY_RADIUS;paper.path(SVG_PATH_STRING,x,y,centerPoint.x,centerPoint.y).attr(EDGE_STYLE);that._drawNode(x,y,r,referringEntity);}
x=referringEntity?centerPoint.x/1.05:centerPoint.x/1.5;y=centerPoint.y;r=ENTITY_RADIUS;var center=that._drawNode(x,y,r,entity);var dx=paper.width/2.75;var dy=dx/0.9;var n=relatedEntities.length+1;var arc=Math.PI/n;for(var i=0;i<n;i++){if(i==0)continue;var rootX=center.attr("cx");var rootY=center.attr("cy");y=dy*Math.sin((arc*i)-(Math.PI/2));y*=5/6;y+=rootY;x=dx*Math.cos((arc*i)-(Math.PI/2));x+=rootX;r=RELATED_ENTITY_RADIUS;paper.path(SVG_PATH_STRING,rootX,rootY,x,y).attr(EDGE_STYLE);relatedElements.push(that._drawNode(x,y,r,relatedEntities[i-1]));}
relatedElements.attr("scale",0.001);relatedElements.animate({scale:1},1000,"bounce");center.toFront();var event={};event.type=Evri.Visualization.RENDERED;event.target=that;event.entity=entity;event.referringEntity=referringEntity;event.relatedEntities=relatedEntities;that.dispatchEvent(event.type,event);};that._drawNode=function(x,y,r,entity){var circle=paper.circle(x,y,r);var type=entity.type?entity.type:entity.resource.split("/")[1];circle.attr(ENTITY_NODE_STYLES[type.toUpperCase()]||ENTITY_NODE_STYLES["OTHER"]);circle.attr("stroke-width",3);var $node=jQuery(circle.node);$node.data("node",circle);$node.css("cursor","pointer");$node.click(function(e){that._node_clickHandler.apply(that,[e,entity]);});that._drawNodeLabel(circle,entity);return circle;};that._drawNodeLabel=function(element,entity){var $label=jQuery("<div/>").text(entity.name).addClass("label");$label.css("position","absolute");$label.data("node",element);$container.append($label);if($label.width()>MAX_LABEL_WIDTH){$label.data("text",entity.name);$label.addClass("truncated");$label.width(MAX_LABEL_WIDTH);}
that._centerOverNode(element,$label);$label.bind("click",function(e){that._node_clickHandler.apply(that,[e,entity]);});$label.bind("mouseover",function(){if($label.data("text")){$label.removeClass("truncated");$label.css("z-index",1001);that._centerOverNode(element,$label);}});$label.bind("mouseout",function(){if($label.data("text")){$label.addClass("truncated");$label.css("z-index",1000);that._centerOverNode(element,$label);}});};that._centerOverNode=function(element,$node){var x=element.attr("cx")-($node.outerWidth()/2);var y=element.attr("cy")-($node.outerHeight()/2);$node.css({left:x,top:y});};that._node_clickHandler=function(mouseEvent,entity){var event={};event.type=Evri.Visualization.GRAPH_ITEM_CLICKED;event.target=mouseEvent.target;event.entity=entity;var point=Evri.Util.globalToLocal({x:mouseEvent.pageX,y:mouseEvent.pageY},$container[0]);event.mouseX=point.x;event.mouseY=point.y;event.pageX=mouseEvent.pageX;event.pageY=mouseEvent.pageY;that.dispatchEvent(event.type,event);$container.find(".label").removeClass("selected");var $target=$(mouseEvent.target);var node=$target.data("node");if(!$target.hasClass("label")){var x=parseInt(node.attr("cx"));var y=parseInt(node.attr("cy"));point=Evri.Util.localToGlobal({x:x,y:y},$container[0]);$target=jQuery(document.elementFromPoint(point.x,point.y));}
$target.addClass("selected");that._centerOverNode(node,$target);};}};Array.prototype.first=function(){var self=this;var retval=[];if(arguments.length==0||parseInt(arguments[0])==1){retval=self[0];}else if(parseInt(arguments[0])>1){retval=self.slice(0,(arguments[0]>self.length?self.length:arguments[0]));}
return retval;};Array.prototype.last=function(){var self=this;var indexOfLast=self.length-1;var retval=[];if(arguments.length==0||parseInt(arguments[0])==1){return self[indexOfLast];}else if(parseInt(arguments[0])>1){var listSize=parseInt(arguments[0]);return self.slice((listSize<self.length?self.length-listSize:0),self.length);}
return retval;};Array.prototype.toSentence=function(){var self=this;var retval="";if(arguments.length>0&&arguments[0]instanceof Function){var convertedItems=[];var itemProcessor=arguments[0];for(var i=0;i<self.length;i++){convertedItems.push(itemProcessor.call(null,self[i]));}
self=convertedItems;}
if(self.length==1){retval=self.first();}else if(self.length==2){retval=self.join(" and ");}else if(self.length>2){retval=self.first(self.length-1).join(", ")+", and "+self.last();}
return retval;};Date.MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];$.extend(Date,{MONTHS:["January","February","March","April","May","June","July","August","September","October","November","December"],seconds:function(val){return(val||0)*1000;},minutes:function(val){return 60*this.seconds(val);},hours:function(val){return 60*this.minutes(val);},days:function(val){return 24*this.hours(val);},weeks:function(val){return 7*this.days(val);},months:function(val){return 30*this.days(val);},years:function(val){return 365*this.days(val);}});$.extend(Date.prototype,{timeAgoInWords:function(){var now=new Date();var minutesDiff=Math.round(Math.abs(this.getTime()-now.getTime())/60000);var secondsDiff=Math.round(Math.abs(this.getTime()-now.getTime())/1000);if(minutesDiff>=0&&minutesDiff<=1){if(secondsDiff>=0&&secondsDiff<=4){return"less than 5 seconds ago";}
else if(secondsDiff>=5&&secondsDiff<=9){return"less than 10 seconds ago";}
else if(secondsDiff>=10&&secondsDiff<=19){return"less than 20 seconds ago";}
else if(secondsDiff>=20&&secondsDiff<=39){return"half a minute ago";}
else if(secondsDiff>=40&&secondsDiff<=59){return"less than a minute ago";}
else{return"1 minute ago";}}
else if(minutesDiff>=2&&minutesDiff<=44){return minutesDiff+" minutes ago";}
else if(minutesDiff>=45&&minutesDiff<=89){return"about 1 hour ago";}
else if(minutesDiff>=90&&minutesDiff<=1439){return"about "+Math.round(minutesDiff/60.0)+" hours ago";}
else if(minutesDiff>=1440&&minutesDiff<=2879){return"1 day ago";}
else if(minutesDiff>=2880&&minutesDiff<=43199){return Math.round(minutesDiff/1440.0)+" days ago";}
else if(minutesDiff>=43200&&minutesDiff<=86399){return"about 1 month ago";}
else if(minutesDiff>=86400&&minutesDiff<=525599){return Math.round(minutesDiff/43200.0)+" months ago";}
else if(minutesDiff>=525600&&minutesDiff<=1051199){return"about 1 year ago";}
else{return Math.round(minutesDiff/525600.0)+" years ago";}},toFlatString:function(){var month=this.getMonth()+1;var date=this.getDate();return this.getFullYear().toString()+
(month<10?'0'+month:month).toString()+
(date<10?'0'+date:date).toString();},toConversationalString:function(){return Date.MONTHS[this.getMonth()]+' '+
this.getDate()+', '+
this.getFullYear();},toUSString:function(){return this.getMonth()+1+'/'+this.getDate()+'/'+this.getFullYear();},ago:function(spec){spec=$.extend({millis:0,seconds:0,minutes:0,hours:0,days:0,years:0},spec);var diff=0;diff+=spec.millis;diff+=Date.seconds(spec.seconds);diff+=Date.minutes(spec.minutes);diff+=Date.hours(spec.hours);diff+=Date.days(spec.days);diff+=Date.years(spec.years);var now=new Date().getTime();return new Date(now-diff);}});String.prototype.blank=function(){var self=this;return/^\s*$/.test(self);};String.prototype.wordTruncate=function(maxLength)
{if(this.length<maxLength)
{return this;}
return this.slice(0,maxLength).replace(/\W*\s+\w*\W*$/,'');};window.location.params=function(){var location=this;return URI.parseQueryString(location.search);};window.refresh=function(){window.location.href=window.location.href;};window.location.referredFromBrowse=function(){return document.referrer.indexOf(window.location.protocol+'//'+window.location.host+'/browse/')==0;};jQuery.browser.macFirefox=function(){var userAgent=navigator.userAgent.toLowerCase();return(userAgent.indexOf('mac')!=-1&&userAgent.indexOf('firefox')!=-1);};jQuery.browser.winFirefox=function(){var userAgent=navigator.userAgent.toLowerCase();return(userAgent.indexOf('windows')!=-1&&userAgent.indexOf('firefox')!=-1);};jQuery.browser.firefox3=function(){var version_number=navigator.userAgent.match(/Firefox\/([\d.]+)$/);if(version_number!==null)
{return parseInt(version_number[1])===3;}
return false;};jQuery.browser.ie6=function(){return navigator.userAgent.toLowerCase().indexOf('msie 6')!=-1;};jQuery.browser.ie7=function(){return navigator.userAgent.toLowerCase().indexOf('msie 7')!=-1;};jQuery.browser.ie8=function(){return navigator.userAgent.toLowerCase().indexOf('msie 8')!=-1;};jQuery.browser.ie=function(){return jQuery.browser.ie6()||jQuery.browser.ie7()||jQuery.browser.ie8();};jQuery.fn.modalize=function(options)
{if($.browser.msie){$("select").hide();}
var backgroundColor="#BBB";this.each(function(index,object){var self=$(object);var offset=self.offset();var height=self.outerHeight();var width=self.outerWidth();var offsetLeft=offset.left<0?0:offset.left;var offsetTop=offset.top<0?0:offset.top;var west=jQuery("<div id='modal-west'></div>");west.css({position:"absolute",opacity:0.75,top:offsetTop,height:height,"background-color":backgroundColor,width:offsetLeft+1,"z-index":100});var north=jQuery("<div id='modal-north'></div>");north.css({position:"absolute",opacity:0.75,top:0,"background-color":backgroundColor,height:offsetTop,width:$(document).width(),"z-index":100});var east=jQuery("<div id='modal-east'></div>");east.css({position:"absolute",opacity:0.75,top:offsetTop,"background-color":backgroundColor,height:height,width:$(document).width()-offsetLeft-width,left:offsetLeft+width,"z-index":100});var south=jQuery("<div id='modal-south'></div>");south.css({position:"absolute",opacity:0.75,top:offsetTop+height,"background-color":backgroundColor,height:$(document).height()-offsetTop-height,width:$(document).width(),"z-index":100});var blocker=jQuery("<div id='modal-blocker'></div>").append(west).append(north).append(south).append(east);jQuery(document.body).append(blocker);if(options.blockFocus===true){blocker.append($('<div />').css({height:$(document).height(),width:$(document).width(),position:"absolute",top:0,left:0}));}});return this;};jQuery.fn.demodalize=function()
{if($.browser.msie){$("select").show();}
jQuery("#modal-blocker").remove();return this;};jQuery.fn.getMap=function(places,callback)
{this.each(function(elementIndex,element){$.each(places,function(placeIndex,place){new GClientGeocoder().getLocations(place,function(points){var div=document.createElement("div");$(element).append(div);var coords=points.Placemark.first().Point.coordinates;var map=new GMap2(div,{size:new GSize(280,280)});if(callback){GEvent.addListener(map,"load",callback);}
var center=new GLatLng(coords[1],coords[0]);map.setCenter(center);map.addOverlay(new GMarker(center));map.setZoom(points.Placemark.first().AddressDetails.Accuracy+1);map.addControl(new GSmallZoomControl());});});});return this;};jQuery.fn.choose=function(num)
{var selection;if(this.length<=num)
{return this;}
while(selection===undefined||selection.length<num)
{var random=this.eq(Math.floor(Math.random()*this.length));selection=selection?selection.add(random):random;}
return selection;};jQuery.fn.validate=function(regularExpression){return this.filter(function(){return!regularExpression.test($(this).val());}).length===0;};jQuery.fn.observe=function(callb){this.each(function(i,obj){var previousValue=$(obj).val();$(obj).focus(function(){setTimeout(function(){previousValue=$(obj).val();setTimeout(arguments.callee,200);},200);$(obj).unbind("unfocus",arguments.callee);});});};jQuery.evriFacebox=function(){$.facebox.apply(this,arguments);return $("#facebox").find(".close").attr('title',"close").click(function(){$.facebox.close();}).end().find(".footer").hide().end();};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};};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};};jQuery.fn.center=function()
{this.each(function(){var el=$(this);var x;var y;var winH=jQuery.windowDimensions().height;var winW=jQuery.windowDimensions().width;if(winH<el.height())
{y=0;}
else
{y=winH/2-el.height()/2;}
if(winW<el.width())
{x=winW-el.width();}
else
{x=winW/2-el.width()/2;}
if(jQuery.browser.ie6)
{el.css('position','absolute');y+=jQuery.windowScroll().y;x+=jQuery.windowScroll().x;}
el.css("top",y);el.css("left",x);});return this;};jQuery.browserClasses=function(){var classes=[];jQuery.each(jQuery.browser,function(i,o){(jQuery.isFunction(o)?o():o)&&classes.push(i);});return classes;};jQuery.fn.addBrowserClasses=function(){this.addClass(jQuery.browserClasses().join(" "));};jQuery.fn.doOnce=function(callb){this.length&&callb.apply(this);return this;};jQuery.init=function(selector,callback){jQuery(function(){$(selector).doOnce(callback);});};jQuery.fn.appendFlash=function(url,width,height){var randomId="video-player-"+(new Date()).getTime();this.append($("<div/>").attr("id",randomId));swfobject.embedSWF(url,randomId,width,height,Flash.requiredVersion,Flash.expressInstallPath,{},{});return this;};jQuery.toSentence=function(array){if(array.length===1){return array[0];}
else if(array.length===2){return array.join(" and ");}
else{return array.slice(0,-1).join(", ")+", and "+array[array.length-1];}};jQuery.camelizeDashed=function(str){return $.map(str.split("-"),function(s,i){return i>0?s.charAt(0).toUpperCase()+s.substr(1).toLowerCase():s;}).join("");};(function($){$.fn.expandableList=function(options){var $selector=this;options=$.extend({'collapseLabel':'...Less','expandLabel':'More...','collapseLength':10},options);$selector.each(function(listIndex,list){var $list=$(list);var $allListItems=$list.find('li');if($allListItems.length>options.collapseLength){var selectorForHideableListItems='li:gt('+(options.collapseLength-1)+')';$list.find(selectorForHideableListItems).hide();$('<li><a href="javascript:void(0);"></a></li>').find('a').text(options.expandLabel).click(function(){var $link=$(this).blur();if($link.text()==options.expandLabel){$list.find(selectorForHideableListItems).show();$link.text(options.collapseLabel);}else{$list.find(selectorForHideableListItems).hide();$link.text(options.expandLabel);$list.find('li:last').show();}
return false;}).end().appendTo($list)}});return $selector;};})(jQuery);(function($){$.fn.initializeVideoControls=function(){var $selector=this;$selector.each(function(panelIndex,panel){var $panel=$(panel);$panel.find("a.video-play").click(function(){$panel.find(".video-player").empty().removeClass("video-display");$panel.find(".video-close").remove();var item=$(this).parents(".video-summary");item.append($("<a/>").text("close").addClass("video-close").attr("href","#close-video").click(function(){$panel.find(".video-player").empty().removeClass("video-display");$panel.find(".video-close").remove();return false;}));var playerArea=item.find(".video-player").addClass("video-display");playerArea.appendFlash($(this).attr("data-youtube-video"),playerArea.width(),310);return false;});});return $selector;};})(jQuery);(function($){$.fn.initializeImageSummaries=function(){var $selector=this;var hoverClass="image-hover";$selector.each(function(panelIndex,panel){var $panel=$(panel);$panel.find("li.image-summary").hover(function(){$(this).addClass(hoverClass);},function(){$(this).removeClass(hoverClass);});});return $selector;};})(jQuery);function px(i){return""+parseInt(i)+"px";}
function percentage(f){return""+(f*100)+"%";}
if(window.Evri===undefined){window.Evri={};}
Evri.Constants={APP_ID:"evri-portal",FACEBOOK_LOGIN_COOKIE_NAME:"fbLoginCookie"};var Class={create:function(){function klass(){this.initialize.apply(this,arguments);}
return klass;}};var URI={parseQueryString:function(queryString){if(queryString.search(/^\?/)===0){queryString=queryString.substring(1);}
var paramItems=queryString.split("&");var params={};for(var i=0;i<paramItems.length;i++){var result=paramItems[i].split("=");params[result.first()]=decodeURIComponent(result.last());}
return params;},toCanonicalQueryString:function(params){var paramsItems=[];for(var key in params){if(params.hasOwnProperty(key)){paramsItems.push({key:key,value:params[key]});}}
paramsItems=paramsItems.sort(function(a,b){return a.key>b.key?1:-1;});for(var i=0;i<paramsItems.length;i++){paramsItems[i]=paramsItems[i].key+"="+encodeURIComponent(paramsItems[i].value);}
return paramsItems.join('&');},toQueryString:function(params){var paramItems=[];for(var i in params){if(params[i]instanceof(Array))
{for(var j=0;j<params[i].length;j++)
{paramItems.push([i,encodeURIComponent(params[i][j])].join("="));}}
else
{paramItems.push([i,encodeURIComponent(params[i])].join("="));}}
return'?'+paramItems.join('&');}};var EventTracker={REFERRAL_ATTRIBUTE_NAME:'data-analytics-referrer-name',CONTAINER_PATH_ATTRIBUTE_NAME:'data-analytics-container-path',PAGE_ATTRIBUTE_NAME:'data-analytics-page-name',googleAnalyticsEventTracker:undefined,referralMade:false,pageName:function(){return document.body.getAttribute(EventTracker.PAGE_ATTRIBUTE_NAME);},bindToPage:function(){EventTracker.googleAnalyticsEventTracker=pageTracker;},addContainerPathTo:function(node,path){if(node!==undefined){node.setAttribute(EventTracker.CONTAINER_PATH_ATTRIBUTE_NAME,path);}},trackDHTML:function(node,name,options){options=options||{};if(EventTracker.referralMade===true){EventTracker.referralMade=false;return;}
EventTracker.track("DHTML",node,name,options);},trackFlex:function(node,name,options){options=options||{};if(EventTracker.referralMade===true){EventTracker.referralMade=false;return;}
EventTracker.track("FLEX",node,name,options);},trackReferral:function(node,options){options=options||{};EventTracker.referralMade=true;EventTracker.track("REFERRAL",node,node.getAttribute(EventTracker.REFERRAL_ATTRIBUTE_NAME),{});},track:function(type,node,name,options){if(node.skipTrack===true){node.skipTrack=false;return;}
var trackPath="/"+type+"/"+EventTracker.pageName();var eventName="/"+name;var trackPathItems=[];if(options.containerPath!==undefined){trackPathItems.push(options.containerPath);delete options.containerPath;}
while(node.tagName!==undefined&&node.tagName.toUpperCase()!='BODY'){if(node.getAttribute(EventTracker.CONTAINER_PATH_ATTRIBUTE_NAME)!==undefined){trackPathItems.unshift(node.getAttribute(EventTracker.CONTAINER_PATH_ATTRIBUTE_NAME));}
node=node.parentNode;}
var canonicalQueryString=URI.toCanonicalQueryString(options);var eventPath=trackPath+trackPathItems.join("")+eventName;EventTracker.googleAnalyticsEventTracker._trackEvent(type,eventPath,canonicalQueryString);},markReferrerLinks:function($node){setTimeout(function(){$node.find("a["+EventTracker.REFERRAL_ATTRIBUTE_NAME+"]").each(function(index,anchor){$(anchor).unbind('click',EventTracker.referralClickHandler);$(anchor).bind('click',EventTracker.referralClickHandler);});},0);},referralClickHandler:function(event){var anchor=this;EventTracker.trackReferral(anchor,{});}};jQuery.fn.replaceAttr=function(aName,rxString,repString){return this.attr(aName,function(){return jQuery(this).attr(aName).replace(rxString,repString);});};var Flash={expressInstallPath:undefined,requiredVersion:"9.0.0",installMessaging:"This content requires the Macromedia Flash Player. <a href=\"http://www.macromedia.com/go/getflash/\">Get Flash!</a>",clearFocusOnClick:function(){this.blur();},userVersion:function(){var version=swfobject.getFlashPlayerVersion();return[version.major,version.minor,version.release].join('.');}};var GlobalTemplates={link:function(params)
{return $('<a></a>').attr('href',params.href).attr('title',params.title).html(params.text);},image:function(params)
{return $('<img></img>').attr('src',params.src).attr('alt',params.alt).attr('title',params.title).attr('class',params.classes);},documentTitle:function(content){document.title=content+' - Evri';}};var HelpViewer={spotlight:function(nodeId,callbacks,options){var nodeSelector='#'+nodeId;var selectedSection=$(nodeSelector);var documentName=options.documentName!==undefined?options.documentName:nodeId;if(selectedSection.hasClass("help-focused"))
{return;}
selectedSection.modalize({blockFocus:true}).addClass("help-focused");if(callbacks.afterBlocked!==undefined){try{callbacks.afterBlocked.call();}catch(e){}}
$.ajax({url:"/help/"+documentName+".xml",type:"GET",dataType:"xml",success:function(dialogOptionsXML,text){var dialogOptions=HelpViewer.toJSON(dialogOptionsXML);var dialog=HelpViewer.Templates.dialog(dialogOptions);var placement=dialogOptions.placement;var dialogPositionLeft=px(parseInt(selectedSection.offset().left)+parseInt(selectedSection.width())-8);var dialogPositionTop=px(parseInt(selectedSection.offset().top)-18);var trigger=selectedSection.find("a.help-trigger");if(placement=='trigger-bottom'){dialogPositionTop=px(parseInt(trigger.offset().top)+trigger.height()+10);dialogPositionLeft=px(parseInt(selectedSection.offset().left)+selectedSection.width()-245);}else if(placement.search(/^trigger-/)===0){dialogPositionTop=px(parseInt(trigger.offset().top)-25);}
if(placement=='left'){dialogPositionLeft=px(parseInt(selectedSection.offset().left)-267);}else if(placement=='trigger-right'){dialogPositionLeft=px(parseInt(trigger.offset().left)+parseInt(trigger.width())+10);}else if(placement=='trigger-left'){dialogPositionLeft=px(parseInt(trigger.offset().left)-280);}
dialog.css({top:dialogPositionTop,left:dialogPositionLeft}).appendTo("body");var closer=function(){var node=this;selectedSection.demodalize().removeClass("help-focused");EventTracker.trackDHTML(node,"HelpCloser",{});$(window).unbind("resize",closer);$("div#help-dialog-closer").unbind('click');dialog.remove();};$("div#help-dialog-closer").click(closer);$("div#help-dialog-closer").hover(function(){$(this).addClass("hover");},function(){$(this).removeClass("hover");});$(window).bind("resize",closer);$("#modal-blocker div").click(closer);if($.browser.msie&&$.browser.version<=6)
{$("#help-dialog-pointer").remove();}},error:function(xhr,textStatus,errorThrown){selectedSection.demodalize().removeClass("help-focused");}});},toJSON:function(xml){var options={};options.title=$(xml).children('HelpSection').children('Title').text();options.content=$(xml).children('HelpSection').children('Content').text();options.placement=$(xml).children('HelpSection').children('Placement').text();return options;},Templates:{dialog:function(options){var dialogContainer=$('<div id="help-dialog" class="placement-'+options.placement+'"></div>');var dialogContentContainer=$('<div id="help-dialog-content"></div>');var dialogHeader=$('<h3>'+options.title+'</h3>');var dialogCloser=$("<div />").attr("id","help-dialog-closer").append($('<img class="close-button-hover" src="/images/buttons/close_over.png" alt="Close"/>'),$('<img class="close-button" src="/images/buttons/close.png" alt="Close"/>'));dialogContentContainer.append(dialogCloser);dialogContainer.append(dialogContentContainer);dialogContentContainer.append(dialogHeader);dialogContentContainer.append($('<div class="content">'+options.content+'</div>'));dialogContainer.append('<div id="help-dialog-pointer">&nbsp;</div>');return dialogContainer;}},initializeTriggers:function(){$(document.body).addClass('help-enabled');}};var HTML={escape:function(string){return string.toString().replace(/</,'&lt;').replace(/>/,'&gt;');}};var ToggleList={buildMenu:function($hiddenList,$toolbar){var $show=$("<li><a/></li>").addClass("menu");$toolbar.append($show);var less=function(untracked){if(!untracked){EventTracker.trackDHTML($show[0],"ShowLess");}
$show.find("a").html("Show more&nbsp;<sub>&#9660;</sub>").blur();$hiddenList.hide();};var more=function(){EventTracker.trackDHTML($show[0],"ShowMore");$show.find("a").html("Show less&nbsp;<sub>&#9650;</sub>").blur();$hiddenList.show();};$show.toggle(more,less);less(false);}};Evri.Loader={defaultError:"There was an error loading articles. Make another selection.",loadSuccess:function()
{var self=this;if(((new Date()).getTime()-self.firstLoaded)>2000)
{return;}
var message="&nbsp;&nbsp;&nbsp;&nbsp;Loading...";var loadingMessage=$("<div id='articles-loading'>"+"<div id='articles-loading-shadow'></div>"+"<div id='articles-loading-content'>"+message+"</div>"+"</div>");var properties={top:30,opacity:0.75};loadingMessage.css(properties);$(self.loaderLocation).append(loadingMessage);loadingMessage.animate({opacity:0},function(){loadingMessage.remove();});return loadingMessage;},loadArticles:function(loaderLocation,message)
{var self=this;self.loaderLocation=loaderLocation;if($('div#articles-loading').length==0)
{self.firstLoaded=(new Date()).getTime();var loadingMessage=$("<div id='articles-loading'>"+"<div id='articles-loading-shadow'></div>"+"<div id='articles-loading-content'>"+message+"</div>"+"</div>");$(self.loaderLocation).addClass("disabled").append(loadingMessage);return loadingMessage.css({opacity:0}).animate({opacity:0.75});}
else
{return $('div#articles-loading');}},loadError:function(errorMessage)
{var self=this;errorMessage=errorMessage||self.defaultError;var loadingBox=$('div#articles-loading');var error=loadingBox.clone().addClass('error');loadingBox.replaceWith(error);error[0].style["data-opacity"]=error.css('opacity');var startValues={width:error.find('#articles-loading-shadow').width(),marginLeft:"25%",opacity:0.75};error.find('#articles-loading-content').text(errorMessage);JSTweener.addTween(startValues,{onUpdate:function(){error.css({opacity:startValues.opacity}).find('#articles-loading-shadow , #articles-loading-content').css(startValues);},width:450,marginLeft:0,opacity:1.00,suffix:{width:'px',"marginLeft":'%'},transition:"linear",time:0.75});return error;}};Evri.Feedback={Form:function(){return $('#modal-feedback-form');},errorMessage:["Unfortunately, there was an error sending your message.","Please try again or come back later."].join(" "),resetInstructions:function(){$(".radio-form .instructions").html($("<p/>").addClass("light").text("Please select one of the following options:"));$(".optional-form .instructions").html($("<p/>").addClass("light").text("Enter optional information here:"));},submit:function(){Evri.Feedback.resetInstructions();var emailRegexp=/^\s*[A-Z0-9._%+\-]+@[A-Z0-9.\-]+\.[A-Z]{2,4}\s*$/i;if($("#email-field").val()!=""&&!$("#email-field").validate(emailRegexp)){$("#email-field").addClass("error");$("#facebox .optional-form .message-display-area").html($("<p/>").addClass("error").text("The email address below is invalid. Please verify or retype the address."));}
else{var feedback=Evri.PageSession.session;$.extend(feedback,{selection:$(".feedback-type:checked").val(),message:$("#message-field").val(),from_email:$("#email-field").val(),href:window.location.href});$.extend(feedback,Evri.PageSession.session);$.ajax({type:"POST",url:"/mailer/feedback",data:feedback,success:function(response){$("#facebox_overlay").remove();$.evriFacebox(response);},error:function(){var errorMessage=$("<p/>").addClass("error").text(Evri.Feedback.errorMessage);var optionalFields=$("#facebox .tell-us-more").length===0;if(optionalFields){$(".optional-form .instructions").html(errorMessage);}
else{$(".radio-form .instructions").html(errorMessage);}}});}
return false;},instantiate:function(position){if($('a#feedback-trigger').length>0){EventTracker.trackDHTML($('a#feedback-trigger')[0],'OpenFeedbackForm',{});}
$.facebox(function(){$.get("/mailer/feedback_form",function(data){$.evriFacebox(data).find("form").submit(Evri.Feedback.submit).find(".submit-link").replaceWith($("<a />").text("Send feedback").addClass("disabled submit-link").click(function(){!$(this).hasClass("disabled")&&$("#facebox form").submit();return false;})).end().find(".radio-form label").click(function(){$(this).parent().find("input").attr("checked",true).click();}).end().find(".radio-form input").click(function(){$("#facebox .submit-link").removeClass("disabled");$(".optional-form #user-selection").text($(this).parent().find('label').text());}).end().end().find(".tell-us-more").click(function(){if(!$(this).is(".disabled")){$(this).parent().remove();$("#facebox .optional-form").slideDown();}
return false;});});});return false;},cancel:function(){Evri.Feedback.trackEvent("Cancel",{});Evri.Feedback.dismiss();},close:function(){Evri.Feedback.trackEvent("Close",{});Evri.Feedback.dismiss();},complete:function(){Evri.Feedback.trackEvent("CloseForComplete",{});Evri.Feedback.dismiss();},trackEvent:function(name,options){EventTracker.trackDHTML(Evri.Feedback.Form()[0],name,options);}};Evri.ShareMail={Form:function(){return $('#modal-share-form');},prepareCloseButton:Evri.Feedback.prepareCloseButton,errorMessage:Evri.Feedback.errorMessage,resetMessages:function(){$("#facebox .message-display-area").empty();},validateField:function(){var emailRegexp=/^\s*[A-Z0-9._%+\-]+@[A-Z0-9.\-]+\.[A-Z]{2,4}\s*$/i;Evri.ShareMail.resetMessages();$(this).removeClass("error");if(!$(this).validate(emailRegexp)){$("#facebox .message-display-area").html($("<p />").addClass("error").text("Invalid e-mail entered."));$(this).addClass("error");return false;}
return true;},validateAllFields:function(){var valid=true;$("#share-recipient,#share-sendermail").each(function(i,element){var isValid=Evri.ShareMail.validateField.call(element);valid=valid&&isValid;});return valid;},submit:function(){$("#share-form form").ajaxSubmit({success:function(response){$("#facebox_overlay").remove();$.facebox(response);$("#facebox").find(".close").click(function(){Evri.ShareMail.removeIFrameShim();$.facebox.close();}).end().find(".footer").hide();Evri.ShareMail.resizeIFrameShim();},error:function(){$("#facebox .message-display-area").html($("<p />").addClass("error").text(Evri.ShareMail.errorMessage));}});return false;},instantiate:function(options){$.facebox(function(){$.get("/mailer/share_form",function(response){var pageURL=document.location.href;var pageTitle=window.document.title;if(options){if(options.pageURL){pageURL=options.pageURL;}
if(options.pageTitle){pageTitle=options.pageTitle;}
if(options.requireIFrameShim){Evri.ShareMail.addIFrameShim();}}
$.evriFacebox(response).find("form").submit(Evri.ShareMail.submit).end().find("#share-pagetitle").val(pageTitle).end().find("#share-pagehref").val(pageURL).end().find(".submit-link").replaceWith($("<a />").text("Send Email").addClass("submit-link").click(function(){if(Evri.ShareMail.validateAllFields()){$("#facebox form").submit();}
return false;})).end().find("#user-selection").append($("<p/>").addClass("light").text(document.title),$("<p/>").addClass("light").text(pageURL)).end().find(".close").click(function(){Evri.ShareMail.removeIFrameShim();$.facebox.close();});var socialMediaArea=$('div#social-media-links');socialMediaArea.hide();addthis_open(socialMediaArea[0],'',window.location.href,'[TITLE]');Evri.ShareMail.resizeIFrameShim();(function(){var poll=arguments.callee;if($('#at_share').length){var services=addthis_options.split(", ");services=$.map(services,function(i){return"#ati_"+i;});var links=$('div#at_share').find("div.at_item").filter(services.join(","));socialMediaArea.append(links.clone());socialMediaArea.show();}
else{setTimeout(poll,50);}})();$("#share-recipient,#share-sendermail").change(Evri.ShareMail.validateField);});});return false;},addIFrameShim:function(){var iFrameShim=$('<iframe id="evri-share-iframeshim" frameborder="0" src="javascript:false;" />');$(document.body).append(iFrameShim);$(document).bind('close.facebox',function(){Evri.ShareMail.removeIFrameShim();});return iFrameShim;},resizeIFrameShim:function(){var iFrameShim=$("#evri-share-iframeshim");if(iFrameShim.length>0){var facebox=$("#facebox");iFrameShim.height(facebox.height()).width(facebox.width()).css({"position":"absolute","left":facebox.css("left"),"top":facebox.css("top")});}},removeIFrameShim:function(){var iFrameShim=$("#evri-share-iframeshim");if(iFrameShim.length>0){iFrameShim.remove();}},close:function(){Evri.ShareMail.trackEvent("Close",{});Evri.ShareMail.removeIFrameShim();Evri.ShareMail.dismiss();},cancel:function(){Evri.ShareMail.trackEvent("Cancel",{});Evri.ShareMail.removeIFrameShim();Evri.ShareMail.dismiss();},complete:function(){Evri.ShareMail.trackEvent("Complete",{});Evri.ShareMail.removeIFrameShim();Evri.ShareMail.dismiss();},trackEvent:function(name,options){EventTracker.trackDHTML(Evri.ShareMail.Form()[0],name,options);}};var EntityScrollList=Class.create();EntityScrollList.prototype={initialize:function(baseSelector,options){var self=this;self.options=$.extend({shadowed:true},options);self.$base=$(baseSelector);if((!$.browser.msie&&parseInt($.browser.version)!==6)&&self.options.shadowed!==false){self.$base.addClass("shadowed");}
return self;},preparePagination:function(itemsPerPage){itemsPerPage=itemsPerPage||11;var self=this;var selectedPage=0;var list=self.$base.find("ol.scroll-list-items");var items=list.find("li");self.$base.toggleClass("no-scroll",items.length<itemsPerPage);function selectPage(i){return function(){if(i>=0&&i*itemsPerPage<items.length)
{selectedPage=i;paginationArea.find("ol li").removeClass("selected").eq(i).addClass("selected");var position=items.eq(i*itemsPerPage).position();var start={top:list.position().top};JSTweener.addTween(start,{top:-1*position.top,onUpdate:function(){if(selectedPage===i){list.css("top",start.top+"px");}}});enableButtons();}};}
var paginationArea=self.$base.find("div.navigation");var prevButton=$("<a />").addClass("previous-page left entityScrollPager").append($("<div/>").addClass("arrow arrow-west left "),$("<div />").text("Prev").addClass("left")).click(function(){selectPage(selectedPage-1)();}).hover(function(){if(!prevButton.is(".disabled")){prevButton.children(".arrow").removeClass("arrow-west").addClass("arrow-west-black");}},function(){prevButton.children(".arrow").removeClass("arrow-west-black").addClass("arrow-west");});var nextButton=$("<a />").addClass("next-page left entityScrollPager").append($("<div />").text("Next").addClass("left"),$("<div/>").addClass("arrow arrow-east left")).click(function(){selectPage(selectedPage+1)();}).hover(function(){if(!nextButton.is(".disabled")){nextButton.children(".arrow").removeClass("arrow-east").addClass("arrow-east-black");}},function(){nextButton.children(".arrow").removeClass("arrow-east-black").addClass("arrow-east");});function enableButtons(){if(selectedPage>0)
{prevButton.removeClass("disabled");prevButton.children(".arrow").removeClass("arrow-west-gray");}
else
{prevButton.addClass("disabled");prevButton.children(".arrow").addClass("arrow-west-gray");}
if(selectedPage<items.length/itemsPerPage-1)
{nextButton.removeClass("disabled");nextButton.children(".arrow").removeClass("arrow-east-gray");}
else
{nextButton.addClass("disabled");nextButton.children(".arrow").addClass("arrow-east-gray");}}
var pageLinks=$("<ol />").addClass("left");paginationArea.append($("<div />").addClass("prev-next-container left").append(prevButton,$("<p />").addClass("left").text(" | "),nextButton),pageLinks,$("<div />").addClass("clear"));for(var pageNumber=0;pageNumber<items.length/itemsPerPage;pageNumber++)
{pageLinks.append($("<li/>").addClass("pagination-page left").click(selectPage(pageNumber)));}
selectPage(0)();return self;}};var EntityDetailPage=Class.create();EntityDetailPage.prototype.initialize=function(entityHref,graph)
{var self=this;self.entityHref=entityHref;self.actions={};self.targets={};self.tooltips={};self.visualizationGraph=graph;self.useCustomScrollbars=false;self.subjectEntity={name:$("meta[name=entity-name]").attr("content").replace(/\s/,''),facets:$("meta[name=entity-facets]").attr("content").split(', '),href:entityHref};var initializationFunctions=['prepareDescription','prepareHelp','prepareEntityScrollList','prepareTrends','prepareWidgets','prepareCollectionsList','prepareTags'];Evri.Collections.initFavoriteMenu("li.favorite-link",entityHref);$('li.favorite-link').bind('addedToCollection',function(){$('.favorite-link a.show-menu').text('You are following this');});$.each(initializationFunctions,function(index,functionName){setTimeout(function(){self[functionName].call(self);},0);});};EntityDetailPage.prototype.prepareTags=function(){var that=this;that.global_text="Show just my tags";that.user_text="Show everybody's tags";var $tags=$("#tags");var $form=$tags.find("form.add");var $menu=$tags.find("a.menu");var $error=$tags.find("p.error");var $global_tags=$tags.find(".global_tags");var $user_tags=$tags.find(".user_tags");var $toggle_tags=$("<a/>").text(that.global_text).addClass("toggle");$form.hide().submit(function(){var input=$.trim($form.find("#tag_list").val());if(input==""){$global_tags.show();$toggle_tags.show();$menu.show();$form.hide();return false;}});$menu.show().click(function(){if(!Evri.isAuthenticated){return;}
$error.hide();$global_tags.hide();$user_tags.hide();$toggle_tags.hide();$menu.hide();$form.show();});$tags.find("h4").hide();var $tag_list=$tags.find("#tag_list");$tag_list.autocomplete("/find/tags",{minChars:2,parameters:{},timeout:200,validSelection:false});var $tag_links=$tags.find("form .tag");$.each($tag_links,function(index,item){var $item=$(item);$item.click(function(){try{var value=$item.text();var map={value:true};var finish=[];var start=$tag_list.val().split(",");for(var i=0;i<start.length;i++){var tag_value=$.trim(start[i]);if(map[tag_value]===undefined&&tag_value!==""){map[tag_value]=true;finish.push(tag_value.toLowerCase());}}
finish.push(value);$tag_list.val(finish.join(', '));}catch(error){alert(error.message);}finally{return false;}});});if($user_tags.length>0&&$user_tags[0].tagName.toLowerCase()=="ul"){if($user_tags.children().length==0){$user_tags.append("<li><em>You haven't added a tag yet</em></li>");}
$tags.find("ul").hide();$toggle_tags.insertAfter($user_tags);$toggle_tags.toggle(function(){$toggle_tags.text(that.user_text);$user_tags.show();$global_tags.hide();},function(){$toggle_tags.text(that.global_text);$user_tags.hide();$global_tags.show();});$global_tags.show();}};EntityDetailPage.prototype.prepareWidgets=function(){var self=this;var facets=this.subjectEntity.facets;for(var i=0;i<facets.length;i++){if(facets[i].toLowerCase()=="album"){var $holder=$("<iframe class='widget' frameborder='0' scrolling='no' />");var $sidebar=$("#sidebar");$sidebar.prepend($holder.hide());var params={};params["name"]="amazon_music";params["title"]="";$sidebar.find(".widget").attr("src",self.entityHref+"/third_party_widget?"+toQueryString(params));}}
function toQueryString(object){var search="";for(var p in object){search+=p.toString()+"="+object[p]+"&";}
return search.substr(0,search.length-1);}};EntityDetailPage.prototype.prepareTrends=function(){var that=this;var trends=new Evri.Trends($("#trends .container")[0],Evri.Constants.APP_ID);trends.addEventHandler(Evri.Trends.ARTICLE_CLICKED,function(event){var article=event.article;var path="entity_uri="+that.entityHref+"&page="+article.link.sourceUrl+"&title="+article.link.title;window.location.href="/media/article?"+encodeURI(path);});trends.render(this.entityHref);};EntityDetailPage.prototype.prepareImageBar=function(){var self=this;self.imagebar=new Carousel({'width':475});self.imagebar.replace("imagebar");self.loadImages();var imageBar=self.imagebar;imageBar.click(function(data){window.location.href="/media/image"+URI.toQueryString({"entity_uri":self.entityHref,"page":data.clickURL});});};EntityDetailPage.prototype.prepareDescription=function(){var $description=$('#description');if($description.length==0)return;var $toolbar=$("#edp_description_toolbar",$("#sidebar"));$description.children("p:not(p:first)").addClass("indent");$description.children("p:last").addClass("last");if($description[0].scrollHeight>$description[0].offsetHeight)
{var $show=$("<li><a/></li>").addClass("menu");$toolbar.append($show);var less=function(untracked){if(!untracked){EventTracker.trackDHTML($show[0],"ShowLess");}
$show.find("a").html("Show more&nbsp;<sub>&#9660;</sub>").blur();$description.scrollTo(0);$description.addClass("preview");};var more=function(){EventTracker.trackDHTML($show[0],"ShowMore");$show.find("a").html("Show less&nbsp;<sub>&#9650;</sub>").blur();$description.removeClass("preview");};$show.toggle(more,less);less(false);}
else
{$description.css("height","auto");}};EntityDetailPage.prototype.prepareCollectionsList=function(){var $sidebar=$("#sidebar");var $list=$sidebar.find("#collections ul.collections");var $hidden=$list.children().slice(5);var $toolbar=$sidebar.find("#collections .toolbar:last");if($list.children().length>5){ToggleList.buildMenu($hidden,$toolbar);}};EntityDetailPage.prototype.prepareHelp=function(){HelpViewer.initializeTriggers();$("#entity-description a.help-trigger").click(function(){var node=this;EventTracker.trackDHTML(node,"ShowHelp",{containerPath:"/description"});HelpViewer.spotlight('entity-description',{},{});node.blur();return false;});$("#top-connections a.help-trigger").click(function(){var node=this;EventTracker.trackDHTML(node,"ShowHelp",{containerPath:"/visualization"});HelpViewer.spotlight('top-connections',{},{documentName:'entity-visualization'});node.blur();return false;});$("#action-articles-area a.help-trigger").click(function(){var node=this;EventTracker.trackDHTML(node,"ShowHelp",{containerPath:"/articles"});HelpViewer.spotlight('action-articles-area',{},{documentName:'entity-articles'});node.blur();return false;});$("#trends h2 a.help-trigger").click(function(){var node=this;EventTracker.trackDHTML(node,"ShowHelp",{containerPath:""});HelpViewer.spotlight("trends",{},{documentName:"entity-trends"});node.blur();return false;});};EntityDetailPage.prototype.setReferrer=function(r){this.referrer=r;return this;};EntityDetailPage.prototype.prepareEntityScrollList=function(){var self=this;self.scrollList=new EntityScrollList("div#entity-scroll-list",{shadowed:false});self.scrollList.preparePagination();var $scrollListContainer=$('div#scroll-list-container');$scrollListContainer.css({'visibility':'visible'}).hide();return self;};EntityDetailPage.prototype.prepareSVGVisualization=function(){var self=this;var vis=VisualizationFactory(300,230);var graph=self.visualizationGraph;var referringEntity;$("#visualization").html(vis);if(self.referrer!==undefined)
{referringEntity=vis.referringNode(self.referrer.href,self.referrer.name,self.referrer);referringEntity.shape.label.hover(referringEntity.shape.expandLabel,referringEntity.shape.shrinkLabel);referringEntity.shape.circle.attr({"fill":"#fff","stroke-width":"3px"});function bindEvents(el){el.click(function(){window.location=referringEntity.data.href;EventTracker.trackDHTML(this,"ReferringEntity");});el.mouseover(function(){referringEntity.shape.circle.attr(VisualizationFactory.styleForSelectedEntityType(referringEntity.data.href.split("/")[1]));});el.mouseout(function(){var style=VisualizationFactory.styleForSelectedEntityType(referringEntity.data.href.split("/")[1]);style.fill="#fff";referringEntity.shape.circle.attr(style);});};bindEvents(referringEntity.shape.label);bindEvents($(referringEntity.shape.circle[0]));}
var centerNode=vis.centerNode(graph.source.href,graph.source.name,graph.source);centerNode.shape.label.hover(centerNode.shape.expandLabel,centerNode.shape.shrinkLabel);centerNode.shape.label.css({'cursor':'default'});function setLeaves(targets)
{vis.leavesNumber(targets.length);function bindEachLeaf(callb)
{for(var i=0;i<targets.length;i++)
{var leaf=vis.leaf(targets[i].href,targets[i].name,targets[i]);callb(i,leaf,targets[i]);};}
bindEachLeaf(function(index,leaf,target){leaf.shape.label.hover(leaf.shape.expandLabel,leaf.shape.shrinkLabel);function bindShapes(shape)
{shape.click(function(){window.location.href=target.href+"?referring_entity_uri="+graph.source.href;EventTracker.trackDHTML(this,"Target");});shape.mouseover(function(){if(!$.browser.msie){vis.append(leaf.shape.label);}
leaf.shape.circle.attr(VisualizationFactory.styleForSelectedEntityType(target.href.split("/")[1]));});shape.mouseout(function(){var style=VisualizationFactory.styleForSelectedEntityType(target.href.split("/")[1]);style.fill="#fff";leaf.shape.circle.attr(style);});}
bindShapes($(leaf.shape.circle[0]));bindShapes(leaf.shape.label);});vis.css("zoom",1);}
var targets=graph.targets;if(self.referrer!==undefined)
{targets=$.grep(targets,function(object,index){return object.href!==self.referrer.href;});}
if(targets.length>5)
{var more=$("<div />").addClass("tinkertoyPaging interactive right").append($("<div/>").html("See more <span class='utf_arrow'>&#9658;</span>")).click(function(){vis.resetLeaves(function(){setLeaves(targets.slice(5,10));back.show();vis.properties({"top":0});});more.hide();}).click(function(){EventTracker.trackDHTML(this,"More");});var back=$("<div />").addClass("tinkertoyPaging interactive right").append($("<div/>").html("<span class='utf_arrow'>&#9668;</span> Back")).click(function(){vis.resetLeaves(function(){setLeaves(targets.slice(0,5));more.show();vis.properties({"top":0});});back.hide();}).click(function(){EventTracker.trackDHTML(this,"Back");});$("#visualization").append(more,back);back.hide();}
setLeaves(targets.slice(0,5));vis.parent().css("zoom",1);vis.parent().parent().css("zoom",1);};EntityDetailPage.prototype.prepareVisualization=function(){var visualization=new Evri.Visualization($("#visualization")[0],Evri.Constants.APP_ID);visualization.addEventHandler(Evri.Visualization.GRAPH_ITEM_CLICKED,function(event){alert("we should take you to "+event.entity.href);});var params=Evri.Util.paramsToMap(window.location.search);visualization.render(self.entityHref,params["referring_entity_uri"]);};EntityDetailPage.prototype.showSingleSubjectWidget=function(){var self=this;var url="/widget/VerticalSingleEntity/widget.html?entity_href="+self.entityHref;var html='<div class="edp-embed-instructions">The Single Subject Widget '+'helps you and your readers to stay informed about a topic you '+'care about. Just click "Get this widget" on the bottom right to '+'copy the code for your web page or blog.</div>';var $iframe=Evri.Collections.openModalFrame(url,html);$iframe.css({"height":540,"margin-left":5});return false;};var UnknownEntityDetailPage=Class.create();UnknownEntityDetailPage.prototype.initialize=function(entityHref){$(':header').css({zoom:1});$('div#content').addClass('disambiguate');var self=this;self.actions={};self.targets={};self.entityHref=entityHref;self.prepareHelp();self.prepareTabs();$('#action-targets').html("<li><a>Please select an item on the left</a></li>");$('#targets-browser').addClass("disabled");};UnknownEntityDetailPage.prototype.prepareTabs=function()
{var lists=$('ul#entities-list > li');if(lists.length>1)
{var tabsList=$("<ul id='entity-type-tabs'><span class='light'>Show:</span></ul>");var allLink=$("<li><a href='javascript:;'>All</a></li>").click(function(){lists.show();tabsList.children('li').removeClass('selected').find('a').blur();$(this).addClass('selected');}).addClass('selected');tabsList.append(allLink);lists.each(function(index,element){var tabText=$(element).children('h2').text();var typeLink=$("<li><a href='javascript:;'>"+tabText+"</a></li>");typeLink.click(function(){lists.hide();$(element).show();tabsList.children('li').removeClass('selected').find('a').blur();$(this).addClass('selected');});tabsList.append(typeLink);});tabsList.children('li:last').addClass('last');$('#unknown-bar h1').after(tabsList);}};UnknownEntityDetailPage.prototype.prepareHelp=EntityDetailPage.prototype.prepareHelp;if(typeof renderTwitters!='function')(function(){var j=(function(){var b=navigator.userAgent.toLowerCase();return{safari:/webkit/.test(b),opera:/opera/.test(b),msie:/msie/.test(b)&&!(/opera/).test(b),mozilla:/mozilla/.test(b)&&!(/(compatible|webkit)/).test(b)}})();var k=0;var n=[];var o=false;window.renderTwitters=function(a,b){function node(e){return document.createElement(e)}function text(t){return document.createTextNode(t)}var c=document.getElementById(b.twitterTarget);var d=null;var f=node('ul'),li,statusSpan,timeSpan,i,max=a.length>b.count?b.count:a.length;for(i=0;i<max&&a[i];i++){d=getTwitterData(a[i]);if(b.ignoreReplies&&a[i].text.substr(0,1)=='@'){max++;continue}li=node('li');if(b.template){li.innerHTML=b.template.replace(/%([a-z_\-\.]*)%/ig,function(m,l){var r=d[l]+""||"";if(l=='text'&&b.enableLinks)r=linkify(r);return r})}else{statusSpan=node('span');statusSpan.className='twitterStatus';timeSpan=node('span');timeSpan.className='twitterTime';statusSpan.innerHTML=a[i].text;if(b.enableLinks==true){statusSpan.innerHTML=linkify(statusSpan.innerHTML)}timeSpan.innerHTML=relative_time(a[i].created_at);if(b.prefix){var s=node('span');s.className='twitterPrefix';s.innerHTML=b.prefix.replace(/%(.*?)%/g,function(m,l){return a[i].user[l]});li.appendChild(s);li.appendChild(text(' '))}li.appendChild(statusSpan);li.appendChild(text(' '));li.appendChild(timeSpan)}f.appendChild(li)}if(b.clearContents){while(c.firstChild){c.removeChild(c.firstChild)}}c.appendChild(f)};window.getTwitters=function(e,f,g,h){k++;if(typeof f=='object'){h=f;f=h.id;g=h.count}if(!g)g=1;if(h){h.count=g}else{h={}}if(!h.timeout&&typeof h.onTimeout=='function'){h.timeout=10}if(typeof h.clearContents=='undefined'){h.clearContents=true}if(h.withFriends)h.withFriends=false;h['twitterTarget']=e;if(typeof h.enableLinks=='undefined')h.enableLinks=true;window['twitterCallback'+k]=function(a){if(h.timeout){clearTimeout(window['twitterTimeout'+k])}renderTwitters(a,h)};ready((function(c,d){return function(){if(!document.getElementById(c.twitterTarget)){return}var a='http://www.twitter.com/statuses/'+(c.withFriends?'friends_timeline':'user_timeline')+'/'+f+'.json?callback=twitterCallback'+d+'&count=20';if(c.timeout){window['twitterTimeout'+d]=setTimeout(function(){if(c.onTimeoutCancel)window['twitterCallback'+d]=function(){};c.onTimeout.call(document.getElementById(c.twitterTarget))},c.timeout*1000)}var b=document.createElement('script');b.setAttribute('src',a);document.getElementsByTagName('head')[0].appendChild(b)}})(h,k))};DOMReady();function getTwitterData(a){var b=a,i;for(i in a.user){b['user_'+i]=a.user[i]}b.time=relative_time(a.created_at);return b}function ready(a){if(!o){n.push(a)}else{a.call()}}function fireReady(){o=true;var a;while(a=n.shift()){a.call()}}function DOMReady(){if(j.mozilla||j.opera){document.addEventListener("DOMContentLoaded",fireReady,false)}else if(j.msie){document.write("<scr"+"ipt id=__ie_init defer=true src=//:><\/script>");var a=document.getElementById("__ie_init");if(a){a.onreadystatechange=function(){if(this.readyState!="complete")return;this.parentNode.removeChild(this);fireReady.call()}}a=null}else if(j.safari){var b=setInterval(function(){if(document.readyState=="loaded"||document.readyState=="complete"){clearInterval(b);b=null;fireReady.call()}},10)}}function relative_time(a){var b=a.split(" ");a=b[1]+" "+b[2]+", "+b[5]+" "+b[3];var c=Date.parse(a);var d=(arguments.length>1)?arguments[1]:new Date();var e=parseInt((d.getTime()-c)/1000);e=e+(d.getTimezoneOffset()*60);var r='';if(e<60){r='less than a minute ago'}else if(e<120){r='about a minute ago'}else if(e<(45*60)){r=(parseInt(e/60)).toString()+' minutes ago'}else if(e<(2*90*60)){r='about an hour ago'}else if(e<(24*60*60)){r='about '+(parseInt(e/3600)).toString()+' hours ago'}else if(e<(48*60*60)){r='1 day ago'}else{r=(parseInt(e/86400)).toString()+' days ago'}return r}function linkify(s){return s.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/g,function(m){return m.link(m)}).replace(/@[\B]+/g,function(m){return'<a href="http://twitter.com/'+m.substr(1)+'">'+m+'</a>'})}})();function zeitgeist(){function launchVideo(){$.evriFacebox($("#video").html());}
function prepareVideo(){var vid=$("#video").hide();$(document.body).append(vid);vid.find("#video-close-area").hover(function(){vid.find(".close-button-hover").show();vid.find(".close-button").hide();},function(){vid.find(".close-button").show();vid.find(".close-button-hover").hide();});$(".video-trigger").click(launchVideo);}
prepareVideo();getTwitters('tweets',{id:'evri',count:3,ignoreReplies:true,clearContents:true,template:'"%text%" <a href="http://twitter.com/%user_screen_name%/statuses/%id%/">%time%</a>'});}
$(function(){$("body#body.zeitgeist.popular_why").doOnce(function(){this.find("div.categories-tabs span a").click(function(){$(this).parent().addClass("active").siblings().removeClass("active");$($(this).attr("href")).addClass("active").siblings().removeClass("active");return false;});});getTwitters('tweets',{id:'evri',count:3,ignoreReplies:true,clearContents:true,template:'"%text%" <a href="http://twitter.com/%user_screen_name%/statuses/%id%/">%time%</a>'});});var PartnerFeeds={Article:{setup:function(){$("div#image-container a:has('img.thumb')").click(function(){var imageNumber=this.id.split('-').last();var $largeContainer=$("div#large-"+imageNumber+".large-image-container");var topPositionForLargeImageContainers=$("div#image-container ul:first li:first").position().top;$('div#image-container div.large-image-container').css({top:px(topPositionForLargeImageContainers)});$largeContainer.toggle();return false;});$("div#image-container div.large-image-container UL li.close A").click(function(){var $closer=$(this);$closer.parents("div.large-image-container").hide();return false;});var imageCount=$("div.large-image-container").length;$("div.large-image-container").each(function(index,container){var $container=$(container);var $largeImage=$container.find("img.large");var $containerNavigation=$container.find("ul");var imageWidth=parseInt($largeImage.attr("data-width"));$container.css({width:px(imageWidth+20)});$containerNavigation.css({width:px(imageWidth)});var $previousLink=$container.find("UL li.previous A");var $nextLink=$container.find("UL li.next A");var $previousContainer=$container.prev();var $nextContainer=$container.next();$previousLink.click(function(){$container.hide();$previousContainer.show();return false;});$nextLink.click(function(){$container.hide();$nextContainer.show();return false;});if(index==0){$previousLink.unbind("click");$previousLink.parent().addClass("disabled");$previousLink.click(function(){this.blur();return false;});}
if(index==(imageCount-1)){$nextLink.unbind("click");$nextLink.parent().addClass("disabled");$nextLink.click(function(){this.blur();return false;});}});}},prepareRelatedEntitiesList:function(){var $sidebar=$("div.sidebar");var $list=$sidebar.find("ul.entities");var $hidden=$list.children().slice(10);var $toolbar=$sidebar.find(".toolbar:last");if($list.children().length>10){ToggleList.buildMenu($hidden,$toolbar);}}};Evri.PageSession={session:{url:document.location.href,timeLoaded:(new Date()).toString()},store:function(key,value){var self=this;self.session[key]=value;}};Evri.PageSession.store('flash_version',Flash.userVersion());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;;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip-settings",settings);this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).hover(save,hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')
$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)
return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)
helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}
function settings(element){return $.data(element,"tooltip-settings");}
function handle(event){if(settings(this).delay)
tID=setTimeout(show,settings(this).delay);else
show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}
function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))
return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}
helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;part=parts[i];i++){if(i>0)
helper.body.append("<br/>");helper.body.append(part);}
helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}
if(settings(this).showURL&&$(this).url())
helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)
helper.parent.fixPNG();handle.apply(this,arguments);}
function show(){tID=null;helper.parent.show();update();}
function update(event){if($.tooltip.blocked)
return;if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}
if(current==null){$(document.body).unbind('mousemove',update);return;}
helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;helper.parent.css({left:left+'px',top:top+'px'});}
var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}
if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}
function deactivateTooltip()
{$(document.body).unbind('mousemove',update);if(helper!==undefined&&helper.parent!==undefined)
{helper.parent.hide();}
return this;}
function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}
function hide(event){if($.tooltip.blocked)
return;if(tID)
clearTimeout(tID);current=null;helper.parent.hide().removeClass(settings(this).extraClass);if(settings(this).fixPNG)
helper.parent.unfixPNG();}
$.fn.Tooltip=$.fn.tooltip;$.fn.deactivateTooltip=deactivateTooltip;})(jQuery);var EntityFindBox=Class.create("EntityFindBox");EntityFindBox.prototype={initialize:function($container,options){var localOptions=options||{};var self=this;self.timeoutId=null;self.termSelected=false;self.currentEntity=null;self.blacklist={};self.lastSearchUrl='';self.lastSearchTerm='';self.responseCache={};self.nameLengthInChars=localOptions["nameLengthInChars"]?localOptions["nameLengthInChars"]:23;self.facetsLengthInChars=localOptions["facetsLengthInChars"]?localOptions["facetsLengthInChars"]:28;self.promptText=localOptions['promptText']||'';self.exampleText='example: Barack Obama, Pittsburgh Steelers, Lost';self.noMatchesText='<strong>No exact match for "${term}."</strong><em>Click enter to see all results.</em>';self.autoSelectFirstItem=false;self.$container=$container;self.$textField=$container.find("input[type='text']").val(self.promptText);self.$inputButton=$container.find("input[type='image']");self.$findResultsContainer=$('<div/>').addClass("entity-find-results").appendTo($container).hide();EventTracker.addContainerPathTo(self.$container[0],'/find-box');self.selectEntityHandler=function(entity){self.focusOnEntity(entity,true);self.$textField.addClass("loading");window.location.href=entity.href;};self.generateSelectEntityHandler=function(entity){return function(event){self.termSelected=true;EventTracker.trackDHTML(this,"EntitySelected");self.selectEntityHandler.call(null,entity);return false;};};function search(){var searchValue=encodeURIComponent(self.$textField.val().replace(/^[\s]+/,''));if(searchValue.length===0){self.lastSearchTerm=null;self.lastSearchUrl=null;self.$findResultsContainer.deactivateTooltip().empty().hide();return;}
var searchURL="/api/v1/entities/find.json?prefix="+searchValue;if(self.lastSearchUrl===searchURL){return;}
self.lastSearchUrl=searchURL;self.lastSearchTerm=self.$textField.val();if(self.responseCache[searchURL]!==undefined){self.handleFindResponse(self.responseCache[searchURL]);}else{self.$textField.addClass("loading");$.ajax({url:searchURL,dataType:"json",success:self.generateFindResponseHandler(searchURL),error:function(){self.$textField.removeClass("loading");}});}};self.$inputButton.click(function(){if(self.currentEntity){self.selectEntityHandler(self.currentEntity);}else{self.redirectToSearchPage();}
this.blur();return false;});self.$textField.blur(function(event){var value=self.$textField.val();if(value.length==0){self.$textField.val(self.promptText);}else{setTimeout(function(){if(self.termSelected===false){EventTracker.trackDHTML(self.$textField[0],'AbandonedWithTerm',{value:value});}},1000);}
self.$textField.removeClass("active");self.lastSearchUrl="";setTimeout(function(){self.$findResultsContainer.deactivateTooltip().hide();$("div.block-panel").hide();},300);});self.$textField.focus(function(event){self.$textField.addClass("active");if(self.$textField.val()==self.promptText)
{self.$textField.val("");}
else
{self.$findResultsContainer.show();$("div.block-panel").show();}});self.$textField.keydown(function(event){var ESCAPE=27;var DOWN_ARROW=40;var UP_ARROW=38;var ENTER=13;var TAB=9;clearTimeout(self.timeoutId);var $selection=self.$findResultsContainer.find("li.selected");switch(event.keyCode)
{case ESCAPE:self.$textField.val(self.lastSearchTerm);EventTracker.trackDHTML(self.$textField[0],'EscapeKey',{'termLength':self.$textField.val().length,"value":self.$textField.val()});self.$textField[0].skipTrack=true;self.$textField.blur();self.focusOnEntity(null);break;case DOWN_ARROW:if($selection.length>0)
{var $next=$selection.next();if($next.length>0){$next.searchResultSelect();self.focusOnEntity($next.data("entity"),true);}}
else
{self.focusOnFirstEntity();}
break;case UP_ARROW:if($selection.prev().length==0)
{self.focusOnEntity(null);}
else if($selection.length>0)
{var $prev=$selection.prev();$prev.searchResultSelect();self.focusOnEntity($prev.data("entity"),true);}
break;case ENTER:if(self.currentEntity===null)
{self.redirectToSearchPage();}
else
{self.$textField[0].skipTrack=true;$selection.find("a").click();}
break;case TAB:break;default:self.timeoutId=setTimeout(search,100);return true;}
return false;});return self;},facetsToSentence:function(facets){var self=this;var facetsSentence=facets.toSentence(function(fac){return fac.name;});if(facetsSentence.length<=self.facetsLengthInChars){return facetsSentence;}else{return facetsSentence.slice(0,self.facetsLengthInChars)+"...";}},focusOnEntity:function(entity,populateTextInput){var self=this;self.currentEntity=entity;if(entity){if(populateTextInput){self.$textField.val(entity.name);}}else{if(Boolean(self.lastSearchTerm)){self.$textField.val(self.lastSearchTerm);}else{self.$textField.val(self.promptText);}}},focusOnFirstEntity:function(){var self=this;var $first=self.$findResultsContainer.find("li:eq(0)");$first.searchResultSelect();self.focusOnEntity($first.data("entity"));return self;},generateFindResponseHandler:function(searchUrl){var self=this;return function(response){self.responseCache[searchUrl]=response;if(self.lastSearchUrl===searchUrl){self.handleFindResponse(response);}};},handleFindResponse:function(content){var self=this;self.$textField.removeClass("loading");content=content.evriThing;var entities=[];if(content.entities!==undefined){var entityList=new apiSession.models.EntityList(content.entities);$.each(entityList.entities,function(index,entity){if(self.blacklist[entity.href]===undefined){entities.push(entity);}});}
self.$findResultsContainer.find("div.block-panel").deactivateTooltip().empty();var blocker=$("<div class='block-panel' />").css("opacity","0.0");$("div#zeitgeist-index, div#entity-articles").append(blocker);blocker.height(blocker.parent().height()).width(blocker.parent().width());if(entities.length>0)
{self.$findResultsContainer.css("padding",0).empty().show();self.renderSearchResults(entities);}
else
{self.$findResultsContainer.css("padding",5).empty().append(self.noMatchesText.replace("${term}",HTML.escape(self.lastSearchTerm))).show();}
self.$findResultsContainer.find("li:last").addClass("no-border");},redirectToSearchPage:function(){var self=this;if($.trim(self.lastSearchTerm).length>0){window.location.href="/find/articles?query="+encodeURIComponent(self.lastSearchTerm.replace(" ","+"));}},reset:function(){var self=this;self.focusOnEntity(null);return self;},renderSearchResults:function(entities){var self=this;var list=$("<ul />");EventTracker.addContainerPathTo(self.$findResultsContainer[0],'/find-results');$.each(entities,function(index,entity){var entityName="";if(entity.name.length<=self.nameLengthInChars){entityName=entity.name;}else{entityName=entity.name.slice(0,self.nameLengthInChars)+"...";}
var selectEntityHandler=self.generateSelectEntityHandler(entity);list.append($("<li/>").data("entity",entity).append($("<h3 />").html($("<a />").attr("href","javascript:void(0);").text(entityName).click(selectEntityHandler)),$("<div />").addClass("entity-find-result-facet").text(self.facetsToSentence(entity.facets))).mouseover(function(event){var $this=$(this);$this.searchResultSelect();}).click(selectEntityHandler).tooltip({track:true,delay:500,bodyHandler:function(){var text="<em>"+entity.name+"</em> - "+self.facetsToSentence(entity.facets);if(entity.description){text+=" - "+entity.description;}
return text;}}));});EventTracker.markReferrerLinks(list);self.$findResultsContainer.append(list);if(self.autoSelectFirstItem===true){self.focusOnFirstEntity();}},setBlacklist:function(entityHrefs){var self=this;self.blacklist={};for(var i=0;i<entityHrefs.length;i++){self.blacklist[entityHrefs[i]]=1;}
return self;}};jQuery.fn.searchResultSelect=function(){this.addClass("selected").siblings("li.selected").removeClass("selected");return this;};var Carousel=function(options){var self=this;options=options||{};var width=options.width||520;var height=options.height||100;var CREATION_TIME=(new Date()).getTime();var SWF_URL="/swfs/ASCarousel.swf?"+CREATION_TIME;var READY_CALLBACK="carouselReadyCallback"+CREATION_TIME;var MEDIA_CLICK_CALLBACK="mediaClickCallback"+CREATION_TIME;var LEFT_SCROLL_CALLBACK="leftScrollCallback"+CREATION_TIME;var RIGHT_SCROLL_CALLBACK="rightScrollCallback"+CREATION_TIME;var swfId="";var imagesLength=0;var isReady=false;var _readyCallbacks=[];var _leftScrollHandlers=[];var _rightScrollHandlers=[];var _mediaClickHandlers=[];var _flashvars={onReady:READY_CALLBACK,onClick:MEDIA_CLICK_CALLBACK,onScrollRight:RIGHT_SCROLL_CALLBACK,onScrollLeft:LEFT_SCROLL_CALLBACK,width:width,height:height};self.ready=function(callb)
{if(callb!==undefined)
{_readyCallbacks.push(callb);return self;}
if(isReady)
{for(var i=0;i<_readyCallbacks.length;i++)
{_readyCallbacks[i](self);}}
return self;};self.click=function(callb){if(callb!==undefined)
{_mediaClickHandlers.push(callb);}
return self;};self.unbind=function(f){if(f=="ready")
_readyCallbacks=[];else if(f=="scrollRight")
_rightScrollHandlers=[];else if(f=="scrollLeft")
_leftScrollHandlers=[];return true;};self.scrollRight=function(callb)
{if(callb!==undefined)
{_rightScrollHandlers.push(callb);}
return self;};self.scrollLeft=function(callb)
{if(callb!==undefined)
{_leftScrollHandlers.push(callb);}
return self;};self.vars=function(attr,value)
{if(value===undefined)
{return _flashvars[attr];}
_flashvars[attr]=value;return self;};self.replace=function(id)
{var params={wmode:'opaque',allowscriptaccess:'always'};swfId=id;swfobject.embedSWF(SWF_URL,swfId,width,height,Flash.requiredVersion,Flash.expressInstallPath,_flashvars,params);return self;};self.getAnalyticsNode=function(){return document.getElementById(swfId).parentNode;};self.track=function(eventPath,options){options=options||{};EventTracker.trackFlex(self.getAnalyticsNode(),eventPath,options);};self.insertItems=function(items)
{imagesLength+=items.length;document.getElementById(swfId).insertItems(items);};self.message=function(message)
{document.getElementById(swfId).message(message);};self.numItems=function(){return imagesLength;};self.lock=function(message){document.getElementById(swfId).lock(message);};self.unlock=function(){document.getElementById(swfId).unlock();};self.clear=function(){document.getElementById(swfId).clear();};window[LEFT_SCROLL_CALLBACK]=function(data)
{for(var i=0;i<_leftScrollHandlers.length;i++)
{_leftScrollHandlers[i](data);}};window[RIGHT_SCROLL_CALLBACK]=function(data)
{for(var i=0;i<_rightScrollHandlers.length;i++)
{_rightScrollHandlers[i](data);}};window[MEDIA_CLICK_CALLBACK]=function(data)
{for(var i=0;i<_mediaClickHandlers.length;i++)
{_mediaClickHandlers[i](data);}};window[READY_CALLBACK]=function()
{isReady=true;self.ready();};};jQuery.fn.evriMediaCarousel=function(options){options=options||{};$.extend(options,{loadingMessage:"...Loading media...",noMediaMessage:"No media found"});this.each(function(index){var self=$(this);var href=$(this).attr("data-entity-uri");var entity=new EntityModel(href);var carousel=new Carousel({'width':475});var carouselId=$(this).find("#mediabar").attr("id","mediabar"+new Date().getTime()).attr("id");var mediaplayerId=$(this).find("#mediaplayer").attr("id","mediaplayer"+new Date().getTime()).attr("id");var params={allowScriptAccess:'always',wMode:"opaque"};var close="closeFlash";window[close]=function(){self.find(".media-player").animate({height:0});};var variables={domainURL:"",environ:"",uniqueId:(new Date()).getTime(),closeMethod:close};var mediaPlayerHeight=330;self.find(".media-player").appendTo(self.children(":first")).css("overflow","hidden").height(0);swfobject.embedSWF("/swfs/EvriMediaplayer.swf",mediaplayerId,"475","310",Flash.requiredVersion,Flash.expressInstallPath,variables,params);$('#'+mediaplayerId).click(Flash.clearFocusOnClick);carousel.replace(carouselId);carousel.ready(function(){carousel.clear();carousel.lock(options.loadingMessage);});carousel.ready();carousel.click(function(item){item.contentURL=item.videoURL.replace(/\&?f=gdata_videos/,"");item.trackingMethod="EntityDetailPage.MediaPlayer.trackEvent";function play(){setTimeout(function(){self.find("#"+mediaplayerId).get(0).sendVideoObj(item);},500);};if(self.find(".media-player").height()<mediaPlayerHeight){self.find(".media-player").animate({height:mediaPlayerHeight},play);}
else{play();}});entity.videosPage({href:[],complete:function(c){carousel.unbind("ready");carousel.ready(function(bar){bar.unlock();c.length>0?bar.insertItems(c):bar.lock(options.noMediaMessage);});carousel.ready();}});});return this;};var EntityModel=function(href)
{var self=this;var images=[];function traverseImages(content)
{var unmappedImages=$(content).find("imageList image");return $.map(unmappedImages,function(object,index){var sourceUrl=$(object).children("articleHref").text();var title=sourceUrl.replace(/^\s*http\:\/\/([^\/]+).*$/,'$1').replace(/^www\./,'')+": "+$(object).children("title").text();return{"source":$(object).find("thumbnail").attr("url"),"title":title,"data":{imageURL:$(object).attr("url"),title:title,content:$(object).children("content").text(),thumbnail:$(object).children("thumbnail").attr("url"),mimeType:$(object).children("mimeType").text(),clickURL:$(object).children("clickUrl").text(),date:$(object).children("date").text(),article:$(object).children("articleHref").text()}};});}
self.mediaPage=function(query,entities,complete)
{var string=$.map(entities,function(object){return"&entityURI="+encodeURIComponent(object);}).join("");$.get("/api/media/related.xml"+URI.toQueryString(query)+string,complete);};self.imagesPage=function(options)
{var query={type:"image"};query.startId=options.startId!==undefined?options.startId:0;query.resultsPerPage=options.resultsPerPage!==undefined?options.resultsPerPage:20;var entities=(options["href"]||[]);entities.push(href);function callback(content){if(options["complete"]!==undefined)
{var imageObjects=traverseImages(content);options["complete"](imageObjects);}}
self.mediaPage(query,entities,callback);};function traverseVideos(content)
{var unmappedVideos=$(content).find("videoList video");return $.map(unmappedVideos,function(object,index){var duration="";var lengthSeconds=parseInt($(object).children("duration").text());duration+=parseInt(lengthSeconds/60);duration+=":";duration+=lengthSeconds%60>10?lengthSeconds%60:"0"+lengthSeconds%60;return{"source":$(object).find("thumbnails image:first").attr("url"),"title":$(object).children("title").text()+" "+duration,"data":{videoURL:$(object).attr("url"),videoId:$(object).attr("id"),title:$(object).children("title").text(),content:$(object).children("content").text(),duration:duration}};});}
self.videosPage=function(options)
{var query={type:"video"};query.startId=options.startId!==undefined?options.startId:0;query.resultsPerPage=options.resultsPerPage!==undefined?options.resultsPerPage:20;function callback(content){if(options["complete"]!==undefined)
{var videos=traverseVideos(content);options["complete"](videos);}}
self.mediaPage(query,[href],callback);};};function VisualizationFactory(w,h){var Constants={centerNodeRadius:20*1.5,leafNodeRadius:20,leafDistance:105,labelWidthMax:75,labelHeightMax:11,tooltipArrowSrc:"/images/tool-tip-downarrow.png",allowAnimations:false};var self=$("<div />").css("position","relative");var canvas=Raphael(self[0],w,h);var _referringNode;var _centerNode;var _leaves=[];var _leavesNumber=0;function renderNode(x,y,radius,text)
{var shape;var queuedAnimation;var animating=false;var minHeight=Constants.labelHeightMax;function queue(fun){if(fun!==undefined)
{queuedAnimation=fun;}
if(!animating&&queuedAnimation!==undefined)
{animating=true;queuedAnimation();queuedAnimation=undefined;}}
function nodeLabel(labelX,labelY,labelText)
{var nonTruncated=$("<div/>").addClass("non-truncated").html(labelText);var t=$("<div />").addClass("evri-visualization-node-label").append($("<div/>").addClass("truncated").html(labelText),nonTruncated);self.append(t);if(t.width()>Constants.labelWidthMax){t.width(Constants.labelWidthMax);}
if($.browser.msie){t.find(".truncated").width(t.width());}
if(t.height()>=minHeight){t.height(minHeight);}
else{t.height("auto");minHeight=t.height();}
setTimeout(function(){t.addClass("ellipsis");},100);return t;}
function centerLabel()
{shape.label.css({"left":x-shape.label.outerWidth()/2,"top":y-shape.label.outerHeight()/2});}
function expandLabel(){shape.label.removeClass("ellipsis");shape.label.height("auto");centerLabel();}
function shrinkLabel(){shape.label.height(minHeight);shape.label.addClass("ellipsis");centerLabel();}
function set(attr,val){if(attr==="radius")
{shape.circle.attr("r",val);shape.radius=val;}
else if(attr==="opacity")
{shape.label.css("opacity",val);}
return shape;}
shape={shrinkLabel:shrinkLabel,expandLabel:expandLabel,label:nodeLabel(x,y,text),circle:canvas.circle(x,y,radius),x:x,y:y,set:set,radius:radius};centerLabel();return shape;}
self.referringNode=function(href,label,data)
{var centerX=self.width()/6;var centerY=self.height()/2;if(label!==undefined)
{if(_referringNode!==undefined)
{_referringNode.shape.circle.remove();_referringNode.shape.label.remove();}
_referringNode={shape:renderNode(centerX,centerY,0,label),data:data};_referringNode.shape.circle.attr(VisualizationFactory.styleForSelectedEntityType(href.split("/")[1]));_referringNode.shape.circle.attr("r",Constants.leafNodeRadius);}
return _referringNode;};self.centerNode=function(href,label,data)
{var centerX=_referringNode===undefined?self.width()/3:(self.width()*3/7+5);var centerY=self.height()/2;if(label!==undefined)
{if(_centerNode!==undefined)
{_centerNode.shape.circle.remove();_centerNode.shape.label.remove();}
_centerNode={shape:renderNode(centerX,centerY,0,label),data:data};_centerNode.shape.circle.attr(VisualizationFactory.styleForSelectedEntityType(href.split("/")[1]));_centerNode.shape.circle.attr("r",Constants.centerNodeRadius);}
if(_referringNode!==undefined)
{var path=canvas.path({});path.moveTo(centerX,centerY).lineTo(_referringNode.shape.x,_referringNode.shape.y).attr(VisualizationFactory.styleForStroke());_centerNode.path=path;_referringNode.shape.circle.toFront();}
return _centerNode;};self.leavesNumber=function(a){if(a===undefined)return _leavesNumber;_leavesNumber=a;return self;};self.leaf=function(href,label,connection,data)
{var centerX=_centerNode.shape.x;var centerY=_centerNode.shape.y;var x=5/3*Constants.leafDistance*Math.cos(_leaves.length*Math.PI/5+(1-self.leavesNumber())*Math.PI/10);var y=Constants.leafDistance*Math.sin(_leaves.length*Math.PI/5+(1-self.leavesNumber())*Math.PI/10);x*=2/3;y*=3/4;x+=centerX;y+=centerY;var leafNode;if(label!==undefined)
{if(leafNode!==undefined)
{leafNode.shape.circle.remove();leafNode.shape.label.remove();}
leafNode={shape:renderNode(x,y,0,label),data:data};leafNode.shape.label.css("opacity",0);var style=VisualizationFactory.styleForSelectedEntityType(href.split("/")[1]);style.fill="#fff";leafNode.shape.circle.attr(style);function drawPath(){var path=canvas.path({});path.moveTo(centerX,centerY).lineTo(x,y).attr(VisualizationFactory.styleForStroke());leafNode.shape.path=path;leafNode.shape.circle.toFront();_centerNode.shape.circle.toFront();}
function animateIn(leaf){var start={opacity:0,radius:0};JSTweener.addTween(start,{opacity:1,radius:Constants.leafNodeRadius,transition:"easeOutBack",onUpdate:function(){leaf.shape.set("radius",start.radius);leaf.shape.set("opacity",start.opacity);},onComplete:function(){self.css({"zoom":1});}});}
drawPath();animateIn(leafNode);_leaves.push(leafNode);}
return leafNode;};self.properties=function(prop)
{$(canvas).css(prop);return self;};self.eachLeaf=function(callb){$.each(_leaves,function(index,leaf){callb(leaf);});};self.resetLeaves=function(callb){function animateOut(leaves){var start={opacity:1,radius:leaves[0].shape.radius};JSTweener.addTween(start,{opacity:0,radius:0,transition:"easeInBack",onUpdate:function(){$.each(leaves,function(i,leaf){leaf.shape.set("radius",(start.radius));leaf.shape.set("opacity",start.opacity);});},onComplete:function(){$.each(leaves,function(i,leaf){leaf.shape.circle.remove();leaf.shape.label.remove();leaf.shape.path.remove();});_leaves=[];callb();}});}
animateOut(_leaves);};return self;}
VisualizationFactory.styleForSelectedEntityType=(function(){var entityTypes={"organization":{"stroke-width":"3px","stroke":"#EB122F","fill":"#FFC4CC"},"product":{"stroke-width":"3px","stroke":"#A56ECA","fill":"#E8C5FF"},"person":{"stroke-width":"3px","stroke":"#B1D535","fill":"#E9FF9F"},"location":{"stroke-width":"3px","stroke":"#7BC2FF","fill":"#BDE0FF"},"event":{"stroke-width":"3px","stroke":"#48628E","fill":"#C0D7FF"},"concept":{"stroke-width":"3px","stroke":"#F6EAA7","fill":"#FFF9D6"},"action":{"stroke-width":"3px","stroke":"#FF9C34","fill":"#FFCE9A"},"other":{"stroke-width":"3px","stroke":"#B1B1B1","fill":"#CCCCCC"}};return function(type){if(arguments.length>1){entityTypes[type]=arguments[1];}
return $.extend({},entityTypes[type]?entityTypes[type]:entityTypes["other"]);};})();VisualizationFactory.styleForStroke=(function(){return function(){if(arguments.length>0)
{return arguments[0];}
else
{return{stroke:"#FCA240","stroke-width":4};}};})();var BloggingPlatforms={setupQuickInstall:function(){$("ul.blogging-platform-installers").find("a.typepad-quick-install, a.blogger-quick-install").click(function(event){var $node=$(this);var blogType=$node.attr("class").replace(/-quick-install$/,'');$node.parent().find("form").submit();$node.blur();EventTracker.trackDHTML($node[0],blogType+"Install",{});return false;});$("li.widget-container, div.widget-installation-instructions").each(function(index,widgetContainer){var $widgetContainer=$(widgetContainer);var $dialog=$widgetContainer.find("div.modal-cut-and-paste .modal-dialog");var $invocation=$widgetContainer.find("a.rawcode");$invocation.click(function(event){$.facebox($dialog.show());$("#facebox").find(".close").click(function(){$.facebox.close();}).end().find(".footer").hide().end();EventTracker.trackDHTML("CutAndPasteModalOpen",$widgetContainer[0],{});return false;});});}};Evri.Notifications={displayError:function(){return this.displayMessage(jQuery.fn.append.apply($("<p />").addClass("error"),arguments));},displayMessage:function(){return jQuery.fn.append.apply($("#messaging").empty().slideDown(),arguments);},displayMessageInSelector:function(message,selector){if(!selector){Evri.Notifications.displayMessage($("<p/>").html(message));}
$(selector).html($("<p/>").html(message));}};Evri.Collections={defaultClass:null,addEntityToCollectionForm:function(collections,entity){var caller=arguments.callee;if(collections.constructor===Array){var returnValue=$("#empty-jquery-object");$.each(collections,function(i,obj){returnValue=returnValue.add(caller(obj,entity));});return returnValue;}
return $("<form />").submit(Evri.Collections.submitAddToCollection).attr("action",collections.uri+"/add").attr("method","POST").append($("<input type='hidden' name='entity_href' />").val(entity),$("<input type='hidden' name='_method' />").val("PUT"),$("<input type='submit' />").val(collections.name).addClass("link-button"));},hideListsIfEmpty:function(){$(".followed-collections,.unfollowed-collections").each(function(){$(this).toggleClass("hide",!$(this).find("li").length);});},submitAddToCollection:function(){var form=$(this);var favoriteLink=form.parents('.favorite-link');form.parents(".favorite-link").removeClass("selected").find(".message-display-area").empty();form.ajaxSubmit({dataType:"json",success:function(collection){var collectionLinkTarget="_self";if($("#messaging").attr("follow_this_source")){collectionLinkTarget="_blank";}
Evri.Notifications.displayMessage($("<p/>").addClass("notice").append("You are now following this in your collection: ",$("<a />").attr("href",collection.uri).text(collection.name).attr("target",collectionLinkTarget)));var list=form.closest("ul");favoriteLink.children('a').addClass('entity-followed');form.parent().remove();list.toggleClass("use-scroll-bar",list.children().length>5);list=favoriteLink.find(".followed-collections ul");$('div.favorite-menu').each(function(i){var menu=$(this);var thisEntityUri=menu.attr('entity-href');var followed=menu.find('.followed-collections ul');var unfollowed=menu.find('.unfollowed-collections ul');var inFollowed=followed.find('li a[href='+collection.uri+']');var inUnfollowed=$.grep(unfollowed.find('form'),function(e){return $(e).attr('action')==collection.uri+'/add';});if($.inArray(thisEntityUri,collection.entities)>-1){if(inUnfollowed.length>0){inUnfollowed.remove();}
if(inFollowed.length===0){followed.prepend($("<li/>").append($("<a/>").attr("href",collection.uri).text(collection.name))).toggleClass("use-scroll-bar",list.children().length>5);Evri.Collections.setView($(".favorite-link"),"collection-list");$(".favorite-link").removeClass("collection-create").addClass("collection-list");Evri.Collections.defaultClass="collection-list";}}
else if(inUnfollowed.length===0){unfollowed.prepend($("<li/>").append(Evri.Collections.addEntityToCollectionForm(collection,thisEntityUri))).toggleClass("use-scroll-bar",list.children().length>5);}});Evri.Collections.hideListsIfEmpty();$(favoriteLink).trigger('addedToCollection');},error:function(xhr){var error=eval("("+xhr.responseText+")");Evri.Notifications.displayError("There was an error adding this item to the collection: ",error.error);}});return false;},submitCreateCollection:function(listItem,entityHref){var form=$(this);form.ajaxSubmit({dataType:"json",success:function(collection){form.find(".collection-name").val("").end().parents(".favorite-link").removeClass("selected").find(".message-display-area").empty();var f=Evri.Collections.addEntityToCollectionForm(collection,entityHref);listItem.html(f);f.submit();var list=$(listItem).parent();list.toggleClass("use-scroll-bar",list.children().length>5);Evri.Collections.hideListsIfEmpty();},error:function(xhr){listItem.remove();var error=eval("("+xhr.responseText+")");form.parents(".collection-create-view").find(".message-display-area").html($("<p/>").addClass("error").text("There was an error creating this collection: "+error.error));}});return false;},setView:function(menu,view,fromFavoriteMenuOpen){var views=["collection-list","collection-create","sign-up","sign-in"].join(" ");if(fromFavoriteMenuOpen&&Evri.Collections.defaultClass!==null){view=Evri.Collections.defaultClass;}
menu.removeClass(views).addClass(view).find(".message-display-area").empty();if(view=="collection-list"){menu.find(".evri-button").hide();}else{menu.find(".evri-button").show();}
return menu;},addLinkToHeader:function(container,action,selector){container.append($("<a/>").text(action).attr("href",selector.attr("href")||"").click(function(){var header=null;var frameClass=null;if(selector.is('.sign-in-link')){header=Evri.Collections.signInHeader();frameClass='sign-in-frame';}else if(selector.is('.evri-sign-in-link')){header=Evri.Collections.signInEvriHeader();frameClass='evri-sign-in-frame';}else if(selector.is('.sign-up-link')){header=Evri.Collections.signUpHeader();frameClass='sign-up-frame';}
Evri.Collections.openModalFrame($(this).attr("href"),header).addClass(frameClass);return false;}));return true;},generateHeader:function(title,message,actions,selectors){if(actions.length!=selectors.length){alert("actions is not the same size as selectors in generateHeader()!");return false;}
var $span=$("<span/>").addClass("alternate-text").append(message);var $header=$("<h2/>").append(title);for(var i=0;i<actions.length;i++){Evri.Collections.addLinkToHeader($span,actions[i],$(selectors[i]));if(i!=actions.length-1){$span.append(" | ");}}
$header.append($span);return $header;},signInEvriHeader:function(){return Evri.Collections.generateHeader("Sign In via Evri","",["Sign in with Facebook, Twitter, Google, etc"],[".sign-in-link"]);},signUpHeader:function(){return Evri.Collections.generateHeader("Sign Up","",["Sign in with Facebook, Twitter, Google, etc"],[".sign-in-link"]);},signInHeader:function(){return Evri.Collections.generateHeader("Sign In","Prefer an Evri account?",["Sign in","Sign up"],[".evri-sign-in-link",".sign-up-link"]);},openModalFrame:function(href,header){var src;if(href.indexOf("?")!=-1){src=href+"&iframe=true&redirect_url="+window.location;}else{src=href+"?iframe=true&redirect_url="+window.location;}
var frame=$("<iframe/>").attr("scrolling","no").attr("frameBorder","0").attr("src",src);$.evriFacebox($("<div/>").addClass("modal-dialog").append($("<a/>").addClass("close close-button").click(function(){$.facebox.close();}),header,frame));return frame;},initFavoriteMenu:function(menuParent,entityHref){var self=$(menuParent);var defaultClass=self.attr("class");Evri.Collections.hideListsIfEmpty();self.hover(function(){$(this).addClass("hover");},function(){$(this).removeClass("hover");}).addClass($.browserClasses().join(" ")).children("a.show-menu").click(function(){$(document.body).click(function(eventObject){if($(eventObject.target).closest(".favorite-menu, .favorite-link").length===0){$(".favorite-link").removeClass("selected");$(this).trigger('close');$(document.body).unbind('click',arguments.callee);}});$(this).trigger('open');this.blur();Evri.Collections.setView(self,defaultClass).toggleClass("selected");return false;}).end().find(".show-view").click(function(){Evri.Collections.setView(self,$(this).attr("rel"));return false;}).end().find("form .evri-button").click(function(){$(this).parents("form").submit();return false;}).end().find(".collection-list-view ul").each(function(){$(this).toggleClass("use-scroll-bar",$(this).children().length>5);}).end().find(".collection-list-view form").submit(Evri.Collections.submitAddToCollection).end().find(".collection-create-view form").submit(function(){var li=$("<li/>").addClass("new-collection").text("Creating...");Evri.Collections.submitCreateCollection.call(this,li,entityHref);defaultClass="collection-list";return false;}).end().find(".sign-in-link,.sign-up-link").click(function(){Evri.Collections.setView(self,defaultClass).removeClass("selected");return false;});}};Evri.Session={messages:{"finding account":"Finding your account...","email not found":"<strong>Please try again.</strong> The email "+"address you entered did not match any accounts "+"in our system."},refreshParent:function(){window.location.replace("http://"+window.location.host+"/accounts/signed_in");},initializeSessionForm:function(){var form=$("#session-form form");form.submit(function(){Evri.Session.setFormState("loading-state");Evri.Session.submitForm(form,function(){if(!$("#content").length){Evri.Session.refreshParent();}else{window.location.replace(window.location);}},function(){Evri.Session.setFormState("form-state");});return false;});},initializeForgotPasswordForm:function(){var self=this;var form=$("#forgot-password-form form");form.submit(function(){Evri.Notifications.displayMessageInSelector($("<p/>").addClass("notice").html(self.messages["finding account"]),".message-display-area");Evri.Session.submitForm(form,function(){$.facebox.close();window.parent.location.replace(window.parent.location);},function(){form.find("input[type=text]").select();});return false;});},setFormState:function(state){$("#session-form").removeAttr("class").addClass(state);},submitForm:function(form,successCallback,errorCallback){var self=this;$.ajax({type:"POST",dataType:"json",data:form.serialize(),success:function(account){if(successCallback!==null){successCallback.call(this,account);}},error:function(xhr,status){var error=eval("("+xhr.responseText+")");if(errorCallback!==null){errorCallback.call(this,error);}
var message=self.messages[error.error]?self.messages[error.error]:error.error;Evri.Notifications.displayMessageInSelector($("<p/>").addClass("error").html(message),"#messaging");}});return false;}};Evri.UserSettings={userEailId:undefined,emailSetting:undefined,errorStyle:{'textColor':'#FF0000','borderColor':'#FF0000'},infoStyle:{'textColor':'#000','borderColor':'#AAA'},bindUserSettingEvents:function(userEailId,rootUrl){Evri.UserSettings.userEailId=userEailId;$("#new-password").hide();$("#confirm-password").hide();if($.browser.msie){$("#password-row").find('#change-password-form').css({'height':'98px','overflow':'hidden'});$('div.save-button-container').css({'height':'20px','padding-top':'6px'});if(parseInt(self.jQuery.browser.version)<=6){$("input.first-field").removeClass("first-field").addClass("first-field-IE6");$('div.edit-form-container').find('input').css('margin-right','190px');$('input.input-checkbox').css('margin-right','0');}}
$("#change-email").click(function(){Evri.UserSettings.toggleContainer("change-email-form","emailfieldvalue");$("#new-email-address").val(Evri.UserSettings.userEailId);$("#content").find("#messaging").empty();});$("#save-email").click(function(){Evri.UserSettings.updateEmail();});$("#cancel-email").click(function(){if(!$("#cancel-email").hasClass("disabel-link")){Evri.UserSettings.showErrorMessage('email-address-row','new-email-address',Evri.UserSettings.infoStyle);$("#change-email-form").find(".error-message").hide();Evri.UserSettings.toggleContainer("emailfieldvalue","change-email-form");}});$("a#change-password").click(function(){Evri.UserSettings.toggleContainer("change-password-form","password-field-value");$("#content").find("#messaging").empty();});$("#save-password").click(function(){Evri.UserSettings.updatePassword();});$("a#cancel-password").click(function(){if(!$("#cancel-password").hasClass("disabel-link")){Evri.UserSettings.showErrorMessage('password-row','new-password',Evri.UserSettings.infoStyle);Evri.UserSettings.showErrorMessage('password-row','confirm-password',Evri.UserSettings.infoStyle);Evri.UserSettings.showErrorMessage('password-row','new-password-temp',Evri.UserSettings.infoStyle);Evri.UserSettings.showErrorMessage('password-row','confirm-password-temp',Evri.UserSettings.infoStyle);$("#change-password-form").find(".error-message").hide();Evri.UserSettings.toggleContainer("new-password-temp","new-password");Evri.UserSettings.toggleContainer("confirm-password-temp","confirm-password");$("#new-password").val("");$("#confirm-password").val("");Evri.UserSettings.toggleContainer("password-field-value","change-password-form");}});$("#new-password-temp").focus(function(){Evri.UserSettings.toggleContainer("new-password","new-password-temp");$("#new-password").css('color','#000000').focus();});$("#confirm-password-temp").focus(function(){Evri.UserSettings.toggleContainer("confirm-password","confirm-password-temp");$("#confirm-password").css('color','#000000').focus();});$("#new-password").blur(function(){if($.trim($(this).val())===""){Evri.UserSettings.toggleContainer("new-password-temp","new-password");$("#new-password").val("");}});$("#confirm-password").blur(function(){if($.trim($(this).val())===""){Evri.UserSettings.toggleContainer("confirm-password-temp","confirm-password");$("#confirm-password").val("");}});$("a#change-email-setting").click(function(){Evri.UserSettings.emailSetting=$("#email-setting-option").attr("checked");Evri.UserSettings.toggleContainer("change-email-setting-form","email-settings-container");$("#content").find("#messaging").empty();});$("#save-email-settings").click(function(){Evri.UserSettings.updateEmailSetting();});$("a#cancel-email-settings").click(function(){if(!$("#cancel-email-settings").hasClass("disabel-link")){Evri.UserSettings.toggleContainer("email-settings-container","change-email-setting-form");$("#email-setting-option").attr("checked",Evri.UserSettings.emailSetting);}});$("#delete-account").click(function(){Evri.UserSettings.deleteUser(rootUrl);});},showFeedbackDialog:function(){$("#facebox_overlay").remove();return Evri.Feedback.instantiate();},updateEmail:function(){if($("#save-email").hasClass("disabel-link")){return false;}
var new_email=$.trim($("#new-email-address").val());if(new_email===""){$("#change-email-form").find(".error-message").text("Email cannot be blank.").show();Evri.UserSettings.showErrorMessage('email-address-row','new-email-address',Evri.UserSettings.errorStyle);return false;}
var emailRegexp=/^\s*[A-Z0-9._%+\-]+@[A-Z0-9.\-]+\.[A-Z]{2,4}\s*$/i;if(!$("#new-email-address").validate(emailRegexp)){$("#change-email-form").find(".error-message").text("You have typed an invalid email address. Please try again.").show();Evri.UserSettings.showErrorMessage('email-address-row','new-email-address',Evri.UserSettings.errorStyle);return false;}
$("#save-email").addClass('disabel-link');$("#cancel-email").addClass("disabel-link");$.ajax({type:"POST",dataType:"json",url:"/accounts/update_email",data:"newemail="+new_email,success:function(data,textStatus){$("#cancel-email").removeClass("disabel-link");$("#save-email").removeClass('disabel-link');Evri.UserSettings.userEailId=new_email;$("#current-user-email-id").text(new_email);var globalMessagePara=$("<p/>").text("Your email address has been updated.");$("#content").find("#messaging").empty().append(globalMessagePara);Evri.UserSettings.showErrorMessage('email-address-row','new-email-address',Evri.UserSettings.infoStyle);$("#cancel-email").click();},error:function(data,textStatus){$("#cancel-email").removeClass("disabel-link");$("#save-email").removeClass('disabel-link');$("#change-email-form").find(".error-message").text(data.responseText).show();Evri.UserSettings.showErrorMessage('email-address-row','new-email-address',Evri.UserSettings.errorStyle);}});},updatePassword:function(){if($("#save-password").hasClass("disabel-link")){return false;}
var newPassword=$.trim($("#new-password").val());var confirmPassword=$.trim($("#confirm-password").val());if(newPassword===""){$("#change-password-form").find(".error-message").text("Password cannot be blank.").show();Evri.UserSettings.showErrorMessage('password-row','new-password',Evri.UserSettings.errorStyle);Evri.UserSettings.showErrorMessage('password-row','new-password-temp',Evri.UserSettings.errorStyle);}
else if(confirmPassword===""){$("#change-password-form").find(".error-message").text("Password confirmation cannot be blank.").show();Evri.UserSettings.showErrorMessage('password-row','confirm-password',Evri.UserSettings.errorStyle);Evri.UserSettings.showErrorMessage('password-row','confirm-password-temp',Evri.UserSettings.errorStyle);}
else if(confirmPassword!=newPassword){$("#change-password-form").find(".error-message").text("Password doesn't match confirmation.").show();Evri.UserSettings.showErrorMessage('password-row','new-password',Evri.UserSettings.errorStyle);Evri.UserSettings.showErrorMessage('password-row','confirm-password',Evri.UserSettings.errorStyle);}
else{$("#save-password").addClass("disabel-link");$("#cancel-password").addClass("disabel-link");$("#change-password-form").find(".error-message").hide();$.ajax({type:"POST",dataType:"json",url:"/accounts/update_password",data:{"password":newPassword,"password_confirmation":confirmPassword},success:function(data,textStatus){$("#save-password").removeClass("disabel-link");$("#cancel-password").removeClass("disabel-link");var globalMessagePara=$("<p/>").text("Your password has been updated.");$("#content").find("#messaging").empty().append(globalMessagePara);Evri.UserSettings.showErrorMessage('password-row','new-password',Evri.UserSettings.infoStyle);Evri.UserSettings.showErrorMessage('password-row','confirm-password',Evri.UserSettings.infoStyle);Evri.UserSettings.showErrorMessage('password-row','new-password-temp',Evri.UserSettings.infoStyle);Evri.UserSettings.showErrorMessage('password-row','confirm-password-temp',Evri.UserSettings.infoStyle);$("a#cancel-password").click();},error:function(data,textStatus){$("#save-password").removeClass("disabel-link");$("#cancel-password").removeClass("disabel-link");$("#change-password-form").find(".error-message").text(data.responseText);$("#change-password-form").find(".error-message").show();Evri.UserSettings.showErrorMessage('password-row','new-password',Evri.UserSettings.errorStyle);Evri.UserSettings.showErrorMessage('password-row','confirm-password',Evri.UserSettings.errorStyle);}});}},updateEmailSetting:function(){if($("#save-email-settings").hasClass("disabel-link")){return false;}
var opt_in="true";if($("#email-setting-option").attr("checked")){$("#current-email-settings").text("On");}else{$("#current-email-settings").text("Off");opt_in="false";}
$("#save-email-settings").addClass("disabel-link");$("#cancel-email-settings").addClass("disabel-link");$.ajax({type:"POST",dataType:"json",url:"/accounts/update_email_settings",data:{"opt_in":opt_in},success:function(data,textStatus){if(data.success){var globalMessagePara=$("<p/>").text("Your email settings have been updated.");$("#content").find("#messaging").empty().append(globalMessagePara);Evri.UserSettings.toggleContainer("email-settings-container","change-email-setting-form");}
$("#save-email-settings").removeClass("disabel-link");$("#cancel-email-settings").removeClass("disabel-link");}});},deleteUser:function(rootUrl){var modelDialogClone=$("#delete-account-row").find('div.modal-confirm-delete').clone();$.facebox(modelDialogClone.show());var faceBox=$("#facebox");faceBox.find("h2.sub-heading").css("border","none");faceBox.find(".footer").hide();faceBox.find(".close-button").click(function(){$.facebox.close();});faceBox.find(".cancel-button").click(function(){$.facebox.close();});faceBox.find('.delete-button').click(function(){$.post("/accounts/delete_my_account",{},function(data,textStatus){if(textStatus=="success"){window.location=rootUrl;}});});},toggleContainer:function(containerToShow,containerToHide){$("#"+containerToShow).show();$("#"+containerToHide).hide();},showErrorMessage:function(fieldLabel,fieldInput,style){$("#"+fieldLabel).find('label.left-column-label').css('color',style.textColor);$("#"+fieldInput).css('border-color',style.borderColor);}};$(function(){$('.sign-in-link').click(function(){var $frame=Evri.Collections.openModalFrame($(this).attr('href'),Evri.Collections.signInHeader());$frame.addClass('sign-in-frame');return false;});$('.sign-up-link').click(function(){var $frame=Evri.Collections.openModalFrame($(this).attr('href'),Evri.Collections.signUpHeader());$frame.addClass('sign-up-frame');return false;});});;(function($){$.fn.ajaxSubmit=function(options){if(!this.length){log('ajaxSubmit: skipping submit process - no element selected');return this;}
if(typeof options=='function')
options={success:options};options=$.extend({url:this.attr('action')||window.location.toString(),type:this.attr('method')||'GET'},options||{});var veto={};this.trigger('form-pre-serialize',[this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');return this;}
if(options.beforeSerialize&&options.beforeSerialize(this,options)===false){log('ajaxSubmit: submit aborted via beforeSerialize callback');return this;}
var a=this.formToArray(options.semantic);if(options.data){options.extraData=options.data;for(var n in options.data){if(options.data[n]instanceof Array){for(var k in options.data[n])
a.push({name:n,value:options.data[n][k]})}
else
a.push({name:n,value:options.data[n]});}}
if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){log('ajaxSubmit: submit aborted via beforeSubmit callback');return this;}
this.trigger('form-submit-validate',[a,this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-submit-validate trigger');return this;}
var q=$.param(a);if(options.type.toUpperCase()=='GET'){options.url+=(options.url.indexOf('?')>=0?'&':'?')+q;options.data=null;}
else
options.data=q;var $form=this,callbacks=[];if(options.resetForm)callbacks.push(function(){$form.resetForm();});if(options.clearForm)callbacks.push(function(){$form.clearForm();});if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){$(options.target).html(data).each(oldSuccess,arguments);});}
else if(options.success)
callbacks.push(options.success);options.success=function(data,status){for(var i=0,max=callbacks.length;i<max;i++)
callbacks[i].apply(options,[data,status,$form]);};var files=$('input:file',this).fieldValue();var found=false;for(var j=0;j<files.length;j++)
if(files[j])
found=true;if(options.iframe||found){if($.browser.safari&&options.closeKeepAlive)
$.get(options.closeKeepAlive,fileUpload);else
fileUpload();}
else
$.ajax(options);this.trigger('form-submit-notify',[this,options]);return this;function fileUpload(){var form=$form[0];if($(':input[name=submit]',form).length){alert('Error: Form elements must not be named "submit".');return;}
var opts=$.extend({},$.ajaxSettings,options);var s=jQuery.extend(true,{},$.extend(true,{},$.ajaxSettings),opts);var id='jqFormIO'+(new Date().getTime());var $io=$('<iframe id="'+id+'" name="'+id+'" />');var io=$io[0];if($.browser.msie||$.browser.opera)
io.src='javascript:false;document.write("");';$io.css({position:'absolute',top:'-1000px',left:'-1000px'});var xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:'n/a',getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;$io.attr('src','about:blank');}};var g=opts.global;if(g&&!$.active++)$.event.trigger("ajaxStart");if(g)$.event.trigger("ajaxSend",[xhr,opts]);if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;return;}
if(xhr.aborted)
return;var cbInvoked=0;var timedOut=0;var sub=form.clk;if(sub){var n=sub.name;if(n&&!sub.disabled){options.extraData=options.extraData||{};options.extraData[n]=sub.value;if(sub.type=="image"){options.extraData[name+'.x']=form.clk_x;options.extraData[name+'.y']=form.clk_y;}}}
setTimeout(function(){var t=$form.attr('target'),a=$form.attr('action');form.setAttribute('target',id);if(form.getAttribute('method')!='POST')
form.setAttribute('method','POST');if(form.getAttribute('action')!=opts.url)
form.setAttribute('action',opts.url);if(!options.skipEncodingOverride){$form.attr({encoding:'multipart/form-data',enctype:'multipart/form-data'});}
if(opts.timeout)
setTimeout(function(){timedOut=true;cb();},opts.timeout);var extraInputs=[];try{if(options.extraData)
for(var n in options.extraData)
extraInputs.push($('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />').appendTo(form)[0]);$io.appendTo('body');io.attachEvent?io.attachEvent('onload',cb):io.addEventListener('load',cb,false);form.submit();}
finally{form.setAttribute('action',a);t?form.setAttribute('target',t):$form.removeAttr('target');$(extraInputs).remove();}},10);var operaHack=0;function cb(){if(cbInvoked++)return;io.detachEvent?io.detachEvent('onload',cb):io.removeEventListener('load',cb,false);var ok=true;try{if(timedOut)throw'timeout';var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;if(doc.body==null&&!operaHack&&$.browser.opera){operaHack=1;cbInvoked--;setTimeout(cb,100);return;}
xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;xhr.getResponseHeader=function(header){var headers={'content-type':opts.dataType};return headers[header];};if(opts.dataType=='json'||opts.dataType=='script'){var ta=doc.getElementsByTagName('textarea')[0];xhr.responseText=ta?ta.value:xhr.responseText;}
else if(opts.dataType=='xml'&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText);}
data=$.httpData(xhr,opts.dataType);}
catch(e){ok=false;$.handleError(opts,xhr,'error',e);}
if(ok){opts.success(data,'success');if(g)$.event.trigger("ajaxSuccess",[xhr,opts]);}
if(g)$.event.trigger("ajaxComplete",[xhr,opts]);if(g&&!--$.active)$.event.trigger("ajaxStop");if(opts.complete)opts.complete(xhr,ok?'success':'error');setTimeout(function(){$io.remove();xhr.responseXML=null;},100);};function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async='false';doc.loadXML(s);}
else
doc=(new DOMParser()).parseFromString(s,'text/xml');return(doc&&doc.documentElement&&doc.documentElement.tagName!='parsererror')?doc:null;};};};$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().bind('submit.form-plugin',function(){$(this).ajaxSubmit(options);return false;}).each(function(){$(":submit,input:image",this).bind('click.form-plugin',function(e){var form=this.form;form.clk=this;if(this.type=='image'){if(e.offsetX!=undefined){form.clk_x=e.offsetX;form.clk_y=e.offsetY;}else if(typeof $.fn.offset=='function'){var offset=$(this).offset();form.clk_x=e.pageX-offset.left;form.clk_y=e.pageY-offset.top;}else{form.clk_x=e.pageX-this.offsetLeft;form.clk_y=e.pageY-this.offsetTop;}}
setTimeout(function(){form.clk=form.clk_x=form.clk_y=null;},10);});});};$.fn.ajaxFormUnbind=function(){this.unbind('submit.form-plugin');return this.each(function(){$(":submit,input:image",this).unbind('click.form-plugin');});};$.fn.formToArray=function(semantic){var a=[];if(this.length==0)return a;var form=this[0];var els=semantic?form.getElementsByTagName('*'):form.elements;if(!els)return a;for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n)continue;if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el)
a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});continue;}
var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++)
a.push({name:n,value:v[j]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:n,value:v});}
if(!semantic&&form.clk){var inputs=form.getElementsByTagName("input");for(var i=0,max=inputs.length;i<max;i++){var input=inputs[i];var n=input.name;if(n&&!input.disabled&&input.type=="image"&&form.clk==input)
a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});}}
return a;};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic));};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n)return;var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++)
a.push({name:n,value:v[i]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:this.name,value:v});});return $.param(a);};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=='undefined'||(v.constructor==Array&&!v.length))
continue;v.constructor==Array?$.merge(val,v):val.push(v);}
return val;};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful=='undefined')successful=true;if(successful&&(!n||el.disabled||t=='reset'||t=='button'||(t=='checkbox'||t=='radio')&&!el.checked||(t=='submit'||t=='image')&&el.form&&el.form.clk!=el||tag=='select'&&el.selectedIndex==-1))
return null;if(tag=='select'){var index=el.selectedIndex;if(index<0)return null;var a=[],ops=el.options;var one=(t=='select-one');var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=($.browser.msie&&op.attributes&&op.attributes['value']&&!(op.attributes['value'].specified))?op.text:op.value;if(one)return v;a.push(v);}}
return a;}
return el.value;};$.fn.clearForm=function(){return this.each(function(){$('input,select,textarea',this).clearFields();});};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=='text'||t=='password'||tag=='textarea')
this.value='';else if(t=='checkbox'||t=='radio')
this.checked=false;else if(tag=='select')
this.selectedIndex=-1;});};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=='function'||(typeof this.reset=='object'&&!this.reset.nodeType))
this.reset();});};$.fn.enable=function(b){if(b==undefined)b=true;return this.each(function(){this.disabled=!b});};$.fn.selected=function(select){if(select==undefined)select=true;return this.each(function(){var t=this.type;if(t=='checkbox'||t=='radio')
this.checked=select;else if(this.tagName.toLowerCase()=='option'){var $sel=$(this).parent('select');if(select&&$sel[0]&&$sel[0].type=='select-one'){$sel.find('option').selected(false);}
this.selected=select;}});};function log(){if($.fn.ajaxSubmit.debug&&window.console&&window.console.log)
window.console.log('[jquery.form] '+Array.prototype.join.call(arguments,''));};})(jQuery);(function(f){f.facebox=function(m,l){f.facebox.loading();if(m.ajax){g(m.ajax);}else{if(m.image){c(m.image);}else{if(m.div){j(m.div);}else{if(f.isFunction(m)){m.call(f);}else{f.facebox.reveal(m,l);}}}}};f.extend(f.facebox,{settings:{opacity:0,overlay:true,loadingImage:"/images/facebox/loading.gif",closeImage:"/images/facebox/closelabel.gif",imageTypes:["png","jpg","jpeg","gif"],faceboxHtml:'    <div id="facebox" style="display:none;">       <div class="popup">         <table>           <tbody>             <tr>               <td class="tl"/><td class="b"/><td class="tr"/>             </tr>             <tr>               <td class="b"/>               <td class="body">                 <div class="content">                 </div>                 <div class="footer">                   <a href="#" class="close">                     <img src="/images/facebox/closelabel.gif" title="close" class="close_image" />                   </a>                 </div>               </td>               <td class="b"/>             </tr>             <tr>               <td class="bl"/><td class="b"/><td class="br"/>             </tr>           </tbody>         </table>       </div>     </div>'},loading:function(){k();if(f("#facebox .loading").length==1){return true;}e();f("#facebox .content").empty();f("#facebox .body").children().hide().end().append('<div class="loading"><img src="'+f.facebox.settings.loadingImage+'"/></div>');f("#facebox").css({top:h()[1]+(i()/10),left:385.5}).show();f(document).bind("keydown.facebox",function(l){if(l.keyCode==27){f.facebox.close();}return true;});f(document).trigger("loading.facebox");},reveal:function(m,l){f(document).trigger("beforeReveal.facebox");if(l){f("#facebox .content").addClass(l);}f("#facebox .content").append(m);f("#facebox .loading").remove();f("#facebox .body").children().fadeIn("normal");f("#facebox").css("left",f(window).width()/2-(f("#facebox table").width()/2));f(document).trigger("reveal.facebox").trigger("afterReveal.facebox");},close:function(){f(document).trigger("close.facebox");return false;}});f.fn.facebox=function(l){k(l);function m(){f.facebox.loading(true);var n=this.rel.match(/facebox\[?\.(\w+)\]?/);if(n){n=n[1];}j(this.href,n);return false;}return this.click(m);};function k(n){if(f.facebox.settings.inited){return true;}else{f.facebox.settings.inited=true;}f(document).trigger("init.facebox");d();var l=f.facebox.settings.imageTypes.join("|");f.facebox.settings.imageTypesRegexp=new RegExp("."+l+"$","i");if(n){f.extend(f.facebox.settings,n);}f("body").append(f.facebox.settings.faceboxHtml);var m=[new Image(),new Image()];m[0].src=f.facebox.settings.closeImage;m[1].src=f.facebox.settings.loadingImage;f("#facebox").find(".b:first, .bl, .br, .tl, .tr").each(function(){m.push(new Image());m.slice(-1).src=f(this).css("background-image").replace(/url\((.+)\)/,"$1");});f("#facebox .close").click(f.facebox.close);f("#facebox .close_image").attr("src",f.facebox.settings.closeImage);}function h(){var m,l;if(self.pageYOffset){l=self.pageYOffset;m=self.pageXOffset;}else{if(document.documentElement&&document.documentElement.scrollTop){l=document.documentElement.scrollTop;m=document.documentElement.scrollLeft;}else{if(document.body){l=document.body.scrollTop;m=document.body.scrollLeft;}}}return new Array(m,l);}function i(){var l;if(self.innerHeight){l=self.innerHeight;}else{if(document.documentElement&&document.documentElement.clientHeight){l=document.documentElement.clientHeight;}else{if(document.body){l=document.body.clientHeight;}}}return l;}function d(){var l=f.facebox.settings;l.loadingImage=l.loading_image||l.loadingImage;l.closeImage=l.close_image||l.closeImage;l.imageTypes=l.image_types||l.imageTypes;l.faceboxHtml=l.facebox_html||l.faceboxHtml;}function j(m,l){if(m.match(/#/)){var n=window.location.href.split("#")[0];var o=m.replace(n,"");f.facebox.reveal(f(o).clone().show(),l);}else{if(m.match(f.facebox.settings.imageTypesRegexp)){c(m,l);}else{g(m,l);}}}function c(m,l){var n=new Image();n.onload=function(){f.facebox.reveal('<div class="image"><img src="'+n.src+'" /></div>',l);};n.src=m;}function g(m,l){f.get(m,function(n){f.facebox.reveal(n,l);});}function b(){return f.facebox.settings.overlay==false||f.facebox.settings.opacity===null;}function e(){if(b()){return;}if(f("facebox_overlay").length==0){f("body").append('<div id="facebox_overlay" class="facebox_hide"></div>');}f("#facebox_overlay").hide().addClass("facebox_overlayBG").css("opacity",f.facebox.settings.opacity).click(function(){f(document).trigger("close.facebox");}).fadeIn(200);return false;}function a(){if(b()){return;}f("#facebox_overlay").fadeOut(200,function(){f("#facebox_overlay").removeClass("facebox_overlayBG");f("#facebox_overlay").addClass("facebox_hide");f("#facebox_overlay").remove();});return false;}f(document).bind("close.facebox",function(){f(document).unbind("keydown.facebox");f("#facebox").fadeOut(function(){f("#facebox .content").removeClass().addClass("content");a();f("#facebox .loading").remove();});});})(jQuery);var EvriFacebook=(function($){return{shareArticle:function(templateId,title,link,description,linkId){if(this.loggedIn()){link=link.replace("&show_facebook=1","");var shortLink=EvriShortener.shortenUrl(link);FB.Connect.showFeedDialog(templateId,{"title":title,"link":shortLink,"description":description},null,null,null,FB.RequireConnect.promptConnect);}else{this.showLoginDialogBox(linkId);}
return false;},loggedIn:function(){return(FB.Connect.get_status().result!=FB.ConnectState.userNotLoggedIn);},showLoginDialogBox:function(linkId){var redirectParams={'show_facebook':1};if(linkId){redirectParams['linkId']=linkId;}
var qs=URI.toQueryString(redirectParams);if(top.location.search){qs="&"+qs.slice(1);}
var redirectUrl=top.location.href+qs;var tokenUrl='http://'+top.location.host+'/rpx/process_token'+URI.toQueryString({'redirect_url':redirectUrl});var action='https://'+Evri.RPX_NOW_TARGET_HOST+'/facebook/start'+URI.toQueryString({'token_url':tokenUrl});var $form=$('<form/>').attr('action',action).attr('method','POST');$('body').append($form);$form.submit();return false;},redirectableUrl:function(url,params){if(url.indexOf("?")!==-1){url+="&";}else{url+="?";}
params['show_facebook']="1";url+=URI.toQueryString(params).substr(1);return escape(escape(url));},autoShowShareDialog:function(elementSelector){FB.Connect.requireSession(function(){FB.Connect.get_status().waitUntilReady(function(connectStatus){if(connectStatus==FB.ConnectState.connected){$(elementSelector).click();}});});},initializeTrigger:function(elementSelector,templateId){var $trigger=$(elementSelector);$trigger.click(function(event){event.preventDefault();EvriFacebook.shareArticle(templateId,$trigger.attr('data-title'),window.location.href);});}};})(jQuery);var EvriShortener=(function($){return{shortenUrl:function(url){var rawResult=$.ajax({async:false,url:'/shortener/redirects',data:{redirect_url:url},type:"POST"}).responseText;var responseJson=eval("("+rawResult+")");return responseJson.link;}};})(jQuery);var WidgetGalleryBloggingPlatforms={setupQuickInstall:function(){var self=this;$("li.widget-container, div.widget-installation-instructions").each(function(index,widgetContainer){var $widgetContainer=$(widgetContainer);var $dialog=$widgetContainer.find("div.modal-cut-and-paste .modal-dialog");if($dialog.length!=0){var $invocation=$widgetContainer.find("a.rawcode");$invocation.click(function(event){$.facebox($dialog.show());var facebox=$("#facebox");var showInstallationNotesLink=facebox.find("a.view-installation-notes");var hideInstallationNotesLink=facebox.find("a.hide-installation-notes");var installationNotes=facebox.find("ul.installation-notes-content");installationNotes.height('0').hide();if($.browser.msie){facebox.find('.modal-dialog').css('float','none');installationNotes.css('float','none');facebox.find(".close-button").css('margin','0 4px 0 0');}
showInstallationNotesLink.show();hideInstallationNotesLink.hide();facebox.center();$("#facebox").find(".close").click(function(){$.facebox.close();}).end().find(".footer").hide().end();showInstallationNotesLink.click(function(){self.showInstallationNotes(facebox);});hideInstallationNotesLink.click(function(){self.hideInstallationNotes(facebox);});self.initialTop=parseInt(facebox.css('top'));self.bindBloggingPlatformsEvent($dialog);EventTracker.trackDHTML("CutAndPasteModalOpen",$widgetContainer[0],{});return false;});}});},showInstallationNotes:function(facebox){var self=this;var showInstallationNotesLink=facebox.find("a.view-installation-notes");if(!showInstallationNotesLink.hasClass('disabled')){var newTop=self.initialTop-95;var installationNotesHeight='185px';if(facebox.find("#jirafa-widget").length==1){installationNotesHeight='95px';}
if(facebox.find("#gamera-widget").length==1){installationNotesHeight='25px';newTop=self.initialTop-10;}
facebox.animate({top:newTop},600,null,function(){var installationNotes=facebox.find("ul.installation-notes-content");installationNotes.height('0').show();showInstallationNotesLink.hide();facebox.find("a.hide-installation-notes").addClass('disabled').show();installationNotes.animate({height:installationNotesHeight},600,null,function(){facebox.find("a.hide-installation-notes").removeClass('disabled');});});}},hideInstallationNotes:function(facebox){var self=this;hideInstallationNotesLink=facebox.find("a.hide-installation-notes");if(!hideInstallationNotesLink.hasClass('disabled')){var showInstallationNotesLink=facebox.find("a.view-installation-notes");showInstallationNotesLink.addClass('disabled').show();facebox.find("ul.installation-notes-content").slideUp("slow",function(){var newTop=self.initialTop;facebox.animate({top:newTop},600,null,function(){showInstallationNotesLink.removeClass('disabled');});});hideInstallationNotesLink.hide();showInstallationNotesLink.show();}},bindBloggingPlatformsEvent:function($dialog){$dialog.find("ul.blogging-platform-installers").find("a.typepad-quick-install, a.blogger-quick-install").click(function(event){var $node=$(this);var blogType=$node.attr("class").replace(/-quick-install$/,'');$node.parent().find("form").submit();$node.blur();EventTracker.trackDHTML($node[0],blogType+"Install",{});return false;});}};Evri.WidgetGalleryIndex={bindEvents:function(widget_category){$("ul.tabs-view li.selected a").addClass("disabled");$("a.change-tab").click(function(){if($(this).hasClass("disabled")){return false;}
$("ul.tabs-view li a").removeClass("disabled");$(this).addClass("disabled");});}};Evri.WidgetGalleryDemo={demo_with_url:true,bindDemoEvents:function(){$("#header-text").example("Enter headline or title");$("#demo-text").example("Enter article body or blog post");$('a#install_notes_link').click(function(){if($(this).attr("inpro")=="true"){return;}
$(this).attr("inpro","true");if($(this).text()=="Hide installation notes"){$('p#install_notes').slideUp('slow',function(){$('a#install_notes_link').attr("inpro","false");});$(this).text("View installation notes");}
else{$('p#install_notes').slideDown('slow',function(){$('a#install_notes_link').attr("inpro","false");});$(this).text("Hide installation notes");}});$("a#submit").click(function(){$("form#widget-preview-form").submit();$("form#submit").blur();});var widgetType=window.location.params()["widget"];$("#widget-preview-form").submit(function(){if(widgetType=="content"){Evri.WidgetGalleryDemo.instantiateContentWidget();}
else if(widgetType=="gamera"){Evri.WidgetGalleryDemo.instantiateGameraWidget();}
else if(widgetType=="zd"){Evri.WidgetGalleryDemo.instantiateZDWidget();}
else{Evri.WidgetGalleryDemo.instantiateJirafa();}
$("div#preview-pane, #embedded").empty();return false;});$("#content-type-url").click(function(){$(this).addClass('black');$("#content-type-text").removeClass('black');$("#demo-text-container").hide();$("#demo-url-container").show();Evri.WidgetGalleryDemo.demo_with_url=true;return false;});$("#content-type-text").click(function(){$(this).addClass('black');$("#content-type-url").removeClass('black');$("#demo-url-container").hide();$("#demo-text-container").show();Evri.WidgetGalleryDemo.demo_with_url=false;return false;});},bindArticlePreviewEvents:function(urlForWidget){$('a#install_notes_link').click(function(){if($(this).attr("inpro")=="true"){return;}
$(this).attr("inpro","true");if($(this).text()=="Hide installation notes"){$('p#install_notes').slideUp('slow',function(){$('a#install_notes_link').attr("inpro","false");});$(this).text("View installation notes");}
else{$('p#install_notes').slideDown('slow',function(){$('a#install_notes_link').attr("inpro","false");});$(this).text("Hide installation notes");}});var widgetType=window.location.params()["widget"];if(widgetType=="content"){Evri.WidgetGalleryDemo.instantiateContentWidget(true);}
else if(widgetType=="gamera"){Evri.WidgetGalleryDemo.instantiateGameraWidget(true,urlForWidget);}
else if(widgetType=="zd"){Evri.WidgetGalleryDemo.instantiateZDWidget(true,urlForWidget);}
else{Evri.WidgetGalleryDemo.instantiateJirafa(true,urlForWidget);}},instantiateJirafa:function(isArticlepreview,urlForWidget){var jirafaWidget=new Evri.Widget.Jirafa();if(isArticlepreview){$("div#jirafa-destination").append(jirafaWidget.render($("<div />").width(160)));jirafaWidget.sendURI(urlForWidget);return;}
$("div#jirafa-destination").empty().css({"background-color":"#fff","padding":"5px 0 15px 4px","width":160}).append(jirafaWidget.render($("<div />").width(160)));if(Evri.WidgetGalleryDemo.demo_with_url){jirafaWidget.sendURI($("#demo-url").val());}
else{jirafaWidget.sendContent($("#header-text").val()+"\n\n"+$("#demo-text").val(),window.location.href+"?"+(new Date()).getTime());}},instantiateContentWidget:function(isArticlepreview){var widget=new Evri.Widget.ContentRecommendation();widget.popover();if(isArticlepreview){var documentCSSSelector='div.widget-article';var contentCSSSelector='h1,p';widget.placeInvocationPoints(documentCSSSelector,contentCSSSelector,{});}
else{if(Evri.WidgetGalleryDemo.demo_with_url){widget.getGraphForURL($("#demo-url").val());}
else{widget.renderWidgetForGivenContent($("#header-text").val()+"\n\n"+$("#demo-text").val());}}
return false;},instantiateGameraWidget:function(isArticlepreview,urlForWidget){var g=new Evri.Widget.Gamera();$("#gamera-destination").empty();g.ready(function(){g.renderIn("#gamera-destination");if(isArticlepreview){g.getGraphForURL(urlForWidget,function(){g.spanHeight(300);});}
else{$("#gamera-destination").css({"background-color":"#fff","margin-top":"15px"});if(Evri.WidgetGalleryDemo.demo_with_url){g.getGraphForURL($("#demo-url").val(),function(){g.spanHeight(300);});}
else{g.getGraphForContent($("#header-text").val()+"\n\n"+$("#demo-text").val(),function(){g.spanHeight(300);});}}});},instantiateZDWidget:function(isArticlepreview,urlForWidget){if(isArticlepreview){Evri.Widget.ZeroDestruction.initWithURL(urlForWidget).renderIn("#zd-destination");}
else{$("#zd-destination").empty().css({"background-color":"#fff","margin-top":"15px"});if(Evri.WidgetGalleryDemo.demo_with_url){Evri.Widget.ZeroDestruction.initWithURL($("#demo-url").val()).renderIn("#zd-destination");}
else{Evri.Widget.ZeroDestruction.initWithText($("#header-text").val()+"\n\n"+$("#demo-text").val()).renderIn("#zd-destination");}}}};Evri.WidgetGallery={};Evri.WidgetGallery.SingleSubjectWidget={widgetLoadingInterval:null,entityUri:null,bindEvents:function(entityUri){Evri.WidgetGallery.SingleSubjectWidget.entityUri=entityUri;$("div#single-subject-parent").css("background","none");$("#narrow-widget").click(function(){if($(this).hasClass("link-inactive")){return;}
$("#evri-miniedp-container-div").empty();$("#single-subject-parent").css({"width":182,"margin-left":210});Evri.WidgetGallery.SingleSubjectWidget.makeActiveDisabledLink(this);$("div#evri-miniedp-container-div").attr("loading","false");Evri.WidgetGallery.SingleSubjectWidget.initialize();});$("#wide-widget").click(function(){if($(this).hasClass("link-inactive")){return;}
$("#evri-miniedp-container-div").empty();$("#single-subject-parent").css({"width":302,"margin-left":148});Evri.WidgetGallery.SingleSubjectWidget.makeActiveDisabledLink(this);$("div#evri-miniedp-container-div").attr("loading","false");Evri.WidgetGallery.SingleSubjectWidget.initialize();});$("#microedp-widget").click(function(){$("div.single-subject").hide();$("div.microedp").show();$("#evri-miniedp-container-div").css('border','none').empty();$("#single-subject-parent").css({"width":332,"margin-left":130});Evri.WidgetGallery.SingleSubjectWidget.makeActiveDisabledLink(this);var microEdpWidget=new Evri.Widget.MicroEDP(entityUri);microEdpWidget.renderIn("#evri-miniedp-container-div");});},makeActiveDisabledLink:function(eventOwner){$("#narrow-widget").removeClass().addClass("link-active");$("#wide-widget").removeClass().addClass("link-active");$("#microedp-widget").removeClass().addClass("link-active");$(eventOwner).removeClass().addClass("link-inactive");},initialize:function(){$("div.single-subject").show();$("div.microedp").hide();var verticalSingleEntityWidget=new Evri.Widget.VerticalSingleEntity(Evri.WidgetGallery.SingleSubjectWidget.entityUri);verticalSingleEntityWidget.render("div#evri-miniedp-container-div");}};Evri.WidgetGallery.QuotesWidget={initialize:function(entityUri){var quotesWidget=new Evri.Widget.Quotes();quotesWidget.ready(function(){quotesWidget.renderIn("div#evri-miniedp-container-div");quotesWidget.render(entityUri);});}};Evri.WidgetGallery.TwitterWidget={initialize:function(entityUri){var twitterWidget=new Evri.Widget.Twitter();twitterWidget.ready(function(){twitterWidget.renderIn("div#evri-miniedp-container-div");twitterWidget.render(entityUri);});}};Evri.WidgetGallery.SentimentWidget={initialize:function(entityUri){var sentimentWidget=new Evri.Widget.Sentiment();sentimentWidget.ready(function(){sentimentWidget.renderIn("div#evri-miniedp-container-div");sentimentWidget.render(entityUri);});}};Evri.WidgetGallery.MultiSubjectWidget={widgetLoadingInterval:null,entityUris:null,numAddedEntities:0,bindEvents:function(entityUris){Evri.WidgetGallery.MultiSubjectWidget.entityUris=entityUris;$("div#single-subject-parent").css("background","none");$("#narrow-widget").click(function(){if($(this).hasClass("link-inactive")){return;}
$("#evri-miniedp-container-div").empty();$("#single-subject-parent").css({"width":182,"margin-left":210});$(this).removeClass().addClass("link-inactive");$("#wide-widget").removeClass().addClass("link-active");$("div#evri-miniedp-container-div").attr("loading","false");Evri.WidgetGallery.MultiSubjectWidget.initialize();});$("#wide-widget").click(function(){if($(this).hasClass("link-inactive")){return;}
$("#evri-miniedp-container-div").empty();$("#single-subject-parent").css({"width":302,"margin-left":148});$(this).removeClass().addClass("link-inactive");$("#narrow-widget").removeClass().addClass("link-active");$("div#evri-miniedp-container-div").attr("loading","false");Evri.WidgetGallery.MultiSubjectWidget.initialize();});$("#change_subject_link").click(function(){$("#multientity-form").submit();return false;});},initialize:function(){var multiEntityWidget=new Evri.Widget.MultiEntity({});$("#evri-miniedp-container-div").empty();multiEntityWidget.ready(function(){multiEntityWidget.renderIn("#evri-miniedp-container-div");multiEntityWidget.renderWidget(Evri.WidgetGallery.MultiSubjectWidget.entityUris);});},initializeSelectionPage:function(numAddedEntities){Evri.WidgetGallery.MultiSubjectWidget.numAddedEntities=numAddedEntities;Evri.WidgetGallery.MultiSubjectWidget.setupSelectionBox();if(numAddedEntities>=8){$("#multi-entity-max-entities-message").show();}else{$("#find-select-subject").show();}
$("#entitySearchFinish").click(function(){if(Evri.WidgetGallery.MultiSubjectWidget.numAddedEntities==0){Evri.Notifications.displayMessage($("<p/>").text("Please pick at least one subject."));return false;}
$("#multientity-form").submit();});$("div.entity-name").mouseover(function(){$(this).find("a.entity-delete-link").css("display","block");});$("div.entity-name").mouseout(function(){$(this).find("a.entity-delete-link").hide();});$("a.entity-delete-link").click(function(){Evri.WidgetGallery.MultiSubjectWidget.deleteEntity(this);});},setupSelectionBox:function(){var findBox=new EntityFindBox($("#find-select-subject"));findBox.autoSelectFirstItem=true;findBox.selectEntityHandler=function(entity){$("#content").find("div.global-message").hide();findBox.$findResultsContainer.hide();var entity_uri=decodeURIComponent(entity.href);var div_id=entity_uri.replace(/\//g,"-").replace(/,/g,"-");if($("#"+div_id).length>0){return;}
var new_div=$("<div/>").attr({"id":div_id,"class":"entity-name"}).append($("<span/>").append(entity.name));var del_span=$("<span/>").attr({"class":"delete-entity"});var del_link=$("<a/>").attr({"href":"javascript:void(0);","class":"entity-delete-link","title":"Delete","entity_uri":entity_uri});new_div.mouseover(function(){$(this).find("a.entity-delete-link").css("display","block");}).mouseout(function(){$(this).find("a.entity-delete-link").hide();});del_link.click(function(){Evri.WidgetGallery.MultiSubjectWidget.deleteEntity(this);});new_div.append(del_span.append(del_link));$("#selected-entities").append(new_div);var input_id="input"+div_id;var hidden_input=$("<input/>").attr({"id":input_id,"type":"hidden","name":"top-subjects[]","value":entity.href});$("#multientity-form").append(hidden_input);Evri.WidgetGallery.MultiSubjectWidget.numAddedEntities++;if(Evri.WidgetGallery.MultiSubjectWidget.numAddedEntities>=8){$("#find-select-subject").hide();$("#multi-entity-max-entities-message").show();}
return false;};},deleteEntity:function(obj){var entity_uri=$(obj).attr("entity_uri");var div_id=entity_uri.replace(/\//g,"-").replace(/,/g,"-");var input_id="input"+div_id;$("#selected-entities").find("#"+div_id+".entity-name").remove();$("#"+input_id).remove();Evri.WidgetGallery.MultiSubjectWidget.numAddedEntities--;if(Evri.WidgetGallery.MultiSubjectWidget.numAddedEntities<8){$("#find-select-subject").show();$("#multi-entity-max-entities-message").hide();}}};var Log4js={version:"1.0",applicationStartDate:new Date(),loggers:{},getLogger:function(categoryName){if(!(typeof categoryName=="string")){categoryName="[default]";}
if(!Log4js.loggers[categoryName]){Log4js.loggers[categoryName]=new Log4js.Logger(categoryName);}
return Log4js.loggers[categoryName];},getDefaultLogger:function(){return Log4js.getLogger("[default]");},attachEvent:function(element,name,observer){if(element.addEventListener){element.addEventListener(name,observer,false);}else if(element.attachEvent){element.attachEvent('on'+name,observer);}}};Log4js.extend=function(destination,source){for(property in source){destination[property]=source[property];}
return destination;}
Log4js.bind=function(fn,object){return function(){return fn.apply(object,arguments);};};Log4js.Level=function(level,levelStr){this.level=level;this.levelStr=levelStr;};Log4js.Level.prototype={toLevel:function(sArg,defaultLevel){if(sArg===null){return defaultLevel;}
if(typeof sArg=="string"){var s=sArg.toUpperCase();if(s=="ALL"){return Log4js.Level.ALL;}
if(s=="DEBUG"){return Log4js.Level.DEBUG;}
if(s=="INFO"){return Log4js.Level.INFO;}
if(s=="WARN"){return Log4js.Level.WARN;}
if(s=="ERROR"){return Log4js.Level.ERROR;}
if(s=="FATAL"){return Log4js.Level.FATAL;}
if(s=="OFF"){return Log4js.Level.OFF;}
if(s=="TRACE"){return Log4js.Level.TRACE;}
return defaultLevel;}else if(typeof sArg=="number"){switch(sArg){case ALL_INT:return Log4js.Level.ALL;case DEBUG_INT:return Log4js.Level.DEBUG;case INFO_INT:return Log4js.Level.INFO;case WARN_INT:return Log4js.Level.WARN;case ERROR_INT:return Log4js.Level.ERROR;case FATAL_INT:return Log4js.Level.FATAL;case OFF_INT:return Log4js.Level.OFF;case TRACE_INT:return Log4js.Level.TRACE;default:return defaultLevel;}}else{return defaultLevel;}},toString:function(){return this.levelStr;},valueOf:function(){return this.level;}};Log4js.Level.OFF_INT=Number.MAX_VALUE;Log4js.Level.FATAL_INT=50000;Log4js.Level.ERROR_INT=40000;Log4js.Level.WARN_INT=30000;Log4js.Level.INFO_INT=20000;Log4js.Level.DEBUG_INT=10000;Log4js.Level.TRACE_INT=5000;Log4js.Level.ALL_INT=Number.MIN_VALUE;Log4js.Level.OFF=new Log4js.Level(Log4js.Level.OFF_INT,"OFF");Log4js.Level.FATAL=new Log4js.Level(Log4js.Level.FATAL_INT,"FATAL");Log4js.Level.ERROR=new Log4js.Level(Log4js.Level.ERROR_INT,"ERROR");Log4js.Level.WARN=new Log4js.Level(Log4js.Level.WARN_INT,"WARN");Log4js.Level.INFO=new Log4js.Level(Log4js.Level.INFO_INT,"INFO");Log4js.Level.DEBUG=new Log4js.Level(Log4js.Level.DEBUG_INT,"DEBUG");Log4js.Level.TRACE=new Log4js.Level(Log4js.Level.TRACE_INT,"TRACE");Log4js.Level.ALL=new Log4js.Level(Log4js.Level.ALL_INT,"ALL");Log4js.CustomEvent=function(){this.listeners=[];};Log4js.CustomEvent.prototype={addListener:function(method){this.listeners.push(method);},removeListener:function(method){var foundIndexes=this.findListenerIndexes(method);for(var i=0;i<foundIndexes.length;i++){this.listeners.splice(foundIndexes[i],1);}},dispatch:function(handler){for(var i=0;i<this.listeners.length;i++){try{this.listeners[i](handler);}
catch(e){log4jsLogger.warn("Could not run the listener "+this.listeners[i]+". \n"+e);}}},findListenerIndexes:function(method){var indexes=[];for(var i=0;i<this.listeners.length;i++){if(this.listeners[i]==method){indexes.push(i);}}
return indexes;}};Log4js.LoggingEvent=function(categoryName,level,message,exception,logger){this.startTime=new Date();this.categoryName=categoryName;this.message=message;this.exception=exception;this.level=level;this.logger=logger;};Log4js.LoggingEvent.prototype={getFormattedTimestamp:function(){if(this.logger){return this.logger.getFormattedTimestamp(this.startTime);}else{return this.startTime.toGMTString();}}};Log4js.Logger=function(name){this.loggingEvents=[];this.appenders=[];this.category=name||"";this.level=Log4js.Level.FATAL;this.dateformat=Log4js.DateFormatter.DEFAULT_DATE_FORMAT;this.dateformatter=new Log4js.DateFormatter();this.onlog=new Log4js.CustomEvent();this.onclear=new Log4js.CustomEvent();this.appenders.push(new Log4js.Appender(this));try{}catch(e){}};Log4js.Logger.prototype={addAppender:function(appender){if(appender instanceof Log4js.Appender){appender.setLogger(this);this.appenders.push(appender);}else{throw"Not instance of an Appender: "+appender;}},setAppenders:function(appenders){for(var i=0;i<this.appenders.length;i++){this.appenders[i].doClear();}
this.appenders=appenders;for(var j=0;j<this.appenders.length;j++){this.appenders[j].setLogger(this);}},setLevel:function(level){this.level=level;},log:function(logLevel,message,exception){var loggingEvent=new Log4js.LoggingEvent(this.category,logLevel,message,exception,this);this.loggingEvents.push(loggingEvent);this.onlog.dispatch(loggingEvent);},clear:function(){try{this.loggingEvents=[];this.onclear.dispatch();}catch(e){}},isTraceEnabled:function(){if(this.level.valueOf()<=Log4js.Level.TRACE.valueOf()){return true;}
return false;},trace:function(message){if(this.isTraceEnabled()){this.log(Log4js.Level.TRACE,message,null);}},isDebugEnabled:function(){if(this.level.valueOf()<=Log4js.Level.DEBUG.valueOf()){return true;}
return false;},debug:function(message){if(this.isDebugEnabled()){this.log(Log4js.Level.DEBUG,message,null);}},debug:function(message,throwable){if(this.isDebugEnabled()){this.log(Log4js.Level.DEBUG,message,throwable);}},isInfoEnabled:function(){if(this.level.valueOf()<=Log4js.Level.INFO.valueOf()){return true;}
return false;},info:function(message){if(this.isInfoEnabled()){this.log(Log4js.Level.INFO,message,null);}},info:function(message,throwable){if(this.isInfoEnabled()){this.log(Log4js.Level.INFO,message,throwable);}},isWarnEnabled:function(){if(this.level.valueOf()<=Log4js.Level.WARN.valueOf()){return true;}
return false;},warn:function(message){if(this.isWarnEnabled()){this.log(Log4js.Level.WARN,message,null);}},warn:function(message,throwable){if(this.isWarnEnabled()){this.log(Log4js.Level.WARN,message,throwable);}},isErrorEnabled:function(){if(this.level.valueOf()<=Log4js.Level.ERROR.valueOf()){return true;}
return false;},error:function(message){if(this.isErrorEnabled()){this.log(Log4js.Level.ERROR,message,null);}},error:function(message,throwable){if(this.isErrorEnabled()){this.log(Log4js.Level.ERROR,message,throwable);}},isFatalEnabled:function(){if(this.level.valueOf()<=Log4js.Level.FATAL.valueOf()){return true;}
return false;},fatal:function(message){if(this.isFatalEnabled()){this.log(Log4js.Level.FATAL,message,null);}},fatal:function(message,throwable){if(this.isFatalEnabled()){this.log(Log4js.Level.FATAL,message,throwable);}},windowError:function(msg,url,line){var message="Error in ("+(url||window.location)+") on line "+line+" with message ("+msg+")";this.log(Log4js.Level.FATAL,message,null);},setDateFormat:function(format){this.dateformat=format;},getFormattedTimestamp:function(date){return this.dateformatter.formatDate(date,this.dateformat);}};Log4js.Appender=function(){this.logger=null;};Log4js.Appender.prototype={doAppend:function(loggingEvent){return;},doClear:function(){return;},setLayout:function(layout){this.layout=layout;},setLogger:function(logger){logger.onlog.addListener(Log4js.bind(this.doAppend,this));logger.onclear.addListener(Log4js.bind(this.doClear,this));this.logger=logger;}};Log4js.Layout=function(){return;};Log4js.Layout.prototype={format:function(loggingEvent){return"";},getContentType:function(){return"text/plain";},getHeader:function(){return null;},getFooter:function(){return null;},getSeparator:function(){return"";}};Log4js.ConsoleAppender=function(isInline){this.layout=new Log4js.PatternLayout(Log4js.PatternLayout.TTCC_CONVERSION_PATTERN);this.inline=isInline;this.accesskey="d";this.tagPattern=null;this.commandHistory=[];this.commandIndex=0;this.popupBlocker=false;this.outputElement=null;this.docReference=null;this.winReference=null;if(this.inline){Log4js.attachEvent(window,'load',Log4js.bind(this.initialize,this));}};Log4js.ConsoleAppender.prototype=Log4js.extend(new Log4js.Appender(),{setAccessKey:function(key){this.accesskey=key;},initialize:function(){if(!this.inline){var doc=null;var win=null;window.top.consoleWindow=window.open("",this.logger.category,"left=0,top=0,width=700,height=700,scrollbars=no,status=no,resizable=yes;toolbar=no");window.top.consoleWindow.opener=self;win=window.top.consoleWindow;if(!win){this.popupBlocker=true;alert("Popup window manager blocking the Log4js popup window to bedisplayed.\n\n"
+"Please disabled this to properly see logged events.");}else{doc=win.document;doc.open();doc.write("<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN ");doc.write("  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>\n\n");doc.write("<html><head><title>Log4js - "+this.logger.category+"</title>\n");doc.write("</head><body style=\"background-color:darkgray\"></body>\n");win.blur();win.focus();}
this.docReference=doc;this.winReference=win;}else{this.docReference=document;this.winReference=window;}
this.outputCount=0;this.tagPattern=".*";this.logElement=this.docReference.createElement('div');this.docReference.body.appendChild(this.logElement);this.logElement.style.display='none';this.logElement.style.position="absolute";this.logElement.style.left='0px';this.logElement.style.width='100%';this.logElement.style.textAlign="left";this.logElement.style.fontFamily="lucida console";this.logElement.style.fontSize="100%";this.logElement.style.backgroundColor='darkgray';this.logElement.style.opacity=0.9;this.logElement.style.zIndex=2000;this.toolbarElement=this.docReference.createElement('div');this.logElement.appendChild(this.toolbarElement);this.toolbarElement.style.padding="0 0 0 2px";this.buttonsContainerElement=this.docReference.createElement('span');this.toolbarElement.appendChild(this.buttonsContainerElement);if(this.inline){var closeButton=this.docReference.createElement('button');closeButton.style.cssFloat="right";closeButton.style.styleFloat="right";closeButton.style.color="black";closeButton.innerHTML="close";closeButton.onclick=Log4js.bind(this.toggle,this);this.buttonsContainerElement.appendChild(closeButton);}
var clearButton=this.docReference.createElement('button');clearButton.style.cssFloat="right";clearButton.style.styleFloat="right";clearButton.style.color="black";clearButton.innerHTML="clear";clearButton.onclick=Log4js.bind(this.logger.clear,this.logger);this.buttonsContainerElement.appendChild(clearButton);this.tagFilterContainerElement=this.docReference.createElement('span');this.toolbarElement.appendChild(this.tagFilterContainerElement);this.tagFilterContainerElement.style.cssFloat='left';this.tagFilterContainerElement.appendChild(this.docReference.createTextNode("Log4js - "+this.logger.category));this.tagFilterContainerElement.appendChild(this.docReference.createTextNode(" | Level Filter: "));this.tagFilterElement=this.docReference.createElement('input');this.tagFilterContainerElement.appendChild(this.tagFilterElement);this.tagFilterElement.style.width='200px';this.tagFilterElement.value=this.tagPattern;this.tagFilterElement.setAttribute('autocomplete','off');Log4js.attachEvent(this.tagFilterElement,'keyup',Log4js.bind(this.updateTags,this));Log4js.attachEvent(this.tagFilterElement,'click',Log4js.bind(function(){this.tagFilterElement.select();},this));this.outputElement=this.docReference.createElement('div');this.logElement.appendChild(this.outputElement);this.outputElement.style.overflow="auto";this.outputElement.style.clear="both";this.outputElement.style.height=(this.inline)?("200px"):("650px");this.outputElement.style.width="100%";this.outputElement.style.backgroundColor='black';this.inputContainerElement=this.docReference.createElement('div');this.inputContainerElement.style.width="100%";this.logElement.appendChild(this.inputContainerElement);this.inputElement=this.docReference.createElement('input');this.inputContainerElement.appendChild(this.inputElement);this.inputElement.style.width='100%';this.inputElement.style.borderWidth='0px';this.inputElement.style.margin='0px';this.inputElement.style.padding='0px';this.inputElement.value='Type command here';this.inputElement.setAttribute('autocomplete','off');Log4js.attachEvent(this.inputElement,'keyup',Log4js.bind(this.handleInput,this));Log4js.attachEvent(this.inputElement,'click',Log4js.bind(function(){this.inputElement.select();},this));if(this.inline){window.setInterval(Log4js.bind(this.repositionWindow,this),500);this.repositionWindow();var accessElement=this.docReference.createElement('button');accessElement.style.position="absolute";accessElement.style.top="-100px";accessElement.accessKey=this.accesskey;accessElement.onclick=Log4js.bind(this.toggle,this);this.docReference.body.appendChild(accessElement);}else{this.show();}},toggle:function(){if(this.logElement.style.display=='none'){this.show();return true;}else{this.hide();return false;}},show:function(){this.logElement.style.display='';this.outputElement.scrollTop=this.outputElement.scrollHeight;this.inputElement.select();},hide:function(){this.logElement.style.display='none';},output:function(message,style){var shouldScroll=(this.outputElement.scrollTop+(2*this.outputElement.clientHeight))>=this.outputElement.scrollHeight;this.outputCount++;style=(style?style+=';':'');style+='padding:1px;margin:0 0 5px 0';if(this.outputCount%2===0){style+=";background-color:#101010";}
message=message||"undefined";message=message.toString();this.outputElement.innerHTML+="<pre style='"+style+"'>"+message+"</pre>";if(shouldScroll){this.outputElement.scrollTop=this.outputElement.scrollHeight;}},updateTags:function(){var pattern=this.tagFilterElement.value;if(this.tagPattern==pattern){return;}
try{new RegExp(pattern);}catch(e){return;}
this.tagPattern=pattern;this.outputElement.innerHTML="";this.outputCount=0;for(var i=0;i<this.logger.loggingEvents.length;i++){this.doAppend(this.logger.loggingEvents[i]);}},repositionWindow:function(){var offset=window.pageYOffset||this.docReference.documentElement.scrollTop||this.docReference.body.scrollTop;var pageHeight=self.innerHeight||this.docReference.documentElement.clientHeight||this.docReference.body.clientHeight;this.logElement.style.top=(offset+pageHeight-this.logElement.offsetHeight)+"px";},doAppend:function(loggingEvent){if(this.popupBlocker){return;}
if((!this.inline)&&(!this.winReference||this.winReference.closed)){this.initialize();}
if(this.tagPattern!==null&&loggingEvent.level.toString().search(new RegExp(this.tagPattern,'igm'))==-1){return;}
var style='';if(loggingEvent.level.toString().search(/ERROR/)!=-1){style+='color:red';}else if(loggingEvent.level.toString().search(/FATAL/)!=-1){style+='color:red';}else if(loggingEvent.level.toString().search(/WARN/)!=-1){style+='color:orange';}else if(loggingEvent.level.toString().search(/DEBUG/)!=-1){style+='color:green';}else if(loggingEvent.level.toString().search(/INFO/)!=-1){style+='color:white';}else{style+='color:yellow';}
this.output(this.layout.format(loggingEvent),style);},doClear:function(){this.outputElement.innerHTML="";},handleInput:function(e){if(e.keyCode==13){var command=this.inputElement.value;switch(command){case"clear":this.logger.clear();break;default:var consoleOutput="";try{consoleOutput=eval(this.inputElement.value);}catch(e){this.logger.error("Problem parsing input <"+command+">"+e.message);break;}
this.logger.trace(consoleOutput);break;}
if(this.inputElement.value!==""&&this.inputElement.value!==this.commandHistory[0]){this.commandHistory.unshift(this.inputElement.value);}
this.commandIndex=0;this.inputElement.value="";}else if(e.keyCode==38&&this.commandHistory.length>0){this.inputElement.value=this.commandHistory[this.commandIndex];if(this.commandIndex<this.commandHistory.length-1){this.commandIndex+=1;}}else if(e.keyCode==40&&this.commandHistory.length>0){if(this.commandIndex>0){this.commandIndex-=1;}
this.inputElement.value=this.commandHistory[this.commandIndex];}else{this.commandIndex=0;}},toString:function(){return"Log4js.ConsoleAppender[inline="+this.inline+"]";}});Log4js.MetatagAppender=function(){this.currentLine=0;};Log4js.MetatagAppender.prototype=Log4js.extend(new Log4js.Appender(),{doAppend:function(loggingEvent){var now=new Date();var lines=loggingEvent.message.split("\n");var headTag=document.getElementsByTagName("head")[0];for(var i=1;i<=lines.length;i++){var value=lines[i-1];if(i==1){value=loggingEvent.level.toString()+": "+value;}else{value="> "+value;}
var metaTag=document.createElement("meta");metaTag.setAttribute("name","X-log4js:"+this.currentLine);metaTag.setAttribute("content",value);headTag.appendChild(metaTag);this.currentLine+=1;}},toString:function(){return"Log4js.MetatagAppender";}});Log4js.AjaxAppender=function(loggingUrl){this.isInProgress=false;this.loggingUrl=loggingUrl||"logging.log4js";this.threshold=1;this.timeout=2000;this.loggingEventMap=new Log4js.FifoBuffer();this.layout=new Log4js.XMLLayout();this.httpRequest=null;};Log4js.AjaxAppender.prototype=Log4js.extend(new Log4js.Appender(),{doAppend:function(loggingEvent){log4jsLogger.trace("> AjaxAppender.append");if(this.loggingEventMap.length()<=this.threshold||this.isInProgress===true){this.loggingEventMap.push(loggingEvent);}
if(this.loggingEventMap.length()>=this.threshold&&this.isInProgress===false){this.send();}
log4jsLogger.trace("< AjaxAppender.append");},doClear:function(){log4jsLogger.trace("> AjaxAppender.doClear");if(this.loggingEventMap.length()>0){this.send();}
log4jsLogger.trace("< AjaxAppender.doClear");},setThreshold:function(threshold){log4jsLogger.trace("> AjaxAppender.setThreshold: "+threshold);this.threshold=threshold;log4jsLogger.trace("< AjaxAppender.setThreshold");},setTimeout:function(milliseconds){this.timeout=milliseconds;},send:function(){if(this.loggingEventMap.length()>0){log4jsLogger.trace("> AjaxAppender.send");this.isInProgress=true;var a=[];for(var i=0;i<this.loggingEventMap.length()&&i<this.threshold;i++){a.push(this.layout.format(this.loggingEventMap.pull()));}
var content=this.layout.getHeader();content+=a.join(this.layout.getSeparator());content+=this.layout.getFooter();var appender=this;if(this.httpRequest===null){this.httpRequest=this.getXmlHttpRequest();}
this.httpRequest.onreadystatechange=function(){appender.onReadyStateChanged.call(appender);};this.httpRequest.open("POST",this.loggingUrl,true);this.httpRequest.setRequestHeader("Content-type",this.layout.getContentType());this.httpRequest.setRequestHeader("REFERER",location.href);this.httpRequest.setRequestHeader("Content-length",content.length);this.httpRequest.setRequestHeader("Connection","close");this.httpRequest.send(content);appender=this;try{window.setTimeout(function(){log4jsLogger.trace("> AjaxAppender.timeout");appender.httpRequest.onreadystatechange=function(){return;};appender.httpRequest.abort();appender.isInProgress=false;if(appender.loggingEventMap.length()>0){appender.send();}
log4jsLogger.trace("< AjaxAppender.timeout");},this.timeout);}catch(e){log4jsLogger.fatal(e);}
log4jsLogger.trace("> AjaxAppender.send");}},onReadyStateChanged:function(){log4jsLogger.trace("> AjaxAppender.onReadyStateChanged");var req=this.httpRequest;if(this.httpRequest.readyState!=4){log4jsLogger.trace("< AjaxAppender.onReadyStateChanged: readyState "+req.readyState+" != 4");return;}
var success=((typeof req.status==="undefined")||req.status===0||(req.status>=200&&req.status<300));if(success){log4jsLogger.trace("  AjaxAppender.onReadyStateChanged: success");this.isInProgress=false;}else{var msg="  AjaxAppender.onReadyStateChanged: XMLHttpRequest request to URL "+this.loggingUrl+" returned status code "+this.httpRequest.status;log4jsLogger.error(msg);}
log4jsLogger.trace("< AjaxAppender.onReadyStateChanged: readyState == 4");},getXmlHttpRequest:function(){log4jsLogger.trace("> AjaxAppender.getXmlHttpRequest");var httpRequest=false;try{if(window.XMLHttpRequest){httpRequest=new XMLHttpRequest();if(httpRequest.overrideMimeType){httpRequest.overrideMimeType(this.layout.getContentType());}}else if(window.ActiveXObject){try{httpRequest=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){httpRequest=new ActiveXObject("Microsoft.XMLHTTP");}}}catch(e){httpRequest=false;}
if(!httpRequest){log4jsLogger.fatal("Unfortunatelly your browser does not support AjaxAppender for log4js!");}
log4jsLogger.trace("< AjaxAppender.getXmlHttpRequest");return httpRequest;},toString:function(){return"Log4js.AjaxAppender[loggingUrl="+this.loggingUrl+", threshold="+this.threshold+"]";}});Log4js.FileAppender=function(file){this.layout=new Log4js.SimpleLayout();this.isIE='undefined';this.file=file||"log4js.log";try{this.fso=new ActiveXObject("Scripting.FileSystemObject");this.isIE=true;}catch(e){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");this.fso=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);this.isIE=false;}catch(e){log4jsLogger.error(e);}}};Log4js.FileAppender.prototype=Log4js.extend(new Log4js.Appender(),{doAppend:function(loggingEvent){try{var fileHandle=null;if(this.isIE==='undefined'){log4jsLogger.error("Unsupported ")}
else if(this.isIE){fileHandle=this.fso.OpenTextFile(this.file,8,true);fileHandle.WriteLine(this.layout.format(loggingEvent));fileHandle.close();}else{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");this.fso.initWithPath(this.file);if(!this.fso.exists()){this.fso.create(0x00,0600);}
fileHandle=Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);fileHandle.init(this.fso,0x04|0x08|0x10,064,0);var line=this.layout.format(loggingEvent);fileHandle.write(line,line.length);fileHandle.close();}}catch(e){log4jsLogger.error(e);}},doClear:function(){try{if(this.isIE){var fileHandle=this.fso.GetFile(this.file);fileHandle.Delete();}else{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");this.fso.initWithPath(this.file);if(this.fso.exists()){this.fso.remove(false);}}}catch(e){log4jsLogger.error(e);}},toString:function(){return"Log4js.FileAppender[file="+this.file+"]";}});Log4js.WindowsEventAppender=function(){this.layout=new Log4js.SimpleLayout();try{this.shell=new ActiveXObject("WScript.Shell");}catch(e){log4jsLogger.error(e);}};Log4js.WindowsEventAppender.prototype=Log4js.extend(new Log4js.Appender(),{doAppend:function(loggingEvent){var winLevel=4;switch(loggingEvent.level){case Log4js.Level.FATAL:winLevel=1;break;case Log4js.Level.ERROR:winLevel=1;break;case Log4js.Level.WARN:winLevel=2;break;default:winLevel=4;break;}
try{this.shell.LogEvent(winLevel,this.level.format(loggingEvent));}catch(e){log4jsLogger.error(e);}},toString:function(){return"Log4js.WindowsEventAppender";}});Log4js.JSAlertAppender=function(){this.layout=new Log4js.SimpleLayout();};Log4js.JSAlertAppender.prototype=Log4js.extend(new Log4js.Appender(),{doAppend:function(loggingEvent){alert(this.layout.getHeader()+this.layout.format(loggingEvent)+this.layout.getFooter());},toString:function(){return"Log4js.JSAlertAppender";}});Log4js.MozillaJSConsoleAppender=function(){this.layout=new Log4js.SimpleLayout();try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");this.jsConsole=Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);this.scriptError=Components.classes["@mozilla.org/scripterror;1"].createInstance(Components.interfaces.nsIScriptError);}catch(e){log4jsLogger.error(e);}};Log4js.MozillaJSConsoleAppender.prototype=Log4js.extend(new Log4js.Appender(),{doAppend:function(loggingEvent){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");this.scriptError.init(this.layout.format(loggingEvent),null,null,null,null,this.getFlag(loggingEvent),loggingEvent.categoryName);this.jsConsole.logMessage(this.scriptError);}catch(e){log4jsLogger.error(e);}},toString:function(){return"Log4js.MozillaJSConsoleAppender";},getFlag:function(loggingEvent)
{var retval;switch(loggingEvent.level){case Log4js.Level.FATAL:retval=2;break;case Log4js.Level.ERROR:retval=0;break;case Log4js.Level.WARN:retval=1;break;default:retval=1;break;}
return retval;}});Log4js.OperaJSConsoleAppender=function(){this.layout=new Log4js.SimpleLayout();};Log4js.OperaJSConsoleAppender.prototype=Log4js.extend(new Log4js.Appender(),{doAppend:function(loggingEvent){opera.postError(this.layout.format(loggingEvent));},toString:function(){return"Log4js.OperaJSConsoleAppender";}});Log4js.SafariJSConsoleAppender=function(){this.layout=new Log4js.SimpleLayout();};Log4js.SafariJSConsoleAppender.prototype=Log4js.extend(new Log4js.Appender(),{doAppend:function(loggingEvent){window.console.log(this.layout.format(loggingEvent));},toString:function(){return"Log4js.SafariJSConsoleAppender";}});Log4js.BrowserConsoleAppender=function(){this.consoleDelegate=null;if(window.console){this.consoleDelegate=new Log4js.SafariJSConsoleAppender();}
else if(window.opera){this.consoleDelegate=new Log4js.OperaJSConsoleAppender();}
else if(netscape){this.consoleDelegate=new Log4js.MozJSConsoleAppender();}
else{log4jsLogger.error("Unsupported Browser");}};Log4js.BrowserConsoleAppender.prototype=Log4js.extend(new Log4js.Appender(),{doAppend:function(loggingEvent){this.consoleDelegate.doAppend(loggingEvent);},doClear:function(){this.consoleDelegate.doClear();},setLayout:function(layout){this.consoleDelegate.setLayout(layout);},toString:function(){return"Log4js.BrowserConsoleAppender: "+this.consoleDelegate.toString();}});Log4js.SimpleLayout=function(){this.LINE_SEP="\n";this.LINE_SEP_LEN=1;};Log4js.SimpleLayout.prototype=Log4js.extend(new Log4js.Layout(),{format:function(loggingEvent){return loggingEvent.level.toString()+" - "+loggingEvent.message+this.LINE_SEP;},getContentType:function(){return"text/plain";},getHeader:function(){return"";},getFooter:function(){return"";}});Log4js.BasicLayout=function(){this.LINE_SEP="\n";};Log4js.BasicLayout.prototype=Log4js.extend(new Log4js.Layout(),{format:function(loggingEvent){return loggingEvent.categoryName+"~"+loggingEvent.startTime.toLocaleString()+" ["+loggingEvent.level.toString()+"] "+loggingEvent.message+this.LINE_SEP;},getContentType:function(){return"text/plain";},getHeader:function(){return"";},getFooter:function(){return"";}});Log4js.HtmlLayout=function(){return;};Log4js.HtmlLayout.prototype=Log4js.extend(new Log4js.Layout(),{format:function(loggingEvent){return"<div style=\""+this.getStyle(loggingEvent)+"\">"+loggingEvent.getFormattedTimestamp()+" - "+loggingEvent.level.toString()+" - "+loggingEvent.message+"</div>\n";},getContentType:function(){return"text/html";},getHeader:function(){return"<html><head><title>log4js</head><body>";},getFooter:function(){return"</body></html>";},getStyle:function(loggingEvent)
{var style;if(loggingEvent.level.toString().search(/ERROR/)!=-1){style='color:red';}else if(loggingEvent.level.toString().search(/FATAL/)!=-1){style='color:red';}else if(loggingEvent.level.toString().search(/WARN/)!=-1){style='color:orange';}else if(loggingEvent.level.toString().search(/DEBUG/)!=-1){style='color:green';}else if(loggingEvent.level.toString().search(/INFO/)!=-1){style='color:white';}else{style='color:yellow';}
return style;}});Log4js.XMLLayout=function(){return;};Log4js.XMLLayout.prototype=Log4js.extend(new Log4js.Layout(),{format:function(loggingEvent){var useragent="unknown";try{useragent=navigator.userAgent;}catch(e){useragent="unknown";}
var referer="unknown";try{referer=location.href;}catch(e){referer="unknown";}
var content="<log4js:event logger=\"";content+=loggingEvent.categoryName+"\" level=\"";content+=loggingEvent.level.toString()+"\" useragent=\"";content+=useragent+"\" referer=\"";content+=referer.replace(/&/g,"&amp;")+"\" timestamp=\"";content+=loggingEvent.getFormattedTimestamp()+"\">\n";content+="\t<log4js:message><![CDATA["+this.escapeCdata(loggingEvent.message)+"]]></log4js:message>\n";if(loggingEvent.exception){content+=this.formatException(loggingEvent.exception);}
content+="</log4js:event>\n";return content;},getContentType:function(){return"text/xml";},getHeader:function(){return"<log4js:eventSet version=\""+Log4js.version+"\" xmlns:log4js=\"http://log4js.berlios.de/2007/log4js/\">\n";},getFooter:function(){return"</log4js:eventSet>\n";},getSeparator:function(){return"\n";},formatException:function(ex){if(ex){var exStr="\t<log4js:throwable>";if(ex.message){exStr+="\t\t<log4js:message><![CDATA["+this.escapeCdata(ex.message)+"]]></log4js:message>\n";}
if(ex.description){exStr+="\t\t<log4js:description><![CDATA["+this.escapeCdata(ex.description)+"]]></log4js:description>\n";}
exStr+="\t\t<log4js:stacktrace>";exStr+="\t\t\t<log4js:location fileName=\""+ex.fileName+"\" lineNumber=\""+ex.lineNumber+"\" />";exStr+="\t\t</log4js:stacktrace>";exStr="\t</log4js:throwable>";return exStr;}
return null;},escapeCdata:function(str){return str.replace(/\]\]>/,"]]>]]&gt;<![CDATA[");}});Log4js.JSONLayout=function(){this.df=new Log4js.DateFormatter();};Log4js.JSONLayout.prototype=Log4js.extend(new Log4js.Layout(),{format:function(loggingEvent){var useragent="unknown";try{useragent=navigator.userAgent;}catch(e){useragent="unknown";}
var referer="unknown";try{referer=location.href;}catch(e){referer="unknown";}
var jsonString="{\n \"LoggingEvent\": {\n";jsonString+="\t\"logger\": \""+loggingEvent.categoryName+"\",\n";jsonString+="\t\"level\": \""+loggingEvent.level.toString()+"\",\n";jsonString+="\t\"message\": \""+loggingEvent.message+"\",\n";jsonString+="\t\"referer\": \""+referer+"\",\n";jsonString+="\t\"useragent\": \""+useragent+"\",\n";jsonString+="\t\"timestamp\": \""+this.df.formatDate(loggingEvent.startTime,"yyyy-MM-ddThh:mm:ssZ")+"\",\n";jsonString+="\t\"exception\": \""+loggingEvent.exception+"\"\n";jsonString+="}}";return jsonString;},getContentType:function(){return"text/json";},getHeader:function(){return"{\"Log4js\": [\n";},getFooter:function(){return"\n]}";},getSeparator:function(){return",\n";}});Log4js.PatternLayout=function(pattern){if(pattern){this.pattern=pattern;}else{this.pattern=Log4js.PatternLayout.DEFAULT_CONVERSION_PATTERN;}};Log4js.PatternLayout.TTCC_CONVERSION_PATTERN="%r %p %c - %m%n";Log4js.PatternLayout.DEFAULT_CONVERSION_PATTERN="%m%n";Log4js.PatternLayout.ISO8601_DATEFORMAT="yyyy-MM-dd HH:mm:ss,SSS";Log4js.PatternLayout.DATETIME_DATEFORMAT="dd MMM YYYY HH:mm:ss,SSS";Log4js.PatternLayout.ABSOLUTETIME_DATEFORMAT="HH:mm:ss,SSS";Log4js.PatternLayout.prototype=Log4js.extend(new Log4js.Layout(),{getContentType:function(){return"text/plain";},getHeader:function(){return null;},getFooter:function(){return null;},format:function(loggingEvent){var regex=/%(-?[0-9]+)?(\.?[0-9]+)?([cdmnpr%])(\{([^\}]+)\})?|([^%]+)/;var formattedString="";var result;var searchString=this.pattern;while((result=regex.exec(searchString))){var matchedString=result[0];var padding=result[1];var truncation=result[2];var conversionCharacter=result[3];var specifier=result[5];var text=result[6];if(text){formattedString+=""+text;}else{var replacement="";switch(conversionCharacter){case"c":var loggerName=loggingEvent.categoryName;if(specifier){var precision=parseInt(specifier,10);var loggerNameBits=loggingEvent.categoryName.split(".");if(precision>=loggerNameBits.length){replacement=loggerName;}else{replacement=loggerNameBits.slice(loggerNameBits.length-precision).join(".");}}else{replacement=loggerName;}
break;case"d":var dateFormat=Log4js.PatternLayout.ISO8601_DATEFORMAT;if(specifier){dateFormat=specifier;if(dateFormat=="ISO8601"){dateFormat=Log4js.PatternLayout.ISO8601_DATEFORMAT;}else if(dateFormat=="ABSOLUTE"){dateFormat=Log4js.PatternLayout.ABSOLUTETIME_DATEFORMAT;}else if(dateFormat=="DATE"){dateFormat=Log4js.PatternLayout.DATETIME_DATEFORMAT;}}
replacement=(new Log4js.SimpleDateFormat(dateFormat)).format(loggingEvent.startTime);break;case"m":replacement=loggingEvent.message;break;case"n":replacement="\n";break;case"p":replacement=loggingEvent.level.toString();break;case"r":replacement=""+loggingEvent.startTime.toLocaleTimeString();break;case"%":replacement="%";break;default:replacement=matchedString;break;}
var len;if(truncation){len=parseInt(truncation.substr(1),10);replacement=replacement.substring(0,len);}
if(padding){if(padding.charAt(0)=="-"){len=parseInt(padding.substr(1),10);while(replacement.length<len){replacement+=" ";}}else{len=parseInt(padding,10);while(replacement.length<len){replacement=" "+replacement;}}}
formattedString+=replacement;}
searchString=searchString.substr(result.index+result[0].length);}
return formattedString;}});if(!Array.prototype.push){Array.prototype.push=function(){var startLength=this.length;for(var i=0;i<arguments.length;i++){this[startLength+i]=arguments[i];}
return this.length;};}
Log4js.FifoBuffer=function()
{this.array=new Array();};Log4js.FifoBuffer.prototype={push:function(obj){this.array[this.array.length]=obj;return this.array.length;},pull:function(){if(this.array.length>0){var firstItem=this.array[0];for(var i=0;i<this.array.length-1;i++){this.array[i]=this.array[i+1];}
this.array.length=this.array.length-1;return firstItem;}
return null;},length:function(){return this.array.length;}};Log4js.DateFormatter=function(){return;};Log4js.DateFormatter.DEFAULT_DATE_FORMAT="yyyy-MM-ddThh:mm:ssO";Log4js.DateFormatter.prototype={formatDate:function(vDate,vFormat){var vDay=this.addZero(vDate.getDate());var vMonth=this.addZero(vDate.getMonth()+1);var vYearLong=this.addZero(vDate.getFullYear());var vYearShort=this.addZero(vDate.getFullYear().toString().substring(3,4));var vYear=(vFormat.indexOf("yyyy")>-1?vYearLong:vYearShort);var vHour=this.addZero(vDate.getHours());var vMinute=this.addZero(vDate.getMinutes());var vSecond=this.addZero(vDate.getSeconds());var vTimeZone=this.O(vDate);var vDateString=vFormat.replace(/dd/g,vDay).replace(/MM/g,vMonth).replace(/y{1,4}/g,vYear);vDateString=vDateString.replace(/hh/g,vHour).replace(/mm/g,vMinute).replace(/ss/g,vSecond);vDateString=vDateString.replace(/O/g,vTimeZone);return vDateString;},addZero:function(vNumber){return((vNumber<10)?"0":"")+vNumber;},O:function(date){var os=Math.abs(date.getTimezoneOffset());var h=String(Math.floor(os/60));var m=String(os%60);h.length==1?h="0"+h:1;m.length==1?m="0"+m:1;return date.getTimezoneOffset()<0?"+"+h+m:"-"+h+m;}};var log4jsLogger=Log4js.getLogger("Log4js");log4jsLogger.addAppender(new Log4js.ConsoleAppender());log4jsLogger.setLevel(Log4js.Level.ALL);if(typeof Objs=='undefined')
{var Objs=function()
{this.__classes=new Object();};Objs.register=function(classpath,constructorMethod)
{Objs._getInstance()._register(classpath,constructorMethod);};Objs.load=function(classPath)
{return Objs._getInstance()._load(classPath);};Objs.extend=function(constructorMethod,superConstructor)
{if(superConstructor.toString().indexOf('Objs.extending')==-1)
throw new Error('You have forgotten to avoid unwanted call to constructor while extending.');Objs.extending=true;constructorMethod.prototype=new superConstructor();Objs.extending=false;};Objs.extending=false;Objs.implement=function(constructorMethod,interfaceConstructor)
{Objs._getInstance()._implement(constructorMethod,interfaceConstructor);};Objs.prototype.__classPathBase=null;Objs.prototype.__classes=null;Objs.ClassInfo=function(){};Objs.ClassInfo.prototype.constructorMethod=null;Objs.ClassInfo.prototype.implementList=null;Objs._instance=null;Objs._getInstance=function()
{if(Objs._instance==null)
return Objs._instance=new Objs();return Objs._instance;};Objs.prototype._getClassInfo=function(classPath)
{var classInfo;try
{classInfo=this.__classes[classPath];}
catch(e)
{return null;}
return classInfo;};Objs.prototype._getClassInfoFromConstructor=function(constructorMethod)
{for(var sName in this.__classes)
if(this.__classes[sName].constructorMethod===constructorMethod)
return this.__classes[sName];return null;};Objs.prototype._register=function(classPath,constructorMethod)
{var classInfo=this._getClassInfo(classPath);if(classInfo==null)
{classInfo=new Objs.ClassInfo();this.__classes[classPath]=classInfo;}
if(classInfo.constructorMethod!=null)
return;classInfo.constructorMethod=constructorMethod;classInfo.implementList=new Array();};Objs.prototype._load=function(classPath)
{var classInfo;classInfo=this._getClassInfo(classPath);if(classInfo!=null&&classInfo.constructorMethod!=null)
return classInfo.constructorMethod;var wrapperMethodName='class_'+classPath.split('.').join('_');var wrapperMethod=window[wrapperMethodName];if(wrapperMethod==null)
throw new Error('Unexistent class wrapper method : "'+wrapperMethodName+'"');wrapperMethod();classInfo=this._getClassInfo(classPath);if(classInfo==null)
throw new Error('Problem while registering : "'+wrapperMethodName+'". Mainly means that you forgive to register the constructor method.');this._checkImplementList(classInfo);return classInfo.constructorMethod;};Objs.prototype._implement=function(constructorMethod,interfaceConstructor)
{var classClassInfo=this._getClassInfoFromConstructor(constructorMethod);if(classClassInfo==null)
throw new Error('Attempting to implement the interface ['+interfaceConstructor+'] on the unregistered constructor ['+constructorMethod+']');var interfaceClassInfo=this._getClassInfoFromConstructor(interfaceConstructor);if(interfaceClassInfo==null)
throw new Error('Attempting to implement the unregistered interface ['+interfaceConstructor+'] on the constructor ['+constructorMethod+']');classClassInfo.implementList.push(interfaceClassInfo);};Objs.prototype._checkImplementList=function(classInfo)
{if(classInfo.implementList.length==0)
return;var len=classInfo.implementList.length;for(var i=0;i<len;i++)
this._checkImplement(classInfo,classInfo.implementList[i]);};Objs.prototype._checkImplement=function(classClassInfo,interfaceClassInfo)
{Objs.extending=true;var interClass=new classClassInfo.constructorMethod();var interfaceClass=new interfaceClassInfo.constructorMethod();Objs.extending=false;for(var methodName in interfaceClass)
{var method=interfaceClass[methodName];if(typeof method!='function')
continue;if(typeof interClass[methodName]!='function')
throw new Error('Method : "'+methodName+'" from ['+interfaceClassInfo.constructorMethod+'] is not implemented by ['+classClassInfo.constructorMethod+']');}};}
function class_org_puremvc_js_core_Controller()
{Objs.register("org.puremvc.js.core.Controller",Controller);var View=Objs.load("org.puremvc.js.core.View");var Observer=Objs.load("org.puremvc.js.patterns.observer.Observer");var IController=Objs.load("org.puremvc.js.interfaces.IController");function Controller()
{if(Objs.extending)return;if(Controller._instance!=null)
throw new Error(Controller._SINGLETON_MSG);Controller._instance=this;this._commandMap=new Array();this._initializeController();}
Objs.implement(Controller,IController);var o=Controller.prototype;o._view=null;o._commandMap=null;Controller._instance=null;Controller._SINGLETON_MSG="Controller Singleton already constructed!";o._initializeController=function()
{this._view=View.getInstance();}
Controller.getInstance=function()
{if(Controller._instance==null)
Controller._instance=new Controller();return Controller._instance;}
o.executeCommand=function(note)
{var commandClassRef=this._commandMap[note.getName()];if(commandClassRef==null)
return;var commandInstance=new commandClassRef();commandInstance.execute(note);}
o.registerCommand=function(notificationName,commandClassRef)
{var that=this;var f=function(note){that.executeCommand(note)}
if(this._commandMap[notificationName]==null)
this._view.registerObserver(notificationName,new Observer(f,this));this._commandMap[notificationName]=commandClassRef;}
o.hasCommand=function(notificationName)
{return this._commandMap[notificationName]!=null;}
o.removeCommand=function(notificationName)
{if(this.hasCommand(notificationName))
{this._view.removeObserver(notificationName,this);this._commandMap[notificationName]=null;}}}
function class_org_puremvc_js_core_Model()
{Objs.register("org.puremvc.js.core.Model",Model);var IModel=Objs.load("org.puremvc.js.interfaces.IModel");var IProxy=Objs.load("org.puremvc.js.interfaces.IProxy");function Model()
{if(Objs.extending)return;if(Model._instance!=null)
throw Error(Model.SINGLETON_MSG);Model._instance=this;this._proxyMap=new Array();this._initializeModel();}
Objs.implement(Model,IModel);var o=Model.prototype;o._proxyMap=null;Model._instance=null;Model._SINGLETON_MSG="Model Singleton already constructed!";o._initializeModel=function()
{}
Model.getInstance=function()
{if(Model._instance==null)
Model._instance=new Model();return Model._instance;}
o.registerProxy=function(proxy)
{this._proxyMap[proxy.getProxyName()]=proxy;proxy.onRegister();}
o.retrieveProxy=function(proxyName)
{return this._proxyMap[proxyName];}
o.hasProxy=function(proxyName)
{return this._proxyMap[proxyName]!=null;}
o.removeProxy=function(proxyName)
{var proxy=this._proxyMap[proxyName];if(proxy)
{this._proxyMap[proxyName]=null;proxy.onRemove();}
return proxy;}}
function class_org_puremvc_js_core_View()
{Objs.register("org.puremvc.js.core.View",View);var IView=Objs.load("org.puremvc.js.interfaces.IView");var IObserver=Objs.load("org.puremvc.js.interfaces.IObserver");var INotification=Objs.load("org.puremvc.js.interfaces.INotification");var Observer=Objs.load("org.puremvc.js.patterns.observer.Observer");function View()
{if(Objs.extending)return;if(View._instance!=null)
throw Error(View._SINGLETON_MSG);View._instance=this;this._mediatorMap=new Array();this._observerMap=new Array();this._initializeView();}
Objs.implement(View,IView);var o=View.prototype;o._mediatorMap=null;o._observerMap=null;View._instance=null;View._SINGLETON_MSG="View Singleton already constructed!";o._initializeView=function()
{}
View.getInstance=function()
{if(View._instance==null)
View._instance=new View();return View._instance;}
o.registerObserver=function(notificationName,observer)
{var observers=this._observerMap[notificationName];if(observers)
observers.push(observer);else
this._observerMap[notificationName]=[observer];}
o.notifyObservers=function(notification)
{if(this._observerMap[notification.getName()]!=null)
{var observers=this._observerMap[notification.getName()];for(var i=0;i<observers.length;i++)
{var observer=observers[i];observer.notifyObserver(notification);}}}
o.removeObserver=function(notificationName,notifyContext)
{var observers=this._observerMap[notificationName];for(var i=0;i<observers.length;i++)
{if(Observer(observers[i]).compareNotifyContext(notifyContext)==true)
{observers.splice(i,1);break;}}
if(observers.length==0)
delete this._observerMap[notificationName];}
o.registerMediator=function(mediator)
{this._mediatorMap[mediator.getMediatorName()]=mediator;var interests=mediator.listNotificationInterests();if(interests.length>0)
{var observer=new Observer(mediator.handleNotification,mediator);for(var i=0;i<interests.length;i++)
this.registerObserver(interests[i],observer);}
mediator.onRegister();}
o.retrieveMediator=function(mediatorName)
{return this._mediatorMap[mediatorName];}
o.removeMediator=function(mediatorName)
{var mediator=this._mediatorMap[mediatorName];if(mediator)
{var interests=mediator.listNotificationInterests();for(var i=0;i<interests.length;i++)
{this.removeObserver(interests[i],mediator);}
delete this._mediatorMap[mediatorName];mediator.onRemove();}
return mediator;}
o.hasMediator=function(mediatorName)
{return this._mediatorMap[mediatorName]!=null;}}
function class_org_puremvc_js_interfaces_ICommand()
{Objs.register("org.puremvc.js.interfaces.ICommand",ICommand);var o=ICommand.prototype;function ICommand(){}
o.execute=function(notification){};}
function class_org_puremvc_js_interfaces_IController()
{Objs.register("org.puremvc.js.interfaces.IController",IController);var o=IController.prototype;function IController(){}
o.registerCommand=function(notificationName,commandIControllerRef){};o.executeCommand=function(notification){};o.removeCommand=function(notificationName){};o.hasCommand=function(notificationName){};}
function class_org_puremvc_js_interfaces_IFacade()
{Objs.register("org.puremvc.js.interfaces.IFacade",IFacade);var o=IFacade.prototype;function IFacade(){}
o.registerProxy=function(proxy){};o.retrieveProxy=function(proxyName){};o.removeProxy=function(proxyName){};o.hasProxy=function(proxyName){};o.registerCommand=function(noteName,commandIFacadeRef){};o.removeCommand=function(notificationName){};o.hasCommand=function(notificationName){};o.registerMediator=function(mediator){};o.retrieveMediator=function(mediatorName){};o.removeMediator=function(mediatorName){};o.hasMediator=function(mediatorName){};o.notifyObservers=function(notification){};}
function class_org_puremvc_js_interfaces_IMediator()
{Objs.register("org.puremvc.js.interfaces.IMediator",IMediator);var o=IMediator.prototype;function IMediator(){}
o.getMediatorName=function(){};o.getViewComponent=function(){};o.setViewComponent=function(viewComponent){};o.listNotificationInterests=function(){};o.handleNotification=function(notification){};o.onRegister=function(){};o.onRemove=function(){};}
function class_org_puremvc_js_interfaces_IModel()
{Objs.register("org.puremvc.js.interfaces.IModel",IModel);var o=IModel.prototype;function IModel(){}
o.registerProxy=function(proxy){};o.retrieveProxy=function(proxyName){};o.removeProxy=function(proxyName){};o.hasProxy=function(proxyName){};}
function class_org_puremvc_js_interfaces_INotification()
{Objs.register("org.puremvc.js.interfaces.INotification",INotification);var o=INotification.prototype;function INotification(){}
o.getName=function(){};o.setBody=function(body){};o.getBody=function(){};o.setType=function(type){};o.getType=function(){};o.toString=function(){};}
function class_org_puremvc_js_interfaces_INotifier()
{Objs.register("org.puremvc.js.interfaces.INotifier",INotifier);var o=INotifier.prototype;function INotifier(){}
o.sendNotification=function(notificationName,body,type){};}
function class_org_puremvc_js_interfaces_IObserver()
{Objs.register("org.puremvc.js.interfaces.IObserver",IObserver);var o=IObserver.prototype;function IObserver(){}
o.setNotifyMethod=function(notifyMethod){};o.setNotifyContext=function(notifyContext){};o.notifyObserver=function(notification){};o.compareNotifyContext=function(object){};}
function class_org_puremvc_js_interfaces_IProxy()
{Objs.register("org.puremvc.js.interfaces.IProxy",IProxy);function IProxy(){}
var o=IProxy.prototype;o.getProxyName=function(){};o.setData=function(data){};o.getData=function(){};o.onRegister=function(){};o.onRemove=function(){};}
function class_org_puremvc_js_interfaces_IView()
{Objs.register("org.puremvc.js.interfaces.IView",IView);function IView(){}
var o=IView.prototype;o.registerObserver=function(notificationName,observer){};o.removeObserver=function(notificationName,notifyContext){};o.notifyObservers=function(note){};o.registerMediator=function(mediator){};o.retrieveMediator=function(mediatorName){};o.removeMediator=function(mediatorName){};o.hasMediator=function(mediatorName){};}
function class_org_puremvc_js_patterns_command_MacroCommand()
{Objs.register("org.puremvc.js.patterns.command.MacroCommand",MacroCommand);var Notifier=Objs.load("org.puremvc.js.patterns.observer.Notifier");var ICommand=Objs.load("org.puremvc.js.interfaces.ICommand");var INotifier=Objs.load("org.puremvc.js.interfaces.INotifier");var INotification=Objs.load("org.puremvc.js.interfaces.INotification");function MacroCommand()
{Notifier.apply(this,arguments);if(Objs.extending)return;this._subCommands=new Array();this._initializeMacroCommand();}
Objs.extend(MacroCommand,Notifier);Objs.implement(MacroCommand,ICommand);Objs.implement(MacroCommand,INotifier);var o=MacroCommand.prototype;o._subCommands=null;o._initializeMacroCommand=function()
{}
o._addSubCommand=function(commandClassRef)
{this._subCommands.push(commandClassRef);}
o.execute=function(notification)
{while(this._subCommands.length>0)
{var commandClassRef=this._subCommands.shift();var commandInstance=new commandClassRef();commandInstance.execute(notification);}}}
function class_org_puremvc_js_patterns_command_SimpleCommand()
{Objs.register("org.puremvc.js.patterns.command.SimpleCommand",SimpleCommand);var Notifier=Objs.load("org.puremvc.js.patterns.observer.Notifier");var ICommand=Objs.load("org.puremvc.js.interfaces.ICommand");var INotifier=Objs.load("org.puremvc.js.interfaces.INotifier");var INotification=Objs.load("org.puremvc.js.interfaces.INotification");function SimpleCommand()
{Notifier.apply(this,arguments);if(Objs.extending)return;}
Objs.extend(SimpleCommand,Notifier);Objs.implement(SimpleCommand,ICommand);Objs.implement(SimpleCommand,INotifier);var o=SimpleCommand.prototype;o.execute=function(notification)
{}}
function class_org_puremvc_js_patterns_facade_Facade()
{Objs.register("org.puremvc.js.patterns.facade.Facade",Facade);var IFacade=Objs.load("org.puremvc.js.interfaces.IFacade");var IProxy=Objs.load("org.puremvc.js.interfaces.IProxy");var IMediator=Objs.load("org.puremvc.js.interfaces.IMediator");var INotification=Objs.load("org.puremvc.js.interfaces.INotification");var IController=Objs.load("org.puremvc.js.interfaces.IController");var IModel=Objs.load("org.puremvc.js.interfaces.IModel");var IView=Objs.load("org.puremvc.js.interfaces.IView");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var Model=Objs.load("org.puremvc.js.core.Model");var View=Objs.load("org.puremvc.js.core.View");var Controller=Objs.load("org.puremvc.js.core.Controller");function Facade()
{if(Objs.extending)return;if(Facade._instance!=null)
throw Error(Facade._SINGLETON_MSG);this._initializeFacade();}
Objs.implement(Facade,IFacade);var o=Facade.prototype;o._controller=null;o._model=null;o._view=null;Facade._instance=null;Facade._SINGLETON_MSG="Facade Singleton already constructed!";o._initializeFacade=function()
{this._initializeModel();this._initializeController();this._initializeView();}
Facade.getInstance=function()
{if(Facade._instance==null)
Facade._instance=new Facade();return Facade._instance;}
o._initializeController=function()
{if(this._controller!=null)
return;this._controller=Controller.getInstance();}
o._initializeModel=function()
{if(this._model!=null)
return;this._model=Model.getInstance();}
o._initializeView=function()
{if(this._view!=null)
return;this._view=View.getInstance();}
o.registerCommand=function(notificationName,commandClassRef)
{this._controller.registerCommand(notificationName,commandClassRef);}
o.removeCommand=function(notificationName)
{this._controller.removeCommand(notificationName);}
o.hasCommand=function(notificationName)
{return this._controller.hasCommand(notificationName);}
o.registerProxy=function(proxy)
{this._model.registerProxy(proxy);}
o.retrieveProxy=function(proxyName)
{return this._model.retrieveProxy(proxyName);}
o.removeProxy=function(proxyName)
{var proxy;if(this._model!=null)
proxy=this._model.removeProxy(proxyName);return proxy}
o.hasProxy=function(proxyName)
{return this._model.hasProxy(proxyName);}
o.registerMediator=function(mediator)
{if(this._view!=null)
this._view.registerMediator(mediator);}
o.retrieveMediator=function(mediatorName)
{return this._view.retrieveMediator(mediatorName);}
o.removeMediator=function(mediatorName)
{var mediator;if(this._view!=null)
mediator=this._view.removeMediator(mediatorName);return mediator;}
o.hasMediator=function(mediatorName)
{return this._view.hasMediator(mediatorName);}
o.sendNotification=function(notificationName,body,type)
{this.notifyObservers(new Notification(notificationName,body,type));}
o.notifyObservers=function(notification)
{if(this._view!=null)
this._view.notifyObservers(notification);}}
function class_org_puremvc_js_patterns_mediator_Mediator()
{Objs.register("org.puremvc.js.patterns.mediator.Mediator",Mediator);var Notifier=Objs.load("org.puremvc.js.patterns.observer.Notifier");var IMediator=Objs.load("org.puremvc.js.interfaces.IMediator");var INotifier=Objs.load("org.puremvc.js.interfaces.INotifier");var INotification=Objs.load("org.puremvc.js.interfaces.INotification");Mediator.NAME='Mediator';function Mediator(mediatorName,viewComponent)
{Notifier.apply(this,arguments);if(Objs.extending)return;this._mediatorName=(mediatorName!=null)?mediatorName:Mediator.NAME;this._viewComponent=viewComponent;}
Objs.extend(Mediator,Notifier);Objs.implement(Mediator,IMediator);Objs.implement(Mediator,INotifier);var o=Mediator.prototype;o._mediatorName=null;o._viewComponent=null;o.getMediatorName=function()
{return this._mediatorName;}
o.setViewComponent=function(viewComponent)
{this._viewComponent=viewComponent;}
o.getViewComponent=function()
{return this._viewComponent;}
o.listNotificationInterests=function()
{return[];}
o.handleNotification=function(notification)
{}
o.onRegister=function()
{}
o.onRemove=function()
{}}
function class_org_puremvc_js_patterns_observer_Notification()
{Objs.register("org.puremvc.js.patterns.observer.Notification",Notification);var INotification=Objs.load("org.puremvc.js.interfaces.INotification");function Notification
(name,body,type)
{if(Objs.extending)return;this._name=name;this._body=body;this._type=type;}
Objs.implement(Notification,INotification);var o=Notification.prototype;o._name=null;o._type=null;o._body=null;o.getName=function()
{return this._name;}
o.setBody=function(body)
{this._body=body;}
o.getBody=function()
{return this._body;}
o.setType=function(type)
{this._type=type;}
o.getType=function()
{return this._type;}
o.toString=function()
{var msg="Notification Name:"+this.getName();msg+="\nBody:"+((this._body==null)?"null":this._body.toString());msg+="\nType:"+((this._type==null)?"null":this._type);return msg;}}
function class_org_puremvc_js_patterns_observer_Notifier()
{Objs.register("org.puremvc.js.patterns.observer.Notifier",Notifier);var IFacade=Objs.load("org.puremvc.js.interfaces.IFacade");var Facade=Objs.load("org.puremvc.js.patterns.facade.Facade");var INotifier=Objs.load("org.puremvc.js.interfaces.INotifier");function Notifier()
{if(Objs.extending)return;o._facade=Facade.getInstance();}
Objs.implement(Notifier,INotifier);var o=Notifier.prototype;o._facade=null;o.sendNotification=function(notificationName,body,type)
{this._facade.sendNotification(notificationName,body,type);}}
function class_org_puremvc_js_patterns_observer_Observer()
{Objs.register("org.puremvc.js.patterns.observer.Observer",Observer);var IObserver=Objs.load("org.puremvc.js.interfaces.IObserver");function Observer(notifyMethod,notifyContext)
{if(Objs.extending)return;this.setNotifyMethod(notifyMethod);this.setNotifyContext(notifyContext);}
var o=Observer.prototype;o._notify=null;o._context=null;Objs.implement(Observer,IObserver);o.setNotifyMethod=function(notifyMethod)
{this._notify=notifyMethod;}
o.setNotifyContext=function(notifyContext)
{this._context=notifyContext;}
o.__getNotifyMethod=function()
{return this._notify;}
o.__getNotifyContext=function()
{return this._context;}
o.notifyObserver=function(notification)
{this.__getNotifyMethod().apply(this.__getNotifyContext(),[notification]);}
o.compareNotifyContext=function(object)
{return object===this._context;}}
function class_org_puremvc_js_patterns_proxy_Proxy()
{Objs.register("org.puremvc.js.patterns.proxy.Proxy",Proxy);var Notifier=Objs.load("org.puremvc.js.patterns.observer.Notifier");var IProxy=Objs.load("org.puremvc.js.interfaces.IProxy");var INotifier=Objs.load("org.puremvc.js.interfaces.INotifier");function Proxy(proxyName,data)
{Notifier.apply(this,arguments);if(Objs.extending)return;this._proxyName=(proxyName!=null)?proxyName:Proxy.NAME;if(data!=null)
this.setData(data);}
Objs.extend(Proxy,Notifier);Objs.implement(Proxy,IProxy);Objs.implement(Proxy,INotifier);var o=Proxy.prototype;Proxy.NAME='Proxy';o._proxyName=null;o._data=null;o.getProxyName=function()
{return this._proxyName;}
o.setData=function(data)
{this._data=data;}
o.getData=function()
{return this._data;}
o.onRegister=function()
{}
o.onRemove=function()
{}}
function class_net_tekool_events_EventDispatcher()
{Objs.register("net.tekool.events.EventDispatcher",EventDispatcher);function EventDispatcher()
{if(Objs.extending)return;this.__listenerMap=new Object();}
EventDispatcher.QUEUE_PATTERN='@_@';var o=EventDispatcher.prototype;o.__listenerMap=null;o.dispatchEvent=function(event)
{if(typeof event=='undefined')
return;if(typeof event.type=='undefined')
return;var queue;try{queue=this.__listenerMap[EventDispatcher.QUEUE_PATTERN+event.type].slice(0);}
catch(e){return};var len=queue.length;for(var i=0;i<len;i++)
{var listener=queue[i];if(typeof event.target=='undefined')
event.target=this;if(typeof listener=='function')
listener.call(this,event);else
{if(typeof listener.handleEvent!='undefined')
listener.handleEvent.call(listener,event);var handler=listener[event.type+'Handler'];if(typeof handler!='undefined')
handler.call(listener,event);}}}
o.addEventListener=function(type,listener)
{var queue;try{queue=this.__listenerMap[EventDispatcher.QUEUE_PATTERN+type]}catch(e){};if(typeof queue=='undefined')
queue=this.__listenerMap[EventDispatcher.QUEUE_PATTERN+type]=new Array();var len=queue.length;for(var i=0;i<len;i++)
if(queue[i]==listener)
return;queue.push(listener);}
o.removeEventListener=function(type,listener)
{var queue;try{queue=this.__listenerMap[EventDispatcher.QUEUE_PATTERN+type]}catch(e){};if(typeof queue=='undefined')
return;var len=queue.length;for(var i=0;i<len;i++)
if(queue[i]==listener)
{queue.splice(i,1);return;}}}
function class_net_tekool_events_EventS()
{Objs.register("net.tekool.events.EventS",EventS);function EventS
(type,target)
{if(Objs.extending)return;this.type=type;this.target=target;}
EventS.prototype.type=null;EventS.prototype.target=null;EventS.prototype.toString=function()
{return'[EventS] '
+'{ type:"'+(this.type||'')+'"'
+', target:'+(this.target||'')
+'}';}}
function class_net_tekool_utils_Relegate()
{Objs.register("net.tekool.utils.Relegate",Relegate);function Relegate(){}
Relegate.create=function(t,f)
{var a=new Array();for(var i=2;i<arguments.length;i++)
a.push(arguments[i]);return function()
{var b=new Array();for(var i=0;i<arguments.length;i++)
b.push(arguments[i]);return f.apply
(t,b.concat(a));};}}
function class_com_evri_collections_ApplicationFacade()
{Objs.register("com.evri.collections.ApplicationFacade",ApplicationFacade);var IFacade=Objs.load("org.puremvc.js.interfaces.IFacade");var Facade=Objs.load("org.puremvc.js.patterns.facade.Facade");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var StartupCommand=Objs.load("com.evri.collections.controller.StartupCommand");Objs.extend(ApplicationFacade,Facade);Objs.implement(ApplicationFacade,IFacade);var o=ApplicationFacade.prototype;ApplicationFacade.NAME="ApplicationFacade";ApplicationFacade.STARTUP="startup";ApplicationFacade.APPLICATION_MESSAGE="application_message";ApplicationFacade.COLLECTION_CHANGED="collection_changed";ApplicationFacade.ENTITY_CHANGED="entity_changed";ApplicationFacade.SERVER_ERROR="server_error";ApplicationFacade.TWEETS_LOADED="tweets_loaded";ApplicationFacade.TWEETS_FAILED="tweets_failed";o.__log=null;function ApplicationFacade()
{Facade.apply(this,arguments);if(Objs.extending)return;this.__initialize();}
ApplicationFacade.getInstance=function()
{if(!(Facade._instance instanceof ApplicationFacade))
{Facade._instance=new ApplicationFacade();}
return Facade._instance;};o.startup=function(app)
{this.sendNotification(ApplicationFacade.STARTUP,app);};o._initializeController=function()
{Facade.prototype._initializeController(this);this.registerCommand(ApplicationFacade.STARTUP,StartupCommand);};o.__initialize=function()
{this.__log=Log4js.getLogger();this.__log.debug(ApplicationFacade.NAME+" initialized");};}
function class_com_evri_collections_controller_StartupCommand()
{Objs.register("com.evri.collections.controller.StartupCommand",StartupCommand);var ICommand=Objs.load("org.puremvc.js.interfaces.ICommand");var MacroCommand=Objs.load("org.puremvc.js.patterns.command.MacroCommand");var InitializeCommand=Objs.load("com.evri.collections.controller.InitializeCommand");var DeserializeStateCommand=Objs.load("com.evri.collections.controller.DeserializeStateCommand");Objs.extend(StartupCommand,MacroCommand);Objs.implement(StartupCommand,ICommand);var o=StartupCommand.prototype;StartupCommand.NAME="StartupCommand";o.__log=Log4js.getLogger();function StartupCommand()
{MacroCommand.apply(this,arguments);if(Objs.extending)return;this.__initialize();}
o._initializeMacroCommand=function()
{this._addSubCommand(InitializeCommand);this._addSubCommand(DeserializeStateCommand);};o.__initialize=function()
{this.__log.debug(StartupCommand.NAME+" initialized");};}
function class_com_evri_collections_controller_InitializeCommand()
{Objs.register("com.evri.collections.controller.InitializeCommand",InitializeCommand);var ICommand=Objs.load("org.puremvc.js.interfaces.ICommand");var SimpleCommand=Objs.load("org.puremvc.js.patterns.command.SimpleCommand");var CollectionProxy=Objs.load("com.evri.collections.model.CollectionProxy");var EntityProxy=Objs.load("com.evri.collections.model.EntityProxy");var ResourceProxy=Objs.load("com.evri.collections.model.ResourceProxy");var UserProxy=Objs.load("com.evri.collections.model.UserProxy");var TweetProxy=Objs.load("com.evri.collections.model.TweetProxy");var CollectionMetadataMediator=Objs.load("com.evri.collections.view.CollectionMetadataMediator");var IncludedEntitiesMediator=Objs.load("com.evri.collections.view.IncludedEntitiesMediator");var EntitySearchMediator=Objs.load("com.evri.collections.view.EntitySearchMediator");var MessagingMediator=Objs.load("com.evri.collections.view.MessagingMediator");var RelatedEntitiesMediator=Objs.load("com.evri.collections.view.RelatedEntitiesMediator");var TweetMediator=Objs.load("com.evri.collections.view.TweetMediator");Objs.extend(InitializeCommand,SimpleCommand);Objs.implement(InitializeCommand,ICommand);var o=InitializeCommand.prototype;InitializeCommand.NAME="InitializeCommand";o.__log=Log4js.getLogger();;function InitializeCommand()
{SimpleCommand.apply(this,arguments);if(Objs.extending)return;this.__initialize();}
o.execute=function(note)
{this._facade.registerProxy(new CollectionProxy());this._facade.registerProxy(new EntityProxy());this._facade.registerProxy(new ResourceProxy());this._facade.registerProxy(new UserProxy());this._facade.registerProxy(new TweetProxy());var app=note.getBody();this._facade.registerMediator(new MessagingMediator(app["messaging"]));this._facade.registerMediator(new CollectionMetadataMediator(app["collectionMetadata"]));this._facade.registerMediator(new IncludedEntitiesMediator(app["includedEntities"]));this._facade.registerMediator(new EntitySearchMediator(app["entitySearch"]));this._facade.registerMediator(new RelatedEntitiesMediator(app["relatedEntities"]));this._facade.registerMediator(new TweetMediator(app["tweets"]));};o.__initialize=function()
{this.__log.debug(InitializeCommand.NAME+" initialized");};}
function class_com_evri_collections_controller_DeserializeStateCommand()
{Objs.register("com.evri.collections.controller.DeserializeStateCommand",DeserializeStateCommand);var ICommand=Objs.load("org.puremvc.js.interfaces.ICommand");var SimpleCommand=Objs.load("org.puremvc.js.patterns.command.SimpleCommand");var CollectionProxy=Objs.load("com.evri.collections.model.CollectionProxy");var CollectionVO=Objs.load("com.evri.collections.model.vo.CollectionVO");var EntityProxy=Objs.load("com.evri.collections.model.EntityProxy");var EntityVO=Objs.load("com.evri.collections.model.vo.EntityVO");var CollectionMetadataMediator=Objs.load("com.evri.collections.view.CollectionMetadataMediator");var IncludedEntitiesMediator=Objs.load("com.evri.collections.view.IncludedEntitiesMediator");var RelatedEntitiesMediator=Objs.load("com.evri.collections.view.RelatedEntitiesMediator");Objs.extend(DeserializeStateCommand,SimpleCommand);Objs.implement(DeserializeStateCommand,ICommand);var o=DeserializeStateCommand.prototype;DeserializeStateCommand.NAME="DeserializeStateCommand";o.__log=Log4js.getLogger();function DeserializeStateCommand()
{SimpleCommand.apply(this,arguments);if(Objs.extending)return;this.__initialize();}
o.execute=function(note)
{this.__findCollections();this.__findEntities();};o.__initialize=function()
{this.__log.debug(DeserializeStateCommand.NAME+" initialized");};o.__findCollections=function()
{var proxy=this._facade.retrieveProxy(CollectionProxy.NAME);var metadata=this._facade.retrieveMediator(CollectionMetadataMediator.NAME);var collections=null;var i=0;var n=0;collections=metadata.getViewState(CollectionVO);n=collections.length;for(i=0;i<n;i++)
{proxy.addCollection(collections[i]);}};o.__findEntities=function()
{var entityProxy=this._facade.retrieveProxy(EntityProxy.NAME);var collectionProxy=this._facade.retrieveProxy(CollectionProxy.NAME);var included=this._facade.retrieveMediator(IncludedEntitiesMediator.NAME);var related=this._facade.retrieveMediator(RelatedEntitiesMediator.NAME);var entities;var i=0;var n=0;entities=included.getViewState(EntityVO);n=entities.length;for(i=0;i<n;i++)
{var entity=entities[i];entityProxy.addEntity(entity);}
collectionProxy.addEntitiesFromViewState(null,entities);entities=related.getViewState(EntityVO);n=entities.length;for(i=0;i<n;i++)
{entityProxy.addEntity(entities[i]);}};}
function class_com_evri_collections_model_CollectionProxy()
{Objs.register("com.evri.collections.model.CollectionProxy",CollectionProxy);var IProxy=Objs.load("org.puremvc.js.interfaces.IProxy");var Proxy=Objs.load("org.puremvc.js.patterns.proxy.Proxy");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var ApplicationFacade=Objs.load("com.evri.collections.ApplicationFacade");var CollectionVO=Objs.load("com.evri.collections.model.vo.CollectionVO");var EntityVO=Objs.load("com.evri.collections.model.vo.EntityVO");var ErrorType=Objs.load("com.evri.collections.model.enum.ErrorType");var EntityProxy=Objs.load("com.evri.collections.model.EntityProxy");var ResourceProxy=Objs.load("com.evri.collections.model.ResourceProxy");var MessagingType=Objs.load("com.evri.collections.model.enum.MessagingType");var Relegate=Objs.load("net.tekool.utils.Relegate");Objs.extend(CollectionProxy,Proxy);Objs.implement(CollectionProxy,IProxy);var o=CollectionProxy.prototype;CollectionProxy.NAME="CollectionProxy";o.__log=Log4js.getLogger();o.__endpoint=null;o.__defaultCollectionUrl=null;function CollectionProxy()
{Proxy.apply(this,[CollectionProxy.NAME,new Object()]);if(Objs.extending)return;this.__initialize();}
o.addCollection=function(collection)
{if(!Boolean(collection.uri))
{collection.uri=this.__defaultCollectionUrl;}
else if(collection.uri.indexOf("http")==0)
{collection.uri=collection.uri.replace(/https?:\/\//,"");collection.uri=collection.uri.substring(collection.uri.indexOf("/"));}
this.getCollectionMap()[collection.uri]=collection;this.sendNotification(ApplicationFacade.COLLECTION_CHANGED,collection);};o.removeCollection=function(collection)
{delete this.getCollectionMap()[collection.uri];this.sendNotification(ApplicationFacade.COLLECTION_CHANGED,false);};o.getCollection=function(collectionUri)
{if(!Boolean(collectionUri))
{return this.getCollectionMap()[this.__defaultCollectionUrl];}
else
{return this.getCollectionMap()[collectionUri];}};o.updateCollection=function(collection)
{this.__log.debug("updateCollection");if(!collection.name||collection.name=="")
{throw new Error(ErrorType.VALUE_REQUIRED);}
if(!this.__isCollectionNameUnique(collection))
{throw new Error(ErrorType.NON_UNIQUE_VALUE);}
var request={};request["type"]="POST";request["dataType"]="json";request["url"]=this.__endpoint+"/update";request["data"]={name:collection.name,description:collection.description};request["success"]=Relegate.create(this,this.__successHandler);request["error"]=Relegate.create(this,this.__errorHandler);$.ajax(request);};o.getCollectionArray=function()
{var map=this.getCollectionMap();var array=new Array();for(var uri in map)
{array.push(map[uri]);}
return array;};o.getCollectionMap=function()
{return this._data;};o.getEntitiesForCollection=function(collection)
{if(collection)
{return this.getCollectionMap()[collection.url].entities;}
else
{return this.getCollectionMap()[this.__defaultCollectionUrl].entities;}};o.addEntityToCollection=function(collection,entity)
{if(!collection)
{collection=this.getCollectionMap()[this.__defaultCollectionUrl];}
var request={};request["type"]="POST";request["dataType"]="json";request["url"]=this.__endpoint+"/add";request["data"]={entity_href:entity.uri};request["success"]=Relegate.create(this,this.__successHandler);request["error"]=Relegate.create(this,this.__errorHandler);$.ajax(request);};o.removeEntityFromCollection=function(collection,entity)
{if(!collection)
{collection=this.getCollectionMap()[this.__defaultCollectionUrl];}
var request={};request["type"]="POST";request["dataType"]="json";request["url"]=this.__endpoint+"/remove";request["data"]={entity_href:entity.uri};request["success"]=Relegate.create(this,this.__successHandler);request["error"]=Relegate.create(this,this.__errorHandler);$.ajax(request);};o.addEntitiesFromViewState=function(collection,entities)
{if(!collection)
{collection=this.getCollectionMap()[this.__defaultCollectionUrl];}
for(var i=0;i<entities.length;i++){collection.entities.push(entities[i].uri);}
this._facade.sendNotification(ApplicationFacade.COLLECTION_CHANGED,collection);};o.__initialize=function()
{this.__log.debug(CollectionProxy.NAME+" initialized");this.__endpoint=window.location.pathname.replace(/\/(profiles|twitter|images|videos).*$/,"");this.__defaultCollectionUrl=this.__endpoint;this.__log.info(CollectionProxy.NAME+" endpoint:"+this.__endpoint);this.__getCollections();};o.__isCollectionNameUnique=function(collection)
{for(var uri in this._data)
{var temp=this.getCollection(uri);if(collection.name==temp.name&&collection.uri!=temp.uri)
{return false;}}
return true;};o.__getCollections=function()
{var $items=$("#userCollections a");for(var i=0;i<$items.length;i++)
{this.addCollection(new CollectionVO($items[i].innerHTML,null,$items[i].href));}};o.__successHandler=function(result)
{var collection=CollectionVO.fromObject(result);this.addCollection(collection);var entityProxy=this._facade.retrieveProxy(EntityProxy.NAME);entityProxy.addEntitiesFromCollection(collection);};o.__errorHandler=function(error)
{var errorMessage="";try{var json_error=eval("("+error.responseText+")");errorMessage=json_error.error;}catch(error){this.__log.error(error.responseText);var resourceProxy=this._facade.retrieveProxy(ResourceProxy.NAME);errorMessage=resourceProxy.getErrorHtml(ErrorType.UNKNOWN);}
this._facade.sendNotification(ApplicationFacade.SERVER_ERROR,errorMessage);};}
function class_com_evri_collections_model_EntityProxy()
{Objs.register("com.evri.collections.model.EntityProxy",EntityProxy);var IProxy=Objs.load("org.puremvc.js.interfaces.IProxy");var Proxy=Objs.load("org.puremvc.js.patterns.proxy.Proxy");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var ApplicationFacade=Objs.load("com.evri.collections.ApplicationFacade");var CollectionVO=Objs.load("com.evri.collections.model.vo.CollectionVO");var EntityVO=Objs.load("com.evri.collections.model.vo.EntityVO");var Relegate=Objs.load("net.tekool.utils.Relegate");Objs.extend(EntityProxy,Proxy);Objs.implement(EntityProxy,IProxy);var o=EntityProxy.prototype;EntityProxy.NAME="EntityProxy";EntityProxy.APP_ID="evri-portal-collections";o.__log=null;o.__apiSession=null;function EntityProxy()
{Proxy.apply(this,[EntityProxy.NAME,new Object()]);if(Objs.extending)return;this.__initialize();}
o.addEntity=function(entity)
{var map=this.getEntityMap();map[this.__extractHex(entity.uri)]=entity;if(entity.isLoaded())
{this.__log.debug("updated "+entity.uri);this.sendNotification(ApplicationFacade.ENTITY_CHANGED,entity);}
else
{this.__log.debug("requesting "+entity.uri);var options={};options["onComplete"]=Relegate.create(this,this.__completeHandler);options["onFailure"]=Relegate.create(this,this.__failureHandler);this.__apiSession.models.Entity.findByResource(entity.uri,options);}};o.addEntitiesFromCollection=function(collection)
{var uris=collection.entities;for(var i=0;i<uris.length;i++)
{if(!this.getEntity(uris[i]))
{this.addEntity(new EntityVO(null,uris[i]));}}};o.getEntity=function(entityUri)
{return this.getEntityMap()[this.__extractHex(entityUri)];};o.getEntityMap=function()
{return this._data;};o.__initialize=function()
{this.__log=Log4js.getLogger();this.__log.debug(EntityProxy.NAME+" initialized");this.__apiSession=new Evri.API.Session({appId:EntityProxy.APP_ID});};o.__extractHex=function(uri)
{if(uri)
{var matches=uri.match(/0x[a-f0-9]+$/);if(matches!=null&&matches.length>0)
{return matches[0];}
else
{throw new Error("malformed element");}}};o.__completeHandler=function(result)
{this.addEntity(EntityVO.fromObject(result));};o.__failureHandler=function(error)
{this.__log.debug("failed entity request: "+error);};}
function class_com_evri_collections_model_ResourceProxy()
{Objs.register("com.evri.collections.model.ResourceProxy",ResourceProxy);var IProxy=Objs.load("org.puremvc.js.interfaces.IProxy");var Proxy=Objs.load("org.puremvc.js.patterns.proxy.Proxy");var ErrorType=Objs.load("com.evri.collections.model.enum.ErrorType");Objs.extend(ResourceProxy,Proxy);Objs.implement(ResourceProxy,IProxy);var o=ResourceProxy.prototype;ResourceProxy.NAME="ResourceProxy";o.__log=Log4js.getLogger();function ResourceProxy()
{Proxy.apply(this,[ResourceProxy.NAME,new Object()]);if(Objs.extending)return;this.__initialize();}
o.getErrorHtml=function(errorType)
{return this._data[errorType]||this.__getDefaultErrorHtml();};o.__initialize=function()
{this.__log.debug(ResourceProxy.NAME+" initialized");var map=this._data;map[ErrorType.UNKNOWN]="We've encountered an unknown error.";map[ErrorType.VALUE_REQUIRED]="We need a name for this collection.";map[ErrorType.NON_UNIQUE_VALUE]="Looks like you've already used that name "+"for a collection. <strong>Please try "+"again</strong>";map[ErrorType.MAX_LENGTH_EXCEEDED]="Your collection description is too "+"long. Please enter a description "+"that is less than 500 characters.";};o.__getDefaultErrorHtml=function()
{return this._data[ErrorType.UNKNOWN];};}
function class_com_evri_collections_model_UserProxy()
{Objs.register("com.evri.collections.model.UserProxy",UserProxy);var IProxy=Objs.load("org.puremvc.js.interfaces.IProxy");var Proxy=Objs.load("org.puremvc.js.patterns.proxy.Proxy");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var ApplicationFacade=Objs.load("com.evri.collections.ApplicationFacade");var CollectionVO=Objs.load("com.evri.collections.model.vo.CollectionVO");var EntityVO=Objs.load("com.evri.collections.model.vo.EntityVO");var Relegate=Objs.load("net.tekool.utils.Relegate");Objs.extend(UserProxy,Proxy);Objs.implement(UserProxy,IProxy);var o=UserProxy.prototype;UserProxy.NAME="UserProxy";o.__log=Log4js.getLogger();function UserProxy()
{Proxy.apply(this,[UserProxy.NAME,new Object()]);if(Objs.extending)return;this.__initialize();}
o.isUserOwner=function()
{var $username=$("span#username");return $username.length==0;};o.__initialize=function()
{this.__log.debug(UserProxy.NAME+" initialized");};}
function class_com_evri_collections_model_TweetProxy()
{Objs.register("com.evri.collections.model.TweetProxy",TweetProxy);var IProxy=Objs.load("org.puremvc.js.interfaces.IProxy");var Proxy=Objs.load("org.puremvc.js.patterns.proxy.Proxy");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var ApplicationFacade=Objs.load("com.evri.collections.ApplicationFacade");var TweetVO=Objs.load("com.evri.collections.model.vo.TweetVO");var Relegate=Objs.load("net.tekool.utils.Relegate");Objs.extend(TweetProxy,Proxy);Objs.implement(TweetProxy,IProxy);var o=TweetProxy.prototype;TweetProxy.NAME="TweetProxy";TweetProxy.APP_ID="evri-portal-collections";o.__log=null;o.__apiSession=null;function TweetProxy()
{Proxy.apply(this,[TweetProxy.NAME,new Object()]);if(Objs.extending)return;this.__initialize();}
o.getTweetsForCollection=function(entityUris)
{this.__log.debug("requesting tweets for collection.");var options={};options["onComplete"]=Relegate.create(this,this.__completeHandler);options["onFailure"]=Relegate.create(this,this.__failureHandler);var entitySet=new this.__apiSession.models.EntitySet(entityUris);entitySet.media.getTweets(options);};o.__initialize=function()
{this.__log=Log4js.getLogger();this.__log.debug(TweetProxy.NAME+" initialized");this.__apiSession=new Evri.API.Session({appId:TweetProxy.APP_ID});};o.__completeHandler=function(result)
{var tweets=[];for(var i=0;i<result.tweets.length;i++){tweets.push(TweetVO.fromObject(result.tweets[i]));}
this.sendNotification(ApplicationFacade.TWEETS_LOADED,tweets);};o.__failureHandler=function(error)
{this.__log.debug("failed tweet request: "+error);this.sendNotification(ApplicationFacade.TWEETS_FAILED,error);};}
function class_com_evri_collections_model_enum_ErrorType()
{Objs.register("com.evri.collections.model.enum.ErrorType",ErrorType);var o=ErrorType.prototype;ErrorType.UNKNOWN=new ErrorType("unknown");ErrorType.VALUE_REQUIRED=new ErrorType("value_required");ErrorType.NON_UNIQUE_VALUE=new ErrorType("non_unique_value");ErrorType.MAX_LENGTH_EXCEEDED=new ErrorType("max_length_exceeded");o._name=-1;function ErrorType(name)
{if(Objs.extending)return;this._name=name;}
o.toString=function()
{return this._name;};o.valueOf=function()
{return this.toString();};}
function class_com_evri_collections_model_enum_KeyCode()
{Objs.register("com.evri.collections.model.enum.KeyCode",KeyCode);var o=KeyCode.prototype;KeyCode.NONE=new KeyCode(-1);KeyCode.ENTER=new KeyCode(13);KeyCode.ESCAPE=new KeyCode(27);KeyCode.SPACE=new KeyCode(32);KeyCode.DELETE=new KeyCode(46);KeyCode.NUMPAD_FORWARD_SLASH=new KeyCode(111);KeyCode.ONE_EIGHT_FIVE=new KeyCode(185);o._code=-1;function KeyCode(code)
{if(Objs.extending)return;this._code=code;}
KeyCode.isVisible=function(code)
{return((code>46&&code<111)||(code>185));};o.valueOf=function()
{return this._code;};}
function class_com_evri_collections_model_enum_MediaType()
{Objs.register("com.evri.collections.model.enum.MediaType",MediaType);var o=MediaType.prototype;MediaType.ARTICLE=new MediaType("article");MediaType.IMAGE=new MediaType("image");MediaType.VIDEO=new MediaType("video");o._name=null;function MediaType(name)
{if(Objs.extending)return;this._name=name;}
o.toString=function()
{return this._name;};}
function class_com_evri_collections_model_enum_MessagingType()
{Objs.register("com.evri.collections.model.enum.MessagingType",MessagingType);var o=MessagingType.prototype;MessagingType.ERROR=new MessagingType("error");MessagingType.INFO=new MessagingType("notice");MessagingType.NONE=new MessagingType("none");o._name=null;function MessagingType(name)
{if(Objs.extending)return;this._name=name;}
o.toString=function()
{return this._name;};}
function class_com_evri_collections_model_utils_UrlUtil()
{Objs.register("com.evri.collections.model.utils.UrlUtil",UrlUtil);function UrlUtil()
{if(Objs.extending)return;}
UrlUtil.getHost=function(url)
{var matches=url.match(/http:\/\/([^\/]*)/);if(matches&&matches.length>0)
{return matches[1];}
else
{return"";}};}
function class_com_evri_collections_model_vo_CollectionVO()
{Objs.register("com.evri.collections.model.vo.CollectionVO",CollectionVO);var o=CollectionVO.prototype;CollectionVO.NAME="CollectionVO";function CollectionVO(name,description,uri,entities,createdAt,updatedAt)
{if(Objs.extending)return;if(name)this.name=name;if(description)this.description=description;if(uri)this.uri=uri;if(entities)this.entities=entities;if(createdAt)this.createdAt=createdAt;if(updatedAt)this.updatedAt=updatedAt;}
o.name="";o.description="";o.uri="";o.entities=[];o.createdAt=null;o.updatedAt=null;o.clone=function()
{return new CollectionVO(this.name,this.description,this.uri,this.entities,this.createdAt,this.updatedAt);};CollectionVO.fromObject=function(object)
{return new CollectionVO(object["name"],object["description"],object["uri"],object["entities"],new Date(object["created_at"]),new Date(object["updated_at"]));};}
function class_com_evri_collections_model_vo_EntityVO()
{Objs.register("com.evri.collections.model.vo.EntityVO",EntityVO);var o=EntityVO.prototype;EntityVO.NAME="EntityVO";o.__isLoaded=false;function EntityVO(id,uri,name,description,facets,articles,images,videos)
{if(Objs.extending)return;if(id)this.id=id;if(uri)this.uri=uri;if(name)this.name=name;if(description)this.description=description;if(facets)this.facets=$.map(facets,function(facet){return facet.name?facet.name:facet;});if(articles)this.articles=articles;if(images)this.images=images;if(videos)this.videos=videos;}
o.id="";o.uri="";o.name="";o.description="";o.facets=[];o.articles=[];o.images=[];o.videos=[];EntityVO.fromObject=function(object)
{var vo=new EntityVO(object["id"],object["href"],object["name"],object["description"],object["facets"],object["articles"],object["images"],object["videos"]);if(object["klass"]=="Entity")
{vo.__isLoaded=true;}
return vo;};o.isLoaded=function()
{return this.__isLoaded;};}
function class_com_evri_collections_model_vo_ImageDataVO()
{Objs.register("com.evri.collections.model.vo.ImageDataVO",ImageDataVO);var o=ImageDataVO.prototype;ImageDataVO.NAME="ImageDataVO";function ImageDataVO(url,title,caption,trackingUrl,documentUrl)
{if(Objs.extending)return;if(url)this.url=url;if(title)this.title=title;if(caption)this.caption=caption;if(trackingUrl)this.trackingUrl=trackingUrl;if(documentUrl)this.documentUrl=documentUrl;}
o.url="";o.title="";o.caption="";o.trackingUrl="";o.documentUrl="";ImageDataVO.fromObject=function(object)
{return new ImageDataVO(object["imageURL"],object["title"],object["content"],object["clickURL"],object["article"]);};}
function class_com_evri_collections_model_vo_TweetVO()
{Objs.register("com.evri.collections.model.vo.TweetVO",TweetVO);var o=TweetVO.prototype;TweetVO.NAME="TweetVO";function TweetVO(authorName,authorURI,content,title,entityResources,imageURI,matchedLocations,published,updated,getTitleRanges,getRelativePublicationDate,session)
{if(Objs.extending)return;if(authorName)this.authorName=authorName;if(authorURI)this.authorURI=authorURI;if(content)this.content=content;if(title)this.title=title;if(entityResources)this.entityResources=entityResources;if(imageURI)this.imageURI=imageURI;if(matchedLocations)this.matchedLocations=matchedLocations;if(published)this.published=published;if(updated)this.updated=updated;if(getTitleRanges)this.getTitleRanges=getTitleRanges;if(getRelativePublicationDate)this.getRelativePublicationDate=getRelativePublicationDate;if(session)this.session=session;}
o.authorName="";o.authorURI="";o.content="";o.title="";o.entityResources=[];o.imageURI="";o.matchedLocations=[];o.published="";o.updated="";o.getTitleRanges=null;o.getRelativePublicationDate=null;o.session=null;TweetVO.fromObject=function(object)
{var vo=new TweetVO(object["authorName"],object["authorURI"],object["content"],object["title"],object["entityResources"],object["imageURI"],object["matchedLocations"],object["published"],object["updated"],object["getTitleRanges"],object["getRelativePublicationDate"],object["session"]);return vo;};}
function class_com_evri_collections_view_components_CollectionMedia()
{Objs.register("com.evri.collections.view.components.CollectionMedia",CollectionMedia);var EventDispatcher=Objs.load("net.tekool.events.EventDispatcher");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");var CollectionMediaItem=Objs.load("com.evri.collections.view.components.CollectionMediaItem");var o=CollectionMedia.prototype;CollectionMedia.NAME="CollectionMedia";CollectionMedia.__ELEMENT_ID="collectionMedia";CollectionMedia.__ENTITY_MEDIA_CLASS="entity-media";o._element=null;o.__log=Log4js.getLogger();o.__items=null;function CollectionMedia(element)
{if(Objs.extending)return;this._element=element;this.__initialize();}
o.__initialize=function()
{this.__log.debug(CollectionMedia.NAME+" initialized");this.__items=new Array();this.__initializeMediaItems();};o.__initializeMediaItems=function()
{var mediaType=document.body.className;mediaType=mediaType.replace("collections","");mediaType=mediaType.replace("javascript-enabled","");var $items;switch(jQuery.trim(mediaType).toLowerCase())
{case"profiles":$items=$(".entity-media",this._element);for(var i=0;i<$items.length;i++)
{this.__items.push(new CollectionMediaItem($items[i]));}
break;case"videos":$items=$(".videos-panel",this._element);$items.each(function(){TabsPanels.videos.apply($(this));});break;}};}
function class_com_evri_collections_view_components_CollectionMediaItem()
{Objs.register("com.evri.collections.view.components.CollectionMediaItem",CollectionMediaItem);var EventDispatcher=Objs.load("net.tekool.events.EventDispatcher");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");var MediaType=Objs.load("com.evri.collections.model.enum.MediaType");var ImageDataVO=Objs.load("com.evri.collections.model.vo.ImageDataVO");var o=CollectionMediaItem.prototype;CollectionMediaItem.NAME="CollectionMediaItem";CollectionMediaItem.__URI_ATTRIBUTE="data-entity-uri";CollectionMediaItem.__LOADING_TOKEN="...Loading {0}...";CollectionMediaItem.__CAROUSEL_ID_TOKEN="{0}bar{1}";o._element=null;o.__log=Log4js.getLogger();o.__uri=null;o.__hex=null;o.__tabOptions=null;o.__carousel=null;o.__imageViewer=null;o.__videoViewer=null;function CollectionMediaItem(element)
{if(Objs.extending)return;this._element=element;this.__initialize();}
o.__initialize=function()
{this.__log.debug(CollectionMediaItem.NAME+" initialized");this.__extractEntityData();if(!this.__tabOptions)
{this.__tabOptions={};this.__tabOptions["selected"]=0;this.__tabOptions["select"]=Relegate.create(this,this.__tab_selectHandler);}
var $e=$(this._element);$e.tabs(this.__tabOptions);$e.find("ul.ui-tabs-nav").show();};o.__extractEntityData=function()
{this.__uri=$(this._element).attr(CollectionMediaItem.__URI_ATTRIBUTE);var matches=this.__uri.match(/0x[a-f0-9]+$/);if(matches.length>0)
{this.__hex=matches[0];}
else
{this.__log.error("malformed element");}};o.__initializeImagesTab=function()
{if(this.__carousel)
{delete this.__carousel.click;delete this.__carousel.ready;}
this.__carousel=new Carousel();this.__carousel.click(Relegate.create(this,this.__carousel_clickHandler));this.__carousel.ready(Relegate.create(this,this.__carousel_readyHandler));this.__carousel.replace(this.__getCarouselContainer(MediaType.IMAGE));};o.__getLoadingText=function(type)
{return CollectionMediaItem.__LOADING_TOKEN.replace("{0}",type);};o.__getCarouselContainer=function(type)
{var result=CollectionMediaItem.__CAROUSEL_ID_TOKEN;result=result.replace("{0}",type);result=result.replace("{1}",this.__hex);return result;};o.__tab_selectHandler=function(eventObject,ui)
{var type=ui.panel.id.replace(this.__hex,"");switch(type)
{case"entityArticles":break;case"entityImages":this.__initializeImagesTab();break;case"entityVideos":$(this._element).find(".video-bar").evriMediaCarousel({loadingMessage:"...Loading videos..."});break;default:this.__log.warn("unknown tab type: "+type);}};o.__carousel_readyHandler=function()
{this.__carousel.unbind("ready");var options={};options["complete"]=Relegate.create(this,this.__entity_pageCompleteHandler);var e=new EntityModel(this.__uri);e.imagesPage(options);this.__carousel.clear();this.__carousel.lock(this.__getLoadingText(MediaType.IMAGE));};o.__carousel_clickHandler=function(data)
{var type=data["videoUrl"]?MediaType.VIDEO:MediaType.IMAGE;switch(type)
{case MediaType.IMAGE:var collection_uri=$("meta[name='collection-uri']").attr("content");window.location.href="/media/image"+URI.toQueryString({"collection_uri":collection_uri,"page":data.clickURL});break;}};o.__entity_pageCompleteHandler=function(result)
{this.__carousel.insertItems(result);this.__carousel.unlock();};}
function class_com_evri_collections_view_components_CollectionMetadata()
{Objs.register("com.evri.collections.view.components.CollectionMetadata",CollectionMetadata);var EventDispatcher=Objs.load("net.tekool.events.EventDispatcher");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");var CollectionVO=Objs.load("com.evri.collections.model.vo.CollectionVO");var KeyCode=Objs.load("com.evri.collections.model.enum.KeyCode");var o=CollectionMetadata.prototype;CollectionMetadata.NAME="CollectionMetadata";CollectionMetadata.UPDATE_METADATA_REQUEST="update_metadata_request";CollectionMetadata.MAX_DESCRIPTION_LENGTH=500;CollectionMetadata.EDIT_CSS_CLASS="editor";CollectionMetadata.__ELEMENT_ID="collectionMetadata";CollectionMetadata.__EDIT_ICON_SRC="/images/icons/edit.gif";CollectionMetadata.__SCROLL_BAR_SIZE=17;o._element=null;o._$nameForm=null;o._$nameEditor=null;o._$descriptionForm=null;o._$descriptionEditor=null;o.__log=Log4js.getLogger();o.__eventDispatcher=null;o.__collection=null;o.__isReadOnly=true;function CollectionMetadata(element)
{if(Objs.extending)return;this._element=element;this.__initialize();}
o.getCollection=function()
{if(!this.__collection)
{var collection=new CollectionVO();collection.name=this._getName();collection.description=this._getDescription();this.__collection=collection;}
return this.__collection;};o.setCollection=function(collection)
{this.__log.debug(CollectionMetadata.NAME+" setCollection: "+collection.uri);this.__collection=collection;this.refresh();};o.getIsReadOnly=function()
{return this.__isReadOnly;};o.setIsReadOnly=function(value)
{if(value!=this.__isReadOnly)
{this.__isReadOnly=value;this.__updateEditableState();}};o.refresh=function()
{this.__log.debug(CollectionMetadata.NAME+" refresh");if(this.__collection)
{var $e=$(this._element);$e.find(".updated").text=this.__collection.updatedAt;this._setName(this.__collection.name);this._setDescription(this.__collection.description);this.__adjustDescriptionHeight();}};o._getName=function()
{return jQuery.trim($("h1 strong").text());};o._setName=function(name)
{if(this.__isReadOnly)
{$("h1 strong",this._element).text(name);}
else
{$("h1 strong",this._element).html($("<a/>").text(name));this._$nameEditor.val(this.__unescapeHtml(name));}};o._getDescription=function()
{return jQuery.trim($("p",this._element).text());};o._setDescription=function(description)
{var value=jQuery.trim(description);if(value!=this._getDescription)
{var $p=$("p",this._element);if(this.__isReadOnly)
{$p.append($("<span/>").text(value));}
else
{this._$descriptionEditor.val(this.__unescapeHtml(value));if(value)
{$p.empty().append($("<a/>").text(value).addClass("content"));}
else
{$p.empty().append($("<a/>").text("Add a description"));}}}};o.__initialize=function()
{this.__log.debug(CollectionMetadata.NAME+" initialized");this.__updateEditableState();};o.__unescapeHtml=function(text)
{return text.replace(/&quot;/g,'"').replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');};o.__updateEditableState=function()
{if(this.__isReadOnly)
{this.__eventDispatcher=null;this.__destroyForms();}
else
{this.__eventDispatcher=new EventDispatcher();this.__createNameForm();this.__createDescriptionForm();this.__createEventListeners();}
this.refresh();};o.__destroyForms=function()
{$("img, strong, p",this._element).attr("title","edit").removeClass(CollectionMetadata.EDIT_CSS_CLASS);if(this._$nameForm)this._$nameForm.remove();if(this._$descriptionForm)this._$descriptionForm.remove();};o.__createNameForm=function()
{var $img=$("<img/>");$img.attr("src",CollectionMetadata.__EDIT_ICON_SRC);$img.attr("alt","edit");this._$name_element=$("h1.collection-name");this._$name_element.append($img);$("img, strong",this._$name_element).attr("title","edit").addClass(CollectionMetadata.EDIT_CSS_CLASS);if(!this._$nameForm)
{this._$nameForm=$("<form/>").attr("id",CollectionMetadata.__ELEMENT_ID+"NameEditorForm");this._$nameForm.hide();this._$nameEditor=$("<input/>");this._$nameEditor.attr("type","text");this._$nameEditor.attr("maxlength",50);this._$nameForm.append(this._$nameEditor);this._$nameForm.append(this.__createFormButtons());this._$name_element.after(this._$nameForm);}};o.__createDescriptionForm=function()
{$("p",this._element).attr("title","edit").addClass(CollectionMetadata.EDIT_CSS_CLASS);if(!this._$descriptionForm)
{this._$descriptionForm=$("<form/>").attr("id",CollectionMetadata.__ELEMENT_ID+"DescriptionEditorForm");this._$descriptionForm.hide();this._$descriptionEditor=$("<textarea/>");this._$descriptionForm.append(this._$descriptionEditor);this._$descriptionForm.append($("<em><strong>n</strong> characters remaining</em>"));this._$descriptionForm.append(this.__createFormButtons());$(this._element).find("p").after(this._$descriptionForm);}};o.__createFormButtons=function()
{var $div=$("<div/>");var $save=$("<a/>");$save.addClass("evri-button");$save.text("Save");$save.append("<span></span>");$div.append($save);$div.append("&nbsp;or&nbsp;");var $cancel=$("<a/>");$cancel.addClass("cancel");$cancel.text("Cancel");$div.append($cancel);return $div;};o.__createEventListeners=function()
{$(document).bind("click",Relegate.create(this,this.__body_clickHandler));this._$name_element.find("strong, img").click(Relegate.create(this,this.__name_editHandler));this._$nameEditor.bind("keydown",Relegate.create(this,this.__name_keyDownHandler));this._$nameForm.bind("submit",Relegate.create(this,this.__name_submitHandler));this._$nameForm.find("a.evri-button").click(Relegate.create(this,this.__name_saveHandler));this._$nameForm.find("a.cancel").click(Relegate.create(this,this.__name_cancelHandler));$(this._element).find("p").click(Relegate.create(this,this.__description_editHandler));this._$descriptionForm.find("a.evri-button").click(Relegate.create(this,this.__description_saveHandler));this._$descriptionForm.find("a.cancel").click(Relegate.create(this,this.__description_cancelHandler));this._$descriptionEditor.bind("keydown",Relegate.create(this,this.__description_keyDownHandler));this._$descriptionEditor.bind("keyup",Relegate.create(this,this.__description_keyUpHandler));};o.__updateAndReturnCharactersRemaining=function()
{var count=$(this._element).find("textarea").val().length;var remaining=CollectionMetadata.MAX_DESCRIPTION_LENGTH-count;$(this._element).find("form em strong").text(Math.max(0,remaining));return remaining;};o.__adjustDescriptionHeight=function()
{if(jQuery.browser.msie)
{this.__log.debug("adjusting the description height for IE");var p=$(this._element).find("p")[0];var offsetHeight=p.offsetHeight;var scrollHeight=p.scrollHeight;if(scrollHeight<offsetHeight)
{var $p=$(p);$p.height($p.height()+CollectionMetadata.__SCROLL_BAR_SIZE);}}};o.__requestMetadataUpdate=function(eventObject)
{var collection=this.__collection.clone();collection.name=this._$nameEditor.val();this._setName(collection.name);collection.description=this._$descriptionEditor.val();this._setDescription(collection.description);var event=new EventS(CollectionMetadata.UPDATE_METADATA_REQUEST,this);event["data"]=collection;this.dispatchEvent(event);};o.__body_clickHandler=function(eventObject)
{if($("form",this._element).css("display")=="none")
{return;}
if($(eventObject.target).parents().is("#"+CollectionMetadata.__ELEMENT_ID))
{return;}
this.refresh();};o.__name_keyDownHandler=function(eventObject)
{var keyCode=eventObject.keyCode;if(keyCode==KeyCode.ENTER)
{this.__name_saveHandler(null);}
else if(keyCode==KeyCode.ESCAPE)
{this.__name_cancelHandler(null);}
else
{return true;}};o.__name_editHandler=function(eventObject)
{this._$name_element.find("*").css("visibility","hidden");this._$nameForm.show();this._$nameEditor.val(this.__collection.name);this._$nameEditor.focus();};o.__name_submitHandler=function(eventObject)
{eventObject.preventDefault();};o.__name_saveHandler=function(eventObject)
{this.__requestMetadataUpdate();this.__name_cancelHandler(null);};o.__name_cancelHandler=function(eventObject)
{this._$name_element.find("*").css("visibility","visible");this._$nameForm.hide();this._$nameEditor.blur();};o.__description_editHandler=function(eventObject)
{$(this._element).find(".description").hide();this._$descriptionEditor.val(this.__collection.description);this.__updateAndReturnCharactersRemaining();this._$descriptionForm.show();this._$descriptionEditor.focus();};o.__description_saveHandler=function(eventObject)
{this.__requestMetadataUpdate();this.__description_cancelHandler(eventObject);};o.__description_cancelHandler=function(eventObject)
{$(this._element).find(".description").show();this._$descriptionForm.hide();this._$descriptionEditor.blur();this.__adjustDescriptionHeight();};o.__description_keyDownHandler=function(eventObject)
{var keyCode=eventObject.keyCode;var remaining=this.__updateAndReturnCharactersRemaining();if(remaining<0&&(keyCode==27||keyCode==32||(keyCode>46&&keyCode<111)||keyCode>185))
{return false;}
else
{return true;}};o.__description_keyUpHandler=function(eventObject)
{var remaining=this.__updateAndReturnCharactersRemaining();if(remaining<0)
{var description=this._$descriptionEditor.val();description=description.substr(0,CollectionMetadata.MAX_DESCRIPTION_LENGTH);this._$descriptionEditor.val(description);}
return true;};o.dispatchEvent=function(event)
{event.target=this;this.__eventDispatcher.dispatchEvent(event);};o.addEventListener=function(type,listener)
{this.__eventDispatcher.addEventListener(type,listener);};o.removeEventListener=function(type,listener)
{this.__eventDispatcher.removeEventListener(type,listener);};}
function class_com_evri_collections_view_components_EntitySearch()
{Objs.register("com.evri.collections.view.components.EntitySearch",EntitySearch);var EventDispatcher=Objs.load("net.tekool.events.EventDispatcher");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");var EntityVO=Objs.load("com.evri.collections.model.vo.EntityVO");var o=EntitySearch.prototype;EntitySearch.NAME="EntitySearch";EntitySearch.ADD_ENTITY_REQUEST="add_entity_request";EntitySearch.__ELEMENT_ID="entitySearch";EntitySearch.__BOX_ID=EntitySearch.__ELEMENT_ID+"FindBox";EntitySearch.__START_ID=EntitySearch.__ELEMENT_ID+"Start";EntitySearch.__FINISH_ID=EntitySearch.__ELEMENT_ID+"Finish";EntitySearch.__URI_ATTRIBUTE="data-entity-uri";EntitySearch.__NAME_LENGTH_IN_CHARS=31;EntitySearch.__FACETS_LENGTH_IN_CHARS=38;o._element=null;o._findBox=null;o._isDirty=false;o.__log=Log4js.getLogger();o.__eventDispatcher=null;o.__timeoutId=NaN;function EntitySearch(element)
{if(Objs.extending)return;this._element=element;this.__initialize();}
o.enable=function()
{this.__eventDispatcher=new EventDispatcher();var $e=$(this._element);var findBoxOptions={};findBoxOptions["nameLengthInChars"]=EntitySearch.__NAME_LENGTH_IN_CHARS;findBoxOptions["facetsLengthInChars"]=EntitySearch.__FACETS_LENGTH_IN_CHARS;this.__entityFindBox=new EntityFindBox($e.find("#"+EntitySearch.__BOX_ID),findBoxOptions);this.__entityFindBox.autoSelectFirstItem=true;this.__entityFindBox.selectEntityHandler=Relegate.create(this,this.__find_selectionHandler);$e.find("#"+EntitySearch.__START_ID).bind("click",Relegate.create(this,this.__start_clickHandler));$e.find("#"+EntitySearch.__FINISH_ID).bind("click",Relegate.create(this,this.__finish_clickHandler));$e.find("li a").bind("click",Relegate.create(this,this.__entity_clickHandler));};o.showMessage=function(message)
{var $e=$(this._element);var $p=$e.find("p.message");if($p.length==0)
{$p=$("<p/>").addClass("message");$e.find("form").prepend($p);}
$p.stop().empty();if(this.__timeoutId)clearTimeout(this.__timeoutId);$p.hide().html(message).slideDown();this.__timeoutId=setTimeout(function(){$p.slideUp();},5000);};o.setBlacklistedEntities=function(entities)
{var n=entities.length;var uris=new Array(n);for(var i=0;i<n;i++)
{var entity=entities[i];if(entity instanceof EntityVO)
{uris.push(entities[i].uri);}}
this.__entityFindBox.setBlacklist(uris);};o.dispatchEvent=function(event)
{event.target=this;this.__eventDispatcher.dispatchEvent(event);};o.addEventListener=function(type,listener)
{this.__eventDispatcher.addEventListener(type,listener);};o.removeEventListener=function(type,listener)
{this.__eventDispatcher.removeEventListener(type,listener);};o.__initialize=function()
{this.__log.debug(EntitySearch.NAME+" initialized");};o.__toggleViewState=function()
{var $e=$(this._element);$e.find("form").toggle();$e.find("#"+EntitySearch.__START_ID).toggle();};o.__find_selectionHandler=function(entity)
{var event=new EventS(EntitySearch.ADD_ENTITY_REQUEST,this);event["data"]=EntityVO.fromObject(entity);this.dispatchEvent(event);this.__entityFindBox.reset();this._isDirty=true;};o.__entity_clickHandler=function(eventObject)
{var $target;if(eventObject.target.nodeName.toLowerCase()!="a")
{$target=$(eventObject.target).parent("a["+EntitySearch.__URI_ATTRIBUTE+"]");}
else
{$target=$(eventObject.target);}
var event=new EventS(EntitySearch.ADD_ENTITY_REQUEST,this);event["data"]=$target.attr(EntitySearch.__URI_ATTRIBUTE);this.dispatchEvent(event);$target.parent().remove();this._isDirty=true;return false;};o.__start_clickHandler=function(eventObject)
{this.__toggleViewState();};o.__finish_clickHandler=function(eventObject)
{this.__toggleViewState();if(this._isDirty)
{window.location.reload();}};}
function class_com_evri_collections_view_components_IncludedEntities()
{Objs.register("com.evri.collections.view.components.IncludedEntities",IncludedEntities);var EventDispatcher=Objs.load("net.tekool.events.EventDispatcher");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");var EntityVO=Objs.load("com.evri.collections.model.vo.EntityVO");var o=IncludedEntities.prototype;IncludedEntities.NAME="IncludedEntities";IncludedEntities.ADD_ENTITY_REQUEST="add_entity_request";IncludedEntities.REMOVE_ENTITY_REQUEST="remove_entity_request";IncludedEntities.EDITING="editing";IncludedEntities.VIEWING="viewing";IncludedEntities.__ELEMENT_ID="includedEntities";IncludedEntities.__DELETE_ICON_URL="/images/icons/delete.gif";IncludedEntities.__URI_ATTRIBUTE="data-entity-uri";IncludedEntities.__FACETS_ATTRIBUTE="data-entity-facets";o._element=null;o.__log=null;o.__eventDispatcher=null;o.__entities=null;o.__entitiesChanged=true;o.__isReadOnly=true;o.__isReadOnlyChanged=true;o.__state=IncludedEntities.VIEWING;o.__stateChanged=true;o.__changeCounter=0;function IncludedEntities(element)
{if(Objs.extending)return;this._element=element;this.__initialize();}
o.getEntities=function()
{if(!this.__entities)
{var $entities=$("a["+IncludedEntities.__URI_ATTRIBUTE+"]",this._element);var entities=new Array($entities.length);$entities.each(function(index,item)
{var $this=$(item);var uri=$this.attr(IncludedEntities.__URI_ATTRIBUTE);var name=$.trim($this[0].firstChild.nodeValue);var facets=$this.find(".facets").attr(IncludedEntities.__FACETS_ATTRIBUTE).split(", ");entities[index]=(new EntityVO(null,uri,name,null,facets));});this.__entities=entities;}
return this.__entities;};o.setEntities=function(entities)
{if(this.getState()==IncludedEntities.EDITING)return;this.__entities=entities;this.__entitiesChanged=true;this.refresh();};o.getIsReadOnly=function()
{return this.__isReadOnly;};o.setIsReadOnly=function(value)
{if(value!=this.__isReadOnly)
{this.__isReadOnly=value;this.__isReadOnlyChanged=true;this.refresh();}};o.getState=function()
{return this.__state;};o.setState=function(value)
{if(value!=this.__state)
{this.__log.debug("setting state to "+value);this.__state=value;this.__stateChanged=true;this.refresh();}};o.updateEntity=function(entity)
{if(!(entity instanceof EntityVO))return;for(var i=0;i<this.__entities.length;i++)
{var local=this.__entities[i];if(local instanceof EntityVO)
{if(local.uri==entity.uri)
{this.__log.debug("refreshing entity: "+local.uri);this.__entities[i]=local;break;}}
else
{this.__log.warn("malformed collection: item "+i+" is "+entity);}}};o.refresh=function()
{this.__log.debug("refreshing "+IncludedEntities.NAME);var i=0;var $e=$(this._element);var $list=$e.find("ul");var $menu=$e.find("h2 a");if(this.__entitiesChanged)
{this.__entitiesChanged=false;this.__changeCounter=0;$list.empty();var entities=this.getEntities();for(i=0;i<entities.length;i++)
{var entity=entities[i];if(entity instanceof EntityVO)
{$list.append(this.__createEntityListItem(entity));}
else
{this.__log.error("malformed collection: item "+i+" is "+entity);}}}
if(this.__isReadOnlyChanged)
{this.__isReadOnlyChanged=false;this.__eventDispatcher=this.getIsReadOnly()?null:new EventDispatcher();if(this.getIsReadOnly())
{$e.find("h2 a").remove();this.__stateChanged=false;}}
if(this.__stateChanged)
{this.__stateChanged=false;if($menu.length==0)
{$menu=$("<a/>");$menu.bind("click",Relegate.create(this,this.__menu_clickHandler));$e.find("h2").append($menu);}
var currentState=this.getState();$list[0].className=currentState;$menu.text(currentState==IncludedEntities.EDITING?"I'm done":"Remove items");var $items=$list.find("li");for(i=0;i<$items.length;i++)
{var $item=$($items[i]);var $action=$item.find("a.action");if($action.length==0)
{$item.append(this.__createEntityAction());}}}};o.dispatchEvent=function(event)
{event.target=this;this.__eventDispatcher.dispatchEvent(event);};o.addEventListener=function(type,listener)
{this.__eventDispatcher.addEventListener(type,listener);};o.removeEventListener=function(type,listener)
{this.__eventDispatcher.removeEventListener(type,listener);};o.__initialize=function()
{this.__log=Log4js.getLogger();this.__log.debug(IncludedEntities.NAME+" initialized");this.getEntities();};o.__getEntityForUri=function(uri)
{for(var i=0;i<this.__entities.length;i++)
{var entity=this.__entities[i];if(entity&&entity.uri==uri)
{return entity;}}
return null;};o.__createEntityListItem=function(entity)
{var $a=$("<a/>");$a.attr("href",entity.uri);$a.attr(IncludedEntities.__URI_ATTRIBUTE,entity.uri);$a.text(entity.name);var $em=$("<em/>");$em.addClass("facets");$em.text(entity.facets.toSentence());var $li=$("<li/>",this._element);$li.append($a.append(" ").append($em));return $li;};o.__createEntityAction=function()
{var $action=$("<a/>").addClass("action");$action.bind("click",Relegate.create(this,this.__action_clickHandler));var $img=$("<img/>").attr("src",IncludedEntities.__DELETE_ICON_URL);var $em=$("<em/>").text("undo");return $action.append($img).append($em);};o.__menu_clickHandler=function(eventObject)
{if(this.getState()==IncludedEntities.EDITING)
{this.setState(IncludedEntities.VIEWING);if(this.__changeCounter>0)
{$(this._element).find("li.deleted").remove();window.location.reload();}}
else
{this.setState(IncludedEntities.EDITING);}};o.__action_clickHandler=function(eventObject)
{var $target;if(eventObject.target.nodeName.toLowerCase()!="a")
{$target=$(eventObject.target).parent("a");}
else
{$target=$(eventObject.target);}
var $entity=$target.siblings("a[data-entity-uri]");var event;if($entity.parent().hasClass("deleted"))
{event=new EventS(IncludedEntities.ADD_ENTITY_REQUEST,this);$entity.parent().removeClass("deleted");this.__changeCounter--;}
else
{event=new EventS(IncludedEntities.REMOVE_ENTITY_REQUEST,this);$entity.parent().addClass("deleted");this.__changeCounter++;}
event["data"]=this.__getEntityForUri($entity.attr(IncludedEntities.__URI_ATTRIBUTE));this.dispatchEvent(event);return false;};}
function class_com_evri_collections_view_components_Messaging()
{Objs.register("com.evri.collections.view.components.Messaging",Messaging);var EventDispatcher=Objs.load("net.tekool.events.EventDispatcher");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");var MessagingType=Objs.load("com.evri.collections.model.enum.MessagingType");var o=Messaging.prototype;Messaging.NAME="Messaging";o._element=null;o.__log=Log4js.getLogger();o.__items=null;function Messaging(element)
{if(Objs.extending)return;this._element=element;this.__initialize();}
o.addMessage=function(type,message)
{var $container=$("#"+type,this._element);var $item=$("<p/>").addClass(type.toString()).html(message);$container.append($item).slideDown();setTimeout(function(){$container.slideUp();},5000);};o.clearMessages=function(type)
{$(this._element).find("#"+type).empty();};o.__initialize=function()
{this.__log.debug(Messaging.NAME+" initialized");if($("#"+MessagingType.INFO).length==0)
{$(this._element).prepend($("<div/>").attr("id",MessagingType.INFO));}
if($("#"+MessagingType.ERROR).length==0)
{$(this._element).prepend($("<div/>").attr("id",MessagingType.ERROR));}};}
function class_com_evri_collections_view_components_RelatedEntities()
{Objs.register("com.evri.collections.view.components.RelatedEntities",RelatedEntities);var EventDispatcher=Objs.load("net.tekool.events.EventDispatcher");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");var EntityVO=Objs.load("com.evri.collections.model.vo.EntityVO");var o=RelatedEntities.prototype;RelatedEntities.NAME="RelatedEntities";RelatedEntities.__ELEMENT_ID="relatedEntities";RelatedEntities.__URI_ATTRIBUTE="data-entity-uri";o._element=null;o.__log=Log4js.getLogger();o.__entities=null;function RelatedEntities(element)
{if(Objs.extending)return;this._element=element;this.__initialize();}
o.getEntities=function()
{if(!this.__entities)
{var $entities=$("a["+RelatedEntities.__URI_ATTRIBUTE+"]",this._element);var entities=new Array($entities.length);$entities.each(function(index,item)
{var $this=$(item);entities[index]=(new EntityVO(null,$this.attr(RelatedEntities.__URI_ATTRIBUTE),$this.find("a").text()));});this.__entities=entities;}
return this.__entities;};o.__initialize=function()
{this.__log.debug(RelatedEntities.NAME+" initialized");};}
function class_com_evri_collections_view_components_Tweets()
{Objs.register("com.evri.collections.view.components.Tweets",Tweets);var EventDispatcher=Objs.load("net.tekool.events.EventDispatcher");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");var o=Tweets.prototype;Tweets.NAME="Tweets";Tweets.__ELEMENT_ID="Tweets";o._element=null;o.__log=Log4js.getLogger();function Tweets(element)
{if(Objs.extending)return;this._element=element;this.__initialize();}
o.renderTweets=function(result)
{if(result.length===0){$(this._element).tweetsError('No tweets found');return;}
$(this._element).find(".panel-message").remove();$(this._element).find("ol.tweets").tweetsForList(result,'');};o.renderTweetsError=function(error)
{$(this._element).tweetsError('Twitter is currently unavailable');}
o.__initialize=function()
{this.__log.debug(Tweets.NAME+" initialized");};}
function class_com_evri_collections_view_CollectionMetadataMediator()
{Objs.register("com.evri.collections.view.CollectionMetadataMediator",CollectionMetadataMediator);var IMediator=Objs.load("org.puremvc.js.interfaces.IMediator");var INotification=Objs.load("org.puremvc.js.interfaces.INotification");var Mediator=Objs.load("org.puremvc.js.patterns.mediator.Mediator");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var ApplicationFacade=Objs.load("com.evri.collections.ApplicationFacade");var CollectionProxy=Objs.load("com.evri.collections.model.CollectionProxy");var ResourceProxy=Objs.load("com.evri.collections.model.ResourceProxy");var UserProxy=Objs.load("com.evri.collections.model.UserProxy");var CollectionVO=Objs.load("com.evri.collections.model.vo.CollectionVO");var CollectionMetadata=Objs.load("com.evri.collections.view.components.CollectionMetadata");var MessagingType=Objs.load("com.evri.collections.model.enum.MessagingType");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");Objs.extend(CollectionMetadataMediator,Mediator);Objs.implement(CollectionMetadataMediator,IMediator);var o=CollectionMetadataMediator.prototype;CollectionMetadataMediator.NAME="CollectionMetadataMediator";o.__log=Log4js.getLogger();o.__cachedCollection=null;o.__refresh=false;function CollectionMetadataMediator(viewComponent)
{Mediator.apply(this,[CollectionMetadataMediator.NAME,viewComponent]);if(Objs.extending)return;this.__initialize();}
o.getViewState=function(object)
{this.__log.debug(CollectionMetadataMediator.NAME+" getting view state");switch(object.NAME)
{case CollectionVO.NAME:return[this._getView().getCollection()];default:return[];}};o.listNotificationInterests=function()
{return[ApplicationFacade.APPLICATION_MESSAGE,ApplicationFacade.COLLECTION_CHANGED,ApplicationFacade.SERVER_ERROR];};o.handleNotification=function(note)
{var userProxy=this._facade.retrieveProxy(UserProxy.NAME);if(!userProxy.isUserOwner())
{return;}
var view=this._getView();var proxy=this._facade.retrieveProxy(CollectionProxy.NAME);switch(note.getName())
{case ApplicationFacade.COLLECTION_CHANGED:if(this.__refresh)
{window.location.replace(note.getBody().uri);}
else
{view.setCollection(note.getBody());}
break;case ApplicationFacade.APPLICATION_MESSAGE:if(note.getType()==MessagingType.ERROR)
{view.setCollection(proxy.getCollection());}
break;case ApplicationFacade.SERVER_ERROR:view.setCollection(proxy.getCollection());break;default:this.__log.warn("unknown notification type: "+note.getName());}};o._getView=function()
{return this._viewComponent;};o._onUpdateMetadataRequest=function(event)
{this.__log.debug("updating metadata");try
{var collectionProxy=this._facade.retrieveProxy(CollectionProxy.NAME);var collection=collectionProxy.getCollection();this.__refresh=collection.name!=event["data"].name;collectionProxy.updateCollection(event["data"]);}
catch(error)
{this.__log.debug("handling error: "+error.message);var resourceProxy=this._facade.retrieveProxy(ResourceProxy.NAME);this._facade.sendNotification(ApplicationFacade.APPLICATION_MESSAGE,resourceProxy.getErrorHtml(error.message),MessagingType.ERROR);}};o.__initialize=function()
{this.__log.debug(CollectionMetadataMediator.NAME+" initialized");var userProxy=this._facade.retrieveProxy(UserProxy.NAME);if(userProxy.isUserOwner())
{var view=this._getView();view.setIsReadOnly(false);view.addEventListener(CollectionMetadata.UPDATE_METADATA_REQUEST,Relegate.create(this,this._onUpdateMetadataRequest));}};}
function class_com_evri_collections_view_EntitySearchMediator()
{Objs.register("com.evri.collections.view.EntitySearchMediator",EntitySearchMediator);var IMediator=Objs.load("org.puremvc.js.interfaces.IMediator");var INotification=Objs.load("org.puremvc.js.interfaces.INotification");var Mediator=Objs.load("org.puremvc.js.patterns.mediator.Mediator");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var ApplicationFacade=Objs.load("com.evri.collections.ApplicationFacade");var EntitySearch=Objs.load("com.evri.collections.view.components.EntitySearch");var CollectionProxy=Objs.load("com.evri.collections.model.CollectionProxy");var EntityProxy=Objs.load("com.evri.collections.model.EntityProxy");var UserProxy=Objs.load("com.evri.collections.model.UserProxy");var EntityVO=Objs.load("com.evri.collections.model.vo.EntityVO");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");Objs.extend(EntitySearchMediator,Mediator);Objs.implement(EntitySearchMediator,IMediator);var o=EntitySearchMediator.prototype;EntitySearchMediator.NAME="EntitySearchMediator";o.__isUserOwner=false;function EntitySearchMediator(viewComponent)
{Mediator.apply(this,[EntitySearchMediator.NAME,viewComponent]);if(Objs.extending)return;this.__initialize();}
o.listNotificationInterests=function()
{return[ApplicationFacade.COLLECTION_CHANGED,];};o.handleNotification=function(note)
{switch(note.getName())
{case ApplicationFacade.COLLECTION_CHANGED:var uris=note.getBody()["entities"];if(uris.length>0)
{var entityProxy=this._facade.retrieveProxy(EntityProxy.NAME);var entities=new Array();for(var i=0;i<uris.length;i++)
{entities.push(entityProxy.getEntity(uris[i]));}
if(this.__isUserOwner){this._getView().setBlacklistedEntities(entities);}}
break;default:this.__log.warn("unknown notification type: "+note.getName());}};o._getView=function()
{return this._viewComponent;};o._onAddEntityRequest=function(event)
{var entity;var entityProxy=this._facade.retrieveProxy(EntityProxy.NAME);if(event["data"]instanceof EntityVO)
{entity=event["data"];entityProxy.addEntity(entity);}
else
{entity=entityProxy.getEntity(event["data"]);}
try
{var collectionProxy=this._facade.retrieveProxy(CollectionProxy.NAME);collectionProxy.addEntityToCollection(null,entity);}
catch(error)
{this._getView().showMessage("There was an error adding "+entity.name);}
this._getView().showMessage(entity.name+" has been added");};o.__initialize=function()
{var userProxy=this._facade.retrieveProxy(UserProxy.NAME);this.__isUserOwner=userProxy.isUserOwner();if(this.__isUserOwner)
{var entitySearch=this._getView();entitySearch.enable();entitySearch.addEventListener(EntitySearch.ADD_ENTITY_REQUEST,Relegate.create(this,this._onAddEntityRequest));}};}
function class_com_evri_collections_view_IncludedEntitiesMediator()
{Objs.register("com.evri.collections.view.IncludedEntitiesMediator",IncludedEntitiesMediator);var IMediator=Objs.load("org.puremvc.js.interfaces.IMediator");var INotification=Objs.load("org.puremvc.js.interfaces.INotification");var Mediator=Objs.load("org.puremvc.js.patterns.mediator.Mediator");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var ApplicationFacade=Objs.load("com.evri.collections.ApplicationFacade");var CollectionProxy=Objs.load("com.evri.collections.model.CollectionProxy");var EntityProxy=Objs.load("com.evri.collections.model.EntityProxy");var UserProxy=Objs.load("com.evri.collections.model.UserProxy");var EntityVO=Objs.load("com.evri.collections.model.vo.EntityVO");var IncludedEntities=Objs.load("com.evri.collections.view.components.IncludedEntities");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");Objs.extend(IncludedEntitiesMediator,Mediator);Objs.implement(IncludedEntitiesMediator,IMediator);var o=IncludedEntitiesMediator.prototype;IncludedEntitiesMediator.NAME="IncludedEntitiesMediator";o.__log=null;function IncludedEntitiesMediator(viewComponent)
{Mediator.apply(this,[IncludedEntitiesMediator.NAME,viewComponent]);if(Objs.extending)return;this.__initialize();}
o.getViewState=function(object)
{this.__log.debug(IncludedEntitiesMediator.NAME+" getting view state");switch(object.NAME)
{case EntityVO.NAME:return this._getView().getEntities();default:return[];}};o.listNotificationInterests=function()
{return[ApplicationFacade.COLLECTION_CHANGED,ApplicationFacade.ENTITY_CHANGED];};o.handleNotification=function(note)
{var view=this._getView();switch(note.getName())
{case ApplicationFacade.COLLECTION_CHANGED:var uris=note.getBody()["entities"];if(uris.length>0)
{var entityProxy=this._facade.retrieveProxy(EntityProxy.NAME);var entities=new Array();for(var i=0;i<uris.length;i++)
{entities.push(entityProxy.getEntity(uris[i]));}
view.setEntities(entities);}
break;case ApplicationFacade.ENTITY_CHANGED:view.updateEntity(note.getBody());break;default:this.__log.warn("unknown notification type: "+note.getName());}};o._getView=function()
{return this._viewComponent;};o._onAddEntityRequest=function(event)
{var collection=this._facade.retrieveProxy(CollectionProxy.NAME);collection.addEntityToCollection(null,event["data"]);}
o._onRemoveEntityRequest=function(event)
{var collection=this._facade.retrieveProxy(CollectionProxy.NAME);collection.removeEntityFromCollection(null,event["data"]);};o.__initialize=function()
{this.__log=Log4js.getLogger();this.__log.debug(IncludedEntitiesMediator.NAME+" initialized");var userProxy=this._facade.retrieveProxy(UserProxy.NAME);if(userProxy.isUserOwner())
{var view=this._getView();view.setIsReadOnly(false);view.addEventListener(IncludedEntities.ADD_ENTITY_REQUEST,Relegate.create(this,this._onAddEntityRequest));view.addEventListener(IncludedEntities.REMOVE_ENTITY_REQUEST,Relegate.create(this,this._onRemoveEntityRequest));}};}
function class_com_evri_collections_view_MessagingMediator()
{Objs.register("com.evri.collections.view.MessagingMediator",MessagingMediator);var IMediator=Objs.load("org.puremvc.js.interfaces.IMediator");var INotification=Objs.load("org.puremvc.js.interfaces.INotification");var Mediator=Objs.load("org.puremvc.js.patterns.mediator.Mediator");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var ApplicationFacade=Objs.load("com.evri.collections.ApplicationFacade");var EntityVO=Objs.load("com.evri.collections.model.vo.EntityVO");var MessagingType=Objs.load("com.evri.collections.model.enum.MessagingType");Objs.extend(MessagingMediator,Mediator);Objs.implement(MessagingMediator,IMediator);var o=MessagingMediator.prototype;o.__log=Log4js.getLogger();MessagingMediator.NAME="MessagingMediator";function MessagingMediator(viewComponent)
{Mediator.apply(this,[MessagingMediator.NAME,viewComponent]);if(Objs.extending)return;this.__initialize();}
o.listNotificationInterests=function()
{return[ApplicationFacade.APPLICATION_MESSAGE,ApplicationFacade.SERVER_ERROR,];};o.handleNotification=function(note)
{switch(note.getName())
{case ApplicationFacade.APPLICATION_MESSAGE:this._getView().clearMessages(note.getType());this._getView().addMessage(note.getType(),note.getBody());break;case ApplicationFacade.SERVER_ERROR:this._getView().clearMessages(MessagingType.ERROR);this._getView().addMessage(MessagingType.ERROR,note.getBody());break;default:this.__log.warn("unknown notification type: "+note.getName());}};o._getView=function()
{return this._viewComponent;};o.__initialize=function()
{this.__log.debug(MessagingMediator.NAME+" initialized");};}
function class_com_evri_collections_view_RelatedEntitiesMediator()
{Objs.register("com.evri.collections.view.RelatedEntitiesMediator",RelatedEntitiesMediator);var IMediator=Objs.load("org.puremvc.js.interfaces.IMediator");var INotification=Objs.load("org.puremvc.js.interfaces.INotification");var Mediator=Objs.load("org.puremvc.js.patterns.mediator.Mediator");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var ApplicationFacade=Objs.load("com.evri.collections.ApplicationFacade");var EntityVO=Objs.load("com.evri.collections.model.vo.EntityVO");Objs.extend(RelatedEntitiesMediator,Mediator);Objs.implement(RelatedEntitiesMediator,IMediator);var o=RelatedEntitiesMediator.prototype;o.__log=Log4js.getLogger();RelatedEntitiesMediator.NAME="RelatedEntitiesMediator";function RelatedEntitiesMediator(viewComponent)
{Mediator.apply(this,[RelatedEntitiesMediator.NAME,viewComponent]);if(Objs.extending)return;this.__initialize();}
o.getViewState=function(object)
{this.__log.debug(RelatedEntitiesMediator.NAME+" getting view state");switch(object.NAME)
{case EntityVO.NAME:return this._getView().getEntities();default:return[];}};o.listNotificationInterests=function()
{return[];};o.handleNotification=function(note)
{};o._getView=function()
{return this._viewComponent;};o.__initialize=function()
{this.__log.debug(RelatedEntitiesMediator.NAME+" initialized");};}
function class_com_evri_collections_view_TweetMediator()
{Objs.register("com.evri.collections.view.TweetMediator",TweetMediator);var IMediator=Objs.load("org.puremvc.js.interfaces.IMediator");var INotification=Objs.load("org.puremvc.js.interfaces.INotification");var Mediator=Objs.load("org.puremvc.js.patterns.mediator.Mediator");var Notification=Objs.load("org.puremvc.js.patterns.observer.Notification");var ApplicationFacade=Objs.load("com.evri.collections.ApplicationFacade");var TweetProxy=Objs.load("com.evri.collections.model.TweetProxy");var IncludedEntities=Objs.load("com.evri.collections.view.components.IncludedEntities");var EventS=Objs.load("net.tekool.events.EventS");var Relegate=Objs.load("net.tekool.utils.Relegate");Objs.extend(TweetMediator,Mediator);Objs.implement(TweetMediator,IMediator);var o=TweetMediator.prototype;TweetMediator.NAME="TweetMediator";o.__log=null;function TweetMediator(viewComponent)
{Mediator.apply(this,[TweetMediator.NAME,viewComponent]);if(Objs.extending)return;this.__initialize();}
o.listNotificationInterests=function()
{return[ApplicationFacade.STARTUP,ApplicationFacade.TWEETS_LOADED,ApplicationFacade.TWEETS_FAILED];};o.handleNotification=function(note)
{var view=this._getView();switch(note.getName())
{case ApplicationFacade.STARTUP:if(view._element==null)return;var $entities=$("#includedEntities a["+IncludedEntities.__URI_ATTRIBUTE+"]",this._element);var entityUris=[];for(var i=0;i<$entities.length;i++){var uri=$($entities[i]).attr(IncludedEntities.__URI_ATTRIBUTE);entityUris.push(uri);}
var tweetProxy=this._facade.retrieveProxy(TweetProxy.NAME);tweetProxy.getTweetsForCollection(entityUris);break;case ApplicationFacade.TWEETS_LOADED:view.renderTweets(note.getBody());break;case ApplicationFacade.TWEETS_FAILED:view.renderTweetsError(note.getBody());break;default:this.__log.warn("unknown notification type: "+note.getName());}};o._getView=function()
{return this._viewComponent;};o.__initialize=function()
{this.__log=Log4js.getLogger();this.__log.debug(TweetMediator.NAME+" initialized");};}
var Collection={setup:function(){$(".images-panel").initializeImageSummaries();var ApplicationFacade=Objs.load("com.evri.collections.ApplicationFacade");var CollectionMedia=Objs.load("com.evri.collections.view.components.CollectionMedia");var CollectionMetadata=Objs.load("com.evri.collections.view.components.CollectionMetadata");var EntitySearch=Objs.load("com.evri.collections.view.components.EntitySearch");var IncludedEntities=Objs.load("com.evri.collections.view.components.IncludedEntities");var Messaging=Objs.load("com.evri.collections.view.components.Messaging");var RelatedEntities=Objs.load("com.evri.collections.view.components.RelatedEntities");var Tweets=Objs.load("com.evri.collections.view.components.Tweets");var application=document.getElementById("body");application.messaging=new Messaging(document.getElementById("messaging"));application.collectionMetadata=new CollectionMetadata(document.getElementById("collectionMetadata"));application.includedEntities=new IncludedEntities(document.getElementById("includedEntities"));application.entitySearch=new EntitySearch(document.getElementById("entitySearch"));application.relatedEntities=new RelatedEntities(document.getElementById("relatedEntities"));application.collectionMedia=new CollectionMedia(document.getElementById("collectionMedia"));application.tweets=new Tweets(document.getElementById("collectionTweets"));var facade=ApplicationFacade.getInstance();facade.startup(application);},showMultiSubjectWidget:function(collection_uri){var url="/widget_gallery/multi_subject_for_collection?collection_uri="+encodeURIComponent(collection_uri);var html='<div class="edp-embed-instructions">The Collections Widget '+'helps you and your readers to stay informed about topics you '+'care about. Just click "Get this widget" on the bottom right '+'to copy the code for your web page or blog.</div>';var $iFrame=Evri.Collections.openModalFrame(url,html);$iFrame.css({"height":550});return false;},bindCollectionEvents:function(){$("div.name-and-delete-link").mouseover(function(){$(this).find("a.collection-delete-link").show();});$("div.name-and-delete-link").mouseout(function(){$(this).find("a.collection-delete-link").hide();});$("a.collection-delete-link").click(function(){var collection_uri=$(this).attr("col_uri");Collection.deleteCollection(collection_uri);});},deleteCollection:function(collection_uri){var $dialog=$("#content").find("div.modal-confirm-delete").clone();$.facebox($dialog);var $facebox=$("#facebox").center();$facebox.find(".footer").hide();$facebox.find("div.modal-confirm-delete").find("a.close-button").click(function(){$.facebox.close();});$facebox.find("#cancel-delete").click(function(){$.facebox.close();});$facebox.find("div.delete-button").find("input.chromeless-button").click(function(){$.ajax({type:"POST",dataType:"json",url:"/collections/delete",data:"collection_uri="+collection_uri,success:function(data,textStatus){$.facebox.close();var $content=$("#content");switch(data.status){case"ok":var remainingSize=data.size;if(remainingSize===0){window.location.reload();return;}
var div_id=collection_uri.replace(/\//g,"-");$content.find("#messaging").html("<p>Collection deleted.</p>");$content.find("#collections").find("#"+div_id+".collection-container").hide();break;case"unowned":$content.find("#messaging").html("<p>Please sign in to delete this collection</p>");break;}}});});}};;(function($){var $scrollTo=$.scrollTo=function(target,duration,settings){$scrollTo.window().scrollTo(target,duration,settings);};$scrollTo.defaults={axis:'y',duration:1};$scrollTo.window=function(){return $($.browser.safari?'body':'html');};$.fn.scrollTo=function(target,duration,settings){if(typeof duration=='object'){settings=duration;duration=0;}
settings=$.extend({},$scrollTo.defaults,settings);duration=duration||settings.speed||settings.duration;settings.queue=settings.queue&&settings.axis.length>1;if(settings.queue)
duration/=2;settings.offset=both(settings.offset);settings.over=both(settings.over);return this.each(function(){var elem=this,$elem=$(elem),t=target,toff,attr={},win=$elem.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t=both(t);break;}
t=$(t,this);case'object':if(t.is||t.style)
toff=(t=$(t)).offset();}
$.each(settings.axis.split(''),function(i,axis){var Pos=axis=='x'?'Left':'Top',pos=Pos.toLowerCase(),key='scroll'+Pos,act=elem[key],Dim=axis=='x'?'Width':'Height',dim=Dim.toLowerCase();if(toff){attr[key]=toff[pos]+(win?0:act-$elem.offset()[pos]);if(settings.margin){attr[key]-=parseInt(t.css('margin'+Pos))||0;attr[key]-=parseInt(t.css('border'+Pos+'Width'))||0;}
attr[key]+=settings.offset[pos]||0;if(settings.over[pos])
attr[key]+=t[dim]()*settings.over[pos];}else
attr[key]=t[pos];if(/^\d+$/.test(attr[key]))
attr[key]=attr[key]<=0?0:Math.min(attr[key],max(Dim));if(!i&&settings.queue){if(act!=attr[key])
animate(settings.onAfterFirst);delete attr[key];}});animate(settings.onAfter);function animate(callback){$elem.animate(attr,duration,settings.easing,callback&&function(){callback.call(this,target);});};function max(Dim){var el=win?$.browser.opera?document.body:document.documentElement:elem;return el['scroll'+Dim]-el['client'+Dim];};});};function both(val){return typeof val=='object'?val:{top:val,left:val};};})(jQuery);(function($){$.fn.tweetsForList=function(list,query){renderTweets(this,list,query);return this;};$.fn.tweetsForQuery=function(apiSession,options){var $selector=this;options=$.extend({count:20},options);$selector.each(function(index,container){var $container=$(container);var $tweetsList=$container.find('ol.tweets');var query=$container.attr("data-twitter-query");var tweetMethod='findForEntityResource';if(apiSession.models.Entity.parseIdFromResource(query)===undefined){tweetMethod='findForQuery';}
apiSession.models.Tweet[tweetMethod](query,{onComplete:function(tweetList){if(tweetList.tweets.length===0){$container.tweetsError('No tweets found');}else{renderTweets($tweetsList,tweetList.tweets.slice(0,options.count),query);$container.find(".panel-message").remove();}},onFailure:function(error){$container.tweetsError('Twitter is currently unavailable');}});});return $selector;};$.fn.tweetsError=function(message){var $selector=this;$selector.each(function(index,item){var $item=$(item);$item.find(".panel-message").html($("<p/>").text(message));$item.parent(".news-feed-section").hide();});return $selector;};function renderTweets($listContainer,tweets,query){$.each(tweets,function(i,tweet){var tweetContentRanges=tweet.getTitleRanges();var entityLinkedTweet="";$.each(tweetContentRanges,function(rangeIndex,range){if(range.matchedLocation!==undefined){if(range.matchedLocation.href==query){entityLinkedTweet+='<em>'+range.content+'</em>';}else{entityLinkedTweet+='<a href="'+range.matchedLocation.portalURI+'" class="entity-match">'+range.content+'</a>';}}else{entityLinkedTweet+=range.content;}});var rawTweet=tweet.content;var author=tweet.authorName.replace(/\s\(.+\).*$/,'');var $tweetLinks=$('<div />').html(rawTweet).find('a');$tweetLinks.each(function(link_index,link){var $link=$(link);$link.addClass("tweet-origin");var linkMarkup=$('<div />').append($link).html();entityLinkedTweet=entityLinkedTweet.replace($link.text(),linkMarkup);});var userImage=$("<a/>").attr("href",tweet.authorURI).append($("<img/>").attr("src",tweet.imageURI));$('<li>\
            <div class="tweet-image"/>\
            <div class="tweet-top"><p class="content" /></div>\
            <div class="tweet-bottom"><a class="attribution" /><span /><a class="retweet" target="_blank"/></div>\
         </li>').appendTo($listContainer).addClass('tweet').find("div.tweet-image").append(userImage).end().find('p.content').html(entityLinkedTweet).end().find('div.tweet-bottom').find('a.attribution').attr('href',tweet.authorURI).text(author).end().find('a.retweet').text("retweet").attr("href",function(){var user=encodeURIComponent(author);var status=encodeURIComponent(tweet.title);var href="/twitter/retweet?twitter_user="+user+"&status="+status;return href;}).end().find('span').text(tweet.getRelativePublicationDate());});};})(jQuery);(function($){$.fn.renderQuotesViewer=function(){var $selection=this;$selection.each(function(viewerIndex,viewerNode){var $viewer=$(viewerNode);$viewer.find('h2').find('a.next').click(function(){var $button=$(this);var $quotes=$viewer.find('ol.quotes');var $current=$quotes.find('li.current');var $next=$current.next();if($next.length===1){$current.removeClass('current');$next.addClass('current');$next.show();}
$viewer.updateQuotesViewerButtons();$button.blur();return false}).end().find('a.previous').click(function(){var $button=$(this);var $quotes=$viewer.find('ol.quotes');var $current=$quotes.find('li.current');var $previous=$current.prev();if($previous.length===1){$current.removeClass('current');$previous.addClass('current');$previous.show();}
$viewer.updateQuotesViewerButtons();$button.blur();return false}).end().end().find('ol.quotes li:first').addClass('current').show().end().updateQuotesViewerButtons();});return $selection;};$.fn.updateQuotesViewerButtons=function(){var $selection=this
$selection.each(function(viewerIndex,viewerNode){var $viewer=$(viewerNode);var $next=$viewer.find('h2 a.next');var $previous=$viewer.find('h2 a.previous');var $current=$viewer.find('ol.quotes li.current');if($current.prevAll().length===0){$previous.addClass('disabled');}else{$previous.removeClass('disabled');}
if($current.nextAll().length===0){$next.addClass('disabled');}else{$next.removeClass('disabled');}});return $selection;}})(jQuery);var Find={initialize:function(){$('div.twitter-panel').tweetsForQuery(apiSession);$('div.videos-panel').initializeVideoControls();$('div.images-panel').initializeImageSummaries();var params=URI.parseQueryString(window.location.search);var $list=$("ul.related").hide();var blacklist={};$(".entity_summary a").each(function(index,item){blacklist[$(item).attr("href")]=index;});$.getJSON("/find/related.json",params,function(data){$.each(data,function(index,item){var parts=item.split(" (/");var entity={name:parts[0],href:"/"+parts[1].replace(")","")};if(blacklist[entity.href]==undefined){var $anchor=$("<a/>").attr("href",entity.href).attr("data-entity-resource",entity.href);$list.append($("<li/>").append($anchor.text(entity.name)));}});if($list.children().length>0){$list.prepend("<h2>Related to '"+HTML.escape(params['query'].replace("+"," "))+"'</h2>");$list.expandableList();$('div#results-related').richTooltip();$list.slideDown();}});}};var dp={sh:{Toolbar:{},Utils:{},RegexLib:{},Brushes:{},Strings:{AboutDialog:'<html><head><title>About...</title></head><body class="dp-about"><table cellspacing="0"><tr><td class="copy"><p class="title">dp.SyntaxHighlighter</div><div class="para">Version: {V}</p><p><a href="http://www.dreamprojections.com/syntaxhighlighter/?ref=about" target="_blank">http://www.dreamprojections.com/syntaxhighlighter</a></p>&copy;2004-2007 Alex Gorbatchev.</td></tr><tr><td class="footer"><input type="button" class="close" value="OK" onClick="window.close()"/></td></tr></table></body></html>'},ClipboardSwf:null,Version:'1.5.1'}};dp.SyntaxHighlighter=dp.sh;dp.sh.Toolbar.Commands={ExpandSource:{label:'+ expand source',check:function(highlighter){return highlighter.collapse;},func:function(sender,highlighter)
{sender.parentNode.removeChild(sender);highlighter.div.className=highlighter.div.className.replace('collapsed','');}},ViewSource:{label:'view plain',func:function(sender,highlighter)
{var code=dp.sh.Utils.FixForBlogger(highlighter.originalCode).replace(/</g,'&lt;');var wnd=window.open('','_blank','width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=0');wnd.document.write('<textarea style="width:99%;height:99%">'+code+'</textarea>');wnd.document.close();}},CopyToClipboard:{label:'copy to clipboard',check:function(){return window.clipboardData!=null||dp.sh.ClipboardSwf!=null;},func:function(sender,highlighter)
{var code=dp.sh.Utils.FixForBlogger(highlighter.originalCode).replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');if(window.clipboardData)
{window.clipboardData.setData('text',code);}
else if(dp.sh.ClipboardSwf!=null)
{var flashcopier=highlighter.flashCopier;if(flashcopier==null)
{flashcopier=document.createElement('div');highlighter.flashCopier=flashcopier;highlighter.div.appendChild(flashcopier);}
flashcopier.innerHTML='<embed src="'+dp.sh.ClipboardSwf+'" FlashVars="clipboard='+encodeURIComponent(code)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';}
alert('The code is in your clipboard now');}},PrintSource:{label:'print',func:function(sender,highlighter)
{var iframe=document.createElement('IFRAME');var doc=null;iframe.style.cssText='position:absolute;width:0px;height:0px;left:-500px;top:-500px;';document.body.appendChild(iframe);doc=iframe.contentWindow.document;dp.sh.Utils.CopyStyles(doc,window.document);doc.write('<div class="'+highlighter.div.className.replace('collapsed','')+' printing">'+highlighter.div.innerHTML+'</div>');doc.close();iframe.contentWindow.focus();iframe.contentWindow.print();alert('Printing...');document.body.removeChild(iframe);}},About:{label:'?',func:function(highlighter)
{var wnd=window.open('','_blank','dialog,width=300,height=150,scrollbars=0');var doc=wnd.document;dp.sh.Utils.CopyStyles(doc,window.document);doc.write(dp.sh.Strings.AboutDialog.replace('{V}',dp.sh.Version));doc.close();wnd.focus();}}};dp.sh.Toolbar.Create=function(highlighter)
{var div=document.createElement('DIV');div.className='tools';for(var name in dp.sh.Toolbar.Commands)
{var cmd=dp.sh.Toolbar.Commands[name];if(cmd.check!=null&&!cmd.check(highlighter))
continue;div.innerHTML+='<a href="#" onclick="dp.sh.Toolbar.Command(\''+name+'\',this);return false;">'+cmd.label+'</a>';}
return div;}
dp.sh.Toolbar.Command=function(name,sender)
{var n=sender;while(n!=null&&n.className.indexOf('dp-highlighter')==-1)
n=n.parentNode;if(n!=null)
dp.sh.Toolbar.Commands[name].func(sender,n.highlighter);}
dp.sh.Utils.CopyStyles=function(destDoc,sourceDoc)
{var links=sourceDoc.getElementsByTagName('link');for(var i=0;i<links.length;i++)
if(links[i].rel.toLowerCase()=='stylesheet')
destDoc.write('<link type="text/css" rel="stylesheet" href="'+links[i].href+'"></link>');}
dp.sh.Utils.FixForBlogger=function(str)
{return(dp.sh.isBloggerMode==true)?str.replace(/<br\s*\/?>|&lt;br\s*\/?&gt;/gi,'\n'):str;}
dp.sh.RegexLib={MultiLineCComments:new RegExp('/\\*[\\s\\S]*?\\*/','gm'),SingleLineCComments:new RegExp('//.*$','gm'),SingleLinePerlComments:new RegExp('#.*$','gm'),DoubleQuotedString:new RegExp('"(?:\\.|(\\\\\\")|[^\\""\\n])*"','g'),SingleQuotedString:new RegExp("'(?:\\.|(\\\\\\')|[^\\''\\n])*'",'g')};dp.sh.Match=function(value,index,css)
{this.value=value;this.index=index;this.length=value.length;this.css=css;}
dp.sh.Highlighter=function()
{this.noGutter=false;this.addControls=true;this.collapse=false;this.tabsToSpaces=true;this.wrapColumn=80;this.showColumns=true;}
dp.sh.Highlighter.SortCallback=function(m1,m2)
{if(m1.index<m2.index)
return-1;else if(m1.index>m2.index)
return 1;else
{if(m1.length<m2.length)
return-1;else if(m1.length>m2.length)
return 1;}
return 0;}
dp.sh.Highlighter.prototype.CreateElement=function(name)
{var result=document.createElement(name);result.highlighter=this;return result;}
dp.sh.Highlighter.prototype.GetMatches=function(regex,css)
{var index=0;var match=null;while((match=regex.exec(this.code))!=null)
this.matches[this.matches.length]=new dp.sh.Match(match[0],match.index,css);}
dp.sh.Highlighter.prototype.AddBit=function(str,css)
{if(str==null||str.length==0)
return;var span=this.CreateElement('SPAN');str=str.replace(/ /g,'&nbsp;');str=str.replace(/</g,'&lt;');str=str.replace(/\n/gm,'&nbsp;<br>');if(css!=null)
{if((/br/gi).test(str))
{var lines=str.split('&nbsp;<br>');for(var i=0;i<lines.length;i++)
{span=this.CreateElement('SPAN');span.className=css;span.innerHTML=lines[i];this.div.appendChild(span);if(i+1<lines.length)
this.div.appendChild(this.CreateElement('BR'));}}
else
{span.className=css;span.innerHTML=str;this.div.appendChild(span);}}
else
{span.innerHTML=str;this.div.appendChild(span);}}
dp.sh.Highlighter.prototype.IsInside=function(match)
{if(match==null||match.length==0)
return false;for(var i=0;i<this.matches.length;i++)
{var c=this.matches[i];if(c==null)
continue;if((match.index>c.index)&&(match.index<c.index+c.length))
return true;}
return false;}
dp.sh.Highlighter.prototype.ProcessRegexList=function()
{for(var i=0;i<this.regexList.length;i++)
this.GetMatches(this.regexList[i].regex,this.regexList[i].css);}
dp.sh.Highlighter.prototype.ProcessSmartTabs=function(code)
{var lines=code.split('\n');var result='';var tabSize=4;var tab='\t';function InsertSpaces(line,pos,count)
{var left=line.substr(0,pos);var right=line.substr(pos+1,line.length);var spaces='';for(var i=0;i<count;i++)
spaces+=' ';return left+spaces+right;}
function ProcessLine(line,tabSize)
{if(line.indexOf(tab)==-1)
return line;var pos=0;while((pos=line.indexOf(tab))!=-1)
{var spaces=tabSize-pos%tabSize;line=InsertSpaces(line,pos,spaces);}
return line;}
for(var i=0;i<lines.length;i++)
result+=ProcessLine(lines[i],tabSize)+'\n';return result;}
dp.sh.Highlighter.prototype.SwitchToList=function()
{var html=this.div.innerHTML.replace(/<(br)\/?>/gi,'\n');var lines=html.split('\n');if(this.addControls==true)
this.bar.appendChild(dp.sh.Toolbar.Create(this));if(this.showColumns)
{var div=this.CreateElement('div');var columns=this.CreateElement('div');var showEvery=10;var i=1;while(i<=150)
{if(i%showEvery==0)
{div.innerHTML+=i;i+=(i+'').length;}
else
{div.innerHTML+='&middot;';i++;}}
columns.className='columns';columns.appendChild(div);this.bar.appendChild(columns);}
for(var i=0,lineIndex=this.firstLine;i<lines.length-1;i++,lineIndex++)
{var li=this.CreateElement('LI');var span=this.CreateElement('SPAN');li.className=(i%2==0)?'alt':'';span.innerHTML=lines[i]+'&nbsp;';li.appendChild(span);this.ol.appendChild(li);}
this.div.innerHTML='';}
dp.sh.Highlighter.prototype.Highlight=function(code)
{function Trim(str)
{return str.replace(/^\s*(.*?)[\s\n]*$/g,'$1');}
function Chop(str)
{return str.replace(/\n*$/,'').replace(/^\n*/,'');}
function Unindent(str)
{var lines=dp.sh.Utils.FixForBlogger(str).split('\n');var indents=new Array();var regex=new RegExp('^\\s*','g');var min=1000;for(var i=0;i<lines.length&&min>0;i++)
{if(Trim(lines[i]).length==0)
continue;var matches=regex.exec(lines[i]);if(matches!=null&&matches.length>0)
min=Math.min(matches[0].length,min);}
if(min>0)
for(var i=0;i<lines.length;i++)
lines[i]=lines[i].substr(min);return lines.join('\n');}
function Copy(string,pos1,pos2)
{return string.substr(pos1,pos2-pos1);}
var pos=0;if(code==null)
code='';this.originalCode=code;this.code=Chop(Unindent(code));this.div=this.CreateElement('DIV');this.bar=this.CreateElement('DIV');this.ol=this.CreateElement('OL');this.matches=new Array();this.div.className='dp-highlighter';this.div.highlighter=this;this.bar.className='bar';this.ol.start=this.firstLine;if(this.CssClass!=null)
this.ol.className=this.CssClass;if(this.collapse)
this.div.className+=' collapsed';if(this.noGutter)
this.div.className+=' nogutter';if(this.tabsToSpaces==true)
this.code=this.ProcessSmartTabs(this.code);this.ProcessRegexList();if(this.matches.length==0)
{this.AddBit(this.code,null);this.SwitchToList();this.div.appendChild(this.bar);this.div.appendChild(this.ol);return;}
this.matches=this.matches.sort(dp.sh.Highlighter.SortCallback);for(var i=0;i<this.matches.length;i++)
if(this.IsInside(this.matches[i]))
this.matches[i]=null;for(var i=0;i<this.matches.length;i++)
{var match=this.matches[i];if(match==null||match.length==0)
continue;this.AddBit(Copy(this.code,pos,match.index),null);this.AddBit(match.value,match.css);pos=match.index+match.length;}
this.AddBit(this.code.substr(pos),null);this.SwitchToList();this.div.appendChild(this.bar);this.div.appendChild(this.ol);}
dp.sh.Highlighter.prototype.GetKeywords=function(str)
{return'\\b'+str.replace(/ /g,'\\b|\\b')+'\\b';}
dp.sh.BloggerMode=function()
{dp.sh.isBloggerMode=true;}
dp.sh.HighlightAll=function(name,showGutter,showControls,collapseAll,firstLine,showColumns)
{function FindValue()
{var a=arguments;for(var i=0;i<a.length;i++)
{if(a[i]==null)
continue;if(typeof(a[i])=='string'&&a[i]!='')
return a[i]+'';if(typeof(a[i])=='object'&&a[i].value!='')
return a[i].value+'';}
return null;}
function IsOptionSet(value,list)
{for(var i=0;i<list.length;i++)
if(list[i]==value)
return true;return false;}
function GetOptionValue(name,list,defaultValue)
{var regex=new RegExp('^'+name+'\\[(\\w+)\\]$','gi');var matches=null;for(var i=0;i<list.length;i++)
if((matches=regex.exec(list[i]))!=null)
return matches[1];return defaultValue;}
function FindTagsByName(list,name,tagName)
{var tags=document.getElementsByTagName(tagName);for(var i=0;i<tags.length;i++)
if(tags[i].getAttribute('name')==name)
list.push(tags[i]);}
var elements=[];var highlighter=null;var registered={};var propertyName='innerHTML';FindTagsByName(elements,name,'pre');FindTagsByName(elements,name,'textarea');if(elements.length==0)
return;for(var brush in dp.sh.Brushes)
{var aliases=dp.sh.Brushes[brush].Aliases;if(aliases==null)
continue;for(var i=0;i<aliases.length;i++)
registered[aliases[i]]=brush;}
for(var i=0;i<elements.length;i++)
{var element=elements[i];var options=FindValue(element.attributes['class'],element.className,element.attributes['language'],element.language);var language='';if(options==null)
continue;options=options.split(':');language=options[0].toLowerCase();if(registered[language]==null)
continue;highlighter=new dp.sh.Brushes[registered[language]]();element.style.display='none';highlighter.noGutter=(showGutter==null)?IsOptionSet('nogutter',options):!showGutter;highlighter.addControls=(showControls==null)?!IsOptionSet('nocontrols',options):showControls;highlighter.collapse=(collapseAll==null)?IsOptionSet('collapse',options):collapseAll;highlighter.showColumns=(showColumns==null)?IsOptionSet('showcolumns',options):showColumns;var headNode=document.getElementsByTagName('head')[0];if(highlighter.Style&&headNode)
{var styleNode=document.createElement('style');styleNode.setAttribute('type','text/css');if(styleNode.styleSheet)
{styleNode.styleSheet.cssText=highlighter.Style;}
else
{var textNode=document.createTextNode(highlighter.Style);styleNode.appendChild(textNode);}
headNode.appendChild(styleNode);}
highlighter.firstLine=(firstLine==null)?parseInt(GetOptionValue('firstline',options,1)):firstLine;highlighter.Highlight(element[propertyName]);highlighter.source=element;element.parentNode.insertBefore(highlighter.div,element);}}
dp.sh.Brushes.Xml=function()
{this.CssClass='dp-xml';this.Style='.dp-xml .cdata { color: #ff1493; }'+'.dp-xml .tag, .dp-xml .tag-name { color: #069; font-weight: bold; }'+'.dp-xml .attribute { color: red; }'+'.dp-xml .attribute-value { color: blue; }';};dp.sh.Brushes.Xml.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Xml.Aliases=['xml','xhtml','xslt','html','xhtml'];dp.sh.Brushes.Xml.prototype.ProcessRegexList=function()
{function push(array,value)
{array[array.length]=value;}
var index=0;var match=null;var regex=null;this.GetMatches(new RegExp('(\&lt;|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\&gt;|>)','gm'),'cdata');this.GetMatches(new RegExp('(\&lt;|<)!--\\s*.*?\\s*--(\&gt;|>)','gm'),'comments');regex=new RegExp('([:\\w-\.]+)\\s*=\\s*(".*?"|\'.*?\'|\\w+)*|(\\w+)','gm');while((match=regex.exec(this.code))!=null)
{if(match[1]==null)
{continue;}
push(this.matches,new dp.sh.Match(match[1],match.index,'attribute'));if(match[2]!=undefined)
{push(this.matches,new dp.sh.Match(match[2],match.index+match[0].indexOf(match[2]),'attribute-value'));}}
this.GetMatches(new RegExp('(\&lt;|<)/*\\?*(?!\\!)|/*\\?*(\&gt;|>)','gm'),'tag');regex=new RegExp('(?:\&lt;|<)/*\\?*\\s*([:\\w-\.]+)','gm');while((match=regex.exec(this.code))!=null)
{push(this.matches,new dp.sh.Match(match[1],match.index+match[0].indexOf(match[1]),'tag-name'));}}
dp.sh.Brushes.JScript=function(){var keywords='abstract boolean break byte case catch char class const continue debugger '+'default delete do double else enum export extends false final finally float '+'for function goto if implements import in instanceof int interface long native '+'new null package private protected public return short static super switch '+'synchronized this throw throws transient true try typeof var void volatile while with';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('^\\s*#.*','gm'),css:'preprocessor'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'},{regex:new RegExp(this.GetKeywords('onCreate onLoaded onComplete onFailure'),'gm'),css:'evri-callback'}];this.CssClass='dp-c';};dp.sh.Brushes.JScript.prototype=new dp.sh.Highlighter();dp.sh.Brushes.JScript.Aliases=['js','jscript','javascript'];var TabsPanels={"news-feed":function(){var panel=this;var hoverClass="image-hover";panel.initializeImageSummaries();panel.find(".twitter-panel").tweetsForQuery(apiSession,{count:3});$.each(["videos"],function(i,name){panel.find("."+name+"-panel").doOnce(TabsPanels[name]);});},images:function(){var panel=this;panel.initializeImageSummaries();},"articles-filter":function(){var panel=this;var actions={"form.articles-filter-relations":function(){this.submit(function(){$(this).siblings("form").find(".articles-context").val("").end().find(".articles-input-active").removeClass("articles-input-active");});},"form.articles-filter-relations select":function(){this.change(function(){$(this).parents('form').submit();});},"form.articles-filter-context":function(){this.submit(function(){$(this).siblings("form").find("select").val("");}).submit(function(){var context=$(this).find(".articles-context").val();$(this).find(".articles-input-context").toggleClass("articles-input-active",context.length>0);});},".articles-context":function(){this.example('Keywords',{class_name:'default-keyword'});},".articles-clear-context":function(){this.click(function(){$(this).parents(".articles-input-context").removeClass("articles-input-active").find("input").val("").focus();$(this).parents("form.articles-filter").submit();return false;});},"form.articles-filter":function(){this.submit(function(){var href=$(this).attr("action");panel.find(".articles-panel").addClass("disabled");$.get(href,$(this).serialize(),function(data){panel.find(".articles-page").remove();panel.find(".articles-filter-forms").after($(data).find(".articles-page"));});return false;});}};$.each(actions,function(selector,action){action.call(panel.find(selector));});$.each(["prev","next"],function(i,name){panel.find("a.articles-filter-page-"+name).click(function(){var activeClass="articles-page-active";panel.find("."+activeClass)[name](".articles-page").addClass(activeClass).siblings().removeClass(activeClass);return false;});});},twitter:function(){this.tweetsForQuery(apiSession);},videos:function(){var panel=this;panel.initializeVideoControls();}};$.each(TabsPanels,function(tabName,callb){$.init("#body.entity #entity-tabs .tabs-panels > ."+tabName+"-panel",callb);});$.init("#body.entity #entity-tabs .pagination-link a",function(){if($('.articles-panel').length>0){Evri.paginationFunction(this,$(".articles-panel")[0]);}else{Evri.paginationFunction(this);}});if(window.Evri==undefined)Evri={};Evri.paginationFunction=function(initObj,appendDiv){initObj.live("click",function(){var link=$(this);var panel=link.parents(".tabs-panels");link.parent().remove();var message=$("<div class='loading-message'><p>Loading...</p></div>");panel.append(message);$.get(link.attr("href"),function(data){message.remove();data=$(data);data.appendTo(appendDiv||panel).doOnce(TabsPanels[link.parent().attr("data-initializer")]);});return false;});}
if(window.Evri==undefined)Evri={};Evri.ModalDialog=function(srcUrl,title,childCloseCallback,width,height){this.srcUrl=srcUrl;this.title=title;this.childCloseCallback=childCloseCallback;this.height=height;this.width=width;this.positioningTimeout=null;this.dialogNode=null;this.modalNode=null;this.iframe=null;this.showOverlay();this.showDialog();};Evri.ModalDialog.prototype.settings={opacity:0.5,minSize:{height:100,width:100},minMargin:100,dialogHtml:'\
                    <div id="dialog" style="display:none;"> \
                      <div class="popup"> \
                        <table style="position:relative"> \
                          <tbody> \
                            <tr> \
                              <td class="tl"/><td class="b"/><td class="tr"/> \
                            </tr> \
                            <tr> \
                              <td class="b"/> \
                              <td class="body"> \
                                <div class="content" style="background:#FFF;position:relative;overflow:hidden;"> \
                                    <div class="header"> \
                                        <div class="title"></div> \
                                        <a class="close" title="close"/> \
                                    </div> \
                                    <div style="position:relative;margin:4px;height:100%;"> \
                                        <iframe style="height:100%;width:100%;" frameborder="0"></iframe> \
                                        <div class="iframe_overlay" style="height:100%;width:100%;background:#FFF;position:absolute;top:0px;left:0px;"> \
                                            <img src="/images/evri_loading.gif"/>\
                                        </div>\
                                    </div> \
                                </div> \
                              </td> \
                              <td class="b"/> \
                            </tr> \
                            <tr> \
                              <td class="bl"/><td class="b"/><td class="br"/> \
                            </tr> \
                          </tbody> \
                        </table> \
                      </div> \
                    </div>'};Evri.ModalDialog.prototype.populateIframe=function(){this.iframe=$(this.dialogNode).find('iframe')[0];var modalDialog=this;if(this.iframe.addEventListener){this.iframe.addEventListener('load',function(){modalDialog.handleIframeLoaded();},false);}else if(this.iframe.attachEvent){this.iframe.attachEvent('onload',function(){modalDialog.handleIframeLoaded();});}
if(this.srcUrl.match(/\?/)){this.iframe.src=this.srcUrl+'&dialog=true';}else{this.iframe.src=this.srcUrl+'?dialog=true';}
Evri.ModalDialog.handleCompletedDialog=function(){modalDialog.close();if(modalDialog.childCloseCallback)modalDialog.childCloseCallback.call();};};Evri.ModalDialog.prototype.handleIframeLoaded=function(){if(!this.iframe)return;this.desiredIframeHeight=this.height||this.settings.minHeight;this.width=this.width||this.settings.minWidth;this.resize();$(this.dialogNode).find('.iframe_overlay').remove();};Evri.ModalDialog.prototype.showDialog=function(){$('body').append(this.settings.dialogHtml);this.dialogNode=$('body')[0].lastChild;$(this.dialogNode).find('.title').text(this.title);$(this.dialogNode).find('.content').height(this.height+'px');$(this.dialogNode).find('.content').width(this.width+'px');var modalDialog=this;$(this.dialogNode).find('.close').click(function(){modalDialog.close();});this.position(this.height,this.width);$(window).bind('resize.dialog',function(){modalDialog.handleBrowserResize();});$(window).bind('scroll.dialog',function(){modalDialog.handleScroll();});$(this.dialogNode).fadeIn(200,function(){modalDialog.populateIframe();});};Evri.ModalDialog.prototype.handleBrowserResize=function(){if(this.positioningTimeout)clearTimeout(this.positioningTimeout);var modalDialog=this;this.positioningTimeout=setTimeout(function(){modalDialog.resize();},250);};Evri.ModalDialog.prototype.handleScroll=function(){if(this.positioningTimeout)clearTimeout(this.positioningTimeout);var modalDialog=this;this.positioningTimeout=setTimeout(function(){modalDialog.position();},250);};Evri.ModalDialog.prototype.resize=function(){var newHeight=this.height;var newWidth=this.width;var pageHeight=getPageHeight();if(newWidth>$(window).width()-this.settings.minMargin*2){newWidth=$(window).width()-this.settings.minMargin*2;}
if(newWidth<this.settings.minSize.width){newWidth=this.settings.minSize.width;}
if(newHeight>pageHeight-this.settings.minMargin*2){newHeight=pageHeight-this.settings.minMargin*2;}
if(newHeight<this.settings.minSize.height){newHeight=this.settings.minSize.height;}
var modalDialog=this;this.position(newHeight,newWidth);$(this.dialogNode).find('.content').animate({height:newHeight+'px',width:newWidth+'px'});$(this.iframe).animate({height:newHeight-42+'px',width:newWidth-8+'px'});};Evri.ModalDialog.prototype.position=function(resizeHeight,resizeWidth){var dialogHeight=resizeHeight||$(this.dialogNode).height();var dialogWidth=resizeWidth||$(this.dialogNode).width();var scroll=getPageScroll();var newLeft=($(window).width()/2.0)-(dialogWidth/2.0)+scroll[0];var newTop=(getPageHeight()/2.0)-(dialogHeight/2.0)+scroll[1];if(newTop<scroll[1])newTop=scroll[1];if(newLeft<0)newLeft=0;var animationParms={left:newLeft+'px',top:newTop+'px'}
$(this.dialogNode).animate(animationParms);};Evri.ModalDialog.prototype.showOverlay=function(){$("body").append('<div id="modal_overlay" class="modal_overlayBG" style="display:none;opacity:'+this.settings.opacity+';filter:alpha(opacity='+(this.settings.opacity*100)+');"></div>');this.overlayNode=$('body')[0].lastChild;var modalDialog=this;$(this.overlayNode).click(function(){modalDialog.close();});$(document).bind('keydown.modal',function(e){if(e.keyCode==27)modalDialog.close();return true;});$(this.overlayNode).fadeIn(200);return false;};Evri.ModalDialog.prototype.close=function(){$(document).unbind('keydown.modal');$(window).unbind('resize.dialog');$(window).unbind('scroll.dialog');if(this.widgetFollowThisClose){this.widgetFollowThisClose();}
Evri.ModalDialog.handleCompletedDialog=null;this.iframe=null;var modalDialog=this;$(this.dialogNode).fadeOut(function(){$(modalDialog.dialogNode).remove();modalDialog.dialogNode=null;});$(this.overlayNode).fadeOut(function(){$(modalDialog.overlayNode).remove();modalDialog.overlayNode=null;});};function getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
return new Array(xScroll,yScroll);}
function getPageHeight(){var windowHeight;if(self.innerHeight){windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowHeight=document.documentElement.clientHeight;}else if(document.body){windowHeight=document.body.clientHeight;}
return windowHeight;}
if(!window.Evri)window.Evri={};if(!window.Evri.Form)window.Evri.Form={};Evri.Form.submitSpinnerUrl="/images/evri_loading.gif";Evri.Form.showSpinnerOnSubmit=function(form,message){$(form).children().each(function(){this.style.visibility='hidden';});var submitSpinnerHTML="<div style='position:absolute;top:0px;left:0px;'>"+"<img src='"+Evri.Form.submitSpinnerUrl+"' class='loading-icon' />"+"<span class='loading-message'>"+message+"</span>"+"</div>";form.style.position='relative';$(form).append(submitSpinnerHTML);};(function($){'$:nomunge';var interval_id,last_hash,cache_bust=1,rm_callback,window=this,FALSE=!1,postMessage='postMessage',addEventListener='addEventListener',p_receiveMessage,has_postMessage=window[postMessage]&&!$.browser.opera;$[postMessage]=function(message,target_url,target){if(!target_url){return;}
message=typeof message==='string'?message:$.param(message);target=target||parent;if(has_postMessage){target[postMessage](message,target_url.replace(/([^:]+:\/\/[^\/]+).*/,'$1'));}else if(target_url){target.location=target_url.replace(/#.*$/,'')+'#'+(+new Date)+(cache_bust++)+'&'+message;}};$.receiveMessage=p_receiveMessage=function(callback,source_origin,delay){if(has_postMessage){if(callback){rm_callback&&p_receiveMessage();rm_callback=function(e){if((typeof source_origin==='string'&&e.origin!==source_origin)||($.isFunction(source_origin)&&source_origin(e.origin)===FALSE)){return FALSE;}
callback(e);};}
if(window[addEventListener]){window[callback?addEventListener:'removeEventListener']('message',rm_callback,FALSE);}else{window[callback?'attachEvent':'detachEvent']('onmessage',rm_callback);}}else{interval_id&&clearInterval(interval_id);interval_id=null;if(callback){delay=typeof source_origin==='number'?source_origin:typeof delay==='number'?delay:100;interval_id=setInterval(function(){var hash=document.location.hash,re=/^#?\d+&/;if(hash!==last_hash&&re.test(hash)){last_hash=hash;callback({data:hash.replace(re,'')});}},delay);}}};})(jQuery);