/* Copyright 2007 Google */ (function() { function f(){this.j=null;this.ea=0;if(!window.RegExp)return;var a=[f.OPERA,f.IE,f.SAFARI,f.FIREFOX,f.NETSCAPE,f.MOZILLA],b=navigator.userAgent.toLowerCase();for(var e=0;e0)this.p(this.n[0])};j.prototype.F= function(a){var b=a[A];if(!b)return;while(b.length>0)this.p(b[0])};j.prototype.m=function(a){return a==window||a==window.document||typeof a.nodeType!="undefined"};function C(a,b,e){var c=e||{},d;if(typeof ActiveXObject!="undefined")d=new ActiveXObject("Microsoft.XMLHTTP");else if(window.XMLHttpRequest)d=new XMLHttpRequest;else throw new Error("XMLHttpRequest not supported");if(b)d.onreadystatechange=function(){if(d.readyState==4){b.call(null,d.responseText,d.status);d.onreadystatechange=r}};var g="GET";if(c.post||c.body)g="POST";d.open(g,a,!c.synchronous);if(g=="POST"){var h=c.contentType||"application/x-www-form-urlencoded";d.setRequestHeader("Content-Type", h)}if(c.username||c.password)d.send(c.body,c.username,c.password);else d.send(c.body);if(c.synchronous&&b)b.call(null,d.responseText,d.status)};function k(a,b){return function(){b.apply(a,arguments)}}function B(a,b){for(var e=0;e'); g.appendChild(h)}catch(l){h=this.b("input",g);h.type="checkbox"}h.name="task";h.value=this.g;h.checked=this.G;j.addListener(h,"click",k(this,this.K));j.addListener(h,"mousedown",u);var s=this.b("td",d,"description");this.d=this.b("div",s);this.d.style.position="relative";this.u();var o=new z(b,true);j.addListener(o,"dragstart",k(this,this.M));j.addListener(o,"dragend",k(this,this.L));j.addListener(o,"drag",k(this,this.N));j.addListener(o,"click",k(this,this.edit));this.D=h;this.a=b;return b};E.prototype.K= function(){if(this.D.checked)w(this.a,"completed");else y(this.a,"completed");var a=["id="+encodeURIComponent(this.g)];if(this.D.checked)a.push("completed=1");C("/settaskcompleted.do",null,{post:true,body:a.join("&")})};E.prototype.edit=function(){if(this.i)return;var a;try{a=document.createElement('')}catch(b){a=this.b("input");a.type="text"}a.style.position="absolute";a.style.left=this.d.offsetLeft-3+"px";a.style.top=this.d.offsetTop-3+"px";a.style.width=this.d.offsetWidth+"px"; a.style.border="1px solid silver";a.style.padding="2px";a.style.margin="0";a.style.zIndex=1;a.value=this.k;t(this.a);j.addListener(a,"keypress",k(this,this.O));j.addListener(a,"blur",k(this,this.v));j.addListener(a,"mousedown",u);this.d.parentNode.appendChild(a);this.d.style.display="none";a.focus();this.i=a};E.prototype.O=function(a){if(a.keyCode==13){v(a);this.v()}else if(a.keyCode==27){v(a);this.r()}};E.prototype.r=function(){this.i.parentNode.removeChild(this.i);this.i=null;this.d.style.display= "";q(this.a)};E.prototype.v=function(){var a=this.i.value!=this.k;if(a){this.k=this.i.value;this.u()}this.r();if(a)this.save()};E.prototype.u=function(){this.d.innerHTML=" ";var a=this.b("span",null,"text");a.appendChild(document.createTextNode(this.k));this.d.insertBefore(a,this.d.firstChild)};E.prototype.save=function(){var a=["list="+encodeURIComponent(this.aa),"description="+encodeURIComponent(this.k)];if(this.g)a.push("task="+encodeURIComponent(this.g));C("/edittask.do",k(this,this.S),{post:true, body:a.join("&")})};E.prototype.S=function(a,b){if(b>=200&&b<300)this.g=a};E.prototype.M=function(){var a=document.createElement("div");a.style.width=this.a.offsetWidth+"px";a.style.height=this.a.offsetHeight+"px";this.a.parentNode.insertBefore(a,this.a);m(this.a,0.5);this.c=a};E.prototype.N=function(){var a=this.a.parentNode,b=this.a.offsetTop,e=this.a.offsetTop+this.a.offsetHeight;for(var c=a.firstChild;c!=null;c=c.nextSibling){if(c==this.a||c==this.c)continue;var d=c.offsetTop,g=c.offsetTop+c.offsetHeight, h=(d+g)/2;if(d>e)continue;if(gh)if(c.nextChild!=this.c){a.removeChild(this.c);a.insertBefore(this.c,c.nextSibling);return}}};E.prototype.L=function(){if(!this.c)return;var a=this.a.parentNode;a.removeChild(this.a);this.a.style.position="relative";this.a.style.width="auto";this.a.style.height="auto";this.a.style.left="auto";this.a.style.top="auto";m(this.a,1);a.insertBefore(this.a,this.c);a.removeChild(this.c); this.c=null;j.trigger(this,"positionchanged")};E.prototype.b=function(a,b,e){var c=document.createElement(a);if(e)c.className=e;if(b)b.appendChild(c);return c};function F(a,b){this.g=a;this.x=b}F.prototype.attach=function(a){var b=document.createElement("div");b.className="tasklist";b.style.position="relative";a.appendChild(b);this.a=b;var e=[];for(var c=0;c