var wordList,f21s=[],regExpMetaChar=new Array("\\","[","]","^","$",".","|","?","*","+","(",")"),myGlobal,stopWords,stopChars,dataForUser;
function f63(){$("#makeAWordCloudTips").show();$("#makeAWordCloudWrapper").show();f99();f33();f32();f36();f81();$("input.number.positive").bind("focus",f74);$("input.number.positive").bind("blur",f73);f62();$("#newWordCloudSectionWrapper").show();f89();f80();$("#wcTarget").css("left",$("#newWordCloud").offset().left+$("#newWordCloud").innerWidth()/2-25+parseInt($("#wctxpx").text()));
$("#wcTarget").css("top",$("#newWordCloud").offset().top+$("#newWordCloud").innerHeight()/2-25-parseInt($("#wctypx").text()));$("#xSetTarget").click(function(){f97();return false});$("#newWordCloudSectionWrapper").hide();$("#makeAWordCloudWrapper").css("min-height",window.screen.availHeight/2);f78();$("div.makeAWordCloudSection").hide();$("#open_textInputSection").click();f4()}
function f10(){f19("#iFontFamily");f19("#iVaryFontColourHow");f79();Math.random()>0.8&&$("#iMaxNoColours").text(0)}
function f97(){$("#newWordCloud,#wcTarget").css("cursor","crosshair");$("#newWordCloud a").hide();$("#setTargetTip").show();$("#wcTarget").show();$("#newWordCloud,#wcTarget").bind("click.setTarget",function(a){$("#wcTarget").css("left",a.pageX-25);$("#wcTarget").css("top",a.pageY-25);$("#wctxpx").text(Math.round(a.pageX-$("#newWordCloud").offset().left-$("#newWordCloud").innerWidth()/2));$("#wctypx").text(-1*Math.round(a.pageY-$("#newWordCloud").offset().top-$("#newWordCloud").innerHeight()/
2));setTimeout("f37()",100);f43();return false});$("body").not("#newWordCloud,#wcTarget").bind("click.bSetTarget",function(){f37();return false})}function f37(){$("#newWordCloud").css("cursor","");$("#setTargetTip").hide();$("#newWordCloud a").show();$("#wcTarget").hide();$("#newWordCloud,#wcTarget").unbind("click.setTarget");$("body").unbind("click.bSetTarget")}
function f24(a){f12(false,"f27","f26",0,"f25",a)}
function f27(){wordList=[];var a=$("#originalSourceInput").attr("value"),b=$.trim(a),d,c;d=b.match(/[\t,:]\s*[0-9]+\s*$/gim);d=d==null?1:d.length;c=b.match(/\n/gim);c=c==null?1E3:c.length+1;if(b==""){f61("Please insert some text");$("#originalSourceInput").focus();$("#everywhere").addClass("f12Stop");return false}else if($("#originalSourceInput").hasClass("googleReady")&&b.search(/\s/)<0&&b.length<2E3){$("#everywhere").addClass("f12Pause");google.feeds.lookupFeed(b,function(e){if(e.error||
e.url==null){$("#everywhere").removeClass("f12Pause");f28(" "+a.replace(/[,:]/g," ")+" ")}else{e=new google.feeds.Feed(e.url);e.setNumEntries(20);e.load(function(f){$("#everywhere").removeClass("f12Pause");if(f.error||f.feed.entries==null||f.feed.entries.length==0){alertModal("Error retrieving web page<br />"+f.error.message);$("#everywhere").addClass("f12Stop")}else{for(var g=document.createElement("div"),i=" ",h=0;h<f.feed.entries.length;h+=1){i+=f.feed.entries[h].title+
" ";g.innerHTML=f.feed.entries[h].content;i+=$(g).text()+" "}dataForUser={};dataForUser.wordCloudTitle=f.feed.title;dataForUser.wordCloudDescription=f.feed.description;dataForUser.relatedUrl=b;$("#newWordCloudSectionWrapper").removeClass("firstRun");f28(" "+i+" ")}})}})}else if(d==c){myGlobal.dataIsATable=true;myGlobal.deliminator=":";c=b.match(/\t\s*[0-9]+\s*$/gim);if(c!=null)if(c.length==d)myGlobal.deliminator="\t";c=b.match(/,\s*[0-9]+\s*$/gim);if(c!=null)if(c.length==d)myGlobal.deliminator=
",";c=b.match(/:\s*[0-9]+\s*$/gim);if(c!=null)if(c.length==d)myGlobal.deliminator=":";f28(" "+b+" ")}else f28(" "+a+" ")}
function f28(a){f9();if(myGlobal.dataIsATable)myGlobal.wordArraySourceText=a.split("\n");else{myGlobal.nbsps=$("#taReplaceWithNbsp").val();var b=stopWords;b=b.replace(/\s+/g," ");b=b.toLowerCase();b=f90(b);myGlobal.stopWordsArray=b.split(" ");myGlobal.stopWordsArray.sort(f104);myGlobal.stopWordsArray.sort(f105);myGlobal.currentStopWord=0;a=f90(a);myGlobal.icase=$("#iCase").text();myGlobal.wordArraySourceText=a.split(" ");
if(!$("#newWordCloudSectionWrapper").hasClass("sentenceNotFreq")){myGlobal.wordArraySourceText.sort(f104);myGlobal.wordArraySourceText.sort(f105)}a=$("#iMinLetters").text();myGlobal.minLetters=parseInt(a)}}
function f26(a){if(myGlobal.dataIsATable){var b=myGlobal.wordArraySourceText[a].split(myGlobal.deliminator);if(b.length==2){var d=new f3($.trim(b[0]),b[1]);wordList.push(d)}return myGlobal.wordArraySourceText.length==a+1?false:a+1}else if(a<myGlobal.wordArraySourceText.length){if(myGlobal.wordArraySourceText[a].length>=myGlobal.minLetters){for(b=true;myGlobal.stopWordsArray[myGlobal.currentStopWord]<myGlobal.wordArraySourceText[a].toLowerCase();)myGlobal.currentStopWord+=
1;if(myGlobal.stopWordsArray[myGlobal.currentStopWord]==myGlobal.wordArraySourceText[a].toLowerCase())b=false;if(myGlobal.wordArraySourceText[a].toLowerCase()=="")b=false;for(var c=a;c+1<myGlobal.wordArraySourceText.length&&myGlobal.wordArraySourceText[c]==myGlobal.wordArraySourceText[c+1];)c+=1;var e=new RegExp("["+myGlobal.nbsps+"]","g");d=myGlobal.wordArraySourceText[a].replace(e,String.fromCharCode(160));d=new f3(d,c-a+1);for(b&&wordList.push(d);c+1<myGlobal.wordArraySourceText.length&&
myGlobal.wordArraySourceText[c].toLowerCase()==myGlobal.wordArraySourceText[c+1].toLowerCase();){for(c=a=c+1;c+1<myGlobal.wordArraySourceText.length&&myGlobal.wordArraySourceText[c]==myGlobal.wordArraySourceText[c+1];)c+=1;if(b){d=myGlobal.wordArraySourceText[c].replace(e,String.fromCharCode(160));wordList[wordList.length-1].include(d,c-a+1)}}wordList.length>0&&wordList[wordList.length-1].chooseSetCase(myGlobal.icase);a=c}return a+1}else return false}
function f25(){wordList.length<100||myGlobal.dataIsATable?$("#iMaxWords").text(wordList.length):$("#iMaxWords").text("100");$("#ubNoWords").text(wordList.length);if(wordList.length>0){var a=wordList.sort(f106);$("#ubFreq").text(a[0].frequency);if(a[0].frequency==1&&$("#newWordCloudSectionWrapper").hasClass("firstRun")){f61("No repeated words: changing default settings to simple sentence");$("#iVaryFontSizeWith").text("Randomly");$("#iPlaceOrder").text("Randomly");
stopWords=" ";$("#taStopWords").val(stopWords);stopChars=" ";$("#taStopChars").val(stopChars);$("#iMinLetters").text("0");$("#newWordCloudSectionWrapper").removeClass("firstRun").addClass("sentenceNotFreq");setTimeout("f24('f43()');",50);return false}else $("#newWordCloudSectionWrapper").removeClass("firstRun");$("#newWordCloudSectionWrapper").hasClass("sentenceNotFreq")||f110(true);a=parseInt($("#iMaxWords").text());for(var b=0;b<a;b+=1)wordList[b].display=true;$("#iMinFrequency").text(wordList[a-
1].frequency-1)}myGlobal.dataIsATable==true?$("#tableSettingsNotification").show():$("#tableSettingsNotification").hide();$("#newWordList").empty();return true}
function f90(a){var b;a=a.replace(/[ \f\n\r\t\v\u2028\u2029]/g," ");var d=stopChars.replace(/\s/g,"");b="["+myGlobal.nbsps+"]";b=new RegExp(b,"g");d=d.replace(b,"");if(d=="")return a;for(b=0;b<regExpMetaChar.length;b+=1){var c="\\".concat(regExpMetaChar[b]);d=d.replace(regExpMetaChar[b],c)}b=" [";b=b.concat(d);b=b.concat("]*");b=new RegExp(b,"gi");a=a.replace(b," ");b="[";b=b.concat(d);b=b.concat("]* ");b=new RegExp(b,"gi");a=a.replace(b," ");b="[";b+=String.fromCharCode(8216);b+=String.fromCharCode(8217);
b=b.concat("]");b=new RegExp(b,"gi");a=a.replace(b,"'");return a=a.replace(/[ \f\n\r\t\v\u2028\u2029]+/g," ")}function f103(a,b){$("#everywhere").show();f110(a);f47(b)}function f113(){f47()}function f47(a){f12(false,"f50","f49",0,"f48",a)}
function f50(){if($("#showAllWords").hasClass("showAllWords")){myGlobal.showAllWords=true;$("#showAllWords").removeClass("showAllWords")}$("#newWordList").empty();$("#wordListEntryInfo").hide();var a=$("#iMinFrequency").text();myGlobal.minFrequency=parseInt(a);a=$("#iMaxWords").text();myGlobal.maxWords=parseInt(a);myGlobal.noWords=0;if($("#wordListSettingsSection:visible").length>0)myGlobal.printItOut=true}
function f49(a){if(a<wordList.length){var b="";if(wordList[a].forceExclude==true){b=" excluded";wordList[a].display=false}else wordList[a].display=wordList[a].frequency<myGlobal.minFrequency||myGlobal.noWords>=myGlobal.maxWords?false:true;if(wordList[a].forceInclude==true){b=" included";wordList[a].display=true}if(myGlobal.printItOut==true){if(wordList[a].display)b=b.concat(" display");if(myGlobal.showAllWords==true&&myGlobal.noWords>=myGlobal.maxWords&&a>=1E3)return a+1;if(myGlobal.showAllWords!=
true&&wordList[a].display==false&&myGlobal.noWords>=myGlobal.maxWords&&a>2*myGlobal.noWords)return a+1;if(myGlobal.showAllWords!=true&&wordList[a].display==false&&myGlobal.minFrequency>2*wordList[a].frequency)return a+1;if(myGlobal.showAllWords==true&&wordList[a].display==false&&myGlobal.minFrequency>4*wordList[a].frequency)return a+1;$("#newWordList").append(" <a class='"+b+"' id='listEntry"+a+"'> "+wordList[a].text+"</a>")}if(wordList[a].display==true)myGlobal.noWords+=1;return a+1}else return false}
function f48(){if(myGlobal.printItOut==true){f17();$("#newWordList>a.altered").removeClass("altered");if(wordList.length>$("#newWordList>a").length)if(myGlobal.showAllWords==true)$("#newWordList").append("<a id='showAllWords' title='Too many words to show'> ... </a> ");else{$("#newWordList").append("<a id='showAllWords' title='Show more words'> ... </a> ");$("#newWordList").ready(function(){$("#showAllWords").bind("click",function(){$(this).addClass("showAllWords");
f47();return false})})}$("#newWordList>a").not("#showAllWords").mouseover(function(){if($("#wlCustAlt").hasClass("focussed")==false){clearTimeout(myTimeOut);$("#newWordList>a.current").removeClass("current");$(this).addClass("current");var a=parseInt($(this).attr("id").replace("listEntry",""));$("#wlFreq").text(wordList[a].frequency);var b="";a=wordList[a].getEquivalentTexts();for(var d=0;d<a.length;d+=1){var c="<a";if(a[d]==$.trim($(this).text()))c="<a class='currentSelection'";
b=b.concat(c+">"+a[d]+"</a> ")}$("#wlAlts").empty();$("#wlAlts").append(b);$("#wlCustAlt").val($.trim($(this).text()));$("#wlCustAlt").css("width",$("#wlCustAlt").val().length+"em");f94($(this));$("#wordListEntryInfo").css("left",$(this).position().left-$(this).position().left/$("body").width()*$("#wordListEntryInfo").width());$("#wordListEntryInfo").css("top",$(this).position().top+$(this).innerHeight()).show()}return false})}return true}
function f78(){$("#newWordListWrapper").bind("mouseleave",function(){$("#wlCustAlt").hasClass("focussed")==false&&f59();return false});$("#wlAlts a").live("click",function(){var a=$("#newWordList>a.current"),b=parseInt(a.attr("id").replace("listEntry",""));if(wordList[b].text!=$.trim($(this).text())){a.text($.trim($(this).text()));wordList[b].text=a.text();$("#newWordList>a.current").addClass("altered")}$(this).siblings().filter(".currentSelection").removeClass("currentSelection");
$(this).addClass("currentSelection")});$("#wlCustAlt").focus(function(){$(this).addClass("focussed");return false});$("#wlCustAlt").blur(function(){$(this).removeClass("focussed");var a=$("#newWordList>a.current"),b=parseInt(a.attr("id").replace("listEntry","")),d=$.trim($(this).val());if(wordList[b].text!=d)if(d!=""){a.text(d);wordList[b].text=d;$("#iPlaceOrder").text()=="Alphabetical order"&&$("#newWordList").addClass("altered");$("#newWordList>a.current").addClass("altered")}return false});$("#wlCustAlt").bind("keypress",
function(){$("#wlCustAlt").css("width",$("#wlCustAlt").val().length+"em")});$("#wlClude").bind("click",function(){var a=$("#newWordList>a.current");if(a.length==0)return false;var b=parseInt(a.attr("id").replace("listEntry",""));if($(a).hasClass("display")==true){$(a).removeClass("display");if($(a).hasClass("included")){wordList[b].forceInclude=false;$(a).removeClass("included")}else{$(a).addClass("excluded");wordList[b].forceExclude=true}wordList[b].display=false}else{$(a).addClass("display");if($(a).hasClass("excluded")){$(a).removeClass("excluded");
wordList[b].forceExclude=false}else{wordList[b].forceInclude=true;$(a).addClass("included")}wordList[b].display=true}f17();f94(a);$(a).addClass("altered");return false})}
function f94(a){if($(a).hasClass("display")){$("#wlClude").text("Remove");$("#wlClude").attr("title","Remove this from the word cloud");$("#wlClude").removeClass("positive").addClass("negative")}else{$("#wlClude").text("Include");$("#wlClude").attr("title","Include this in the word cloud");$("#wlClude").removeClass("negative").addClass("positive")}}
function f59(a,b){$("#wordListEntryInfo").css("display","none");$("#newWordList>a.current").removeClass("current");$("#newWordList>a.altered").removeClass("altered");if($("#newWordList").hasClass("altered")||a==true){f103(false,b);$("#newWordList").removeClass("altered")}return false}function f43(){f12(true,"f46","f45",0,"f44","")}
function f46(){$("#omittedWordsSection").hide();$("#omittedWords").empty();$("#newWordCloud").empty();f21s=[];myGlobal.W=$("#newWordCloud").innerWidth();myGlobal.H=$("#newWordCloud").innerHeight();myGlobal.targetX=parseInt($("#wctxpx").text());myGlobal.targetY=parseInt($("#wctypx").text());myGlobal.canvasPadding=parseInt($("#iCanvasBorder").val());myGlobal.standardFontSize=parseInt($("#iStandardFontSize").val());myGlobal.varyFontSize=parseInt($("#iVaryFontSize").val());myGlobal.varyFontSizeWith=
$("#iVaryFontSizeWith").text();myGlobal.varyFontColourWith=$("#iVaryFontColourWith").text();myGlobal.standardFontColour=$("#iStandardFontColour").css("background-color");myGlobal.varyFontColour=$("#iVaryFontColour").css("background-color");myGlobal.standardFontColour=$.RGB(myGlobal.standardFontColour);myGlobal.varyFontColour=$.RGB(myGlobal.varyFontColour);f53(myGlobal.varyFontSizeWith,myGlobal.varyFontColourWith);myGlobal.maxNoColours=$("#iMaxNoColours").text();$("#wctnWords").text(myGlobal.includedWords.length);
myGlobal.varyFontColourHow=$("#iVaryFontColourHow").text();if(myGlobal.varyFontColourHow=="Rainbow"&&myGlobal.varyFontColourWith!="No variation"){var a=f54(myGlobal.standardFontColour,myGlobal.varyFontColour);myGlobal.standardX=a[0];myGlobal.varyX=a[1];myGlobal.minColour=a[2];myGlobal.maxColour=a[3]}$("#newWordCloud").css("background-color",$("#canvasColour").css("background-color"));myGlobal.fontFamily=$("#iFontFamily").text()}
function f45(a){if(a<myGlobal.includedWords.length){var b,d,c=myGlobal.includedWords[a],e=$("#newWordCloud").append("<a id='cp"+f21s.length+"' title='"+f69(wordList[c].text)+"' class='cloudword'>"+f69(wordList[c].text)+"</a>").children().filter(":last");if(myGlobal.varyFontSizeWith=="No variation")b=myGlobal.standardFontSize;else{switch(myGlobal.varyFontSizeWith){case "Count":b=wordList[c].frequency;break;case "Level":b=wordList[c].level;break;
case "Randomly":b=Math.random();break}b=myGlobal.varyFontSize+(myGlobal.standardFontSize-myGlobal.varyFontSize)*(b-myGlobal.varyFontSizeFactor)/(myGlobal.standardFontSizeFactor-myGlobal.varyFontSizeFactor);b=Math.round(b)}if(isNaN(b))b=myGlobal.standardFontSize;var f=b*0.5;if(myGlobal.fontFamily=="Gruenewald-VA")b*=1.6;else if(myGlobal.fontFamily=="Isabella"||myGlobal.fontFamily=="Jura")b*=1.2;var g=b*0.5;e.css("font-size",b+"px");e.addClass(myGlobal.fontFamily);for(var i=e.width(),h=e.height(),j=
[],l=0;l<f21s.length;l+=1){var k=new f111(f21s[l].l-i/2-g,f21s[l].r+i/2+g,f21s[l].t+f,f21s[l].b-f);j.push(k)}f=[];g=new f0(-myGlobal.W/2+myGlobal.canvasPadding+i/2,myGlobal.W/2-myGlobal.canvasPadding-i/2,myGlobal.H/2-myGlobal.canvasPadding-h/2,-myGlobal.H/2+myGlobal.canvasPadding+h/2);f.push(g);l=g.r-g.l;for(g=0;g<j.length;g+=1)f=f6(j[g],f);if(f.length==0){$("#omittedWords").append("<span>"+e.text()+"; </span>");e.remove();
return a+1}j=myGlobal.targetX;g=myGlobal.targetY;k=0;f[0].calcMinDistanceTo(myGlobal.targetX,myGlobal.targetY);for(j=1;j<f.length;j+=1){f[j].calcMinDistanceTo(myGlobal.targetX,myGlobal.targetY);if(f[j].minDistance<f[k].minDistance)k=j}if(f[k].r-f[k].l==l){g=Math.random();j=f[k].xNearest+g*i-i/2;if(j>f[k].r)j=f[k].r;else if(j<f[k].l)j=f[k].l}else j=f[k].xNearest;if(f[k].yNearest==myGlobal.targetY){g=Math.random();g=f[k].yNearest+g*h-h/2;if(g>f[k].t)g=f[k].t;else if(g<f[k].b)g=f[k].b}else g=f[k].yNearest;
j=Math.round(j);g=Math.round(g);if(myGlobal.varyFontColourWith=="No variation")d="rgb("+myGlobal.standardFontColour[0]+","+myGlobal.standardFontColour[1]+","+myGlobal.standardFontColour[2]+")";else{switch(myGlobal.varyFontColourWith){case "Count":d=wordList[c].frequency;break;case "Level":d=wordList[c].level;break;case "Randomly":d=Math.random();if(myGlobal.maxNoColours!=0){d=Math.round(d*(myGlobal.maxNoColours-1));d=myGlobal.maxNoColours>1?myGlobal.varyFontColourFactor+d*(myGlobal.standardFontColourFactor-
myGlobal.varyFontColourFactor)/(myGlobal.maxNoColours-1):1}break}if(myGlobal.varyFontColourHow=="Rainbow"){d=myGlobal.varyX+(myGlobal.standardX-myGlobal.varyX)*(d-myGlobal.varyFontColourFactor)/(myGlobal.standardFontColourFactor-myGlobal.varyFontColourFactor);f=myGlobal.minColour+(Math.sin(d+0)+1)/2*(myGlobal.maxColour-myGlobal.minColour);l=myGlobal.minColour+(Math.sin(d+4*Math.PI/3)+1)/2*(myGlobal.maxColour-myGlobal.minColour);d=myGlobal.minColour+(Math.sin(d+2*Math.PI/3)+1)/2*(myGlobal.maxColour-
myGlobal.minColour)}else{f=myGlobal.varyFontColour[0]+(myGlobal.standardFontColour[0]-myGlobal.varyFontColour[0])*(d-myGlobal.varyFontColourFactor)/(myGlobal.standardFontColourFactor-myGlobal.varyFontColourFactor);l=myGlobal.varyFontColour[1]+(myGlobal.standardFontColour[1]-myGlobal.varyFontColour[1])*(d-myGlobal.varyFontColourFactor)/(myGlobal.standardFontColourFactor-myGlobal.varyFontColourFactor);d=myGlobal.varyFontColour[2]+(myGlobal.standardFontColour[2]-myGlobal.varyFontColour[2])*(d-myGlobal.varyFontColourFactor)/
(myGlobal.standardFontColourFactor-myGlobal.varyFontColourFactor)}f=Math.round(f);l=Math.round(l);d=Math.round(d);d="rgb("+f+","+l+","+d+")";if(isNaN(f))d="rgb("+myGlobal.standardFontColour[0]+","+myGlobal.standardFontColour[1]+","+myGlobal.standardFontColour[2]+")"}c=new f21(wordList[c].text,b,i,h,j,g);c.rgb=$.RGB(d);c.fontFamily=myGlobal.fontFamily;e.css("color",d);c.left=myGlobal.W/2+c.l;c.top=myGlobal.H/2-c.t;e.css("left",c.left);e.css("top",c.top);f21s.push(c);$("#wcnWords").text(f21s.length);
$("#wcpcWords").text(Math.round(100*f21s.length/myGlobal.includedWords.length));e.fadeIn("slow");return a+1}else return false}
function f44(){$("#omittedWords span").length>0&&$("#omittedWordsSection").slideDown();myGlobal.includedWords.length>f21s.length?$("#wcnWords").addClass("warning"):$("#wcnWords").removeClass("warning");$("#newWordCloud").removeClass("saved");if($("#newWordCloud").hasClass("freshCloud")){$("#newWordCloud").addClass("randomSettings");$("#newWordCloud").removeClass("freshCloud")}$("#newWordCloudSectionWrapper").removeClass("firstRun");$("#newWordCloudSectionWrapper").removeClass("sentenceNotFreq");
return true}
function f6(a,b){for(var d=[],c=0;c<b.length;c+=1){var e,f,g,i;e=f=g=i=-1;if(a.r>b[c].l)f=0;if(a.r>b[c].r)f=1;if(a.l>b[c].l)e=0;if(a.l>b[c].r)e=1;if(a.t>b[c].b)g=0;if(a.t>b[c].t)g=1;if(a.b>b[c].b)i=0;if(a.b>b[c].t)i=1;f<e&&alert("error: rTR<lTR");g<i&&alert("error: tTR<bTR");if(f==0&&e==-1&&g==0&&i==-1){e=new f0(b[c].l,b[c].r,b[c].t,a.t);d.push(e);e=new f0(a.r,b[c].r,a.t,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==0&&e==-1&&g==0&&i==0){e=new f0(b[c].l,
b[c].r,b[c].t,a.t);d.push(e);e=new f0(a.r,b[c].r,a.t,a.b);d.push(e);e=new f0(b[c].l,b[c].r,a.b,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==0&&e==-1&&g==1&&i==-1){e=new f0(a.r,b[c].r,b[c].t,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==0&&e==-1&&g==1&&i==0){e=new f0(a.r,b[c].r,b[c].t,a.b);d.push(e);e=new f0(b[c].l,b[c].r,a.b,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==0&&e==0&&g==0&&i==-1){e=new f0(b[c].l,b[c].r,b[c].t,a.t);d.push(e);e=new f0(a.r,
b[c].r,a.t,b[c].b);d.push(e);e=new f0(b[c].l,a.l,a.t,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==0&&e==0&&g==0&&i==0){e=new f0(b[c].l,b[c].r,b[c].t,a.t);d.push(e);e=new f0(a.r,b[c].r,a.t,a.b);d.push(e);e=new f0(b[c].l,a.l,a.t,a.b);d.push(e);e=new f0(b[c].l,b[c].r,a.b,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==0&&e==0&&g==1&&i==-1){e=new f0(a.r,b[c].r,b[c].t,b[c].b);d.push(e);e=new f0(b[c].l,a.l,b[c].t,b[c].b);d.push(e);b.splice(c,1);
c-=1}else if(f==0&&e==0&&g==1&&i==0){e=new f0(a.r,b[c].r,b[c].t,a.b);d.push(e);e=new f0(b[c].l,a.l,b[c].t,a.b);d.push(e);e=new f0(b[c].l,b[c].r,a.b,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==1&&e==-1&&g==0&&i==-1){e=new f0(b[c].l,b[c].r,b[c].t,a.t);d.push(e);b.splice(c,1);c-=1}else if(f==1&&e==-1&&g==0&&i==0){e=new f0(b[c].l,b[c].r,b[c].t,a.t);d.push(e);e=new f0(b[c].l,b[c].r,a.b,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==1&&e==-1&&g==1&&i==
-1){b.splice(c,1);c-=1}else if(f==1&&e==-1&&g==1&&i==0){e=new f0(b[c].l,b[c].r,a.b,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==1&&e==0&&g==0&&i==-1){e=new f0(b[c].l,b[c].r,b[c].t,a.t);d.push(e);e=new f0(b[c].l,a.l,a.t,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==1&&e==0&&g==0&&i==0){e=new f0(b[c].l,b[c].r,b[c].t,a.t);d.push(e);e=new f0(b[c].l,a.l,a.t,a.b);d.push(e);e=new f0(b[c].l,b[c].r,a.b,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==1&&
e==0&&g==1&&i==-1){e=new f0(b[c].l,a.l,b[c].t,b[c].b);d.push(e);b.splice(c,1);c-=1}else if(f==1&&e==0&&g==1&&i==0){e=new f0(b[c].l,a.l,b[c].t,a.b);d.push(e);e=new f0(b[c].l,b[c].r,a.b,b[c].b);d.push(e);b.splice(c,1);c-=1}}return b=b.concat(d)}
function f54(a,b){var d=a[0],c=a[0],e=b[0],f=b[0],g,i,h=0,j=0;for(h=0;h<3;h+=1){if(a[h]>d)d=a[h];if(a[h]<c)c=a[h];if(b[h]>e)e=b[h];if(b[h]<f)f=b[h]}i=d>e?d:e;g=c<f?c:f;var l=[];j=[];for(h=0;h<3;h+=1){l[h]=2*(a[h]-c)/d-1;j[h]=2*(b[h]-f)/e-1}h=f51(l);j=f51(j);if(j<h)j+=2*Math.PI;if(j==h)myGlobal.varyFontColourHow="Direct";return new Array(h,j,g,i)}
function f51(a){var b=0;if(a[0]>=a[1]&&a[0]>=a[2])if(a[2]>=a[1])b+=Math.asin(Math.asin(Math.PI/6)+(1-Math.asin(Math.PI/6))*(1-a[2])/2);else b=b+Math.PI-Math.asin(Math.asin(Math.PI/6)+(1-Math.asin(Math.PI/6))*(1-a[2])/2);else if(a[1]>=a[0]&&a[1]>=a[2]){b=2*Math.PI/3;if(a[0]>=a[2])b+=Math.asin(Math.asin(Math.PI/6)+(1-Math.asin(Math.PI/6))*(1-a[2])/2);else b=b+Math.PI-Math.asin(Math.asin(Math.PI/6)+(1-Math.asin(Math.PI/6))*(1-a[2])/2)}else{b=4*Math.PI/3;if(a[1]>=a[0])b+=Math.asin(Math.asin(Math.PI/
6)+(1-Math.asin(Math.PI/6))*(1-a[2])/2);else b=b+Math.PI-Math.asin(Math.asin(Math.PI/6)+(1-Math.asin(Math.PI/6))*(1-a[2])/2)}return b}
function f53(a,b){var d,c;if(a=="Randomly"){myGlobal.varyFontSizeFactor=0;myGlobal.standardFontSizeFactor=1}if(b=="Randomly"){myGlobal.varyFontColourFactor=0;myGlobal.standardFontColourFactor=1}if(d==undefined||c==undefined){d=[];c=[];for(var e=0;e<wordList.length;e+=1)if(wordList[e].display!=false){d.push(e);c.push(wordList[e].frequency)}c=c.sort(f108);for(var f=1;f<c.length;)if(c[f]==c[f-1])c.splice(f,1);else f+=1;for(e=0;e<d.length;e+=1){for(f=0;c[f]!=wordList[d[e]].frequency;)f+=
1;wordList[d[e]].level=f+1}switch(a){case "Count":myGlobal.varyFontSizeFactor=c[c.length-1];myGlobal.standardFontSizeFactor=c[0];break;case "Level":myGlobal.varyFontSizeFactor=c.length;myGlobal.standardFontSizeFactor=1;break}switch(b){case "Count":myGlobal.varyFontColourFactor=c[c.length-1];myGlobal.standardFontColourFactor=c[0];break;case "Level":myGlobal.varyFontColourFactor=c.length;myGlobal.standardFontColourFactor=1;break}myGlobal.includedWords=d}}
function f3(a,b){this.text=a;this.frequency=b;this.display=false;this.equivalents=[];this.equivalents[0]=new f1(a,b);this.include=function(d,c){this.frequency+=c;this.equivalents.push(new f1(d,c))};this.getEquivalentTexts=function(){for(var d=[],c=0;c<this.equivalents.length;c+=1)d.push(this.equivalents[c].text);return d};this.chooseSetCase=function(d){for(var c=this.equivalents[0].frequency,e=this.equivalents[0].text,f=1;f<this.equivalents.length;f+=1)if(this.equivalents[f].frequency>
c){e=this.equivalents[f].text;c=this.equivalents[f].frequency}this.mostCommonText=e;this.setCase(d)};this.setCase=function(d){if(d=="lowercase")this.text=this.text.toLowerCase();if(d=="UPPERCASE")this.text=this.text.toUpperCase();if(d=="Most common")this.text=this.mostCommonText}}function f1(a,b){this.text=a;this.frequency=b}function f2(a,b){this.first=a;this.second=b}
function f0(a,b,d,c){this.l=Math.round(a);this.r=Math.round(b);this.t=Math.round(d);this.b=Math.round(c);this.yNearestOrigin=this.xNearestOrigin=0;if(d>0)if(c>0)this.yNearestOrigin=c;if(d<0)this.yNearestOrigin=d;if(b>0)if(a>0)this.xNearestOrigin=a;if(b<0)this.xNearestOrigin=b;this.distance2Origin=Math.sqrt(this.xNearestOrigin*this.xNearestOrigin+this.yNearestOrigin*this.yNearestOrigin);this.calcMinDistanceTo=function(e,f){this.xNearest=e;this.yNearest=f;if(d>f)if(c>f)this.yNearest=c;if(d<
f)this.yNearest=d;if(b>e)if(a>e)this.xNearest=a;if(b<e)this.xNearest=b;e=e-this.xNearest;f=f-this.yNearest;this.minDistance=Math.sqrt(e*e+f*f)}}function f111(a,b,d,c){this.l=Math.round(a);this.r=Math.round(b);this.t=Math.round(d);this.b=Math.round(c)}function f21(a,b,d,c,e,f){this.text=a;this.fontSize=b;this.width=d;this.height=c;this.x=e;this.y=f;this.l=Math.round(e-d/2);this.r=Math.round(e+d/2);this.t=Math.round(f+c/2);this.b=Math.round(f-c/2)}
function f12(a,b,d,c,e,f){$("#everywhere").show();var g=200;if(myGlobal==null||myGlobal==undefined){myGlobal={};myGlobal.originalPageTitle=document.title;document.title="Loading...";eval(b+"();")}document.title="Loading...";if($("#everywhere").hasClass("f12Pause")){setTimeout("f12("+a+',"'+b+'","'+d+'",'+c+',"'+e+'","'+f+'")',50);return false}if($("#everywhere").hasClass("f12Stop")){$("#everywhere").removeClass("f12Stop");document.title=myGlobal.originalPageTitle;myGlobal=null;
$("#everywhere").hide();return false}if(a==true)g=100;var i=new Date;i=i.getTime();var h=new Date;h=h.getTime();for(var j=c;h-i<g;){c=eval(d+"("+c+");");if(c==false)break;h=new Date;h=h.getTime()}if(c==false){a=eval(e+"();");document.title=myGlobal.originalPageTitle;myGlobal=null;a&&f!=""&&setTimeout('eval("'+f+';")',10);$("#everywhere").hide();return true}else setTimeout("f12("+a+',"'+b+'","'+d+'",'+c+',"'+e+'","'+f+'")',50)}
function f4(){$("#footer").append("<div id='fontsInTheFooter'>\t<span class='Daniel'>Daniel</span>\t<span class='Essays1743'>Essays1743</span>\t<span class='Gentium'>Gentium</span>\t<span class='Gruenewald-VA'>Gruenewald-VA</span>\t<span class='Isabella'>Isabella</span>\t<span class='Jura'>Jura</span>\t<span class='Sniglet'>Sniglet</span>\t<span class='Yiggivoo'>Yiggivoo</span>\t</div>")}
function f85(){$("#fontsInTheFooter>span").each(function(){var a=$.trim($(this).text());if($(this).hasLoadedWebFont(a)==false){$("#iFontFamily").siblings().last().children().each(function(){$.trim($(this).text())==a&&$(this).remove()});$(this).remove()}})}
jQuery.fn.hasLoadedWebFont=function(a){var b=true,d=$(this).css("font-size");$(this).css("font-size","100px");var c=$(this).width(),e=$(this).height(),f=$(this).css("font-family").split(",");if(f.length>1){f=f[f.length-1];$(this).removeClass(a).addClass(f);if(c==$(this).width()&&e==$(this).height())b=false}else{$(this).removeClass(a).addClass("serif");if(c==$(this).width()&&e==$(this).height())b=false;$(this).removeClass("serif").addClass("sans-serif");if(c==$(this).width()&&e==$(this).height())b=
false;$(this).removeClass("sans-serif").addClass("monospace");if(c==$(this).width()&&e==$(this).height())b=false;f="monospace"}$(this).removeClass(f).addClass(a);$(this).css("font-size",d);return b};function f19(a){var b=$(a).siblings("ul").children(),d=Math.round(Math.random()*(b.length-1));$(a).text($.trim($(b[d]).text()))}
function f110(a){switch($("#iPlaceOrder").text()){case "Count":wordList=wordList.sort(f107);wordList=wordList.sort(f106);break;case "Alphabetical order":wordList=wordList.sort(f106);wordList=wordList.sort(f107);break;case "Randomly":if(a==true)wordList=wordList.sort(f109);break}}function f109(){return 0.5-Math.random()}function f106(a,b){return b.frequency-a.frequency}function f108(a,b){return b-a}
function f107(a,b){a=a.text.toLowerCase();b=b.text.toLowerCase();try{result=a<b?-1:a>b?1:0}catch(d){result=0}return result}function f104(a,b){return a<b?-1:a>b?1:0}function f105(a,b){a=a.toLowerCase();b=b.toLowerCase();var d=0;try{d=a<b?-1:a>b?1:0}catch(c){d=0}return d}function f82(a,b){for(var d=[],c=0;c<3;c+=1)d[c]=a+Math.round((b-a)*Math.random());return d}function f71(a){return a[0]>a[1]?a[0]>a[2]?0:2:a[1]>a[2]?1:2}
function f70(){var a,b;for(b=0;b<wordList.length;b+=1)if(wordList[b].display==true){a=wordList[b].frequency;break}for(b=b;b<wordList.length;b+=1)if(wordList[b].frequency<a)if(wordList[b].display==true)a=wordList[b].frequency;return a}function f60(){var a,b;for(b=0;b<wordList.length;b+=1)if(wordList[b].display==true){a=wordList[b].frequency;break}for(b=b;b<wordList.length;b+=1)if(wordList[b].frequency>a)if(wordList[b].display==true)a=wordList[b].frequency;return a}
function f18(a){var b=a.val();if(b.indexOf("http://")!=0)if(b.indexOf("https://")!=0)b="http://".concat(b);a.val(b)}function f20(){}
function f114(){var a=$(this).siblings().filter(".updown"),b=a.text();b=parseInt(b);if($(this).hasClass("increase"))b+=1;else if($(this).hasClass("decrease"))if(b>0)b-=1;a.text(b);if(a.attr("id")=="wlFreq"){var d=parseInt($("#newWordList>a.current").attr("id").replace("listEntry",""));if(wordList[d].frequency!=b){wordList[d].frequency=b;$("#newWordList").addClass("altered");$("#newWordList>a.current").addClass("altered")}}if(a.attr("id")=="iMaxWords"){f17();$(this).one("mouseleave",
function(){f59()})}if(a.attr("id")=="iMinFrequency"){if($(this).hasClass("increase"))f17(true);else $(this).hasClass("decrease")&&f17();$(this).one("mouseleave",function(){f59()})}}
function f17(a){if($("#newWordList").hasClass("altered")==false){var b=$("#newWordList>a.display").length;b=b-parseInt($("#iMaxWords").text());if(a==true)f83();else if(b>0)f84(b);else if(b<0){b*=-1;f7(b)}b=$("#newWordList>a.display").length;$("#greenWords").text(b)}}
function f7(a){var b=$("#newWordList>a").not(".display").not(".excluded"),d=0,c=parseInt($("#iMinFrequency").text()),e=false;if($("#iPlaceOrder").text()=="Count")e=true;for(var f=0;f<b.length;f+=1){if($(b[f]).attr("id")=="showAllWords"){$("#newWordList").addClass("altered");break}var g=parseInt($(b[f]).attr("id").replace("listEntry",""));if(wordList[g].frequency>=c){$(b[f]).addClass("display");wordList[g].display=true;$(b[f]).addClass("altered");d+=1;if(d==a)break}else if(e)break}}
function f83(){for(var a=$("#newWordList>a.display").not(".included"),b=parseInt($("#iMinFrequency").text()),d=a.length-1;d>=0;d-=1){var c=parseInt($(a[d]).attr("id").replace("listEntry",""));if(wordList[c].frequency<b){$(a[d]).removeClass("display");wordList[c].display=false;$(a[d]).addClass("altered")}}}
function f84(a){for(var b=$("#newWordList>a.display").not(".included"),d=1;d<=a;d+=1){if(d>b.length)break;var c=parseInt($(b[b.length-d]).attr("id").replace("listEntry",""));$(b[b.length-d]).removeClass("display");wordList[c].display=false;$(b[b.length-d]).addClass("altered")}}
function f5(){for(var a=$("#newWordList>a").not(".display").not(".excluded"),b=0;b<a.length;b+=1){if($(a[b]).attr("id")=="showAllWords"){$("#newWordList").addClass("altered");$(this).one("mouseleave",function(){f59()});break}var d=parseInt($(a[b]).attr("id").replace("listEntry",""));if(wordList[d].frequency>=parseInt($("#iMinFrequency").text())){$(a[b]).addClass("display");wordList[d].display=true;$(a[b]).addClass("altered");break}}}
function f86(){var a=$("#newWordList>a.display").not(".included"),b=parseInt($(a[a.length-1]).attr("id").replace("listEntry",""));$(a[a.length-1]).removeClass("display");wordList[b].display=false;$(a[a.length-1]).addClass("altered")}
function f81(){$(".updown").each(function(){if($(this).hasClass("processed")==false){$(this).after(" <a title='Plus 1' class='increase'></a><a title='Minus 1' class='decrease'></a>");$(this).addClass("processed")}});$("a.increase,a.decrease").bind("click",f114)}function f74(){myGlobal=$(this).attr("value")}function f73(){var a=$(this).attr("value");a=parseInt(a);a<0&&$(this).attr("value",myGlobal);myGlobal=null}
function f36(){$("div.dropDown ul li a").bind("click",f30)}function f30(){var a=$(this).closest("div");f31(a);a.hasClass("dropDownInput")?a.children().filter(":first").val($(this).text()):a.children().filter(":first").text($(this).text());f29(a);return false}function f31(a){a.children().filter("ul").css("display","none");setTimeout("$('div.dropDown ul:hidden').css('display','');",200)}
function f29(a){a=a.children().filter(":first");if(a.hasClass("updateWLT"))f103(true);else if(a.hasClass("showHideRandomColourOption"))a.text()=="Randomly"?$("#randomColourOption").show():$("#randomColourOption").hide();else if(a.attr("id")=="iCase"){a=a.text();for(var b=0;b<wordList.length;b+=1)wordList[b].setCase(a);f47()}}
function f89(){function a(e){if($(this).hasClass("vertical"))$(document).bind("mousemove",d);else $(this).hasClass("horizontal")&&$(document).bind("mousemove",b);$(document).bind("mouseup",c);thisHandle=$(this);otherHandle=$(this).siblings().filter(".resizeHandle");resizeElement=$(this).siblings().filter(".resizeable");handleVOffset=resizeElement.outerHeight()-resizeElement.innerHeight();handleHOffset=resizeElement.outerWidth()-resizeElement.innerWidth();initialTopOffset=parseInt(resizeElement.offset().top);
if(resizeElement.attr("id")=="newWordCloud"){originalHeight=resizeElement.innerHeight();originalWidth=resizeElement.innerWidth()}return false}function b(e){if(resizeElement.attr("id")=="newWordCloud")if(e.pageX>window.screen.availWidth*0.95-20)return false;resizeElement.width(Math.max(100,e.pageX-resizeElement.offset().left-4));thisHandle.css("left",resizeElement.offset().left+resizeElement.outerWidth()-1);if(otherHandle.length>0){otherHandle.width(resizeElement.outerWidth());otherHandle.css("left",
resizeElement.offset().left)}if(resizeElement.attr("id")=="newWordCloud"){f112();leftOffset=parseInt(resizeElement.offset().left);e=parseFloat($("#wcTarget").css("left").replace("px",""))+25;var f=(resizeElement.innerWidth()-originalWidth)*(e-leftOffset)/resizeElement.innerWidth();resizeElement.children().each(function(){$(this).css("left",parseFloat($(this).css("left").replace("px",""))+f)});originalWidth=resizeElement.innerWidth()}f80();return false}function d(e){resizeElement.height(Math.max(100,
e.pageY-initialTopOffset-handleVOffset-4));if(otherHandle.length>0){otherHandle.height(resizeElement.outerHeight());otherHandle.css("left",resizeElement.offset().left+resizeElement.outerWidth())}if(resizeElement.attr("id")=="newWordCloud"){f112();e=parseFloat($("#wcTarget").css("top").replace("px",""))+25;var f=(resizeElement.innerHeight()-originalHeight)*(e-initialTopOffset)/resizeElement.innerHeight();resizeElement.children().each(function(){$(this).css("top",parseFloat($(this).css("top").replace("px",
""))+f)});originalHeight=resizeElement.innerHeight()}f80();return false}function c(e){$(document).unbind("mousemove");$(document).unbind("mouseup");if(resizeElement.attr("id")=="newWordCloud"){f112();leftOffset=parseInt(resizeElement.offset().left);e=parseFloat($("#wcTarget").css("left").replace("px",""))+25;var f=(resizeElement.innerWidth()-originalWidth)*(e-leftOffset)/resizeElement.innerWidth();e=parseFloat($("#wcTarget").css("top").replace("px",""))+25;var g=(resizeElement.innerHeight()-
originalHeight)*(e-initialTopOffset)/resizeElement.innerHeight();resizeElement.children().each(function(){var i=parseFloat($(this).css("left").replace("px",""))+f,h=parseFloat($(this).css("top").replace("px",""))+g;$(this).css("left",i);$(this).css("top",h);var j=parseInt($(this).attr("id").replace("cp",""));f21s[j].left=parseInt(i);f21s[j].top=parseInt(h)});f80()}return false}$(".resizeable.vertical").each(function(){$(this).after("<a class='resizeHandle vertical' title='Click to drag and resize'>v</a>")});
$(".resizeable.horizontal").each(function(){$(this).before("<a class='resizeHandle horizontal' title='Click to drag and resize'><span>&gt;</span></a>")});$(".resizeHandle").mousedown(a);f39();$(window).resize(f39)}
function f112(){if(parseInt($("#wctxpx").text())>$("#newWordCloud").innerWidth()/2)$("#wctxpx").text(parseInt($("#newWordCloud").innerWidth()/2));else-1*parseInt($("#wctxpx").text())>$("#newWordCloud").innerWidth()/2&&$("#wctxpx").text(parseInt(-1*$("#newWordCloud").innerWidth()/2));if(parseInt($("#wctypx").text())>$("#newWordCloud").innerHeight()/2)$("#wctypx").text(parseInt($("#newWordCloud").innerHeight()/2));else-1*parseInt($("#wctypx").text())>$("#newWordCloud").innerHeight()/2&&$("#wctypx").text(parseInt(-1*
$("#newWordCloud").innerHeight()/2));$("#wcTarget").css("left",$("#newWordCloud").offset().left+$("#newWordCloud").innerWidth()/2-25+parseInt($("#wctxpx").text()));$("#wcTarget").css("top",$("#newWordCloud").offset().top+$("#newWordCloud").innerHeight()/2-25-parseInt($("#wctypx").text()))}
function f80(){var a=$("#newWordCloud").innerHeight(),b=$("#newWordCloud").innerWidth();$("#wcxpx").text(b);$("#wcypx").text(a);if(a>=b){$("#wcxpc").text(Math.round(b/a*100)/100);$("#wcypc").text(Math.round(a/a*100)/100)}else{$("#wcxpc").text(Math.round(b/b*100)/100);$("#wcypc").text(Math.round(a/b*100)/100)}}
function f39(){$(".resizeable:visible").each(function(){$(this).siblings().filter(".resizeHandle.vertical").width($(this).outerWidth()).css("left",$(this).offset().left);$(this).siblings().filter(".resizeHandle.horizontal").height($(this).outerHeight()).css("left",$(this).offset().left+$(this).outerWidth())})}
function f75(a){if(a.is(":hidden")){$("#everywhere").show();var b=$("div.makeAWordCloudSection:visible");b.length>0?b.slideToggle(500,function(){a.slideToggle(500,function(){f92()})}):a.slideToggle(500,function(){f92()})}}
function f92(){f39();if($("#textInputSettingsSection:visible").length>0){$("#taStopWords").val(stopWords);$("#taStopChars").val(stopChars)}else $("#textInputSection:visible").length>0&&$("#originalSourceInput").focus();if($("#wordListSettingsSection:visible").length>0)$("#newWordList").children().length==0&&f47();else $("#showAllWords").removeClass("showAllWords");$("#everywhere").hide()}
function f79(){var a,b;if(Math.round(Math.random())>0.5){var d=f82(173,255);$("#canvasColour").css("background-color","rgb("+d[0]+","+d[1]+","+d[2]+")");$("#newWordCloud").css("background-color","rgb("+d[0]+","+d[1]+","+d[2]+")");d=f82(0,86);$("#iStandardFontColour").css("background-color","rgb("+d[0]+","+d[1]+","+d[2]+")");a=f71(d);d=f82(87,172)}else{d=f82(0,86);$("#canvasColour").css("background-color","rgb("+d[0]+","+d[1]+","+d[2]+")");$("#newWordCloud").css("background-color",
"rgb("+d[0]+","+d[1]+","+d[2]+")");d=f82(87,172);$("#iStandardFontColour").css("background-color","rgb("+d[0]+","+d[1]+","+d[2]+")");a=f71(d);d=f82(173,255)}b=f71(d);a!=b?$("#iVaryFontColour").css("background-color","rgb("+d[0]+","+d[1]+","+d[2]+")"):$("#iVaryFontColour").css("background-color","rgb("+d[1]+","+d[2]+","+d[0]+")");$("div.colour").each(function(){$(this).children().css("background-color",$(this).css("background-color"))})}
function f62(){var a=$.farbtastic("#colourpicker");$("div.colour").prepend("<div class='oldColour'></div>");$("div.colour").mouseover(function(){clearTimeout(myTimeOut);a.linkTo(this);a.setColor($.fmtColor($(this).css("background-color"),"hexadecimal"));$("#colourpicker").css("left",$(this).offset().left+$(this).innerWidth()).css("top",$(this).offset().top-50).show();return false});$("div.colour").mouseleave(function(){myTimeOut=setTimeout("$('#colourpicker').css('display','none')",
500);return false});$("#colourpicker").mouseleave(function(){$("div.colour").each(function(){$(this).children().css("background-color",$(this).css("background-color"))});return false})}
function f33(){stopWords="a also am an and are aren't as at be been but by can can't cannot could couldn't did didn't do does doesn't don't down e.g. for from get gets got had hadn't has hasn't have haven't he he'd he'll he's her him his how however I i.e. I'd I'll I'm I've if in into is isn't it it's its may me might mine must mustn't must've my no not of off on or our ours out shall she she'd she'll she's should shouldn't so such than that that's the their theirs them then there there's these they they'd they'll they're they've this those thus to too up us very was wasn't we we'd we'll we're we've were what when where which who why will with won't would wouldn't you you'd you'll you're you've your yours";$("#taStopWords").val(stopWords+
"\n");$("#taStopWords").bind("keyup mouseup",function(){stopWords=$(this).val()})}
function f32(){stopChars="";for(var a=new Array(new f2(48,58),new f2(33,48),new f2(58,65),new f2(91,97),new f2(123,126),new f2(161,192),new f2(8208,8232),new f2(8240,8287),new f2(8304,8399),new f2(0,32),new f2(127,161),new f2(8192,8208),new f2(8232,8240),new f2(8287,8303)),b=0;b<a.length;b+=1)for(var d=a[b].first;d<a[b].second;d+=1){var c=String.fromCharCode(d);stopChars=stopChars.concat(c)}stopChars=
stopChars.replace(/\s/g,"");$("#taStopChars").val(stopChars+"\n");$("#taStopChars").bind("keyup mouseup",function(){stopChars=$(this).val()})}
function f99(){$("#enterDocumentToOriginalSourceInput,#enterWebAddressToOriginalSourceInput,#enterSentenceToOriginalSourceInput,#enterTableToOriginalSourceInput,#enterCSVToOriginalSourceInput,#enterTSVToOriginalSourceInput").click(function(){var a,b=$("#originalSourceInput");switch($(this).attr("id")){case "enterDocumentToOriginalSourceInput":a=1;break;case "enterWebAddressToOriginalSourceInput":a=2;break;case "enterSentenceToOriginalSourceInput":a=3;break;case "enterTableToOriginalSourceInput":a=
4;break;case "enterCSVToOriginalSourceInput":a=5;break;case "enterTSVToOriginalSourceInput":a=6;break;default:a=0}if($.trim(b.val())==""){b.val(f52(a));return false}for(var d=1;d<=6;d+=1)if($.trim(b.val())==f52(d)){b.val(f52(a));return false}f22("Are you sure? This will replace your current text.");modalWindowOk="f38("+a+");";return false});$("#trickToTabToSave").focus(function(){$("#aGenerateFromOriginalTextInput").focus();
return false});$("#xRandomLook").bind("click",function(){if($("#newWordCloud").hasClass("randomSettings")){f10();f43();$("#newWordCloud").addClass("randomSettings")}else{f22("You may lose changes you have made to colours and type of font");modalWindowOk="$('#newWordCloud').addClass('randomSettings');$('#xRandomLook').click();"}return false});$("#sectionOpener a").click(function(){var a=$(this).attr("id");a=a.replace("open_","");f75($("#"+a));$("#sectionOpener li a").removeClass("currentSection");
$(this).addClass("currentSection");return false});$("#aGenerateFromOriginalTextInput").bind("click keypress",function(a){if(a.type=="click"||a.which==13){f85();$("#newWordCloudSectionWrapper").hasClass("firstRun")&&f10();f24("f43()");return false}});$("ul.selectable li").click(function(){$(this).siblings().removeClass("selected");$(this).addClass("selected");return false});$("#aTextInputSettings").click(function(){f24("f43()");
return false});$("#aRefreshWordTable").click(function(){f59(true);return false});$("#aWordListSettings").click(function(){f59(true,"f43()");return false});$("a.button.redraw").click(function(){$(this).hasClass("newWCSettings")&&$("#newWordCloud").removeClass("randomSettings");f43();return false});$("#aSaveWordCloud").click(function(){f77();return false});$("#aDefStopWords").click(f33);$("#aDefStopChars").click(f32);f72()}
function f72(){var a,b;if($("#newWordCloudSectionWrapper").is(":visible")){a=["Resize the word cloud by simply dragging the sides","Set a different target for the centre of the word cloud","Change the text to display with the word list tab","Customise the words or characters to be removed with the text settings tab","Embed the word clouds once you've saved them","When saved, word clouds will be automatically stretched or shrunk to fit"];b=3E4}else{a=["Use ~ or _ to keep words in a sentence together",
"Enter a website address to use it's feed as the source text","Just type in a sentence and automagically create a word cloud","Make a custom data cloud with a two column table (see examples)","Tweak the text later with the word list tab","Customise the words or characters to be removed later with the text settings tab"];b=1E4}a=a[Math.round(Math.random()*(a.length-1))];$("#makeAWordCloudTipText").text(a);setTimeout("f72()",b)}
function f38(a){$("#originalSourceInput").val(f52(a));return true}
function f52(a){switch(a){case 1:return'The Story of the Three Little Pigs\n\nOnce upon a time there was an old Sow with three little Pigs, and as she had not enough to keep them, she sent them out to seek their fortune.\n\nThe first that went off met a Man with a bundle of straw, and said to him, "Please, Man, give me that straw to build me a house"; which the Man did, and the little Pig built a house with it. Presently came along a Wolf, and knocked at the door, and said, "Little Pig, little Pig, let me come in."\n\nTo which the Pig answered, "No, no, by the hair of my chinny chin chin."\n\n"Then I\'ll huff and I\'ll puff, and I\'ll blow your house in!" said the Wolf. So he huffed and he puffed, and he blew his house in, and ate up the little Pig.\n\nThe second Pig met a Man with a bundle of furze, and said, "Please, Man, give me that furze to build a house"; which the Man did, and the Pig built his house.\n\nThen along came the Wolf and said, "Little Pig, little Pig, let me come in."\n\n"No, no, by the hair of my chinny chin chin."\n\n"Then I\'ll puff and I\'ll huff, and I\'ll blow your house in!" So he huffed and he puffed, and he puffed and he huffed, and at last he blew the house down, and ate up the second little Pig.\n\nThe third little Pig met a Man with a load of bricks, and said, "Please, Man, give me those bricks to build a house with"; so the Man gave him the bricks, and he built his house with them. So the Wolf came, as he did to the other little Pigs, and said, "Little Pig, little Pig, let me come in."\n\n"No, no, by the hair of my chinny chin chin."\n\n"Then I\'ll huff and I\'ll puff, and I\'ll blow your house in."\n\nWell, he huffed and he puffed, and he huffed and he puffed, and he puffed and he huffed; but he could not get the house down. When he found that he could not, with all his huffing and puffing, blow the house down, he said, "Little Pig, I know where there is a nice field of turnips."\n\n"Where?" said the little Pig.\n\n"Oh, in Mr. Smith\'s home-field; and if you will be ready to-morrow morning, I will call for you, and we will go together and get some for dinner."\n\n"Very well," said the little Pig, "I will be ready. What time do you mean to go?"\n\n"Oh, at six o\'clock."\n\nWell, the little Pig got up at five, and got the turnips and was home again before six. When the Wolf came he said, "Little Pig, are you ready?"\n\n"Ready!" said the little Pig, "I have been and come back again, and got a nice pot-full for dinner."\n\nThe Wolf felt very angry at this, but thought that he would be up to the little Pig somehow or other; so he said, "Little Pig, I know where there is a nice apple-tree."\n\n"Where?" said the Pig.\n\n"Down at Merry-garden," replied the Wolf; "and if you will not deceive me I will come for you, at five o\'clock to-morrow, and we will go together and get some apples."\n\nWell, the little Pig woke at four the next morning, and bustled up, and went off for the apples, hoping to get back before the Wolf came; but he had farther to go, and had to climb the tree, so that just as he was coming down from it, he saw the Wolf coming, which, as you may suppose, frightened him very much. When the Wolf came up he said, "Little Pig, what! are you here before me? Are they nice apples?"\n\n"Yes, very," said the little Pig; "I will throw you down one." And he threw it so far that, while the Wolf was gone to pick it up, the little Pig jumped down and ran home.\n\nThe next day the Wolf came again, and said to the little Pig, "Little Pig, there is a Fair in the Town this afternoon: will you go?"\n\n"Oh, yes," said the Pig, "I will go; what time shall you be ready?"\n\n"At three," said the Wolf.\n\nSo the little Pig went off before the time, as usual, and got to the Fair, and bought a butter churn, and was on his way home with it when he saw the Wolf coming. Then he could not tell what to do. So he got into the churn to hide, and in doing so turned it round, and it began to roll, and rolled down the hill with the Pig inside it, which frightened the Wolf so much that he ran home without going to the Fair.\n\nHe went to the little Pig\'s house, and told him how frightened he had been by a great round thing which came down the hill past him.\n\nThen the little Pig said, "Hah! I frightened you, did I? I had been to the Fair and bought a butter churn, and when I saw you I got into it, and rolled down the hill."\n\nThen the Wolf was very angry indeed, and declared he would eat up the little Pig, and that he would get down the chimney after him.\n\nWhen the little Pig saw what he was about, he hung on the pot full of water, and made up a blazing fire, and, just as the Wolf was coming down, took off the cover of the pot, and in fell the Wolf. And the little Pig put on the cover again in an instant, boiled him up, and ate him for supper, and lived happy ever after.';case 2:return"news.bbc.co.uk";
case 3:return"WordItOut lets you transform your text into word~clouds!";case 4:return"one:1\ntwo:2\nthree:3\nfour:4\nfive:5\nsix:6\nseven:7\neight:8\nnine:9\nten:10";case 5:return"WordItOut works in other languages , 30\nDeutsch , 60\nEspa\u00f1ol , 100\nFran\u00e7ais , 70\nItaliano , 30\nNederlands , 30\n\u65e5\u672c\u8a9e , 60\nPolski , 30\nPortugu\u00eas , 40\nMagyar , 20\nNorsk (bokm\u00e5l) , 20\n\u0420\u0443\u0441\u0441\u043a\u0438\u0439 , 20\nSuomi , 20\nSvenska , 20\n\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430 , 20\n\u4e2d\u6587 , 50\n\u0627\u0644\u0639\u0631\u0628\u064a\u0629 , 10\nBahasa Indonesia , 10\n\u010ce\u0161tina , 10\nDansk , 10\n\u05e2\u05d1\u05e8\u05d9\u05ea , 10\n\ud55c\uad6d\uc5b4 , 10\nLietuvi\u0173 , 10\nRom\u00e2n\u0103 , 10\nSloven\u010dina , 10\n\u0421\u0440\u043f\u0441\u043a\u0438 / Srpski , 10\nTi\u1ebfng Vi\u1ec7t , 10\nT\u00fcrk\u00e7e , 10";
case 6:return"Mercury\t2439\nVenus\t6052\nEarth\t6378\nMars\t3394\nJupiter\t71400\nSaturn\t60000\nUranus\t25559\nNeptune\t24764\n(Pluto)\t1150";default:return false}}
function f9(){$("#sectionOpener ul.advancedSettings li:last a").hasClass("currentSection")||$("#sectionOpener ul.advancedSettings li:last a").click();if($("#newWordCloudSectionWrapper:hidden").length>0){$("#textInputSection h1.pageHeader").remove();$("#newWordCloudSectionWrapper:hidden").fadeIn("slow",function(){var b=$("#newWordCloudSectionWrapper").offset().top;$("html,body").animate({scrollTop:b},1E3)});window.onbeforeunload=function(){if($("#newWordCloud").hasClass("saved")!=
true)return"Your current word cloud has not been saved and will be lost."};$("#sectionOpener ul.advancedSettings:hidden").fadeIn("slow");$("#newWordCloud").addClass("freshCloud")}else{var a=$("#newWordCloudSectionWrapper").offset().top;$("html,body").animate({scrollTop:a},1E3)}}
function f67(){if(dataForUser!=null||dataForUser!=undefined){if(dataForUser.wordCloudTitle!=null||dataForUser.wordCloudTitle!=undefined){$("#iWordCloudTitle").val(dataForUser.wordCloudTitle);$("#iWordCloudTitle").trigger("keyup")}if(dataForUser.wordCloudDescription!=null||dataForUser.wordCloudDescription!=undefined){$("#iWordCloudDescription").val(dataForUser.wordCloudDescription);$("#iWordCloudDescription").trigger("keyup")}if(dataForUser.relatedUrl!=null||dataForUser.relatedUrl!=undefined){$("#iRelatedUrl").val(dataForUser.relatedUrl);
$("#iRelatedUrl").trigger("keyup")}if(dataForUser.emailAddress!=null||dataForUser.emailAddress!=undefined){$("#iUserEmailAddress").val(dataForUser.emailAddress);$("#iUserEmailAddress").trigger("keyup");$("#iWordCloudTitle").focus()}else $("#iUserEmailAddress").focus()}else{$("#iWordCloudTitle").focus();typeof fillUserStuff=="function"&&fillUserStuff()}}
function f77(a){if(a!=true){if($("#newWordCloud").hasClass("saved")==true){modalWindowOk="f77(true);";f22("<p>You've already saved this word cloud and we've sent an email to <span class='monospace'>"+dataForUser.emailAddress+"</span>.<br />Press okay only if you want to save it twice.","Word cloud already saved");return false}}else $("#newWordCloud").removeClass("saved");modalWindowOk="f91();";a="";a+="<div title='Give a short name or title for your word cloud' class='setting'><p class='desc'>Title [<span class='maxLengthCheck'></span>] </p> ";
a+="<input type='text' class='userInput' name='title' id='iWordCloudTitle'></input></div>";a+="<div title='Perhaps you would like to describe your word cloud a little' class='setting'><p class='desc'>Description [<span class='maxLengthCheck'></span>] </p> ";a+="<textarea id='iWordCloudDescription' class='userInput' name='description' ></textarea></div>";a+="<div title='You may add a link to a website' class='setting'><p class='desc'>Related web page</p> <input type='text'  class='userInput' id='iRelatedUrl'></input></div>";
a+="<div title='Public word clouds are available to everyone. Private word clouds are only available to those who have the unique link that you will give them' class='setting'><p class='desc'>Sharing</p>";a+="<form style='margin-left:20px;'><input style='width:auto;display:inline;' type='radio' name='iWordCloudAccess'  checked='checked' value='Public' /> Public <input style='width:auto;display:inline;' type='radio' name='iWordCloudAccess' value='Private' /> Private </form>";a+="</div>";a+="<div title='We need to send you important links.' class='setting required'>Email address<span style='color:red'>*</span> <span class='note'>See our <a href='../community/questions#faq-privacy' target='_blank'>FAQ</a> if you want to know why we need this.</span><span class='note' style='font-weight:bold;margin-left:20px;'>No password required!</span><input type='text' class='userInput validateEmail' id='iUserEmailAddress' name='email'></input>";
a+="</div>";f22(a,"Save your word cloud");setTimeout("f115();f11();",500);setTimeout("f67();",750);return true}
function f91(){if($.trim($("#iUserEmailAddress").val())==""){f61("You haven't put in an email address");$("#iUserEmailAddress").focus();return false}if($("#iUserEmailAddress").hasClass("valid")==false){f61("Please check you've typed your email address correctly");$("#iUserEmailAddress").focus();return false}if($("div.modalWindow span.maxLengthCheck").hasClass("warning")){f61("You've put too many letters here");$("div.modalWindow span.maxLengthCheck.warning").parent().next().focus();
return false}f41();f61("Saving...");var a=$("#newWordCloud").width(),b=$("#newWordCloud").height()/a;a=Math.round(a);var d=$("#newWordCloud").css("background-color");canvasRgb=$.RGB(d);d=$.trim($("#iRelatedUrl").val());if(d!=""&&d.indexOf("http://")<0&&d.indexOf("https://")<0){d="http://"+d;$("#iRelatedUrl").val(d)}var c=$.trim($("#iWordCloudTitle").val()),e=$.trim($("#iWordCloudDescription").val()),f=$("input[name='iWordCloudAccess']:checked").val(),g=$.trim($("#iUserEmailAddress").val());
if(dataForUser==null||dataForUser==undefined)dataForUser={};dataForUser.emailAddress=g;for(var i=[],h=[],j=[],l=[],k=[],n=[],o=[],p=[],m=0;m<f21s.length;m+=1){i.push(f21s[m].text);h.push(Math.round(f21s[m].fontSize));j.push(Math.round(f21s[m].left));l.push(Math.round(f21s[m].top));k.push(f21s[m].fontFamily);n.push(Math.round(f21s[m].rgb[0]));o.push(Math.round(f21s[m].rgb[1]));p.push(Math.round(f21s[m].rgb[2]))}$.post(BASEFILE,{action:"newWordCloud",
canvasWidth:a,canvasAspectRatio:b,"canvasRgb[]":canvasRgb,"text[]":i,"fontSize[]":h,"positionLeft[]":j,"positionTop[]":l,"fontFamily[]":k,"red[]":n,"green[]":o,"blue[]":p,relatedUrl:d,wordCloudTitle:c,wordCloudDescription:e,wordCloudAccess:f,userEmailAddress:g},function(q,r,s){eval(q);f42();$("#newWordCloud").hasClass("saved")==true&&$("#iUserEmailAddress").closest("div.modalWindow").remove()})}
function f69(a){a=a.replace(/&amp;/gim,"&");a=a.replace(/&quot;/gim,'"');a=a.replace(/&#039;/gim,"'");a=a.replace(/&lt;/gim,"<");a=a.replace(/&gt;/gim,">");a=a.replace(/[&]/gim,"&amp;");a=a.replace(/["]/gim,"&quot;");a=a.replace(/[']/gim,"&#039;");a=a.replace(/[<]/gim,"&lt;");return a=a.replace(/[>]/gim,"&gt;")};
