Converted Rico3 icons to CSS sprites. Moved minsrc and baselibs directories out of...
authorMatt Brown <dowdybrown@yahoo.com>
Sat, 7 May 2011 13:35:30 +0000 (13:35 +0000)
committerMatt Brown <dowdybrown@yahoo.com>
Sat, 7 May 2011 13:35:30 +0000 (13:35 +0000)
git-svn-id: svn://svn.code.sf.net/p/openrico/code/trunk/rico3@76 53df2df2-7ab5-4331-af62-ea79255fa4e2

87 files changed:
examples/asp/ex2editfilter.asp
examples/asp/ex2editfilterKW.asp
examples/asp/ex2nosession.asp
examples/dotnet/ex2editfilter.aspx
examples/dotnet/ex2nosession.aspx
examples/html/LoadRicoClient.js
examples/php/LoadRicoClient.php
examples/php/ex2editfilter.php
examples/php/ex2nosession.php
minsrc/baselibs/README.TXT [new file with mode: 0644]
minsrc/baselibs/glow.core-1.7.js [new file with mode: 0644]
minsrc/baselibs/prototype.js [new file with mode: 0644]
minsrc/ricoCalendar.js [new file with mode: 0644]
minsrc/ricoColorPicker.js [new file with mode: 0644]
minsrc/ricoDragDrop.js [new file with mode: 0644]
minsrc/ricoGridCommon.js [new file with mode: 0644]
minsrc/ricoLiveGrid.js [new file with mode: 0644]
minsrc/ricoLiveGridAjax.js [new file with mode: 0644]
minsrc/ricoLiveGridControls.js [new file with mode: 0644]
minsrc/ricoLiveGridForms.js [new file with mode: 0644]
minsrc/ricoLiveGridMenu.js [new file with mode: 0644]
minsrc/ricoSearch.js [new file with mode: 0644]
minsrc/ricoSimpleGrid.js [new file with mode: 0644]
minsrc/ricoTree.js [new file with mode: 0644]
minsrc/ricoUI.js [new file with mode: 0644]
plugins/asp/LoadRicoClient.asp
plugins/asp/ricoLiveGridForms.vbs
plugins/php/ricoLiveGridForms.php
ricoClient/css/coffee-with-milk.css
ricoClient/css/grayedout.css
ricoClient/css/rico.css
ricoClient/css/seaglass.css
ricoClient/css/warmfall.css
ricoClient/images/calarrow.png [deleted file]
ricoClient/images/calendaricon.gif [deleted file]
ricoClient/images/checkmark.gif [deleted file]
ricoClient/images/close_b.gif [deleted file]
ricoClient/images/close_w.gif [deleted file]
ricoClient/images/delete.gif [deleted file]
ricoClient/images/delete_w.gif [deleted file]
ricoClient/images/divider.gif [deleted file]
ricoClient/images/doc.gif [deleted file]
ricoClient/images/dotbutton.gif [deleted file]
ricoClient/images/drop.gif [deleted file]
ricoClient/images/filtercol.gif [deleted file]
ricoClient/images/folderclosed.gif [deleted file]
ricoClient/images/folderopen.gif [deleted file]
ricoClient/images/info_icon.gif [deleted file]
ricoClient/images/left_b.gif [deleted file]
ricoClient/images/left_w.gif [deleted file]
ricoClient/images/link.gif [deleted file]
ricoClient/images/m.gif [deleted file]
ricoClient/images/node.gif [deleted file]
ricoClient/images/nodeblank.gif [deleted file]
ricoClient/images/nodelast.gif [deleted file]
ricoClient/images/nodeline.gif [deleted file]
ricoClient/images/nodem.gif [deleted file]
ricoClient/images/nodemlast.gif [deleted file]
ricoClient/images/nodep.gif [deleted file]
ricoClient/images/nodeplast.gif [deleted file]
ricoClient/images/p.gif [deleted file]
ricoClient/images/removeFilter.gif [deleted file]
ricoClient/images/ricoIcons.gif [new file with mode: 0644]
ricoClient/images/right_b.gif [deleted file]
ricoClient/images/right_w.gif [deleted file]
ricoClient/images/sort_asc.gif [deleted file]
ricoClient/images/sort_desc.gif [deleted file]
ricoClient/images/tableFilterCollapse.gif [deleted file]
ricoClient/images/tableFilterExpand.gif [deleted file]
ricoClient/js/baselibs/README.TXT [deleted file]
ricoClient/js/baselibs/glow.core-1.7.js [deleted file]
ricoClient/js/baselibs/prototype.js [deleted file]
ricoClient/js/minsrc/ricoCalendar.js [deleted file]
ricoClient/js/minsrc/ricoColorPicker.js [deleted file]
ricoClient/js/minsrc/ricoDragDrop.js [deleted file]
ricoClient/js/minsrc/ricoGridCommon.js [deleted file]
ricoClient/js/minsrc/ricoLiveGrid.js [deleted file]
ricoClient/js/minsrc/ricoLiveGridAjax.js [deleted file]
ricoClient/js/minsrc/ricoLiveGridControls.js [deleted file]
ricoClient/js/minsrc/ricoLiveGridForms.js [deleted file]
ricoClient/js/minsrc/ricoLiveGridMenu.js [deleted file]
ricoClient/js/minsrc/ricoSearch.js [deleted file]
ricoClient/js/minsrc/ricoSimpleGrid.js [deleted file]
ricoClient/js/minsrc/ricoTree.js [deleted file]
ricoClient/js/minsrc/ricoUI.js [deleted file]
ricoClient/js/rico.js
ricoClient/js/rico_min.js

index e4f1600..3e39f11 100644 (file)
@@ -27,16 +27,13 @@ set RicoClient = Nothing
 \r
 function orders_FormInit() {\r
   var cal=new Rico.CalendarControl("Cal");\r
-  Rico.EditControls.register(cal, Rico.imgDir+'calarrow.png');\r
+  Rico.EditControls.register(cal, 'rico-icon rico-calarrow');\r
   \r
   var CustTree=new Rico.TreeControl("CustomerTree","CustTree.asp");\r
-  Rico.EditControls.register(CustTree, Rico.imgDir+'dotbutton.gif');\r
+  Rico.EditControls.register(CustTree, 'rico-icon rico-dotbutton');\r
 }\r
 </script>\r
 <style type="text/css">\r
-div.ricoLG_outerDiv thead .ricoLG_cell, div.ricoLG_outerDiv thead td, div.ricoLG_outerDiv thead th {\r
-       height:1.5em;\r
-}\r
 div.ricoLG_cell {\r
   white-space:nowrap;\r
 }\r
index 6f74943..9e254b9 100644 (file)
@@ -34,9 +34,6 @@ function orders_FormInit() {
 }\r
 </script>\r
 <style type="text/css">\r
-div.ricoLG_outerDiv thead .ricoLG_cell, div.ricoLG_outerDiv thead td, div.ricoLG_outerDiv thead th {\r
-       height:1.5em;\r
-}\r
 div.ricoLG_cell {\r
   white-space:nowrap;\r
 }\r
index 9200846..8cb71a4 100644 (file)
@@ -61,9 +61,6 @@ function orders_FormInit() {
 }\r
 </script>\r
 <style type="text/css">\r
-div.ricoLG_outerDiv thead .ricoLG_cell, div.ricoLG_outerDiv thead td, div.ricoLG_outerDiv thead th {\r
-       height:1.5em;\r
-}\r
 div.ricoLG_cell {\r
   white-space:nowrap;\r
 }\r
index 137777a..acca634 100644 (file)
@@ -51,9 +51,6 @@ function ex8_FormInit() {
 </script>\r
 \r
 <style type="text/css">\r
-div.ricoLG_outerDiv thead .ricoLG_cell, div.ricoLG_outerDiv thead td, div.ricoLG_outerDiv thead th {\r
-       height:1.5em;\r
-}\r
 div.ricoLG_cell {\r
   white-space:nowrap;\r
 }\r
index f0ad536..becd1a5 100644 (file)
@@ -62,9 +62,6 @@ function ex8_FormInit() {
 </script>\r
 \r
 <style type="text/css">\r
-div.ricoLG_outerDiv thead .ricoLG_cell, div.ricoLG_outerDiv thead td, div.ricoLG_outerDiv thead th {\r
-       height:1.5em;\r
-}\r
 div.ricoLG_cell {\r
   white-space:nowrap;\r
 }\r
index ef0f8c5..54833ff 100644 (file)
@@ -1,7 +1,8 @@
 Rico_CONFIG = {\r
   jsDir: "../../ricoClient/js/",       // directory containing Rico's javascript files\r
   cssDir: "../../ricoClient/css/",     // directory containing Rico's css files\r
-  imgDir: "../../ricoClient/images/",  // directory containing Rico's image files\r
+  imgResize: "../../ricoClient/images/resize.gif",\r
+  imgIcons: "../../ricoClient/images/ricoIcons.gif",\r
   enableLogging: false,    // enable console logging\r
   grid_striping: true,     // apply row striping to LiveGrids?\r
   LoadBaseLib: true,       // load base Javascript library (prototype, jQuery, etc)?\r
index 6d21f00..c24db98 100644 (file)
@@ -33,8 +33,8 @@ function SetConfig() {
   echo "Rico_CONFIG = {\n";\r
   if ($ricoLogging) echo "enableLogging: true,\n";\r
   echo "jsDir: '" . $jsDir . "',\n";\r
-  echo "cssDir: '" . $cssDir . "',\n";\r
-  echo "imgDir: '" . $imgDir . "'\n";\r
+  echo "imgResize: '" . $imgDir . "resize.gif',\n";\r
+  echo "imgIcons: '" . $imgDir . "ricoIcons.gif'\n";\r
   echo "};";\r
   echo "</script>\n";\r
 }\r
@@ -86,7 +86,6 @@ function LoadTheme($theme) {
   switch ($prefix) {\r
     case 'j':\r
       requireRicoJS("Themeroller");\r
-      //echo "<link type='text/css' rel='stylesheet' href='".$cssDir."jquery-base/ui.base.css' />";\r
       echo "<link type='text/css' rel='Stylesheet' href='" . $jQuery_theme_path . $theme."/jquery-ui.css' />";\r
       break;\r
     case 'r':\r
index dee9e32..50e6e5d 100644 (file)
@@ -31,9 +31,6 @@ function orders_FormInit() {
 
 <link href="../demo.css" type="text/css" rel="stylesheet" />
 <style type="text/css">
-div.ricoLG_outerDiv thead .ricoLG_cell, div.ricoLG_outerDiv thead td, div.ricoLG_outerDiv thead th {
-       height:1.5em;
-}
 div.ricoLG_cell {
   white-space:nowrap;
 }
index 64b7631..b212ba1 100644 (file)
@@ -61,9 +61,6 @@ function orders_FormInit() {
 
 <link href="../demo.css" type="text/css" rel="stylesheet" />
 <style type="text/css">
-div.ricoLG_outerDiv thead .ricoLG_cell, div.ricoLG_outerDiv thead td, div.ricoLG_outerDiv thead th {
-       height:1.5em;
-}
 div.ricoLG_cell {
   white-space:nowrap;
 }
diff --git a/minsrc/baselibs/README.TXT b/minsrc/baselibs/README.TXT
new file mode 100644 (file)
index 0000000..32689cb
--- /dev/null
@@ -0,0 +1,5 @@
+The files in this directory are included in the Rico distribution\r
+for the purpose of demonstrating the examples. Each of these libraries \r
+has licensing terms that are different from Rico itself. Make sure you\r
+understand the terms before deploying any library into a production \r
+environment.
\ No newline at end of file
diff --git a/minsrc/baselibs/glow.core-1.7.js b/minsrc/baselibs/glow.core-1.7.js
new file mode 100644 (file)
index 0000000..e6d6e0e
--- /dev/null
@@ -0,0 +1,20 @@
+/*     
+       Copyright 2009 British Broadcasting Corporation
+
+       Licensed under the Apache License, Version 2.0 (the "License");
+       you may not use this file except in compliance with the License.
+       You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+       See the License for the specific language governing permissions and
+       limitations under the License.
+*/
+(function(){var f={glow:true},b=/([$^\\\/()|?+*\[\]{}.-])/g,a=navigator.userAgent.toLowerCase(),k="1.7.3",r=0,g=[],m=0,q=[],o=0,s=false,n={VERSION:k,UID:"glow"+Math.floor(Math.random()*(1<<30)),isDomReady:window.gloader&&gloader.isReady,isReady:window.gloader&&gloader.isReady,env:function(){var u=[0,NaN],d=(/opera[\s\/]([\w\.]+)/.exec(a)||u)[1],v=d?NaN:(/msie ([\w\.]+)/.exec(a)||u)[1],x=(/rv:([\w\.]+).*gecko\//.exec(a)||u)[1],e=(/applewebkit\/([\w\.]+)/.exec(a)||u)[1],t=(/khtml\/([\w\.]+)/.exec(a)||u)[1],w=parseFloat;return{gecko:w(x),ie:w(v),opera:w(d),webkit:w(e),khtml:w(t),version:v||x||e||d||t,standardsMode:document.compatMode!="BackCompat"&&(!v||v>=6)};}(),module:function(u){var t=2,w=u.depends[0]||[],d=w.length,e=u.name,v=window.glow;if(u.library[1]!=n.VERSION){throw new Error("Cannot register "+e+": Version mismatch");}if(w[2]){for(;t<d;t++){if(!f[w[t]]){throw new Error("Module "+w[t]+" required before "+e);}}}u.builder(n);f[e]=true;return n;},ready:function(d){if(this.isReady){d();}else{q[o++]=d;}return this;},_readyBlockers:{},_addReadyBlock:function(d){if(!n._readyBlockers[d]){n._readyBlockers[d]=true;n.isReady=false;r++;}return n;},_removeReadyBlock:function(d){if(n._readyBlockers[d]){n._readyBlockers[d]=false;r--;if(!r){n.isReady=true;p();}}return n;},onDomReady:function(d){if(this.isDomReady){d();}else{g[m++]=d;}},lang:{trim:function(d){return d.replace(/^\s*((?:[\S\s]*\S)?)\s*$/,"$1");},toArray:function(e){if(e.constructor==Array){return e;}var u=[],t=0,d=e.length;for(;t<d;t++){u[t]=e[t];}return u;},apply:function(d,t){for(var e in t){d[e]=t[e];}return d;},map:function(e,x,w){if(Array.prototype.map){return Array.prototype.map.call(e,x,w||e);}if(!x.call){throw new TypeError();}var d=e.length,v=[],u=w||e,t=0;for(;t<d;t++){if(t in e){v[t]=x.call(u,e[t],t,e);}}return v;},replace:(function(){var d="g".replace(/g/,function(){return"l";})!="l",e=String.prototype.replace;return function(y,w,t){var z,v,x,u;if(!d||typeof(t)!="function"){return e.call(y,w,t);}if(!(w instanceof RegExp)){z=y.indexOf(w);return z==-1?y:e.call(y,w,t.call(null,w,z,y));}u=[];x=w.lastIndex=0;while((v=w.exec(y))!=null){z=v.index;u[u.length]=y.slice(x,z);u[u.length]=t.apply(null,v);if(w.global){x=w.lastIndex;}else{x=z+v[0].length;break;}}u[u.length]=y.slice(x);return u.join("");};})(),interpolate:function(t,w,u){var d,v,e,x;u=u||{};if(u.escapeHtml){if(!n.dom){throw new Error("glow.lang.interpolate - glow.dom is needed for escapeHtml");}x=n.dom.create("<div></div>");}if(u.delimiter==undefined){d=/\{[^{}]+\}/g;}else{v=u.delimiter.substr(0,1).replace(b,"\\$1");e=u.delimiter.substr(1,1).replace(b,"\\$1")||v;d=new RegExp(v+"[^"+v+e+"]+"+e,"g");}return t.replace(d,function(D){var A=D.slice(1,-1),C=A.split("."),B,z=0,y=C.length;if(A in w){B=w[A];}else{B=w;for(;z<y;z++){if(C[z] in B){B=B[C[z]];}else{return D;}}}if(u.escapeHtml){B=x.text(B).html();}return B;});},hasOwnProperty:{}.hasOwnProperty?function(d,e){return d.hasOwnProperty(e);}:function(x,y){var u=x[y],w=x.__proto__,t=w?w[y]:{};if(u!==t){return true;}var e=n.lang.hasOwnProperty(w,y),d=w[y]={},v=(x[y]!==d);delete w[y];if(e){w[name]=d;}return v;},extend:function(e,u,d){var t=function(){},v;t.prototype=u.prototype;v=new t();e.prototype=v;v.constructor=e;e.base=u;if(d){n.lang.apply(e.prototype,d);}},clone:function(t){var d,u,e;t=t.valueOf();if(typeof t!=="object"){return t;}else{if(t[0]||t.concat){e=[];d=t.length;while(d--){e[d]=arguments.callee(t[d]);}}else{e={};for(d in t){e[d]=arguments.callee(t[d]);}}return e;}}}},h=n.env,l=document;function c(){n.isDomReady=true;for(var d=0;d<m;d++){g[d]();}}function p(){if(s){return;}s=true;for(var d=0;d<o;){q[d]();d++;if(r){break;}}q=q.slice(d);o=o-d;s=false;}(function(){if(n.isDomReady){return;}n._addReadyBlock("glow_domReady");if(h.ie){if(typeof window.frameElement!="undefined"){l.attachEvent("onreadystatechange",function(){if(l.readyState=="complete"){l.detachEvent("onreadystatechange",arguments.callee);c();n._removeReadyBlock("glow_domReady");}});}else{(function(){try{l.documentElement.doScroll("left");}catch(u){setTimeout(arguments.callee,0);return;}c();n._removeReadyBlock("glow_domReady");})();}}else{if(n.env.webkit<525.13&&typeof l.readyState!="undefined"){var e=function(){if(/loaded|complete/.test(l.readyState)){c();n._removeReadyBlock("glow_domReady");}else{setTimeout(e,0);}};e();}else{var t=function(){if(t.fired){return;}t.fired=true;c();n._removeReadyBlock("glow_domReady");};if(l.addEventListener){l.addEventListener("DOMContentLoaded",t,false);}var d=window.onload;window.onload=function(){if(d){d();}t();};}}})();n.isSupported=!(h.ie<6||(h.gecko<1.9&&!/^1\.8\.1/.test(h.version))||h.opera<9||h.webkit<412);if(!n.isSupported){n._addReadyBlock("glow_browserSupport");}if(window.gloader){gloader.library({name:"glow",version:"1.7.3",builder:function(){return n;}});}else{if(window.glow){throw new Error("Glow global object already exists");}else{window.glow=n;}}if(n.ie){try{document.execCommand("BackgroundImageCache",false,true);}catch(j){}}})();
+/*@cc_on @*/
+/*@if (@_jscript_version > 5.5)@*/
+(window.gloader||glow).module({name:"glow.i18n",library:["glow","1.7.3"],depends:[["glow","1.7.3"]],builder:function(r){var A;var t={l:/^[a-z]$/,lv:/^[a-z]{2,3}$/,s:/^[A-Z][a-z]{3}$/,r:/^[A-Z]{2}|[0-9]{3}$/,v:/^[a-z0-9]{4,}$/};var s=1,k=2,l=4,j=8,p=s+k+l+j,f=s+l+j,x=s+k+j,c=s+j,y=s+k+l,e=s+l,d=s+k;var m={l:s,s:k,r:l,v:j},I=["l","s","r","v"],F={l:0,s:1,r:2,v:3};var C={};var b={};var o=w(document.documentElement.lang||"en")||w("en");function D(K){for(var J in t){if(t[J].test(K)){return J;}}return"";}function w(V){if(!V.split){V="";}var N=V.split("-"),Q=N.length,R=[],K={l:"",s:"",r:"",v:""},J=0,O=J,U=0,P,S;for(var M=0,T=I.length;M<T;M++){O=J;P=I[M];S=F[P];while((D(N[O]).indexOf(P)==-1)&&(O<Q)){O++;}if(O<Q){R[S]=N[O];U+=m[P];K[P]=N[O];N[O]="*";J=O;}}var L=R.join("-").replace(/-+/g,"-");if((L=="")||(L.substring(0,1)=="-")){return false;}else{return{canonical:L,mask:U,subtags:K};}}function g(K,M,J){var L;if((J&~K.mask)==0){L=K.subtags.l;if(k&J){L=L+"-"+K.subtags.s;}if(l&J){L=L+"-"+K.subtags.r;}if(j&J){L=L+"-"+K.subtags.v;}if(M(L)){return L;}}return false;}function a(K,N,J,L){var M;switch(K.mask){case f:if((M=g(K,N,f))){break;}case e:if((M=g(K,N,e))){break;}case p:if((M=g(K,N,p))){break;}case y:if((M=g(K,N,y))){break;}case x:if((M=g(K,N,x))){break;}case d:if((M=g(K,N,d))){break;}case c:if((M=g(K,N,c))){break;}case s:if((M=g(K,N,s))){break;}default:if(N("en")){M="en";}else{M=null;}}if(M==null){L();}else{J(M);}}function v(L){var J=o,K=w(L);if(K){o=K;o.next=J;}return A;}function H(){o=o.next||o;return A;}function B(){return o.canonical;}function h(M,L,Q){var J=w(L),P,O,K;if(J){P=C[J.canonical]=C[J.canonical]||{};O=P[M]=P[M]||{};K=b[M]=b[M]||{};for(var N in Q){O[N]=Q[N];K[N]=1;}}return A;}function E(K,J){var L={},S=J||{},N=b[K]||{},O=o,T,Q;function P(U){if(C[U]&&C[U][K]&&C[U][K][Q]){return true;}else{return false;}}function R(U){L[Q]=C[U][K][Q];}function M(){L[Q]="[Error! No "+K+"."+Q+" on "+O.canonical+"]";}if(S.locale!=undefined){T=w(S.locale);if(T){O=T;}}for(Q in N){a(O,P,R,M);}return L;}function G(K,L){for(var J in L){h(J,K,L[J]);}return A;}function u(L,M){var K=M||{},J=w(L);if(K.module){if(K.label){return q(J,K.module,K.label);}else{return n(J,K.module);}}else{return z(J);}return null;}function q(L,N,M){var J;function P(Q){if(C[Q]&&C[Q][N]&&C[Q][N][M]){return true;}else{return false;}}function O(Q){J=Q;}function K(){J="**error** - no negotiated value exists";}a(L,P,O,K);return J;}function n(L,O){var K=b[O]||{},N={},M;function Q(R){if(C[R]&&C[R][O]&&C[R][O][M]){return true;}else{return false;}}function P(R){N[M]=R;}function J(){N[M]="**error** - no negotiated value exists";}for(M in K){a(L,Q,P,J);}return N;}function z(K){var N={},M,L;function P(Q){if(C[Q]&&C[Q][M]&&C[Q][M][L]){return true;}else{return false;}}function O(Q){N[M][L]=Q;}function J(){N[M][L]="**error** - no negotiated value exists";}for(M in b){N[M]={};for(L in b[M]){a(K,P,O,J);}}return N;}r.i18n=A={setLocale:v,revertLocale:H,getLocale:B,addLocaleModule:h,getLocaleModule:E,addLocalePack:G,checkLocale:u};G("en",{PROPERTIES:{LANGUAGE:"English",DIR:"ltr"}});}});(window.gloader||glow).module({name:"glow.dom",library:["glow","1.7.3"],depends:[],builder:function(u){var n=u.env,k=u.lang,s={tagName:/^(\w+|\*)/,combinator:/^\s*([>]?)\s*/,classNameOrId:(n.webkit<417)?new RegExp("^([\\.#])((?:(?![\\.#\\[:\\s\\\\]).|\\\\.)+)"):/^([\.#])((?:[^\.#\[:\\\s]+|\\.)+)/},X=/([$^\\\/()|?+*\[\]{}.-])/g,B={},R={checked:"checked","class":"className",disabled:"disabled","for":"htmlFor",maxlength:"maxLength"},c={checked:true,disabled:true},ah={maxlength:function(r){return r.toString()=="2147483647"?undefined:r;}},ad=1,x="_unique"+u.UID,ai="_uniqueData"+u.UID,ag=1,L=[],I={black:0,silver:12632256,gray:8421504,white:16777215,maroon:8388608,red:16711680,purple:8388736,fuchsia:16711935,green:32768,lime:65280,olive:8421376,yellow:16776960,navy:128,blue:255,teal:32896,aqua:65535,orange:16753920},D=/height|top/,t=/^rgb\(([\d\.]+)(%?),\s*([\d\.]+)(%?),\s*([\d\.]+)(%?)/i,A=/^(?:(width|height)|(border-(top|bottom|left|right)-width))$/,C=/width|height|top$|bottom$|left$|right$|spacing$|indent$|font-size/,T,d,K,H,aa=window,l=document,V,G,w,P=l.createElement("div"),y=[1,"<table>","</table>"],ab=[0,"",""],O=n.webkit<526?[0,"","</div>",true]:[1,"b<div>","</div>"],a=[3,"<table><tbody><tr>","</tr></tbody></table>"],E={caption:y,thead:y,th:a,colgroup:y,tbody:y,tr:[2,"<table><tbody>","</tbody></table>"],td:a,tfoot:y,option:[1,"<select>","</select>"],legend:[1,"<fieldset>","</fieldset>"],link:O,script:O,style:O};if(n.ie){window.attachEvent("onunload",function(){P=null;});}u.ready(function(){V=l.body;G=l.documentElement;});(function(){var r=l.createElement("div");r.a=1;w=!!r.cloneNode(true).a;})();function af(r){for(var aj=r.firstChild;aj;aj=aj.nextSibling){if(aj.nodeType==1){return aj;}}return null;}function v(r){return new RegExp(["(^|\\s)",r.replace(X,"\\$1"),"($|\\s)"].join(""),"g");}function N(ap){var ao=[],al=(/^\s*<([^\s>]+)/.exec(ap)||[,"div"])[1],aj=E[al]||ab,am,ak,an=0;P.innerHTML=(aj[1]+ap+aj[2]);ak=P;am=aj[0];while(am--){ak=ak.lastChild;}while(ak.firstChild){ao[an++]=ak.removeChild(ak.firstChild);}ak=null;return ao;}function p(al){var ak=[],aj=0;for(;al[aj];aj++){ak[aj]=al[aj];}return ak;}function e(am,aj){for(var al=this,r=0,ak=al.length;r<ak;r++){aj.call(al[r],am.call?am.call(al[r],r):am);}return al;}if(document.all){T=function(ak,aj){var al=0,r=ak.length,am=aj.length;if(typeof aj.length=="number"){for(;al<am;al++){ak[r++]=aj[al];}}else{for(;aj[al];al++){ak[r++]=aj[al];}}};}else{T=function(ak,aj){var al=0,r=ak.length;for(;aj[al];al++){ak[r++]=aj[al];}};}function M(r){return(r.ownerDocument&&!r.ownerDocument.body)||(r.documentElement&&!r.documentElement.body);}if(n.ie){d=function(ak){if(ak.length==1){return ak;}var am=[],aj=0,al=0;for(;ak[al];al++){if(ak[al].getAttribute(x)!=ad&&ak[al].nodeType==1){am[aj++]=ak[al];}ak[al].setAttribute(x,ad);}for(al=0;ak[al];al++){ak[al].removeAttribute(x);}ad++;return am;};}else{d=function(ak){if(ak.length==1){return ak;}var am=[],aj=0,al=0;for(;ak[al];al++){if(ak[al][x]!=ad&&ak[al].nodeType==1){am[aj++]=ak[al];}ak[al][x]=ad;}ad++;return am;};}if(document.all){H=function(aj,al){var am=[],ak=0;for(;al[ak];ak++){if(aj=="*"&&al[ak].all&&!M(al[ak])){T(am,al[ak].all);}else{T(am,al[ak].getElementsByTagName(aj));}}return am;};}else{H=function(ak,am){var an=[],al=0,aj=am.length;for(;al<aj;al++){T(an,am[al].getElementsByTagName(ak));}return an;};}function b(am){var al=[],an=am.childNodes,ak=0,aj=0;for(;an[ak];ak++){if(an[ak].nodeType==1&&an[ak].nodeName!="!"){al[aj++]=an[ak];}}return al;}var U=["border-left-width","border-right-width","padding-left","padding-right"],Q=["border-top-width","border-bottom-width","padding-top","padding-bottom"];function f(ap,an){var am,aj=n.standardsMode?G:V,ao=(an=="width"),ak=ao?"Width":"Height",al;if(ap.window){am=n.webkit<522.11?(ao?ap.innerWidth:ap.innerHeight):n.webkit?(ao?V.clientWidth:ap.innerHeight):n.opera<9.5?(ao?V.clientWidth:V.clientHeight):(ao?aj.clientWidth:aj.clientHeight);}else{if(ap.getElementById){am=Math.max(V["scroll"+ak],G["scroll"+ak]);}else{al=ao?U:Q;am=ap["offset"+ak]-parseInt(Z(ap,al));}}return am;}function ae(r){if(n.ie<6){return r.document.body;}else{return r.ownerDocument.body;}}function j(al,am,ak){if(typeof am=="number"||/\d$/.test(am)){am+="px";}for(var aj=0,r=al.length;aj<r;aj++){al[aj].style[ak]=am;}}function W(r){if(r=="float"){return n.ie?"styleFloat":"cssFloat";}return k.replace(r,/-(\w)/g,function(aj,ak){return ak.toUpperCase();});}function z(ap,an){var am,ao=ap.style,al=ao.display,aj=ao.visibility,ak=ao.position;ao.visibility="hidden";ao.position="absolute";ao.display="block";if(!h(ap)){ao.position=ak;am=z(ap.parentNode,an);ao.display=al;ao.visibility=aj;}else{am=an();ao.display=al;ao.position=ak;ao.visibility=aj;}return am;}function h(r){return r.offsetWidth||r.offsetHeight;}function Z(ar,al){var ak,au=0,ap=0,ao=al.length,an=l.defaultView&&(l.defaultView.getComputedStyle(ar,null)||l.defaultView.getComputedStyle),am=ar.currentStyle,at,aq,aj=al.push||A.exec(al)||[];if(al.push){for(;ap<ao;ap++){au+=parseInt(Z(ar,al[ap]),10)||0;}return au+"px";}if(aj[1]){if(!h(ar)){return z(ar,function(){return f(ar,aj[1])+"px";});}return f(ar,aj[1])+"px";}else{if(aj[2]&&u.env.ie&&Z(ar,"border-"+aj[3]+"-style")=="none"){return"0";}else{if(an){if(typeof an=="function"){at=ar.style.display;ak=z(ar,function(){if(al=="display"){ar.style.display=at;if(!l.defaultView.getComputedStyle(ar,null)){return"none";}ar.style.display="block";}return Z(ar,al);});}else{if(n.webkit>500&&n.webkit<526&&al=="margin-right"&&an.getPropertyValue("position")!="absolute"){al="margin-left";}ak=an.getPropertyValue(al);}}else{if(am){if(al=="opacity"){aq=/alpha\(opacity=([^\)]+)\)/.exec(am.filter);return aq?String(parseInt(aq[1],10)/100):"1";}ak=String(am[W(al)]);if(/^-?[\d\.]+(?!px)[%a-z]+$/i.test(ak)&&al!="font-size"){ak=J(ar,ak,D.test(al))+"px";}}}}}if(al.indexOf("color")!=-1){ak=S(ak).toString();}else{if(ak.indexOf("url")==0){ak=ak.replace(/\"/g,"");}}return ak;}function J(ao,aq,am){var ak=am?"top":"left",an=am?"Top":"Left",ar=ao.style,al=ar[ak],ap=ao.runtimeStyle[ak],aj;ao.runtimeStyle[ak]=ao.currentStyle[ak];ar[ak]=aq;aj=ar["pixel"+an];ar[ak]=al;ao.runtimeStyle[ak]=ap;return aj;}function S(ak){if(/^(transparent|rgba\(0, ?0, ?0, ?0\))$/.test(ak)){return"transparent";}var ao,aj,ap,aq,al,an=Math.round,ar=parseInt,am=parseFloat;if(ao=t.exec(ak)){aj=ao[2]?an(((am(ao[1])/100)*255)):ar(ao[1]);ap=ao[4]?an(((am(ao[3])/100)*255)):ar(ao[3]);aq=ao[6]?an(((am(ao[5])/100)*255)):ar(ao[5]);}else{if(typeof ak=="number"){al=ak;}else{if(ak.charAt(0)=="#"){if(ak.length=="4"){ak="#"+ak.charAt(1)+ak.charAt(1)+ak.charAt(2)+ak.charAt(2)+ak.charAt(3)+ak.charAt(3);}al=ar(ak.slice(1),16);}else{al=I[ak];}}aj=(al)>>16;ap=(al&65280)>>8;aq=(al&255);}ak=new String("rgb("+aj+", "+ap+", "+aq+")");ak.r=aj;ak.g=ap;ak.b=aq;return ak;}function m(an){var am="",ak=an.childNodes,al=0,aj=ak.length;for(;al<aj;al++){if(ak[al].nodeType==3){am+=ak[al].nodeValue;}else{if(ak[al].nodeType==1){am+=m(ak[al]);}}}return am;}function q(ao,al){var ak=[],aj=0,r,am=0,an=ao.length;for(;am<an;am++){r=ao[am];while(r=r[al+"Sibling"]){if(r.nodeType==1&&r.nodeName!="!"){ak[aj++]=r;break;}}}return Y.get(ak);}function F(aj){var r=aj.offsetParent;while(r&&Y.get(r).css("position")=="static"){r=r.offsetParent;}if(!r&&Y.get(G).css("position")!="static"){r=G;}return r||null;}function ac(am,al){var ak,aj="scroll"+(al?"Left":"Top");if(am.window){ak=am.document.documentElement[aj]||(al?am.pageXOffset:am.pageYOffset)||0;}else{ak=am[aj];}return ak;}function o(ak,aj,r){if(ak.window){ak.scrollTo(aj?r:ac(ak,true),!aj?r:ac(ak,false));}else{ak["scroll"+(aj?"Left":"Top")]=r;}}function g(r,al,ak){var aj=r.length;if(ak!==undefined){while(aj--){o(r[aj],al,ak);}return r;}else{return ac(r[0],al);}}var Y={};Y.get=function(){var am=new u.dom.NodeList(),al=0,ak=arguments,aj=ak.length;for(;al<aj;al++){if(typeof ak[al]=="string"){am.push(new u.dom.NodeList().push(l).get(ak[al]));}else{am.push(ak[al]);}}return am;};Y.create=function(an,am){var r=[],aj=0,al=0,ak;am=u.lang.apply({interpolate:null,escapeHtml:false},am||{});if(am.interpolate){an=k.interpolate(an,am.interpolate,{escapeHtml:am.escapeHtml});}ak=N(an);for(;ak[aj];aj++){if(ak[aj].nodeType==1&&ak[aj].nodeName!="!"){r[al++]=ak[aj];}else{if(ak[aj].nodeType==3&&k.trim(ak[aj].nodeValue)!==""){throw new Error("glow.dom.create - Text must be wrapped in an element");}}}return new Y.NodeList().push(r);};Y.parseCssColor=function(r){var aj=S(r);return{r:aj.r,g:aj.g,b:aj.b};};Y.NodeList=function(){this.length=0;};Y.NodeList.prototype={item:function(r){return this[r];},push:function(){var ak=arguments,aj=ak.length,al=0,ao,r,am=this,an=Array.prototype.push;for(;al<aj;al++){if(!ak[al]){continue;}else{if(ak[al].nodeType==1||ak[al].nodeType==9||ak[al].document){an.call(am,ak[al]);}else{if(ak[al][0]){for(ao=0,r=ak[al].length;ao<r;ao++){an.call(am,ak[al][ao]);}}}}}return am;},each:function(al){for(var r=0,ak=this,aj=ak.length;r<aj;r++){al.call(ak[r],r,ak);}return ak;},eq:function(al){var ak=this,r=0,aj=ak.length;if(!al.push){al=[al];}if(al.length!=ak.length){return false;}for(;r<aj;r++){if(ak[r]!=al[r]){return false;}}return true;},isWithin:function(al){if(al.push){al=al[0];}if(!al||!this.length){return false;}var ak=this,r=0,aj=ak.length,am;if(al.contains&&n.webkit>=521){for(;r<aj;r++){if(!(al.contains(ak[r])&&ak[r]!=al)){return false;}}}else{if(ak[0].compareDocumentPosition){for(;r<aj;r++){if(!(ak[r].compareDocumentPosition(al)&8)){return false;}}}else{for(;r<aj;r++){am=ak[r];while(am=am.parentNode){if(am==al){break;}}if(!am){return false;}}}}return true;},attr:function(ak){var am=this,aj=arguments,r=aj.length,al,an;if(am.length===0){return r>1?am:undefined;}if(typeof ak=="object"){for(al in ak){if(k.hasOwnProperty(ak,al)){am.attr(al,ak[al]);}}return am;}if(n.ie&&R[ak]){if(r>1){e.call(am,aj[1],function(ao){this[R[ak]]=ao;});return am;}an=am[0][R[ak]];if(c[ak]){return an?ak:undefined;}else{if(ah[ak]){return ah[ak](an);}}return an;}if(r>1){e.call(am,aj[1],function(ao){this.setAttribute(ak,ao);});return am;}return M(am[0])?am[0].getAttribute(ak):am[0].getAttribute(ak,2);},removeAttr:function(aj){var r=n.ie&&R[aj],am=this,ak=0,al=am.length;for(;ak<al;ak++){if(r){am[ak][r]="";}else{am[ak].removeAttribute(aj);}}return am;},hasAttr:function(al){var an=this[0],ak=an.attributes;if(M(an)&&n.ie){var ak=an.attributes,am=0,aj=ak.length;for(;am<aj;am++){if(ak[am].nodeName==al){return ak[am].specified;}}return false;}else{if(this[0].getAttributeNode){var r=this[0].getAttributeNode(al);return r?r.specified:false;}}return typeof ak[r]!="undefined";},prop:function(r,am){if(r.constructor===Object){var al=r,ak;for(ak in al){this.prop(ak,al[ak]);}return this;}if(am!==undefined){var aj=this.length;while(aj--){this[aj][r]=am;}return this;}if(!this[0]){return undefined;}return this[0][r];},hasClass:function(r){for(var aj=0,ak=this.length;aj<ak;aj++){if((" "+this[aj].className+" ").indexOf(" "+r+" ")!=-1){return true;}}return false;},addClass:function(r){for(var aj=0,ak=this.length;aj<ak;aj++){if((" "+this[aj].className+" ").indexOf(" "+r+" ")==-1){this[aj].className+=((this[aj].className)?" ":"")+r;}}return this;},removeClass:function(r){var ak=v(r),am=this,aj=0,al=am.length;for(;aj<al;aj++){am[aj].className=am[aj].className.replace(ak," ");}return am;},toggleClass:function(aj){var al=this.length,ak,r=" "+aj+" ";while(al--){ak=" "+this[al].className+" ";if(ak.indexOf(r)!=-1){this[al].className=ak.replace(r," ");}else{this[al].className+=" "+aj;}}return this;},val:function(){function al(ap){var am=ap.type,an=ap.checked,ar=ap.value,at=[],ao=0;if(am=="radio"){return an?ar:"";}else{if(am=="checkbox"){return an?ar:"";}else{if(am=="select-one"){return ap.selectedIndex>-1?ap.options[ap.selectedIndex].value:"";}else{if(am=="select-multiple"){for(var aq=ap.options.length;ao<aq;ao++){if(ap.options[ao].selected){at[at.length]=ap.options[ao].value;}}return at;}else{return ar;}}}}}function aj(an){var av={},au={},aq=an.elements,at=0,ap=aq.length,am,ax,ar,ao,aw;for(;at<ap;at++){ax=aq[at];aw=ax.nodeName.toLowerCase();am=ax.name;if(aw=="fieldset"||aw=="object"||!am){continue;}if(ax.type=="checkbox"&&!ax.checked){if(!am in av){av[am]=undefined;}}else{if(ax.type=="radio"){if(au[am]){au[am][au[am].length]=ax;}else{au[am]=[ax];}}else{var ay=al(ax);if(am in av){if(av[am].push){av[am][av[am].length]=ay;}else{av[am]=[av[am],ay];}}else{av[am]=ay;}}}}for(at in au){ar=0;for(ap=au[at].length;ar<ap;ar++){ao=au[at][ar];am=ao.name;if(ao.checked){av[ao.name]=ao.value;break;}}if(!am in av){av[am]=undefined;}}return av;}function r(an,aw){var am,ax,at={},aq,ar=0,ao,au,av,ap;for(am in aw){ax=an[am];if(ax&&ax[0]&&!ax.options){aw[am]=aw[am]&&aw[am].push?aw[am]:[aw[am]];at.radios=[];at.checkboxesSelects=[];at.multiSelects=[];at.other=[];for(ar=0;ax[ar];ar++){ap=ax[ar].type;if(ap=="radio"){aq="radios";}else{if(ap=="select-one"||ap=="checkbox"){aq="checkboxesSelects";}else{if(ap=="select-multiple"){aq="multiSelects";}else{aq="other";}}}at[aq][at[aq].length]=ax[ar];}for(ar=0;at.multiSelects[ar];ar++){aw[am]=ak(at.multiSelects[ar],aw[am]);}for(ar=0;at.checkboxesSelects[ar];ar++){ak(at.checkboxesSelects[ar],"");for(ao=0,au=aw[am].length;ao<au;ao++){if(ak(at.checkboxesSelects[ar],aw[am][ao])){aw[am].slice(ao,1);break;}}}for(ar=0;at.radios[ar];ar++){at.radios[ar].checked=false;av=false;for(ao=0,au=aw[am].length;ao<au;ao++){if(ak(at.radios[ar],aw[am][ao])){aw[am].slice(ao,1);av=true;break;}if(av){break;}}}for(ar=0;at.other[ar]&&aw[am][ar]!==undefined;ar++){ak(at.other[ar],aw[am][ar]);}}else{if(ax&&ax.nodeName){ak(ax,aw[am]);}}}}function ak(ao,aq){var ar=0,an,ap=0,av,am,au;if(ao.type=="select-one"){for(an=ao.options.length;ar<an;ar++){if(ao.options[ar].value==aq){ao.selectedIndex=ar;return true;}}return false;}else{if(ao.type=="select-multiple"){var at=!!aq.push;for(ar=0,an=ao.options.length;ar<an;ar++){am=ao.options[ar];au=am.value;if(at){am.selected=false;for(av=aq.length;ap<av;ap++){if(au==aq[ap]){am.selected=true;aq.splice(ap,1);break;}}}else{return am.selected=aq==au;}}return false;}else{if(ao.type=="radio"||ao.type=="checkbox"){ao.checked=aq==ao.value;return aq==ao.value;}else{ao.value=aq;return true;}}}}return function(){var am=arguments,aq=am[0],ap=this,an=0,ao=ap.length;if(am.length===0){return ap[0].nodeName=="FORM"?aj(ap[0]):al(ap[0]);}if(ap[0].nodeName=="FORM"){if(!typeof aq=="object"){throw"value for FORM must be object";}r(ap[0],aq);}else{for(;an<ao;an++){ak(ap[an],aq);}}return ap;};}(),slice:function(){return new Y.NodeList().push(Array.prototype.slice.apply(this,arguments));},sort:function(al){var ak=this,aj=0,r;if(!ak.length){return ak;}if(!al){if(typeof ak[0].sourceIndex=="number"){al=function(an,am){return an.sourceIndex-am.sourceIndex;};}else{if(ak[0].compareDocumentPosition){al=function(an,am){return 3-(an.compareDocumentPosition(am)&6);};}else{r=H("*",[l]);for(;r[aj];aj++){r[aj]._sourceIndex=aj;}al=function(an,am){return an._sourceIndex-am._sourceIndex;};}}}return Y.get([].sort.call(ak,al));},filter:function(am){var aj=[],r=0,ak=0,al=this.length;for(;ak<al;ak++){if(am.apply(this[ak],[ak])){aj[r++]=this[ak];}}return Y.get(aj);},children:function(){var aj=[],r=0,ak=0,an=0,am=this.length,al;for(;ak<am;ak++){aj=aj.concat(b(this[ak]));}return Y.get(aj);},parent:function(){var aj=[],r=0,ak=0,al=this.length;for(;ak<al;ak++){aj[r++]=this[ak].parentNode;}return Y.get(d(aj));},ancestors:function(){var aj=[],r=0,ak=0,al=this.length,am;while(ak<al){am=this[ak].parentNode;while(am&&am.nodeType==1){aj[r++]=am;am=am.parentNode;}ak++;}return Y.get(d(aj));},wrap:function(am){var al=this.length,r,ak,aj;if(typeof am=="string"){aj=Y.create(am);}else{aj=Y.get(am);}for(i=0;i<al;i++){ak=aj[0];while(ak){r=af(ak);if(r){ak=r;}else{break;}}if(this[i].parentNode){aj.insertBefore(this[i]);}if(i!=al-1){aj=aj.clone();}ak.appendChild(this[i]);}return this;},unwrap:function(){var aj,r=this.parent(),ak=r.length;for(i=0;i<ak;i++){aj=r.slice(i,i+1);if(!aj[0].parentNode){aj.children().remove();aj.destroy();}else{aj.children().insertBefore(aj);aj.destroy();}}return this;},next:function(){return q(this,"next");},prev:function(){return q(this,"previous");},is:function(aj){var ak=u.dom.get(aj),am=0,r=this.length,al,an;node:for(;am<r;am++){for(al=0,an=ak.length;al<an;al++){if(this[am]==ak[al]){continue node;}}return false;}return true;},text:function(){var r=arguments,aj=0,al=this,ak=al.length;if(r.length>0){for(;aj<ak;aj++){al[aj].innerHTML="";al[aj].appendChild(l.createTextNode(r[0]));}return al;}return al[0].innerText||al[0].textContent==undefined?m(al[0]):al[0].textContent;},empty:function(){var aj=0,r=this.length;for(;aj<r;aj++){while(this[aj].firstChild){this[aj].removeChild(this[aj].firstChild);}}return this;},remove:function(){for(var al=this,aj=0,ak=al.length,r;aj<ak;aj++){if(r=al[aj].parentNode){r.removeChild(al[aj]);}}return al;},destroy:function(){this.get("*").push(this).removeData();this.appendTo(P);P.innerHTML="";Array.prototype.splice.call(this,0,this.length);return this;},clone:function(am){var aj=[],al=this.length,r,ak;eventIdProp="__eventId"+u.UID;if(al===0){return new Y.NodeList();}while(al--){aj[al]=this[al].cloneNode(true);}r=Y.get(aj).get("*").push(aj);if(w&&!M(aj[0])){al=r.length;while(al--){r[al][eventIdProp]=null;}}ak=this.get("*").push(this);al=r.length;while(al--){r[al].removeAttribute(ai);u.dom.get(r[al]).data(u.dom.get(ak[al]).data());}if(am){if(!u.events){throw"glow.events required to clone event listeners";}u.events._copyListeners(this.get("*").push(this),r||Y.get(aj).get("*").push(aj));}return Y.get(aj);},html:function(r){var aj=0,ak=this.length;if(r!==undefined){return this.empty().append(r.toString());}return this[0]?this[0].innerHTML:"";},width:function(r){if(r==undefined){return f(this[0],"width");}j(this,r,"width");return this;},height:function(r){if(r==undefined){return f(this[0],"height");}j(this,r,"height");return this;},scrollLeft:function(r){return g(this,true,r);},scrollTop:function(r){return g(this,false,r);},show:function(){var ak=0,aj=this.length,r,al;for(;ak<aj;ak++){r=Y.get(this[ak]);al=r[0].style;if(r.css("display")=="none"){al.display="";al.visibility="visible";if(r.css("display")=="none"){al.display="block";}}}return this;},hide:function(){return this.css("display","none").css("visibility","hidden");},css:function(ao,al){var ak=this,an,aj=0,r=ak.length,am=ao;if(ao.constructor===Object){for(style in ao){this.css(style,ao[style]);}return ak;}else{if(al!=undefined){ao=W(ao);for(;aj<r;aj++){an=ak[aj].style;if(typeof al=="number"&&C.test(am)){al=al.toString()+"px";}if(ao=="opacity"&&n.ie){an.zoom="1";if(al===""){an.filter="";}else{an.filter="alpha(opacity="+Math.round(Number(al,10)*100)+")";}}else{an[ao]=al;}}return ak;}else{if(!r){return;}return Z(ak[0],ao);}}},offset:function(){var an=this[0],al={x:ac(window,true),y:ac(window,false)};if(!u.env.webkit&&an.getBoundingClientRect){var ap=an.getBoundingClientRect();return{top:ap.top+al.y-G.clientTop,left:ap.left+al.x-G.clientLeft};}else{var ao=an.offsetTop,r=an.offsetLeft,aj=an,aq,am=false,ak=an;while(an=an.offsetParent){r+=an.offsetLeft;ao+=an.offsetTop;if(Z(an,"position")=="fixed"){am=true;}if(n.gecko||n.webkit>500){r+=parseInt(Z(an,"border-left-width"))||0;ao+=parseInt(Z(an,"border-top-width"))||0;}if(an.nodeName.toLowerCase()!="body"){ak=an;}}an=aj;while((an=an.parentNode)&&(an!=V)&&(an!=G)){r-=an.scrollLeft;ao-=an.scrollTop;if(n.gecko&&Z(an,"overflow")!="visible"){r+=parseInt(Z(an,"border-left-width"));ao+=parseInt(Z(an,"border-top-width"));}}if(am){r+=al.x;ao+=al.y;}if((n.webkit<500&&(am||Z(ak,"position")=="absolute"))||(n.gecko&&Z(ak,"position")!="absolute")){r-=V.offsetLeft;ao-=V.offsetTop;}return{left:r,top:ao};}},position:function(){var aj=Y.get(F(this[0])),ao=!!aj[0],an=parseInt(this.css("margin-left"))||0,am=parseInt(this.css("margin-top"))||0,al=(ao&&parseInt(aj.css("border-left-width")))||0,r=(ao&&parseInt(aj.css("border-top-width")))||0,ap=this.offset(),ak=ao?aj.offset():{top:0,left:0};return{left:ap.left-ak.left-an-al,top:ap.top-ak.top-am-r};},append:function(an){var am=this,aj=0,ak=1,al=am.length,r;if(al==0){return am;}r=typeof an=="string"?p(N(an)):an.nodeType?[an]:p(an);for(;r[aj];aj++){am[0].appendChild(r[aj]);}for(;ak<al;ak++){for(aj=0;r[aj];aj++){am[ak].appendChild(r[aj].cloneNode(true));}}return am;},prepend:function(ao){var am=this,aj=0,ak=1,al=am.length,r,an;if(al==0){return am;}r=typeof ao=="string"?p(N(ao)):ao.nodeType?[ao]:p(ao);an=am[0].firstChild;for(;r[aj];aj++){am[0].insertBefore(r[aj],an);}for(;ak<al;ak++){an=am[ak].firstChild;for(aj=0;r[aj];aj++){am[ak].insertBefore(r[aj].cloneNode(true),an);}}return am;},appendTo:function(r){if(!(r instanceof Y.NodeList)){r=Y.get(r);}r.append(this);return this;},prependTo:function(r){if(!(r instanceof Y.NodeList)){r=Y.get(r);}r.prepend(this);return this;},after:function(ap){var ao=this,an=ao.length,ak,aj,al,am=1,r;if(an==0){return ao;}ak=typeof ap=="string"?Y.create(ap):ap instanceof Y.NodeList?ap:Y.get(ap);aj=ak.length;for(al=aj-1;al>=0;al--){ao[0].parentNode.insertBefore(ak[al],ao[0].nextSibling);}for(;am<an;am++){r=ak.clone();for(al=aj-1;al>=0;al--){ao[am].parentNode.insertBefore(r[al],ao[am].nextSibling);}}return ao;},before:function(ap){var ao=this,an=ao.length,al=0,am=1,ak,aj,r;if(an==0){return ao;}ak=typeof ap=="string"?Y.create(ap):ap instanceof Y.NodeList?ap:Y.get(ap);aj=ak.length;for(;al<aj;al++){ao[0].parentNode.insertBefore(ak[al],ao[0]);}for(;am<an;am++){r=ak.clone();for(al=0;al<aj;al++){ao[am].parentNode.insertBefore(r[al],ao[am]);}}return ao;},insertAfter:function(r){if(!(r instanceof Y.NodeList)){r=Y.get(r);}r.after(this);return this;},insertBefore:function(r){if(!(r instanceof Y.NodeList)){r=Y.get(r);}r.before(this);return this;},replaceWith:function(r){if(n.webkit<500){this.after(K).remove();Y.get("u.glow-placeholder").after(r).remove();}else{this.after(r).remove();}return this;},data:function(ak,al){if(typeof ak==="object"){for(var an in ak){this.data(an,ak[an]);}return this;}var r,am;switch(arguments.length){case 0:if(this[0]===undefined){return undefined;}r=this[0][ai]||ag++;return L[r]||(L[r]={});case 1:if(this[0]===undefined){return undefined;}r=this[0][ai];return r?L[r][ak]:undefined;case 2:for(var aj=this.length;aj--;){am=this[aj];if(!(r=am[ai])){r=ag++;am[ai]=r;L[r]={};}L[r][ak]=al;}return this;default:throw new Error("glow.dom.NodeList#data expects 2 or less arguments, not "+arguments.length+".");}},removeData:function(ak){var am,aj=this.length,r;while(aj--){am=this[aj];r=am[ai];if(r!==undefined){switch(arguments.length){case 0:L[r]=undefined;am[ai]=undefined;try{delete am[ai];}catch(al){am.removeAttribute&&am.removeAttribute(ai);}break;case 1:L[r][ak]=undefined;delete L[r][ak];break;default:throw new Error("glow.dom.NodeList#removeData expects 1 or less arguments, not "+arguments.length+".");}}}return this;},get:function(){function ak(az){if(B[az]){return B[az];}var ar=[],aC=0,at,aA,av,ax,aB,ay,au=true,aw=az;while(az&&az!=ay){aA="";av="";ay=az;if(ax=s.combinator.exec(az)){at=ax[1];az=az.slice(ax[0].length);}if(ax=s.tagName.exec(az)){aA=ax[1];az=az.slice(ax[0].length);}if(ax=s.classNameOrId.exec(az)){if(ax[1]=="#"){av=ax[2];az=az.slice(ax[0].length);}}if(!at){if(av&&au){ar[aC++]=[am,[av.replace(/\\/g,""),aA||"*",null]];}else{ar[aC++]=[H,[aA||"*",null]];if(av){ar[aC++]=[ap,[av.replace(/\\/g,""),null]];}}}else{if(at==">"){ar[aC++]=[al,[null]];if(av){ar[aC++]=[ap,[av.replace(/\\/g,""),null]];}if(aA&&aA!="*"){ar[aC++]=[aq,[aA,null]];}}}aB=true;while(aB){if(az.charAt(0)=="#"||az.charAt(0)=="."){if(ax=s.classNameOrId.exec(az)){if(az.charAt(0)=="#"){ar[aC++]=[ap,[ax[2].replace(/\\/g,""),null]];}else{ar[aC++]=[ao,[ax[2].replace(/\\/g,""),null]];}az=az.slice(ax[0].length);}else{throw new Error("Invalid Selector "+aw);}}else{aB=false;}}au=false;}if(az!==""){throw new Error("Invalid Selector "+aw);}return B[az]=ar;}function an(ar,av){var au=av;for(var at=0,aw=ar.length;at<aw;at++){ar[at][1][ar[at][1].length-1]=au;au=ar[at][0].apply(this,ar[at][1]);}return au;}function am(at,ax,au){var ar=[],aB=0,aw=[],aA=0,ay;for(var az=0,av=au.length;az<av;az++){if(au[az].getElementById){ay=au[az].getElementById(at);if(ay&&(ay.tagName==ax.toUpperCase()||ax=="*"||ay.tagName==ax)){ar[aB++]=ay;}}else{aw[aA++]=au[az];}}if(aw[0]){aw=H(ax,aw);aw=ap(at,aw);}return ar.concat(aw);}function al(au){var av=[],at=0,ar=au.length;for(;at<ar;at++){T(av,b(au[at]));}return av;}function ap(av,at){for(var ar=0,au=at.length;ar<au;ar++){if(at[ar].id==av){return[at[ar]];}}return[];}function aq(av,au){var ax=[],ar=0;for(var at=0,aw=au.length;at<aw;at++){if(au[at].tagName==av.toUpperCase()||au[at].tagName==av){ax[ar++]=au[at];}}return ax;}function ao(av,au){var ax=[],ar=0;for(var at=0,aw=au.length;at<aw;at++){if((" "+au[at].className+" ").indexOf(" "+av+" ")!=-1){ax[ar++]=au[at];}}return ax;}function aj(ay,au){var av;var ax=[];var aw=ay.split(",");for(var at=0,ar=aw.length;at<ar;at++){av=ak(u.lang.trim(aw[at]));ax=ax.concat(an(av,au));}return ax;}function r(at,av){at=at.length?at:[at];var aw=[];var ar;for(var au=0;at[au];au++){ar=u.dom.get(at[au]);for(var ax=0;av[ax];ax++){if(ar.isWithin(av[ax])){aw[aw.length]=ar[0];break;}}}return aw;}return function(av){if(!this.length){return this;}var au=[];for(var at=0,ar=arguments.length;at<ar;at++){if(typeof arguments[at]=="string"){au=au.concat(aj(arguments[at],this));}else{au=au.concat(r(arguments[at],this));}}return u.dom.get(d(au));};}()};K=Y.create('<u class="glow-placeholder"></u>');u.dom=Y;}});(window.gloader||glow).module({name:"glow.events",library:["glow","1.7.3"],depends:[["glow","1.7.3","glow.dom"]],builder:function(o){var k=o.dom.get;var C={};var x=1;var m=1;var n={};var b={};var p={};var l="__eventId"+o.UID;var g=l+"PreventDefault";var u=l+"StopPropagation";var E={};var f=1;var B={};var z={};var G=1;var d=2;var s=4;var h={TAB:"\t",SPACE:" ",ENTER:"\n",BACKTICK:"`"};var K={"96":223};var t={CAPSLOCK:20,NUMLOCK:144,SCROLLLOCK:145,BREAK:19,BACKTICK:223,BACKSPACE:8,PRINTSCREEN:44,MENU:93,SPACE:32,SHIFT:16,CTRL:17,ALT:18,ESC:27,TAB:9,META:91,RIGHTMETA:92,ENTER:13,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,INS:45,HOME:36,PAGEUP:33,DEL:46,END:35,PAGEDOWN:34,LEFT:37,UP:38,RIGHT:39,DOWN:40};var I={};for(var H in t){I[""+t[H]]=H;}var y="0123456789=;'\\/#,.-";function D(O){var N=z[O];if(!N){return false;}var M=B[N];if(!M){return false;}for(var L=0,r=M.length;L<r;L++){if(M[L][0]==O){M.splice(L,1);return true;}}return false;}function A(r){E[r]=C.addListener(document,"key"+r,function(R){var P=0;if(R.ctrlKey){P+=G;}if(R.altKey){P+=d;}if(R.shiftKey){P+=s;}var Q=R.chr?R.chr.toLowerCase():R.key?R.key.toLowerCase():R.keyCode;var N=P+":"+Q+":"+r;var O=B[N]?B[N].slice(0):[];if(R.shiftKey){var S=(P&~s)+":"+Q+":"+r;if(B[S]){for(var M=0,L=B[S].length;M<L;M++){O[O.length]=B[S][M];}}}if(!O){return;}for(var M=0,L=O.length;M<L;M++){if(O[M][2].call(O[M][3]||this,R)===false){R.preventDefault();}}return !R.defaultPrevented();});}function w(){var r;for(r in b){C.removeListener(r);}}var q;var J,e;function F(O,N,L){var r;L=!!L;if(o.env.opera){if(N.toLowerCase()=="resize"&&!J&&O==window){J=C.addListener(window.document.body,"resize",function(R){C.fire(window,"resize",R);});}else{if(N.toLowerCase()=="scroll"&&!e&&O==window){e=C.addListener(window.document,"scroll",function(R){C.fire(window,"scroll",R);});}}}var Q=function(T){if(!T){T=window.event;}var S=new C.Event(),R=N.toLowerCase();S.nativeEvent=T;S.source=T.target||T.srcElement;S.relatedTarget=T.relatedTarget||(R=="mouseover"?T.fromElement:T.toElement);S.button=o.env.ie?(T.button&1?0:T.button&2?2:1):T.button;if(T.pageX||T.pageY){S.pageX=T.pageX;S.pageY=T.pageY;}else{if(T.clientX||T.clientY){S.pageX=T.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;S.pageY=T.clientY+document.body.scrollTop+document.documentElement.scrollTop;}}if(R=="mousewheel"){S.wheelDelta=T.wheelDelta?T.wheelDelta/120:T.detail?-T.detail/3:0;if(S.wheelDelta==0){return;}}if(R.indexOf("key")!=-1){S.altKey=!!T.altKey;S.ctrlKey=!!T.ctrlKey;S.shiftKey=!!T.shiftKey;if(N=="keydown"){q=T.keyCode;}S.charCode=T.keyCode&&T.charCode!==0?undefined:T.charCode;if(R=="keypress"){if(typeof(S.charCode)=="undefined"){S.charCode=T.keyCode;}if(o.env.opera&&S.charCode&&S.charCode==q&&y.indexOf(String.fromCharCode(S.charCode))==-1){S.charCode=undefined;S.keyCode=q;}}if(S.charCode&&S.charCode<=49){S.charCode=undefined;}if(S.charCode){S.chr=String.fromCharCode(S.charCode);}else{if(T.keyCode){S.charCode=undefined;S.keyCode=K[T.keyCode.toString()]||T.keyCode;S.key=I[S.keyCode];if(h[S.key]){S.chr=h[S.key];S.charCode=S.chr.charCodeAt(0);}}}if(S.chr){S.capsLock=S.chr.toUpperCase()!=S.chr?S.shiftKey:S.chr.toLowerCase()!=S.chr?!S.shiftKey:undefined;}}C.fire(this,N,S);if(S.defaultPrevented()){return false;}};if(O.addEventListener&&(!o.env.webkit||o.env.webkit>418)){if((N=="focus"||N=="blur")&&(o.env.opera)){O.parentNode.addEventListener(N,function(){},true);}O.addEventListener(N.toLowerCase()=="mousewheel"&&o.env.gecko?"DOMMouseScroll":N,Q,L);}else{var M="on"+N;var P=O[M];if(P){O[M]=function(){var R=P.apply(this,arguments),S=Q.apply(this,arguments);return(R!==false)&&(S!==false);};}else{O[M]=Q;}}O=null;}function a(M,N){var O=k(M),r=N?"mouseout":"mouseover",L=N?"mouseleave":"mouseenter";C.addListener(M,r,function(Q){var P=k(Q.relatedTarget);if(!P.eq(O)&&!P.isWithin(O)){return !C.fire(O[0],L,Q).defaultPrevented();}});}C._copyListeners=function(R,Q){var M=R.length,P,r,L,O,N;while(M--){if(R[M][l]){P=n[R[M][l]];for(r in P){L=0;O=P[r].length;for(;L<O;L++){N=P[r][L];C.addListener(Q[M],r,N[2],N[3]);}}}}};C.addListener=function(S,M,V,O){var T=false;if(!S){throw"no attachTo paramter passed to addListener";}if(typeof S=="string"){if(!o.dom){throw"glow.dom must be loaded to use a selector as the first argument to glow.events.addListener";}S=k(S);}if(o.dom&&S instanceof o.dom.NodeList){var U=[],R=S.length;while(R--){U[R]=C.addListener(S[R],M,V,O);}return U;}var N;if(!(N=S[l])){N=S[l]=m++;}var Q=x++;var P=[N,M,V,O,Q];b[Q]=P;var r=n[N];if(!r){r=n[N]={};}var L=r[M];if(!L){L=r[M]=[];}L[L.length]=P;if((S.addEventListener||S.attachEvent)&&!p[N+":"+M]){switch(M){case"mouseenter":a(S,false);return Q;case"mouseleave":a(S,true);return Q;case"focus":if(o.env.ie){c(S,true);return Q;}else{T=true;}break;case"blur":if(o.env.ie){c(S,false);return Q;}else{T=true;}break;}F(S,M,T);p[N+":"+M]=true;}return Q;};function c(M,N){var r=N?"focusin":"focusout",L=N?"focus":"blur";C.addListener(M,r,function(O){return !C.fire(M,L,O).defaultPrevented();});}C.removeListener=function(O){if(O&&O.toString().indexOf("k:")!=-1){return D(O);}if(O instanceof Array){var L=O.length;while(L--){C.removeListener(O[L]);}return true;}var N=b[O];if(!N){return false;}delete b[O];var M=n[N[0]][N[1]];for(var L=0,r=M.length;L<r;L++){if(M[L]==N){M.splice(L,1);break;}}if(!M.length){delete n[N[0]][N[1]];}var P=false;for(var L in n[N[0]]){P=true;break;}if(!P){delete n[N[0]];}return true;};C.removeAllListeners=function(Q){var N,M,P=[],O=0,r,L;if(typeof Q=="string"){Q=k(Q);}if(Q instanceof Array||Q instanceof o.dom.NodeList){N=Q.length;while(N--){C.removeAllListeners(Q[N]);}return C;}M=Q[l];if(!M){return C;}L=n[M];for(r in L){N=L[r].length;while(N--){P[O++]=L[r][N][4];}}if(P.length){C.removeListener(P);}return C;};C.fire=function(r,L,M){if(!r){throw"glow.events.fire: required parameter attachedTo not passed (name: "+L+")";}if(!L){throw"glow.events.fire: required parameter name not passed";}if(!M){M=new C.Event();}if(M.constructor===Object){M=new C.Event(M);}if(typeof r=="string"){if(!o.dom){throw"glow.dom must be loaded to use a selector as the first argument to glow.events.addListener";}r=k(r);}M.type=L;M.attachedTo=r;if(!M.source){M.source=r;}if(r instanceof o.dom.NodeList){r.each(function(N){v(r[N],M);});}else{v(r,M);}return M;};function v(R,Q){var L,r,M=r&&r[Q.type];(L=R[l])&&(r=n[L])&&(M=r[Q.type]);if(!M){return Q;}var N;var S=M.slice(0);for(var O=0,P=S.length;O<P;O++){N=S[O];if(N[2].call(N[3]||R,Q)===false){Q.preventDefault();}}}var j=/^((?:(?:ctrl|alt|shift)\+)*)(?:(\w+|.)|[\n\r])$/i;C.addKeyListener=function(Q,P,R,L){P.replace(/^key/i,"");P=P.toLowerCase();if(!(P=="press"||P=="down"||P=="up")){throw"event type must be press, down or up";}if(!E[P]){A(P);}var N=Q.match(j),S=0,T;if(!N){throw"key format not recognised";}if(N[1].toLowerCase().indexOf("ctrl")!=-1){S+=G;}if(N[1].toLowerCase().indexOf("alt")!=-1){S+=d;}if(N[1].toLowerCase().indexOf("shift")!=-1){S+=s;}var r=S+":"+(N[2]?N[2].toLowerCase():"\n")+":"+P;var M="k:"+f++;z[M]=r;var O=B[r];if(!O){O=B[r]=[];}O[O.length]=[M,P,R,L];return M;};C.Event=function(r){if(r){o.lang.apply(this,r);}};C.Event.prototype.preventDefault=function(){if(this[g]){return;}this[g]=true;if(this.nativeEvent&&this.nativeEvent.preventDefault){this.nativeEvent.preventDefault();this.nativeEvent.returnValue=false;}};C.Event.prototype.defaultPrevented=function(){return !!this[g];};C.Event.prototype.stopPropagation=function(){if(this[u]){return;}this[u]=true;var r=this.nativeEvent;if(r){r.cancelBubble=true;if(r.stopPropagation){r.stopPropagation();}}};C.Event.prototype.propagationStopped=function(){return !!this[u];};if(o.env.ie<8||o.env.webkit<500){C.addListener(window,"unload",w);}o.events=C;o.events.listenersByObjId=n;}});(window.gloader||glow).module({name:"glow.data",library:["glow","1.7.3"],depends:[["glow","1.7.3","glow.dom"]],builder:function(glow){var TYPES={UNDEFINED:"undefined",OBJECT:"object",NUMBER:"number",BOOLEAN:"boolean",STRING:"string",ARRAY:"array",FUNCTION:"function",NULL:"null"};var TEXT={AT:"@",EQ:"=",DOT:".",EMPTY:"",AND:"&",OPEN:"(",CLOSE:")"};var JSON={HASH:{START:"{",END:"}",SHOW_KEYS:true},ARRAY:{START:"[",END:"]",SHOW_KEYS:false},DATA_SEPARATOR:",",KEY_SEPARATOR:":",KEY_DELIMITER:'"',STRING_DELIMITER:'"',SAFE_PT1:/^[\],:{}\s]*$/,SAFE_PT2:/\\./g,SAFE_PT3:/\"[^\"\\\n\r]*\"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g,SAFE_PT4:/(?:^|:|,)(?:\s*\[)+/g};var SLASHES={TEST:/[\b\n\r\t\\\f\"]/g,B:{PLAIN:"\b",ESC:"\\b"},N:{PLAIN:"\n",ESC:"\\n"},R:{PLAIN:"\r",ESC:"\\r"},T:{PLAIN:"\t",ESC:"\\t"},F:{PLAIN:"\f",ESC:"\\f"},SL:{PLAIN:"\\",ESC:"\\\\"},QU:{PLAIN:'"',ESC:'\\"'}};function _replaceSlashes(s){switch(s){case SLASHES.B.PLAIN:return SLASHES.B.ESC;case SLASHES.N.PLAIN:return SLASHES.N.ESC;case SLASHES.R.PLAIN:return SLASHES.R.ESC;case SLASHES.T.PLAIN:return SLASHES.T.ESC;case SLASHES.F.PLAIN:return SLASHES.F.ESC;case SLASHES.SL.PLAIN:return SLASHES.SL.ESC;case SLASHES.QU.PLAIN:return SLASHES.QU.ESC;default:return s;}}function _getType(object){if((typeof object)==TYPES.OBJECT){if(object==null){return TYPES.NULL;}else{return(object instanceof Array)?TYPES.ARRAY:TYPES.OBJECT;}}else{return(typeof object);}}glow.data={encodeUrl:function(object){var objectType=_getType(object);var paramsList=[];var listLength=0;if(objectType!=TYPES.OBJECT){throw new Error("glow.data.encodeUrl: cannot encode item");}else{for(var key in object){switch(_getType(object[key])){case TYPES.FUNCTION:case TYPES.OBJECT:throw new Error("glow.data.encodeUrl: cannot encode item");break;case TYPES.ARRAY:for(var i=0,l=object[key].length;i<l;i++){switch(_getType(object[key])[i]){case TYPES.FUNCTION:case TYPES.OBJECT:case TYPES.ARRAY:throw new Error("glow.data.encodeUrl: cannot encode item");break;default:paramsList[listLength++]=key+TEXT.EQ+encodeURIComponent(object[key][i]);}}break;default:paramsList[listLength++]=key+TEXT.EQ+encodeURIComponent(object[key]);}}return paramsList.join(TEXT.AND);}},decodeUrl:function(text){if(_getType(text)!=TYPES.STRING){throw new Error("glow.data.decodeUrl: cannot decode item");}else{if(text===""){return{};}}var result={};var keyValues=text.split(/[&;]/);var thisPair,key,value;for(var i=0,l=keyValues.length;i<l;i++){thisPair=keyValues[i].split(TEXT.EQ);if(thisPair.length!=2){throw new Error("glow.data.decodeUrl: cannot decode item");}else{key=glow.lang.trim(decodeURIComponent(thisPair[0]));value=glow.lang.trim(decodeURIComponent(thisPair[1]));switch(_getType(result[key])){case TYPES.ARRAY:result[key][result[key].length]=value;break;case TYPES.UNDEFINED:result[key]=value;break;default:result[key]=[result[key],value];}}}return result;},encodeJson:function(object,options){function _encode(object,options){if(_getType(object)==TYPES.ARRAY){var type=JSON.ARRAY;}else{var type=JSON.HASH;}var serial=[type.START];var len=1;var dataType;var notFirst=false;for(var key in object){dataType=_getType(object[key]);if(dataType!=TYPES.UNDEFINED){if(notFirst){serial[len++]=JSON.DATA_SEPARATOR;}notFirst=true;if(type.SHOW_KEYS){serial[len++]=JSON.KEY_DELIMITER;serial[len++]=key;serial[len++]=JSON.KEY_DELIMITER;serial[len++]=JSON.KEY_SEPARATOR;}switch(dataType){case TYPES.FUNCTION:throw new Error("glow.data.encodeJson: cannot encode item");break;case TYPES.STRING:default:serial[len++]=JSON.STRING_DELIMITER;serial[len++]=glow.lang.replace(object[key],SLASHES.TEST,_replaceSlashes);serial[len++]=JSON.STRING_DELIMITER;break;case TYPES.NUMBER:case TYPES.BOOLEAN:serial[len++]=object[key];break;case TYPES.OBJECT:case TYPES.ARRAY:serial[len++]=_encode(object[key],options);break;case TYPES.NULL:serial[len++]=TYPES.NULL;break;}}}serial[len++]=type.END;return serial.join(TEXT.EMPTY);}options=options||{};var type=_getType(object);if((type==TYPES.OBJECT)||(type==TYPES.ARRAY)){return _encode(object,options);}else{throw new Error("glow.data.encodeJson: cannot encode item");}},decodeJson:function(text,options){if(_getType(text)!=TYPES.STRING){throw new Error("glow.data.decodeJson: cannot decode item");}options=options||{};options.safeMode=options.safeMode||false;var canEval=true;if(options.safeMode){canEval=(JSON.SAFE_PT1.test(text.replace(JSON.SAFE_PT2,TEXT.AT).replace(JSON.SAFE_PT3,JSON.ARRAY.END).replace(JSON.SAFE_PT4,TEXT.EMPTY)));}if(canEval){try{return eval(TEXT.OPEN+text+TEXT.CLOSE);}catch(e){}}throw new Error("glow.data.decodeJson: cannot decode item");},escapeHTML:function(html){return glow.dom.create("<div></div>").text(html).html();}};}});(window.gloader||glow).module({name:"glow.net",library:["glow","1.7.3"],depends:[["glow","1.7.3","glow.data","glow.events"]],builder:function(h){var t={XML_ERR:"Cannot get response as XML, check the mime type of the data",POST_DEFAULT_CONTENT_TYPE:"application/x-www-form-urlencoded;"},u=/\+xml$/,p=[],e="c",o="_"+h.UID+"loadScriptCbs",g=h.dom.get,c=h.events,f=function(){},k=1;function s(){if(window.ActiveXObject){return(s=function(){return new ActiveXObject("Microsoft.XMLHTTP");})();}else{return(s=function(){return new XMLHttpRequest();})();}}function d(w){var r=h.lang.apply({onLoad:f,onError:f,onAbort:f,headers:{},async:true,useCache:false,data:null,defer:false,forceXml:false},w||{});if(!("X-Requested-With" in r.headers)){r.headers["X-Requested-With"]="XMLHttpRequest";}return r;}function v(r){return[r,(/\?/.test(r)?"&":"?"),"a",new Date().getTime(),parseInt(Math.random()*100000)].join("");}function j(C,r,z){var y=s(),A=z.data&&(typeof z.data=="string"?z.data:h.data.encodeUrl(z.data)),w,x=new q(y,z);if(!z.useCache){r=v(r);}y.open(C,r,z.async);for(w in z.headers){y.setRequestHeader(w,z.headers[w]);}function B(){x.send=f;if(z.async){if(z.timeout){x._timeout=setTimeout(function(){a(x);var E=new b(y,true,x);c.fire(x,"error",E);},z.timeout*1000);}y.onreadystatechange=function(){if(y.readyState==4){x._timeout&&clearTimeout(x._timeout);x.completed=true;var E=new b(y,false,x);if(E.wasSuccessful){c.fire(x,"load",E);}else{c.fire(x,"error",E);}y.onreadystatechange=new Function();}};y.send(A);return x;}else{y.send(A);x.completed=true;var D=new b(y,false,x);if(D.wasSuccessful){c.fire(x,"load",D);}else{c.fire(x,"error",D);}return D;}}x.send=B;return z.defer?x:B();}var m={};m.get=function(r,w){w=d(w);return j("GET",r,w);};m.post=function(r,w,x){x=d(x);x.data=w;if(!x.headers["Content-Type"]){x.headers["Content-Type"]=t.POST_DEFAULT_CONTENT_TYPE;}return j("POST",r,x);};m.send=function(y,r,w,x){w=w||"";x=d(x);x.data=w;return j(y,r,x);};m.put=function(r,w,x){x=d(x);x.data=w;if(!x.headers["Content-Type"]){x.headers["Content-Type"]=t.POST_DEFAULT_CONTENT_TYPE;}return j("PUT",r,x);};m.del=function(r,w){w=d(w);return j("DELETE",r,w);};m.loadScript=function(w,z){var x=p.length,r,A=e+x,z=d(z),y=new q(x,z),w=z.useCache?w:v(w),B=window[o]||(window[o]={});if(z.onLoad!=f){B[A]=function(){y._timeout&&clearTimeout(y._timeout);y.completed=true;z.onLoad.apply(this,arguments);y.destroy();r=B[A]=undefined;delete B[A];};w=h.lang.interpolate(w,{callback:o+"."+A});}r=p[x]=document.createElement("script");if(z.charset){r.charset=z.charset;}c.addListener(y,"abort",z.onAbort);h.ready(function(){if(z.timeout){y._timeout=setTimeout(function(){a(y);z.onError();},z.timeout*1000);}if(h.env.opera){setTimeout(function(){if(r){r.src=w;}},0);}else{r.src=w;}document.body.appendChild(r);});return y;};function a(w){var r=w.nativeRequest,x=w._callbackIndex;w._timeout&&clearTimeout(w._timeout);if(r){r.onreadystatechange=new Function();r.abort();}else{if(x){window[o][e+x]=f;h.dom.get(p[x]).destroy();}}}function q(y,w){this._timeout=null;this._forceXml=w.forceXml;if(w.forceXml&&y.overrideMimeType){y.overrideMimeType("application/xml");}this.complete=false;if(typeof y=="number"){this._callbackIndex=y;}else{this.nativeRequest=y;}var x=["Load","Error","Abort"],r=0;for(;r<3;r++){c.addListener(this,x[r].toLowerCase(),w["on"+x[r]]);}}q.prototype={send:function(){},abort:function(){if(!this.completed&&!c.fire(this,"abort").defaultPrevented()){a(this);}return this;},destroy:function(){var r=this;if(this._callbackIndex!==undefined){setTimeout(function(){g(p[r._callbackIndex]).destroy();p[r._callbackIndex]=undefined;delete p[r._callbackIndex];},0);}return this;}};function b(x,r,w){c.Event.call(this);this._request=w;this.nativeResponse=x;this.status=r?408:x.status==1223?204:x.status;this.timedOut=!!r;this.wasSuccessful=(this.status>=200&&this.status<300)||this.status==304||(this.status==0&&x.responseText);}function l(){var r=this.header("Content-Type");return u.test(r)||r==="";}h.lang.extend(b,c.Event,{text:function(){return this.nativeResponse.responseText;},xml:function(){var w=this.nativeResponse;if((h.env.ie&&l.call(this))||(this._request._forceXml&&!this._request.nativeRequest.overrideMimeType&&window.ActiveXObject)){var r=new ActiveXObject("Microsoft.XMLDOM");r.loadXML(w.responseText);return r;}else{if(!w.responseXML){throw new Error(t.XML_ERR);}return w.responseXML;}},json:function(r){return h.data.decodeJson(this.text(),{safeMode:r});},header:function(r){return this.nativeResponse.getResponseHeader(r);},statusText:function(){return this.timedOut?"Request Timeout":this.nativeResponse.statusText;}});var n=function(r,x,y,w){this.url=r;this.data=x;this.isGet=y;this.opts=w;};n.prototype={_send:function(){this._addIframe();this._addForm();this._addTimeout();this.onLoad=this._handleResponse;this._submitForm();},_addIframe:function(){this.iframe=h.dom.create('<iframe style="visibility: hidden; position: absolute; height: 0;"></iframe>');var r=this.iframe[0],w=this,x=function(){if(w.onLoad){w.onLoad();}};if(r.attachEvent){r.attachEvent("onload",x);}else{r.onload=x;}g("body").append(this.iframe);},_addForm:function(){var x=this._window().document;if(h.env.ie){x.open();x.write("<html><body></body></html>");x.close();}var w=this.form=x.createElement("form");w.setAttribute("action",this.url);w.setAttribute("method",this.isGet?"GET":"POST");var r=x.getElementsByTagName("body")[0];r.appendChild(w);this._addFormData();},_addFormData:function(){for(var x in this.data){if(!this.data.hasOwnProperty(x)){continue;}if(this.data[x] instanceof Array){var r=this.data[x].length;for(var w=0;w<r;w++){this._addHiddenInput(x,this.data[x][w]);}}else{this._addHiddenInput(x,this.data[x]);}}},_addHiddenInput:function(w,x){var r=this._window().document.createElement("input");r.type="hidden";r.name=w;r.value=x;this.form.appendChild(r);},_window:function(){var r=this.iframe[0];if(r.contentWindow){return r.contentWindow;}throw new Error("could not get contentWindow from iframe");},_addTimeout:function(){var r=this;this.timeout=setTimeout(function(){var w;if(r.opts.hasOwnProperty("onTimeout")){try{r.opts.onTimeout();}catch(x){w=x;}}r._cleanup();if(w){throw new Error("error in xDomainPost onTimeout callback: "+w);}},(this.opts.timeout||10)*1000);},_handleResponse:function(){var w,r,y=this._window();try{r=y.location.href;}catch(x){w=x;}if(r!="about:blank"||w){clearTimeout(this.timeout);this.onLoad=this._readHandler;if("_fullBlankUrl" in this.opts){y.location=this.opts._fullBlankUrl;}else{y.location=window.location.protocol+"//"+window.location.host+(this.opts.blankUrl||"/favicon.ico");}}},_readHandler:function(){var r;if(this.opts.hasOwnProperty("onLoad")){try{this.opts.onLoad(this._window().name);}catch(w){r=w;}}this._cleanup();if(r){throw new Error("error in xDomainPost onLoad callback: "+r);}},_cleanup:function(){this.iframe.remove();},_submitForm:function(){var r=this;this._window().setTimeout(function(){r.form.submit();},0);}};m.xDomainPost=function(r,y,x){var w=new n(r,y,false,x);w._send();};m.xDomainGet=function(r,x){var w=new n(r,{},true,x);w._send();};h.net=m;}});(window.gloader||glow).module({name:"glow.tweens",library:["glow","1.7.3"],depends:[],builder:function(b){function a(c){return function(d){return 1-c(1-d);};}b.tweens={linear:function(){return function(c){return c;};},easeIn:function(c){c=c||2;return function(d){return Math.pow(1,c-1)*Math.pow(d,c);};},easeOut:function(c){return a(this.easeIn(c));},easeBoth:function(c){return this.combine(this.easeIn(c),this.easeOut(c));},overshootIn:function(c){return a(this.overshootOut(c));},overshootOut:function(c){c=c||1.70158;return function(d){if(d==0||d==1){return d;}return((d-=1)*d*((c+1)*d+c)+1);};},overshootBoth:function(c){return this.combine(this.overshootIn(c),this.overshootOut(c));},bounceIn:function(){return a(this.bounceOut());},bounceOut:function(){return function(c){if(c<(1/2.75)){return 7.5625*c*c;}else{if(c<(2/2.75)){return(7.5625*(c-=(1.5/2.75))*c+0.75);}else{if(c<(2.5/2.75)){return(7.5625*(c-=(2.25/2.75))*c+0.9375);}else{return(7.5625*(c-=(2.625/2.75))*c+0.984375);}}}};},bounceBoth:function(){return this.combine(this.bounceIn(),this.bounceOut());},elasticIn:function(c,d){return a(this.elasticOut(c,d));},elasticOut:function(c,d){return function(e){if(e==0||e==1){return e;}if(!d){d=0.3;}if(!c||c<1){c=1;var f=d/4;}else{var f=d/(2*Math.PI)*Math.asin(1/c);}return c*Math.pow(2,-10*e)*Math.sin((e-f)*(2*Math.PI)/d)+1;};},elasticBoth:function(c,d){d=d||0.45;return this.combine(this.elasticIn(c,d),this.elasticOut(c,d));},combine:function(d,c){return function(e){if(e<0.5){return d(e*2)/2;}else{return c((e-0.5)*2)/2+0.5;}};}};}});(window.gloader||glow).module({name:"glow.anim",library:["glow","1.7.3"],depends:[["glow","1.7.3","glow.tweens","glow.events","glow.dom"]],builder:function(glow){var $=glow.dom.get,manager,events=glow.events,dom=glow.dom,get=dom.get,hasUnits=/width|height|top$|bottom$|left$|right$|spacing$|indent$|font-size/,noNegatives=/width|height|padding|opacity/,usesYAxis=/height|top/,getUnit=/(\D+)$/,testElement=dom.create('<div style="position:absolute;visibility:hidden"></div>');function addEventsFromOpts(instance,opts,eventProps){for(var i=0,len=eventProps.length;i<len;i++){if(opts[eventProps[i]]){events.addListener(instance,eventProps[i].slice(2).toLowerCase(),opts[eventProps[i]]);}}}(function(){var queue=[],queueLen=0,intervalTime=13,interval;manager={addToQueue:function(anim){queue[queueLen++]=anim;anim._playing=true;anim._timeAnchor=anim._timeAnchor||new Date().valueOf();if(!interval){this.startInterval();}},removeFromQueue:function(anim){for(var i=0;i<queueLen;i++){if(queue[i]==anim){queue.splice(i,1);anim._timeAnchor=null;anim._playing=false;if(--queueLen==0){this.stopInterval();}return;}}},startInterval:function(){interval=window.setInterval(this.processQueue,intervalTime);},stopInterval:function(){window.clearInterval(interval);interval=null;},processQueue:function(){var anim,i,now=new Date().valueOf();for(i=0;i<queueLen;i++){anim=queue[i];if(anim.position==anim.duration){manager.removeFromQueue(anim);i--;events.fire(anim,"complete");if(anim._opts.destroyOnComplete){anim.destroy();}continue;}if(anim.useSeconds){anim.position=(now-anim._timeAnchor)/1000;if(anim.position>anim.duration){anim.position=anim.duration;}}else{anim.position++;}anim.value=anim.tween(anim.position/anim.duration);events.fire(anim,"frame");}}};})();function convertCssUnit(element,fromValue,toUnit,axis){var elmStyle=testElement[0].style,axisProp=(axis=="x")?"width":"height",startPixelValue,toUnitPixelValue;elmStyle.margin=elmStyle.padding=elmStyle.border="0";startPixelValue=testElement.css(axisProp,fromValue).insertAfter(element)[axisProp]();toUnitPixelValue=testElement.css(axisProp,10+toUnit)[axisProp]()/10;testElement.remove();return startPixelValue/toUnitPixelValue;}function keepWithinRange(num,start,end){if(start!==undefined&&num<start){return start;}if(end!==undefined&&num>end){return end;}return num;}function buildAnimFunction(element,spec){var cssProp,r=["a=(function(){"],rLen=1,fromUnit,unitDefault=[0,"px"],to,from,unit,a;for(cssProp in spec){r[rLen++]='element.css("'+cssProp+'", ';if(typeof spec[cssProp]!="object"){to=spec[cssProp];}else{to=spec[cssProp].to;}if((from=spec[cssProp].from)===undefined){if(cssProp=="font-size"||cssProp=="background-position"){throw new Error("From value must be set for "+cssProp);}from=element.css(cssProp);}if(hasUnits.test(cssProp)){unit=(getUnit.exec(to)||unitDefault)[1];fromUnit=(getUnit.exec(from)||unitDefault)[1];from=parseFloat(from)||0;to=parseFloat(to)||0;if(from&&unit!=fromUnit){if(cssProp=="font-size"){throw new Error("Units must be the same for font-size");}from=convertCssUnit(element,from+fromUnit,unit,usesYAxis.test(cssProp)?"y":"x");}if(noNegatives.test(cssProp)){r[rLen++]="keepWithinRange(("+(to-from)+" * this.value) + "+from+', 0) + "'+unit+'"';}else{r[rLen++]="("+(to-from)+" * this.value) + "+from+' + "'+unit+'"';}}else{if(!(isNaN(from)||isNaN(to))){from=Number(from);to=Number(to);r[rLen++]="("+(to-from)+" * this.value) + "+from;}else{if(cssProp.indexOf("color")!=-1){to=dom.parseCssColor(to);if(!glow.lang.hasOwnProperty(from,"r")){from=dom.parseCssColor(from);}r[rLen++]='"rgb(" + keepWithinRange(Math.round('+(to.r-from.r)+" * this.value + "+from.r+'), 0, 255) + "," + keepWithinRange(Math.round('+(to.g-from.g)+" * this.value + "+from.g+'), 0, 255) + "," + keepWithinRange(Math.round('+(to.b-from.b)+" * this.value + "+from.b+'), 0, 255) + ")"';}else{if(cssProp=="background-position"){var vals={},fromTo=["from","to"],unit=(getUnit.exec(from)||unitDefault)[1];vals.fromOrig=from.toString().split(/\s/);vals.toOrig=to.toString().split(/\s/);if(vals.fromOrig[1]===undefined){vals.fromOrig[1]="50%";}if(vals.toOrig[1]===undefined){vals.toOrig[1]="50%";}for(var i=0;i<2;i++){vals[fromTo[i]+"X"]=parseFloat(vals[fromTo[i]+"Orig"][0]);vals[fromTo[i]+"Y"]=parseFloat(vals[fromTo[i]+"Orig"][1]);vals[fromTo[i]+"XUnit"]=(getUnit.exec(vals[fromTo[i]+"Orig"][0])||unitDefault)[1];vals[fromTo[i]+"YUnit"]=(getUnit.exec(vals[fromTo[i]+"Orig"][1])||unitDefault)[1];}if((vals.fromXUnit!==vals.toXUnit)||(vals.fromYUnit!==vals.toYUnit)){throw new Error("Mismatched axis units cannot be used for "+cssProp);}r[rLen++]="("+(vals.toX-vals.fromX)+" * this.value + "+vals.fromX+') + "'+vals.fromXUnit+' " + ('+(vals.toY-vals.fromY)+" * this.value + "+vals.fromY+') + "'+vals.fromYUnit+'"';}}}}r[rLen++]=");";}r[rLen++]="})";return eval(r.join(""));}var r={};r.css=function(element,duration,spec,opts){element=get(element);var anim=new r.Animation(duration,opts);if(element[0]){events.addListener(anim,"frame",buildAnimFunction(element,spec));}return anim;};slideElement=function slideElement(element,duration,action,opts){duration=duration||0.5;element=$(element);opts=glow.lang.apply({tween:glow.tweens.easeBoth(),onStart:function(){},onComplete:function(){}},opts);var i=0,thatlength=element.length,completeHeight,fromHeight,channels=[],timeline;for(;i<thatlength;i++){if(action=="up"||(action=="toggle"&&element.slice(i,i+1).height()>0)){element[i].style.overflow="hidden";if(glow.env.ie<8){element[i].style.zoom=1;}completeHeight=0;fromHeight=element.slice(i,i+1).height();}else{if(action=="down"||(action=="toggle"&&element.slice(i,i+1).height()==0)){fromHeight=element.slice(i,i+1).height();element[i].style.height="";completeHeight=element.slice(i,i+1).height();if(completeHeight===0){element[i].style.height="auto";completeHeight=element.slice(i,i+1).height();}element[i].style.height=fromHeight+"px";}}channels[i]=[glow.anim.css(element[i],duration,{height:{from:fromHeight,to:completeHeight}},{tween:opts.tween})];}timeline=new glow.anim.Timeline(channels,{destroyOnComplete:true});events.addListener(timeline,"complete",function(){element.each(function(){if(this.style.height.slice(0,1)!="0"){this.style.height="";if(glow.dom.get(this).height()===0){this.style.height="auto";}}});});events.addListener(timeline,"start",opts.onStart);events.addListener(timeline,"complete",opts.onComplete);return timeline.start();};r.slideDown=function(element,duration,opts){return slideElement(element,duration,"down",opts);};r.slideUp=function(element,duration,opts){return slideElement(element,duration,"up",opts);};r.slideToggle=function(element,duration,opts){return slideElement(element,duration,"toggle",opts);};r.fadeOut=function(element,duration,opts){return r.fadeTo(element,0,duration,opts);};r.fadeIn=function(element,duration,opts){return r.fadeTo(element,1,duration,opts);};r.fadeTo=function(element,opacity,duration,opts){duration=duration||0.5;element=$(element);opts=glow.lang.apply({tween:glow.tweens.easeBoth(),onStart:function(){},onComplete:function(){}},opts);var i=0,thatlength=element.length,channels=[],timeline;for(;i<thatlength;i++){channels[i]=[glow.anim.css(element[i],duration,{opacity:opacity},{tween:opts.tween})];}timeline=new glow.anim.Timeline(channels,{destroyOnComplete:true});events.addListener(timeline,"start",opts.onStart);events.addListener(timeline,"complete",opts.onComplete);return timeline.start();};r.highlight=function(element,highlightColour,duration,opts){element=$(element);duration=duration||1;highlightColour=highlightColour||"#ffff99";opts=glow.lang.apply({tween:glow.tweens.easeBoth(),onStart:function(){},onComplete:function(){}},opts);var i=0,transArray=[],elmsLength=element.length,completeColour,channels=[],timeline;for(;i<elmsLength;i++){completeColour=opts.completeColour||element.slice(i,i+1).css("background-color");if(completeColour=="transparent"||completeColour==""){completeColour="#fff";}channels[i]=[r.css(element[i],duration,{"background-color":{from:highlightColour,to:completeColour}},{tween:opts.tween})];}timeline=new glow.anim.Timeline(channels,{destroyOnComplete:true});events.addListener(timeline,"start",opts.onStart);events.addListener(timeline,"complete",opts.onComplete);return timeline.start();};var animationEventConstructorNames=["onStart","onStop","onComplete","onResume","onFrame"];r.Animation=function(duration,opts){this._opts=opts=glow.lang.apply({useSeconds:true,tween:glow.tweens.linear(),destroyOnComplete:false,onStart:null,onStop:null,onComplete:null,onResume:null,onFrame:null},opts);this._playing=false;this._timeAnchor=null;this.duration=duration;this.useSeconds=opts.useSeconds;this.tween=opts.tween;this.position=0;this.value=0;addEventsFromOpts(this,opts,animationEventConstructorNames);};r.Animation.prototype={start:function(){if(this._playing){this.stop();}var e=events.fire(this,"start");if(e.defaultPrevented()){return this;}this._timeAnchor=null;this.position=0;manager.addToQueue(this);return this;},stop:function(){if(this._playing){var e=events.fire(this,"stop");if(e.defaultPrevented()){return this;}manager.removeFromQueue(this);}return this;},destroy:function(){this.stop();events.removeAllListeners(this);return this;},resume:function(){if(!this._playing){var e=events.fire(this,"resume");if(e.defaultPrevented()){return this;}this._timeAnchor=new Date().valueOf()-(this.position*1000);manager.addToQueue(this);}return this;},isPlaying:function(){return this._playing;},goTo:function(pos){this._timeAnchor=new Date().valueOf()-((this.position=pos)*1000);this.value=this.tween(this.duration&&this.position/this.duration);events.fire(this,"frame");return this;}};var timelineEventConstructorNames=["onStart","onStop","onComplete","onResume"];r.Timeline=function(channels,opts){this._opts=opts=glow.lang.apply({loop:false,destroyOnComplete:false,onStart:null,onStop:null,onComplete:null,onResume:null},opts);this._channels=(channels[0]&&channels[0].push)?channels:[channels];this._channelPos=[];this._playing=false;this.loop=opts.loop;var i,j,iLen,jLen,channel,allChannels=this._channels,totalDuration=0,channelDuration;for(i=0,iLen=allChannels.length;i<iLen;i++){channel=allChannels[i];channelDuration=0;for(j=0,jLen=channel.length;j<jLen;j++){if(typeof channel[j]=="number"){channel[j]=new r.Animation(channel[j]);}if(channel[j] instanceof r.Animation){if(!channel[j].useSeconds){throw new Error("Timelined animations must be timed in seconds");}channel[j]._timelineOffset=channelDuration*1000;channelDuration+=channel[j].duration;channel[j]._channelIndex=i;}}this.duration=totalDuration=Math.max(channelDuration,totalDuration);}this._controlAnim=new r.Animation(totalDuration);events.addListener(this._controlAnim,"frame",this._processFrame,this);events.addListener(this._controlAnim,"complete",this._complete,this);addEventsFromOpts(this,opts,timelineEventConstructorNames);};r.Timeline.prototype={_advanceChannel:function(i){var currentAnim=this._channels[i][this._channelPos[i]],nextAnim=this._channels[i][++this._channelPos[i]];if(currentAnim&&currentAnim._playing){currentAnim._playing=false;events.fire(currentAnim,"complete");if(currentAnim._opts.destroyOnComplete){currentAnim.destroy();}}if((nextAnim)!==undefined){if(typeof nextAnim=="function"){nextAnim();this._advanceChannel(i);}else{nextAnim.position=0;nextAnim._channelIndex=i;events.fire(nextAnim,"start");nextAnim._playing=true;}}},_complete:function(){if(this.loop){this.start();return;}this._playing=false;events.fire(this,"complete");if(this._opts.destroyOnComplete){this.destroy();}},_processFrame:function(){var i,len,anim,controlAnim=this._controlAnim,msFromStart=(new Date().valueOf())-controlAnim._timeAnchor;for(i=0,len=this._channels.length;i<len;i++){if(!(anim=this._channels[i][this._channelPos[i]])){continue;}anim.position=(msFromStart-anim._timelineOffset)/1000;if(anim.position>anim.duration){anim.position=anim.duration;}anim.value=anim.tween(anim.position/anim.duration);events.fire(anim,"frame");if(anim.position==anim.duration){this._advanceChannel(i);}}},start:function(){var e=events.fire(this,"start");if(e.defaultPrevented()){return this;}var i,iLen,j,jLen,anim;this._playing=true;for(i=0,iLen=this._channels.length;i<iLen;i++){this._channelPos[i]=-1;this._advanceChannel(i);for(j=this._channels[i].length;j;j--){anim=this._channels[i][j];if(anim instanceof r.Animation){anim.goTo(0);}}}this._controlAnim.start();return this;},stop:function(){if(this._playing){var e=events.fire(this,"stop");if(e.defaultPrevented()){return this;}this._playing=false;var anim;for(var i=0,len=this._channels.length;i<len;i++){anim=this._channels[i][this._channelPos[i]];if(anim instanceof r.Animation&&anim._playing){events.fire(anim,"stop");anim._playing=false;}}this._controlAnim.stop();}return this;},destroy:function(){var i,j;this.stop();events.removeAllListeners(this);this._controlAnim.destroy();i=this._channels.length;while(i--){j=this._channels[i].length;while(j--){if(this._channels[i][j].destroy){this._channels[i][j].destroy();}}}return this;},resume:function(){if(!this._playing){var e=events.fire(this,"resume");if(e.defaultPrevented()){return this;}this._playing=true;var anim;for(var i=0,len=this._channels.length;i<len;i++){anim=this._channels[i][this._channelPos[i]];if(anim instanceof r.Animation&&!anim._playing){events.fire(anim,"resume");anim._playing=true;}}this._controlAnim.resume();}return this;},isPlaying:function(){return this._playing;},goTo:function(pos){var i,j,k,channelsLen=this._channels.length,channelLen,anim,runningDuration;if(typeof pos=="number"){if(pos>this.duration){if(this.loop){pos=pos%this.duration;}else{pos=this.duration;}}this._controlAnim.goTo(pos);for(i=0;i<channelsLen;i++){runningDuration=0;for(j=0,channelLen=this._channels[i].length;j<channelLen;j++){anim=this._channels[i][j];if(anim instanceof r.Animation){if((runningDuration+anim.duration)>pos){this._channelPos[i]=j;anim.goTo(pos-runningDuration);break;}anim.goTo(anim.duration);runningDuration+=anim.duration;}}for(k=channelLen;k>j;k--){anim.goTo(0);}}}else{for(i=0;i<channelsLen;i++){runningDuration=0;for(j=0,channelLen=this._channels[i].length;j<channelLen;j++){anim=this._channels[i][j];if(anim===pos){return this.goTo(runningDuration);}if(anim instanceof r.Animation){runningDuration+=anim.duration;}}}throw"Animation not found in animation channels";}return this;}};glow.anim=r;}});(window.gloader||glow).module({name:"glow.forms",library:["glow","1.7.3"],depends:[["glow","1.7.3","glow.dom","glow.events","glow.anim","glow.net","glow.i18n"]],builder:function(g){var b=g.i18n,f=g.lang.interpolate;b.addLocaleModule("GLOW_FORMS","en",{TEST_MESSAGE_REQUIRED:"Value is required",TEST_MESSAGE_IS_NUMBER:"Must be a number.",TEST_MESSAGE_MIN:"The value must be at least {arg}.",TEST_MESSAGE_MAX:"The value must be less than {arg}.",TEST_MESSAGE_RANGE:"The value must be {min} or greater, and less than {max}.",TEST_MESSAGE_MIN_COUNT:"Must be have at least {arg} values.",TEST_MESSAGE_MAX_COUNT:"Must be have at most {arg} values.",TEST_MESSAGE_COUNT:"Must have {arg} values.",TEST_MESSAGE_REGEX:"Must be in the correct format.",TEST_MESSAGE_MIN_LEN:"Must be at least {arg} characters.",TEST_MESSAGE_MAX_LEN:"Must be at most {arg} characters.",TEST_MESSAGE_IS_EMAIL:"Must be a valid email address.",TEST_MESSAGE_SAME_AS:"Must be the same as: {arg}",TEST_MESSAGE_AJAX:"server responded",TEST_MESSAGE_IS:"Must be {arg}",TEST_MESSAGE_IS_NOT:"Must not be {arg}"});g.forms={};g.forms.Form=function(k,j){this.formNode=g.dom.get(k);if(!this.formNode[0]){throw"Could not find form. Possibly run before DOM ready.";}this._fields=[];this._result=null;this.opts=j||{};g.events.addListener(this,"validate",this.opts.onValidate||a.defaultFeedback);this._idleTimer=null;this._localeModule=b.getLocaleModule("GLOW_FORMS");var h=this;g.events.addListener(this.formNode,"submit",function(){h.validate("submit");return false;});};g.forms.Form.prototype.validate=function(h,j){this.eventName=h||"submit";this._result=new g.forms.ValidateResult(this.eventName);this._result.form=this;this._fieldCur=0;this._testCur=-1;this._fieldName=j;c.call(this);};var c=function(){this._testCur++;if(this._testCur>=this._fields[this._fieldCur]._tests.length){if(!d.call(this)){return;}}var j=this._fields[this._fieldCur]._tests[this._testCur];var h;if(j.opts.field){h=this.formNode.val()[j.opts.field]||"";j.isConditional=true;}else{h=this.formNode.val()[this._fields[this._fieldCur].name]||"";}if(!h.join){h=[h];}var k=function(l){return function(){e.apply(l,arguments);};}(this);j.opts.on=j.opts.on||"submit";if(this._result.eventName&&(" "+j.opts.on+" ").indexOf(" "+this._result.eventName+" ")!=-1){if(this._fieldName&&this._fieldName!=j.name){c.call(this);return;}if(typeof g.forms.tests[j.type]!="function"){throw"Unimplemented test: no test exists of type '"+j.type+"'.";}j.opts._localeModule=this._localeModule;g.forms.tests[j.type](h,j.opts,k,this.formNode.val());}else{c.call(this);}};var d=function(){this._fieldCur++;this._testCur=0;if(this._fieldCur>=this._fields.length){this._fieldCur=0;g.events.fire(this,"validate",this._result);if(this.eventName=="submit"&&this._result&&!this._result.defaultPrevented()){try{this.formNode[0].submit();}catch(h){throw new Error("Glow can't submit the form because the submit function can't be called. Perhaps that form's submit was replaced by an input element named 'submit'?");}}return false;}return true;};var e=function(h,j){if(typeof h=="boolean"){h=(h)?g.forms.PASS:g.forms.FAIL;}if(this._fields[this._fieldCur]._tests[this._testCur].isConditional&&h===g.forms.FAIL){h=g.forms.SKIP;}this._result.fields.push({name:this._fields[this._fieldCur].name,result:h,message:j});if(h!==g.forms.PASS){if(h===g.forms.FAIL){this._result.errorCount++;}this._testCur=this._fields[this._fieldCur]._tests.length;}c.call(this);};g.forms.Form.prototype.addTests=function(r){var q={name:r,_tests:[]};var j=function(s){return function(){s.validate.apply(s,["change",r]);};}(this);var n=function(s){return function(){s.validate.apply(s,["click",r]);};}(this);var o=function(s){return function(){s.validate.apply(s,["idle",r]);};}(this);for(var l=1;l<arguments.length;l++){var k=arguments[l][0];var p=(arguments[l].length>1)?arguments[l][1]:{};q._tests.push({name:r,type:k,opts:p});if(!j.added&&(" "+p.on+" ").indexOf(" change ")!=-1){var m=this.formNode.get("*").each(function(s){if(this.name==r){g.events.addListener(this,"change",j);j.added=true;}});}if(!n.added&&(" "+p.on+" ").indexOf(" click ")!=-1){var m=this.formNode.get("*").each(function(s){if(this.name==r){g.events.addListener(this,"click",n);n.added=true;}});}if(!o.added&&(" "+p.on+" ").indexOf(" idle ")!=-1){var h=(typeof p.delay!="undefined")?parseInt(p.delay):1000;var m=this.formNode.get("*").each(function(s){if(this.name==r){g.events.addListener(this,"keyup",function(u){return function(){window.clearTimeout(this.idleTimeoutID);if(this.value){this.idleTimeoutID=window.setTimeout(o,u);}};}(h));g.events.addListener(this,"blur",function(){window.clearTimeout(this.idleTimeoutID);});o.added=true;}});}}this._fields.push(q);return this;};g.forms.ValidateResult=function(h){g.events.Event.apply(this);this.eventName=h;this.errorCount=0;this.value=undefined;this.fields=[];};g.lang.extend(g.forms.ValidateResult,g.events.Event);g.forms.PASS=1;g.forms.FAIL=0;g.forms.SKIP=-1;g.forms.tests={required:function(j,m,n){var l=m.message||m._localeModule.TEST_MESSAGE_REQUIRED;for(var k=0,h=j.length;k<h;k++){if(/^\s*$/.test(j[k])){n(g.forms.FAIL,l);return;}}n(g.forms.PASS,l);},isNumber:function(j,m,n){var l=m.message||m._localeModule.TEST_MESSAGE_IS_NUMBER;for(var k=0,h=j.length;k<h;k++){if(j[k]==""||isNaN(j[k])){n(g.forms.FAIL,l);return;}}n(g.forms.PASS,l);},min:function(j,m,n){var l=m.message||f(m._localeModule.TEST_MESSAGE_MIN,{arg:m.arg});for(var k=0,h=j.length;k<h;k++){if(Number(j[k])<Number(m.arg)){n(g.forms.FAIL,l);return;}}n(g.forms.PASS,l);},max:function(j,m,n){var l=m.message||f(m._localeModule.TEST_MESSAGE_MAX,{arg:m.arg});for(var k=0,h=j.length;k<h;k++){if(Number(j[k])>Number(m.arg)){n(g.forms.FAIL,l);return;}}n(g.forms.PASS,l);},range:function(k,o,p){var n=o.arg.split("..");if(typeof n[0]=="undefined"||typeof n[1]=="undefined"){throw"Range test requires a parameter like 0..10.";}var m=o.message||f(o._localeModule.TEST_MESSAGE_RANGE,{min:n[0],max:n[1]});n[0]*=1;n[1]*=1;if(n[0]>n[1]){var j=n[0];n[0]=n[1];n[1]=j;}for(var l=0,h=k.length;l<h;l++){if(k[l]<n[0]||k[l]>n[1]){p(g.forms.FAIL,m);return;}}p(g.forms.PASS,m);},minCount:function(h,m,n){var l=m.message||f(m._localeModule.TEST_MESSAGE_MIN_COUNT,{arg:m.arg});var k=0;for(var j=0;j<h.length;j++){if(h[j]!=""){k++;}}if(k<m.arg){n(g.forms.FAIL,l);return;}n(g.forms.PASS,l);},maxCount:function(h,m,n){var l=m.message||f(m._localeModule.TEST_MESSAGE_MAX_COUNT,{arg:m.arg});var k=0;for(var j=0;j<h.length;j++){if(h[j]!=""){k++;}}if(k>m.arg){n(g.forms.FAIL,l);return;}n(g.forms.PASS,l);},count:function(h,m,n){var l=m.message||f(m._localeModule.TEST_MESSAGE_COUNT,{arg:m.arg});var k=0;for(var j=0;j<h.length;j++){if(h[j]!=""){k++;}}if(k!=m.arg){n(g.forms.FAIL,l);return;}n(g.forms.PASS,l);},regex:function(j,n,o){var m=n.message||n._localeModule.TEST_MESSAGE_REGEX;var l=(typeof n.arg=="string")?new RegExp(n.arg):n.arg;for(var k=0,h=j.length;k<h;k++){if(!l.test(j[k])){o(g.forms.FAIL,m);return;}}o(g.forms.PASS,m);},minLen:function(j,m,n){var l=m.message||f(m._localeModule.TEST_MESSAGE_MIN_LEN,{arg:m.arg});for(var k=0,h=j.length;k<h;k++){if(j[k].length<m.arg){n(g.forms.FAIL,l);return;}}n(g.forms.PASS,l);},maxLen:function(j,m,n){var l=m.message||f(m._localeModule.TEST_MESSAGE_MAX_LEN,{arg:m.arg});for(var k=0,h=j.length;k<h;k++){if(j[k].length>m.arg){n(g.forms.FAIL,l);return;}}n(g.forms.PASS,l);},isEmail:function(j,m,n){var l=m.message||m._localeModule.TEST_MESSAGE_IS_EMAIL;for(var k=0,h=j.length;k<h;k++){if(!/^\s*[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\s*$/i.test(j[k])){n(g.forms.FAIL,l);return;}}n(g.forms.PASS,l);},sameAs:function(j,n,p,o){var m=n.message||f(n._localeModule.TEST_MESSAGE_SAME_AS,{arg:n.arg});var k=o[n.arg];for(var l=0,h=j.length;l<h;l++){if(j[l]!=k){p(g.forms.FAIL,m);return;}}p(g.forms.PASS,m);},ajax:function(o,h,q,n){var m={},r=(h.message||h._localeModule.TEST_MESSAGE_AJAX);for(var k in n){if(typeof n[k]=="string"){m[k]=escape(n[k]);}else{if(typeof n[k].push!="undefined"){m[k]=g.lang.map(n[k],function(p){return escape(p);}).join(",");}}}var j=g.lang.interpolate(h.url,m);var l=g.net.get(j,{onLoad:function(p){var s=h.arg(p);if(typeof s.push=="undefined"){s=[s,r];}q(s[0],s[1]);},onError:function(p){alert("Error getting file: "+j);}});},custom:function(h,j,k){j.arg.apply(this,arguments);},is:function(j,m,n){var l=m.message||f(m._localeModule.TEST_MESSAGE_IS,{arg:m.arg});for(var k=0,h=j.length;k<h;k++){if(j[k]!=m.arg){n(g.forms.FAIL,l);return;}}n(g.forms.PASS,l);},isNot:function(j,m,n){var l=m.message||f(m._localeModule.TEST_MESSAGE_IS_NOT,{arg:m.arg});for(var k=0,h=j.length;k<h;k++){if(j[k]==m.arg){n(g.forms.FAIL,l);return;}}n(g.forms.PASS,l);}};var a=g.forms.feedback={};a.defaultFeedback=(function(){var h;function l(){if(!h){h=g.dom.create('<input type="hidden" value="0" name="1.7.3" id="1.7.3" />').appendTo(document.body);}h[0].value++;}function k(o){var n=o.fields,r,q,s,p,m;for(p=0,m=n.length;p<m;p++){r=g.dom.get(o.form.formNode[0].elements[n[p].name]);q=g.dom.get("."+n[p].name.replace(/(\W)/g,"\\$1")+"-msgContainer");if(!q[0]&&r.length==1){q=o.form.formNode.get("label").filter(function(){return this.htmlFor==r[0].id;});}s=q.get("span.glow-errorMsg");if(n[p].result){s.remove();r.removeClass("glow-invalid");}else{if(q.length){if(!s[0]){q.append((s=g.dom.create('<span class="glow-errorMsg"></span>')));}s.text(n[p].message);r.addClass("glow-invalid");}}}}function j(p){var s=p.fields,v,n,o,r,m,q,t;p.form.formNode.get("div.glow-errorSummary").remove();n=g.dom.create('<div class="glow-errorSummary" tabindex="-1"><ul></ul></div>');o=n.get("ul");for(q=0,t=s.length;q<t;q++){v=g.dom.get(p.form.formNode[0].elements[s[q].name]);r=g.dom.get("."+s[q].name.replace(/(\W)/g,"\\$1")+"-prompt");if(!r[0]&&v.length==1){r=p.form.formNode.get("label").filter(function(){return this.htmlFor==v[0].id;});}if(r[0]){r.get("span.glow-errorMsg").remove();m=g.lang.trim(r.text());if(m.slice(-1)==":"){m=m.slice(0,-1);}}else{m=s[q].name.replace(/^\w/,function(w){return w.toUpperCase();});}if(!s[q].result){o.append(g.dom.create("<li></li>").text(m+": "+s[q].message));}}p.form.formNode.prepend(n.css("opacity","0"));g.anim.css(n,"0.5",{opacity:{from:0,to:1}},{tween:g.tweens.easeOut()}).start();try{n[0].focus();}catch(u){}l();}return function(m){if(m.eventName=="submit"){if(!m.errorCount){m.form.formNode.get("div.glow-errorSummary").remove();return;}j(m);}setTimeout(function(){k(m);},0);return false;};}());}});(window.gloader||glow).module({name:"glow.embed",library:["glow","1.7.3"],depends:[["glow","1.7.3","glow.dom","glow.data","glow.i18n"]],builder:function(n){var o=n.i18n;o.addLocaleModule("GLOW_EMBED","en",{FLASH_MESSAGE:"This content requires Flash Player version {min} (installed version: {installed})",NO_PLAYER_MESSAGE:"No Flash Flayer installed, or version is pre 6.0.0"});function b(s){var r="";for(var t in s){if(t.toLowerCase()=="flashvars"&&typeof s[t]=="object"){r+=' FlashVars="'+n.data.encodeUrl(s[t])+'"';}else{r+=" "+t+'="'+s[t]+'"';}}return r;}function q(s){var u="",t,v;for(t in s){if(t.toLowerCase()=="flashvars"&&typeof s[t]=="object"){v=n.data.encodeUrl(s[t]);}else{v=s[t];}u+='<param name="'+t+'" value="'+v+'" />\n';}return u;}function h(s,r){s=s||{};for(var t in r){if(typeof s[t]=="undefined"){s[t]=r[t];}else{if(typeof r[t]=="object"){s[t]=h(s[t],r[t]);}}}return s;}function c(){var r=(navigator.platform||navigator.userAgent);return r.match(/win/i)?"win":r.match(/mac/i)?"mac":"other";}function l(r){var t=/^WIN (\d+),(\d+),(\d+),\d+$/;var s=r.GetVariable("$version");if($match=t.exec(s)){return{major:parseInt($match[1]),minor:parseInt($match[2]),release:parseInt($match[3]),actual:s};}else{}}function k(){var s,u,v={major:0,minor:0,release:0},r=v;if(n.env.ie){try{u=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");r=l(u);}catch(w){try{u=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");try{u.AllowScriptAccess="always";r=l(u);}catch(w){r={major:6,minor:0,release:29};}}catch(w){}}}else{var t=/^Shockwave Flash\s*(\d+)\.(\d+)\s*\w(\d+)$/;if((u=navigator.plugins["Shockwave Flash"])&&(s=t.exec(u.description))){r={major:parseInt(s[1]),minor:parseInt(s[2]),release:parseInt(s[3]),actual:u.description};}}r.toString=function(){return this.major?[this.major,this.minor,this.release].join("."):o.getLocaleModule("GLOW_EMBED").NO_PLAYER_MESSAGE;};return r;}var m=k();function f(t){if(typeof t!="object"){var s=String(t).match(/^(\d+)(?:\.(\d+)(?:\.(\d+))?)?$/);if(!s){throw new Error('glow.embed._meetsVersionRequirements: invalid format for version string, require "n.n.n" or "n.n" or simply "n" where n is a numeric value');}t={major:parseInt(s[1],10),minor:parseInt(s[2]||0,10),release:parseInt(s[3]||0,10)};}var r=m,u=t;return(r.major>u.major||(r.major==u.major&&r.minor>u.minor)||(r.major==u.major&&r.minor==u.minor&&r.release>=u.release));}var e=n.env.ie?j:g;function g(t,r,s){return'<embed type="application/x-shockwave-flash" src="'+t+'"'+b(r)+b(s)+"></embed>";}function j(t,r,s){return'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+b(r)+'><param name="movie" value="'+t+'" />'+q(s)+"</object>";}var a={},p=0;function d(){return n.UID+"FlashEmbed"+(p++);}a.Flash=function(x,r,w,v){v=h(v,{width:"100%",height:"100%",params:{allowscriptaccess:"always",allowfullscreen:"true",quality:"high"},attributes:{},message:n.lang.interpolate(o.getLocaleModule("GLOW_EMBED").FLASH_MESSAGE,{min:w,installed:m}),id:(v&&v.attributes&&v.attributes.id)||d()});r=n.dom.get(r);if(!r.length){throw new Error("glow.embed.Flash unable to locate container");}this.container=r;this.movie=null;this._displayErrorMessage=typeof v.message=="function"?v.message:function(){return v.message;};this.isSupported;if(this.isSupported=f(w)){var s=v.attributes,u=["id","width","height"],t=u.length;while(t--){if(v[u[t]]){s[u[t]]=v[u[t]];}}if(v.className){s["class"]=v.className;}this._embed_tag=e(x,s,v.params);}};a.Flash.version=function(){return m;};a.Flash.prototype.embed=function(){var s=this.container[0];if(this.isSupported){s.innerHTML=this._embed_tag;this.movie=s.firstChild;}else{var r=this._displayErrorMessage();if(r){s.innerHTML=r;}}return this;};n.embed=a;}});(window.gloader||glow).module({name:"glow.dragdrop",library:["glow","1.7.3"],depends:[["glow","1.7.3","glow.tweens","glow.events","glow.dom","glow.anim"]],builder:function(j){var c=j.events,k=c.addListener,v=c.fire,g=c.removeListener,q=j.dom,h=q.get,m=q.create;var n={},w=1000,a=(document.compatMode=="CSS1Compat"&&j.env.ie>=5)?true:false,x=(document.compatMode!="CSS1Compat"&&j.env.ie>=5)?true:false,d=j.env.ie>=5,s=["top","right","bottom","left"];function b(r,z){var A=r.prototype[z];var y="cached_"+z;r.prototype[z]=function(){if(y in this){return this[y];}return this[y]=A.apply(this,arguments);};}function u(A,z){var r=s.length,y;while(r--){y="margin-"+s[r];A.css(y,z.css(y));}}function f(r,y){var A=r.prototype[y];var z="cached_"+y;r.prototype[y]=function(B){if(!this[z]){this[z]={};}if(B in this[z]){return this[z][B];}return this[z][B]=A.apply(this,arguments);};}function t(A,z){for(var y=0,r=z.length;y<r;y++){delete A["cached_"+z[y]];}}var o=function(r){this.el=r;};o.prototype={val:function(r){var y=parseInt(this.el.css(r));return y||0;},width:function(){return this.borderWidth()-this.val("border-left-width")-this.val("border-right-width");},height:function(){return this.borderHeight()-this.val("border-top-width")-this.val("border-bottom-width");},offsetParentPageTop:function(){var r=this.el[0],z,y;while(r=r.offsetParent){if(h(r).css("position")!="static"){break;}}return r?h(r).offset().top:0;},offsetTop:function(){return this.el.position().top;},offsetLeft:function(){return this.el.position().left;},borderWidth:function(){var r=this.el[0].offsetWidth;if(j.env.khtml){r-=this.val("margin-left")+this.val("margin-right")+this.val("border-left-width")+this.val("border-right-width");}return r;},borderHeight:function(){if(this._logicalBottom){return this._logicalBottom-this.offsetTop();}var r=this.el[0].offsetHeight;if(j.env.khtml){r-=this.val("margin-top")+this.val("margin-bottom")+this.val("border-top-width")+this.val("border-bottom-width");}return r;},outerWidth:function(){return this.borderWidth()+this.val("margin-left")+this.val("margin-right");},outerHeight:function(){return this.borderHeight()+this.val("margin-top")+this.val("margin-bottom");},innerLeftPos:function(){return this.offsetLeft()+this.val("margin-left")+this.val("border-left-width")+this.val("padding-left");},innerTopPos:function(){return this.offsetTop()+this.val("margin-top")+this.val("border-top-width")+this.val("padding-top");},surroundWidth:function(){return this.val("border-left-width")+this.val("padding-left")+this.val("padding-right")+this.val("border-right-width");},surroundHeight:function(){return this.val("border-top-width")+this.val("padding-top")+this.val("padding-bottom")+this.val("border-bottom-width");},verticalCenter:function(){return this.offsetTop()+(this.outerHeight()/2);},horizontalCenter:function(){return this.offsetTop()+(this.outerWidth()/2);}};for(var p in o.prototype){if(p=="val"){f(o,p);}else{b(o,p);}}j.lang.apply(o.prototype,{resetPosition:function(){t(this,["offsetTop","offsetLeft","borderTopPos","borderLeftPos","innerTopPos","innerLeftPos","verticalCenter","horizontalCenter"]);},setLogicalBottom:function(r){this._logicalBottom=r;},boundsFor:function(z){var y,r,A=this.el.css("position");if(A!="static"){y=r=0;}else{y=this.innerTopPos();r=this.innerLeftPos();}return[y,r+this.width()-z.outerWidth(),y+this.height()-z.outerHeight(),r];},outerBounds:function(){var z=this.el.offset(),y=z.left,r=z.top;return[r,y+this.borderWidth(),r+this.borderHeight(),y];},intersectSize:function(z,A){var y=this.outerBounds(),r=z.outerBounds();if(A){y[1]++;r[1]++;y[2]++;r[2]++;}return(y[2]<r[0]?0:r[2]<y[0]?0:y[0]<r[0]?(y[2]<r[2]?y[2]-r[0]:r[2]-r[0]):r[2]<y[2]?r[2]-y[0]:y[2]-y[0])*(y[1]<r[3]?0:r[1]<y[3]?0:y[3]<r[3]?(y[1]<r[1]?y[1]-r[3]:r[1]-r[3]):r[1]<y[1]?r[1]-y[3]:y[1]-y[3]);},sizePlaceholder:function(C,D,A,y){var B=new o(C),z=this.el,r=D||z.css("position");C.css("display","none");z.after(C);C.css("width",(z[0].offsetWidth-B.surroundWidth())+"px").css("height",(z[0].offsetHeight-B.surroundHeight())+"px");u(C,z);C.remove();C.css("display","block");if(r!="static"){C.css("left",A+"px");C.css("top",y+"px");}C.css("position",r);},contains:function(z){var y=this.boundsFor(z),r=z.el.position(),B=r.top,A=r.left;return B>=y[0]&&A<=y[1]&&B<=y[2]&&A>=y[3];},containsPoint:function(y){var r=this.el.offset();return y.x>=r.left&&y.y>=r.top&&y.x<=r.left+this.borderWidth()&&y.y<=r.top+this.borderHeight();},positionedAncestorBox:function(){var r=this.el.parent(),y;while(r[0]){y=r.css("position")||"static";if(y=="relative"||y=="absolute"||y=="fixed"){return new o(r);}r=r.parent();}return null;}});function e(y){var r=y[0].tagName.toLowerCase()=="li"?"li":"div";var z=m("<"+r+"></"+r+">");if(r=="li"){z.css("list-style-type","none");}return z;}n.Draggable=function(A,B){this.element=h(A);this._opts=B=j.lang.apply({dragPrevention:["input","textarea","button","select","option","a"],placeholder:"spacer",placeholderClass:"glow-dragdrop-placeholder",step:{x:1,y:1}},B||{});if(typeof B.step=="number"){B.step={x:B.step,y:B.step};}else{B.step.x=B.step.x||1;B.step.y=B.step.y||1;}this._preventDrag=[];for(var y=0,r=B.dragPrevention.length;y<r;y++){this._preventDrag[y]=B.dragPrevention[y].toLowerCase();}if(B.container){this.container=h(B.container);}this._handle=B.handle&&this.element.get(B.handle)||this.element;if(B.dropTargets){this.dropTargets=h(B.dropTargets);}var z=this._listeners=[],y=0;if(B.onDrag){z[y++]=k(this,"drag",this._opts.onDrag,this);}if(B.onEnter){z[y++]=k(this,"enter",this._opts.onEnter,this);}if(B.onLeave){z[y++]=k(this,"leave",this._opts.onLeave,this);}if(B.onDrop){z[y++]=k(this,"drop",this._opts.onDrop,this);}if(B.onAfterDrop){z[y++]=k(this,"afterDrop",this._opts.onAfterDrop,this);}this._dragListener=k(this._handle,"mousedown",this._startDragMouse,this);return;};n.Draggable.prototype={_createPlaceholder:function(){var r=this.element,z,y=this._box;if(this._opts.placeholder=="clone"){z=r.clone();}else{z=e(r);}if(this._opts.placeholderClass){z.addClass(this._opts.placeholderClass);}y.sizePlaceholder(z,null,this._startLeft,this._startTop);r.after(z);this._placeholder=z;},_removePlaceholder:function(){this._placeholder.remove();},_resetPosition:function(){var G=this._preDragPosition,r=this.element,z=this._box,B=this._startOffset,D=r.css("position"),F,C;z.resetPosition();var A=z.el.position(),y={x:A.left,y:A.top};if(this._placeholder||this._dropIndicator){r.remove();}if(G=="static"&&y.y==B.y&&y.x==B.x){r.css("position","static");r.css("left","");r.css("top","");}else{r.css("z-index",this._preDragZIndex);r.css("position",G=="static"?"relative":G);if(G=="static"){F=y.x-B.x;C=y.y-B.y;}else{if(G=="relative"&&D!="relative"){F=this._startLeft+(y.x-B.x);C=this._startTop+(y.y-B.y);}}if(D!=G){r.css("left",F?F+"px":"");r.css("top",C?C+"px":"");}}if(this._dropIndicator){var E=this._dropIndicator.parent()[0];if(E){E.replaceChild(r[0],this._dropIndicator[0]);}delete this._dropIndicator;if(this._placeholder){this._placeholder.remove();delete this._placeholder;}r.css("position",G);if(G=="relative"&&D!="relative"){r.css("left",this._startLeft);r.css("top",this._startTop);}}else{if(this._placeholder){var E=this._placeholder.parent()[0];if(E){E.replaceChild(r[0],this._placeholder[0]);}delete this._placeholder;}}},_startDragMouse:function(I){var D=this._preventDrag,y=I.source,M=y.tagName.toLowerCase();for(var F=0,E=D.length;F<E;F++){if(D[F]==M){return;}}if(v(this,"drag").defaultPrevented()){return;}if(this._dragging==1){return this.endDrag();}else{if(this._dragging){return;}}this._dragging=1;var B=this.element,A=this.container,r=this._opts,H=this._box=new o(B),C=r.step;this._preDragPosition=B.css("position");var G=H.el.position(),J=this._startOffset={x:G.left,y:G.top};if(A){this._containerBox=new o(A);this._bounds=this._containerBox.boundsFor(H);if(C.x!=1){this._bounds[3]-=(this._bounds[3]-J.x)%C.x;this._bounds[1]-=(this._bounds[1]-J.x)%C.x;}if(C.y!=1){this._bounds[0]-=(this._bounds[0]-J.y)%C.y;this._bounds[2]-=(this._bounds[2]-J.y)%C.y;}}else{delete this._bounds;}this._mouseStart={x:I.pageX,y:I.pageY};this._preDragStyle=B.attr("style");this._preDragZIndex=B.css("z-index");B.css("z-index",w++);this._startLeft=B[0].style.left?parseInt(B[0].style.left):0;this._startTop=B[0].style.top?parseInt(B[0].style.top):0;if(r.placeholder&&r.placeholder!="none"){this._createPlaceholder();}B.css("position","absolute");B.css("left",J.x+"px");B.css("top",J.y+"px");if(a){this._scrollY=document.documentElement.scrollTop;this._innerHeight=document.documentElement.clientHeight;}else{if(x){this._scrollY=document.body.scrollTop;this._innerHeight=document.body.clientHeight;}else{this._scrollY=window.scrollY;this._innerHeight=window.innerHeight;}}var K=function(){return false;},L=document.documentElement;if(this.dropTargets){var z=new c.Event();z.draggable=this;for(var F=0,E=this.dropTargets.length;F<E;F++){v(this.dropTargets[F],"active",z);}this._mousePos={x:I.pageX,y:I.pageY};this._testForDropTargets();}this._dragListeners=[k(L,"selectstart",K),k(L,"dragstart",K),k(L,"mousedown",K),k(L,"mousemove",this._dragMouse,this),k(L,"mouseup",this._releaseElement,this)];return false;},_dragMouse:function(C){var r=this.element,y=this._opts.axis,D=y=="y"?this._startOffset.x:(this._startOffset.x+C.pageX-this._mouseStart.x),B=y=="x"?this._startOffset.y:(this._startOffset.y+C.pageY-this._mouseStart.y),A=this._bounds,z=this._opts.step;if(z.x!=1){D=Math.round((D-this._startOffset.x)/z.x)*z.x+this._startOffset.x;}if(z.y!=1){B=Math.round((B-this._startOffset.y)/z.y)*z.y+this._startOffset.y;}if(A){if(y!="y"){D=D<A[3]?A[3]:D>A[1]?A[1]:D;}if(y!="x"){B=B<A[0]?A[0]:B>A[2]?A[2]:B;}}r[0].style.left=D+"px";r[0].style.top=B+"px";if(this.dropTargets){this._mousePos={x:C.pageX,y:C.pageY};}if(d&&C.nativeEvent.button==0){this._releaseElement(C);return false;}return false;},_testForDropTargets:function(H){if(!this._lock){this._lock=0;}if(H){this._lock--;}else{if(this.lock){return;}}if(this._dragging!=1){return;}var z=this.activeTarget,y,R=this.dropTargets,S,C,F=this._box,K=this._mousePos;F.resetPosition();var D=0;for(var L=0,J=R.length;L<J;L++){S=R[L];C=S._box;if(S._opts.tolerance=="contained"){if(C.contains(F)){y=S;break;}}else{if(S._opts.tolerance=="cursor"){if(C.containsPoint(K)){y=S;break;}}else{var M=C.intersectSize(F,true);if(M>D){D=M;y=S;}}}}this.activeTarget=y;if(y!==z){if(y){var I=new c.Event();I.draggable=this;v(y,"enter",I);var r=new c.Event();r.dropTarget=y;v(this,"enter",r);}if(z){var E=new c.Event();E.draggable=this;v(z,"leave",E);var G=new c.Event();G.dropTarget=z;v(this,"leave",G);}}if(y&&y._opts.dropIndicator!="none"){var P,N=y._childBoxes,A=y._children;F.resetPosition();var Q=y._box.innerTopPos();var T=K.y-F.offsetParentPageTop();var O=0;for(var L=0,J=N.length;L<J;L++){if(A[L]==this.element[0]){continue;}P=N[L];Q+=P.outerHeight();if(T<=Q){if(y._dropIndicatorAt!=L){h(P.el).before(y._dropIndicator);y._dropIndicatorAt=L;}O=1;break;}}if(!O){if(P){h(P.el).after(y._dropIndicator);y._dropIndicatorAt=L+1;}else{y.element.append(y._dropIndicator);y._dropIndicatorAt=0;}}}this._lock++;var B=this;setTimeout(function(){B._testForDropTargets(1);},100);},_releaseElement:function(){if(this._dragging!=1){return;}this._dragging=2;var z,r;var D=this.dropTargets,C=this.activeTarget;if(D){for(z=0,r=D.length;z<r;z++){var B=new c.Event();B.draggable=this;B.droppedOnThis=C&&C==D[z];v(D[z],"inactive",B);}}if(C){var B=new c.Event();B.draggable=this;v(C,"drop",B);}var y=this._dragListeners;for(z=0,r=y.length;z<r;z++){c.removeListener(y[z]);}var A=v(this,"drop");if(!A.defaultPrevented()&&this.dropTargets){this.returnHome();}else{this.endDrag();}},endDrag:function(){if(this._dragging!=2){return;}this._dragging=0;if(this._reset){this._reset();delete this._reset;}if(this.placeholder){this.placeholder.remove();}this._resetPosition();delete this.activeTarget;v(this,"afterDrop");},returnHome:function(G){var z=(G)?G:j.tweens.linear(),C,r,A=this.element,E=this._box.el.position(),y=Math.pow(Math.pow(this._startOffset.x-E.left,2)+Math.pow(this._startOffset.y-E.top,2),0.5),B=0.3+(y/1000);var D=[[j.anim.css(A,B,{left:this._startOffset.x,top:this._startOffset.y},{tween:z})]];if(this._dropIndicator){D.push([j.anim.css(this._dropIndicator,B-0.1,{opacity:{to:0}})]);}var F=new j.anim.Timeline(D);k(F,"complete",function(){this.endDrag();},this);F.start();return;}};var l=0;n.DropTarget=function(r,y){r=this.element=h(r);if(!r.length){throw"no element passed into DropTarget constuctor";}if(r.length>1){throw"more than one element passed into DropTarget constructor";}this._id=++l;this._opts=y=j.lang.apply({dropIndicator:"none",dropIndicatorClass:"glow-dragdrop-dropindicator",tolerance:"intersect"},y||{});if(y.onActive){k(this,"active",y.onActive);}if(y.onInactive){k(this,"inactive",y.onInactive);}if(y.onEnter){k(this,"enter",y.onEnter);}if(y.onLeave){k(this,"leave",y.onLeave);}if(y.onDrop){k(this,"drop",y.onDrop);}k(this,"active",this._onActive);k(this,"inactive",this._onInactive);return this;};n.DropTarget.prototype={setLogicalBottom:function(r){this._logicalBottom=r;},_onActive:function(A){var y=A.draggable;this._box=new o(this.element);if(this._logicalBottom){this._box.setLogicalBottom(this._logicalBottom);}if(this._opts.dropIndicator=="none"){return;}this._onEnterListener=k(this,"enter",this._onEnter);this._onLeaveListener=k(this,"leave",this._onLeave);this._dropIndicator=e(y.element);if(this._opts.dropIndicatorClass){this._dropIndicator.addClass(this._opts.dropIndicatorClass);}y._box.sizePlaceholder(this._dropIndicator,"relative",0,0);var z=this._children=h(this.element.children()).filter(function(){var B=h(this);return(!A.draggable._placeholder||!B.eq(A.draggable._placeholder))&&(!this._dropIndicator||!B.eq(this._dropIndicator));});var r=this._childBoxes=[];z.each(function(B){r[B]=new o(h(z[B]));});},_onInactive:function(r){g(this._onEnterListener);g(this._onLeaveListener);delete this._box;if(this._opts.dropIndicator=="none"){return;}if(!r.droppedOnThis&&this._dropIndicator){this._dropIndicator.remove();delete this._dropIndicator;}delete this._childBoxes;delete this._children;},_onEnter:function(){this._dropIndicatorAt=-1;},_onLeave:function(){this._dropIndicator.remove();},moveToPosition:function(y){var C=this._dropIndicator,z=new o(C);var B=parseInt(C.css("margin-left"))||0,A=parseInt(C.css("margin-top"))||0,r=z.el.position();y._startOffset={x:r.left,y:r.top};y._dropIndicator=C;delete this._dropIndicator;}};j.dragdrop=n;}});
+/*@end @*/
diff --git a/minsrc/baselibs/prototype.js b/minsrc/baselibs/prototype.js
new file mode 100644 (file)
index 0000000..474b223
--- /dev/null
@@ -0,0 +1,6082 @@
+/*  Prototype JavaScript framework, version 1.7
+ *  (c) 2005-2010 Sam Stephenson
+ *
+ *  Prototype is freely distributable under the terms of an MIT-style license.
+ *  For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+ *--------------------------------------------------------------------------*/
+
+var Prototype = {
+
+  Version: '1.7',
+
+  Browser: (function(){
+    var ua = navigator.userAgent;
+    var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
+    return {
+      IE:             !!window.attachEvent && !isOpera,
+      Opera:          isOpera,
+      WebKit:         ua.indexOf('AppleWebKit/') > -1,
+      Gecko:          ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
+      MobileSafari:   /Apple.*Mobile/.test(ua)
+    }
+  })(),
+
+  BrowserFeatures: {
+    XPath: !!document.evaluate,
+
+    SelectorsAPI: !!document.querySelector,
+
+    ElementExtensions: (function() {
+      var constructor = window.Element || window.HTMLElement;
+      return !!(constructor && constructor.prototype);
+    })(),
+    SpecificElementExtensions: (function() {
+      if (typeof window.HTMLDivElement !== 'undefined')
+        return true;
+
+      var div = document.createElement('div'),
+          form = document.createElement('form'),
+          isSupported = false;
+
+      if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) {
+        isSupported = true;
+      }
+
+      div = form = null;
+
+      return isSupported;
+    })()
+  },
+
+  ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
+  JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
+
+  emptyFunction: function() { },
+
+  K: function(x) { return x }
+};
+
+if (Prototype.Browser.MobileSafari)
+  Prototype.BrowserFeatures.SpecificElementExtensions = false;
+
+
+var Abstract = { };
+
+
+var Try = {
+  these: function() {
+    var returnValue;
+
+    for (var i = 0, length = arguments.length; i < length; i++) {
+      var lambda = arguments[i];
+      try {
+        returnValue = lambda();
+        break;
+      } catch (e) { }
+    }
+
+    return returnValue;
+  }
+};
+
+/* Based on Alex Arnell's inheritance implementation. */
+
+var Class = (function() {
+
+  var IS_DONTENUM_BUGGY = (function(){
+    for (var p in { toString: 1 }) {
+      if (p === 'toString') return false;
+    }
+    return true;
+  })();
+
+  function subclass() {};
+  function create() {
+    var parent = null, properties = $A(arguments);
+    if (Object.isFunction(properties[0]))
+      parent = properties.shift();
+
+    function klass() {
+      this.initialize.apply(this, arguments);
+    }
+
+    Object.extend(klass, Class.Methods);
+    klass.superclass = parent;
+    klass.subclasses = [];
+
+    if (parent) {
+      subclass.prototype = parent.prototype;
+      klass.prototype = new subclass;
+      parent.subclasses.push(klass);
+    }
+
+    for (var i = 0, length = properties.length; i < length; i++)
+      klass.addMethods(properties[i]);
+
+    if (!klass.prototype.initialize)
+      klass.prototype.initialize = Prototype.emptyFunction;
+
+    klass.prototype.constructor = klass;
+    return klass;
+  }
+
+  function addMethods(source) {
+    var ancestor   = this.superclass && this.superclass.prototype,
+        properties = Object.keys(source);
+
+    if (IS_DONTENUM_BUGGY) {
+      if (source.toString != Object.prototype.toString)
+        properties.push("toString");
+      if (source.valueOf != Object.prototype.valueOf)
+        properties.push("valueOf");
+    }
+
+    for (var i = 0, length = properties.length; i < length; i++) {
+      var property = properties[i], value = source[property];
+      if (ancestor && Object.isFunction(value) &&
+          value.argumentNames()[0] == "$super") {
+        var method = value;
+        value = (function(m) {
+          return function() { return ancestor[m].apply(this, arguments); };
+        })(property).wrap(method);
+
+        value.valueOf = method.valueOf.bind(method);
+        value.toString = method.toString.bind(method);
+      }
+      this.prototype[property] = value;
+    }
+
+    return this;
+  }
+
+  return {
+    create: create,
+    Methods: {
+      addMethods: addMethods
+    }
+  };
+})();
+(function() {
+
+  var _toString = Object.prototype.toString,
+      NULL_TYPE = 'Null',
+      UNDEFINED_TYPE = 'Undefined',
+      BOOLEAN_TYPE = 'Boolean',
+      NUMBER_TYPE = 'Number',
+      STRING_TYPE = 'String',
+      OBJECT_TYPE = 'Object',
+      FUNCTION_CLASS = '[object Function]',
+      BOOLEAN_CLASS = '[object Boolean]',
+      NUMBER_CLASS = '[object Number]',
+      STRING_CLASS = '[object String]',
+      ARRAY_CLASS = '[object Array]',
+      DATE_CLASS = '[object Date]',
+      NATIVE_JSON_STRINGIFY_SUPPORT = window.JSON &&
+        typeof JSON.stringify === 'function' &&
+        JSON.stringify(0) === '0' &&
+        typeof JSON.stringify(Prototype.K) === 'undefined';
+
+  function Type(o) {
+    switch(o) {
+      case null: return NULL_TYPE;
+      case (void 0): return UNDEFINED_TYPE;
+    }
+    var type = typeof o;
+    switch(type) {
+      case 'boolean': return BOOLEAN_TYPE;
+      case 'number':  return NUMBER_TYPE;
+      case 'string':  return STRING_TYPE;
+    }
+    return OBJECT_TYPE;
+  }
+
+  function extend(destination, source) {
+    for (var property in source)
+      destination[property] = source[property];
+    return destination;
+  }
+
+  function inspect(object) {
+    try {
+      if (isUndefined(object)) return 'undefined';
+      if (object === null) return 'null';
+      return object.inspect ? object.inspect() : String(object);
+    } catch (e) {
+      if (e instanceof RangeError) return '...';
+      throw e;
+    }
+  }
+
+  function toJSON(value) {
+    return Str('', { '': value }, []);
+  }
+
+  function Str(key, holder, stack) {
+    var value = holder[key],
+        type = typeof value;
+
+    if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') {
+      value = value.toJSON(key);
+    }
+
+    var _class = _toString.call(value);
+
+    switch (_class) {
+      case NUMBER_CLASS:
+      case BOOLEAN_CLASS:
+      case STRING_CLASS:
+        value = value.valueOf();
+    }
+
+    switch (value) {
+      case null: return 'null';
+      case true: return 'true';
+      case false: return 'false';
+    }
+
+    type = typeof value;
+    switch (type) {
+      case 'string':
+        return value.inspect(true);
+      case 'number':
+        return isFinite(value) ? String(value) : 'null';
+      case 'object':
+
+        for (var i = 0, length = stack.length; i < length; i++) {
+          if (stack[i] === value) { throw new TypeError(); }
+        }
+        stack.push(value);
+
+        var partial = [];
+        if (_class === ARRAY_CLASS) {
+          for (var i = 0, length = value.length; i < length; i++) {
+            var str = Str(i, value, stack);
+            partial.push(typeof str === 'undefined' ? 'null' : str);
+          }
+          partial = '[' + partial.join(',') + ']';
+        } else {
+          var keys = Object.keys(value);
+          for (var i = 0, length = keys.length; i < length; i++) {
+            var key = keys[i], str = Str(key, value, stack);
+            if (typeof str !== "undefined") {
+               partial.push(key.inspect(true)+ ':' + str);
+             }
+          }
+          partial = '{' + partial.join(',') + '}';
+        }
+        stack.pop();
+        return partial;
+    }
+  }
+
+  function stringify(object) {
+    return JSON.stringify(object);
+  }
+
+  function toQueryString(object) {
+    return $H(object).toQueryString();
+  }
+
+  function toHTML(object) {
+    return object && object.toHTML ? object.toHTML() : String.interpret(object);
+  }
+
+  function keys(object) {
+    if (Type(object) !== OBJECT_TYPE) { throw new TypeError(); }
+    var results = [];
+    for (var property in object) {
+      if (object.hasOwnProperty(property)) {
+        results.push(property);
+      }
+    }
+    return results;
+  }
+
+  function values(object) {
+    var results = [];
+    for (var property in object)
+      results.push(object[property]);
+    return results;
+  }
+
+  function clone(object) {
+    return extend({ }, object);
+  }
+
+  function isElement(object) {
+    return !!(object && object.nodeType == 1);
+  }
+
+  function isArray(object) {
+    return _toString.call(object) === ARRAY_CLASS;
+  }
+
+  var hasNativeIsArray = (typeof Array.isArray == 'function')
+    && Array.isArray([]) && !Array.isArray({});
+
+  if (hasNativeIsArray) {
+    isArray = Array.isArray;
+  }
+
+  function isHash(object) {
+    return object instanceof Hash;
+  }
+
+  function isFunction(object) {
+    return _toString.call(object) === FUNCTION_CLASS;
+  }
+
+  function isString(object) {
+    return _toString.call(object) === STRING_CLASS;
+  }
+
+  function isNumber(object) {
+    return _toString.call(object) === NUMBER_CLASS;
+  }
+
+  function isDate(object) {
+    return _toString.call(object) === DATE_CLASS;
+  }
+
+  function isUndefined(object) {
+    return typeof object === "undefined";
+  }
+
+  extend(Object, {
+    extend:        extend,
+    inspect:       inspect,
+    toJSON:        NATIVE_JSON_STRINGIFY_SUPPORT ? stringify : toJSON,
+    toQueryString: toQueryString,
+    toHTML:        toHTML,
+    keys:          Object.keys || keys,
+    values:        values,
+    clone:         clone,
+    isElement:     isElement,
+    isArray:       isArray,
+    isHash:        isHash,
+    isFunction:    isFunction,
+    isString:      isString,
+    isNumber:      isNumber,
+    isDate:        isDate,
+    isUndefined:   isUndefined
+  });
+})();
+Object.extend(Function.prototype, (function() {
+  var slice = Array.prototype.slice;
+
+  function update(array, args) {
+    var arrayLength = array.length, length = args.length;
+    while (length--) array[arrayLength + length] = args[length];
+    return array;
+  }
+
+  function merge(array, args) {
+    array = slice.call(array, 0);
+    return update(array, args);
+  }
+
+  function argumentNames() {
+    var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1]
+      .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '')
+      .replace(/\s+/g, '').split(',');
+    return names.length == 1 && !names[0] ? [] : names;
+  }
+
+  function bind(context) {
+    if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
+    var __method = this, args = slice.call(arguments, 1);
+    return function() {
+      var a = merge(args, arguments);
+      return __method.apply(context, a);
+    }
+  }
+
+  function bindAsEventListener(context) {
+    var __method = this, args = slice.call(arguments, 1);
+    return function(event) {
+      var a = update([event || window.event], args);
+      return __method.apply(context, a);
+    }
+  }
+
+  function curry() {
+    if (!arguments.length) return this;
+    var __method = this, args = slice.call(arguments, 0);
+    return function() {
+      var a = merge(args, arguments);
+      return __method.apply(this, a);
+    }
+  }
+
+  function delay(timeout) {
+    var __method = this, args = slice.call(arguments, 1);
+    timeout = timeout * 1000;
+    return window.setTimeout(function() {
+      return __method.apply(__method, args);
+    }, timeout);
+  }
+
+  function defer() {
+    var args = update([0.01], arguments);
+    return this.delay.apply(this, args);
+  }
+
+  function wrap(wrapper) {
+    var __method = this;
+    return function() {
+      var a = update([__method.bind(this)], arguments);
+      return wrapper.apply(this, a);
+    }
+  }
+
+  function methodize() {
+    if (this._methodized) return this._methodized;
+    var __method = this;
+    return this._methodized = function() {
+      var a = update([this], arguments);
+      return __method.apply(null, a);
+    };
+  }
+
+  return {
+    argumentNames:       argumentNames,
+    bind:                bind,
+    bindAsEventListener: bindAsEventListener,
+    curry:               curry,
+    delay:               delay,
+    defer:               defer,
+    wrap:                wrap,
+    methodize:           methodize
+  }
+})());
+
+
+
+(function(proto) {
+
+
+  function toISOString() {
+    return this.getUTCFullYear() + '-' +
+      (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
+      this.getUTCDate().toPaddedString(2) + 'T' +
+      this.getUTCHours().toPaddedString(2) + ':' +
+      this.getUTCMinutes().toPaddedString(2) + ':' +
+      this.getUTCSeconds().toPaddedString(2) + 'Z';
+  }
+
+
+  function toJSON() {
+    return this.toISOString();
+  }
+
+  if (!proto.toISOString) proto.toISOString = toISOString;
+  if (!proto.toJSON) proto.toJSON = toJSON;
+
+})(Date.prototype);
+
+
+RegExp.prototype.match = RegExp.prototype.test;
+
+RegExp.escape = function(str) {
+  return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
+};
+var PeriodicalExecuter = Class.create({
+  initialize: function(callback, frequency) {
+    this.callback = callback;
+    this.frequency = frequency;
+    this.currentlyExecuting = false;
+
+    this.registerCallback();
+  },
+
+  registerCallback: function() {
+    this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+  },
+
+  execute: function() {
+    this.callback(this);
+  },
+
+  stop: function() {
+    if (!this.timer) return;
+    clearInterval(this.timer);
+    this.timer = null;
+  },
+
+  onTimerEvent: function() {
+    if (!this.currentlyExecuting) {
+      try {
+        this.currentlyExecuting = true;
+        this.execute();
+        this.currentlyExecuting = false;
+      } catch(e) {
+        this.currentlyExecuting = false;
+        throw e;
+      }
+    }
+  }
+});
+Object.extend(String, {
+  interpret: function(value) {
+    return value == null ? '' : String(value);
+  },
+  specialChar: {
+    '\b': '\\b',
+    '\t': '\\t',
+    '\n': '\\n',
+    '\f': '\\f',
+    '\r': '\\r',
+    '\\': '\\\\'
+  }
+});
+
+Object.extend(String.prototype, (function() {
+  var NATIVE_JSON_PARSE_SUPPORT = window.JSON &&
+    typeof JSON.parse === 'function' &&
+    JSON.parse('{"test": true}').test;
+
+  function prepareReplacement(replacement) {
+    if (Object.isFunction(replacement)) return replacement;
+    var template = new Template(replacement);
+    return function(match) { return template.evaluate(match) };
+  }
+
+  function gsub(pattern, replacement) {
+    var result = '', source = this, match;
+    replacement = prepareReplacement(replacement);
+
+    if (Object.isString(pattern))
+      pattern = RegExp.escape(pattern);
+
+    if (!(pattern.length || pattern.source)) {
+      replacement = replacement('');
+      return replacement + source.split('').join(replacement) + replacement;
+    }
+
+    while (source.length > 0) {
+      if (match = source.match(pattern)) {
+        result += source.slice(0, match.index);
+        result += String.interpret(replacement(match));
+        source  = source.slice(match.index + match[0].length);
+      } else {
+        result += source, source = '';
+      }
+    }
+    return result;
+  }
+
+  function sub(pattern, replacement, count) {
+    replacement = prepareReplacement(replacement);
+    count = Object.isUndefined(count) ? 1 : count;
+
+    return this.gsub(pattern, function(match) {
+      if (--count < 0) return match[0];
+      return replacement(match);
+    });
+  }
+
+  function scan(pattern, iterator) {
+    this.gsub(pattern, iterator);
+    return String(this);
+  }
+
+  function truncate(length, truncation) {
+    length = length || 30;
+    truncation = Object.isUndefined(truncation) ? '...' : truncation;
+    return this.length > length ?
+      this.slice(0, length - truncation.length) + truncation : String(this);
+  }
+
+  function strip() {
+    return this.replace(/^\s+/, '').replace(/\s+$/, '');
+  }
+
+  function stripTags() {
+    return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, '');
+  }
+
+  function stripScripts() {
+    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
+  }
+
+  function extractScripts() {
+    var matchAll = new RegExp(Prototype.ScriptFragment, 'img'),
+        matchOne = new RegExp(Prototype.ScriptFragment, 'im');
+    return (this.match(matchAll) || []).map(function(scriptTag) {
+      return (scriptTag.match(matchOne) || ['', ''])[1];
+    });
+  }
+
+  function evalScripts() {
+    return this.extractScripts().map(function(script) { return eval(script) });
+  }
+
+  function escapeHTML() {
+    return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
+  }
+
+  function unescapeHTML() {
+    return this.stripTags().replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');
+  }
+
+
+  function toQueryParams(separator) {
+    var match = this.strip().match(/([^?#]*)(#.*)?$/);
+    if (!match) return { };
+
+    return match[1].split(separator || '&').inject({ }, function(hash, pair) {
+      if ((pair = pair.split('='))[0]) {
+        var key = decodeURIComponent(pair.shift()),
+            value = pair.length > 1 ? pair.join('=') : pair[0];
+
+        if (value != undefined) value = decodeURIComponent(value);
+
+        if (key in hash) {
+          if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
+          hash[key].push(value);
+        }
+        else hash[key] = value;
+      }
+      return hash;
+    });
+  }
+
+  function toArray() {
+    return this.split('');
+  }
+
+  function succ() {
+    return this.slice(0, this.length - 1) +
+      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
+  }
+
+  function times(count) {
+    return count < 1 ? '' : new Array(count + 1).join(this);
+  }
+
+  function camelize() {
+    return this.replace(/-+(.)?/g, function(match, chr) {
+      return chr ? chr.toUpperCase() : '';
+    });
+  }
+
+  function capitalize() {
+    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
+  }
+
+  function underscore() {
+    return this.replace(/::/g, '/')
+               .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
+               .replace(/([a-z\d])([A-Z])/g, '$1_$2')
+               .replace(/-/g, '_')
+               .toLowerCase();
+  }
+
+  function dasherize() {
+    return this.replace(/_/g, '-');
+  }
+
+  function inspect(useDoubleQuotes) {
+    var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) {
+      if (character in String.specialChar) {
+        return String.specialChar[character];
+      }
+      return '\\u00' + character.charCodeAt().toPaddedString(2, 16);
+    });
+    if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
+    return "'" + escapedString.replace(/'/g, '\\\'') + "'";
+  }
+
+  function unfilterJSON(filter) {
+    return this.replace(filter || Prototype.JSONFilter, '$1');
+  }
+
+  function isJSON() {
+    var str = this;
+    if (str.blank()) return false;
+    str = str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@');
+    str = str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']');
+    str = str.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
+    return (/^[\],:{}\s]*$/).test(str);
+  }
+
+  function evalJSON(sanitize) {
+    var json = this.unfilterJSON(),
+        cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
+    if (cx.test(json)) {
+      json = json.replace(cx, function (a) {
+        return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+      });
+    }
+    try {
+      if (!sanitize || json.isJSON()) return eval('(' + json + ')');
+    } catch (e) { }
+    throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
+  }
+
+  function parseJSON() {
+    var json = this.unfilterJSON();
+    return JSON.parse(json);
+  }
+
+  function include(pattern) {
+    return this.indexOf(pattern) > -1;
+  }
+
+  function startsWith(pattern) {
+    return this.lastIndexOf(pattern, 0) === 0;
+  }
+
+  function endsWith(pattern) {
+    var d = this.length - pattern.length;
+    return d >= 0 && this.indexOf(pattern, d) === d;
+  }
+
+  function empty() {
+    return this == '';
+  }
+
+  function blank() {
+    return /^\s*$/.test(this);
+  }
+
+  function interpolate(object, pattern) {
+    return new Template(this, pattern).evaluate(object);
+  }
+
+  return {
+    gsub:           gsub,
+    sub:            sub,
+    scan:           scan,
+    truncate:       truncate,
+    strip:          String.prototype.trim || strip,
+    stripTags:      stripTags,
+    stripScripts:   stripScripts,
+    extractScripts: extractScripts,
+    evalScripts:    evalScripts,
+    escapeHTML:     escapeHTML,
+    unescapeHTML:   unescapeHTML,
+    toQueryParams:  toQueryParams,
+    parseQuery:     toQueryParams,
+    toArray:        toArray,
+    succ:           succ,
+    times:          times,
+    camelize:       camelize,
+    capitalize:     capitalize,
+    underscore:     underscore,
+    dasherize:      dasherize,
+    inspect:        inspect,
+    unfilterJSON:   unfilterJSON,
+    isJSON:         isJSON,
+    evalJSON:       NATIVE_JSON_PARSE_SUPPORT ? parseJSON : evalJSON,
+    include:        include,
+    startsWith:     startsWith,
+    endsWith:       endsWith,
+    empty:          empty,
+    blank:          blank,
+    interpolate:    interpolate
+  };
+})());
+
+var Template = Class.create({
+  initialize: function(template, pattern) {
+    this.template = template.toString();
+    this.pattern = pattern || Template.Pattern;
+  },
+
+  evaluate: function(object) {
+    if (object && Object.isFunction(object.toTemplateReplacements))
+      object = object.toTemplateReplacements();
+
+    return this.template.gsub(this.pattern, function(match) {
+      if (object == null) return (match[1] + '');
+
+      var before = match[1] || '';
+      if (before == '\\') return match[2];
+
+      var ctx = object, expr = match[3],
+          pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
+
+      match = pattern.exec(expr);
+      if (match == null) return before;
+
+      while (match != null) {
+        var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1];
+        ctx = ctx[comp];
+        if (null == ctx || '' == match[3]) break;
+        expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
+        match = pattern.exec(expr);
+      }
+
+      return before + String.interpret(ctx);
+    });
+  }
+});
+Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
+
+var $break = { };
+
+var Enumerable = (function() {
+  function each(iterator, context) {
+    var index = 0;
+    try {
+      this._each(function(value) {
+        iterator.call(context, value, index++);
+      });
+    } catch (e) {
+      if (e != $break) throw e;
+    }
+    return this;
+  }
+
+  function eachSlice(number, iterator, context) {
+    var index = -number, slices = [], array = this.toArray();
+    if (number < 1) return array;
+    while ((index += number) < array.length)
+      slices.push(array.slice(index, index+number));
+    return slices.collect(iterator, context);
+  }
+
+  function all(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var result = true;
+    this.each(function(value, index) {
+      result = result && !!iterator.call(context, value, index);
+      if (!result) throw $break;
+    });
+    return result;
+  }
+
+  function any(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var result = false;
+    this.each(function(value, index) {
+      if (result = !!iterator.call(context, value, index))
+        throw $break;
+    });
+    return result;
+  }
+
+  function collect(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var results = [];
+    this.each(function(value, index) {
+      results.push(iterator.call(context, value, index));
+    });
+    return results;
+  }
+
+  function detect(iterator, context) {
+    var result;
+    this.each(function(value, index) {
+      if (iterator.call(context, value, index)) {
+        result = value;
+        throw $break;
+      }
+    });
+    return result;
+  }
+
+  function findAll(iterator, context) {
+    var results = [];
+    this.each(function(value, index) {
+      if (iterator.call(context, value, index))
+        results.push(value);
+    });
+    return results;
+  }
+
+  function grep(filter, iterator, context) {
+    iterator = iterator || Prototype.K;
+    var results = [];
+
+    if (Object.isString(filter))
+      filter = new RegExp(RegExp.escape(filter));
+
+    this.each(function(value, index) {
+      if (filter.match(value))
+        results.push(iterator.call(context, value, index));
+    });
+    return results;
+  }
+
+  function include(object) {
+    if (Object.isFunction(this.indexOf))
+      if (this.indexOf(object) != -1) return true;
+
+    var found = false;
+    this.each(function(value) {
+      if (value == object) {
+        found = true;
+        throw $break;
+      }
+    });
+    return found;
+  }
+
+  function inGroupsOf(number, fillWith) {
+    fillWith = Object.isUndefined(fillWith) ? null : fillWith;
+    return this.eachSlice(number, function(slice) {
+      while(slice.length < number) slice.push(fillWith);
+      return slice;
+    });
+  }
+
+  function inject(memo, iterator, context) {
+    this.each(function(value, index) {
+      memo = iterator.call(context, memo, value, index);
+    });
+    return memo;
+  }
+
+  function invoke(method) {
+    var args = $A(arguments).slice(1);
+    return this.map(function(value) {
+      return value[method].apply(value, args);
+    });
+  }
+
+  function max(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var result;
+    this.each(function(value, index) {
+      value = iterator.call(context, value, index);
+      if (result == null || value >= result)
+        result = value;
+    });
+    return result;
+  }
+
+  function min(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var result;
+    this.each(function(value, index) {
+      value = iterator.call(context, value, index);
+      if (result == null || value < result)
+        result = value;
+    });
+    return result;
+  }
+
+  function partition(iterator, context) {
+    iterator = iterator || Prototype.K;
+    var trues = [], falses = [];
+    this.each(function(value, index) {
+      (iterator.call(context, value, index) ?
+        trues : falses).push(value);
+    });
+    return [trues, falses];
+  }
+
+  function pluck(property) {
+    var results = [];
+    this.each(function(value) {
+      results.push(value[property]);
+    });
+    return results;
+  }
+
+  function reject(iterator, context) {
+    var results = [];
+    this.each(function(value, index) {
+      if (!iterator.call(context, value, index))
+        results.push(value);
+    });
+    return results;
+  }
+
+  function sortBy(iterator, context) {
+    return this.map(function(value, index) {
+      return {
+        value: value,
+        criteria: iterator.call(context, value, index)
+      };
+    }).sort(function(left, right) {
+      var a = left.criteria, b = right.criteria;
+      return a < b ? -1 : a > b ? 1 : 0;
+    }).pluck('value');
+  }
+
+  function toArray() {
+    return this.map();
+  }
+
+  function zip() {
+    var iterator = Prototype.K, args = $A(arguments);
+    if (Object.isFunction(args.last()))
+      iterator = args.pop();
+
+    var collections = [this].concat(args).map($A);
+    return this.map(function(value, index) {
+      return iterator(collections.pluck(index));
+    });
+  }
+
+  function size() {
+    return this.toArray().length;
+  }
+
+  function inspect() {
+    return '#<Enumerable:' + this.toArray().inspect() + '>';
+  }
+
+
+
+
+
+
+
+
+
+  return {
+    each:       each,
+    eachSlice:  eachSlice,
+    all:        all,
+    every:      all,
+    any:        any,
+    some:       any,
+    collect:    collect,
+    map:        collect,
+    detect:     detect,
+    findAll:    findAll,
+    select:     findAll,
+    filter:     findAll,
+    grep:       grep,
+    include:    include,
+    member:     include,
+    inGroupsOf: inGroupsOf,
+    inject:     inject,
+    invoke:     invoke,
+    max:        max,
+    min:        min,
+    partition:  partition,
+    pluck:      pluck,
+    reject:     reject,
+    sortBy:     sortBy,
+    toArray:    toArray,
+    entries:    toArray,
+    zip:        zip,
+    size:       size,
+    inspect:    inspect,
+    find:       detect
+  };
+})();
+
+function $A(iterable) {
+  if (!iterable) return [];
+  if ('toArray' in Object(iterable)) return iterable.toArray();
+  var length = iterable.length || 0, results = new Array(length);
+  while (length--) results[length] = iterable[length];
+  return results;
+}
+
+
+function $w(string) {
+  if (!Object.isString(string)) return [];
+  string = string.strip();
+  return string ? string.split(/\s+/) : [];
+}
+
+Array.from = $A;
+
+
+(function() {
+  var arrayProto = Array.prototype,
+      slice = arrayProto.slice,
+      _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available
+
+  function each(iterator, context) {
+    for (var i = 0, length = this.length >>> 0; i < length; i++) {
+      if (i in this) iterator.call(context, this[i], i, this);
+    }
+  }
+  if (!_each) _each = each;
+
+  function clear() {
+    this.length = 0;
+    return this;
+  }
+
+  function first() {
+    return this[0];
+  }
+
+  function last() {
+    return this[this.length - 1];
+  }
+
+  function compact() {
+    return this.select(function(value) {
+      return value != null;
+    });
+  }
+
+  function flatten() {
+    return this.inject([], function(array, value) {
+      if (Object.isArray(value))
+        return array.concat(value.flatten());
+      array.push(value);
+      return array;
+    });
+  }
+
+  function without() {
+    var values = slice.call(arguments, 0);
+    return this.select(function(value) {
+      return !values.include(value);
+    });
+  }
+
+  function reverse(inline) {
+    return (inline === false ? this.toArray() : this)._reverse();
+  }
+
+  function uniq(sorted) {
+    return this.inject([], function(array, value, index) {
+      if (0 == index || (sorted ? array.last() != value : !array.include(value)))
+        array.push(value);
+      return array;
+    });
+  }
+
+  function intersect(array) {
+    return this.uniq().findAll(function(item) {
+      return array.detect(function(value) { return item === value });
+    });
+  }
+
+
+  function clone() {
+    return slice.call(this, 0);
+  }
+
+  function size() {
+    return this.length;
+  }
+
+  function inspect() {
+    return '[' + this.map(Object.inspect).join(', ') + ']';
+  }
+
+  function indexOf(item, i) {
+    i || (i = 0);
+    var length = this.length;
+    if (i < 0) i = length + i;
+    for (; i < length; i++)
+      if (this[i] === item) return i;
+    return -1;
+  }
+
+  function lastIndexOf(item, i) {
+    i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
+    var n = this.slice(0, i).reverse().indexOf(item);
+    return (n < 0) ? n : i - n - 1;
+  }
+
+  function concat() {
+    var array = slice.call(this, 0), item;
+    for (var i = 0, length = arguments.length; i < length; i++) {
+      item = arguments[i];
+      if (Object.isArray(item) && !('callee' in item)) {
+        for (var j = 0, arrayLength = item.length; j < arrayLength; j++)
+          array.push(item[j]);
+      } else {
+        array.push(item);
+      }
+    }
+    return array;
+  }
+
+  Object.extend(arrayProto, Enumerable);
+
+  if (!arrayProto._reverse)
+    arrayProto._reverse = arrayProto.reverse;
+
+  Object.extend(arrayProto, {
+    _each:     _each,
+    clear:     clear,
+    first:     first,
+    last:      last,
+    compact:   compact,
+    flatten:   flatten,
+    without:   without,
+    reverse:   reverse,
+    uniq:      uniq,
+    intersect: intersect,
+    clone:     clone,
+    toArray:   clone,
+    size:      size,
+    inspect:   inspect
+  });
+
+  var CONCAT_ARGUMENTS_BUGGY = (function() {
+    return [].concat(arguments)[0][0] !== 1;
+  })(1,2)
+
+  if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat;
+
+  if (!arrayProto.indexOf) arrayProto.indexOf = indexOf;
+  if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf;
+})();
+function $H(object) {
+  return new Hash(object);
+};
+
+var Hash = Class.create(Enumerable, (function() {
+  function initialize(object) {
+    this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
+  }
+
+
+  function _each(iterator) {
+    for (var key in this._object) {
+      var value = this._object[key], pair = [key, value];
+      pair.key = key;
+      pair.value = value;
+      iterator(pair);
+    }
+  }
+
+  function set(key, value) {
+    return this._object[key] = value;
+  }
+
+  function get(key) {
+    if (this._object[key] !== Object.prototype[key])
+      return this._object[key];
+  }
+
+  function unset(key) {
+    var value = this._object[key];
+    delete this._object[key];
+    return value;
+  }
+
+  function toObject() {
+    return Object.clone(this._object);
+  }
+
+
+
+  function keys() {
+    return this.pluck('key');
+  }
+
+  function values() {
+    return this.pluck('value');
+  }
+
+  function index(value) {
+    var match = this.detect(function(pair) {
+      return pair.value === value;
+    });
+    return match && match.key;
+  }
+
+  function merge(object) {
+    return this.clone().update(object);
+  }
+
+  function update(object) {
+    return new Hash(object).inject(this, function(result, pair) {
+      result.set(pair.key, pair.value);
+      return result;
+    });
+  }
+
+  function toQueryPair(key, value) {
+    if (Object.isUndefined(value)) return key;
+    return key + '=' + encodeURIComponent(String.interpret(value));
+  }
+
+  function toQueryString() {
+    return this.inject([], function(results, pair) {
+      var key = encodeURIComponent(pair.key), values = pair.value;
+
+      if (values && typeof values == 'object') {
+        if (Object.isArray(values)) {
+          var queryValues = [];
+          for (var i = 0, len = values.length, value; i < len; i++) {
+            value = values[i];
+            queryValues.push(toQueryPair(key, value));
+          }
+          return results.concat(queryValues);
+        }
+      } else results.push(toQueryPair(key, values));
+      return results;
+    }).join('&');
+  }
+
+  function inspect() {
+    return '#<Hash:{' + this.map(function(pair) {
+      return pair.map(Object.inspect).join(': ');
+    }).join(', ') + '}>';
+  }
+
+  function clone() {
+    return new Hash(this);
+  }
+
+  return {
+    initialize:             initialize,
+    _each:                  _each,
+    set:                    set,
+    get:                    get,
+    unset:                  unset,
+    toObject:               toObject,
+    toTemplateReplacements: toObject,
+    keys:                   keys,
+    values:                 values,
+    index:                  index,
+    merge:                  merge,
+    update:                 update,
+    toQueryString:          toQueryString,
+    inspect:                inspect,
+    toJSON:                 toObject,
+    clone:                  clone
+  };
+})());
+
+Hash.from = $H;
+Object.extend(Number.prototype, (function() {
+  function toColorPart() {
+    return this.toPaddedString(2, 16);
+  }
+
+  function succ() {
+    return this + 1;
+  }
+
+  function times(iterator, context) {
+    $R(0, this, true).each(iterator, context);
+    return this;
+  }
+
+  function toPaddedString(length, radix) {
+    var string = this.toString(radix || 10);
+    return '0'.times(length - string.length) + string;
+  }
+
+  function abs() {
+    return Math.abs(this);
+  }
+
+  function round() {
+    return Math.round(this);
+  }
+
+  function ceil() {
+    return Math.ceil(this);
+  }
+
+  function floor() {
+    return Math.floor(this);
+  }
+
+  return {
+    toColorPart:    toColorPart,
+    succ:           succ,
+    times:          times,
+    toPaddedString: toPaddedString,
+    abs:            abs,
+    round:          round,
+    ceil:           ceil,
+    floor:          floor
+  };
+})());
+
+function $R(start, end, exclusive) {
+  return new ObjectRange(start, end, exclusive);
+}
+
+var ObjectRange = Class.create(Enumerable, (function() {
+  function initialize(start, end, exclusive) {
+    this.start = start;
+    this.end = end;
+    this.exclusive = exclusive;
+  }
+
+  function _each(iterator) {
+    var value = this.start;
+    while (this.include(value)) {
+      iterator(value);
+      value = value.succ();
+    }
+  }
+
+  function include(value) {
+    if (value < this.start)
+      return false;
+    if (this.exclusive)
+      return value < this.end;
+    return value <= this.end;
+  }
+
+  return {
+    initialize: initialize,
+    _each:      _each,
+    include:    include
+  };
+})());
+
+
+
+var Ajax = {
+  getTransport: function() {
+    return Try.these(
+      function() {return new XMLHttpRequest()},
+      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
+      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
+    ) || false;
+  },
+
+  activeRequestCount: 0
+};
+
+Ajax.Responders = {
+  responders: [],
+
+  _each: function(iterator) {
+    this.responders._each(iterator);
+  },
+
+  register: function(responder) {
+    if (!this.include(responder))
+      this.responders.push(responder);
+  },
+
+  unregister: function(responder) {
+    this.responders = this.responders.without(responder);
+  },
+
+  dispatch: function(callback, request, transport, json) {
+    this.each(function(responder) {
+      if (Object.isFunction(responder[callback])) {
+        try {
+          responder[callback].apply(responder, [request, transport, json]);
+        } catch (e) { }
+      }
+    });
+  }
+};
+
+Object.extend(Ajax.Responders, Enumerable);
+
+Ajax.Responders.register({
+  onCreate:   function() { Ajax.activeRequestCount++ },
+  onComplete: function() { Ajax.activeRequestCount-- }
+});
+Ajax.Base = Class.create({
+  initialize: function(options) {
+    this.options = {
+      method:       'post',
+      asynchronous: true,
+      contentType:  'application/x-www-form-urlencoded',
+      encoding:     'UTF-8',
+      parameters:   '',
+      evalJSON:     true,
+      evalJS:       true
+    };
+    Object.extend(this.options, options || { });
+
+    this.options.method = this.options.method.toLowerCase();
+
+    if (Object.isHash(this.options.parameters))
+      this.options.parameters = this.options.parameters.toObject();
+  }
+});
+Ajax.Request = Class.create(Ajax.Base, {
+  _complete: false,
+
+  initialize: function($super, url, options) {
+    $super(options);
+    this.transport = Ajax.getTransport();
+    this.request(url);
+  },
+
+  request: function(url) {
+    this.url = url;
+    this.method = this.options.method;
+    var params = Object.isString(this.options.parameters) ?
+          this.options.parameters :
+          Object.toQueryString(this.options.parameters);
+
+    if (!['get', 'post'].include(this.method)) {
+      params += (params ? '&' : '') + "_method=" + this.method;
+      this.method = 'post';
+    }
+
+    if (params && this.method === 'get') {
+      this.url += (this.url.include('?') ? '&' : '?') + params;
+    }
+
+    this.parameters = params.toQueryParams();
+
+    try {
+      var response = new Ajax.Response(this);
+      if (this.options.onCreate) this.options.onCreate(response);
+      Ajax.Responders.dispatch('onCreate', this, response);
+
+      this.transport.open(this.method.toUpperCase(), this.url,
+        this.options.asynchronous);
+
+      if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
+
+      this.transport.onreadystatechange = this.onStateChange.bind(this);
+      this.setRequestHeaders();
+
+      this.body = this.method == 'post' ? (this.options.postBody || params) : null;
+      this.transport.send(this.body);
+
+      /* Force Firefox to handle ready state 4 for synchronous requests */
+      if (!this.options.asynchronous && this.transport.overrideMimeType)
+        this.onStateChange();
+
+    }
+    catch (e) {
+      this.dispatchException(e);
+    }
+  },
+
+  onStateChange: function() {
+    var readyState = this.transport.readyState;
+    if (readyState > 1 && !((readyState == 4) && this._complete))
+      this.respondToReadyState(this.transport.readyState);
+  },
+
+  setRequestHeaders: function() {
+    var headers = {
+      'X-Requested-With': 'XMLHttpRequest',
+      'X-Prototype-Version': Prototype.Version,
+      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
+    };
+
+    if (this.method == 'post') {
+      headers['Content-type'] = this.options.contentType +
+        (this.options.encoding ? '; charset=' + this.options.encoding : '');
+
+      /* Force "Connection: close" for older Mozilla browsers to work
+       * around a bug where XMLHttpRequest sends an incorrect
+       * Content-length header. See Mozilla Bugzilla #246651.
+       */
+      if (this.transport.overrideMimeType &&
+          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
+            headers['Connection'] = 'close';
+    }
+
+    if (typeof this.options.requestHeaders == 'object') {
+      var extras = this.options.requestHeaders;
+
+      if (Object.isFunction(extras.push))
+        for (var i = 0, length = extras.length; i < length; i += 2)
+          headers[extras[i]] = extras[i+1];
+      else
+        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
+    }
+
+    for (var name in headers)
+      this.transport.setRequestHeader(name, headers[name]);
+  },
+
+  success: function() {
+    var status = this.getStatus();
+    return !status || (status >= 200 && status < 300) || status == 304;
+  },
+
+  getStatus: function() {
+    try {
+      if (this.transport.status === 1223) return 204;
+      return this.transport.status || 0;
+    } catch (e) { return 0 }
+  },
+
+  respondToReadyState: function(readyState) {
+    var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
+
+    if (state == 'Complete') {
+      try {
+        this._complete = true;
+        (this.options['on' + response.status]
+         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
+         || Prototype.emptyFunction)(response, response.headerJSON);
+      } catch (e) {
+        this.dispatchException(e);
+      }
+
+      var contentType = response.getHeader('Content-type');
+      if (this.options.evalJS == 'force'
+          || (this.options.evalJS && this.isSameOrigin() && contentType
+          && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
+        this.evalResponse();
+    }
+
+    try {
+      (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
+      Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
+    } catch (e) {
+      this.dispatchException(e);
+    }
+
+    if (state == 'Complete') {
+      this.transport.onreadystatechange = Prototype.emptyFunction;
+    }
+  },
+
+  isSameOrigin: function() {
+    var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
+    return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
+      protocol: location.protocol,
+      domain: document.domain,
+      port: location.port ? ':' + location.port : ''
+    }));
+  },
+
+  getHeader: function(name) {
+    try {
+      return this.transport.getResponseHeader(name) || null;
+    } catch (e) { return null; }
+  },
+
+  evalResponse: function() {
+    try {
+      return eval((this.transport.responseText || '').unfilterJSON());
+    } catch (e) {
+      this.dispatchException(e);
+    }
+  },
+
+  dispatchException: function(exception) {
+    (this.options.onException || Prototype.emptyFunction)(this, exception);
+    Ajax.Responders.dispatch('onException', this, exception);
+  }
+});
+
+Ajax.Request.Events =
+  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+
+
+
+
+
+
+
+Ajax.Response = Class.create({
+  initialize: function(request){
+    this.request = request;
+    var transport  = this.transport  = request.transport,
+        readyState = this.readyState = transport.readyState;
+
+    if ((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
+      this.status       = this.getStatus();
+      this.statusText   = this.getStatusText();
+      this.responseText = String.interpret(transport.responseText);
+      this.headerJSON   = this._getHeaderJSON();
+    }
+
+    if (readyState == 4) {
+      var xml = transport.responseXML;
+      this.responseXML  = Object.isUndefined(xml) ? null : xml;
+      this.responseJSON = this._getResponseJSON();
+    }
+  },
+
+  status:      0,
+
+  statusText: '',
+
+  getStatus: Ajax.Request.prototype.getStatus,
+
+  getStatusText: function() {
+    try {
+      return this.transport.statusText || '';
+    } catch (e) { return '' }
+  },
+
+  getHeader: Ajax.Request.prototype.getHeader,
+
+  getAllHeaders: function() {
+    try {
+      return this.getAllResponseHeaders();
+    } catch (e) { return null }
+  },
+
+  getResponseHeader: function(name) {
+    return this.transport.getResponseHeader(name);
+  },
+
+  getAllResponseHeaders: function() {
+    return this.transport.getAllResponseHeaders();
+  },
+
+  _getHeaderJSON: function() {
+    var json = this.getHeader('X-JSON');
+    if (!json) return null;
+    json = decodeURIComponent(escape(json));
+    try {
+      return json.evalJSON(this.request.options.sanitizeJSON ||
+        !this.request.isSameOrigin());
+    } catch (e) {
+      this.request.dispatchException(e);
+    }
+  },
+
+  _getResponseJSON: function() {
+    var options = this.request.options;
+    if (!options.evalJSON || (options.evalJSON != 'force' &&
+      !(this.getHeader('Content-type') || '').include('application/json')) ||
+        this.responseText.blank())
+          return null;
+    try {
+      return this.responseText.evalJSON(options.sanitizeJSON ||
+        !this.request.isSameOrigin());
+    } catch (e) {
+      this.request.dispatchException(e);
+    }
+  }
+});
+
+Ajax.Updater = Class.create(Ajax.Request, {
+  initialize: function($super, container, url, options) {
+    this.container = {
+      success: (container.success || container),
+      failure: (container.failure || (container.success ? null : container))
+    };
+
+    options = Object.clone(options);
+    var onComplete = options.onComplete;
+    options.onComplete = (function(response, json) {
+      this.updateContent(response.responseText);
+      if (Object.isFunction(onComplete)) onComplete(response, json);
+    }).bind(this);
+
+    $super(url, options);
+  },
+
+  updateContent: function(responseText) {
+    var receiver = this.container[this.success() ? 'success' : 'failure'],
+        options = this.options;
+
+    if (!options.evalScripts) responseText = responseText.stripScripts();
+
+    if (receiver = $(receiver)) {
+      if (options.insertion) {
+        if (Object.isString(options.insertion)) {
+          var insertion = { }; insertion[options.insertion] = responseText;
+          receiver.insert(insertion);
+        }
+        else options.insertion(receiver, responseText);
+      }
+      else receiver.update(responseText);
+    }
+  }
+});
+
+Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
+  initialize: function($super, container, url, options) {
+    $super(options);
+    this.onComplete = this.options.onComplete;
+
+    this.frequency = (this.options.frequency || 2);
+    this.decay = (this.options.decay || 1);
+
+    this.updater = { };
+    this.container = container;
+    this.url = url;
+
+    this.start();
+  },
+
+  start: function() {
+    this.options.onComplete = this.updateComplete.bind(this);
+    this.onTimerEvent();
+  },
+
+  stop: function() {
+    this.updater.options.onComplete = undefined;
+    clearTimeout(this.timer);
+    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
+  },
+
+  updateComplete: function(response) {
+    if (this.options.decay) {
+      this.decay = (response.responseText == this.lastText ?
+        this.decay * this.options.decay : 1);
+
+      this.lastText = response.responseText;
+    }
+    this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
+  },
+
+  onTimerEvent: function() {
+    this.updater = new Ajax.Updater(this.container, this.url, this.options);
+  }
+});
+
+
+function $(element) {
+  if (arguments.length > 1) {
+    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
+      elements.push($(arguments[i]));
+    return elements;
+  }
+  if (Object.isString(element))
+    element = document.getElementById(element);
+  return Element.extend(element);
+}
+
+if (Prototype.BrowserFeatures.XPath) {
+  document._getElementsByXPath = function(expression, parentElement) {
+    var results = [];
+    var query = document.evaluate(expression, $(parentElement) || document,
+      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+    for (var i = 0, length = query.snapshotLength; i < length; i++)
+      results.push(Element.extend(query.snapshotItem(i)));
+    return results;
+  };
+}
+
+/*--------------------------------------------------------------------------*/
+
+if (!Node) var Node = { };
+
+if (!Node.ELEMENT_NODE) {
+  Object.extend(Node, {
+    ELEMENT_NODE: 1,
+    ATTRIBUTE_NODE: 2,
+    TEXT_NODE: 3,
+    CDATA_SECTION_NODE: 4,
+    ENTITY_REFERENCE_NODE: 5,
+    ENTITY_NODE: 6,
+    PROCESSING_INSTRUCTION_NODE: 7,
+    COMMENT_NODE: 8,
+    DOCUMENT_NODE: 9,
+    DOCUMENT_TYPE_NODE: 10,
+    DOCUMENT_FRAGMENT_NODE: 11,
+    NOTATION_NODE: 12
+  });
+}
+
+
+
+(function(global) {
+  function shouldUseCache(tagName, attributes) {
+    if (tagName === 'select') return false;
+    if ('type' in attributes) return false;
+    return true;
+  }
+
+  var HAS_EXTENDED_CREATE_ELEMENT_SYNTAX = (function(){
+    try {
+      var el = document.createElement('<input name="x">');
+      return el.tagName.toLowerCase() === 'input' && el.name === 'x';
+    }
+    catch(err) {
+      return false;
+    }
+  })();
+
+  var element = global.Element;
+
+  global.Element = function(tagName, attributes) {
+    attributes = attributes || { };
+    tagName = tagName.toLowerCase();
+    var cache = Element.cache;
+
+    if (HAS_EXTENDED_CREATE_ELEMENT_SYNTAX && attributes.name) {
+      tagName = '<' + tagName + ' name="' + attributes.name + '">';
+      delete attributes.name;
+      return Element.writeAttribute(document.createElement(tagName), attributes);
+    }
+
+    if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
+
+    var node = shouldUseCache(tagName, attributes) ?
+     cache[tagName].cloneNode(false) : document.createElement(tagName);
+
+    return Element.writeAttribute(node, attributes);
+  };
+
+  Object.extend(global.Element, element || { });
+  if (element) global.Element.prototype = element.prototype;
+
+})(this);
+
+Element.idCounter = 1;
+Element.cache = { };
+
+Element._purgeElement = function(element) {
+  var uid = element._prototypeUID;
+  if (uid) {
+    Element.stopObserving(element);
+    element._prototypeUID = void 0;
+    delete Element.Storage[uid];
+  }
+}
+
+Element.Methods = {
+  visible: function(element) {
+    return $(element).style.display != 'none';
+  },
+
+  toggle: function(element) {
+    element = $(element);
+    Element[Element.visible(element) ? 'hide' : 'show'](element);
+    return element;
+  },
+
+  hide: function(element) {
+    element = $(element);
+    element.style.display = 'none';
+    return element;
+  },
+
+  show: function(element) {
+    element = $(element);
+    element.style.display = '';
+    return element;
+  },
+
+  remove: function(element) {
+    element = $(element);
+    element.parentNode.removeChild(element);
+    return element;
+  },
+
+  update: (function(){
+
+    var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
+      var el = document.createElement("select"),
+          isBuggy = true;
+      el.innerHTML = "<option value=\"test\">test</option>";
+      if (el.options && el.options[0]) {
+        isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION";
+      }
+      el = null;
+      return isBuggy;
+    })();
+
+    var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){
+      try {
+        var el = document.createElement("table");
+        if (el && el.tBodies) {
+          el.innerHTML = "<tbody><tr><td>test</td></tr></tbody>";
+          var isBuggy = typeof el.tBodies[0] == "undefined";
+          el = null;
+          return isBuggy;
+        }
+      } catch (e) {
+        return true;
+      }
+    })();
+
+    var LINK_ELEMENT_INNERHTML_BUGGY = (function() {
+      try {
+        var el = document.createElement('div');
+        el.innerHTML = "<link>";
+        var isBuggy = (el.childNodes.length === 0);
+        el = null;
+        return isBuggy;
+      } catch(e) {
+        return true;
+      }
+    })();
+
+    var ANY_INNERHTML_BUGGY = SELECT_ELEMENT_INNERHTML_BUGGY ||
+     TABLE_ELEMENT_INNERHTML_BUGGY || LINK_ELEMENT_INNERHTML_BUGGY;
+
+    var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () {
+      var s = document.createElement("script"),
+          isBuggy = false;
+      try {
+        s.appendChild(document.createTextNode(""));
+        isBuggy = !s.firstChild ||
+          s.firstChild && s.firstChild.nodeType !== 3;
+      } catch (e) {
+        isBuggy = true;
+      }
+      s = null;
+      return isBuggy;
+    })();
+
+
+    function update(element, content) {
+      element = $(element);
+      var purgeElement = Element._purgeElement;
+
+      var descendants = element.getElementsByTagName('*'),
+       i = descendants.length;
+      while (i--) purgeElement(descendants[i]);
+
+      if (content && content.toElement)
+        content = content.toElement();
+
+      if (Object.isElement(content))
+        return element.update().insert(content);
+
+      content = Object.toHTML(content);
+
+      var tagName = element.tagName.toUpperCase();
+
+      if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) {
+        element.text = content;
+        return element;
+      }
+
+      if (ANY_INNERHTML_BUGGY) {
+        if (tagName in Element._insertionTranslations.tags) {
+          while (element.firstChild) {
+            element.removeChild(element.firstChild);
+          }
+          Element._getContentFromAnonymousElement(tagName, content.stripScripts())
+            .each(function(node) {
+              element.appendChild(node)
+            });
+        } else if (LINK_ELEMENT_INNERHTML_BUGGY && Object.isString(content) && content.indexOf('<link') > -1) {
+          while (element.firstChild) {
+            element.removeChild(element.firstChild);
+          }
+          var nodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts(), true);
+          nodes.each(function(node) { element.appendChild(node) });
+        }
+        else {
+          element.innerHTML = content.stripScripts();
+        }
+      }
+      else {
+        element.innerHTML = content.stripScripts();
+      }
+
+      content.evalScripts.bind(content).defer();
+      return element;
+    }
+
+    return update;
+  })(),
+
+  replace: function(element, content) {
+    element = $(element);
+    if (content && content.toElement) content = content.toElement();
+    else if (!Object.isElement(content)) {
+      content = Object.toHTML(content);
+      var range = element.ownerDocument.createRange();
+      range.selectNode(element);
+      content.evalScripts.bind(content).defer();
+      content = range.createContextualFragment(content.stripScripts());
+    }
+    element.parentNode.replaceChild(content, element);
+    return element;
+  },
+
+  insert: function(element, insertions) {
+    element = $(element);
+
+    if (Object.isString(insertions) || Object.isNumber(insertions) ||
+        Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
+          insertions = {bottom:insertions};
+
+    var content, insert, tagName, childNodes;
+
+    for (var position in insertions) {
+      content  = insertions[position];
+      position = position.toLowerCase();
+      insert = Element._insertionTranslations[position];
+
+      if (content && content.toElement) content = content.toElement();
+      if (Object.isElement(content)) {
+        insert(element, content);
+        continue;
+      }
+
+      content = Object.toHTML(content);
+
+      tagName = ((position == 'before' || position == 'after')
+        ? element.parentNode : element).tagName.toUpperCase();
+
+      childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
+
+      if (position == 'top' || position == 'after') childNodes.reverse();
+      childNodes.each(insert.curry(element));
+
+      content.evalScripts.bind(content).defer();
+    }
+
+    return element;
+  },
+
+  wrap: function(element, wrapper, attributes) {
+    element = $(element);
+    if (Object.isElement(wrapper))
+      $(wrapper).writeAttribute(attributes || { });
+    else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
+    else wrapper = new Element('div', wrapper);
+    if (element.parentNode)
+      element.parentNode.replaceChild(wrapper, element);
+    wrapper.appendChild(element);
+    return wrapper;
+  },
+
+  inspect: function(element) {
+    element = $(element);
+    var result = '<' + element.tagName.toLowerCase();
+    $H({'id': 'id', 'className': 'class'}).each(function(pair) {
+      var property = pair.first(),
+          attribute = pair.last(),
+          value = (element[property] || '').toString();
+      if (value) result += ' ' + attribute + '=' + value.inspect(true);
+    });
+    return result + '>';
+  },
+
+  recursivelyCollect: function(element, property, maximumLength) {
+    element = $(element);
+    maximumLength = maximumLength || -1;
+    var elements = [];
+
+    while (element = element[property]) {
+      if (element.nodeType == 1)
+        elements.push(Element.extend(element));
+      if (elements.length == maximumLength)
+        break;
+    }
+
+    return elements;
+  },
+
+  ancestors: function(element) {
+    return Element.recursivelyCollect(element, 'parentNode');
+  },
+
+  descendants: function(element) {
+    return Element.select(element, "*");
+  },
+
+  firstDescendant: function(element) {
+    element = $(element).firstChild;
+    while (element && element.nodeType != 1) element = element.nextSibling;
+    return $(element);
+  },
+
+  immediateDescendants: function(element) {
+    var results = [], child = $(element).firstChild;
+    while (child) {
+      if (child.nodeType === 1) {
+        results.push(Element.extend(child));
+      }
+      child = child.nextSibling;
+    }
+    return results;
+  },
+
+  previousSiblings: function(element, maximumLength) {
+    return Element.recursivelyCollect(element, 'previousSibling');
+  },
+
+  nextSiblings: function(element) {
+    return Element.recursivelyCollect(element, 'nextSibling');
+  },
+
+  siblings: function(element) {
+    element = $(element);
+    return Element.previousSiblings(element).reverse()
+      .concat(Element.nextSiblings(element));
+  },
+
+  match: function(element, selector) {
+    element = $(element);
+    if (Object.isString(selector))
+      return Prototype.Selector.match(element, selector);
+    return selector.match(element);
+  },
+
+  up: function(element, expression, index) {
+    element = $(element);
+    if (arguments.length == 1) return $(element.parentNode);
+    var ancestors = Element.ancestors(element);
+    return Object.isNumber(expression) ? ancestors[expression] :
+      Prototype.Selector.find(ancestors, expression, index);
+  },
+
+  down: function(element, expression, index) {
+    element = $(element);
+    if (arguments.length == 1) return Element.firstDescendant(element);
+    return Object.isNumber(expression) ? Element.descendants(element)[expression] :
+      Element.select(element, expression)[index || 0];
+  },
+
+  previous: function(element, expression, index) {
+    element = $(element);
+    if (Object.isNumber(expression)) index = expression, expression = false;
+    if (!Object.isNumber(index)) index = 0;
+
+    if (expression) {
+      return Prototype.Selector.find(element.previousSiblings(), expression, index);
+    } else {
+      return element.recursivelyCollect("previousSibling", index + 1)[index];
+    }
+  },
+
+  next: function(element, expression, index) {
+    element = $(element);
+    if (Object.isNumber(expression)) index = expression, expression = false;
+    if (!Object.isNumber(index)) index = 0;
+
+    if (expression) {
+      return Prototype.Selector.find(element.nextSiblings(), expression, index);
+    } else {
+      var maximumLength = Object.isNumber(index) ? index + 1 : 1;
+      return element.recursivelyCollect("nextSibling", index + 1)[index];
+    }
+  },
+
+
+  select: function(element) {
+    element = $(element);
+    var expressions = Array.prototype.slice.call(arguments, 1).join(', ');
+    return Prototype.Selector.select(expressions, element);
+  },
+
+  adjacent: function(element) {
+    element = $(element);
+    var expressions = Array.prototype.slice.call(arguments, 1).join(', ');
+    return Prototype.Selector.select(expressions, element.parentNode).without(element);
+  },
+
+  identify: function(element) {
+    element = $(element);
+    var id = Element.readAttribute(element, 'id');
+    if (id) return id;
+    do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id));
+    Element.writeAttribute(element, 'id', id);
+    return id;
+  },
+
+  readAttribute: function(element, name) {
+    element = $(element);
+    if (Prototype.Browser.IE) {
+      var t = Element._attributeTranslations.read;
+      if (t.values[name]) return t.values[name](element, name);
+      if (t.names[name]) name = t.names[name];
+      if (name.include(':')) {
+        return (!element.attributes || !element.attributes[name]) ? null :
+         element.attributes[name].value;
+      }
+    }
+    return element.getAttribute(name);
+  },
+
+  writeAttribute: function(element, name, value) {
+    element = $(element);
+    var attributes = { }, t = Element._attributeTranslations.write;
+
+    if (typeof name == 'object') attributes = name;
+    else attributes[name] = Object.isUndefined(value) ? true : value;
+
+    for (var attr in attributes) {
+      name = t.names[attr] || attr;
+      value = attributes[attr];
+      if (t.values[attr]) name = t.values[attr](element, value);
+      if (value === false || value === null)
+        element.removeAttribute(name);
+      else if (value === true)
+        element.setAttribute(name, name);
+      else element.setAttribute(name, value);
+    }
+    return element;
+  },
+
+  getHeight: function(element) {
+    return Element.getDimensions(element).height;
+  },
+
+  getWidth: function(element) {
+    return Element.getDimensions(element).width;
+  },
+
+  classNames: function(element) {
+    return new Element.ClassNames(element);
+  },
+
+  hasClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    var elementClassName = element.className;
+    return (elementClassName.length > 0 && (elementClassName == className ||
+      new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
+  },
+
+  addClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    if (!Element.hasClassName(element, className))
+      element.className += (element.className ? ' ' : '') + className;
+    return element;
+  },
+
+  removeClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    element.className = element.className.replace(
+      new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
+    return element;
+  },
+
+  toggleClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    return Element[Element.hasClassName(element, className) ?
+      'removeClassName' : 'addClassName'](element, className);
+  },
+
+  cleanWhitespace: function(element) {
+    element = $(element);
+    var node = element.firstChild;
+    while (node) {
+      var nextNode = node.nextSibling;
+      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
+        element.removeChild(node);
+      node = nextNode;
+    }
+    return element;
+  },
+
+  empty: function(element) {
+    return $(element).innerHTML.blank();
+  },
+
+  descendantOf: function(element, ancestor) {
+    element = $(element), ancestor = $(ancestor);
+
+    if (element.compareDocumentPosition)
+      return (element.compareDocumentPosition(ancestor) & 8) === 8;
+
+    if (ancestor.contains)
+      return ancestor.contains(element) && ancestor !== element;
+
+    while (element = element.parentNode)
+      if (element == ancestor) return true;
+
+    return false;
+  },
+
+  scrollTo: function(element) {
+    element = $(element);
+    var pos = Element.cumulativeOffset(element);
+    window.scrollTo(pos[0], pos[1]);
+    return element;
+  },
+
+  getStyle: function(element, style) {
+    element = $(element);
+    style = style == 'float' ? 'cssFloat' : style.camelize();
+    var value = element.style[style];
+    if (!value || value == 'auto') {
+      var css = document.defaultView.getComputedStyle(element, null);
+      value = css ? css[style] : null;
+    }
+    if (style == 'opacity') return value ? parseFloat(value) : 1.0;
+    return value == 'auto' ? null : value;
+  },
+
+  getOpacity: function(element) {
+    return $(element).getStyle('opacity');
+  },
+
+  setStyle: function(element, styles) {
+    element = $(element);
+    var elementStyle = element.style, match;
+    if (Object.isString(styles)) {
+      element.style.cssText += ';' + styles;
+      return styles.include('opacity') ?
+        element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
+    }
+    for (var property in styles)
+      if (property == 'opacity') element.setOpacity(styles[property]);
+      else
+        elementStyle[(property == 'float' || property == 'cssFloat') ?
+          (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
+            property] = styles[property];
+
+    return element;
+  },
+
+  setOpacity: function(element, value) {
+    element = $(element);
+    element.style.opacity = (value == 1 || value === '') ? '' :
+      (value < 0.00001) ? 0 : value;
+    return element;
+  },
+
+  makePositioned: function(element) {
+    element = $(element);
+    var pos = Element.getStyle(element, 'position');
+    if (pos == 'static' || !pos) {
+      element._madePositioned = true;
+      element.style.position = 'relative';
+      if (Prototype.Browser.Opera) {
+        element.style.top = 0;
+        element.style.left = 0;
+      }
+    }
+    return element;
+  },
+
+  undoPositioned: function(element) {
+    element = $(element);
+    if (element._madePositioned) {
+      element._madePositioned = undefined;
+      element.style.position =
+        element.style.top =
+        element.style.left =
+        element.style.bottom =
+        element.style.right = '';
+    }
+    return element;
+  },
+
+  makeClipping: function(element) {
+    element = $(element);
+    if (element._overflow) return element;
+    element._overflow = Element.getStyle(element, 'overflow') || 'auto';
+    if (element._overflow !== 'hidden')
+      element.style.overflow = 'hidden';
+    return element;
+  },
+
+  undoClipping: function(element) {
+    element = $(element);
+    if (!element._overflow) return element;
+    element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
+    element._overflow = null;
+    return element;
+  },
+
+  clonePosition: function(element, source) {
+    var options = Object.extend({
+      setLeft:    true,
+      setTop:     true,
+      setWidth:   true,
+      setHeight:  true,
+      offsetTop:  0,
+      offsetLeft: 0
+    }, arguments[2] || { });
+
+    source = $(source);
+    var p = Element.viewportOffset(source), delta = [0, 0], parent = null;
+
+    element = $(element);
+
+    if (Element.getStyle(element, 'position') == 'absolute') {
+      parent = Element.getOffsetParent(element);
+      delta = Element.viewportOffset(parent);
+    }
+
+    if (parent == document.body) {
+      delta[0] -= document.body.offsetLeft;
+      delta[1] -= document.body.offsetTop;
+    }
+
+    if (options.setLeft)   element.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
+    if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
+    if (options.setWidth)  element.style.width = source.offsetWidth + 'px';
+    if (options.setHeight) element.style.height = source.offsetHeight + 'px';
+    return element;
+  }
+};
+
+Object.extend(Element.Methods, {
+  getElementsBySelector: Element.Methods.select,
+
+  childElements: Element.Methods.immediateDescendants
+});
+
+Element._attributeTranslations = {
+  write: {
+    names: {
+      className: 'class',
+      htmlFor:   'for'
+    },
+    values: { }
+  }
+};
+
+if (Prototype.Browser.Opera) {
+  Element.Methods.getStyle = Element.Methods.getStyle.wrap(
+    function(proceed, element, style) {
+      switch (style) {
+        case 'height': case 'width':
+          if (!Element.visible(element)) return null;
+
+          var dim = parseInt(proceed(element, style), 10);
+
+          if (dim !== element['offset' + style.capitalize()])
+            return dim + 'px';
+
+          var properties;
+          if (style === 'height') {
+            properties = ['border-top-width', 'padding-top',
+             'padding-bottom', 'border-bottom-width'];
+          }
+          else {
+            properties = ['border-left-width', 'padding-left',
+             'padding-right', 'border-right-width'];
+          }
+          return properties.inject(dim, function(memo, property) {
+            var val = proceed(element, property);
+            return val === null ? memo : memo - parseInt(val, 10);
+          }) + 'px';
+        default: return proceed(element, style);
+      }
+    }
+  );
+
+  Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
+    function(proceed, element, attribute) {
+      if (attribute === 'title') return element.title;
+      return proceed(element, attribute);
+    }
+  );
+}
+
+else if (Prototype.Browser.IE) {
+  Element.Methods.getStyle = function(element, style) {
+    element = $(element);
+    style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
+    var value = element.style[style];
+    if (!value && element.currentStyle) value = element.currentStyle[style];
+
+    if (style == 'opacity') {
+      if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
+        if (value[1]) return parseFloat(value[1]) / 100;
+      return 1.0;
+    }
+
+    if (value == 'auto') {
+      if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
+        return element['offset' + style.capitalize()] + 'px';
+      return null;
+    }
+    return value;
+  };
+
+  Element.Methods.setOpacity = function(element, value) {
+    function stripAlpha(filter){
+      return filter.replace(/alpha\([^\)]*\)/gi,'');
+    }
+    element = $(element);
+    var currentStyle = element.currentStyle;
+    if ((currentStyle && !currentStyle.hasLayout) ||
+      (!currentStyle && element.style.zoom == 'normal'))
+        element.style.zoom = 1;
+
+    var filter = element.getStyle('filter'), style = element.style;
+    if (value == 1 || value === '') {
+      (filter = stripAlpha(filter)) ?
+        style.filter = filter : style.removeAttribute('filter');
+      return element;
+    } else if (value < 0.00001) value = 0;
+    style.filter = stripAlpha(filter) +
+      'alpha(opacity=' + (value * 100) + ')';
+    return element;
+  };
+
+  Element._attributeTranslations = (function(){
+
+    var classProp = 'className',
+        forProp = 'for',
+        el = document.createElement('div');
+
+    el.setAttribute(classProp, 'x');
+
+    if (el.className !== 'x') {
+      el.setAttribute('class', 'x');
+      if (el.className === 'x') {
+        classProp = 'class';
+      }
+    }
+    el = null;
+
+    el = document.createElement('label');
+    el.setAttribute(forProp, 'x');
+    if (el.htmlFor !== 'x') {
+      el.setAttribute('htmlFor', 'x');
+      if (el.htmlFor === 'x') {
+        forProp = 'htmlFor';
+      }
+    }
+    el = null;
+
+    return {
+      read: {
+        names: {
+          'class':      classProp,
+          'className':  classProp,
+          'for':        forProp,
+          'htmlFor':    forProp
+        },
+        values: {
+          _getAttr: function(element, attribute) {
+            return element.getAttribute(attribute);
+          },
+          _getAttr2: function(element, attribute) {
+            return element.getAttribute(attribute, 2);
+          },
+          _getAttrNode: function(element, attribute) {
+            var node = element.getAttributeNode(attribute);
+            return node ? node.value : "";
+          },
+          _getEv: (function(){
+
+            var el = document.createElement('div'), f;
+            el.onclick = Prototype.emptyFunction;
+            var value = el.getAttribute('onclick');
+
+            if (String(value).indexOf('{') > -1) {
+              f = function(element, attribute) {
+                attribute = element.getAttribute(attribute);
+                if (!attribute) return null;
+                attribute = attribute.toString();
+                attribute = attribute.split('{')[1];
+                attribute = attribute.split('}')[0];
+                return attribute.strip();
+              };
+            }
+            else if (value === '') {
+              f = function(element, attribute) {
+                attribute = element.getAttribute(attribute);
+                if (!attribute) return null;
+                return attribute.strip();
+              };
+            }
+            el = null;
+            return f;
+          })(),
+          _flag: function(element, attribute) {
+            return $(element).hasAttribute(attribute) ? attribute : null;
+          },
+          style: function(element) {
+            return element.style.cssText.toLowerCase();
+          },
+          title: function(element) {
+            return element.title;
+          }
+        }
+      }
+    }
+  })();
+
+  Element._attributeTranslations.write = {
+    names: Object.extend({
+      cellpadding: 'cellPadding',
+      cellspacing: 'cellSpacing'
+    }, Element._attributeTranslations.read.names),
+    values: {
+      checked: function(element, value) {
+        element.checked = !!value;
+      },
+
+      style: function(element, value) {
+        element.style.cssText = value ? value : '';
+      }
+    }
+  };
+
+  Element._attributeTranslations.has = {};
+
+  $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
+      'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
+    Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
+    Element._attributeTranslations.has[attr.toLowerCase()] = attr;
+  });
+
+  (function(v) {
+    Object.extend(v, {
+      href:        v._getAttr2,
+      src:         v._getAttr2,
+      type:        v._getAttr,
+      action:      v._getAttrNode,
+      disabled:    v._flag,
+      checked:     v._flag,
+      readonly:    v._flag,
+      multiple:    v._flag,
+      onload:      v._getEv,
+      onunload:    v._getEv,
+      onclick:     v._getEv,
+      ondblclick:  v._getEv,
+      onmousedown: v._getEv,
+      onmouseup:   v._getEv,
+      onmouseover: v._getEv,
+      onmousemove: v._getEv,
+      onmouseout:  v._getEv,
+      onfocus:     v._getEv,
+      onblur:      v._getEv,
+      onkeypress:  v._getEv,
+      onkeydown:   v._getEv,
+      onkeyup:     v._getEv,
+      onsubmit:    v._getEv,
+      onreset:     v._getEv,
+      onselect:    v._getEv,
+      onchange:    v._getEv
+    });
+  })(Element._attributeTranslations.read.values);
+
+  if (Prototype.BrowserFeatures.ElementExtensions) {
+    (function() {
+      function _descendants(element) {
+        var nodes = element.getElementsByTagName('*'), results = [];
+        for (var i = 0, node; node = nodes[i]; i++)
+          if (node.tagName !== "!") // Filter out comment nodes.
+            results.push(node);
+        return results;
+      }
+
+      Element.Methods.down = function(element, expression, index) {
+        element = $(element);
+        if (arguments.length == 1) return element.firstDescendant();
+        return Object.isNumber(expression) ? _descendants(element)[expression] :
+          Element.select(element, expression)[index || 0];
+      }
+    })();
+  }
+
+}
+
+else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
+  Element.Methods.setOpacity = function(element, value) {
+    element = $(element);
+    element.style.opacity = (value == 1) ? 0.999999 :
+      (value === '') ? '' : (value < 0.00001) ? 0 : value;
+    return element;
+  };
+}
+
+else if (Prototype.Browser.WebKit) {
+  Element.Methods.setOpacity = function(element, value) {
+    element = $(element);
+    element.style.opacity = (value == 1 || value === '') ? '' :
+      (value < 0.00001) ? 0 : value;
+
+    if (value == 1)
+      if (element.tagName.toUpperCase() == 'IMG' && element.width) {
+        element.width++; element.width--;
+      } else try {
+        var n = document.createTextNode(' ');
+        element.appendChild(n);
+        element.removeChild(n);
+      } catch (e) { }
+
+    return element;
+  };
+}
+
+if ('outerHTML' in document.documentElement) {
+  Element.Methods.replace = function(element, content) {
+    element = $(element);
+
+    if (content && content.toElement) content = content.toElement();
+    if (Object.isElement(content)) {
+      element.parentNode.replaceChild(content, element);
+      return element;
+    }
+
+    content = Object.toHTML(content);
+    var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
+
+    if (Element._insertionTranslations.tags[tagName]) {
+      var nextSibling = element.next(),
+          fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
+      parent.removeChild(element);
+      if (nextSibling)
+        fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
+      else
+        fragments.each(function(node) { parent.appendChild(node) });
+    }
+    else element.outerHTML = content.stripScripts();
+
+    content.evalScripts.bind(content).defer();
+    return element;
+  };
+}
+
+Element._returnOffset = function(l, t) {
+  var result = [l, t];
+  result.left = l;
+  result.top = t;
+  return result;
+};
+
+Element._getContentFromAnonymousElement = function(tagName, html, force) {
+  var div = new Element('div'),
+      t = Element._insertionTranslations.tags[tagName];
+
+  var workaround = false;
+  if (t) workaround = true;
+  else if (force) {
+    workaround = true;
+    t = ['', '', 0];
+  }
+
+  if (workaround) {
+    div.innerHTML = '&nbsp;' + t[0] + html + t[1];
+    div.removeChild(div.firstChild);
+    for (var i = t[2]; i--; ) {
+      div = div.firstChild;
+    }
+  }
+  else {
+    div.innerHTML = html;
+  }
+  return $A(div.childNodes);
+};
+
+Element._insertionTranslations = {
+  before: function(element, node) {
+    element.parentNode.insertBefore(node, element);
+  },
+  top: function(element, node) {
+    element.insertBefore(node, element.firstChild);
+  },
+  bottom: function(element, node) {
+    element.appendChild(node);
+  },
+  after: function(element, node) {
+    element.parentNode.insertBefore(node, element.nextSibling);
+  },
+  tags: {
+    TABLE:  ['<table>',                '</table>',                   1],
+    TBODY:  ['<table><tbody>',         '</tbody></table>',           2],
+    TR:     ['<table><tbody><tr>',     '</tr></tbody></table>',      3],
+    TD:     ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
+    SELECT: ['<select>',               '</select>',                  1]
+  }
+};
+
+(function() {
+  var tags = Element._insertionTranslations.tags;
+  Object.extend(tags, {
+    THEAD: tags.TBODY,
+    TFOOT: tags.TBODY,
+    TH:    tags.TD
+  });
+})();
+
+Element.Methods.Simulated = {
+  hasAttribute: function(element, attribute) {
+    attribute = Element._attributeTranslations.has[attribute] || attribute;
+    var node = $(element).getAttributeNode(attribute);
+    return !!(node && node.specified);
+  }
+};
+
+Element.Methods.ByTag = { };
+
+Object.extend(Element, Element.Methods);
+
+(function(div) {
+
+  if (!Prototype.BrowserFeatures.ElementExtensions && div['__proto__']) {
+    window.HTMLElement = { };
+    window.HTMLElement.prototype = div['__proto__'];
+    Prototype.BrowserFeatures.ElementExtensions = true;
+  }
+
+  div = null;
+
+})(document.createElement('div'));
+
+Element.extend = (function() {
+
+  function checkDeficiency(tagName) {
+    if (typeof window.Element != 'undefined') {
+      var proto = window.Element.prototype;
+      if (proto) {
+        var id = '_' + (Math.random()+'').slice(2),
+            el = document.createElement(tagName);
+        proto[id] = 'x';
+        var isBuggy = (el[id] !== 'x');
+        delete proto[id];
+        el = null;
+        return isBuggy;
+      }
+    }
+    return false;
+  }
+
+  function extendElementWith(element, methods) {
+    for (var property in methods) {
+      var value = methods[property];
+      if (Object.isFunction(value) && !(property in element))
+        element[property] = value.methodize();
+    }
+  }
+
+  var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object');
+
+  if (Prototype.BrowserFeatures.SpecificElementExtensions) {
+    if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) {
+      return function(element) {
+        if (element && typeof element._extendedByPrototype == 'undefined') {
+          var t = element.tagName;
+          if (t && (/^(?:object|applet|embed)$/i.test(t))) {
+            extendElementWith(element, Element.Methods);
+            extendElementWith(element, Element.Methods.Simulated);
+            extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]);
+          }
+        }
+        return element;
+      }
+    }
+    return Prototype.K;
+  }
+
+  var Methods = { }, ByTag = Element.Methods.ByTag;
+
+  var extend = Object.extend(function(element) {
+    if (!element || typeof element._extendedByPrototype != 'undefined' ||
+        element.nodeType != 1 || element == window) return element;
+
+    var methods = Object.clone(Methods),
+        tagName = element.tagName.toUpperCase();
+
+    if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
+
+    extendElementWith(element, methods);
+
+    element._extendedByPrototype = Prototype.emptyFunction;
+    return element;
+
+  }, {
+    refresh: function() {
+      if (!Prototype.BrowserFeatures.ElementExtensions) {
+        Object.extend(Methods, Element.Methods);
+        Object.extend(Methods, Element.Methods.Simulated);
+      }
+    }
+  });
+
+  extend.refresh();
+  return extend;
+})();
+
+if (document.documentElement.hasAttribute) {
+  Element.hasAttribute = function(element, attribute) {
+    return element.hasAttribute(attribute);
+  };
+}
+else {
+  Element.hasAttribute = Element.Methods.Simulated.hasAttribute;
+}
+
+Element.addMethods = function(methods) {
+  var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
+
+  if (!methods) {
+    Object.extend(Form, Form.Methods);
+    Object.extend(Form.Element, Form.Element.Methods);
+    Object.extend(Element.Methods.ByTag, {
+      "FORM":     Object.clone(Form.Methods),
+      "INPUT":    Object.clone(Form.Element.Methods),
+      "SELECT":   Object.clone(Form.Element.Methods),
+      "TEXTAREA": Object.clone(Form.Element.Methods),
+      "BUTTON":   Object.clone(Form.Element.Methods)
+    });
+  }
+
+  if (arguments.length == 2) {
+    var tagName = methods;
+    methods = arguments[1];
+  }
+
+  if (!tagName) Object.extend(Element.Methods, methods || { });
+  else {
+    if (Object.isArray(tagName)) tagName.each(extend);
+    else extend(tagName);
+  }
+
+  function extend(tagName) {
+    tagName = tagName.toUpperCase();
+    if (!Element.Methods.ByTag[tagName])
+      Element.Methods.ByTag[tagName] = { };
+    Object.extend(Element.Methods.ByTag[tagName], methods);
+  }
+
+  function copy(methods, destination, onlyIfAbsent) {
+    onlyIfAbsent = onlyIfAbsent || false;
+    for (var property in methods) {
+      var value = methods[property];
+      if (!Object.isFunction(value)) continue;
+      if (!onlyIfAbsent || !(property in destination))
+        destination[property] = value.methodize();
+    }
+  }
+
+  function findDOMClass(tagName) {
+    var klass;
+    var trans = {
+      "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
+      "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
+      "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
+      "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
+      "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
+      "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
+      "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
+      "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
+      "FrameSet", "IFRAME": "IFrame"
+    };
+    if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
+    if (window[klass]) return window[klass];
+    klass = 'HTML' + tagName + 'Element';
+    if (window[klass]) return window[klass];
+    klass = 'HTML' + tagName.capitalize() + 'Element';
+    if (window[klass]) return window[klass];
+
+    var element = document.createElement(tagName),
+        proto = element['__proto__'] || element.constructor.prototype;
+
+    element = null;
+    return proto;
+  }
+
+  var elementPrototype = window.HTMLElement ? HTMLElement.prototype :
+   Element.prototype;
+
+  if (F.ElementExtensions) {
+    copy(Element.Methods, elementPrototype);
+    copy(Element.Methods.Simulated, elementPrototype, true);
+  }
+
+  if (F.SpecificElementExtensions) {
+    for (var tag in Element.Methods.ByTag) {
+      var klass = findDOMClass(tag);
+      if (Object.isUndefined(klass)) continue;
+      copy(T[tag], klass.prototype);
+    }
+  }
+
+  Object.extend(Element, Element.Methods);
+  delete Element.ByTag;
+
+  if (Element.extend.refresh) Element.extend.refresh();
+  Element.cache = { };
+};
+
+
+document.viewport = {
+
+  getDimensions: function() {
+    return { width: this.getWidth(), height: this.getHeight() };
+  },
+
+  getScrollOffsets: function() {
+    return Element._returnOffset(
+      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
+      window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop);
+  }
+};
+
+(function(viewport) {
+  var B = Prototype.Browser, doc = document, element, property = {};
+
+  function getRootElement() {
+    if (B.WebKit && !doc.evaluate)
+      return document;
+
+    if (B.Opera && window.parseFloat(window.opera.version()) < 9.5)
+      return document.body;
+
+    return document.documentElement;
+  }
+
+  function define(D) {
+    if (!element) element = getRootElement();
+
+    property[D] = 'client' + D;
+
+    viewport['get' + D] = function() { return element[property[D]] };
+    return viewport['get' + D]();
+  }
+
+  viewport.getWidth  = define.curry('Width');
+
+  viewport.getHeight = define.curry('Height');
+})(document.viewport);
+
+
+Element.Storage = {
+  UID: 1
+};
+
+Element.addMethods({
+  getStorage: function(element) {
+    if (!(element = $(element))) return;
+
+    var uid;
+    if (element === window) {
+      uid = 0;
+    } else {
+      if (typeof element._prototypeUID === "undefined")
+        element._prototypeUID = Element.Storage.UID++;
+      uid = element._prototypeUID;
+    }
+
+    if (!Element.Storage[uid])
+      Element.Storage[uid] = $H();
+
+    return Element.Storage[uid];
+  },
+
+  store: function(element, key, value) {
+    if (!(element = $(element))) return;
+
+    if (arguments.length === 2) {
+      Element.getStorage(element).update(key);
+    } else {
+      Element.getStorage(element).set(key, value);
+    }
+
+    return element;
+  },
+
+  retrieve: function(element, key, defaultValue) {
+    if (!(element = $(element))) return;
+    var hash = Element.getStorage(element), value = hash.get(key);
+
+    if (Object.isUndefined(value)) {
+      hash.set(key, defaultValue);
+      value = defaultValue;
+    }
+
+    return value;
+  },
+
+  clone: function(element, deep) {
+    if (!(element = $(element))) return;
+    var clone = element.cloneNode(deep);
+    clone._prototypeUID = void 0;
+    if (deep) {
+      var descendants = Element.select(clone, '*'),
+          i = descendants.length;
+      while (i--) {
+        descendants[i]._prototypeUID = void 0;
+      }
+    }
+    return Element.extend(clone);
+  },
+
+  purge: function(element) {
+    if (!(element = $(element))) return;
+    var purgeElement = Element._purgeElement;
+
+    purgeElement(element);
+
+    var descendants = element.getElementsByTagName('*'),
+     i = descendants.length;
+
+    while (i--) purgeElement(descendants[i]);
+
+    return null;
+  }
+});
+
+(function() {
+
+  function toDecimal(pctString) {
+    var match = pctString.match(/^(\d+)%?$/i);
+    if (!match) return null;
+    return (Number(match[1]) / 100);
+  }
+
+  function getPixelValue(value, property, context) {
+    var element = null;
+    if (Object.isElement(value)) {
+      element = value;
+      value = element.getStyle(property);
+    }
+
+    if (value === null) {
+      return null;
+    }
+
+    if ((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(value)) {
+      return window.parseFloat(value);
+    }
+
+    var isPercentage = value.include('%'), isViewport = (context === document.viewport);
+
+    if (/\d/.test(value) && element && element.runtimeStyle && !(isPercentage && isViewport)) {
+      var style = element.style.left, rStyle = element.runtimeStyle.left;
+      element.runtimeStyle.left = element.currentStyle.left;
+      element.style.left = value || 0;
+      value = element.style.pixelLeft;
+      element.style.left = style;
+      element.runtimeStyle.left = rStyle;
+
+      return value;
+    }
+
+    if (element && isPercentage) {
+      context = context || element.parentNode;
+      var decimal = toDecimal(value);
+      var whole = null;
+      var position = element.getStyle('position');
+
+      var isHorizontal = property.include('left') || property.include('right') ||
+       property.include('width');
+
+      var isVertical =  property.include('top') || property.include('bottom') ||
+        property.include('height');
+
+      if (context === document.viewport) {
+        if (isHorizontal) {
+          whole = document.viewport.getWidth();
+        } else if (isVertical) {
+          whole = document.viewport.getHeight();
+        }
+      } else {
+        if (isHorizontal) {
+          whole = $(context).measure('width');
+        } else if (isVertical) {
+          whole = $(context).measure('height');
+        }
+      }
+
+      return (whole === null) ? 0 : whole * decimal;
+    }
+
+    return 0;
+  }
+
+  function toCSSPixels(number) {
+    if (Object.isString(number) && number.endsWith('px')) {
+      return number;
+    }
+    return number + 'px';
+  }
+
+  function isDisplayed(element) {
+    var originalElement = element;
+    while (element && element.parentNode) {
+      var display = element.getStyle('display');
+      if (display === 'none') {
+        return false;
+      }
+      element = $(element.parentNode);
+    }
+    return true;
+  }
+
+  var hasLayout = Prototype.K;
+  if ('currentStyle' in document.documentElement) {
+    hasLayout = function(element) {
+      if (!element.currentStyle.hasLayout) {
+        element.style.zoom = 1;
+      }
+      return element;
+    };
+  }
+
+  function cssNameFor(key) {
+    if (key.include('border')) key = key + '-width';
+    return key.camelize();
+  }
+
+  Element.Layout = Class.create(Hash, {
+    initialize: function($super, element, preCompute) {
+      $super();
+      this.element = $(element);
+
+      Element.Layout.PROPERTIES.each( function(property) {
+        this._set(property, null);
+      }, this);
+
+      if (preCompute) {
+        this._preComputing = true;
+        this._begin();
+        Element.Layout.PROPERTIES.each( this._compute, this );
+        this._end();
+        this._preComputing = false;
+      }
+    },
+
+    _set: function(property, value) {
+      return Hash.prototype.set.call(this, property, value);
+    },
+
+    set: function(property, value) {
+      throw "Properties of Element.Layout are read-only.";
+    },
+
+    get: function($super, property) {
+      var value = $super(property);
+      return value === null ? this._compute(property) : value;
+    },
+
+    _begin: function() {
+      if (this._prepared) return;
+
+      var element = this.element;
+      if (isDisplayed(element)) {
+        this._prepared = true;
+        return;
+      }
+
+      var originalStyles = {
+        position:   element.style.position   || '',
+        width:      element.style.width      || '',
+        visibility: element.style.visibility || '',
+        display:    element.style.display    || ''
+      };
+
+      element.store('prototype_original_styles', originalStyles);
+
+      var position = element.getStyle('position'),
+       width = element.getStyle('width');
+
+      if (width === "0px" || width === null) {
+        element.style.display = 'block';
+        width = element.getStyle('width');
+      }
+
+      var context = (position === 'fixed') ? document.viewport :
+       element.parentNode;
+
+      element.setStyle({
+        position:   'absolute',
+        visibility: 'hidden',
+        display:    'block'
+      });
+
+      var positionedWidth = element.getStyle('width');
+
+      var newWidth;
+      if (width && (positionedWidth === width)) {
+        newWidth = getPixelValue(element, 'width', context);
+      } else if (position === 'absolute' || position === 'fixed') {
+        newWidth = getPixelValue(element, 'width', context);
+      } else {
+        var parent = element.parentNode, pLayout = $(parent).getLayout();
+
+        newWidth = pLayout.get('width') -
+         this.get('margin-left') -
+         this.get('border-left') -
+         this.get('padding-left') -
+         this.get('padding-right') -
+         this.get('border-right') -
+         this.get('margin-right');
+      }
+
+      element.setStyle({ width: newWidth + 'px' });
+
+      this._prepared = true;
+    },
+
+    _end: function() {
+      var element = this.element;
+      var originalStyles = element.retrieve('prototype_original_styles');
+      element.store('prototype_original_styles', null);
+      element.setStyle(originalStyles);
+      this._prepared = false;
+    },
+
+    _compute: function(property) {
+      var COMPUTATIONS = Element.Layout.COMPUTATIONS;
+      if (!(property in COMPUTATIONS)) {
+        throw "Property not found.";
+      }
+
+      return this._set(property, COMPUTATIONS[property].call(this, this.element));
+    },
+
+    toObject: function() {
+      var args = $A(arguments);
+      var keys = (args.length === 0) ? Element.Layout.PROPERTIES :
+       args.join(' ').split(' ');
+      var obj = {};
+      keys.each( function(key) {
+        if (!Element.Layout.PROPERTIES.include(key)) return;
+        var value = this.get(key);
+        if (value != null) obj[key] = value;
+      }, this);
+      return obj;
+    },
+
+    toHash: function() {
+      var obj = this.toObject.apply(this, arguments);
+      return new Hash(obj);
+    },
+
+    toCSS: function() {
+      var args = $A(arguments);
+      var keys = (args.length === 0) ? Element.Layout.PROPERTIES :
+       args.join(' ').split(' ');
+      var css = {};
+
+      keys.each( function(key) {
+        if (!Element.Layout.PROPERTIES.include(key)) return;
+        if (Element.Layout.COMPOSITE_PROPERTIES.include(key)) return;
+
+        var value = this.get(key);
+        if (value != null) css[cssNameFor(key)] = value + 'px';
+      }, this);
+      return css;
+    },
+
+    inspect: function() {
+      return "#<Element.Layout>";
+    }
+  });
+
+  Object.extend(Element.Layout, {
+    PROPERTIES: $w('height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height'),
+
+    COMPOSITE_PROPERTIES: $w('padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height'),
+
+    COMPUTATIONS: {
+      'height': function(element) {
+        if (!this._preComputing) this._begin();
+
+        var bHeight = this.get('border-box-height');
+        if (bHeight <= 0) {
+          if (!this._preComputing) this._end();
+          return 0;
+        }
+
+        var bTop = this.get('border-top'),
+         bBottom = this.get('border-bottom');
+
+        var pTop = this.get('padding-top'),
+         pBottom = this.get('padding-bottom');
+
+        if (!this._preComputing) this._end();
+
+        return bHeight - bTop - bBottom - pTop - pBottom;
+      },
+
+      'width': function(element) {
+        if (!this._preComputing) this._begin();
+
+        var bWidth = this.get('border-box-width');
+        if (bWidth <= 0) {
+          if (!this._preComputing) this._end();
+          return 0;
+        }
+
+        var bLeft = this.get('border-left'),
+         bRight = this.get('border-right');
+
+        var pLeft = this.get('padding-left'),
+         pRight = this.get('padding-right');
+
+        if (!this._preComputing) this._end();
+
+        return bWidth - bLeft - bRight - pLeft - pRight;
+      },
+
+      'padding-box-height': function(element) {
+        var height = this.get('height'),
+         pTop = this.get('padding-top'),
+         pBottom = this.get('padding-bottom');
+
+        return height + pTop + pBottom;
+      },
+
+      'padding-box-width': function(element) {
+        var width = this.get('width'),
+         pLeft = this.get('padding-left'),
+         pRight = this.get('padding-right');
+
+        return width + pLeft + pRight;
+      },
+
+      'border-box-height': function(element) {
+        if (!this._preComputing) this._begin();
+        var height = element.offsetHeight;
+        if (!this._preComputing) this._end();
+        return height;
+      },
+
+      'border-box-width': function(element) {
+        if (!this._preComputing) this._begin();
+        var width = element.offsetWidth;
+        if (!this._preComputing) this._end();
+        return width;
+      },
+
+      'margin-box-height': function(element) {
+        var bHeight = this.get('border-box-height'),
+         mTop = this.get('margin-top'),
+         mBottom = this.get('margin-bottom');
+
+        if (bHeight <= 0) return 0;
+
+        return bHeight + mTop + mBottom;
+      },
+
+      'margin-box-width': function(element) {
+        var bWidth = this.get('border-box-width'),
+         mLeft = this.get('margin-left'),
+         mRight = this.get('margin-right');
+
+        if (bWidth <= 0) return 0;
+
+        return bWidth + mLeft + mRight;
+      },
+
+      'top': function(element) {
+        var offset = element.positionedOffset();
+        return offset.top;
+      },
+
+      'bottom': function(element) {
+        var offset = element.positionedOffset(),
+         parent = element.getOffsetParent(),
+         pHeight = parent.measure('height');
+
+        var mHeight = this.get('border-box-height');
+
+        return pHeight - mHeight - offset.top;
+      },
+
+      'left': function(element) {
+        var offset = element.positionedOffset();
+        return offset.left;
+      },
+
+      'right': function(element) {
+        var offset = element.positionedOffset(),
+         parent = element.getOffsetParent(),
+         pWidth = parent.measure('width');
+
+        var mWidth = this.get('border-box-width');
+
+        return pWidth - mWidth - offset.left;
+      },
+
+      'padding-top': function(element) {
+        return getPixelValue(element, 'paddingTop');
+      },
+
+      'padding-bottom': function(element) {
+        return getPixelValue(element, 'paddingBottom');
+      },
+
+      'padding-left': function(element) {
+        return getPixelValue(element, 'paddingLeft');
+      },
+
+      'padding-right': function(element) {
+        return getPixelValue(element, 'paddingRight');
+      },
+
+      'border-top': function(element) {
+        return getPixelValue(element, 'borderTopWidth');
+      },
+
+      'border-bottom': function(element) {
+        return getPixelValue(element, 'borderBottomWidth');
+      },
+
+      'border-left': function(element) {
+        return getPixelValue(element, 'borderLeftWidth');
+      },
+
+      'border-right': function(element) {
+        return getPixelValue(element, 'borderRightWidth');
+      },
+
+      'margin-top': function(element) {
+        return getPixelValue(element, 'marginTop');
+      },
+
+      'margin-bottom': function(element) {
+        return getPixelValue(element, 'marginBottom');
+      },
+
+      'margin-left': function(element) {
+        return getPixelValue(element, 'marginLeft');
+      },
+
+      'margin-right': function(element) {
+        return getPixelValue(element, 'marginRight');
+      }
+    }
+  });
+
+  if ('getBoundingClientRect' in document.documentElement) {
+    Object.extend(Element.Layout.COMPUTATIONS, {
+      'right': function(element) {
+        var parent = hasLayout(element.getOffsetParent());
+        var rect = element.getBoundingClientRect(),
+         pRect = parent.getBoundingClientRect();
+
+        return (pRect.right - rect.right).round();
+      },
+
+      'bottom': function(element) {
+        var parent = hasLayout(element.getOffsetParent());
+        var rect = element.getBoundingClientRect(),
+         pRect = parent.getBoundingClientRect();
+
+        return (pRect.bottom - rect.bottom).round();
+      }
+    });
+  }
+
+  Element.Offset = Class.create({
+    initialize: function(left, top) {
+      this.left = left.round();
+      this.top  = top.round();
+
+      this[0] = this.left;
+      this[1] = this.top;
+    },
+
+    relativeTo: function(offset) {
+      return new Element.Offset(
+        this.left - offset.left,
+        this.top  - offset.top
+      );
+    },
+
+    inspect: function() {
+      return "#<Element.Offset left: #{left} top: #{top}>".interpolate(this);
+    },
+
+    toString: function() {
+      return "[#{left}, #{top}]".interpolate(this);
+    },
+
+    toArray: function() {
+      return [this.left, this.top];
+    }
+  });
+
+  function getLayout(element, preCompute) {
+    return new Element.Layout(element, preCompute);
+  }
+
+  function measure(element, property) {
+    return $(element).getLayout().get(property);
+  }
+
+  function getDimensions(element) {
+    element = $(element);
+    var display = Element.getStyle(element, 'display');
+
+    if (display && display !== 'none') {
+      return { width: element.offsetWidth, height: element.offsetHeight };
+    }
+
+    var style = element.style;
+    var originalStyles = {
+      visibility: style.visibility,
+      position:   style.position,
+      display:    style.display
+    };
+
+    var newStyles = {
+      visibility: 'hidden',
+      display:    'block'
+    };
+
+    if (originalStyles.position !== 'fixed')
+      newStyles.position = 'absolute';
+
+    Element.setStyle(element, newStyles);
+
+    var dimensions = {
+      width:  element.offsetWidth,
+      height: element.offsetHeight
+    };
+
+    Element.setStyle(element, originalStyles);
+
+    return dimensions;
+  }
+
+  function getOffsetParent(element) {
+    element = $(element);
+
+    if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element))
+      return $(document.body);
+
+    var isInline = (Element.getStyle(element, 'display') === 'inline');
+    if (!isInline && element.offsetParent) return $(element.offsetParent);
+
+    while ((element = element.parentNode) && element !== document.body) {
+      if (Element.getStyle(element, 'position') !== 'static') {
+        return isHtml(element) ? $(document.body) : $(element);
+      }
+    }
+
+    return $(document.body);
+  }
+
+
+  function cumulativeOffset(element) {
+    element = $(element);
+    var valueT = 0, valueL = 0;
+    if (element.parentNode) {
+      do {
+        valueT += element.offsetTop  || 0;
+        valueL += element.offsetLeft || 0;
+        element = element.offsetParent;
+      } while (element);
+    }
+    return new Element.Offset(valueL, valueT);
+  }
+
+  function positionedOffset(element) {
+    element = $(element);
+
+    var layout = element.getLayout();
+
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      element = element.offsetParent;
+      if (element) {
+        if (isBody(element)) break;
+        var p = Element.getStyle(element, 'position');
+        if (p !== 'static') break;
+      }
+    } while (element);
+
+    valueL -= layout.get('margin-top');
+    valueT -= layout.get('margin-left');
+
+    return new Element.Offset(valueL, valueT);
+  }
+
+  function cumulativeScrollOffset(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.scrollTop  || 0;
+      valueL += element.scrollLeft || 0;
+      element = element.parentNode;
+    } while (element);
+    return new Element.Offset(valueL, valueT);
+  }
+
+  function viewportOffset(forElement) {
+    element = $(element);
+    var valueT = 0, valueL = 0, docBody = document.body;
+
+    var element = forElement;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      if (element.offsetParent == docBody &&
+        Element.getStyle(element, 'position') == 'absolute') break;
+    } while (element = element.offsetParent);
+
+    element = forElement;
+    do {
+      if (element != docBody) {
+        valueT -= element.scrollTop  || 0;
+        valueL -= element.scrollLeft || 0;
+      }
+    } while (element = element.parentNode);
+    return new Element.Offset(valueL, valueT);
+  }
+
+  function absolutize(element) {
+    element = $(element);
+
+    if (Element.getStyle(element, 'position') === 'absolute') {
+      return element;
+    }
+
+    var offsetParent = getOffsetParent(element);
+    var eOffset = element.viewportOffset(),
+     pOffset = offsetParent.viewportOffset();
+
+    var offset = eOffset.relativeTo(pOffset);
+    var layout = element.getLayout();
+
+    element.store('prototype_absolutize_original_styles', {
+      left:   element.getStyle('left'),
+      top:    element.getStyle('top'),
+      width:  element.getStyle('width'),
+      height: element.getStyle('height')
+    });
+
+    element.setStyle({
+      position: 'absolute',
+      top:    offset.top + 'px',
+      left:   offset.left + 'px',
+      width:  layout.get('width') + 'px',
+      height: layout.get('height') + 'px'
+    });
+
+    return element;
+  }
+
+  function relativize(element) {
+    element = $(element);
+    if (Element.getStyle(element, 'position') === 'relative') {
+      return element;
+    }
+
+    var originalStyles =
+     element.retrieve('prototype_absolutize_original_styles');
+
+    if (originalStyles) element.setStyle(originalStyles);
+    return element;
+  }
+
+  if (Prototype.Browser.IE) {
+    getOffsetParent = getOffsetParent.wrap(
+      function(proceed, element) {
+        element = $(element);
+
+        if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element))
+          return $(document.body);
+
+        var position = element.getStyle('position');
+        if (position !== 'static') return proceed(element);
+
+        element.setStyle({ position: 'relative' });
+        var value = proceed(element);
+        element.setStyle({ position: position });
+        return value;
+      }
+    );
+
+    positionedOffset = positionedOffset.wrap(function(proceed, element) {
+      element = $(element);
+      if (!element.parentNode) return new Element.Offset(0, 0);
+      var position = element.getStyle('position');
+      if (position !== 'static') return proceed(element);
+
+      var offsetParent = element.getOffsetParent();
+      if (offsetParent && offsetParent.getStyle('position') === 'fixed')
+        hasLayout(offsetParent);
+
+      element.setStyle({ position: 'relative' });
+      var value = proceed(element);
+      element.setStyle({ position: position });
+      return value;
+    });
+  } else if (Prototype.Browser.Webkit) {
+    cumulativeOffset = function(element) {
+      element = $(element);
+      var valueT = 0, valueL = 0;
+      do {
+        valueT += element.offsetTop  || 0;
+        valueL += element.offsetLeft || 0;
+        if (element.offsetParent == document.body)
+          if (Element.getStyle(element, 'position') == 'absolute') break;
+
+        element = element.offsetParent;
+      } while (element);
+
+      return new Element.Offset(valueL, valueT);
+    };
+  }
+
+
+  Element.addMethods({
+    getLayout:              getLayout,
+    measure:                measure,
+    getDimensions:          getDimensions,
+    getOffsetParent:        getOffsetParent,
+    cumulativeOffset:       cumulativeOffset,
+    positionedOffset:       positionedOffset,
+    cumulativeScrollOffset: cumulativeScrollOffset,
+    viewportOffset:         viewportOffset,
+    absolutize:             absolutize,
+    relativize:             relativize
+  });
+
+  function isBody(element) {
+    return element.nodeName.toUpperCase() === 'BODY';
+  }
+
+  function isHtml(element) {
+    return element.nodeName.toUpperCase() === 'HTML';
+  }
+
+  function isDocument(element) {
+    return element.nodeType === Node.DOCUMENT_NODE;
+  }
+
+  function isDetached(element) {
+    return element !== document.body &&
+     !Element.descendantOf(element, document.body);
+  }
+
+  if ('getBoundingClientRect' in document.documentElement) {
+    Element.addMethods({
+      viewportOffset: function(element) {
+        element = $(element);
+        if (isDetached(element)) return new Element.Offset(0, 0);
+
+        var rect = element.getBoundingClientRect(),
+         docEl = document.documentElement;
+        return new Element.Offset(rect.left - docEl.clientLeft,
+         rect.top - docEl.clientTop);
+      }
+    });
+  }
+})();
+window.$$ = function() {
+  var expression = $A(arguments).join(', ');
+  return Prototype.Selector.select(expression, document);
+};
+
+Prototype.Selector = (function() {
+
+  function select() {
+    throw new Error('Method "Prototype.Selector.select" must be defined.');
+  }
+
+  function match() {
+    throw new Error('Method "Prototype.Selector.match" must be defined.');
+  }
+
+  function find(elements, expression, index) {
+    index = index || 0;
+    var match = Prototype.Selector.match, length = elements.length, matchIndex = 0, i;
+
+    for (i = 0; i < length; i++) {
+      if (match(elements[i], expression) && index == matchIndex++) {
+        return Element.extend(elements[i]);
+      }
+    }
+  }
+
+  function extendElements(elements) {
+    for (var i = 0, length = elements.length; i < length; i++) {
+      Element.extend(elements[i]);
+    }
+    return elements;
+  }
+
+
+  var K = Prototype.K;
+
+  return {
+    select: select,
+    match: match,
+    find: find,
+    extendElements: (Element.extend === K) ? K : extendElements,
+    extendElement: Element.extend
+  };
+})();
+Prototype._original_property = window.Sizzle;
+/*!
+ * Sizzle CSS Selector Engine - v1.0
+ *  Copyright 2009, The Dojo Foundation
+ *  Released under the MIT, BSD, and GPL Licenses.
+ *  More information: http://sizzlejs.com/
+ */
+(function(){
+
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+       done = 0,
+       toString = Object.prototype.toString,
+       hasDuplicate = false,
+       baseHasDuplicate = true;
+
+[0, 0].sort(function(){
+       baseHasDuplicate = false;
+       return 0;
+});
+
+var Sizzle = function(selector, context, results, seed) {
+       results = results || [];
+       var origContext = context = context || document;
+
+       if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
+               return [];
+       }
+
+       if ( !selector || typeof selector !== "string" ) {
+               return results;
+       }
+
+       var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context),
+               soFar = selector;
+
+       while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) {
+               soFar = m[3];
+
+               parts.push( m[1] );
+
+               if ( m[2] ) {
+                       extra = m[3];
+                       break;
+               }
+       }
+
+       if ( parts.length > 1 && origPOS.exec( selector ) ) {
+               if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+                       set = posProcess( parts[0] + parts[1], context );
+               } else {
+                       set = Expr.relative[ parts[0] ] ?
+                               [ context ] :
+                               Sizzle( parts.shift(), context );
+
+                       while ( parts.length ) {
+                               selector = parts.shift();
+
+                               if ( Expr.relative[ selector ] )
+                                       selector += parts.shift();
+
+                               set = posProcess( selector, set );
+                       }
+               }
+       } else {
+               if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
+                               Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
+                       var ret = Sizzle.find( parts.shift(), context, contextXML );
+                       context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
+               }
+
+               if ( context ) {
+                       var ret = seed ?
+                               { expr: parts.pop(), set: makeArray(seed) } :
+                               Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
+                       set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
+
+                       if ( parts.length > 0 ) {
+                               checkSet = makeArray(set);
+                       } else {
+                               prune = false;
+                       }
+
+                       while ( parts.length ) {
+                               var cur = parts.pop(), pop = cur;
+
+                               if ( !Expr.relative[ cur ] ) {
+                                       cur = "";
+                               } else {
+                                       pop = parts.pop();
+                               }
+
+                               if ( pop == null ) {
+                                       pop = context;
+                               }
+
+                               Expr.relative[ cur ]( checkSet, pop, contextXML );
+                       }
+               } else {
+                       checkSet = parts = [];
+               }
+       }
+
+       if ( !checkSet ) {
+               checkSet = set;
+       }
+
+       if ( !checkSet ) {
+               throw "Syntax error, unrecognized expression: " + (cur || selector);
+       }
+
+       if ( toString.call(checkSet) === "[object Array]" ) {
+               if ( !prune ) {
+                       results.push.apply( results, checkSet );
+               } else if ( context && context.nodeType === 1 ) {
+                       for ( var i = 0; checkSet[i] != null; i++ ) {
+                               if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
+                                       results.push( set[i] );
+                               }
+                       }
+               } else {
+                       for ( var i = 0; checkSet[i] != null; i++ ) {
+                               if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+                                       results.push( set[i] );
+                               }
+                       }
+               }
+       } else {
+               makeArray( checkSet, results );
+       }
+
+       if ( extra ) {
+               Sizzle( extra, origContext, results, seed );
+               Sizzle.uniqueSort( results );
+       }
+
+       return results;
+};
+
+Sizzle.uniqueSort = function(results){
+       if ( sortOrder ) {
+               hasDuplicate = baseHasDuplicate;
+               results.sort(sortOrder);
+
+               if ( hasDuplicate ) {
+                       for ( var i = 1; i < results.length; i++ ) {
+                               if ( results[i] === results[i-1] ) {
+                                       results.splice(i--, 1);
+                               }
+                       }
+               }
+       }
+
+       return results;
+};
+
+Sizzle.matches = function(expr, set){
+       return Sizzle(expr, null, null, set);
+};
+
+Sizzle.find = function(expr, context, isXML){
+       var set, match;
+
+       if ( !expr ) {
+               return [];
+       }
+
+       for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
+               var type = Expr.order[i], match;
+
+               if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
+                       var left = match[1];
+                       match.splice(1,1);
+
+                       if ( left.substr( left.length - 1 ) !== "\\" ) {
+                               match[1] = (match[1] || "").replace(/\\/g, "");
+                               set = Expr.find[ type ]( match, context, isXML );
+                               if ( set != null ) {
+                                       expr = expr.replace( Expr.match[ type ], "" );
+                                       break;
+                               }
+                       }
+               }
+       }
+
+       if ( !set ) {
+               set = context.getElementsByTagName("*");
+       }
+
+       return {set: set, expr: expr};
+};
+
+Sizzle.filter = function(expr, set, inplace, not){
+       var old = expr, result = [], curLoop = set, match, anyFound,
+               isXMLFilter = set && set[0] && isXML(set[0]);
+
+       while ( expr && set.length ) {
+               for ( var type in Expr.filter ) {
+                       if ( (match = Expr.match[ type ].exec( expr )) != null ) {
+                               var filter = Expr.filter[ type ], found, item;
+                               anyFound = false;
+
+                               if ( curLoop == result ) {
+                                       result = [];
+                               }
+
+                               if ( Expr.preFilter[ type ] ) {
+                                       match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+                                       if ( !match ) {
+                                               anyFound = found = true;
+                                       } else if ( match === true ) {
+                                               continue;
+                                       }
+                               }
+
+                               if ( match ) {
+                                       for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
+                                               if ( item ) {
+                                                       found = filter( item, match, i, curLoop );
+                                                       var pass = not ^ !!found;
+
+                                                       if ( inplace && found != null ) {
+                                                               if ( pass ) {
+                                                                       anyFound = true;
+                                                               } else {
+                                                                       curLoop[i] = false;
+                                                               }
+                                                       } else if ( pass ) {
+                                                               result.push( item );
+                                                               anyFound = true;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               if ( found !== undefined ) {
+                                       if ( !inplace ) {
+                                               curLoop = result;
+                                       }
+
+                                       expr = expr.replace( Expr.match[ type ], "" );
+
+                                       if ( !anyFound ) {
+                                               return [];
+                                       }
+
+                                       break;
+                               }
+                       }
+               }
+
+               if ( expr == old ) {
+                       if ( anyFound == null ) {
+                               throw "Syntax error, unrecognized expression: " + expr;
+                       } else {
+                               break;
+                       }
+               }
+
+               old = expr;
+       }
+
+       return curLoop;
+};
+
+var Expr = Sizzle.selectors = {
+       order: [ "ID", "NAME", "TAG" ],
+       match: {
+               ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
+               CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
+               NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
+               ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
+               TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,
+               CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
+               POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
+               PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
+       },
+       leftMatch: {},
+       attrMap: {
+               "class": "className",
+               "for": "htmlFor"
+       },
+       attrHandle: {
+               href: function(elem){
+                       return elem.getAttribute("href");
+               }
+       },
+       relative: {
+               "+": function(checkSet, part, isXML){
+                       var isPartStr = typeof part === "string",
+                               isTag = isPartStr && !/\W/.test(part),
+                               isPartStrNotTag = isPartStr && !isTag;
+
+                       if ( isTag && !isXML ) {
+                               part = part.toUpperCase();
+                       }
+
+                       for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+                               if ( (elem = checkSet[i]) ) {
+                                       while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
+
+                                       checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
+                                               elem || false :
+                                               elem === part;
+                               }
+                       }
+
+                       if ( isPartStrNotTag ) {
+                               Sizzle.filter( part, checkSet, true );
+                       }
+               },
+               ">": function(checkSet, part, isXML){
+                       var isPartStr = typeof part === "string";
+
+                       if ( isPartStr && !/\W/.test(part) ) {
+                               part = isXML ? part : part.toUpperCase();
+
+                               for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+                                       var elem = checkSet[i];
+                                       if ( elem ) {
+                                               var parent = elem.parentNode;
+                                               checkSet[i] = parent.nodeName === part ? parent : false;
+                                       }
+                               }
+                       } else {
+                               for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+                                       var elem = checkSet[i];
+                                       if ( elem ) {
+                                               checkSet[i] = isPartStr ?
+                                                       elem.parentNode :
+                                                       elem.parentNode === part;
+                                       }
+                               }
+
+                               if ( isPartStr ) {
+                                       Sizzle.filter( part, checkSet, true );
+                               }
+                       }
+               },
+               "": function(checkSet, part, isXML){
+                       var doneName = done++, checkFn = dirCheck;
+
+                       if ( !/\W/.test(part) ) {
+                               var nodeCheck = part = isXML ? part : part.toUpperCase();
+                               checkFn = dirNodeCheck;
+                       }
+
+                       checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
+               },
+               "~": function(checkSet, part, isXML){
+                       var doneName = done++, checkFn = dirCheck;
+
+                       if ( typeof part === "string" && !/\W/.test(part) ) {
+                               var nodeCheck = part = isXML ? part : part.toUpperCase();
+                               checkFn = dirNodeCheck;
+                       }
+
+                       checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
+               }
+       },
+       find: {
+               ID: function(match, context, isXML){
+                       if ( typeof context.getElementById !== "undefined" && !isXML ) {
+                               var m = context.getElementById(match[1]);
+                               return m ? [m] : [];
+                       }
+               },
+               NAME: function(match, context, isXML){
+                       if ( typeof context.getElementsByName !== "undefined" ) {
+                               var ret = [], results = context.getElementsByName(match[1]);
+
+                               for ( var i = 0, l = results.length; i < l; i++ ) {
+                                       if ( results[i].getAttribute("name") === match[1] ) {
+                                               ret.push( results[i] );
+                                       }
+                               }
+
+                               return ret.length === 0 ? null : ret;
+                       }
+               },
+               TAG: function(match, context){
+                       return context.getElementsByTagName(match[1]);
+               }
+       },
+       preFilter: {
+               CLASS: function(match, curLoop, inplace, result, not, isXML){
+                       match = " " + match[1].replace(/\\/g, "") + " ";
+
+                       if ( isXML ) {
+                               return match;
+                       }
+
+                       for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+                               if ( elem ) {
+                                       if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
+                                               if ( !inplace )
+                                                       result.push( elem );
+                                       } else if ( inplace ) {
+                                               curLoop[i] = false;
+                                       }
+                               }
+                       }
+
+                       return false;
+               },
+               ID: function(match){
+                       return match[1].replace(/\\/g, "");
+               },
+               TAG: function(match, curLoop){
+                       for ( var i = 0; curLoop[i] === false; i++ ){}
+                       return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
+               },
+               CHILD: function(match){
+                       if ( match[1] == "nth" ) {
+                               var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+                                       match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
+                                       !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+                               match[2] = (test[1] + (test[2] || 1)) - 0;
+                               match[3] = test[3] - 0;
+                       }
+
+                       match[0] = done++;
+
+                       return match;
+               },
+               ATTR: function(match, curLoop, inplace, result, not, isXML){
+                       var name = match[1].replace(/\\/g, "");
+
+                       if ( !isXML && Expr.attrMap[name] ) {
+                               match[1] = Expr.attrMap[name];
+                       }
+
+                       if ( match[2] === "~=" ) {
+                               match[4] = " " + match[4] + " ";
+                       }
+
+                       return match;
+               },
+               PSEUDO: function(match, curLoop, inplace, result, not){
+                       if ( match[1] === "not" ) {
+                               if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
+                                       match[3] = Sizzle(match[3], null, null, curLoop);
+                               } else {
+                                       var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+                                       if ( !inplace ) {
+                                               result.push.apply( result, ret );
+                                       }
+                                       return false;
+                               }
+                       } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
+                               return true;
+                       }
+
+                       return match;
+               },
+               POS: function(match){
+                       match.unshift( true );
+                       return match;
+               }
+       },
+       filters: {
+               enabled: function(elem){
+                       return elem.disabled === false && elem.type !== "hidden";
+               },
+               disabled: function(elem){
+                       return elem.disabled === true;
+               },
+               checked: function(elem){
+                       return elem.checked === true;
+               },
+               selected: function(elem){
+                       elem.parentNode.selectedIndex;
+                       return elem.selected === true;
+               },
+               parent: function(elem){
+                       return !!elem.firstChild;
+               },
+               empty: function(elem){
+                       return !elem.firstChild;
+               },
+               has: function(elem, i, match){
+                       return !!Sizzle( match[3], elem ).length;
+               },
+               header: function(elem){
+                       return /h\d/i.test( elem.nodeName );
+               },
+               text: function(elem){
+                       return "text" === elem.type;
+               },
+               radio: function(elem){
+                       return "radio" === elem.type;
+               },
+               checkbox: function(elem){
+                       return "checkbox" === elem.type;
+               },
+               file: function(elem){
+                       return "file" === elem.type;
+               },
+               password: function(elem){
+                       return "password" === elem.type;
+               },
+               submit: function(elem){
+                       return "submit" === elem.type;
+               },
+               image: function(elem){
+                       return "image" === elem.type;
+               },
+               reset: function(elem){
+                       return "reset" === elem.type;
+               },
+               button: function(elem){
+                       return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
+               },
+               input: function(elem){
+                       return /input|select|textarea|button/i.test(elem.nodeName);
+               }
+       },
+       setFilters: {
+               first: function(elem, i){
+                       return i === 0;
+               },
+               last: function(elem, i, match, array){
+                       return i === array.length - 1;
+               },
+               even: function(elem, i){
+                       return i % 2 === 0;
+               },
+               odd: function(elem, i){
+                       return i % 2 === 1;
+               },
+               lt: function(elem, i, match){
+                       return i < match[3] - 0;
+               },
+               gt: function(elem, i, match){
+                       return i > match[3] - 0;
+               },
+               nth: function(elem, i, match){
+                       return match[3] - 0 == i;
+               },
+               eq: function(elem, i, match){
+                       return match[3] - 0 == i;
+               }
+       },
+       filter: {
+               PSEUDO: function(elem, match, i, array){
+                       var name = match[1], filter = Expr.filters[ name ];
+
+                       if ( filter ) {
+                               return filter( elem, i, match, array );
+                       } else if ( name === "contains" ) {
+                               return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
+                       } else if ( name === "not" ) {
+                               var not = match[3];
+
+                               for ( var i = 0, l = not.length; i < l; i++ ) {
+                                       if ( not[i] === elem ) {
+                                               return false;
+                                       }
+                               }
+
+                               return true;
+                       }
+               },
+               CHILD: function(elem, match){
+                       var type = match[1], node = elem;
+                       switch (type) {
+                               case 'only':
+                               case 'first':
+                                       while ( (node = node.previousSibling) )  {
+                                               if ( node.nodeType === 1 ) return false;
+                                       }
+                                       if ( type == 'first') return true;
+                                       node = elem;
+                               case 'last':
+                                       while ( (node = node.nextSibling) )  {
+                                               if ( node.nodeType === 1 ) return false;
+                                       }
+                                       return true;
+                               case 'nth':
+                                       var first = match[2], last = match[3];
+
+                                       if ( first == 1 && last == 0 ) {
+                                               return true;
+                                       }
+
+                                       var doneName = match[0],
+                                               parent = elem.parentNode;
+
+                                       if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
+                                               var count = 0;
+                                               for ( node = parent.firstChild; node; node = node.nextSibling ) {
+                                                       if ( node.nodeType === 1 ) {
+                                                               node.nodeIndex = ++count;
+                                                       }
+                                               }
+                                               parent.sizcache = doneName;
+                                       }
+
+                                       var diff = elem.nodeIndex - last;
+                                       if ( first == 0 ) {
+                                               return diff == 0;
+                                       } else {
+                                               return ( diff % first == 0 && diff / first >= 0 );
+                                       }
+                       }
+               },
+               ID: function(elem, match){
+                       return elem.nodeType === 1 && elem.getAttribute("id") === match;
+               },
+               TAG: function(elem, match){
+                       return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
+               },
+               CLASS: function(elem, match){
+                       return (" " + (elem.className || elem.getAttribute("class")) + " ")
+                               .indexOf( match ) > -1;
+               },
+               ATTR: function(elem, match){
+                       var name = match[1],
+                               result = Expr.attrHandle[ name ] ?
+                                       Expr.attrHandle[ name ]( elem ) :
+                                       elem[ name ] != null ?
+                                               elem[ name ] :
+                                               elem.getAttribute( name ),
+                               value = result + "",
+                               type = match[2],
+                               check = match[4];
+
+                       return result == null ?
+                               type === "!=" :
+                               type === "=" ?
+                               value === check :
+                               type === "*=" ?
+                               value.indexOf(check) >= 0 :
+                               type === "~=" ?
+                               (" " + value + " ").indexOf(check) >= 0 :
+                               !check ?
+                               value && result !== false :
+                               type === "!=" ?
+                               value != check :
+                               type === "^=" ?
+                               value.indexOf(check) === 0 :
+                               type === "$=" ?
+                               value.substr(value.length - check.length) === check :
+                               type === "|=" ?
+                               value === check || value.substr(0, check.length + 1) === check + "-" :
+                               false;
+               },
+               POS: function(elem, match, i, array){
+                       var name = match[2], filter = Expr.setFilters[ name ];
+
+                       if ( filter ) {
+                               return filter( elem, i, match, array );
+                       }
+               }
+       }
+};
+
+var origPOS = Expr.match.POS;
+
+for ( var type in Expr.match ) {
+       Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
+       Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source );
+}
+
+var makeArray = function(array, results) {
+       array = Array.prototype.slice.call( array, 0 );
+
+       if ( results ) {
+               results.push.apply( results, array );
+               return results;
+       }
+
+       return array;
+};
+
+try {
+       Array.prototype.slice.call( document.documentElement.childNodes, 0 );
+
+} catch(e){
+       makeArray = function(array, results) {
+               var ret = results || [];
+
+               if ( toString.call(array) === "[object Array]" ) {
+                       Array.prototype.push.apply( ret, array );
+               } else {
+                       if ( typeof array.length === "number" ) {
+                               for ( var i = 0, l = array.length; i < l; i++ ) {
+                                       ret.push( array[i] );
+                               }
+                       } else {
+                               for ( var i = 0; array[i]; i++ ) {
+                                       ret.push( array[i] );
+                               }
+                       }
+               }
+
+               return ret;
+       };
+}
+
+var sortOrder;
+
+if ( document.documentElement.compareDocumentPosition ) {
+       sortOrder = function( a, b ) {
+               if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
+                       if ( a == b ) {
+                               hasDuplicate = true;
+                       }
+                       return 0;
+               }
+
+               var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
+               if ( ret === 0 ) {
+                       hasDuplicate = true;
+               }
+               return ret;
+       };
+} else if ( "sourceIndex" in document.documentElement ) {
+       sortOrder = function( a, b ) {
+               if ( !a.sourceIndex || !b.sourceIndex ) {
+                       if ( a == b ) {
+                               hasDuplicate = true;
+                       }
+                       return 0;
+               }
+
+               var ret = a.sourceIndex - b.sourceIndex;
+               if ( ret === 0 ) {
+                       hasDuplicate = true;
+               }
+               return ret;
+       };
+} else if ( document.createRange ) {
+       sortOrder = function( a, b ) {
+               if ( !a.ownerDocument || !b.ownerDocument ) {
+                       if ( a == b ) {
+                               hasDuplicate = true;
+                       }
+                       return 0;
+               }
+
+               var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
+               aRange.setStart(a, 0);
+               aRange.setEnd(a, 0);
+               bRange.setStart(b, 0);
+               bRange.setEnd(b, 0);
+               var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
+               if ( ret === 0 ) {
+                       hasDuplicate = true;
+               }
+               return ret;
+       };
+}
+
+(function(){
+       var form = document.createElement("div"),
+               id = "script" + (new Date).getTime();
+       form.innerHTML = "<a name='" + id + "'/>";
+
+       var root = document.documentElement;
+       root.insertBefore( form, root.firstChild );
+
+       if ( !!document.getElementById( id ) ) {
+               Expr.find.ID = function(match, context, isXML){
+                       if ( typeof context.getElementById !== "undefined" && !isXML ) {
+                               var m = context.getElementById(match[1]);
+                               return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
+                       }
+               };
+
+               Expr.filter.ID = function(elem, match){
+                       var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+                       return elem.nodeType === 1 && node && node.nodeValue === match;
+               };
+       }
+
+       root.removeChild( form );
+       root = form = null; // release memory in IE
+})();
+
+(function(){
+
+       var div = document.createElement("div");
+       div.appendChild( document.createComment("") );
+
+       if ( div.getElementsByTagName("*").length > 0 ) {
+               Expr.find.TAG = function(match, context){
+                       var results = context.getElementsByTagName(match[1]);
+
+                       if ( match[1] === "*" ) {
+                               var tmp = [];
+
+                               for ( var i = 0; results[i]; i++ ) {
+                                       if ( results[i].nodeType === 1 ) {
+                                               tmp.push( results[i] );
+                                       }
+                               }
+
+                               results = tmp;
+                       }
+
+                       return results;
+               };
+       }
+
+       div.innerHTML = "<a href='#'></a>";
+       if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
+                       div.firstChild.getAttribute("href") !== "#" ) {
+               Expr.attrHandle.href = function(elem){
+                       return elem.getAttribute("href", 2);
+               };
+       }
+
+       div = null; // release memory in IE
+})();
+
+if ( document.querySelectorAll ) (function(){
+       var oldSizzle = Sizzle, div = document.createElement("div");
+       div.innerHTML = "<p class='TEST'></p>";
+
+       if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+               return;
+       }
+
+       Sizzle = function(query, context, extra, seed){
+               context = context || document;
+
+               if ( !seed && context.nodeType === 9 && !isXML(context) ) {
+                       try {
+                               return makeArray( context.querySelectorAll(query), extra );
+                       } catch(e){}
+               }
+
+               return oldSizzle(query, context, extra, seed);
+       };
+
+       for ( var prop in oldSizzle ) {
+               Sizzle[ prop ] = oldSizzle[ prop ];
+       }
+
+       div = null; // release memory in IE
+})();
+
+if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
+       var div = document.createElement("div");
+       div.innerHTML = "<div class='test e'></div><div class='test'></div>";
+
+       if ( div.getElementsByClassName("e").length === 0 )
+               return;
+
+       div.lastChild.className = "e";
+
+       if ( div.getElementsByClassName("e").length === 1 )
+               return;
+
+       Expr.order.splice(1, 0, "CLASS");
+       Expr.find.CLASS = function(match, context, isXML) {
+               if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+                       return context.getElementsByClassName(match[1]);
+               }
+       };
+
+       div = null; // release memory in IE
+})();
+
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+       var sibDir = dir == "previousSibling" && !isXML;
+       for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+               var elem = checkSet[i];
+               if ( elem ) {
+                       if ( sibDir && elem.nodeType === 1 ){
+                               elem.sizcache = doneName;
+                               elem.sizset = i;
+                       }
+                       elem = elem[dir];
+                       var match = false;
+
+                       while ( elem ) {
+                               if ( elem.sizcache === doneName ) {
+                                       match = checkSet[elem.sizset];
+                                       break;
+                               }
+
+                               if ( elem.nodeType === 1 && !isXML ){
+                                       elem.sizcache = doneName;
+                                       elem.sizset = i;
+                               }
+
+                               if ( elem.nodeName === cur ) {
+                                       match = elem;
+                                       break;
+                               }
+
+                               elem = elem[dir];
+                       }
+
+                       checkSet[i] = match;
+               }
+       }
+}
+
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+       var sibDir = dir == "previousSibling" && !isXML;
+       for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+               var elem = checkSet[i];
+               if ( elem ) {
+                       if ( sibDir && elem.nodeType === 1 ) {
+                               elem.sizcache = doneName;
+                               elem.sizset = i;
+                       }
+                       elem = elem[dir];
+                       var match = false;
+
+                       while ( elem ) {
+                               if ( elem.sizcache === doneName ) {
+                                       match = checkSet[elem.sizset];
+                                       break;
+                               }
+
+                               if ( elem.nodeType === 1 ) {
+                                       if ( !isXML ) {
+                                               elem.sizcache = doneName;
+                                               elem.sizset = i;
+                                       }
+                                       if ( typeof cur !== "string" ) {
+                                               if ( elem === cur ) {
+                                                       match = true;
+                                                       break;
+                                               }
+
+                                       } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+                                               match = elem;
+                                               break;
+                                       }
+                               }
+
+                               elem = elem[dir];
+                       }
+
+                       checkSet[i] = match;
+               }
+       }
+}
+
+var contains = document.compareDocumentPosition ?  function(a, b){
+       return a.compareDocumentPosition(b) & 16;
+} : function(a, b){
+       return a !== b && (a.contains ? a.contains(b) : true);
+};
+
+var isXML = function(elem){
+       return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
+               !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML";
+};
+
+var posProcess = function(selector, context){
+       var tmpSet = [], later = "", match,
+               root = context.nodeType ? [context] : context;
+
+       while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
+               later += match[0];
+               selector = selector.replace( Expr.match.PSEUDO, "" );
+       }
+
+       selector = Expr.relative[selector] ? selector + "*" : selector;
+
+       for ( var i = 0, l = root.length; i < l; i++ ) {
+               Sizzle( selector, root[i], tmpSet );
+       }
+
+       return Sizzle.filter( later, tmpSet );
+};
+
+
+window.Sizzle = Sizzle;
+
+})();
+
+;(function(engine) {
+  var extendElements = Prototype.Selector.extendElements;
+
+  function select(selector, scope) {
+    return extendElements(engine(selector, scope || document));
+  }
+
+  function match(element, selector) {
+    return engine.matches(selector, [element]).length == 1;
+  }
+
+  Prototype.Selector.engine = engine;
+  Prototype.Selector.select = select;
+  Prototype.Selector.match = match;
+})(Sizzle);
+
+window.Sizzle = Prototype._original_property;
+delete Prototype._original_property;
+
+var Form = {
+  reset: function(form) {
+    form = $(form);
+    form.reset();
+    return form;
+  },
+
+  serializeElements: function(elements, options) {
+    if (typeof options != 'object') options = { hash: !!options };
+    else if (Object.isUndefined(options.hash)) options.hash = true;
+    var key, value, submitted = false, submit = options.submit, accumulator, initial;
+
+    if (options.hash) {
+      initial = {};
+      accumulator = function(result, key, value) {
+        if (key in result) {
+          if (!Object.isArray(result[key])) result[key] = [result[key]];
+          result[key].push(value);
+        } else result[key] = value;
+        return result;
+      };
+    } else {
+      initial = '';
+      accumulator = function(result, key, value) {
+        return result + (result ? '&' : '') + encodeURIComponent(key) + '=' + encodeURIComponent(value);
+      }
+    }
+
+    return elements.inject(initial, function(result, element) {
+      if (!element.disabled && element.name) {
+        key = element.name; value = $(element).getValue();
+        if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
+            submit !== false && (!submit || key == submit) && (submitted = true)))) {
+          result = accumulator(result, key, value);
+        }
+      }
+      return result;
+    });
+  }
+};
+
+Form.Methods = {
+  serialize: function(form, options) {
+    return Form.serializeElements(Form.getElements(form), options);
+  },
+
+  getElements: function(form) {
+    var elements = $(form).getElementsByTagName('*'),
+        element,
+        arr = [ ],
+        serializers = Form.Element.Serializers;
+    for (var i = 0; element = elements[i]; i++) {
+      arr.push(element);
+    }
+    return arr.inject([], function(elements, child) {
+      if (serializers[child.tagName.toLowerCase()])
+        elements.push(Element.extend(child));
+      return elements;
+    })
+  },
+
+  getInputs: function(form, typeName, name) {
+    form = $(form);
+    var inputs = form.getElementsByTagName('input');
+
+    if (!typeName && !name) return $A(inputs).map(Element.extend);
+
+    for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
+      var input = inputs[i];
+      if ((typeName && input.type != typeName) || (name && input.name != name))
+        continue;
+      matchingInputs.push(Element.extend(input));
+    }
+
+    return matchingInputs;
+  },
+
+  disable: function(form) {
+    form = $(form);
+    Form.getElements(form).invoke('disable');
+    return form;
+  },
+
+  enable: function(form) {
+    form = $(form);
+    Form.getElements(form).invoke('enable');
+    return form;
+  },
+
+  findFirstElement: function(form) {
+    var elements = $(form).getElements().findAll(function(element) {
+      return 'hidden' != element.type && !element.disabled;
+    });
+    var firstByIndex = elements.findAll(function(element) {
+      return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
+    }).sortBy(function(element) { return element.tabIndex }).first();
+
+    return firstByIndex ? firstByIndex : elements.find(function(element) {
+      return /^(?:input|select|textarea)$/i.test(element.tagName);
+    });
+  },
+
+  focusFirstElement: function(form) {
+    form = $(form);
+    var element = form.findFirstElement();
+    if (element) element.activate();
+    return form;
+  },
+
+  request: function(form, options) {
+    form = $(form), options = Object.clone(options || { });
+
+    var params = options.parameters, action = form.readAttribute('action') || '';
+    if (action.blank()) action = window.location.href;
+    options.parameters = form.serialize(true);
+
+    if (params) {
+      if (Object.isString(params)) params = params.toQueryParams();
+      Object.extend(options.parameters, params);
+    }
+
+    if (form.hasAttribute('method') && !options.method)
+      options.method = form.method;
+
+    return new Ajax.Request(action, options);
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+
+Form.Element = {
+  focus: function(element) {
+    $(element).focus();
+    return element;
+  },
+
+  select: function(element) {
+    $(element).select();
+    return element;
+  }
+};
+
+Form.Element.Methods = {
+
+  serialize: function(element) {
+    element = $(element);
+    if (!element.disabled && element.name) {
+      var value = element.getValue();
+      if (value != undefined) {
+        var pair = { };
+        pair[element.name] = value;
+        return Object.toQueryString(pair);
+      }
+    }
+    return '';
+  },
+
+  getValue: function(element) {
+    element = $(element);
+    var method = element.tagName.toLowerCase();
+    return Form.Element.Serializers[method](element);
+  },
+
+  setValue: function(element, value) {
+    element = $(element);
+    var method = element.tagName.toLowerCase();
+    Form.Element.Serializers[method](element, value);
+    return element;
+  },
+
+  clear: function(element) {
+    $(element).value = '';
+    return element;
+  },
+
+  present: function(element) {
+    return $(element).value != '';
+  },
+
+  activate: function(element) {
+    element = $(element);
+    try {
+      element.focus();
+      if (element.select && (element.tagName.toLowerCase() != 'input' ||
+          !(/^(?:button|reset|submit)$/i.test(element.type))))
+        element.select();
+    } catch (e) { }
+    return element;
+  },
+
+  disable: function(element) {
+    element = $(element);
+    element.disabled = true;
+    return element;
+  },
+
+  enable: function(element) {
+    element = $(element);
+    element.disabled = false;
+    return element;
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+var Field = Form.Element;
+
+var $F = Form.Element.Methods.getValue;
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element.Serializers = (function() {
+  function input(element, value) {
+    switch (element.type.toLowerCase()) {
+      case 'checkbox':
+      case 'radio':
+        return inputSelector(element, value);
+      default:
+        return valueSelector(element, value);
+    }
+  }
+
+  function inputSelector(element, value) {
+    if (Object.isUndefined(value))
+      return element.checked ? element.value : null;
+    else element.checked = !!value;
+  }
+
+  function valueSelector(element, value) {
+    if (Object.isUndefined(value)) return element.value;
+    else element.value = value;
+  }
+
+  function select(element, value) {
+    if (Object.isUndefined(value))
+      return (element.type === 'select-one' ? selectOne : selectMany)(element);
+
+    var opt, currentValue, single = !Object.isArray(value);
+    for (var i = 0, length = element.length; i < length; i++) {
+      opt = element.options[i];
+      currentValue = this.optionValue(opt);
+      if (single) {
+        if (currentValue == value) {
+          opt.selected = true;
+          return;
+        }
+      }
+      else opt.selected = value.include(currentValue);
+    }
+  }
+
+  function selectOne(element) {
+    var index = element.selectedIndex;
+    return index >= 0 ? optionValue(element.options[index]) : null;
+  }
+
+  function selectMany(element) {
+    var values, length = element.length;
+    if (!length) return null;
+
+    for (var i = 0, values = []; i < length; i++) {
+      var opt = element.options[i];
+      if (opt.selected) values.push(optionValue(opt));
+    }
+    return values;
+  }
+
+  function optionValue(opt) {
+    return Element.hasAttribute(opt, 'value') ? opt.value : opt.text;
+  }
+
+  return {
+    input:         input,
+    inputSelector: inputSelector,
+    textarea:      valueSelector,
+    select:        select,
+    selectOne:     selectOne,
+    selectMany:    selectMany,
+    optionValue:   optionValue,
+    button:        valueSelector
+  };
+})();
+
+/*--------------------------------------------------------------------------*/
+
+
+Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
+  initialize: function($super, element, frequency, callback) {
+    $super(callback, frequency);
+    this.element   = $(element);
+    this.lastValue = this.getValue();
+  },
+
+  execute: function() {
+    var value = this.getValue();
+    if (Object.isString(this.lastValue) && Object.isString(value) ?
+        this.lastValue != value : String(this.lastValue) != String(value)) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  }
+});
+
+Form.Element.Observer = Class.create(Abstract.TimedObserver, {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.Observer = Class.create(Abstract.TimedObserver, {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.EventObserver = Class.create({
+  initialize: function(element, callback) {
+    this.element  = $(element);
+    this.callback = callback;
+
+    this.lastValue = this.getValue();
+    if (this.element.tagName.toLowerCase() == 'form')
+      this.registerFormCallbacks();
+    else
+      this.registerCallback(this.element);
+  },
+
+  onElementEvent: function() {
+    var value = this.getValue();
+    if (this.lastValue != value) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  },
+
+  registerFormCallbacks: function() {
+    Form.getElements(this.element).each(this.registerCallback, this);
+  },
+
+  registerCallback: function(element) {
+    if (element.type) {
+      switch (element.type.toLowerCase()) {
+        case 'checkbox':
+        case 'radio':
+          Event.observe(element, 'click', this.onElementEvent.bind(this));
+          break;
+        default:
+          Event.observe(element, 'change', this.onElementEvent.bind(this));
+          break;
+      }
+    }
+  }
+});
+
+Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.EventObserver = Class.create(Abstract.EventObserver, {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+(function() {
+
+  var Event = {
+    KEY_BACKSPACE: 8,
+    KEY_TAB:       9,
+    KEY_RETURN:   13,
+    KEY_ESC:      27,
+    KEY_LEFT:     37,
+    KEY_UP:       38,
+    KEY_RIGHT:    39,
+    KEY_DOWN:     40,
+    KEY_DELETE:   46,
+    KEY_HOME:     36,
+    KEY_END:      35,
+    KEY_PAGEUP:   33,
+    KEY_PAGEDOWN: 34,
+    KEY_INSERT:   45,
+
+    cache: {}
+  };
+
+  var docEl = document.documentElement;
+  var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl
+    && 'onmouseleave' in docEl;
+
+
+
+  var isIELegacyEvent = function(event) { return false; };
+
+  if (window.attachEvent) {
+    if (window.addEventListener) {
+      isIELegacyEvent = function(event) {
+        return !(event instanceof window.Event);
+      };
+    } else {
+      isIELegacyEvent = function(event) { return true; };
+    }
+  }
+
+  var _isButton;
+
+  function _isButtonForDOMEvents(event, code) {
+    return event.which ? (event.which === code + 1) : (event.button === code);
+  }
+
+  var legacyButtonMap = { 0: 1, 1: 4, 2: 2 };
+  function _isButtonForLegacyEvents(event, code) {
+    return event.button === legacyButtonMap[code];
+  }
+
+  function _isButtonForWebKit(event, code) {
+    switch (code) {
+      case 0: return event.which == 1 && !event.metaKey;
+      case 1: return event.which == 2 || (event.which == 1 && event.metaKey);
+      case 2: return event.which == 3;
+      default: return false;
+    }
+  }
+
+  if (window.attachEvent) {
+    if (!window.addEventListener) {
+      _isButton = _isButtonForLegacyEvents;
+    } else {
+      _isButton = function(event, code) {
+        return isIELegacyEvent(event) ? _isButtonForLegacyEvents(event, code) :
+         _isButtonForDOMEvents(event, code);
+      }
+    }
+  } else if (Prototype.Browser.WebKit) {
+    _isButton = _isButtonForWebKit;
+  } else {
+    _isButton = _isButtonForDOMEvents;
+  }
+
+  function isLeftClick(event)   { return _isButton(event, 0) }
+
+  function isMiddleClick(event) { return _isButton(event, 1) }
+
+  function isRightClick(event)  { return _isButton(event, 2) }
+
+  function element(event) {
+    event = Event.extend(event);
+
+    var node = event.target, type = event.type,
+     currentTarget = event.currentTarget;
+
+    if (currentTarget && currentTarget.tagName) {
+      if (type === 'load' || type === 'error' ||
+        (type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
+          && currentTarget.type === 'radio'))
+            node = currentTarget;
+    }
+
+    if (node.nodeType == Node.TEXT_NODE)
+      node = node.parentNode;
+
+    return Element.extend(node);
+  }
+
+  function findElement(event, expression) {
+    var element = Event.element(event);
+
+    if (!expression) return element;
+    while (element) {
+      if (Object.isElement(element) && Prototype.Selector.match(element, expression)) {
+        return Element.extend(element);
+      }
+      element = element.parentNode;
+    }
+  }
+
+  function pointer(event) {
+    return { x: pointerX(event), y: pointerY(event) };
+  }
+
+  function pointerX(event) {
+    var docElement = document.documentElement,
+     body = document.body || { scrollLeft: 0 };
+
+    return event.pageX || (event.clientX +
+      (docElement.scrollLeft || body.scrollLeft) -
+      (docElement.clientLeft || 0));
+  }
+
+  function pointerY(event) {
+    var docElement = document.documentElement,
+     body = document.body || { scrollTop: 0 };
+
+    return  event.pageY || (event.clientY +
+       (docElement.scrollTop || body.scrollTop) -
+       (docElement.clientTop || 0));
+  }
+
+
+  function stop(event) {
+    Event.extend(event);
+    event.preventDefault();
+    event.stopPropagation();
+
+    event.stopped = true;
+  }
+
+
+  Event.Methods = {
+    isLeftClick:   isLeftClick,
+    isMiddleClick: isMiddleClick,
+    isRightClick:  isRightClick,
+
+    element:     element,
+    findElement: findElement,
+
+    pointer:  pointer,
+    pointerX: pointerX,
+    pointerY: pointerY,
+
+    stop: stop
+  };
+
+  var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
+    m[name] = Event.Methods[name].methodize();
+    return m;
+  });
+
+  if (window.attachEvent) {
+    function _relatedTarget(event) {
+      var element;
+      switch (event.type) {
+        case 'mouseover':
+        case 'mouseenter':
+          element = event.fromElement;
+          break;
+        case 'mouseout':
+        case 'mouseleave':
+          element = event.toElement;
+          break;
+        default:
+          return null;
+      }
+      return Element.extend(element);
+    }
+
+    var additionalMethods = {
+      stopPropagation: function() { this.cancelBubble = true },
+      preventDefault:  function() { this.returnValue = false },
+      inspect: function() { return '[object Event]' }
+    };
+
+    Event.extend = function(event, element) {
+      if (!event) return false;
+
+      if (!isIELegacyEvent(event)) return event;
+
+      if (event._extendedByPrototype) return event;
+      event._extendedByPrototype = Prototype.emptyFunction;
+
+      var pointer = Event.pointer(event);
+
+      Object.extend(event, {
+        target: event.srcElement || element,
+        relatedTarget: _relatedTarget(event),
+        pageX:  pointer.x,
+        pageY:  pointer.y
+      });
+
+      Object.extend(event, methods);
+      Object.extend(event, additionalMethods);
+
+      return event;
+    };
+  } else {
+    Event.extend = Prototype.K;
+  }
+
+  if (window.addEventListener) {
+    Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__;
+    Object.extend(Event.prototype, methods);
+  }
+
+  function _createResponder(element, eventName, handler) {
+    var registry = Element.retrieve(element, 'prototype_event_registry');
+
+    if (Object.isUndefined(registry)) {
+      CACHE.push(element);
+      registry = Element.retrieve(element, 'prototype_event_registry', $H());
+    }
+
+    var respondersForEvent = registry.get(eventName);
+    if (Object.isUndefined(respondersForEvent)) {
+      respondersForEvent = [];
+      registry.set(eventName, respondersForEvent);
+    }
+
+    if (respondersForEvent.pluck('handler').include(handler)) return false;
+
+    var responder;
+    if (eventName.include(":")) {
+      responder = function(event) {
+        if (Object.isUndefined(event.eventName))
+          return false;
+
+        if (event.eventName !== eventName)
+          return false;
+
+        Event.extend(event, element);
+        handler.call(element, event);
+      };
+    } else {
+      if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED &&
+       (eventName === "mouseenter" || eventName === "mouseleave")) {
+        if (eventName === "mouseenter" || eventName === "mouseleave") {
+          responder = function(event) {
+            Event.extend(event, element);
+
+            var parent = event.relatedTarget;
+            while (parent && parent !== element) {
+              try { parent = parent.parentNode; }
+              catch(e) { parent = element; }
+            }
+
+            if (parent === element) return;
+
+            handler.call(element, event);
+          };
+        }
+      } else {
+        responder = function(event) {
+          Event.extend(event, element);
+          handler.call(element, event);
+        };
+      }
+    }
+
+    responder.handler = handler;
+    respondersForEvent.push(responder);
+    return responder;
+  }
+
+  function _destroyCache() {
+    for (var i = 0, length = CACHE.length; i < length; i++) {
+      Event.stopObserving(CACHE[i]);
+      CACHE[i] = null;
+    }
+  }
+
+  var CACHE = [];
+
+  if (Prototype.Browser.IE)
+    window.attachEvent('onunload', _destroyCache);
+
+  if (Prototype.Browser.WebKit)
+    window.addEventListener('unload', Prototype.emptyFunction, false);
+
+
+  var _getDOMEventName = Prototype.K,
+      translations = { mouseenter: "mouseover", mouseleave: "mouseout" };
+
+  if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) {
+    _getDOMEventName = function(eventName) {
+      return (translations[eventName] || eventName);
+    };
+  }
+
+  function observe(element, eventName, handler) {
+    element = $(element);
+
+    var responder = _createResponder(element, eventName, handler);
+
+    if (!responder) return element;
+
+    if (eventName.include(':')) {
+      if (element.addEventListener)
+        element.addEventListener("dataavailable", responder, false);
+      else {
+        element.attachEvent("ondataavailable", responder);
+        element.attachEvent("onlosecapture", responder);
+      }
+    } else {
+      var actualEventName = _getDOMEventName(eventName);
+
+      if (element.addEventListener)
+        element.addEventListener(actualEventName, responder, false);
+      else
+        element.attachEvent("on" + actualEventName, responder);
+    }
+
+    return element;
+  }
+
+  function stopObserving(element, eventName, handler) {
+    element = $(element);
+
+    var registry = Element.retrieve(element, 'prototype_event_registry');
+    if (!registry) return element;
+
+    if (!eventName) {
+      registry.each( function(pair) {
+        var eventName = pair.key;
+        stopObserving(element, eventName);
+      });
+      return element;
+    }
+
+    var responders = registry.get(eventName);
+    if (!responders) return element;
+
+    if (!handler) {
+      responders.each(function(r) {
+        stopObserving(element, eventName, r.handler);
+      });
+      return element;
+    }
+
+    var i = responders.length, responder;
+    while (i--) {
+      if (responders[i].handler === handler) {
+        responder = responders[i];
+        break;
+      }
+    }
+    if (!responder) return element;
+
+    if (eventName.include(':')) {
+      if (element.removeEventListener)
+        element.removeEventListener("dataavailable", responder, false);
+      else {
+        element.detachEvent("ondataavailable", responder);
+        element.detachEvent("onlosecapture", responder);
+      }
+    } else {
+      var actualEventName = _getDOMEventName(eventName);
+      if (element.removeEventListener)
+        element.removeEventListener(actualEventName, responder, false);
+      else
+        element.detachEvent('on' + actualEventName, responder);
+    }
+
+    registry.set(eventName, responders.without(responder));
+
+    return element;
+  }
+
+  function fire(element, eventName, memo, bubble) {
+    element = $(element);
+
+    if (Object.isUndefined(bubble))
+      bubble = true;
+
+    if (element == document && document.createEvent && !element.dispatchEvent)
+      element = document.documentElement;
+
+    var event;
+    if (document.createEvent) {
+      event = document.createEvent('HTMLEvents');
+      event.initEvent('dataavailable', bubble, true);
+    } else {
+      event = document.createEventObject();
+      event.eventType = bubble ? 'ondataavailable' : 'onlosecapture';
+    }
+
+    event.eventName = eventName;
+    event.memo = memo || { };
+
+    if (document.createEvent)
+      element.dispatchEvent(event);
+    else
+      element.fireEvent(event.eventType, event);
+
+    return Event.extend(event);
+  }
+
+  Event.Handler = Class.create({
+    initialize: function(element, eventName, selector, callback) {
+      this.element   = $(element);
+      this.eventName = eventName;
+      this.selector  = selector;
+      this.callback  = callback;
+      this.handler   = this.handleEvent.bind(this);
+    },
+
+    start: function() {
+      Event.observe(this.element, this.eventName, this.handler);
+      return this;
+    },
+
+    stop: function() {
+      Event.stopObserving(this.element, this.eventName, this.handler);
+      return this;
+    },
+
+    handleEvent: function(event) {
+      var element = Event.findElement(event, this.selector);
+      if (element) this.callback.call(this.element, event, element);
+    }
+  });
+
+  function on(element, eventName, selector, callback) {
+    element = $(element);
+    if (Object.isFunction(selector) && Object.isUndefined(callback)) {
+      callback = selector, selector = null;
+    }
+
+    return new Event.Handler(element, eventName, selector, callback).start();
+  }
+
+  Object.extend(Event, Event.Methods);
+
+  Object.extend(Event, {
+    fire:          fire,
+    observe:       observe,
+    stopObserving: stopObserving,
+    on:            on
+  });
+
+  Element.addMethods({
+    fire:          fire,
+
+    observe:       observe,
+
+    stopObserving: stopObserving,
+
+    on:            on
+  });
+
+  Object.extend(document, {
+    fire:          fire.methodize(),
+
+    observe:       observe.methodize(),
+
+    stopObserving: stopObserving.methodize(),
+
+    on:            on.methodize(),
+
+    loaded:        false
+  });
+
+  if (window.Event) Object.extend(window.Event, Event);
+  else window.Event = Event;
+})();
+
+(function() {
+  /* Support for the DOMContentLoaded event is based on work by Dan Webb,
+     Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */
+
+  var timer;
+
+  function fireContentLoadedEvent() {
+    if (document.loaded) return;
+    if (timer) window.clearTimeout(timer);
+    document.loaded = true;
+    document.fire('dom:loaded');
+  }
+
+  function checkReadyState() {
+    if (document.readyState === 'complete') {
+      document.stopObserving('readystatechange', checkReadyState);
+      fireContentLoadedEvent();
+    }
+  }
+
+  function pollDoScroll() {
+    try { document.documentElement.doScroll('left'); }
+    catch(e) {
+      timer = pollDoScroll.defer();
+      return;
+    }
+    fireContentLoadedEvent();
+  }
+
+  if (document.addEventListener) {
+    document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false);
+  } else {
+    document.observe('readystatechange', checkReadyState);
+    if (window == top)
+      timer = pollDoScroll.defer();
+  }
+
+  Event.observe(window, 'load', fireContentLoadedEvent);
+})();
+
+Element.addMethods();
+
+/*------------------------------- DEPRECATED -------------------------------*/
+
+Hash.toQueryString = Object.toQueryString;
+
+var Toggle = { display: Element.toggle };
+
+Element.Methods.childOf = Element.Methods.descendantOf;
+
+var Insertion = {
+  Before: function(element, content) {
+    return Element.insert(element, {before:content});
+  },
+
+  Top: function(element, content) {
+    return Element.insert(element, {top:content});
+  },
+
+  Bottom: function(element, content) {
+    return Element.insert(element, {bottom:content});
+  },
+
+  After: function(element, content) {
+    return Element.insert(element, {after:content});
+  }
+};
+
+var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
+
+var Position = {
+  includeScrollOffsets: false,
+
+  prepare: function() {
+    this.deltaX =  window.pageXOffset
+                || document.documentElement.scrollLeft
+                || document.body.scrollLeft
+                || 0;
+    this.deltaY =  window.pageYOffset
+                || document.documentElement.scrollTop
+                || document.body.scrollTop
+                || 0;
+  },
+
+  within: function(element, x, y) {
+    if (this.includeScrollOffsets)
+      return this.withinIncludingScrolloffsets(element, x, y);
+    this.xcomp = x;
+    this.ycomp = y;
+    this.offset = Element.cumulativeOffset(element);
+
+    return (y >= this.offset[1] &&
+            y <  this.offset[1] + element.offsetHeight &&
+            x >= this.offset[0] &&
+            x <  this.offset[0] + element.offsetWidth);
+  },
+
+  withinIncludingScrolloffsets: function(element, x, y) {
+    var offsetcache = Element.cumulativeScrollOffset(element);
+
+    this.xcomp = x + offsetcache[0] - this.deltaX;
+    this.ycomp = y + offsetcache[1] - this.deltaY;
+    this.offset = Element.cumulativeOffset(element);
+
+    return (this.ycomp >= this.offset[1] &&
+            this.ycomp <  this.offset[1] + element.offsetHeight &&
+            this.xcomp >= this.offset[0] &&
+            this.xcomp <  this.offset[0] + element.offsetWidth);
+  },
+
+  overlap: function(mode, element) {
+    if (!mode) return 0;
+    if (mode == 'vertical')
+      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
+        element.offsetHeight;
+    if (mode == 'horizontal')
+      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
+        element.offsetWidth;
+  },
+
+
+  cumulativeOffset: Element.Methods.cumulativeOffset,
+
+  positionedOffset: Element.Methods.positionedOffset,
+
+  absolutize: function(element) {
+    Position.prepare();
+    return Element.absolutize(element);
+  },
+
+  relativize: function(element) {
+    Position.prepare();
+    return Element.relativize(element);
+  },
+
+  realOffset: Element.Methods.cumulativeScrollOffset,
+
+  offsetParent: Element.Methods.getOffsetParent,
+
+  page: Element.Methods.viewportOffset,
+
+  clone: function(source, target, options) {
+    options = options || { };
+    return Element.clonePosition(target, source, options);
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
+  function iter(name) {
+    return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
+  }
+
+  instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
+  function(element, className) {
+    className = className.toString().strip();
+    var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
+    return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
+  } : function(element, className) {
+    className = className.toString().strip();
+    var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
+    if (!classNames && !className) return elements;
+
+    var nodes = $(element).getElementsByTagName('*');
+    className = ' ' + className + ' ';
+
+    for (var i = 0, child, cn; child = nodes[i]; i++) {
+      if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
+          (classNames && classNames.all(function(name) {
+            return !name.toString().blank() && cn.include(' ' + name + ' ');
+          }))))
+        elements.push(Element.extend(child));
+    }
+    return elements;
+  };
+
+  return function(className, parentElement) {
+    return $(parentElement || document.body).getElementsByClassName(className);
+  };
+}(Element.Methods);
+
+/*--------------------------------------------------------------------------*/
+
+Element.ClassNames = Class.create();
+Element.ClassNames.prototype = {
+  initialize: function(element) {
+    this.element = $(element);
+  },
+
+  _each: function(iterator) {
+    this.element.className.split(/\s+/).select(function(name) {
+      return name.length > 0;
+    })._each(iterator);
+  },
+
+  set: function(className) {
+    this.element.className = className;
+  },
+
+  add: function(classNameToAdd) {
+    if (this.include(classNameToAdd)) return;
+    this.set($A(this).concat(classNameToAdd).join(' '));
+  },
+
+  remove: function(classNameToRemove) {
+    if (!this.include(classNameToRemove)) return;
+    this.set($A(this).without(classNameToRemove).join(' '));
+  },
+
+  toString: function() {
+    return $A(this).join(' ');
+  }
+};
+
+Object.extend(Element.ClassNames.prototype, Enumerable);
+
+/*--------------------------------------------------------------------------*/
+
+(function() {
+  window.Selector = Class.create({
+    initialize: function(expression) {
+      this.expression = expression.strip();
+    },
+
+    findElements: function(rootElement) {
+      return Prototype.Selector.select(this.expression, rootElement);
+    },
+
+    match: function(element) {
+      return Prototype.Selector.match(element, this.expression);
+    },
+
+    toString: function() {
+      return this.expression;
+    },
+
+    inspect: function() {
+      return "#<Selector: " + this.expression + ">";
+    }
+  });
+
+  Object.extend(Selector, {
+    matchElements: function(elements, expression) {
+      var match = Prototype.Selector.match,
+          results = [];
+
+      for (var i = 0, length = elements.length; i < length; i++) {
+        var element = elements[i];
+        if (match(element, expression)) {
+          results.push(Element.extend(element));
+        }
+      }
+      return results;
+    },
+
+    findElement: function(elements, expression, index) {
+      index = index || 0;
+      var matchIndex = 0, element;
+      for (var i = 0, length = elements.length; i < length; i++) {
+        element = elements[i];
+        if (Prototype.Selector.match(element, expression) && index === matchIndex++) {
+          return Element.extend(element);
+        }
+      }
+    },
+
+    findChildElements: function(element, expressions) {
+      var selector = expressions.toArray().join(', ');
+      return Prototype.Selector.select(selector, element || document);
+    }
+  });
+})();
diff --git a/minsrc/ricoCalendar.js b/minsrc/ricoCalendar.js
new file mode 100644 (file)
index 0000000..64b099a
--- /dev/null
@@ -0,0 +1,548 @@
+/*
+ *  (c) 2005-2009 Richard Cowin (http://openrico.org)
+ *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
+ *  file except in compliance with the License. You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software distributed under the
+ *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ *  either express or implied. See the License for the specific language governing permissions
+ *  and limitations under the License.
+ */
+
+//  Inspired by code originally written by Tan Ling Wee on 2 Dec 2001
+
+Rico.CalendarControl = function(id,options) {
+  this.initialize(id,options);
+};
+
+Rico.CalendarControl.prototype = {
+/**
+ * @class Implements a pop-up Gregorian calendar.
+ * Dates of adoption of the Gregorian calendar vary by country - accurate as a US & British calendar from 14 Sept 1752 to present.
+ * Mark special dates with calls to addHoliday()
+ * @extends Rico.Popup
+ * @constructs
+ * @param id unique identifier
+ * @param options object may contain any of the following:<dl>
+ *   <dt>startAt       </dt><dd> week starts with 0=sunday, 1=monday? default=0</dd>
+ *   <dt>showWeekNumber</dt><dd> show week number in first column? default=0</dd>
+ *   <dt>showToday     </dt><dd> show "Today is..." in footer? default=1</dd>
+ *   <dt>dateFmt       </dt><dd> date format for return value (one of values accepted by {@link Date#formatDate}), default=ISO8601</dd>
+ *   <dt>minDate       </dt><dd> earliest selectable date? default=today-50 years</dd>
+ *   <dt>maxDate       </dt><dd> last selectable date? default=today+50 years</dd>
+ *</dl>
+ */
+  initialize: function(id,options) {
+    this.id=id;
+    var today=new Date();
+    Rico.extend(this, new Rico.Popup());
+    Rico.extend(this.options, {
+      ignoreClicks:true,
+      startAt : 0,
+      showWeekNumber : 0,
+      showToday : 1,
+      dateFmt : 'ISO8601',
+      minDate : new Date(today.getFullYear()-50,0,1),
+      maxDate : new Date(today.getFullYear()+50,11,31)
+    });
+    Rico.extend(this.options, options || {});
+    /**
+     * alias for closePopup
+     * @function
+     */
+    this.close=this.closePopup;
+    this.bPageLoaded=false;
+    this.img=[];
+    this.Holidays={};
+    this.weekString=Rico.getPhraseById("calWeekHdg");
+    this.re=/^\s*(\w+)(\W)(\w+)(\W)(\w+)/i;
+    this.setDateFmt(this.options.dateFmt);
+  },
+
+
+  setDateFmt: function(fmt) {
+    this.dateFmt=(fmt=='rico') ? Rico.dateFmt : fmt;
+    Rico.log(this.id+' date format set to '+this.dateFmt);
+    this.dateParts={};
+    if (this.re.exec(this.dateFmt)) {
+      this.dateParts[RegExp.$1]=0;
+      this.dateParts[RegExp.$3]=1;
+      this.dateParts[RegExp.$5]=2;
+    }
+  },
+  
+/**
+ * Call before displaying calendar to highlight special days
+ * @param d day (1-31)
+ * @param m month (1-12)
+ * @param y year (0 implies a repeating holiday)
+ * @param desc description
+ * @param bgColor background color for cell displaying this day (CSS value, defaults to '#DDF')
+ * @param txtColor text color for cell displaying this day (CSS value), if not specified it is displayed with the same color as other days
+ */
+  addHoliday : function(d, m, y, desc, bgColor, txtColor) {
+    this.Holidays[this.holidayKey(y,m-1,d)]={desc:desc, txtColor:txtColor, bgColor:bgColor || '#DDF'};
+  },
+  
+/** @private */
+  holidayKey : function(y,m,d) {
+    return 'h'+Rico.zFill(y,4)+Rico.zFill(m,2)+Rico.zFill(d,2);
+  },
+
+  atLoad : function() {
+    Rico.log('Calendar#atLoad: '+this.id);
+    this.createContainer();
+    this.container.id=this.id;
+    Rico.addClass(this.container, Rico.theme.calendar || 'ricoCalContainer');
+
+    this.maintab=document.createElement("table");
+    this.maintab.cellSpacing=2;
+    this.maintab.cellPadding=0;
+    this.maintab.border=0;
+    this.maintab.style.borderCollapse='separate';
+    this.maintab.className='ricoCalTab';
+    if (Rico.theme.calendarTable) Rico.addClass(this.maintab,Rico.theme.calendarTable)
+    this.tbody=Rico.getTBody(this.maintab);
+
+    var r,c,d,i,j,img,dow,a,s,tab;
+    this.colStart=this.options.showWeekNumber ? 1 : 0;
+    for (i=0; i<7; i++) {
+      r=this.tbody.insertRow(-1);
+      r.className='row'+i;
+      for (c=0; c<7+this.colStart; c++) {
+        r.insertCell(-1);
+      }
+    }
+    r=this.tbody.rows[0];
+    r.className='ricoCalDayNames';
+    if (this.options.showWeekNumber) {
+      r.cells[0].innerHTML=this.weekString;
+      for (i=0; i<7; i++) {
+        this.tbody.rows[i].cells[0].className='ricoCalWeekNum';
+      }
+    }
+    this.styles=[];
+    for (i=0; i<7; i++) {
+      dow=(i+this.options.startAt) % 7;
+      r.cells[i+this.colStart].innerHTML=Rico.dayAbbr(dow);
+      this.styles[i]='ricoCal'+dow;
+    }
+    
+    // table header (navigation controls)
+    this.thead=this.maintab.createTHead();
+    r=this.thead.insertRow(-1);
+    c=r.appendChild(document.createElement("th"));
+    c.colSpan=7+this.colStart;
+    d=c.appendChild(document.createElement("div"));
+    //d.style.padding='3px';
+    d.className=Rico.theme.calendarHeading || 'RicoCalHeading';
+    
+    d.appendChild(this._createTitleSection('Month'));
+    d.appendChild(this._createTitleSection('Year'));
+    new Rico.HoverSet(d.getElementsByTagName('a'));
+    new Rico.HoverSet(this.tbody.getElementsByTagName('td'),{ hoverNodes: function(e) { return e.innerHTML.match(/^\d+$/) ? [e] : []; } });
+    d.appendChild(Rico.closeButton(Rico.eventHandle(this,'close')));
+
+    // table footer (today)
+    if (this.options.showToday) {
+      this.tfoot=this.maintab.createTFoot();
+      r=this.tfoot.insertRow(-1);
+      this.todayCell=r.insertCell(-1);
+      this.todayCell.colSpan=7+this.colStart;
+      if (Rico.theme.calendarFooter) Rico.addClass(this.todayCell,Rico.theme.calendarFooter);
+      Rico.eventBind(this.todayCell,"click", Rico.eventHandle(this,'selectNow'), false);
+    }
+    this.content.appendChild(this.maintab);
+    var ie6=Rico.isIE && Rico.ieVersion < 7;
+    var selectOptions={shadow: !ie6};
+    
+    // month selector
+    this.monthPopup=new Rico.Popup(document.createElement("div"),selectOptions);
+    this.monthPopup.closePopup();
+    tab=document.createElement("table");
+    tab.className='ricoCalMenu';
+    if (Rico.theme.calendarPopdown) Rico.addClass(tab,Rico.theme.calendarPopdown);
+    tab.cellPadding=2;
+    tab.cellSpacing=0;
+    tab.border=0;
+    tab.style.borderCollapse='separate';
+    tab.style.margin='0px';
+    for (i=0; i<4; i++) {
+      r=tab.insertRow(-1);
+      for (j=0; j<3; j++) {
+        c=r.insertCell(-1);
+        a=document.createElement("a");
+        a.innerHTML=Rico.monthAbbr(i*3+j);
+        a.name=i*3+j;
+        if (Rico.theme.calendarDay) Rico.addClass(a,Rico.theme.calendarDay);
+        c.appendChild(a);
+        Rico.eventBind(a,"click", Rico.eventHandle(this,'selectMonth'), false);
+      }
+    }
+    new Rico.HoverSet(tab.getElementsByTagName('a'));
+    this.monthPopup.content.appendChild(tab);
+    this.content.appendChild(this.monthPopup.container);
+    
+    // year selector
+    this.yearPopup=new Rico.Popup(document.createElement("div"),selectOptions);
+    this.yearPopup.closePopup();
+    this.yearPopup.content.className='ricoCalYearPrompt';
+    if (Rico.theme.calendarPopdown) Rico.addClass(this.yearPopup.content,Rico.theme.calendarPopdown);
+    var tab=document.createElement("table");
+    tab.cellPadding=2;
+    tab.cellSpacing=0;
+    tab.border=0;
+    tab.style.borderCollapse='separate';
+    tab.style.margin='0px';
+    r=tab.insertRow(-1);
+    this.yearLabel=r.insertCell(-1);
+    this.yearLabel.colSpan=3;
+    r=tab.insertRow(-1);
+    c=r.insertCell(-1);
+    this.yearInput=c.appendChild(document.createElement("input"));
+    this.yearInput.maxlength=4;
+    this.yearInput.size=4;
+    Rico.eventBind(this.yearInput,"keypress", Rico.eventHandle(this,'yearKey'), false);
+    c=r.insertCell(-1);
+    var a=Rico.floatButton('Checkmark', Rico.eventHandle(this,'processPopUpYear'));
+    Rico.setStyle(a.firstChild,{ margin:"0px", padding:"0px", border:"none" });
+    c.appendChild(a);
+    c=r.insertCell(-1);
+    a=Rico.floatButton('Cancel', Rico.eventHandle(this,'popDownYear'));
+    Rico.setStyle(a.firstChild,{ margin:"0px", padding:"0px", border:"none" });
+    c.appendChild(a);
+    this.yearPopup.content.appendChild(tab);
+    this.content.appendChild(this.yearPopup.container);
+
+    //this.yearLabel.className='ricoCalYearPromptText';
+
+    // fix anchors so they work in IE6
+    a=this.content.getElementsByTagName('a');
+    for (i=0; i<a.length; i++) {
+      a[i].href='javascript:void(0)';
+    }
+    
+    Rico.eventBind(this.tbody,"click", Rico.eventHandle(this,'saveAndClose'));
+    this.close();
+    this.bPageLoaded=true;
+  },
+
+  _createTitleSection : function(section) {
+    var s=document.createElement("span");
+    s.className='RicoCal'+section+'Heading';
+
+    var a=s.appendChild(document.createElement("a"));
+    a.className='Rico_leftArrow';
+    if (Rico.theme.leftArrowAnchor) Rico.addClass(a,Rico.theme.leftArrowAnchor);
+    a.appendChild(this.createNavArrow('dec'+section,'left'));
+
+    a=s.appendChild(document.createElement("a"));
+    a.style.display='inline';
+    Rico.eventBind(a,"click", Rico.eventHandle(this,'popUp'+section), false);
+    this['title'+section]=a;
+
+    a=s.appendChild(document.createElement("a"));
+    a.className='Rico_rightArrow';
+    if (Rico.theme.rightArrowAnchor) Rico.addClass(a,Rico.theme.rightArrowAnchor);
+    a.appendChild(this.createNavArrow('inc'+section,'right'));
+    return s
+  },
+  
+  selectNow : function() {
+    var today = new Date();
+    this.dateNow  = today.getDate();
+    this.monthNow = today.getMonth();
+    this.yearNow  = today.getFullYear();
+    this.monthSelected=this.monthNow;
+    this.yearSelected=this.yearNow;
+    this.constructCalendar();
+  },
+  
+/** @private */
+  createNavArrow: function(funcname,direction) {
+    var span=document.createElement("span");
+    span.className=Rico.theme[direction+'Arrow'] || 'rico-icon Rico_'+direction+'Arrow';
+    Rico.eventBind(span,"click", Rico.eventHandle(this,funcname), false);
+    return span;
+  },
+
+/**
+ * @returns true if yr/mo is within minDate/MaxDate
+ */
+  isValidMonth : function(yr,mo) {
+    if (yr < this.options.minDate.getFullYear()) return false;
+    if (yr == this.options.minDate.getFullYear() && mo < this.options.minDate.getMonth()) return false;
+    if (yr > this.options.maxDate.getFullYear()) return false;
+    if (yr == this.options.maxDate.getFullYear() && mo > this.options.maxDate.getMonth()) return false;
+    return true;
+  },
+
+  incMonth : function() {
+    var newMonth=this.monthSelected+1;
+    var newYear=this.yearSelected;
+    if (newMonth>11) {
+      newMonth=0;
+      newYear++;
+    }
+    if (!this.isValidMonth(newYear,newMonth)) return;
+    this.monthSelected=newMonth;
+    this.yearSelected=newYear;
+    this.constructCalendar();
+  },
+
+  decMonth : function() {
+    var newMonth=this.monthSelected-1;
+    var newYear=this.yearSelected;
+    if (newMonth<0) {
+      newMonth=11;
+      newYear--;
+    }
+    if (!this.isValidMonth(newYear,newMonth)) return;
+    this.monthSelected=newMonth;
+    this.yearSelected=newYear;
+    this.constructCalendar();
+  },
+  
+/** @private */
+  selectMonth : function(e) {
+    var el=Rico.eventElement(e);
+    this.monthSelected=parseInt(el.name,10);
+    this.constructCalendar();
+    Rico.eventStop(e);
+  },
+
+  popUpMonth : function(e) {
+    if (this.monthPopup.visible()) {
+      this.popDownMonth();
+      return;
+    }
+    this.popDownYear();
+    this.monthPopup.openPopup(this.titleMonth.parentNode.offsetLeft, this.thead.offsetHeight+2);
+    Rico.eventStop(e);
+    return false;
+  },
+
+  popDownMonth : function() {
+    this.monthPopup.closePopup();
+  },
+
+  popDownYear : function() {
+    this.yearPopup.closePopup();
+    this.yearInput.disabled=true;  // make sure this does not get submitted
+  },
+
+/**
+ * Prompt for year
+ */
+  popUpYear : function(e) {
+    if (this.yearPopup.visible()) {
+      this.popDownYear();
+      return;
+    }
+    this.popDownMonth();
+    this.yearPopup.openPopup(90, this.thead.offsetHeight+2);
+    this.yearLabel.innerHTML=Rico.getPhraseById("calYearRange",this.options.minDate.getFullYear(),this.options.maxDate.getFullYear());
+    this.yearInput.disabled=false;
+    this.yearInput.value='';   // this.yearSelected
+    this.yearInput.focus();
+    Rico.eventStop(e);
+    return false;
+  },
+  
+  yearKey : function(e) {
+    switch (Rico.eventKey(e)) {
+      case 27: this.popDownYear(); Rico.eventStop(e); return false;
+      case 13: this.processPopUpYear(); Rico.eventStop(e); return false;
+    }
+    return true;
+  },
+  
+  processPopUpYear : function() {
+    var newYear=this.yearInput.value;
+    newYear=parseInt(newYear,10);
+    if (isNaN(newYear) || newYear<this.options.minDate.getFullYear() || newYear>this.options.maxDate.getFullYear()) {
+      alert(Rico.getPhraseById("calInvalidYear"));
+    } else {
+      this.yearSelected=newYear;
+      this.popDownYear();
+      this.constructCalendar();
+    }
+  },
+  
+  incYear : function() {
+    if (this.yearSelected>=this.options.maxDate.getFullYear()) return;
+    this.yearSelected++;
+    this.constructCalendar();
+  },
+
+  decYear : function() {
+    if (this.yearSelected<=this.options.minDate.getFullYear()) return;
+    this.yearSelected--;
+    this.constructCalendar();
+  },
+
+  // tried a number of different week number functions posted on the net
+  // this is the only one that produced consistent results when comparing week numbers for December and the following January
+  WeekNbr : function(year,month,day) {
+    var when = new Date(year,month,day);
+    var newYear = new Date(year,0,1);
+    var offset = 7 + 1 - newYear.getDay();
+    if (offset == 8) offset = 1;
+    var daynum = ((Date.UTC(year,when.getMonth(),when.getDate(),0,0,0) - Date.UTC(year,0,1,0,0,0)) /1000/60/60/24) + 1;
+    var weeknum = Math.floor((daynum-offset+7)/7);
+    if (weeknum == 0) {
+      year--;
+      var prevNewYear = new Date(year,0,1);
+      var prevOffset = 7 + 1 - prevNewYear.getDay();
+      weeknum = (prevOffset == 2 || prevOffset == 8) ? 53 : 52;
+    }
+    return weeknum;
+  },
+
+  constructCalendar : function() {
+    var aNumDays = [31,0,31,30,31,30,31,31,30,31,30,31];
+    var startDate = new Date (this.yearSelected,this.monthSelected,1);
+    var endDate,numDaysInMonth,i,colnum;
+
+    if (typeof this.monthSelected!='number' || this.monthSelected>=12 || this.monthSelected<0) {
+      alert('ERROR in calendar: monthSelected='+this.monthSelected);
+      return;
+    }
+
+    if (this.monthSelected==1) {
+      endDate = new Date (this.yearSelected,this.monthSelected+1,1);
+      endDate = new Date (endDate - (24*60*60*1000));
+      numDaysInMonth = endDate.getDate();
+    } else {
+      numDaysInMonth = aNumDays[this.monthSelected];
+    }
+    var dayPointer = startDate.getDay() - this.options.startAt;
+    if (dayPointer<0) dayPointer+=7;
+    this.popDownMonth();
+    this.popDownYear();
+
+    //this.bgcolor=Rico.getStyle(this.tbody,'background-color');
+    //this.bgcolor=this.bgcolor.replace(/\"/g,'');
+    if (this.options.showWeekNumber) {
+      for (i=1; i<7; i++) {
+        this.tbody.rows[i].cells[0].innerHTML='&nbsp;';
+      }
+    }
+    for ( i=0; i<dayPointer; i++ ) {
+      this.resetCell(this.tbody.rows[1].cells[i+this.colStart]);
+    }
+
+    for ( var datePointer=1,r=1; datePointer<=numDaysInMonth; datePointer++,dayPointer++ ) {
+      colnum=dayPointer % 7;
+      if (this.options.showWeekNumber && colnum==0) {
+        this.tbody.rows[r].cells[0].innerHTML=this.WeekNbr(this.yearSelected,this.monthSelected,datePointer);
+      }
+      var c=this.tbody.rows[r].cells[colnum+this.colStart];
+      c.innerHTML=datePointer;
+      c.className=this.styles[colnum];
+      if ((datePointer==this.dateNow)&&(this.monthSelected==this.monthNow)&&(this.yearSelected==this.yearNow)) {
+        Rico.addClass(c,Rico.theme.calendarToday || 'ricoCalToday');
+      }
+      if (Rico.theme.calendarDay) Rico.addClass(c,Rico.theme.calendarDay);
+      if ((datePointer==this.odateSelected) && (this.monthSelected==this.omonthSelected) && (this.yearSelected==this.oyearSelected)) {
+        Rico.addClass(c,Rico.theme.calendarSelectedDay || 'ricoSelectedDay');
+      }
+      var h=this.Holidays[this.holidayKey(this.yearSelected,this.monthSelected,datePointer)];
+      if (!h)  {
+        h=this.Holidays[this.holidayKey(0,this.monthSelected,datePointer)];
+      }
+      c.style.color=h ? h.txtColor : '';
+      c.style.backgroundColor=h ? h.bgColor : '';
+      c.title=h ? h.desc : '';
+      if (colnum==6) r++;
+    }
+    while (dayPointer<42) {
+      colnum=dayPointer % 7;
+      this.resetCell(this.tbody.rows[r].cells[colnum+this.colStart]);
+      dayPointer++;
+      if (colnum==6) r++;
+    }
+
+    this.titleMonth.innerHTML = Rico.monthAbbr(this.monthSelected);
+    this.titleYear.innerHTML = this.yearSelected;
+    if (this.todayCell) {
+      this.todayCell.innerHTML = Rico.getPhraseById("calToday",this.dateNow,Rico.monthAbbr(this.monthNow),this.yearNow,this.monthNow+1);
+    }
+  },
+  
+/** @private */
+  resetCell: function(c) {
+    c.innerHTML="&nbsp;";
+    c.className='ricoCalEmpty';
+    c.style.color='';
+    c.style.backgroundColor='';
+    c.title='';
+  },
+  
+/** @private */
+  saveAndClose : function(e) {
+    Rico.eventStop(e);
+    var el=Rico.eventElement(e);
+    var s=el.innerHTML.replace(/&nbsp;/g,'');
+    if (s=='' || el.className=='ricoCalWeekNum') return;
+    var day=parseInt(s,10);
+    if (isNaN(day)) return;
+    var d=new Date(this.yearSelected,this.monthSelected,day);
+    var dateStr=Rico.formatDate(d,this.dateFmt=='ISO8601' ? 'yyyy-mm-dd' : this.dateFmt);
+    if (this.returnValue) {
+      this.returnValue(dateStr);
+      this.close();
+    }
+  },
+
+  open : function(curval) {
+    if (!this.bPageLoaded) return;
+    var today = new Date();
+    this.dateNow  = today.getDate();
+    this.monthNow = today.getMonth();
+    this.yearNow  = today.getFullYear();
+    this.oyearSelected = -1;
+    if (typeof curval=='object') {
+      this.odateSelected  = curval.getDate();
+      this.omonthSelected = curval.getMonth();
+      this.oyearSelected  = curval.getFullYear();
+    } else if (this.dateFmt=='ISO8601') {
+      var d=Rico.setISO8601(curval);
+      if (d) {
+        this.odateSelected  = d.getDate();
+        this.omonthSelected = d.getMonth();
+        this.oyearSelected  = d.getFullYear();
+      }
+    } else if (this.re.exec(curval)) {
+      var aDate = [ RegExp.$1, RegExp.$3, RegExp.$5 ];
+      this.odateSelected  = parseInt(aDate[this.dateParts.dd], 10);
+      this.omonthSelected = parseInt(aDate[this.dateParts.mm], 10) - 1;
+      this.oyearSelected  = parseInt(aDate[this.dateParts.yyyy], 10);
+      if (this.oyearSelected < 100) {
+        // apply a century to 2-digit years
+        this.oyearSelected+=this.yearNow - (this.yearNow % 100);
+        var maxyr=this.options.maxDate.getFullYear();
+        while (this.oyearSelected > maxyr) this.oyearSelected-=100;
+      }
+    } else {
+      if (curval) {
+        alert('ERROR: invalid date passed to calendar ('+curval+')');
+      }
+    }
+    if (this.oyearSelected > 0) {
+      this.dateSelected=this.odateSelected;
+      this.monthSelected=this.omonthSelected;
+      this.yearSelected=this.oyearSelected;
+    } else {
+      this.dateSelected=this.dateNow;
+      this.monthSelected=this.monthNow;
+      this.yearSelected=this.yearNow;
+    }
+    this.constructCalendar();
+    this.openPopup();
+  }
+};
diff --git a/minsrc/ricoColorPicker.js b/minsrc/ricoColorPicker.js
new file mode 100644 (file)
index 0000000..36c2a3e
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ *  (c) 2005-2009 Richard Cowin (http://openrico.org)
+ *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
+ *  file except in compliance with the License. You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software distributed under the
+ *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ *  either express or implied. See the License for the specific language governing permissions
+ *  and limitations under the License.
+ */
+
+// ===================================================================
+// Adapted to Rico by Matt Brown from code 
+//   published by Matt Kruse http://www.mattkruse.com/
+// ===================================================================
+
+Rico.ColorPicker = function(id,options) {
+  this.initialize(id,options);
+};
+
+Rico.ColorPicker.prototype = {
+/**
+ * @class Implements a pop-up color picker control.
+ * @extends Rico.Popup
+ * @constructs
+ * @param id unique identifier
+ * @param options object may contain any of the following:<dl>
+ *   <dt>showColorCode</dt><dd> show hex color code as user hovers over color grid? default=false</dd>
+ *   <dt>cellsPerRow  </dt><dd> number of colors per row in the grid? default=18</dd>
+ *   <dt>palette      </dt><dd> array of 6 digit hex values, default=216 "web safe" colors</dd>
+ *</dl>
+ */
+  initialize: function(id,options) {
+    this.id=id;
+    this.currentValue = "#FFFFFF";
+    Rico.extend(this, new Rico.Popup());
+    Rico.extend(this.options, {
+      showColorCode : false,
+      cellsPerRow   : 18,
+      palette       : []
+    });
+    var hexvals=['00','33','66','99','CC','FF'];
+    for (var g=0; g<hexvals.length; g++) {
+      for (var r=0; r<hexvals.length; r++) {
+        for (var b=0; b<hexvals.length; b++) {
+          this.options.palette.push(hexvals[r]+hexvals[g]+hexvals[b]);
+        }
+      }
+    }
+    Rico.extend(this.options, options || {});
+  },
+
+  atLoad : function() {
+    this.createContainer();
+    this.content.className='ricoColorPicker';
+    var width = this.options.cellsPerRow;
+    var cp_contents = "<TABLE BORDER='1' CELLSPACING='1' CELLPADDING='0'>";
+    for (var i=0; i<this.options.palette.length; i++) {
+      if ((i % width) == 0) { cp_contents += "<TR>"; }
+      cp_contents += '<TD BGCOLOR="#'+this.options.palette[i]+'">&nbsp;</TD>';
+      if ( ((i+1)>=this.options.palette.length) || (((i+1) % width) == 0)) {
+        cp_contents += "</TR>";
+      }
+    }
+    var halfwidth = Math.floor(width/2);
+    if (this.options.showColorCode) {
+      cp_contents += "<TR><TD COLSPAN='"+halfwidth+"' ID='colorPickerSelectedColor'>&nbsp;</TD><TD COLSPAN='"+(width-halfwidth)+"' ALIGN='CENTER' ID='colorPickerSelectedColorValue'>#FFFFFF</TD></TR>";
+    } else {
+      cp_contents += "<TR><TD COLSPAN='"+width+"' ID='colorPickerSelectedColor'>&nbsp;</TD></TR>";
+    }
+    cp_contents += "</TABLE>";
+    this.content.innerHTML=cp_contents;
+    /**
+     * alias for openPopup
+     * @function
+     */
+    this.open=this.openPopup;
+    /**
+     * alias for closePopup
+     * @function
+     */
+    this.close=this.closePopup;
+    Rico.eventBind(this.container,"mouseover", Rico.eventHandle(this,'highlightColor'), false);
+    Rico.eventBind(this.container,"click", Rico.eventHandle(this,'selectColor'), false);
+    this.close();
+  },
+
+/** @private */
+  selectColor: function(e) {
+    Rico.eventStop(e);
+    if (this.returnValue) this.returnValue(this.currentValue);
+    this.close();
+  },
+
+/* This function runs when you move your mouse over a color block */
+/** @private */
+  highlightColor: function(e) {
+    var elem = Rico.eventElement(e);
+    if (!elem.tagName || elem.tagName.toLowerCase() != 'td') return;
+    var c=Rico.Color.createColorFromBackground(elem).toString();
+    this.currentValue = c;
+    Rico.setStyle('colorPickerSelectedColor', {backgroundColor:c});
+    var d = Rico.$("colorPickerSelectedColorValue");
+    if (d) d.innerHTML = c;
+  }
+};
diff --git a/minsrc/ricoDragDrop.js b/minsrc/ricoDragDrop.js
new file mode 100644 (file)
index 0000000..5eafd1a
--- /dev/null
@@ -0,0 +1,577 @@
+/*
+ *  (c) 2005-2009 Richard Cowin (http://openrico.org)
+ *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
+ *  file except in compliance with the License. You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software distributed under the
+ *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ *  either express or implied. See the License for the specific language governing permissions
+ *  and limitations under the License.
+ */
+
+Rico.dndMgrList = [];
+
+Rico.registerDraggable = function(aDraggable, mgrIdx) {
+  if (typeof mgrIdx != 'number') mgrIdx=0;
+  if (typeof Rico.dndMgrList[mgrIdx] != 'object')
+    Rico.dndMgrList[mgrIdx] = new Rico.dndMgr();
+  Rico.dndMgrList[mgrIdx].registerDraggable(aDraggable);
+};
+
+Rico.registerDropZone = function(aDropZone, mgrIdx) {
+  if (typeof mgrIdx != 'number') mgrIdx=0;
+  if (typeof Rico.dndMgrList[mgrIdx] != 'object')
+    Rico.dndMgrList[mgrIdx] = new Rico.dndMgr();
+  Rico.dndMgrList[mgrIdx].registerDropZone(aDropZone);
+};
+
+Rico.dndMgr = function() {
+  this.initialize();
+};
+
+Rico.dndMgr.prototype = {
+/**
+ * @class Implements drag-n-drop manager -- a group of linked draggables and drop zones
+ * @constructs
+ */
+   initialize: function() {
+      this.dropZones                = [];
+      this.draggables               = [];
+      this.currentDragObjects       = [];
+      this.dragElement              = null;
+      this.lastSelectedDraggable    = null;
+      this.currentDragObjectVisible = false;
+      this.interestedInMotionEvents = false;
+      this._mouseDown = Rico.eventHandle(this,'_mouseDownHandler');
+      this._mouseMove = Rico.eventHandle(this,'_mouseMoveHandler');
+      this._mouseUp = Rico.eventHandle(this,'_mouseUpHandler');
+   },
+
+   registerDropZone: function(aDropZone) {
+      this.dropZones[ this.dropZones.length ] = aDropZone;
+   },
+
+   deregisterDropZone: function(aDropZone) {
+      var newDropZones = new Array();
+      var j = 0;
+      for ( var i = 0 ; i < this.dropZones.length ; i++ ) {
+         if ( this.dropZones[i] != aDropZone )
+            newDropZones[j++] = this.dropZones[i];
+      }
+
+      this.dropZones = newDropZones;
+   },
+
+   clearDropZones: function() {
+      this.dropZones = new Array();
+   },
+
+   registerDraggable: function( aDraggable ) {
+      this.draggables[ this.draggables.length ] = aDraggable;
+      var htmlElement = aDraggable.getMouseDownHTMLElement();
+      if ( htmlElement != null ) {
+         htmlElement.ricoDraggable = aDraggable;
+         Rico.eventBind(htmlElement, "mousedown", Rico.eventHandle(this,'_attachEvents'));
+         Rico.eventBind(htmlElement, "mousedown", this._mouseDown);
+      }
+   },
+
+   clearSelection: function() {
+      for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
+         this.currentDragObjects[i].deselect();
+      this.currentDragObjects = new Array();
+      this.lastSelectedDraggable = null;
+   },
+
+   hasSelection: function() {
+      return this.currentDragObjects.length > 0;
+   },
+
+   setStartDragFromElement: function( e, mouseDownElement ) {
+      this.origPos = Rico.cumulativeOffset(mouseDownElement);
+      var coord=Rico.eventClient(e);
+      this.startx = coord.x - this.origPos.left;
+      this.starty = coord.y - this.origPos.top;
+
+      this.interestedInMotionEvents = this.hasSelection();
+      Rico.eventStop(e);
+   },
+
+   updateSelection: function( draggable, extendSelection ) {
+      if ( ! extendSelection )
+         this.clearSelection();
+
+      if ( draggable.isSelected() ) {
+         this.currentDragObjects=this.currentDragObjects.without(draggable);
+         draggable.deselect();
+         if ( draggable == this.lastSelectedDraggable )
+            this.lastSelectedDraggable = null;
+      }
+      else {
+         draggable.select();
+         if ( draggable.isSelected() ) {
+           this.currentDragObjects.push(draggable);
+           this.lastSelectedDraggable = draggable;
+         }
+      }
+   },
+
+   _mouseDownHandler: function(e) {
+      // if not button 1 ignore it...
+      if (!Rico.eventLeftClick(e)) return;
+
+      var eventTarget      = Rico.eventElement(e);
+      var draggableObject  = eventTarget.ricoDraggable;
+
+      var candidate = eventTarget;
+      while (draggableObject == null && candidate.parentNode) {
+         candidate = candidate.parentNode;
+         draggableObject = candidate.ricoDraggable;
+      }
+
+      if ( draggableObject == null ) return;
+
+      this.updateSelection( draggableObject, e.ctrlKey );
+
+      // clear the drop zones postion cache...
+      if ( this.hasSelection() ) {
+         for ( var i = 0 ; i < this.dropZones.length ; i++ )
+            this.dropZones[i].clearPositionCache();
+      }
+      this.setStartDragFromElement( e, draggableObject.getMouseDownHTMLElement() );
+   },
+
+
+   _mouseMoveHandler: function(e) {
+      if ( !this.interestedInMotionEvents ) {
+         return;
+      }
+
+      if ( ! this.hasSelection() )
+         return;
+
+      if ( ! this.currentDragObjectVisible )
+         this._startDrag(e);
+
+      if ( !this.activatedDropZones )
+         this._activateRegisteredDropZones();
+
+      this._updateDraggableLocation(e);
+      this._updateDropZonesHover(e);
+
+      Rico.eventStop(e);
+   },
+
+   _makeDraggableObjectVisible: function(e) {
+      if ( !this.hasSelection() )
+         return;
+
+      var dragElement;
+      if ( this.currentDragObjects.length > 1 )
+         dragElement = this.currentDragObjects[0].getMultiObjectDragGUI(this.currentDragObjects);
+      else
+         dragElement = this.currentDragObjects[0].getSingleObjectDragGUI();
+
+      // go ahead and absolute position it...
+      this.dragElemPosition=Rico.getStyle(dragElement, "position");
+      if (this.dragElemPosition != "absolute")
+         dragElement.style.position = "absolute";
+
+      // need to parent him into the document...
+      if ( dragElement.parentNode == null || dragElement.parentNode.nodeType == 11 )
+         document.body.appendChild(dragElement);
+
+      this.dragElement = dragElement;
+      this._updateDraggableLocation(e);
+
+      this.currentDragObjectVisible = true;
+   },
+
+   _leftOffset: function(e) {
+          return e.offsetX ? document.body.scrollLeft : 0;
+       },
+
+   _topOffset: function(e) {
+          return e.offsetY ? document.body.scrollTop : 0;
+       },
+
+
+   _updateDraggableLocation: function(e) {
+      var dragObjectStyle = this.dragElement.style;
+      var coord=Rico.eventClient(e);
+      dragObjectStyle.left = (coord.x + this._leftOffset(e) - this.startx) + "px";
+      dragObjectStyle.top  = (coord.y + this._topOffset(e) - this.starty) + "px";
+   },
+
+   _updateDropZonesHover: function(e) {
+      var i,n = this.dropZones.length;
+      for ( i = 0 ; i < n ; i++ ) {
+         if ( ! this._mousePointInDropZone( e, this.dropZones[i] ) )
+            this.dropZones[i].hideHover();
+      }
+
+      for ( i = 0 ; i < n ; i++ ) {
+         if ( this._mousePointInDropZone( e, this.dropZones[i] ) ) {
+            if ( this.dropZones[i].canAccept(this.currentDragObjects) )
+               this.dropZones[i].showHover();
+         }
+      }
+   },
+
+   _startDrag: function(e) {
+      for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
+         this.currentDragObjects[i].startDrag();
+      this._makeDraggableObjectVisible(e);
+   },
+
+   _mouseUpHandler: function(e) {
+      if ( ! this.hasSelection() ) return;
+      if (!Rico.eventLeftClick(e)) return;
+
+      this.interestedInMotionEvents = false;
+
+      if ( this._placeDraggableInDropZone(e) )
+         this._completeDropOperation(e);
+      else if (this.dragElement != null) {
+         Rico.eventStop(e);
+         var self=this;
+         Rico.animate(this.dragElement,
+                      {duration: 300, onEnd: function() { self._doCancelDragProcessing(); } },
+                      {left:this.origPos.left, top:this.origPos.top});
+      }
+
+     Rico.eventUnbind(document.body, "mousemove", this._mouseMove);
+     Rico.eventUnbind(document.body, "mouseup",  this._mouseUp);
+   },
+
+   _retTrue: function () {
+      return true;
+   },
+
+   _completeDropOperation: function(e) {
+      if ( this.dragElement != this.currentDragObjects[0].getMouseDownHTMLElement() ) {
+         if ( this.dragElement.parentNode != null )
+            this.dragElement.parentNode.removeChild(this.dragElement);
+      }
+
+      this._deactivateRegisteredDropZones();
+      this._endDrag();
+      this.clearSelection();
+      this.dragElement = null;
+      this.currentDragObjectVisible = false;
+      Rico.eventStop(e);
+   },
+
+   _doCancelDragProcessing: function() {
+      this._cancelDrag();
+      if ( this.dragElement == this.currentDragObjects[0].getMouseDownHTMLElement() ) {
+         this.dragElement.style.position=this.dragElemPosition;
+      } else {
+         if ( this.dragElement && this.dragElement.parentNode != null )
+            this.dragElement.parentNode.removeChild(this.dragElement);
+      }
+      this._deactivateRegisteredDropZones();
+      this.dragElement = null;
+      this.currentDragObjectVisible = false;
+   },
+
+   _placeDraggableInDropZone: function(e) {
+      var foundDropZone = false;
+      var n = this.dropZones.length;
+      for ( var i = 0 ; i < n ; i++ ) {
+         if ( this._mousePointInDropZone( e, this.dropZones[i] ) ) {
+            if ( this.dropZones[i].canAccept(this.currentDragObjects) ) {
+               this.dropZones[i].hideHover();
+               this.dropZones[i].accept(this.currentDragObjects);
+               foundDropZone = true;
+               break;
+            }
+         }
+      }
+
+      return foundDropZone;
+   },
+
+   _cancelDrag: function() {
+      for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
+         this.currentDragObjects[i].cancelDrag();
+   },
+
+   _endDrag: function() {
+      for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
+         this.currentDragObjects[i].endDrag();
+   },
+
+   _mousePointInDropZone: function( e, dropZone ) {
+
+      var absoluteRect = dropZone.getAbsoluteRect();
+      var coord=Rico.eventClient(e);
+
+      return coord.x  > absoluteRect.left + this._leftOffset(e) &&
+             coord.x  < absoluteRect.right + this._leftOffset(e) &&
+             coord.y  > absoluteRect.top + this._topOffset(e)   &&
+             coord.y  < absoluteRect.bottom + this._topOffset(e);
+   },
+
+   _activateRegisteredDropZones: function() {
+      var n = this.dropZones.length;
+      for ( var i = 0 ; i < n ; i++ ) {
+         var dropZone = this.dropZones[i];
+         if ( dropZone.canAccept(this.currentDragObjects) )
+            dropZone.activate();
+      }
+
+      this.activatedDropZones = true;
+   },
+
+   _deactivateRegisteredDropZones: function() {
+      var n = this.dropZones.length;
+      for ( var i = 0 ; i < n ; i++ )
+         this.dropZones[i].deactivate();
+      this.activatedDropZones = false;
+   },
+
+   _attachEvents: function () {
+     Rico.eventBind(document.body, "mousemove", this._mouseMove);
+     Rico.eventBind(document.body, "mouseup",  this._mouseUp);
+   }
+
+};
+
+
+Rico.Draggable = function(type, htmlElement) {
+  this.initialize(type, htmlElement);
+};
+
+Rico.Draggable.prototype = {
+/**
+ * @class Implements behavior for a draggable element
+ * @constructs
+ */
+   initialize: function( type, htmlElement ) {
+      this.type          = type;
+      this.htmlElement   = Rico.$(htmlElement);
+      this.selected      = false;
+   },
+
+   /**
+    *   Returns the HTML element that should have a mouse down event
+    *   added to it in order to initiate a drag operation
+    **/
+   getMouseDownHTMLElement: function() {
+      return this.htmlElement;
+   },
+
+   select: function() {
+      this._select();
+   },
+
+   _select: function() {
+      this.selected = true;
+      if (this.showingSelected) return;
+      this.showingSelected = true;
+
+      var htmlElement = this.getMouseDownHTMLElement();
+      var color = Rico.Color.createColorFromBackground(htmlElement);
+      color.isBright() ? color.darken(0.033) : color.brighten(0.033);
+      this.saveBackground = Rico.getStyle(htmlElement, "backgroundColor", "background-color");
+      htmlElement.style.backgroundColor = color.asHex();
+   },
+
+   deselect: function() {
+      this.selected = false;
+      if (!this.showingSelected) return;
+      var htmlElement = this.getMouseDownHTMLElement();
+      htmlElement.style.backgroundColor = this.saveBackground;
+      this.showingSelected = false;
+   },
+
+   isSelected: function() {
+      return this.selected;
+   },
+
+   startDrag: function() {
+   },
+
+   cancelDrag: function() {
+   },
+
+   endDrag: function() {
+   },
+
+   getSingleObjectDragGUI: function() {
+      return this.htmlElement;
+   },
+
+   getMultiObjectDragGUI: function( draggables ) {
+      return this.htmlElement;
+   },
+
+   getDroppedGUI: function() {
+      return this.htmlElement;
+   },
+
+   toString: function() {
+      return this.type + ":" + this.htmlElement + ":";
+   }
+
+};
+
+
+Rico.LiveGridDraggable = function(grid, rownum, colnum) {
+  this.initialize(grid, rownum, colnum);
+};
+
+Rico.LiveGridDraggable.prototype = Rico.extend(new Rico.Draggable(), {
+/**
+ * @class Enables draggable behavior for LiveGrid cells.
+ * Called by LiveGrid#appendBlankRow for columns where canDrag is true.
+ * @extends Rico.Draggable
+ * @constructs
+ */
+  initialize: function( grid, rownum, colnum) {\r
+    this.type        = 'RicoCell';\r
+    this.htmlElement = grid.cell(rownum,colnum);\r
+    this.liveGrid    = grid;\r
+    this.dragRow     = rownum;\r
+    this.dragCol     = colnum;\r
+  },\r
+\r
+  select: function() {
+    if (this.dragRow >= this.liveGrid.buffer.totalRows) return;
+    this.selected = true;
+    this.showingSelected = true;
+  },
+
+  deselect: function() {
+    this.selected = false;
+    this.showingSelected = false;
+  },
+
+  getSingleObjectDragGUI: function() {\r
+    var div = document.createElement("div");\r
+    div.className = 'LiveGridDraggable';\r
+    div.style.width = (this.htmlElement.offsetWidth - 10) + "px";\r
+    div.innerHTML=this.htmlElement.innerHTML;
+    return div;\r
+  }\r
+});\r
+
+
+Rico.Dropzone = function(htmlElement) {
+  this.initialize(htmlElement);
+};
+
+Rico.Dropzone.prototype = {
+/**
+ * @class Implements behavior for a drop zone
+ * @constructs
+ */
+   initialize: function( htmlElement ) {
+      this.htmlElement  = Rico.$(htmlElement);
+      this.absoluteRect = null;
+   },
+
+   getHTMLElement: function() {
+      return this.htmlElement;
+   },
+
+   clearPositionCache: function() {
+      this.absoluteRect = null;
+   },
+
+   getAbsoluteRect: function() {
+      if ( this.absoluteRect == null ) {
+         var htmlElement = this.getHTMLElement();
+         var pos = Rico.viewportOffset(htmlElement);
+
+         this.absoluteRect = {
+            top:    pos.top,
+            left:   pos.left,
+            bottom: pos.top + htmlElement.offsetHeight,
+            right:  pos.left + htmlElement.offsetWidth
+         };
+      }
+      return this.absoluteRect;
+   },
+
+   activate: function() {
+      var htmlElement = this.getHTMLElement();
+      if (htmlElement == null  || this.showingActive)
+         return;
+
+      this.showingActive = true;
+      this.saveBackgroundColor = htmlElement.style.backgroundColor;
+
+      var fallbackColor = "#ffea84";
+      var currentColor = Rico.Color.createColorFromBackground(htmlElement);
+      if ( currentColor == null )
+         htmlElement.style.backgroundColor = fallbackColor;
+      else {
+         currentColor.isBright() ? currentColor.darken(0.2) : currentColor.brighten(0.2);
+         htmlElement.style.backgroundColor = currentColor.asHex();
+      }
+   },
+
+   deactivate: function() {
+      var htmlElement = this.getHTMLElement();
+      if (htmlElement == null || !this.showingActive)
+         return;
+
+      htmlElement.style.backgroundColor = this.saveBackgroundColor;
+      this.showingActive = false;
+      this.saveBackgroundColor = null;
+   },
+
+   showHover: function() {
+      var htmlElement = this.getHTMLElement();
+      if ( htmlElement == null || this.showingHover )
+         return;
+
+      this.saveBorderWidth = htmlElement.style.borderWidth;
+      this.saveBorderStyle = htmlElement.style.borderStyle;
+      this.saveBorderColor = htmlElement.style.borderColor;
+
+      this.showingHover = true;
+      htmlElement.style.borderWidth = "1px";
+      htmlElement.style.borderStyle = "solid";
+      //htmlElement.style.borderColor = "#ff9900";
+      htmlElement.style.borderColor = "#ffff00";
+   },
+
+   hideHover: function() {
+      var htmlElement = this.getHTMLElement();
+      if ( htmlElement == null || !this.showingHover )
+         return;
+
+      htmlElement.style.borderWidth = this.saveBorderWidth;
+      htmlElement.style.borderStyle = this.saveBorderStyle;
+      htmlElement.style.borderColor = this.saveBorderColor;
+      this.showingHover = false;
+   },
+
+   canAccept: function(draggableObjects) {
+      return true;
+   },
+
+   accept: function(draggableObjects) {
+      var htmlElement = this.getHTMLElement();
+      if ( htmlElement == null )
+         return;
+
+      var n = draggableObjects.length;
+      for ( var i = 0 ; i < n ; i++ ) {
+         var theGUI = draggableObjects[i].getDroppedGUI();
+         if ( Rico.getStyle( theGUI, "position" ) == "absolute" ) {
+            theGUI.style.position = "static";
+            theGUI.style.top = "";
+            theGUI.style.top = "";
+         }
+         htmlElement.appendChild(theGUI);
+      }
+   }
+};
diff --git a/minsrc/ricoGridCommon.js b/minsrc/ricoGridCommon.js
new file mode 100644 (file)
index 0000000..7ecaa99
--- /dev/null
@@ -0,0 +1,980 @@
+/*
+ *  (c) 2005-2009 Richard Cowin (http://openrico.org)
+ *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
+ *  file except in compliance with the License. You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software distributed under the
+ *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ *  either express or implied. See the License for the specific language governing permissions
+ *  and limitations under the License.
+ */
+
+if(typeof Rico=='undefined') throw("GridCommon requires the Rico JavaScript framework");
+
+/**
+ * Define methods that are common to both SimpleGrid and LiveGrid
+ */
+Rico.GridCommon = {
+
+  baseInit: function() {
+    this.options = {
+      saveColumnInfo   : {width:true, filter:false, sort:false},  // save info in cookies?
+      cookiePrefix     : 'RicoGrid.',
+      allowColResize   : true,      // allow user to resize columns
+      windowResize     : true,      // Resize grid on window.resize event? Set to false when embedded in an accordian.
+      click            : null,
+      dblclick         : null,
+      contextmenu      : null,
+      menuEvent        : 'dblclick',  // event that triggers menus - click, dblclick, contextmenu, or none (no menus)
+      defaultWidth     : -1,          // if -1, then use unformatted column width
+      scrollBarWidth   : 19,          // this is the value used in positioning calculations, it does not actually change the width of the scrollbar
+      minScrollWidth   : 100,         // min scroll area width when width of frozen columns exceeds window width
+      frozenColumns    : 0,
+      exportWindow     : "height=400,width=500,scrollbars=1,menubar=1,resizable=1",
+      exportStyleList  : ['background-color','color','text-align','font-weight','font-size','font-family'],
+      exportImgTags    : false,       // applies to grid header and to SimpleGrid cells (not LiveGrid cells)
+      exportFormFields : true,
+      FilterLocation   : null,        // heading row number to place filters. -1=add a new heading row.
+      FilterAllToken   : '___ALL___', // select box value to use to indicate ALL
+      columnSpecs      : []
+    };
+    this.colWidths = [];
+    this.hdrCells=[];
+    this.headerColCnt=0;
+    this.headerRowIdx=0;       // row in header which gets resizers (no colspan's in this row)
+    this.tabs=new Array(2);
+    this.thead=new Array(2);
+    this.tbody=new Array(2);
+  },
+
+  attachMenuEvents: function() {
+    var i;
+    if (!this.options.menuEvent || this.options.menuEvent=='none') return;
+    this.hideScroll=navigator.userAgent.match(/Macintosh\b.*\b(Firefox|Camino)\b/i) || (Rico.isOpera && parseFloat(window.opera.version())<9.5);
+    this.options[this.options.menuEvent]=Rico.eventHandle(this,'handleMenuClick');
+    if (this.highlightDiv) {
+      switch (this.options.highlightElem) {
+        case 'cursorRow':
+          this.attachMenu(this.highlightDiv[0]);
+          break;
+        case 'cursorCell':
+          for (i=0; i<2; i++) {
+            this.attachMenu(this.highlightDiv[i]);
+          }
+          break;
+      }
+    }
+    for (i=0; i<2; i++) {
+      this.attachMenu(this.tbody[i]);
+    }
+  },
+
+  attachMenu: function(elem) {
+    if (this.options.click)
+      Rico.eventBind(elem, 'click', this.options.click, false);
+    if (this.options.dblclick) {
+      if (Rico.isWebKit || Rico.isOpera)
+        Rico.eventBind(elem, 'click', Rico.eventHandle(this,'handleDblClick'), false);
+      else
+        Rico.eventBind(elem, 'dblclick', this.options.dblclick, false);
+    }
+    if (this.options.contextmenu) {
+      if (Rico.isOpera || Rico.isKonqueror)
+        Rico.eventBind(elem, 'click', Rico.eventHandle(this,'handleContextMenu'), false);
+      else
+        Rico.eventBind(elem, 'contextmenu', this.options.contextmenu, false);
+    }
+  },
+
+/**
+ * implement double-click for browsers that don't support a double-click event (e.g. Safari)
+ */
+  handleDblClick: function(e) {
+    var elem=Rico.eventElement(e);
+    if (this.dblClickElem == elem) {
+      this.options.dblclick(e);
+    } else {
+      this.dblClickElem = elem;
+      this.safariTimer=Rico.runLater(300,this,'clearDblClick');
+    }
+  },
+
+  clearDblClick: function() {
+    this.dblClickElem=null;
+  },
+
+/**
+ * implement right-click for browsers that don't support contextmenu event (e.g. Opera, Konqueror)
+ * use control-click instead
+ */
+  handleContextMenu: function(e) {
+    var b;
+    if( typeof( e.which ) == 'number' )
+      b = e.which; //Netscape compatible
+    else if( typeof( e.button ) == 'number' )
+      b = e.button; //DOM
+    else
+      return;
+    if (b==1 && e.ctrlKey) {
+      this.options.contextmenu(e);
+    }
+  },
+
+  cancelMenu: function() {
+    if (this.menu) this.menu.cancelmenu();
+  },
+
+/**
+ * gather info from original headings
+ */
+  getColumnInfo: function(hdrSrc) {
+    Rico.log('getColumnInfo: len='+hdrSrc.length);
+    if (hdrSrc.length == 0) return 0;
+    this.headerRowCnt=hdrSrc.length;
+    var r,c,colcnt;
+    for (r=0; r<this.headerRowCnt; r++) {
+      var headerRow = hdrSrc[r];
+      var headerCells=headerRow.cells;
+      if (r >= this.hdrCells.length) this.hdrCells[r]=[];
+      for (c=0; c<headerCells.length; c++) {
+        var obj={};
+        obj.cell=headerCells[c];
+        obj.colSpan=headerCells[c].colSpan || 1;  // Safari & Konqueror return default colspan of 0
+        if (this.options.defaultWidth < 0) obj.initWidth=headerCells[c].offsetWidth;
+        this.hdrCells[r].push(obj);
+      }
+      if (headerRow.id.slice(-5)=='_main') {
+        colcnt=this.hdrCells[r].length;
+        this.headerRowIdx=r;
+      }
+    }
+    if (!colcnt) {
+      this.headerRowIdx=this.headerRowCnt-1;
+      colcnt=this.hdrCells[this.headerRowIdx].length;
+    }
+    Rico.log("getColumnInfo: colcnt="+colcnt);
+    return colcnt;
+  },
+
+  addHeadingRow: function(className) {
+    var r=this.headerRowCnt++;
+    this.hdrCells[r]=[];
+    for( var h=0; h < 2; h++ ) {
+      var row = this.thead[h].insertRow(-1);
+      var newClass='ricoLG_hdg '+this.tableId+'_hdg'+r;
+      if (className) newClass+=' '+className;
+      row.className=newClass;
+      var limit= h==0 ? this.options.frozenColumns : this.headerColCnt-this.options.frozenColumns;
+      for( var c=0; c < limit; c++ ) {
+        var hdrCell=row.insertCell(-1);
+        var colDiv=Rico.wrapChildren(hdrCell,'ricoLG_col');
+        Rico.wrapChildren(colDiv,'ricoLG_cell');
+        this.hdrCells[r].push({cell:hdrCell,colSpan:1});
+      }
+    }
+    return r;
+  },
+  
+/**
+ * create column array
+ */
+  createColumnArray: function(columnType) {
+    this.direction=Rico.getStyle(this.outerDiv,'direction').toLowerCase();  // ltr or rtl
+    this.align=this.direction=='rtl' ? ['right','left'] : ['left','right'];
+    Rico.log('createColumnArray: dir='+this.direction);
+    this.columns = [];
+    for (var c=0; c < this.headerColCnt; c++) {
+      Rico.log("createColumnArray: c="+c);
+      var tabidx=c<this.options.frozenColumns ? 0 : 1;
+      var col=new Rico[columnType](this, c, this.hdrCells[this.headerRowIdx][c], tabidx);
+      this.columns.push(col);
+      if (c > 0) this.columns[c-1].next=col;
+    }
+    this.getCookie();
+    Rico.runLater(100,this,'insertResizers');  // avoids peek-a-boo bug in column 1 in IE6/7
+  },
+
+/**
+ * Insert resizing handles
+ */
+  insertResizers: function() {
+    if (!this.options.allowColResize) return;
+    for (var x=0;x<this.columns.length;x++) {
+      this.columns[x].insertResizer();
+    }
+  },
+
+/**
+ * Create div structure
+ */
+  createDivs: function() {
+    Rico.log("createDivs start");
+    this.outerDiv   = this.createDiv("outer");
+    if (Rico.theme.widget) Rico.addClass(this.outerDiv,Rico.theme.widget);
+    if (this.outerDiv.firstChild && this.outerDiv.firstChild.tagName && this.outerDiv.firstChild.tagName.toUpperCase()=='TABLE') {
+      this.structTab=this.outerDiv.firstChild;
+      this.structTabLeft=this.structTab.rows[0].cells[0];
+      this.structTabUR=this.structTab.rows[0].cells[1];
+      this.structTabLR=this.structTab.rows[1].cells[0];
+    } else {
+      this.structTab = document.createElement("table");
+      this.structTab.border=0;
+      this.structTab.cellPadding=0;
+      this.structTab.cellSpacing=0;
+      var tr1=this.structTab.insertRow(-1);
+      tr1.vAlign='top';
+      this.structTabLeft=tr1.insertCell(-1);
+      this.structTabLeft.rowSpan=2;
+      var tr2=this.structTab.insertRow(-1);
+      tr2.vAlign='top';
+      this.structTabUR=tr1.insertCell(-1);
+      this.structTabLR=tr2.insertCell(-1);
+      this.outerDiv.appendChild(this.structTab);
+    }
+    //this.structTabLR.style.overflow='hidden';
+    //if (Rico.isOpera) this.outerDiv.style.overflow="hidden";
+    this.frozenTabs = this.createDiv("frozenTabs",this.structTabLeft);
+    this.innerDiv   = this.createDiv("inner",this.structTabUR);
+    this.scrollDiv  = this.createDiv("scroll",this.structTabLR);
+    this.resizeDiv  = this.createDiv("resize",this.outerDiv,true);
+    this.exportDiv  = this.createDiv("export",this.outerDiv,true);
+
+    this.messagePopup=new Rico.Popup();
+    this.messagePopup.createContainer({hideOnEscape:false, hideOnClick:false, parent:this.outerDiv});
+    this.messagePopup.content.className='ricoLG_messageDiv';
+    if (Rico.theme.gridMessage) Rico.addClass(this.messagePopup.content,Rico.theme.gridMessage);
+
+    this.keywordPopup=new Rico.Window('', {zIndex:-1, parent:this.outerDiv});
+    Rico.addClass(this.keywordPopup.container, 'ricoLG_keywordDiv');
+    var instructions=this.keywordPopup.contentDiv.appendChild(document.createElement("p"));
+    instructions.innerHTML=Rico.getPhraseById("keywordPrompt");
+    this.keywordBox=this.keywordPopup.contentDiv.appendChild(document.createElement("input"));
+    this.keywordBox.size=20;
+    Rico.eventBind(this.keywordBox,"keypress", Rico.eventHandle(this,'keywordKey'), false);
+    this.keywordPopup.contentDiv.appendChild(Rico.floatButton('Checkmark', Rico.eventHandle(this,'processKeyword')));
+    var s=this.keywordPopup.contentDiv.appendChild(document.createElement("p"));
+    Rico.setStyle(s,{clear:'both'});
+
+    //this.frozenTabs.style[this.align[0]]='0px';
+    //this.innerDiv.style[this.align[0]]='0px';
+    Rico.log("createDivs end");
+  },
+  
+  keywordKey: function(e) {
+    switch (Rico.eventKey(e)) {
+      case 27: this.closeKeyword(); Rico.eventStop(e); return false;
+      case 13: this.processKeyword(); Rico.eventStop(e); return false;
+    }
+    return true;
+  },
+  
+  openKeyword: function(colnum) {
+    this.keywordCol=colnum;
+    this.keywordBox.value='';
+    this.keywordPopup.setTitle(this.columns[colnum].displayName);
+    this.keywordPopup.centerPopup();
+    this.keywordBox.focus();
+  },
+  
+  closeKeyword: function() {
+    this.keywordPopup.closePopup();
+    this.cancelMenu();
+  },
+  
+  processKeyword: function() {
+    var keyword=this.keywordBox.value;
+    this.closeKeyword();
+    this.columns[this.keywordCol].setFilterKW(keyword);
+  },
+
+/**
+ * Create a div and give it a standardized id and class name.
+ * If the div already exists, then just assign the class name.
+ */
+  createDiv: function(elemName,elemParent,hidden) {
+    var id=this.tableId+"_"+elemName+"Div";
+    var newdiv=document.getElementById(id);
+    if (!newdiv) {
+      newdiv = document.createElement("div");
+      newdiv.id = id;
+      if (elemParent) elemParent.appendChild(newdiv);
+    }
+    newdiv.className = "ricoLG_"+elemName+"Div";
+    if (hidden) Rico.hide(newdiv);
+    return newdiv;
+  },
+
+/**
+ * Common code used to size & position divs in both SimpleGrid & LiveGrid
+ */
+  baseSizeDivs: function() {
+    this.setOtherHdrCellWidths();
+
+    if (this.options.frozenColumns) {
+      Rico.show(this.tabs[0]);
+      Rico.show(this.frozenTabs);
+      // order of next 3 lines is critical in IE6
+      this.hdrHt=Math.max(Rico.nan2zero(this.thead[0].offsetHeight),this.thead[1].offsetHeight);
+      this.dataHt=Math.max(Rico.nan2zero(this.tbody[0].offsetHeight),this.tbody[1].offsetHeight);
+      this.frzWi=this.borderWidth(this.tabs[0]);
+    } else {
+      Rico.hide(this.tabs[0]);
+      Rico.hide(this.frozenTabs);
+      this.frzWi=0;
+      this.hdrHt=this.thead[1].offsetHeight;
+      this.dataHt=this.tbody[1].offsetHeight;
+    }
+
+    var wiLimit,i;
+    var borderWi=this.borderWidth(this.columns[0].dataCell);
+    Rico.log('baseSizeDivs '+this.tableId+': hdrHt='+this.hdrHt+' dataHt='+this.dataHt);
+    Rico.log(this.tableId+' frzWi='+this.frzWi+' borderWi='+borderWi);
+    for (i=0; i<this.options.frozenColumns; i++) {
+      if (this.columns[i].visible) this.frzWi+=parseInt(this.columns[i].colWidth,10)+borderWi;
+    }
+    this.scrTabWi=this.borderWidth(this.tabs[1]);
+    this.scrTabWi0=this.scrTabWi;
+    Rico.log('scrTabWi: '+this.scrTabWi);
+    for (i=this.options.frozenColumns; i<this.columns.length; i++) {
+      if (this.columns[i].visible) this.scrTabWi+=parseInt(this.columns[i].colWidth,10)+borderWi;
+    }
+    this.scrWi=this.scrTabWi+this.options.scrollBarWidth;
+    if (this.sizeTo=='parent') {
+      if (Rico.isIE) Rico.hide(this.outerDiv);
+      wiLimit=this.outerDiv.parentNode.offsetWidth;
+      if (Rico.isIE) Rico.show(this.outerDiv);
+    }  else {
+      wiLimit=Rico.windowWidth()-this.options.scrollBarWidth-8;
+    }
+    if (this.outerDiv.parentNode.clientWidth > 0)
+      wiLimit=Math.min(this.outerDiv.parentNode.clientWidth, wiLimit);
+    var overage=this.frzWi+this.scrWi-wiLimit;
+    Rico.log('baseSizeDivs '+this.tableId+': scrWi='+this.scrWi+' wiLimit='+wiLimit+' overage='+overage+' clientWidth='+this.outerDiv.parentNode.clientWidth);
+    if (overage > 0 && this.options.frozenColumns < this.columns.length)
+      this.scrWi=Math.max(this.scrWi-overage, this.options.minScrollWidth);
+    this.scrollDiv.style.width=this.scrWi+'px';
+    //this.scrollDiv.style.top=this.hdrHt+'px';
+    //this.frozenTabs.style.width=this.scrollDiv.style[this.align[0]]=this.innerDiv.style[this.align[0]]=this.frzWi+'px';
+    this.frozenTabs.style.width=this.frzWi+'px';
+    this.outerDiv.style.width=(this.frzWi+this.scrWi)+'px';
+  },
+
+/**
+ * Returns the sum of the left & right border widths of an element
+ */
+  borderWidth: function(elem) {
+    var l=Rico.nan2zero(Rico.getStyle(elem,'borderLeftWidth'));
+    var r=Rico.nan2zero(Rico.getStyle(elem,'borderRightWidth'));
+    Rico.log((elem.id || elem.tagName)+' borderWidth: L='+l+', R='+r);
+    return l + r;
+//    return Rico.nan2zero(Rico.getStyle(elem,'borderLeftWidth')) + Rico.nan2zero(Rico.getStyle(elem,'borderRightWidth'));
+  },
+
+  setOtherHdrCellWidths: function() {
+    var c,i,j,r,w,hdrcell,cell,origSpan,newSpan,divs;
+    for (r=0; r<this.hdrCells.length; r++) {
+      if (r==this.headerRowIdx) continue;
+      Rico.log('setOtherHdrCellWidths: r='+r);
+      c=i=0;
+      while (i<this.headerColCnt && c<this.hdrCells[r].length) {
+        hdrcell=this.hdrCells[r][c];
+        cell=hdrcell.cell;
+        origSpan=newSpan=hdrcell.colSpan;
+        for (w=j=0; j<origSpan; j++, i++) {
+          if (this.columns[i].hdrCell.style.display=='none')
+            newSpan--;
+          else if (this.columns[i].hdrColDiv.style.display!='none')
+            w+=parseInt(this.columns[i].colWidth,10);
+        }
+        if (!hdrcell.hdrColDiv || !hdrcell.hdrCellDiv) {
+          divs=cell.getElementsByTagName('div');
+          hdrcell.hdrColDiv=(divs.length<1) ? Rico.wrapChildren(cell,'ricoLG_col') : divs[0];
+          hdrcell.hdrCellDiv=(divs.length<2) ? Rico.wrapChildren(hdrcell.hdrColDiv,'ricoLG_cell') : divs[1];
+        }
+        if (newSpan==0) {
+          cell.style.display='none';
+        } else if (w==0) {
+          hdrcell.hdrColDiv.style.display='none';
+          cell.colSpan=newSpan;
+        } else {
+          cell.style.display='';
+          hdrcell.hdrColDiv.style.display='';
+          cell.colSpan=newSpan;
+          hdrcell.hdrColDiv.style.width=w+'px';
+        }
+        c++;
+      }
+    }
+  },
+
+  initFilterImage: function(filterRowNum){
+    this.filterAnchor=document.getElementById(this.tableId+'_filterLink');
+    if (!this.filterAnchor) return;
+    this.filterRows=Rico.select('tr.'+this.tableId+'_hdg'+filterRowNum);
+    if (this.filterRows.length!=2) return;
+    for (var i=0, r=[]; i<2; i++) r[i]=Rico.select('.ricoLG_cell',this.filterRows[i]);
+    this.filterElements=r[0].concat(r[1]);
+    this.saveHeight = this.filterElements[0].offsetHeight;
+    var pt=Rico.getStyle(this.filterElements[0],'paddingTop');
+    var pb=Rico.getStyle(this.filterElements[0],'paddingBottom');
+    if (pt) this.saveHeight-=parseInt(pt,10);
+    if (pb) this.saveHeight-=parseInt(pb,10);
+    this.rowNum = filterRowNum;
+    this.setFilterImage(false);
+    //Rico.eventBind(this.filterAnchor, 'click', Rico.eventHandle(this,'toggleFilterRow'), false);
+  },
+
+  toggleFilterRow: function() {
+    if ( Rico.visible(this.filterRows[0]) )
+      this.slideFilterUp();
+    else
+      this.slideFilterDown();
+  },
+
+  setFilterImage: function(expandFlag) {
+    var altText=Rico.getPhraseById((expandFlag ? 'show' : 'hide')+'FilterRow');
+    this.filterAnchor.innerHTML = '<img src="'+Rico.imgDir+'tableFilter'+(expandFlag ? 'Expand' : 'Collapse')+'.gif" alt="'+altText+'" border="0">';
+  },
+
+/**
+ * Returns a div for the cell at the specified row and column index.
+ * In SimpleGrid, r can refer to any row in the grid.
+ * In LiveGrid, r refers to a visible row (row 0 is the first visible row).
+ */
+  cell: function(r,c) {
+    return (0<=c && c<this.columns.length && r>=0) ? this.columns[c].cell(r) : null;
+  },
+
+/**
+ * Returns the screen height available for a grid
+ */
+  availHt: function() {
+    var divPos=Rico.cumulativeOffset(this.outerDiv);
+    return Rico.windowHeight()-divPos.top-2*this.options.scrollBarWidth-15;  // allow for scrollbar and some margin
+  },
+
+  setHorizontalScroll: function() {
+    var newLeft=(-this.scrollDiv.scrollLeft)+'px';
+    this.hdrTabs[1].style.marginLeft=newLeft;
+  },
+
+  pluginScroll: function() {
+     if (this.scrollPluggedIn) return;
+     Rico.eventBind(this.scrollDiv,"scroll",this.scrollEventFunc, false);
+     this.scrollPluggedIn=true;
+  },
+
+  unplugScroll: function() {
+     Rico.eventUnbind(this.scrollDiv,"scroll", this.scrollEventFunc , false);
+     this.scrollPluggedIn=false;
+  },
+
+  hideMsg: function() {
+    this.messagePopup.closePopup();
+  },
+
+  showMsg: function(msg) {
+    this.messagePopup.setContent(msg);
+    this.messagePopup.centerPopup();
+    Rico.log("showMsg: "+msg);
+  },
+
+/**
+ * @return array of column objects which have invisible status
+ */
+  listInvisible: function(attr) {
+    var hiddenColumns=[];
+    for (var x=0;x<this.columns.length;x++) {
+      if (!this.columns[x].visible)
+        hiddenColumns.push(attr ? this.columns[x][attr] : this.columns[x]);
+    }
+    return hiddenColumns;
+  },
+
+/**
+ * @return index of left-most visibile column, or -1 if there are no visible columns
+ */
+  firstVisible: function() {
+    for (var x=0;x<this.columns.length;x++) {
+      if (this.columns[x].visible) return x;
+    }
+    return -1;
+  },
+
+/**
+ * Show all columns
+ */
+  showAll: function() {
+    var invisible=this.listInvisible();
+    for (var x=0;x<invisible.length;x++)
+      invisible[x].showColumn();
+  },
+  
+  chooseColumns: function() {
+    this.menu.cancelmenu();
+    var x,z,col,itemDiv,span,contentDiv;\r
+    if (!this.columnChooser) {
+      Rico.log('creating columnChooser');
+      z=Rico.getStyle(this.outerDiv.offsetParent,'zIndex');
+      if (typeof z!='number') z=0;
+      this.columnChooser=new Rico.Window(Rico.getPhraseById('gridChooseCols'), {zIndex:z+2, parent:this.outerDiv});
+      Rico.addClass(this.columnChooser.container, 'ricoLG_chooserDiv');
+      contentDiv=this.columnChooser.contentDiv;
+      for (x=0;x<this.columns.length;x++) {
+        col=this.columns[x];
+        itemDiv=contentDiv.appendChild(document.createElement('div'));
+        col.ChooserBox=Rico.createFormField(itemDiv,'input','checkbox');
+        span=itemDiv.appendChild(document.createElement('span'));
+        span.innerHTML=col.displayName;
+        Rico.eventBind(col.ChooserBox, 'click', Rico.eventHandle(col,'chooseColumn'), false);
+      }
+    }
+    Rico.log('opening columnChooser');
+    this.columnChooser.openPopup(1,this.hdrHt);
+    for (x=0;x<this.columns.length;x++) {
+      this.columns[x].ChooserBox.checked=this.columns[x].visible;
+      this.columns[x].ChooserBox.disabled = !this.columns[x].canHideShow();
+    }
+  },
+
+  blankRow: function(r) {
+    for (var c=0; c < this.columns.length; c++) {
+      this.columns[c].clearCell(r);
+    }
+  },
+  
+  getExportStyles: function(chkelem) {
+    var exportStyles=this.options.exportStyleList;
+    var bgImg=Rico.getStyle(chkelem,'backgroundImage');
+    if (!bgImg || bgImg=='none') return exportStyles;
+    for (var styles=[],i=0; i<exportStyles.length; i++)
+      if (exportStyles[i]!='background-color' && exportStyles[i]!='color') styles.push(exportStyles[i]);
+    return styles;
+  },
+
+/**
+ * Support function for printVisible()
+ */
+  exportStart: function() {
+    var r,c,i,j,hdrcell,newSpan,divs,cell;
+    var exportStyles=this.getExportStyles(this.thead[0]);
+    //alert(exportStyles.join('\n'));
+    this.exportRows=[];
+    this.exportText="<table border='1' cellspacing='0'>";\r
+    for (c=0; c<this.columns.length; c++) {\r
+      if (this.columns[c].visible) this.exportText+="<col width='"+parseInt(this.columns[c].colWidth,10)+"'>";
+    }\r
+    this.exportText+="<thead style='display: table-header-group;'>";
+    if (this.exportHeader) this.exportText+=this.exportHeader;
+    for (r=0; r<this.hdrCells.length; r++) {
+      if (this.hdrCells[r].length==0 || !Rico.visible(this.hdrCells[r][0].cell.parentNode)) continue;
+      this.exportText+="<tr>";
+      for (c=0,i=0; c<this.hdrCells[r].length; c++) {
+        hdrcell=this.hdrCells[r][c];
+        newSpan=hdrcell.colSpan;
+        for (j=0; j<hdrcell.colSpan; j++, i++) {
+          if (!this.columns[i].visible) newSpan--;
+        }
+        if (newSpan > 0) {
+          divs=Rico.select('.ricoLG_cell',hdrcell.cell);
+          cell=divs && divs.length>0 ? divs[0] : hdrcell.cell;
+          this.exportText+="<td style='"+this.exportStyle(cell,exportStyles)+"'";
+          if (hdrcell.colSpan > 1) this.exportText+=" colspan='"+newSpan+"'";
+          this.exportText+=">"+Rico.getInnerText(cell,!this.options.exportImgTags, !this.options.exportFormFields, 'NoExport')+"</td>";
+        }
+      }
+      this.exportText+="</tr>";
+    }
+    this.exportText+="</thead><tbody>";
+  },
+
+/**
+ * Support function for printVisible().
+ * exportType is optional and defaults 'plain'; 'owc' can be used for IE users with Office Web Components.
+ */
+  exportFinish: function(exportType) {
+    if (this.hideMsg) this.hideMsg();
+    window.status=Rico.getPhraseById('exportComplete');
+    if (this.exportRows.length > 0) this.exportText+='<tr>'+this.exportRows.join('</tr><tr>')+'</tr>';
+    if (this.exportFooter) this.exportText+=this.exportFooter;
+    this.exportText+="</tbody></table>";
+    this.exportDiv.innerHTML=this.exportText;
+    this.exportText=undefined;
+    this.exportRows=undefined;
+    if (this.cancelMenu) this.cancelMenu();
+    var w=window.open(Rico.htmDir+'export_'+(exportType || 'plain')+'.html?'+this.exportDiv.id,'',this.options.exportWindow);
+    if (w == null) alert(Rico.getPhraseById('disableBlocker'));
+  },
+
+/**
+ * Support function for printVisible()
+ */
+  exportStyle: function(elem,styleList) {
+    for (var i=0,s=''; i < styleList.length; i++) {
+      try {
+        var curstyle=Rico.getStyle(elem,styleList[i]);
+        if (curstyle) s+=styleList[i]+':'+curstyle+';';
+      } catch(e) {};
+    }
+    return s;
+  },
+
+/**
+ * Gets the value of the grid cookie and interprets the contents.
+ * All information for a particular grid is stored in a single cookie.
+ * This may include column widths, column hide/show status, current sort, and any column filters.
+ */
+  getCookie: function() {
+    var c=Rico.getCookie(this.options.cookiePrefix+this.tableId);
+    if (!c) return;
+    var cookieVals=c.split(',');
+    for (var i=0; i<cookieVals.length; i++) {
+      var v=cookieVals[i].split(':');
+      if (v.length!=2) continue;
+      var colnum=parseInt(v[0].slice(1),10);
+      if (colnum < 0 || colnum >= this.columns.length) continue;
+      var col=this.columns[colnum];
+      switch (v[0].charAt(0)) {
+        case 'w':
+          col.setColWidth(v[1]);
+          col.customWidth=true;
+          break;
+        case 'h':
+          if (v[1].toLowerCase()=='true')
+            col.hideshow(true,true);
+          else
+            col.hideshow(false,true);
+          break;
+        case 's':
+          if (!this.options.saveColumnInfo.sort || !col.sortable) break;
+          col.setSorted(v[1]);
+          break;
+        case 'f':
+          if (!this.options.saveColumnInfo.filter || !col.filterable) break;
+          var filterTemp=v[1].split('~');
+          col.filterOp=filterTemp.shift();
+          col.filterValues = [];
+          col.filterType = Rico.ColumnConst.USERFILTER;
+          for (var j=0; j<filterTemp.length; j++)
+            col.filterValues.push(unescape(filterTemp[j]));
+          break;
+      }
+    }
+  },
+
+/**
+ * Sets the grid cookie.
+ * All information for a particular grid is stored in a single cookie.
+ * This may include column widths, column hide/show status, current sort, and any column filters.
+ */
+  setCookie: function() {
+    var cookieVals=[];
+    for (var i=0; i<this.columns.length; i++) {
+      var col=this.columns[i];
+      if (this.options.saveColumnInfo.width) {
+        if (col.customWidth) cookieVals.push('w'+i+':'+col.colWidth);
+        if (col.customVisible) cookieVals.push('h'+i+':'+col.visible);
+      }
+      if (this.options.saveColumnInfo.sort) {
+        if (col.currentSort != Rico.ColumnConst.UNSORTED)
+          cookieVals.push('s'+i+':'+col.currentSort);
+      }
+      if (this.options.saveColumnInfo.filter && col.filterType == Rico.ColumnConst.USERFILTER) {
+        var filterTemp=[col.filterOp];
+        for (var j=0; j<col.filterValues.length; j++)
+          filterTemp.push(escape(col.filterValues[j]));
+        cookieVals.push('f'+i+':'+filterTemp.join('~'));
+      }
+    }
+    Rico.setCookie(this.options.cookiePrefix+this.tableId, cookieVals.join(','), this.options.cookieDays, this.options.cookiePath, this.options.cookieDomain);
+  }
+
+};
+
+
+Rico.ColumnConst = {
+  UNFILTERED:   0,
+  SYSTEMFILTER: 1,
+  USERFILTER:   2,
+
+  UNSORTED:  0,
+  SORT_ASC:  "ASC",
+  SORT_DESC: "DESC",
+
+  MINWIDTH: 10,
+  DOLLAR:  {type:'number', prefix:'$', decPlaces:2, ClassName:'alignright'},
+  EURO:    {type:'number', prefix:'&euro;', decPlaces:2, ClassName:'alignright'},
+  PERCENT: {type:'number', suffix:'%', decPlaces:2, multiplier:100, ClassName:'alignright'},
+  QTY:     {type:'number', decPlaces:0, ClassName:'alignright'},
+  DEFAULT: {type:"showTags"}
+}
+
+
+/**
+ * @class Define methods that are common to columns in both SimpleGrid and LiveGrid
+ */
+Rico.TableColumnBase = function() {};
+
+Rico.TableColumnBase.prototype = {
+
+/**
+ * Common code used to initialize the column in both SimpleGrid & LiveGrid
+ */
+  baseInit: function(liveGrid,colIdx,hdrInfo,tabIdx) {
+    Rico.log("TableColumnBase.init index="+colIdx+" tabIdx="+tabIdx);
+    this.liveGrid  = liveGrid;
+    this.index     = colIdx;
+    this.hideWidth = Rico.isKonqueror || Rico.isWebKit || liveGrid.headerRowCnt>1 ? 5 : 2;  // column width used for "hidden" columns. Anything less than 5 causes problems with Konqueror. Best to keep this greater than padding used inside cell.
+    this.options   = liveGrid.options;
+    this.tabIdx    = tabIdx;
+    this.hdrCell   = hdrInfo.cell;
+    this.body = document.getElementsByTagName("body")[0];
+    this.displayName  = this.getDisplayName(this.hdrCell);
+    var divs=this.hdrCell.getElementsByTagName('div');
+    this.hdrColDiv=(divs.length<1) ? Rico.wrapChildren(this.hdrCell,'ricoLG_col') : divs[0];
+    this.hdrCellDiv=(divs.length<2) ? Rico.wrapChildren(this.hdrColDiv,'ricoLG_cell') : divs[1];
+    var sectionIndex= tabIdx==0 ? colIdx : colIdx-liveGrid.options.frozenColumns;
+    this.dataCell = liveGrid.tbody[tabIdx].rows[0].cells[sectionIndex];
+    divs=this.dataCell.getElementsByTagName('div');
+    this.dataColDiv=(divs.length<1) ? Rico.wrapChildren(this.dataCell,'ricoLG_col') : divs[0];
+
+    this.mouseDownHandler= Rico.eventHandle(this,'handleMouseDown');
+    this.mouseMoveHandler= Rico.eventHandle(this,'handleMouseMove');
+    this.mouseUpHandler  = Rico.eventHandle(this,'handleMouseUp');
+    this.mouseOutHandler = Rico.eventHandle(this,'handleMouseOut');
+
+    this.fieldName = 'col'+this.index;
+    var spec = liveGrid.options.columnSpecs[colIdx];
+    this.format=Rico.extend( {}, Rico.ColumnConst.DEFAULT);
+    switch (typeof spec) {
+      case 'object':
+        if (typeof spec.format=='string') Rico.extend(this.format, Rico.ColumnConst[spec.format.toUpperCase()]);
+        Rico.extend(this.format, spec);
+        break;
+      case 'string':
+        if (spec.slice(0,4)=='spec') spec=spec.slice(4).toUpperCase();  // for backwards compatibility
+        if (typeof Rico.ColumnConst[spec]=='object') Rico.extend(this.format, Rico.ColumnConst[spec]);
+        break;
+    }
+    Rico.addClass(this.dataColDiv, this.colClassName());
+    this.visible=true;
+    if (typeof this.format.visible=='boolean') this.visible=this.format.visible;
+    Rico.log("TableColumn.init index="+colIdx+" fieldName="+this.fieldName);
+    this.sortable     = typeof this.format.canSort=='boolean' ? this.format.canSort : liveGrid.options.canSortDefault;
+    this.currentSort  = Rico.ColumnConst.UNSORTED;
+    this.filterable   = typeof this.format.canFilter=='boolean' ? this.format.canFilter : liveGrid.options.canFilterDefault;
+    this.filterType   = Rico.ColumnConst.UNFILTERED;
+    this.hideable     = typeof this.format.canHide=='boolean' ? this.format.canHide : liveGrid.options.canHideDefault;
+
+    var wi=(typeof(this.format.width)=='number') ? this.format.width : hdrInfo.initWidth;
+    wi=(typeof(wi)=='number') ? Math.max(wi,Rico.ColumnConst.MINWIDTH) : liveGrid.options.defaultWidth;
+    this.setColWidth(wi);
+    if (!this.visible) this.setDisplay('none');
+  },
+  
+  colClassName: function() {
+    return this.format.ClassName ? this.format.ClassName : this.liveGrid.tableId+'_col'+this.index;
+  },
+
+  insertResizer: function() {
+    //this.hdrCell.style.width='';
+    if (this.format.noResize) return;
+    var resizer=document.createElement('div');
+    resizer.className='ricoLG_Resize';
+    resizer.style[this.liveGrid.align[1]]='0px';
+    this.hdrCellDiv.appendChild(resizer);
+    Rico.eventBind(resizer,"mousedown", this.mouseDownHandler, false);
+  },
+
+/**
+ * get the display name of a column
+ */
+  getDisplayName: function(el) {
+    var anchors=el.getElementsByTagName("A");
+    //Check the existance of A tags
+    if (anchors.length > 0)
+      return anchors[0].innerHTML;
+    else
+      return Rico.stripTags(el.innerHTML);
+  },
+
+  _clear: function(gridCell) {
+    gridCell.innerHTML='&nbsp;';
+  },
+
+  clearCell: function(rowIndex) {
+    var gridCell=this.cell(rowIndex);
+    this._clear(gridCell,rowIndex);
+    if (!this.liveGrid.buffer) return;
+    var acceptAttr=this.liveGrid.buffer.options.acceptAttr;
+    for (var k=0; k<acceptAttr.length; k++) {
+      switch (acceptAttr[k]) {
+        case 'style': gridCell.style.cssText=''; break;
+        case 'class': gridCell.className=''; break;
+        default:      gridCell['_'+acceptAttr[k]]=''; break;
+      }
+    }
+  },
+
+  dataTable: function() {
+    return this.liveGrid.tabs[this.tabIdx];
+  },
+
+  numRows: function() {
+    return this.dataColDiv.childNodes.length;
+  },
+
+  clearColumn: function() {
+    var childCnt=this.numRows();
+    for (var r=0; r<childCnt; r++)
+      this.clearCell(r);
+  },
+
+  cell: function(r) {
+    return this.dataColDiv.childNodes[r];
+  },
+
+  getFormattedValue: function(r,xImg,xForm,xClass) {
+    return Rico.getInnerText(this.cell(r),xImg,xForm,xClass);
+  },
+
+  setColWidth: function(wi) {
+    if (typeof wi=='number') {
+      wi=parseInt(wi,10);
+      if (wi < Rico.ColumnConst.MINWIDTH) return;
+      wi=wi+'px';
+    }
+    Rico.log('setColWidth '+this.index+': '+wi);
+    this.colWidth=wi;
+    this.hdrColDiv.style.width=wi;
+    this.dataColDiv.style.width=wi;
+  },
+
+  pluginMouseEvents: function() {
+    if (this.mousePluggedIn==true) return;
+    Rico.eventBind(this.body,"mousemove", this.mouseMoveHandler, false);
+    Rico.eventBind(this.body,"mouseup",   this.mouseUpHandler  , false);
+    Rico.eventBind(this.body,"mouseout",  this.mouseOutHandler , false);
+    this.mousePluggedIn=true;
+  },
+
+  unplugMouseEvents: function() {
+    Rico.eventUnbind(this.body,"mousemove", this.mouseMoveHandler, false);
+    Rico.eventUnbind(this.body,"mouseup",   this.mouseUpHandler  , false);
+    Rico.eventUnbind(this.body,"mouseout",  this.mouseOutHandler , false);
+    this.mousePluggedIn=false;
+  },
+
+  handleMouseDown: function(e) {
+    this.resizeStart=Rico.eventClient(e).x;
+    this.origWidth=parseInt(this.colWidth,10);
+    var p=Rico.positionedOffset(this.hdrCell);
+    if (this.liveGrid.direction=='rtl') {
+      this.edge=p.left+this.liveGrid.options.scrollBarWidth;
+      switch (this.tabIdx) {
+        case 0: this.edge+=this.liveGrid.innerDiv.offsetWidth; break;
+        case 1: this.edge-=this.liveGrid.scrollDiv.scrollLeft; break;
+      }
+    } else {
+      this.edge=p.left+this.hdrCell.offsetWidth;
+      if (this.tabIdx>0) this.edge+=Rico.nan2zero(this.liveGrid.tabs[0].offsetWidth);
+    }
+    this.liveGrid.resizeDiv.style.left=this.edge+"px";
+    this.liveGrid.resizeDiv.style.display="";
+    this.liveGrid.outerDiv.style.cursor='e-resize';
+    this.tmpHighlight=this.liveGrid.highlightEnabled;
+    this.liveGrid.highlightEnabled=false;
+    this.pluginMouseEvents();
+    Rico.eventStop(e);
+  },
+
+  handleMouseMove: function(e) {
+    var delta=Rico.eventClient(e).x-this.resizeStart;
+    var newWidth=(this.liveGrid.direction=='rtl') ? this.origWidth-delta : this.origWidth+delta;
+    if (newWidth < Rico.ColumnConst.MINWIDTH) return;
+    this.liveGrid.resizeDiv.style.left=(this.edge+delta)+"px";
+    this.colWidth=newWidth;
+    Rico.eventStop(e);
+  },
+
+  handleMouseUp: function(e) {
+    this.unplugMouseEvents();
+    Rico.log('handleMouseUp '+this.liveGrid.tableId);
+    this.liveGrid.outerDiv.style.cursor='';
+    this.liveGrid.resizeDiv.style.display="none";
+    this.setColWidth(this.colWidth);
+    this.customWidth=true;
+    this.liveGrid.setCookie();
+    this.liveGrid.highlightEnabled=this.tmpHighlight;
+    this.liveGrid.sizeDivs();
+    Rico.eventStop(e);
+  },
+
+  handleMouseOut: function(e) {
+    var reltg = Rico.eventRelatedTarget(e) || e.toElement;
+    while (reltg != null && reltg.nodeName.toLowerCase() != 'body')
+