(function(){if(typeof window.console=="undefined"){window.console={};window.console.log=function(g){}}var e={js:"javascript",html:"html",php:"php"};function c(g){return document.createElement(g)}var a="ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr6OwBovxn7TDAH5Q";function f(){this.categories=[];this.subCategories=[];this.codeTitles=[];this.selectCode=null;this.codeDiv=null;this.codeLIs=[];this.currentCode=new Object();this.curI="";this.codeEditorDivs;this.currentEditor;this.temporaryBoilerplate;this.uiEffects=new Object();this.runBox=new Object();this.autoCompleteData=[];this.insertJavascriptRegex}f.prototype.addDeleteIcon=function(g,i){var h=c("img");h.src="images/trash.gif";h.style.cursor="pointer";h.style.marginLeft="6px";$(h).bind("click",this.deleteCustomExample(i));g.appendChild(h)};f.prototype.addNewSampleMarkers=function(l){var h;if(l.responseStatus==200){h={};entries=l.responseData.feed.entries;for(var p=0;p<entries.length;p++){var r=/Add.*\/trunk\/interactive_samples\/.*\.js/g;var q=entries[p].content.match(r);if(q){for(var n=0;n<q.length;n++){var g=q[n].match(/samples\/js.*/g);if(g!=null&&typeof h[g[0]]=="undefined"){h[g]=true}}}}}for(var p in h){if(h.hasOwnProperty(p)){var s=this.sampleFileNameToObject(p);if(s){var t=s.li;var m=this.createNewSup(" New!");t.appendChild(m);var o=is.getLiCategoryTitle(t);if(o.innerHTML.toLowerCase().indexOf("<sup")==-1){var k=this.createNewSup(" New Samples!");o.appendChild(k)}}}}};f.prototype.addShowHideClicks=function(){var j;for(j=0;j<this.categories.length;j++){var h=this.categories[j];var k=h.childNodes[0];$(k).bind("click",this.toggleShowHideSubCategories(h))}for(j=0;j<this.subCategories.length;j++){var g=this.subCategories[j].childNodes[0];$(g).bind("click",this.toggleShowHideLIs(g))}};f.prototype.changeCodeMirror=function(g){try{this.currentEditor.setCode(g);$(this.currentEditor.frame.contentWindow.window.document.body).scrollTop(10);$(this.currentEditor.frame.contentWindow.window.document.body).scrollTop(0)}catch(h){window.console.log("changeCodeMirror failed!!")}};f.prototype.changeSamplesBoilerplateTo=function(p,o){for(var n=0;n<codeArray.length;n++){for(var l=0;l<codeArray[n].samples.length;l++){var h=codeArray[n].samples[l];for(var g=0;g<h.files.length;g++){var m=h.files[g];if(p==m){this.temporaryBoilerplate=codeArray[n].samples[l].boilerplateLoc;codeArray[n].samples[l].boilerplateLoc=o}}}}};f.prototype.confirmLogin=function(i,h){var g;if(h){g=confirm("You must login to save.  Logging in will lose any edited code.")}else{g=confirm("Logging in will lose any edited code.")}i+="%23"+window.location.hash.substring(1);if(g){window.location=i}};f.prototype.createCategories=function(){this.selectCode=$("#selectCode").get(0);for(var x=0;x<codeArray.length;x++){var u=codeArray[x].category;var m=null;var k=null;var t=null;var s=null;var z,l;if(u.indexOf("-")!=-1){var h=u.split("-");u=h[0];k=h[1]}t=document.getElementById(u);if(t==null){t=c("span");t.className="category categoryClosed";t.id=u;var v=c("span");v.className="categoryTitle";z=c("img");z.className="expand";z.src="images/cleardot.png";v.appendChild(z);v.innerHTML+=u;t.appendChild(v);this.selectCode.appendChild(t);this.categories.push(t)}if(k){s=document.createElement("div");var g=c("span");g.className="subCategoryTitle";z=c("img");z.className="collapse";z.src="images/cleardot.png";g.appendChild(z);g.innerHTML+=k;s.appendChild(g);t.appendChild(s)}m=s||t;var o=c("ul");o.className="categoryItems";m.appendChild(o);for(var w=0;w<codeArray[x].samples.length;w++){var y=codeArray[x].samples[w];var n=c("li");var q=document.createElement("span");q.innerHTML=y.sampleName;q.style.cursor="pointer";$(q).bind("click",this.showSample(y.sampleName));n.appendChild(q);if(u=="Saved Code"){this.addDeleteIcon(n,codeArray[x].samples[w].id)}var p=" <sup>("+((u)||"")+((k)?", "+k:"");p+=(y.tags)?", "+y.tags:"";p+=")</sup>";this.autoCompleteData.push(y.sampleName+p);codeArray[x].samples[w]["li"]=n;if(x==0&&w==0&&window.location.hash.length<=1){this.showSample(y.sampleName,true)();this.hideAllCategoriesExcept(t)}if(window.location.hash.length>0){var r=this.nameToHashName(y.sampleName);if(window.location.hash.substring(1)==r){this.showSample(y.sampleName)();this.hideAllCategoriesExcept(t)}}if(window.expandedCategory&&u.replace(" ","").toLowerCase().indexOf(window.expandedCategory)!=-1&&window.location.hash.length<=1){this.hideAllCategoriesExcept(t);if(w==0){this.showSample(y.sampleName)()}}this.codeLIs.push(n);o.appendChild(n)}if(m!=t){this.subCategories.push(m)}}};f.prototype.createNewSup=function(h){var g=document.createElement("sup");g.className="new";g.innerHTML=h;return g};f.prototype.deleteCustomExample=function(h){var g=this;return function(){var i=confirm("Are you sure you want to delete this example?");if(i){var k="delete?id="+h;var j=g.getCookie("dev_appserver_login");j=(j)?j.replace(/\"/g,""):g.getCookie("ACSID");j=(j)?j.substring(6,20):null;k+=((curAPITypes)?"&type="+curAPITypes:"");k+=(j)?"&sc=safe"+j:"";window.location=k}}};f.prototype.toggleEditHTML=function(i){if(is.currentEditor==window.mixedEditor){if(confirm("This will take you back to the original Javascript.  You will lose any changes.")){var j=is.getCurFilename()||null;var g=is.sampleFileNameToObject(j);is.showSample(g.sampleName)()}return}if(!i){this.getFullSrc(this.toggleEditHTML,a);return}var h=window.is;h.useMixedEditor();h.changeCodeMirror(i);var j=h.getCurFilename();h.changeSamplesBoilerplateTo(j,"")};f.prototype.findNumSpacesToIndentCode=function(j){var g=this.insertJavascriptRegex.exec(j)[0];var h="";while(g.indexOf(" ")==0){h+=" ";g=g.substring(1)}return h};f.prototype.getCode=function(){return this.currentEditor.getCode()};f.prototype.getCookie=function(h){var k=h+"=";var g=document.cookie.split(";");for(var j=0;j<g.length;j++){var l=g[j];while(l.charAt(0)==" "){l=l.substring(1,l.length)}if(l.indexOf(k)==0){return l.substring(k.length,l.length)}}return null};f.prototype.getCurFilename=function(){return this.curI};f.prototype.getFullSrc=function(g,l,m){var n=this.getCurFilename();var i=this.sampleFileNameToObject(n);var h=i.boilerplateLoc;var k=this;var j=m||this.getCode();if(h==""){g(j);return}$.get(h,function(p,r){if(r){var q=k.findNumSpacesToIndentCode(p);j=k.indentCodeWithTheseSpaces(j,q);p=k.insertJavascript(p,j);var o=l||"<<INSERT KEY>>";p=p.replace(/key=.*"/,"key="+o+'"');g(p)}})};f.prototype.getLiCategoryTitle=function(g){var j=$(g.parentNode);var h=0;while(!j.hasClass("category")){j=j.parent();h++;if(h>10){break}}return j.children()[0]};f.prototype.getSafetyToken=function(){var g=this.getCookie("dev_appserver_login");g=(g)?g.replace(/\"/g,""):this.getCookie("ACSID");g=(g)?g.substring(6,20):null;return"safe"+g};f.prototype.hideAllCategoriesExcept=function(j){for(var h=0;h<this.categories.length;h++){var g=this.categories[h];var k=g.childNodes[0].childNodes[0];if(g!=j){g.className="category categoryClosed";k.className="expand"}else{g.className="category categoryOpen";k.className="collapse"}}};f.prototype.indentCodeWithTheseSpaces=function(h,i){h=i.concat(h);var k=h.indexOf("\n");while(k!=-1){var j=h.slice(0,k);var g=h.slice(k+1);g=("\n"+i).concat(g);h=j.concat(g);k=h.indexOf("\n",k+1)}return h};f.prototype.init=function(g){this.currentEditor=window.jsEditor;this.codeEditorFrames={editJS:document.getElementById("editJS"),editMixed:document.getElementById("editMixed")};this.insertJavascriptRegex=/[ ]*INSERT_JAVASCRIPT_HERE/;this.ie=($.browser.msie);this.ie6=(this.ie&&$.browser.version<7);this.runBox=new d();this.runBox.init(this,!$.browser.msie);this.codeDiv=g;this.createCategories();this.addShowHideClicks();this.uiEffects=new b();this.uiEffects.init(this);if(window.logoutUrl){this.putSafetyCookieInForms()}this.loadCodesiteFeed()};f.prototype.insertJavascript=function(h,g){h=h.replace(this.insertJavascriptRegex,g);return h};f.prototype.linkCode=function(){var g=a;this.getFullSrc(this.sendCodeToServer,g)};f.prototype.loadCode=function(h,i){var j=h.split(".");var k=j[j.length-1];var g=e[k.toLowerCase()];this.loadRemotely(h,g,i)};f.prototype.loadCodesiteFeed=function(){var g=document.createElement("script");g.src="http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://code.google.com/feeds/p/google-ajax-examples/svnchanges/basic&num=20&callback=is.addNewSampleMarkers";g.type="text/javascript";document.body.appendChild(g)};f.prototype.loadRemotely=function(h,g,i){var j=this;if(h.indexOf("?id=")!=-1){h+="&sc="+this.getSafetyToken()}$.get(h,function(k){if(i){j.changeCodeMirror(k)}})};f.prototype.nameToHashName=function(g){var h=g.toLowerCase();h=h.replace(/ /g,"_");return h};f.prototype.putSafetyCookieInForms=function(){var g=this.getSafetyToken();if(g){$("#safetyCookie").attr("value",g)}};f.prototype.sampleFileNameToObject=function(o){for(var n=0;n<codeArray.length;n++){for(var l=0;l<codeArray[n].samples.length;l++){var h=codeArray[n].samples[l];for(var g=0;g<h.files.length;g++){var m=h.files[g];if(o==m){h.category=codeArray[n].category;h.categoryDocsUrl=codeArray[n].docsUrl||null;return h}}}}return null};f.prototype.sampleNameToObject=function(g){for(var l=0;l<codeArray.length;l++){for(var k=0;k<codeArray[l].samples.length;k++){var h=codeArray[l].samples[k];if(h.sampleName==g){h.category=codeArray[l].category;h.categoryDocsUrl=codeArray[l].docsUrl||null;return h}}}};f.prototype.saveCode=function(){var j=this.getCurFilename();var g=this.sampleFileNameToObject(j);this.putSafetyCookieInForms();if(g.category=="Saved Code"){var h=confirm("Are you sure you want to overwrite this code?");if(h){var i=this.getCode();i=i.replace(/\n/g,"NEWLINE!!!");$("#jscodeSaveForm").attr("value",i);$("#boilerplateLoc").attr("value",g.boilerplateLoc);$("#idSaveForm").attr("value",g.id);$("#saveForm").submit()}}else{this.uiEffects.showSaveForm()}};f.prototype.sendCodeToServer=function(g){g=g.replace(/\n/g,"NEWLINE!!!");$("#codeHolder").attr("value",g);$("#linkCodeForm").get(0).submit()};f.prototype.setDemoTitle=function(i){var g=i.sampleName;var h=i.category.split("-");var j=$("<div>"+(h[1]?h[1]:h[0])+" > "+g+"</div>");if(i.docsUrl||i.categoryDocsUrl){$("#docsLink").attr("href",(i.docsUrl||i.categoryDocsUrl)).css("display","block")}else{$("#docsLink").css("display","none")}$("#demoTitle").html(j);$("#saveSampleName").attr("value","Custom "+g);$("#tagsSaveForm").attr("value",i.tags)};f.prototype.showSample=function(g,h){me=this;return function(){var n=me.getCurFilename()||null;if(n){me.changeSamplesBoilerplateTo(n,me.temporaryBoilerplate)}var q=me.sampleNameToObject(g);var k=q.files;var p=q.li;var j=q.category.split("-");var m=j[0];var t=me.codeLIs;var s=true;me.temporaryBoilerplate=q.boilerplateLoc;if(q.boilerplateLoc!=""){me.useJsEditor()}else{me.useMixedEditor()}me.currentEditor.clearBreakPoints();me.runBox.iFrameLoaded=false;me.setDemoTitle(q);var o;for(o=0;o<t.length;o++){t[o].className=""}if(!h){window.location.hash=me.nameToHashName(g)}p.className="selected";me.currentCode=new Object();for(o=0;o<k.length;o++){var l=k[o];var u="lb";if(o==0){u="db";me.loadCode(l,true)}else{me.loadCode(l,false)}}me.hideAllCategoriesExcept(document.getElementById(m));me.curI=k[0];try{if(window.pageTracker){window.pageTracker._trackPageview()}}catch(r){}}};f.prototype.toggleShowHideLIs=function(g){return function(){var h=g.nextSibling;if(h.nodeName.toLowerCase()=="a"){h=h.nextSibling}var i=g.childNodes[0];if(i.className=="expand"){i.className="collapse"}else{i.className="expand"}if(h.style.display=="none"){h.style.display="block"}else{h.style.display="none"}}};f.prototype.toggleShowHideSubCategories=function(g){return function(){var h=g.childNodes[0].childNodes[0];if(h.className=="expand"){h.className="collapse";g.className="category categoryOpen"}else{h.className="expand";g.className="category categoryClosed"}}};f.prototype.useJsEditor=function(){this.codeEditorFrames.editJS.style.display="inline";this.currentEditor=window.jsEditor};f.prototype.useMixedEditor=function(){this.codeEditorFrames.editJS.style.display="none";this.currentEditor=window.mixedEditor};function b(){this.is=new Object();this.numHTMLEditors;this.uiEls;this.dropdownTimer;this.draggingMid}b.prototype.init=function(g){this.is=g;this.numHTMLEditors=0;if(this.is.ie6){this.fixPNGs()}this.initAutoComplete();this.setCodeMenuButtonClicks();this.setMenuScrollHeight();this.initDraggables()};b.prototype.fixPNGs=function(){$.getScript("js/jquery.pngFix.pack.js",function(){$(document).pngFix()})};b.prototype.setCodeMenuButtonClicks=function(){var h=this;var i=$("#codeMenuButtonContainer");var g=$("#codeMenuDropdown");$("#dropdownButton").bind("mousedown",function(){h.toggleDropdown("codeMenuDropdown");return false});i.bind("mouseout",function(){h.dropdownTimer=window.setTimeout("window.is.uiEffects.toggleDropdown('codeMenuDropdown', true);",100)});i.bind("mouseover",function(){if(h.dropdownTimer){window.clearTimeout(h.dropdownTimer)}});g.bind("mouseout",function(){h.dropdownTimer=window.setTimeout("window.is.uiEffects.toggleDropdown('codeMenuDropdown', true);",100)});g.bind("mouseover",function(){if(h.dropdownTimer){window.clearTimeout(h.dropdownTimer)}})};b.prototype.setMenuScrollHeight=function(){var h=$("#selectCode");h.scrollTop(0);var g=$("li.selected");var i=($(g).position().top-h.position().top)-(h.height()/2);if(i>0){h.scrollTop(i)}};b.prototype.closeDialog=function(g){$("#grayOverlay").css("display","none");$("#"+g).css("display","none")};b.prototype.createAutoComplete=function(){$("#search").autocomplete({data:is.autoCompleteData,matchContains:true,width:"auto",scroll:false,scrollHeight:"400px",formatResult:function(g){g=g[0].split(" <sup")[0];return g},formatItem:function(){if(arguments.length>3){if(!$(".ui-autocomplete-results")[0].getAttribute("id")){$(".ui-autocomplete-results")[0].id="acDiv"}}return arguments[0][0]}})};b.prototype.setAutoCompleteClicks=function(){$("#search").autocomplete("result",function(i,g,h){var j=h.split(" <sup>")[0];document.getElementById("edit").focus();window.is.showSample(j)();return j})};b.prototype.createAutoCompleteDropShadow=function(){$("#search").bind("keyup",function(){var g=$("#acDiv");try{if(g.position()&&g.css("display")!="none"&&$("#acShadowDiv").length==0){$(g).append($('<div id="acShadowDiv" class="">&nbsp</div>'))}else{}}catch(h){}})};b.prototype.initAutoComplete=function(){$("#searchInputContainer").show();this.createAutoComplete();this.setAutoCompleteClicks();if(!this.is.ie){this.createAutoCompleteDropShadow()}};b.prototype.resizeAndShowDialog=function(h){var i=$(document.body).width();var k=$(window).height()+15;var g=(i/2)-200;var j=(k/2)-150;$("#grayOverlay").css("width",i+"px").css("height",k+"px").css("display","inline");$("#"+h).css("left",g+"px").css("top",j+"px").css("display","block")};b.prototype.showSaveForm=function(){this.resizeAndShowDialog("saveDiv");$(window).resize(function(){window.is.uiEffects.resizeAndShowDialog("saveDiv")});var g=this.is.sampleFileNameToObject(this.is.getCurFilename());var i=g.boilerplateLoc;$("#boilerplateLoc").attr("value",i);var h=this.is.getCode();h=h.replace(/\n/g,"NEWLINE!!!");$("#jscodeSaveForm").attr("value",h)};b.prototype.showGetChromeFrameDiv=function(){window.is.uiEffects.resizeAndShowDialog("getChromeFrameDiv");$(window).resize(function(){window.is.uiEffects.resizeAndShowDialog("getChromeFrameDiv")})};b.prototype.toggleDropdown=function(g,h){var i=$("#"+g);if(h){i.removeClass("expanded");return}if(i.hasClass("expanded")){i.removeClass("expanded")}else{i.addClass("expanded")}};b.prototype.initDraggables=function(){var g=this;this.draggingMid=false;this.editDiv=$("#edit");this.editOffset=this.editDiv.position().top+9;this.draggersMid=$(".draggerMid");this.dragsafeDiv=$("#dragsafe");this.selectCodeDiv=$("#selectCode");this.draggerBot=$(".draggerBot");this.draggingBot=false;this.runFrame=null;this.runFrameOffset=null;this.draggersMid.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false}).mousedown(function(){g.draggingMid=true;$().one("mouseup",function(){g.draggingMid=false;g.dragsafeDiv.css("top","-800px").css("left","-800px");if(is.currentEditor==window.jsEditor){var h=$(window.jsEditor.frame).css("height");$(window.mixedEditor.frame).css("height",h)}else{var h=$(window.mixedEditor.frame).css("height");$(window.jsEditor.frame).css("height",h)}})});this.draggerBot.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false}).mousedown(function(){g.runFrame=$("#runFrame");g.runFrameOffset=g.runFrame.position().top;g.draggingBot=true;$().one("mouseup",function(){g.draggingBot=false;g.dragsafeDiv.css("top","-800px").css("left","-800px")})});$().mousemove(function(k){if(g.draggingMid){var i=k.clientY-400;var j=k.clientX-400;var h=(k.clientY-g.editOffset+$().scrollTop())+"px";g.dragsafeDiv.css("top",i+"px").css("left",j+"px");$(is.currentEditor.frame).css("height",h);g.editDiv.css("height",h);g.selectCodeDiv.css("height",h)}if(g.draggingBot){var i=k.clientY-400;var j=k.clientX-400;var h=(k.clientY-g.runFrameOffset+$().scrollTop())+"px";g.dragsafeDiv.css("top",i+"px").css("left",j+"px");g.runFrame.css("height",h)}})};function d(){this.outputContainer;this.runBoxPoppedOut;this.popoutWindow;this.is;this.runBoxDiv;this.popoutRunBoxDiv;this.resizable;this.iFrameLoaded}d.prototype.init=function(h,g){this.resizable=g;this.runBoxDiv=document.getElementById("runbox");this.runBoxPoppedOut=false;this.outputContainer=$("#outputContainer");this.is=h};d.prototype.insertDebuggingTools=function(h){var g=(function(){var j=document.createElement("link");j.rel="stylesheet";j.href="http://www.lisbakken.com/debugStyles.css";j.type="text/css";j.media="screen";j.charset="utf-8";document.getElementsByTagName("head")[0].appendChild(j);window.doContinue=true;window.setContinue=function(l){window.doContinue=l;var n=document.getElementById("debugBar");var m=document.getElementById("debugBarText");if(n){if(l){n.className="debugBarRunning";m.innerHTML="Complete."}else{n.className="debugBarPaused";m.innerHTML="Paused (Line:"+window.curBreakLineNum+")"}}else{window.doContinue=false}};function k(l){var m=window.onload;if(typeof window.onload!="function"){window.onload=l}else{window.onload=function(){m();l()}}}window.toggleFirebug=function(l){if(!window.firebug.env.minimized||(l&&l.closeIt)){window.firebug.env.minimized=true;window.firebug.el.main.environment.addStyle({height:"35px"});window.firebug.el.mainiframe.environment.addStyle({height:"35px"});window.firebug.el.button.maximize.environment.addStyle({display:"block"});window.firebug.el.button.minimize.environment.addStyle({display:"none"});window.firebug.win.refreshSize()}else{window.firebug.env.minimized=false;window.firebug.el.button.minimize.environment.addStyle({display:"block"});window.firebug.el.button.maximize.environment.addStyle({display:"none"});window.firebug.win.setHeight(firebug.env.height)}};k(function(){var l=document.createElement("div");l.id="debugBar";l.className=(window.doContinue)?"debugBarRunning":"debugBarPaused";l.innerHTML='<div class="debugBarTop">\n</div>\n<div class="debugBarTile">\n<div class="debugBarContent">\n<a href="#" class="debugContinuePaused" onclick="window.setContinue(true);return false;"><img border=0 src="/images/debug-btn-continue.png"></a>\n<img class="debugContinueRunning" src="/images/debug-btn-continue.png">\n<a href="#" onclick="window.toggleFirebug();return false;"><img border=0 src="/images/debug-btn-firebug-lite.png"></a>\n<span id="debugBarText">\n'+((window.doContinue)?"Complete.":"Paused (Line:"+window.curBreakLineNum+")")+'</span>\n</div>\n</div>\n<div class="debugBarBottom">\n</div>\n';window.document.body.appendChild(l);if(window.firebug.el&&window.firebug.el.main&&window.firebug.el.main.environment){window.toggleFirebug()}})});var i='<script type="text/javascript" src="http://savedbythegoog.appspot.com/firebug.js"><\/script>\n<script type="text/javascript">firebug.env.height = 220;\nfirebug.env.liteFilename = \'firebug.js\';\n';if(h.indexOf("<head>")==-1){alert("Sample must have <head> element")}h=h.replace("<head>","<head>\n"+i+"("+g.toString()+")();<\/script>");return h};d.prototype.insertBreakPoints=function(j,n){var q=[];for(m in n){if(n[m]==true){q.push(m)}}function s(v,w){var u=v.indexOf("}",w);if(u!=-1){u+=1;var x=v.substring(0,u+1);var t=(x.split("}").length-1)-(x.split("{").length-1);if(t==1){var i=u-1;v=v.substring(0,i);return v}return s(v,u)}else{return v}}function l(i,u){var t="\nwindow.curBreakLineNum = "+u+";\n";t+="window.setContinue(false);\n";t+="function breakpointAtLine"+u+"() {\n";t+="if (!doContinue) {\n";t+="if (window.scheduledConsoleLogs && window.scheduledConsoleLogs.length > 0) {\n";t+="for (var i =0; i < window.scheduledConsoleLogs.length; i++) {\n";t+="console.log(eval(window.scheduledConsoleLogs[i]));\n";t+="}\n";t+="}\n";t+="window.scheduledConsoleLogs = [];\n";t+="window.setTimeout(breakpointAtLine"+u+", 100);\n";t+="} else {\n";t+=i+"\n";t+="}\n";t+="}\n";t+="breakpointAtLine"+u+"();\n";return t}for(var m=q.length-1;m>=0;m--){var r=q[m];var g=0;var o=0;while(g+1!=r){o=j.indexOf("\n",o+1);if(o==-1){window.console.log("AddBreakPointCode failed.");break}else{g++}}var h=j.substring(0,o);var p=j.substring(o);var k=s(p,0);p=p.replace(k,"");k=l(k,r);h=h.concat(k);h=h.concat(p);j=h}return j};d.prototype.hideOnScreenRun=function(){};d.prototype.createIframe=function(h){if($.browser.safari){var g=$('<iframe id="runFrame" style="height: 450px;" onload="is.runBox.iFrameLoaded = true;"></iframe>');$(this.runBoxDiv).empty().append(g);g=g.get(0);g.src=h}else{var g=$('<iframe src="'+h+'" style="height: 450px;" onload="is.runBox.iFrameLoaded = true;" id="runFrame"></iframe>');$(this.runBoxDiv).empty().append(g)}};d.prototype.createIframeOrPopout=function(h){var i="http://savedbythegoog.appspot.com/retrieve_cache?unique_id="+h;if(!is.runBox.runBoxPoppedOut){window.is.runBox.createIframe(i)}else{var g=window.is.runBox.popoutWindow.document.getElementById("runbox");g.innerHTML="";window.is.runBox.popoutWindow.addIframe(i)}};d.prototype.sendCodeToSavedByTheGoog=function(g){var h=this;return function(j){var k=location.protocol+"//"+location.host+"/apis/ajax/playground/cacheCode";var i={};if(g&&g.debugMode){j=h.insertDebuggingTools(j)}i.code=j;$.post(k,i,window.is.runBox.createIframeOrPopout)}};d.prototype.runCode=function(o){if(o&&o.defaultSample){var h=this.is.getCurFilename();var l=this.is.sampleFileNameToObject(h);if(l.category!="Saved Code"){var m=location.protocol+"//"+location.host+location.pathname;var n=m+l.files[0];n=encodeURIComponent(n);var i=m+l.boilerplateLoc;i=encodeURIComponent(i);uniqueID=i+"%7C"+n+"&defaultSample=true";this.createIframeOrPopout(uniqueID);return}}var g=this.is.getCode();if(this.is.currentEditor==window.mixedEditor){this.sendCodeToSavedByTheGoog(o)(g)}else{var k=a;if(o&&o.debugMode){var j=this.is.currentEditor.getBreakPoints();j=(j.length==0)?null:j;g=this.insertBreakPoints(g,j)}this.is.getFullSrc(this.sendCodeToSavedByTheGoog(o),k,g)}};d.prototype.changeToPopout=function(){this.runBoxPoppedOut=true;$(this.outputContainer).hide();this.popoutWindow=window.open("popout.html","popout","left=20,top=20,width=600,height=500,toolbar=1,resizable=1")};d.prototype.changeToInline=function(){this.runBoxPoppedOut=false;$(this.outputContainer).show();this.runCode()};window.is=new f()})();function setBgColorWhite(){this.style.backgroundColor="white"}function setBgColorBlue(){this.style.backgroundColor="#E5ECF9"};