var Evernote=(typeof Evernote=="object"&&Evernote!=null)?Evernote:{};Evernote.logger={debug:function(a){if(typeof console=="object"&&console!=null&&typeof console.log=="function"){console.log(a)}},isDebugEnabled:function(){return false}};Evernote.detectCharacterEncoding=function(b){var c=(b)?b:document;var a=null;if(typeof c.characterSet=="string"){a=c.characterSet}else{if(typeof c.charset=="string"){a=c.charset}else{if(typeof c.inputEncoding=="string"){a=c.inputEncoding}else{if(typeof c.defaultCharset=="string"){a=c.defaultCharset}}}}return a};if(typeof Array.prototype.indexOf!="function"){Array.prototype.indexOf=function(b){for(var a=0;a<this.length;a++){if(this[a]==b){return a}}return -1}}Evernote.Config={insecureProto:"http://",secureProto:"https://",serviceDomain:"www.evernote.com",clipPath:"/noteit.action",getClipUrl:function(){return this.secureProto+this.serviceDomain+this.clipPath}};Evernote.inherit=function(b,d,c){if(d.constructor==Function){b.prototype=new d;b.prototype.constructor=b;b.prototype.parent=d.prototype;b.constructor.parent=d}else{b.prototype=d;b.prototype.constructor=b;b.prototype.parent=d;b.constructor.parent=d}if(c){for(var a in d.prototype.constructor){if(a!="parent"&&a!="prototype"&&d.constructor[a]!=d.prototype.constructor[a]&&typeof b.prototype.constructor[a]=="undefined"){b.prototype.constructor[a]=d.prototype.constructor[a]}}}if(typeof b.handleInheritance=="function"){b.handleInheritance.apply(b,arguments)}return b};Evernote.inherits=function(a,b){return(typeof a.prototype.parent!="undefined"&&a.prototype.parent.constructor==b)};Evernote.isHtmlElement=function(a){if(typeof HTMLElement=="function"){return(a instanceof HTMLElement)}else{if(typeof Element=="function"){return(a instanceof Element)}else{if(a!=null){return(typeof a.nodeType!="undefined"&&a.nodeType==1)}}}return false};Evernote.trimString=function(a){if(typeof a=="string"){return a.replace(/^\s+/,"").replace(/\s+$/,"")}return a};Evernote.collapseString=function(a){if(typeof a=="string"){return a.replace(/[\s\t\n]+/g," ").replace(/^\s+/,"").replace(/\s+$/,"")}return a};Evernote.cleanArray=function(c,b){if(c instanceof Array&&typeof b=="function"){var a=0;while(a<c.length){if(b(c[a])){c.splice(a,1)}else{a+=1}}}};Evernote.findChildren=function(b,e,a){var d=new Array();if(typeof b=="object"&&b!=null&&typeof b.nodeType=="number"&&b.nodeType==1){var g=b.childNodes;for(var c=0;c<g.length;c++){if(typeof e=="function"&&e(g[c])){d.push(g[c])}else{if(typeof e!="function"){d.push(g[c])}}if(a&&g[c].childElementCount>0){var f=arguments.callee(g[c],e);if(f&&f.length>0){d=Evernote.concatArrays(d,f)}}}}return d};Evernote.findParent=function(a,b){if(typeof a=="object"&&a!=null&&typeof a.nodeType=="number"){if(a.nodeName=="BODY"){return a}else{if(a.parentNode=="BODY"){return a}else{var c=a;while(c.parentNode.nodeName!="BODY"){if(typeof b=="function"&&b(c.parentNode)){return c.parentNode}else{if(typeof b!="function"){return c.parentNode}}c=c.parentNode}}}}return null};Evernote.hasElementClass=function(c,d,a){if(!this.isHtmlElement(c)){return false}try{var b=c.getAttribute("class");if(typeof b!="string"){return false}if(!a){b=b.toLowerCase();d=d.toLowerCase()}var g=b.replace(/\s+/," ").split(" ");return g.indexOf(d)>=0}catch(f){}return false};Evernote.containsElementClass=function(c,d,a){if(!this.isHtmlElement(c)){return false}try{var b=c.getAttribute("class");if(typeof b!="string"){return false}if(!a){b=b.toLowerCase();d=d.toLowerCase()}return b.indexOf(d)>=0}catch(f){}return false};Evernote.hasElementId=function(b,f,a){if(!this.isHtmlElement(b)){return false}try{var d=b.getAttribute("id");if(typeof d!="string"){return false}if(!a){d=d.toLowerCase();f=f.toLowerCase()}return d==f}catch(c){}return false};Evernote.containsElementId=function(b,f,a){if(!this.isHtmlElement(b)){return false}try{var d=b.getAttribute("id");if(typeof d!="string"){return false}if(!a){d=d.toLowerCase();f=f.toLowerCase()}return d.indexOf(f)>=0}catch(c){}return false};Evernote.isElementVisible=function(a){if(!this.isHtmlElement(a)){return false}try{var b=a.ownerDocument.defaultView.getComputedStyle(a);if(b){if(b.getPropertyValue("display")!="none"&&b.getPropertyValue("visibility")!="none"){return true}}}catch(c){}return false};Evernote.getElementClassNames=function(a){if(!this.isHtmlElement(a)){return false}return a.getAttribute("class").replace(/\s+/," ").split(" ")};Evernote.getElementSortedClassName=function(a){if(!this.isHtmlElement(a)){return null}return Evernote.getElementClassNames().sort().join(" ")};Evernote.Clip=function(b,a){this.initialize(b,a)};Evernote.Clip.constants={isIE:(navigator.appVersion.indexOf("MSIE",0)!=-1),isSafari:(navigator.appVersion.indexOf("WebKit",0)!=-1),isFirefox:(navigator.userAgent.indexOf("Firefox",0)!=-1),isIpad:(navigator.userAgent.indexOf("WebKit")>0&&navigator.userAgent.indexOf("iPad")>0),isIphone:(navigator.userAgent.indexOf("WebKit")>0&&navigator.userAgent.indexOf("iPhone")>0)};Evernote.Clip.contentMarkers=["article","post","content","story","body"];Evernote.Clip.filterMarkers=["comment","feedback","breadcrumb","share","sharing","social","sociable","tools","links","extra","related","sponsor","ads","adsense","banner","chat","shout","module"];Evernote.Clip.NOKEEP_NODE_ATTRIBUTES={style:null,"class":null,id:null,onclick:null,onsubmit:null,onmouseover:null,onmouseout:null};Evernote.Clip.NOKEEP_NODE_NAMES={style:null,script:null,input:null,select:null,option:null,textarea:null};Evernote.Clip.SELF_CLOSING_NODE_NAMES={base:null,basefont:null,frame:null,link:null,meta:null,area:null,br:null,col:null,hr:null,img:null,input:null,param:null};Evernote.Clip.NODE_NAME_TRANSLATIONS={body:"div",form:"div"};Evernote.Clip.LIST_NODE_NAMES={ul:null,ol:null};Evernote.Clip.HTMLEncode=function(e){var b="";for(var d=0;d<e.length;d++){var c=e.charCodeAt(d);var a=e[d];if(c>127){b+="&#"+c+";"}else{if(a==">"){b+="&gt;"}else{if(a=="<"){b+="&lt;"}else{if(a=="&"){b+="&amp;"}else{b+=e.charAt(d)}}}}}return b};Evernote.Clip.unicodeEntities=function(d){var a="";if(typeof d=="string"){for(var b=0;b<d.length;b++){var e=d.charCodeAt(b);if(e>127){a+="&#"+e+";"}else{a+=d.charAt(b)}}}return a};Evernote.Clip.isHtmlElement=function(a){return Evernote.isHtmlElement(a)};Evernote.Clip.trimString=function(a){return Evernote.trimString(a)};Evernote.Clip.collapseString=function(a){return Evernote.collapseString(a)};Evernote.Clip.nodeFilter=null;Evernote.Clip.prototype.title=null;Evernote.Clip.prototype.location=null;Evernote.Clip.prototype.window=null;Evernote.Clip.prototype.selectionFinder=null;Evernote.Clip.prototype.deep=true;Evernote.Clip.prototype.content=null;Evernote.Clip.prototype.range=null;Evernote.Clip.prototype._stylingStrategy=null;Evernote.Clip.prototype._verboseLog=false;Evernote.Clip.prototype.initialize=function(b,a){this.title=(typeof b.document.title=="string")?b.document.title:"";this.title=Evernote.Clip.collapseString(this.title);this.location=b.location;this.window=b;this.selectionFinder=new Evernote.SelectionFinder(b.document);this.range=null;if(a){this.setStylingStrategy(a)}};Evernote.Clip.prototype.isFullPage=function(){return !this.hasSelection()};Evernote.Clip.prototype.hasSelection=function(){if(this.selectionFinder.hasSelection()){return true}else{this.findSelection();return this.selectionFinder.hasSelection()}};Evernote.Clip.prototype.findSelection=function(){this.selectionFinder.find(this.deep)};Evernote.Clip.prototype.getSelection=function(){if(this.hasSelection()){return this.selectionFinder.selection}return null};Evernote.Clip.prototype.getRange=function(){if(this.hasSelection()){return this.selectionFinder.getRange()}return null};Evernote.Clip.prototype.getBody=function(){return this.window.document.getElementsByTagName("body")[0]};Evernote.Clip.prototype.hasBody=function(){try{var a=this.getBody();return a?true:false}catch(b){return false}};Evernote.Clip.prototype.hasContentToClip=function(){return(this.hasBody()||this.hasSelection())};Evernote.Clip.prototype.clipBody=function(){if(!this.hasBody()){Evernote.logger.debug("Document has no body...");return false}return this.clipElement(this.getBody())};Evernote.Clip.prototype.clipElement=function(a){if(a&&Evernote.Clip.isHtmlElement(a)){var b=0;var c=0;if(this._verboseLog){Evernote.logger.debug("Getting element contents: "+this);b=new Date().getTime()}this.content=this.serializeDOMNode(a,null,true);if(this._verboseLog){c=new Date().getTime();Evernote.logger.debug("Clipped element contents in "+(c-b)+" seconds")}if(typeof this.content!="string"){return false}return true}else{Evernote.logger.debug("Nothing to clip...");return false}};Evernote.Clip.prototype.clipSelection=function(){if(!this.hasSelection()){Evernote.logger.debug("No selection to clip");return false}if(Evernote.Clip.constants.isIE){this.content=this.selectionFinder.selection.htmlText;return true}var a=0;var b=0;this.range=this.getRange();if(this.range){if(this._verboseLog){var a=new Date().getTime()}this.content=this.serializeDOMNode(this.range.commonAncestorContainer);if(this._verboseLog){var b=new Date().getTime()}this.range=null;if(this._verboseLog){Evernote.logger.debug("Success...");Evernote.logger.debug("Clipped selection in "+(b-a)+" seconds")}return true}this.range=null;Evernote.logger.debug("Failed to clip selection");return false};Evernote.Clip.prototype.clipLink=function(a,b){if(typeof a!="string"){a=this.window.document.location.href}if(typeof b!="string"){b=Evernote.Clip.collapseString(this.window.document.title)}this.content="<a href='"+a+"'>"+b+"</a>";return true};Evernote.Clip.prototype.rangeIntersectsNode=function(a){if(this.range){var c=a.ownerDocument.createRange();try{c.selectNode(a)}catch(b){c.selectNodeContents(a)}return this.range.compareBoundaryPoints(Range.START_TO_END,c)==1&&this.range.compareBoundaryPoints(Range.END_TO_START,c)==-1}return false};Evernote.Clip.prototype.serializeDOMNode=function(g,i,c){if(this._verboseLog){Evernote.logger.debug("Clip.serializeDOMNode")}var k="";if(!c){if(this.range&&!this.rangeIntersectsNode(g)){if(this._verboseLog){Evernote.logger.debug("Skipping serialization of node: "+g.nodeName+" cuz it's not in range...")}return k}if(!this.keepNode(g)){if(this._verboseLog){Evernote.logger.debug("Skipping seralization of node: "+g.nodeName+" cuz it's a no-keeper")}return k}}if(this._verboseLog){Evernote.logger.debug("SerializeDOMNode: "+g.nodeName)}if(g.nodeType==3){if(this._verboseLog){Evernote.logger.debug("Serializing text node...")}if(this.range){if(this.range.startContainer==g&&this.range.startContainer==this.range.endContainer){k+=this.constructor.HTMLEncode(g.nodeValue.substring(this.range.startOffset,this.range.endOffset))}else{if(this.range.startContainer==g){k+=this.constructor.HTMLEncode(g.nodeValue.substring(this.range.startOffset))}else{if(this.range.endContainer==g){k+=this.constructor.HTMLEncode(g.nodeValue.substring(0,this.range.endOffset))}else{if(this.range.commonAncestorContainer!=g){k+=this.constructor.HTMLEncode(g.nodeValue)}}}}}else{k+=this.constructor.HTMLEncode(g.nodeValue)}}else{if(g.nodeType==1){if(this.range&&this.range.commonAncestorContainer==g&&this.range.startContainer!=this.range.commonAncestorContainer&&!this.isListNode(g)){if(this._verboseLog){Evernote.logger.debug("Ignoring range ancestor: "+g.nodeName)}}else{if(this._verboseLog){Evernote.logger.debug("Serializing node: "+g.nodeName)}var d=this.translateNodeName(g);k+="<"+d;var b=this.nodeAttributesToString(g);if(b.length>0){k+=" "+b}if(this.getStylingStrategy()){if(this._verboseLog){Evernote.logger.debug("Styling node: "+g.nodeName)}var l=this.getStylingStrategy().styleForNode(g,i);if(this._verboseLog){Evernote.logger.debug(l)}if(l instanceof Evernote.ClipStyle&&l.length>0){k+=' style="'+l.toString()+'"'}else{if(this._verboseLog){Evernote.logger.debug("Empty style...")}}}if(!g.hasChildNodes()&&this.isSelfClosingNode(g)){if(this._verboseLog){Evernote.logger.debug("Closing self-closing tag: "+g.nodeName)}k+="/>"}else{k+=">"}}if(g.nodeName.toLowerCase()!="iframe"&&g.hasChildNodes()){var f=g.childNodes;for(var h=0;h<f.length;h++){var e=f[h];if(e!=null&&e.nodeType>0&&e.nodeName!="SCRIPT"&&e.nodeName!="IFRAME"){var a=this.serializeDOMNode(e,g);if(a&&a.length>0){k+=a}}}}if(this.range&&this.range.commonAncestorContainer==g&&!this.isListNode(g)){if(this._verboseLog){Evernote.logger.debug("Ignoring range ancestor: "+g.nodeName)}}else{if(g.hasChildNodes()||!this.isSelfClosingNode(g)){k+="</"+d+">"}}}}return k};Evernote.Clip.prototype.keepNodeAttr=function(a){return(typeof a=="string"&&typeof Evernote.Clip.NOKEEP_NODE_ATTRIBUTES[a.toLowerCase()]=="undefined")};Evernote.Clip.prototype.keepNode=function(a){if(a){if(a.nodeType==3){return true}else{if(a.nodeType==1){if(a.nodeName.indexOf("#")==0||!this.isNodeVisible(a)){return false}return(typeof Evernote.Clip.NOKEEP_NODE_NAMES[a.nodeName.toLowerCase()]=="undefined"&&this.nodeFilter(a))}}}return false};Evernote.Clip.prototype.nodeFilter=function(a){if(typeof Evernote.Clip.nodeFilter=="function"){return Evernote.Clip.nodeFilter(a)}return true};Evernote.Clip.prototype.isNodeVisible=function(a){var b=this.getNodeStylePropertyValue(a,"display");return(b&&b!="none")};Evernote.Clip.prototype.isSelfClosingNode=function(a){return(a&&typeof Evernote.Clip.SELF_CLOSING_NODE_NAMES[a.nodeName.toLowerCase()]!="undefined")};Evernote.Clip.prototype.isListNode=function(a){return(a&&a.nodeType==1&&typeof Evernote.Clip.LIST_NODE_NAMES[a.nodeName.toLowerCase()]!="undefined")};Evernote.Clip.prototype.nodeAttributesToString=function(f){var g="";var d=f.attributes;if(d!=null){for(var e=0;e<d.length;e++){var b=d[e].nodeName.toLowerCase();var c=d[e].nodeValue;if(b=="href"&&c.toLowerCase().indexOf("javascript:")==0){continue}if(this.keepNodeAttr(b)&&c!=null&&c.length>0){g+=b+'="'+c+'" '}}}return g.replace(/\s+$/,"")};Evernote.Clip.prototype.translateNodeName=function(a){if(typeof Evernote.Clip.NODE_NAME_TRANSLATIONS[a.nodeName.toLowerCase()]!="undefined"){return Evernote.Clip.NODE_NAME_TRANSLATIONS[a.nodeName.toLowerCase()]}return a.nodeName};Evernote.Clip.prototype.getNodeStyle=function(c,b,a){return Evernote.ClipStyle.getNodeStyle(c,b,a)};Evernote.Clip.prototype.getNodeStylePropertyValue=function(c,d){if(c&&typeof c.nodeType=="number"&&c.nodeType==1&&typeof d=="string"){var g=c.ownerDocument;var a=null;try{a=(g.defaultView)?g.defaultView:this.window}catch(f){if(this._verboseLog){Evernote.logger.debug("Could not obtain parent window. Using default.")}a=this.window}if(typeof a.getComputedStyle=="function"){var b=a.getComputedStyle(c,null);return b.getPropertyValue(d)}else{if(typeof c.currentStyle=="object"&&c.currentStyle!=null){return c.currentStyle[d]}}}return null};Evernote.Clip.prototype.setStylingStrategy=function(a){if(typeof a=="function"&&Evernote.inherits(a,Evernote.ClipStylingStrategy)){this._stylingStrategy=new a(this.window)}else{if(a instanceof Evernote.ClipStylingStrategy){this._stylingStrategy=a}else{if(a==null){this._stylingStrategy=null}}}};Evernote.Clip.prototype.getStylingStrategy=function(){return this._stylingStrategy};Evernote.Clip.prototype.toString=function(){return"Clip["+this.location+"] "+this.title};Evernote.Clip.prototype.getLength=function(){var b=0;var c=this.toDataObject();for(var a in c){b+=(""+c[a]).length+a.length+2}b-=1;return b};Evernote.Clip.prototype.toDataObject=function(){return{content:this.content,title:this.title,url:this.location.href,fullPage:this.isFullPage()}};Evernote.ClipStyle=function(a,b){this.initialize(a,b)};Evernote.ClipStyle.stylePrefix=function(b){if(typeof b=="string"){var a=0;if((a=b.indexOf("-"))>0){return b.substring(0,a)}}return b};Evernote.ClipStyle.prototype.length=0;Evernote.ClipStyle.prototype.filter=null;Evernote.ClipStyle.prototype._verboseLog=false;Evernote.ClipStyle.prototype.initialize=function(b,c){if(c){this.setFilter(c)}try{if(CSSRuleList&&b instanceof CSSRuleList){if(b.length>0){for(var a=0;a<b.length;a++){this.addStyle(b[a].style)}}}else{if(typeof CSSStyleRule!="undefined"&&b instanceof CSSStyleRule){this.addStyle(b.style)}else{if(typeof CSSStyleDeclaration!="undefined"&&b instanceof CSSStyleDeclaration){this.addStyle(b)}else{if(typeof CSSCurrentStyleDeclaration!="undefined"&&b instanceof CSSCurrentStyleDeclaration){this.addStyle(b)}}}}}catch(d){Evernote.logger.debug("Error initializing Evernote.ClipStyle: "+d)}};Evernote.ClipStyle.prototype.addStyle=function(b){if(typeof CSSStyleDeclaration!="undefined"&&b instanceof CSSStyleDeclaration&&b.length>0){for(var a=0;a<b.length;a++){var d=b[a];if(typeof this.filter=="function"&&!this.filter(d)){continue}var c=b.getPropertyValue(d);if(typeof this[d]=="undefined"){this.length++}this[d]=c}}else{if(typeof CSSCurrentStyleDeclaration!="undefined"&&b instanceof CSSCurrentStyleDeclaration){for(var d in b){if(typeof this.filter=="function"&&!this.filter(d)){continue}this[d]=b[d]}}else{if(b instanceof Evernote.ClipStyle){for(var d in b){if(typeof this.constructor.prototype[d]=="undefined"){if(typeof this.filter=="function"&&!this.filter(d)){continue}this[d]=b[d]}}}else{if(typeof b=="object"&&b!=null){for(var a in b){if(typeof this.filter=="function"&&!this.filter(a)){continue}if(typeof b[a]!="function"&&typeof this.constructor.prototype[a]=="undefined"){if(typeof this[a]=="undefined"){this.length++}this[a]=b[a]}}}}}}};Evernote.ClipStyle.prototype.removeStyle=function(d,c){var a=this;function f(h,g){if(typeof a[h]!="undefined"&&typeof a.constructor.prototype[h]=="undefined"&&(typeof c=="function"||a[h]==g)){if(typeof c!="function"||(typeof c=="function"&&c(h,a[h],g))){if(delete (a[h])){a.length--}}}}if(typeof CSSStyleDeclaration!="undefined"&&d instanceof CSSStyleDeclaration&&d.length>0){for(var b=0;b<d.length;b++){var e=d[b];f(e,d.getPropertyValue(e))}}else{if(d instanceof Evernote.ClipStyle&&d.length>0){for(var e in d){f(e,d[e])}}}};Evernote.ClipStyle.prototype.removeStyleIgnoreValue=function(a){this.removeStyle(a,function(d,c,b){return true})};Evernote.ClipStyle.styleInArray=function(c,b){if(typeof c!="string"||!(b instanceof Array)){return false}var a=-1;var c=c.toLowerCase();var d=((a=c.indexOf("-"))>0)?c.substring(0,a).toLowerCase():c.toLowerCase();for(var a=0;a<b.length;a++){if(b[a]==c||b[a]==d){return true}}return false};Evernote.ClipStyle.prototype.deriveStyle=function(c,a,b){this.removeStyle(c,function(f,e,d){if(b instanceof Array&&Evernote.ClipStyle.styleInArray(f,b)){return false}return(typeof a[f]=="undefined"&&e==d)})};Evernote.ClipStyle.prototype.setFilter=function(a){if(typeof a=="function"){this.filter=a}else{if(a==null){this.filter=null}}};Evernote.ClipStyle.prototype.getFilter=function(){return this.filter};Evernote.ClipStyle.prototype.mergeStyle=function(c,b){if(c instanceof Evernote.ClipStyle&&c.length==0){for(var a in c){if(typeof this.constructor.prototype[a]!="undefined"){continue}if(typeof this[a]=="undefined"||b){this[a]=c[a]}}}};Evernote.ClipStyle.prototype.clone=function(){var b=new Evernote.ClipStyle();for(var a in this){if(typeof this.constructor.prototype[a]=="undefined"){b[a]=this[a]}}b.length=this.length;return b};Evernote.ClipStyle.prototype.toString=function(){var b="";if(this.length>0){for(var a in this){if(typeof this[a]!="string"||typeof this.constructor.prototype[a]!="undefined"||this[a].length==0){continue}b+=a+":"+this[a]+";"}}return b};Evernote.ClipStyle.getNodeStyle=function(f,d,c){var b=new Evernote.ClipStyle();if(f&&typeof f.nodeType=="number"&&f.nodeType==1){var h=f.ownerDocument;var a=null;try{a=(h.defaultView)?h.defaultView:window}catch(g){Evernote.logger.debug("Could not obtain default view... using default window");a=window}if(d){if(typeof a.getComputedStyle=="function"){b=new Evernote.ClipStyle(a.getComputedStyle(f,null),c)}else{if(typeof f.currentStyle=="object"&&f.currentStyle!=null){b=new Evernote.ClipStyle(f.currentStyle,c)}}}else{if(typeof a.getMatchedCSSRules=="function"){b=new Evernote.ClipStyle(a.getMatchedCSSRules(f),c)}else{try{if(typeof CSSStyleDeclaration!="undefined"&&f.style instanceof CSSStyleDeclaration&&f.style.length>0){b=new Evernote.ClipStyle(f.style,c)}}catch(g){}}}}return b};Evernote.SelectionFinder=function(a){this.initDocument=a;this.document=a};Evernote.SelectionFinder.prototype.initDocument=null;Evernote.SelectionFinder.prototype.document=null;Evernote.SelectionFinder.prototype.selection=null;Evernote.SelectionFinder.prototype.findNestedDocuments=function(g){var c=new Array();var h=null;var f=null;try{h=g.getElementsByTagName("frame")}catch(d){Evernote.logger.debug("Could not get all the frames in the document")}if(h.length>0){for(var b=0;b<h.length;b++){c.push(h[b].contentDocument)}}try{f=g.getElementsByTagName("iframe")}catch(d){Evernote.logger.debug("Could not get all iframes in document")}try{if(f.length>0){for(var b=0;b<f.length;b++){var a=f[b].contentDocument;if(a){c.push(a)}}}}catch(d){}return c};Evernote.SelectionFinder.prototype.reset=function(){this.document=this.initDocument;this.selection=null};Evernote.SelectionFinder.prototype.hasSelection=function(){if(Evernote.Clip.constants.isIE){return(this.selection&&this.selection.htmlText&&this.selection.htmlText.length>0)}var a=this.getRange();if(a&&(a.startContainer!=a.endContainer||(a.startContainer==a.endContainer&&a.startOffset!=a.endOffset))){return true}return false};Evernote.SelectionFinder.prototype.find=function(a){var b=this._findSelectionInDocument(this.document,a);this.document=b.document;this.selection=b.selection};Evernote.SelectionFinder.prototype.getRange=function(){if(!this.selection||this.selection.rangeCount==0){return null}if(typeof this.selection.getRangeAt=="function"){return this.selection.getRangeAt(0)}else{var a=this.document.createRange();a.setStart(this.selection.anchorNode,this.selection.anchorOffset);a.setEnd(this.selection.focusNode,this.selection.focusOffset);return a}return null};Evernote.SelectionFinder.prototype._findSelectionInDocument=function(j,k){var b=null;var h=false;var f=null;try{f=(j.defaultView)?j.defaultView:window}catch(g){Evernote.logger.debug("Could not retrieve default view... using default window");f=window}if(typeof f.getSelection=="function"){b=f.getSelection();if(b&&typeof b.rangeCount!="undefined"&&b.rangeCount>0){h=true}}else{if(f.selection&&typeof f.selection.createRange=="function"){b=f.selection.createRange();if(typeof f.selection.type=="Text"&&typeof b.htmlText=="string"&&b.htmlText.length>0){h=true}}else{if(j.selection&&j.selection.createRange){b=j.selection.createRange();if(typeof j.selection.type=="Text"&&typeof b.htmlText=="string"&&b.htmlText.length>0){h=true}}}}if(b&&!h&&k){Evernote.logger.debug("Empty range, trying frames");var c=this.findNestedDocuments(j);Evernote.logger.debug("# of nested docs: "+c.length);if(c.length>0){for(var d=0;d<c.length;d++){if(c[d]){Evernote.logger.debug("Trying nested doc: "+c[d]);var a=this._findSelectionInDocument(c[d],k);if(a&&a.selection&&a.selection.rangeCount>0){return a}}}}}return{document:j,selection:b}};Evernote.ClipStylingStrategy=function(a){this.initialize(a)};Evernote.ClipStylingStrategy.prototype._verboseLog=false;Evernote.ClipStylingStrategy.prototype.initialize=function(a){this.window=a};Evernote.ClipStylingStrategy.prototype.styleForNode=function(b,a){return null};Evernote.ClipStylingStrategy.prototype.getNodeStyle=function(c,b,a){return Evernote.ClipStyle.getNodeStyle(c,b,a)};Evernote.ClipTextStylingStrategy=function(a){this.initialize(a)};Evernote.inherit(Evernote.ClipTextStylingStrategy,Evernote.ClipStylingStrategy);Evernote.ClipTextStylingStrategy.FORMAT_NODE_NAMES={b:null,big:null,em:null,i:null,small:null,strong:null,sub:null,sup:null,ins:null,del:null,s:null,strike:null,u:null,code:null,kbd:null,samp:null,tt:null,"var":null,pre:null,listing:null,plaintext:null,xmp:null,abbr:null,acronym:null,address:null,bdo:null,blockquote:null,q:null,cite:null,dfn:null};Evernote.ClipTextStylingStrategy.STYLE_ATTRS={font:null,text:null,color:null};Evernote.ClipTextStylingStrategy.prototype.isFormatNode=function(a){return(a&&a.nodeType==1&&typeof Evernote.ClipTextStylingStrategy.FORMAT_NODE_NAMES[a.nodeName.toLowerCase()]!="undefined")};Evernote.ClipTextStylingStrategy.prototype.hasTextNodes=function(b){if(b&&b.nodeType==1&&b.childNodes.length>0){for(var a=0;a<b.childNodes.length;a++){if(b.childNodes[a].nodeType==3){if(this._verboseLog){Evernote.logger.debug("Node "+b.nodeName+" has text nodes")}return true}}}return false};Evernote.ClipTextStylingStrategy.prototype.styleFilter=function(b){var a=Evernote.ClipStyle.stylePrefix(b.toLowerCase());if(typeof Evernote.ClipTextStylingStrategy.STYLE_ATTRS[a]!="undefined"){return true}else{if(this._verboseLog){Evernote.logger.debug("Filter excluding: "+b)}}};Evernote.ClipTextStylingStrategy.prototype.styleForNode=function(c,a){var b=null;if(this.isFormatNode(c)||this.hasTextNodes(c)){b=this.getNodeStyle(c,true,this.styleFilter)}return b};Evernote.ClipFullStylingStrategy=function(a){this.initialize(a)};Evernote.inherit(Evernote.ClipFullStylingStrategy,Evernote.ClipStylingStrategy);Evernote.ClipFullStylingStrategy.ALWAYS_KEEP={"*":["font","text","color","margin","padding"],img:["width","height","border"],li:["list","margin","padding"],ul:["list","margin","padding"],dl:["margin","padding"],dt:["margin","padding"],h1:["margin","padding"],h2:["margin","padding"],h3:["margin","padding"],h4:["margin","padding"],h5:["margin","padding"],h6:["margin","padding"],h7:["margin","padding"],h8:["margin","padding"],h9:["margin","padding"],form:["height","width","margin","padding"]};Evernote.ClipFullStylingStrategy.prototype.styleForNode=function(f,a){var b=null;if(f&&f.nodeType==1){b=this.getNodeStyle(f,true);if(a){if(this._verboseLog){Evernote.logger.debug("Deriving style...")}var e=this.getNodeStyle(f,false);var d=this.getNodeStyle(a,true);var c=(typeof Evernote.ClipFullStylingStrategy.ALWAYS_KEEP[f.nodeName.toLowerCase()]!="undefined")?Evernote.ClipFullStylingStrategy.ALWAYS_KEEP[f.nodeName.toLowerCase()]:Evernote.ClipFullStylingStrategy.ALWAYS_KEEP["*"];b.deriveStyle(d,e,c)}}return b};Evernote.CSSSelector=function(a){this.initialize(a)};Evernote.CSSSelector.P_TAGNAME=1;Evernote.CSSSelector.P_TAGTYPE=2;Evernote.CSSSelector.P_ID=3;Evernote.CSSSelector.P_CLASS=4;Evernote.CSSSelector.P_START_ATTR=5;Evernote.CSSSelector.P_ATTR_KVSEP=6;Evernote.CSSSelector.P_END_ATTR=7;Evernote.CSSSelector.P_MODIFIER=8;Evernote.CSSSelector.fromString=function(a){return new Evernote.CSSSelector(a)};Evernote.CSSSelector.fromElement=function(f){var g=new Evernote.CSSSelector();if(typeof f.nodeName=="string"){g.tagName=f.nodeName.toLowerCase()}try{var b=f.attributes;for(var d=0;d<b.length;d++){var a=b[d];var c=a.name.toLowerCase();if(c=="id"&&a.value){g.id=a.value}else{if(c=="class"&&a.value){g.classes=a.value.replace(/\s+/," ").split(" ")}else{if(g.attributes instanceof Array){g.attributes.push({name:c,value:a.value})}else{g.attributes=[{name:c,value:a.value}]}}}}}catch(h){}return g};Evernote.CSSSelector.prototype.tagName=null;Evernote.CSSSelector.prototype.tagType=null;Evernote.CSSSelector.prototype.id=null;Evernote.CSSSelector.prototype.classes=null;Evernote.CSSSelector.prototype.attributes=null;Evernote.CSSSelector.prototype.modifier=null;Evernote.CSSSelector.prototype.initialize=function(a){if(typeof a=="string"){this.parse(a)}};Evernote.CSSSelector.prototype.reset=function(){this.tagName=null;this.tagType=null;this.id=null;this.classes=null;this.attributes=null;this.modifier=null};Evernote.CSSSelector.prototype.parse=function(e){var a=0;var d=Evernote.CSSSelector.P_TAGNAME;e=Evernote.trim(e);this.reset();while(a<e.length){var f=e.charAt(a);if(f==":"){d=(a==0)?Evernote.CSSSelector.P_TAGTYPE:Evernote.CSSSelector.P_MODIFIER}else{if(f=="#"){d=Evernote.CSSSelector.P_ID}else{if(f=="."){d=Evernote.CSSSelector.P_CLASS;if(!this.classes){this.classes=new Array()}this.classes.push("")}else{if(f=="["){d=Evernote.CSSSelector.P_START_ATTR;if(!this.attributes){this.attributes=new Array()}this.attributes.push({name:"",value:null})}else{if(f=="="&&d==Evernote.CSSSelector.P_START_ATTR){d=Evernote.CSSSelector.P_ATTR_KVSEP}else{if(f=="]"){d=Evernote.CSSSelector.P_END_ATTR}else{if(d==Evernote.CSSSelector.P_TAGTYPE){this.tagType=(this.tagType)?this.tagType+f:f}else{if(d==Evernote.CSSSelector.P_TAGNAME&&f!="*"){this.tagName=(this.tagName)?this.tagName+f.toLowerCase():f.toLowerCase()}else{if(d==Evernote.CSSSelector.P_ID){this.id=(this.id)?this.id+f:f}else{if(d==Evernote.CSSSelector.P_CLASS){this.classes[this.classes.length-1]+=f}else{if(d==Evernote.CSSSelector.P_START_ATTR){var b=this.attributes[this.attributes.length-1];b.name+=f.toLowerCase()}else{if(d==Evernote.CSSSelector.P_ATTR_KVSEP){var b=this.attributes[this.attributes.length-1];b.value=(b.value)?b.value+f:f}else{if(d==Evernote.CSSSelector.P_MODIFIER){this.modifier=(this.modifier)?this.modifier+f:f}}}}}}}}}}}}}a+=1}this.update()};Evernote.CSSSelector.prototype.update=function(){if(this.classes){Evernote.cleanArray(this.classes,function(a){return(typeof a!="string"||Evernote.trim(a).length==0)});if(this.classes.length==0){this.classes=null}else{this.classes.sort()}}if(this.attributes){Evernote.cleanArray(this.attributes,function(a){return(typeof a.name!="string"||Evernote.trim(a.name).length==0)});if(this.attributes.length==0){this.attributes=null}else{this.attributes.sort(function(d,c){return d.name>c.name})}}};Evernote.CSSSelector.prototype.getAttributeMap=function(){var a={};if(this.attributes){for(var b=0;b<this.attributes.length;b++){a[this.attributes[b].name]=this.attributes[b].value}}return a};Evernote.CSSSelector.prototype.appliesTo=function(a){var c=null;if(a instanceof Evernote.CSSSelector){c=a}else{if(typeof a=="string"){c=Evernote.CSSSelector.fromString(a)}else{if(typeof a=="object"&&a!=null&&typeof a.nodeName=="string"){c=Evernote.CSSSelector.fromElement(a)}else{c=new Evernote.CSSSelector()}}}if(this.tagName&&this.tagName!=c.tagName){return false}if(this.tagType!=c.tagType){return false}if(this.id&&(this.id!=c.id)){return false}if(this.classes&&c.classes){for(var b=0;b<this.classes.length;b++){if(c.classes.indexOf(this.classes[b])<0){return false}}}else{if(this.classes&&!c.classes){return false}}if(this.attributes&&c.attributes){var d=c.getAttributeMap();for(var b=0;b<this.attributes.length;b++){if(typeof d[this.attributes[b].name]=="undefined"){return false}}}else{if(this.attributes&&!c.attributes){return false}}if(this.modifier&&this.modifier!=c.modifier){return false}return true};Evernote.CSSSelector.prototype.toString=function(){var b="";if(this.tagType){b+=":"+this.tagType}else{if(this.tagName){b+=this.tagName}}if(this.id){b+="#"+this.id}if(this.classes&&this.classes.length>0){b+="."+this.classes.join(".")}if(this.attributes&&this.attributes.length>0){for(var a=0;a<this.attributes.length;a++){b+="["+this.attributes[a].name+"="+this.attributes[a].value+"]"}}if(this.modifier){b+=":"+this.modifier}return b};Evernote.Ajax={options:{async:true,type:"GET",data:null,success:null,error:null,context:null,complete:null,timeout:10000},getXhr:function(){if(window.XMLHttpRequest&&(window.location.protocol!=="file:"||!window.ActiveXObject)){return new window.XMLHttpRequest()}else{try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}}return null},doRequest:function(c){var d=Evernote.extend(true,{},this.options,((typeof c=="object"&&c!=null)?c:{}));var h=this.getXhr();h.open(d.type,d.url,d.async);d.context=(d.context)?d.context:this;var g=function(e,i,j){if(typeof d.success=="function"){d.success.apply(d.context,[e,i,j])}};var b=function(j,i,e){if(typeof d.error=="function"){d.error.apply(d.context,[j,i,e])}};var a=(typeof d.complete=="function")?d.complete:function(e,i){if(e.status==200){g(e.responseText,i,e)}else{b(e,i,null)}};if(d.async){h.onreadystatechange=function(){if(h.readyState==4){a(h,h.statusText)}}}if(d.timeout){setTimeout(function(){if(h&&h.readyState<4){h.abort();b(h,h.statusText,"timeout")}},d.timeout)}if(!d.async){try{h.send(d.data);a(h,h.statusText)}catch(f){b(h,h.statusText,f)}}else{try{h.send(d.data)}catch(f){b(h,h.statusText,f)}}},get:function(a){var b=(typeof a=="object"&&a!=null)?a:{};b.type="GET";this.doRequest(a)}};Evernote.CLIP_OPTIONS={url:null,title:null,signature:null,header:null,footer:null,content:null,contentId:null,contentUrl:null,filter:null,suggestTags:null,suggestNotebook:null,providerName:null,code:null,latitude:null,longitude:null,styling:Evernote.ClipTextStylingStrategy};Evernote.CLIP_WINDOW_ATTRIBUTES={windowUrl:"",windowName:"evernoteClipWindow",windowOptions:"width=500,height=480,scrollbars=yes,resizable=yes"};Evernote.CLIP_FORM_ATTRIBUTES={action:Evernote.Config.getClipUrl(),method:"post",enctype:"multipart/form-data",encoding:"multipart/form-data","accept-charset":"UTF-8",id:"evernoteClipForm",target:Evernote.CLIP_WINDOW_ATTRIBUTES.windowName};Evernote.extend=function(){var b=arguments;var d=false;var f=0;if(typeof b[0]=="boolean"){d=b[0];f=1}var e=b[f];for(var c=(f+1);c<b.length;c++){if(typeof b[c]=="object"&&b[c]!=null){for(var a in b[c]){if(typeof b[c][a]=="object"&&b[c][a]!=null&&d){Evernote.extend(true,(typeof e[a]!="undefined")?e[a]:{},b[c][a])}else{e[a]=b[c][a]}}}}return e};Evernote.trim=function(a){if(typeof a=="string"){return a.replace(/^[\s\t]+/,"").replace(/[\s\t]+$/,"")}return a};Evernote.cleanString=function(a){if(typeof a=="string"){return Evernote.trim(a)}return""};Evernote.concatArrays=function(){if(arguments.length<=1){return arguments[0]}var c=new Array();for(var d=0;d<arguments.length;d++){c.push(arguments[d])}if(typeof Array.prototype.concat=="function"){return c[0].concat.apply(c[0],c.slice(1))}else{for(var d=1;d<c.length;d++){var b=c[d];for(var e=0;e<b.length;e++){c[0].push(b[e])}}return c[0]}};Evernote.createClipForm=function(h,p){var b=Evernote.extend({},Evernote.CLIP_OPTIONS,(typeof p=="object"&&p!=null)?p:{});var f=document.createElement("form");for(var o in Evernote.CLIP_FORM_ATTRIBUTES){if(typeof Evernote.CLIP_FORM_ATTRIBUTES[o]=="function"){f.setAttribute(o,Evernote.CLIP_FORM_ATTRIBUTES[o]())}else{if(Evernote.CLIP_FORM_ATTRIBUTES[o]!=null){f.setAttribute(o,Evernote.CLIP_FORM_ATTRIBUTES[o])}}}f.style.display="none";var d=(b.url)?b.url:h.location.href;if(!d){d=document.location.href}var n=(b.title)?b.title:h.title;if(!n){n=document.title}var g={title:Evernote.cleanString(n),htmlTitle:Evernote.Clip.unicodeEntities(Evernote.cleanString(n)),url:Evernote.cleanString(d),suggestTags:Evernote.cleanString(b.suggestTags),suggestNotebook:Evernote.cleanString(b.suggestNotebook),code:Evernote.cleanString(b.code),providerName:Evernote.cleanString(b.providerName)};if(Evernote.Clip.constants.isIE){var k=["title","suggestTags","suggestNotebook","providerName"];for(var j=0;j<k.length;j++){g[k[j]]=Evernote.Clip.unicodeEntities(g[k[j]])}g.charset="htmlentities"}var m=parseFloat(b.latitude);var c=parseFloat(b.longitude);if(typeof m=="number"&&!isNaN(m)&&m>=-90&&m<=90&&typeof c=="number"&&!isNaN(c)&&c>=-180&&c<=180){g.latitude=m;g.longitude=c}if(h&&h instanceof Evernote.Clip){g.content=h.content}for(var j in g){var l=document.createElement("input");l.setAttribute("type","hidden");l.setAttribute("name",j);l.value=g[j];Evernote.logger.debug(l);f.appendChild(l)}return f};Evernote.createClip=function(options){var opts=Evernote.extend({},Evernote.CLIP_OPTIONS,(typeof options=="object"&&options!=null)?options:{});if(typeof opts.styling=="string"){switch(opts.styling.toLowerCase()){case"none":opts.styling=null;break;case"text":opts.styling=Evernote.ClipTextStylingStrategy;break;case"full":opts.styling=Evernote.ClipFullStylingStrategy;break;default:opts.styling=Evernote.ClipTextStylingStrategy}}var clip=new Evernote.Clip(window,opts.styling);if(typeof opts.filter=="function"){clip.nodeFilter=opts.filter}else{if(typeof opts.filter=="string"){try{var _noteit_temp_F=undefined;eval("var _noteit_temp_F = "+opts.filter);if(typeof _noteit_temp_F=="function"){clip.nodeFilter=_noteit_temp_F}}catch(e){}}}var contentElement=null;if(typeof opts.content=="string"){clip.content=opts.content}else{if(Evernote.Clip.isHtmlElement(opts.content)){clip.clipElement(opts.content)}else{if(typeof opts.contentId=="string"&&(contentElement=window.document.getElementById(opts.contentId))){clip.clipElement(contentElement)}else{if(typeof opts.contentUrl=="string"){Evernote.Ajax.get({url:opts.contentUrl,async:false,success:function(data,status,xhr){clip.content=data},error:function(xhr,status,error){alert("Error retrieving clip content!");clip.content=""}})}else{contentElement=document.getElementsByTagName("BODY")[0];if(contentElement){clip.clipElement(contentElement)}else{clip.clipLink(opts.url,opts.title)}}}}}if(opts.signature){if(typeof opts.signature=="string"){clip.content+="<hr/>"+opts.signature}else{if(Evernote.Clip.isHtmlElement(opts.signature)){var signatureClip=new Evernote.Clip(window,opts.styling);signatureClip.clipElement(opts.signature);if(signatureClip.content){clip.content+="<hr/>"+signatureClip.content}}}}if(opts.header){if(typeof opts.header=="string"){clip.content=opts.header+clip.content}else{if(Evernote.Clip.isHtmlElement(opts.header)){var headerClip=new Evernote.Clip(window,opts.styling);headerClip.clipElement(opts.header);if(headerClip.content){clip.content=headerClip.content+clip.content}}}}if(opts.footer){if(typeof opts.header=="string"){clip.content+=opts.footer}else{if(Evernote.Clip.isHtmlElement(opts.footer)){var footerClip=new Evernote.Clip(window,opts.styling);footerClip.clipElement(opts.footer);if(footerClip.content){clip.content+=footerClip.content}}}}return clip};Evernote.doClip=function(m){var b=(typeof m=="object"&&m!=null)?m:{};if(typeof b.content=="undefined"&&typeof b.contentId=="undefined"&&typeof b.contentUrl=="undefined"){if(typeof b.filter!="function"){b.filter=function(n){if(typeof event=="object"&&event!=null&&event.target&&n==event.target){return false}for(var e=0;e<Evernote.Clip.filterMarkers.length;e++){if(Evernote.containsElementId(n,Evernote.Clip.filterMarkers[e])||Evernote.containsElementClass(n,Evernote.Clip.filterMarkers[e])){return false}}return true}}var l=[];b.content=(typeof event=="object"&&event!=null&&event.target)?Evernote.findParent(event.target,function(n){if(!Evernote.isHtmlElement(n)){return false}for(var e=0;e<Evernote.Clip.contentMarkers.length;e++){if(Evernote.isElementVisible(n)&&b.filter(n)){if(Evernote.containsElementClass(n,Evernote.Clip.contentMarkers[e])){l.push(n)}if(Evernote.containsElementId(n,Evernote.Clip.contentMarkers[e])||Evernote.hasElementClass(n,Evernote.Clip.contentMarkers[e])){b.styling="full";return true}}}return false}):document.getElementsByTagName("BODY")[0];if(!b.content&&l.length>0){b.content=l[l.length-1]}else{if(l.length>0){var h=l[l.length-1];var d=Evernote.getElementClassNames(h);var j=Evernote.findChildren(b.content,function(n){for(var e=0;e<d.length;e++){if(Evernote.hasElementClass(n,d[e])){return true}}return false},true);if(j.length>1){b.content=h}}}}var g=Evernote.createClip(b);var f=document.getElementById(Evernote.CLIP_FORM_ATTRIBUTES.id);if(f){f.parentNode.removeChild(f)}var c=Evernote.createClipForm(g,b);var i=document.getElementsByTagName("body")[0];var a=window.open(Evernote.CLIP_WINDOW_ATTRIBUTES.windowUrl,Evernote.CLIP_WINDOW_ATTRIBUTES.windowName,Evernote.CLIP_WINDOW_ATTRIBUTES.windowOptions);if(i){var f=document.getElementById(Evernote.CLIP_FORM_ATTRIBUTES.id);if(typeof f=="object"&&f!=null&&typeof f.parentNode=="object"&&typeof f.parentNode!=null){f.parentNode.removeChild(f)}i.appendChild(c);c.submit();try{a.window.focus()}catch(k){}}};
