// Append ?raw to the URL of this page to view the raw source (for 
// comments, copyright & licence), or ?pretty for a colorized version.

Array.prototype.______array='______array';var JSON={org:'http://www.JSON.org',copyright:'(c)2005 JSON.org',license:'http://www.crockford.com/JSON/license.html',stringify:function(arg){var c,i,l,s='',v;switch(typeof arg){case'object':if(arg){if(arg.______array=='______array'){for(i=0;i<arg.length;++i){v=this.stringify(arg[i]);if(s){s+=',';}
s+=v;}
return'['+s+']';}else if(typeof arg.toString!='undefined'){for(i in arg){v=arg[i];if(typeof v!='undefined'&&typeof v!='function'){v=this.stringify(v);if(s){s+=',';}
s+=this.stringify(i)+':'+v;}}
return'{'+s+'}';}}
return'null';case'number':return isFinite(arg)?String(arg):'null';case'string':l=arg.length;s='"';for(i=0;i<l;i+=1){c=arg.charAt(i);if(c>=' '){if(c=='\\'||c=='"'){s+='\\';}
s+=c;}else{switch(c){case'\b':s+='\\b';break;case'\f':s+='\\f';break;case'\n':s+='\\n';break;case'\r':s+='\\r';break;case'\t':s+='\\t';break;default:c=c.charCodeAt();s+='\\u00'+Math.floor(c/16).toString(16)+
(c%16).toString(16);}}}
return s+'"';case'boolean':return String(arg);default:return'null';}},parse:function(text){var at=0;var ch=' ';function error(m){throw{name:'JSONError',message:m,at:at-1,text:text};}
function next(){ch=text.charAt(at);at+=1;return ch;}
function white(){while(ch){if(ch<=' '){next();}else if(ch=='/'){switch(next()){case'/':while(next()&&ch!='\n'&&ch!='\r'){}
break;case'*':next();for(;;){if(ch){if(ch=='*'){if(next()=='/'){next();break;}}else{next();}}else{error("Unterminated comment");}}
break;default:error("Syntax error");}}else{break;}}}
function string(){var i,s='',t,u;if(ch=='"'){outer:while(next()){if(ch=='"'){next();return s;}else if(ch=='\\'){switch(next()){case'b':s+='\b';break;case'f':s+='\f';break;case'n':s+='\n';break;case'r':s+='\r';break;case't':s+='\t';break;case'u':u=0;for(i=0;i<4;i+=1){t=parseInt(next(),16);if(!isFinite(t)){break outer;}
u=u*16+t;}
s+=String.fromCharCode(u);break;default:s+=ch;}}else{s+=ch;}}}
error("Bad string");}
function array(){var a=[];if(ch=='['){next();white();if(ch==']'){next();return a;}
while(ch){a.push(value());white();if(ch==']'){next();return a;}else if(ch!=','){break;}
next();white();}}
error("Bad array");}
function object(){var k,o={};if(ch=='{'){next();white();if(ch=='}'){next();return o;}
while(ch){k=string();white();if(ch!=':'){break;}
next();o[k]=value();white();if(ch=='}'){next();return o;}else if(ch!=','){break;}
next();white();}}
error("Bad object");}
function number(){var n='',v;if(ch=='-'){n='-';next();}
while(ch>='0'&&ch<='9'){n+=ch;next();}
if(ch=='.'){n+='.';while(next()&&ch>='0'&&ch<='9'){n+=ch;}}
if(ch=='e'||ch=='E'){n+='e';next();if(ch=='-'||ch=='+'){n+=ch;next();}
while(ch>='0'&&ch<='9'){n+=ch;next();}}
v=+n;if(!isFinite(v)){}else{return v;}}
function word(){switch(ch){case't':if(next()=='r'&&next()=='u'&&next()=='e'){next();return true;}
break;case'f':if(next()=='a'&&next()=='l'&&next()=='s'&&next()=='e'){next();return false;}
break;case'n':if(next()=='u'&&next()=='l'&&next()=='l'){next();return null;}
break;}
error("Syntax error");}
function value(){white();switch(ch){case'{':return object();case'[':return array();case'"':return string();case'-':return number();default:return ch>='0'&&ch<='9'?number():word();}}
return value();}};if(!document.body){document.body=document.getElementsByTagName("body")[0];}
var queue=[new QueueItem("student","http://www.mezzoblue.com/zengarden/alldesigns/student/"),new QueueItem("student","http://www.mezzoblue.com/zengarden/alldesigns/student/002/")];var completed=[];var failed=[];var output=[];var categories={"conceptual":12,"fun":null,"minimal":4,"official":9,"specialeffects":null,"themes":2,"zengarden":2,"allothers":3,};function QueueItem(cat,url){var self=this;this.toString=function(){return self.url;};this.url=url;this.category=cat;};function createQueue(){var baseString="http://www.mezzoblue.com/zengarden/alldesigns/";function lpad(num){num=num.toString();return(num.length==2)?"0"+num:(num.length==1)?"00"+num:num;};for(cat in categories){queue[queue.length]=new QueueItem(cat,baseString+cat+"/");if(categories[cat]!=null){for(var i=1;i<(categories[cat]+1);i++){queue[queue.length]=new QueueItem(cat,baseString+cat+"/"+lpad(i)+"/");}}}};createQueue();function ZenEntry(category,number,name,url,nation,cssfile,title){this.number=number;this.name=name;this.url=url;this.nation=nation;this.cssfile=cssfile;this.title=title;};function locationContains(doc,needle){return(doc.location.href.toString().indexOf(needle)>-1);};function processPage(queueItem,doc){var content=doc.getElementById("mainContent");if(!content)throw"#mainContent not found";for(var i=0;i<content.childNodes.length;i++){if(content.childNodes[i].className&&content.childNodes[i].className.match(/\s*contentarea\s*/i)){content=content.childNodes[i];break;}}
if(content==document.getElementById("mainContent"))throw"contentarea div not found";lis=content.getElementsByTagName("ul")[1].getElementsByTagName("li");for(var i=0;i<lis.length;i++){lis[i].style.border="1px dotted purple";processListItem(doc,queueItem,lis[i]);}};function processListItem(doc,queueItem,li){var nation=(li.getElementsByTagName("img")[0])?li.getElementsByTagName("img")[0].getAttribute("alt"):undefined;as=li.getElementsByTagName("a");var range=doc.createRange();range.selectNodeContents(li);var name=range.toString().replace(/^.*by |\s$/,"");var cssfile=as[0].getAttribute("href").replace(/^\s*http:\/\/(www\.)?csszengarden\.com\/\?cssfile=/i,"");if(cssfile.match(/^\//)){cssfile="http://www.csszengarden.com"+cssfile;}
var number=(li.innerHTML.replace(/^\s*<img[^\>]*>\s*/i,"").match(/[0-9]{0,2}[1-9]\s/g))?parseInt(li.innerHTML.replace(/^\s*<img[^\>]*>\s*([0-9]{0,2}[1-9]).*/i,"$1"),10):undefined;var category=queueItem.category;var range=doc.createRange();range.selectNodeContents(as[0]);var title=range.toString().replace(/^\s|\s$/g,"");var url=(as[1])?as[1].getAttribute("href"):undefined;output.push(new ZenEntry(category,number,name,url,nation,cssfile,title));sendInfo(JSON.stringify(output[output.length-1]));};var step=0;function doStage(){if(!iframe.contentDocument||!iframe.contentDocument.body||!iframe.contentDocument.body.innerHTML||!iframe.contentDocument.body.innerHTML.indexOf("© Copyright 2001 – 2005, Dave Shea, all rights reserved.")<0){setTimeout(doStage,200);return;}else if(iframe.contentDocument.body.innerHTML.indexOf("error 404 - file not found")>-1){alert("404 error accessing\n"+queue[0].toString()+"\n\nMoving on to next item.");failed.push(queue.shift());iframe.setLocation(queue[0].toString());setTimeout(doStage,500);}{var success=true;try{processPage(queue[0],iframe.contentDocument);}catch(e){processException(e);success=false;}
var item=queue.shift();if(success){completed.push(item);}else{failed.push(item);}
if(queue[0]){iframe.contentDocument.body.innerHTML="";step++;iframe.setLocation(queue[0].toString());setTimeout(doStage,500);}}};function processException(e){sendInfo(e);};function sendInfo(info){data.value+="\n\n"+info.toString();data.selectionEnd=data.length-1;};function setInfo(string){data.value=string;};document.body.innerHTML="";var iframe=document.createElement("iframe");iframe.setAttribute("style","position:absolute;right: 10px;height:300px;left:10px;top:10px;");document.body.appendChild(iframe);iframe.setLocation=function(newLocation){this.setAttribute("src",newLocation);};var data=document.createElement("textarea");data.setAttribute("name","data");data.style.position="absolute";data.style.left="10px";data.style.right="10px";data.style.top="320px";data.style.height="200px";document.body.appendChild(data);iframe.setLocation(queue[0]);setInfo(JSON.stringify(queue).replace(/,\{"url"/g,',\n{"url"'));setTimeout(function(){setInfo("");doStage();},3000);
