var SpreadsheetUtil={h:{},c:function(a,b){return a+"/"+b},o:function(a,b){return this.h[this.c(a,b)]},q:function(a,b){delete this.h[this.c(a,b)]},addSheetLoaderMap:function(a,b,c){var d=this.c(a,b);SpreadsheetUtil.h[d]=c},jsonCallback:function(a){if(!!a.feed){var b=a.feed.id.$t,c="",d="",e=/^http:\/\/spreadsheets\.google\.com\/feeds\/cells\/([^\/ ]+)\/([^\/ ]+)\/\S+/;if(b.match(e)){c=RegExp.$1;d=RegExp.$2}var f=this.o(c,d),h=f.getSheet(c,d);h.parse(a.feed);this.q(c,d);--f.e==0&&f.executeCallback()}}}; function DataRow(){this.a={}}DataRow.prototype.addData=function(a,b){this.a[a]=b};DataRow.prototype.getData=function(a){return this.a[a]};DataRow.prototype.iterateData=function(a,b){var c=b||null;for(var d in this.a)a.call(c,d,this.a[d])};function Spreadsheet(a,b){this.p=a;this.r=b;this.f="";this.d=1;this.g=[];this.k={};this.j=false}Spreadsheet.prototype.i=function(a,b){this.k[a]=b};Spreadsheet.prototype.getKeyId=function(){return this.p};Spreadsheet.prototype.getSheetId=function(){return this.r}; Spreadsheet.prototype.getName=function(){return this.f};Spreadsheet.prototype.getRows=function(){return this.g};Spreadsheet.prototype.setHeaderRow=function(a){if(!a||a<1)throw new Error("Spreadsheet.setHeaderRow(): index must be a number greater than 0");this.d=a};Spreadsheet.prototype.setCacheEnabled=function(a){this.j=a};Spreadsheet.prototype.isParsed=function(){return Boolean(this.f)};Spreadsheet.prototype.isCached=function(){return this.j&&this.isParsed()}; Spreadsheet.prototype.parse=function(a){this.f=a.title.$t;this.g.length=0;var b=null,c,d=0,e;for(;e=a.entry[d];d++){var f=/([A-Za-z]+)(\d+)/.exec(e.title.$t),h=f[1],g=parseInt(f[2],10);if(g==this.d){this.i(h,e.content.$t);c=g}else if(g>this.d){if(c!=g){c=g;b=new DataRow;this.g.push(b)}b.addData(this.k[h],e.content.$t)}}};function SpreadsheetLoader(){this.b=[];this.m=function(){};this.e=0} SpreadsheetLoader.prototype.n=function(a){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("head")[0];c&&c.appendChild(b)};SpreadsheetLoader.prototype.l=function(a){return["http://spreadsheets.google.com/feeds/cells/",a.getKeyId(),"/",a.getSheetId(),"/public/basic?alt=json-in-script&callback=SpreadsheetUtil.jsonCallback"].join("")};SpreadsheetLoader.prototype.addSheet=function(a){this.getSheet(a.getKeyId(),a.getSheetId())||this.b.push(a)}; SpreadsheetLoader.prototype.getSheet=function(a,b){var c=0,d;for(;d=this.b[c];c++)if(a==d.getKeyId()&&b==d.getSheetId())return d};SpreadsheetLoader.prototype.loadSheets=function(a){if(typeof a!="function")throw new Error("SpreadsheetLoader.load(): callback must be a Function");this.m=a;var b=0,c;for(;c=this.b[b];b++)if(!c.isCached()){this.n(this.l(c));this.e++;SpreadsheetUtil.addSheetLoaderMap(c.getKeyId(),c.getSheetId(),this)}this.e==0&&this.executeCallback()}; SpreadsheetLoader.prototype.executeCallback=function(){this.m(this.b)};