function startTyntLiteApp() {
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};String.prototype.wordCount=function(){var A=this.trim();return(A?A.split(/\s+/i).length:0);};function typeOfObject(A){if(typeof A=="undefined"||(typeof A=="object"&&!A)){return false;}var B=typeof A;if(B=="object"||B=="function"){switch(A.constructor){case Array:return"array";case RegExp:return"regexp";default:break;}}return B;}var FORM_CHARSET='<input type="hidden" name="_charset_" value=""> ';var toFormHTML=function(G,C,H){var B="";var F="";for(var D in G){if(!C){C="";H=0;}var A=D;if(H>0){A="["+D+"]";}if(typeOfObject(G[D])=="object"){B+=toFormHTML(G[D],C+A,H+1);}else{var E=((typeof G[D]==="undefined")?"undefined":(G[D]===null?"null":G[D].toString().replace(/"/g,"&quot;")));B+=F+'<input type="hidden" name="'+C+A+'" value="'+E+'">';}F=" ";}return B;};var getValuesFromUri=function(E){if(!E){return{};}var F=E.substring(E.indexOf("?")+1);var A={};var B=F.split("&");for(var C=0;C<B.length;C++){var D=B[C].split("=");A[D[0]]=D[1];}return A;};var windowSelection={};windowSelection.capture=function(){if(typeof window.getSelection!="undefined"){this.selection=window.getSelection();}else{this.selection=document.selection;}return this;};windowSelection.empty=function(){if(this.selection&&typeof this.selection.empty!="undefined"){this.selection.empty();}};var TraceLiteServer={};TraceLiteServer.WRITE_URL="http://wau.tynt.com";var userId;var threeLastSelectionStrings=[];var httpRequestCurrentId=0;var COPY_WITH_NO_ATTRIBUTION=1,IMAGE=3;var createHttpPostCallback=function(A){return function(B){window.setTimeout(function(){gotFrameResult(A);},0);};};var httpPost=function(C,G,H){var A=document.getElementsByTagName("body")[0];var B="TyntLiteIframe"+httpRequestCurrentId;var E;try{E=document.createElement('<iframe name="'+B+'">');}catch(D){E=document.createElement("iframe");}E.style.display="none";E.style.height=0;E.id=B;E.name=B;A.appendChild(E);if(window.addEventListener){E.addEventListener("load",createHttpPostCallback(httpRequestCurrentId),false);}else{E.attachEvent("onload",createHttpPostCallback(httpRequestCurrentId));}var F=document.createElement("form");F.style.display="none";F.style.height=0;F.id="TyntLiteForm"+httpRequestCurrentId;F.action=C;F.method="POST";F.target=E.name;F.acceptCharset="utf-8";F.innerHTML=FORM_CHARSET+toFormHTML(G);A.appendChild(F);F.submit();httpRequestCurrentId++;};var gotFrameResult=function(A){var B=document.getElementById("TyntLiteForm"+A);if(B){B.parentNode.removeChild(B);}var C=document.getElementById("TyntLiteIframe"+A);if(C){C.parentNode.removeChild(C);}};var getTracerScriptUri=function(){var A=document.getElementsByTagName("script");for(var B=0;B<A.length;B++){if(/\/tyntlite.*\?/i.test(A[B].src)){return A[B].src;}}return null;};var handleImageDragCopy=(function(B){var C;var A=function(F){var E=F.target||F.srcElement;if(E!=C){if(window.addEventListener){document.removeEventListener("dragexit",A,false);window.removeEventListener("dragleave",A,false);}else{document.getElementsByTagName("body")[0].attachEvent("ondragleave",A);}var D=true;handleTracing(C,D);}return true;};return function(D){C=D.target||D.srcElement;if(window.removeEventListener){document.removeEventListener("dragexit",A,false);window.removeEventListener("dragleave",A,false);}else{document.getElementsByTagName("body")[0].detachEvent("ondragleave",A);}if(C.nodeName=="IMG"){if(window.addEventListener){document.addEventListener("dragexit",A,false);window.addEventListener("dragleave",A,false);}else{document.getElementsByTagName("body")[0].attachEvent("ondragleave",A);}}return true;};})();var handleImageCopyThruContextMenu=(function(C){var B;var A=function(E){window.removeEventListener("blur",A,false);var D=true;handleTracing(B,D);return true;};return function(D){B=D.target||D.srcElement;window.removeEventListener("blur",A,false);if(B.nodeName=="IMG"&&B.parentNode.nodeName!="A"){window.addEventListener("blur",A,false);window.setTimeout(function(){document.removeEventListener("blur",A,false);},10000);}return true;};})();var eventHandler=function(B){var C=B.target||B.srcElement||sel.selection.getRangeAt(0).startContainer;var A=(B.type=="copy");handleTracing(C,A);};var startListeningForTraces=function(){if(window.addEventListener){if(!window.navigator.userAgent.match("Firefox/2")){document.getElementsByTagName("body")[0].addEventListener("copy",eventHandler,false);}document.addEventListener("mouseup",eventHandler,false);document.addEventListener("mousedown",handleImageDragCopy,false);document.addEventListener("contextmenu",handleImageCopyThruContextMenu,false);}else{document.getElementsByTagName("body")[0].attachEvent("oncopy",eventHandler);document.getElementsByTagName("body")[0].attachEvent("onmouseup",eventHandler);document.getElementsByTagName("body")[0].attachEvent("onmousedown",handleImageDragCopy);}};var selectionStringIsNew=function(B){if(B==null||B.trim().length==0){return false;}for(var A=threeLastSelectionStrings.length-1;A>=0;A--){if(threeLastSelectionStrings[A]==B){return false;}}threeLastSelectionStrings.unshift(B);if(threeLastSelectionStrings.length>3){threeLastSelectionStrings.pop();}return true;};var documentTitle=function(){return(document.title||window.location.hostname).trim().replace(new RegExp(window.location.hash,"g"),"");};var handleTracing=(function(){var D;var C=null;var B=function(){C=(typeof D.selection.toString!="undefined")?D.selection.toString():document.selection.createRange().text;};var A=function(E){if(selectionStringIsNew(C)){var F={url:window.location.href.replace(/#ixzz=?.*$/,""),site_guid:userId,word_count:C.wordCount(),name:documentTitle(),trace_type:E,content:C};httpPost(TraceLiteServer.WRITE_URL+"/traces",{trace:F},function(){});}return null;};return function(F,E){D=windowSelection.capture();var G=F.src;if(G&&E){C=G;A(IMAGE);}else{if(E&&C){A(COPY_WITH_NO_ATTRIBUTION);}else{if(E){B();A(COPY_WITH_NO_ATTRIBUTION);}else{B();}}}return true;};})();var scriptValues=getValuesFromUri(getTracerScriptUri());userId=scriptValues.user;startListeningForTraces();}
function tyntLitedocumentIsReady() {
    var html = document.getElementsByTagName('html')[0];
    return !(!html || !document.getElementsByTagName('body')[0] || !html.innerHTML || html.innerHTML.toLowerCase().indexOf('</body>') == -1 || (typeof document.readyState == 'string' && document.readyState != 'complete')); // Overly cautious
}

function tyntLiteLoader() {
    window.setTimeout(tyntLitedocumentIsReady() ? startTyntLiteApp : tyntLiteLoader, 10);
}

tyntLiteLoader();

