// http://javascript.crockford.com/remedial.html

function typeOf(value){var s=typeof value;if(s==='object'){if(value){if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))&&typeof value.splice==='function'){s='array';}}else{s='null';}}
return s;}
function isEmpty(o){var i,v;if(typeOf(o)==='object'){for(i in o){v=o[i];if(v!==undefined&&typeOf(v)!=='function'){return false;}}}
return true;}
String.prototype.entityify=function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");};String.prototype.quote=function(){var c,i,l=this.length,o='"';for(i=0;i<l;i+=1){c=this.charAt(i);if(c>=' '){if(c==='\\'||c==='"'){o+='\\';}
o+=c;}else{switch(c){case'\b':o+='\\b';break;case'\f':o+='\\f';break;case'\n':o+='\\n';break;case'\r':o+='\\r';break;case'\t':o+='\\t';break;default:c=c.charCodeAt();o+='\\u00'+Math.floor(c/16).toString(16)+
(c%16).toString(16);}}}
return o+'"';};String.prototype.supplant=function(o){var i,j,s=this,v;for(;;){i=s.lastIndexOf('{');if(i<0){break;}
j=s.indexOf('}',i);if(i+1>=j){break;}
v=o[s.substring(i+1,j)];if(typeOf(v)!=='string'&&typeOf(v)!=='number'){break;}
s=s.substring(0,i)+v+s.substring(j+1);}
return s;};String.prototype.trim=function(){return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1");};