[Jifty-commit] r5107 - in jifty/branches/virtual-models: . bin debian examples/Chat examples/Chat/lib/Chat examples/Chat/share examples/Chat/var examples/Clock/var examples/Doxory examples/Doxory/var examples/HelloKitty examples/HelloKitty/var examples/MyWeblog/log examples/MyWeblog/var examples/ShrinkURL/var examples/Yada/inc inc/Module inc/Module/Install lib lib/Jifty lib/Jifty/Action lib/Jifty/Action/Record lib/Jifty/Filter lib/Jifty/Manual lib/Jifty/Mason lib/Jifty/Model lib/Jifty/Plugin lib/Jifty/Plugin/Attributes lib/Jifty/Plugin/Attributes/Mixin lib/Jifty/Plugin/Attributes/Model lib/Jifty/Plugin/Authentication/CAS/Action lib/Jifty/Plugin/Authentication/Ldap/Action lib/Jifty/Plugin/Authentication/Password lib/Jifty/Plugin/Authentication/Password/Action lib/Jifty/Plugin/Authentication/Password/Mixin/Model lib/Jifty/Plugin/Chart lib/Jifty/Plugin/Chart/Renderer lib/Jifty/Plugin/Chart/Renderer/GD lib/Jifty/Plugin/ErrorTemplates lib/Jifty/Plugin/Gladiator lib/Jifty/Plugin/LeakTracker lib/Jifty/Plugin/Monitoring lib/Jifty/Plugin/Monitoring/Command lib/Jifty/Plugin/Monitoring/Model lib/Jifty/Plugin/OAuth lib/Jifty/Plugin/OAuth/Model lib/Jifty/Plugin/OpenID lib/Jifty/Plugin/OpenID/Mixin/Model lib/Jifty/Plugin/Quota lib/Jifty/Plugin/Quota/Model lib/Jifty/Plugin/REST lib/Jifty/Plugin/Recorder/Command lib/Jifty/Plugin/SQLQueries lib/Jifty/Plugin/SkeletonApp lib/Jifty/Script lib/Jifty/Test/WWW lib/Jifty/View/Declare lib/Jifty/View/Mason lib/Jifty/Web lib/Jifty/Web/Form lib/Jifty/Web/Form/Field lib/Jifty/Web/Session share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin share/plugins/Jifty/Plugin/CSSQuery share/plugins/Jifty/Plugin/CSSQuery/web share/plugins/Jifty/Plugin/CSSQuery/web/static share/plugins/Jifty/Plugin/CSSQuery/web/static/js share/plugins/Jifty/Plugin/CSSQuery/web/static/js/cssquery share/plugins/Jifty/Plugin/Chart/web/static/js share/plugins/Jifty/Plugin/JQuery share/po share/web/static/css share/web/static/css/yui/calendar share/web/static/css/yui/menu share/web/static/css/yui/tabview share/web/static/images/yui/calendar share/web/static/images/yui/menu share/web/static/images/yui/tabview share/web/static/js share/web/static/js/cssquery share/web/static/js/yui share/web/templates/__jifty share/web/templates/__jifty/webservices share/web/templates/_elements t t/Continuations/lib/Continuations t/Mapper/lib/Mapper t/TestApp-JiftyJS t/TestApp-JiftyJS/bin t/TestApp-JiftyJS/doc t/TestApp-JiftyJS/etc t/TestApp-JiftyJS/lib t/TestApp-JiftyJS/lib/TestApp t/TestApp-JiftyJS/lib/TestApp/JiftyJS t/TestApp-JiftyJS/lib/TestApp/JiftyJS/Action t/TestApp-JiftyJS/lib/TestApp/JiftyJS/Model t/TestApp-JiftyJS/log t/TestApp-JiftyJS/share t/TestApp-JiftyJS/share/po t/TestApp-JiftyJS/share/web t/TestApp-JiftyJS/share/web/static t/TestApp-JiftyJS/share/web/static/css t/TestApp-JiftyJS/share/web/static/js-test t/TestApp-JiftyJS/share/web/static/js-test/lib t/TestApp-JiftyJS/share/web/static/js-test/lib/DOM t/TestApp-JiftyJS/share/web/static/js-test/lib/Test t/TestApp-JiftyJS/share/web/static/js-test/lib/Test/Harness t/TestApp-JiftyJS/share/web/templates t/TestApp-JiftyJS/t t/TestApp-JiftyJS/var t/TestApp-Plugin-Attributes t/TestApp-Plugin-Attributes/bin t/TestApp-Plugin-Attributes/doc t/TestApp-Plugin-Attributes/etc t/TestApp-Plugin-Attributes/lib t/TestApp-Plugin-Attributes/lib/TestApp t/TestApp-Plugin-Attributes/lib/TestApp/Plugin t/TestApp-Plugin-Attributes/lib/TestApp/Plugin/Attributes t/TestApp-Plugin-Attributes/lib/TestApp/Plugin/Attributes/Action t/TestApp-Plugin-Attributes/lib/TestApp/Plugin/Attributes/Model t/TestApp-Plugin-Attributes/share t/TestApp-Plugin-Attributes/share/po t/TestApp-Plugin-Attributes/share/web t/TestApp-Plugin-Attributes/share/web/static t/TestApp-Plugin-Attributes/share/web/templates t/TestApp-Plugin-Attributes/t t/TestApp-Plugin-Chart/etc t/TestApp-Plugin-JQuery t/TestApp-Plugin-OAuth/etc t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth t/TestApp-Plugin-OAuth/t t/TestApp-Plugin-PasswordAuth/t t/TestApp-Plugin-REST/lib/TestApp/Plugin/REST t/TestApp-Plugin-REST/t t/TestApp/lib/TestApp t/TestApp/lib/TestApp/Model t/TestApp/share/web/templates t/TestApp/share/web/templates/_elements t/TestApp/t

Jifty commits jifty-commit at lists.jifty.org
Thu Feb 14 14:59:22 EST 2008


Author: sterling
Date: Thu Feb 14 14:59:21 2008
New Revision: 5107

Added:
   jifty/branches/virtual-models/bin/show_continuation   (contents, props changed)
   jifty/branches/virtual-models/examples/Chat/lib/Chat/View.pm
   jifty/branches/virtual-models/examples/MyWeblog/log/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/Mixin/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/Mixin/Attributes.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/Model/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/Model/Attribute.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/Model/AttributeCollection.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/CSSQuery.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Gladiator/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Gladiator.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Gladiator/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Gladiator/View.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/Command/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/Command/Cron.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/Model/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/Model/LastRun.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/Model/MonitoredDataPoint.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Quota/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Quota.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Quota/Model/
   jifty/branches/virtual-models/lib/Jifty/Plugin/Quota/Model/Quota.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/SQLQueries/
   jifty/branches/virtual-models/lib/Jifty/Plugin/SQLQueries.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/SQLQueries/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/SQLQueries/View.pm
   jifty/branches/virtual-models/lib/Jifty/Script/Script.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Session/ApacheSession.pm
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/CSSQuery/
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/CSSQuery/web/
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/CSSQuery/web/static/
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/CSSQuery/web/static/js/
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/CSSQuery/web/static/js/cssquery/
      - copied from r2686, /jifty/branches/virtual-models/share/web/static/js/cssquery/
   jifty/branches/virtual-models/share/web/static/css/yui/calendar/calendar-core.css
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menu-core.css
   jifty/branches/virtual-models/share/web/static/css/yui/tabview/tabview-core.css
   jifty/branches/virtual-models/share/web/static/images/yui/calendar/
   jifty/branches/virtual-models/share/web/static/images/yui/calendar/calgrad.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/calendar/callt.gif   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/calendar/calrt.gif   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/calendar/calx.gif   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menu_down_arrow.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menu_down_arrow_disabled.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menu_down_arrow_selected.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menu_up_arrow.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menu_up_arrow_disabled.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menubaritem_submenuindicator.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menubaritem_submenuindicator_disabled.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menubaritem_submenuindicator_selected.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_checked.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_checked_disabled.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_checked_selected.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_submenuindicator.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_submenuindicator_disabled.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_submenuindicator_selected.png   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/images/yui/tabview/
   jifty/branches/virtual-models/share/web/static/images/yui/tabview/loading.gif   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/js/cssQuery-jquery.js   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/js/jquery-1.2.1.js   (contents, props changed)
   jifty/branches/virtual-models/share/web/static/js/jquery_noconflict.js   (contents, props changed)
   jifty/branches/virtual-models/t/Mapper/lib/Mapper/Dispatcher.pm
   jifty/branches/virtual-models/t/TestApp-JiftyJS/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/Makefile.PL
   jifty/branches/virtual-models/t/TestApp-JiftyJS/bin/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/bin/jifty   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/doc/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/etc/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/etc/config.yml
   jifty/branches/virtual-models/t/TestApp-JiftyJS/lib/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/lib/TestApp/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/Action/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/Action/AddTwoNumbers.pm
   jifty/branches/virtual-models/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/Action/Play.pm
   jifty/branches/virtual-models/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/Model/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm
   jifty/branches/virtual-models/t/TestApp-JiftyJS/log/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/po/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/css/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/css/app.css
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/01.behaviour.html   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/02.action.html   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/02.cssquery.html   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/index.html   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/DOM/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/DOM/Events.js   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/DOM/Ready.js   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/JSAN.js   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/Test/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/Test/Builder.js   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/Test/Harness/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/Test/Harness.js   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/Test/Harness/Browser.js   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/Test/Harness/Director.js   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/Test/More.js   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/static/js-test/lib/Test/Simple.js   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-JiftyJS/share/web/templates/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/t/
   jifty/branches/virtual-models/t/TestApp-JiftyJS/t/00-action-AddTwoNumbers.t
   jifty/branches/virtual-models/t/TestApp-JiftyJS/t/00-action-Play.t
   jifty/branches/virtual-models/t/TestApp-JiftyJS/t/1-jifty-update.t
   jifty/branches/virtual-models/t/TestApp-JiftyJS/t/2-behaviour.t
   jifty/branches/virtual-models/t/TestApp-JiftyJS/t/3-continuation.t
   jifty/branches/virtual-models/t/TestApp-JiftyJS/t/4-tangent.t
   jifty/branches/virtual-models/t/TestApp-JiftyJS/t/5-action.t
   jifty/branches/virtual-models/t/TestApp-JiftyJS/var/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/Makefile.PL
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/bin/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/bin/jifty   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/doc/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/etc/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/etc/config.yml
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/lib/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/lib/TestApp/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/lib/TestApp/Plugin/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/lib/TestApp/Plugin/Attributes/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/lib/TestApp/Plugin/Attributes/Action/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/lib/TestApp/Plugin/Attributes/Model/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/lib/TestApp/Plugin/Attributes/Model/Song.pm
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/share/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/share/po/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/share/web/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/share/web/static/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/share/web/templates/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/t/
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/t/00-basic.t
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/t/01-content.t
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/t/02-crud-methods.t
   jifty/branches/virtual-models/t/TestApp-Plugin-Attributes/t/03-permissions.t
   jifty/branches/virtual-models/t/TestApp/lib/TestApp/Model/CanonTest.pm
   jifty/branches/virtual-models/t/TestApp/share/web/templates/template-with-error
   jifty/branches/virtual-models/t/TestApp/t/20-error-pages.t
   jifty/branches/virtual-models/t/TestApp/t/21-js-arguments.t
Removed:
   jifty/branches/virtual-models/examples/Chat/share/
   jifty/branches/virtual-models/examples/Chat/var/
   jifty/branches/virtual-models/examples/Clock/var/
   jifty/branches/virtual-models/examples/Doxory/doxory
   jifty/branches/virtual-models/examples/Doxory/var/
   jifty/branches/virtual-models/examples/HelloKitty/hellokitty
   jifty/branches/virtual-models/examples/HelloKitty/var/
   jifty/branches/virtual-models/examples/MyWeblog/var/
   jifty/branches/virtual-models/examples/ShrinkURL/var/
   jifty/branches/virtual-models/examples/Yada/inc/
   jifty/branches/virtual-models/lib/Jifty/Plugin/JQuery.pm
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/JQuery/
   jifty/branches/virtual-models/share/web/static/css/yui/menu/map.gif
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menuarodwn8_dim_1.gif
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menuarodwn8_hov_1.gif
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menuarodwn8_nrm_1.gif
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menuarorght8_dim_1.gif
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menuarorght8_hov_1.gif
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menuarorght8_nrm_1.gif
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menuaroup8_dim_1.gif
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menuaroup8_nrm_1.gif
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menuchk8_dim_1.gif
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menuchk8_hov_1.gif
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menuchk8_nrm_1.gif
   jifty/branches/virtual-models/share/web/static/css/yui/tabview/tabs.css
   jifty/branches/virtual-models/share/web/static/js/cssquery/
   jifty/branches/virtual-models/t/TestApp-Plugin-JQuery/
Modified:
   jifty/branches/virtual-models/   (props changed)
   jifty/branches/virtual-models/AUTHORS
   jifty/branches/virtual-models/Changelog
   jifty/branches/virtual-models/MANIFEST
   jifty/branches/virtual-models/META.yml
   jifty/branches/virtual-models/Makefile.PL
   jifty/branches/virtual-models/debian/control
   jifty/branches/virtual-models/examples/Chat/Makefile.PL
   jifty/branches/virtual-models/inc/Module/Install.pm
   jifty/branches/virtual-models/inc/Module/Install/AutoInstall.pm
   jifty/branches/virtual-models/inc/Module/Install/Base.pm
   jifty/branches/virtual-models/inc/Module/Install/Can.pm
   jifty/branches/virtual-models/inc/Module/Install/Fetch.pm
   jifty/branches/virtual-models/inc/Module/Install/Include.pm
   jifty/branches/virtual-models/inc/Module/Install/Makefile.pm
   jifty/branches/virtual-models/inc/Module/Install/Metadata.pm
   jifty/branches/virtual-models/inc/Module/Install/Scripts.pm
   jifty/branches/virtual-models/inc/Module/Install/Share.pm
   jifty/branches/virtual-models/inc/Module/Install/Win32.pm
   jifty/branches/virtual-models/inc/Module/Install/WriteAll.pm
   jifty/branches/virtual-models/lib/Jifty.pm
   jifty/branches/virtual-models/lib/Jifty/API.pm
   jifty/branches/virtual-models/lib/Jifty/Action.pm
   jifty/branches/virtual-models/lib/Jifty/Action/Record.pm
   jifty/branches/virtual-models/lib/Jifty/Action/Record/Create.pm
   jifty/branches/virtual-models/lib/Jifty/Action/Record/Search.pm
   jifty/branches/virtual-models/lib/Jifty/Action/Record/Update.pm
   jifty/branches/virtual-models/lib/Jifty/ClassLoader.pm
   jifty/branches/virtual-models/lib/Jifty/Collection.pm
   jifty/branches/virtual-models/lib/Jifty/Config.pm
   jifty/branches/virtual-models/lib/Jifty/Continuation.pm
   jifty/branches/virtual-models/lib/Jifty/DateTime.pm
   jifty/branches/virtual-models/lib/Jifty/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Everything.pm
   jifty/branches/virtual-models/lib/Jifty/Filter/DateTime.pm
   jifty/branches/virtual-models/lib/Jifty/Handle.pm
   jifty/branches/virtual-models/lib/Jifty/Handler.pm
   jifty/branches/virtual-models/lib/Jifty/LetMe.pm
   jifty/branches/virtual-models/lib/Jifty/Manual/AccessControl.pod
   jifty/branches/virtual-models/lib/Jifty/Manual/Cookbook.pod
   jifty/branches/virtual-models/lib/Jifty/Manual/Deploying.pod
   jifty/branches/virtual-models/lib/Jifty/Mason/Halo.pm
   jifty/branches/virtual-models/lib/Jifty/Model/Metadata.pm
   jifty/branches/virtual-models/lib/Jifty/Model/Session.pm
   jifty/branches/virtual-models/lib/Jifty/Model/SessionCollection.pm
   jifty/branches/virtual-models/lib/Jifty/Param.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/CAS/Action/CASLogin.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Ldap/Action/LDAPLogin.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/GeneratePasswordToken.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Login.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/View.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer/GD/Graph.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer/XMLSWF.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/ClassLoader.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/ErrorTemplates/View.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Halo.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/I18N.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker/View.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/OAuth/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/OAuth/Model/Consumer.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/OpenID/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/OpenID/Mixin/Model/User.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/REST.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/REST/Dispatcher.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Recorder.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/Recorder/Command/Playback.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/SinglePage.pm
   jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/View.pm
   jifty/branches/virtual-models/lib/Jifty/Record.pm
   jifty/branches/virtual-models/lib/Jifty/Request.pm
   jifty/branches/virtual-models/lib/Jifty/Result.pm
   jifty/branches/virtual-models/lib/Jifty/Script.pm
   jifty/branches/virtual-models/lib/Jifty/Script/Schema.pm
   jifty/branches/virtual-models/lib/Jifty/Test.pm
   jifty/branches/virtual-models/lib/Jifty/Test/WWW/Declare.pm
   jifty/branches/virtual-models/lib/Jifty/TestServer.pm
   jifty/branches/virtual-models/lib/Jifty/Util.pm
   jifty/branches/virtual-models/lib/Jifty/View/Declare/CRUD.pm
   jifty/branches/virtual-models/lib/Jifty/View/Declare/Handler.pm
   jifty/branches/virtual-models/lib/Jifty/View/Declare/Helpers.pm
   jifty/branches/virtual-models/lib/Jifty/View/Mason/Handler.pm
   jifty/branches/virtual-models/lib/Jifty/Web.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Form.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Form/Clickable.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Form/Element.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Form/Field.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Form/Field/Combobox.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Form/Field/Select.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Form/Link.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Menu.pm
   jifty/branches/virtual-models/lib/Jifty/Web/PageRegion.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Session.pm
   jifty/branches/virtual-models/lib/Jifty/Web/Session/ClientSide.pm
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/index.html
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/CSSQuery/web/static/js/cssquery/cssQuery.js
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/Chart/web/static/js/chart_img_behaviour.js
   jifty/branches/virtual-models/share/plugins/Jifty/Plugin/Chart/web/static/js/simple_bars.js
   jifty/branches/virtual-models/share/po/zh_tw.po
   jifty/branches/virtual-models/share/web/static/css/base.css
   jifty/branches/virtual-models/share/web/static/css/halos.css
   jifty/branches/virtual-models/share/web/static/css/main.css
   jifty/branches/virtual-models/share/web/static/css/yui/calendar/calendar.css
   jifty/branches/virtual-models/share/web/static/css/yui/menu/menu.css
   jifty/branches/virtual-models/share/web/static/css/yui/tabview/border_tabs.css
   jifty/branches/virtual-models/share/web/static/css/yui/tabview/tabview.css
   jifty/branches/virtual-models/share/web/static/js/behaviour.js
   jifty/branches/virtual-models/share/web/static/js/bps_util.js
   jifty/branches/virtual-models/share/web/static/js/calendar.js
   jifty/branches/virtual-models/share/web/static/js/context_menu.js
   jifty/branches/virtual-models/share/web/static/js/halo.js
   jifty/branches/virtual-models/share/web/static/js/jifty.js
   jifty/branches/virtual-models/share/web/static/js/prototype.js
   jifty/branches/virtual-models/share/web/static/js/yui/calendar.js
   jifty/branches/virtual-models/share/web/static/js/yui/container.js
   jifty/branches/virtual-models/share/web/static/js/yui/dom.js
   jifty/branches/virtual-models/share/web/static/js/yui/element-beta.js
   jifty/branches/virtual-models/share/web/static/js/yui/event.js
   jifty/branches/virtual-models/share/web/static/js/yui/menu.js
   jifty/branches/virtual-models/share/web/static/js/yui/oom_select.patch
   jifty/branches/virtual-models/share/web/static/js/yui/tabview.js
   jifty/branches/virtual-models/share/web/static/js/yui/yahoo.js
   jifty/branches/virtual-models/share/web/templates/__jifty/halo
   jifty/branches/virtual-models/share/web/templates/__jifty/webservices/json
   jifty/branches/virtual-models/share/web/templates/__jifty/webservices/yaml
   jifty/branches/virtual-models/share/web/templates/_elements/wrapper
   jifty/branches/virtual-models/t/01-dependencies.t
   jifty/branches/virtual-models/t/03-form-protocol.t
   jifty/branches/virtual-models/t/Continuations/lib/Continuations/Dispatcher.pm
   jifty/branches/virtual-models/t/TestApp-Plugin-Chart/etc/config.yml
   jifty/branches/virtual-models/t/TestApp-Plugin-OAuth/etc/config.yml
   jifty/branches/virtual-models/t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Test.pm
   jifty/branches/virtual-models/t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/View.pm
   jifty/branches/virtual-models/t/TestApp-Plugin-OAuth/t/00-test-setup.t
   jifty/branches/virtual-models/t/TestApp-Plugin-OAuth/t/01-basic.t
   jifty/branches/virtual-models/t/TestApp-Plugin-OAuth/t/02-request-token.t
   jifty/branches/virtual-models/t/TestApp-Plugin-OAuth/t/03-authorize.t
   jifty/branches/virtual-models/t/TestApp-Plugin-OAuth/t/04-access-token.t
   jifty/branches/virtual-models/t/TestApp-Plugin-OAuth/t/05-protected-resource.t
   jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/t/00-model-User.t
   jifty/branches/virtual-models/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t
   jifty/branches/virtual-models/t/TestApp-Plugin-REST/lib/TestApp/Plugin/REST/Dispatcher.pm
   jifty/branches/virtual-models/t/TestApp-Plugin-REST/t/02-basic-use.t
   jifty/branches/virtual-models/t/TestApp/etc/config.yml
   jifty/branches/virtual-models/t/TestApp/lib/TestApp/Dispatcher.pm
   jifty/branches/virtual-models/t/TestApp/lib/TestApp/View.pm
   jifty/branches/virtual-models/t/TestApp/share/web/templates/_elements/wrapper
   jifty/branches/virtual-models/t/TestApp/t/02-dispatch.t
   jifty/branches/virtual-models/t/TestApp/t/05-editactions-Cachable.t
   jifty/branches/virtual-models/t/TestApp/t/05-editactions-Record.t
   jifty/branches/virtual-models/t/TestApp/t/06-validation.t
   jifty/branches/virtual-models/t/TestApp/t/14-template-paths.t   (contents, props changed)
   jifty/branches/virtual-models/t/TestApp/t/15-template-subclass.t
   jifty/branches/virtual-models/t/TestApp/t/16-template-region.t

Log:
 r15307 at riddle:  andrew | 2008-02-14 13:55:08 -0600
 Mergedown from trunk.
  r14334 at riddle:  andrew | 2007-12-03 14:11:13 -0600
   r14332 at riddle (orig r4604):  alexmv | 2007-12-02 22:57:21 -0600
    r25342 at zoq-fot-pik:  chmrr | 2007-12-02 23:55:41 -0500
     * Failing test for error pages
   
   r14333 at riddle (orig r4605):  alexmv | 2007-12-02 23:02:39 -0600
    r25344 at zoq-fot-pik:  chmrr | 2007-12-03 00:01:36 -0500
     * Fix error pages.  This is a perltidy; the only semantic change is
       to replace Jifty->web->return with form_return
   
  
  r14335 at riddle:  andrew | 2007-12-03 16:41:08 -0600
  Fixing HTML dumping so that the HTML is more correct and easier to read when debugging.
  r14339 at riddle:  andrew | 2007-12-03 16:42:45 -0600
   r14336 at riddle (orig r4606):  alexmv | 2007-12-03 14:34:32 -0600
    r25352 at zoq-fot-pik:  chmrr | 2007-12-03 15:33:18 -0500
     * Fix for autogenerated modules.  Since sticking a method into them
       can cause things to "inherit" being autogenerated(!), we instead
       keep a global hash of them.
    
     * Also, fix schema code, which checked the wrong class for plugins
       overriding the app.
   
   r14337 at riddle (orig r4607):  alexmv | 2007-12-03 15:33:35 -0600
    r25354 at zoq-fot-pik:  chmrr | 2007-12-03 16:32:25 -0500
     * Delay things which call Jifty::Util::require; Jifty::Util is often
       in *mid-require* when Jifty::Everything is loaded, thus causing
       calls to Jifty::Util::require to silently fail.
    
   
  
  r14642 at riddle:  andrew | 2007-12-28 09:04:17 -0600
   r14389 at dynpc145 (orig r4613):  sartak | 2007-12-04 00:22:23 -0600
    r48551 at onn:  sartak | 2007-12-04 01:21:27 -0500
    Use Jifty::Util->absolute_path on the recorder log path
   
   r14390 at dynpc145 (orig r4614):  sartak | 2007-12-04 00:41:51 -0600
    r48566 at onn:  sartak | 2007-12-04 01:41:37 -0500
    Freeze and thaw the CGI object, because it can be a glob that upsets YAML
    Wrap the YAML generation in eval {} too, because it is upsettable :)
   
   r14391 at dynpc145 (orig r4615):  jesse | 2007-12-04 00:44:32 -0600
    r72650 at pinglin:  jesse | 2007-12-04 01:24:32 -0500
    Jifty::YAML, not YAML;
    
    r72653 at pinglin:  jesse | 2007-12-04 01:43:42 -0500
     use Jifty::YAML
   
   r14393 at dynpc145 (orig r4617):  sartak | 2007-12-05 14:03:51 -0600
    r48628 at onn:  sartak | 2007-12-05 15:03:20 -0500
    Make sure actions still fail when you set columns you can't update (or read) to undef
   
   r14394 at dynpc145 (orig r4618):  sartak | 2007-12-05 15:39:00 -0600
    r48702 at onn:  sartak | 2007-12-05 16:33:29 -0500
    Fix the current_user_can call
   
   r14396 at dynpc145 (orig r4620):  alexmv | 2007-12-05 19:14:27 -0600
    r25352 at zoq-fot-pik:  chmrr | 2007-12-03 15:33:18 -0500
     * Fix for autogenerated modules.  Since sticking a method into them
       can cause things to "inherit" being autogenerated(!), we instead
       keep a global hash of them.
    
     * Also, fix schema code, which checked the wrong class for plugins
       overriding the app.
   
   r14397 at dynpc145 (orig r4621):  alexmv | 2007-12-05 19:14:40 -0600
    r25354 at zoq-fot-pik:  chmrr | 2007-12-03 16:32:25 -0500
     * Delay things which call Jifty::Util::require; Jifty::Util is often
       in *mid-require* when Jifty::Everything is loaded, thus causing
       calls to Jifty::Util::require to silently fail.
    
   
   r14398 at dynpc145 (orig r4622):  alexmv | 2007-12-05 19:15:31 -0600
    r25455 at zoq-fot-pik:  chmrr | 2007-12-05 20:13:15 -0500
     * Code to actually fully remove a session
   
   r14399 at dynpc145 (orig r4623):  alexmv | 2007-12-05 19:15:40 -0600
    r25456 at zoq-fot-pik:  chmrr | 2007-12-05 20:13:46 -0500
     * Monitoring plugin
   
   r14400 at dynpc145 (orig r4624):  alexmv | 2007-12-05 19:21:19 -0600
    r25461 at zoq-fot-pik:  chmrr | 2007-12-05 20:20:38 -0500
     * Make POD coverage happy
   
   r14401 at dynpc145 (orig r4625):  alexmv | 2007-12-05 20:20:27 -0600
    r25482 at zoq-fot-pik:  chmrr | 2007-12-05 21:19:45 -0500
     * Wrong column type.
   
   r14432 at dynpc145 (orig r4627):  clkao | 2007-12-05 23:36:04 -0600
   refactor handlers Jifty::Web::Form::Element to use our
   mk_normalising_accessor.
   
   r14433 at dynpc145 (orig r4628):  clkao | 2007-12-05 23:50:43 -0600
   Don't call _handler_setup unless the normalising accessor is
   used as mutator.
   
   r14434 at dynpc145 (orig r4629):  alexmv | 2007-12-06 13:06:50 -0600
    r25492 at zoq-fot-pik:  chmrr | 2007-12-06 13:43:07 -0500
     * Perltidy
   
   r14435 at dynpc145 (orig r4630):  alexmv | 2007-12-06 13:06:56 -0600
    r25493 at zoq-fot-pik:  chmrr | 2007-12-06 14:06:31 -0500
     * Check and upgrade plugin versions
   
   r14436 at dynpc145 (orig r4631):  sartak | 2007-12-06 15:17:42 -0600
    r48725 at onn:  sartak | 2007-12-06 16:15:51 -0500
    Recorder: Defer loghandle creation until first hit, so not all commands are creating request logs
   
   r14437 at dynpc145 (orig r4632):  sartak | 2007-12-06 18:20:53 -0600
    r48738 at onn:  sartak | 2007-12-06 19:20:22 -0500
    Add a Queries plugin for examining the db queries made by your app
   
   r14438 at dynpc145 (orig r4633):  sartak | 2007-12-06 18:35:59 -0600
    r48740 at onn:  sartak | 2007-12-06 19:35:45 -0500
    Move the query reports into /__jifty/admin/
   
   r14439 at dynpc145 (orig r4634):  sartak | 2007-12-06 18:37:32 -0600
    r48742 at onn:  sartak | 2007-12-06 19:37:19 -0500
    Move LeakTracker's reports into /__jifty/admin/ as well
   
   r14440 at dynpc145 (orig r4635):  jesse | 2007-12-06 21:30:40 -0600
    r72758 at pinglin:  jesse | 2007-12-06 15:23:37 -0500
    * Don't load up the column object on create widgets unless we need it.
    
    r72759 at pinglin:  jesse | 2007-12-06 16:23:23 -0500
    * Beginning some serious refactoring of Jifty::Action::Record->arguments
    
    r72775 at pinglin:  jesse | 2007-12-06 19:44:46 -0500
     * starting to split out current values of things
    r72776 at pinglin:  jesse | 2007-12-06 22:04:31 -0500
    * store the base 'arguments' hash and merge in default values on the fly. This should result in a healthy performance boost. But is also the first place to look if things start acting funny any time soon.
   
   r14441 at dynpc145 (orig r4636):  jesse | 2007-12-07 00:03:32 -0600
    r72784 at pinglin:  jesse | 2007-12-07 01:03:22 -0500
    * defer default value until we really care about it
   
   r14442 at dynpc145 (orig r4637):  gugod | 2007-12-07 07:31:17 -0600
   Prepare a TestApp just for testing jifty.js javascript functions.
   
   The goal is to test javascript code, not just perl code, so using
   selenium is a must. Pretty much like this test suit should be the
   counter-part of mech-based tests under TestApp/.
   
   Provide a simple test file to test Jifty.update() function, both
   with and without argument.
   
   r14443 at dynpc145 (orig r4638):  jesse | 2007-12-07 12:53:15 -0600
    r72791 at pinglin:  jesse | 2007-12-07 13:53:00 -0500
    * Refactoring around the fact that Scalar::Defer::defer'd variables will never return undef until they're forced.
   
   r14444 at dynpc145 (orig r4639):  sartak | 2007-12-07 15:02:02 -0600
    r48759 at onn:  sartak | 2007-12-07 16:01:06 -0500
    Queries: begin renaming to SQLQueries because Queries is vague
   
   r14445 at dynpc145 (orig r4640):  sartak | 2007-12-07 15:04:05 -0600
    r48764 at onn:  sartak | 2007-12-07 16:03:48 -0500
    SQLQueries: Finish renaming from Queries
   
   r14448 at dynpc145 (orig r4643):  sartak | 2007-12-07 15:24:31 -0600
    r48766 at onn:  sartak | 2007-12-07 16:24:11 -0500
    jifty.js: Work around placeholders not being properly cleared and causing (small) data loss
   
   r14452 at dynpc145 (orig r4647):  sartak | 2007-12-07 15:58:13 -0600
    r48770 at onn:  sartak | 2007-12-07 16:57:54 -0500
    cssquery.js: thisElement is being called 11000 times for hiveminder's /todo. It includes an IE workaround. Use the workaround only if we're actually using IE. This cuts its runtime on /todo from ~220ms to ~100ms
   
   r14453 at dynpc145 (orig r4648):  sartak | 2007-12-07 18:05:51 -0600
    r48775 at onn:  sartak | 2007-12-07 19:05:34 -0500
    Shave off another 100ms by special casing the beastly 40% function
   
   r14454 at dynpc145 (orig r4649):  sartak | 2007-12-07 18:53:30 -0600
    r48777 at onn:  sartak | 2007-12-07 19:53:11 -0500
    Another JS speedup: cache the results of selectAll. it's called only 8 times for /todo, but caching saves ~80ms.
   
   r14455 at dynpc145 (orig r4650):  sartak | 2007-12-07 20:42:58 -0600
    r48779 at onn:  sartak | 2007-12-07 21:42:41 -0500
    Speed up selection by class by using indexOf with space padding instead of regex
   
   r14456 at dynpc145 (orig r4651):  sartak | 2007-12-07 21:55:17 -0600
    r48788 at onn:  sartak | 2007-12-07 22:55:01 -0500
    SQLQueries: keep track of the ten slowest queries and display them. The query page could use a bit of visual design. :)
   
   r14457 at dynpc145 (orig r4652):  sartak | 2007-12-07 22:03:54 -0600
    r48790 at onn:  sartak | 2007-12-07 23:03:39 -0500
    Punt the design issue by making SQLQueries and LeakTracker use your app's layout :)
   
   r14458 at dynpc145 (orig r4653):  jesse | 2007-12-08 16:39:00 -0600
    r72824 at pinglin:  jesse | 2007-12-08 17:26:08 -0500
    * minor cleanup and refactoring
   
   r14459 at dynpc145 (orig r4654):  jesse | 2007-12-08 16:39:06 -0600
    r72825 at pinglin:  jesse | 2007-12-08 17:34:29 -0500
    * Refacotring/cleanup
   
   r14460 at dynpc145 (orig r4655):  jesse | 2007-12-08 16:39:10 -0600
    r72826 at pinglin:  jesse | 2007-12-08 17:38:20 -0500
     * minor refactoring
   
   r14461 at dynpc145 (orig r4656):  jesse | 2007-12-08 17:20:38 -0600
    r72830 at pinglin:  jesse | 2007-12-08 18:20:30 -0500
    * Make view handler classes configurable.
   
   r14462 at dynpc145 (orig r4657):  jesse | 2007-12-08 22:42:32 -0600
    r72834 at pinglin:  jesse | 2007-12-08 22:38:02 -0500
    * Terrifyingly, the added /s causes escape_html (2% of hiveminder's runtime) to benchmark 200% faster.
   
   r14463 at dynpc145 (orig r4658):  jesse | 2007-12-08 23:14:41 -0600
    r72836 at pinglin:  jesse | 2007-12-09 00:14:39 -0500
    * nope - I'm wrong. bad benchmarking made me believe that the thing I am reverting was faster
   
   r14464 at dynpc145 (orig r4659):  jesse | 2007-12-09 23:46:50 -0600
    r72844 at pinglin:  jesse | 2007-12-10 00:45:22 -0500
    * If we have a user object already, use it to fetch the email address when generating a LetMe
   
   r14465 at dynpc145 (orig r4660):  jesse | 2007-12-09 23:46:55 -0600
    r72845 at pinglin:  jesse | 2007-12-10 00:46:07 -0500
    * There's no need to compile Dispatcher rules to regexes every time they're evaluated. Cache them.
   
   r14466 at dynpc145 (orig r4661):  audreyt | 2007-12-10 13:04:19 -0600
   * Jifty::Dispatcher: Trivial minimal POD fix for correct vim highlighting
     (avoiding "package" at the beginning of the line.)
   r14526 at dynpc145 (orig r4664):  sartak | 2007-12-12 19:24:12 -0600
    r48930 at onn:  sartak | 2007-12-12 20:23:42 -0500
    ID is sometimes passed into Jifty::Action::Record::Update, we want to ignore it if it doesn't change, to avoid spurious permission errors. This codepath could use some more thought
   
   r14527 at dynpc145 (orig r4665):  sartak | 2007-12-12 22:20:00 -0600
    r48932 at onn:  sartak | 2007-12-12 23:19:51 -0500
    Fix a validation bug where we'd get a lot of
    "extend=function (object) { return Object.extend.apply(this, [this, object]); }"
    arguments. This is because prototype.js overcomplicates form element serialization.
   
   r14528 at dynpc145 (orig r4666):  sartak | 2007-12-12 22:59:14 -0600
    r48954 at onn:  sartak | 2007-12-12 23:59:05 -0500
    Jifty::DateTime::is_date method, which tells whether the given J:DT is only a date
   
   r14529 at dynpc145 (orig r4667):  sartak | 2007-12-12 23:10:56 -0600
    r48959 at onn:  sartak | 2007-12-13 00:10:46 -0500
    Syntax error :|
   
   r14530 at dynpc145 (orig r4668):  sartak | 2007-12-12 23:54:05 -0600
    r48963 at onn:  sartak | 2007-12-13 00:53:52 -0500
    Normalize placeholder text because sometimes one has \r\n and the other has \n. Ugh.
   
   r14531 at dynpc145 (orig r4669):  gugod | 2007-12-13 01:24:51 -0600
   Import a Test.More (the jsan module) -based js test to test behavour.js.
   Including a .t wrapper that launches a selenium server pointing to the harness test.
   
   
   r14532 at dynpc145 (orig r4670):  sartak | 2007-12-13 02:41:54 -0600
    r49010 at onn:  sartak | 2007-12-13 03:39:52 -0500
    Recorder: record the current user ID so we can still playback (to some degree) without the sessions table
   
   r14533 at dynpc145 (orig r4671):  sartak | 2007-12-13 02:41:58 -0600
    r49011 at onn:  sartak | 2007-12-13 03:41:22 -0500
    Recorder: autoflush logfile just in case the server goes splat
   
   r14534 at dynpc145 (orig r4672):  sartak | 2007-12-13 03:34:35 -0600
    r49016 at onn:  sartak | 2007-12-13 04:33:49 -0500
    LeakTracker: log how much memory we're using at each request if Proc::ProcessTable is installed
   
   r14535 at dynpc145 (orig r4673):  sartak | 2007-12-13 03:34:39 -0600
    r49017 at onn:  sartak | 2007-12-13 04:34:16 -0500
    Recorder: log how much memory we're using at each request if memory_usage is set.
   
   r14536 at dynpc145 (orig r4674):  yves | 2007-12-13 04:24:39 -0600
   for mysql varchar must be explicit (255 should be enough)
   
   r14537 at dynpc145 (orig r4675):  yves | 2007-12-13 04:47:25 -0600
   mixin ldap authentication by email
   
   r14541 at dynpc145 (orig r4679):  yves | 2007-12-13 15:51:07 -0600
   add missing continuation in CAS login plugin
   
   r14547 at dynpc145 (orig r4685):  gugod | 2007-12-14 01:15:10 -0600
   Replace "is $html, ..." with $self->wait_for_text_present_ok
   
   Isolate current tests in a bare block, so we can put more tests in this file easily.
   
   r14548 at dynpc145 (orig r4686):  gugod | 2007-12-14 01:38:57 -0600
   For testing continuation, add a "AddTwoNumber" wizard like the one in
   Jifty::Manual::Continuations, only it's written with TD rather then
   mason template.
   
   To manually test it, goto /c/page1 first. Type some number and hit
   enter. You sholud then visit /c/page2. Type some other number and hit
   enter. You should return to /c/page1 with the result of AddTwoNumber
   action shown in the message box.
   
   r14549 at dynpc145 (orig r4687):  gugod | 2007-12-14 01:42:49 -0600
   Adda another URL that shows the same form as /c/page1/ to test if the
   form_return really return to the tangent point.
   
   r14550 at dynpc145 (orig r4688):  gugod | 2007-12-14 03:02:57 -0600
   Finish two sets of selenium tests for testing continuation.
   
   The goal is to see if form_return actually returned to where it
   begins.  The entry point can be either '/c/page1', or
   '/c/page_another_one'.
   
   r14551 at dynpc145 (orig r4689):  gugod | 2007-12-14 03:49:15 -0600
   Add a simple tangent/return test file, this is to protect the
   behaviour that, clicking on a "return" link should return to previous
   tangent point, or default location if none.
   
   r14552 at dynpc145 (orig r4690):  gugod | 2007-12-14 04:40:39 -0600
   Add a test to test the link that updates multiple regions at once,
   and also showing an alert().
   
   r14553 at dynpc145 (orig r4691):  gugod | 2007-12-14 06:42:55 -0600
   Add a "Play" action with various argument schema, and a test to test
   javascript behaviour based on the schema.
   
   The first test is to test if ajax canonicalized setting works.
   
   r14554 at dynpc145 (orig r4692):  gugod | 2007-12-14 07:56:15 -0600
   Add canonicalization tests.
   
   r14558 at dynpc145 (orig r4696):  jesse | 2007-12-15 01:12:14 -0600
    r73170 at pinglin:  jesse | 2007-12-15 02:09:57 -0500
     * A first pass attempt at a Devel::Gladiator plugin for Jifty. Doesn't seem to work very well
   
   r14567 at dynpc145 (orig r4705):  sartak | 2007-12-15 06:30:38 -0600
    r49097 at onn:  sartak | 2007-12-15 07:30:02 -0500
    Rewrite the Gladiator plugin so that it now works, and do the log/view thing (which really wants to be generalized.. later)
   
   r14570 at dynpc145 (orig r4708):  jesse | 2007-12-16 14:50:56 -0600
   
   * Revert mistaken commit. 
   * Fix menus to properly weaken "parent" relationships (and normalize _parent and parent)
   
   r14571 at dynpc145 (orig r4709):  sartak | 2007-12-16 15:16:11 -0600
    r49124 at onn:  sartak | 2007-12-16 16:14:49 -0500
    LeakTracker: complain if Devel::Events::Generator::ObjectTracker isn't loaded in time (nothingmuch++)
   
   r14572 at dynpc145 (orig r4710):  sartak | 2007-12-16 15:22:08 -0600
    r49130 at onn:  sartak | 2007-12-16 16:21:49 -0500
    Copying a reference unweakens it, so a small fix for that in JWFF->_action. But that isn't our leak, I think
   
   r14573 at dynpc145 (orig r4711):  sartak | 2007-12-16 15:27:20 -0600
    r49133 at onn:  sartak | 2007-12-16 16:27:08 -0500
    Fix a real memory leak in Jifty::Web::Menu due to copying a weak reference. Woo!
   
   r14574 at dynpc145 (orig r4712):  sartak | 2007-12-16 15:30:49 -0600
    r49135 at onn:  sartak | 2007-12-16 16:30:44 -0500
    Another copied weakref in Jifty::Web::Form::Field, though this code was just changed so I don't think it explains our white whale
   
   r14575 at dynpc145 (orig r4713):  sartak | 2007-12-16 15:54:03 -0600
    r49137 at onn:  sartak | 2007-12-16 16:53:55 -0500
    Add Devel::Gladiator to Makefile.PL, other little fixes in here
   
   r14576 at dynpc145 (orig r4714):  jesse | 2007-12-16 17:54:13 -0600
    r73218 at pinglin:  jesse | 2007-12-16 18:52:40 -0500
    * small fixes to make the tests run from the main harness
   
   r14584 at dynpc145 (orig r4722):  sartak | 2007-12-17 05:57:35 -0600
    r49139 at onn:  sartak | 2007-12-17 06:55:58 -0500
    Revert 4650 (cssquery change) because ".error is no longer hidden for the region being replaced with ajax" in some browsers
   
   r14585 at dynpc145 (orig r4723):  jesse | 2007-12-17 06:30:42 -0600
    r73700 at pinglin:  jesse | 2007-12-17 07:28:21 -0500
    * Attempt to weaken another reference to the current action that may be leaking
   
   r14586 at dynpc145 (orig r4724):  clkao | 2007-12-17 12:06:06 -0600
   In deferred sub called from arguments, we need to use weakself.
   r14587 at dynpc145 (orig r4725):  clkao | 2007-12-17 12:09:35 -0600
   oops, revert accidental changes in the deferred sub.
   r14588 at dynpc145 (orig r4726):  sartak | 2007-12-17 13:53:38 -0600
   
   r14589 at dynpc145 (orig r4727):  sartak | 2007-12-17 13:54:01 -0600
    r49156 at onn:  sartak | 2007-12-17 14:49:51 -0500
    More Makefile.PL tweaks
   
   r14590 at dynpc145 (orig r4728):  sartak | 2007-12-17 13:54:04 -0600
    r49157 at onn:  sartak | 2007-12-17 14:53:28 -0500
    Typo fix in Makefile.PL
   
   r14594 at dynpc145 (orig r4732):  falcone | 2007-12-17 22:07:26 -0600
    r27631 at ketch:  falcone | 2007-12-17 23:05:12 -0500
    * add a check for the op to the dispatcher condition cache
      because on and the other ops generate different regexps
   
   r14595 at dynpc145 (orig r4733):  alexmv | 2007-12-17 22:46:21 -0600
    r25896 at zoq-fot-pik:  chmrr | 2007-12-17 23:44:06 -0500
     * Lockfile support
   
   r14598 at dynpc145 (orig r4736):  sartak | 2007-12-18 11:45:42 -0600
    r49191 at onn:  sartak | 2007-12-18 12:45:27 -0500
    Revert 4649 js memoization which caused .error div problems
   
   r14599 at dynpc145 (orig r4737):  alexmv | 2007-12-18 15:17:14 -0600
    r25921 at zoq-fot-pik:  chmrr | 2007-12-18 16:16:05 -0500
     * Bump Scalar::Defer dependency, for great lack-of-memory-leak justice
   
   r14600 at dynpc145 (orig r4738):  sartak | 2007-12-18 18:30:22 -0600
    r49193 at onn:  sartak | 2007-12-18 19:27:52 -0500
    Move the REST object walking into Jifty::Result so that it may be reused
   
   r14601 at dynpc145 (orig r4739):  sartak | 2007-12-18 19:12:10 -0600
    r49197 at onn:  sartak | 2007-12-18 20:11:39 -0500
    Make the json and yaml webservices use Result->from_hash
   
   r14602 at dynpc145 (orig r4740):  sartak | 2007-12-18 19:23:08 -0600
    r49199 at onn:  sartak | 2007-12-18 20:22:56 -0500
    Missing $server in a test? I doubt this is intentional, so fixing
   
   r14603 at dynpc145 (orig r4741):  sartak | 2007-12-18 20:22:13 -0600
    r49203 at onn:  sartak | 2007-12-18 21:22:02 -0500
    Give the interesting classes jifty_serialize_format instead of hardcoding in recurse_object_to_data (obra++)
   
   r14604 at dynpc145 (orig r4742):  sartak | 2007-12-18 22:23:56 -0600
    r49205 at onn:  sartak | 2007-12-18 23:23:44 -0500
    Two small fixes for Jifty::Result changes: missed two fields and for backcompat we need to bless the resulting hash into Jifty::Result
   
   r14605 at dynpc145 (orig r4743):  sartak | 2007-12-18 22:39:22 -0600
    r49209 at onn:  sartak | 2007-12-18 23:39:11 -0500
    Actually, no, don't bless the result of Jifty::Result->as_hash
   
   r14608 at dynpc145 (orig r4746):  sartak | 2007-12-19 10:59:13 -0600
    r49215 at onn:  sartak | 2007-12-19 11:58:58 -0500
    Eugh, don't eval send_action results in mech
   
   r14609 at dynpc145 (orig r4747):  sartak | 2007-12-19 11:20:27 -0600
    r49217 at onn:  sartak | 2007-12-19 12:20:11 -0500
    Revert 4746 because it's actually not evil at all
   
   r14610 at dynpc145 (orig r4748):  sartak | 2007-12-19 15:57:26 -0600
    r49311 at onn:  sartak | 2007-12-19 16:57:08 -0500
    Use record->jifty_serialize_format instead of the old result->_record_to_data
   
   r14616 at dynpc145 (orig r4754):  gugod | 2007-12-20 08:58:41 -0600
   Add a simple test to test Action object initialization.
   
   r14619 at dynpc145 (orig r4757):  sartak | 2007-12-20 14:30:29 -0600
    r49326 at onn:  sartak | 2007-12-20 15:27:49 -0500
    Add /=/search/ModelName/c1/v1/c2/v2/c3/v3/... for REST
   
   r14620 at dynpc145 (orig r4758):  sartak | 2007-12-21 09:11:25 -0600
    r49350 at onn:  sartak | 2007-12-21 10:10:52 -0500
    SQLQueries: Hide the stack trace behind a more/less JS thinger
   
   r14621 at dynpc145 (orig r4759):  clkao | 2007-12-22 03:51:21 -0600
   - Merge /bps/jifty/jifty/branches/cssquery-refactor to /bps/jifty/jifty/trunk
   r14625 at dynpc145 (orig r4763):  trs | 2007-12-22 04:51:20 -0600
    r29318 at zot:  tom | 2007-12-22 05:50:09 -0500
    * Fix setting of class attribute for calendars (className is only for element.className)
    * Fix typo causing the CSSQuery plugin to fail
   
   r14627 at dynpc145 (orig r4765):  jesse | 2007-12-23 14:22:11 -0600
    r74081 at pinglin:  jesse | 2007-12-23 14:52:22 -0500
    * Made Password Auth plugin able to work with attributes other than 'email address' for autoloading
   
   r14628 at dynpc145 (orig r4766):  jesse | 2007-12-23 19:01:20 -0600
    r74084 at pinglin:  jesse | 2007-12-23 19:59:49 -0500
    * Misc current_user cleanups to deal with issues unmasked by RT on Jifty
   
   r14629 at dynpc145 (orig r4767):  trs | 2007-12-23 20:13:46 -0600
    r29329 at zot:  tom | 2007-12-23 21:13:36 -0500
    Add a Quota plugin which provides a framework for managing quotas in Jifty
   
   r14630 at dynpc145 (orig r4768):  trs | 2007-12-23 22:15:57 -0600
    r29340 at zot:  tom | 2007-12-23 23:15:13 -0500
    Upgrade plugins before application so that application upgrades can depend on plugin upgrades
   
   r14631 at dynpc145 (orig r4769):  trs | 2007-12-24 19:06:03 -0600
    r29351 at zot:  tom | 2007-12-24 20:02:32 -0500
    Enforce uniqueness on (object_id, object_class, type)
   
   r14632 at dynpc145 (orig r4770):  trs | 2007-12-24 19:22:52 -0600
    r29355 at zot:  tom | 2007-12-24 20:22:42 -0500
    Bypass ACLs to check
   
   r14633 at dynpc145 (orig r4771):  alexmv | 2007-12-25 01:24:09 -0600
    r26009 at zoq-fot-pik:  chmrr | 2007-12-25 02:21:32 -0500
     * Don't single-quote our JSON output, since JSON technically only has
       double quotes.
   
   r14634 at dynpc145 (orig r4772):  sunnavy | 2007-12-25 12:58:56 -0600
   seems varchar(255) won't work, have to set max_length
   r14635 at dynpc145 (orig r4773):  sartak | 2007-12-26 16:38:28 -0600
    r49456 at onn:  sartak | 2007-12-26 17:36:28 -0500
    A prototype.js fix for IE6 throwing object errors on Hiveminder task creation
   
   r14636 at dynpc145 (orig r4774):  sunnavy | 2007-12-27 01:05:33 -0600
   fixed a wrong regex
   r14637 at dynpc145 (orig r4775):  sartak | 2007-12-27 15:15:12 -0600
    r49625 at onn:  sartak | 2007-12-27 16:14:36 -0500
    Add __limit/N to /=/search/ for when you really only want N results -- such as when displaying them in a dashboard widget O:)
   
  
  r14647 at riddle:  andrew | 2008-01-02 11:26:29 -0600
   r14646 at riddle (orig r4780):  audreyt | 2008-01-02 08:59:00 -0600
   * Jifty::Dispatcher: Extremely trivial POD typo cleanup
  
  r14648 at riddle:  andrew | 2008-01-02 11:29:20 -0600
  The jQuery plugin is now obsolete since jQuery is no included in Jifty's core JavaScript files.
  r14664 at riddle:  andrew | 2008-01-03 21:56:32 -0600
   r14660 at riddle (orig r4782):  sartak | 2008-01-03 16:15:21 -0600
    r49872 at onn:  sartak | 2008-01-03 17:14:31 -0500
    Never send a cookie with cached content. Misbehaving proxies cause terrific problems.
   
   r14661 at riddle (orig r4783):  sartak | 2008-01-03 18:28:49 -0600
    r49874 at onn:  sartak | 2008-01-03 19:28:24 -0500
    Make Jifty::DateTime dates Jifty::Util->stringify to just yyyy-mm-dd, no 00:00:00
   
  
  r14700 at riddle:  andrew | 2008-01-04 23:11:10 -0600
   r14695 at dynpc145 (orig r4785):  clkao | 2008-01-04 08:15:58 -0600
   SPA is not compatible with letme's across clicks/submit
   for obvious reasons.  So disable it when we got
   temporary_current_user.
   
   r14697 at dynpc145 (orig r4787):  sartak | 2008-01-04 14:19:54 -0600
    r49914 at onn:  sartak | 2008-01-04 15:19:03 -0500
    REST: We don't need the temporary hack any more for .js, since jifty_serialize_format already explicitly stringifies things
   
   r14698 at dynpc145 (orig r4788):  nelhage | 2008-01-04 16:19:18 -0600
   Add the continuation debugging tool from hiveminder
   r14699 at dynpc145 (orig r4789):  sartak | 2008-01-04 16:23:43 -0600
    r49918 at onn:  sartak | 2008-01-04 17:22:31 -0500
    jQuery: Fix our one test failure (caused by a broken test)
   
  
  r14712 at riddle:  andrew | 2008-01-07 08:36:31 -0600
  Adding a CLI thingy to generate stubs for command-line scripts.
  r14728 at riddle:  andrew | 2008-01-09 13:17:21 -0600
   r14719 at riddle (orig r4794):  sartak | 2008-01-07 13:10:49 -0600
   
   r14720 at riddle (orig r4795):  sartak | 2008-01-07 13:11:00 -0600
    r49938 at onn:  sartak | 2008-01-07 14:10:22 -0500
    Tiny fixes in the new Jifty::Script::Script (hanenkamp++)
   
   r14721 at riddle (orig r4796):  sartak | 2008-01-07 13:20:13 -0600
    r49942 at onn:  sartak | 2008-01-07 14:19:44 -0500
    Munging @INC isn't necessary in new scripts, Jifty does that for you now
   
   r14725 at riddle (orig r4800):  alexmv | 2008-01-07 23:57:18 -0600
    r26465 at zoq-fot-pik:  chmrr | 2008-01-08 00:55:56 -0500
     * Force time zone update on current_user change
   
  
  r14743 at riddle:  andrew | 2008-01-10 17:38:10 -0600
   r14731 at riddle (orig r4803):  alexmv | 2008-01-09 18:24:29 -0600
    r26550 at zoq-fot-pik:  chmrr | 2008-01-09 19:24:03 -0500
     * Email::MIME and Email::Simple went through a period of not talking
       to each other, throwing crokery around, and generally making life
       miserable for each other.  Force versions of things which are at
       least on speaking terms again.
     * Updated META.yml for that.
   
   r14732 at riddle (orig r4804):  alexmv | 2008-01-09 18:24:35 -0600
    r26551 at zoq-fot-pik:  chmrr | 2008-01-09 19:24:17 -0500
     * Updated Module::Install
   
   r14734 at riddle (orig r4806):  sartak | 2008-01-10 14:00:44 -0600
    r50044 at onn:  sartak | 2008-01-10 14:59:41 -0500
    REST: Add __order_by, __order_by_asc, and __order_by_desc to /=/search
   
   r14736 at riddle (orig r4808):  sartak | 2008-01-10 14:57:25 -0600
    r50048 at onn:  sartak | 2008-01-10 15:56:42 -0500
    Use add_order_by for REST's __order_by, except the first time when we do want
    to wipe out the default ordering
   
   r14739 at riddle (orig r4811):  sartak | 2008-01-10 15:06:15 -0600
    r50054 at onn:  sartak | 2008-01-10 16:05:32 -0500
    Generalize __limit to __per_page and __page
   
   r14740 at riddle (orig r4812):  alexmv | 2008-01-10 15:48:25 -0600
    r26575 at zoq-fot-pik:  chmrr | 2008-01-10 16:47:54 -0500
     * Output a plan before loading modules
   
   r14741 at riddle (orig r4813):  alexmv | 2008-01-10 16:10:42 -0600
    r26581 at zoq-fot-pik:  chmrr | 2008-01-10 17:10:17 -0500
     * Only clobber ::plan if we actually output a plan already
     * Require Jifty::Util
   
   r14742 at riddle (orig r4814):  sartak | 2008-01-10 16:11:10 -0600
    r50056 at onn:  sartak | 2008-01-10 17:10:24 -0500
    REST: Add /=/version, which only includes Jifty and REST versions. Bump REST to 1.00.
   
  
  r14744 at riddle:  andrew | 2008-01-10 22:38:27 -0600
  Updating so that simple bars work again (broke with Prototype 1.6) and also ported to use jQuery.
  r14748 at riddle:  andrew | 2008-01-10 22:38:49 -0600
   r14745 at dynpc145 (orig r4815):  alexmv | 2008-01-10 18:06:33 -0600
    r26589 at zoq-fot-pik:  chmrr | 2008-01-10 19:05:48 -0500
     * Jifty::Test::WWW::Declare doesn't call import_extra, so move
       'requires' and plan into ->setup
     * We have to use Jifty::Util in Jifty::Test, alas. :/
     * Remove bogus svn:keywords from a test file
   
   r14746 at dynpc145 (orig r4816):  sartak | 2008-01-10 19:16:45 -0600
    r50061 at onn:  sartak | 2008-01-10 20:13:51 -0500
    REST: Canonicalize search arguments
   
   r14747 at dynpc145 (orig r4817):  sartak | 2008-01-10 19:17:22 -0600
    r50064 at onn:  sartak | 2008-01-10 20:15:52 -0500
    REST: More documentation for /=/search
   
  
  r14750 at riddle:  andrew | 2008-01-10 22:47:22 -0600
  Updated the chart image behaviour JavaScript since it broke with the Prototype 1.6 update.
  r14751 at riddle:  andrew | 2008-01-10 22:47:35 -0600
  
  r14761 at riddle:  andrew | 2008-01-12 11:18:12 -0600
   r14758 at dynpc145 (orig r4825):  sartak | 2008-01-11 20:16:49 -0600
    r50111 at onn:  sartak | 2008-01-11 21:15:54 -0500
    Make Jifty::DateTime->current_user_has_timezone work (ie without requiring a blessed reference)
   
   r14759 at dynpc145 (orig r4826):  sartak | 2008-01-11 20:22:29 -0600
    r50113 at onn:  sartak | 2008-01-11 21:21:54 -0500
    DateTime->new is pretty strict, so use DateTime->now
    Also accept user_object->timezone for intuiting the user's time zone.
   
   r14760 at dynpc145 (orig r4827):  sartak | 2008-01-11 20:34:58 -0600
    r50115 at onn:  sartak | 2008-01-11 21:34:23 -0500
    Wow, I really botched that line of code :)
   
  
  r14762 at riddle:  andrew | 2008-01-12 11:30:02 -0600
  Add a class to read mode spans to allow them to be selected separately.
  r14922 at riddle:  andrew | 2008-01-24 09:28:14 -0600
   r14826 at riddle (orig r4829):  jesse | 2008-01-12 15:41:18 -0600
    r74888 at pinglin:  jesse | 2008-01-12 14:19:06 -0600
    * You no longer have to manually register an action if the only place it's used in a form is in a submit.
        exception: if you use a moniker rather than an action object, we don't have a way to convert that into the action, so that still requires a manual registration
   
   r14827 at riddle (orig r4830):  jesse | 2008-01-12 15:41:48 -0600
    r74889 at pinglin:  jesse | 2008-01-12 14:19:31 -0600
    * Port the chat demo to Template::Declare
   
   r14828 at riddle (orig r4831):  jesse | 2008-01-12 15:42:38 -0600
    r74890 at pinglin:  jesse | 2008-01-12 14:46:34 -0600
    * cleaning up some old templates
    * made not changing your password no longer a criminal offense
    * fixed a bug someone introduced that mistakenly set password to varchar(255)
   
   r14830 at riddle (orig r4833):  jesse | 2008-01-12 18:16:01 -0600
    r74967 at pinglin:  jesse | 2008-01-12 18:14:49 -0600
    * small bugfixes
   
   r14838 at riddle (orig r4841):  alexmv | 2008-01-13 21:09:25 -0600
    r26667 at zoq-fot-pik:  chmrr | 2008-01-13 22:07:29 -0500
     * POD nit in Jifty::Web::Session (no whitespace on line before POD
       command)
     * Jifty::Web::Session->continuations returns a hash, not a hashref.
   
   r14839 at riddle (orig r4842):  audreyt | 2008-01-14 00:10:13 -0600
   * Jifty::Web::Session::ClientSide - Unbreak this module by conforming
     to the latest ::Session API (with _cookie_name) as well as Base-64
     encoding the cookie itself.
   r14840 at riddle (orig r4843):  audreyt | 2008-01-14 00:28:39 -0600
   * Jifty::Web::Session::ApacheSession, a session backend that bridges to Apache::Session.
   r14841 at riddle (orig r4844):  audreyt | 2008-01-14 03:03:31 -0600
   * J::Web::Session::ClientSide - Switch to Storable because we really want to
     serialize all kinds of things.
   r14842 at riddle (orig r4845):  audreyt | 2008-01-14 03:08:00 -0600
   * Add ApacheSession to MANIFEST.
   r14844 at riddle (orig r4847):  alexmv | 2008-01-14 12:39:00 -0600
    r26743 at zoq-fot-pik:  chmrr | 2008-01-14 13:37:37 -0500
     * Perltidy
     * Revert r4829 -- it registers all actions in the *form*, which is
       wrong.
     * The correct logic (butting the registration on the button) was
       already in the $action->button method; move it into Clickable.
   
   r14845 at riddle (orig r4848):  alexmv | 2008-01-14 12:43:10 -0600
    r26745 at zoq-fot-pik:  chmrr | 2008-01-14 13:41:56 -0500
     * Clean out un-necessary files from examples/
   
   r14846 at riddle (orig r4849):  alexmv | 2008-01-14 12:50:12 -0600
    r26747 at zoq-fot-pik:  chmrr | 2008-01-14 13:48:44 -0500
     * Whoops, stupid copy/paste error.
   
   r14847 at riddle (orig r4850):  alexmv | 2008-01-14 13:20:28 -0600
    r26749 at zoq-fot-pik:  chmrr | 2008-01-14 14:18:53 -0500
     * We should skip registering it on the button if it has made any appearance in the form
   
   r14848 at riddle (orig r4851):  sartak | 2008-01-14 18:39:58 -0600
    r50318 at onn:  sartak | 2008-01-14 19:38:39 -0500
    AJAX canonicalization tests submitted by Peter Mottram
   
   r14849 at riddle (orig r4852):  trs | 2008-01-14 20:14:44 -0600
    r30929 at zot:  tom | 2008-01-14 21:13:37 -0500
    Compare old/new values for updating _before_ checking if we can update it (no point in saying permission denied for a column we don't want to actually change).  However, only do the comparison if we can read the field so that we don't get bogus undefs.  Everybody's happy now.
    
    Bonus: make references X by Y work when comparing old/new values
   
   r14850 at riddle (orig r4853):  trs | 2008-01-14 20:33:37 -0600
    r30931 at zot:  tom | 2008-01-14 21:33:27 -0500
    Get rid of the JQuery plugin tests hanging around from a now gone JQuery plugin
   
   r14851 at riddle (orig r4854):  alexmv | 2008-01-15 14:55:13 -0600
    r26783 at zoq-fot-pik:  chmrr | 2008-01-15 15:53:05 -0500
     * Don't explicitly register the delete action in CRUD
     * Check that forms that are opened are closed
     * Perltidy to fix indentation in Jifty::Web
   
   r14852 at riddle (orig r4855):  sartak | 2008-01-15 18:15:04 -0600
   
   r14853 at riddle (orig r4856):  sartak | 2008-01-15 18:15:13 -0600
    r50373 at onn:  sartak | 2008-01-15 18:32:16 -0500
    Improve Jifty::DateTime->new_from_string so that it can handle time zones properly, and add Jifty::DateTime->get_tz_offset.
   
   r14854 at riddle (orig r4857):  trs | 2008-01-15 18:21:09 -0600
    r30987 at zot:  tom | 2008-01-15 19:19:23 -0500
    Make dropdown/context menus a reasonable fixed width
   
   r14855 at riddle (orig r4858):  trs | 2008-01-15 19:36:48 -0600
    r30999 at zot:  tom | 2008-01-15 20:36:20 -0500
    Make the YUI menu.css usable
   
   r14856 at riddle (orig r4859):  sartak | 2008-01-15 19:52:49 -0600
   
   r14857 at riddle (orig r4860):  sartak | 2008-01-15 19:52:53 -0600
    r50433 at onn:  sartak | 2008-01-15 20:50:48 -0500
    Small fixes for newer OAuth spec
   
   r14858 at riddle (orig r4861):  sartak | 2008-01-15 20:07:44 -0600
    r50439 at onn:  sartak | 2008-01-15 21:06:45 -0500
    Test corrections, and depend on Net::OAuth 0.05
   
   r14859 at riddle (orig r4862):  sartak | 2008-01-15 21:11:35 -0600
    r50441 at onn:  sartak | 2008-01-15 22:10:52 -0500
    Improve tests, the basic protected resource request works, yay. PLAINTEXT fixes.
   
   r14860 at riddle (orig r4863):  sartak | 2008-01-15 21:25:29 -0600
    r50443 at onn:  sartak | 2008-01-15 22:24:47 -0500
    OAuth should set temporary_current_user, not current_user
   
   r14861 at riddle (orig r4864):  sartak | 2008-01-15 21:56:25 -0600
    r50445 at onn:  sartak | 2008-01-15 22:55:42 -0500
    More tests. Looking good!
   
   r14862 at riddle (orig r4865):  trs | 2008-01-16 09:35:50 -0600
    r31001 at zot:  tom | 2008-01-16 10:35:01 -0500
    Support menu grouping for YUI
   
   r14863 at riddle (orig r4866):  trs | 2008-01-16 12:57:49 -0600
    r31014 at zot:  tom | 2008-01-16 12:20:58 -0500
    Cleaning up hard tabs
   
   r14864 at riddle (orig r4867):  trs | 2008-01-16 12:57:55 -0600
    r31024 at zot:  tom | 2008-01-16 13:54:12 -0500
    Fix menu activation for menu items which are defined with link instead of url/label
   
   r14865 at riddle (orig r4868):  trs | 2008-01-16 13:53:16 -0600
    r31027 at zot:  tom | 2008-01-16 14:51:55 -0500
    Only call ->url on link if it supports it
   
   r14866 at riddle (orig r4869):  trs | 2008-01-16 13:54:30 -0600
    r31029 at zot:  tom | 2008-01-16 14:54:24 -0500
    Precedence
   
   r14868 at riddle (orig r4871):  alexmv | 2008-01-17 14:13:03 -0600
    r26865 at zoq-fot-pik:  chmrr | 2008-01-17 15:09:30 -0500
     * lockfile error-proofing
   
   r14869 at riddle (orig r4872):  sartak | 2008-01-17 21:27:15 -0600
    r50513 at onn:  sartak | 2008-01-17 22:25:53 -0500
    Old REST code was creating screwy hashes, use the new jifty_serialize_format instead
   
   r14870 at riddle (orig r4873):  alexmv | 2008-01-17 23:02:07 -0600
    r26877 at zoq-fot-pik:  chmrr | 2008-01-17 23:59:54 -0500
     * Lazy page regions (only work with JS)
   
   r14871 at riddle (orig r4874):  trs | 2008-01-18 00:43:08 -0600
    r31086 at zot:  tom | 2008-01-18 01:12:36 -0500
    Support group headings for YUI menubar rendering
   
   r14872 at riddle (orig r4875):  trs | 2008-01-18 00:43:14 -0600
    r31087 at zot:  tom | 2008-01-18 01:42:27 -0500
    Don't try to make undef urls absolute
   
   r14874 at riddle (orig r4877):  sartak | 2008-01-18 05:46:56 -0600
   
   r14875 at riddle (orig r4878):  sartak | 2008-01-18 05:47:02 -0600
    r50523 at onn:  sartak | 2008-01-18 06:45:25 -0500
    Don't 404 on a search with no results
   
   r14876 at riddle (orig r4879):  sartak | 2008-01-18 05:47:13 -0600
   
   r14877 at riddle (orig r4880):  sartak | 2008-01-18 06:03:53 -0600
    r50532 at onn:  sartak | 2008-01-18 07:03:10 -0500
    Fix test that was requiring search to return 404 for no matches
   
   r14878 at riddle (orig r4881):  sartak | 2008-01-18 06:06:54 -0600
    r50534 at onn:  sartak | 2008-01-18 07:06:11 -0500
    A few more OAuth tests I had left uncommitted, tired of 's'ing them :)
   
   r14883 at riddle (orig r4886):  trs | 2008-01-18 14:32:21 -0600
    r31101 at zot:  tom | 2008-01-18 15:31:49 -0500
    Totally redo menu grouping.  The way it works now is you build up menus and submenus as normal and then for submenus that you want inline, you set render_children_inline => 1 for the parent.
   
   r14885 at riddle (orig r4888):  ssinyagin | 2008-01-19 14:23:58 -0600
   added mod_perl and file permissions info
   r14886 at riddle (orig r4889):  ssinyagin | 2008-01-19 14:26:36 -0600
   appended myself
   r14887 at riddle (orig r4890):  trs | 2008-01-19 17:33:10 -0600
    r31126 at zot:  tom | 2008-01-19 18:31:57 -0500
    Update YUI from 2.2.1 to 2.4.1
    
    *** Please check your apps for incompatibilities as there have been
    *** many changes between these YUI versions.
   
   r14888 at riddle (orig r4891):  sartak | 2008-01-20 23:25:53 -0600
    r50572 at onn:  sartak | 2008-01-21 00:24:48 -0500
    A fix for a time zone bug exposed by Doxory: copy the time_zone from JDBI::Filter, but allow for overriding it
   
   r14891 at riddle (orig r4894):  jesse | 2008-01-21 00:17:57 -0600
    r75284 at pinglin:  jesse | 2008-01-17 09:45:05 -0500
    * Deployment manual updates from Stanislav Sinyagin <ssinyagin at yahoo.com>  
    r75374 at pinglin:  jesse | 2008-01-19 14:24:33 -0500
    * Possibly making region inclusion display-neutral
    r75462 at pinglin:  jesse | 2008-01-21 01:16:24 -0500
    * We somehow had dropped caching headers when we compressed css and js.
   
   r14896 at riddle (orig r4899):  sartak | 2008-01-22 05:56:37 -0600
    r50655 at onn:  sartak | 2008-01-22 06:55:54 -0500
    Force result->success to be 0 or 1, for the benefit of REST users
   
   r14897 at riddle (orig r4900):  jesse | 2008-01-22 12:42:34 -0600
    r75538 at pinglin:  jesse | 2008-01-22 13:40:40 -0500
    * Compressed CSS and JS caching backout
   
   r14900 at riddle (orig r4903):  bokutin | 2008-01-22 15:28:50 -0600
   Add myself to AUTHORS
   
   r14902 at riddle (orig r4905):  sartak | 2008-01-22 16:58:50 -0600
    r50681 at onn:  sartak | 2008-01-22 17:58:12 -0500
    Template::Declare halos! (you'll need a bleeding edge TD though)
   
   r14903 at riddle (orig r4906):  jesse | 2008-01-23 08:42:03 -0600
   
   r14904 at riddle (orig r4907):  jesse | 2008-01-23 08:42:29 -0600
    r75584 at pinglin:  jesse | 2008-01-23 09:41:37 -0500
    * 'unexpected dispatch on REST' fixed -  Patch from bokutin
   
   r14905 at riddle (orig r4908):  sartak | 2008-01-23 13:37:27 -0600
   
   r14906 at riddle (orig r4909):  sartak | 2008-01-23 13:37:41 -0600
    r50687 at onn:  sartak | 2008-01-23 14:37:13 -0500
    REST's _resolve needs to take into account that we use :: as a seperator, but we give . as the separator
   
   r14907 at riddle (orig r4910):  sartak | 2008-01-23 13:53:38 -0600
    r50690 at onn:  sartak | 2008-01-23 14:53:24 -0500
    REST: Qualifying the entire model/action name will fail because it will have no leading ::
   
   r14908 at riddle (orig r4911):  sartak | 2008-01-23 14:12:47 -0600
    r50692 at onn:  sartak | 2008-01-23 15:12:29 -0500
    Awright! Plugins can now fiddle with (TD) halos as they wish.
    
    As an example, query logging is activated only if you use the SQLQueries plugin. Which also fixes a bug where any queries caught by the Halo plugin would be lost to SQLQueries.
   
   r14909 at riddle (orig r4912):  sartak | 2008-01-23 14:32:40 -0600
    r50694 at onn:  sartak | 2008-01-23 15:32:26 -0500
    Some refactoring of Jifty::Mason::Halo. Now it too can support plugins munging the halo data. And its query logging is now off unless the SQLQueries plugin is used
   
   r14910 at riddle (orig r4913):  sartak | 2008-01-23 17:37:23 -0600
    r50696 at onn:  sartak | 2008-01-23 18:37:06 -0500
    Now each halo has a proper header. You can now toggle between rendered output and HTML source. It's ugly as sin, but it works.
    Other misc cleanups.
   
   r14911 at riddle (orig r4914):  sartak | 2008-01-23 18:39:00 -0600
    r50698 at onn:  sartak | 2008-01-23 19:36:03 -0500
    Split between "Draw halos" and "Page info". Make halos look less offensive as well.
   
   r14913 at riddle (orig r4916):  sartak | 2008-01-23 19:11:27 -0600
    r50702 at onn:  sartak | 2008-01-23 20:11:08 -0500
    Add some support for dumping the Perl code of templates. For now, only for TD. And DDS is currently giving us a lot of extraneous bits (oh well)
   
   r14914 at riddle (orig r4917):  sartak | 2008-01-24 04:51:46 -0600
    r50704 at onn:  sartak | 2008-01-24 05:51:18 -0500
    Distinguish between *runnable* actions and *visible* actions in Jifty::API.
    This distinction will be used in the REST interface shortly. You should hide
    an action if the user will never be able to run it. You should deny actions if
    conditions aren't right for this request (such as during a GET). For example:
    
    Only administrators should be able to see a PublishNews action.
        Jifty->api->hide('PublishNews') unless Jifty->web->current_user->is_admin
    
    Only users can run CreateGame (though nonusers can still inspect the action).
        Jifty->api->deny('CreateGame') unless Jifty->web->current_user->user_object
   
   r14915 at riddle (orig r4918):  sartak | 2008-01-24 04:55:50 -0600
    r50706 at onn:  sartak | 2008-01-24 05:55:35 -0500
    BEHAVIOR CHANGE: REST will now list visible actions, not just runnable actions.
    This is because you generally want to disable actions during GET, but that
    breaks GET /=/action/
    
    So if you have actions you really mean to hide, then you'll need to update your application.
   
   r14916 at riddle (orig r4919):  sartak | 2008-01-24 05:18:49 -0600
    r50708 at onn:  sartak | 2008-01-24 06:18:02 -0500
    Allowing actions also shows them. Fix the defaults so that "weird" actions
    (such as Jifty::Action) are hidden.
   
   r14917 at riddle (orig r4920):  sartak | 2008-01-24 05:18:56 -0600
    r50709 at onn:  sartak | 2008-01-24 06:18:31 -0500
    Make TD halos show up only if DevelMode is on, consistent with Mason halos
   
   r14918 at riddle (orig r4921):  sartak | 2008-01-24 05:46:12 -0600
    r50712 at onn:  sartak | 2008-01-24 06:45:38 -0500
    Fix some test failures caused by halo output in TD generated images. Anyone have any better ideas?
   
   r14919 at riddle (orig r4922):  sartak | 2008-01-24 07:13:53 -0600
    r50714 at onn:  sartak | 2008-01-24 08:13:32 -0500
    Security fix: Deny all actions (except Autocomplete and Redirect) on GET. You must whitelist actions known to be safe, such as with:
        before '*' => run { Jifty->api->allow('CustomSearch') };
   
   r14920 at riddle (orig r4923):  sartak | 2008-01-24 07:39:38 -0600
    r50746 at onn:  sartak | 2008-01-24 08:39:25 -0500
    Add t/Mapper/lib/Mapper/Dispatcher.pm which whitelists the GetGrail and CrossBridge actions
   
   r14921 at riddle (orig r4924):  yves | 2008-01-24 09:16:13 -0600
   debian packaging
   
  
  r14924 at riddle:  andrew | 2008-01-24 10:55:28 -0600
  Check the database connection before handling requests.
  r14928 at riddle:  andrew | 2008-01-24 10:56:24 -0600
   r14925 at riddle (orig r4925):  ishigaki | 2008-01-24 09:51:27 -0600
   Jifty::Web: removed long-gone loc.js (deleted at #4324) from javascript_libs
   r14926 at riddle (orig r4926):  sartak | 2008-01-24 10:31:49 -0600
    r50748 at onn:  sartak | 2008-01-24 11:30:28 -0500
    Complain loudly about back-compat when an action is denied.
    Changelog the Jifty::API changes.
   
  
  r14931 at riddle:  andrew | 2008-01-24 11:18:56 -0600
  Backing out the previous commit as this has been moved up into Jifty::DBI.
  r15024 at riddle:  andrew | 2008-01-28 16:05:16 -0600
   r14998 at riddle (orig r4930):  ishigaki | 2008-01-24 11:32:17 -0600
   Jifty::TestServer: explicitly ignore ClassLoader objects in @INC while stringifying
   r14999 at riddle (orig r4931):  alexmv | 2008-01-24 14:49:50 -0600
    r27023 at zoq-fot-pik:  chmrr | 2008-01-24 15:48:04 -0500
     * Fix tests for new region styling
   
   r15000 at riddle (orig r4932):  alexmv | 2008-01-24 14:50:41 -0600
    r27024 at zoq-fot-pik:  chmrr | 2008-01-24 15:48:29 -0500
     * Now with more running under "use strict"
   
   r15002 at riddle (orig r4934):  trs | 2008-01-24 15:11:34 -0600
   
   r15003 at riddle (orig r4935):  alexmv | 2008-01-24 15:12:16 -0600
    r27030 at zoq-fot-pik:  chmrr | 2008-01-24 16:11:14 -0500
     * Protected and private columns and models
     * Force values in REST handler, so we get real values
   
   r15004 at riddle (orig r4936):  trs | 2008-01-24 15:12:18 -0600
    r31384 at zot:  tom | 2008-01-24 16:07:44 -0500
    * YUI classes weren't getting properly attached because $class changed to $args{class} (why didn't strict/warnings catch this?)
    * Attach the proper yuimenu(bar)?itemlabel class to links
   
   r15006 at riddle (orig r4938):  alexmv | 2008-01-24 15:35:17 -0600
    r27030 at zoq-fot-pik:  chmrr | 2008-01-24 16:11:14 -0500
     * Protected and private columns and models
     * Force values in REST handler, so we get real values
   
   r15007 at riddle (orig r4939):  alexmv | 2008-01-24 15:35:21 -0600
    r27047 at zoq-fot-pik:  chmrr | 2008-01-24 16:34:56 -0500
     * Bump JDBI dep
   
   r15009 at riddle (orig r4941):  bokutin | 2008-01-26 01:14:00 -0600
   fix Jifty->web->session->continuations.
   change accessor from $_->key to $_->data_key.
   Jifty::Model::Session schema was changed by revision 990.
   
   r990 | alexmv | 2006-05-05 05:25:00 +0900 (Fri, 05 May 2006) | 3 lines
   Changed paths:
      M /jifty/trunk
      M /jifty/trunk/lib/Jifty/Handle.pm
      M /jifty/trunk/lib/Jifty/Model/Metadata.pm
      M /jifty/trunk/lib/Jifty/Model/Session.pm
      M /jifty/trunk/lib/Jifty/Script/Schema.pm
      M /jifty/trunk/lib/Jifty/Upgrade/Internal.pm
      M /jifty/trunk/lib/Jifty/Upgrade.pm
      M /jifty/trunk/lib/Jifty/Web/Session.pm
      M /jifty/trunk/lib/Jifty.pm
   
    r12829 at zoq-fot-pik:  chmrr | 2006-05-04 16:24:18 -0400
     * Rename 'key' to 'data_key'
   
   r15011 at riddle (orig r4943):  sartak | 2008-01-26 18:21:46 -0600
    r50748 at onn:  sartak | 2008-01-24 11:30:28 -0500
    Complain loudly about back-compat when an action is denied.
    Changelog the Jifty::API changes.
   
   r15012 at riddle (orig r4944):  sartak | 2008-01-26 18:22:17 -0600
   
   r15013 at riddle (orig r4945):  sartak | 2008-01-26 18:22:41 -0600
    r50939 at onn:  sartak | 2008-01-26 19:21:25 -0500
    Let Jifty::Param::Schema actions define documentation for paramters.
    Have the REST dispatcher use "documentation" meta-attribute in models and columns
   
   r15014 at riddle (orig r4946):  sartak | 2008-01-26 18:30:08 -0600
    r50944 at onn:  sartak | 2008-01-26 19:29:36 -0500
    Steal documentation from the model class in Jifty::Action::Record
   
   r15015 at riddle (orig r4947):  sartak | 2008-01-26 19:16:16 -0600
    r50946 at onn:  sartak | 2008-01-26 20:14:41 -0500
    REST: bug in some old code: if (ref $x eq 'ARRAY') { %$x }
   
   r15017 at riddle (orig r4949):  sartak | 2008-01-27 06:13:42 -0600
    r51069 at onn:  sartak | 2008-01-27 07:13:17 -0500
    Revert a mismerge
   
   r15020 at riddle (orig r4952):  bokutin | 2008-01-28 01:23:05 -0600
   fix pods.
   WARN - DEPRECATED: renderer argument to Chart plugin is deprecated. Use DefaultRenderer instead. at trunk/lib/Jifty/Plugin/Chart.pm line 96.
   
   r15023 at riddle (orig r4955):  sartak | 2008-01-28 09:51:44 -0600
    r51105 at onn:  sartak | 2008-01-28 10:48:54 -0500
    Allow AuthenticateOpenID and VerifyOpenID for some pages
   
  
  r15047 at riddle:  andrew | 2008-01-30 09:03:01 -0600
   r15044 at riddle (orig r4962):  bokutin | 2008-01-30 01:11:27 -0600
   utf8 on $path cause garbage characters in Mason.
   This problem line in HTML::Mason::Compiler::raw_block() is
   	$comment = "#line $line $file\n" if $self->use_source_line_numbers;
   If utf8 on $path was pass
   	UTF8_ON  = "#line UTF8_OFF UTF8_ON" ( $file is $path )
  
  r15048 at riddle:  andrew | 2008-01-30 09:04:30 -0600
  Fixed missing HTML escaping on option value attributes in select form fields.
  r15052 at riddle:  andrew | 2008-01-31 15:31:59 -0600
  Inserted the missing jifty-result-popup DIV on the Mason page wrapper.
  r15054 at riddle:  andrew | 2008-01-31 15:33:00 -0600
   r15053 at riddle (orig r4966):  alexmv | 2008-01-31 11:23:44 -0600
    r27409 at zoq-fot-pik:  chmrr | 2008-01-31 12:22:54 -0500
     * One-character fix to get lazy regions actually working
   
  
  r15091 at riddle:  andrew | 2008-02-01 09:36:22 -0600
   r15088 at riddle (orig r4968):  bokutin | 2008-01-31 21:48:55 -0600
   fix pod.
   r15089 at riddle (orig r4969):  sartak | 2008-02-01 09:13:15 -0600
   
   r15090 at riddle (orig r4970):  sartak | 2008-02-01 09:14:54 -0600
    r51313 at onn:  sartak | 2008-02-01 10:12:39 -0500
    OAuth: Support for Authorization header
   
  
  r15102 at riddle:  andrew | 2008-02-01 12:18:28 -0600
  Removing <!-- and --> from scripts because when evalScript() is called during Ajax loads, IE7 complains about syntax errors.
  r15105 at riddle:  andrew | 2008-02-01 12:19:21 -0600
   r15103 at riddle (orig r4971):  sartak | 2008-02-01 11:52:43 -0600
    r51316 at onn:  sartak | 2008-02-01 12:47:44 -0500
    Halo refactor to allow arbitrary plugins to add their data to be displayed
   
   r15104 at riddle (orig r4972):  sartak | 2008-02-01 12:16:01 -0600
    r51318 at onn:  sartak | 2008-02-01 13:15:27 -0500
    Remove a bunch of code duplication between Jifty::{Mason,Plugin}::Halo
   
  
  r15109 at riddle:  andrew | 2008-02-01 13:52:35 -0600
   r15107 at riddle (orig r4974):  alexmv | 2008-02-01 12:33:56 -0600
    r27419 at zoq-fot-pik:  chmrr | 2008-02-01 13:33:11 -0500
     * Too zealous on removing characters
   
   r15108 at riddle (orig r4975):  alexmv | 2008-02-01 12:52:25 -0600
    r27421 at zoq-fot-pik:  chmrr | 2008-02-01 13:51:51 -0500
     * Finish pulling out html comments, and the now-unnecessary newlines
       as well
   
  
  r15148 at riddle:  andrew | 2008-02-02 12:09:00 -0600
  Convert clickable tooltip to button title and make sure buttonToLink() passes on the title attribute.
  r15158 at riddle:  andrew | 2008-02-02 12:09:57 -0600
   r15149 at dynpc145 (orig r4976):  sartak | 2008-02-01 14:56:45 -0600
    r51320 at onn:  sartak | 2008-02-01 14:46:57 -0500
    Some style changes and minor fixes (that damn quote in onclick.. !)
   
   r15150 at dynpc145 (orig r4977):  sartak | 2008-02-01 14:56:51 -0600
    r51321 at onn:  sartak | 2008-02-01 15:55:43 -0500
    Add query logging to halos
    Add some "downgrade the info link if there's no information" logic
   
   r15151 at dynpc145 (orig r4978):  jasonmay | 2008-02-01 14:56:58 -0600
   Minor typo fix
   
   r15152 at dynpc145 (orig r4979):  sartak | 2008-02-01 14:57:17 -0600
   
   r15153 at dynpc145 (orig r4980):  sartak | 2008-02-01 15:55:11 -0600
    r51331 at onn:  sartak | 2008-02-01 16:54:24 -0500
    Halos now display arguments
   
   r15154 at dynpc145 (orig r4981):  sartak | 2008-02-01 16:06:27 -0600
    r51333 at onn:  sartak | 2008-02-01 17:06:06 -0500
    Style changes, flip between "draw halos" and "hide halos"
   
  
  r15290 at riddle:  andrew | 2008-02-12 11:12:51 -0600
   r15177 at riddle (orig r4987):  clkao | 2008-02-03 06:18:42 -0600
   random l10n.
   
   r15178 at riddle (orig r4988):  clkao | 2008-02-03 06:39:35 -0600
   r4925 removed loc.js from jifty::web, which should have been
   added to the i18n plguin.
   
   r15179 at riddle (orig r4989):  sartak | 2008-02-03 13:44:22 -0600
    r51343 at onn:  sartak | 2008-02-03 14:43:38 -0500
    Dependency on URI::Escape (which we're already using, probably pulled in by Mason)
   
   r15180 at riddle (orig r4990):  sartak | 2008-02-03 13:47:01 -0600
    r51345 at onn:  sartak | 2008-02-03 14:46:31 -0500
    Have t/01-dependencies.t report the entire dir+filename, not just the filename
   
   r15181 at riddle (orig r4991):  alexmv | 2008-02-04 15:13:20 -0600
    r27443 at zoq-fot-pik:  chmrr | 2008-02-04 16:10:36 -0500
    THE FOLLOWING CHANGE BREAKS BACK COMPATABILITY:
    
     * 'set' in T::D templates and the dispatcher no longer alters the
       values in the request itself.  It alters values that are not stored
       if the request is saved as a continuation.  This saves us from
       contiuation bloat due to objects getting stored in the
       continuation.  This does not lose us much, because any arguments
       set via 'set' will get a chance to be set again when the
       continuation is called.
    
       Due to the implementation, however, 'set' cannot be used any more
       to alter or add actions, state variables, or the like.  Some might
       view this new restriction as a feature, though, given how much of a
       kludge it felt like before.
   
   r15183 at riddle (orig r4993):  clkao | 2008-02-05 08:43:51 -0600
   * In authenticate::password plugin, do the password check on
     creation and prevent empty password. 
   * Add todo tests for validate_password to be run on set_password,
     which isn't currently the case.
   
   r15184 at riddle (orig r4994):  clkao | 2008-02-05 08:46:15 -0600
   * don't prepend http:// on https:// openid urls.
   * on verification failure, call continuation if there's one,
     rather than always redirect to /openid/login.
   
   r15185 at riddle (orig r4995):  sartak | 2008-02-05 10:54:38 -0600
    r51361 at onn:  sartak | 2008-02-05 11:53:49 -0500
    Checkpoint in the new Attributes plugin, a port of RT::Attribute
   
   r15186 at riddle (orig r4996):  sartak | 2008-02-05 11:58:28 -0600
    r51363 at onn:  sartak | 2008-02-05 12:57:59 -0500
    Forgot to commit TestApp::Plugin::Attributes::Model::Song
    Clean up the return values of the attribute mixin methods
    A bunch more tests
   
   r15187 at riddle (orig r4997):  sartak | 2008-02-05 12:46:20 -0600
    r51365 at onn:  sartak | 2008-02-05 13:45:51 -0500
    Some SQLQueries fixes
   
   r15189 at riddle (orig r4999):  sartak | 2008-02-05 13:03:48 -0600
    r51369 at onn:  sartak | 2008-02-05 14:03:22 -0500
    SQLQueries: Log queries as soon as they're made, instead of after the request
   
   r15250 at riddle (orig r5060):  alexmv | 2008-02-06 15:14:17 -0600
    r27521 at zoq-fot-pik:  chmrr | 2008-02-06 16:02:33 -0500
     * onclick => { submit => { action => $a, arguments => { a => "b" }}}
       now propagates the action arguments to the non-JS click as well.
   
   r15256 at riddle (orig r5066):  alexmv | 2008-02-07 13:03:21 -0600
    r27687 at zoq-fot-pik:  chmrr | 2008-02-07 14:03:12 -0500
     * Cache triggers for session and metadata
   
   r15257 at riddle (orig r5067):  sartak | 2008-02-07 13:27:17 -0600
    r51455 at onn:  sartak | 2008-02-07 14:25:55 -0500
    Halo pod coverage
   
   r15259 at riddle (orig r5069):  sartak | 2008-02-07 13:41:00 -0600
    r51461 at onn:  sartak | 2008-02-07 14:39:58 -0500
    Better diagnostics from OAuth - notify user when we have Net-OAuth < 0.05
   
   r15260 at riddle (orig r5070):  falcone | 2008-02-07 14:47:12 -0600
    r29315 at ketch:  falcone | 2008-02-07 15:45:16 -0500
    * t/TestApp/t/06-validator.t fails with an older HTTP::Server::Simple
   
   r15262 at riddle (orig r5072):  alexmv | 2008-02-07 15:27:04 -0600
    r27701 at zoq-fot-pik:  chmrr | 2008-02-07 16:26:41 -0500
     * Template arguments override normal args, when talking to templates
     * Template arguments don't propagate down into pageregion calls
   
   r15263 at riddle (orig r5073):  alexmv | 2008-02-07 22:41:05 -0600
    r27710 at zoq-fot-pik:  chmrr | 2008-02-07 23:40:58 -0500
     * Work around bug in Devel::InnerPackage
   
   r15264 at riddle (orig r5074):  jesse | 2008-02-07 22:49:24 -0600
    r27479 at 31b:  jesse | 2008-02-07 23:49:17 -0500
    Small cleanups to CRUD views to help make RT work
   
   r15271 at riddle (orig r5081):  sartak | 2008-02-08 15:42:52 -0600
    r51679 at onn:  sartak | 2008-02-08 16:41:47 -0500
    Fix the isa check in REST's _resolve.  We instead want to fail if the class we check isn't a $base.
   
   r15272 at riddle (orig r5082):  alexmv | 2008-02-08 15:47:36 -0600
    r27722 at zoq-fot-pik:  chmrr | 2008-02-08 16:47:00 -0500
     * Add an ->enumerable method to record classes, so we don't try to
       create huge valid_values lists for record classes which are
       known-huge.
   
   r15277 at riddle (orig r5087):  audreyt | 2008-02-09 17:07:48 -0600
   * Jifty::Util::app_root - File::Spec::Win32's catdir() just got
     much more strict in PathTools 3.27, such that:
   
       catdir('C:', 'perl')
   
     Now returns 'C:perl' instead of 'C:\perl'.  Code around it
     using a few catpath() calls to deal with the volume part.
   
     (This is not the whole story; a new Class::Inspector release
     would be needed for File::HomeDir to work on Win32 too.)
   r15281 at riddle (orig r5091):  alexmv | 2008-02-11 13:28:13 -0600
    r27742 at zoq-fot-pik:  chmrr | 2008-02-11 14:27:52 -0500
     * catpath wants a file, or File::Spec::Unix carps about undef values
   
   r15282 at riddle (orig r5092):  sartak | 2008-02-11 14:01:27 -0600
   
   r15283 at riddle (orig r5093):  sartak | 2008-02-11 14:01:57 -0600
    r51757 at onn:  sartak | 2008-02-11 14:59:50 -0500
    OAuth: Better debugging output, small fixes
   
   r15284 at riddle (orig r5094):  sartak | 2008-02-11 14:02:17 -0600
    r51758 at onn:  sartak | 2008-02-11 15:01:04 -0500
    Keep track of whether we are OAuthed in the stash (this may move in the future, since current_user_can will probably want it)
    More tests, especially "don't let consumers oauth tokens while oauthed"
   
   r15285 at riddle (orig r5095):  alexmv | 2008-02-11 14:47:07 -0600
    r27753 at zoq-fot-pik:  chmrr | 2008-02-11 15:46:40 -0500
     * Old requests from continuations may not have template_arguments set
   
   r15289 at riddle (orig r5099):  audreyt | 2008-02-12 00:33:35 -0600
   * Upgrade Class::Inspector dependency so Win32 won't break
     with File::Spec 3.16.
  
 


Modified: jifty/branches/virtual-models/AUTHORS
==============================================================================
--- jifty/branches/virtual-models/AUTHORS	(original)
+++ jifty/branches/virtual-models/AUTHORS	Thu Feb 14 14:59:21 2008
@@ -35,3 +35,5 @@
 Cornelius Lin <c9s at aiink.com>
 Todd Chapman <todd at chaka.net>
 Jason May <jason.a.may at gmail.com>
+Stanislav Sinyagin <ssinyagin at k-open.com>
+Tomohiro Hosaka <bokutin at bokut.in>

Modified: jifty/branches/virtual-models/Changelog
==============================================================================
--- jifty/branches/virtual-models/Changelog	(original)
+++ jifty/branches/virtual-models/Changelog	Thu Feb 14 14:59:21 2008
@@ -1,3 +1,13 @@
+Jifty $NEXT
+
+BACKWARDS COMPATIBILITY
+====
+ * Deny all actions during GET requests. Applications must now whitelist safe
+   actions. - Sartak
+ * The action API is now split between "runnable" and "inspectable". The REST
+   interface used to use the former, now it uses the latter. - Sartak
+
+
 Jifty 0.71129
 
 I18N

Modified: jifty/branches/virtual-models/MANIFEST
==============================================================================
--- jifty/branches/virtual-models/MANIFEST	(original)
+++ jifty/branches/virtual-models/MANIFEST	Thu Feb 14 14:59:21 2008
@@ -369,6 +369,7 @@
 lib/Jifty/Web/Menu.pm
 lib/Jifty/Web/PageRegion.pm
 lib/Jifty/Web/Session.pm
+lib/Jifty/Web/Session/ApacheSession.pm
 lib/Jifty/Web/Session/ClientSide.pm
 lib/Jifty/Web/Session/None.pm
 lib/Jifty/YAML.pm

Modified: jifty/branches/virtual-models/META.yml
==============================================================================
--- jifty/branches/virtual-models/META.yml	(original)
+++ jifty/branches/virtual-models/META.yml	Thu Feb 14 14:59:21 2008
@@ -1,8 +1,9 @@
 --- 
+author: ~
 build_requires: 
   ExtUtils::MakeMaker: 6.11
 distribution_type: module
-generated_by: Module::Install version 0.67
+generated_by: Module::Install version 0.680
 license: Perl
 meta-spec: 
   url: http://module-build.sourceforge.net/META-spec-v1.3.html
@@ -27,11 +28,11 @@
   Class::Accessor::Named: 0
   Crypt::OpenSSL::RSA: 0
   DBD::SQLite: 0
+  Data::Dump::Streamer: 0
   Devel::Cover: 0
   Devel::EvalContext: 0
-  Devel::Events: 0.02
-  Devel::Events::Generator::Objects: 0
-  Devel::Events::Handler::ObjectTracker: 0
+  Devel::Events::Objects: 0.02
+  Devel::Gladiator: 0
   Devel::Size: 0
   Digest::HMAC_SHA1: 0
   GD: 0
@@ -42,14 +43,13 @@
   Module::Install::Admin: 0.50
   Module::Refresh: 0.09
   Net::LDAP: 0
-  Net::OAuth::AccessTokenRequest: 0
-  Net::OAuth::ProtectedResourceRequest: 0
-  Net::OAuth::Request: 0.04
-  Net::OAuth::RequestTokenRequest: 0
+  Net::OAuth::Request: 0.05
   Net::OpenID::Consumer: 0
   Net::Server::Fork: 0
   Net::Server::PreFork: 0
   PAR::Dist::FromCPAN: 0
+  Proc::ProcessTable: 0
+  Template::Declare: 0.28
   Test::Base: 0.44
   Test::HTML::Lint: 0
   Test::HTTP::Server::Simple: 0.02
@@ -81,14 +81,14 @@
   DateTime::Locale: 0
   Email::Folder: 0
   Email::LocalDelivery: 0.217
-  Email::MIME: 0
-  Email::MIME::ContentType: 0
+  Email::MIME: 1.861
+  Email::MIME::ContentType: 1.012
   Email::MIME::CreateHTML: 0
-  Email::MIME::Creator: 0
-  Email::MIME::Modifier: 0
-  Email::Send: 1.99_01
-  Email::Simple: 0
-  Email::Simple::Creator: 0
+  Email::MIME::Creator: 1.45
+  Email::MIME::Modifier: 1.442
+  Email::Send: 2.0
+  Email::Simple: 2.003
+  Email::Simple::Creator: 1.4
   Exporter::Lite: 0
   File::Find::Rule: 0
   File::MMagic: 0
@@ -101,14 +101,14 @@
   HTML::Mason::Plugin: 0
   HTTP::Cookies: 0
   HTTP::Date: 0
-  HTTP::Server::Simple: 0.26
+  HTTP::Server::Simple: 0.28
   HTTP::Server::Simple::Recorder: 0
   Hash::Merge: 0
   Hook::LexWrap: 0
   IPC::PubSub: 0.23
   IPC::Run3: 0
   JSON::Syck: 0.15
-  Jifty::DBI: 0.47
+  Jifty::DBI: 0.49
   LWP::UserAgent: 0
   Locale::Maketext::Extract: 0.20
   Locale::Maketext::Lexicon: 0.60
@@ -124,7 +124,7 @@
   Params::Validate: 0
   Pod::Simple: 0
   SQL::ReservedWords: 0
-  Scalar::Defer: 0.10
+  Scalar::Defer: 0.12
   Shell::Command: 0
   String::Koremutake: 0
   Template::Declare: 0.26
@@ -137,6 +137,7 @@
   Test::WWW::Selenium: 0
   UNIVERSAL::require: 0
   URI: 1.31
+  URI::Escape: 0
   WWW::Mechanize: 1.3
   XML::Simple: 0
   XML::Writer: 0.601

Modified: jifty/branches/virtual-models/Makefile.PL
==============================================================================
--- jifty/branches/virtual-models/Makefile.PL	(original)
+++ jifty/branches/virtual-models/Makefile.PL	Thu Feb 14 14:59:21 2008
@@ -12,6 +12,7 @@
 requires('Clone' => '0.27');
 requires('CGI' => '3.19');
 requires('CGI::Cookie::Splitter');
+requires('Class::Inspector' => 1.20); # For File::ShareDir on Win32
 requires('Crypt::CBC');
 requires('Crypt::Rijndael');
 requires('Compress::Zlib');
@@ -24,14 +25,14 @@
 requires('Date::Manip');
 requires('Email::Folder');
 requires('Email::LocalDelivery' => 0.217 );
-requires('Email::MIME');
-requires('Email::MIME::Creator');
-requires('Email::MIME::ContentType');
+requires('Email::MIME' => 1.861);
+requires('Email::MIME::Creator' => 1.450 );
+requires('Email::MIME::ContentType' => 1.012 );
 requires('Email::MIME::CreateHTML');
-requires('Email::MIME::Modifier');
-requires('Email::Send' => '1.99_01'); # Email::Send::Jifty::Test
-requires('Email::Simple');
-requires('Email::Simple::Creator');
+requires('Email::MIME::Modifier' => 1.442 );
+requires('Email::Send' => '2.0'); # Email::Send::Jifty::Test
+requires('Email::Simple' => 2.003);
+requires('Email::Simple::Creator' => 1.400 );
 requires('Exporter::Lite');
 requires('File::Find::Rule');
 requires('File::MMagic');
@@ -44,13 +45,13 @@
 requires('HTML::Mason::Plugin');
 requires('HTTP::Cookies');
 requires('HTTP::Date');
-requires('HTTP::Server::Simple' => '0.26');  # HTTP::Server::Simple::CGI
+requires('HTTP::Server::Simple' => '0.28');  # HTTP::Server::Simple::CGI
 requires('HTTP::Server::Simple::Recorder');
 requires('Hash::Merge');
 requires('Hook::LexWrap');
 requires('IPC::PubSub' => '0.23' );
 requires('IPC::Run3');
-requires('Jifty::DBI' => '0.47' );            # Jifty::DBI::Collection Jifty::DBI::Handle Jifty::DBI::Record::Cachable Jifty::DBI::SchemaGenerator
+requires('Jifty::DBI' => '0.49' );            # Jifty::DBI::Collection Jifty::DBI::Handle Jifty::DBI::Record::Cachable Jifty::DBI::SchemaGenerator
 requires('Locale::Maketext::Extract' => '0.20');
 requires('Locale::Maketext::Lexicon' => '0.60');
 requires('Log::Log4perl' => '1.04');
@@ -64,7 +65,7 @@
 requires('Object::Declare' => '0.13');
 requires('PadWalker');
 requires('Params::Validate');
-requires('Scalar::Defer' => '0.10');
+requires('Scalar::Defer' => '0.12');
 requires('Shell::Command');
 requires('String::Koremutake');
 requires('SQL::ReservedWords');
@@ -83,6 +84,7 @@
 requires('WWW::Mechanize' => 1.30 ),
 requires('UNIVERSAL::require');
 requires('URI' => 1.31);
+requires('URI::Escape');
 requires('XML::Writer' => '0.601');
 requires('XML::Simple');
 requires('XML::XPath');
@@ -164,20 +166,16 @@
         recommends('XML::Simple'),
         recommends('Image::Info'), # for testing
     ],
-    'Memory Leak Plugin' => [
+    'Memory Leak Plugins' => [
         -default => 0,
-        recommends('Devel::Events' => '0.02'),
-        recommends('Devel::Events::Handler::ObjectTracker'),
-        recommends('Devel::Events::Generator::Objects'),
+        recommends('Devel::Events::Objects' => '0.02'), # Devel::Events::Handler::ObjectTracker Devel::Events::Generator::Objects
         recommends('Devel::Size'),
+        recommends('Devel::Gladiator'),
+        recommends('Proc::ProcessTable'),
     ],
     'OAuth Plugin' => [
         -default => 0,
-        recommends('Net::OAuth::Request' => '0.04'),
-        recommends('Net::OAuth::RequestTokenRequest'),
-        recommends('Net::OAuth::AccessTokenRequest'),
-        recommends('Net::OAuth::ProtectedResourceRequest'),
-
+        recommends('Net::OAuth::Request' => '0.05'), # Net::OAuth::RequestTokenRequest Net::OAuth::AccessTokenRequest Net::OAuth::ProtectedResourceRequest
         recommends('Crypt::OpenSSL::RSA'),
         recommends('Digest::HMAC_SHA1'),
     ],
@@ -188,7 +186,12 @@
     'CAS Plugin' => [
         -default => 0,
         recommends('Authen::CAS::Client')
-    ]
+    ],
+    'Improved halos' => [
+        -default => 0,
+        recommends('Template::Declare' => '0.28'),
+        recommends('Data::Dump::Streamer'),
+    ],
 );
 
 

Added: jifty/branches/virtual-models/bin/show_continuation
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/bin/show_continuation	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+
+use Jifty::Everything;
+Jifty->new();
+
+my $id = shift @ARGV || die("Usage: $0 CONTINUATION_ID\n");
+
+my $session = Jifty::Model::SessionCollection->new(current_user => Jifty::CurrentUser->superuser);
+$session->limit(column => 'data_key', value => $id);
+
+while (my $item = $session->next) {
+    print scalar Jifty::YAML::Dump($item->value);
+}
+
+1;

Modified: jifty/branches/virtual-models/debian/control
==============================================================================
--- jifty/branches/virtual-models/debian/control	(original)
+++ jifty/branches/virtual-models/debian/control	Thu Feb 14 14:59:21 2008
@@ -60,7 +60,7 @@
  libdbd-sqlite3-perl, libdata-page-perl, libossp-uuid-perl,
  libdatetime-perl, libdatetime-format-builder-perl, 
  libdate-manip-perl, libemail-folder-perl,
- libemail-messageid-perl, libemail-mime-perl, libemail-mime-encodings-perl, libemail-mime-perl, libemail-mime-encodings-perl, libemail-mime-contenttype-perl, libemail-simple-perl, libemail-mime-modifier-perl, libemail-mime-creator-perl, libemail-mime-createhtml-perl,
+ libemail-messageid-perl, libemail-mime-perl (>> 1.861), libemail-mime-encodings-perl, libemail-mime-perl, libemail-mime-encodings-perl, libemail-mime-contenttype-perl, libemail-simple-perl, libemail-mime-modifier-perl, libemail-mime-creator-perl, libemail-mime-createhtml-perl,
  libemail-localdelivery-perl (>> 0.217), 
  libemail-send-perl (>> 2.003), 
  libemail-simple-creator-perl, libexporter-lite-perl,
@@ -75,11 +75,11 @@
  libmime-types-perl, libmodule-pluggable-perl (>> 3.5),
  libmodule-corelist-perl, libmodule-refresh-perl,
  libmodule-scandeps-perl, libobject-declare-perl (>> 0.22),
- libparams-validate-perl, libscalar-defer-perl (>> 0.10),
+ libparams-validate-perl, libscalar-defer-perl (>> 0.14),
  libpadwalker-perl,
  libstring-koremutake-perl, libsql-reservedwords-perl,
  libtemplate-declare-perl (>> 0.26), 
- libtest-base-perl, libtest-log4perl-perl, 
+ libtest-base-perl, libtest-log4perl-perl, libtest-www-selenium-perl, 
  libuniversal-require-perl, liburi-perl,
  libxml-writer-perl (>> 0.601), libxml-simple-perl,
  libxml-xpath-perl, libversion-perl, libyaml-syck-perl (>> 0.72), 

Modified: jifty/branches/virtual-models/examples/Chat/Makefile.PL
==============================================================================
--- jifty/branches/virtual-models/examples/Chat/Makefile.PL	(original)
+++ jifty/branches/virtual-models/examples/Chat/Makefile.PL	Thu Feb 14 14:59:21 2008
@@ -1,5 +1,5 @@
 use inc::Module::Install;
-name('Clock');
+name('Chat');
 version('0.01');
 requires('Jifty' => '0.60912');
 

Added: jifty/branches/virtual-models/examples/Chat/lib/Chat/View.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/examples/Chat/lib/Chat/View.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,31 @@
+use warnings;
+use strict;
+
+package Chat::View;
+use Jifty::View::Declare -base;
+
+template 'index.html' => page { title => "Jifty chat server" } content {
+    Jifty->subs->add(
+        class       => 'Message',
+        mode        => 'Bottom',
+        region      => "message",
+        render_with => '/fragments/message'
+    );
+    render_region( name => "message", path => '/__jifty/empty' );
+    render_region( name => "sender",  path => '/fragments/sender' );
+};
+
+template 'fragments/message' => sub {
+    div { get('event')->data->{'message'} }
+};
+
+
+template 'fragments/sender' => sub {
+    my $action = Jifty->web->new_action( class => 'Send' );
+    form {
+        render_param ($action => 'message', focus => 1);
+        form_submit(onclick => [ { submit => $action }, { refresh_self => 1 } ]);
+    }
+};
+
+1;

Modified: jifty/branches/virtual-models/inc/Module/Install.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install.pm	Thu Feb 14 14:59:21 2008
@@ -28,7 +28,7 @@
     # This is not enforced yet, but will be some time in the next few
     # releases once we can make sure it won't clash with custom
     # Module::Install extensions.
-    $VERSION = '0.67';
+    $VERSION = '0.68';
 }
 
 # Whether or not inc::Module::Install is actually loaded, the

Modified: jifty/branches/virtual-models/inc/Module/Install/AutoInstall.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install/AutoInstall.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install/AutoInstall.pm	Thu Feb 14 14:59:21 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.67';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: jifty/branches/virtual-models/inc/Module/Install/Base.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install/Base.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install/Base.pm	Thu Feb 14 14:59:21 2008
@@ -1,7 +1,7 @@
 #line 1
 package Module::Install::Base;
 
-$VERSION = '0.67';
+$VERSION = '0.68';
 
 # Suspend handler for "redefined" warnings
 BEGIN {

Modified: jifty/branches/virtual-models/inc/Module/Install/Can.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install/Can.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install/Can.pm	Thu Feb 14 14:59:21 2008
@@ -11,7 +11,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.67';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: jifty/branches/virtual-models/inc/Module/Install/Fetch.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install/Fetch.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install/Fetch.pm	Thu Feb 14 14:59:21 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.67';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: jifty/branches/virtual-models/inc/Module/Install/Include.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install/Include.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install/Include.pm	Thu Feb 14 14:59:21 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.67';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: jifty/branches/virtual-models/inc/Module/Install/Makefile.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install/Makefile.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install/Makefile.pm	Thu Feb 14 14:59:21 2008
@@ -7,7 +7,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.67';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: jifty/branches/virtual-models/inc/Module/Install/Metadata.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install/Metadata.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install/Metadata.pm	Thu Feb 14 14:59:21 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.67';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: jifty/branches/virtual-models/inc/Module/Install/Scripts.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install/Scripts.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install/Scripts.pm	Thu Feb 14 14:59:21 2008
@@ -7,7 +7,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.67';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: jifty/branches/virtual-models/inc/Module/Install/Share.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install/Share.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install/Share.pm	Thu Feb 14 14:59:21 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.67';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: jifty/branches/virtual-models/inc/Module/Install/Win32.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install/Win32.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install/Win32.pm	Thu Feb 14 14:59:21 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.67';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: jifty/branches/virtual-models/inc/Module/Install/WriteAll.pm
==============================================================================
--- jifty/branches/virtual-models/inc/Module/Install/WriteAll.pm	(original)
+++ jifty/branches/virtual-models/inc/Module/Install/WriteAll.pm	Thu Feb 14 14:59:21 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.67';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: jifty/branches/virtual-models/lib/Jifty.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty.pm	Thu Feb 14 14:59:21 2008
@@ -224,6 +224,12 @@
     # Save the class loader for later reference
     Jifty->class_loader($class_loader);
     Jifty->class_loader->require;
+    # Cache triggers on our model classes (the classloader does this
+    # for app model classes)
+    $_->finalize_triggers
+        for grep { $_->can('finalize_triggers') }
+        qw/Jifty::Model::Metadata Jifty::Model::Session/;
+
     # Configure the request handler and action API handler
     Jifty->handler(Jifty::Handler->new());
     Jifty->api(Jifty::API->new());

Modified: jifty/branches/virtual-models/lib/Jifty/API.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/API.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/API.pm	Thu Feb 14 14:59:21 2008
@@ -20,15 +20,28 @@
      Jifty->api->deny('FooBarDeleteTheWorld');
  }
 
+ # New users cannot even see some actions
+ if (Jifty->web->current_user->age < 18) {
+     Jifty->api->hide(qr/Vote|PurchaseTobacco/);
+ }
+
  # Fetch the class names of all the allowed actions
  my @actions = Jifty->api->actions;
 
+ # Fetch all of the visible actions (some of which may not be allowed)
+ my @visible = Jifty->api->visible_actions;
+
  # Check to see if an action is allowed
  if (Jifty->api->is_allowed('TrueFooBar')) {
      # do something...
  }
 
- # Undo all allow/deny/restrict calls
+ # Check to see if an action is visible
+ if (Jifty->api->is_visible('SpamOurUsers')) {
+     SpamBot->be_annoying;
+ }
+
+ # Undo all allow/deny/restrict/hide calls
  Jifty->api->reset;
 
 =head1 DESCRIPTION
@@ -103,8 +116,8 @@
 
 Resets which actions are allowed to the defaults; that is, all of the
 application's actions, L<Jifty::Action::Autocomplete>, and
-L<Jifty::Action::Redirect> are allowed; everything else is denied.
-See L</restrict> for the details of how limits are processed.
+L<Jifty::Action::Redirect> are allowed and visible; everything else is denied
+and hidden. See L</restrict> for the details of how limits are processed.
 
 =cut
 
@@ -116,22 +129,41 @@
 
     # These are the default action limits
     $self->action_limits(
-        [   { deny => 1, restriction => qr/.*/ },
-            {   allow       => 1,
-                restriction => qr/^\Q$app_actions\E/,
-            },
-            { allow => 1, restriction => 'Jifty::Action::Autocomplete' },
-            { allow => 1, restriction => 'Jifty::Action::Redirect' },
+        [
+            { hide => 1, deny => 1, restriction => qr/.*/ },
+            { allow => 1, show => 1, restriction => qr/^\Q$app_actions\E/ },
+            { allow => 1, show => 1, restriction => 'Jifty::Action::Autocomplete' },
+            { allow => 1, show => 1, restriction => 'Jifty::Action::Redirect' },
         ]
     );
 }
 
+=head2 deny_for_get
+
+Denies all actions except L<Jifty::Action::Autocomplete> and
+L<Jifty::Action::Redirect>. This is to protect against a common cross-site
+scripting hole. In your C<before> dispatcher rules, you can whitelist actions
+that are known to be read-only.
+
+This is called automatically during any C<GET> request.
+
+=cut
+
+sub deny_for_get {
+    my $self = shift;
+    $self->deny(qr/.*/);
+    $self->allow("Jifty::Action::Autocomplete");
+    $self->allow("Jifty::Action::Redirect");
+}
+
 =head2 allow RESTRICTIONS
 
 Takes a list of strings or regular expressions, and adds them in order
 to the list of limits for the purposes of L</is_allowed>.  See
 L</restrict> for the details of how limits are processed.
 
+Allowing actions also L</show> them.
+
 =cut
 
 sub allow {
@@ -152,16 +184,44 @@
     $self->restrict( deny => @_ );
 }
 
+=head2 hide RESTRICTIONS
+
+Takes a list of strings or regular expressions, and adds them in order
+to the list of limits for the purposes of L</is_visible>.  See
+L</restrict> for the details of how limits are processed.
+
+Hiding actions also L</deny> them.
+
+=cut
+
+sub hide {
+    my $self = shift;
+    $self->restrict( hide => @_ );
+}
+
+=head2 show RESTRICTIONS
+
+Takes a list of strings or regular expressions, and adds them in order
+to the list of limits for the purposes of L</is_visible>.  See
+L</restrict> for the details of how limits are processed.
+
+=cut
+
+sub show {
+    my $self = shift;
+    $self->restrict( show => @_ );
+}
+
 =head2 restrict POLARITY RESTRICTIONS
 
-Method that L</allow> and L</deny> call internally; I<POLARITY> is
-either C<allow> or C<deny>.  Allow and deny limits are evaluated in
-the order they're called.  The last limit that applies will be the one
-which takes effect.  Regexes are matched against the class; strings
-are fully L</qualify|qualified> and used as an exact match against the
-class name.  The base set of restrictions (which is reset every
-request) is set in L</reset>, and usually modified by the
-application's L<Jifty::Dispatcher> if need be.
+Method that L</allow>, L</deny>, L</hide>, and L</show> call internally;
+I<POLARITY> is one of C<allow>, C<deny>, C<hide>, or C<show>. Limits are
+evaluated in the order they're called. The last limit that applies will be the
+one which takes effect. Regexes are matched against the class; strings are
+fully L</qualify|qualified> and used as an exact match against the class name.
+The base set of restrictions (which is reset every request) is set in
+L</reset>, and usually modified by the application's L<Jifty::Dispatcher> if
+need be.
 
 If you call:
 
@@ -181,15 +241,16 @@
 
 =cut
 
+my %valid_polarity = map { $_ => 1 } qw/allow deny hide show/;
+
 sub restrict {
     my $self         = shift;
     my $polarity     = shift;
     my @restrictions = @_;
 
     # Check the sanity of the polarity
-    die "Polarity must be 'allow' or 'deny'"
-        unless $polarity eq "allow"
-        or $polarity     eq "deny";
+    die "Polarity must be one of: " . join(', ', sort keys %valid_polarity)
+        unless $valid_polarity{$polarity};
 
     for my $restriction (@restrictions) {
 
@@ -206,6 +267,18 @@
         # Add to list of restrictions
         push @{ $self->action_limits },
             { $polarity => 1, restriction => $restriction };
+
+        # Hiding an action also denies it
+        if ($polarity eq 'hide') {
+            push @{ $self->action_limits },
+                { deny => 1, restriction => $restriction };
+        }
+
+        # Allowing an action also shows it
+        if ($polarity eq 'allow') {
+            push @{ $self->action_limits },
+                { show => 1, restriction => $restriction };
+        }
     }
 }
 
@@ -218,15 +291,49 @@
 =cut
 
 sub is_allowed {
+    my $self   = shift;
+    my $action = shift;
+
+    $self->decide_action_polarity($action, 'allow', 'deny');
+}
+
+=head2 is_visible CLASS
+
+Returns true if the I<CLASS> name (which is fully qualified if it is
+not already) is allowed to be seen.  See L</restrict> above for
+the rules that the class name must pass.
+
+=cut
+
+sub is_visible {
+    my $self   = shift;
+    my $action = shift;
+
+    $self->decide_action_polarity($action, 'show', 'hide');
+}
+
+=head2 decide_action_polarity CLASS, ALLOW, DENY
+
+Returns true if the I<CLASS> name it has the ALLOW restriction, false if it has
+the DENY restriction. This is a helper method used by L</is_allowed> and
+L</is_visible>.
+
+If no restrictions apply to this action, then false will be returned.
+
+=cut
+
+sub decide_action_polarity {
     my $self  = shift;
     my $class = shift;
+    my $allow = shift;
+    my $deny  = shift;
 
     # Qualify the action
     $class = $self->qualify($class);
 
     # Assume that it doesn't pass; however, the real fallbacks are
     # controlled by L</reset>, above.
-    my $allow = 0;
+    my $valid = 0;
 
     # Walk all of the limits
     for my $limit ( @{ $self->action_limits } ) {
@@ -236,18 +343,24 @@
             or ( $class eq $limit->{restriction} ) )
         {
 
-            # If the restriction passes, set the current allow/deny
+            # If the restriction passes, set the current $allow/$deny
             # bit according to if this was a positive or negative
             # limit
-            $allow = $limit->{allow} ? 1 : 0;
+            if ($limit->{$allow}) {
+                $valid = 1;
+            }
+            if ($limit->{$deny}) {
+                $valid = 0;
+            }
         }
     }
-    return $allow;
+
+    return $valid;
 }
 
 =head2 actions
 
-Lists the class names of all of the allowed actions for this Jifty
+Lists the class names of all of the B<allowed> actions for this Jifty
 application; this may include actions under the C<Jifty::Action::>
 namespace, in addition to your application's actions.
 
@@ -255,7 +368,20 @@
 
 sub actions {
     my $self = shift;
-    return sort grep { $self->is_allowed($_) } $self->_actions;
+    return sort grep { not /::SUPER$/ and $self->is_allowed($_) } $self->_actions;
+}
+
+=head2 visible_actions
+
+Lists the class names of all of the B<visible> actions for this Jifty
+application; this may include actions under the C<Jifty::Action::>
+namespace, in addition to your application's actions.
+
+=cut
+
+sub visible_actions {
+    my $self = shift;
+    return sort grep { not /::SUPER$/ and $self->is_visible($_) } $self->_actions;
 }
 
 =head1 SEE ALSO

Modified: jifty/branches/virtual-models/lib/Jifty/Action.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Action.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Action.pm	Thu Feb 14 14:59:21 2008
@@ -647,17 +647,6 @@
         Jifty->web->form->print_action_registration($self->moniker);
     } 
     
-    # Not registered yet, so we need to place registration in the button itself
-    elsif ( not Jifty->web->form->printed_actions->{ $self->moniker } ) {
-
-        # Otherwise, if we're not registered yet, do it in the button
-        my $arguments = $self->arguments;
-        $args{parameters}{ $self->register_name } = ref $self;
-        $args{parameters}{ $self->fallback_form_field_name($_) }
-            = $self->argument_value($_) || $arguments->{$_}->{'default_value'}
-            for grep { $arguments->{$_}{constructor} } keys %{ $arguments };
-    }
-
     # Add whatever additional arguments they've requested to the button
     $args{parameters}{$self->form_field_name($_)} = $args{arguments}{$_}
       for keys %{$args{arguments}};
@@ -1248,11 +1237,6 @@
     return;
 }
 
-=head2 autogenerated
-
-Autogenerated Actions will always return true when this method is called. 
-"Regular" actions will return false.
-
 =head1 CUSTOMIZATION
 
 =head2 Canonicalization
@@ -1375,8 +1359,6 @@
 
 =cut
 
-sub autogenerated {0}
-
 =head1 SEE ALSO
 
 L<Jifty>, L<Jifty::API>, L<Jifty::Action::Record>, L<Jifty::Result>,

Modified: jifty/branches/virtual-models/lib/Jifty/Action/Record.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Action/Record.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Action/Record.pm	Thu Feb 14 14:59:21 2008
@@ -21,11 +21,15 @@
 =cut
 
 use base qw/Jifty::Action/;
-
+use Scalar::Defer qw/ defer /;
 use Scalar::Util qw/ blessed /;
+use Clone qw/clone/;
 
 __PACKAGE__->mk_accessors(qw(record _cached_arguments));
 
+our $ARGUMENT_PROTOTYPE_CACHE = {};
+
+
 =head1 METHODS
 
 =head2 record
@@ -44,10 +48,8 @@
 sub record_class {
     my $self = shift;
     my $class = ref $self;
-    my $hint = $class eq __PACKAGE__ ? "" :
-        " (did you forget to override record_class in $class?)";
-    $self->log->fatal("Jifty::Action::Record must be subclassed to be used" .
-        $hint);
+    my $hint = $class eq __PACKAGE__ ? "" : " (did you forget to override record_class in $class?)";
+    $self->log->fatal("Jifty::Action::Record must be subclassed to be used" .  $hint);
 }
 
 =head2 new PARAMHASH
@@ -67,6 +69,7 @@
         record => undef,
         @_,
     );
+
     my $self = $class->SUPER::new(%args);
 
     # Load the associated record class just in case it hasn't been already
@@ -94,11 +97,9 @@
     
     # Otherwise, try to use the arguments to load the record
     else {
-
         # We could leave out the explicit current user, but it'd have
         # a slight negative performance implications
-        $self->record(
-            $record_class->new( current_user => $self->current_user ) );
+        $self->record( $record_class->new( current_user => $self->current_user ) );
         my %given_pks = ();
         for my $pk ( @{ $self->record->_primary_keys } ) {
             $given_pks{$pk} = $self->argument_value($pk)
@@ -139,11 +140,44 @@
     my $self = shift;
 
     # Don't do this twice, it's too expensive
-    return $self->_cached_arguments if $self->_cached_arguments;
+    unless ( $self->_cached_arguments ) {
+        $ARGUMENT_PROTOTYPE_CACHE->{ ref($self) } ||= $self->_build_class_arguments();
+        $self->_cached_arguments( $self->_fill_in_argument_record_data());
+    }
+    return $self->_cached_arguments();
+}
+
+
+sub _fill_in_argument_record_data {
+    my $self = shift;
+
+    my $arguments = clone( $ARGUMENT_PROTOTYPE_CACHE->{ ref($self) } );
+    return $arguments unless ( $self->record->id );
+
+    for my $field ( keys %$arguments ) {
+        if ( my $function = $self->record->can($field) ) {
+            my $weakself = $self;
+            Scalar::Util::weaken $weakself;
+            $arguments->{$field}->{default_value} = defer {
+                my $val = $function->( $weakself->record );
+                # If the current value is actually a pointer to
+                # another object, turn it into an ID
+                return $val->id if (blessed($val) and $val->isa('Jifty::Record'));
+                return $val;
+            }
+        }
+        # The record's current value becomes the widget's default value
+    }
+    return $arguments;
+}
+
+
+sub _build_class_arguments {
+    my $self = shift;
 
     # Get ready to rumble
     my $field_info = {};
-    my @fields = $self->possible_fields;
+    my @fields     = $self->possible_fields;
 
     # we use a while here because we may be modifying the fields on the fly.
     while ( my $field = shift @fields ) {
@@ -153,47 +187,26 @@
         # The field is a column object, adjust to that
         if ( ref $field ) {
             $column = $field;
-            $field  = $column->name;
-        } 
-        
-        # Otherwise, we need to load the column info
-        else {
-            # Load teh column object and the record's current value
+        } else {
             $column = $self->record->column($field);
-            my $current_value = $self->record->$field;
-
-            # If the current value is actually a pointer to
-            # another object, turn it into an ID
-            $current_value = $current_value->id
-                if blessed($current_value)
-                and $current_value->isa('Jifty::Record');
-
-            # The record's current value becomes the widget's default value
-            $info->{default_value} = $current_value if $self->record->id;
         }
 
-        # 
-        #  if($field =~ /^(.*)_id$/ && $self->record->column($1)) {
-        #    $column = $self->record->column($1);
-        #}
-
-    #########
+        $field = $column->name;
 
         # Canonicalize the render_as setting for the column
-        my $render_as = $column->render_as;
-        $render_as = defined $render_as ? lc($render_as) : '';
+        my $render_as = lc( $column->render_as || '' );
 
         # Use a select box if we have a list of valid values
-        if ( defined (my $valid_values = $column->valid_values)) {
+        if ( defined( my $valid_values = $column->valid_values ) ) {
             $info->{valid_values} = $valid_values;
             $info->{render_as}    = 'Select';
-        } 
-        
+        }
+
         # Use a checkbox for boolean fields
         elsif ( defined $column->type && $column->type =~ /^bool/i ) {
             $info->{render_as} = 'Checkbox';
-        } 
-        
+        }
+
         # Add an additional _confirm field for passwords
         elsif ( $render_as eq 'password' ) {
 
@@ -202,7 +215,8 @@
                 my ( $self, $value ) = @_;
                 if ( $value ne $self->argument_value($field) ) {
                     return $self->validation_error(
-                        ($field.'_confirm') => _("The passwords you typed didn't match each other")
+                        ( $field . '_confirm' ) => _(
+                            "The passwords you typed didn't match each other")
                     );
                 } else {
                     return $self->validation_ok( $field . '_confirm' );
@@ -211,52 +225,32 @@
 
             # Add the extra confirmation field
             $field_info->{ $field . "_confirm" } = {
-                render_as => 'Password',
-                virtual => '1',
-                validator => $same,
-                sort_order => ($column->sort_order +.01),
-                mandatory => 0
+                render_as  => 'Password',
+                virtual    => '1',
+                validator  => $same,
+                sort_order => ( $column->sort_order + .01 ),
+                mandatory  => 0
             };
         }
 
         # Handle the X-to-one references
-        elsif ( defined (my $refers_to = $column->refers_to) ) {
+        elsif ( defined( my $refers_to = $column->refers_to ) ) {
 
             # Render as a select box unless they override
             if ( UNIVERSAL::isa( $refers_to, 'Jifty::Record' ) ) {
                 $info->{render_as} = $render_as || 'Select';
+
+                $info->{render_as} = 'Text' unless $column->refers_to->enumerable;
             }
 
             # If it's a select box, setup the available values
             if ( UNIVERSAL::isa( $refers_to, 'Jifty::Record' ) && $info->{render_as} eq 'Select' ) {
+                $info->{'valid_values'} = $self->_default_valid_values( $column, $refers_to );
+            }
 
-                # Get an unlimited collection
-                my $collection = Jifty::Collection->new(
-                    record_class => $refers_to,
-                    current_user => $self->record->current_user,
-                );
-                $collection->unlimit;
-
-                # Fetch the _brief_description() method
-                my $method = $refers_to->_brief_description();
-
-                # FIXME: we should get value_from with the actualy refered by key
-
-                # Setup the list of valid values
-                $info->{valid_values} = [
-                    {   display_from => $refers_to->can($method) ? $method : "id",
-                        value_from => 'id',
-                        collection => $collection
-                    }
-                ];
-                unshift @{ $info->{valid_values} }, {
-                    display => _('no value'),
-                    value   => '',
-                } unless $column->mandatory;
-            } 
-            
             # If the reference is X-to-many instead, skip it
             else {
+
                 # No need to generate arguments for
                 # JDBI::Collections, as we can't do anything
                 # useful with them yet, anyways.
@@ -266,184 +260,252 @@
                 # developer know what he/she is doing.
                 # So we just render it as whatever specified.
 
-                next unless $render_as;
+                # XXX TODO -  the next line seems to be a "next" which meeant to just fall through the else
+            # next unless $render_as;
             }
         }
 
-    #########
+        #########
 
-        # Figure out what the action's validation method would for this field
-        my $validate_method = "validate_" . $field;
+        $info->{'autocompleter'} ||= $self->_argument_autocompleter($column);
+        my ( $validator, $ajax_validates ) = $self->_argument_validator($column);
+        $info->{validator}      ||= $validator;
+        $info->{ajax_validates} ||= $ajax_validates;
+        my ( $canonicalizer, $ajax_canonicalizes ) = $self->_argument_canonicalizer($column);
+        $info->{'canonicalizer'}      ||= $canonicalizer;
+        $info->{'ajax_canonicalizes'} ||= $ajax_canonicalizes;
 
-        # Build up a validator sub if the column implements validation
-        # and we're not overriding it at the action level
-        if ( $column->validator and not $self->can($validate_method) ) {
-            $info->{ajax_validates} = 1;
-            $info->{validator} = sub {
-                my $self  = shift;
-                my $value = shift;
-
-                # Check the column's validator
-                my ( $is_valid, $message )
-                    = &{ $column->validator }( $self->record, $value );
-
-                # The validator reported valid, return OK
-                if ($is_valid) {
-                    return $self->validation_ok($field);
-                } 
-                
-                # Bad stuff, report an error
-                else {
-                    unless ($message) {
-                        $self->log->error(
-                            qq{Schema validator for $field didn't explain why the value '$value' is invalid}
-                        );
-                    }
-                    return (
-                        $self->validation_error(
-                            $field => ($message || _("That doesn't look right, but I don't know why"))
-                        )
-                    );
-                }
-            };
+        # If we're hand-coding a render_as, hints or label, let's use it.
+        for ( qw(render_as label hints max_length mandatory sort_order container documentation)) {
+            if ( defined( my $val = $column->$_ ) ) {
+                $info->{$_} = $val;
+            }
         }
 
-        # What would the autocomplete method be for this column in the record
-        my $autocomplete_method = "autocomplete_" . $field;
 
-        # Set the autocompleter if the record has one
-        if ( $self->record->can($autocomplete_method) ) {
-            $info->{'autocompleter'} ||= sub {
-                my ( $self, $value ) = @_;
-                my %columns;
-                $columns{$_} = $self->argument_value($_)
-                    for grep { $_ ne $field } $self->possible_fields;
-                return $self->record->$autocomplete_method( $value,
-                    %columns );
-            };
+        $field_info->{$field} = $info;
+    }
+
+    # After all that, use the schema { ... } params for the final bits
+    if ( $self->can('PARAMS') ) {
+
+       # User-defined declarative schema fields can override default ones here
+        my $params = $self->PARAMS;
+
+     # We really, really want our sort_order to prevail over user-defined ones
+     # (as opposed to all other param fields).  So we do exactly that here.
+        while ( my ( $key, $param ) = each %$params ) {
+            defined( my $sort_order = $param->sort_order ) or next;
+
+        # The .99 below means that it's autogenerated by Jifty::Param::Schema.
+            if ( $sort_order =~ /\.99$/ ) {
+                $param->sort_order( $field_info->{$key}{sort_order} );
+            }
         }
 
-        # The column requests an automagically generated autocompleter, which
-        # is baed upon the values available in the field
-        elsif ($column->autocompleted) {
-            # Auto-generated autocompleter
-            $info->{'autocompleter'} ||= sub {
-                my ( $self, $value ) = @_;
+        # Cache the result of merging the Jifty::Action::Record and schema
+        # parameters
+        use Jifty::Param::Schema ();
+        return Jifty::Param::Schema::merge_params( $field_info, $params );
+    }
 
-                my $collection = Jifty::Collection->new(
-                    record_class => $self->record_class,
-                    current_user => $self->record->current_user
-                );
+    # No schema { ... } block, so just use what we generated
+    else {
+        return $field_info;
+    }
+}
 
-                # Return the first 20 matches...
-                $collection->unlimit;
-                $collection->rows_per_page(20);
-
-                # ...that start with the value typed...
-                if (length $value) {
-                    $collection->limit(
-                        column   => $field, 
-                        value    => $value, 
-                        operator => 'STARTSWITH', 
-                        entry_aggregator => 'AND'
-                    );
-                }
 
-                # ...but are not NULL...
-                $collection->limit(
-                    column => $field, 
-                    value => 'NULL', 
-                    operator => 'IS NOT', 
-                    entry_aggregator => 'AND'
-                );
 
-                # ...and are not empty.
-                $collection->limit(
-                    column => $field, 
-                    value => '', 
-                    operator => '!=', 
-                    entry_aggregator => 'AND'
+sub _argument_validator {
+    my $self    = shift;
+    my $column  = shift;
+    my $field   = $column->name;
+    my $do_ajax = 0;
+    my $method;
+
+    # Figure out what the action's validation method would for this field
+    my $validate_method = "validate_" . $field;
+
+    # Build up a validator sub if the column implements validation
+    # and we're not overriding it at the action level
+    if ( $column->validator and not $self->can($validate_method) ) {
+        $do_ajax = 1;
+        $method  = sub {
+            my $self  = shift;
+            my $value = shift;
+
+            # Check the column's validator
+            my ( $is_valid, $message )
+                = &{ $column->validator }( $self->record, $value );
+
+            # The validator reported valid, return OK
+            return $self->validation_ok($field) if ($is_valid);
+
+            # Bad stuff, report an error
+            unless ($message) {
+                $self->log->error(
+                    qq{Schema validator for $field didn't explain why the value '$value' is invalid}
                 );
+            }
+            return ( $self->validation_error( $field => ( $message || _( "That doesn't look right, but I don't know why"))));
+            }
+    }
+
+    return ( $method, $do_ajax );
+}
+
+
+sub _argument_canonicalizer {
+    my $self = shift;
+    my $column = shift;
+    my $field = $column->name;
+    my $method;
+    my $do_ajax = 0;
 
-                # Optimize the query a little bit
-                $collection->columns('id', $field);
-                $collection->order_by(column => $field);
-                $collection->group_by(column => $field);
-
-                # Set up the list of choices to return
-                my @choices;
-                while (my $record = $collection->next) {
-                    push @choices, $record->$field;
-                }
-                return @choices;
-            };
-        }
 
         # Add a canonicalizer for the column if the record provides one
         if ( $self->record->has_canonicalizer_for_column($field) ) {
-            $info->{'ajax_canonicalizes'} = 1;
-            $info->{'canonicalizer'} ||= sub {
+            $do_ajax = 1;
+            $method ||= sub {
                 my ( $self, $value ) = @_;
                 return $self->record->run_canonicalization_for_column(column => $field, value => $value);
             };
         } 
         
         # Otherwise, if it's a date, we have a built-in canonicalizer for that
-        elsif ( $render_as eq 'date') {
-            $info->{'ajax_canonicalizes'} = 1;
+        elsif ( lc($column->render_as) eq 'date') {
+            $do_ajax = 1;
         }
+    return ($method, $do_ajax);
+    }
 
-        # If we're hand-coding a render_as, hints or label, let's use it.
-        for (qw(render_as label hints max_length mandatory sort_order container)) {
+sub _argument_autocompleter {
+    my $self = shift;
+    my $column = shift;
+    my $field  = $column->name;
 
-            if ( defined (my $val = $column->$_) ) {
-                $info->{$_} = $val;
-            }
+    my $autocomplete;
+
+        # What would the autocomplete method be for this column in the record
+        my $autocomplete_method = "autocomplete_" . $field;
+
+        # Set the autocompleter if the record has one
+        if ( $self->record->can($autocomplete_method) ) {
+            $autocomplete ||= sub {
+                my ( $self, $value ) = @_;
+                my %columns;
+                $columns{$_} = $self->argument_value($_) for grep { $_ ne $field } $self->possible_fields;
+                return $self->record->$autocomplete_method( $value, %columns );
+            };
         }
-        $field_info->{$field} = $info;
+
+        # The column requests an automagically generated autocompleter, which
+        # is baed upon the values available in the field
+        elsif ($column->autocompleted) {
+            # Auto-generated autocompleter
+            $autocomplete ||=  sub {  $self->_default_autocompleter(shift , $field)};
+            
+        }
+        return $autocomplete;
+
     }
 
-    # After all that, use the schema { ... } params for the final bits
-    if ($self->can('PARAMS')) {
 
-        # User-defined declarative schema fields can override default ones here
-        my $params = $self->PARAMS;
+sub _default_valid_values {
+    my $self      = shift;
+    my $column    = shift;
+    my $refers_to = shift;
+
+    my @valid;
+
+    # Get an unlimited collection
+    my $collection = Jifty::Collection->new(
+        record_class => $refers_to,
+        current_user => $self->record->current_user,
+    );
+    $collection->find_all_rows;
 
-        # We really, really want our sort_order to prevail over user-defined ones
-        # (as opposed to all other param fields).  So we do exactly that here.
-        while (my ($key, $param) = each %$params) {
-            defined(my $sort_order = $param->sort_order) or next;
-
-            # The .99 below means that it's autogenerated by Jifty::Param::Schema.
-            if ($sort_order =~ /\.99$/) {
-                $param->sort_order($field_info->{$key}{sort_order});
-            }
+    # Fetch the _brief_description() method
+    my $method = $refers_to->_brief_description();
+
+    # FIXME: we should get value_from with the actualy refered by key
+
+    # Setup the list of valid values
+    @valid = (
+        {   display_from => $refers_to->can($method) ? $method : "id",
+            value_from   => 'id',
+            collection   => $collection
         }
+    );
+    unshift @valid, {
+        display => _('no value'),
+        value   => '' } unless $column->mandatory;
+    return \@valid;
 
-        # Cache the result of merging the Jifty::Action::Record and schema
-        # parameters
-        use Jifty::Param::Schema ();
-        $self->_cached_arguments(Jifty::Param::Schema::merge_params($field_info, $params));
-    }
+}
 
-    # No schema { ... } block, so just use what we generated
-    else {
-        $self->_cached_arguments($field_info);
+sub _default_autocompleter {
+    my ( $self, $value, $field ) = @_;
+
+    my $collection = Jifty::Collection->new(
+        record_class => $self->record_class,
+        current_user => $self->record->current_user
+    );
+
+    # Return the first 20 matches...
+    $collection->rows_per_page(20);
+
+    # ...that start with the value typed...
+    if ( length $value ) {
+        $collection->limit(
+            column           => $field,
+            value            => $value,
+            operator         => 'STARTSWITH',
+            entry_aggregator => 'AND'
+        );
     }
 
-    return $self->_cached_arguments();
+    # ...but are not NULL...
+    $collection->limit(
+        column           => $field,
+        value            => 'NULL',
+        operator         => 'IS NOT',
+        entry_aggregator => 'AND'
+    );
+
+    # ...and are not empty.
+    $collection->limit(
+        column           => $field,
+        value            => '',
+        operator         => '!=',
+        entry_aggregator => 'AND'
+    );
+
+    # Optimize the query a little bit
+    $collection->columns( 'id', $field );
+    $collection->order_by( column => $field );
+    $collection->group_by( column => $field );
+
+    # Set up the list of choices to return
+    my @choices;
+    while ( my $record = $collection->next ) {
+        push @choices, $record->$field;
+    }
+    return @choices;
 }
 
+
 =head2 possible_fields
 
 Returns the list of fields on the object that the action can update.
-This defaults to all of the fields of the object.
+This defaults to all of the non-C<private> fields of the object.
 
 =cut
 
 sub possible_fields {
     my $self = shift;
-    return map { $_->name } grep { $_->container || $_->type ne "serial" } $self->record->columns;
+    return map { $_->name } grep { $_->container || $_->type ne "serial" and not $_->private and not $_->virtual } $self->record->columns;
 }
 
 =head2 take_action

Modified: jifty/branches/virtual-models/lib/Jifty/Action/Record/Create.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Action/Record/Create.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Action/Record/Create.pm	Thu Feb 14 14:59:21 2008
@@ -29,13 +29,15 @@
 
 sub arguments {
     my $self = shift;
-    
+
     # Add default values to the arguments configured by Jifty::Action::Record
     my $args = $self->SUPER::arguments;
-    for my $arg (keys %{$args}) {
-        my $column = $self->record->column($arg) or next;
-        $args->{$arg}{default_value} = $column->default
-          if not $args->{$arg}->{default_value};
+    for my $arg ( keys %{$args} ) {
+        unless ( $args->{$arg}->{default_value} ) {
+            my $column = $self->record->column($arg);
+            next if not $column;
+            $args->{$arg}{default_value} = $column->default;
+        }
     }
     return $args;
 }
@@ -118,6 +120,19 @@
     $self->result->message(_("Created"))
 }
 
+=head2 possible_fields
+
+Create actions do not provide fields for columns marked as C<private>
+or C<protected>.
+
+=cut
+
+sub possible_fields {
+    my $self = shift;
+    my @names = $self->SUPER::possible_fields;
+    return map {$_->name} grep {not $_->protected} map {$self->record->column($_)} @names;
+}
+
 =head1 SEE ALSO
 
 L<Jifty::Action::Record>, L<Jifty::Record>

Modified: jifty/branches/virtual-models/lib/Jifty/Action/Record/Search.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Action/Record/Search.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Action/Record/Search.pm	Thu Feb 14 14:59:21 2008
@@ -195,13 +195,13 @@
     my $self = shift;
 
     # Create a generic collection for our record class
-    my $collection = Jifty::Collection->new(
+    my $collection = $self->record_class->collection_class->new(
         record_class => $self->record_class,
         current_user => $self->record->current_user
     );
 
     # Start with an unlimited collection
-    $collection->unlimit;
+    $collection->find_all_rows;
 
     # For each field, process the limits
     for my $field (grep {$self->has_argument($_)} $self->argument_names) {

Modified: jifty/branches/virtual-models/lib/Jifty/Action/Record/Update.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Action/Record/Update.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Action/Record/Update.pm	Thu Feb 14 14:59:21 2008
@@ -36,7 +36,7 @@
     my $arguments = $self->SUPER::arguments(@_);
 
     # Mark read-only columns for read-only display
-    for my $column ( $self->record->columns ) {
+    for my $column ( map {$self->record->column($_)} $self->possible_fields ) {
         if ( not $column->writable and $column->readable ) {
             $arguments->{$column->name}{'render_mode'} = 'read';
         }
@@ -124,18 +124,53 @@
             $value = scalar <$value>;
         }
 
-        # Skip fields that have not changed
-        my $old = $self->record->$field;
-        # XXX TODO: This ignore "by" on columns
-        $old = $old->id if blessed($old) and $old->isa( 'Jifty::Record' );
-    
-        # if both the new and old values are defined and equal, we don't want to change em
-        # XXX TODO "$old" is a cheap hack to scalarize datetime objects
-        next if ( defined $old and defined $value and "$old" eq "$value" );
-
-        # If _both_ the values are ''
-        next if (  (not defined $old or not length $old)
-                    and ( not defined $value or not length $value ));
+        # Skip fields that have not changed, but only if we can read the field.
+        # This prevents us from getting an $old value that is wrongly undef
+        # when really we are just denied read access.  At the same time, it means
+        # we can keep the change checks before checking if we can update.
+        
+        if ( $self->record->current_user_can('read', column => $field) ) {
+            my $old = $self->record->$field;
+
+            # Handle columns which reference other tables
+            my $col = $self->record->column( $field );
+            my $by  = defined $col->by ? $col->by : 'id';
+            $old = $old->$by if blessed($old) and $old->isa( 'Jifty::Record' );
+
+            # ID is sometimes passed in, we want to ignore it if it doesn't change
+            next if $field eq 'id'
+               and defined $old
+               and defined $value
+               and "$old" eq "$value";
+
+            # if both the new and old values are defined and equal, we don't want to change em
+            # XXX TODO "$old" is a cheap hack to scalarize datetime objects
+            next if ( defined $old and defined $value and "$old" eq "$value" );
+
+            # If _both_ the values are ''
+            next if (  (not defined $old or not length $old)
+                        and ( not defined $value or not length $value ));
+        }
+
+        # Error on columns we can't update
+        # <Sartak> ah ha. I think I know why passing due => undef reports
+        #          action success
+        # <Sartak> Jifty::Action::Record::Update compares the value of the
+        #          field with what you passed in
+        # <Sartak> but since user can't read the field, it returns undef
+        # <Sartak> and so: they're both undef, no change, skip this column
+        # <Sartak> and since that's the only column that changed, it'll notice
+        #          that every column it did try to update (which is.. none of
+        #          them) succeeded
+        # <Sartak> I don't think we can just skip ACLs for reading the column
+        #          -- that's a potential security issue. an attacker could try
+        #          every value until the action succeeds because nothing changed
+        # <Sartak> it doesn't matter for HM but for other apps it may
+
+        unless ($self->record->current_user_can('update', column => $field, value => $value)) {
+            $self->result->field_error($field, _('Permission denied'));
+            next;
+        }
 
         # Calculate the name of the setter and set; asplode on failure
         my $setter = "set_$field";
@@ -170,6 +205,20 @@
     $self->result->message(_("Updated"))
 }
 
+
+=head2 possible_fields
+
+Update actions do not provide fields for columns marked as C<private>
+or C<protected>.
+
+=cut
+
+sub possible_fields {
+    my $self = shift;
+    my @names = $self->SUPER::possible_fields;
+    return map {$_->name} grep {not $_->protected} map {$self->record->column($_)} @names;
+}
+
 =head1 SEE ALSO
 
 L<Jifty::Action::Record>, L<Jifty::Record>

Modified: jifty/branches/virtual-models/lib/Jifty/ClassLoader.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/ClassLoader.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/ClassLoader.pm	Thu Feb 14 14:59:21 2008
@@ -3,6 +3,8 @@
 
 package Jifty::ClassLoader;
 
+our %AUTOGENERATED;
+
 =head1 NAME
 
 Jifty::ClassLoader - Loads the application classes
@@ -65,7 +67,7 @@
 
 =item I<Application>::Action::I<[Verb]>I<[Something]>
 
-If I<Application>::Model::I<Something> is a valid model class and I<Verb> is one of "Create", "Search", "Update", or "Delete", then it creates a subclass of I<Application>::Action::Record::I<Verb>
+If I<Application>::Model::I<Something> is a valid model class and I<Verb> is one of "Create", "Search", "Update", or "Delete", then it creates a subclass of I<Application>::Action::Record::I<Verb>  Models can control which actions are generated by overriding L<Jifty::Record/autogenerate_action>.  See also L<Jifty::Record/is_private> and L<Jifty::Record/is_protected>.
 
 =item I<Application>::Action::I<Something>
 
@@ -170,27 +172,29 @@
                                       Dispatcher|Bootstrap|Upgrade|CurrentUser|
                                       Handle|Event|Event::Model|Action|
                                       Action::Record::\w+)$/x ) {
+        $AUTOGENERATED{$module} = 1;
         return $self->return_class(
                   "package $module;\n"
-                . "use base qw/Jifty::$1/; sub _autogenerated { 1 };\n"
+                . "use base qw/Jifty::$1/; \n"
             );
     } 
     
     # Autogenerate an empty View if none is defined
     elsif ( $module =~ /^(?:$base)::View$/ ) {
+        $AUTOGENERATED{$module} = 1;
         return $self->return_class(
                   "package $module;\n"
-                . "use Jifty::View::Declare -base; sub _autogenerated { 1 };\n"
+                . "use Jifty::View::Declare -base;\n"
             );
     } 
 
     # Autogenerate the Collection class for a Model
     elsif ( $module =~ /^(?:$base)::Model::([^\.]+)Collection$/ ) {
+        $AUTOGENERATED{$module} = 1;
         return $self->return_class(
                   "package $module;\n"
                 . "use base qw/@{[$base]}::Collection/;\n"
                 . "sub record_class { '@{[$base]}::Model::$1' }\n"
-                . "sub _autogenerated { 1 };\n"
             );
     } 
     
@@ -204,11 +208,11 @@
         # Don't generate an event unless it really is a model
         return undef unless eval { $modelclass->isa('Jifty::Record') };
 
+        $AUTOGENERATED{$module} = 1;
         return $self->return_class(
                   "package $module;\n"
                 . "use base qw/${base}::Event::Model/;\n"
                 . "sub record_class { '$modelclass' };\n"
-                . "sub _autogenerated { 1 };\n"
             );
     } 
     
@@ -222,13 +226,14 @@
 
         # Don't generate the action unless it really is a model
         if ( eval { $modelclass->isa('Jifty::Record') } ) {
-
-            return $self->return_class(
-                  "package $module;\n"
-                . "use base qw/$base\::Action::Record::$1/;\n"
-                . "sub record_class { '$modelclass' };\n"
-                . "sub _autogenerated { 1 };\n"
-            );
+            if ($modelclass->autogenerate_action($1)) {
+                $AUTOGENERATED{$module} = 1;
+                return $self->return_class(
+                      "package $module;\n"
+                    . "use base qw/$base\::Action::Record::$1/;\n"
+                    . "sub record_class { '$modelclass' };\n"
+                );
+            }
         }
 
     }
@@ -265,7 +270,6 @@
         foreach my $plugin (map {ref} Jifty->plugins) {
             next if ($plugin eq $base);
             my $class = $plugin."::".$type."::".$item;
-
             # Found it!
             if (Jifty::Util->try_to_require($class) ) {
 
@@ -278,10 +282,10 @@
                     if $type eq 'Model';
 
                 # Generate the empty stub
+                $AUTOGENERATED{$module} = 1;
                 return $self->return_class(
                         "package $module;\n"
                         . "use base qw/$class/;\n"
-                        . "sub _autogenerated { 1 };\n"
                         . $module_suffix
                     );
             }
@@ -375,7 +379,7 @@
     my($short) = $full =~ /::Model::(\w*)/;
     Jifty::Util->require($full . "Collection");
     Jifty::Util->require($base . "::Action::" . $_ . $short)
-        for qw/Create Update Delete Search/;
+        for grep {$full->autogenerate_action($_)} qw/Create Update Delete Search/;
 
 }
 
@@ -405,7 +409,7 @@
 
     require Jifty::Model::ModelClassCollection;
     require Jifty::Model::ModelClass;
-    my $models = Jifty::Model::ModelClassCollection->new(current_user => Jifty::CurrentUser->superuser);
+    my $models = Jifty::Model::ModelClassCollection->new(current_user => Jifty->app_class('CurrentUser')->superuser);
     $models->unlimit();
     while (my $model = $models->next) {
         $model->instantiate();
@@ -473,6 +477,18 @@
     @INC = grep {defined $_ and $_ ne $self} @INC;
 }
 
+=head2 autogenerated PACKAGE
+
+Returns true if the package was autogenerated by a classloader.
+
+=cut
+
+sub autogenerated {
+    my $class = shift;
+    my $classname = shift;
+    return $AUTOGENERATED{$classname};
+}
+
 =head1 WRITING YOUR OWN CLASSES
 
 If you require more functionality than is provided by the classes created by

Modified: jifty/branches/virtual-models/lib/Jifty/Collection.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Collection.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Collection.pm	Thu Feb 14 14:59:21 2008
@@ -144,6 +144,19 @@
     return ( current_user => $self->current_user );
 }
 
+=head2 jifty_serialize_format
+
+This returns an array reference of the individual records that make up this
+collection.
+
+=cut
+
+sub jifty_serialize_format {
+    my $records = shift->items_array_ref;
+
+    return [ map { $_->jifty_serialize_format(@_) } @$records ];
+}
+
 =head1 SEE ALSO
 
 L<Jifty::DBI::Collection>, L<Jifty::Object>, L<Jifty::Record>

Modified: jifty/branches/virtual-models/lib/Jifty/Config.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Config.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Config.pm	Thu Feb 14 14:59:21 2008
@@ -255,19 +255,20 @@
     if (@_) {
         $app_name = shift;
     }
-   
+
     # Is it already in the stash?
-    elsif ($self->stash->{framework}->{ApplicationName}) {
-        $app_name =  $self->stash->{framework}->{ApplicationName};
-    } 
-    
+    elsif ( $self->stash->{framework}->{ApplicationName} ) {
+        $app_name = $self->stash->{framework}->{ApplicationName};
+    }
+
     # Finally, just guess from the application root
     else {
-        $app_name =  Jifty::Util->default_app_name;
+        $app_name = Jifty::Util->default_app_name;
     }
 
     # Setup the application class name based on the application name
-    my $app_class =  $self->stash->{framework}->{ApplicationClass} ||$app_name;
+    my $app_class = $self->stash->{framework}->{ApplicationClass}
+        || $app_name;
     $app_class =~ s/-/::/g;
     my $db_name = lc $app_name;
     $db_name =~ s/-/_/g;
@@ -276,49 +277,56 @@
     # Build up the guessed configuration
     my $guess = {
         framework => {
-            AdminMode        => 1,
-            DevelMode        => 1,
+            AdminMode         => 1,
+            DevelMode         => 1,
             SkipAccessControl => 0,
-            ApplicationClass => $app_class,
-            TemplateClass    => $app_class."::View",
-            ApplicationName  => $app_name,
-            ApplicationUUID  => $app_uuid,
-            LogLevel         => 'INFO',
-            PubSub           => {
-                Enable => undef,
+            ApplicationClass  => $app_class,
+            TemplateClass     => $app_class . "::View",
+            ApplicationName   => $app_name,
+            ApplicationUUID   => $app_uuid,
+            LogLevel          => 'INFO',
+            PubSub            => {
+                Enable  => undef,
                 Backend => 'Memcached',
             },
-            Database         => {
-                AutoUpgrade => 1,
-                Database =>  $db_name,
-                Driver   => "SQLite",
-                Host     => "localhost",
-                Password => "",
-                User     => "",
-                Version  => "0.0.1",
+            Database => {
+                AutoUpgrade     => 1,
+                Database        => $db_name,
+                Driver          => "SQLite",
+                Host            => "localhost",
+                Password        => "",
+                User            => "",
+                Version         => "0.0.1",
                 RecordUUIDs => 'active',
                 RecordBaseClass => 'Jifty::DBI::Record::Cachable',
-                CheckSchema => '1'
+                CheckSchema     => '1'
             },
             Mailer     => 'Sendmail',
             MailerArgs => [],
-            L10N       => {
-                PoDir => "share/po",
+            L10N       => { PoDir => "share/po", },
+
+            View => {
+                FallbackHandler => 'Jifty::View::Mason::Handler',
+                Handlers => [
+                    'Jifty::View::Static::Handler',
+                    'Jifty::View::Declare::Handler',
+                    'Jifty::View::Mason::Handler'
+                ]
             },
-            Web        => {
-                Port => '8888',
-                BaseURL => 'http://localhost',
-                DataDir     => "var/mason",
-                StaticRoot   => "share/web/static",
-                TemplateRoot => "share/web/templates",
+            Web => {
+                Port             => '8888',
+                BaseURL          => 'http://localhost',
+                DataDir          => "var/mason",
+                StaticRoot       => "share/web/static",
+                TemplateRoot     => "share/web/templates",
                 ServeStaticFiles => 1,
-                MasonConfig => {
-                    autoflush    => 0,
-                    error_mode   => 'fatal',
-                    error_format => 'text',
+                MasonConfig      => {
+                    autoflush            => 0,
+                    error_mode           => 'fatal',
+                    error_format         => 'text',
                     default_escape_flags => 'h',
                 },
-                Globals      => [],
+                Globals => [],
             },
         },
     };
@@ -339,7 +347,7 @@
 sub initial_config {
     my $self = shift;
     my $guess = $self->guess(@_);
-    $guess->{'framework'}->{'ConfigFileVersion'} = 2;
+    $guess->{'framework'}->{'ConfigFileVersion'} = 3;
 
     # These are the plugins which new apps will get by default
     $guess->{'framework'}->{'Plugins'} = [
@@ -383,6 +391,12 @@
         );
     }
 
+    if ( $config->{'framework'}->{'ConfigFileVersion'} < 3) {
+        unshift (@{$config->{'framework'}->{'Plugins'}}, 
+            { CSSQuery           => {}, }
+        );
+    }
+
     return $config;
 }
 

Modified: jifty/branches/virtual-models/lib/Jifty/Continuation.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Continuation.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Continuation.pm	Thu Feb 14 14:59:21 2008
@@ -253,7 +253,8 @@
     my $self = shift;
 
     # Remove all continuations that point to me
-    $_->delete for grep {$_->parent eq $self->id} values %{Jifty->web->session->continuations};
+    my %continuations = Jifty->web->session->continuations;
+    $_->delete for grep {$_->parent eq $self->id} values %continuations;
 
     # Finally, remove me from the list of continuations
     Jifty->web->session->remove_continuation($self->id);

Modified: jifty/branches/virtual-models/lib/Jifty/DateTime.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/DateTime.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/DateTime.pm	Thu Feb 14 14:59:21 2008
@@ -22,11 +22,15 @@
 
 =head1 DESCRIPTION
 
-Jifty natively stores timestamps in the database in GMT.  Dates are stored
-without timezone. This class loads and parses dates and sets them
-into the proper timezone.
-
-To use this DateTime class to it's fullest ability, you'll need to add a C<time_zone> method to your application's user object class. This is the class returned by L<Jifty::CurrentUser/user_object>. It must return a value valid for using as an argument to L<DateTime>'s C<set_time_zone()> method.
+Jifty natively stores timestamps in the database in GMT.  Dates are
+stored without timezone. This class loads and parses dates and sets
+them into the proper timezone.
+
+To use this DateTime class to it's fullest ability, you'll need to add
+a C<time_zone> method to your application's user object class. This is
+the class returned by L<Jifty::CurrentUser/user_object>. It must
+return a value valid for using as an argument to L<DateTime>'s
+C<set_time_zone()> method.
 
 =cut
 
@@ -53,6 +57,9 @@
 sub new {
     my $class = shift;
     my %args  = (@_);
+
+    my $replace_tz = delete $args{_replace_time_zone};
+
     my $self  = $class->SUPER::new(%args);
 
     # XXX What if they really mean midnight offset by time zone?
@@ -65,15 +72,16 @@
     # 00:00:00 implies that no time is used
     if ($self->hour || $self->minute || $self->second) {
 
-        # Unless the user has explicitly said they want a floating time,
+        # Unless the user has explicitly said they want a time zone,
         # we want to convert to the end-user's timezone. If we ignore
         # $args{time_zone}, then DateTime::from_epoch will get very confused
-        if (!$args{time_zone} and my $tz = $self->current_user_has_timezone) {
-
-            # XXX: we do this because of the floating timezone
-            $self->set_time_zone("UTC");
+        if (!$args{time_zone} || $replace_tz) {
+            if (my $tz = $self->current_user_has_timezone) {
+                # XXX: we do this because of the floating timezone
+                $self->set_time_zone("UTC");
 
-            $self->set_time_zone( $tz );
+                $self->set_time_zone( $tz );
+            }
         }
     }
 
@@ -126,24 +134,47 @@
     return $self;
 }
 
+=head2 current_user [CURRENTUSER]
+
+When setting the current user, update the timezone appropriately.
+
+=cut
+
+sub current_user {
+    my $self = shift;
+    return $self->SUPER::current_user unless @_;
+    my $ret = $self->SUPER::current_user(@_);
+    $self->set_current_user_timezone();
+    return $ret;
+}
+
 =head2 current_user_has_timezone
 
-Return timezone if the current user has one. This is determined by checking to see if the current user has a user object. If it has a user object, then it checks to see if that user object has a C<time_zone> method and uses that to determine the value.
+Return timezone if the current user has one. This is determined by
+checking to see if the current user has a user object. If it has a
+user object, then it checks to see if that user object has a
+C<time_zone> method and uses that to determine the value.
 
 =cut
 
 sub current_user_has_timezone {
     my $self = shift;
-    $self->_get_current_user();
+
+    # make this work as Jifty::DateTime->current_user_has_timezone
+    my $dt = ref($self) ? $self : $self->now;
+
+    $dt->_get_current_user();
 
     # Can't continue if we have no notion of a user_object
-    $self->current_user->can('user_object') or return;
+    $dt->current_user->can('user_object') or return;
 
     # Can't continue unless the user object is defined
-    my $user_obj = $self->current_user->user_object or return;
+    my $user_obj = $dt->current_user->user_object or return;
 
     # Check for a time_zone method and then use it if it exists
-    my $f = $user_obj->can('time_zone') or return;
+    my $f = $user_obj->can('time_zone') || $user_obj->can('timezone')
+        or return;
+
     return $f->($user_obj);
 }
 
@@ -171,14 +202,16 @@
 it in the floating timezone, otherwise, set it to the current user's
 timezone.
 
-As of this writing, this uses L<Date::Manip> along with some internal hacks to alter the way L<Date::Manip> normally interprets week day names. This may change in the future.
+As of this writing, this uses L<Date::Manip> along with some internal
+hacks to alter the way L<Date::Manip> normally interprets week day
+names. This may change in the future.
 
 =cut
 
 sub new_from_string {
     my $class  = shift;
     my $string = shift;
-    my $now;
+    my $epoch;
 
     # Hack to use Date::Manip to flexibly scan dates from strings
     {
@@ -189,23 +222,33 @@
         if($string =~ /^\s* (?:monday|tuesday|wednesday|thursday|friday|saturday|sunday)$/xi) {
             $string = "next $string";
         }
-        
-        # Why are we parsing this as GMT? This feels really wrong.  It will get the wrong answer
-        # if the current user is in another tz.
+
+        my $offset = $class->get_tz_offset;
+        my $dt_now = $class->now;
+        my $now = $dt_now->ymd . ' ' . $dt_now->hms;
+
         require Date::Manip;
-        Date::Manip::Date_Init("TZ=GMT");
-        $now = Date::Manip::UnixDate( $string, "%o" );
+
+        # TZ sets the timezone for parsing
+        # ConvTZ sets the output timezone
+        # ForceDate forces the current date to be now in the user's timezone,
+        #    if we don't set it then DM uses the machine's timezone
+        Date::Manip::Date_Init("TZ=$offset", "ConvTZ=+0000", "ForceDate=$now");
+        $epoch = Date::Manip::UnixDate( $string, "%o" );
     }
 
     # Stop here if Date::Manip couldn't figure it out
-    return undef unless $now;
+    return undef unless $epoch;
 
     # Build a DateTime object from the Date::Manip value and setup the TZ
-    my $self = $class->from_epoch( epoch => $now, time_zone => 'gmt' );
+    my $self = $class->from_epoch( epoch => $epoch, time_zone => 'GMT' );
     if (my $tz = $self->current_user_has_timezone) {
-        $self->set_time_zone("floating")
-            unless ( $self->hour or $self->minute or $self->second );
-        $self->set_time_zone( $tz );
+        if ($self->hour || $self->minute || $self->second) {
+            $self->set_time_zone( $tz );
+        }
+        else {
+            $self->set_time_zone("floating")
+        }
     }
 
     return $self;
@@ -248,11 +291,73 @@
     return $ymd;
 }
 
-=head1 WHY?
+=head2 is_date
+
+Returns whether or not this C<Jifty::DateTime> object represents a date
+(without a specific time). Dates in Jifty are in the floating time zone and
+are set to midnight.
+
+=cut
 
-There are other ways to do some of these things and some of the decisions here may seem arbitrary, particularly if you read the code. They are.
+sub is_date {
+    my $self = shift;
+
+    # all dates are in the floating time zone
+    return 0 unless $self->time_zone->name eq 'floating';
+
+    # all dates are set to midnight
+    return 0 unless $self->hms eq '00:00:00';
+
+    return 1;
+}
+
+=head2 get_tz_offset [DateTime] -> String
+
+Returns the offset for the current user's timezone. If there is no current
+user, or the current user's time zone is unset, then UTC will be used.
+
+The optional DateTime argument lets you calculate an offset for some time other
+than "right now".
+
+=cut
+
+sub get_tz_offset {
+    my $self = shift;
+    my $dt   = shift || DateTime->now();
+
+    $dt->set_time_zone( $self->current_user_has_timezone || 'UTC' );
+
+    return $dt->strftime("%z");
+}
+
+=head2 jifty_serialize_format
+
+This returns a DateTime (or string) consistent with Jifty's date format.
+
+=cut
+
+sub jifty_serialize_format {
+    my $dt = shift;
+
+    # if it looks like just a date, then return just the date portion
+    return $dt->ymd
+        if lc($dt->time_zone->name) eq 'floating'
+        && $dt->hms('') eq '000000';
+
+    # otherwise let stringification take care of it
+    return $dt;
+}
+
+=head1 WHY?
 
-These things are valuable to applications built by Best Practical Solutions, so it's here. If you disagree with the policy or need to do it differently, then you probably need to implement something yourself using a DateTime::Format::* class or your own code. 
+There are other ways to do some of these things and some of the
+decisions here may seem arbitrary, particularly if you read the
+code. They are.
+
+These things are valuable to applications built by Best Practical
+Solutions, so it's here. If you disagree with the policy or need to do
+it differently, then you probably need to implement something yourself
+using a DateTime::Format::* class or your own code.
 
 Parts may be cleaned up and the API cleared up a bit more in the future.
 

Modified: jifty/branches/virtual-models/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Dispatcher.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Dispatcher.pm	Thu Feb 14 14:59:21 2008
@@ -296,7 +296,7 @@
 sub default ($$@) { _ret @_ }    # set parameter if it's not yet set
 sub set ($$@)     { _ret @_ }    # set parameter
 sub del ($@)      { _ret @_ }    # remove parameter
-sub get ($) { request->argument( $_[0] ) }
+sub get ($) { request->template_argument( $_[0] ) || request->argument( $_[0] ) }
 
 sub _qualify ($@);
 sub GET ($)     { _qualify method => @_ }
@@ -316,8 +316,8 @@
 =head2 import
 
 Jifty::Dispatcher is an L<Exporter>, that is, part of its role is to
-blast a bunch of symbols into another package. In this case, that other
-package is the dispatcher for your application.
+blast a bunch of symbols into another package. In this case, that
+other package is the dispatcher for your application.
 
 You never call import directly. Just:
 
@@ -473,7 +473,9 @@
     local $SIG{__DIE__} = 'DEFAULT';
 
     eval {
-        $Dispatcher->_do_dispatch( Jifty->web->request->path);
+        my $path = Jifty->web->request->path;
+        utf8::downgrade($path); # Mason handle non utf8 path.
+        $Dispatcher->_do_dispatch( $path );
     };
     if ( my $err = $@ ) {
         $self->log->warn(ref($err) . " " ."'$err'") if ( $err !~ /^ABORT/ );
@@ -798,7 +800,7 @@
 sub _do_set {
     my ( $self, $key, $value ) = @_;
     $self->log->debug("Setting argument $key to ".($value||''));
-    request->argument($key, $value);
+    request->template_argument($key, $value);
 }
 
 sub _do_del {
@@ -810,8 +812,8 @@
 sub _do_default {
     my ( $self, $key, $value ) = @_;
     $self->log->debug("Setting argument default $key to ".($value||''));
-    request->argument($key, $value)
-        unless defined request->argument($key);
+    request->template_argument($key, $value)
+        unless defined request->argument($key) or defined request->template_argument($key);
 }
 
 =head2 _do_dispatch [PATH]
@@ -838,6 +840,9 @@
 
     $self->log->debug("Dispatching request to ".$self->{path});
 
+    # Disable most actions on GET requests
+    Jifty->api->deny_for_get() if $self->_match_method('GET');
+
     # Setup -- we we don't abort out of setup, then run the
     # actions and then the RUN stage.
     if ($self->_handle_stage('SETUP')) {
@@ -976,52 +981,62 @@
 
 =cut
 
+
+my %CONDITION_CACHE;
+
 sub _compile_condition {
     my ( $self, $cond ) = @_;
 
     # Previously compiled (eg. a qr{} -- return it verbatim)
     return $cond if ref $cond;
 
-    # Escape and normalize
-    $cond = quotemeta($cond);
-    $cond =~ s{(?:\\\/)+}{/}g;
-    $cond =~ s{/$}{};
-
-    my $has_capture = ( $cond =~ / \\ [*?#] /x);
-    if ($has_capture or $cond =~ / \\ [[{] /x) {
-        $cond = $self->_compile_glob($cond);
-    }
+    my $cachekey = join('-', (($Dispatcher->{rule} eq 'on') ? 'on' : 'in'),
+                             $cond);
+    unless ( $CONDITION_CACHE{$cachekey} ) {
+
+        my $compiled = $cond;
+
+        # Escape and normalize
+        $compiled = quotemeta($compiled);
+        $compiled =~ s{(?:\\\/)+}{/}g;
+        $compiled =~ s{/$}{};
+
+        my $has_capture = ( $compiled =~ / \\ [*?#] /x );
+        if ( $has_capture or $compiled =~ / \\ [[{] /x ) {
+            $compiled = $self->_compile_glob($compiled);
+        }
 
-    if ( $cond =~ m{^/} ) {
+        if ( $compiled =~ m{^/} ) {
 
-        # '/foo' => qr{^/foo}
-        $cond = "\\A$cond";
-    } elsif ( length($cond) ) {
+            # '/foo' => qr{^/foo}
+            $compiled = "\\A$compiled";
+        } elsif ( length($compiled) ) {
 
-        # 'foo' => qr{^$cwd/foo}
-        $cond = "(?<=\\A$self->{cwd}/)$cond";
-    } else {
+            # 'foo' => qr{^$cwd/foo}
+            $compiled = "(?<=\\A$self->{cwd}/)$compiled";
+        } else {
 
-        # empty path -- just match $cwd itself
-        $cond = "(?<=\\A$self->{cwd})";
-    }
+            # empty path -- just match $cwd itself
+            $compiled = "(?<=\\A$self->{cwd})";
+        }
 
-    if ( $Dispatcher->{rule} eq 'on' ) {
+        if ( $Dispatcher->{rule} eq 'on' ) {
 
-        # "on" anchors on complete match only
-        $cond .= '/?\\z';
-    } else {
+            # "on" anchors on complete match only
+            $compiled .= '/?\\z';
+        } else {
 
-        # "in" anchors on prefix match in directory boundary
-        $cond .= '(?=/|\\z)';
-    }
+            # "in" anchors on prefix match in directory boundary
+            $compiled .= '(?=/|\\z)';
+        }
 
-    # Make all metachars into capturing submatches
-    if (!$has_capture) {
-        $cond = "($cond)";
+        # Make all metachars into capturing submatches
+        if ( !$has_capture ) {
+            $compiled = "($compiled)";
+        }
+        $CONDITION_CACHE{$cachekey} = qr{$compiled};
     }
-
-    return qr{$cond};
+    return $CONDITION_CACHE{$cachekey};
 }
 
 =head2 _compile_glob METAEXPRESSION
@@ -1030,7 +1045,7 @@
 
 Turns a metaexpression containing C<*>, C<?> and C<#> into a capturing regex pattern.
 
-Also supports the non-capturing C<[]>,and C<{}> notation.
+Also supports the non-capturing C<[]> and C<{}> notations.
 
 The rules are:
 
@@ -1183,23 +1198,21 @@
     my $self     = shift;
     my $template = shift;
     my $showed   = 0;
-#    local $@;
     eval {
         foreach my $handler ( Jifty->handler->view_handlers ) {
-            if ( Jifty->handler->view($handler)->template_exists($template) ) {
+            my $handler_class = Jifty->handler->view($handler);
+            if ( $handler_class->template_exists($template) ) {
+                $handler_class->show($template);
                 $showed = 1;
-                Jifty->handler->view($handler)->show($template);
                 last;
             }
         }
         if ( not $showed and my $fallback_handler = Jifty->handler->fallback_view_handler ) {
             $fallback_handler->show($template);
         }
-
     };
 
     my $err = $@;
-
     # Handle parse errors
     $self->log->fatal("view class error: $err") if $err;
     if ( $err and not eval { $err->isa('HTML::Mason::Exception::Abort') } ) {
@@ -1221,7 +1234,6 @@
     } elsif ($err) {
         die $err;
     }
-
 }
 
 

Modified: jifty/branches/virtual-models/lib/Jifty/Everything.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Everything.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Everything.pm	Thu Feb 14 14:59:21 2008
@@ -89,9 +89,14 @@
 #Jifty::Module::Pluggable->import(search_path => ['Jifty::Web::Form::Field'], require     => 1, except      => qr/\.#/);
 #__PACKAGE__->plugins;
 
-# load commands defined in Jifty/Plugin/*/Command/*.pm
-Jifty::Module::Pluggable->import(search_path => ['Jifty::Plugin'], file_regex => qr{/Command/[^/]+}, require => 1);
-__PACKAGE__->plugins;
+# Set up to load commands defined in Jifty/Plugin/*/Command/*.pm
+# we do the actual load in Jifty::Script
+Jifty::Module::Pluggable->import(
+    search_path => ['Jifty::Plugin'],
+    file_regex  => qr{/Command/[^/]+},
+    require     => 1,
+    sub_name    => "plugin_commands"
+);
 
 =head1 SEE ALSO
 

Modified: jifty/branches/virtual-models/lib/Jifty/Filter/DateTime.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Filter/DateTime.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Filter/DateTime.pm	Thu Feb 14 14:59:21 2008
@@ -53,13 +53,14 @@
 
     # XXX There has to be a better way to do this
     my %args;
-    for (qw(year month day hour minute second nanosecond formatter)) {
+    for (qw(year month day hour minute second nanosecond time_zone formatter)) {
         $args{$_} = $$value_ref->$_ if(defined($$value_ref->$_));
     }
 
-    # the floating timezone indicates a date, so we don't want to set any
-    # other timezone on it
-    $args{time_zone} = 'floating' if $$value_ref->time_zone =~ /floating/i;
+    # we want this DateTime's TZ to be in the current user's TZ, unless
+    # it represents a date
+    $args{_replace_time_zone} = 1
+        unless $args{time_zone} =~ /floating/i;
 
     my $dt = Jifty::DateTime->new(%args);
 

Modified: jifty/branches/virtual-models/lib/Jifty/Handle.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Handle.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Handle.pm	Thu Feb 14 14:59:21 2008
@@ -39,20 +39,20 @@
     }
 
     my $driver = Jifty->config->framework('Database')->{'Driver'};
-    if ($driver eq 'Oracle') {
-        $ENV{'NLS_LANG'} = "AMERICAN_AMERICA.AL32UTF8";
+    if ( $driver eq 'Oracle' ) {
+        $ENV{'NLS_LANG'}  = "AMERICAN_AMERICA.AL32UTF8";
         $ENV{'NLS_NCHAR'} = "AL32UTF8";
     }
-   
+
     # We do this to avoid Jifty::DBI::Handle's magic reblessing, because
     # it breaks subclass methods.
-    my $driver_class  = "Jifty::DBI::Handle::".  $driver;
+    my $driver_class = "Jifty::DBI::Handle::" . $driver;
     Jifty::Util->require($driver_class);
 
     die "No such handle class as $driver_class. ",
         "Check your spelling and check that your Jifty installation and ",
-        "related modules (especially Jifty::DBI) are up to date." 
-            unless $driver_class->can('isa');
+        "related modules (especially Jifty::DBI) are up to date."
+        unless $driver_class->can('isa');
 
     unshift @ISA, $driver_class;
     return $class->SUPER::new();
@@ -71,18 +71,18 @@
 
 sub canonical_database_name {
     my $self_or_class = shift;
-    my $db_config = Jifty->config->framework('Database');
+    my $db_config     = Jifty->config->framework('Database');
 
     # XXX TODO consider canonicalizing to all-lowercase, once there are no
     # legacy databases
     my $db = $db_config->{'Database'};
 
-    if ($db_config->{'Driver'} =~ /SQLite/) {
+    if ( $db_config->{'Driver'} =~ /SQLite/ ) {
         $db = Jifty::Util->absolute_path($db);
-    } 
+    }
 
     return $db;
-} 
+}
 
 =head2 connect ARGS
 
@@ -92,27 +92,36 @@
 =cut
 
 sub connect {
-    my $self = shift;
-    my %args = (@_);
-    my %db_config =  (%{Jifty->config->framework('Database')}, Database => $self->canonical_database_name);
+    my $self      = shift;
+    my %args      = (@_);
+    my %db_config = (
+        %{ Jifty->config->framework('Database') },
+        Database => $self->canonical_database_name
+    );
 
     my %lc_db_config;
+
     # Skip the non-dsn keys, but not anything else
-    for (grep {!/^autoupgrade|checkschema|version|forwardcompatible|recordbaseclass|attributes$/i} keys %db_config) {
-        $lc_db_config{lc($_)} = $db_config{$_};
+    for (
+        grep {
+            !/^autoupgrade|checkschema|version|forwardcompatible|recordbaseclass|attributes$/i
+        } keys %db_config
+        )
+    {
+        $lc_db_config{ lc($_) } = $db_config{$_};
     }
-    $self->SUPER::connect( %lc_db_config , %args);
-    $self->{db_config} = { %lc_db_config , %args };
-    $self->dbh->{LongReadLen} = Jifty->config->framework('MaxAttachmentSize') || '10000000';
+    $self->SUPER::connect( %lc_db_config, %args );
+    $self->{db_config} = { %lc_db_config, %args };
+    $self->dbh->{LongReadLen} = Jifty->config->framework('MaxAttachmentSize')
+        || '10000000';
 
     # setup attributes
     my $attributes = Jifty->config->framework('Database')->{Attributes} || {};
-    for (keys %$attributes) {
-        $self->dbh->{lc($_)} = $attributes->{$_};
+    for ( keys %$attributes ) {
+        $self->dbh->{ lc($_) } = $attributes->{$_};
     }
 }
 
-
 =head2 check_schema_version
 
 Make sure that we have a recent enough database schema.  If we don't,
@@ -123,7 +132,7 @@
 sub check_schema_version {
     my $self = shift;
     require Jifty::Model::Metadata;
-            my $autoup = delete Jifty->config->framework('Database')->{'AutoUpgrade'};
+    my $autoup = delete Jifty->config->framework('Database')->{'AutoUpgrade'};
 
     # Application db version check
     {
@@ -131,7 +140,8 @@
         my $appv = Jifty->config->framework('Database')->{'Version'};
 
         if ( not defined $dbv ) {
-            # First layer of backwards compatibility -- it used to be in _db_version
+
+      # First layer of backwards compatibility -- it used to be in _db_version
             my @v;
             eval {
                 local $SIG{__WARN__} = sub { };
@@ -141,11 +151,14 @@
             $dbv = join( ".", @v ) if @v == 3;
         }
         if ( not defined $dbv ) {
+
             # It was also called the 'key' column, not the data_key column
             eval {
                 local $SIG{__WARN__} = sub { };
-                $dbv = Jifty->handle->fetch_result(
-                    "SELECT value FROM _jifty_metadata WHERE key = 'application_db_version'");
+                $dbv
+                    = Jifty->handle->fetch_result(
+                    "SELECT value FROM _jifty_metadata WHERE key = 'application_db_version'"
+                    );
             } or undef($dbv);
         }
 
@@ -154,18 +167,24 @@
             . "\t bin/jifty schema --setup\n"
             unless defined $dbv;
 
-        unless (version->new($appv) == version->new($dbv)) {
-            # if app version is older than db version, but we are still compatible
-            my $compat = delete Jifty->config->framework('Database')->{'ForwardCompatible'} || $appv;
-            if (version->new($appv) > version->new($dbv) || version->new($compat) < version->new($dbv)) {
-            warn "Application schema version in database ($dbv) doesn't match application schema version ($appv)\n";
-            if( $autoup 
-            ) {
-                warn "Automatically upgrading your database to match the current application schema";
-                $self->_upgrade_schema();
-            } else {
-                 die "Please run `bin/jifty schema --setup` to upgrade the database.\n";
-             }
+        unless ( version->new($appv) == version->new($dbv) ) {
+
+        # if app version is older than db version, but we are still compatible
+            my $compat = delete Jifty->config->framework('Database')
+                ->{'ForwardCompatible'} || $appv;
+            if (   version->new($appv) > version->new($dbv)
+                || version->new($compat) < version->new($dbv) )
+            {
+                warn
+                    "Application schema version in database ($dbv) doesn't match application schema version ($appv)\n";
+                if ( $autoup ) {
+                    warn
+                        "Automatically upgrading your database to match the current application schema";
+                    $self->_upgrade_schema();
+                } else {
+                    die
+                        "Please run `bin/jifty schema --setup` to upgrade the database.\n";
+                }
             }
         }
     }
@@ -180,19 +199,54 @@
             = version->new( Jifty::Model::Metadata->load("jifty_db_version")
                 || '0.60426' );
         my $appv = version->new($Jifty::VERSION);
-            unless ( $appv == $dbv ) {
-           warn "Internal jifty schema version in database ($dbv) doesn't match running jifty version ($appv)\n";
-            if( $autoup) {
-                warn "Automatically upgrading your database to match the current Jifty schema\n";
+        unless ( $appv == $dbv ) {
+            warn
+                "Internal jifty schema version in database ($dbv) doesn't match running jifty version ($appv)\n";
+            if ($autoup) {
+                warn
+                    "Automatically upgrading your database to match the current Jifty schema\n";
                 $self->_upgrade_schema;
             } else {
-        die "Please run `bin/jifty schema --setup` to upgrade the database.\n"
+                die
+                    "Please run `bin/jifty schema --setup` to upgrade the database.\n";
             }
-        };
+        }
     }
 
-}
+    # Plugin version check
+    for my $plugin ( Jifty->plugins ) {
+        my $plugin_class = ref $plugin;
 
+        my $dbv
+            = Jifty::Model::Metadata->load( $plugin_class . '_db_version' );
+        my $appv = version->new( $plugin->version );
+
+        if ( not defined $dbv ) {
+            warn
+                "$plugin_class plugin isn't installed in database\n";
+            if ($autoup) {
+                warn
+                    "Automatically upgrading your database to match the current plugin schema\n";
+                $self->_upgrade_schema;
+            } else {
+                die
+                    "Please run `bin/jifty schema --setup` to upgrade the database.\n";
+            }
+        } elsif (version->new($dbv) < $appv) {
+            warn
+                "$plugin_class plugin version in database ($dbv) doesn't match running plugin version ($appv)\n";
+            if ($autoup) {
+                warn
+                    "Automatically upgrading your database to match the current plugin schema\n";
+                $self->_upgrade_schema;
+            } else {
+                die
+                    "Please run `bin/jifty schema --setup` to upgrade the database.\n";
+            }
+        }
+    }
+
+}
 
 =head2 create_database MODE
 
@@ -204,13 +258,13 @@
 =cut
 
 sub create_database {
-    my $self = shift;
-    my $mode = shift || 'execute';
+    my $self     = shift;
+    my $mode     = shift || 'execute';
     my $database = $self->canonical_database_name;
     my $driver   = Jifty->config->framework('Database')->{'Driver'};
-    my $query = "CREATE DATABASE $database";
+    my $query    = "CREATE DATABASE $database";
     $query .= " TEMPLATE template0" if $driver =~ /Pg/;
-    if ( $mode eq 'print') {
+    if ( $mode eq 'print' ) {
         print "$query;\n";
     } elsif ( $driver !~ /SQLite/ ) {
         $self->simple_query($query);
@@ -227,8 +281,8 @@
 =cut
 
 sub drop_database {
-    my $self = shift;
-    my $mode = shift || 'execute';
+    my $self     = shift;
+    my $mode     = shift || 'execute';
     my $database = $self->canonical_database_name;
     my $driver   = Jifty->config->framework('Database')->{'Driver'};
     if ( $mode eq 'print' ) {
@@ -239,8 +293,8 @@
         $self->disconnect if $^O eq 'MSWin32';
         unlink($database);
     } else {
-        local $SIG{__WARN__} =
-          sub { warn $_[0] unless $_[0] =~ /exist|couldn't execute/i };
+        local $SIG{__WARN__}
+            = sub { warn $_[0] unless $_[0] =~ /exist|couldn't execute/i };
         $self->simple_query("DROP DATABASE $database");
     }
 }

Modified: jifty/branches/virtual-models/lib/Jifty/Handler.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Handler.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Handler.pm	Thu Feb 14 14:59:21 2008
@@ -92,23 +92,41 @@
 
 Returns a list of modules implementing view for your Jifty application.
 
-XXX TODO: this should take pluggable views
+You can override this by specifying: 
 
-=cut
+  framework:
+      View:
+         Handlers:
+            - Jifty::View::Something::Handler
+            - Jifty::View::SomethingElse::Handler
 
 
-sub view_handlers { qw(Jifty::View::Static::Handler Jifty::View::Declare::Handler Jifty::View::Mason::Handler)}
+=cut
+
+sub view_handlers {
+    @{Jifty->config->framework('View')->{'Handlers'}}
+}
 
 
 =head2 fallback_view_handler
 
 Returns the object for our "last-resort" view handler. By default, this is the L<HTML::Mason> handler.
 
+You can override this by specifying: 
+
+  framework:
+      View:
+         FallbackHandler: Jifty::View::Something::Handler
+
 =cut
 
 
 
-sub fallback_view_handler { my $self = shift; return $self->view('Jifty::View::Mason::Handler') }
+sub fallback_view_handler { 
+   my $self = shift; 
+    return $self->view(Jifty->config->framework('View')->{'FallbackHandler'});
+    
+}
 
 =head2 setup_view_handlers
 
@@ -226,6 +244,9 @@
         # Return from the continuation if need be
         Jifty->web->request->return_from_continuation;
         $self->dispatcher->handle_request();
+
+        $self->call_trigger('before_cleanup', $args{cgi});
+
         $self->cleanup_request();
     }
 

Modified: jifty/branches/virtual-models/lib/Jifty/LetMe.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/LetMe.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/LetMe.pm	Thu Feb 14 14:59:21 2008
@@ -93,7 +93,7 @@
 
     # get user's generic secret
     my $user;
-    return '' unless ( $user = $self->_user_from_email($self->email) );
+    return '' unless ( $user = $self->user || $self->_user_from_email($self->email) );
     return '' unless ($user->auth_token);
 
 

Modified: jifty/branches/virtual-models/lib/Jifty/Manual/AccessControl.pod
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Manual/AccessControl.pod	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Manual/AccessControl.pod	Thu Feb 14 14:59:21 2008
@@ -18,10 +18,10 @@
 if C<current_user_can('read')> returns false.
 
 On C<_set()> or C<I<set_somefieldname>>, we reject the operation
-if C<current_user_can('write')> returns false.
+if C<current_user_can('update')> returns false.
 
 
-On C<delete()>, we reject the operation  if C<current_user_can('delete')>
+On C<delete()>, we reject the operation if C<current_user_can('delete')>
 returns false.
 
 Out of the box, C<current_user_can> returns 1. When you want to actually 

Modified: jifty/branches/virtual-models/lib/Jifty/Manual/Cookbook.pod
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Manual/Cookbook.pod	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Manual/Cookbook.pod	Thu Feb 14 14:59:21 2008
@@ -30,7 +30,7 @@
 
   __PACKAGE__->mk_accessors(qw(LDAP));
 
-and we can write our C<ldap_search> fonction. 
+and we can write our C<ldap_search> function. 
 Search need at least 3 characters and return an array of C<DisplayName (login)>
 
   sub ldap_search {

Modified: jifty/branches/virtual-models/lib/Jifty/Manual/Deploying.pod
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Manual/Deploying.pod	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Manual/Deploying.pod	Thu Feb 14 14:59:21 2008
@@ -117,6 +117,8 @@
 
 After you've copied your application onto the server, change into that directory and make any changes to your configuration required for production.
 
+Put all your site-specific changes in F<etc/site_config.yml> and never edit F<etc/config.yml>, as it will be overwritten with the next application update.
+
 Here are some things you'll want to consider changing:
 
 =over
@@ -195,7 +197,7 @@
 
 If you've been developing your server using the default SQLite configuration, you will likely want to change this for your production server. SQLite might work for production environment, but chances are it will not.
 
-For your production system, you will probably want to modify the C<Driver> to suit your production environment. For example, if you were going to change to use a MySQL server, you might change your C<Database> configuration in F<etc/config.yml> to something like this:
+For your production system, you will probably want to modify the C<Driver> to suit your production environment. For example, if you were going to change to use a MySQL server, you might change your C<Database> configuration in F<etc/site_config.yml> to something like this:
 
   Database:
     Database: myapp
@@ -217,7 +219,7 @@
 
 =head3 Configure the Web Server
 
-There are two primary ways to configure your web server. You can use FastCGI or you can use a proxy to the Jifty simple server. You will most likely want to do the former, but the configuration for the latter is presented for completeness.
+There are several ways to configure your web server. You can use FastCGI or mod_perl or you can use a proxy to the Jifty simple server. The first two options are what you will most likely want to do, but the proxy configuration is presented for completeness.
 
 =head4 Configuring FastCGI
 
@@ -225,6 +227,10 @@
 
 It may take a few tries to get the configuration exactly right. Be sure to check the server logs for your web server when looking for problems.
 
+=head4 Configuring mod_perl
+
+Support for mod_perl version 2.0 is provided by L<Jifty::Script::ModPerl2>. Remember that you need to completely stop and start the Apache server after the Perl modules in your application are changed.
+
 =head4 Configuring a Proxy
 
 You can use a proxy with the built-in server. This can be done with the following configuration in Apache:
@@ -240,6 +246,17 @@
 
 Apache will proxy your server on port 80 for you. This may not work exactly as expected because the built-in server is intended for testing, not for a production environment. As such, it is not well-tested as a production server.
 
+=head3 Configure File Permissions
+
+The <var/> subdirectory in your application should be writable by the server process. If it runs as non-root UID (for example, FastCGI and Apache processes are usually running under the user named I<apache> or I<www> or something alike), you need to change the group or user permissions for this directory.
+
+For example, assume your application will run under user I<apache> and group I<apache>. Then the following commands should do the job:
+
+  chgrp -R apache var
+  chmod -R g+w var
+
+A more flexible way would be to create a new group I<myapp> and add I<apache> user in it. This allows you to maintain the application from non-root login and use C<sudo> for restarting Apache.
+
 =head3 All Systems Go
 
 Once you have done all of the above, your application should be ready to use at the production address you have configured.

Modified: jifty/branches/virtual-models/lib/Jifty/Mason/Halo.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Mason/Halo.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Mason/Halo.pm	Thu Feb 14 14:59:21 2008
@@ -2,8 +2,9 @@
 use strict;
 package Jifty::Mason::Halo;
 use base qw/HTML::Mason::Plugin/;
-use Time::HiRes ();
-Jifty->handle->log_sql_statements(1);
+use Time::HiRes 'time';
+use Class::Trigger;
+use Jifty::Plugin::Halo;
 
 =head1 NAME
 
@@ -28,38 +29,19 @@
     my $self    = shift;
     my $context = shift;
 
-    return if ($context->comp->path && $context->comp->path eq "/__jifty/halo");
+    return if ($context->comp->path || '') eq "/__jifty/halo";
 
-    Jifty->handler->stash->{ '_halo_index_stack' } ||= [];
-
-    my $DEPTH = Jifty->handler->stash->{'_halo_depth'} || 0;
-    my $STACK = Jifty->handler->stash->{'_halo_stack'} ||= [];
-        
-    my $INDEX_STACK = Jifty->handler->stash->{'_halo_index_stack'};
-
-    my $halo_base = Jifty->web->serial;
-
-    Jifty->handler->stash->{'_halo_depth'} = ++$DEPTH;
-    if ($STACK->[-1]) {
-        push @{$STACK->[-1]->{sql_statements}}, Jifty->handle->sql_statement_log;
-        Jifty->handle->clear_sql_statement_log;
-    }
-
-    push @$STACK, {
-        id           => $halo_base,
+    my $frame = Jifty::Plugin::Halo->push_frame(
         args         => [map { eval { defined $_ and fileno( $_ ) }  ? "*GLOB*" : $_} @{$context->args}],
-        start_time   => Time::HiRes::time(),
         path         => $context->comp->path || '',
-        subcomponent => (  $context->comp->is_subcomp() ? 1:0),
-        name         => $context->comp->name || '(Unamed component)',
-        proscribed   => ($self->_unrendered_component($context) ? 1 :0 ),
-        depth        => $DEPTH
-    };
+        subcomponent => $context->comp->is_subcomp() ? 1 : 0,
+        name         => $context->comp->name || '(Unnamed component)',
+        proscribed   => $self->_unrendered_component($context) ? 1 : 0,
+    );
 
-    push @$INDEX_STACK, $#{$STACK};
     return if $self->_unrendered_component($context);
 
-    $context->request->out(qq{<div id="halo-@{[$halo_base]}">});
+    $context->request->out(Jifty::Plugin::Halo->halo_header($frame));
 }
 
 =head2 end_component_hook CONTEXT_OBJECT
@@ -67,53 +49,24 @@
 When we're done rendering a component, record how long it took
 and close off the halo C<span> if we have one.
 
-
 =cut
 
 sub end_component_hook {
     my $self    = shift;
     my $context = shift;
 
-    return if ($context->comp->path && $context->comp->path =~ "^/__jifty/halo");
+    return if ($context->comp->path || '') eq "/__jifty/halo";
 
-    my $STACK = Jifty->handler->stash->{'_halo_stack'};
-    my $INDEX_STACK = Jifty->handler->stash->{'_halo_index_stack'};
-    my $DEPTH = Jifty->handler->stash->{'_halo_depth'};
+    my $frame = Jifty::Plugin::Halo->pop_frame;
 
-    my $FRAME_ID = pop @$INDEX_STACK;
-
-    my $frame = $STACK->[$FRAME_ID];
-    $frame->{'render_time'} = int((Time::HiRes::time - $frame->{'start_time'}) * 1000)/1000;
-
-    push @{$frame->{sql_statements}}, Jifty->handle->sql_statement_log;
-    Jifty->handle->clear_sql_statement_log;
-
-
-    Jifty->handler->stash->{'_halo_depth'} = $DEPTH-1 ;
-
-    # If 
     return if $self->_unrendered_component($context);
 
     # print out the div with our halo magic actions.
     # if we didn't render a beginning of the span, don't render an end
     unless ( $frame->{'proscribed'} ) {
         my $comp_name = $frame->{'path'};
-        $context->request->out('</div>');
-        $context->request->out(
-            Jifty->web->link(
-                label   => _( 'Edit %1', $comp_name ),
-                class => 'inline_edit',
-                onclick => [
-                    {   element      => "#halo-" . $frame->{id},
-                        replace_with =>
-                            '/__jifty/edit_inline/mason_component/'.$comp_name
-                    }
-                ]
-            )
-            )
-            if 0 and ( $frame->{'path'} and $frame->{'path'} !~ /^\/?__jifty/ );
+        $context->request->out(Jifty::Plugin::Halo->halo_footer($frame));
     }
-
 }
 
 =head2 _unrendered_component CONTEXT
@@ -152,7 +105,7 @@
     my @stack = @{ Jifty->handler->stash->{'_halo_stack'} };
 
     for (@stack) {
-        $_->{'render_time'} = int((Time::HiRes::time - $_->{'start_time'}) * 1000)/1000
+        $_->{'render_time'} = int((($_->{'end_time'}||time) - $_->{'start_time'}) * 1000)/1000
           unless defined $_->{'render_time'};
     }
 

Modified: jifty/branches/virtual-models/lib/Jifty/Model/Metadata.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Model/Metadata.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Model/Metadata.pm	Thu Feb 14 14:59:21 2008
@@ -57,7 +57,7 @@
 
 sub load {
     my $self = shift;
-    $self = $self->new( current_user => Jifty::CurrentUser->superuser )
+    $self = $self->new( current_user => Jifty->app_class('CurrentUser')->superuser )
         unless ref $self;
     return undef unless $self->_handle and $self->_handle->dbh->ping;
 
@@ -83,7 +83,7 @@
 
 sub store {
     my $self = shift;
-    $self = $self->new( current_user => Jifty::CurrentUser->superuser )
+    $self = $self->new( current_user => Jifty->app_class('CurrentUser')->superuser )
         unless ref $self;
 
     my ( $key, $value ) = @_;

Modified: jifty/branches/virtual-models/lib/Jifty/Model/Session.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Model/Session.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Model/Session.pm	Thu Feb 14 14:59:21 2008
@@ -58,7 +58,7 @@
 
 =cut
 
-sub current_user { return Jifty::CurrentUser->superuser }
+sub current_user { return Jifty->app_class('CurrentUser')->superuser }
 
 =head2 new_session_id
 

Modified: jifty/branches/virtual-models/lib/Jifty/Model/SessionCollection.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Model/SessionCollection.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Model/SessionCollection.pm	Thu Feb 14 14:59:21 2008
@@ -29,6 +29,6 @@
 
 =cut
 
-sub current_user { return Jifty::CurrentUser->superuser }
+sub current_user { return Jifty->app_class('CurrentUser')->superuser }
 
 1;

Modified: jifty/branches/virtual-models/lib/Jifty/Param.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Param.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Param.pm	Thu Feb 14 14:59:21 2008
@@ -76,7 +76,7 @@
 use base qw/Class::Accessor::Fast/;
 use constant ACCESSORS => (
     Jifty::Web::Form::Field->accessors,
-    qw(constructor valid_values available_values sort_order),
+    qw(constructor valid_values available_values sort_order documentation),
 );
 
 __PACKAGE__->mk_accessors(ACCESSORS);

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin.pm	Thu Feb 14 14:59:21 2008
@@ -59,6 +59,32 @@
 
     # XXX TODO: Add .po path
     $self->init(@_);
+
+    # XXX: If we have methods for halos, add them. Some way of detecting "are
+    # we going to be using halos" would be superb. As it stands right now,
+    # plugins are loaded, initialized, and prereq-examined in the order they're
+    # listed in the config files. Instead, each phase should be separate.
+    Jifty::Util->require("Jifty::Plugin::Halo");
+    Jifty::Util->require("Jifty::Mason::Halo");
+
+    if ($self->can('halo_pre_template')) {
+        Jifty::Plugin::Halo->add_trigger(
+            halo_pre_template => sub { $self->halo_pre_template(@_) },
+        );
+        Jifty::Mason::Halo->add_trigger(
+            halo_pre_template => sub { $self->halo_pre_template(@_) },
+        );
+    }
+
+    if ($self->can('halo_post_template')) {
+        Jifty::Plugin::Halo->add_trigger(
+            halo_post_template => sub { $self->halo_post_template(@_) },
+        );
+        Jifty::Mason::Halo->add_trigger(
+            halo_post_template => sub { $self->halo_post_template(@_) },
+        );
+    }
+
     return $self;
 }
 

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,8 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::Attributes;
+use base 'Jifty::Plugin';
+
+1;
+

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/Mixin/Attributes.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/Mixin/Attributes.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,144 @@
+#!/usr/bin/env perl
+package Jifty::Plugin::Attributes::Mixin::Attributes;
+use strict;
+use warnings;
+use Jifty::Plugin::Attributes::Model::Attribute;
+use Jifty::Plugin::Attributes::Model::AttributeCollection;
+
+use base 'Exporter';
+
+our @EXPORT = qw/attributes first_attribute add_attribute set_attribute
+                 delete_attribute/;
+
+=head2 attributes
+
+Returns an AttributeCollection limited to the invoking object.
+
+=cut
+
+sub attributes {
+    my $self = shift;
+    my $attrs = Jifty::Plugin::Attributes::Model::AttributeCollection->new;
+    $attrs->limit_to_object($self);
+}
+
+=head2 first_attribute name
+
+Returns the first attribute on this object with the given name, or C<undef> if
+none exist.
+
+=cut
+
+sub first_attribute {
+    my $self = shift;
+    my $name = shift;
+
+    $self->attributes->named($name)->first;
+}
+
+=head2 add_attribute PARAMHASH
+
+Adds the given attribute to this object. Returns the new attribute if
+successful, C<undef> otherwise. The following fields must be provided:
+
+=over 4
+
+=item name
+
+The name of the attribute
+
+=item description
+
+A description of the attribute
+
+=item content
+
+The attribute's value
+
+=back
+
+=cut
+
+sub add_attribute {
+    my $self = shift;
+    my %args = @_;
+
+    my $attr = Jifty::Plugin::Attributes::Model::Attribute->new;
+    $attr->create(
+        object      => $self,
+        name        => $args{name},
+        description => $args{description},
+        content     => $args{content},
+    );
+
+    return $attr->id ? $attr : undef;
+}
+
+=head2 set_attribute PARAMHASH
+
+Sets the given attribute on the object. Note that all existing attributes of
+that name will be removed. Returns the new attribute or C<undef> if one could
+not be created. The following fields must be provided:
+
+=over 4
+
+=item name
+
+The name of the attribute
+
+=item description
+
+A description of the attribute
+
+=item content
+
+The attribute's value
+
+=back
+
+=cut
+
+sub set_attribute {
+    my $self = shift;
+    my %args = @_;
+
+    my $attrs = $self->attributes->named($args{name});
+    if ($attrs->count == 0) {
+        return $self->add_attribute(%args);
+    }
+
+    my $saved = $attrs->first;
+
+    while (my $attr = $attrs->next) {
+        $attr->delete;
+    }
+
+    $saved->set_content($args{content});
+    $saved->set_description($args{description});
+
+    return $saved;
+}
+
+=head2 delete_attribute name
+
+Deletes all attributes of the given name. Returns a true value if all attributes
+were deleted, a false if any could not be.
+
+=cut
+
+sub delete_attribute {
+    my $self = shift;
+    my $name = shift;
+    my $ok = 1;
+
+    my $attrs = $self->attributes->named($name);
+    while (my $attr = $attrs->next) {
+        $attr->delete
+            or $ok = 0;
+    }
+
+    return $ok;
+}
+
+1;
+

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/Model/Attribute.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/Model/Attribute.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,101 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+package Jifty::Plugin::Attributes::Model::Attribute;
+use base 'Jifty::Record';
+
+use Jifty::DBI::Schema;
+use Jifty::Record schema {
+    column name =>
+        type is 'text',
+        is mandatory;
+
+    column description =>
+        type is 'text';
+
+    column content =>
+        type is 'blob',
+        filters are 'Jifty::DBI::Filter::Storable';
+
+    column object_type =>
+        type is 'text',
+        is mandatory;
+
+    column object_id =>
+        type is 'int',
+        is mandatory;
+};
+
+=head2 before_create
+
+Let users pass in object instead of object_type and object_id.
+
+=cut
+
+sub before_create {
+    my $self = shift;
+    my $args = shift;
+
+    if (my $object = delete $args->{object}) {
+        $args->{object_type} = ref($object);
+        $args->{object_id}   = $object->id;
+    }
+
+    return 1;
+}
+
+=head2 current_user_can
+
+If you can read the original object, you can read its attributes. If you can
+update the original object, you can create, update, and delete its attributes.
+
+=cut
+
+sub current_user_can {
+    my $self  = shift;
+    my $right = shift;
+
+    # get a copy of the object
+    my ($type, $id);
+
+    if ($right eq 'create') {
+        my %args = @_;
+        ($type, $id) = $args{object}
+                     ? (ref($args{object}), $args{object}->id)
+                     : ($args{object_type}, $args{object_id});
+    }
+    else {
+        ($type, $id) = ($self->__value('object_type'), $self->__value('object_id'));
+    }
+
+    Carp::confess "No object given!" if !defined($type);
+
+    my $object = $type->new;
+    $object->load($id);
+
+    if ($right ne 'read') {
+        $right = 'update';
+    }
+
+    return $object->current_user_can($right, @_);
+}
+
+=head2 object
+
+Returns the object that owns this attribute.
+
+=cut
+
+sub object {
+    my $self = shift;
+    my ($type, $id) = ($self->object_type, $self->object_id);
+
+    my $object = $type->new;
+    $object->load($id);
+
+    return $object;
+}
+
+1;
+

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/Model/AttributeCollection.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Attributes/Model/AttributeCollection.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,52 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+package Jifty::Plugin::Attributes::Model::AttributeCollection;
+use base 'Jifty::Collection';
+
+=head2 record_class
+
+Is this even required any more?
+
+=cut
+
+sub record_class { 'Jifty::Plugin::Attributes::Model::Attribute' }
+
+=head2 named name
+
+Limits to attributes with the given name.
+
+=cut
+
+sub named {
+    my $self = shift;
+    my $name = shift;
+
+    $self->limit(column => 'name', value => $name);
+    return $self;
+}
+
+=head2 limit_to_object object
+
+Limits to attributes modifying the given object.
+
+=cut
+
+sub limit_to_object {
+    my $self = shift;
+    my $object = shift;
+
+    my $type = ref($object); # should this check be smarter?
+    return undef unless $type && $object->can('id');
+
+    my $id = $object->id;
+
+    $self->limit(column => 'object_type', value => $type);
+    $self->limit(column => 'object_id', value => $id);
+
+    return $self;
+}
+
+1;
+

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/CAS/Action/CASLogin.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/CAS/Action/CASLogin.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/CAS/Action/CASLogin.pm	Thu Feb 14 14:59:21 2008
@@ -70,6 +70,9 @@
 #    	$ENV{HTTP_HOST}.'/caslogin';
     
     my $service_url = Jifty->web->url.'/caslogin';
+    if ( Jifty->web->request->continuation ) {
+        $service_url .= '?J:C='.Jifty->web->request->continuation_id;
+    };
 
     if (! $ticket) {
         my $login_url = $plugin->CAS->login_url( $service_url );

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Ldap/Action/LDAPLogin.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Ldap/Action/LDAPLogin.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Ldap/Action/LDAPLogin.pm	Thu Feb 14 14:59:21 2008
@@ -79,8 +79,15 @@
     }
 
     # Load up the user
+    my $infos =  $plugin->get_infos($username);
+    my $name = $infos->{name};
+    my $email = $infos->{email};
+ 
     my $current_user = Jifty->app_class('CurrentUser');
-    my $user = $current_user->new( ldap_id => $username );
+    my $user = ($email) 
+        ? $current_user->new( email => $email)    # load by email to mix authentication
+        : $current_user->new( ldap_id => $username );  # else load by ldap_id
+
 
     # Autocreate the user if necessary
     if ( not $user->id ) {
@@ -102,9 +109,6 @@
         $user = $current_user->new( ldap_id => $username );
     }
 
-    my $infos =  $plugin->get_infos($username);
-    my $name = $infos->{name};
-    my $email = $infos->{email};
     my $u = $user->user_object;
 
     # Update, just in case

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/GeneratePasswordToken.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/GeneratePasswordToken.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/GeneratePasswordToken.pm	Thu Feb 14 14:59:21 2008
@@ -36,7 +36,7 @@
 
     my $email = $self->argument_value('email');
     my $class = Jifty->app_class('Model','User');
-    my $user = $class->new(current_user => Jifty::CurrentUser->superuser);
+    my $user = $class->new(current_user => Jifty->app_class('CurrentUser')->superuser);
     $user->load_by_cols(email => $email);
     unless($user->id) {
         $self->result->error('No such user');

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Login.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Login.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Action/Login.pm	Thu Feb 14 14:59:21 2008
@@ -58,8 +58,7 @@
     my $self  = shift;
     my $email = shift;
 
-    my $u = Jifty->app_class('Model', 'User')->new(current_user => Jifty->app_class('CurrentUser')->superuser);
-    $u->load_by_cols( email => $email );
+    my $u = $self->load_user($email);
     return $self->validation_error(email => _("It doesn't look like there's an account by that name.")) unless ($u->id);
 
     return $self->validation_ok('email');
@@ -131,25 +130,23 @@
 
 sub take_action {
     my $self = shift;
-    my $user = Jifty->app_class('Model', 'User')->new(current_user => Jifty->app_class('CurrentUser')->superuser);
-    $user->load_by_cols( email => $self->argument_value('email') );
-
-
+    my $user = $self->load_user( $self->argument_value('email') );
     my $password = $self->argument_value('password');
     my $token    = $self->argument_value('token') || '';
     my $hashedpw = $self->argument_value('hashed_password');
 
+           my $BAD_PW =  _('You may have mistyped your email or password. Give it another shot.');
 
     if ( $token ne '' ) {   # browser supports javascript, do password hashing
         unless ( $user->id && $user->hashed_password_is( $hashedpw, $token ) )
         {
-            $self->result->error( _('You may have mistyped your email or password. Give it another shot.'));
+            $self->result->error($BAD_PW);
             return;
         }
         Jifty->web->session->set( login_token => '' );
     } else {                # no password hashing over the wire
         unless ( $user->id && $user->password_is($password) ) {
-            $self->result->error( _('You may have mistyped your email or password. Give it another shot.'));
+            $self->result->error($BAD_PW);
             return;
         }
     }
@@ -169,6 +166,21 @@
     return 1;
 }
 
+=head2 load_user
+
+Load up and return a YourApp::User object for the user trying to log in
+
+=cut
+
+sub load_user {
+    my $self = shift;
+    my $username = shift;
+    my $user = Jifty->app_class('Model', 'User')->new(current_user => Jifty->app_class('CurrentUser')->superuser);
+    $user->load_by_cols( email => $username);
+    return $user
+
+}
+
 =head2 login_message $user_object
 
 Returns the "hi, you're logged in message"

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Dispatcher.pm	Thu Feb 14 14:59:21 2008
@@ -46,7 +46,7 @@
 
 };
 
-=head2 on qr/^(?:passwordreminder|signup|lost_password)$/ 
+=head2 on qr/^(?:signup|lost_password)$/ 
 
 Redirect to home if logged.
 
@@ -54,7 +54,7 @@
 
 =cut
 
-before qr'^/(?:passwordreminder|signup|lost_password)$' => run {
+before qr'^/(?:signup|lost_password)$' => run {
     redirect('/') if ( Jifty->web->current_user->id );
     set 'next' => Jifty->web->request->continuation || Jifty::Continuation->new( request => Jifty::Request->new( path => "/login" ) );
 };

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/Mixin/Model/User.pm	Thu Feb 14 14:59:21 2008
@@ -48,7 +48,8 @@
 
 column auth_token =>
   render_as 'unrendered',
-  type is 'varchar',
+  type is 'varchar(255)',
+  max_length is 255,
   default is '',
   label is _('Authentication token');
     
@@ -57,7 +58,8 @@
 column password =>
   is unreadable,
   label is _('Password'),
-  type is 'varchar',
+  type is 'varchar(64)',
+  max_length is 64,
   hints is _('Your password should be at least six characters'),
   render_as 'password',
   filters are 'Jifty::DBI::Filter::SaltHash';

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/View.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/View.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Authentication/Password/View.pm	Thu Feb 14 14:59:21 2008
@@ -105,10 +105,11 @@
 
 =cut
 
-template 'let/reset_lost_password' => page { title => 'Reset lost password' } content {
+template 'let/reset_lost_password' => page { title => _('Reset lost password') } content {
     my ( $next ) = get(qw(next));
     my $action = Jifty->web->new_action( class => 'ResetLostPassword' );
 
+    h1 { {class is 'title'};  _('Reset lost password')};
     Jifty->web->form->start( call => $next );
         render_param( $action => $_ ) for ( $action->argument_names );
         form_return( label => _("New password"), submit => $action );
@@ -143,6 +144,7 @@
         class   => 'SendPasswordReminder',
     );
 
+    h1 { {class is 'title'};  _('Send a link to reset your password')};
     outs( _(  "You lost your password. A link to reset it will be sent to the following email address:"));
     my $focused = 0;
     Jifty->web->form->start( call => $next );
@@ -152,35 +154,6 @@
 
 };
 
-=head2 passwordreminder
-
-Starts the process of sending a link to reset a lost password by email.
-
-See L<Jifty::Plugin::Authentication::Password::SendPasswordReminder>.
-
-=begin comment
-
-What's the difference between lost_password and passwordreminder? -- Sterling
-
-=end comment
-
-=cut
-
-template 'passwordreminder' => page { title => 'Send a password reminder' } content {
-    my $next = get('next');
-    my $action = Jifty->web->new_action(
-        moniker => 'password_reminder',
-        class   => 'SendPasswordReminder',
-    );
-    h2 { _('Send a password reminder') };
-    p  { _(  "You lost your password. A reminder will be send to the following mail:") };
-
-    Jifty->web->form->start( call => $next );
-        render_param( $action => $_ ) for ( $action->argument_names );
-        form_return( label => _("Send"), submit => $action);
-    Jifty->web->form->end();
-};
-
 =head2 resend_confirmation
 
 Request a new email confirmation message be sent to your email account.

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/CSSQuery.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/CSSQuery.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,72 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::CSSQuery;
+use base qw/ Jifty::Plugin /;
+
+=head1 NAME
+
+Jifty::Plugin::CSSQuery - use the cssQuery JavaScript library with Jifty
+
+=head1 SYNOPSIS
+
+In your F<etc/config.yml>:
+
+  framework:
+    Plugins:
+      - CSSQuery: {}
+
+=head1 DESCRIPTION
+
+cssQuery() is a powerful cross-browser JavaScript function that
+enables querying of a DOM document using CSS selectors. All CSS1 and
+CSS2 selectors are allowed plus quite a few CSS3 selectors.
+
+This is a Jifty plugin that let you use cssQuery javascript library in
+your Jifty application. cssQuery has been bundle with Jifty for a long
+time, for Jifty use it internally. Now it's been replaced with jQuery.
+It's now a plugin for backward compatibility.
+
+It is disabled by default, unless your C<ConfigFileVersion> is smaller
+or equal then 2.
+
+For more information about cssQuery, see L<http://dean.edwards.name/my/cssQuery/>.
+
+=head1 METHODS
+
+=head2 init
+
+This initializes the plugin, which simply includes the JavaScript
+necessary to load cssQuery.
+
+=cut
+
+sub init {
+    Jifty->web->add_javascript(
+        'cssquery/cssQuery.js',
+        'cssquery/cssQuery-level2.js',
+        'cssquery/cssQuery-level3.js',
+        'cssquery/cssQuery-standard.js'
+    );
+}
+
+=head1 SEE ALSO
+
+L<http://jifty.org>, L<http://dean.edwards.name/my/cssQuery/>
+
+=head1 COPYRIGHT AND LICENSE
+
+This plugin is Copyright 2007 Handlino, Inc.
+
+It is available for modication and distribution under the same terms
+as Perl itself.
+
+cssQuery is available for use in all personal or commercial projects
+under both MIT and GPL licenses. This means taht you can choose the
+license that best suits your project and use it accordingly. See
+L<http://jifty.com/> for current information on cssQuery copyrights
+and licensing.
+
+=cut
+
+1;

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer.pm	Thu Feb 14 14:59:21 2008
@@ -13,7 +13,7 @@
 
   Plugins:
     - Chart:
-        renderer: MyApp::Renderer;
+        DefaultRenderer: MyApp::Renderer
 
 In F<lib/MyApp/Renderer.pm>:
 

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer/GD/Graph.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer/GD/Graph.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer/GD/Graph.pm	Thu Feb 14 14:59:21 2008
@@ -14,7 +14,7 @@
 
   Plugins:
     - Chart:
-        renderer: Jifty::Plugin::Chart::Renderer::GD::Graph
+        DefaultRenderer: Jifty::Plugin::Chart::Renderer::GD::Graph
 
 =head1 DESCRIPTION
 

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer/XMLSWF.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer/XMLSWF.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Chart/Renderer/XMLSWF.pm	Thu Feb 14 14:59:21 2008
@@ -16,7 +16,7 @@
 
   Plugins:
     - Chart:
-        renderer: XMLSWF
+        DefaultRenderer: XMLSWF
         license_key: YOUR_OPTIONAL_LICENSE_KEY
 
 =head1 METHODS

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/ClassLoader.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/ClassLoader.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/ClassLoader.pm	Thu Feb 14 14:59:21 2008
@@ -125,10 +125,10 @@
         my $method = "${plugin}::CurrentUser";
 	if ( Jifty::Util->already_required($method) ) {
 	    Jifty->log->debug("Implementing $module using $method");
+            $Jifty::ClassLoader::AUTOGENERATED{$module} = 1;
             return Jifty::ClassLoader->return_class(
                   "use warnings; use strict; package $module;\n"
                 . "use base qw/$method/;\n"
-                . "sub _autogenerated { 1 };\n"
                 . "1;" ) 
 	}
 	else {
@@ -144,11 +144,11 @@
 
 	if ( Jifty::Util->already_required($method) ) {
 	    Jifty->log->debug("Implementing $module using $method");
+            $Jifty::ClassLoader::AUTOGENERATED{$module} = 1;
 	    return Jifty::ClassLoader->return_class(
                   "use warnings; use strict; package $module;\n"
                 . "use base qw/$method/;\n"
                 . "sub record_class { '$base$model' };\n"
-                . "sub autogenerated { 1 };\n"
                 . "1;" )
 	}
 	else {
@@ -158,10 +158,10 @@
 	my $method = $plugin . "::" . $1 . $2;
 	if ( Jifty::Util->already_required($method) ) {
 	    Jifty->log->debug("Implementing $module using $method");
+            $Jifty::ClassLoader::AUTOGENERATED{$module} = 1;
 	    return Jifty::ClassLoader->return_class(
                   "use warnings; use strict; package $module;\n"
                 . "use base qw/$method/;\n"
-                . "sub autogenerated { 1 };\n"
                 . "1;" )
 	}
 	else {

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/ErrorTemplates/View.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/ErrorTemplates/View.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/ErrorTemplates/View.pm	Thu Feb 14 14:59:21 2008
@@ -48,8 +48,10 @@
 };
 
 =head2 wrapper
-                              This exists as a fallback wrapper,
-                              in case the error in question is caused by the Jifty app's wrapper, for instance.
+
+This exists as a fallback wrapper, in case the error in question is
+caused by the Jifty app's wrapper, for instance.
+
 =cut
 
 {
@@ -67,11 +69,11 @@
                         media => 'all'
                     }
                 };
-                }
-                body {
+            }
+            body {
                 div {
                     attr { id => 'headers' };
-                    h1  {'Internal Error'};
+                    h1 {'Internal Error'};
                     div {
                         attr { id => 'content' };
                         a { attr { name => 'content' } };
@@ -86,35 +88,34 @@
                                         )
                                         . 'is enabled.'
                                 );
-                                }
+                            }
                         }
                         Jifty->web->render_messages;
                         $code->();
-                        }
-
                     }
+
                 }
             }
+        }
     }
 }
 
 
 template '__jifty/error/dhandler' => sub {
     my $error = get('error');
-                            Jifty->log->error( "Unhandled web error " . $error );
-                            page {
-                              title is 'Something went awry';
-                              show('/__jifty/error/_elements/error_text', error => $error );
-                        };
-                    };
+    Jifty->log->error( "Unhandled web error " . $error );
+    page {
+        title is 'Something went awry';
+        show( '/__jifty/error/_elements/error_text', error => $error );
+    };
+};
 
 template '__jifty/error/error.css' => sub {
-                            Jifty->handler->apache->content_type("text/css");
-                            h1 {
-                              outs('color: red');
-                              }
-
-                          };
+    Jifty->handler->apache->content_type("text/css");
+    h1 {
+        outs('color: red');
+    };
+};
 
 
 template '/errors/404' => sub {
@@ -123,23 +124,22 @@
     Jifty->handler->apache->header_out( Status => '404' );
     with( title => _("Something's not quite right") ), page {
 
-        with( id => "overview" ),
-        div {
+        with( id => "overview" ), div {
             p {
                 join( " ",
-                    _( "You got to a page that we don't think exists." ),
-                    _( "Anyway, the software has logged this error." ),
+                    _("You got to a page that we don't think exists."),
+                    _("Anyway, the software has logged this error."),
                     _("Sorry about this.") );
-                }
+            }
 
-                p {
+            p {
                 hyperlink(
                     url   => "/",
                     label => _('Go back home...')
                 );
-                }
-
             }
+
+        }
     };
 };
 
@@ -147,42 +147,44 @@
 
 template '__jifty/error/mason_internal_error' => page {
     { title is _('Something went awry') }
+
     my $cont = Jifty->web->request->continuation;
-    #my $wrapper = "/__jifty/error/_elements/wrapper" if $cont and $cont->request->path eq "/__jifty/error/mason_internal_error";
+
+#my $wrapper = "/__jifty/error/_elements/wrapper" if $cont and $cont->request->path eq "/__jifty/error/mason_internal_error";
 
     # If we're not in devel, bail
     if ( not Jifty->config->framework("DevelMode") or not $cont ) {
-            show("/__jifty/error/_elements/error_text");
-    #    return;
-    }
+        show("/__jifty/error/_elements/error_text");
 
-    my $e   = $cont->response->error;
-    if (ref($e)) {
-    my $msg = $e->message;
-    $msg =~ s/, <\S+> (line|chunk) \d+\././;
-
-    my $info  = $e->analyze_error;
-    my $file  = $info->{file};
-    my @lines = @{ $info->{lines} };
-    my @stack = @{ $info->{frames} };
+        #    return;
+    }
+    my $e = $cont->response->error;
+    if ( ref($e) ) {
+        my $msg = $e->message;
+        $msg =~ s/, <\S+> (line|chunk) \d+\././;
+
+        my $info  = $e->analyze_error;
+        my $file  = $info->{file};
+        my @lines = @{ $info->{lines} };
+        my @stack = @{ $info->{frames} };
 
         outs('Error in ');
         _error_line( $file, "@lines" );
         pre {$msg};
 
-        Jifty->web->return( label => _("Try again") );
+        form_return( label => _("Try again") );
 
-    h2 { 'Call stack' };
-    ul {
-        for my $frame (@stack) {
-            next if $frame->filename =~ m{/HTML/Mason/};
-            li {
-                _error_line( $frame->filename, $frame->line );
+        h2 {'Call stack'};
+        ul {
+            for my $frame (@stack) {
+                next if $frame->filename =~ m{/HTML/Mason/};
+                li {
+                    _error_line( $frame->filename, $frame->line );
                 }
-        }
-    }; 
+            }
+        };
     } else {
-    pre {$e};
+        pre {$e};
     }
 };
 

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Gladiator.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Gladiator.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,127 @@
+package Jifty::Plugin::Gladiator;
+use strict;
+use warnings;
+use base qw/Jifty::Plugin Class::Data::Inheritable/;
+__PACKAGE__->mk_accessors(qw/prev_data/);
+
+use Devel::Gladiator;
+use List::Util 'reduce';
+
+our @requests;
+
+our $VERSION = 0.01;
+
+=head2 init
+
+init installs the trigger needed before each HTTP request. It also establishes
+the baseline for all times and creates the log path.
+
+=cut
+
+sub init {
+    my $self = shift;
+    my %args = (
+        @_,
+    );
+
+    return if $self->_pre_init;
+
+    Jifty::Handler->add_trigger(
+        after_request => sub { $self->after_request(@_) }
+    );
+}
+
+=head2 after_request
+
+=cut
+
+sub after_request {
+    my $self    = shift;
+    my $handler = shift;
+    my $cgi     = shift;
+
+    # walk the arena, noting the type of each value
+    my %types;
+    for (@{ Devel::Gladiator::walk_arena() }) {
+        ++$types{ ref $_ };
+    }
+
+    # basic stats
+    my $all_values = reduce { $a + $b } values %types;
+    my $all_types  = keys %types;
+    my $new_values = 0;
+    my $new_types  = 0;
+
+    my %prev = %{ $self->prev_data || {} };
+
+    # copy so when we modify %types it doesn't affect prev_data
+    my %new_prev = %types;
+    $self->prev_data(\%new_prev);
+
+    # find the difference
+    for my $type (keys %types) {
+        my $diff = $types{$type} - ($prev{$type} || 0);
+
+        if ($diff != 0) {
+            $new_values += $diff;
+            ++$new_types;
+        }
+
+        $types{$type} = {
+            all => $types{$type},
+            new => $diff,
+        }
+    }
+
+    push @requests, {
+        id         => 1 + @requests,
+        url        => $cgi->url(-absolute=>1,-path_info=>1),
+        time       => scalar gmtime,
+
+        all_values => $all_values,
+        all_types  => $all_types,
+        new_values => $new_values,
+        new_types  => $new_types,
+        diff       => \%types,
+    };
+}
+
+
+=head1 NAME
+
+Jifty::Plugin::Gladiator - find leaks
+
+=head1 DESCRIPTION
+
+This plugin will attempt to output diffs between the current contents of memory after each request.
+
+
+=head1 USAGE
+
+Add the following to your site_config.yml
+
+ framework:
+   Plugins:
+     - Gladiator: {}
+
+=head2 OPTIONS
+
+=over 4
+
+
+=back
+
+=head1 SEE ALSO
+
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007 Best Practical Solutions
+
+This is free software and may be modified and distributed under the same terms as Perl itself.
+
+=cut
+
+1;
+
+

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Gladiator/Dispatcher.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Gladiator/Dispatcher.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,49 @@
+package Jifty::Plugin::Gladiator::Dispatcher;
+use warnings;
+use strict;
+
+use Jifty::Dispatcher -base;
+
+# http://your.app/arena
+on '/__jifty/admin/arena' => run {
+    set 'skip_zero' => 1;
+    show "/__jifty/admin/arena/all";
+};
+
+# http://your.app/arena/all
+on '/__jifty/admin/arena/all' => run {
+    set 'skip_zero' => 0;
+    show "/__jifty/admin/arena/all";
+};
+
+# http://your.app/arena/clear
+on '/__jifty/admin/arena/clear' => run {
+    @Jifty::Plugin::Gladiator::requests = ();
+    set 'skip_zero' => 1;
+    redirect "/__jifty/admin/arena";
+};
+
+# http://your.app/arena/xxx
+on '/__jifty/admin/arena/#' => run {
+    abort(404) if $1 < 1;
+    my $arena = $Jifty::Plugin::Gladiator::requests[$1 - 1]
+        or abort(404);
+    set arena => $arena;
+    show "/__jifty/admin/arena/one";
+};
+
+=head1 SEE ALSO
+
+L<Jifty::Plugin::Gladiator>, L<Jifty::Plugin::Gladiator::View>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007 Best Practical Solutions
+
+This is free software and may be modified and distributed under the same terms as Perl itself.
+
+=cut
+
+1;
+
+

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Gladiator/View.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Gladiator/View.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,114 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::Gladiator::View;
+use Jifty::View::Declare -base;
+use Scalar::Util 'blessed';
+
+=head1 NAME
+
+Jifty::Plugin::Gladiator::View - Views for database arena
+
+=head1 TEMPLATES
+
+=cut
+
+template '/__jifty/admin/arena/all' => page {
+    my $skip_zero = get 'skip_zero';
+
+    h1 { "Queries" }
+    p {
+        if ($skip_zero) {
+            a { attr { href => "/__jifty/admin/arena/all" }
+                "Show zero-arena requests" }
+        }
+        else {
+            a { attr { href => "/__jifty/admin/arena" }
+                "Hide zero-arena requests" }
+        }
+        a { attr { href => "/__jifty/admin/arena/clear" }
+            "Clear arena log" }
+    }
+    hr {}
+
+    h3 { "All arena" };
+    table {
+        row {
+            th { "ID"         }
+            th { "New values" }
+            th { "New types"  }
+            th { "All values" }
+            th { "All types"  }
+            th { "URL"        }
+        };
+
+        for (@Jifty::Plugin::Gladiator::requests)
+        {
+            next if $skip_zero && $_->{new_values} == 0;
+
+            row {
+                cell { a {
+                    attr { href => "/__jifty/admin/arena/$_->{id}" }
+                    $_->{id} } }
+
+                cell { $_->{new_values} }
+                cell { $_->{new_types}  }
+                cell { $_->{all_values} }
+                cell { $_->{all_types}  }
+                cell { $_->{url}        }
+            };
+        }
+    }
+};
+
+template '/__jifty/admin/arena/one' => page {
+    my $arena = get 'arena';
+
+    h1 { "Queries from Request $arena->{id}" }
+    ul {
+        li { "URL: $arena->{url}" }
+        li { "At: " . $arena->{time} }
+        li { "New values: $arena->{new_values}" }
+        li { "New types:  $arena->{new_types}"  }
+        li { "All values: $arena->{all_values}" }
+        li { "All types:  $arena->{all_types}"  }
+    }
+
+    table {
+        row {
+            th { "Type" }
+            th { "New" }
+            th { "All" }
+        };
+
+        my @sorted = sort {
+            $arena->{diff}->{$b}->{new} <=> $arena->{diff}->{$a}->{new}
+                                         ||
+            $arena->{diff}->{$b}->{all} <=> $arena->{diff}->{$a}->{all}
+        } keys %{ $arena->{diff} };
+
+        for my $type (@sorted) {
+            row {
+                cell { $type }
+                cell { $arena->{diff}->{$type}->{new} }
+                cell { $arena->{diff}->{$type}->{all} }
+            }
+        }
+    }
+};
+
+=head1 SEE ALSO
+
+L<Jifty::Plugin::Gladiator>, L<Jifty::Plugin::Gladiator::Dispatcher>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007 Best Practical Solutions
+
+This is free software and may be modified and distributed under the same terms as Perl itself.
+
+=cut
+
+1;
+
+

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Halo.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Halo.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Halo.pm	Thu Feb 14 14:59:21 2008
@@ -3,10 +3,8 @@
 
 package Jifty::Plugin::Halo;
 use base qw/Jifty::Plugin/;
-
-# Your plugin goes here.  If takes any configuration or arguments, you
-# probably want to override L<Jifty::Plugin/init>.
-
+use Time::HiRes 'time';
+use Class::Trigger;
 
 =head1 NAME
 
@@ -20,5 +18,277 @@
 
 =cut
 
+=head2 init
+
+Only enable halos in DevelMode. Add our instrumentation to L<Template::Declare>.
+
+=cut
+
+sub init {
+    my $self = shift;
+    return if $self->_pre_init;
+    return unless Jifty->config->framework('DevelMode');
+
+    # 0.28 added around_template instrumentation
+    eval { Template::Declare->VERSION('0.28'); 1 }
+        or do {
+            Jifty->log->debug("Template::Declare 0.28 required for TD halos.");
+            return;
+        };
+
+    warn "Overwriting an existing Template::Declare->around_template"
+        if Template::Declare->around_template;
+
+    Template::Declare->around_template(sub { $self->around_template(@_) });
+}
+
+=head2 around_template
+
+This is called to instrument L<Template::Declare> templates. We also draw a halo
+around the template itself.
+
+=cut
+
+sub around_template {
+    my ($self, $orig, $path, $args, $code) = @_;
+
+    # for now, call the last piece of the template's path the name
+    $path =~ m{.*/(.+)};
+    my $name = $1 || $path;
+
+    my $frame = $self->push_frame(
+        args  => [ %{ Jifty->web->request->arguments } ],
+        path  => $path,
+        name  => $name,
+    );
+
+    $frame->{displays}->{P} = {
+        name     => "perl",
+        callback => sub {
+            my $deparsed = eval {
+                require Data::Dump::Streamer;
+                Data::Dump::Streamer::Dump($code)->Out;
+            };
+            Jifty->web->escape($deparsed);
+        },
+    };
+
+    Template::Declare->buffer->append($self->halo_header($frame));
+    $orig->();
+
+    $frame = $self->pop_frame;
+    Template::Declare->buffer->append($self->halo_footer($frame));
+}
+
+=head2 halo_header frame -> string
+
+This will give you the halo header which includes links to the various
+information displays for this template.
+
+=cut
+
+sub halo_header {
+    my $self     = shift;
+    my $frame    = shift;
+    my $id       = $frame->{id};
+    my $name     = Jifty->web->escape($frame->{name});
+    my $displays = $frame->{displays};
+
+    my @buttons;
+    for my $letter (sort keys %$displays) {
+        my $d = $displays->{$letter};
+        my $name = Jifty->web->escape($d->{name});
+
+        push @buttons, join "\n", grep { $_ }
+            qq{<a id="halo-button-$name-$id"},
+            qq{  onclick="halo_render('$id', '$name'); return false"},
+            $d->{default} && qq{  style="font-weight:bold"},
+            qq{  href="#">$letter</a>},
+    }
+
+    my $rendermode = '[ ' . join(' | ', @buttons) . ' ]';
+
+    return << "    HEADER";
+        <div id="halo-$id" class="halo">
+            <div class="halo-header">
+                <span id="halo-rendermode-$id" class="halo-rendermode">
+                    $rendermode
+                </span>
+                <div class="halo-name">$name</div>
+            </div>
+            <div id="halo-inner-$id">
+                <div id="halo-rendered-$id">
+    HEADER
+}
+
+=head2 halo_footer frame -> string
+
+This will give you the halo footer which includes the actual information to
+be displayed when the user pokes the halo.
+
+=cut
+
+sub halo_footer {
+    my $self     = shift;
+    my $frame    = shift;
+    my $id       = $frame->{id};
+    my $displays = $frame->{displays};
+
+    my @divs;
+    for (sort keys %$displays) {
+        my $d = $displays->{$_};
+        my $name = Jifty->web->escape($d->{name});
+
+        if ($d->{callback}) {
+            my $output =
+                qq{<div id="halo-info-$name-$id" style="display: none">};
+
+            if (defined(my $info = $d->{callback}->($frame))) {
+                $output .= $info;
+            }
+            else {
+                # downgrade the link to plaintext so it's obvious there's no
+                # information available
+                $output .= qq{<script type="text/javascript">remove_link('$id', '$name');</script>};
+            }
+
+            $output .= "</div>";
+            push @divs, $output;
+        }
+    }
+
+    my $divs = join "\n", @divs;
+
+    return << "    FOOTER";
+                </div>
+                <div id="halo-info-$id">
+                    $divs
+                </div>
+            </div>
+        </div>
+    FOOTER
+}
+
+=head2 new_frame -> hashref
+
+Gives you a new frame for storing halo information.
+
+=cut
+
+sub new_frame {
+    my $self = shift;
+
+    my $args = {
+        name => "arguments",
+        callback => sub {
+            my $frame = shift;
+            my @out;
+
+            my @args;
+            while (my ($key, $value) = splice(@{$frame->{args}},0,2)) {
+                push @args, [$key, $value];
+            }
+
+            for (sort { $a->[0] cmp $b->[0] } @args) {
+                my ($name, $value) = @$_;
+                my $ref = ref($value);
+                my $out = qq{<b>$name</b>: };
+
+                if ($ref) {
+                    my $expanded = Jifty->web->serial;
+                    my $yaml = Jifty->web->escape(Jifty::YAML::Dump($value));
+                    #$out .= qq{<a href="#" onclick="Element.toggle('$expanded'); return false">$ref</a><div id="$expanded" style="display: none; position: absolute; left: 200px; border: 1px solid black; background: #ccc; padding: 1em; padding-top: 0; width: 300px; height: 500px; overflow: auto"><pre>$yaml</pre></div>};
+                    $out .= qq{<a href="#" onclick="Element.toggle('$expanded'); return false">$ref</a><div id="$expanded" class="halo-argument" style="display: none"><pre>$yaml</pre></div>};
+                }
+                elsif (defined $value) {
+                    $out .= Jifty->web->escape($value);
+                }
+                else {
+                    $out .= "undef";
+                }
+
+                push @out, $out;
+            }
+
+            return undef if @out == 0;
+
+            return "<ul>"
+                 . join("\n",
+                        map { "<li>$_</li>" }
+                        @out)
+                 . "</ul>";
+        },
+    };
+
+    return {
+        id           => Jifty->web->serial,
+        start_time   => time,
+        subcomponent => 0,
+        proscribed   => 0,
+        displays     => {
+            R => { name => "render", default => 1 },
+            S => { name => "source" },
+            A => $args,
+        },
+        @_,
+    };
+}
+
+=head2 push_frame -> frame
+
+Creates and pushes a frame onto the render stack. Mason's halos do not support
+"around"ing a component, so we fake it with an explicit stack.
+
+This also triggers C<halo_pre_template> for plugins adding halo data.
+
+=cut
+
+sub push_frame {
+    my $self = shift;
+
+    my $STACK       = Jifty->handler->stash->{'_halo_stack'} ||= [];
+    my $DEPTH       = ++Jifty->handler->stash->{'_halo_depth'};
+    my $INDEX_STACK = Jifty->handler->stash->{'_halo_index_stack'} ||= [];
+
+    # if this is the first frame, discard anything from the previous queries
+    my $previous = $STACK->[-1] || {};
+
+    my $frame = $self->new_frame(@_, previous => $previous, depth => $DEPTH);
+
+    push @$STACK, $frame;
+    push @$INDEX_STACK, $#$STACK;
+
+    $self->call_trigger('halo_pre_template', frame => $frame, previous => $previous);
+
+    return $frame;
+}
+
+=head2 pop_frame -> frame
+
+Pops a frame off the render stack. Mason's halos do not support
+"around"ing a component, so we fake it with an explicit stack.
+
+This also triggers C<halo_post_template> for plugins adding halo data.
+
+=cut
+
+sub pop_frame {
+    my $self = shift;
+
+    my $STACK       = Jifty->handler->stash->{'_halo_stack'} ||= [];
+    my $INDEX_STACK = Jifty->handler->stash->{'_halo_index_stack'} ||= [];
+    my $FRAME_ID    = pop @$INDEX_STACK;
+
+    my $frame = $STACK->[$FRAME_ID];
+    my $previous = $frame->{previous};
+
+    $frame->{'end_time'} = time;
+
+    $self->call_trigger('halo_post_template', frame => $frame, previous => $previous);
+
+    --Jifty->handler->stash->{'_halo_depth'};
+
+    return $frame;
+}
 
 1;

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/I18N.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/I18N.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/I18N.pm	Thu Feb 14 14:59:21 2008
@@ -48,6 +48,8 @@
 
 __PACKAGE__->mk_accessors(qw(js));
 
+Jifty->web->add_javascript('loc.js');
+
 sub init {
     my $self = shift;
     return if $self->_pre_init;

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker.pm	Thu Feb 14 14:59:21 2008
@@ -4,6 +4,13 @@
 package Jifty::Plugin::LeakTracker;
 use base qw/Jifty::Plugin Class::Data::Inheritable/;
 use Data::Dumper;
+
+BEGIN {
+    if (!$INC{"Devel/Events/Generator/Objects.pm"}) {
+        Jifty->log->error("Devel::Events::Generator::Objects must be compiled very early so that it can override 'bless' in time. Usually this means you must run your Jifty application with: perl -MDevel::Events::Generator::Objects bin/jifty");
+    }
+}
+
 use Devel::Events::Handler::ObjectTracker;
 use Devel::Events::Generator::Objects;
 use Devel::Size 'total_size';
@@ -73,6 +80,20 @@
     # XXX: Devel::Size seems to segfault Jifty at END time
     my $size = total_size([ @leaks ]) - $empty_array;
 
+    my $total = '?';
+
+    # report total memory, if able
+    eval {
+        require Proc::ProcessTable;
+        my $proc = Proc::ProcessTable->new;
+        for (@{ $proc->table }) {
+            next unless $_->pid == $$;
+            $total = $_->size;
+            last;
+        }
+    };
+    Jifty->log->warn($@) if $@;
+
     push @requests, {
         id => 1 + @requests,
         url => $cgi->url(-absolute=>1,-path_info=>1),
@@ -80,6 +101,7 @@
         objects => Dumper($leaked),
         time => scalar gmtime,
         leaks => \@leaks,
+        total => $total,
     };
 
     $self->generator(undef);
@@ -106,15 +128,15 @@
 
 View the top-level leak report (how much each request has leaked)
 
-    http://your.app/leaks
+    http://your.app/__jifty/admin/leaks
 
 View the top-level leak report, including zero-leak requests
 
-    http://your.app/leaks/all
+    http://your.app/__jifty/admin/leaks/all
 
 View an individual request's detailed leak report (which objects were leaked)
 
-    http://your.app/leaks/3
+    http://your.app/__jifty/admin/leaks/3
 
 =head1 WARNING
 

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker/Dispatcher.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker/Dispatcher.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker/Dispatcher.pm	Thu Feb 14 14:59:21 2008
@@ -4,25 +4,25 @@
 
 use Jifty::Dispatcher -base;
 
-# http://your.app/leaks -- display full leak report
-on 'leaks' => run {
+# http://your.app/__jifty/admin/leaks -- display full leak report
+on '/__jifty/admin/leaks' => run {
     set 'skip_zero' => 1;
-    show "leaks/all";
+    show "/__jifty/admin/leaks/all";
 };
 
-# http://your.app/leaks/all -- full leak report with non-leaked requests
-on 'leaks/all' => run {
+# http://your.app/__jifty/admin/leaks/all -- leak report with 0-leak requests
+on '/__jifty/admin/leaks/all' => run {
     set 'skip_zero' => 0;
-    show "leaks/all";
+    show "/__jifty/admin/leaks/all";
 };
 
-# http://your.app/leaks/xxx -- display leak report for request ID xxx
-on 'leaks/#' => run {
+# http://your.app/__jifty/admin/leaks/xxx -- display leak report for request ID
+on '/__jifty/admin/leaks/#' => run {
     abort(404) if $1 < 1;
     my $leak = $Jifty::Plugin::LeakTracker::requests[$1 - 1]
         or abort(404);
     set leak => $leak;
-    show "leaks/one";
+    show "/__jifty/admin/leaks/one";
 };
 
 =head1 SEE ALSO

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker/View.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker/View.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/LeakTracker/View.pm	Thu Feb 14 14:59:21 2008
@@ -11,86 +11,76 @@
 
 =head1 TEMPLATES
 
-=head2 leaks/chart
-
-This shows a chart using L<Chart>. It expects to find the arguments in the C<args> parameter, which is setup for it in L<Jifty::Plugin::Chart::Dispatcher>.
-
-This will output a PNG file unless there is an error building the chart.
-
 =cut
 
-template 'leaks/all' => sub {
+template '/__jifty/admin/leaks/all' => page {
     my $skip_zero = get 'skip_zero';
 
-    html {
-        body {
-            h1 { "Leaked Objects" }
-            p {
-                if ($skip_zero) {
-                    a { attr { href => "/leaks/all" }
-                        "Show zero-leak requests" }
-                }
-                else {
-                    a { attr { href => "/leaks" }
-                        "Hide zero-leak requests" }
-                }
-            }
-            hr {}
-
-            table {
-                row {
-                    th { "ID" }
-                    th { "Leaks" }
-                    th { "Bytes leaked" }
-                    th { "Time" }
-                    th { "URL" }
-                };
-
-                for (@Jifty::Plugin::LeakTracker::requests)
-                {
-                    next if $skip_zero && @{$_->{leaks}} == 0;
-
-                    row {
-                        cell { a { attr { href => "leaks/$_->{id}" }
-                                   $_->{id} } }
-
-                        cell { scalar @{$_->{leaks}} }
-                        cell { $_->{size} }
-                        cell { $_->{time} }
-                        cell { $_->{url} }
-                    };
-                }
-            }
+    h1 { "Leaked Objects" }
+    p {
+        if ($skip_zero) {
+            a { attr { href => "/__jifty/admin/leaks/all" }
+                "Show zero-leak requests" }
+        }
+        else {
+            a { attr { href => "/__jifty/admin/leaks" }
+                "Hide zero-leak requests" }
+        }
+    }
+    hr {}
+
+    table {
+        row {
+            th { "ID" }
+            th { "Leaks" }
+            th { "Bytes leaked" }
+            th { "Total size" }
+            th { "Time" }
+            th { "URL" }
+        };
+
+        for (@Jifty::Plugin::LeakTracker::requests)
+        {
+            next if $skip_zero && @{$_->{leaks}} == 0;
+
+            row {
+                cell { a {
+                    attr { href => "/__jifty/admin/leaks/$_->{id}" }
+                    $_->{id} } }
+
+                cell { scalar @{$_->{leaks}} }
+                cell { $_->{size} }
+                cell { $_->{total} }
+                cell { $_->{time} }
+                cell { $_->{url} }
+            };
         }
     }
 };
 
-template 'leaks/one' => sub {
+template '/__jifty/admin/leaks/one' => page {
     my $leak = get 'leak';
 
-    html {
-        body {
-            h1 { "Leaks from Request $leak->{id}" }
-            ul {
-                li { "URL: $leak->{url}" }
-                li { "Time: $leak->{time}" }
-                li { "Objects leaked: " . scalar(@{$leak->{leaks}}) }
-                li { "Total memory leaked: $leak->{size} bytes" }
-            }
-            p { a { attr { href => "/leaks" } "Table of Contents" } }
-            hr {}
-            h2 { "Object types leaked:" }
-            ul {
-                my %seen;
-                for (map { blessed $_ } @{ $leak->{leaks} }) {
-                    next if $seen{$_}++;
-                    li { $_ }
-                }
-            }
-            hr {}
-            pre { $leak->{objects} }
+    h1 { "Leaks from Request $leak->{id}" }
+    ul {
+        li { "URL: $leak->{url}" }
+        li { "Time: $leak->{time}" }
+        li { "Total memory used: $leak->{total} bytes" }
+        li { "Objects leaked: " . scalar(@{$leak->{leaks}}) }
+        li { "Memory leaked: $leak->{size} bytes" }
+    }
+    p { a { attr { href => "/__jifty/admin/leaks" } "Table of Contents" } }
+    hr {}
+    h2 { "Object types leaked:" }
+    ul {
+        my %seen;
+        for (map { blessed $_ } @{ $leak->{leaks} }) {
+            next if $seen{$_}++;
+            li { $_ }
         }
     }
+    hr {}
+    pre { $leak->{objects} }
 };
 
 =head1 SEE ALSO

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,321 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::Monitoring;
+
+use base qw/Jifty::Plugin Exporter/;
+use Time::HiRes qw(gettimeofday tv_interval);
+
+our $VERSION = 0.01;
+
+=head1 NAME
+
+Jifty::Plugin::Monitoring - Provides a framework for profiling and
+monitoring services
+
+=head1 SYNOPSIS
+
+In your F<config.yml>:
+
+  Plugins:
+    - Monitoring: {}
+
+By writing modules, and scheduling the running of C<jifty cron>,
+repeating events can be scheduled at various frequencies.  It also
+provides functionality for sampling and recording profiling or usage
+statistics from your jifty application.
+
+=head1 DESCRIPTION
+
+The configuration in F<config.yml> accepts one possible parameter,
+C<path>, which should be the base class under which all monitoring
+classes are found.  This defaults to C<AppName::Monitor>.  C<path> may
+also be an array refence of classes to search under.
+
+Each class monitoring class should C<use Jifty::Plugin::Monitoring>.
+This will import several functions, which allow you to write
+monitoring code as follows:
+
+  use Jifty::Plugin::Monitoring;
+  monitor users => every 30 => minutes, sub {
+      my $monitor = shift;
+      my $collection = AppName::Model::UserCollection->new;
+      $collection->unlimit;
+      data_point all => $collection->count;
+
+      data_point yaks => int(rand(100));
+  };
+
+Monitors must have distinct names.  Time units supported by this
+syntax include the singular and plural forms of C<minute>, C<hour>,
+C<day>, C<week>, C<month>, and C<year>.
+
+=cut
+
+__PACKAGE__->mk_accessors(qw/base_classes monitors now current_monitor lockfile has_lock/);
+
+our @EXPORT = qw/monitor every
+                 minute minutes
+                 hour hours
+                 day days
+                 week weeks
+                 month months
+                 year years
+
+                 data_point timer/;
+
+BEGIN {
+    for my $time (qw/minute hour day week month year/) {
+        for my $plural ( "", "s" ) {
+            my $method = $time . $plural;
+            no strict 'refs';
+            *{ __PACKAGE__ . "::" . $method }
+                = sub { return $time };
+        }
+    }
+}
+
+=head2 EXPORTED FUNCTIONS
+
+These methods are used in your monitoring classes to define monitors.
+
+=head2 every
+
+Syntactic sugar helper method, which allows you to write:
+
+  every 3 => minutes, sub { ... };
+
+or
+
+  every qw/3 minutes/, sub { ... };
+
+=cut
+
+sub every {
+    unshift @_, 1 if @_ == 2;
+    my ($count, $units, $sub) = @_;
+    $units =~ s/s$//;
+    return ($count, $units, $sub);
+}
+
+=head2 monitor
+
+Syntactic sugar which defines a monitor.  Use it in conjunction with
+L</every>:
+
+  monitor "name", every qw/3 minutes/ => sub { ... };
+
+=cut
+
+sub monitor {
+    my ($self) = Jifty->find_plugin('Jifty::Plugin::Monitoring');
+    $self ||= $Jifty::Plugin::Monitoring::self;
+    $self->add_monitor(@_);
+}
+
+=head2 data_point NAME, VALUE [, CATEGORY]
+
+Records a data point, associating C<NAME> to C<VALUE> at the current
+time.  C<CATEGORY> defaults to the name of the monitor that the data
+point is inside of.
+
+=cut
+
+sub data_point {
+    my ($self) = Jifty->find_plugin('Jifty::Plugin::Monitoring');
+    $self ||= $Jifty::Plugin::Monitoring::self;
+
+    my $category = @_ == 3 ? shift : $self->current_monitor->{name};
+    my ($name, $value) = @_;    
+    
+    my $data = Jifty::Plugin::Monitoring::Model::MonitoredDataPoint->new();
+    $data->create(
+        category => $category,
+        sample_name => $name,
+        value => $value,
+        sampled_at => $self->now,
+    );
+}
+
+=head2 timer MECH, URL
+
+Uses L<Time::HiRes> to time how long it takes the given
+L<WWW::Mechanize> object C<MECH> to retrueve the given C<URL>.
+Returns the number of seconds elapsed.
+
+=cut
+
+sub timer {
+    my $mech = shift;
+    my $url = shift;
+    
+    my $t0 = [gettimeofday];
+    $mech->get($url);
+    return tv_interval($t0);
+}
+
+=head2 Other Syntactic Sugar Methods
+
+The following methods simply return themselves:
+
+=over
+
+=item minute, minutes
+
+=item hour, hours
+
+=item day, days
+
+=item week, weeks
+
+=item month, months
+
+=item year, years
+
+=back
+
+=head1 OBJECT METHODS
+
+These are primarily used by
+L<Jifty::Plugin::Monitoring::Command::Cron>; you will not need to call
+these in most uses of this plugin.
+
+=head2 init
+
+Looks for and loads all monitoring classes.  During the loading
+process, the monitors defined in each class are found and stored for
+later reference.
+
+=cut
+
+sub init {
+    my $self = shift;
+    my %args = @_;
+    my @path = $args{path} ? @{$args{path}} : (Jifty->app_class("Monitor"));
+    $self->base_classes(\@path);
+    $self->monitors({});
+    $self->lockfile($args{lockfile} || Jifty::Util->absolute_path("var/monitoring.pid"));
+    local $Jifty::Plugin::Monitoring::self = $self;
+    Jifty::Module::Pluggable->import(
+        require => 1,
+        search_path => \@path,
+        except => qr/\.#/,
+        sub_name => 'monitor_classes',
+    );
+    $self->monitor_classes;
+}
+
+
+=head2 add_monitor NAME COUNT UNIT SUB
+
+A class method used to add a monitor with the given C<NAME> and
+C<SUB>, which is scheduled to be run every C<COUNT> C<UNIT>s.
+
+=cut
+
+sub add_monitor {
+    my $self = shift;
+    my ($name, $count, $units, $sub) = @_;
+    $self->monitors->{$name} = { name => $name, sub => $sub, count => $count, unit => $units };
+}
+
+=head2 last_run NAME
+
+Looks up and returns the L<Jifty::Plugin::Monitoring::Model::LastRun>
+object for this monitor; creates one if one does not exist, and sets
+it to the previous round time it would have run.
+
+=cut
+
+sub last_run {
+    my $self = shift;
+    my ($name) = @_;
+    my $last = Jifty::Plugin::Monitoring::Model::LastRun->new();
+    $last->load_or_create( name => $name );
+    return $last if $last->last_run;
+
+    my $unit = $self->monitors->{$name}->{unit};
+    my $now = Jifty::DateTime->now->truncate( to => $unit );
+    warn "No last run time for monitor $name; inserting $now\n";
+    $last->set_last_run($now);
+    return $last;
+}
+
+=head2 current_user
+
+Monitors presumable run as superuser; thus, this method returns the
+application's superuser object.
+
+=cut
+
+sub current_user {
+    return Jifty->app_class("CurrentUser")->superuser;
+}
+
+=head2 current_monitor
+
+Returns a hashref, with keys of C<name>, C<sub>, C<count>, and
+C<units>, which describe the monitor which is crrently running, if
+any.
+
+=head2 now
+
+For consistency, the current concept of "now" is fixed while the
+monitor is running.  Use this method to determine when "now" is.
+
+=cut
+
+=head2 run_monitors
+
+For each monitor that we know of, checks to see if it is due to be
+run, and runs it if it is.
+
+=cut
+
+sub run_monitors {
+    my $self = shift;
+    return unless $self->lock;
+    my $now = Jifty::DateTime->now->truncate( to => "minute" );
+    $now->set_time_zone("UTC");
+    $self->now($now);
+    for my $name (keys %{$self->monitors}) {
+        my $last = $self->last_run($name);
+        my %monitor = %{$self->monitors->{$name}};
+        my $next = $last->last_run->add( $monitor{unit}."s" => $monitor{count} );
+        warn "For monitor $name, next $next, now $now\n";
+        next unless $now >= $next;
+        warn "Cron not being run often enough: we skipped a '$name'!\n"
+          if $now >= $next->add( $monitor{unit}."s" => $monitor{count} );
+        warn "Running monitor $name\n";
+        $self->current_monitor(\%monitor);
+        eval {
+            $monitor{sub}->($self);
+        };
+        if (my $error = $@) {
+            warn "Error running monitor $name: $error\n";
+        } else {
+            $last->set_last_run($now);
+        }
+    }
+    $self->current_monitor(undef);
+}
+
+sub lock {
+    my $self = shift;
+    return if -e $self->lockfile;
+    unless (open PID, ">", $self->lockfile) {
+        warn "Can't open lockfile @{[$self->lockfile]}: $!";
+        return 0;
+    }
+    print PID $$;
+    close PID;
+    $self->has_lock(1);
+    return 1;
+}
+
+sub DESTROY {
+    my $self = shift;
+    unlink $self->lockfile if $self->has_lock;
+}
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/Command/Cron.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/Command/Cron.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,70 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::Monitoring::Command::Cron;
+
+# note that you'll need a patch to App::CLI to allow arbitrary
+# files to define new commands
+
+package Jifty::Script::Cron;
+
+use base qw/App::CLI::Command/;
+
+=head1 NAME
+
+Jifty::Script::Cron - Runs any monitoring services
+
+=head1 SYNOPSIS
+
+If your app uses L<Jifty::Plugin::Monitoring>, this script should be
+run by your cron daemon.  The frequency it should be run is
+determinded by the LCM of the monitors you have scheduled.  Running it
+more frequently that this is not harmful, except by consuming come
+resources.
+
+=head1 DESCRIPTION
+
+=head2 options
+
+Takes no options.
+
+=head2 run
+
+Examines the application, looking for an instance of the monitoring
+plugin, and runs it.
+
+=cut
+
+sub run {
+    my $self = shift;
+    Jifty->new;
+
+    my ($monitor) = Jifty->find_plugin('Jifty::Plugin::Monitoring');
+    die "Monitoring is not enabled for @{[Jifty->app_class]}\n" unless $monitor;
+    $monitor->run_monitors;
+}
+
+=head2 filename
+
+This is used as a hack to get L<App::CLI> to retrieve our POD correctly.
+
+Inner packages are not given in C<%INC>. If anyone finds a way around this,
+please let us know.
+
+=cut
+
+sub filename { __FILE__ }
+
+=head1 SEE ALSO
+
+L<Jifty::Plugin::Monitoring>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007 Best Practical Solutions
+
+This is free software and may be modified and distributed under the same terms as Perl itself.
+
+=cut
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/Model/LastRun.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/Model/LastRun.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::Monitoring::Model::LastRun;
+
+use base qw( Jifty::Record );
+
+use Jifty::DBI::Schema;
+use Jifty::Record schema {
+
+    column name =>
+        type is 'varchar',
+        is distinct,
+        is required;
+
+    column last_run =>
+        type is 'timestamp',
+        filters are 'Jifty::DBI::Filter::DateTime';
+};
+
+1;
+

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/Model/MonitoredDataPoint.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Monitoring/Model/MonitoredDataPoint.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,29 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::Monitoring::Model::MonitoredDataPoint;
+
+use base qw( Jifty::Record );
+
+use Jifty::DBI::Schema;
+use Jifty::Record schema {
+
+    column category =>
+        type is 'varchar',
+        is required;
+
+    column sample_name =>
+        type is 'varchar',
+        is required;
+
+    column value =>
+        type is 'varchar',
+        is required;
+
+    column sampled_at =>
+        type is 'timestamp',
+        filters are 'Jifty::DBI::Filter::DateTime';
+};
+
+1;
+

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/OAuth/Dispatcher.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/OAuth/Dispatcher.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/OAuth/Dispatcher.pm	Thu Feb 14 14:59:21 2008
@@ -8,6 +8,7 @@
 use Net::OAuth::AccessTokenRequest;
 use Net::OAuth::ProtectedResourceRequest;
 use Crypt::OpenSSL::RSA;
+use URI::Escape 'uri_unescape';
 
 on     POST '/oauth/request_token' => \&request_token;
 before GET  '/oauth/authorize'     => \&authorize;
@@ -26,8 +27,13 @@
 
 sub abortmsg {
     my ($code, $msg) = @_;
-    Jifty->log->debug($msg) if defined($msg);
-    abort($code) if $code;
+    if ($code) {
+        Jifty->log->debug("$code for ".Jifty->web->request->path.":" . $msg) if defined($msg);
+        abort($code);
+    }
+    elsif (defined $msg) {
+        Jifty->log->debug("OAuth denied for ".Jifty->web->request->path.":" . $msg);
+    }
 }
 
 =head2 request_token
@@ -94,6 +100,7 @@
 
 sub authorize {
     my @params = qw/token callback/;
+    abortmsg(403, "Cannot authorize tokens as an OAuthed user") if Jifty->handler->stash->{oauth};
 
     set no_abort => 1;
     my %oauth_params = get_parameters(@params);
@@ -120,6 +127,7 @@
 =cut
 
 sub authorize_post {
+    abortmsg(403, "Cannot authorize tokens as an OAuthed user") if Jifty->handler->stash->{oauth};
     my $result = Jifty->web->response->result("authorize_request_token");
     unless ($result && $result->success) {
         redirect '/oauth/authorize';
@@ -250,7 +258,8 @@
     abortmsg(undef, "Invalid signature (type: $oauth_params{signature_method})."), return unless $request->verify;
 
     $consumer->made_request(@oauth_params{qw/timestamp nonce/});
-    Jifty->web->current_user(Jifty->app_class('CurrentUser')->new(id => $access_token->auth_as));
+    Jifty->handler->stash->{oauth} = 1;
+    Jifty->web->temporary_current_user(Jifty->app_class('CurrentUser')->new(id => $access_token->auth_as));
 }
 
 =head2 get_consumer CONSUMER KEY
@@ -344,11 +353,16 @@
 
 sub get_parameters {
     my %p;
+    my %params = Jifty->handler->apache->params();
 
-    # XXX: Check Authorization header
-    # XXX: Check WWW-Authenticate header
+    # Check Authorization header
+    my $authz = Jifty->handler->apache->header_in("Authorization");
+    if ($authz && $authz =~ s/^\s*OAuth\s*//i) {
+        while ($authz =~ m{\s*([%a-zA-Z0-9._~-]+)="([%a-zA-Z0-9._~-]*)"\s*}g) {
+            $params{uri_unescape($1)} = uri_unescape($2);
+        }
+    }
 
-    my %params = Jifty->handler->apache->params();
     for (@_) {
         $p{$_} = delete $params{"oauth_$_"}
             if !defined $p{$_};

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/OAuth/Model/Consumer.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/OAuth/Model/Consumer.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/OAuth/Model/Consumer.pm	Thu Feb 14 14:59:21 2008
@@ -94,13 +94,13 @@
 
 sub is_valid_request {
     my ($self, $timestamp, $nonce) = @_;
-    return (0, "Timestamp nonincreasing.")
+    return (0, "Timestamp nonincreasing, $timestamp < ".$self->last_timestamp.".")
         if $timestamp < $self->last_timestamp;
     return 1 if $timestamp > $self->last_timestamp;
 
     # if this is the same timestamp as the last, we must check that the nonce
     # is unique across the requests of these timestamps
-    return (0, "Already used this nonce.")
+    return (0, "Already used the nonce $nonce.")
         if defined $self->nonces->{$nonce};
 
     return 1;

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/OpenID/Dispatcher.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/OpenID/Dispatcher.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/OpenID/Dispatcher.pm	Thu Feb 14 14:59:21 2008
@@ -19,6 +19,7 @@
 };
 
 before qr'^/openid/login' => run {
+    Jifty->api->allow('AuthenticateOpenID');
     set action => Jifty->web->new_action(
         class   => 'AuthenticateOpenID',
         moniker => 'authenticateopenid'
@@ -26,6 +27,7 @@
 };
 
 before qr'^/openid/verify' => run {
+    Jifty->api->allow('VerifyOpenID');
     Jifty->web->request->add_action(
         class   => 'VerifyOpenID',
         moniker => 'verifyopenid'
@@ -88,7 +90,11 @@
         }
     }
     else {
-        redirect '/openid/login';
+        if(Jifty->web->request->continuation) {
+            Jifty->web->request->continuation->call;
+        } else {
+            redirect '/openid/login';
+        }
     }
 };
 

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/OpenID/Mixin/Model/User.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/OpenID/Mixin/Model/User.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/OpenID/Mixin/Model/User.pm	Thu Feb 14 14:59:21 2008
@@ -79,7 +79,7 @@
         if not defined $openid or not length $openid;
 
     $openid = 'http://' . $openid
-        if $openid !~ m{^http://};
+        if $openid !~ m{^https?://};
 
     my $uri = URI->new( $openid );
 

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Quota.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Quota.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,65 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::Quota;
+
+use base qw/Jifty::Plugin/;
+
+=head1 NAME
+
+Jifty::Plugin::Quota - Provides a framework for generic quota management
+of Jifty model objects
+
+=head1 SYNOPSIS
+
+In your F<config.yml>:
+
+  Plugins:
+    - Quota:
+        disk:
+          User: 5242880   # bytes (5MB)
+          Group: 10485760
+
+By inserting hooks and checks into an app (actions and models, most
+likely), quotas can be updated and enforced.  It is up to the developer to
+do this though; this plugin just provides a ready-made framework.
+
+The configuration provides defaults for quota creation.  It is structured
+by I<type> and then I<object_class>.  In the example above, the default disk
+space quotas for User and Group model objects are set.  When a new quota is
+created and a I<cap> is not specified, the plugin will look up the default
+in the config.
+
+=head1 METHODS
+
+=head2 config
+
+=cut
+
+__PACKAGE__->mk_accessors(qw(config));
+
+=head2 init
+
+=cut
+
+sub init {
+    my $self = shift;
+    my %opt  = @_;
+    $self->config( \%opt );
+}
+
+=head2 default_cap TYPE CLASS
+
+Returns the default cap (if there is one) as specified by the config for
+the given TYPE and CLASS.  Returns undef otherwise.
+
+=cut
+
+sub default_cap {
+    my $self  = shift;
+    my $type  = shift;
+    my $class = shift;
+    return $self->config->{$type}{$class};
+}
+
+1;

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/Quota/Model/Quota.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Quota/Model/Quota.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,193 @@
+use strict;
+use warnings;
+
+=head1 NAME
+
+BTDT::Model::Quota
+
+=head1 DESCRIPTION
+
+Generic quotas for Jifty model objects.
+
+=cut
+
+package Jifty::Plugin::Quota::Model::Quota;
+use Jifty::DBI::Schema;
+
+use Jifty::Record schema {
+    column object_id =>
+        type is 'integer',
+        is mandatory;
+    
+    column object_class =>
+        type is 'text',
+        is mandatory;
+
+    column type =>
+        type is 'text',
+        is mandatory,
+        label is 'Type';
+
+    column cap =>
+        type is 'integer',
+        is mandatory,
+        label is 'Cap (limit)';
+
+    column usage =>
+        type is 'integer',
+        is mandatory,
+        default is 0,
+        label is 'Usage';
+};
+
+=head2 create PARAMHASH
+
+=cut
+
+sub create {
+    my $self = shift;
+    my %args = @_;
+
+    if ( not defined $args{cap} ) {
+        my $plugin = Jifty->find_plugin('Jifty::Plugin::Quota');
+        $args{cap} = $plugin->default_cap( $args{type}, $args{object_class} );
+    }
+
+    $args{usage} = 0
+        if not defined $args{usage};
+
+    # XXX TODO: This should be in the schema, but we can't do that at the moment
+    my $check = Jifty::Plugin::Quota::Model::Quota->new( current_user => Jifty->app_class('CurrentUser')->superuser );
+    $check->load_by_cols(
+        object_id    => $args{object_id},
+        object_class => $args{object_class},
+        type         => $args{type}
+    );
+    return ( undef, "Already a quota for that object." ) if $check->id;
+
+    return $self->SUPER::create( %args );
+}
+
+=head2 create_from_object OBJECT [PARAMHASH]
+
+Conveniently creates a quota record using a model OBJECT and an optional
+extra paramhash.
+
+=cut
+
+sub create_from_object {
+    my $self    = shift;
+    my $object  = shift;
+    return $self->create( ($self->_object_attrs($object)), @_ );
+}
+
+=head2 load_by_object OBJECT [PARAMHASH]
+
+Conveniently loads a quota record using a model OBJECT and an optional
+extra paramhash.
+
+=cut
+
+sub load_by_object {
+    my $self    = shift;
+    my $object  = shift;
+    return $self->load_by_cols( ($self->_object_attrs($object)), @_ );
+}
+
+sub _object_attrs {
+    my $self   = shift;
+    my $object = shift;
+    my $class  = ref $object;
+    $class =~ s/^.+::(\w+)$/$1/;
+    return ( object_id => $object->id, object_class => $class );
+}
+
+=head2 object
+
+Returns the object regulated by this quota.
+
+=cut
+
+sub object {
+    my $self   = shift;
+    my $class  = Jifty->app_class( 'Model', $self->__value('object_class') );
+    my $object = $class->new( current_user => $self->current_user );
+    $object->load( $self->__value('object_id') );
+    return $object;
+}
+
+=head2 usage_ok INTEGER
+
+Checks if adding INTEGER to the current I<usage> will exceed I<cap>.
+
+Returns true or false.
+
+=cut
+
+sub usage_ok {
+    my $self = shift;
+    my $more = shift;
+    return (($self->__value('usage') + $more) <= $self->__value('cap')) ? 1 : 0;
+}
+
+=head2 add_usage INTEGER
+
+Adds INTEGER to I<usage> if there is enough quota left.
+
+Returns true on success, false on failure.
+
+=cut
+
+sub add_usage {
+    my $self  = shift;
+    my $usage = shift;
+    
+    $usage =~ s/\D//g;
+
+    if ( $self->usage_ok( $usage ) ) {
+        $self->__set(
+            column => 'usage',
+            value  => 'usage + '.$usage,
+            is_sql_function => 1
+        );
+        return 1;
+    }
+    return 0;
+}
+
+=head2 subtract_usage INTEGER
+
+Subtracts INTEGER from I<usage>.
+
+=cut
+
+sub subtract_usage {
+    my $self  = shift;
+    my $usage = shift;
+    
+    $usage =~ s/\D//g;
+
+    $self->__set(
+        column => 'usage',
+        value  => 'usage - '.$usage,
+        is_sql_function => 1
+    );
+}
+
+=head2 current_user_can
+
+If current user can read the referenced object, then they can read the quotas.
+No one can created, update, or delete quotas unless they are a superuser.
+
+=cut
+
+sub current_user_can {
+    my $self   = shift;
+    my $right  = shift;
+    return 1 if $right eq 'read' and $self->object->current_user_can( $right );
+    return 1 if $self->current_user->is_superuser;
+    return $self->SUPER::current_user_can( $right, @_ );
+}
+
+1;
+

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/REST.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/REST.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/REST.pm	Thu Feb 14 14:59:21 2008
@@ -4,7 +4,7 @@
 package Jifty::Plugin::REST;
 use base qw/Jifty::Plugin/;
 
-our $VERSION = 0.01;
+our $VERSION = '1.00';
 
 =head1 NAME
 

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/REST/Dispatcher.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/REST/Dispatcher.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/REST/Dispatcher.pm	Thu Feb 14 14:59:21 2008
@@ -35,11 +35,16 @@
 on PUT    '/=/model/*/*/*'      => \&replace_item;
 on DELETE '/=/model/*/*/*'      => \&delete_item;
 
+on GET    '/=/search/*/**'      => \&search_items;
+
 on GET    '/=/action/*'         => \&list_action_params;
 on GET    '/=/action'           => \&list_actions;
 on POST   '/=/action/*'         => \&run_action;
 
 on GET    '/=/help'             => \&show_help;
+on GET    '/=/help/*'           => \&show_help_specific;
+
+on GET    '/=/version'          => \&show_version;
 
 =head2 show_help
 
@@ -56,20 +61,27 @@
     print qq{
 Accessing resources:
 
-on GET    /=/model                                  list models
-on GET    /=/model/<model>                          list model columns
-on GET    /=/model/<model>/<column>                 list model items
-on GET    /=/model/<model>/<column>/<key>           show item
-on GET    /=/model/<model>/<column>/<key>/<field>   show item field
-
-on POST   /=/model/<model>                          create item
-on PUT    /=/model/<model>/<column>/<key>           update item
-on DELETE /=/model/<model>/<column>/<key>           delete item
-
-on GET    /=/action                                 list actions
-on GET    /=/action/<action>                        list action params
-on POST   /=/action/<action>                        run action
+on GET    /=/model                                   list models
+on GET    /=/model/<model>                           list model columns
+on GET    /=/model/<model>/<column>                  list model items
+on GET    /=/model/<model>/<column>/<key>            show item
+on GET    /=/model/<model>/<column>/<key>/<field>    show item field
+
+on POST   /=/model/<model>                           create item
+on PUT    /=/model/<model>/<column>/<key>            update item
+on DELETE /=/model/<model>/<column>/<key>            delete item
+
+on GET    /=/search/<model>/<c1>/<v1>/<c2>/<v2>/...  search items
+on GET    /=/search/<model>/<c1>/<v1>/.../<field>    show matching items' field
+
+on GET    /=/action                                  list actions
+on GET    /=/action/<action>                         list action params
+on POST   /=/action/<action>                         run action
 
+on GET    /=/help                                    this help page
+on GET    /=/help/search                             help for /=/search
+
+on GET    /=/version                                 version information
 
 Resources are available in a variety of formats:
 
@@ -82,147 +94,84 @@
 
 HTML is output only if the Accept: header or an extension does not request a
 specific format.
-    };
+};
     last_rule;
 }
 
+=head2 show_help_specific
 
-=head2 stringify LIST
-
-Takes a list of values and forces them into strings.  Right now all it does
-is concatenate them to an empty string, but future versions might be more
-magical.
+Displays a help page about a specific topic. Will look for a method named
+C<show_help_specific_$1>.
 
 =cut
 
-sub stringify {
-    # XXX: allow configuration to specify model fields that are to be
-    # expanded
-    my @r;
+sub show_help_specific {
+    my $topic = $1;
+    my $method = "show_help_specific_$topic";
+    __PACKAGE__->can($method) or abort(404);
 
-    for (@_) {
-        if (UNIVERSAL::isa($_, 'Jifty::Record')) {
-            push @r, reference_to_data($_);
-        }
-        elsif (UNIVERSAL::isa($_, 'Jifty::DateTime')) {
-            push @r, _datetime_to_data($_);
-        }
-        elsif (defined $_) {
-            push @r, '' . $_; # force stringification
-        }
-        else {
-            push @r, undef;
-        }
-    }
+    my $apache = Jifty->handler->apache;
 
-    return wantarray ? @r : $r[-1];
+    $apache->header_out('Content-Type' => 'text/plain; charset=UTF-8');
+    $apache->send_http_header;
+
+    print __PACKAGE__->$method;
+    last_rule;
 }
 
-=head2 reference_to_data
+=head2 show_help_specific_search
 
-provides a saner output format for models than MyApp::Model::Foo=HASH(0x1800568)
+Explains /=/search/ a bit more in-depth.
 
 =cut
 
-sub reference_to_data {
-    my $obj = shift;
-    my ($model) = map { s/::/./g; $_ } ref($obj);
-    return { jifty_model_reference => 1, id => $obj->id, model => $model };
-}
-
-=head2 object_to_data OBJ
+sub show_help_specific_search {
+    return << 'SEARCH';
+This interface supports searching arbitrary columns and values. For example, if
+you're looking at a Task with due date 1999-12-25 and complete, you can use:
 
-Takes an object and converts the known types into simple data structures.
+    /=/search/Task/due/1999-12-25/complete/1
 
-Current known types:
+If you're looking for just the summaries of these tasks, you can use:
 
-  Jifty::DBI::Collection
-  Jifty::DBI::Record
-  Jifty::DateTime
+    /=/search/Task/due/1999-12-25/complete/1/summary
 
-=cut
+Any column in the model is eligible for searching. If you specify multiple
+values for the same column, they'll be ORed together. For example, if you're
+looking for Tasks with due dates 1999-12-25 OR 2000-12-25, you can use:
 
-sub object_to_data {
-    my $obj = shift;
-    
-    my %types = (
-        'Jifty::DBI::Collection' => \&_collection_to_data,
-        'Jifty::DBI::Record'     => \&_record_to_data,
-        'Jifty::DateTime'        => \&_datetime_to_data,
-    );
+    /=/search/Task/due/1999-12-25/due/2000-12-25/
 
-    for my $type ( keys %types ) {
-        if ( UNIVERSAL::isa( $obj, $type ) ) {
-            return $types{$type}->( $obj );
-        }
-    }
+There are also some pseudo-columns that affect the results, but are not columns
+that are searched:
 
-    # As the last resort, return the object itself and expect the $accept-specific
-    # renderer to format the object as e.g. YAML or JSON data.
-    return $obj;
-}
+    .../__order_by/<column>
+    .../__order_by_asc/<column>
+    .../__order_by_desc/<column>
 
-sub _collection_to_data {
-    my $records = shift->items_array_ref;
-    return [ map { _record_to_data( $_ ) } @$records ];
-}
+These let you change the output order of the results. Multiple '__order_by's
+will be respected.
 
-sub _record_to_data {
-    my $record = shift;
-    # We could use ->as_hash but this method avoids transforming refers_to
-    # columns into JDBI objects
+    .../__page/<number>
+    .../__per_page/<number>
 
-    # XXX: maybe just test ->virtual?
-    my %data   = map {
-                    $_ => (UNIVERSAL::isa( $record->column( $_ )->refers_to,
-                                           'Jifty::DBI::Collection' ) ||
-                           $record->column($_)->container
-                             ? undef
-                             : stringify( $record->_value( $_ ) ) )
-                 } $record->readable_attributes;
-    return \%data;
+These let you control how many results you'll get.
+SEARCH
 }
 
-sub _datetime_to_data {
-    my $dt = shift;
+=head2 show_version
 
-    # if it looks like just a date, then return just the date portion
-    return $dt->ymd
-        if lc($dt->time_zone->name) eq 'floating'
-        && $dt->hms('') eq '000000';
-
-    # otherwise let stringification take care of it
-    return $dt;
-}
-
-=head2 recurse_object_to_data REF
-
-Takes a reference, and calls C<object_to_data> on it if that is
-meaningful.  If it is an arrayref, or recurses on each element.  If it
-is a hashref, recurses on each value.  Returns the new datastructure.
+Displays versions of the various bits of your application.
 
 =cut
 
-sub recurse_object_to_data {
-    my $o = shift;
-    return $o unless ref $o;
-
-    my $updated = object_to_data($o);
-    if ($o ne $updated) {
-        return $updated;
-    } elsif (ref $o eq "ARRAY") {
-        my @a = map {recurse_object_to_data($_)} @{$o};
-        return \@a;
-    } elsif (ref $o eq "HASH") {
-        my %h;
-        $h{$_} = recurse_object_to_data($o->{$_}) for keys %{$o};
-        return \%h;
-    } else {
-        return $o;
-    }
+sub show_version {
+    outs(['version'], {
+        Jifty => $Jifty::VERSION,
+        REST  => $Jifty::Plugin::REST::VERSION,
+    });
 }
 
-
 =head2 list PREFIX items
 
 Takes a URL prefix and a set of items to render. passes them on.
@@ -266,16 +215,11 @@
     elsif ($accept =~ /json/i) {
         $apache->header_out('Content-Type' => 'application/json; charset=UTF-8');
         $apache->send_http_header;
-        print Jifty::JSON::objToJson( @_, { singlequote => 1 } );
+        print Jifty::JSON::objToJson( @_ );
     }
     elsif ($accept =~ /j(?:ava)?s|ecmascript/i) {
         $apache->header_out('Content-Type' => 'application/javascript; charset=UTF-8');
         $apache->send_http_header;
-	# XXX: temporary hack to fix _() that aren't respected by json dumper
-	for (values %{$_[0]}) {
-	    $_->{label} = "$_->{label}" if exists $_->{label} && defined ref $_->{label};
-	    $_->{hints} = "$_->{hints}" if exists $_->{hints} && defined ref $_->{hints};
-	}
         print 'var $_ = ', Jifty::JSON::objToJson( @_, { singlequote => 1 } );
     }
     elsif ($accept =~ qr{^(?:application/x-)?(?:perl|pl)$}i) {
@@ -378,17 +322,33 @@
 sub html_dump {
     my $content = shift;
     if (ref($content) eq 'ARRAY') {
-        ul(map {
-            li(html_dump($_))
-        } @{$content});
+        if (@$content) {
+            return ul(map {
+                li(html_dump($_))
+            } @{$content});
+        }
+        else {
+            return;
+        }
     }
     elsif (ref($content) eq 'HASH') {
-        dl(map {
-            dt(Jifty::Web->escape($_)),
-            dd(html_dump($content->{$_})),
-        } sort keys %{$content}),
+        if (keys %$content) {
+            return dl(map {
+                dt(Jifty::Web->escape($_)),
+                dd(html_dump($content->{$_})),
+            } sort keys %{$content});
+        }
+        else {
+            return;
+        }
+    
     } elsif (ref($content) && $content->isa('Jifty::Collection')) {
-        return  ol( map { li( html_dump_record($_))  } @{$content->items_array_ref});
+        if ($content->count) {
+            return  ol( map { li( html_dump_record($_))  } @{$content->items_array_ref});
+        }
+        else {
+            return;
+        }
         
     } elsif (ref($content) && $content->isa('Jifty::Record')) {
           return   html_dump_record($content);
@@ -419,7 +379,7 @@
 =cut
 
 
-sub action {  _resolve($_[0], 'Jifty::Action', Jifty->api->actions) }
+sub action {  _resolve($_[0], 'Jifty::Action', Jifty->api->visible_actions) }
 
 =head2 model MODEL
 
@@ -427,17 +387,20 @@
 
 =cut
 
-sub model  { _resolve($_[0], 'Jifty::Record', Jifty->class_loader->models) }
+sub model  { _resolve($_[0], 'Jifty::Record', grep {not $_->is_private} Jifty->class_loader->models) }
 
 sub _resolve {
     my $name = shift;
     my $base = shift;
-    return $name if $name->isa($base);
 
-    $name =~ s/\W+/\\W+/g;
+    # we display actions as "AppName.Action.Foo", so we want to convert those
+    # heathen names to be Perl-style
+    $name =~ s/\./::/g;
+
+    my $re = qr/(?:^|::)\Q$name\E$/i;
 
     foreach my $cls (@_) {
-        return $cls if $cls =~ /$name$/i;
+        return $cls if $cls =~ $re && $cls->isa($base);
     }
 
     abort(404);
@@ -451,11 +414,18 @@
 =cut
 
 sub list_models {
-    list(['model'], map { s/::/./g; $_ } Jifty->class_loader->models);
+    list(['model'], map { s/::/./g; $_ } grep {not $_->is_private} Jifty->class_loader->models);
 }
 
+=head2 valid_column
+
+Returns true if the column is a valid column to observe on the model
+
+=cut
+
 our @column_attrs = 
 qw( name
+    documentation
     type
     default
     readable writable
@@ -470,6 +440,10 @@
     valid_values
 );
 
+sub valid_column {
+    my ( $model, $column ) = @_;
+    return scalar grep { $_->name eq $column and not $_->virtual and not $_->private } $model->new->columns;
+}
 
 =head2 list_model_columns
 
@@ -483,12 +457,14 @@
 
     my %cols;
     for my $col ( $model->new->columns ) {
+        next if $col->private or $col->virtual;
         $cols{ $col->name } = { };
         for ( @column_attrs ) {
             my $val = $col->$_();
-            $cols{ $col->name }->{ $_ } = $val
+            $cols{ $col->name }->{ $_ } = Scalar::Defer::force($val)
                 if defined $val and length $val;
         }
+        $cols{ $col->name }{writable} = 0 if exists $cols{$col->name}{writable} and $col->protected;
     }
 
     outs( [ 'model', $model ], \%cols );
@@ -507,12 +483,16 @@
     my $col = $model->new->collection_class->new;
     $col->unlimit;
 
+    # Check that the field is actually a column
+    abort(404) unless valid_column($model, $column);
+
     # If we don't load the PK, we won't get data
     $col->columns("id", $column);
     $col->order_by( column => $column );
 
     list( [ 'model', $model, $column ],
-        map { stringify($_->$column()) } @{ $col->items_array_ref || [] } );
+        map { Jifty::Util->stringify($_->$column()) }
+            @{ $col->items_array_ref || [] } );
 }
 
 
@@ -531,9 +511,10 @@
     $rec->can($field) or abort(404);
 
     # Check that the field is actually a column (and not some other method)
-    abort(404) if not scalar grep { $_->name eq $field } $rec->columns;
+    abort(404) unless valid_column($model, $column);
 
-    outs( [ 'model', $model, $column, $key, $field ], stringify($rec->$field()) );
+    outs( [ 'model', $model, $column, $key, $field ],
+          Jifty::Util->stringify($rec->$field()) );
 }
 
 =head2 show_item $model, $column, $key
@@ -547,9 +528,169 @@
 sub show_item {
     my ($model, $column, $key) = (model($1), $2, $3);
     my $rec = $model->new;
+
+    # Check that the field is actually a column
+    abort(404) unless valid_column($model, $column);
+
     $rec->load_by_cols( $column => $key );
     $rec->id or abort(404);
-    outs( ['model', $model, $column, $key],  { map {$_ => stringify($rec->$_())} map {$_->name} $rec->columns});
+    outs( ['model', $model, $column, $key], $rec->jifty_serialize_format );
+}
+
+=head2 search_items $model, [c1, v1, c2, v2, ...] [, $field]
+
+Loads up all models of type C<$model> that match the given columns and values.
+If the column and value list has an odd count, then the last item is taken to
+be the output column. Otherwise, all items will be returned.
+
+Will throw a 404 if there were no matches, or C<$field> was invalid.
+
+Pseudo-columns:
+
+=over 4
+
+=item __per_page => N
+
+Return the collection as N records per page.
+
+=item __page => N
+
+Return page N of the collection
+
+=item __order_by => C<column>
+
+Order by the given column, ascending.
+
+=item __order_by_desc => C<column>
+
+Order by the given column, descending.
+
+=back
+
+=cut
+
+sub search_items {
+    my ($model, $fragment) = (model($1), $2);
+    my @pieces = grep {length} split '/', $fragment;
+    my $ret = ['search', $model, @pieces];
+
+    # if they provided an odd number of pieces, the last is the output column
+    my $field;
+    if (@pieces % 2 == 1) {
+        $field = pop @pieces;
+    }
+
+    # limit to the key => value pairs they gave us
+    my $collection = eval { $model->collection_class->new }
+        or abort(404);
+    $collection->unlimit;
+
+    my $record = $model->new
+        or abort(404);
+
+    my $added_order = 0;
+    my $per_page;
+    my $current_page = 1;
+
+    my %special = (
+        __per_page => sub {
+            my $N = shift;
+
+            # must be a number
+            $N =~ /^\d+$/
+                or abort(404);
+
+            $per_page = $N;
+        },
+        __page => sub {
+            my $N = shift;
+
+            # must be a number
+            $N =~ /^\d+$/
+                or abort(404);
+
+            $current_page = $N;
+        },
+        __order_by => sub {
+            my $col = shift;
+            my $order = shift || 'ASC';
+
+            # this will wipe out the default ordering on your model the first
+            # time around
+            if ($added_order) {
+                $collection->add_order_by(
+                    column => $col,
+                    order  => $order,
+                );
+            }
+            else {
+                $added_order = 1;
+                $collection->order_by(
+                    column => $col,
+                    order  => $order,
+                );
+            }
+        },
+    );
+
+    # this was called __limit before it was generalized
+    $special{__limit} = $special{__per_page};
+
+    # /__order_by/name/desc is impossible to distinguish between ordering by
+    # 'name', descending, and ordering by 'name', with output column 'desc'.
+    # so we use __order_by_desc instead (and __order_by_asc is provided for
+    # consistency)
+    $special{__order_by_asc}  = $special{__order_by};
+    $special{__order_by_desc} = sub { $special{__order_by}->($_[0], 'DESC') };
+
+    while (@pieces) {
+        my $column = shift @pieces;
+        my $value  = shift @pieces;
+
+        if (exists $special{$column}) {
+            $special{$column}->($value);
+        }
+        else {
+            my $canonicalizer = "canonicalize_$column";
+            $value = $record->$canonicalizer($value)
+                if $record->can($canonicalizer);
+
+            $collection->limit(column => $column, value => $value);
+        }
+    }
+
+    if (defined($per_page) || defined($current_page)) {
+        $per_page = 15 unless defined $per_page;
+        $current_page = 1 unless defined $current_page;
+        $collection->set_page_info(
+            current_page => $current_page,
+            per_page     => $per_page,
+        );
+    }
+
+    $collection->count                       or return outs($ret, []);
+    $collection->pager->entries_on_this_page or return outs($ret, []);
+
+    # output
+    if (defined $field) {
+        my $item = $collection->first
+            or return outs($ret, []);
+
+        # Check that the field is actually a column
+        abort(404) unless valid_column($model, $field);
+
+        my @values;
+
+        # collect the values for $field
+        do {
+            push @values, $item->$field;
+        } while $item = $collection->next;
+
+        outs($ret, \@values);
+    }
+    else {
+        outs($ret, $collection->jifty_serialize_format);
+    }
 }
 
 =head2 create_item
@@ -630,12 +771,12 @@
 
 =head2 list_actions
 
-Returns a list of all actions allowed to the current user. (Canonicalizes Perl::Style to Everything.Else.Style).
+Returns a list of all actions visible to the current user. (Canonicalizes Perl::Style to Everything.Else.Style).
 
 =cut
 
 sub list_actions {
-    list(['action'], map {s/::/./g; $_} Jifty->api->actions);
+    list(['action'], map {s/::/./g; $_} Jifty->api->visible_actions);
 }
 
 =head2 list_action_params
@@ -648,6 +789,7 @@
 
 our @param_attrs = qw(
     name
+    documentation
     type
     default_value
     label
@@ -753,24 +895,8 @@
         } 'model', ref($rec), 'id', $rec->id);
         Jifty->handler->apache->header_out('Location' => $url);
     }
-    
-    my $result = $action->result;
 
-    my $out = {};
-    $out->{success} = $result->success;
-    $out->{message} = $result->message;
-    $out->{error} = $result->error;
-    $out->{field_errors} = {$result->field_errors};
-    for (keys %{$out->{field_errors}}) {
-        delete $out->{field_errors}->{$_} unless $out->{field_errors}->{$_};
-    }
-    $out->{field_warnings} = {$result->field_warnings};
-    for (keys %{$out->{field_warnings}}) {
-        delete $out->{field_warnings}->{$_} unless $out->{field_warnings}->{$_};
-    }
-    $out->{content} = recurse_object_to_data($result->content);
-    
-    outs(undef, $out);
+    outs(undef, $action->result->as_hash);
 
     last_rule;
 }

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Recorder.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Recorder.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Recorder.pm	Thu Feb 14 14:59:21 2008
@@ -2,11 +2,11 @@
 use strict;
 use warnings;
 use base qw/Jifty::Plugin Class::Data::Inheritable/;
-__PACKAGE__->mk_accessors(qw/start path loghandle/);
+__PACKAGE__->mk_accessors(qw/start path loghandle logged_request memory_usage/);
 
 use Time::HiRes 'time';
-use YAML;
 use Jifty::Util;
+use Storable 'nfreeze';
 
 our $VERSION = 0.01;
 
@@ -21,23 +21,29 @@
     my $self = shift;
     my %args = (
         path => 'log/requests',
+        memory_usage => 0,
         @_,
     );
 
     return if $self->_pre_init;
 
     $self->start(time);
-    $self->path($args{path});
-    Jifty::Util->make_path($args{path});
 
-    $self->loghandle($self->get_loghandle);
-
-    # if creating the loghandle failed, then we may as well not bother :)
-    if ($self->loghandle) {
-        Jifty::Handler->add_trigger(
-            before_request => sub { $self->before_request(@_) }
-        );
+    $self->memory_usage($args{memory_usage});
+    if ($args{memory_usage}) {
+        require Proc::ProcessTable;
     }
+
+    $self->path(Jifty::Util->absolute_path( $args{path} ));
+    Jifty::Util->make_path($self->path);
+
+    Jifty::Handler->add_trigger(
+        before_request => sub { $self->before_request(@_) }
+    );
+
+    Jifty::Handler->add_trigger(
+        before_cleanup => sub { $self->before_cleanup }
+    );
 }
 
 =head2 before_request
@@ -52,14 +58,59 @@
     my $handler = shift;
     my $cgi     = shift;
 
-    my $delta = time - $self->start;
-    my $request = { cgi => $cgi, ENV => \%ENV, time => $delta };
-    my $yaml = YAML::Dump($request);
+    $self->logged_request(0);
+
+    eval {
+        my $delta = time - $self->start;
+        my $request = { cgi => nfreeze($cgi), ENV => \%ENV, time => $delta };
+        my $yaml = Jifty::YAML::Dump($request);
+
+        print { $self->get_loghandle } $yaml;
+        $self->logged_request(1);
+    };
 
-    eval { print { $self->loghandle } $yaml };
     Jifty->log->error("Unable to append to request log: $@") if $@;
 }
 
+=head2 before_cleanup
+
+Append the current user to the request log. This isn't done in one fell swoop
+because if the server explodes during a request, we would lose the request's
+data for logging.
+
+This, strictly speaking, isn't necessary. But we don't always want to lug the
+sessions table around, so this gets us most of the way there.
+
+C<logged_request> is checked to ensure that we don't append the current
+user if the current request couldn't be logged for whatever reason (perhaps
+a serialization error?).
+
+=cut
+
+sub before_cleanup {
+    my $self = shift;
+
+    if ($self->logged_request) {
+        eval {
+            print { $self->get_loghandle } "current_user: " . (Jifty->web->current_user->id || 0) . "\n";
+
+            # get memory usage. yes, we really do need to go through these
+            # motions every request :(
+            if ($self->memory_usage) {
+                my $proc = Proc::ProcessTable->new;
+                for (@{ $proc->table }) {
+                    next unless $_->pid == $$;
+
+                    print { $self->get_loghandle } "memory: " . ($_->size||'?') . "\n";
+                    return;
+                }
+
+                Jifty->log->error("Unable to find myself, pid $$, in Proc::ProcessTable.");
+            }
+        };
+    }
+}
+
 =head2 get_loghandle
 
 Creates the loghandle. The created file is named C<PATH/BOOTTIME-PID.log>.
@@ -71,19 +122,23 @@
 sub get_loghandle {
     my $self = shift;
 
-    my $name = sprintf '%s/%d-%d.log',
-                $self->path,
-                $self->start,
-                $$;
-
-    open my $loghandle, '>', $name or do {
-        Jifty->log->error("Unable to open $name for writing: $!");
-        return;
-    };
+    unless ($self->loghandle) {
+        my $name = sprintf '%s/%d-%d.log',
+                    $self->path,
+                    $self->start,
+                    $$;
+
+        open my $loghandle, '>', $name or do {
+            Jifty->log->error("Unable to open $name for writing: $!");
+            return;
+        };
+        $loghandle->autoflush(1);
 
-    Jifty->log->info("Logging all HTTP requests to $name.");
+        Jifty->log->info("Logging all HTTP requests to $name.");
+        $self->loghandle($loghandle);
+    }
 
-    return $loghandle;
+    return $self->loghandle;
 }
 
 =head1 NAME
@@ -113,6 +168,11 @@
 The path for creating request logs. Default: log/requests. This directory will
 be created for you, if necessary.
 
+=item memory_usage
+
+Report how much memory (in bytes) Jifty is taking up. This uses
+L<Proc::ProcessTable>. Default is off.
+
 =back
 
 =head1 SEE ALSO

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/Recorder/Command/Playback.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/Recorder/Command/Playback.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/Recorder/Command/Playback.pm	Thu Feb 14 14:59:21 2008
@@ -10,6 +10,7 @@
 
 use base qw/App::CLI::Command/;
 use Time::HiRes 'sleep';
+use Storable 'thaw';
 
 our $start = time; # for naming log files
 our $path = 'log/playback';
@@ -168,6 +169,8 @@
                         $set_num,
                         $req_num;
 
+        $request->{cgi} = thaw($request->{cgi});
+
         $self->play_request($request, $filename);
     }
 }

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/SQLQueries.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/SQLQueries.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,228 @@
+#!/usr/bin/env perl
+package Jifty::Plugin::SQLQueries;
+use base qw/Jifty::Plugin/;
+use strict;
+use warnings;
+
+our @requests;
+our @slow_queries;
+our @halo_queries;
+
+=head1 NAME
+
+Jifty::Plugin::SQLQueries
+
+=head1 DESCRIPTION
+
+SQL query logging and reporting for your Jifty app
+
+=head1 USAGE
+
+Add the following to your site_config.yml
+
+ framework:
+   Plugins:
+     - SQLQueries: {}
+
+This makes the following URLs available:
+
+View the top-level query report (how many queries each request had)
+
+    http://your.app/__jifty/admin/queries
+
+View the top-level query report, including zero-query requests
+
+    http://your.app/__jifty/admin/queries/all
+
+View an individual request's detailed query report (which queries were made,
+where, how long they took, etc)
+
+    http://your.app/__jifty/admin/queries/3
+
+=head2 init
+
+This makes sure that each request is wrapped with query logging.
+
+=cut
+
+sub init {
+    my $self = shift;
+    return if $self->_pre_init;
+
+    Jifty->add_trigger(
+        post_init => \&post_init
+    );
+
+    Jifty::Handler->add_trigger(
+        before_request => \&before_request
+    );
+
+    Jifty::Handler->add_trigger(
+        after_request  => \&after_request
+    );
+}
+
+=head2 post_init
+
+This sets up L<Jifty::DBI>'s query logging, and is called at the end of
+C<< Jifty->new >>
+
+=cut
+
+sub post_init {
+    Jifty->handle or return;
+
+    require Carp;
+
+    Jifty->handle->log_sql_statements(1);
+    Jifty->handle->log_sql_hook(SQLQueryPlugin => sub {
+        my ($time, $statement, $bindings, $duration) = @_;
+        Jifty->log->debug(sprintf 'Query (%.3fs): "%s", with bindings: %s',
+                            $duration,
+                            $statement,
+                            join ', ', @$bindings);
+        return Carp::longmess;
+    });
+}
+
+=head2 before_request
+
+Clears the SQL log so you only get the request's queries
+
+=cut
+
+sub before_request {
+    Jifty->handle or return;
+}
+
+=head2 after_request
+
+Logs the queries made (at level DEBUG)
+
+=cut
+
+sub after_request {
+    Jifty->handle or return;
+
+    my $handler = shift;
+    my $cgi = shift;
+
+    my $total_time = 0;
+    my @log = ((splice @halo_queries), Jifty->handle->sql_statement_log());
+    Jifty->handle->clear_sql_statement_log();
+
+    for (@log) {
+        my ($time, $statement, $bindings, $duration, $results) = @$_;
+
+        $total_time += $duration;
+
+        # keep track of the ten slowest queries so far
+        if (@slow_queries < 10 || $duration > $slow_queries[0][3]) {
+            push @slow_queries, $_;
+            @slow_queries = sort { $a->[3] <=> $b->[3] } @slow_queries;
+            shift @slow_queries if @slow_queries > 9;
+        }
+    }
+
+    push @requests, {
+        id => 1 + @requests,
+        duration => $total_time,
+        url => $cgi->url(-absolute=>1,-path_info=>1),
+        time => scalar gmtime,
+        queries => \@log,
+    };
+}
+
+=head2 halo_pre_template
+
+Log any queries made to the previous template. Also, keep track of whatever
+queries made so the rest of the plugin can see them (since we clear the log)
+
+=cut
+
+sub halo_pre_template {
+    my $self = shift;
+    my $halo = shift;
+    my %args = @_;
+
+    push @{ $args{previous}{sql_statements} }, Jifty->handle->sql_statement_log;
+    push @halo_queries, Jifty->handle->sql_statement_log;
+
+    Jifty->handle->clear_sql_statement_log;
+
+    $args{frame}{displays}{Q} = {
+        name => "queries",
+        callback => sub {
+            my $frame = shift;
+            my @queries;
+
+            for (@{ $frame->{sql_statements} || [] }) {
+                my $bindings;
+
+                if (@{$_->[2]}) {
+                    my @bindings = map {
+                        defined $_
+                            ? $_ =~ /[^[:space:][:graph:]]/
+                                ? "*BLOB*"
+                                : Jifty->web->escape($_)
+                            : "undef"
+                    } @{$_->[2]};
+
+                    $bindings = join '',
+                        "<b>",
+                        _('Bindings'),
+                        ":</b> <tt>",
+                        join(', ', @bindings),
+                        "</tt><br />",
+                }
+
+                push @queries, join "\n",
+                    qq{<span class="fixed">},
+                    Jifty->web->escape($_->[1]),
+                    qq{</span><br />},
+                    defined($bindings) ? $bindings : '',
+                    "<i>". _('%1 seconds', $_->[3]) ."</i>",
+            }
+
+            return undef if @queries == 0;
+
+            return "<ol>"
+                 . join("\n",
+                        map { "<li>$_</li>" }
+                        @queries)
+                 . "</ol>";
+        },
+    };
+}
+
+=head2 halo_post_template
+
+Log any queries made to the current template. Also, keep track of whatever
+queries made so the rest of the plugin can see them (since we clear the log)
+
+XXX: can this somehow be refactored into one function? If the same pattern
+occurs elsewhere I'll look into it.
+
+=cut
+
+sub halo_post_template {
+    my $self = shift;
+    my $halo = shift;
+    my %args = @_;
+
+    push @{ $args{frame}{sql_statements} }, Jifty->handle->sql_statement_log;
+    push @halo_queries, Jifty->handle->sql_statement_log;
+
+    Jifty->handle->clear_sql_statement_log;
+}
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007 Best Practical Solutions
+
+This is free software and may be modified and distributed under the same terms as Perl itself.
+
+=cut
+
+1;
+

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/SQLQueries/Dispatcher.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/SQLQueries/Dispatcher.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,48 @@
+package Jifty::Plugin::SQLQueries::Dispatcher;
+use warnings;
+use strict;
+
+use Jifty::Dispatcher -base;
+
+# http://your.app/queries -- display full query report
+on '/__jifty/admin/queries' => run {
+    set 'skip_zero' => 1;
+    show "/__jifty/admin/queries/all";
+};
+
+# http://your.app/queries/all -- full query report with non-query requests
+on '/__jifty/admin/queries/all' => run {
+    set 'skip_zero' => 0;
+    show "/__jifty/admin/queries/all";
+};
+
+# http://your.app/queries/clear -- clear query log
+on '/__jifty/admin/queries/clear' => run {
+    @Jifty::Plugin::SQLQueries::requests = ();
+    set 'skip_zero' => 1;
+    redirect "/__jifty/admin/queries";
+};
+
+# http://your.app/queries/xxx -- display query report for request ID xxx
+on '/__jifty/admin/queries/#' => run {
+    abort(404) if $1 < 1;
+    my $query = $Jifty::Plugin::SQLQueries::requests[$1 - 1]
+        or abort(404);
+    set query => $query;
+    show "/__jifty/admin/queries/one";
+};
+
+=head1 SEE ALSO
+
+L<Jifty::Plugin::SQLQueries>, L<Jifty::Plugin::SQLQueries::View>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007 Best Practical Solutions
+
+This is free software and may be modified and distributed under the same terms as Perl itself.
+
+=cut
+
+1;
+

Added: jifty/branches/virtual-models/lib/Jifty/Plugin/SQLQueries/View.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/SQLQueries/View.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,149 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::SQLQueries::View;
+use Jifty::View::Declare -base;
+use Scalar::Util 'blessed';
+
+=head1 NAME
+
+Jifty::Plugin::SQLQueries::View - Views for database queries
+
+=head1 TEMPLATES
+
+=cut
+
+template '/__jifty/admin/queries/all' => page {
+    my $skip_zero = get 'skip_zero';
+
+    h1 { "Queries" }
+    p {
+        if ($skip_zero) {
+            a { attr { href => "/__jifty/admin/queries/all" }
+                "Show zero-query requests" }
+        }
+        else {
+            a { attr { href => "/__jifty/admin/queries" }
+                "Hide zero-query requests" }
+        }
+        a { attr { href => "/__jifty/admin/queries/clear" }
+            "Clear query log" }
+    }
+    hr {}
+
+    h3 { "Slowest queries" };
+    table {
+        row {
+            th { "Time taken" };
+            th { "Query" };
+        };
+
+        for (reverse @Jifty::Plugin::SQLQueries::slow_queries)
+        {
+            my ($time, $statement, $bindings, $duration, $misc) = @$_;
+            row {
+                cell { $duration };
+                cell { $statement };
+            };
+        }
+    };
+
+    hr {};
+
+    h3 { "All queries" };
+    table {
+        row {
+            th { "ID" }
+            th { "Queries" }
+            th { "Time taken" }
+            th { "URL" }
+        };
+
+        for (@Jifty::Plugin::SQLQueries::requests)
+        {
+            next if $skip_zero && @{ $_->{queries} } == 0;
+
+            row {
+                cell { a {
+                    attr { href => "/__jifty/admin/queries/$_->{id}" }
+                    $_->{id} } }
+
+                cell { scalar @{ $_->{queries} } }
+                cell { $_->{duration} }
+                cell { $_->{url} }
+            };
+        }
+    }
+};
+
+template '/__jifty/admin/queries/one' => page {
+    my $query = get 'query';
+
+    h1 { "Queries from Request $query->{id}" }
+    ul {
+        li { "URL: $query->{url}" }
+        li { "At: " . $query->{time} }
+        li { "Time taken: $query->{duration}" }
+        li { "Queries made: " . @{ $query->{queries} } }
+    }
+    p { a { attr { href => "/__jifty/admin/queries" }
+            "Table of Contents" } };
+
+    for ( @{ $query->{queries} } ) {
+        hr {};
+        set query => $_;
+        show '/__jifty/admin/queries/query';
+    }
+};
+
+template '/__jifty/admin/queries/query' => sub {
+    my ($time, $statement, $bindings, $duration, $misc) = @{ get 'query' };
+
+    h4 { pre { $statement } };
+    ul {
+        li { "At: " . gmtime($time) };
+        li { "Time taken: $duration" };
+    }
+    h5 { "Bindings:" }
+    ol {
+        li { $_ } for @$bindings;
+    }
+
+    my $more = Jifty->web->serial;
+    div {
+        attr {
+            class => "extra",
+            style => "display: none;",
+            id    => $more,
+        };
+        h5 { "Stack trace:" }
+        pre {
+            $misc->{SQLQueryPlugin};
+        }
+    }
+
+    div {
+        a {
+            attr {
+                href => "#",
+                onclick => "Effect.toggle(\$('$more'),'blind'); this.innerHTML = this.innerHTML == 'more...' ? 'less...' : 'more...'; return false;",
+            };
+            "more..."
+        }
+    }
+};
+
+=head1 SEE ALSO
+
+L<Jifty::Plugin::SQLQueries>, L<Jifty::Plugin::SQLQueries::Dispatcher>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007 Best Practical Solutions
+
+This is free software and may be modified and distributed under the same terms as Perl itself.
+
+=cut
+
+1;
+

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/SinglePage.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/SinglePage.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/SinglePage.pm	Thu Feb 14 14:59:21 2008
@@ -54,6 +54,7 @@
 sub _sp_link {
     my $self = shift;
     return sub {
+        return if Jifty->web->temporary_current_user;
         my ( $clickable, $args ) = @_;
         my $url = $args->{'url'};
         if ( $url && $url !~ m/^#/ && $url !~ m{^https?://} && $url !~ m{^javascript:} ) {

Modified: jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/View.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/View.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Plugin/SkeletonApp/View.pm	Thu Feb 14 14:59:21 2008
@@ -69,7 +69,7 @@
 
 private template 'keybindings' => sub {
     div { id is "keybindings";
-      outs_raw('<script type="text/javascript"><!-- Jifty.KeyBindings.reset() --></script>') };
+      outs_raw('<script type="text/javascript">Jifty.KeyBindings.reset()</script>') };
 };
 
 #template 'index.html' => page { { title is _('Welcome to your new Jifty application') } img { src is "/static/images/pony.jpg", alt is _( 'You said you wanted a pony. (Source %1)', 'http://hdl.loc.gov/loc.pnp/cph.3c13461'); }; };

Modified: jifty/branches/virtual-models/lib/Jifty/Record.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Record.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Record.pm	Thu Feb 14 14:59:21 2008
@@ -472,11 +472,13 @@
         # Otherwise, no instruction from the handlers, move along...
     }
 
-    # Abort! Return false for safety
+    # Abort! Return false for safety if the hook exploded
     else {
         return 0;
     }
 
+
+    Carp::confess unless ( $self->current_user );
     if (   $self->current_user->is_bootstrap_user
         or $self->current_user->is_superuser )
     {
@@ -878,4 +880,80 @@
     }
 }
 
+=head2 jifty_serialize_format
+
+This is used to create a hash reference of the object's values. Unlike
+Jifty::DBI::Record->as_hash, this won't transform refers_to columns into JDBI
+objects
+
+=cut
+
+sub jifty_serialize_format {
+    my $record = shift;
+    my %data;
+
+    # XXX: maybe just test ->virtual?
+    for ($record->readable_attributes) {
+        next if UNIVERSAL::isa($record->column($_)->refers_to,
+                               'Jifty::DBI::Collection');
+        next if $record->column($_)->container;
+
+        $data{$_} = Jifty::Util->stringify($record->_value($_));
+    }
+
+    return \%data;
+}
+
+=head2 autogenerate_action
+
+Controls which of the L<Jifty::Action::Record> subclasses are
+automatically set up for this model; this subroutine is passed one of
+the strings C<Create>, C<Update>, C<Delete> or C<Search>, and should
+return a true value if that action should be autogenerated.
+
+The default method returns 0 for all action classes if the model is
+marked as L</is_private>.  It returns 0 for all actions that are not
+C<Search> if the model is marked as L</is_protected>; otherwise, it
+returns true.
+
+=cut
+
+sub autogenerate_action {
+    my $class = shift;
+    my($action) = @_;
+
+    return 0 if $class->is_private;
+    return 0 if $class->is_protected and $action ne "Search";
+
+    return 1;
+}
+
+=head2 is_private
+
+Override this method to return true to not generate any actions for
+this model, and to hide it from REST introspection.
+
+=cut
+
+sub is_private { 0 }
+
+=head2 is_protected
+
+Override this method to return true to only generate Search actions
+for this model.
+
+=cut
+
+sub is_protected { return shift->is_private }
+
+=head2 enumerable
+
+Controls whether atogenerated actions with columns that refer to this
+class should attempt to provide a drop-down of possible values or not.
+This method will be called as a class method, and defaults to true.
+
+=cut
+
+sub enumerable { 1 }
+
 1;

Modified: jifty/branches/virtual-models/lib/Jifty/Request.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Request.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Request.pm	Thu Feb 14 14:59:21 2008
@@ -4,7 +4,7 @@
 package Jifty::Request;
 
 use base qw/Jifty::Object Class::Accessor::Fast/;
-__PACKAGE__->mk_accessors(qw(_top_request arguments just_validating path continuation_id continuation_type continuation_path));
+__PACKAGE__->mk_accessors(qw(_top_request arguments template_arguments just_validating path continuation_id continuation_type continuation_path));
 
 use Jifty::JSON;
 use Jifty::YAML;
@@ -80,6 +80,7 @@
     $self->{'state_variables'} = {};
     $self->{'fragments'} = {};
     $self->arguments({});
+    $self->template_arguments({});
 
     my %args = @_;
     for (keys %args) {
@@ -359,6 +360,28 @@
     $val;
 }
 
+=head2 template_argument KEY [=> VALUE]
+
+Sets an argument for the current template.  Template arguments, unlike
+values set via L</argument>, B<cannot> add actions, change action
+argument, or change state variables.  They are also not stored in
+continuations.
+
+=cut
+
+sub template_argument {
+    my $self = shift;
+
+    my $key = shift;
+    $self->template_arguments({}) unless $self->template_arguments;
+    if (@_) {
+        my $value = shift;
+        $self->template_arguments->{$key} = $value;
+    }
+    defined(my $val = $self->template_arguments->{$key}) or return undef;
+    $val;
+}
+
 =head2 delete KEY
 
 Removes the argument supplied -- this is the opposite of L</argument>,
@@ -370,6 +393,11 @@
     my $self = shift;
 
     my $key = shift;
+    $self->template_arguments({}) unless $self->template_arguments;
+    if (exists $self->template_arguments->{$key}) {
+        delete $self->template_arguments->{$key};
+        return;
+    }
     delete $self->arguments->{$key};
     if ($key =~ /^J:A-(?:(\d+)-)?(.+)/s) {
         $self->remove_action($2);
@@ -532,6 +560,10 @@
     # continuation" into the continuation!
     $self->continuation_path(undef);
 
+    # Clear out the (locally-set) template arguments, which would
+    # bloat the continuation, and can be entirely re-generated.
+    $self->template_arguments({});
+
     my $c = Jifty::Continuation->new(
         request  => $self,
         response => Jifty->web->response,

Modified: jifty/branches/virtual-models/lib/Jifty/Result.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Result.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Result.pm	Thu Feb 14 14:59:21 2008
@@ -53,7 +53,8 @@
 
 sub success {
     my $self = shift;
-    return not $self->failure(map {not $_} @_);
+    return 0 if $self->failure(map {not $_} @_);
+    return 1;
 }
 
 =head2 action_class [MESSAGE]
@@ -179,4 +180,69 @@
     return $self->_content->{$key};
 }
 
+=head2 as_hash
+
+This returns the results as a hash to be given directly to the end user
+(usually via REST or webservices). The difference between
+C<< $result->as_hash >> and C<%$result> is that the latter will expand
+everything as deeply as possible. The former won't inflate C<refers_to>
+columns, among other things.
+
+=cut
+
+sub as_hash {
+    my $self = shift;
+
+    my $out = {
+        success        => $self->success,
+        failure        => $self->failure,
+        action_class   => $self->action_class,
+        message        => $self->message,
+        error          => $self->error,
+        field_errors   => { $self->field_errors },
+        field_warnings => { $self->field_warnings },
+        content        => $self->_recurse_object_to_data($self->content),
+    };
+
+    for (keys %{$out->{field_errors}}) {
+        delete $out->{field_errors}->{$_} unless $out->{field_errors}->{$_};
+    }
+    for (keys %{$out->{field_warnings}}) {
+        delete $out->{field_warnings}->{$_} unless $out->{field_warnings}->{$_};
+    }
+
+    return $out;
+}
+
+sub _recurse_object_to_data {
+    my $self = shift;
+    my $o = shift;
+
+    return $o if !ref($o);
+
+    if (ref($o) eq 'ARRAY') {
+        return [ map { $self->_recurse_object_to_data($_) } @$o ];
+    }
+    elsif (ref($o) eq 'HASH') {
+        my %h;
+        $h{$_} = $self->_recurse_object_to_data($o->{$_}) for keys %$o;
+        return \%h;
+    }
+
+    return $self->_object_to_data($o);
+}
+
+sub _object_to_data {
+    my $self = shift;
+    my $o = shift;
+
+    if ($o->can('jifty_serialize_format')) {
+        return $o->jifty_serialize_format($self);
+    }
+
+    # As the last resort, return the object itself and expect the
+    # $accept-specific renderer to format the object as e.g. YAML or JSON data.
+    return $o;
+}
+
 1;

Modified: jifty/branches/virtual-models/lib/Jifty/Script.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Script.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Script.pm	Thu Feb 14 14:59:21 2008
@@ -2,6 +2,9 @@
 use App::CLI;
 use base qw/App::CLI App::CLI::Command Jifty::Object/;
 
+use Jifty::Everything;
+Jifty::Everything->plugin_commands;
+
 =head1 NAME
 
 Jifty::Script - Base class for all bin/jifty commands
@@ -23,7 +26,7 @@
 
 sub prepare {
     my $self = shift;
-    if ($ARGV[0] =~ /--?h(elp?)/i) {
+    if ($ARGV[0] =~ /--?h(elp)?/i) {
         $ARGV[0] = 'help';
     }
     elsif (!@ARGV) {

Modified: jifty/branches/virtual-models/lib/Jifty/Script/Schema.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Script/Schema.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Script/Schema.pm	Thu Feb 14 14:59:21 2008
@@ -54,7 +54,6 @@
     }
 }
 
-
 =head2 run_upgrades
 
 Take the actions we need in order to bring an existing database up to current.
@@ -63,13 +62,11 @@
 
 sub run_upgrades {
     my $self = shift;
-        $self->upgrade_jifty_tables();
-        $self->upgrade_application_tables();
-        $self->upgrade_plugin_tables();
-
+    $self->upgrade_jifty_tables();
+    $self->upgrade_plugin_tables();
+    $self->upgrade_application_tables();
 }
 
-
 =head2 setup_environment
 
 Sets up a minimal Jifty environment.
@@ -82,7 +79,8 @@
     # Import Jifty
     Jifty::Util->require("Jifty");
     Jifty::Util->require("Jifty::Model::Metadata");
-    Jifty->new( no_handle        => 1, logger_component => 'SchemaTool',) unless Jifty->class_loader;
+    Jifty->new( no_handle => 1, logger_component => 'SchemaTool', )
+        unless Jifty->class_loader;
 }
 
 =head2 schema
@@ -98,7 +96,6 @@
     return $self->{'SCHEMA'};
 }
 
-
 =head2 print_help
 
 Prints out help for the package using pod2usage.
@@ -126,7 +123,7 @@
 =cut
 
 sub probe_database_existence {
-    my $self = shift;
+    my $self      = shift;
     my $no_handle = 0;
     if ( $self->{'create_database'} or $self->{'drop_database'} ) {
         $no_handle = 1;
@@ -134,27 +131,33 @@
 
     # Now try to connect.  We trap expected errors and deal with them.
     eval {
-        Jifty->setup_database_connection( no_handle        => $no_handle, logger_component => 'SchemaTool',);
+        Jifty->setup_database_connection(
+            no_handle        => $no_handle,
+            logger_component => 'SchemaTool',
+        );
     };
+    my $error = $@;
 
-    if ( $@ =~ /doesn't match (application schema|running jifty) version/i ) {
+    if ( $error =~ /doesn't match (application schema|running jifty|running plugin) version/i 
+         or $error =~ /plugin isn't installed in database/i ) {
 
         # We found an out-of-date DB.  Upgrade it
         $self->{setup_tables} = 1;
-    } elsif ( $@ =~ /no version in the database/i ) {
+    } elsif ( $error =~ /no version in the database/i ) {
 
         # No version table.  Assume the DB is empty.
         $self->{create_all_tables} = 1;
-    } elsif ( $@ =~ /database .*? does not exist/i
-        or $@ =~ /unknown database/i ) {
+    } elsif ( $error =~ /database .*? does not exist/i
+        or $error =~ /unknown database/i )
+    {
 
         # No database exists; we'll need to make one and fill it up
         $self->{create_database}   = 1;
         $self->{create_all_tables} = 1;
-    } elsif ($@) {
+    } elsif ($error) {
 
         # Some other unexpected error; rethrow it
-        die $@;
+        die $error;
     }
 
     # Setting up tables requires creating the DB if we just dropped it
@@ -182,8 +185,9 @@
     my $log = Log::Log4perl->get_logger("SchemaTool");
     $log->info("Generating SQL for application @{[Jifty->app_class]}...");
 
-    my $appv = version->new( Jifty->config->framework('Database')->{'Version'} );
-    my $jiftyv = version->new( $Jifty::VERSION  );
+    my $appv
+        = version->new( Jifty->config->framework('Database')->{'Version'} );
+    my $jiftyv = version->new($Jifty::VERSION);
 
     # Start a transaction
     Jifty->handle->begin_transaction;
@@ -191,16 +195,18 @@
     # Bootstrap the UUID table first
     Jifty->handle->bootstrap_uuid_table;
 
-    $self->create_tables_for_models (grep {$_->isa('Jifty::DBI::Record')} $self->schema->models );
+    $self->create_tables_for_models( grep { $_->isa('Jifty::DBI::Record') }
+            $self->schema->models );
 
     # Update the versions in the database
     Jifty::Model::Metadata->store( application_db_version => $appv );
     Jifty::Model::Metadata->store( jifty_db_version       => $jiftyv );
 
     # For each plugin, update the plugin version
-    for my $plugin (Jifty->plugins) {
+    for my $plugin ( Jifty->plugins ) {
         my $pluginv = version->new( $plugin->version );
-        Jifty::Model::Metadata->store( (ref $plugin).'_db_version' => $pluginv );
+        Jifty::Model::Metadata->store(
+            ( ref $plugin ) . '_db_version' => $pluginv );
     }
 
     # Load initial data
@@ -210,7 +216,7 @@
         Jifty::Util->require($bootstrapper);
         $bootstrapper->run() if $bootstrapper->can('run');
 
-        for my $plugin (Jifty->plugins) {
+        for my $plugin ( Jifty->plugins ) {
             my $plugin_bootstrapper = $plugin->bootstrapper;
             Jifty::Util->require($plugin_bootstrapper);
             $plugin_bootstrapper->run() if $plugin_bootstrapper->can('run');
@@ -238,42 +244,46 @@
 =cut
 
 sub create_tables_for_models {
-    my $self = shift;
+    my $self   = shift;
     my @models = (@_);
 
     my $log = Log::Log4perl->get_logger("SchemaTool");
-    my $appv = version->new( Jifty->config->framework('Database')->{'Version'} );
-    my $jiftyv = version->new( $Jifty::VERSION  );
+    my $appv
+        = version->new( Jifty->config->framework('Database')->{'Version'} );
+    my $jiftyv = version->new($Jifty::VERSION);
 
     my %pluginvs;
-    for my $plugin (Jifty->plugins) {
+    for my $plugin ( Jifty->plugins ) {
         my $plugin_class = ref $plugin;
-        $pluginvs{ $plugin_class } = version->new( $plugin->version );
+        $pluginvs{$plugin_class} = version->new( $plugin->version );
     }
 
-    MODEL:
-    for my $model ( @models) {
-        my $plugin_root = Jifty->app_class('Plugin').'::';
-
-        # TODO XXX FIXME:
-        #   This *will* try to generate SQL for abstract base classes you might
-        #   stick in $AC::Model::.
-        if ($model->can('since')) {
-            my $app_class   = Jifty->app_class;
+MODEL:
+    for my $model (@models) {
+
+   # Skip autogenerated models; that is, those that are overridden by plugins.
+        next MODEL if Jifty::ClassLoader->autogenerated($model);
+        my $plugin_root = Jifty->app_class('Plugin') . '::';
+
+       # TODO XXX FIXME:
+       #   This *will* try to generate SQL for abstract base classes you might
+       #   stick in $AC::Model::.
+        if ( $model->can('since') ) {
+            my $app_class = Jifty->app_class;
 
             my $installed_version = 0;
 
             # Is it a Jifty core model?
-            if ($model =~ /^Jifty::Model::/) {
+            if ( $model =~ /^Jifty::Model::/ ) {
                 $installed_version = $jiftyv;
             }
 
             # Is it a Jifty or application plugin model?
-            elsif ($model =~ /^(?:Jifty::Plugin::|$plugin_root)/) {
+            elsif ( $model =~ /^(?:Jifty::Plugin::|$plugin_root)/ ) {
                 my $plugin_class = $model;
                 $plugin_class =~ s/::Model::(.*)$//;
 
-                $installed_version = $pluginvs{ $plugin_class };
+                $installed_version = $pluginvs{$plugin_class};
             }
 
             # Otherwise, an application model
@@ -281,30 +291,34 @@
                 $installed_version = $appv;
             }
 
-            if ($installed_version < $model->since) {
-                # XXX Is this message correct? 
-                $log->info("Skipping $model, as it should already be in the database");
+            if ( $installed_version < $model->since ) {
+
+                # XXX Is this message correct?
+                $log->info(
+                    "Skipping $model, as it should already be in the database"
+                );
                 next MODEL;
             }
         }
 
-        if ($model =~ /^(?:Jifty::Plugin::|$plugin_root)/
-                and $model =~ /::Model::(.*)$/) {
+        if (    $model =~ /^(?:Jifty::Plugin::|$plugin_root)/
+            and $model =~ /::Model::(.*)$/ )
+        {
             my $model_name = $1;
 
             # Check to make sure this model is not overridden in the app,
             # in such cases we don't want to try to create the same table
             # twice, so let the app model do it rather than the plugin
-            my $app_model = Jifty->app_class($model_name);
+            my $app_model = Jifty->app_class( "Model", $model_name );
             $app_model->require;
-            next MODEL unless $app_model->can('_autogenerated');
+            next MODEL unless Jifty::ClassLoader->autogenerated($app_model);
         }
 
         $log->info("Using $model, as it appears to be new.");
 
         $self->schema->_check_reserved($model)
-        unless ( $self->{'ignore_reserved'}
-                or !Jifty->config->framework('Database')->{'CheckSchema'} );
+            unless ( $self->{'ignore_reserved'}
+            or !Jifty->config->framework('Database')->{'CheckSchema'} );
 
         if ( $self->{'print'} ) {
             print $model->printable_table_schema;
@@ -324,17 +338,25 @@
     my $self = shift;
     my $dbv  = Jifty::Model::Metadata->load('jifty_db_version');
     unless ($dbv) {
+
         # Backwards combatibility -- it usd to be 'key' not 'data_key';
         eval {
             local $SIG{__WARN__} = sub { };
-            $dbv = Jifty->handle->fetch_result( "SELECT value FROM _jifty_metadata WHERE key = 'jifty_db_version'");
+            $dbv
+                = Jifty->handle->fetch_result(
+                "SELECT value FROM _jifty_metadata WHERE key = 'jifty_db_version'"
+                );
         };
     }
 
-    $dbv = version->new($dbv || '0.60426');
+    $dbv = version->new( $dbv || '0.60426' );
     my $appv = version->new($Jifty::VERSION);
 
-    return unless $self->upgrade_tables( "Jifty" => $dbv, $appv, "Jifty::Upgrade::Internal");
+    return
+        unless $self->upgrade_tables(
+        "Jifty" => $dbv,
+        $appv, "Jifty::Upgrade::Internal"
+        );
     if ( $self->{print} ) {
         warn "Need to upgrade jifty_db_version to $appv here!";
     } else {
@@ -350,8 +372,10 @@
 
 sub upgrade_application_tables {
     my $self = shift;
-    my $dbv  = version->new( Jifty::Model::Metadata->load('application_db_version') );
-    my $appv = version->new( Jifty->config->framework('Database')->{'Version'} );
+    my $dbv  = version->new(
+        Jifty::Model::Metadata->load('application_db_version') );
+    my $appv
+        = version->new( Jifty->config->framework('Database')->{'Version'} );
 
     return unless $self->upgrade_tables( Jifty->app_class, $dbv, $appv );
     if ( $self->{print} ) {
@@ -368,23 +392,28 @@
 =cut
 
 sub upgrade_plugin_tables {
-    my $self   = shift;
+    my $self = shift;
 
-    for my $plugin (Jifty->plugins) {
+    for my $plugin ( Jifty->plugins ) {
         my $plugin_class = ref $plugin;
 
-        my $dbv  = Jifty::Model::Metadata->load($plugin_class . '_db_version');
+        my $dbv
+            = Jifty::Model::Metadata->load( $plugin_class . '_db_version' );
         my $appv = version->new( $plugin->version );
 
         # Upgrade this plugin from dbv -> appv
-        if (defined $dbv) {
-            $dbv = version->new( $dbv );
+        if ( defined $dbv ) {
+            $dbv = version->new($dbv);
 
-            next unless $self->upgrade_tables( $plugin_class, $dbv, $appv, $plugin->upgrade_class );
+            next
+                unless $self->upgrade_tables( $plugin_class, $dbv, $appv,
+                $plugin->upgrade_class );
             if ( $self->{print} ) {
-                warn "Need to upgrade ${plugin_class}_db_version to $appv here!";
+                warn
+                    "Need to upgrade ${plugin_class}_db_version to $appv here!";
             } else {
-                Jifty::Model::Metadata->store( $plugin_class . '_db_version' => $appv );
+                Jifty::Model::Metadata->store(
+                    $plugin_class . '_db_version' => $appv );
             }
         }
 
@@ -396,15 +425,19 @@
 
             # Create the tables
             $self->create_tables_for_models(
-                grep { $_->isa('Jifty::DBI::Record') and /^\Q$plugin_class\E::Model::/ }
-                     $self->schema->models);
-            
+                grep {
+                    $_->isa('Jifty::DBI::Record')
+                        and /^\Q$plugin_class\E::Model::/
+                    } $self->schema->models
+            );
+
             # Save the plugin version to the database
-            Jifty::Model::Metadata->store( $plugin_class . '_db_version' => $appv )
+            Jifty::Model::Metadata->store(
+                $plugin_class . '_db_version' => $appv )
                 unless $self->{print};
 
             # Run the bootstrapper for initial data
-            unless ($self->{print}) {
+            unless ( $self->{print} ) {
                 eval {
                     my $bootstrapper = $plugin->bootstrapper;
                     Jifty::Util->require($bootstrapper);
@@ -412,7 +445,7 @@
                 };
                 die $@ if $@;
             }
-                
+
             # Save them records
             Jifty->handle->commit;
             $log->info("Set up $plugin_class version $appv");
@@ -438,14 +471,16 @@
     # Find current versions
 
     if ( $appv < $dbv ) {
-        print "$baseclass version $appv from module older than $dbv in database!\n";
+        print
+            "$baseclass version $appv from module older than $dbv in database!\n";
         return;
     } elsif ( $appv == $dbv ) {
+
         # Shouldn't happen
         print "$baseclass version $appv up to date.\n";
         return;
     }
-    $log->info( "Generating SQL to upgrade $baseclass $dbv database to $appv" );
+    $log->info("Generating SQL to upgrade $baseclass $dbv database to $appv");
 
     # Figure out what versions the upgrade knows about.
     Jifty::Util->require($upgradeclass) or return;
@@ -453,10 +488,12 @@
     eval {
         $UPGRADES{$_} = [ $upgradeclass->upgrade_to($_) ]
             for grep { $appv >= version->new($_) and $dbv < version->new($_) }
-                     $upgradeclass->versions();
+            $upgradeclass->versions();
     };
 
-    for my $model_class ( grep {/^\Q$baseclass\E::Model::/} $self->schema->models ) {
+    for my $model_class ( grep {/^\Q$baseclass\E::Model::/}
+        $self->schema->models )
+    {
 
         # We don't want to get the Collections, for example.
         next unless $model_class->isa('Jifty::DBI::Record');
@@ -465,19 +502,32 @@
         my $model = $model_class->new;
 
         # If this whole table is new Create it
-        if ($model->can( 'since' ) and defined $model->since and  $appv >= $model->since and $model->since >$dbv ) {
-            unshift @{ $UPGRADES{ $model->since } }, $model->printable_table_schema();
+        if (    $model->can('since')
+            and defined $model->since
+            and $appv >= $model->since
+            and $model->since > $dbv )
+        {
+            unshift @{ $UPGRADES{ $model->since } },
+                $model->printable_table_schema();
         } else {
+
             # Go through the currently-active columns
-            for my $col  (grep {not $_->virtual} $model->columns ) {
+            for my $col ( grep { not $_->virtual } $model->columns ) {
+
                 # If they're new, add them
-                if ($col->can( 'since' ) and defined $col->since and $appv >= $col->since and $col->since >$dbv ) {
+                if (    $col->can('since')
+                    and defined $col->since
+                    and $appv >= $col->since
+                    and $col->since > $dbv )
+                {
                     unshift @{ $UPGRADES{ $col->since } }, sub {
                         my $renamed = $upgradeclass->just_renamed || {};
 
                         # skip it if this was added by a rename
-                        $model->add_column_in_db($col->name)
-                            unless defined $renamed->{ $model->table }->{'add'}->{ $col->name };
+                        $model->add_column_in_db( $col->name )
+                            unless
+                            defined $renamed->{ $model->table }->{'add'}
+                            ->{ $col->name };
                     };
                 }
             }
@@ -488,23 +538,23 @@
         $self->_print_upgrades(%UPGRADES);
 
     } else {
-        eval { 
+        eval {
             $self->_execute_upgrades(%UPGRADES);
             $log->info("Upgraded to version $appv");
-        }; 
+        };
         die $@ if $@;
     }
     return 1;
 }
 
-
-
 sub _execute_upgrades {
     my $self     = shift;
     my %UPGRADES = (@_);
     Jifty->handle->begin_transaction;
     my $log = Log::Log4perl->get_logger("SchemaTool");
-    for my $version ( sort { version->new($a) <=> version->new($b) } keys %UPGRADES) {
+    for my $version ( sort { version->new($a) <=> version->new($b) }
+        keys %UPGRADES )
+    {
         $log->info("Upgrading through $version");
         for my $thing ( @{ $UPGRADES{$version} } ) {
             if ( ref $thing ) {
@@ -525,7 +575,8 @@
         map  { @{ $UPGRADES{$_} } }
         sort { version->new($a) <=> version->new($b) }
         keys %UPGRADES
-        ) {
+        )
+    {
         if ( ref $_ ) {
             print "-- Upgrade subroutine:\n";
             require Data::Dumper;
@@ -553,13 +604,13 @@
     my $handle = Jifty::Schema->connect_to_db_for_management();
 
     if ( $self->{print} ) {
-         $handle->drop_database('print') if ( $self->{'drop_database'} ) ;
-        $handle->create_database('print') if ( $self->{'create_database'} ) ;
+        $handle->drop_database('print')   if ( $self->{'drop_database'} );
+        $handle->create_database('print') if ( $self->{'create_database'} );
     } else {
-        $handle->drop_database('execute') if ( $self->{'drop_database'} ) ;
-        $handle->create_database('execute') if ( $self->{'create_database'} ) ;
+        $handle->drop_database('execute')   if ( $self->{'drop_database'} );
+        $handle->create_database('execute') if ( $self->{'create_database'} );
         $handle->disconnect;
-        $self->_reinit_handle() if ($self->{'create_database'} ) ;
+        $self->_reinit_handle() if ( $self->{'create_database'} );
     }
 }
 
@@ -568,14 +619,12 @@
     Jifty->handle->connect();
 }
 
-
 sub _exec_sql {
     my $sql = shift;
     my $ret = Jifty->handle->simple_query($sql);
     $ret or die "error updating a table: " . $ret->error_message;
 }
 
-
 1;
 
 __DATA__

Added: jifty/branches/virtual-models/lib/Jifty/Script/Script.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Script/Script.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,104 @@
+use warnings;
+use strict;
+
+package Jifty::Script::Script;
+use base qw/ App::CLI::Command /;
+
+=head1 NAME
+
+Jifty::Script::Script - Add a new Jifty script to your Jifty application
+
+=head1 DESCRIPTION
+
+This creates a skeleton of a new script file for your Jifty application. Often it such a script is needed for cron jobs, annual maintenance work, and any other server-side activity that would benefit from a command-line script.
+
+=head1 API
+
+=head2 options
+
+=over
+
+=item --name NAME (required)
+
+Name of the script to create.
+
+=item --force
+
+By default, this will stop and warn you if any of the files it is going to write already exist. Passing the --force flag will make it overwrite the files.
+
+=back
+
+=cut
+
+sub options {
+    (
+        'n|name=s' => 'name',
+        'force'    => 'force',
+    )
+}
+
+=head2 run
+
+Creates a skeleton file under C<bin/I<script>>.
+
+TODO Should this create skeleton test files too?
+
+=cut
+
+sub run {
+    my $self = shift;
+
+    my $script = $self->{name};
+    die "You need to give your new script a --name\n"
+        unless defined $script;
+
+    Jifty->new( no_handle => 1 );
+    my $root = Jifty::Util->app_root;
+
+    my $script_file = <<"END_OF_SCRIPT";
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use Jifty;
+BEGIN { Jifty->new }
+
+# Your script-specific code goes here.
+
+END_OF_SCRIPT
+
+    $self->_write("$root/bin/$script" => $script_file);
+}
+
+# TODO This should be moved to Jifty::Util or somewhere else so all these
+# scripts don't duplicate it!
+sub _write {
+    my $self = shift;
+    my %files = (@_);
+    my $halt;
+    for my $path (keys %files) {
+        my ($volume, $dir, $file) = File::Spec->splitpath($path);
+
+        # Make sure the directories we need are there
+        Jifty::Util->make_path($dir);
+
+        # If it already exists, bail
+        if (-e $path and not $self->{force}) {
+            print "File $path exists already; Use --force to overwrite\n";
+            $halt = 11;
+        }
+    }
+    exit if $halt;
+
+    # Now that we've san-checked everything, we can write the files
+    for my $path (keys %files) {
+        print "Writing file $path\n";
+        # Actually write the file out
+        open(FILE, ">$path")
+          or die "Can't write to $path: $!";
+        print FILE $files{$path};
+        close FILE;
+    }
+}
+
+1;

Modified: jifty/branches/virtual-models/lib/Jifty/Test.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Test.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Test.pm	Thu Feb 14 14:59:21 2008
@@ -4,9 +4,7 @@
 package Jifty::Test;
 use base qw/Test::More/;
 
-use Jifty::YAML;
-use Jifty::Server;
-use Jifty::Script::Schema;
+use Jifty::Util;
 use Email::LocalDelivery;
 use Email::Folder;
 use File::Path;
@@ -119,8 +117,16 @@
 sub import_extra {
     my $class = shift;
     my $args  = shift;
+
     $class->setup($args);
     Test::More->export_to_level(2);
+
+    # Now, clobber Test::Builder::plan (if we got given a plan) so we
+    # don't try to spit one out *again* later
+    if ($class->builder->has_plan) {
+        no warnings 'redefine';
+        *Test::Builder::plan = sub {};
+    }
 }
 
 =head2 setup ARGS
@@ -161,6 +167,17 @@
 
 sub setup {
     my $class = shift;
+    my $args = shift;
+
+    # Spit out a plan (if we got one) *before* we load modules, in
+    # case of compilation errors
+    $class->builder->plan(@{$args})
+      unless $class->builder->has_plan;
+
+    # Require the things we need
+    require Jifty::YAML;
+    require Jifty::Server;
+    require Jifty::Script::Schema;
 
     my $test_config = File::Temp->new( UNLINK => 0 );
     Jifty::YAML::DumpFile("$test_config", $class->test_config(Jifty::Config->new));
@@ -180,8 +197,8 @@
           use vars qw/$cache_key_prefix/;
 
           $cache_key_prefix = "jifty-test-" . $$;
-        
-          sub cache_key_prefix {
+          
+          *Jifty::Record::cache_key_prefix = sub {
               $Jifty::Record::cache_key_prefix;
           }
       }

Modified: jifty/branches/virtual-models/lib/Jifty/Test/WWW/Declare.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Test/WWW/Declare.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Test/WWW/Declare.pm	Thu Feb 14 14:59:21 2008
@@ -18,7 +18,7 @@
     Test::More->import(@_);
 
     # set up database and other things
-    Jifty::Test->setup($class);
+    Jifty::Test->setup(\@_);
 
     # export the DSL-ey functions
     Test::WWW::Declare->export_to_level(2);

Modified: jifty/branches/virtual-models/lib/Jifty/TestServer.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/TestServer.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/TestServer.pm	Thu Feb 14 14:59:21 2008
@@ -6,7 +6,9 @@
 use Test::Builder;
 my $Tester = Test::Builder->new;
 
-my $INC = [grep { defined } map { File::Spec->rel2abs($_) } @INC ];
+# explicitly ignore ClassLoader objects in @INC,
+# which'd be ignored in the end, though.
+my $INC = [grep { defined } map { File::Spec->rel2abs($_) } grep { !ref } @INC ];
 my @perl = ($^X, map { "-I$_" } @$INC);
 
 =head1 NAME

Modified: jifty/branches/virtual-models/lib/Jifty/Util.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Util.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Util.pm	Thu Feb 14 14:59:21 2008
@@ -147,10 +147,11 @@
 
     Jifty::Util->require('ExtUtils::MM') if $^O =~ /(?:MSWin32|cygwin|os2)/;
     Jifty::Util->require('Config');
-    for (@roots) {
-        my @root = File::Spec->splitdir($_);
+    for my $root_path (@roots) {
+        my ($volume, $dirs) = File::Spec->splitpath($root_path, 'no_file');
+        my @root = File::Spec->splitdir($dirs);
         while (@root) {
-            my $try = File::Spec->catdir( @root, "bin", "jifty" );
+            my $try = File::Spec->catpath($volume, File::Spec->catdir( @root, "bin", "jifty" ), '');
             if (# XXX: Just a quick hack
                 # MSWin32's 'maybe_command' sees only file extension.
                 # Maybe we should check 'jifty.bat' instead on Win32,
@@ -163,7 +164,7 @@
                 and lc($try) ne lc(File::Spec->catdir($Config::Config{bin}, "jifty"))
                 and lc($try) ne lc(File::Spec->catdir($Config::Config{scriptdir}, "jifty")) )
             {
-                return $APP_ROOT = File::Spec->catdir(@root);
+                return $APP_ROOT = File::Spec->catpath($volume, File::Spec->catdir(@root), '');
             }
             pop @root;
         }
@@ -334,6 +335,50 @@
     })->create_str;
 }
 
+=head2 reference_to_data Object
+
+Provides a saner output format for models than
+C<MyApp::Model::Foo=HASH(0x1800568)>.
+
+=cut
+
+sub reference_to_data {
+    my ($self, $obj) = @_;
+    (my $model = ref($obj)) =~ s/::/./g;
+    return { jifty_model_reference => 1, id => $obj->id, model => $model };
+}
+
+=head2 stringify LIST
+
+Takes a list of values and forces them into strings.  Right now all it does
+is concatenate them to an empty string, but future versions might be more
+magical.
+
+=cut
+
+sub stringify {
+    my $self = shift;
+
+    my @r;
+
+    for (@_) {
+        if (UNIVERSAL::isa($_, 'Jifty::Record')) {
+            push @r, Jifty::Util->reference_to_data($_);
+        }
+        if (UNIVERSAL::isa($_, 'Jifty::DateTime') && $_->is_date) {
+            push @r, $_->ymd;
+        }
+        elsif (defined $_) {
+            push @r, '' . $_; # force stringification
+        }
+        else {
+            push @r, undef;
+        }
+    }
+
+    return wantarray ? @r : $r[-1];
+}
+
 =head1 AUTHOR
 
 Various folks at Best Practical Solutions, LLC.

Modified: jifty/branches/virtual-models/lib/Jifty/View/Declare/CRUD.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/View/Declare/CRUD.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/View/Declare/CRUD.pm	Thu Feb 14 14:59:21 2008
@@ -418,8 +418,6 @@
     my $delete = $record->as_delete_action(
         moniker => 'delete-' . Jifty->web->serial,
     );
-    Jifty->web->form->register_action($delete);
-
         div {
             { class is 'crud editlink' };
             hyperlink(
@@ -438,13 +436,13 @@
                     args         => { object_type => $object_type, id => $id }
                 },
                 as_button => 1,
-                class => 'cancel'
+                class     => 'cancel'
             );
             if ( $record->current_user_can('delete') ) {
                 $delete->button(
                     label   => _('Delete'),
                     onclick => {
-                        submit => $delete,
+                        submit  => $delete,
                         confirm => _('Really delete?'),
                         refresh => Jifty->web->current_region->parent,
                     },
@@ -499,7 +497,7 @@
         $collection = $search;
     } else {
         $collection = $collection_class->new();
-        $collection->unlimit();
+        $collection->find_all_rows();
     }
 
     $collection->set_page_info( current_page => $page, per_page => $self->per_page );
@@ -583,6 +581,8 @@
     my $item_path   = shift;
     my $callback    = shift;
     my $object_type = $self->object_type;
+    $collection->_do_search(); # we're going to need the results. 
+    # XXX TODO, should use a real API to force the search
     if ( $collection->count == 0 ) {
         show('./no_items_found');
     }

Modified: jifty/branches/virtual-models/lib/Jifty/View/Declare/Handler.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/View/Declare/Handler.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/View/Declare/Handler.pm	Thu Feb 14 14:59:21 2008
@@ -75,7 +75,7 @@
         goto &Template::Declare::Tags::outs_raw;
     };
     
-    my $content = Template::Declare::Tags::show_page( $template, Jifty->web->request->arguments );
+    my $content = Template::Declare::Tags::show_page( $template, { %{Jifty->web->request->arguments}, %{Jifty->web->request->template_arguments || {}} } );
     return unless defined $content;
 
     my $r = Jifty->handler->apache;

Modified: jifty/branches/virtual-models/lib/Jifty/View/Declare/Helpers.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/View/Declare/Helpers.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/View/Declare/Helpers.pm	Thu Feb 14 14:59:21 2008
@@ -234,9 +234,9 @@
 
 sub get {
     if (wantarray) {
-        map { request->argument($_) } @_;
+        map { request->template_argument($_) || request->argument($_) } @_;
     } else {
-        request->argument( $_[0] );
+        request->template_argument($_[0]) || request->argument( $_[0] );
     }
 }
 
@@ -251,7 +251,7 @@
 
 sub set {
     while ( my ( $arg, $val ) = splice(@_, 0, 2) ) {
-        request->argument( $arg => $val );
+        request->template_argument( $arg => $val );
     }
 
 }

Modified: jifty/branches/virtual-models/lib/Jifty/View/Mason/Handler.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/View/Mason/Handler.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/View/Mason/Handler.pm	Thu Feb 14 14:59:21 2008
@@ -231,7 +231,7 @@
 =cut
 
 sub request_args {
-    return %{Jifty->web->request->arguments};
+    return %{Jifty->web->request->arguments}, %{Jifty->web->request->template_arguments || {}};
 }
 
 ###########################################################

Modified: jifty/branches/virtual-models/lib/Jifty/Web.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web.pm	Thu Feb 14 14:59:21 2008
@@ -39,17 +39,14 @@
     jsan/DOM/Events.js
     json.js
     prototype.js
-    cssquery/cssQuery.js
-    cssquery/cssQuery-level2.js
-    cssquery/cssQuery-level3.js
-    cssquery/cssQuery-standard.js
+    jquery-1.2.1.js
+    jquery_noconflict.js
     behaviour.js
     scriptaculous/builder.js
     scriptaculous/effects.js
     scriptaculous/controls.js
     formatDate.js
     template_declare.js
-    loc.js
     jifty.js
     jifty_utils.js
     jifty_subs.js
@@ -248,21 +245,22 @@
         $self->_current_user( $currentuser_obj || undef );
     }
 
+    my $object;
+
     if ( defined $self->temporary_current_user ) {
         return $self->temporary_current_user;
     } elsif ( defined $self->_current_user ) {
         return $self->_current_user;
-
     } elsif ( my $id = $self->session->get('user_id') ) {
-        my $object = Jifty->app_class("CurrentUser")->new( id => $id );
-        $self->_current_user($object);
-        return $object;
+         $object = Jifty->app_class("CurrentUser")->new( id => $id );
+    } elsif ( Jifty->config->framework('AdminMode')) {
+         $object = Jifty->app_class("CurrentUser")->superuser;
     } else {
-        my $object = Jifty->app_class("CurrentUser")->new;
-        $object->is_superuser(1) if Jifty->config->framework('AdminMode');
-        $self->_current_user($object);
-        return ($object);
+         $object = Jifty->app_class("CurrentUser")->new;
     }
+    
+    $self->_current_user($object);
+    return $object;
 }
 
 =head3 temporary_current_user [USER]
@@ -361,6 +359,7 @@
                         . $request_action->class
                         . "'" );
                 Carp::cluck;
+                $self->log->error("NOTICE! A cross-site scriptng security fix has been installed so that actions are now by default DENIED during GET requests. You must specifically whitelist safe actions using this in your dispatcher: before '*' => run { Jifty->api->allow('SafeAction') }; - We apologize for the inconvenience.");
                 push @denied_actions, $request_action;
                 next;
             }
@@ -386,57 +385,57 @@
 }
 
 sub _process_valid_actions {
-    my  $self = shift;
+    my $self          = shift;
     my $valid_actions = shift;
-        for my $request_action (@$valid_actions) {
+    for my $request_action (@$valid_actions) {
 
-            # Pull the action out of the request (again, since
-            # mappings may have affected parameters).  This
-            # returns the cached version unless the request has
-            # been changed by argument mapping from previous
-            # actions (Jifty::Request::Mapper)
-            my $action = $self->new_action_from_request($request_action);
-            next unless $action;
-            if ( $request_action->modified ) {
-
-                # If the request's action was changed, re-validate
-                $action->result( Jifty::Result->new );
-                $action->result->action_class( ref $action );
-                $self->response->result(
-                    $action->moniker => $action->result );
-                $self->log->debug( "Re-validating action "
-                        . ref($action) . " "
-                        . $action->moniker );
-                next unless $action->validate;
-            }
+        # Pull the action out of the request (again, since
+        # mappings may have affected parameters).  This
+        # returns the cached version unless the request has
+        # been changed by argument mapping from previous
+        # actions (Jifty::Request::Mapper)
+        my $action = $self->new_action_from_request($request_action);
+        next unless $action;
+        if ( $request_action->modified ) {
 
-            $self->log->debug(
-                "Running action " . ref($action) . " " . $action->moniker );
-            eval { $action->run; };
-            $request_action->has_run(1);
-
-            if ( my $err = $@ ) {
-
-                # Poor man's exception propagation; we need to get
-                # "LAST RULE" and "ABORT" exceptions back up to the
-                # dispatcher.  This is specifically for redirects from
-                # actions
-                die $err if ( $err =~ /^(LAST RULE|ABORT)/ );
-                $self->log->fatal($err);
-                $action->result->error(
-                    Jifty->config->framework("DevelMode")
-                    ? $err
-                    : _("There was an error completing the request.  Please try again later."
-                    )
-                );
-            }
+            # If the request's action was changed, re-validate
+            $action->result( Jifty::Result->new );
+            $action->result->action_class( ref $action );
+            $self->response->result( $action->moniker => $action->result );
+            $self->log->debug( "Re-validating action "
+                    . ref($action) . " "
+                    . $action->moniker );
+            next unless $action->validate;
+        }
 
-            # Fill in the request with any results that that action
-            # may have yielded.
-            $self->request->do_mapping;
+        $self->log->debug(
+            "Running action " . ref($action) . " " . $action->moniker );
+        eval { $action->run; };
+        $request_action->has_run(1);
+
+        if ( my $err = $@ ) {
+
+            # Poor man's exception propagation; we need to get
+            # "LAST RULE" and "ABORT" exceptions back up to the
+            # dispatcher.  This is specifically for redirects from
+            # actions
+            die $err if ( $err =~ /^(LAST RULE|ABORT)/ );
+            $self->log->fatal($err);
+            $action->result->error(
+                Jifty->config->framework("DevelMode")
+                ? $err
+                : _("There was an error completing the request.  Please try again later."
+                )
+            );
         }
 
+        # Fill in the request with any results that that action
+        # may have yielded.
+        $self->request->do_mapping;
     }
+
+}
+
 =head3 request [VALUE]
 
 Gets or sets the current L<Jifty::Request> object.
@@ -760,7 +759,7 @@
         local $self->{navigation} = undef;
         local $self->{page_navigation} = undef;
         $self->replace_current_region($page);
-        Jifty::Dispatcher::_abort;
+        Jifty::Dispatcher::_abort();
         return;
     }
 
@@ -792,7 +791,7 @@
 
     # Mason abort, or dispatcher abort out of here
     $self->mason->abort if $self->mason;
-    Jifty::Dispatcher::_abort;
+    Jifty::Dispatcher::_abort();
 }
 
 =head3 caller

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Form.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Form.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Form.pm	Thu Feb 14 14:59:21 2008
@@ -7,6 +7,8 @@
 
 __PACKAGE__->mk_accessors(qw(actions printed_actions name call is_open disable_autocomplete target submit_to onsubmit));
 
+use Scalar::Util qw/weaken/;
+
 =head1 NAME
 
 Jifty::Web::Form - Tools for rendering and dealing with HTML forms
@@ -149,6 +151,7 @@
     my $self = shift;
     my $action = shift;
     $self->actions->{ $action->moniker } =  $action;
+    weaken $self->actions->{ $action->moniker};
     return $action;
 }
 
@@ -370,4 +373,17 @@
     return '';
 }
 
+=head2 DESTROY
+
+Checks to ensure that forms that were opened were actually closed,
+which is when actions are registered.
+
+=cut
+
+sub DESTROY {
+    my $self = shift;
+    warn "Action $_ was never registered (form was never closed)"
+      for grep {not $self->printed_actions->{$_}} keys %{$self->actions};
+}
+
 1;

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Form/Clickable.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Form/Clickable.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Form/Clickable.pm	Thu Feb 14 14:59:21 2008
@@ -103,7 +103,7 @@
               ]
 
 If you specify arguments in the submit block for a button, they will override 
-any values from form fileds submitted by the user.
+any values from form fields submitted by the user.
 
 
 =item preserve_state
@@ -156,28 +156,30 @@
     my ($root) = $ENV{'REQUEST_URI'} =~ /([^\?]*)/;
 
     my %args = (
-        parameters     => {},
-        as_button      => 0,
-        as_link        => 0,
+        parameters => {},
+        as_button  => 0,
+        as_link    => 0,
         @_,
     );
 
-    $class->call_trigger('before_new', \%args);
+    $class->call_trigger( 'before_new', \%args );
 
     $args{render_as_button} = delete $args{as_button};
     $args{render_as_link}   = delete $args{as_link};
 
-    my $self = $class->SUPER::new({
-        class          => '',
-        label          => 'Click me!',
-        url            => $root,
-        escape_label   => 1,
-        tooltip        => '',
-        continuation   => Jifty->web->request->continuation,
-        submit         => [],
-        preserve_state => 0,
-        parameters     => {},
-    }, \%args);
+    my $self = $class->SUPER::new(
+        {   class          => '',
+            label          => 'Click me!',
+            url            => $root,
+            escape_label   => 1,
+            tooltip        => '',
+            continuation   => Jifty->web->request->continuation,
+            submit         => [],
+            preserve_state => 0,
+            parameters     => {},
+        },
+        \%args
+    );
 
     for (qw/continuation call/) {
         $self->{$_} = $self->{$_}->id if $self->{$_} and ref $self->{$_};
@@ -194,7 +196,10 @@
             if ( !ref($submit) ) { push @submit_temp, $submit }
 
             # We've been handed a Jifty::Action to submit
-            elsif ( blessed($submit) ) { push @submit_temp, $submit->moniker }
+            elsif ( blessed($submit) ) {
+                push @submit_temp, $submit->moniker;
+                $self->register_action($submit);
+            }
 
           # We've been handed a hashref which contains an action and arguments
             else {
@@ -206,18 +211,18 @@
 
                 # Add the action's moniker to the submit
                 push @submit_temp, $submit->{'action'}->moniker;
+                $self->register_action($submit->{'action'});
             }
         }
 
         @{ $self->{submit} } = @submit_temp;
     }
 
-
     # Anything doing fragment replacement needs to preserve the
     # current state as well
     if ( grep { $self->$_ } $self->handlers or $self->preserve_state ) {
         my %state_vars = Jifty->web->state_variables;
-        while ( my ($key,  $val) = each %state_vars ) {
+        while ( my ( $key, $val ) = each %state_vars ) {
             if ( $key =~ /^region-(.*?)\.(.*)$/ ) {
                 $self->region_argument( $1, $2 => $val );
             } elsif ( $key =~ /^region-(.*)$/ ) {
@@ -302,8 +307,8 @@
 
 sub state_variable {
     my $self = shift;
-    defined $self->call_trigger('before_state_variable', @_)
-        or return; # if aborted by trigger
+    defined $self->call_trigger( 'before_state_variable', @_ )
+        or return;    # if aborted by trigger
 
     my ( $key, $value, $fallback ) = @_;
     if ( defined $value and length $value ) {
@@ -345,9 +350,9 @@
     my $self = shift;
     my ( $region, $argument, $value ) = @_;
 
-    my $name = ref $region ? $region->qualified_name : $region;
+    my $name     = ref $region ? $region->qualified_name : $region;
     my $defaults = Jifty->web->get_region($name);
-    my $default = $defaults ? $defaults->default_argument($argument) : undef;
+    my $default  = $defaults ? $defaults->default_argument($argument) : undef;
 
     if (   ( not defined $default and not defined $value )
         or ( defined $default and defined $value and $default eq $value ) )
@@ -364,8 +369,9 @@
     my %old_args = @_;
     my %new_args;
 
-    while (my ($key, $val) = each %old_args) {
-        my ($new_key, $new_val) = Jifty::Request::Mapper->query_parameters($key => $val);
+    while ( my ( $key, $val ) = each %old_args ) {
+        my ( $new_key, $new_val )
+            = Jifty::Request::Mapper->query_parameters( $key => $val );
         $new_args{$new_key} = $new_val;
     }
 
@@ -386,17 +392,19 @@
     my %parameters;
 
     if ( $self->returns ) {
-        %parameters = Jifty::Request::Mapper->query_parameters( %{ $self->returns } );
+        %parameters
+            = Jifty::Request::Mapper->query_parameters( %{ $self->returns } );
         $parameters{"J:CREATE"} = 1;
-        $parameters{"J:PATH"} = Jifty::Web::Form::Clickable->new( url => $self->url,
-                                                                  parameters => $self->{parameters},
-                                                                  continuation => undef,
-                                                                )->complete_url;
+        $parameters{"J:PATH"}   = Jifty::Web::Form::Clickable->new(
+            url          => $self->url,
+            parameters   => $self->{parameters},
+            continuation => undef,
+        )->complete_url;
     } else {
-        %parameters = %{ $self->{parameters} };        
+        %parameters = %{ $self->{parameters} };
     }
 
-    %parameters = _map( %{$self->{state_variable} || {}}, %parameters );
+    %parameters = _map( %{ $self->{state_variable} || {} }, %parameters );
 
     $parameters{"J:CALL"} = $self->call
         if $self->call;
@@ -417,13 +425,15 @@
 sub post_parameters {
     my $self = shift;
 
-    my %parameters = ( _map( %{ $self->{fallback} || {} } ), $self->parameters );
+    my %parameters
+        = ( _map( %{ $self->{fallback} || {} } ), $self->parameters );
 
     my ($root) = $ENV{'REQUEST_URI'} =~ /([^\?]*)/;
 
     # Submit actions should only show up once
     my %uniq;
-    $self->submit([grep {not $uniq{$_}++} @{$self->submit}]) if $self->submit;
+    $self->submit( [ grep { not $uniq{$_}++ } @{ $self->submit } ] )
+        if $self->submit;
 
     # Add a redirect, if this isn't to the right page
     if ( $self->url ne $root and not $self->returns ) {
@@ -432,11 +442,12 @@
             arguments => { url => $self->url } );
         $parameters{ $redirect->register_name } = ref $redirect;
         $parameters{ $redirect->form_field_name('url') } = $self->url;
-        $parameters{"J:ACTIONS"} = join( '!', @{ $self->submit }, $redirect->moniker )
-          if $self->submit;
+        $parameters{"J:ACTIONS"}
+            = join( '!', @{ $self->submit }, $redirect->moniker )
+            if $self->submit;
     } else {
         $parameters{"J:ACTIONS"} = join( '!', @{ $self->submit } )
-          if $self->submit;
+            if $self->submit;
     }
 
     return %parameters;
@@ -479,8 +490,8 @@
 
 sub _defined_accessor_values {
     my $self = shift;
-    return { map { my $val = $self->$_; defined $val ? ($_ => $val) : () } 
-        $self->SUPER::accessors };
+    return { map { my $val = $self->$_; defined $val ? ( $_ => $val ) : () }
+            $self->SUPER::accessors };
 }
 
 =head2 as_link
@@ -496,24 +507,26 @@
 
     my $args = $self->_defined_accessor_values;
     my $link = Jifty::Web::Form::Link->new(
-        { %$args,
-          escape_label => $self->escape_label,
-          url          => $self->complete_url,
-          target       => $self->target,
-          continuation => $self->_continuation,
-          @_ }
+        {   %$args,
+            escape_label => $self->escape_label,
+            url          => $self->complete_url,
+            target       => $self->target,
+            continuation => $self->_continuation,
+            @_
+        }
     );
     return $link;
 }
 
 sub _continuation {
+
     # continuation info used by the update() call on client side
     my $self = shift;
-    if ($self->call) {
-	return { 'type' => 'call', id => $self->call };
+    if ( $self->call ) {
+        return { 'type' => 'call', id => $self->call };
     }
-    if ($self->returns) {
-	return { 'create' => $self->url };
+    if ( $self->returns ) {
+        return { 'create' => $self->url };
     }
 
     return {};
@@ -531,12 +544,14 @@
 sub as_button {
     my $self = shift;
 
-    my $args = $self->_defined_accessor_values;
+    my $args  = $self->_defined_accessor_values;
     my $field = Jifty::Web::Form::Field->new(
-        { %$args,
-          type => 'InlineButton',
-          continuation => $self->_continuation,
-          @_ }
+        {   %$args,
+            type         => 'InlineButton',
+            continuation => $self->_continuation,
+            title        => $self->tooltip,
+            @_
+        }
     );
     my %parameters = $self->post_parameters;
 
@@ -546,7 +561,7 @@
             grep { defined $parameters{$_} } keys %parameters
     );
     $field->name( join '|', keys %{ $args->{parameters} } );
-    $field->button_as_link($self->render_as_link);
+    $field->button_as_link( $self->render_as_link );
 
     return $field;
 }
@@ -571,39 +586,82 @@
         my @hooks = @{$value};
         for my $hook (@hooks) {
             next unless ref $hook eq "HASH";
-            $hook->{region} ||= $hook->{refresh} || Jifty->web->qualified_region;
+            $hook->{region} ||= $hook->{refresh}
+                || Jifty->web->qualified_region;
 
-            my $region = ref $hook->{region} ? $hook->{region} : Jifty->web->get_region( $hook->{region} );
+            my $region
+                = ref $hook->{region}
+                ? $hook->{region}
+                : Jifty->web->get_region( $hook->{region} );
 
-            if ($hook->{replace_with}) {
+            if ( $hook->{replace_with} ) {
                 my $currently_shown = '';
                 if ($region) {
 
-                my $state_var = Jifty->web->request->state_variable("region-".$region->qualified_name);
-                $currently_shown = $state_var->value if ($state_var);
-                } 
-                # Toggle region if the toggle flag is set, and clicking wouldn't change path
-                if ($hook->{toggle} and $hook->{replace_with} eq $currently_shown) {
-                    $self->region_fragment( $hook->{region}, "/__jifty/empty" );
+                    my $state_var = Jifty->web->request->state_variable(
+                        "region-" . $region->qualified_name );
+                    $currently_shown = $state_var->value if ($state_var);
+                }
+
+  # Toggle region if the toggle flag is set, and clicking wouldn't change path
+                if (    $hook->{toggle}
+                    and $hook->{replace_with} eq $currently_shown )
+                {
+                    $self->region_fragment( $hook->{region},
+                        "/__jifty/empty" );
+
 #                    Jifty->web->request->remove_state_variable('region-'.$region->qualified_name);
                 } else {
-                    $self->region_fragment( $hook->{region}, $hook->{replace_with} )
+                    $self->region_fragment( $hook->{region},
+                        $hook->{replace_with} );
                 }
-                
+
             }
             $self->region_argument( $hook->{region}, $_ => $hook->{args}{$_} )
                 for keys %{ $hook->{args} };
             if ( $hook->{submit} ) {
                 $self->{submit} ||= [];
-                $hook->{submit} = [ $hook->{submit} ] unless ref $hook->{submit} eq "ARRAY";
+                for my $moniker ( @{ $hook->{submit} } ) {
+                    my $action = Jifty->web->{'actions'}{$moniker};
+                    $self->register_action($action);
+                    $self->parameter( $action->form_field_name($_),
+                        $hook->{action_arguments}{$moniker}{$_} )
+                        for
+                        keys %{ $hook->{action_arguments}{$moniker} || {} };
+                }
                 push @{ $self->{submit} }, @{ $hook->{submit} };
             }
         }
     }
 
-    return ( ( not( $self->submit ) || @{ $self->submit } || $self->render_as_button )
+    return (
+        (          not( $self->submit )
+                || @{ $self->submit }
+                || $self->render_as_button
+        )
         ? $self->as_button(@_)
-        : $self->as_link(@_) );
+        : $self->as_link(@_)
+    );
+}
+
+=head2 register_action ACTION
+
+Reisters the action if it isn't registered already, but only on the
+link.  That is, the registration will not be seen by any other buttons
+in the form.
+
+=cut
+
+sub register_action {
+    my $self = shift;
+    my ($action) = @_;
+    return if Jifty->web->form->actions->{ $action->moniker };
+
+    my $arguments = $action->arguments;
+    $self->parameter( $action->register_name, ref $action );
+    $self->parameter( $action->fallback_form_field_name($_),
+        $action->argument_value($_) || $arguments->{$_}->{'default_value'} )
+        for grep { $arguments->{$_}{constructor} } keys %{$arguments};
 }
 
 1;

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Form/Element.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Form/Element.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Form/Element.pm	Thu Feb 14 14:59:21 2008
@@ -201,184 +201,96 @@
     return $self;
 }
 
+__PACKAGE__->mk_normalising_accessor($_) for __PACKAGE__->handlers;
+
+sub mk_normalising_accessor {
+    my ($class, $accessor) = @_;
+    my $internal_method = "_$accessor";
+    no strict 'refs';
+    *{$accessor} = sub {
+        my $self = shift;
+        return $self->{$internal_method} unless @_;
+
+        $self->$internal_method($self->_handler_setup($internal_method, @_));
+    };
+}
 
- 
 =head2 onclick
 
 The onclick event occurs when the pointing device button is clicked 
 over an element. This attribute may be used with most elements.
 
-=cut
-
-sub onclick {
-    my $self = shift;
-    $self->_onclick($self->_handler_setup('_onclick', @_));
-}
-
 =head2 onchange
 
 The onchange event occurs when a control loses the input focus 
 and its value has been modified since gaining focus. This handler 
 can be used with all form elements.
 
-=cut
-
-sub onchange {
-    my $self = shift;
-    $self->_onchange($self->_handler_setup('_onchange', @_));
-}
-
-
-
 =head2 ondblclick
 
 The ondblclick event occurs when the pointing device button is 
 double clicked over an element.  This handler 
 can be used with all form elements.
 
-=cut
-
-sub ondblclick {
-    my $self = shift;
-    $self->_ondblclick($self->_handler_setup('_ondblclick', @_));
-}
-
 =head2 onmousedown
 
 The onmousedown event occurs when the pointing device button is 
 pressed over an element.  This handler 
 can be used with all form elements.
 
-=cut
-
-sub onmousedown {
-    my $self = shift;
-    $self->_onmousedown($self->_handler_setup('_onmousedown', @_));
-}
-
 =head2 onmouseup
 
 The onmouseup event occurs when the pointing device button is released 
 over an element.  This handler can be used with all form elements.
 
-=cut
-
-sub onmouseup {
-    my $self = shift;
-    $self->_onmouseup($self->_handler_setup('_onmouseup', @_));
-}
-
 =head2 onmouseover
 
 The onmouseover event occurs when the pointing device is moved onto an 
 element.  This handler can be used with all form elements.
 
-=cut
-
-sub onmouseover {
-    my $self = shift;
-    $self->_onmouseover($self->_handler_setup('_onmouseover', @_));
-}
-
 =head2 onmousemove
 
 The onmousemove event occurs when the pointing device is moved while it 
 is over an element.  This handler can be used with all form elements.
 
-=cut
-
-sub onmousemove {
-    my $self = shift;
-    $self->_onmousemove($self->_handler_setup('_onmousemove', @_));
-}
-
 =head2 onmouseout
 
 The onmouseout event occurs when the pointing device is moved away from 
 an element.  This handler can be used with all form elements.
 
-=cut
-
-sub onmouseout {
-    my $self = shift;
-    $self->_onmouseout($self->_handler_setup('_onmouseout', @_));
-}
-
 =head2 onfocus
 
 The onfocus event occurs when an element receives focus either by the 
 pointing device or by tabbing navigation.  This handler 
 can be used with all form elements.
 
-=cut
-
-sub onfocus {
-    my $self = shift;
-    $self->_onfocus($self->_handler_setup('_onfocus', @_));
-}
-
 =head2 onblur
 
 The onblur event occurs when an element loses focus either by the pointing 
 device or by tabbing navigation.  This handler can be used with all 
 form elements.
 
-=cut
-
-sub onblur {
-    my $self = shift;
-    $self->_onblur($self->_handler_setup('_onblur', @_));
-}
-
 =head2 onkeypress
 
 The onkeypress event occurs when a key is pressed and released over an 
 element.  This handler can be used with all form elements.
 
-=cut
-
-sub onkeypress {
-    my $self = shift;
-    $self->_onkeypress($self->_handler_setup('_onkeypress', @_));
-}
-
 =head2 onkeydown
 
 The onkeydown event occurs when a key is pressed down over an element. 
 This handler can be used with all form elements.
 
-=cut
-
-sub onkeydown {
-    my $self = shift;
-    $self->_onkeydown($self->_handler_setup('_onkeydown', @_));
-}
-
 =head2 onkeyup
 
 The onkeyup event occurs when a key is released over an element. 
 This handler can be used with all form elements.
 =cut
 
-sub onkeyup {
-    my $self = shift;
-    $self->_onkeyup($self->_handler_setup('_onkeyup', @_));
-}
-
 =head2 onselect
 
 The onselect event occurs when a user selects some text in a text field. 
 This attribute may be used with the text and textarea fields.
 
-=cut
-
-sub onselect {
-    my $self = shift;
-    $self->_onselect($self->_handler_setup('_onselect', @_));
-}
-
-
-
 =head2 _handler_setup
 
 This method is used by all handlers to normalize all arguments.
@@ -659,11 +571,9 @@
     my $self = shift;
     return unless $self->key_binding;
     Jifty->web->out(
-        '<script type="text/javascript"><!--' .
-        "\n" .
+        '<script type="text/javascript">' .
         Jifty->web->escape($self->key_binding_javascript).
-        "\n" .
-        "--></script>");
+        "</script>");
     return '';
 }
 

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Form/Field.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Form/Field.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Form/Field.pm	Thu Feb 14 14:59:21 2008
@@ -44,7 +44,8 @@
 
 use base 'Jifty::Web::Form::Element';
 
-use Scalar::Util;
+use Scalar::Util qw/weaken/;
+use Scalar::Defer qw/force/;
 use HTML::Entities;
 
 # We need the anonymous sub because otherwise the method of the base class is
@@ -296,13 +297,17 @@
 =cut
 
 sub action {
-    my $self   = shift;
-    my $action = $self->_action(@_);
+    my $self = shift;
+
+    if (@_) {
+        $self->_action(@_);
+
+        # weaken our circular reference
+        weaken $self->{_action};
+    }
+
+    return $self->_action;
 
-    # If we're setting the action, we need to weaken
-    # the reference to not get caught in a loop
-    Scalar::Util::weaken( $self->{_action} ) if @_;
-    return $action;
 }
 
 =head2 current_value
@@ -322,7 +327,10 @@
     if ($self->sticky_value and $self->sticky) {
         return $self->sticky_value;
     } else {
-        return $self->default_value;
+        # the force is here because very often this will be a Scalar::Defer object that we REALLY 
+        # want to be able to check definedness on.
+        # Because of a core limitation in perl, Scalar::Defer can't return undef for an object.
+        return force $self->default_value;
     }
 }
 
@@ -384,9 +392,7 @@
     );
     
     if($javascript =~ /\S/) {
-        Jifty->web->out(qq{<script type="text/javascript"><!--
-    $javascript
---></script>
+        Jifty->web->out(qq{<script type="text/javascript">$javascript</script>
 });
     }
 }
@@ -560,7 +566,7 @@
 sub render_value {
     my $self  = shift;
     my $field = '<span';
-    $field .= qq! class="@{[ $self->classes ]}"> !;
+    $field .= qq! class="@{[ $self->classes ]} value"> !;
     # XXX: force stringify the value because maketext is buggy with overloaded objects.
     $field .= $self->canonicalize_value(Jifty->web->escape("@{[$self->current_value]}")) if defined $self->current_value;
     $field .= qq!</span>\n!;
@@ -600,9 +606,7 @@
     my $self = shift;
     return unless $self->autocompleter;
     $self->render_autocomplete_div;
-    Jifty->web->out(qq{<script type="text/javascript"><!--
-    @{[$self->autocomplete_javascript]}
---></script>});
+    Jifty->web->out(qq{<script type="text/javascript">@{[$self->autocomplete_javascript]}</script>});
     return '';
 }
 

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Form/Field/Combobox.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Form/Field/Combobox.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Form/Field/Combobox.pm	Thu Feb 14 14:59:21 2008
@@ -59,9 +59,9 @@
 
 $field .= <<"EOF";
 </select>
-<script language="javascript"><!--
+<script language="javascript">
 ComboBox_InitWith('@{[ $self->element_id ]}');
-//--></script>
+</script>
 </nobr>
 EOF
 

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Form/Field/Select.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Form/Field/Select.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Form/Field/Select.pm	Thu Feb 14 14:59:21 2008
@@ -30,9 +30,8 @@
         my $display = $opt->{'display'};
         my $value   = $opt->{'value'};
         $value = "" unless defined $value;
-        $field .= qq!<option value="$value"!;
-        $field .= qq! selected="selected"!
-            if defined $self->current_value and $self->current_value eq $value;
+        $field .= qq!<option value="@{[ Jifty->web->escape($value) ]}"!;
+        $field .= qq! selected="selected"!  if defined $self->current_value and $self->current_value eq $value;
         $field .= qq!>!;
         $field .= Jifty->web->escape(_($display)) if defined $display;
         $field .= qq!</option>\n!;

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Form/Link.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Form/Link.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Form/Link.pm	Thu Feb 14 14:59:21 2008
@@ -117,11 +117,9 @@
     $output .= (qq(>$label</a>));
 
     $output .= (
-        '<script type="text/javascript"><!--' .
-        "\n" .
+        '<script type="text/javascript">' .
         Jifty->web->escape($self->key_binding_javascript).
-        "\n" .
-        "--></script>") if $self->key_binding;
+        "</script>") if $self->key_binding;
 
     return $output;
 }

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Menu.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Menu.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Menu.pm	Thu Feb 14 14:59:21 2008
@@ -1,10 +1,16 @@
 package Jifty::Web::Menu;
 
+use strict;
+use warnings;
+
+
 use base qw/Class::Accessor::Fast/;
 use URI;
-use Scalar::Util ();
+use Scalar::Util qw(weaken);
 
-__PACKAGE__->mk_accessors(qw(label parent sort_order link target escape_label class));
+__PACKAGE__->mk_accessors(qw(
+    label _parent sort_order link target escape_label class render_children_inline
+));
 
 =head1 NAME
 
@@ -23,9 +29,17 @@
 
 sub new {
     my $package = shift;
+    my $args = ref($_[0]) eq 'HASH' ? shift @_ : {@_};
+
+    my $parent = delete $args->{'parent'};
+
     # Class::Accessor only wants a hashref;
-    $package->SUPER::new( ref($_[0]) eq 'HASH' ? @_ : {@_} );
+    my $self = $package->SUPER::new( $args);
+
+    # make sure our reference is weak
+    $self->parent($parent) if defined $parent;
 
+    return $self;
 }
 
 
@@ -35,23 +49,30 @@
 
 =cut
 
-sub label {
-    my $self = shift;
-    $self->{label} = shift if @_;
-    return $self->{label};
-}
-
 =head2 parent [MENU]
 
 Gets or sets the parent L<Jifty::Web::Menu> of this item; this defaults
-to null.
+to null. This ensures that the reference is weakened.
+
+=cut
+
+
+sub parent {
+    my $self = shift;
+    if (@_) {
+        $self->_parent(@_);
+        weaken $self->{_parent};
+    }
+
+    return $self->_parent;
+}
+
 
 =head2 sort_order [NUMBER]
 
 Gets or sets the sort order of the item, as it will be displayed under
 the parent.  This defaults to adding onto the end.
 
-
 =head2 link
 
 Gets or set a Jifty::Web::Link object that represents this menu item. If
@@ -69,6 +90,16 @@
 Gets or sets the CSS class the link should have in addition to the default
 classes.  This is only used if C<link> isn't specified.
 
+=head2 render_children_inline [BOOLEAN]
+
+Gets or sets whether children are rendered inline as a menu "group" instead
+of a true submenu.  Only used when rendering with YUI for now.
+Defaults to false.
+
+Note that YUI doesn't support rendering nested menu groups, so having direct
+parent/children render_children_inline is likely not going to do what you
+want or expect.
+
 =head2 url
 
 Gets or sets the URL that the menu's link goes to.  If the link
@@ -82,7 +113,7 @@
     $self->{url} = shift if @_;
 
     $self->{url} = URI->new_abs($self->{url}, $self->parent->url . "/")->as_string
-      if $self->parent and $self->parent->url;
+      if defined $self->{url} and $self->parent and $self->parent->url;
 
     $self->{url} =~ s!///!/! if $self->{url};
 
@@ -131,16 +162,24 @@
                                                @_
                                              });
         Scalar::Util::weaken($self->{children}{$key}{parent});
+        
+        # Figure out the URL
+        my $child = $self->{children}{$key};
+        my $url   =   ( defined $child->link
+                    and ref $child->link
+                    and $child->link->can('url') )
+                        ? $child->link->url : $child->url;
+
         # Activate it
-        if (my $url = $self->{children}{$key}->url and Jifty->web->request) {
+        if ( defined $url and length $url and Jifty->web->request ) {
             # XXX TODO cleanup for mod_perl
             my $base_path = Jifty->web->request->path;
             chomp($base_path);
-        
-            $base_path =~ s/index\.html$//g;
-            $base_path =~ s/\/+$//g;
-            $url =~ s/\/+$//i;
-    
+            
+            $base_path =~ s/index\.html$//;
+            $base_path =~ s/\/+$//;
+            $url =~ s/\/+$//;
+            
             if ($url eq $base_path) {
                 $self->{children}{$key}->active(1); 
             }
@@ -191,7 +230,6 @@
     return wantarray ? @kids : \@kids;
 }
 
-
 =head2 render_as_menu
 
 Render this menu with HTML markup as multiple dropdowns, suitable for
@@ -205,7 +243,7 @@
     Jifty->web->out(qq{<ul class="menu">});
 
     for (@kids) {
-	$_->render_as_hierarchical_menu_item();
+        $_->render_as_hierarchical_menu_item();
     }
     Jifty->web->out(qq{</ul>});
     '';
@@ -218,11 +256,11 @@
 =cut
 
 sub render_as_context_menu {
-	my $self = shift;
-    	Jifty->web->out( qq{<ul class="context_menu">});
-	$self->render_as_hierarchical_menu_item();
-	Jifty->web->out(qq{</ul>});
-	'';
+    my $self = shift;
+    Jifty->web->out( qq{<ul class="context_menu">});
+    $self->render_as_hierarchical_menu_item();
+    Jifty->web->out(qq{</ul>});
+    '';
 }
 
 =head2 render_as_hierarchical_menu_item
@@ -277,13 +315,13 @@
 =cut
 
 sub  render_as_classical_menu {
-	my $self = shift;
+    my $self = shift;
     my @kids = $self->children;
 
     Jifty->web->out( qq{<ul class="menu">});
 
     for (@kids) {
-	    $_->_render_as_classical_menu_item();
+        $_->_render_as_classical_menu_item();
     }
 
     Jifty->web->out(qq{</ul>});
@@ -313,7 +351,7 @@
 
 }
 
-=head2 render_as_yui_menubar
+=head2 render_as_yui_menubar [PARAMHASH]
 
 Render menubar with YUI menu, suitable for an application's menu.
 It can support arbitary levels of submenu.
@@ -323,10 +361,10 @@
 sub render_as_yui_menubar {
     my $self = shift;
     my $id   = Jifty->web->serial;
-    $self->_render_as_yui_menu_item("yuimenubar", $id);
+    $self->_render_as_yui_menu_item( class => "yuimenubar", id => $id );
     Jifty->web->out(qq|<script type="text/javascript">\n|
         . qq|YAHOO.util.Event.onContentReady("|.$id.qq|", function() {\n|
-        . qq|var menu = new YAHOO.widget.MenuBar("|.$id.qq|", { autosubmenudisplay:true, hidedelay:750, lazyload:true });\n|
+        . qq|var menu = new YAHOO.widget.MenuBar("|.$id.qq|", { autosubmenudisplay:true, hidedelay:750, lazyload:true, showdelay:0 });\n|
         . qq|menu.render();\n|
         . qq|});</script>|
         );
@@ -334,23 +372,87 @@
 }
 
 sub _render_as_yui_menu_item {
-    my ($self, $class, $id) = @_;
-    my @kids = $self->children 
-        or return;
+    my $self = shift;
+    my %args = ( class => 'yuimenu', first => 0, id => undef, @_ );
+    my @kids = $self->children or return;
     
-    Jifty->web->out(
-        qq{<div}
-        . ($id ? qq{ id="$id"} : "")
-        . qq{ class="$class"><div class="bd"><ul>}
-    );
-    for (@kids) {
-        Jifty->web->out( qq{<li class="${class}item }
-        . ($_->active? 'active' : '') . qq{">});
-        Jifty->web->out( $_->as_link );
-        $_->_render_as_yui_menu_item("yuimenu");
-        Jifty->web->out( qq{</li>});
+    # Add the appropriate YUI class to each kid
+    for my $kid ( @kids ) {
+        # Skip it if it's a group heading
+        next if $kid->render_children_inline and $kid->children;
+
+        # Figure out the correct object to be setting the class on
+        my $object =   ( defined $kid->link
+                     and ref $kid->link
+                     and $kid->link->can('class') )
+                         ? $kid->link : $kid;
+
+        my $class = defined $object->class ? $object->class . ' ' : '';
+        $class .= "$args{class}itemlabel";
+        $object->class( $class );
+    }
+
+    # We're rendering this inline, so just render a UL (and any submenus as normal)
+    if ( $self->render_children_inline ) {
+        Jifty->web->out( $args{'first'} ? '<ul class="first-of-type">' : '<ul>' );
+        for my $kid ( @kids ) {
+            Jifty->web->out( qq(<li class="$args{class}item ) . ($kid->active? 'active' : '') . qq{">});
+            Jifty->web->out( $kid->as_link );
+            $kid->_render_as_yui_menu_item( class => 'yuimenu' );
+            Jifty->web->out( qq{</li>});
+        }
+        Jifty->web->out('</ul>');
+    }
+    # Render as normal submenus
+    else {
+        Jifty->web->out(
+            qq{<div}
+            . ($args{'id'} ? qq( id="$args{'id'}") : "")
+            . qq( class="$args{class}"><div class="bd">)
+        );
+
+        my $count    = 1;
+        my $count_h6 = 1;
+        my $openlist = 0;
+
+        for my $kid ( @kids ) {
+            # We want to render the children of this child inline, so close
+            # any open <ul>s, render it as an <h6>, and then render it's
+            # children.
+            if ( $kid->render_children_inline and $kid->children ) {
+                Jifty->web->out('</ul>') if $openlist;
+                
+                my @classes = ();
+                push @classes, 'active' if $kid->active;
+                push @classes, 'first-of-type'
+                    if $count_h6 == 1 and $count == 1;
+
+                Jifty->web->out(qq(<h6 class="@{[ join ' ', @classes ]}">));
+                Jifty->web->out( $kid->as_link );
+                Jifty->web->out('</h6>');
+                $kid->_render_as_yui_menu_item(
+                    class => 'yuimenu',
+                    first => ($count == 1 ? 1 : 0)
+                );
+                $openlist = 0;
+                $count_h6++;
+            }
+            # It's a normal child
+            else {
+                if ( not $openlist ) {
+                    Jifty->web->out( $count == 1 ? '<ul class="first-of-type">' : '<ul>' );
+                    $openlist = 1;
+                }
+                Jifty->web->out( qq(<li class="$args{class}item ) . ($kid->active? 'active' : '') . qq{">});
+                Jifty->web->out( $kid->as_link );
+                $kid->_render_as_yui_menu_item( class => 'yuimenu' );
+                Jifty->web->out( qq{</li>});
+            }
+            $count++;
+        }
+        Jifty->web->out('</ul>') if $openlist;
+        Jifty->web->out(qq{</div></div>});
     }
-    Jifty->web->out(qq{</ul></div></div>});
 }
 
 =head2 as_link

Modified: jifty/branches/virtual-models/lib/Jifty/Web/PageRegion.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/PageRegion.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/PageRegion.pm	Thu Feb 14 14:59:21 2008
@@ -15,7 +15,7 @@
 =cut
 
 use base qw/Jifty::Object Class::Accessor::Fast/;
-__PACKAGE__->mk_accessors(qw(name force_path force_arguments default_path default_arguments qualified_name parent region_wrapper));
+__PACKAGE__->mk_accessors(qw(name force_path force_arguments default_path default_arguments qualified_name parent region_wrapper lazy));
 use Jifty::JSON;
 use Encode ();
 
@@ -60,8 +60,9 @@
 HTML region preamble that makes Javascript aware of its presence.
 Defaults to true.
 
+=item lazy (optional)
 
-=item
+Delays the loading of the fragment until render-time
 
 =back
 
@@ -79,6 +80,7 @@
                 force_arguments => {},
                 force_path => undef,
                 region_wrapper => 1,
+                lazy => 0,
                 @_
                );
 
@@ -107,6 +109,7 @@
     $self->arguments({});
     $self->parent($args{parent} || Jifty->web->current_region);
     $self->region_wrapper($args{region_wrapper});
+    $self->lazy($args{lazy});
 
     # Keep track of the fully qualified name (which should be unique)
     $self->log->warn("Repeated region: " . $self->qualified_name)
@@ -284,8 +287,11 @@
             . qq|'| . $self->path . qq|',|
             . ( $self->parent ? qq|'| . $self->parent->qualified_name . qq|'| : q|null|)
             . qq|);\n|
-            . qq|</script>|
-            . qq|<div id="region-| . $self->qualified_name . qq|">|;
+            . qq|</script>|;
+        if ($self->lazy) {
+            return $result .  qq|<div id="region-| . $self->qualified_name . qq|" class="jifty-region-lazy"></div>|;
+        }
+        $result .= qq|<div id="region-| . $self->qualified_name . qq|" class="jifty-region">|;
     }
 
     $self->render_as_subrequest(\$result, \%arguments);
@@ -310,6 +316,7 @@
     $subrequest->argument( region => $self );
     # XXX: use ->arguments?
     $subrequest->argument( $_ => $arguments->{$_}) for keys %$arguments;
+    $subrequest->template_arguments({});
     $subrequest->path( $self->path );
     $subrequest->top_request( Jifty->web->request->top_request );
 

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Session.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Session.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Session.pm	Thu Feb 14 14:59:21 2008
@@ -6,7 +6,7 @@
 use CGI::Cookie ();
 use DateTime ();
 use Storable ();
- 
+
 =head1 NAME
 
 Jifty::Web::Session - A Jifty session handler
@@ -237,6 +237,21 @@
     $setting->delete if $setting->id;
 }
 
+=head2 remove_all
+
+Removes the session from the database entirely.
+
+=cut
+
+sub remove_all {
+    my $self = shift;
+    return unless $self->loaded;
+    my $settings = Jifty::Model::SessionCollection->new;
+    $settings->limit( column => "session_id", value => $self->id );
+    $_->delete while $_ = $settings->next;
+    $self->unload;
+}
+
 =head2 set_continuation ID CONT
 
 Stores a continuation in the session.
@@ -289,7 +304,7 @@
     $conts->limit( column => "session_id", value => $self->id );
 
     my %continuations;
-    $continuations{ $_->key } = $_->value while $_ = $conts->next;
+    $continuations{ $_->data_key } = $_->value while $_ = $conts->next;
     return %continuations;
 }
 
@@ -302,6 +317,10 @@
 sub set_cookie {
     my $self = shift;
 
+    # never send a cookie with cached content. misbehaving proxies cause
+    # terrific problems
+    return if Jifty->handler->apache->header_out('Expires');
+
     my $cookie_name = $self->cookie_name;
     my %cookies     = CGI::Cookie->fetch();
     my $cookie = new CGI::Cookie(

Added: jifty/branches/virtual-models/lib/Jifty/Web/Session/ApacheSession.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Session/ApacheSession.pm	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,172 @@
+package Jifty::Web::Session::ApacheSession;
+
+=head1 NAME
+
+Jifty::Web::Session::ApacheSession - Jifty Sessions based on Apache::Session
+
+=head1 SYNOPSIS
+
+In your F<etc/config.yml>, using the L<Apache::Session::File> backend:
+
+  framework:
+    Web:
+      SessionClass: Jifty::Web::Session::ApacheSession
+      SessionBackend: File
+      SessionOptions:
+        Directory: /tmp/sessions
+        LockDirectory: /var/lock/sessions
+
+Or with L<Apache::Session::Memorycached> backend:
+
+  framework:
+    Web:
+      SessionClass: Jifty::Web::Session::ApacheSession
+      SessionBackend: Memorycached
+      SessionOptions: { servers: [ '127.0.0.1:11211' ] }
+
+=cut
+
+use strict;
+use warnings;
+use Jifty::Model::Session ();
+use base 'Jifty::Web::Session';
+
+=head2 new
+
+Returns a new, empty session handler, subclassing L<Jifty::Web::Session>.
+
+=cut
+
+sub new {
+    my $class = shift;
+    my $cookie_name = Jifty->config->framework('Web')->{'SessionCookieName'};
+    my $backend_class = Jifty->config->framework('Web')->{'SessionBackend'}
+        or die "Please set SessionBackend in your framework/Web settings";
+    $backend_class = "Apache::Session::$backend_class" unless $backend_class =~ /::/;
+    Jifty::Util->require($backend_class);
+
+    return bless { _cookie_name => $cookie_name, _backend_class => $backend_class }, $class;
+}
+
+=head2 id
+
+Returns the session's id if it has been loaded, or C<undef> otherwise.
+
+=cut
+
+sub id {
+    my $self = shift;
+    return $self->loaded ? $self->_session->{_session_id} : undef;
+}
+
+=head2 load [ID]
+
+Load up the current session from the given C<ID>, or the appropriate
+cookie (see L<Jifty::Web::Session/cookie_name>) otherwise.
+
+If both of those fail, creates a session in memory.
+
+=cut
+
+sub load {
+    my $self       = shift;
+    my $session_id = shift;
+    my %cookies    = CGI::Cookie->fetch();
+
+    unless ($session_id) {
+        my $cookie_name = $self->cookie_name;
+        $session_id = $cookies{$cookie_name}
+            ? $cookies{$cookie_name}->value()
+            : Jifty::Model::Session->new_session_id,
+    }
+
+    my $options = Jifty->config->framework('Web')->{'SessionOptions'};
+
+    my %session;
+    local $@;
+    eval {
+        tie %session => $self->{_backend_class}, $session_id, $options;
+        1;
+    } or do {
+        tie %session => $self->{_backend_class}, undef, $options;
+    };
+
+    $self->{_session} = \%session;
+}
+
+=head2 get KEY [TYPE]
+
+See L<Jifty::Web::Session/get>.
+
+=cut
+
+sub get {
+    my $self     = shift;
+    my $key      = shift;
+    my $key_type = shift || "key";
+
+    return undef unless $self->loaded;
+    return $self->_session->{$key_type,$key};
+}
+
+=head2 set KEY => VALUE, [TYPE]
+
+See L<Jifty::Web::Session/set>.
+
+=cut
+
+sub set {
+    my $self     = shift;
+    my $key      = shift;
+    my $value    = shift;
+    my $key_type = shift || "key";
+
+    return undef unless $self->loaded;
+    $self->_session->{$key_type,$key} = $value;
+}
+
+=head2 remove KEY, [TYPE]
+
+See L<Jifty::Web::Session/remove>.
+
+=cut
+
+sub remove {
+    my $self     = shift;
+    my $key      = shift;
+    my $key_type = shift || "key";
+
+    return undef unless $self->loaded;
+    delete $self->_session->{$key_type,$key};
+}
+
+sub remove_all {
+    my $self     = shift;
+    my $key      = shift;
+    my $key_type = shift || "key";
+
+    return undef unless $self->loaded;
+    undef %{$self->_session};
+}
+
+=head2 continuations
+
+See L<Jifty::Web::Session/continuations>.
+
+=cut
+
+sub continuations {
+    my $self     = shift;
+    return () unless $self->loaded;
+
+    my $session = $self->_session;
+    my %continuations;
+    foreach my $key (keys %$session) {
+        if ($key =~ /^continuation$;(.*)/os) {
+            $continuations{$1} = $session->{$key};
+        }
+    }
+    return %continuations;
+}
+
+1;

Modified: jifty/branches/virtual-models/lib/Jifty/Web/Session/ClientSide.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Web/Session/ClientSide.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Web/Session/ClientSide.pm	Thu Feb 14 14:59:21 2008
@@ -19,11 +19,12 @@
 use warnings;
 use base 'Jifty::Web::Session';
 use Jifty::Model::Session();
-use Jifty::YAML ();
+use Storable ();
 use Compress::Zlib ();
 use Crypt::CBC ();
 use Crypt::Rijndael ();
 use CGI::Cookie::Splitter ();
+use MIME::Base64;
 
 my $session_key;
 my $splitter = CGI::Cookie::Splitter->new;
@@ -36,13 +37,14 @@
 
 sub new {
     my $class = shift;
+    my $cookie_name = Jifty->config->framework('Web')->{'SessionCookieName'};
     my $session_key = Jifty->config->framework('Web')->{'SessionSecret'}
         or die "Please set SessionSecret in your framework/Web settings";
     my $cipher = Crypt::CBC->new(
         -key    => $session_key,
         -cipher => 'Rijndael',
     );
-    bless { _cipher => $cipher, _session => undef }, $class;
+    bless { _cookie_name => $cookie_name, _cipher => $cipher, _session => undef }, $class;
 }
 
 =head2 _cipher
@@ -85,11 +87,11 @@
 
     unless ($session_id) {
         my $cookie_name = $self->cookie_name;
-        $session_id = $cookies{$cookie_name}
-            ? $cookies{$cookie_name}->value()
-            : Jifty::Model::Session->new_session_id,
+        $session_id = $cookies{$cookie_name}->value() if $cookies{$cookie_name};
+        $session_id ||= Jifty::Model::Session->new_session_id;
     }
 
+
     my $data;
 
     {
@@ -110,17 +112,19 @@
     if ($data) {
         local $@;
         eval {
-            $self->_session(
-                Jifty::YAML::Load(
-                    Compress::Zlib::uncompress(
-                        $self->_cipher->decrypt(
+            if (my $session = Storable::thaw(
+                Compress::Zlib::uncompress(
+                    $self->_cipher->decrypt(
+                        decode_base64(
                             $data->value
                         )
                     )
                 )
-            );
-            die "Session id mismatch"
-                unless $self->_session->{session_id} eq $session_id;
+            )) {
+                $self->_session($session);
+                die "Session id mismatch"
+                    unless $self->_session->{session_id} eq $session_id;
+            }
             1;
         } and return;
         warn $@ if $@;
@@ -220,10 +224,12 @@
     my $data_cookie = CGI::Cookie->new(
         -name    => "JIFTY_DAT_$session_id",
         -expires => $self->expires,
-        -value   => $self->_cipher->encrypt(
-            Compress::Zlib::compress(
-                Jifty::YAML::Dump(
-                    $self->_session
+        -value   => encode_base64(
+            $self->_cipher->encrypt(
+                Compress::Zlib::compress(
+                    Storable::nfreeze(
+                        $self->_session
+                    )
                 )
             )
         )

Modified: jifty/branches/virtual-models/share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/index.html
==============================================================================
--- jifty/branches/virtual-models/share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/index.html	(original)
+++ jifty/branches/virtual-models/share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/index.html	Thu Feb 14 14:59:21 2008
@@ -20,7 +20,7 @@
 <ul>
 % foreach my $action (Jifty->api->actions) {
 % next unless (Jifty::Util->try_to_require($action));
-% next if ( $action->can('autogenerated') and $action->autogenerated);
+% next if ( Jifty::ClassLoader->autogenerated($action) );
 <li><% Jifty->web->link( url => '/__jifty/admin/action/'.$action, label => $action) %></li>
 % }
 </ul>

Modified: jifty/branches/virtual-models/share/plugins/Jifty/Plugin/CSSQuery/web/static/js/cssquery/cssQuery.js
==============================================================================
--- /jifty/branches/virtual-models/share/web/static/js/cssquery/cssQuery.js	(original)
+++ jifty/branches/virtual-models/share/plugins/Jifty/Plugin/CSSQuery/web/static/js/cssquery/cssQuery.js	Thu Feb 14 14:59:21 2008
@@ -5,6 +5,9 @@
 
 	Modifed by Nelson Elhage <nelhage at bestpractical.com>
 	(2006-06-21) to optimize selection by ID on non-IE browsers
+
+    Modified by Shawn M Moore <sartak at bestpractical.com>
+    (2007-12-07) sped up thisElement, descendent selector, and class selector
 */
 
 // the following functions allow querying of the DOM using CSS selectors
@@ -106,8 +109,40 @@
 // selectors
 // -----------------------------------------------------------------------
 
+// Jifty: special case of the descent selector. this is by far the most time
+// consuming code path of JS. special casing and caching it saves roughly
+// 15% of JS time
+selectAllCache = {};
+selectAll = function($results, $from) {
+    var cache = selectAllCache[$from];
+    var i;
+
+    if (!cache) {
+        var $element, $subset, j;
+        var $elements = new Array();
+
+        for (i = 0; i < $from.length; i++) {
+            $subset = $from[i].getElementsByTagName("*");
+            for (j = 0; ($element = $subset[j]); j++) {
+                if (thisElement($element))
+                    $elements.push($element);
+            }
+        }
+
+        selectAllCache[$from] = cache = $elements;
+    }
+
+    for (i in cache) {
+        $results.push(cache[i]);
+    }
+};
+
 // descendant selector
 selectors[" "] = function($results, $from, $tagName, $namespace) {
+    if ($tagName == "*" && $namespace == "") {
+        return selectAll($results, $from);
+    }
+
 	// loop through current selection
 	var $element, i, j;
 	for (i = 0; i < $from.length; i++) {
@@ -130,12 +165,14 @@
 
 // class selector
 selectors["."] = function($results, $from, $className) {
-	// create a RegExp version of the class
-	$className = new RegExp("(^|\\s)" + $className + "(\\s|$)");
-	// loop through current selection and check class
-	var $element, i;
-	for (i = 0; ($element = $from[i]); i++)
-		if ($className.test($element.className)) $results.push($element);
+    $className = " " + $className + " ";
+    var $element, i;
+    for (i = 0; ($element = $from[i]); i++) {
+        var classes = " " + $element.className + " ";
+        if (classes.indexOf($className) > -1) {
+            $results.push($element);
+        }
+    }
 };
 
 // pseudo-class selector
@@ -169,9 +206,20 @@
 
 // IE5/6 includes comments (LOL) in it's elements collections.
 // so we have to check for this. the test is tagName != "!". LOL (again).
-var thisElement = function($element) {
-	return ($element && $element.nodeType == 1 && $element.tagName != "!") ? $element : null;
-};
+
+// Jifty: since we call this a LOT (11000 times for Hiveminder's /) we check
+// tagName only if IE. this cuts its runtime to half in all but IE
+var thisElement;
+if (Prototype.Browser.IE) {
+    thisElement = function($element) {
+        return ($element && $element.nodeType == 1 && $element.tagName != "!") ? $element : null;
+    };
+}
+else {
+    thisElement = function($element) {
+        return ($element && $element.nodeType == 1) ? $element : null;
+    };
+}
 
 // return the previous element to the supplied element
 //  previousSibling is not good enough as it might return a text or comment node

Modified: jifty/branches/virtual-models/share/plugins/Jifty/Plugin/Chart/web/static/js/chart_img_behaviour.js
==============================================================================
--- jifty/branches/virtual-models/share/plugins/Jifty/Plugin/Chart/web/static/js/chart_img_behaviour.js	(original)
+++ jifty/branches/virtual-models/share/plugins/Jifty/Plugin/Chart/web/static/js/chart_img_behaviour.js	Thu Feb 14 14:59:21 2008
@@ -10,7 +10,7 @@
         var url = e.src;
 
         var path  = url;
-        var query = $H();
+        var query = new Hash();
 
         if (url.indexOf('?') >= 0) {
             var path_and_query = url.split('?');
@@ -19,14 +19,14 @@
             var query_params = path_and_query[1].split('&');
             for (var query_param in query_params) {
                 var key_and_value = query_param.split('=');
-                query[ key_and_value[0] ] = key_and_value[1];
+                query.set(key_and_value[0], key_and_value[1]);
             }
         }
 
-        query['width']  = dim.width + 'px';
-        query['height'] = dim.height + 'px';
+        query.set('width', dim.width + 'px');
+        query.set('height', dim.height + 'px');
 
-        url = path + '?' + $H(query).toQueryString();
+        url = path + '?' + query.toQueryString();
 
         e.src = url;
     }

Modified: jifty/branches/virtual-models/share/plugins/Jifty/Plugin/Chart/web/static/js/simple_bars.js
==============================================================================
--- jifty/branches/virtual-models/share/plugins/Jifty/Plugin/Chart/web/static/js/simple_bars.js	(original)
+++ jifty/branches/virtual-models/share/plugins/Jifty/Plugin/Chart/web/static/js/simple_bars.js	Thu Feb 14 14:59:21 2008
@@ -13,57 +13,52 @@
  */
 
 function SimpleBars(table) {
-    var dataset = $H();
+    var dataSet = {};
 
-    for (var i = 0; i < table.tBodies[0].rows.length; i++) {
-        var table_row = table.tBodies[0].rows[i];
-        dataset[table_row.cells[0].innerHTML] = table_row.cells[1].innerHTML;
-    }
+    jQuery('tr', table).each(function() {
+        dataSet[ jQuery(this.cells[0]).text() ] = jQuery(this.cells[1]).text();
+    });
 
-    var max_value = 0;
-    dataset.values().each(function(v,i){max_value=Math.max(max_value, v);});
+    var maxValue = 0;
+    for (var name in dataSet) {
+        maxValue = Math.max(maxValue, dataSet[name]);
+    }
 
-    var simple_bars = document.createElement('div');
-    simple_bars.id = table.id;
-    simple_bars.className = table.className;
-
-    dataset.keys().each(function(k, i) {
-        var v = dataset[k];
-
-        var row = document.createElement('div');
-        row.className = 'row';
-
-        var row_label = document.createElement('span');
-        row_label.className = 'label';
-        row_label.innerHTML = k;
-        row.appendChild(row_label);
-
-        var row_bar_area = document.createElement('span');
-        row_bar_area.className = 'barArea';
-        row.appendChild(row_bar_area);
-
-        var row_bar = document.createElement('span');
-        row_bar.className = 'bar';
-        row_bar.style.width = Math.round( 100 * v / max_value ) + '%';
-        row_bar.innerHTML = '&nbsp;';
-        row_bar_area.appendChild(row_bar);
-
-        var row_value = document.createElement('span');
-        row_value.className = 'value';
-        row_value.innerHTML = v;
-        row.appendChild(row_value);
+    var simpleBars 
+        = jQuery("<div/>")
+            .attr('id', table.attr('id'))
+            .attr('class', table.attr('class'));
+
+    for (var k in dataSet) {
+        var v = dataSet[k];
+
+        var row = jQuery('<div class="row"/>');
+        jQuery('<span class="label"/>')
+            .text(k)
+            .appendTo(row);
+
+        var rowBarArea = jQuery('<span class="barArea"/>');
+        jQuery('<span class="bar"/>')
+            .css('width', Math.round( 100 * v / maxValue ) + '%')
+            .html('&nbsp;')
+            .appendTo(rowBarArea);
+        rowBarArea.appendTo(row);
+
+        jQuery('<span class="value"/>')
+            .text(v)
+            .appendTo(row);
 
-        simple_bars.appendChild(row);
-    });
+        simpleBars.append(row);
+    }
 
-    table.parentNode.insertBefore(simple_bars, table);
-    table.parentNode.removeChild(table);
+    table.before(simpleBars);
+    table.remove();
 
     return this;
 }
 
 Behaviour.register({
     'table.simple_bars': function(table) {
-        new SimpleBars(table);
+        new SimpleBars(jQuery(table));
     }
 });

Modified: jifty/branches/virtual-models/share/po/zh_tw.po
==============================================================================
--- jifty/branches/virtual-models/share/po/zh_tw.po	(original)
+++ jifty/branches/virtual-models/share/po/zh_tw.po	Thu Feb 14 14:59:21 2008
@@ -375,7 +375,7 @@
 
 #: lib/Jifty/Plugin/OpenID/Action/AuthenticateOpenID.pm:59
 msgid "Invalid OpenID URL.  Please check to make sure it is correct.  (@{[$csr->err]})"
-msgstr ""
+msgstr "不正確的 OpenID 網址. (@{[$csr->err]})"
 
 #: lib/Jifty/Plugin/Authentication/Password/Action/Login.pm:63 lib/Jifty/Plugin/Authentication/Password/Action/SendAccountConfirmation.pm:75 lib/Jifty/Plugin/Authentication/Password/Action/SendPasswordReminder.pm:79
 msgid "It doesn't look like there's an account by that name."
@@ -383,11 +383,11 @@
 
 #: lib/Jifty/Plugin/User/Mixin/Model/User.pm:106
 msgid "It looks like somebody else is using that address. Is there a chance you have another account?"
-msgstr ""
+msgstr "已經有其他人使用這個電郵地址. 您是否已經有其他帳號了?"
 
 #: lib/Jifty/Plugin/OpenID/Dispatcher.pm:43
 msgid "It looks like someone is already using that OpenID."
-msgstr ""
+msgstr "已經有其他人使用此 OpenID."
 
 #: lib/Jifty/Plugin/Authentication/Password/Action/Signup.pm:75
 msgid "It looks like you already have an account. Perhaps you want to <a href=\"/login\">log in</a> instead?"
@@ -511,7 +511,7 @@
 
 #: lib/Jifty/Plugin/OpenID/Action/AuthenticateOpenID.pm:27
 msgid "OpenID URL"
-msgstr ""
+msgstr "OpenID 網址"
 
 #: lib/Jifty/Plugin/OpenID/Action/VerifyOpenID.pm:54
 msgid "OpenID verification failed.  It looks like you cancelled the OpenID verification request."

Modified: jifty/branches/virtual-models/share/web/static/css/base.css
==============================================================================
--- jifty/branches/virtual-models/share/web/static/css/base.css	(original)
+++ jifty/branches/virtual-models/share/web/static/css/base.css	Thu Feb 14 14:59:21 2008
@@ -60,6 +60,10 @@
     float: right;
 }
 
+div#jifty-region, div#jifty-region-lazy {
+    display: inline;
+}
+
 
 
 div.warning {

Modified: jifty/branches/virtual-models/share/web/static/css/halos.css
==============================================================================
--- jifty/branches/virtual-models/share/web/static/css/halos.css	(original)
+++ jifty/branches/virtual-models/share/web/static/css/halos.css	Thu Feb 14 14:59:21 2008
@@ -1,3 +1,38 @@
+.halo {
+    border-color: #ffd700;
+    border-style: solid;
+    border-width: 0;
+    margin: 0;
+    padding: 0;
+}
+
+.halo-header {
+    display: none;
+    border-bottom: 1px solid #ffd700;
+    background: #fff;
+    margin: 3px;
+}
+
+.halo-rendermode {
+    float: right;
+}
+
+.halo-source {
+    font-family: monospace;
+}
+
+.halo-argument {
+    position: absolute;
+    left: 200px;
+    border: 1px solid black;
+    background: #ccc;
+    padding: 1em;
+    padding-top: 0;
+    width: 300px;
+    height: 500px;
+    overflow: auto;
+}
+
 .halo_actions {
     position: fixed;
     border: 1px solid black;
@@ -96,7 +131,7 @@
 
 #render_info {
     position: fixed;
-    right:0.5em;
+    right:.5em;
     bottom:0;
 }
 

Modified: jifty/branches/virtual-models/share/web/static/css/main.css
==============================================================================
--- jifty/branches/virtual-models/share/web/static/css/main.css	(original)
+++ jifty/branches/virtual-models/share/web/static/css/main.css	Thu Feb 14 14:59:21 2008
@@ -9,6 +9,8 @@
 @import "halos.css";
 @import "app.css";
 @import "autocomplete.css";
+ at import "yui/calendar/calendar-core.css";
 @import "yui/calendar/calendar.css";
+ at import "yui/menu/menu-core.css";
 @import "yui/menu/menu.css";
 @import "notices.css";

Added: jifty/branches/virtual-models/share/web/static/css/yui/calendar/calendar-core.css
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/share/web/static/css/yui/calendar/calendar-core.css	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,126 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.4.1
+*/
+/**
+ * CORE
+ *
+ * This is the set of CSS rules required by Calendar to drive core functionality and structure.
+ * Changes to these rules may result in the Calendar not functioning or rendering correctly.
+ *
+ * They should not be modified for skinning.
+ **/
+ 
+/* CALENDAR BOUNDING BOX */
+.yui-calcontainer {
+	position:relative;
+	float:left;
+	_overflow:hidden; /* IE6 only, to clip iframe shim */
+}
+
+/* IFRAME SHIM */
+.yui-calcontainer iframe {
+	position:absolute;
+	border:none;
+	margin:0;padding:0;
+	z-index:0;
+	width:100%;
+	height:100%;
+	left:0px;
+	top:0px;
+}
+
+/* IFRAME SHIM IE6 only */
+.yui-calcontainer iframe.fixedsize {
+	width:50em;
+	height:50em;
+	top:-1px;
+	left:-1px;
+}
+
+/* BOUNDING BOX FOR EACH CALENDAR GROUP PAGE */
+.yui-calcontainer.multi .groupcal {
+	z-index:1;
+	float:left;
+	position:relative;
+}
+
+/* TITLE BAR */
+.yui-calcontainer .title {
+	position:relative;
+	z-index:1;
+}
+
+/* CLOSE ICON CONTAINER */
+.yui-calcontainer .close-icon {
+	position:absolute;
+	z-index:1;
+}
+
+/* CALENDAR TABLE */
+.yui-calendar {
+	position:relative;
+}
+
+/* NAVBAR LEFT ARROW CONTAINER */
+.yui-calendar .calnavleft {
+	position:absolute;
+	z-index:1;
+}
+
+/* NAVBAR RIGHT ARROW CONTAINER */
+.yui-calendar .calnavright {
+	position:absolute;
+	z-index:1;
+}
+
+/* NAVBAR TEXT CONTAINER */
+.yui-calendar .calheader {
+	position:relative;
+	width:100%;
+	text-align:center;
+}
+
+/* CalendarNavigator */
+.yui-calcontainer .yui-cal-nav-mask {
+	position:absolute;
+	z-index:2;
+	margin:0;
+	padding:0;
+	width:100%;
+	height:100%;
+	_width:0;    /* IE6, IE7 quirks - width/height set programmatically to match container */
+	_height:0;
+	left:0;
+	top:0;
+	display:none;
+}
+
+/* NAVIGATOR BOUNDING BOX */
+.yui-calcontainer .yui-cal-nav {
+	position:absolute;
+	z-index:3;
+	top:0;
+	display:none;
+}
+
+/* NAVIGATOR BUTTONS (based on button-core.css) */
+.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn  {
+	display: -moz-inline-box; /* Gecko */
+	display: inline-block; /* IE, Opera and Safari */
+}
+
+.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn button {
+	display: block;
+	*display: inline-block; /* IE */
+	*overflow: visible; /* Remove superfluous padding for IE */
+	border: none;
+	background-color: transparent;
+	cursor: pointer;
+}
+
+/* Specific changes for calendar running under fonts/reset */
+.yui-calendar .calbody a:hover {background:inherit;}
+p#clear {clear:left; padding-top:10px;}
\ No newline at end of file

Modified: jifty/branches/virtual-models/share/web/static/css/yui/calendar/calendar.css
==============================================================================
--- jifty/branches/virtual-models/share/web/static/css/yui/calendar/calendar.css	(original)
+++ jifty/branches/virtual-models/share/web/static/css/yui/calendar/calendar.css	Thu Feb 14 14:59:21 2008
@@ -2,7 +2,7 @@
 Copyright (c) 2007, Yahoo! Inc. All rights reserved.
 Code licensed under the BSD License:
 http://developer.yahoo.net/yui/license.txt
-version: 2.2.1
+version: 2.4.1
 */
 .yui-calcontainer {
 	position:relative;
@@ -10,18 +10,26 @@
 	background-color:#F7F9FB;
 	border:1px solid #7B9EBD;
 	float:left;
-	overflow:hidden;
+	_overflow:hidden; /* IE6 only, to clip iframe shim */
 }
 
 .yui-calcontainer iframe {
 	position:absolute;
 	border:none;
 	margin:0;padding:0;
-	left:-1px;
-	top:-1px;
 	z-index:0;
+	width:100%;
+	height:100%;
+	left:0px;
+	top:0px;
+}
+
+/* IE6 only */
+.yui-calcontainer iframe.fixedsize {
 	width:50em;
 	height:50em;
+	top:-1px;
+	left:-1px;
 }
 
 .yui-calcontainer.multi {
@@ -57,7 +65,7 @@
 }
 
 .yui-calcontainer .calclose {
-	background: url("calx.gif") no-repeat;
+	background: url("/static/images/yui/calendar/calx.gif") no-repeat;
 	width:17px;
 	height:13px;
 	cursor:pointer;	
@@ -83,10 +91,10 @@
 	top:2px;
 	bottom:0;
 	width:9px;
-	height:12px;   
+	height:12px;
 	left:2px;
 	z-index:1;
-	background: url("callt.gif") no-repeat;
+	background: url("/static/images/yui/calendar/callt.gif") no-repeat;
 }
 
 .yui-calendar .calnavright {
@@ -98,7 +106,7 @@
 	height:12px;
 	right:2px;
 	z-index:1;
-	background: url("calrt.gif") no-repeat;
+	background: url("/static/images/yui/calendar/calrt.gif") no-repeat;
 }
 
 .yui-calendar td.calcell {
@@ -192,6 +200,115 @@
 	border-right-width:2px;
 }
 
+/* CalendarNavigator */
+.yui-calendar a.calnav {
+	_position:relative;
+	padding-left:2px;
+	padding-right:2px;
+	text-decoration:none;
+	color:#000;
+}
+
+.yui-calendar a.calnav:hover {
+	border:1px solid #003366;
+	background-color:#6699cc;
+	background: url(/static/images/yui/calendar/calgrad.png) repeat-x;
+	color:#fff;
+	cursor:pointer;
+}
+
+.yui-calcontainer .yui-cal-nav-mask {
+	position:absolute;
+	z-index:2;
+	display:none;
+
+	margin:0;
+	padding:0;
+
+	left:0;
+	top:0;
+	width:100%;
+	height:100%;
+	_width:0;    /* IE6, IE7 Quirks - width/height set programmatically to match container */
+	_height:0;
+
+	background-color:#000;
+	opacity:0.25;
+	*filter:alpha(opacity=25);
+}
+
+.yui-calcontainer .yui-cal-nav {
+	position:absolute;
+	z-index:3;
+	display:none;
+
+	padding:0;
+	top:1.5em;
+	left:50%;
+	width:12em;
+	margin-left:-6em;
+
+	border:1px solid #7B9EBD;
+	background-color:#F7F9FB;
+	font-size:93%;
+}
+
+.yui-calcontainer.withtitle .yui-cal-nav {
+	top:3.5em;
+}
+
+.yui-calcontainer .yui-cal-nav-y,
+.yui-calcontainer .yui-cal-nav-m,
+.yui-calcontainer .yui-cal-nav-b {
+	padding:2px 5px 2px 5px;
+}
+
+.yui-calcontainer .yui-cal-nav-b {
+	text-align:center;
+}
+
+.yui-calcontainer .yui-cal-nav-e {
+	margin-top:2px;
+	padding:2px;
+	background-color:#EDF5FF;
+	border-top:1px solid black;
+	display:none;
+}
+
+.yui-calcontainer .yui-cal-nav label {
+	display:block;
+	font-weight:bold;
+}
+
+.yui-calcontainer .yui-cal-nav-mc {
+	width:100%;
+	_width:auto; /* IE6 doesn't like width 100% */
+}
+
+.yui-calcontainer .yui-cal-nav-y input.yui-invalid {
+	background-color:#FFEE69;
+	border: 1px solid #000;
+}
+
+.yui-calcontainer .yui-cal-nav-yc {
+	width:3em;
+}
+
+.yui-calcontainer .yui-cal-nav-b button {
+	font-size:93%;
+	text-decoration:none;
+	cursor: pointer;
+	background-color: #79b2ea;
+	border: 1px solid #003366;
+	border-top-color:#FFF;
+	border-left-color:#FFF;
+	margin:1px;
+}
+
+.yui-calcontainer .yui-cal-nav-b .yui-default button {
+	/* not implemented */
+}
+
 /* Specific changes for calendar running under fonts/reset */
 .yui-calendar .calbody a:hover {background:inherit;}
 p#clear {clear:left; padding-top:10px;}

Added: jifty/branches/virtual-models/share/web/static/css/yui/menu/menu-core.css
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/share/web/static/css/yui/menu/menu-core.css	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,235 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.4.1
+*/
+/* Menu & MenuBar styles */
+
+.yuimenubar {
+
+    visibility: visible;
+    position: static;
+
+}
+
+.yuimenu .yuimenu,
+.yuimenubar .yuimenu {
+
+    visibility: hidden;
+    position: absolute;
+    top: -10000px;
+    left: -10000px;
+
+}
+
+.yuimenubar li, 
+.yuimenu li {
+
+    list-style-type: none;    
+
+}
+
+.yuimenubar ul, 
+.yuimenu ul,
+.yuimenubar li, 
+.yuimenu li,
+.yuimenu h6,
+.yuimenubar h6 { 
+
+    margin: 0;
+    padding: 0;
+
+}
+
+.yuimenuitemlabel,
+.yuimenubaritemlabel {
+
+    text-align: left;
+    white-space: nowrap;
+
+}
+
+
+/* 
+    The following style rule trigger the "hasLayout" property in 
+    IE (http://msdn2.microsoft.com/en-us/library/ms533776.aspx) for a
+    MenuBar instance's <ul> element, allowing both to clear their floated 
+    child <li> elements.
+*/
+
+.yuimenubar ul {
+
+    *zoom: 1;
+
+}
+
+
+/* 
+    Remove the "hasLayout" trigger for submenus of MenuBar instances as it 
+    is unnecessary. 
+*/
+
+.yuimenubar .yuimenu ul {
+
+    *zoom: normal;
+
+}
+
+/*
+    The following style rule allows a MenuBar instance's <ul> element to clear
+    its floated <li> elements in Firefox, Safari and and Opera.
+*/
+
+.yuimenubar>.bd>ul:after {
+
+    content: ".";
+    display: block;
+    clear: both;
+    visibility: hidden;
+    height: 0;
+    line-height: 0;
+
+}
+
+.yuimenubaritem {
+
+    float: left;
+
+}
+
+.yuimenubaritemlabel,
+.yuimenuitemlabel {
+
+    display: block;
+
+}
+
+.yuimenuitemlabel .helptext {
+
+    font-style: normal;
+    display: block;
+    
+    /*
+        The value for the left margin controls how much the help text is
+        offset from the text of the menu item.  This value will need to 
+        be customized depending on the longest text label of a menu item.
+    */
+    
+    margin: -1em 0 0 10em;
+    
+}
+
+/*
+    PLEASE NOTE: The <div> element used for a menu's shadow is appended 
+    to its root element via JavaScript once it has been rendered.  The 
+    code that creates the shadow lives in the menu's public "onRender" 
+    event handler that is a prototype method of YAHOO.widget.Menu.  
+    Implementers wishing to remove a menu's shadow or add any other markup
+    required for a given skin for menu should override the "onRender" method.
+*/
+
+.yui-menu-shadow {
+
+    position: absolute;
+    visibility: hidden;
+    z-index: -1;
+
+}
+
+.yui-skin-sam .yui-menu-shadow-visible {
+
+    top: 2px;
+    right: -3px;
+    left: -3px;
+    bottom: -3px;
+    visibility: visible;
+
+}
+
+
+/*
+
+There are two known issues with YAHOO.widget.Overlay (the superclass class of 
+Menu) that manifest in Gecko-based browsers on Mac OS X:
+
+    1) Elements with scrollbars will poke through Overlay instances floating 
+       above them.
+    
+    2) An Overlay's scrollbars and the scrollbars of its child nodes remain  
+       visible when the Overlay is hidden.
+
+To fix these bugs in Menu (a subclass of YAHOO.widget.Overlay):
+
+    1) The "overflow" property of a Menu instance's shadow element and child 
+       nodes is toggled between "hidden" and "auto" (through the application  
+       and removal of the "hide-scrollbars" and "show-scrollbars" CSS classes)
+       as its "visibility" configuration property is toggled between 
+       "false" and "true."
+    
+    2) The "display" property of <select> elements that are child nodes of the 
+       Menu instance's root element is set to "none" when it is hidden.
+
+PLEASE NOTE:  
+  
+    1) The "hide-scrollbars" and "show-scrollbars" CSS classes classes are 
+       applied only for Gecko on Mac OS X and are added/removed to/from the 
+       Overlay's root HTML element (DIV) via the "hideMacGeckoScrollbars" and 
+       "showMacGeckoScrollbars" methods of YAHOO.widget.Overlay.
+    
+    2) There may be instances where the CSS for a web page or application 
+       contains style rules whose specificity override the rules implemented by 
+       the Menu CSS files to fix this bug.  In such cases, is necessary to 
+       leverage the provided "hide-scrollbars" and "show-scrollbars" classes to 
+       write custom style rules to guard against this bug.
+
+** For more information on this issue, see:
+
+   + https://bugzilla.mozilla.org/show_bug.cgi?id=187435
+   + SourceForge bug #1723530
+
+*/
+
+.hide-scrollbars * {
+
+	overflow: hidden;
+
+}
+
+.hide-scrollbars select {
+
+	display: none;
+
+}
+
+
+/*
+
+The following style rule (".yuimenu.show-scrollbars") overrides the 
+".show-scrollbars" rule defined in container-core.css which sets the 
+"overflow" property of a YAHOO.widget.Overlay instance's root HTML element to 
+"auto" when it is visible.  Without this override, a Menu would have scrollbars
+when one of its submenus is visible.
+
+*/
+
+.yuimenu.show-scrollbars,
+.yuimenubar.show-scrollbars {
+
+	overflow: visible; 
+
+}
+
+.yuimenu.hide-scrollbars .yui-menu-shadow,
+.yuimenubar.hide-scrollbars .yui-menu-shadow {
+
+    overflow: hidden;
+
+}
+
+.yuimenu.show-scrollbars .yui-menu-shadow,
+.yuimenubar.show-scrollbars .yui-menu-shadow {
+
+    overflow: auto;
+
+}
\ No newline at end of file

Modified: jifty/branches/virtual-models/share/web/static/css/yui/menu/menu.css
==============================================================================
--- jifty/branches/virtual-models/share/web/static/css/yui/menu/menu.css	(original)
+++ jifty/branches/virtual-models/share/web/static/css/yui/menu/menu.css	Thu Feb 14 14:59:21 2008
@@ -2,400 +2,493 @@
 Copyright (c) 2007, Yahoo! Inc. All rights reserved.
 Code licensed under the BSD License:
 http://developer.yahoo.net/yui/license.txt
-version: 2.2.1
+version: 2.4.1
 */
-/* Menu styles */
+/* Menu & MenuBar styles */
 
-div.yuimenu {
+.yuimenubar {
+
+    visibility: visible;
+    position: static;
 
-    background-color:#f6f7ee;
-    border:solid 1px #c4c4be;
-    padding:1px;
-    
 }
 
-/* Submenus are positioned absolute and hidden by default */
+.yuimenu .yuimenu,
+.yuimenubar .yuimenu {
+
+    visibility: hidden;
+    position: absolute;
+    top: -10000px;
+    left: -10000px;
 
-div.yuimenu div.yuimenu,
-div.yuimenubar div.yuimenu {
+}
+
+.yuimenubar li, 
+.yuimenu li {
 
-    position:absolute;
-    visibility:hidden;
+    list-style-type: none;    
 
 }
 
-/* MenuBar Styles */
+.yuimenubar ul, 
+.yuimenu ul,
+.yuimenubar li, 
+.yuimenu li,
+.yuimenu h6,
+.yuimenubar h6 { 
 
-div.yuimenubar {
+    margin: 0;
+    padding: 0;
 
-    background-color:#f6f7ee;
-    
 }
 
-/*
-    Applying a width triggers "haslayout" in IE so that the module's
-    body clears its floated elements
-*/
-div.yuimenubar div.bd {
+.yuimenuitemlabel,
+.yuimenubaritemlabel {
 
-    width:100%;
+    text-align: left;
+    white-space: nowrap;
 
 }
 
-/*
-    Clear the module body for other browsers
+
+/* 
+    The following style rule trigger the "hasLayout" property in 
+    IE (http://msdn2.microsoft.com/en-us/library/ms533776.aspx) for a
+    MenuBar instance's <ul> element, allowing both to clear their floated 
+    child <li> elements.
 */
-div.yuimenubar div.bd:after {
 
-    content:'.';
-    display:block;
-    clear:both;
-    visibility:hidden;
-    height:0;
+.yuimenubar ul {
+
+    *zoom: 1;
 
 }
 
-/* Matches the group title (H6) inside a Menu or MenuBar instance */
 
-div.yuimenu h6,
-div.yuimenubar h6 { 
+/* 
+    Remove the "hasLayout" trigger for submenus of MenuBar instances as it 
+    is unnecessary. 
+*/
+
+.yuimenubar .yuimenu ul {
 
-    font-size:100%;
-    font-weight:normal;    
-    margin:0;
-    border:solid 1px #c4c4be;
-    color:#b9b9b9;    
+    *zoom: normal;
 
 }
 
-div.yuimenubar h6 {
+/*
+    The following style rule allows a MenuBar instance's <ul> element to clear
+    its floated <li> elements in Firefox, Safari and and Opera.
+*/
+
+.yuimenubar>.bd>ul:after {
+
+    content: ".";
+    display: block;
+    clear: both;
+    visibility: hidden;
+    height: 0;
+    line-height: 0;
 
-    float:left;
-    display:inline; /* Prevent margin doubling in IE */
-    padding:4px 12px;
-    border-width:0 1px 0 0;
-    
 }
 
-div.yuimenu h6 {
+.yuimenubaritem {
 
-    float:none;
-    display:block;
-    border-width:1px 0 0 0;
-    padding:5px 10px 0 10px;
+    float: left;
 
 }
 
-/* Matches the UL inside a Menu or MenuBar instance */
+.yuimenubaritemlabel,
+.yuimenuitemlabel {
 
-div.yuimenubar ul {
+    display: block;
 
-    list-style-type:none;
-    margin:0;
-    padding:0;
+}
+
+.yuimenuitemlabel .helptext {
 
+    font-style: normal;
+    display: block;
+    
+    /*
+        The value for the left margin controls how much the help text is
+        offset from the text of the menu item.  This value will need to 
+        be customized depending on the longest text label of a menu item.
+    */
+    
+    margin: -1em 0 0 10em;
+    
 }
 
-div.yuimenu ul {
+/*
+    PLEASE NOTE: The <div> element used for a menu's shadow is appended 
+    to its root element via JavaScript once it has been rendered.  The 
+    code that creates the shadow lives in the menu's public "onRender" 
+    event handler that is a prototype method of YAHOO.widget.Menu.  
+    Implementers wishing to remove a menu's shadow or add any other markup
+    required for a given skin for menu should override the "onRender" method.
+*/
+
+.yui-menu-shadow {
 
-    list-style-type:none;
-    border:solid 1px #c4c4be;
-    border-width:1px 0 0 0;
-    margin:0;
-    padding:10px 0;
+    position: absolute;
+    visibility: hidden;
+    z-index: -1;
 
 }
 
-div.yuimenu ul.first-of-type, 
-div.yuimenu ul.hastitle,
-div.yuimenu h6.first-of-type {
+.yui-skin-sam .yui-menu-shadow-visible {
 
-    border-width:0;
+    top: 2px;
+    right: -3px;
+    left: -3px;
+    bottom: -3px;
+    visibility: visible;
 
 }
 
+
 /*
-    Styles for the menu's header and footer elements that are used as controls 
-    to scroll the menu's body element when the menu's height exceeds the 
-    value of the "maxheight" configuration property.
+
+There are two known issues with YAHOO.widget.Overlay (the superclass class of 
+Menu) that manifest in Gecko-based browsers on Mac OS X:
+
+    1) Elements with scrollbars will poke through Overlay instances floating 
+       above them.
+    
+    2) An Overlay's scrollbars and the scrollbars of its child nodes remain  
+       visible when the Overlay is hidden.
+
+To fix these bugs in Menu (a subclass of YAHOO.widget.Overlay):
+
+    1) The "overflow" property of a Menu instance's shadow element and child 
+       nodes is toggled between "hidden" and "auto" (through the application  
+       and removal of the "hide-scrollbars" and "show-scrollbars" CSS classes)
+       as its "visibility" configuration property is toggled between 
+       "false" and "true."
+    
+    2) The "display" property of <select> elements that are child nodes of the 
+       Menu instance's root element is set to "none" when it is hidden.
+
+PLEASE NOTE:  
+  
+    1) The "hide-scrollbars" and "show-scrollbars" CSS classes classes are 
+       applied only for Gecko on Mac OS X and are added/removed to/from the 
+       Overlay's root HTML element (DIV) via the "hideMacGeckoScrollbars" and 
+       "showMacGeckoScrollbars" methods of YAHOO.widget.Overlay.
+    
+    2) There may be instances where the CSS for a web page or application 
+       contains style rules whose specificity override the rules implemented by 
+       the Menu CSS files to fix this bug.  In such cases, is necessary to 
+       leverage the provided "hide-scrollbars" and "show-scrollbars" classes to 
+       write custom style rules to guard against this bug.
+
+** For more information on this issue, see:
+
+   + https://bugzilla.mozilla.org/show_bug.cgi?id=187435
+   + SourceForge bug #1723530
+
 */
 
-div.yuimenu div.topscrollbar,
-div.yuimenu div.bottomscrollbar {
+.hide-scrollbars * {
 
-    height:16px;
-    background-image:url(map.gif);
-    background-repeat:no-repeat;
+	overflow: hidden;
 
 }
 
+.hide-scrollbars select {
 
-div.yuimenu div.topscrollbar {
-
-    background-image:url(map.gif);
-    background-position:center -72px;
+	display: none;
 
 }
 
 
-div.yuimenu div.topscrollbar_disabled {
+/*
+
+The following style rule (".yuimenu.show-scrollbars") overrides the 
+".show-scrollbars" rule defined in container-core.css which sets the 
+"overflow" property of a YAHOO.widget.Overlay instance's root HTML element to 
+"auto" when it is visible.  Without this override, a Menu would have scrollbars
+when one of its submenus is visible.
+
+*/
+
+.yuimenu.show-scrollbars,
+.yuimenubar.show-scrollbars {
 
-    background-image:url(map.gif);
-    background-position:center -88px;
+	overflow: visible; 
 
 }
 
+.yuimenu.hide-scrollbars .yui-menu-shadow,
+.yuimenubar.hide-scrollbars .yui-menu-shadow {
+
+    overflow: hidden;
 
-div.yuimenu div.bottomscrollbar {
+}
 
-    background-image:url(map.gif);
-    background-position:center -104px;
+.yuimenu.show-scrollbars .yui-menu-shadow,
+.yuimenubar.show-scrollbars .yui-menu-shadow {
+
+    overflow: auto;
 
 }
 
 
-div.yuimenu div.bottomscrollbar_disabled {
+/* MenuBar style rules */
 
-    background-image:url(map.gif);
-    background-position:center -120px;
+.yuimenubar {
 
+    background-color: #f6f7ee;
+    
 }
 
 
-/* MenuItem and MenuBarItem styles */
 
-div.yuimenu li,
-div.yuimenubar li {
+/* Menu style rules */
 
-    font-size:85%;
-    cursor:pointer;
-    cursor:hand;
-    white-space:nowrap;
-    text-align:left;
+.yuimenu {
 
+    background-color: #f6f7ee;
+    border: solid 1px #c4c4be;
+    padding: 1px;
+    
 }
 
-div.yuimenu li.yuimenuitem {
+.yui-menu-shadow {
+
+    display: none;
 
-    padding:2px 24px;
-    
 }
 
-div.yuimenu li li,
-div.yuimenubar li li {
+.yuimenu ul {
 
-    font-size:100%;
+    border: solid 1px #c4c4be;
+    border-width: 1px 0 0 0;
+    padding: 10px 0;
 
 }
 
+.yuimenu .yui-menu-body-scrolled {
 
-/* Matches the help text for a menu item */
+    overflow: hidden;
 
-div.yuimenu li.hashelptext em.helptext {
+}
+
+
+/* Group titles */
 
-    font-style:normal;
-    margin:0 0 0 40px;
+.yuimenu h6,
+.yuimenubar h6 { 
+
+    font-size: 100%;
+    font-weight: normal;
+    border: solid 1px #c4c4be;
+    color: #b9b9b9;    
 
 }
 
-div.yuimenu li a,
-div.yuimenubar li a {
-    
-    /*
-        "zoom:1" triggers "haslayout" in IE to ensure that the mouseover and 
-        mouseout events bubble to the parent LI in IE.
-    */
-    zoom:1;
-    color:#000;
-    text-decoration:none;
-    
+.yuimenubar h6 {
+
+    float: left;
+    padding: 4px 12px;
+    border-width: 0 1px 0 0;
+
 }
 
-div.yuimenu li.hassubmenu,
-div.yuimenu li.hashelptext {
+.yuimenubar .yuimenu h6 {
 
-    text-align:right;
+    float: none;
 
 }
 
-div.yuimenu li.hassubmenu a.hassubmenu,
-div.yuimenu li.hashelptext a.hashelptext {
+.yuimenu h6 {
 
-    /*
-        Need to apply float immediately for IE or help text will jump to the 
-        next line 
-    */
+    border-width: 1px 0 0 0;
+    padding: 5px 10px 0 10px;
 
-    *float:left;
-    *display:inline; /* Prevent margin doubling in IE */
-    text-align:left;
+}
+
+.yuimenu ul.first-of-type, 
+.yuimenu ul.hastitle,
+.yuimenu h6.first-of-type {
+
+    border-width: 0;
 
 }
 
-div.yuimenu.visible li.hassubmenu a.hassubmenu, 
-div.yuimenu.visible li.hashelptext a.hashelptext {
 
-    /*
-        Apply the float only when the menu is visible to prevent the help
-        text from wrapping to the next line in Opera.
-    */
 
-    float:left;
+/* Top and bottom scroll controls */
+
+.yuimenu .topscrollbar,
+.yuimenu .bottomscrollbar {
+
+    height: 16px;
+    background-position: center center;
+    background-repeat: no-repeat;
 
 }
 
+.yuimenu .topscrollbar {
+
+    background-image: url(/static/images/yui/menu/menu_up_arrow.png);
 
-/* Matches selected menu items */
+}
 
-div.yuimenu li.selected,
-div.yuimenubar li.selected {
+.yuimenu .topscrollbar_disabled {
 
-    background-color:#8c8ad0;
+    background-image: url(/static/images/yui/menu/menu_up_arrow_disabled.png);
 
 }
 
-div.yuimenu li.selected a.selected,
-div.yuimenubar li.selected a.selected {
+.yuimenu .bottomscrollbar {
 
-    text-decoration:underline;
+    background-image: url(/static/images/yui/menu/menu_down_arrow.png);
 
 }
 
-div.yuimenu li.selected a.selected,
-div.yuimenu li.selected em.selected, 
-div.yuimenubar li.selected a.selected {
+.yuimenu .bottomscrollbar_disabled {
 
-    color:#fff;
+    background-image: url(/static/images/yui/menu/menu_down_arrow_disabled.png);
 
 }
 
 
-/* Matches disabled menu items */
+/* MenuItem and MenuBarItem styles */
+
+.yuimenuitem {
+
+    /*
+        For IE: Used to collapse superfluous white space between <li> elements
+        that is triggered by the "display" property of the <a> elements being
+        set to "block."
+    */
+
+    *border-bottom: solid 1px #f6f7ee;
 
-div.yuimenu li.disabled, 
-div.yuimenubar li.disabled {
+}
+
+.yuimenuitemlabel,
+.yuimenubaritemlabel {
 
-    cursor:default;
+    font-size: 85%;
+    color: #000;
+    text-decoration: none;
 
 }
 
-div.yuimenu li.disabled a.disabled,
-div.yuimenu li.disabled em.disabled,
-div.yuimenubar li.disabled a.disabled {
+.yuimenuitemlabel {
 
-    color:#b9b9b9;
-    cursor:default;
+    padding: 2px 24px;
     
 }
 
-div.yuimenubar li.yuimenubaritem {
+.yuimenubaritemlabel {
 
-    float:left;
-    display:inline; /* Prevent margin doubling in IE */
-    border-width:0 0 0 1px;
-    border-style:solid;
-    border-color:#c4c4be;
-    padding:4px 24px;
-    margin:0;
+    border-width: 0 0 0 1px;
+    border-style: solid;
+    border-color: #c4c4be;
+    padding: 4px 24px;
 
 }
 
-div.yuimenubar li.yuimenubaritem.first-of-type {
+.yuimenubar li.first-of-type .yuimenubaritemlabel {
 
-    border-width:0;
+    border-width: 0;
 
 }
 
+.yuimenubaritem-hassubmenu {
 
-/* Styles for the the submenu indicator for menu items */
+    background: url(/static/images/yui/menu/menubaritem_submenuindicator.png) right center no-repeat;
 
-div.yuimenu li.hassubmenu em.submenuindicator, 
-div.yuimenubar li.hassubmenu em.submenuindicator {
+}
 
-    display:-moz-inline-box; /* Mozilla */
-    display:inline-block; /* IE, Opera and Safari */
-    vertical-align:middle;
-    height:8px;
-    width:8px;
-    text-indent:9px;
-    font:0/0 arial;
-    overflow:hidden;
-    background-image:url(map.gif);
-    background-repeat:no-repeat;
+.yuimenuitem-hassubmenu {
+
+    background: url(/static/images/yui/menu/menuitem_submenuindicator.png) right center no-repeat;
 
 }
 
-div.yuimenubar li.hassubmenu em.submenuindicator {
+.yuimenuitem-checked {
+
+    background: url(/static/images/yui/menu/menuitem_checkbox.png) left center no-repeat;
+
+}
 
-    background-position:0 -24px;
-    margin:0 0 0 10px;
+.yuimenuitemlabel .helptext {
 
+    margin-top: -1.1em;
+    *margin-top: -1.2em;  /* For IE*/
+    
 }
 
-div.yuimenubar li.hassubmenu em.submenuindicator.selected {
 
-    background-position:0 -32px;
+
+/* MenuItem states */
+
+
+/* Selected MenuItem */
+
+.yuimenubaritem-selected,
+.yuimenuitem-selected {
+
+    background-color: #8c8ad0;
 
 }
 
-div.yuimenubar li.hassubmenu em.submenuindicator.disabled {
+.yuimenubaritemlabel-selected,
+.yuimenuitemlabel-selected {
 
-    background-position:0 -40px;
+    text-decoration: underline;
+    color: #fff;
 
 }
 
-div.yuimenu li.hassubmenu em.submenuindicator {
+.yuimenubaritem-hassubmenu-selected {
 
-    background-position:0 0;
-    margin:0 -16px 0 10px;
+    background-image: url(/static/images/yui/menu/menubaritem_submenuindicator_selected.png);
 
 }
 
-div.yuimenu li.hassubmenu em.submenuindicator.selected {
+.yuimenuitem-hassubmenu-selected {
 
-    background-position:0 -8px;
+    background-image: url(/static/images/yui/menu/menuitem_submenuindicator_selected.png);
 
 }
 
-div.yuimenu li.hassubmenu em.submenuindicator.disabled {
+.yuimenuitem-checked-selected {
 
-    background-position:0 -16px;
+    background-image: url(/static/images/yui/menu/menuitem_checkbox_selected.png);
 
 }
 
 
-/* Styles for a menu item's "checked" state */
+/* Disabled MenuItem */
 
-div.yuimenu li.checked {
+.yuimenubaritemlabel-disabled,
+.yuimenuitemlabel-disabled {
 
-    position:relative;
+    cursor: default;
+    color: #b9b9b9;
 
 }
 
-div.yuimenu li.checked em.checkedindicator {
+.yuimenubaritem-hassubmenu-disabled {
 
-    height:8px;
-    width:8px;
-    text-indent:9px;
-    overflow:hidden;
-    background-image:url(map.gif);
-    background-position:0 -48px;
-    background-repeat:no-repeat;
-    position:absolute;
-    left:6px;
-    _left:-16px; /* Underscore hack b/c this is for IE 6 only */
-    top:.5em;
+    background-image: url(/static/images/yui/menu/menubaritem_submenuindicator_disabled.png);
 
 }
 
-div.yuimenu li.checked em.checkedindicator.selected {
+.yuimenuitem-hassubmenu-disabled {
 
-    background-position:0 -56px;
+    background-image: url(/static/images/yui/menu/menuitem_submenuindicator_disabled.png);
 
 }
 
-div.yuimenu li.checked em.checkedindicator.disabled {
+.yuimenuitem-checked-disabled {
 
-    background-position:0 -64px;
+    background-image: url(/static/images/yui/menu/menuitem_checkbox_disabled.png);
 
-}
\ No newline at end of file
+}

Modified: jifty/branches/virtual-models/share/web/static/css/yui/tabview/border_tabs.css
==============================================================================
--- jifty/branches/virtual-models/share/web/static/css/yui/tabview/border_tabs.css	(original)
+++ jifty/branches/virtual-models/share/web/static/css/yui/tabview/border_tabs.css	Thu Feb 14 14:59:21 2008
@@ -2,7 +2,7 @@
 Copyright (c) 2007, Yahoo! Inc. All rights reserved.
 Code licensed under the BSD License:
 http://developer.yahoo.net/yui/license.txt
-version: 2.2.1
+version: 2.4.1
 */
 .yui-navset .yui-nav li a, .yui-navset .yui-content {
     border:1px solid #000;  /* label and content borders */

Added: jifty/branches/virtual-models/share/web/static/css/yui/tabview/tabview-core.css
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/share/web/static/css/yui/tabview/tabview-core.css	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,110 @@
+/*
+Copyright (c) 2007, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.4.1
+*/
+/* default space between tabs */
+.yui-navset .yui-nav li,
+.yui-navset .yui-navset-top .yui-nav li,
+.yui-navset .yui-navset-bottom .yui-nav li {
+    margin:0 0.5em 0 0; /* horizontal tabs */
+}
+.yui-navset-left .yui-nav li,
+.yui-navset-right .yui-nav li {
+    margin:0 0 0.5em; /* vertical tabs */
+}
+
+/* default width for side tabs */
+.yui-navset .yui-navset-left .yui-nav,
+.yui-navset .yui-navset-right .yui-nav,
+.yui-navset-left .yui-nav,
+.yui-navset-right .yui-nav { width:6em; }
+
+.yui-navset-top .yui-nav,
+.yui-navset-bottom .yui-nav {
+    width:auto;
+}
+.yui-navset .yui-navset-left,
+.yui-navset-left { padding:0 0 0 6em; } /* map to nav width */
+.yui-navset-right { padding:0 6em 0 0; } /* ditto */
+
+.yui-navset-top,
+.yui-navset-bottom {
+    padding:auto;
+}
+/* core */
+
+.yui-nav,
+.yui-nav li {
+    margin:0;
+    padding:0;
+    list-style:none;
+}
+.yui-navset li em { font-style:normal; }
+
+.yui-navset {
+    position:relative; /* contain absolute positioned tabs (left/right) */
+    zoom:1;
+}
+
+.yui-navset .yui-content { zoom:1; }
+
+.yui-navset .yui-nav li,
+.yui-navset .yui-navset-top .yui-nav li, /* in case nested */
+.yui-navset .yui-navset-bottom .yui-nav li {
+    display:inline-block;
+    display:-moz-inline-stack;
+    *display:inline; /* IE */
+    vertical-align:bottom; /* safari: for overlap */
+    cursor:pointer; /* gecko: due to -moz-inline-stack on anchor */
+    zoom:1; /* IE: kill space between horizontal tabs */
+}
+
+.yui-navset-left .yui-nav li,
+.yui-navset-right .yui-nav li {
+    display:block;
+}
+
+.yui-navset .yui-nav a { position:relative; } /* IE: to allow overlap */
+
+.yui-navset .yui-nav li a,
+.yui-navset-top .yui-nav li a,
+.yui-navset-bottom .yui-nav li a {
+    display:block;
+    display:inline-block;
+    vertical-align:bottom; /* safari: for overlap */
+    zoom:1;
+}
+
+.yui-navset-left .yui-nav li a,
+.yui-navset-right .yui-nav li a {
+    display:block;
+}
+
+.yui-navset-bottom .yui-nav li a {
+    vertical-align:text-top; /* for inline overlap (reverse for Opera border bug) */
+}
+
+.yui-navset .yui-nav li a em,
+.yui-navset-top .yui-nav li a em,
+.yui-navset-bottom .yui-nav li a em { display:block; }
+
+/* position left and right oriented tabs */
+.yui-navset .yui-navset-left .yui-nav,
+.yui-navset .yui-navset-right .yui-nav,
+.yui-navset-left .yui-nav,
+.yui-navset-right .yui-nav {
+   position:absolute;
+   z-index:1; 
+}
+
+.yui-navset-top .yui-nav,
+.yui-navset-bottom .yui-nav {
+    position:static;
+}
+.yui-navset .yui-navset-left .yui-nav,
+.yui-navset-left .yui-nav { left:0; right:auto; }
+
+.yui-navset .yui-navset-right .yui-nav,
+.yui-navset-right .yui-nav { right:0; left:auto; }

Modified: jifty/branches/virtual-models/share/web/static/css/yui/tabview/tabview.css
==============================================================================
--- jifty/branches/virtual-models/share/web/static/css/yui/tabview/tabview.css	(original)
+++ jifty/branches/virtual-models/share/web/static/css/yui/tabview/tabview.css	Thu Feb 14 14:59:21 2008
@@ -2,7 +2,7 @@
 Copyright (c) 2007, Yahoo! Inc. All rights reserved.
 Code licensed under the BSD License:
 http://developer.yahoo.net/yui/license.txt
-version: 2.2.1
+version: 2.4.1
 */
 /* default space between tabs */
 .yui-navset .yui-nav li {

Added: jifty/branches/virtual-models/share/web/static/images/yui/calendar/calgrad.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/calendar/callt.gif
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/calendar/calrt.gif
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/calendar/calx.gif
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menu_down_arrow.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menu_down_arrow_disabled.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menu_down_arrow_selected.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menu_up_arrow.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menu_up_arrow_disabled.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menubaritem_submenuindicator.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menubaritem_submenuindicator_disabled.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menubaritem_submenuindicator_selected.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_checked.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_checked_disabled.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_checked_selected.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_submenuindicator.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_submenuindicator_disabled.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/menu/menuitem_submenuindicator_selected.png
==============================================================================
Binary file. No diff available.

Added: jifty/branches/virtual-models/share/web/static/images/yui/tabview/loading.gif
==============================================================================
Binary file. No diff available.

Modified: jifty/branches/virtual-models/share/web/static/js/behaviour.js
==============================================================================
--- jifty/branches/virtual-models/share/web/static/js/behaviour.js	(original)
+++ jifty/branches/virtual-models/share/web/static/js/behaviour.js	Thu Feb 14 14:59:21 2008
@@ -1,6 +1,5 @@
 /*
-   Modified to fix some bugs, use a different css query engine, and to
-   to use JSAN classes.
+   Modified version. Use jQuery as css query engine.
    
    Based on Behaviour v1.1 by Ben Nolan, June 2005, which was based
    largely on the work of Simon Willison.
@@ -27,33 +26,27 @@
 
 */   
 
-JSAN.use("DOM.Events");
-JSAN.use("Upgrade.Array.push");
-
 var Behaviour = {
     list: [],
-    
+
     register: function(sheet) {
         Behaviour.list.push(sheet);
     },
     
     apply: function() {
-	var root = arguments[0];
-	if(root) root = $(root);
-
+        var root = arguments[0];
         for (var h = 0; sheet = Behaviour.list[h]; h++) {
             for (var selector in sheet) {
-		var start = new Date();
-                var elements = cssQuery(selector, root);
-
-                if ( !elements ) continue;
-
-                for (var i = 0; element = elements[i]; i++) {
-                    sheet[selector](element);
-		}
+                jQuery(selector, root).each(function() {
+                     sheet[selector](this);
+                });
             }
         }
     }
-}    
+};
 
-DOM.Events.addListener( window, "load", function() { Behaviour.apply() } );
+(function($) {
+    $(document).ready(function(){
+        Behaviour.apply();
+    });
+})(jQuery);

Modified: jifty/branches/virtual-models/share/web/static/js/bps_util.js
==============================================================================
--- jifty/branches/virtual-models/share/web/static/js/bps_util.js	(original)
+++ jifty/branches/virtual-models/share/web/static/js/bps_util.js	Thu Feb 14 14:59:21 2008
@@ -43,6 +43,7 @@
         });
     }
     link.setAttribute("onclick", onclick);
+    link.setAttribute("title", e.getAttribute("title"));
 
     link.className = e.className;
     link["virtualform"] = form;

Modified: jifty/branches/virtual-models/share/web/static/js/calendar.js
==============================================================================
--- jifty/branches/virtual-models/share/web/static/js/calendar.js	(original)
+++ jifty/branches/virtual-models/share/web/static/js/calendar.js	Thu Feb 14 14:59:21 2008
@@ -16,9 +16,7 @@
     dateRegex: /^(\d{4})\W(\d{2})\W(\d{2})/,
     
     Options: {
-        NAV_ARROW_LEFT: "/static/images/yui/us/tr/callt.gif",
-        NAV_ARROW_RIGHT: "/static/images/yui/us/tr/calrt.gif",
-        OOM_SELECT: true
+        OUT_OF_MONTH_SELECT: true
     },
 
     toggleCalendar: function(ev) {
@@ -40,7 +38,7 @@
         
         wrap = document.createElement("div");
         wrap.setAttribute( "id", wrapId );
-        wrap.setAttribute( "className", "select-free" );
+        wrap.setAttribute( "class", "select-free" );
         
         wrap.style.position = "absolute";
         wrap.style.left     = Jifty.Utils.findRelativePosX( input ) + "px";

Modified: jifty/branches/virtual-models/share/web/static/js/context_menu.js
==============================================================================
--- jifty/branches/virtual-models/share/web/static/js/context_menu.js	(original)
+++ jifty/branches/virtual-models/share/web/static/js/context_menu.js	Thu Feb 14 14:59:21 2008
@@ -58,8 +58,9 @@
     
         var li = Jifty.ContextMenu.getParentListItem(ul);
 
+        Element.addClassName( ul, "dropdown_menu" );
         ul.style.position = "absolute";
-        ul.style.width    = li.offsetWidth * 2 + "px";
+        ul.style.width    = "12em";
         
         /* Use position: relative based positioning for every browser
            but IE, which needs to use absolute positioning */

Added: jifty/branches/virtual-models/share/web/static/js/cssQuery-jquery.js
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/share/web/static/js/cssQuery-jquery.js	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,20 @@
+var cssQuery = function() {
+    var cssQuery = function(a, c) {
+        return jQuery.makeArray( jQuery(a,c) );
+    }
+
+    // All public interfaces are showing alert instead of doing the realthing.
+    // Deep compatibiliy isn't going to be implemented.
+    var msg = "This implementation of cssQuery is really a wrapper to jQuery. No compatibility is ensured. Please use jQuery instead.";
+
+    cssQuery.toString = function() {
+        return "function() { [" + msg +  "] }";
+    };
+
+     cssQuery.clearCache = cssQuery.addModule = cssQuery.valueOf = function() {
+        alert(msg);
+    };
+
+    return cssQuery;
+
+}();

Modified: jifty/branches/virtual-models/share/web/static/js/halo.js
==============================================================================
--- jifty/branches/virtual-models/share/web/static/js/halo.js	(original)
+++ jifty/branches/virtual-models/share/web/static/js/halo.js	Thu Feb 14 14:59:21 2008
@@ -1,4 +1,5 @@
 var halo_shown = null;
+var halos_drawn = null;
 
 var halo_top;
 var halo_left;
@@ -62,3 +63,96 @@
     window.style.width = newWidth;
     grip.xFrom = x;
 }
+
+function draw_halos() {
+    var halo_header_display = 'none';
+    var halo_border_width   = '0';
+    var halo_margin         = '0';
+    var halo_padding        = '0';
+
+    halos_drawn = !halos_drawn;
+
+    if (halos_drawn) {
+        halo_header_display = 'block';
+        halo_border_width   = '2px';
+        halo_margin         = '3px';
+        halo_padding        = '3px';
+    }
+
+    $("render_info-draw_halos").innerHTML = halos_drawn ? "Hide halos" : "Draw halos";
+
+    YAHOO.util.Dom.getElementsByClassName("halo-header", null, null,
+        function (e) {
+            e.style.display = halo_header_display;
+        }
+    );
+
+    YAHOO.util.Dom.getElementsByClassName("halo", null, null,
+        function (e) {
+            e.style.borderWidth = halo_border_width;
+            e.style.margin = halo_margin;
+            e.style.padding = halo_padding;
+        }
+    );
+}
+
+function render_info_tree() {
+    Element.toggle("render_info_tree");
+}
+
+function halo_render(id, name) {
+    halo_reset(id);
+    $('halo-button-'+name+'-'+id).style.fontWeight = 'bold';
+
+    var e = $('halo-rendered-'+id);
+
+    if (name == 'source') {
+        e.halo_rendered = e.innerHTML;
+        e.innerHTML = '<div class="halo-source">' + e.innerHTML.escapeHTML() + '</div>';
+    }
+    else if (name == 'render') {
+        /* ignore */
+    }
+    else {
+        e.style.display = 'none';
+        $('halo-info-'+id).style.display = 'block';
+        $('halo-info-'+name+'-'+id).style.display = 'block';
+    }
+}
+
+function halo_reset(id) {
+    /* restore all buttons to nonbold */
+    for (var child = $('halo-rendermode-'+id).firstChild;
+         child != null;
+         child = child.nextSibling) {
+            if (child.style) {
+                child.style.fontWeight = 'normal';
+            }
+    }
+
+    /* hide all the info divs */
+    $('halo-info-'+id).style.display = 'none';
+    for (var child = $('halo-info-'+id).firstChild;
+         child != null;
+         child = child.nextSibling) {
+            if (child.style) {
+                child.style.display = 'none';
+            }
+    }
+
+    /* restore the rendered div */
+    var e = $('halo-rendered-'+id);
+    e.style.display = 'block';
+    if (e.halo_rendered) {
+        e.innerHTML = e.halo_rendered;
+        e.halo_rendered = null;
+    }
+}
+
+function remove_link(id, name) {
+    var link = $('halo-button-'+name+'-'+id);
+    var newlink = document.createElement("span");
+    newlink.appendChild(link.childNodes[0]);
+    link.parentNode.replaceChild(newlink, link);
+}
+

Modified: jifty/branches/virtual-models/share/web/static/js/jifty.js
==============================================================================
--- jifty/branches/virtual-models/share/web/static/js/jifty.js	(original)
+++ jifty/branches/virtual-models/share/web/static/js/jifty.js	Thu Feb 14 14:59:21 2008
@@ -628,6 +628,9 @@
         element = $(element);
 
         var extras = $A();
+        if (!element)
+            return extras;
+
         var args = Form.Element.buttonArguments(element);
         var keys = args.keys();
         for (var i = 0; i < keys.length; i++) {
@@ -724,6 +727,10 @@
     },
     '.form_field .error, .form_field .warning, .form_field .canonicalization_note': function(e) {
         if ( e.innerHTML == "" ) Element.hide(e);
+    },
+    '.jifty-region-lazy': function(e) {
+        var region = e.getAttribute("id").replace(/^region-/,"");
+        Jifty.update( { 'fragments': [{'region': region, 'mode': 'Replace'}]}, e);
     }
 });
 
@@ -1041,6 +1048,8 @@
     var has_request = 0;
     request.set('actions', $H());
     for (var moniker in named_args['actions']) {
+        if (moniker == 'extend')
+            continue;
         var disable = named_args['actions'][moniker];
         var a = new Action(moniker, button_args);
             current_actions.set(moniker, a); // XXX: how do i make this bloody singleton?
@@ -1447,6 +1456,8 @@
   initialize: function(element, text) {
      this.element = $(element);
      this.text = text;
+     this.element.placeholderText = this.text;
+
      Event.observe(element, 'focus', this.onFocus.bind(this));
      Event.observe(element, 'blur', this.onBlur.bind(this));
      this.onBlur();
@@ -1486,7 +1497,14 @@
   },
             
   clearPlaceholder: function(elt) {
-     if(Jifty.Placeholder.hasPlaceholder(elt)) {
+     // If the element's text isn't the same as its placeholder text, then the
+     // browser screwed up and didn't clear our placeholder. Opera on Mac with
+     // VirtueDesktops does this some times, and I lose data.
+     // These are normalized because sometimes one has \r\n and the other has \n
+     elt.value = elt.value.replace(/\r/g, '');
+     elt.placeholderText = elt.placeholderText.replace(/\r/g, '');
+
+     if(Jifty.Placeholder.hasPlaceholder(elt) && elt.value == elt.placeholderText) {
        elt.value = '';
        Element.removeClassName(elt, 'placeholder');
      }

Added: jifty/branches/virtual-models/share/web/static/js/jquery-1.2.1.js
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/share/web/static/js/jquery-1.2.1.js	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,2992 @@
+(function(){
+/*
+ * jQuery 1.2.1 - New Wave Javascript
+ *
+ * Copyright (c) 2007 John Resig (jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: 2007-09-16 23:42:06 -0400 (Sun, 16 Sep 2007) $
+ * $Rev: 3353 $
+ */
+
+// Map over jQuery in case of overwrite
+if ( typeof jQuery != "undefined" )
+	var _jQuery = jQuery;
+
+var jQuery = window.jQuery = function(selector, context) {
+	// If the context is a namespace object, return a new object
+	return this instanceof jQuery ?
+		this.init(selector, context) :
+		new jQuery(selector, context);
+};
+
+// Map over the $ in case of overwrite
+if ( typeof $ != "undefined" )
+	var _$ = $;
+	
+// Map the jQuery namespace to the '$' one
+window.$ = jQuery;
+
+var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
+
+jQuery.fn = jQuery.prototype = {
+	init: function(selector, context) {
+		// Make sure that a selection was provided
+		selector = selector || document;
+
+		// Handle HTML strings
+		if ( typeof selector  == "string" ) {
+			var m = quickExpr.exec(selector);
+			if ( m && (m[1] || !context) ) {
+				// HANDLE: $(html) -> $(array)
+				if ( m[1] )
+					selector = jQuery.clean( [ m[1] ], context );
+
+				// HANDLE: $("#id")
+				else {
+					var tmp = document.getElementById( m[3] );
+					if ( tmp )
+						// Handle the case where IE and Opera return items
+						// by name instead of ID
+						if ( tmp.id != m[3] )
+							return jQuery().find( selector );
+						else {
+							this[0] = tmp;
+							this.length = 1;
+							return this;
+						}
+					else
+						selector = [];
+				}
+
+			// HANDLE: $(expr)
+			} else
+				return new jQuery( context ).find( selector );
+
+		// HANDLE: $(function)
+		// Shortcut for document ready
+		} else if ( jQuery.isFunction(selector) )
+			return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( selector );
+
+		return this.setArray(
+			// HANDLE: $(array)
+			selector.constructor == Array && selector ||
+
+			// HANDLE: $(arraylike)
+			// Watch for when an array-like object is passed as the selector
+			(selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) ||
+
+			// HANDLE: $(*)
+			[ selector ] );
+	},
+	
+	jquery: "1.2.1",
+
+	size: function() {
+		return this.length;
+	},
+	
+	length: 0,
+
+	get: function( num ) {
+		return num == undefined ?
+
+			// Return a 'clean' array
+			jQuery.makeArray( this ) :
+
+			// Return just the object
+			this[num];
+	},
+	
+	pushStack: function( a ) {
+		var ret = jQuery(a);
+		ret.prevObject = this;
+		return ret;
+	},
+	
+	setArray: function( a ) {
+		this.length = 0;
+		Array.prototype.push.apply( this, a );
+		return this;
+	},
+
+	each: function( fn, args ) {
+		return jQuery.each( this, fn, args );
+	},
+
+	index: function( obj ) {
+		var pos = -1;
+		this.each(function(i){
+			if ( this == obj ) pos = i;
+		});
+		return pos;
+	},
+
+	attr: function( key, value, type ) {
+		var obj = key;
+		
+		// Look for the case where we're accessing a style value
+		if ( key.constructor == String )
+			if ( value == undefined )
+				return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined;
+			else {
+				obj = {};
+				obj[ key ] = value;
+			}
+		
+		// Check to see if we're setting style values
+		return this.each(function(index){
+			// Set all the styles
+			for ( var prop in obj )
+				jQuery.attr(
+					type ? this.style : this,
+					prop, jQuery.prop(this, obj[prop], type, index, prop)
+				);
+		});
+	},
+
+	css: function( key, value ) {
+		return this.attr( key, value, "curCSS" );
+	},
+
+	text: function(e) {
+		if ( typeof e != "object" && e != null )
+			return this.empty().append( document.createTextNode( e ) );
+
+		var t = "";
+		jQuery.each( e || this, function(){
+			jQuery.each( this.childNodes, function(){
+				if ( this.nodeType != 8 )
+					t += this.nodeType != 1 ?
+						this.nodeValue : jQuery.fn.text([ this ]);
+			});
+		});
+		return t;
+	},
+
+	wrapAll: function(html) {
+		if ( this[0] )
+			// The elements to wrap the target around
+			jQuery(html, this[0].ownerDocument)
+				.clone()
+				.insertBefore(this[0])
+				.map(function(){
+					var elem = this;
+					while ( elem.firstChild )
+						elem = elem.firstChild;
+					return elem;
+				})
+				.append(this);
+
+		return this;
+	},
+
+	wrapInner: function(html) {
+		return this.each(function(){
+			jQuery(this).contents().wrapAll(html);
+		});
+	},
+
+	wrap: function(html) {
+		return this.each(function(){
+			jQuery(this).wrapAll(html);
+		});
+	},
+
+	append: function() {
+		return this.domManip(arguments, true, 1, function(a){
+			this.appendChild( a );
+		});
+	},
+
+	prepend: function() {
+		return this.domManip(arguments, true, -1, function(a){
+			this.insertBefore( a, this.firstChild );
+		});
+	},
+	
+	before: function() {
+		return this.domManip(arguments, false, 1, function(a){
+			this.parentNode.insertBefore( a, this );
+		});
+	},
+
+	after: function() {
+		return this.domManip(arguments, false, -1, function(a){
+			this.parentNode.insertBefore( a, this.nextSibling );
+		});
+	},
+
+	end: function() {
+		return this.prevObject || jQuery([]);
+	},
+
+	find: function(t) {
+		var data = jQuery.map(this, function(a){ return jQuery.find(t,a); });
+		return this.pushStack( /[^+>] [^+>]/.test( t ) || t.indexOf("..") > -1 ?
+			jQuery.unique( data ) : data );
+	},
+
+	clone: function(events) {
+		// Do the clone
+		var ret = this.map(function(){
+			return this.outerHTML ? jQuery(this.outerHTML)[0] : this.cloneNode(true);
+		});
+
+		// Need to set the expando to null on the cloned set if it exists
+		// removeData doesn't work here, IE removes it from the original as well
+		// this is primarily for IE but the data expando shouldn't be copied over in any browser
+		var clone = ret.find("*").andSelf().each(function(){
+			if ( this[ expando ] != undefined )
+				this[ expando ] = null;
+		});
+		
+		// Copy the events from the original to the clone
+		if (events === true)
+			this.find("*").andSelf().each(function(i) {
+				var events = jQuery.data(this, "events");
+				for ( var type in events )
+					for ( var handler in events[type] )
+						jQuery.event.add(clone[i], type, events[type][handler], events[type][handler].data);
+			});
+
+		// Return the cloned set
+		return ret;
+	},
+
+	filter: function(t) {
+		return this.pushStack(
+			jQuery.isFunction( t ) &&
+			jQuery.grep(this, function(el, index){
+				return t.apply(el, [index]);
+			}) ||
+
+			jQuery.multiFilter(t,this) );
+	},
+
+	not: function(t) {
+		return this.pushStack(
+			t.constructor == String &&
+			jQuery.multiFilter(t, this, true) ||
+
+			jQuery.grep(this, function(a) {
+				return ( t.constructor == Array || t.jquery )
+					? jQuery.inArray( a, t ) < 0
+					: a != t;
+			})
+		);
+	},
+
+	add: function(t) {
+		return this.pushStack( jQuery.merge(
+			this.get(),
+			t.constructor == String ?
+				jQuery(t).get() :
+				t.length != undefined && (!t.nodeName || jQuery.nodeName(t, "form")) ?
+					t : [t] )
+		);
+	},
+
+	is: function(expr) {
+		return expr ? jQuery.multiFilter(expr,this).length > 0 : false;
+	},
+
+	hasClass: function(expr) {
+		return this.is("." + expr);
+	},
+	
+	val: function( val ) {
+		if ( val == undefined ) {
+			if ( this.length ) {
+				var elem = this[0];
+		    	
+				// We need to handle select boxes special
+				if ( jQuery.nodeName(elem, "select") ) {
+					var index = elem.selectedIndex,
+						a = [],
+						options = elem.options,
+						one = elem.type == "select-one";
+					
+					// Nothing was selected
+					if ( index < 0 )
+						return null;
+
+					// Loop through all the selected options
+					for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
+						var option = options[i];
+						if ( option.selected ) {
+							// Get the specifc value for the option
+							var val = jQuery.browser.msie && !option.attributes["value"].specified ? option.text : option.value;
+							
+							// We don't need an array for one selects
+							if ( one )
+								return val;
+							
+							// Multi-Selects return an array
+							a.push(val);
+						}
+					}
+					
+					return a;
+					
+				// Everything else, we just grab the value
+				} else
+					return this[0].value.replace(/\r/g, "");
+			}
+		} else
+			return this.each(function(){
+				if ( val.constructor == Array && /radio|checkbox/.test(this.type) )
+					this.checked = (jQuery.inArray(this.value, val) >= 0 ||
+						jQuery.inArray(this.name, val) >= 0);
+				else if ( jQuery.nodeName(this, "select") ) {
+					var tmp = val.constructor == Array ? val : [val];
+
+					jQuery("option", this).each(function(){
+						this.selected = (jQuery.inArray(this.value, tmp) >= 0 ||
+						jQuery.inArray(this.text, tmp) >= 0);
+					});
+
+					if ( !tmp.length )
+						this.selectedIndex = -1;
+				} else
+					this.value = val;
+			});
+	},
+	
+	html: function( val ) {
+		return val == undefined ?
+			( this.length ? this[0].innerHTML : null ) :
+			this.empty().append( val );
+	},
+
+	replaceWith: function( val ) {
+		return this.after( val ).remove();
+	},
+
+	eq: function(i){
+		return this.slice(i, i+1);
+	},
+
+	slice: function() {
+		return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
+	},
+
+	map: function(fn) {
+		return this.pushStack(jQuery.map( this, function(elem,i){
+			return fn.call( elem, i, elem );
+		}));
+	},
+
+	andSelf: function() {
+		return this.add( this.prevObject );
+	},
+	
+	domManip: function(args, table, dir, fn) {
+		var clone = this.length > 1, a; 
+
+		return this.each(function(){
+			if ( !a ) {
+				a = jQuery.clean(args, this.ownerDocument);
+				if ( dir < 0 )
+					a.reverse();
+			}
+
+			var obj = this;
+
+			if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") )
+				obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
+
+			jQuery.each( a, function(){
+				var elem = clone ? this.cloneNode(true) : this;
+				if ( !evalScript(0, elem) )
+					fn.call( obj, elem );
+			});
+		});
+	}
+};
+
+function evalScript(i, elem){
+	var script = jQuery.nodeName(elem, "script");
+
+	if ( script ) {
+		if ( elem.src )
+			jQuery.ajax({ url: elem.src, async: false, dataType: "script" });
+		else
+			jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+	
+		if ( elem.parentNode )
+			elem.parentNode.removeChild(elem);
+
+	} else if ( elem.nodeType == 1 )
+    jQuery("script", elem).each(evalScript);
+
+	return script;
+}
+
+jQuery.extend = jQuery.fn.extend = function() {
+	// copy reference to target object
+	var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;
+
+	// Handle a deep copy situation
+	if ( target.constructor == Boolean ) {
+		deep = target;
+		target = arguments[1] || {};
+	}
+
+	// extend jQuery itself if only one argument is passed
+	if ( al == 1 ) {
+		target = this;
+		a = 0;
+	}
+
+	var prop;
+
+	for ( ; a < al; a++ )
+		// Only deal with non-null/undefined values
+		if ( (prop = arguments[a]) != null )
+			// Extend the base object
+			for ( var i in prop ) {
+				// Prevent never-ending loop
+				if ( target == prop[i] )
+					continue;
+
+				// Recurse if we're merging object values
+				if ( deep && typeof prop[i] == 'object' && target[i] )
+					jQuery.extend( target[i], prop[i] );
+
+				// Don't bring in undefined values
+				else if ( prop[i] != undefined )
+					target[i] = prop[i];
+			}
+
+	// Return the modified object
+	return target;
+};
+
+var expando = "jQuery" + (new Date()).getTime(), uuid = 0, win = {};
+
+jQuery.extend({
+	noConflict: function(deep) {
+		window.$ = _$;
+		if ( deep )
+			window.jQuery = _jQuery;
+		return jQuery;
+	},
+
+	// This may seem like some crazy code, but trust me when I say that this
+	// is the only cross-browser way to do this. --John
+	isFunction: function( fn ) {
+		return !!fn && typeof fn != "string" && !fn.nodeName && 
+			fn.constructor != Array && /function/i.test( fn + "" );
+	},
+	
+	// check if an element is in a XML document
+	isXMLDoc: function(elem) {
+		return elem.documentElement && !elem.body ||
+			elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
+	},
+
+	// Evalulates a script in a global context
+	// Evaluates Async. in Safari 2 :-(
+	globalEval: function( data ) {
+		data = jQuery.trim( data );
+		if ( data ) {
+			if ( window.execScript )
+				window.execScript( data );
+			else if ( jQuery.browser.safari )
+				// safari doesn't provide a synchronous global eval
+				window.setTimeout( data, 0 );
+			else
+				eval.call( window, data );
+		}
+	},
+
+	nodeName: function( elem, name ) {
+		return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
+	},
+	
+	cache: {},
+	
+	data: function( elem, name, data ) {
+		elem = elem == window ? win : elem;
+
+		var id = elem[ expando ];
+
+		// Compute a unique ID for the element
+		if ( !id ) 
+			id = elem[ expando ] = ++uuid;
+
+		// Only generate the data cache if we're
+		// trying to access or manipulate it
+		if ( name && !jQuery.cache[ id ] )
+			jQuery.cache[ id ] = {};
+		
+		// Prevent overriding the named cache with undefined values
+		if ( data != undefined )
+			jQuery.cache[ id ][ name ] = data;
+		
+		// Return the named cache data, or the ID for the element	
+		return name ? jQuery.cache[ id ][ name ] : id;
+	},
+	
+	removeData: function( elem, name ) {
+		elem = elem == window ? win : elem;
+
+		var id = elem[ expando ];
+
+		// If we want to remove a specific section of the element's data
+		if ( name ) {
+			if ( jQuery.cache[ id ] ) {
+				// Remove the section of cache data
+				delete jQuery.cache[ id ][ name ];
+
+				// If we've removed all the data, remove the element's cache
+				name = "";
+				for ( name in jQuery.cache[ id ] ) break;
+				if ( !name )
+					jQuery.removeData( elem );
+			}
+
+		// Otherwise, we want to remove all of the element's data
+		} else {
+			// Clean up the element expando
+			try {
+				delete elem[ expando ];
+			} catch(e){
+				// IE has trouble directly removing the expando
+				// but it's ok with using removeAttribute
+				if ( elem.removeAttribute )
+					elem.removeAttribute( expando );
+			}
+
+			// Completely remove the data cache
+			delete jQuery.cache[ id ];
+		}
+	},
+
+	// args is for internal usage only
+	each: function( obj, fn, args ) {
+		if ( args ) {
+			if ( obj.length == undefined )
+				for ( var i in obj )
+					fn.apply( obj[i], args );
+			else
+				for ( var i = 0, ol = obj.length; i < ol; i++ )
+					if ( fn.apply( obj[i], args ) === false ) break;
+
+		// A special, fast, case for the most common use of each
+		} else {
+			if ( obj.length == undefined )
+				for ( var i in obj )
+					fn.call( obj[i], i, obj[i] );
+			else
+				for ( var i = 0, ol = obj.length, val = obj[0]; 
+					i < ol && fn.call(val,i,val) !== false; val = obj[++i] ){}
+		}
+
+		return obj;
+	},
+	
+	prop: function(elem, value, type, index, prop){
+			// Handle executable functions
+			if ( jQuery.isFunction( value ) )
+				value = value.call( elem, [index] );
+				
+			// exclude the following css properties to add px
+			var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
+
+			// Handle passing in a number to a CSS property
+			return value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) ?
+				value + "px" :
+				value;
+	},
+
+	className: {
+		// internal only, use addClass("class")
+		add: function( elem, c ){
+			jQuery.each( (c || "").split(/\s+/), function(i, cur){
+				if ( !jQuery.className.has( elem.className, cur ) )
+					elem.className += ( elem.className ? " " : "" ) + cur;
+			});
+		},
+
+		// internal only, use removeClass("class")
+		remove: function( elem, c ){
+			elem.className = c != undefined ?
+				jQuery.grep( elem.className.split(/\s+/), function(cur){
+					return !jQuery.className.has( c, cur );	
+				}).join(" ") : "";
+		},
+
+		// internal only, use is(".class")
+		has: function( t, c ) {
+			return jQuery.inArray( c, (t.className || t).toString().split(/\s+/) ) > -1;
+		}
+	},
+
+	swap: function(e,o,f) {
+		for ( var i in o ) {
+			e.style["old"+i] = e.style[i];
+			e.style[i] = o[i];
+		}
+		f.apply( e, [] );
+		for ( var i in o )
+			e.style[i] = e.style["old"+i];
+	},
+
+	css: function(e,p) {
+		if ( p == "height" || p == "width" ) {
+			var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"];
+
+			jQuery.each( d, function(){
+				old["padding" + this] = 0;
+				old["border" + this + "Width"] = 0;
+			});
+
+			jQuery.swap( e, old, function() {
+				if ( jQuery(e).is(':visible') ) {
+					oHeight = e.offsetHeight;
+					oWidth = e.offsetWidth;
+				} else {
+					e = jQuery(e.cloneNode(true))
+						.find(":radio").removeAttr("checked").end()
+						.css({
+							visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0"
+						}).appendTo(e.parentNode)[0];
+
+					var parPos = jQuery.css(e.parentNode,"position") || "static";
+					if ( parPos == "static" )
+						e.parentNode.style.position = "relative";
+
+					oHeight = e.clientHeight;
+					oWidth = e.clientWidth;
+
+					if ( parPos == "static" )
+						e.parentNode.style.position = "static";
+
+					e.parentNode.removeChild(e);
+				}
+			});
+
+			return p == "height" ? oHeight : oWidth;
+		}
+
+		return jQuery.curCSS( e, p );
+	},
+
+	curCSS: function(elem, prop, force) {
+		var ret, stack = [], swap = [];
+
+		// A helper method for determining if an element's values are broken
+		function color(a){
+			if ( !jQuery.browser.safari )
+				return false;
+
+			var ret = document.defaultView.getComputedStyle(a,null);
+			return !ret || ret.getPropertyValue("color") == "";
+		}
+
+		if (prop == "opacity" && jQuery.browser.msie) {
+			ret = jQuery.attr(elem.style, "opacity");
+			return ret == "" ? "1" : ret;
+		}
+		
+		if (prop.match(/float/i))
+			prop = styleFloat;
+
+		if (!force && elem.style[prop])
+			ret = elem.style[prop];
+
+		else if (document.defaultView && document.defaultView.getComputedStyle) {
+
+			if (prop.match(/float/i))
+				prop = "float";
+
+			prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase();
+			var cur = document.defaultView.getComputedStyle(elem, null);
+
+			if ( cur && !color(elem) )
+				ret = cur.getPropertyValue(prop);
+
+			// If the element isn't reporting its values properly in Safari
+			// then some display: none elements are involved
+			else {
+				// Locate all of the parent display: none elements
+				for ( var a = elem; a && color(a); a = a.parentNode )
+					stack.unshift(a);
+
+				// Go through and make them visible, but in reverse
+				// (It would be better if we knew the exact display type that they had)
+				for ( a = 0; a < stack.length; a++ )
+					if ( color(stack[a]) ) {
+						swap[a] = stack[a].style.display;
+						stack[a].style.display = "block";
+					}
+
+				// Since we flip the display style, we have to handle that
+				// one special, otherwise get the value
+				ret = prop == "display" && swap[stack.length-1] != null ?
+					"none" :
+					document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop) || "";
+
+				// Finally, revert the display styles back
+				for ( a = 0; a < swap.length; a++ )
+					if ( swap[a] != null )
+						stack[a].style.display = swap[a];
+			}
+
+			if ( prop == "opacity" && ret == "" )
+				ret = "1";
+
+		} else if (elem.currentStyle) {
+			var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
+			ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
+
+			// From the awesome hack by Dean Edwards
+			// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+			// If we're not dealing with a regular pixel number
+			// but a number that has a weird ending, we need to convert it to pixels
+			if ( !/^\d+(px)?$/i.test(ret) && /^\d/.test(ret) ) {
+				var style = elem.style.left;
+				var runtimeStyle = elem.runtimeStyle.left;
+				elem.runtimeStyle.left = elem.currentStyle.left;
+				elem.style.left = ret || 0;
+				ret = elem.style.pixelLeft + "px";
+				elem.style.left = style;
+				elem.runtimeStyle.left = runtimeStyle;
+			}
+		}
+
+		return ret;
+	},
+	
+	clean: function(a, doc) {
+		var r = [];
+		doc = doc || document;
+
+		jQuery.each( a, function(i,arg){
+			if ( !arg ) return;
+
+			if ( arg.constructor == Number )
+				arg = arg.toString();
+			
+			// Convert html string into DOM nodes
+			if ( typeof arg == "string" ) {
+				// Fix "XHTML"-style tags in all browsers
+				arg = arg.replace(/(<(\w+)[^>]*?)\/>/g, function(m, all, tag){
+					return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area)$/i)? m : all+"></"+tag+">";
+				});
+
+				// Trim whitespace, otherwise indexOf won't work as expected
+				var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement("div"), tb = [];
+
+				var wrap =
+					// option or optgroup
+					!s.indexOf("<opt") &&
+					[1, "<select>", "</select>"] ||
+					
+					!s.indexOf("<leg") &&
+					[1, "<fieldset>", "</fieldset>"] ||
+					
+					s.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
+					[1, "<table>", "</table>"] ||
+					
+					!s.indexOf("<tr") &&
+					[2, "<table><tbody>", "</tbody></table>"] ||
+					
+				 	// <thead> matched above
+					(!s.indexOf("<td") || !s.indexOf("<th")) &&
+					[3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
+					
+					!s.indexOf("<col") &&
+					[2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] ||
+
+					// IE can't serialize <link> and <script> tags normally
+					jQuery.browser.msie &&
+					[1, "div<div>", "</div>"] ||
+					
+					[0,"",""];
+
+				// Go to html and back, then peel off extra wrappers
+				div.innerHTML = wrap[1] + arg + wrap[2];
+				
+				// Move to the right depth
+				while ( wrap[0]-- )
+					div = div.lastChild;
+				
+				// Remove IE's autoinserted <tbody> from table fragments
+				if ( jQuery.browser.msie ) {
+					
+					// String was a <table>, *may* have spurious <tbody>
+					if ( !s.indexOf("<table") && s.indexOf("<tbody") < 0 ) 
+						tb = div.firstChild && div.firstChild.childNodes;
+						
+					// String was a bare <thead> or <tfoot>
+					else if ( wrap[1] == "<table>" && s.indexOf("<tbody") < 0 )
+						tb = div.childNodes;
+
+					for ( var n = tb.length-1; n >= 0 ; --n )
+						if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length )
+							tb[n].parentNode.removeChild(tb[n]);
+	
+					// IE completely kills leading whitespace when innerHTML is used	
+					if ( /^\s/.test(arg) )	
+						div.insertBefore( doc.createTextNode( arg.match(/^\s*/)[0] ), div.firstChild );
+
+				}
+				
+				arg = jQuery.makeArray( div.childNodes );
+			}
+
+			if ( 0 === arg.length && (!jQuery.nodeName(arg, "form") && !jQuery.nodeName(arg, "select")) )
+				return;
+
+			if ( arg[0] == undefined || jQuery.nodeName(arg, "form") || arg.options )
+				r.push( arg );
+			else
+				r = jQuery.merge( r, arg );
+
+		});
+
+		return r;
+	},
+	
+	attr: function(elem, name, value){
+		var fix = jQuery.isXMLDoc(elem) ? {} : jQuery.props;
+
+		// Safari mis-reports the default selected property of a hidden option
+		// Accessing the parent's selectedIndex property fixes it
+		if ( name == "selected" && jQuery.browser.safari )
+			elem.parentNode.selectedIndex;
+		
+		// Certain attributes only work when accessed via the old DOM 0 way
+		if ( fix[name] ) {
+			if ( value != undefined ) elem[fix[name]] = value;
+			return elem[fix[name]];
+		} else if ( jQuery.browser.msie && name == "style" )
+			return jQuery.attr( elem.style, "cssText", value );
+
+		else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") )
+			return elem.getAttributeNode(name).nodeValue;
+
+		// IE elem.getAttribute passes even for style
+		else if ( elem.tagName ) {
+
+			if ( value != undefined ) {
+				if ( name == "type" && jQuery.nodeName(elem,"input") && elem.parentNode )
+					throw "type property can't be changed";
+				elem.setAttribute( name, value );
+			}
+
+			if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) ) 
+				return elem.getAttribute( name, 2 );
+
+			return elem.getAttribute( name );
+
+		// elem is actually elem.style ... set the style
+		} else {
+			// IE actually uses filters for opacity
+			if ( name == "opacity" && jQuery.browser.msie ) {
+				if ( value != undefined ) {
+					// IE has trouble with opacity if it does not have layout
+					// Force it by setting the zoom level
+					elem.zoom = 1; 
+	
+					// Set the alpha filter to set the opacity
+					elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/,"") +
+						(parseFloat(value).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
+				}
+	
+				return elem.filter ? 
+					(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : "";
+			}
+			name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();});
+			if ( value != undefined ) elem[name] = value;
+			return elem[name];
+		}
+	},
+	
+	trim: function(t){
+		return (t||"").replace(/^\s+|\s+$/g, "");
+	},
+
+	makeArray: function( a ) {
+		var r = [];
+
+		// Need to use typeof to fight Safari childNodes crashes
+		if ( typeof a != "array" )
+			for ( var i = 0, al = a.length; i < al; i++ )
+				r.push( a[i] );
+		else
+			r = a.slice( 0 );
+
+		return r;
+	},
+
+	inArray: function( b, a ) {
+		for ( var i = 0, al = a.length; i < al; i++ )
+			if ( a[i] == b )
+				return i;
+		return -1;
+	},
+
+	merge: function(first, second) {
+		// We have to loop this way because IE & Opera overwrite the length
+		// expando of getElementsByTagName
+
+		// Also, we need to make sure that the correct elements are being returned
+		// (IE returns comment nodes in a '*' query)
+		if ( jQuery.browser.msie ) {
+			for ( var i = 0; second[i]; i++ )
+				if ( second[i].nodeType != 8 )
+					first.push(second[i]);
+		} else
+			for ( var i = 0; second[i]; i++ )
+				first.push(second[i]);
+
+		return first;
+	},
+
+	unique: function(first) {
+		var r = [], done = {};
+
+		try {
+			for ( var i = 0, fl = first.length; i < fl; i++ ) {
+				var id = jQuery.data(first[i]);
+				if ( !done[id] ) {
+					done[id] = true;
+					r.push(first[i]);
+				}
+			}
+		} catch(e) {
+			r = first;
+		}
+
+		return r;
+	},
+
+	grep: function(elems, fn, inv) {
+		// If a string is passed in for the function, make a function
+		// for it (a handy shortcut)
+		if ( typeof fn == "string" )
+			fn = eval("false||function(a,i){return " + fn + "}");
+
+		var result = [];
+
+		// Go through the array, only saving the items
+		// that pass the validator function
+		for ( var i = 0, el = elems.length; i < el; i++ )
+			if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )
+				result.push( elems[i] );
+
+		return result;
+	},
+
+	map: function(elems, fn) {
+		// If a string is passed in for the function, make a function
+		// for it (a handy shortcut)
+		if ( typeof fn == "string" )
+			fn = eval("false||function(a){return " + fn + "}");
+
+		var result = [];
+
+		// Go through the array, translating each of the items to their
+		// new value (or values).
+		for ( var i = 0, el = elems.length; i < el; i++ ) {
+			var val = fn(elems[i],i);
+
+			if ( val !== null && val != undefined ) {
+				if ( val.constructor != Array ) val = [val];
+				result = result.concat( val );
+			}
+		}
+
+		return result;
+	}
+});
+
+var userAgent = navigator.userAgent.toLowerCase();
+
+// Figure out what browser is being used
+jQuery.browser = {
+	version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
+	safari: /webkit/.test(userAgent),
+	opera: /opera/.test(userAgent),
+	msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
+	mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
+};
+
+var styleFloat = jQuery.browser.msie ? "styleFloat" : "cssFloat";
+	
+jQuery.extend({
+	// Check to see if the W3C box model is being used
+	boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
+	
+	styleFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat",
+	
+	props: {
+		"for": "htmlFor",
+		"class": "className",
+		"float": styleFloat,
+		cssFloat: styleFloat,
+		styleFloat: styleFloat,
+		innerHTML: "innerHTML",
+		className: "className",
+		value: "value",
+		disabled: "disabled",
+		checked: "checked",
+		readonly: "readOnly",
+		selected: "selected",
+		maxlength: "maxLength"
+	}
+});
+
+jQuery.each({
+	parent: "a.parentNode",
+	parents: "jQuery.dir(a,'parentNode')",
+	next: "jQuery.nth(a,2,'nextSibling')",
+	prev: "jQuery.nth(a,2,'previousSibling')",
+	nextAll: "jQuery.dir(a,'nextSibling')",
+	prevAll: "jQuery.dir(a,'previousSibling')",
+	siblings: "jQuery.sibling(a.parentNode.firstChild,a)",
+	children: "jQuery.sibling(a.firstChild)",
+	contents: "jQuery.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)"
+}, function(i,n){
+	jQuery.fn[ i ] = function(a) {
+		var ret = jQuery.map(this,n);
+		if ( a && typeof a == "string" )
+			ret = jQuery.multiFilter(a,ret);
+		return this.pushStack( jQuery.unique(ret) );
+	};
+});
+
+jQuery.each({
+	appendTo: "append",
+	prependTo: "prepend",
+	insertBefore: "before",
+	insertAfter: "after",
+	replaceAll: "replaceWith"
+}, function(i,n){
+	jQuery.fn[ i ] = function(){
+		var a = arguments;
+		return this.each(function(){
+			for ( var j = 0, al = a.length; j < al; j++ )
+				jQuery(a[j])[n]( this );
+		});
+	};
+});
+
+jQuery.each( {
+	removeAttr: function( key ) {
+		jQuery.attr( this, key, "" );
+		this.removeAttribute( key );
+	},
+	addClass: function(c){
+		jQuery.className.add(this,c);
+	},
+	removeClass: function(c){
+		jQuery.className.remove(this,c);
+	},
+	toggleClass: function( c ){
+		jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c);
+	},
+	remove: function(a){
+		if ( !a || jQuery.filter( a, [this] ).r.length ) {
+			jQuery.removeData( this );
+			this.parentNode.removeChild( this );
+		}
+	},
+	empty: function() {
+		// Clean up the cache
+		jQuery("*", this).each(function(){ jQuery.removeData(this); });
+
+		while ( this.firstChild )
+			this.removeChild( this.firstChild );
+	}
+}, function(i,n){
+	jQuery.fn[ i ] = function() {
+		return this.each( n, arguments );
+	};
+});
+
+jQuery.each( [ "Height", "Width" ], function(i,name){
+	var n = name.toLowerCase();
+	
+	jQuery.fn[ n ] = function(h) {
+		return this[0] == window ?
+			jQuery.browser.safari && self["inner" + name] ||
+			jQuery.boxModel && Math.max(document.documentElement["client" + name], document.body["client" + name]) ||
+			document.body["client" + name] :
+		
+			this[0] == document ?
+				Math.max( document.body["scroll" + name], document.body["offset" + name] ) :
+        
+				h == undefined ?
+					( this.length ? jQuery.css( this[0], n ) : null ) :
+					this.css( n, h.constructor == String ? h : h + "px" );
+	};
+});
+
+var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
+		"(?:[\\w*_-]|\\\\.)" :
+		"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
+	quickChild = new RegExp("^>\\s*(" + chars + "+)"),
+	quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
+	quickClass = new RegExp("^([#.]?)(" + chars + "*)");
+
+jQuery.extend({
+	expr: {
+		"": "m[2]=='*'||jQuery.nodeName(a,m[2])",
+		"#": "a.getAttribute('id')==m[2]",
+		":": {
+			// Position Checks
+			lt: "i<m[3]-0",
+			gt: "i>m[3]-0",
+			nth: "m[3]-0==i",
+			eq: "m[3]-0==i",
+			first: "i==0",
+			last: "i==r.length-1",
+			even: "i%2==0",
+			odd: "i%2",
+
+			// Child Checks
+			"first-child": "a.parentNode.getElementsByTagName('*')[0]==a",
+			"last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a",
+			"only-child": "!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')",
+
+			// Parent Checks
+			parent: "a.firstChild",
+			empty: "!a.firstChild",
+
+			// Text Check
+			contains: "(a.textContent||a.innerText||jQuery(a).text()||'').indexOf(m[3])>=0",
+
+			// Visibility
+			visible: '"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"',
+			hidden: '"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"',
+
+			// Form attributes
+			enabled: "!a.disabled",
+			disabled: "a.disabled",
+			checked: "a.checked",
+			selected: "a.selected||jQuery.attr(a,'selected')",
+
+			// Form elements
+			text: "'text'==a.type",
+			radio: "'radio'==a.type",
+			checkbox: "'checkbox'==a.type",
+			file: "'file'==a.type",
+			password: "'password'==a.type",
+			submit: "'submit'==a.type",
+			image: "'image'==a.type",
+			reset: "'reset'==a.type",
+			button: '"button"==a.type||jQuery.nodeName(a,"button")',
+			input: "/input|select|textarea|button/i.test(a.nodeName)",
+
+			// :has()
+			has: "jQuery.find(m[3],a).length",
+
+			// :header
+			header: "/h\\d/i.test(a.nodeName)",
+
+			// :animated
+			animated: "jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length"
+		}
+	},
+	
+	// The regular expressions that power the parsing engine
+	parse: [
+		// Match: [@value='test'], [@foo]
+		/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
+
+		// Match: :contains('foo')
+		/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
+
+		// Match: :even, :last-chlid, #id, .class
+		new RegExp("^([:.#]*)(" + chars + "+)")
+	],
+
+	multiFilter: function( expr, elems, not ) {
+		var old, cur = [];
+
+		while ( expr && expr != old ) {
+			old = expr;
+			var f = jQuery.filter( expr, elems, not );
+			expr = f.t.replace(/^\s*,\s*/, "" );
+			cur = not ? elems = f.r : jQuery.merge( cur, f.r );
+		}
+
+		return cur;
+	},
+
+	find: function( t, context ) {
+		// Quickly handle non-string expressions
+		if ( typeof t != "string" )
+			return [ t ];
+
+		// Make sure that the context is a DOM Element
+		if ( context && !context.nodeType )
+			context = null;
+
+		// Set the correct context (if none is provided)
+		context = context || document;
+
+		// Initialize the search
+		var ret = [context], done = [], last;
+
+		// Continue while a selector expression exists, and while
+		// we're no longer looping upon ourselves
+		while ( t && last != t ) {
+			var r = [];
+			last = t;
+
+			t = jQuery.trim(t);
+
+			var foundToken = false;
+
+			// An attempt at speeding up child selectors that
+			// point to a specific element tag
+			var re = quickChild;
+			var m = re.exec(t);
+
+			if ( m ) {
+				var nodeName = m[1].toUpperCase();
+
+				// Perform our own iteration and filter
+				for ( var i = 0; ret[i]; i++ )
+					for ( var c = ret[i].firstChild; c; c = c.nextSibling )
+						if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName.toUpperCase()) )
+							r.push( c );
+
+				ret = r;
+				t = t.replace( re, "" );
+				if ( t.indexOf(" ") == 0 ) continue;
+				foundToken = true;
+			} else {
+				re = /^([>+~])\s*(\w*)/i;
+
+				if ( (m = re.exec(t)) != null ) {
+					r = [];
+
+					var nodeName = m[2], merge = {};
+					m = m[1];
+
+					for ( var j = 0, rl = ret.length; j < rl; j++ ) {
+						var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
+						for ( ; n; n = n.nextSibling )
+							if ( n.nodeType == 1 ) {
+								var id = jQuery.data(n);
+
+								if ( m == "~" && merge[id] ) break;
+								
+								if (!nodeName || n.nodeName.toUpperCase() == nodeName.toUpperCase() ) {
+									if ( m == "~" ) merge[id] = true;
+									r.push( n );
+								}
+								
+								if ( m == "+" ) break;
+							}
+					}
+
+					ret = r;
+
+					// And remove the token
+					t = jQuery.trim( t.replace( re, "" ) );
+					foundToken = true;
+				}
+			}
+
+			// See if there's still an expression, and that we haven't already
+			// matched a token
+			if ( t && !foundToken ) {
+				// Handle multiple expressions
+				if ( !t.indexOf(",") ) {
+					// Clean the result set
+					if ( context == ret[0] ) ret.shift();
+
+					// Merge the result sets
+					done = jQuery.merge( done, ret );
+
+					// Reset the context
+					r = ret = [context];
+
+					// Touch up the selector string
+					t = " " + t.substr(1,t.length);
+
+				} else {
+					// Optimize for the case nodeName#idName
+					var re2 = quickID;
+					var m = re2.exec(t);
+					
+					// Re-organize the results, so that they're consistent
+					if ( m ) {
+					   m = [ 0, m[2], m[3], m[1] ];
+
+					} else {
+						// Otherwise, do a traditional filter check for
+						// ID, class, and element selectors
+						re2 = quickClass;
+						m = re2.exec(t);
+					}
+
+					m[2] = m[2].replace(/\\/g, "");
+
+					var elem = ret[ret.length-1];
+
+					// Try to do a global search by ID, where we can
+					if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
+						// Optimization for HTML document case
+						var oid = elem.getElementById(m[2]);
+						
+						// Do a quick check for the existence of the actual ID attribute
+						// to avoid selecting by the name attribute in IE
+						// also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
+						if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
+							oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
+
+						// Do a quick check for node name (where applicable) so
+						// that div#foo searches will be really fast
+						ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
+					} else {
+						// We need to find all descendant elements
+						for ( var i = 0; ret[i]; i++ ) {
+							// Grab the tag name being searched for
+							var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
+
+							// Handle IE7 being really dumb about <object>s
+							if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
+								tag = "param";
+
+							r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
+						}
+
+						// It's faster to filter by class and be done with it
+						if ( m[1] == "." )
+							r = jQuery.classFilter( r, m[2] );
+
+						// Same with ID filtering
+						if ( m[1] == "#" ) {
+							var tmp = [];
+
+							// Try to find the element with the ID
+							for ( var i = 0; r[i]; i++ )
+								if ( r[i].getAttribute("id") == m[2] ) {
+									tmp = [ r[i] ];
+									break;
+								}
+
+							r = tmp;
+						}
+
+						ret = r;
+					}
+
+					t = t.replace( re2, "" );
+				}
+
+			}
+
+			// If a selector string still exists
+			if ( t ) {
+				// Attempt to filter it
+				var val = jQuery.filter(t,r);
+				ret = r = val.r;
+				t = jQuery.trim(val.t);
+			}
+		}
+
+		// An error occurred with the selector;
+		// just return an empty set instead
+		if ( t )
+			ret = [];
+
+		// Remove the root context
+		if ( ret && context == ret[0] )
+			ret.shift();
+
+		// And combine the results
+		done = jQuery.merge( done, ret );
+
+		return done;
+	},
+
+	classFilter: function(r,m,not){
+		m = " " + m + " ";
+		var tmp = [];
+		for ( var i = 0; r[i]; i++ ) {
+			var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
+			if ( !not && pass || not && !pass )
+				tmp.push( r[i] );
+		}
+		return tmp;
+	},
+
+	filter: function(t,r,not) {
+		var last;
+
+		// Look for common filter expressions
+		while ( t  && t != last ) {
+			last = t;
+
+			var p = jQuery.parse, m;
+
+			for ( var i = 0; p[i]; i++ ) {
+				m = p[i].exec( t );
+
+				if ( m ) {
+					// Remove what we just matched
+					t = t.substring( m[0].length );
+
+					m[2] = m[2].replace(/\\/g, "");
+					break;
+				}
+			}
+
+			if ( !m )
+				break;
+
+			// :not() is a special case that can be optimized by
+			// keeping it out of the expression list
+			if ( m[1] == ":" && m[2] == "not" )
+				r = jQuery.filter(m[3], r, true).r;
+
+			// We can get a big speed boost by filtering by class here
+			else if ( m[1] == "." )
+				r = jQuery.classFilter(r, m[2], not);
+
+			else if ( m[1] == "[" ) {
+				var tmp = [], type = m[3];
+				
+				for ( var i = 0, rl = r.length; i < rl; i++ ) {
+					var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
+					
+					if ( z == null || /href|src|selected/.test(m[2]) )
+						z = jQuery.attr(a,m[2]) || '';
+
+					if ( (type == "" && !!z ||
+						 type == "=" && z == m[5] ||
+						 type == "!=" && z != m[5] ||
+						 type == "^=" && z && !z.indexOf(m[5]) ||
+						 type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
+						 (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
+							tmp.push( a );
+				}
+				
+				r = tmp;
+
+			// We can get a speed boost by handling nth-child here
+			} else if ( m[1] == ":" && m[2] == "nth-child" ) {
+				var merge = {}, tmp = [],
+					test = /(\d*)n\+?(\d*)/.exec(
+						m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
+						!/\D/.test(m[3]) && "n+" + m[3] || m[3]),
+					first = (test[1] || 1) - 0, last = test[2] - 0;
+
+				for ( var i = 0, rl = r.length; i < rl; i++ ) {
+					var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
+
+					if ( !merge[id] ) {
+						var c = 1;
+
+						for ( var n = parentNode.firstChild; n; n = n.nextSibling )
+							if ( n.nodeType == 1 )
+								n.nodeIndex = c++;
+
+						merge[id] = true;
+					}
+
+					var add = false;
+
+					if ( first == 1 ) {
+						if ( last == 0 || node.nodeIndex == last )
+							add = true;
+					} else if ( (node.nodeIndex + last) % first == 0 )
+						add = true;
+
+					if ( add ^ not )
+						tmp.push( node );
+				}
+
+				r = tmp;
+
+			// Otherwise, find the expression to execute
+			} else {
+				var f = jQuery.expr[m[1]];
+				if ( typeof f != "string" )
+					f = jQuery.expr[m[1]][m[2]];
+
+				// Build a custom macro to enclose it
+				f = eval("false||function(a,i){return " + f + "}");
+
+				// Execute it against the current filter
+				r = jQuery.grep( r, f, not );
+			}
+		}
+
+		// Return an array of filtered elements (r)
+		// and the modified expression string (t)
+		return { r: r, t: t };
+	},
+
+	dir: function( elem, dir ){
+		var matched = [];
+		var cur = elem[dir];
+		while ( cur && cur != document ) {
+			if ( cur.nodeType == 1 )
+				matched.push( cur );
+			cur = cur[dir];
+		}
+		return matched;
+	},
+	
+	nth: function(cur,result,dir,elem){
+		result = result || 1;
+		var num = 0;
+
+		for ( ; cur; cur = cur[dir] )
+			if ( cur.nodeType == 1 && ++num == result )
+				break;
+
+		return cur;
+	},
+	
+	sibling: function( n, elem ) {
+		var r = [];
+
+		for ( ; n; n = n.nextSibling ) {
+			if ( n.nodeType == 1 && (!elem || n != elem) )
+				r.push( n );
+		}
+
+		return r;
+	}
+});
+/*
+ * A number of helper functions used for managing events.
+ * Many of the ideas behind this code orignated from 
+ * Dean Edwards' addEvent library.
+ */
+jQuery.event = {
+
+	// Bind an event to an element
+	// Original by Dean Edwards
+	add: function(element, type, handler, data) {
+		// For whatever reason, IE has trouble passing the window object
+		// around, causing it to be cloned in the process
+		if ( jQuery.browser.msie && element.setInterval != undefined )
+			element = window;
+
+		// Make sure that the function being executed has a unique ID
+		if ( !handler.guid )
+			handler.guid = this.guid++;
+			
+		// if data is passed, bind to handler 
+		if( data != undefined ) { 
+        		// Create temporary function pointer to original handler 
+			var fn = handler; 
+
+			// Create unique handler function, wrapped around original handler 
+			handler = function() { 
+				// Pass arguments and context to original handler 
+				return fn.apply(this, arguments); 
+			};
+
+			// Store data in unique handler 
+			handler.data = data;
+
+			// Set the guid of unique handler to the same of original handler, so it can be removed 
+			handler.guid = fn.guid;
+		}
+
+		// Namespaced event handlers
+		var parts = type.split(".");
+		type = parts[0];
+		handler.type = parts[1];
+
+		// Init the element's event structure
+		var events = jQuery.data(element, "events") || jQuery.data(element, "events", {});
+		
+		var handle = jQuery.data(element, "handle", function(){
+			// returned undefined or false
+			var val;
+
+			// Handle the second event of a trigger and when
+			// an event is called after a page has unloaded
+			if ( typeof jQuery == "undefined" || jQuery.event.triggered )
+				return val;
+			
+			val = jQuery.event.handle.apply(element, arguments);
+			
+			return val;
+		});
+
+		// Get the current list of functions bound to this event
+		var handlers = events[type];
+
+		// Init the event handler queue
+		if (!handlers) {
+			handlers = events[type] = {};	
+			
+			// And bind the global event handler to the element
+			if (element.addEventListener)
+				element.addEventListener(type, handle, false);
+			else
+				element.attachEvent("on" + type, handle);
+		}
+
+		// Add the function to the element's handler list
+		handlers[handler.guid] = handler;
+
+		// Keep track of which events have been used, for global triggering
+		this.global[type] = true;
+	},
+
+	guid: 1,
+	global: {},
+
+	// Detach an event or set of events from an element
+	remove: function(element, type, handler) {
+		var events = jQuery.data(element, "events"), ret, index;
+
+		// Namespaced event handlers
+		if ( typeof type == "string" ) {
+			var parts = type.split(".");
+			type = parts[0];
+		}
+
+		if ( events ) {
+			// type is actually an event object here
+			if ( type && type.type ) {
+				handler = type.handler;
+				type = type.type;
+			}
+			
+			if ( !type ) {
+				for ( type in events )
+					this.remove( element, type );
+
+			} else if ( events[type] ) {
+				// remove the given handler for the given type
+				if ( handler )
+					delete events[type][handler.guid];
+				
+				// remove all handlers for the given type
+				else
+					for ( handler in events[type] )
+						// Handle the removal of namespaced events
+						if ( !parts[1] || events[type][handler].type == parts[1] )
+							delete events[type][handler];
+
+				// remove generic event handler if no more handlers exist
+				for ( ret in events[type] ) break;
+				if ( !ret ) {
+					if (element.removeEventListener)
+						element.removeEventListener(type, jQuery.data(element, "handle"), false);
+					else
+						element.detachEvent("on" + type, jQuery.data(element, "handle"));
+					ret = null;
+					delete events[type];
+				}
+			}
+
+			// Remove the expando if it's no longer used
+			for ( ret in events ) break;
+			if ( !ret ) {
+				jQuery.removeData( element, "events" );
+				jQuery.removeData( element, "handle" );
+			}
+		}
+	},
+
+	trigger: function(type, data, element, donative, extra) {
+		// Clone the incoming data, if any
+		data = jQuery.makeArray(data || []);
+
+		// Handle a global trigger
+		if ( !element ) {
+			// Only trigger if we've ever bound an event for it
+			if ( this.global[type] )
+				jQuery("*").add([window, document]).trigger(type, data);
+
+		// Handle triggering a single element
+		} else {
+			var val, ret, fn = jQuery.isFunction( element[ type ] || null ),
+				// Check to see if we need to provide a fake event, or not
+				evt = !data[0] || !data[0].preventDefault;
+			
+			// Pass along a fake event
+			if ( evt )
+				data.unshift( this.fix({ type: type, target: element }) );
+
+			// Enforce the right trigger type
+			data[0].type = type;
+
+			// Trigger the event
+			if ( jQuery.isFunction( jQuery.data(element, "handle") ) )
+				val = jQuery.data(element, "handle").apply( element, data );
+
+			// Handle triggering native .onfoo handlers
+			if ( !fn && element["on"+type] && element["on"+type].apply( element, data ) === false )
+				val = false;
+
+			// Extra functions don't get the custom event object
+			if ( evt )
+				data.shift();
+
+			// Handle triggering of extra function
+			if ( extra && extra.apply( element, data ) === false )
+				val = false;
+
+			// Trigger the native events (except for clicks on links)
+			if ( fn && donative !== false && val !== false && !(jQuery.nodeName(element, 'a') && type == "click") ) {
+				this.triggered = true;
+				element[ type ]();
+			}
+
+			this.triggered = false;
+		}
+
+		return val;
+	},
+
+	handle: function(event) {
+		// returned undefined or false
+		var val;
+
+		// Empty object is for triggered events with no data
+		event = jQuery.event.fix( event || window.event || {} ); 
+
+		// Namespaced event handlers
+		var parts = event.type.split(".");
+		event.type = parts[0];
+
+		var c = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 );
+		args.unshift( event );
+
+		for ( var j in c ) {
+			// Pass in a reference to the handler function itself
+			// So that we can later remove it
+			args[0].handler = c[j];
+			args[0].data = c[j].data;
+
+			// Filter the functions by class
+			if ( !parts[1] || c[j].type == parts[1] ) {
+				var tmp = c[j].apply( this, args );
+
+				if ( val !== false )
+					val = tmp;
+
+				if ( tmp === false ) {
+					event.preventDefault();
+					event.stopPropagation();
+				}
+			}
+		}
+
+		// Clean up added properties in IE to prevent memory leak
+		if (jQuery.browser.msie)
+			event.target = event.preventDefault = event.stopPropagation =
+				event.handler = event.data = null;
+
+		return val;
+	},
+
+	fix: function(event) {
+		// store a copy of the original event object 
+		// and clone to set read-only properties
+		var originalEvent = event;
+		event = jQuery.extend({}, originalEvent);
+		
+		// add preventDefault and stopPropagation since 
+		// they will not work on the clone
+		event.preventDefault = function() {
+			// if preventDefault exists run it on the original event
+			if (originalEvent.preventDefault)
+				originalEvent.preventDefault();
+			// otherwise set the returnValue property of the original event to false (IE)
+			originalEvent.returnValue = false;
+		};
+		event.stopPropagation = function() {
+			// if stopPropagation exists run it on the original event
+			if (originalEvent.stopPropagation)
+				originalEvent.stopPropagation();
+			// otherwise set the cancelBubble property of the original event to true (IE)
+			originalEvent.cancelBubble = true;
+		};
+		
+		// Fix target property, if necessary
+		if ( !event.target && event.srcElement )
+			event.target = event.srcElement;
+				
+		// check if target is a textnode (safari)
+		if (jQuery.browser.safari && event.target.nodeType == 3)
+			event.target = originalEvent.target.parentNode;
+
+		// Add relatedTarget, if necessary
+		if ( !event.relatedTarget && event.fromElement )
+			event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
+
+		// Calculate pageX/Y if missing and clientX/Y available
+		if ( event.pageX == null && event.clientX != null ) {
+			var e = document.documentElement, b = document.body;
+			event.pageX = event.clientX + (e && e.scrollLeft || b.scrollLeft || 0);
+			event.pageY = event.clientY + (e && e.scrollTop || b.scrollTop || 0);
+		}
+			
+		// Add which for key events
+		if ( !event.which && (event.charCode || event.keyCode) )
+			event.which = event.charCode || event.keyCode;
+		
+		// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
+		if ( !event.metaKey && event.ctrlKey )
+			event.metaKey = event.ctrlKey;
+
+		// Add which for click: 1 == left; 2 == middle; 3 == right
+		// Note: button is not normalized, so don't use it
+		if ( !event.which && event.button )
+			event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+			
+		return event;
+	}
+};
+
+jQuery.fn.extend({
+	bind: function( type, data, fn ) {
+		return type == "unload" ? this.one(type, data, fn) : this.each(function(){
+			jQuery.event.add( this, type, fn || data, fn && data );
+		});
+	},
+	
+	one: function( type, data, fn ) {
+		return this.each(function(){
+			jQuery.event.add( this, type, function(event) {
+				jQuery(this).unbind(event);
+				return (fn || data).apply( this, arguments);
+			}, fn && data);
+		});
+	},
+
+	unbind: function( type, fn ) {
+		return this.each(function(){
+			jQuery.event.remove( this, type, fn );
+		});
+	},
+
+	trigger: function( type, data, fn ) {
+		return this.each(function(){
+			jQuery.event.trigger( type, data, this, true, fn );
+		});
+	},
+
+	triggerHandler: function( type, data, fn ) {
+		if ( this[0] )
+			return jQuery.event.trigger( type, data, this[0], false, fn );
+	},
+
+	toggle: function() {
+		// Save reference to arguments for access in closure
+		var a = arguments;
+
+		return this.click(function(e) {
+			// Figure out which function to execute
+			this.lastToggle = 0 == this.lastToggle ? 1 : 0;
+			
+			// Make sure that clicks stop
+			e.preventDefault();
+			
+			// and execute the function
+			return a[this.lastToggle].apply( this, [e] ) || false;
+		});
+	},
+
+	hover: function(f,g) {
+		
+		// A private function for handling mouse 'hovering'
+		function handleHover(e) {
+			// Check if mouse(over|out) are still within the same parent element
+			var p = e.relatedTarget;
+	
+			// Traverse up the tree
+			while ( p && p != this ) try { p = p.parentNode; } catch(e) { p = this; };
+			
+			// If we actually just moused on to a sub-element, ignore it
+			if ( p == this ) return false;
+			
+			// Execute the right function
+			return (e.type == "mouseover" ? f : g).apply(this, [e]);
+		}
+		
+		// Bind the function to the two event listeners
+		return this.mouseover(handleHover).mouseout(handleHover);
+	},
+	
+	ready: function(f) {
+		// Attach the listeners
+		bindReady();
+
+		// If the DOM is already ready
+		if ( jQuery.isReady )
+			// Execute the function immediately
+			f.apply( document, [jQuery] );
+			
+		// Otherwise, remember the function for later
+		else
+			// Add the function to the wait list
+			jQuery.readyList.push( function() { return f.apply(this, [jQuery]); } );
+	
+		return this;
+	}
+});
+
+jQuery.extend({
+	/*
+	 * All the code that makes DOM Ready work nicely.
+	 */
+	isReady: false,
+	readyList: [],
+	
+	// Handle when the DOM is ready
+	ready: function() {
+		// Make sure that the DOM is not already loaded
+		if ( !jQuery.isReady ) {
+			// Remember that the DOM is ready
+			jQuery.isReady = true;
+			
+			// If there are functions bound, to execute
+			if ( jQuery.readyList ) {
+				// Execute all of them
+				jQuery.each( jQuery.readyList, function(){
+					this.apply( document );
+				});
+				
+				// Reset the list of functions
+				jQuery.readyList = null;
+			}
+			// Remove event listener to avoid memory leak
+			if ( jQuery.browser.mozilla || jQuery.browser.opera )
+				document.removeEventListener( "DOMContentLoaded", jQuery.ready, false );
+			
+			// Remove script element used by IE hack
+			if( !window.frames.length ) // don't remove if frames are present (#1187)
+				jQuery(window).load(function(){ jQuery("#__ie_init").remove(); });
+		}
+	}
+});
+
+jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
+	"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + 
+	"submit,keydown,keypress,keyup,error").split(","), function(i,o){
+	
+	// Handle event binding
+	jQuery.fn[o] = function(f){
+		return f ? this.bind(o, f) : this.trigger(o);
+	};
+});
+
+var readyBound = false;
+
+function bindReady(){
+	if ( readyBound ) return;
+	readyBound = true;
+
+	// If Mozilla is used
+	if ( jQuery.browser.mozilla || jQuery.browser.opera )
+		// Use the handy event callback
+		document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
+	
+	// If IE is used, use the excellent hack by Matthias Miller
+	// http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited
+	else if ( jQuery.browser.msie ) {
+	
+		// Only works if you document.write() it
+		document.write("<scr" + "ipt id=__ie_init defer=true " + 
+			"src=//:><\/script>");
+	
+		// Use the defer script hack
+		var script = document.getElementById("__ie_init");
+		
+		// script does not exist if jQuery is loaded dynamically
+		if ( script ) 
+			script.onreadystatechange = function() {
+				if ( this.readyState != "complete" ) return;
+				jQuery.ready();
+			};
+	
+		// Clear from memory
+		script = null;
+	
+	// If Safari  is used
+	} else if ( jQuery.browser.safari )
+		// Continually check to see if the document.readyState is valid
+		jQuery.safariTimer = setInterval(function(){
+			// loaded and complete are both valid states
+			if ( document.readyState == "loaded" || 
+				document.readyState == "complete" ) {
+	
+				// If either one are found, remove the timer
+				clearInterval( jQuery.safariTimer );
+				jQuery.safariTimer = null;
+	
+				// and execute any waiting functions
+				jQuery.ready();
+			}
+		}, 10); 
+
+	// A fallback to window.onload, that will always work
+	jQuery.event.add( window, "load", jQuery.ready );
+}
+jQuery.fn.extend({
+	load: function( url, params, callback ) {
+		if ( jQuery.isFunction( url ) )
+			return this.bind("load", url);
+
+		var off = url.indexOf(" ");
+		if ( off >= 0 ) {
+			var selector = url.slice(off, url.length);
+			url = url.slice(0, off);
+		}
+
+		callback = callback || function(){};
+
+		// Default to a GET request
+		var type = "GET";
+
+		// If the second parameter was provided
+		if ( params )
+			// If it's a function
+			if ( jQuery.isFunction( params ) ) {
+				// We assume that it's the callback
+				callback = params;
+				params = null;
+
+			// Otherwise, build a param string
+			} else {
+				params = jQuery.param( params );
+				type = "POST";
+			}
+
+		var self = this;
+
+		// Request the remote document
+		jQuery.ajax({
+			url: url,
+			type: type,
+			data: params,
+			complete: function(res, status){
+				// If successful, inject the HTML into all the matched elements
+				if ( status == "success" || status == "notmodified" )
+					// See if a selector was specified
+					self.html( selector ?
+						// Create a dummy div to hold the results
+						jQuery("<div/>")
+							// inject the contents of the document in, removing the scripts
+							// to avoid any 'Permission Denied' errors in IE
+							.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
+
+							// Locate the specified elements
+							.find(selector) :
+
+						// If not, just inject the full result
+						res.responseText );
+
+				// Add delay to account for Safari's delay in globalEval
+				setTimeout(function(){
+					self.each( callback, [res.responseText, status, res] );
+				}, 13);
+			}
+		});
+		return this;
+	},
+
+	serialize: function() {
+		return jQuery.param(this.serializeArray());
+	},
+	serializeArray: function() {
+		return this.map(function(){
+			return jQuery.nodeName(this, "form") ?
+				jQuery.makeArray(this.elements) : this;
+		})
+		.filter(function(){
+			return this.name && !this.disabled && 
+				(this.checked || /select|textarea/i.test(this.nodeName) || 
+					/text|hidden|password/i.test(this.type));
+		})
+		.map(function(i, elem){
+			var val = jQuery(this).val();
+			return val == null ? null :
+				val.constructor == Array ?
+					jQuery.map( val, function(val, i){
+						return {name: elem.name, value: val};
+					}) :
+					{name: elem.name, value: val};
+		}).get();
+	}
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
+	jQuery.fn[o] = function(f){
+		return this.bind(o, f);
+	};
+});
+
+var jsc = (new Date).getTime();
+
+jQuery.extend({
+	get: function( url, data, callback, type ) {
+		// shift arguments if data argument was ommited
+		if ( jQuery.isFunction( data ) ) {
+			callback = data;
+			data = null;
+		}
+		
+		return jQuery.ajax({
+			type: "GET",
+			url: url,
+			data: data,
+			success: callback,
+			dataType: type
+		});
+	},
+
+	getScript: function( url, callback ) {
+		return jQuery.get(url, null, callback, "script");
+	},
+
+	getJSON: function( url, data, callback ) {
+		return jQuery.get(url, data, callback, "json");
+	},
+
+	post: function( url, data, callback, type ) {
+		if ( jQuery.isFunction( data ) ) {
+			callback = data;
+			data = {};
+		}
+
+		return jQuery.ajax({
+			type: "POST",
+			url: url,
+			data: data,
+			success: callback,
+			dataType: type
+		});
+	},
+
+	ajaxSetup: function( settings ) {
+		jQuery.extend( jQuery.ajaxSettings, settings );
+	},
+
+	ajaxSettings: {
+		global: true,
+		type: "GET",
+		timeout: 0,
+		contentType: "application/x-www-form-urlencoded",
+		processData: true,
+		async: true,
+		data: null
+	},
+	
+	// Last-Modified header cache for next request
+	lastModified: {},
+
+	ajax: function( s ) {
+		var jsonp, jsre = /=(\?|%3F)/g, status, data;
+
+		// Extend the settings, but re-extend 's' so that it can be
+		// checked again later (in the test suite, specifically)
+		s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
+
+		// convert data if not already a string
+		if ( s.data && s.processData && typeof s.data != "string" )
+			s.data = jQuery.param(s.data);
+
+		// Handle JSONP Parameter Callbacks
+		if ( s.dataType == "jsonp" ) {
+			if ( s.type.toLowerCase() == "get" ) {
+				if ( !s.url.match(jsre) )
+					s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
+			} else if ( !s.data || !s.data.match(jsre) )
+				s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
+			s.dataType = "json";
+		}
+
+		// Build temporary JSONP function
+		if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
+			jsonp = "jsonp" + jsc++;
+
+			// Replace the =? sequence both in the query string and the data
+			if ( s.data )
+				s.data = s.data.replace(jsre, "=" + jsonp);
+			s.url = s.url.replace(jsre, "=" + jsonp);
+
+			// We need to make sure
+			// that a JSONP style response is executed properly
+			s.dataType = "script";
+
+			// Handle JSONP-style loading
+			window[ jsonp ] = function(tmp){
+				data = tmp;
+				success();
+				complete();
+				// Garbage collect
+				window[ jsonp ] = undefined;
+				try{ delete window[ jsonp ]; } catch(e){}
+			};
+		}
+
+		if ( s.dataType == "script" && s.cache == null )
+			s.cache = false;
+
+		if ( s.cache === false && s.type.toLowerCase() == "get" )
+			s.url += (s.url.match(/\?/) ? "&" : "?") + "_=" + (new Date()).getTime();
+
+		// If data is available, append data to url for get requests
+		if ( s.data && s.type.toLowerCase() == "get" ) {
+			s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
+
+			// IE likes to send both get and post data, prevent this
+			s.data = null;
+		}
+
+		// Watch for a new set of requests
+		if ( s.global && ! jQuery.active++ )
+			jQuery.event.trigger( "ajaxStart" );
+
+		// If we're requesting a remote document
+		// and trying to load JSON or Script
+		if ( !s.url.indexOf("http") && s.dataType == "script" ) {
+			var head = document.getElementsByTagName("head")[0];
+			var script = document.createElement("script");
+			script.src = s.url;
+
+			// Handle Script loading
+			if ( !jsonp && (s.success || s.complete) ) {
+				var done = false;
+
+				// Attach handlers for all browsers
+				script.onload = script.onreadystatechange = function(){
+					if ( !done && (!this.readyState || 
+							this.readyState == "loaded" || this.readyState == "complete") ) {
+						done = true;
+						success();
+						complete();
+						head.removeChild( script );
+					}
+				};
+			}
+
+			head.appendChild(script);
+
+			// We handle everything using the script element injection
+			return;
+		}
+
+		var requestDone = false;
+
+		// Create the request object; Microsoft failed to properly
+		// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
+		var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
+
+		// Open the socket
+		xml.open(s.type, s.url, s.async);
+
+		// Set the correct header, if data is being sent
+		if ( s.data )
+			xml.setRequestHeader("Content-Type", s.contentType);
+
+		// Set the If-Modified-Since header, if ifModified mode.
+		if ( s.ifModified )
+			xml.setRequestHeader("If-Modified-Since",
+				jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
+
+		// Set header so the called script knows that it's an XMLHttpRequest
+		xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+
+		// Allow custom headers/mimetypes
+		if ( s.beforeSend )
+			s.beforeSend(xml);
+			
+		if ( s.global )
+		    jQuery.event.trigger("ajaxSend", [xml, s]);
+
+		// Wait for a response to come back
+		var onreadystatechange = function(isTimeout){
+			// The transfer is complete and the data is available, or the request timed out
+			if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
+				requestDone = true;
+				
+				// clear poll interval
+				if (ival) {
+					clearInterval(ival);
+					ival = null;
+				}
+				
+				status = isTimeout == "timeout" && "timeout" ||
+					!jQuery.httpSuccess( xml ) && "error" ||
+					s.ifModified && jQuery.httpNotModified( xml, s.url ) && "notmodified" ||
+					"success";
+
+				if ( status == "success" ) {
+					// Watch for, and catch, XML document parse errors
+					try {
+						// process the data (runs the xml through httpData regardless of callback)
+						data = jQuery.httpData( xml, s.dataType );
+					} catch(e) {
+						status = "parsererror";
+					}
+				}
+
+				// Make sure that the request was successful or notmodified
+				if ( status == "success" ) {
+					// Cache Last-Modified header, if ifModified mode.
+					var modRes;
+					try {
+						modRes = xml.getResponseHeader("Last-Modified");
+					} catch(e) {} // swallow exception thrown by FF if header is not available
+	
+					if ( s.ifModified && modRes )
+						jQuery.lastModified[s.url] = modRes;
+
+					// JSONP handles its own success callback
+					if ( !jsonp )
+						success();	
+				} else
+					jQuery.handleError(s, xml, status);
+
+				// Fire the complete handlers
+				complete();
+
+				// Stop memory leaks
+				if ( s.async )
+					xml = null;
+			}
+		};
+		
+		if ( s.async ) {
+			// don't attach the handler to the request, just poll it instead
+			var ival = setInterval(onreadystatechange, 13); 
+
+			// Timeout checker
+			if ( s.timeout > 0 )
+				setTimeout(function(){
+					// Check to see if the request is still happening
+					if ( xml ) {
+						// Cancel the request
+						xml.abort();
+	
+						if( !requestDone )
+							onreadystatechange( "timeout" );
+					}
+				}, s.timeout);
+		}
+			
+		// Send the data
+		try {
+			xml.send(s.data);
+		} catch(e) {
+			jQuery.handleError(s, xml, null, e);
+		}
+		
+		// firefox 1.5 doesn't fire statechange for sync requests
+		if ( !s.async )
+			onreadystatechange();
+		
+		// return XMLHttpRequest to allow aborting the request etc.
+		return xml;
+
+		function success(){
+			// If a local callback was specified, fire it and pass it the data
+			if ( s.success )
+				s.success( data, status );
+
+			// Fire the global callback
+			if ( s.global )
+				jQuery.event.trigger( "ajaxSuccess", [xml, s] );
+		}
+
+		function complete(){
+			// Process result
+			if ( s.complete )
+				s.complete(xml, status);
+
+			// The request was completed
+			if ( s.global )
+				jQuery.event.trigger( "ajaxComplete", [xml, s] );
+
+			// Handle the global AJAX counter
+			if ( s.global && ! --jQuery.active )
+				jQuery.event.trigger( "ajaxStop" );
+		}
+	},
+
+	handleError: function( s, xml, status, e ) {
+		// If a local callback was specified, fire it
+		if ( s.error ) s.error( xml, status, e );
+
+		// Fire the global callback
+		if ( s.global )
+			jQuery.event.trigger( "ajaxError", [xml, s, e] );
+	},
+
+	// Counter for holding the number of active queries
+	active: 0,
+
+	// Determines if an XMLHttpRequest was successful or not
+	httpSuccess: function( r ) {
+		try {
+			return !r.status && location.protocol == "file:" ||
+				( r.status >= 200 && r.status < 300 ) || r.status == 304 ||
+				jQuery.browser.safari && r.status == undefined;
+		} catch(e){}
+		return false;
+	},
+
+	// Determines if an XMLHttpRequest returns NotModified
+	httpNotModified: function( xml, url ) {
+		try {
+			var xmlRes = xml.getResponseHeader("Last-Modified");
+
+			// Firefox always returns 200. check Last-Modified date
+			return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
+				jQuery.browser.safari && xml.status == undefined;
+		} catch(e){}
+		return false;
+	},
+
+	httpData: function( r, type ) {
+		var ct = r.getResponseHeader("content-type");
+		var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
+		var data = xml ? r.responseXML : r.responseText;
+
+		if ( xml && data.documentElement.tagName == "parsererror" )
+			throw "parsererror";
+
+		// If the type is "script", eval it in global context
+		if ( type == "script" )
+			jQuery.globalEval( data );
+
+		// Get the JavaScript object, if JSON is used.
+		if ( type == "json" )
+			data = eval("(" + data + ")");
+
+		return data;
+	},
+
+	// Serialize an array of form elements or a set of
+	// key/values into a query string
+	param: function( a ) {
+		var s = [];
+
+		// If an array was passed in, assume that it is an array
+		// of form elements
+		if ( a.constructor == Array || a.jquery )
+			// Serialize the form elements
+			jQuery.each( a, function(){
+				s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
+			});
+
+		// Otherwise, assume that it's an object of key/value pairs
+		else
+			// Serialize the key/values
+			for ( var j in a )
+				// If the value is an array then the key names need to be repeated
+				if ( a[j] && a[j].constructor == Array )
+					jQuery.each( a[j], function(){
+						s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
+					});
+				else
+					s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );
+
+		// Return the resulting serialization
+		return s.join("&").replace(/%20/g, "+");
+	}
+
+});
+jQuery.fn.extend({
+	show: function(speed,callback){
+		return speed ?
+			this.animate({
+				height: "show", width: "show", opacity: "show"
+			}, speed, callback) :
+			
+			this.filter(":hidden").each(function(){
+				this.style.display = this.oldblock ? this.oldblock : "";
+				if ( jQuery.css(this,"display") == "none" )
+					this.style.display = "block";
+			}).end();
+	},
+	
+	hide: function(speed,callback){
+		return speed ?
+			this.animate({
+				height: "hide", width: "hide", opacity: "hide"
+			}, speed, callback) :
+			
+			this.filter(":visible").each(function(){
+				this.oldblock = this.oldblock || jQuery.css(this,"display");
+				if ( this.oldblock == "none" )
+					this.oldblock = "block";
+				this.style.display = "none";
+			}).end();
+	},
+
+	// Save the old toggle function
+	_toggle: jQuery.fn.toggle,
+	
+	toggle: function( fn, fn2 ){
+		return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
+			this._toggle( fn, fn2 ) :
+			fn ?
+				this.animate({
+					height: "toggle", width: "toggle", opacity: "toggle"
+				}, fn, fn2) :
+				this.each(function(){
+					jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
+				});
+	},
+	
+	slideDown: function(speed,callback){
+		return this.animate({height: "show"}, speed, callback);
+	},
+	
+	slideUp: function(speed,callback){
+		return this.animate({height: "hide"}, speed, callback);
+	},
+
+	slideToggle: function(speed, callback){
+		return this.animate({height: "toggle"}, speed, callback);
+	},
+	
+	fadeIn: function(speed, callback){
+		return this.animate({opacity: "show"}, speed, callback);
+	},
+	
+	fadeOut: function(speed, callback){
+		return this.animate({opacity: "hide"}, speed, callback);
+	},
+	
+	fadeTo: function(speed,to,callback){
+		return this.animate({opacity: to}, speed, callback);
+	},
+	
+	animate: function( prop, speed, easing, callback ) {
+		var opt = jQuery.speed(speed, easing, callback);
+
+		return this[ opt.queue === false ? "each" : "queue" ](function(){
+			opt = jQuery.extend({}, opt);
+			var hidden = jQuery(this).is(":hidden"), self = this;
+			
+			for ( var p in prop ) {
+				if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
+					return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
+
+				if ( p == "height" || p == "width" ) {
+					// Store display property
+					opt.display = jQuery.css(this, "display");
+
+					// Make sure that nothing sneaks out
+					opt.overflow = this.style.overflow;
+				}
+			}
+
+			if ( opt.overflow != null )
+				this.style.overflow = "hidden";
+
+			opt.curAnim = jQuery.extend({}, prop);
+			
+			jQuery.each( prop, function(name, val){
+				var e = new jQuery.fx( self, opt, name );
+
+				if ( /toggle|show|hide/.test(val) )
+					e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
+				else {
+					var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
+						start = e.cur(true) || 0;
+
+					if ( parts ) {
+						var end = parseFloat(parts[2]),
+							unit = parts[3] || "px";
+
+						// We need to compute starting value
+						if ( unit != "px" ) {
+							self.style[ name ] = (end || 1) + unit;
+							start = ((end || 1) / e.cur(true)) * start;
+							self.style[ name ] = start + unit;
+						}
+
+						// If a +=/-= token was provided, we're doing a relative animation
+						if ( parts[1] )
+							end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
+
+						e.custom( start, end, unit );
+					} else
+						e.custom( start, val, "" );
+				}
+			});
+
+			// For JS strict compliance
+			return true;
+		});
+	},
+	
+	queue: function(type, fn){
+		if ( jQuery.isFunction(type) ) {
+			fn = type;
+			type = "fx";
+		}
+
+		if ( !type || (typeof type == "string" && !fn) )
+			return queue( this[0], type );
+
+		return this.each(function(){
+			if ( fn.constructor == Array )
+				queue(this, type, fn);
+			else {
+				queue(this, type).push( fn );
+			
+				if ( queue(this, type).length == 1 )
+					fn.apply(this);
+			}
+		});
+	},
+
+	stop: function(){
+		var timers = jQuery.timers;
+
+		return this.each(function(){
+			for ( var i = 0; i < timers.length; i++ )
+				if ( timers[i].elem == this )
+					timers.splice(i--, 1);
+		}).dequeue();
+	}
+
+});
+
+var queue = function( elem, type, array ) {
+	if ( !elem )
+		return;
+
+	var q = jQuery.data( elem, type + "queue" );
+
+	if ( !q || array )
+		q = jQuery.data( elem, type + "queue", 
+			array ? jQuery.makeArray(array) : [] );
+
+	return q;
+};
+
+jQuery.fn.dequeue = function(type){
+	type = type || "fx";
+
+	return this.each(function(){
+		var q = queue(this, type);
+
+		q.shift();
+
+		if ( q.length )
+			q[0].apply( this );
+	});
+};
+
+jQuery.extend({
+	
+	speed: function(speed, easing, fn) {
+		var opt = speed && speed.constructor == Object ? speed : {
+			complete: fn || !fn && easing || 
+				jQuery.isFunction( speed ) && speed,
+			duration: speed,
+			easing: fn && easing || easing && easing.constructor != Function && easing
+		};
+
+		opt.duration = (opt.duration && opt.duration.constructor == Number ? 
+			opt.duration : 
+			{ slow: 600, fast: 200 }[opt.duration]) || 400;
+	
+		// Queueing
+		opt.old = opt.complete;
+		opt.complete = function(){
+			jQuery(this).dequeue();
+			if ( jQuery.isFunction( opt.old ) )
+				opt.old.apply( this );
+		};
+	
+		return opt;
+	},
+	
+	easing: {
+		linear: function( p, n, firstNum, diff ) {
+			return firstNum + diff * p;
+		},
+		swing: function( p, n, firstNum, diff ) {
+			return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
+		}
+	},
+	
+	timers: [],
+
+	fx: function( elem, options, prop ){
+		this.options = options;
+		this.elem = elem;
+		this.prop = prop;
+
+		if ( !options.orig )
+			options.orig = {};
+	}
+
+});
+
+jQuery.fx.prototype = {
+
+	// Simple function for setting a style value
+	update: function(){
+		if ( this.options.step )
+			this.options.step.apply( this.elem, [ this.now, this ] );
+
+		(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
+
+		// Set display property to block for height/width animations
+		if ( this.prop == "height" || this.prop == "width" )
+			this.elem.style.display = "block";
+	},
+
+	// Get the current size
+	cur: function(force){
+		if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
+			return this.elem[ this.prop ];
+
+		var r = parseFloat(jQuery.curCSS(this.elem, this.prop, force));
+		return r && r > -10000 ? r : parseFloat(jQuery.css(this.elem, this.prop)) || 0;
+	},
+
+	// Start an animation from one number to another
+	custom: function(from, to, unit){
+		this.startTime = (new Date()).getTime();
+		this.start = from;
+		this.end = to;
+		this.unit = unit || this.unit || "px";
+		this.now = this.start;
+		this.pos = this.state = 0;
+		this.update();
+
+		var self = this;
+		function t(){
+			return self.step();
+		}
+
+		t.elem = this.elem;
+
+		jQuery.timers.push(t);
+
+		if ( jQuery.timers.length == 1 ) {
+			var timer = setInterval(function(){
+				var timers = jQuery.timers;
+				
+				for ( var i = 0; i < timers.length; i++ )
+					if ( !timers[i]() )
+						timers.splice(i--, 1);
+
+				if ( !timers.length )
+					clearInterval( timer );
+			}, 13);
+		}
+	},
+
+	// Simple 'show' function
+	show: function(){
+		// Remember where we started, so that we can go back to it later
+		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+		this.options.show = true;
+
+		// Begin the animation
+		this.custom(0, this.cur());
+
+		// Make sure that we start at a small width/height to avoid any
+		// flash of content
+		if ( this.prop == "width" || this.prop == "height" )
+			this.elem.style[this.prop] = "1px";
+		
+		// Start by showing the element
+		jQuery(this.elem).show();
+	},
+
+	// Simple 'hide' function
+	hide: function(){
+		// Remember where we started, so that we can go back to it later
+		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+		this.options.hide = true;
+
+		// Begin the animation
+		this.custom(this.cur(), 0);
+	},
+
+	// Each step of an animation
+	step: function(){
+		var t = (new Date()).getTime();
+
+		if ( t > this.options.duration + this.startTime ) {
+			this.now = this.end;
+			this.pos = this.state = 1;
+			this.update();
+
+			this.options.curAnim[ this.prop ] = true;
+
+			var done = true;
+			for ( var i in this.options.curAnim )
+				if ( this.options.curAnim[i] !== true )
+					done = false;
+
+			if ( done ) {
+				if ( this.options.display != null ) {
+					// Reset the overflow
+					this.elem.style.overflow = this.options.overflow;
+				
+					// Reset the display
+					this.elem.style.display = this.options.display;
+					if ( jQuery.css(this.elem, "display") == "none" )
+						this.elem.style.display = "block";
+				}
+
+				// Hide the element if the "hide" operation was done
+				if ( this.options.hide )
+					this.elem.style.display = "none";
+
+				// Reset the properties, if the item has been hidden or shown
+				if ( this.options.hide || this.options.show )
+					for ( var p in this.options.curAnim )
+						jQuery.attr(this.elem.style, p, this.options.orig[p]);
+			}
+
+			// If a callback was provided, execute it
+			if ( done && jQuery.isFunction( this.options.complete ) )
+				// Execute the complete function
+				this.options.complete.apply( this.elem );
+
+			return false;
+		} else {
+			var n = t - this.startTime;
+			this.state = n / this.options.duration;
+
+			// Perform the easing function, defaults to swing
+			this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
+			this.now = this.start + ((this.end - this.start) * this.pos);
+
+			// Perform the next step of the animation
+			this.update();
+		}
+
+		return true;
+	}
+
+};
+
+jQuery.fx.step = {
+	scrollLeft: function(fx){
+		fx.elem.scrollLeft = fx.now;
+	},
+
+	scrollTop: function(fx){
+		fx.elem.scrollTop = fx.now;
+	},
+
+	opacity: function(fx){
+		jQuery.attr(fx.elem.style, "opacity", fx.now);
+	},
+
+	_default: function(fx){
+		fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+	}
+};
+// The Offset Method
+// Originally By Brandon Aaron, part of the Dimension Plugin
+// http://jquery.com/plugins/project/dimensions
+jQuery.fn.offset = function() {
+	var left = 0, top = 0, elem = this[0], results;
+	
+	if ( elem ) with ( jQuery.browser ) {
+		var	absolute     = jQuery.css(elem, "position") == "absolute", 
+		    parent       = elem.parentNode, 
+		    offsetParent = elem.offsetParent, 
+		    doc          = elem.ownerDocument,
+		    safari2      = safari && parseInt(version) < 522;
+	
+		// Use getBoundingClientRect if available
+		if ( elem.getBoundingClientRect ) {
+			box = elem.getBoundingClientRect();
+		
+			// Add the document scroll offsets
+			add(
+				box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
+				box.top  + Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop)
+			);
+		
+			// IE adds the HTML element's border, by default it is medium which is 2px
+			// IE 6 and IE 7 quirks mode the border width is overwritable by the following css html { border: 0; }
+			// IE 7 standards mode, the border is always 2px
+			if ( msie ) {
+				var border = jQuery("html").css("borderWidth");
+				border = (border == "medium" || jQuery.boxModel && parseInt(version) >= 7) && 2 || border;
+				add( -border, -border );
+			}
+	
+		// Otherwise loop through the offsetParents and parentNodes
+		} else {
+		
+			// Initial element offsets
+			add( elem.offsetLeft, elem.offsetTop );
+		
+			// Get parent offsets
+			while ( offsetParent ) {
+				// Add offsetParent offsets
+				add( offsetParent.offsetLeft, offsetParent.offsetTop );
+			
+				// Mozilla and Safari > 2 does not include the border on offset parents
+				// However Mozilla adds the border for table cells
+				if ( mozilla && /^t[d|h]$/i.test(parent.tagName) || !safari2 )
+					border( offsetParent );
+				
+				// Safari <= 2 doubles body offsets with an absolutely positioned element or parent
+				if ( safari2 && !absolute && jQuery.css(offsetParent, "position") == "absolute" )
+					absolute = true;
+			
+				// Get next offsetParent
+				offsetParent = offsetParent.offsetParent;
+			}
+		
+			// Get parent scroll offsets
+			while ( parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
+				// Work around opera inline/table scrollLeft/Top bug
+				if ( !/^inline|table-row.*$/i.test(jQuery.css(parent, "display")) )
+					// Subtract parent scroll offsets
+					add( -parent.scrollLeft, -parent.scrollTop );
+			
+				// Mozilla does not add the border for a parent that has overflow != visible
+				if ( mozilla && jQuery.css(parent, "overflow") != "visible" )
+					border( parent );
+			
+				// Get next parent
+				parent = parent.parentNode;
+			}
+		
+			// Safari doubles body offsets with an absolutely positioned element or parent
+			if ( safari2 && absolute )
+				add( -doc.body.offsetLeft, -doc.body.offsetTop );
+		}
+
+		// Return an object with top and left properties
+		results = { top: top, left: left };
+	}
+
+	return results;
+
+	function border(elem) {
+		add( jQuery.css(elem, "borderLeftWidth"), jQuery.css(elem, "borderTopWidth") );
+	}
+
+	function add(l, t) {
+		left += parseInt(l) || 0;
+		top += parseInt(t) || 0;
+	}
+};
+})();

Added: jifty/branches/virtual-models/share/web/static/js/jquery_noconflict.js
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/share/web/static/js/jquery_noconflict.js	Thu Feb 14 14:59:21 2008
@@ -0,0 +1,4 @@
+/**
+ * noConflict.js - Tell jQuery not to clobber $()
+ */
+jQuery.noConflict();

Modified: jifty/branches/virtual-models/share/web/static/js/prototype.js
==============================================================================
--- jifty/branches/virtual-models/share/web/static/js/prototype.js	(original)
+++ jifty/branches/virtual-models/share/web/static/js/prototype.js	Thu Feb 14 14:59:21 2008
@@ -2210,7 +2210,11 @@
         if (position == 'top' || position == 'after') fragments.reverse();
         fragments.each(pos.insert.curry(element));
       }
-      else element.insertAdjacentHTML(pos.adjacency, content.stripScripts());
+      // Sartak: pos.adjacency may be undefined. IE6 gets very unhappy if you
+      // try to pass undef to insertAdjacentHTML
+      else if (pos.adjacency) {
+          element.insertAdjacentHTML(pos.adjacency, content.stripScripts());
+      }
 
       content.evalScripts.bind(content).defer();
     }
@@ -3480,9 +3484,16 @@
     if (!element.disabled && element.name) {
       var value = element.getValue();
       if (value != undefined) {
-        var pair = { };
-        pair[element.name] = value;
-        return Object.toQueryString(pair);
+        // XXX: Jifty: this used to be:
+        //     var pair = { };
+        //     pair[element.name] = value
+        //     return Object.toQueryString(pair)
+        // but that included the pair.extend function, which occurred
+        // a lot whenever we validated an action. since we're only encoding
+        // the key (element.name) and value, do what we actually mean
+        return encodeURIComponent(element.name)
+             + '='
+             + encodeURIComponent(value);
       }
     }
     return '';

Modified: jifty/branches/virtual-models/share/web/static/js/yui/calendar.js
==============================================================================
--- jifty/branches/virtual-models/share/web/static/js/yui/calendar.js	(original)
+++ jifty/branches/virtual-models/share/web/static/js/yui/calendar.js	Thu Feb 14 14:59:21 2008
@@ -6,477 +6,683 @@
 Copyright (c) 2007, Yahoo! Inc. All rights reserved.
 Code licensed under the BSD License:
 http://developer.yahoo.net/yui/license.txt
-version: 2.2.1
+version: 2.4.1
 */
-/**
-* Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.
-* @namespace YAHOO.util
-* @class Config
-* @constructor
-* @param {Object}	owner	The owner Object to which this Config Object belongs
-*/
-YAHOO.util.Config = function(owner) {
-	if (owner) {
-		this.init(owner);
-	}
-};
-
-/**
- * Constant representing the CustomEvent type for the config changed event.
- * @property YAHOO.util.Config.CONFIG_CHANGED_EVENT
- * @private
- * @static
- * @final
- */
-YAHOO.util.Config.CONFIG_CHANGED_EVENT = "configChanged";
-
-/**
- * Constant representing the boolean type string
- * @property YAHOO.util.Config.BOOLEAN_TYPE
- * @private
- * @static
- * @final
- */
-YAHOO.util.Config.BOOLEAN_TYPE = "boolean";
-
-YAHOO.util.Config.prototype = {
-	
-	/**
-	* Object reference to the owner of this Config Object
-	* @property owner
-	* @type Object
-	*/
-	owner : null,
-
-	/**
-	* Boolean flag that specifies whether a queue is currently being executed
-	* @property queueInProgress
-	* @type Boolean
-	*/
-	queueInProgress : false,
-
-	/**
-	* Maintains the local collection of configuration property objects and their specified values
-	* @property config
-	* @private
-	* @type Object
-	*/ 
-	config : null,
-
-	/**
-	* Maintains the local collection of configuration property objects as they were initially applied.
-	* This object is used when resetting a property.
-	* @property initialConfig
-	* @private
-	* @type Object
-	*/ 
-	initialConfig : null,
-
-	/**
-	* Maintains the local, normalized CustomEvent queue
-	* @property eventQueue
-	* @private
-	* @type Object
-	*/ 
-	eventQueue : null,
-
-	/**
-	* Custom Event, notifying subscribers when Config properties are set (setProperty is called without the silent flag
-	* @event configChangedEvent
-	*/
-	configChangedEvent : null,
-
-	/**
-	* Validates that the value passed in is a Boolean.
-	* @method checkBoolean
-	* @param	{Object}	val	The value to validate
-	* @return	{Boolean}	true, if the value is valid
-	*/	
-	checkBoolean: function(val) {
-		return (typeof val == YAHOO.util.Config.BOOLEAN_TYPE);
-	},
-
-	/**
-	* Validates that the value passed in is a number.
-	* @method checkNumber
-	* @param	{Object}	val	The value to validate
-	* @return	{Boolean}	true, if the value is valid
-	*/
-	checkNumber: function(val) {
-		return (!isNaN(val));
-	},
-
-	/**
-	* Fires a configuration property event using the specified value. 
-	* @method fireEvent
-	* @private
-	* @param {String}	key			The configuration property's name
-	* @param {value}	Object		The value of the correct type for the property
-	*/ 
-	fireEvent : function( key, value ) {
-		var property = this.config[key];
-
-		if (property && property.event) {
-			property.event.fire(value);
-		}	
-	},
-
-	/**
-	* Adds a property to the Config Object's private config hash.
-	* @method addProperty
-	* @param {String}	key	The configuration property's name
-	* @param {Object}	propertyObject	The Object containing all of this property's arguments
-	*/
-	addProperty : function( key, propertyObject ) {
-		key = key.toLowerCase();
-
-		this.config[key] = propertyObject;
-
-		propertyObject.event = new YAHOO.util.CustomEvent(key, this.owner);
-		propertyObject.key = key;
-
-		if (propertyObject.handler) {
-			propertyObject.event.subscribe(propertyObject.handler, this.owner);
-		}
-
-		this.setProperty(key, propertyObject.value, true);
-		
-		if (! propertyObject.suppressEvent) {
-			this.queueProperty(key, propertyObject.value);
-		}
-		
-	},
-
-	/**
-	* Returns a key-value configuration map of the values currently set in the Config Object.
-	* @method getConfig
-	* @return {Object} The current config, represented in a key-value map
-	*/
-	getConfig : function() {
-		var cfg = {};
-			
-		for (var prop in this.config) {
-			var property = this.config[prop];
-			if (property && property.event) {
-				cfg[prop] = property.value;
-			}
-		}
-		
-		return cfg;
-	},
-
-	/**
-	* Returns the value of specified property.
-	* @method getProperty
-	* @param {String} key	The name of the property
-	* @return {Object}		The value of the specified property
-	*/
-	getProperty : function(key) {
-		var property = this.config[key.toLowerCase()];
-		if (property && property.event) {
-			return property.value;
-		} else {
-			return undefined;
-		}
-	},
-
-	/**
-	* Resets the specified property's value to its initial value.
-	* @method resetProperty
-	* @param {String} key	The name of the property
-	* @return {Boolean} True is the property was reset, false if not
-	*/
-	resetProperty : function(key) {
-		key = key.toLowerCase();
-
-		var property = this.config[key];
-		if (property && property.event) {
-			if (this.initialConfig[key] && !YAHOO.lang.isUndefined(this.initialConfig[key]))	{
-				this.setProperty(key, this.initialConfig[key]);
-			}
-			return true;
-		} else {
-			return false;
-		}
-	},
-
-	/**
-	* Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.
-	* @method setProperty
-	* @param {String} key		The name of the property
-	* @param {String} value		The value to set the property to
-	* @param {Boolean} silent	Whether the value should be set silently, without firing the property event.
-	* @return {Boolean}			True, if the set was successful, false if it failed.
-	*/
-	setProperty : function(key, value, silent) {
-		key = key.toLowerCase();
-
-		if (this.queueInProgress && ! silent) {
-			this.queueProperty(key,value); // Currently running through a queue... 
-			return true;
-		} else {
-			var property = this.config[key];
-			if (property && property.event) {
-				if (property.validator && ! property.validator(value)) { // validator
-					return false;
-				} else {
-					property.value = value;
-					if (! silent) {
-						this.fireEvent(key, value);
-						this.configChangedEvent.fire([key, value]);
-					}
-					return true;
-				}
-			} else {
-				return false;
-			}
-		}
-	},
-
-	/**
-	* Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is
-	* moved from its current position to the end of the queue.
-	* @method queueProperty
-	* @param {String} key	The name of the property
-	* @param {String} value	The value to set the property to
-	* @return {Boolean}		true, if the set was successful, false if it failed.
-	*/	
-	queueProperty : function(key, value) {
-		key = key.toLowerCase();
-
-		var property = this.config[key];
-							
-		if (property && property.event) {
-			if (!YAHOO.lang.isUndefined(value) && property.validator && ! property.validator(value)) { // validator
-				return false;
-			} else {
-
-				if (!YAHOO.lang.isUndefined(value)) {
-					property.value = value;
-				} else {
-					value = property.value;
-				}
-
-				var foundDuplicate = false;
-				var iLen = this.eventQueue.length;
-				for (var i=0; i < iLen; i++) {
-					var queueItem = this.eventQueue[i];
-
-					if (queueItem) {
-						var queueItemKey = queueItem[0];
-						var queueItemValue = queueItem[1];
-						
-						if (queueItemKey == key) {
-							// found a dupe... push to end of queue, null current item, and break
-							this.eventQueue[i] = null;
-							this.eventQueue.push([key, (!YAHOO.lang.isUndefined(value) ? value : queueItemValue)]);
-							foundDuplicate = true;
-							break;
-						}
-					}
-				}
-				
-				if (! foundDuplicate && !YAHOO.lang.isUndefined(value)) { // this is a refire, or a new property in the queue
-					this.eventQueue.push([key, value]);
-				}
-			}
-
-			if (property.supercedes) {
-				var sLen = property.supercedes.length;
-				for (var s=0; s < sLen; s++) {
-					var supercedesCheck = property.supercedes[s];
-					var qLen = this.eventQueue.length;
-					for (var q=0; q < qLen; q++) {
-						var queueItemCheck = this.eventQueue[q];
-
-						if (queueItemCheck) {
-							var queueItemCheckKey = queueItemCheck[0];
-							var queueItemCheckValue = queueItemCheck[1];
-							
-							if ( queueItemCheckKey == supercedesCheck.toLowerCase() ) {
-								this.eventQueue.push([queueItemCheckKey, queueItemCheckValue]);
-								this.eventQueue[q] = null;
-								break;
-							}
-						}
-					}
-				}
-			}
-
-			return true;
-		} else {
-			return false;
-		}
-	},
+(function () {
 
-	/**
-	* Fires the event for a property using the property's current value.
-	* @method refireEvent
-	* @param {String} key	The name of the property
-	*/
-	refireEvent : function(key) {
-		key = key.toLowerCase();
-
-		var property = this.config[key];
-		if (property && property.event && !YAHOO.lang.isUndefined(property.value)) {
-			if (this.queueInProgress) {
-				this.queueProperty(key);
-			} else {
-				this.fireEvent(key, property.value);
-			}
-		}
-	},
+    /**
+    * Config is a utility used within an Object to allow the implementer to
+    * maintain a list of local configuration properties and listen for changes 
+    * to those properties dynamically using CustomEvent. The initial values are 
+    * also maintained so that the configuration can be reset at any given point 
+    * to its initial state.
+    * @namespace YAHOO.util
+    * @class Config
+    * @constructor
+    * @param {Object} owner The owner Object to which this Config Object belongs
+    */
+    YAHOO.util.Config = function (owner) {
 
-	/**
-	* Applies a key-value Object literal to the configuration, replacing any existing values, and queueing the property events.
-	* Although the values will be set, fireQueue() must be called for their associated events to execute.
-	* @method applyConfig
-	* @param {Object}	userConfig	The configuration Object literal
-	* @param {Boolean}	init		When set to true, the initialConfig will be set to the userConfig passed in, so that calling a reset will reset the properties to the passed values.
-	*/
-	applyConfig : function(userConfig, init) {
-		if (init) {
-			this.initialConfig = userConfig;
-		}
-		for (var prop in userConfig) {
-			this.queueProperty(prop, userConfig[prop]);
-		}
-	},
+        if (owner) {
+            this.init(owner);
+        }
 
-	/**
-	* Refires the events for all configuration properties using their current values.
-	* @method refresh
-	*/
-	refresh : function() {
-		for (var prop in this.config) {
-			this.refireEvent(prop);
-		}
-	},
 
-	/**
-	* Fires the normalized list of queued property change events
-	* @method fireQueue
-	*/
-	fireQueue : function() {
-		this.queueInProgress = true;
-		for (var i=0;i<this.eventQueue.length;i++) {
-			var queueItem = this.eventQueue[i];
-			if (queueItem) {
-				var key = queueItem[0];
-				var value = queueItem[1];
-				
-				var property = this.config[key];
-				property.value = value;
+    };
 
-				this.fireEvent(key,value);
-			}
-		}
-		
-		this.queueInProgress = false;
-		this.eventQueue = [];
-	},
 
-	/**
-	* Subscribes an external handler to the change event for any given property. 
-	* @method subscribeToConfigEvent
-	* @param {String}	key			The property name
-	* @param {Function}	handler		The handler function to use subscribe to the property's event
-	* @param {Object}	obj			The Object to use for scoping the event handler (see CustomEvent documentation)
-	* @param {Boolean}	override	Optional. If true, will override "this" within the handler to map to the scope Object passed into the method.
-	* @return {Boolean}				True, if the subscription was successful, otherwise false.
-	*/	
-	subscribeToConfigEvent : function(key, handler, obj, override) {
-		var property = this.config[key.toLowerCase()];
-		if (property && property.event) {
-			if (! YAHOO.util.Config.alreadySubscribed(property.event, handler, obj)) {
-				property.event.subscribe(handler, obj, override);
-			}
-			return true;
-		} else {
-			return false;
-		}
-	},
+    var Lang = YAHOO.lang,
+        CustomEvent = YAHOO.util.CustomEvent,
+        Config = YAHOO.util.Config;
 
-	/**
-	* Unsubscribes an external handler from the change event for any given property. 
-	* @method unsubscribeFromConfigEvent
-	* @param {String}	key			The property name
-	* @param {Function}	handler		The handler function to use subscribe to the property's event
-	* @param {Object}	obj			The Object to use for scoping the event handler (see CustomEvent documentation)
-	* @return {Boolean}				True, if the unsubscription was successful, otherwise false.
-	*/
-	unsubscribeFromConfigEvent : function(key, handler, obj) {
-		var property = this.config[key.toLowerCase()];
-		if (property && property.event) {
-			return property.event.unsubscribe(handler, obj);
-		} else {
-			return false;
-		}
-	},
 
-	/**
-	* Returns a string representation of the Config object
-	* @method toString
-	* @return {String}	The Config object in string format.
-	*/
-	toString : function() {
-		var output = "Config";
-		if (this.owner) {
-			output += " [" + this.owner.toString() + "]";
-		}
-		return output;
-	},
+    /**
+     * Constant representing the CustomEvent type for the config changed event.
+     * @property YAHOO.util.Config.CONFIG_CHANGED_EVENT
+     * @private
+     * @static
+     * @final
+     */
+    Config.CONFIG_CHANGED_EVENT = "configChanged";
+    
+    /**
+     * Constant representing the boolean type string
+     * @property YAHOO.util.Config.BOOLEAN_TYPE
+     * @private
+     * @static
+     * @final
+     */
+    Config.BOOLEAN_TYPE = "boolean";
+    
+    Config.prototype = {
+     
+        /**
+        * Object reference to the owner of this Config Object
+        * @property owner
+        * @type Object
+        */
+        owner: null,
+        
+        /**
+        * Boolean flag that specifies whether a queue is currently 
+        * being executed
+        * @property queueInProgress
+        * @type Boolean
+        */
+        queueInProgress: false,
+        
+        /**
+        * Maintains the local collection of configuration property objects and 
+        * their specified values
+        * @property config
+        * @private
+        * @type Object
+        */ 
+        config: null,
+        
+        /**
+        * Maintains the local collection of configuration property objects as 
+        * they were initially applied.
+        * This object is used when resetting a property.
+        * @property initialConfig
+        * @private
+        * @type Object
+        */ 
+        initialConfig: null,
+        
+        /**
+        * Maintains the local, normalized CustomEvent queue
+        * @property eventQueue
+        * @private
+        * @type Object
+        */ 
+        eventQueue: null,
+        
+        /**
+        * Custom Event, notifying subscribers when Config properties are set 
+        * (setProperty is called without the silent flag
+        * @event configChangedEvent
+        */
+        configChangedEvent: null,
+    
+        /**
+        * Initializes the configuration Object and all of its local members.
+        * @method init
+        * @param {Object} owner The owner Object to which this Config 
+        * Object belongs
+        */
+        init: function (owner) {
+    
+            this.owner = owner;
+    
+            this.configChangedEvent = 
+                this.createEvent(Config.CONFIG_CHANGED_EVENT);
+    
+            this.configChangedEvent.signature = CustomEvent.LIST;
+            this.queueInProgress = false;
+            this.config = {};
+            this.initialConfig = {};
+            this.eventQueue = [];
+        
+        },
+        
+        /**
+        * Validates that the value passed in is a Boolean.
+        * @method checkBoolean
+        * @param {Object} val The value to validate
+        * @return {Boolean} true, if the value is valid
+        */ 
+        checkBoolean: function (val) {
+            return (typeof val == Config.BOOLEAN_TYPE);
+        },
+        
+        /**
+        * Validates that the value passed in is a number.
+        * @method checkNumber
+        * @param {Object} val The value to validate
+        * @return {Boolean} true, if the value is valid
+        */
+        checkNumber: function (val) {
+            return (!isNaN(val));
+        },
+        
+        /**
+        * Fires a configuration property event using the specified value. 
+        * @method fireEvent
+        * @private
+        * @param {String} key The configuration property's name
+        * @param {value} Object The value of the correct type for the property
+        */ 
+        fireEvent: function ( key, value ) {
+            var property = this.config[key];
+        
+            if (property && property.event) {
+                property.event.fire(value);
+            } 
+        },
+        
+        /**
+        * Adds a property to the Config Object's private config hash.
+        * @method addProperty
+        * @param {String} key The configuration property's name
+        * @param {Object} propertyObject The Object containing all of this 
+        * property's arguments
+        */
+        addProperty: function ( key, propertyObject ) {
+            key = key.toLowerCase();
+        
+            this.config[key] = propertyObject;
+        
+            propertyObject.event = this.createEvent(key, { scope: this.owner });
+            propertyObject.event.signature = CustomEvent.LIST;
+            
+            
+            propertyObject.key = key;
+        
+            if (propertyObject.handler) {
+                propertyObject.event.subscribe(propertyObject.handler, 
+                    this.owner);
+            }
+        
+            this.setProperty(key, propertyObject.value, true);
+            
+            if (! propertyObject.suppressEvent) {
+                this.queueProperty(key, propertyObject.value);
+            }
+            
+        },
+        
+        /**
+        * Returns a key-value configuration map of the values currently set in  
+        * the Config Object.
+        * @method getConfig
+        * @return {Object} The current config, represented in a key-value map
+        */
+        getConfig: function () {
+        
+            var cfg = {},
+                prop,
+                property;
+                
+            for (prop in this.config) {
+                property = this.config[prop];
+                if (property && property.event) {
+                    cfg[prop] = property.value;
+                }
+            }
+            
+            return cfg;
+        },
+        
+        /**
+        * Returns the value of specified property.
+        * @method getProperty
+        * @param {String} key The name of the property
+        * @return {Object}  The value of the specified property
+        */
+        getProperty: function (key) {
+            var property = this.config[key.toLowerCase()];
+            if (property && property.event) {
+                return property.value;
+            } else {
+                return undefined;
+            }
+        },
+        
+        /**
+        * Resets the specified property's value to its initial value.
+        * @method resetProperty
+        * @param {String} key The name of the property
+        * @return {Boolean} True is the property was reset, false if not
+        */
+        resetProperty: function (key) {
+    
+            key = key.toLowerCase();
+        
+            var property = this.config[key];
+    
+            if (property && property.event) {
+    
+                if (this.initialConfig[key] && 
+                    !Lang.isUndefined(this.initialConfig[key])) {
+    
+                    this.setProperty(key, this.initialConfig[key]);
+
+                    return true;
+    
+                }
+    
+            } else {
+    
+                return false;
+            }
+    
+        },
+        
+        /**
+        * Sets the value of a property. If the silent property is passed as 
+        * true, the property's event will not be fired.
+        * @method setProperty
+        * @param {String} key The name of the property
+        * @param {String} value The value to set the property to
+        * @param {Boolean} silent Whether the value should be set silently, 
+        * without firing the property event.
+        * @return {Boolean} True, if the set was successful, false if it failed.
+        */
+        setProperty: function (key, value, silent) {
+        
+            var property;
+        
+            key = key.toLowerCase();
+        
+            if (this.queueInProgress && ! silent) {
+                // Currently running through a queue... 
+                this.queueProperty(key,value);
+                return true;
+    
+            } else {
+                property = this.config[key];
+                if (property && property.event) {
+                    if (property.validator && !property.validator(value)) {
+                        return false;
+                    } else {
+                        property.value = value;
+                        if (! silent) {
+                            this.fireEvent(key, value);
+                            this.configChangedEvent.fire([key, value]);
+                        }
+                        return true;
+                    }
+                } else {
+                    return false;
+                }
+            }
+        },
+        
+        /**
+        * Sets the value of a property and queues its event to execute. If the 
+        * event is already scheduled to execute, it is
+        * moved from its current position to the end of the queue.
+        * @method queueProperty
+        * @param {String} key The name of the property
+        * @param {String} value The value to set the property to
+        * @return {Boolean}  true, if the set was successful, false if 
+        * it failed.
+        */ 
+        queueProperty: function (key, value) {
+        
+            key = key.toLowerCase();
+        
+            var property = this.config[key],
+                foundDuplicate = false,
+                iLen,
+                queueItem,
+                queueItemKey,
+                queueItemValue,
+                sLen,
+                supercedesCheck,
+                qLen,
+                queueItemCheck,
+                queueItemCheckKey,
+                queueItemCheckValue,
+                i,
+                s,
+                q;
+                                
+            if (property && property.event) {
+    
+                if (!Lang.isUndefined(value) && property.validator && 
+                    !property.validator(value)) { // validator
+                    return false;
+                } else {
+        
+                    if (!Lang.isUndefined(value)) {
+                        property.value = value;
+                    } else {
+                        value = property.value;
+                    }
+        
+                    foundDuplicate = false;
+                    iLen = this.eventQueue.length;
+        
+                    for (i = 0; i < iLen; i++) {
+                        queueItem = this.eventQueue[i];
+        
+                        if (queueItem) {
+                            queueItemKey = queueItem[0];
+                            queueItemValue = queueItem[1];
+
+                            if (queueItemKey == key) {
+    
+                                /*
+                                    found a dupe... push to end of queue, null 
+                                    current item, and break
+                                */
+    
+                                this.eventQueue[i] = null;
+    
+                                this.eventQueue.push(
+                                    [key, (!Lang.isUndefined(value) ? 
+                                    value : queueItemValue)]);
+    
+                                foundDuplicate = true;
+                                break;
+                            }
+                        }
+                    }
+                    
+                    // this is a refire, or a new property in the queue
+    
+                    if (! foundDuplicate && !Lang.isUndefined(value)) { 
+                        this.eventQueue.push([key, value]);
+                    }
+                }
+        
+                if (property.supercedes) {
+
+                    sLen = property.supercedes.length;
+
+                    for (s = 0; s < sLen; s++) {
+
+                        supercedesCheck = property.supercedes[s];
+                        qLen = this.eventQueue.length;
+
+                        for (q = 0; q < qLen; q++) {
+                            queueItemCheck = this.eventQueue[q];
+
+                            if (queueItemCheck) {
+                                queueItemCheckKey = queueItemCheck[0];
+                                queueItemCheckValue = queueItemCheck[1];
+
+                                if (queueItemCheckKey == 
+                                    supercedesCheck.toLowerCase() ) {
+
+                                    this.eventQueue.push([queueItemCheckKey, 
+                                        queueItemCheckValue]);
+
+                                    this.eventQueue[q] = null;
+                                    break;
+
+                                }
+                            }
+                        }
+                    }
+                }
+
+
+                return true;
+            } else {
+                return false;
+            }
+        },
+        
+        /**
+        * Fires the event for a property using the property's current value.
+        * @method refireEvent
+        * @param {String} key The name of the property
+        */
+        refireEvent: function (key) {
+    
+            key = key.toLowerCase();
+        
+            var property = this.config[key];
+    
+            if (property && property.event && 
+    
+                !Lang.isUndefined(property.value)) {
+    
+                if (this.queueInProgress) {
+    
+                    this.queueProperty(key);
+    
+                } else {
+    
+                    this.fireEvent(key, property.value);
+    
+                }
+    
+            }
+        },
+        
+        /**
+        * Applies a key-value Object literal to the configuration, replacing  
+        * any existing values, and queueing the property events.
+        * Although the values will be set, fireQueue() must be called for their 
+        * associated events to execute.
+        * @method applyConfig
+        * @param {Object} userConfig The configuration Object literal
+        * @param {Boolean} init  When set to true, the initialConfig will 
+        * be set to the userConfig passed in, so that calling a reset will 
+        * reset the properties to the passed values.
+        */
+        applyConfig: function (userConfig, init) {
+        
+            var sKey,
+                oConfig;
+
+            if (init) {
+                oConfig = {};
+                for (sKey in userConfig) {
+                    if (Lang.hasOwnProperty(userConfig, sKey)) {
+                        oConfig[sKey.toLowerCase()] = userConfig[sKey];
+                    }
+                }
+                this.initialConfig = oConfig;
+            }
+
+            for (sKey in userConfig) {
+                if (Lang.hasOwnProperty(userConfig, sKey)) {
+                    this.queueProperty(sKey, userConfig[sKey]);
+                }
+            }
+        },
+        
+        /**
+        * Refires the events for all configuration properties using their 
+        * current values.
+        * @method refresh
+        */
+        refresh: function () {
+        
+            var prop;
+        
+            for (prop in this.config) {
+                this.refireEvent(prop);
+            }
+        },
+        
+        /**
+        * Fires the normalized list of queued property change events
+        * @method fireQueue
+        */
+        fireQueue: function () {
+        
+            var i, 
+                queueItem,
+                key,
+                value,
+                property;
+        
+            this.queueInProgress = true;
+            for (i = 0;i < this.eventQueue.length; i++) {
+                queueItem = this.eventQueue[i];
+                if (queueItem) {
+        
+                    key = queueItem[0];
+                    value = queueItem[1];
+                    property = this.config[key];
+        
+                    property.value = value;
+        
+                    this.fireEvent(key,value);
+                }
+            }
+            
+            this.queueInProgress = false;
+            this.eventQueue = [];
+        },
+        
+        /**
+        * Subscribes an external handler to the change event for any 
+        * given property. 
+        * @method subscribeToConfigEvent
+        * @param {String} key The property name
+        * @param {Function} handler The handler function to use subscribe to 
+        * the property's event
+        * @param {Object} obj The Object to use for scoping the event handler 
+        * (see CustomEvent documentation)
+        * @param {Boolean} override Optional. If true, will override "this"  
+        * within the handler to map to the scope Object passed into the method.
+        * @return {Boolean} True, if the subscription was successful, 
+        * otherwise false.
+        */ 
+        subscribeToConfigEvent: function (key, handler, obj, override) {
+    
+            var property = this.config[key.toLowerCase()];
+    
+            if (property && property.event) {
+                if (!Config.alreadySubscribed(property.event, handler, obj)) {
+                    property.event.subscribe(handler, obj, override);
+                }
+                return true;
+            } else {
+                return false;
+            }
+    
+        },
+        
+        /**
+        * Unsubscribes an external handler from the change event for any 
+        * given property. 
+        * @method unsubscribeFromConfigEvent
+        * @param {String} key The property name
+        * @param {Function} handler The handler function to use subscribe to 
+        * the property's event
+        * @param {Object} obj The Object to use for scoping the event 
+        * handler (see CustomEvent documentation)
+        * @return {Boolean} True, if the unsubscription was successful, 
+        * otherwise false.
+        */
+        unsubscribeFromConfigEvent: function (key, handler, obj) {
+            var property = this.config[key.toLowerCase()];
+            if (property && property.event) {
+                return property.event.unsubscribe(handler, obj);
+            } else {
+                return false;
+            }
+        },
+        
+        /**
+        * Returns a string representation of the Config object
+        * @method toString
+        * @return {String} The Config object in string format.
+        */
+        toString: function () {
+            var output = "Config";
+            if (this.owner) {
+                output += " [" + this.owner.toString() + "]";
+            }
+            return output;
+        },
+        
+        /**
+        * Returns a string representation of the Config object's current 
+        * CustomEvent queue
+        * @method outputEventQueue
+        * @return {String} The string list of CustomEvents currently queued 
+        * for execution
+        */
+        outputEventQueue: function () {
+
+            var output = "",
+                queueItem,
+                q,
+                nQueue = this.eventQueue.length;
+              
+            for (q = 0; q < nQueue; q++) {
+                queueItem = this.eventQueue[q];
+                if (queueItem) {
+                    output += queueItem[0] + "=" + queueItem[1] + ", ";
+                }
+            }
+            return output;
+        },
+
+        /**
+        * Sets all properties to null, unsubscribes all listeners from each 
+        * property's change event and all listeners from the configChangedEvent.
+        * @method destroy
+        */
+        destroy: function () {
+
+            var oConfig = this.config,
+                sProperty,
+                oProperty;
+
+
+            for (sProperty in oConfig) {
+            
+                if (Lang.hasOwnProperty(oConfig, sProperty)) {
+
+                    oProperty = oConfig[sProperty];
+
+                    oProperty.event.unsubscribeAll();
+                    oProperty.event = null;
+
+                }
+            
+            }
+            
+            this.configChangedEvent.unsubscribeAll();
+            
+            this.configChangedEvent = null;
+            this.owner = null;
+            this.config = null;
+            this.initialConfig = null;
+            this.eventQueue = null;
+        
+        }
+
+    };
+    
+    
+    
+    /**
+    * Checks to determine if a particular function/Object pair are already 
+    * subscribed to the specified CustomEvent
+    * @method YAHOO.util.Config.alreadySubscribed
+    * @static
+    * @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check 
+    * the subscriptions
+    * @param {Function} fn The function to look for in the subscribers list
+    * @param {Object} obj The execution scope Object for the subscription
+    * @return {Boolean} true, if the function/Object pair is already subscribed 
+    * to the CustomEvent passed in
+    */
+    Config.alreadySubscribed = function (evt, fn, obj) {
+    
+        var nSubscribers = evt.subscribers.length,
+            subsc,
+            i;
+
+        if (nSubscribers > 0) {
+            i = nSubscribers - 1;
+            do {
+                subsc = evt.subscribers[i];
+                if (subsc && subsc.obj == obj && subsc.fn == fn) {
+                    return true;
+                }
+            }
+            while (i--);
+        }
 
-	/**
-	* Returns a string representation of the Config object's current CustomEvent queue
-	* @method outputEventQueue
-	* @return {String}	The string list of CustomEvents currently queued for execution
-	*/
-	outputEventQueue : function() {
-		var output = "";
-		for (var q=0;q<this.eventQueue.length;q++) {
-			var queueItem = this.eventQueue[q];
-			if (queueItem) {
-				output += queueItem[0] + "=" + queueItem[1] + ", ";
-			}
-		}
-		return output;
-	}
-};
+        return false;
 
+    };
 
-/**
-* Initializes the configuration Object and all of its local members.
-* @method init
-* @param {Object}	owner	The owner Object to which this Config Object belongs
-*/
-YAHOO.util.Config.prototype.init = function(owner) {
-	this.owner = owner;
-	this.configChangedEvent = new YAHOO.util.CustomEvent(YAHOO.util.CONFIG_CHANGED_EVENT, this);
-	this.queueInProgress = false;
-	this.config = {};
-	this.initialConfig = {};
-	this.eventQueue = [];
-};
+    YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider);
 
-/**
-* Checks to determine if a particular function/Object pair are already subscribed to the specified CustomEvent
-* @method YAHOO.util.Config.alreadySubscribed
-* @static
-* @param {YAHOO.util.CustomEvent} evt	The CustomEvent for which to check the subscriptions
-* @param {Function}	fn	The function to look for in the subscribers list
-* @param {Object}	obj	The execution scope Object for the subscription
-* @return {Boolean}	true, if the function/Object pair is already subscribed to the CustomEvent passed in
-*/
-YAHOO.util.Config.alreadySubscribed = function(evt, fn, obj) {
-	for (var e=0;e<evt.subscribers.length;e++) {
-		var subsc = evt.subscribers[e];
-		if (subsc && subsc.obj == obj && subsc.fn == fn) {
-			return true;
-		}
-	}
-	return false;
-};
+}());
 
 /**
 * YAHOO.widget.DateMath is used for simple date manipulation. The class is a static utility
@@ -641,7 +847,7 @@
 	* @return {Date}	January 1 of the calendar year specified.
 	*/
 	getJan1 : function(calendarYear) {
-		return new Date(calendarYear,0,1); 
+		return this.getDate(calendarYear,0,1);
 	},
 
 	/**
@@ -671,14 +877,13 @@
 	* @param {Date}	date	The JavaScript date for which to find the week number
 	* @param {Number} calendarYear	OPTIONAL - The calendar year to use for determining the week number. Default is
 	*											the calendar year of parameter "date".
-	* @param {Number} weekStartsOn	OPTIONAL - The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).
 	* @return {Number}	The week number of the given date.
 	*/
 	getWeekNumber : function(date, calendarYear) {
 		date = this.clearTime(date);
 		var nearestThurs = new Date(date.getTime() + (4 * this.ONE_DAY_MS) - ((date.getDay()) * this.ONE_DAY_MS));
 
-		var jan1 = new Date(nearestThurs.getFullYear(),0,1);
+		var jan1 = this.getDate(nearestThurs.getFullYear(),0,1);
 		var dayOfYear = ((nearestThurs.getTime() - jan1.getTime()) / this.ONE_DAY_MS) - 1;
 
 		var weekNum = Math.ceil((dayOfYear)/ 7);
@@ -722,7 +927,7 @@
 	* @return {Date}		The JavaScript Date representing the first day of the month
 	*/
 	findMonthStart : function(date) {
-		var start = new Date(date.getFullYear(), date.getMonth(), 1);
+		var start = this.getDate(date.getFullYear(), date.getMonth(), 1);
 		return start;
 	},
 
@@ -748,14 +953,46 @@
 	clearTime : function(date) {
 		date.setHours(12,0,0,0);
 		return date;
+	},
+
+	/**
+	 * Returns a new JavaScript Date object, representing the given year, month and date. Time fields (hr, min, sec, ms) on the new Date object
+	 * are set to 0. The method allows Date instances to be created with the a year less than 100. "new Date(year, month, date)" implementations 
+	 * set the year to 19xx if a year (xx) which is less than 100 is provided.
+	 * <p>
+	 * <em>NOTE:</em>Validation on argument values is not performed. It is the caller's responsibility to ensure
+	 * arguments are valid as per the ECMAScript-262 Date object specification for the new Date(year, month[, date]) constructor.
+	 * </p>
+	 * @method getDate
+	 * @param {Number} y Year.
+	 * @param {Number} m Month index from 0 (Jan) to 11 (Dec).
+	 * @param {Number} d (optional) Date from 1 to 31. If not provided, defaults to 1.
+	 * @return {Date} The JavaScript date object with year, month, date set as provided.
+	 */
+	getDate : function(y, m, d) {
+		var dt = null;
+		if (YAHOO.lang.isUndefined(d)) {
+			d = 1;
+		}
+		if (y >= 100) {
+			dt = new Date(y, m, d);
+		} else {
+			dt = new Date();
+			dt.setFullYear(y);
+			dt.setMonth(m);
+			dt.setDate(d);
+			dt.setHours(0,0,0,0);
+		}
+		return dt;
 	}
 };
 
 /**
-* The Calendar component is a UI control that enables users to choose one or more dates from a graphical calendar presented in a one-month ("one-up") or two-month ("two-up") interface. Calendars are generated entirely via script and can be navigated without any page refreshes.
+* The Calendar component is a UI control that enables users to choose one or more dates from a graphical calendar presented in a one-month or
+* multi-month interface. Calendars are generated entirely via script and can be navigated without any page refreshes.
 * @module    calendar
-* @title     Calendar
-* @namespace YAHOO.widget
+* @title    Calendar
+* @namespace  YAHOO.widget
 * @requires  yahoo,dom,event
 */
 
@@ -767,19 +1004,39 @@
 * <p>To construct the placeholder for the calendar widget, the code is as
 * follows:
 *	<xmp>
-*		<div id="cal1Container"></div>
+*		<div id="calContainer"></div>
+*	</xmp>
+* </p>
+* <p>
+* <strong>NOTE: As of 2.4.0, the constructor's ID argument is optional.</strong>
+* The Calendar can be constructed by simply providing a container ID string, 
+* or a reference to a container DIV HTMLElement (the element needs to exist 
+* in the document).
+* 
+* E.g.:
+*	<xmp>
+*		var c = new YAHOO.widget.Calendar("calContainer", configOptions);
 *	</xmp>
-* Note that the table can be replaced with any kind of element.
+* or:
+*   <xmp>
+*       var containerDiv = YAHOO.util.Dom.get("calContainer");
+*		var c = new YAHOO.widget.Calendar(containerDiv, configOptions);
+*	</xmp>
+* </p>
+* <p>
+* If not provided, the ID will be generated from the container DIV ID by adding an "_t" suffix.
+* For example if an ID is not provided, and the container's ID is "calContainer", the Calendar's ID will be set to "calContainer_t".
 * </p>
+* 
 * @namespace YAHOO.widget
 * @class Calendar
 * @constructor
-* @param {String}	id			The id of the table element that will represent the calendar widget
-* @param {String}	containerId	The id of the container div element that will wrap the calendar table
-* @param {Object}	config		The configuration object containing the Calendar's arguments
+* @param {String} id optional The id of the table element that will represent the Calendar widget. As of 2.4.0, this argument is optional.
+* @param {String | HTMLElement} container The id of the container div element that will wrap the Calendar table, or a reference to a DIV element which exists in the document.
+* @param {Object} config optional The configuration object containing the initial configuration values for the Calendar.
 */
 YAHOO.widget.Calendar = function(id, containerId, config) {
-	this.init(id, containerId, config);
+	this.init.apply(this, arguments);
 };
 
 /**
@@ -899,23 +1156,24 @@
 * @type Object
 */
 YAHOO.widget.Calendar._DEFAULT_CONFIG = {
-	PAGEDATE : {key:"pagedate", value:new Date()},
-	SELECTED : {key:"selected", value:[]},
+	// Default values for pagedate and selected are not class level constants - they are set during instance creation 
+	PAGEDATE : {key:"pagedate", value:null},
+	SELECTED : {key:"selected", value:null},
 	TITLE : {key:"title", value:""},
 	CLOSE : {key:"close", value:false},
-	IFRAME : {key:"iframe", value:true},
+	IFRAME : {key:"iframe", value:(YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) ? true : false},
 	MINDATE : {key:"mindate", value:null},
 	MAXDATE : {key:"maxdate", value:null},
-	MULTI_SELECT : {key:"multi_select",	value:false},
-	OOM_SELECT : {key:"oom_select",	value:false},
+	MULTI_SELECT : {key:"multi_select", value:false},
 	START_WEEKDAY : {key:"start_weekday", value:0},
 	SHOW_WEEKDAYS : {key:"show_weekdays", value:true},
 	SHOW_WEEK_HEADER : {key:"show_week_header", value:false},
 	SHOW_WEEK_FOOTER : {key:"show_week_footer", value:false},
 	HIDE_BLANK_WEEKS : {key:"hide_blank_weeks", value:false},
+	OUT_OF_MONTH_SELECT : {key:"out_of_month_select", value:false},
 	NAV_ARROW_LEFT: {key:"nav_arrow_left", value:null} ,
 	NAV_ARROW_RIGHT : {key:"nav_arrow_right", value:null} ,
-	MONTHS_SHORT : {key:"months_short",	value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]},
+	MONTHS_SHORT : {key:"months_short", value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]},
 	MONTHS_LONG: {key:"months_long", value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]},
 	WEEKDAYS_1CHAR: {key:"weekdays_1char", value:["S", "M", "T", "W", "T", "F", "S"]},
 	WEEKDAYS_SHORT: {key:"weekdays_short", value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]},
@@ -932,7 +1190,12 @@
 	MD_DAY_POSITION:{key:"md_day_position", value:2},
 	MDY_MONTH_POSITION:{key:"mdy_month_position", value:1},
 	MDY_DAY_POSITION:{key:"mdy_day_position", value:2},
-	MDY_YEAR_POSITION:{key:"mdy_year_position", value:3}
+	MDY_YEAR_POSITION:{key:"mdy_year_position", value:3},
+	MY_LABEL_MONTH_POSITION:{key:"my_label_month_position", value:1},
+	MY_LABEL_YEAR_POSITION:{key:"my_label_year_position", value:2},
+	MY_LABEL_MONTH_SUFFIX:{key:"my_label_month_suffix", value:" "},
+	MY_LABEL_YEAR_SUFFIX:{key:"my_label_year_suffix", value:""},
+	NAV: {key:"navigator", value: null}
 };
 
 /**
@@ -952,11 +1215,21 @@
 	BEFORE_RENDER : "beforeRender",
 	RENDER : "render",
 	RESET : "reset",
-	CLEAR : "clear"
+	CLEAR : "clear",
+	BEFORE_HIDE : "beforeHide",
+	HIDE : "hide",
+	BEFORE_SHOW : "beforeShow",
+	SHOW : "show",
+	BEFORE_HIDE_NAV : "beforeHideNav",
+	HIDE_NAV : "hideNav",
+	BEFORE_SHOW_NAV : "beforeShowNav",
+	SHOW_NAV : "showNav",
+	BEFORE_RENDER_NAV : "beforeRenderNav",
+	RENDER_NAV : "renderNav"
 };
 
 /**
-* Collection of Default Style constants for the Calendar
+* The set of default style constants for the Calendar
 * @property YAHOO.widget.Calendar._STYLES
 * @final
 * @static
@@ -985,6 +1258,7 @@
 	CSS_CONTAINER : "yui-calcontainer",
 	CSS_NAV_LEFT : "calnavleft",
 	CSS_NAV_RIGHT : "calnavright",
+	CSS_NAV : "calnav",
 	CSS_CLOSE : "calclose",
 	CSS_CELL_TOP : "calcelltop",
 	CSS_CELL_LEFT : "calcellleft",
@@ -1028,7 +1302,7 @@
 	* @type HTMLTableCellElement[]
 	*/
 	cells : null,
-	
+
 	/**
 	* The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays in the format of [YYYY, M, D].
 	* @property cellDates
@@ -1037,13 +1311,20 @@
 	cellDates : null,
 
 	/**
-	* The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.
+	* The id that uniquely identifies this Calendar.
 	* @property id
 	* @type String
 	*/
 	id : null,
 
 	/**
+	* The unique id associated with the Calendar's container
+	* @property containerId
+	* @type String
+	*/
+	containerId: null,
+
+	/**
 	* The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.
 	* @property oDomContainer
 	* @type HTMLElement
@@ -1073,6 +1354,14 @@
 	_renderStack : null,
 
 	/**
+	* A reference to the CalendarNavigator instance created for this Calendar.
+	* Will be null if the "navigator" configuration property has not been set
+	* @property oNavigator
+	* @type CalendarNavigator
+	*/
+	oNavigator : null,
+
+	/**
 	* The private list of initially selected dates.
 	* @property _selectedDates
 	* @private
@@ -1085,2348 +1374,2861 @@
 	* @property domEventMap
 	* @type Object
 	*/
-	domEventMap : null
-};
-
-
-
-/**
-* Initializes the Calendar widget.
-* @method init
-* @param {String}	id			The id of the table element that will represent the calendar widget
-* @param {String}	containerId	The id of the container div element that will wrap the calendar table
-* @param {Object}	config		The configuration object containing the Calendar's arguments
-*/
-YAHOO.widget.Calendar.prototype.init = function(id, containerId, config) {
-	this.initEvents();
-	this.today = new Date();
-	YAHOO.widget.DateMath.clearTime(this.today);
+	domEventMap : null,
 
-	this.id = id;
-	this.oDomContainer = document.getElementById(containerId);
-
-	/**
-	* The Config object used to hold the configuration variables for the Calendar
-	* @property cfg
-	* @type YAHOO.util.Config
-	*/
-	this.cfg = new YAHOO.util.Config(this);
-	
 	/**
-	* The local object which contains the Calendar's options
-	* @property Options
-	* @type Object
-	*/
-	this.Options = {};
+	 * Protected helper used to parse Calendar constructor/init arguments.
+	 *
+	 * As of 2.4.0, Calendar supports a simpler constructor 
+	 * signature. This method reconciles arguments
+	 * received in the pre 2.4.0 and 2.4.0 formats.
+	 * 
+	 * @protected
+	 * @method _parseArgs
+	 * @param {Array} Function "arguments" array
+	 * @return {Object} Object with id, container, config properties containing
+	 * the reconciled argument values.
+	 **/
+	_parseArgs : function(args) {
+		/*
+		   2.4.0 Constructors signatures
+
+		   new Calendar(String)
+		   new Calendar(HTMLElement)
+		   new Calendar(String, ConfigObject)
+		   new Calendar(HTMLElement, ConfigObject)
+
+		   Pre 2.4.0 Constructor signatures
+
+		   new Calendar(String, String)
+		   new Calendar(String, HTMLElement)
+		   new Calendar(String, String, ConfigObject)
+		   new Calendar(String, HTMLElement, ConfigObject)
+		 */
+		var nArgs = {id:null, container:null, config:null};
+
+		if (args && args.length && args.length > 0) {
+			switch (args.length) {
+				case 1:
+					nArgs.id = null;
+					nArgs.container = args[0];
+					nArgs.config = null;
+					break;
+				case 2:
+					if (YAHOO.lang.isObject(args[1]) && !args[1].tagName && !(args[1] instanceof String)) {
+						nArgs.id = null;
+						nArgs.container = args[0];
+						nArgs.config = args[1];
+					} else {
+						nArgs.id = args[0];
+						nArgs.container = args[1];
+						nArgs.config = null;
+					}
+					break;
+				default: // 3+
+					nArgs.id = args[0];
+					nArgs.container = args[1];
+					nArgs.config = args[2];
+					break;
+			}
+		} else {
+		}
+		return nArgs;
+	},
 
 	/**
-	* The local object which contains the Calendar's locale settings
-	* @property Locale
-	* @type Object
+	* Initializes the Calendar widget.
+	* @method init
+	*
+	* @param {String} id optional The id of the table element that will represent the Calendar widget. As of 2.4.0, this argument is optional.
+	* @param {String | HTMLElement} container The id of the container div element that will wrap the Calendar table, or a reference to a DIV element which exists in the document.
+	* @param {Object} config optional The configuration object containing the initial configuration values for the Calendar.
 	*/
-	this.Locale = {};
+	init : function(id, container, config) {
+		// Normalize 2.4.0, pre 2.4.0 args
+		var nArgs = this._parseArgs(arguments);
 
-	this.initStyles();
+		id = nArgs.id;
+		container = nArgs.container;
+		config = nArgs.config;
 
-	YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);	
-	YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);
+		this.oDomContainer = YAHOO.util.Dom.get(container);
 
-	this.cellDates = [];
-	this.cells = [];
-	this.renderStack = [];
-	this._renderStack = [];
+		if (!this.oDomContainer.id) {
+			this.oDomContainer.id = YAHOO.util.Dom.generateId();
+		}
+		if (!id) {
+			id = this.oDomContainer.id + "_t";
+		}
 
-	this.setupConfig();
-	
-	if (config) {
-		this.cfg.applyConfig(config, true);
-	}
-	
-	this.cfg.fireQueue();
-};
+		this.id = id;
+		this.containerId = this.oDomContainer.id;
 
-/**
-* Renders the built-in IFRAME shim for the IE6 and below
-* @method configIframe
-*/
-YAHOO.widget.Calendar.prototype.configIframe = function(type, args, obj) {
-	var useIframe = args[0];
+		this.initEvents();
 
-	if (!this.parent) {
-		if (YAHOO.util.Dom.inDocument(this.oDomContainer)) {
-			if (useIframe) {
-				var pos = YAHOO.util.Dom.getStyle(this.oDomContainer, "position");
-
-				if (this.browser == "ie" && (pos == "absolute" || pos == "relative")) {
-					if (! YAHOO.util.Dom.inDocument(this.iframe)) {
-						this.iframe = document.createElement("iframe");
-						this.iframe.src = "javascript:false;";
-						YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");
-						this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);
-					}
-				}
-			} else {
-				if (this.iframe) {
-					if (this.iframe.parentNode) {
-						this.iframe.parentNode.removeChild(this.iframe);
-					}
-					this.iframe = null;
-				}
-			}
-		}
-	}
-};
+		this.today = new Date();
+		YAHOO.widget.DateMath.clearTime(this.today);
 
-/**
-* Default handler for the "title" property
-* @method configTitle
-*/
-YAHOO.widget.Calendar.prototype.configTitle = function(type, args, obj) {
-	var title = args[0];
-	var close = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.CLOSE.key);
-	
-	var titleDiv;
-
-	if (title && title !== "") {
-		titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");
-		titleDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;
-		titleDiv.innerHTML = title;
-		this.oDomContainer.insertBefore(titleDiv, this.oDomContainer.firstChild);
-		YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
-	} else {
-		titleDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
+		/**
+		* The Config object used to hold the configuration variables for the Calendar
+		* @property cfg
+		* @type YAHOO.util.Config
+		*/
+		this.cfg = new YAHOO.util.Config(this);
 
-		if (titleDiv) {
-			YAHOO.util.Event.purgeElement(titleDiv);
-			this.oDomContainer.removeChild(titleDiv);
-		}
-		if (! close) {
-			YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
-		}
-	}
-};
+		/**
+		* The local object which contains the Calendar's options
+		* @property Options
+		* @type Object
+		*/
+		this.Options = {};
 
-/**
-* Default handler for the "close" property
-* @method configClose
-*/
-YAHOO.widget.Calendar.prototype.configClose = function(type, args, obj) {
-	var close = args[0];
-	var title = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.TITLE.key);
-	
-	var DEPR_CLOSE_PATH = "us/my/bn/x_d.gif";
-
-	var linkClose;
-
-	if (close === true) {
-		linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || document.createElement("a");
-		linkClose.href = "#";
-		linkClose.className = "link-close";
-		YAHOO.util.Event.addListener(linkClose, "click", function(e, cal) {cal.hide(); YAHOO.util.Event.preventDefault(e); }, this);
-		
-		if (YAHOO.widget.Calendar.IMG_ROOT !== null) {
-			var imgClose = document.createElement("img");
-			imgClose.src = YAHOO.widget.Calendar.IMG_ROOT + DEPR_CLOSE_PATH;
-			imgClose.className = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE;
-			linkClose.appendChild(imgClose);
-		} else {
-			linkClose.innerHTML = '<span class="' + YAHOO.widget.CalendarGroup.CSS_2UPCLOSE + ' ' + this.Style.CSS_CLOSE + '"></span>';
-		}
-		
-		this.oDomContainer.appendChild(linkClose);
-		YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
-	} else {
-		linkClose = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || null;
-		if (linkClose) {
-			YAHOO.util.Event.purgeElement(linkClose);
-			this.oDomContainer.removeChild(linkClose);
-		}
-		if (! title || title === "") {
-			YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
-		}
-	}
-};
+		/**
+		* The local object which contains the Calendar's locale settings
+		* @property Locale
+		* @type Object
+		*/
+		this.Locale = {};
 
-/**
-* Initializes Calendar's built-in CustomEvents
-* @method initEvents
-*/
-YAHOO.widget.Calendar.prototype.initEvents = function() {
+		this.initStyles();
 
-	var defEvents = YAHOO.widget.Calendar._EVENT_TYPES;
+		YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);
+		YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);
 
-	/**
-	* Fired before a selection is made
-	* @event beforeSelectEvent
-	*/
-	this.beforeSelectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT); 
+		this.cellDates = [];
+		this.cells = [];
+		this.renderStack = [];
+		this._renderStack = [];
 
-	/**
-	* Fired when a selection is made
-	* @event selectEvent
-	* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
-	*/
-	this.selectEvent = new YAHOO.util.CustomEvent(defEvents.SELECT);
+		this.setupConfig();
 
-	/**
-	* Fired before a selection is made
-	* @event beforeDeselectEvent
-	*/
-	this.beforeDeselectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT);
+		if (config) {
+			this.cfg.applyConfig(config, true);
+		}
 
-	/**
-	* Fired when a selection is made
-	* @event deselectEvent
-	* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
-	*/
-	this.deselectEvent = new YAHOO.util.CustomEvent(defEvents.DESELECT);
+		this.cfg.fireQueue();
+	},
 
 	/**
-	* Fired when the Calendar page is changed
-	* @event changePageEvent
-	*/
-	this.changePageEvent = new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE);
+	* Default Config listener for the iframe property. If the iframe config property is set to true, 
+	* renders the built-in IFRAME shim if the container is relatively or absolutely positioned.
+	* 
+	* @method configIframe
+	*/
+	configIframe : function(type, args, obj) {
+		var useIframe = args[0];
+	
+		if (!this.parent) {
+			if (YAHOO.util.Dom.inDocument(this.oDomContainer)) {
+				if (useIframe) {
+					var pos = YAHOO.util.Dom.getStyle(this.oDomContainer, "position");
+					
+					if (pos == "absolute" || pos == "relative") {
+						
+						if (!YAHOO.util.Dom.inDocument(this.iframe)) {
+							this.iframe = document.createElement("iframe");
+							this.iframe.src = "javascript:false;";
+	
+							YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");
+	
+							if (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) {
+								YAHOO.util.Dom.addClass(this.iframe, "fixedsize");
+							}
+	
+							this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);
+						}
+					}
+				} else {
+					if (this.iframe) {
+						if (this.iframe.parentNode) {
+							this.iframe.parentNode.removeChild(this.iframe);
+						}
+						this.iframe = null;
+					}
+				}
+			}
+		}
+	},
 
 	/**
-	* Fired before the Calendar is rendered
-	* @event beforeRenderEvent
+	* Default handler for the "title" property
+	* @method configTitle
 	*/
-	this.beforeRenderEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);
+	configTitle : function(type, args, obj) {
+		var title = args[0];
 
+		// "" disables title bar
+		if (title) {
+			this.createTitleBar(title);
+		} else {
+			var close = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.CLOSE.key);
+			if (!close) {
+				this.removeTitleBar();
+			} else {
+				this.createTitleBar("&#160;");
+			}
+		}
+	},
+	
 	/**
-	* Fired when the Calendar is rendered
-	* @event renderEvent
+	* Default handler for the "close" property
+	* @method configClose
 	*/
-	this.renderEvent = new YAHOO.util.CustomEvent(defEvents.RENDER);
-
+	configClose : function(type, args, obj) {
+		var close = args[0],
+			title = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.TITLE.key);
+	
+		if (close) {
+			if (!title) {
+				this.createTitleBar("&#160;");
+			}
+			this.createCloseButton();
+		} else {
+			this.removeCloseButton();
+			if (!title) {
+				this.removeTitleBar();
+			}
+		}
+	},
+	
 	/**
-	* Fired when the Calendar is reset
-	* @event resetEvent
+	* Initializes Calendar's built-in CustomEvents
+	* @method initEvents
 	*/
-	this.resetEvent = new YAHOO.util.CustomEvent(defEvents.RESET);
+	initEvents : function() {
+	
+		var defEvents = YAHOO.widget.Calendar._EVENT_TYPES;
+	
+		/**
+		* Fired before a selection is made
+		* @event beforeSelectEvent
+		*/
+		this.beforeSelectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT); 
+	
+		/**
+		* Fired when a selection is made
+		* @event selectEvent
+		* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
+		*/
+		this.selectEvent = new YAHOO.util.CustomEvent(defEvents.SELECT);
+	
+		/**
+		* Fired before a selection is made
+		* @event beforeDeselectEvent
+		*/
+		this.beforeDeselectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT);
+	
+		/**
+		* Fired when a selection is made
+		* @event deselectEvent
+		* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
+		*/
+		this.deselectEvent = new YAHOO.util.CustomEvent(defEvents.DESELECT);
+	
+		/**
+		* Fired when the Calendar page is changed
+		* @event changePageEvent
+		*/
+		this.changePageEvent = new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE);
+	
+		/**
+		* Fired before the Calendar is rendered
+		* @event beforeRenderEvent
+		*/
+		this.beforeRenderEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);
+	
+		/**
+		* Fired when the Calendar is rendered
+		* @event renderEvent
+		*/
+		this.renderEvent = new YAHOO.util.CustomEvent(defEvents.RENDER);
+	
+		/**
+		* Fired when the Calendar is reset
+		* @event resetEvent
+		*/
+		this.resetEvent = new YAHOO.util.CustomEvent(defEvents.RESET);
+	
+		/**
+		* Fired when the Calendar is cleared
+		* @event clearEvent
+		*/
+		this.clearEvent = new YAHOO.util.CustomEvent(defEvents.CLEAR);
+	
+		/**
+		* Fired just before the Calendar is to be shown
+		* @event beforeShowEvent
+		*/
+		this.beforeShowEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SHOW);
+	
+		/**
+		* Fired after the Calendar is shown
+		* @event showEvent
+		*/
+		this.showEvent = new YAHOO.util.CustomEvent(defEvents.SHOW);
+	
+		/**
+		* Fired just before the Calendar is to be hidden
+		* @event beforeHideEvent
+		*/
+		this.beforeHideEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_HIDE);
+	
+		/**
+		* Fired after the Calendar is hidden
+		* @event hideEvent
+		*/
+		this.hideEvent = new YAHOO.util.CustomEvent(defEvents.HIDE);
 
-	/**
-	* Fired when the Calendar is cleared
-	* @event clearEvent
-	*/
-	this.clearEvent = new YAHOO.util.CustomEvent(defEvents.CLEAR);
+		/**
+		* Fired just before the CalendarNavigator is to be shown
+		* @event beforeShowNavEvent
+		*/
+		this.beforeShowNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SHOW_NAV);
+	
+		/**
+		* Fired after the CalendarNavigator is shown
+		* @event showNavEvent
+		*/
+		this.showNavEvent = new YAHOO.util.CustomEvent(defEvents.SHOW_NAV);
+	
+		/**
+		* Fired just before the CalendarNavigator is to be hidden
+		* @event beforeHideNavEvent
+		*/
+		this.beforeHideNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_HIDE_NAV);
+	
+		/**
+		* Fired after the CalendarNavigator is hidden
+		* @event hideNavEvent
+		*/
+		this.hideNavEvent = new YAHOO.util.CustomEvent(defEvents.HIDE_NAV);
 
-	this.beforeSelectEvent.subscribe(this.onBeforeSelect, this, true);
-	this.selectEvent.subscribe(this.onSelect, this, true);
-	this.beforeDeselectEvent.subscribe(this.onBeforeDeselect, this, true);
-	this.deselectEvent.subscribe(this.onDeselect, this, true);
-	this.changePageEvent.subscribe(this.onChangePage, this, true);
-	this.renderEvent.subscribe(this.onRender, this, true);
-	this.resetEvent.subscribe(this.onReset, this, true);
-	this.clearEvent.subscribe(this.onClear, this, true);
-};
+		/**
+		* Fired just before the CalendarNavigator is to be rendered
+		* @event beforeRenderNavEvent
+		*/
+		this.beforeRenderNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER_NAV);
 
-/**
-* The default event function that is attached to a date link within a calendar cell
-* when the calendar is rendered.
-* @method doSelectCell
-* @param {DOMEvent} e	The event
-* @param {Calendar} cal	A reference to the calendar passed by the Event utility
-*/
-YAHOO.widget.Calendar.prototype.doSelectCell = function(e, cal) {
-	var cell,index,d,date;
+		/**
+		* Fired after the CalendarNavigator is rendered
+		* @event renderNavEvent
+		*/
+		this.renderNavEvent = new YAHOO.util.CustomEvent(defEvents.RENDER_NAV);
+
+		this.beforeSelectEvent.subscribe(this.onBeforeSelect, this, true);
+		this.selectEvent.subscribe(this.onSelect, this, true);
+		this.beforeDeselectEvent.subscribe(this.onBeforeDeselect, this, true);
+		this.deselectEvent.subscribe(this.onDeselect, this, true);
+		this.changePageEvent.subscribe(this.onChangePage, this, true);
+		this.renderEvent.subscribe(this.onRender, this, true);
+		this.resetEvent.subscribe(this.onReset, this, true);
+		this.clearEvent.subscribe(this.onClear, this, true);
+	},
+	
+	/**
+	* The default event function that is attached to a date link within a calendar cell
+	* when the calendar is rendered.
+	* @method doSelectCell
+	* @param {DOMEvent} e	The event
+	* @param {Calendar} cal	A reference to the calendar passed by the Event utility
+	*/
+	doSelectCell : function(e, cal) {
+		var cell,index,d,date;
+
+		var target = YAHOO.util.Event.getTarget(e);
+		var tagName = target.tagName.toLowerCase();
+		var defSelector = false;
 
-	var target = YAHOO.util.Event.getTarget(e);
-	var tagName = target.tagName.toLowerCase();
-	var defSelector = false;
+		while (tagName != "td" && ! YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
 
-	while (tagName != "td" && ! YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+			if (!defSelector && tagName == "a" && YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTOR)) {
+				defSelector = true;	
+			}
 
-		if (!defSelector && tagName == "a" && YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTOR)) {
-			defSelector = true;	
+			target = target.parentNode;
+			tagName = target.tagName.toLowerCase();
+			// TODO: No need to go all the way up to html.
+			if (tagName == "html") {
+				return;
+			}
 		}
 
-		target = target.parentNode;
-		tagName = target.tagName.toLowerCase(); 
-		if (tagName == "html") {
-			return;
+		if (defSelector) {
+			// Stop link href navigation for default renderer
+			YAHOO.util.Event.preventDefault(e);
 		}
-	}
-
-	if (defSelector) {
-		// Stop link href navigation for default renderer
-		YAHOO.util.Event.preventDefault(e);
-	}
-
-	cell = target;
-
-	if (YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
-		index = cell.id.split("cell")[1];
-		d = cal.cellDates[index];
-		date = new Date(d[0],d[1]-1,d[2]);
 	
-		var link;
+		cell = target;
 
-		if (cal.Options.MULTI_SELECT) {
-			link = cell.getElementsByTagName("a")[0];
-			if (link) {
-				link.blur();
-			}
+		if (YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
+			index = cell.id.split("cell")[1];
+			d = cal.cellDates[index];
+			date = YAHOO.widget.DateMath.getDate(d[0],d[1]-1,d[2]);
+		
+			var link;
 
-			var cellDate = cal.cellDates[index];
-			var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);
+			if (cal.Options.MULTI_SELECT) {
+				link = cell.getElementsByTagName("a")[0];
+				if (link) {
+					link.blur();
+				}
+
+				var cellDate = cal.cellDates[index];
+				var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);
 
-			if (cellDateIndex > -1) {	
-				cal.deselectCell(index);
+				if (cellDateIndex > -1) {	
+					cal.deselectCell(index);
+				} else {
+					cal.selectCell(index);
+				}	
+	
 			} else {
+				link = cell.getElementsByTagName("a")[0];
+				if (link) {
+					link.blur();
+				}
 				cal.selectCell(index);
-			}	
-
-		} else {
-			link = cell.getElementsByTagName("a")[0];
-			if (link) {
-				link.blur();
 			}
-			cal.selectCell(index);
 		}
-	}
-};
-
-/**
-* The event that is executed when the user hovers over a cell
-* @method doCellMouseOver
-* @param {DOMEvent} e	The event
-* @param {Calendar} cal	A reference to the calendar passed by the Event utility
-*/
-YAHOO.widget.Calendar.prototype.doCellMouseOver = function(e, cal) {
-	var target;
-	if (e) {
-		target = YAHOO.util.Event.getTarget(e);
-	} else {
-		target = this;
-	}
+	},
 
-	while (target.tagName.toLowerCase() != "td") {
-		target = target.parentNode;
-		if (target.tagName.toLowerCase() == "html") {
-			return;
+	/**
+	* The event that is executed when the user hovers over a cell
+	* @method doCellMouseOver
+	* @param {DOMEvent} e	The event
+	* @param {Calendar} cal	A reference to the calendar passed by the Event utility
+	*/
+	doCellMouseOver : function(e, cal) {
+		var target;
+		if (e) {
+			target = YAHOO.util.Event.getTarget(e);
+		} else {
+			target = this;
 		}
-	}
-
-	if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
-		YAHOO.util.Dom.addClass(target, cal.Style.CSS_CELL_HOVER);
-	}
-};
 
-/**
-* The event that is executed when the user moves the mouse out of a cell
-* @method doCellMouseOut
-* @param {DOMEvent} e	The event
-* @param {Calendar} cal	A reference to the calendar passed by the Event utility
-*/
-YAHOO.widget.Calendar.prototype.doCellMouseOut = function(e, cal) {
-	var target;
-	if (e) {
-		target = YAHOO.util.Event.getTarget(e);
-	} else {
-		target = this;
-	}
-
-	while (target.tagName.toLowerCase() != "td") {
-		target = target.parentNode;
-		if (target.tagName.toLowerCase() == "html") {
-			return;
+		while (target.tagName && target.tagName.toLowerCase() != "td") {
+			target = target.parentNode;
+			if (!target.tagName || target.tagName.toLowerCase() == "html") {
+				return;
+			}
 		}
-	}
-
-	if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
-		YAHOO.util.Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
-	}
-};
-
-YAHOO.widget.Calendar.prototype.setupConfig = function() {
-
-	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
-
-	/**
-	* The month/year representing the current visible Calendar date (mm/yyyy)
-	* @config pagedate
-	* @type String
-	* @default today's date
-	*/
-	this.cfg.addProperty(defCfg.PAGEDATE.key, { value:defCfg.PAGEDATE.value, handler:this.configPageDate } );
-
-	/**
-	* The date or range of dates representing the current Calendar selection
-	* @config selected
-	* @type String
-	* @default []
-	*/
-	this.cfg.addProperty(defCfg.SELECTED.key, { value:defCfg.SELECTED.value, handler:this.configSelected } );
-
-	/**
-	* The title to display above the Calendar's month header
-	* @config title
-	* @type String
-	* @default ""
-	*/
-	this.cfg.addProperty(defCfg.TITLE.key, { value:defCfg.TITLE.value, handler:this.configTitle } );
-
-	/**
-	* Whether or not a close button should be displayed for this Calendar
-	* @config close
-	* @type Boolean
-	* @default false
-	*/
-	this.cfg.addProperty(defCfg.CLOSE.key, { value:defCfg.CLOSE.value, handler:this.configClose } );
-
-	/**
-	* Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
-	* @config iframe
-	* @type Boolean
-	* @default true
-	*/
-	this.cfg.addProperty(defCfg.IFRAME.key, { value:defCfg.IFRAME.value, handler:this.configIframe, validator:this.cfg.checkBoolean } );
 
-	/**
-	* The minimum selectable date in the current Calendar (mm/dd/yyyy)
-	* @config mindate
-	* @type String
-	* @default null
-	*/
-	this.cfg.addProperty(defCfg.MINDATE.key, { value:defCfg.MINDATE.value, handler:this.configMinDate } );
+		if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+			YAHOO.util.Dom.addClass(target, cal.Style.CSS_CELL_HOVER);
+		}
+	},
 
 	/**
-	* The maximum selectable date in the current Calendar (mm/dd/yyyy)
-	* @config maxdate
-	* @type String
-	* @default null
-	*/
-	this.cfg.addProperty(defCfg.MAXDATE.key, { value:defCfg.MAXDATE.value, handler:this.configMaxDate } );
+	* The event that is executed when the user moves the mouse out of a cell
+	* @method doCellMouseOut
+	* @param {DOMEvent} e	The event
+	* @param {Calendar} cal	A reference to the calendar passed by the Event utility
+	*/
+	doCellMouseOut : function(e, cal) {
+		var target;
+		if (e) {
+			target = YAHOO.util.Event.getTarget(e);
+		} else {
+			target = this;
+		}
 
+		while (target.tagName && target.tagName.toLowerCase() != "td") {
+			target = target.parentNode;
+			if (!target.tagName || target.tagName.toLowerCase() == "html") {
+				return;
+			}
+		}
 
-	// Options properties
+		if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
+			YAHOO.util.Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
+		}
+	},
+	
+	setupConfig : function() {
+	
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
 
-	/**
-	* True if the Calendar should allow multiple selections. False by default.
-	* @config MULTI_SELECT
-	* @type Boolean
-	* @default false
-	*/
-	this.cfg.addProperty(defCfg.MULTI_SELECT.key,	{ value:defCfg.MULTI_SELECT.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+		/**
+		* The month/year representing the current visible Calendar date (mm/yyyy)
+		* @config pagedate
+		* @type String
+		* @default today's date
+		*/
+		this.cfg.addProperty(defCfg.PAGEDATE.key, { value:new Date(), handler:this.configPageDate } );
 
-    /**
-    * True if the Calendar should allow selection of out-of-month dates. False by default.
-    * @config OOM_SELECT
-    * @type Boolean
-    * @default false
-    */
-    this.cfg.addProperty(defCfg.OOM_SELECT.key,      { value:defCfg.OOM_SELECT.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+		/**
+		* The date or range of dates representing the current Calendar selection
+		* @config selected
+		* @type String
+		* @default []
+		*/
+		this.cfg.addProperty(defCfg.SELECTED.key, { value:[], handler:this.configSelected } );
 
-	/**
-	* The weekday the week begins on. Default is 0 (Sunday).
-	* @config START_WEEKDAY
-	* @type number
-	* @default 0
-	*/
-	this.cfg.addProperty(defCfg.START_WEEKDAY.key,	{ value:defCfg.START_WEEKDAY.value, handler:this.configOptions, validator:this.cfg.checkNumber  } );
+		/**
+		* The title to display above the Calendar's month header
+		* @config title
+		* @type String
+		* @default ""
+		*/
+		this.cfg.addProperty(defCfg.TITLE.key, { value:defCfg.TITLE.value, handler:this.configTitle } );
 
-	/**
-	* True if the Calendar should show weekday labels. True by default.
-	* @config SHOW_WEEKDAYS
-	* @type Boolean
-	* @default true
-	*/
-	this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key,	{ value:defCfg.SHOW_WEEKDAYS.value, handler:this.configOptions, validator:this.cfg.checkBoolean  } );
+		/**
+		* Whether or not a close button should be displayed for this Calendar
+		* @config close
+		* @type Boolean
+		* @default false
+		*/
+		this.cfg.addProperty(defCfg.CLOSE.key, { value:defCfg.CLOSE.value, handler:this.configClose } );
 
-	/**
-	* True if the Calendar should show week row headers. False by default.
-	* @config SHOW_WEEK_HEADER
-	* @type Boolean
-	* @default false
-	*/
-	this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key, { value:defCfg.SHOW_WEEK_HEADER.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+		/**
+		* Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
+		* This property is enabled by default for IE6 and below. It is disabled by default for other browsers for performance reasons, but can be 
+		* enabled if required.
+		* 
+		* @config iframe
+		* @type Boolean
+		* @default true for IE6 and below, false for all other browsers
+		*/
+		this.cfg.addProperty(defCfg.IFRAME.key, { value:defCfg.IFRAME.value, handler:this.configIframe, validator:this.cfg.checkBoolean } );
 
-	/**
-	* True if the Calendar should show week row footers. False by default.
-	* @config SHOW_WEEK_FOOTER
-	* @type Boolean
-	* @default false
-	*/	
-	this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key,{ value:defCfg.SHOW_WEEK_FOOTER.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+		/**
+		* The minimum selectable date in the current Calendar (mm/dd/yyyy)
+		* @config mindate
+		* @type String
+		* @default null
+		*/
+		this.cfg.addProperty(defCfg.MINDATE.key, { value:defCfg.MINDATE.value, handler:this.configMinDate } );
 
-	/**
-	* True if the Calendar should suppress weeks that are not a part of the current month. False by default.
-	* @config HIDE_BLANK_WEEKS
-	* @type Boolean
-	* @default false
-	*/	
-	this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key, { value:defCfg.HIDE_BLANK_WEEKS.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+		/**
+		* The maximum selectable date in the current Calendar (mm/dd/yyyy)
+		* @config maxdate
+		* @type String
+		* @default null
+		*/
+		this.cfg.addProperty(defCfg.MAXDATE.key, { value:defCfg.MAXDATE.value, handler:this.configMaxDate } );
 	
-	/**
-	* The image that should be used for the left navigation arrow.
-	* @config NAV_ARROW_LEFT
-	* @type String
-	* @deprecated	You can customize the image by overriding the default CSS class for the left arrow - "calnavleft"  
-	* @default null
-	*/	
-	this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key,	{ value:defCfg.NAV_ARROW_LEFT.value, handler:this.configOptions } );
-
-	/**
-	* The image that should be used for the right navigation arrow.
-	* @config NAV_ARROW_RIGHT
-	* @type String
-	* @deprecated	You can customize the image by overriding the default CSS class for the right arrow - "calnavright"
-	* @default null
-	*/	
-	this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key, { value:defCfg.NAV_ARROW_RIGHT.value, handler:this.configOptions } );
-
-	// Locale properties
-
-	/**
-	* The short month labels for the current locale.
-	* @config MONTHS_SHORT
-	* @type String[]
-	* @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
-	*/
-	this.cfg.addProperty(defCfg.MONTHS_SHORT.key,	{ value:defCfg.MONTHS_SHORT.value, handler:this.configLocale } );
 	
-	/**
-	* The long month labels for the current locale.
-	* @config MONTHS_LONG
-	* @type String[]
-	* @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
-	*/	
-	this.cfg.addProperty(defCfg.MONTHS_LONG.key,		{ value:defCfg.MONTHS_LONG.value, handler:this.configLocale } );
+		// Options properties
 	
-	/**
-	* The 1-character weekday labels for the current locale.
-	* @config WEEKDAYS_1CHAR
-	* @type String[]
-	* @default ["S", "M", "T", "W", "T", "F", "S"]
-	*/	
-	this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key,	{ value:defCfg.WEEKDAYS_1CHAR.value, handler:this.configLocale } );
+		/**
+		* True if the Calendar should allow multiple selections. False by default.
+		* @config MULTI_SELECT
+		* @type Boolean
+		* @default false
+		*/
+		this.cfg.addProperty(defCfg.MULTI_SELECT.key,	{ value:defCfg.MULTI_SELECT.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
 	
-	/**
-	* The short weekday labels for the current locale.
-	* @config WEEKDAYS_SHORT
-	* @type String[]
-	* @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
-	*/	
-	this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key,	{ value:defCfg.WEEKDAYS_SHORT.value, handler:this.configLocale } );
-	
-	/**
-	* The medium weekday labels for the current locale.
-	* @config WEEKDAYS_MEDIUM
-	* @type String[]
-	* @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
-	*/	
-	this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key,	{ value:defCfg.WEEKDAYS_MEDIUM.value, handler:this.configLocale } );
-	
-	/**
-	* The long weekday labels for the current locale.
-	* @config WEEKDAYS_LONG
-	* @type String[]
-	* @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
-	*/	
-	this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key,	{ value:defCfg.WEEKDAYS_LONG.value, handler:this.configLocale } );
-
-	/**
-	* Refreshes the locale values used to build the Calendar.
-	* @method refreshLocale
-	* @private
-	*/
-	var refreshLocale = function() {
-		this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);
-		this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);
-	};
-
-	this.cfg.subscribeToConfigEvent(defCfg.START_WEEKDAY.key, refreshLocale, this, true);
-	this.cfg.subscribeToConfigEvent(defCfg.MONTHS_SHORT.key, refreshLocale, this, true);
-	this.cfg.subscribeToConfigEvent(defCfg.MONTHS_LONG.key, refreshLocale, this, true);
-	this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_1CHAR.key, refreshLocale, this, true);
-	this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_SHORT.key, refreshLocale, this, true);
-	this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_MEDIUM.key, refreshLocale, this, true);
-	this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_LONG.key, refreshLocale, this, true);
-	
-	/**
-	* The setting that determines which length of month labels should be used. Possible values are "short" and "long".
-	* @config LOCALE_MONTHS
-	* @type String
-	* @default "long"
-	*/	
-	this.cfg.addProperty(defCfg.LOCALE_MONTHS.key,	{ value:defCfg.LOCALE_MONTHS.value, handler:this.configLocaleValues } );
-	
-	/**
-	* The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
-	* @config LOCALE_WEEKDAYS
-	* @type String
-	* @default "short"
-	*/	
-	this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key,	{ value:defCfg.LOCALE_WEEKDAYS.value, handler:this.configLocaleValues } );
-
-	/**
-	* The value used to delimit individual dates in a date string passed to various Calendar functions.
-	* @config DATE_DELIMITER
-	* @type String
-	* @default ","
-	*/	
-	this.cfg.addProperty(defCfg.DATE_DELIMITER.key,		{ value:defCfg.DATE_DELIMITER.value, handler:this.configLocale } );
-
-	/**
-	* The value used to delimit date fields in a date string passed to various Calendar functions.
-	* @config DATE_FIELD_DELIMITER
-	* @type String
-	* @default "/"
-	*/	
-	this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key, { value:defCfg.DATE_FIELD_DELIMITER.value, handler:this.configLocale } );
-
-	/**
-	* The value used to delimit date ranges in a date string passed to various Calendar functions.
-	* @config DATE_RANGE_DELIMITER
-	* @type String
-	* @default "-"
-	*/
-	this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key, { value:defCfg.DATE_RANGE_DELIMITER.value, handler:this.configLocale } );
-
-	/**
-	* The position of the month in a month/year date string
-	* @config MY_MONTH_POSITION
-	* @type Number
-	* @default 1
-	*/
-	this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key,	{ value:defCfg.MY_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
-	/**
-	* The position of the year in a month/year date string
-	* @config MY_YEAR_POSITION
-	* @type Number
-	* @default 2
-	*/
-	this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key,	{ value:defCfg.MY_YEAR_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
-	/**
-	* The position of the month in a month/day date string
-	* @config MD_MONTH_POSITION
-	* @type Number
-	* @default 1
-	*/
-	this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key,	{ value:defCfg.MD_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
-	/**
-	* The position of the day in a month/year date string
-	* @config MD_DAY_POSITION
-	* @type Number
-	* @default 2
-	*/
-	this.cfg.addProperty(defCfg.MD_DAY_POSITION.key,		{ value:defCfg.MD_DAY_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
-	/**
-	* The position of the month in a month/day/year date string
-	* @config MDY_MONTH_POSITION
-	* @type Number
-	* @default 1
-	*/
-	this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key,	{ value:defCfg.MDY_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
-	/**
-	* The position of the day in a month/day/year date string
-	* @config MDY_DAY_POSITION
-	* @type Number
-	* @default 2
-	*/
-	this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key,	{ value:defCfg.MDY_DAY_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
-
-	/**
-	* The position of the year in a month/day/year date string
-	* @config MDY_YEAR_POSITION
-	* @type Number
-	* @default 3
-	*/
-	this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key,	{ value:defCfg.MDY_YEAR_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
-};
-
-/**
-* The default handler for the "pagedate" property
-* @method configPageDate
-*/
-YAHOO.widget.Calendar.prototype.configPageDate = function(type, args, obj) {
-	this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key, this._parsePageDate(args[0]), true);
-};
-
-/**
-* The default handler for the "mindate" property
-* @method configMinDate
-*/
-YAHOO.widget.Calendar.prototype.configMinDate = function(type, args, obj) {
-	var val = args[0];
-	if (YAHOO.lang.isString(val)) {
-		val = this._parseDate(val);
-		this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MINDATE.key, new Date(val[0],(val[1]-1),val[2]));
-	}
-};
-
-/**
-* The default handler for the "maxdate" property
-* @method configMaxDate
-*/
-YAHOO.widget.Calendar.prototype.configMaxDate = function(type, args, obj) {
-	var val = args[0];
-	if (YAHOO.lang.isString(val)) {
-		val = this._parseDate(val);
-		this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MAXDATE.key, new Date(val[0],(val[1]-1),val[2]));
-	}
-};
-
-/**
-* The default handler for the "selected" property
-* @method configSelected
-*/
-YAHOO.widget.Calendar.prototype.configSelected = function(type, args, obj) {
-	var selected = args[0];
-	var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
-	
-	if (selected) {
-		if (YAHOO.lang.isString(selected)) {
-			this.cfg.setProperty(cfgSelected, this._parseDates(selected), true);
-		} 
-	}
-	if (! this._selectedDates) {
-		this._selectedDates = this.cfg.getProperty(cfgSelected);
-	}
-};
-
-/**
-* The default handler for all configuration options properties
-* @method configOptions
-*/
-YAHOO.widget.Calendar.prototype.configOptions = function(type, args, obj) {
-	this.Options[type.toUpperCase()] = args[0];
-};
-
-/**
-* The default handler for all configuration locale properties
-* @method configLocale
-*/
-YAHOO.widget.Calendar.prototype.configLocale = function(type, args, obj) {
-	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
-	this.Locale[type.toUpperCase()] = args[0];
-
-	this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);
-	this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);
-};
-
-/**
-* The default handler for all configuration locale field length properties
-* @method configLocaleValues
-*/
-YAHOO.widget.Calendar.prototype.configLocaleValues = function(type, args, obj) {
-	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG; 
-
-	type = type.toLowerCase();
-	var val = args[0];
-
-	switch (type) {
-		case defCfg.LOCALE_MONTHS.key:
-			switch (val) {
-				case YAHOO.widget.Calendar.SHORT:
-					this.Locale.LOCALE_MONTHS = this.cfg.getProperty(defCfg.MONTHS_SHORT.key).concat();
-					break;
-				case YAHOO.widget.Calendar.LONG:
-					this.Locale.LOCALE_MONTHS = this.cfg.getProperty(defCfg.MONTHS_LONG.key).concat();
-					break;
-			}
-			break;
-		case defCfg.LOCALE_WEEKDAYS.key:
-			switch (val) {
-				case YAHOO.widget.Calendar.ONE_CHAR:
-					this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_1CHAR.key).concat();
-					break;
-				case YAHOO.widget.Calendar.SHORT:
-					this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_SHORT.key).concat();
-					break;
-				case YAHOO.widget.Calendar.MEDIUM:
-					this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_MEDIUM.key).concat();
-					break;
-				case YAHOO.widget.Calendar.LONG:
-					this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_LONG.key).concat();
-					break;
-			}
-			
-			var START_WEEKDAY = this.cfg.getProperty(defCfg.START_WEEKDAY.key);
-
-			if (START_WEEKDAY > 0) {
-				for (var w=0;w<START_WEEKDAY;++w) {
-					this.Locale.LOCALE_WEEKDAYS.push(this.Locale.LOCALE_WEEKDAYS.shift());
-				}
-			}
-			break;
-	}
-};
-
-/**
-* Defines the style constants for the Calendar
-* @method initStyles
-*/
-YAHOO.widget.Calendar.prototype.initStyles = function() {
-
-	var defStyle = YAHOO.widget.Calendar._STYLES;
-
-	this.Style = {
 		/**
-		* @property Style.CSS_ROW_HEADER
+		* The weekday the week begins on. Default is 0 (Sunday).
+		* @config START_WEEKDAY
+		* @type number
+		* @default 0
 		*/
-		CSS_ROW_HEADER: defStyle.CSS_ROW_HEADER,
+		this.cfg.addProperty(defCfg.START_WEEKDAY.key,	{ value:defCfg.START_WEEKDAY.value, handler:this.configOptions, validator:this.cfg.checkNumber  } );
+	
 		/**
-		* @property Style.CSS_ROW_FOOTER
+		* True if the Calendar should show weekday labels. True by default.
+		* @config SHOW_WEEKDAYS
+		* @type Boolean
+		* @default true
 		*/
-		CSS_ROW_FOOTER: defStyle.CSS_ROW_FOOTER,
+		this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key,	{ value:defCfg.SHOW_WEEKDAYS.value, handler:this.configOptions, validator:this.cfg.checkBoolean  } );
+	
 		/**
-		* @property Style.CSS_CELL
+		* True if the Calendar should show week row headers. False by default.
+		* @config SHOW_WEEK_HEADER
+		* @type Boolean
+		* @default false
 		*/
-		CSS_CELL : defStyle.CSS_CELL,
+		this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key, { value:defCfg.SHOW_WEEK_HEADER.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+	
 		/**
-		* @property Style.CSS_CELL_SELECTOR
-		*/
-		CSS_CELL_SELECTOR : defStyle.CSS_CELL_SELECTOR,
+		* True if the Calendar should show week row footers. False by default.
+		* @config SHOW_WEEK_FOOTER
+		* @type Boolean
+		* @default false
+		*/	
+		this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key,{ value:defCfg.SHOW_WEEK_FOOTER.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+	
 		/**
-		* @property Style.CSS_CELL_SELECTED
-		*/
-		CSS_CELL_SELECTED : defStyle.CSS_CELL_SELECTED,
+		* True if the Calendar should suppress weeks that are not a part of the current month. False by default.
+		* @config HIDE_BLANK_WEEKS
+		* @type Boolean
+		* @default false
+		*/	
+		this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key, { value:defCfg.HIDE_BLANK_WEEKS.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+		
+        /**
+        * True if the Calendar should allow out of month selections. false by default.
+        * @config OUT_OF_MONTH_SELECT
+        * @type Boolean
+        * @default false
+        */
+        this.cfg.addProperty(defCfg.OUT_OF_MONTH_SELECT.key, { value:defCfg.OUT_OF_MONTH_SELECT.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
+
 		/**
-		* @property Style.CSS_CELL_SELECTABLE
-		*/
-		CSS_CELL_SELECTABLE : defStyle.CSS_CELL_SELECTABLE,
+		* The image that should be used for the left navigation arrow.
+		* @config NAV_ARROW_LEFT
+		* @type String
+		* @deprecated	You can customize the image by overriding the default CSS class for the left arrow - "calnavleft"  
+		* @default null
+		*/	
+		this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key,	{ value:defCfg.NAV_ARROW_LEFT.value, handler:this.configOptions } );
+	
 		/**
-		* @property Style.CSS_CELL_RESTRICTED
-		*/
-		CSS_CELL_RESTRICTED : defStyle.CSS_CELL_RESTRICTED,
+		* The image that should be used for the right navigation arrow.
+		* @config NAV_ARROW_RIGHT
+		* @type String
+		* @deprecated	You can customize the image by overriding the default CSS class for the right arrow - "calnavright"
+		* @default null
+		*/	
+		this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key, { value:defCfg.NAV_ARROW_RIGHT.value, handler:this.configOptions } );
+	
+		// Locale properties
+	
 		/**
-		* @property Style.CSS_CELL_TODAY
+		* The short month labels for the current locale.
+		* @config MONTHS_SHORT
+		* @type String[]
+		* @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
 		*/
-		CSS_CELL_TODAY : defStyle.CSS_CELL_TODAY,
+		this.cfg.addProperty(defCfg.MONTHS_SHORT.key,	{ value:defCfg.MONTHS_SHORT.value, handler:this.configLocale } );
+		
 		/**
-		* @property Style.CSS_CELL_OOM
-		*/
-		CSS_CELL_OOM : defStyle.CSS_CELL_OOM,
+		* The long month labels for the current locale.
+		* @config MONTHS_LONG
+		* @type String[]
+		* @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+		*/	
+		this.cfg.addProperty(defCfg.MONTHS_LONG.key,		{ value:defCfg.MONTHS_LONG.value, handler:this.configLocale } );
+
 		/**
-		* @property Style.CSS_CELL_OOB
-		*/
-		CSS_CELL_OOB : defStyle.CSS_CELL_OOB,
+		* The 1-character weekday labels for the current locale.
+		* @config WEEKDAYS_1CHAR
+		* @type String[]
+		* @default ["S", "M", "T", "W", "T", "F", "S"]
+		*/	
+		this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key,	{ value:defCfg.WEEKDAYS_1CHAR.value, handler:this.configLocale } );
+		
 		/**
-		* @property Style.CSS_HEADER
-		*/
-		CSS_HEADER : defStyle.CSS_HEADER,
+		* The short weekday labels for the current locale.
+		* @config WEEKDAYS_SHORT
+		* @type String[]
+		* @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
+		*/	
+		this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key,	{ value:defCfg.WEEKDAYS_SHORT.value, handler:this.configLocale } );
+		
 		/**
-		* @property Style.CSS_HEADER_TEXT
-		*/
-		CSS_HEADER_TEXT : defStyle.CSS_HEADER_TEXT,
+		* The medium weekday labels for the current locale.
+		* @config WEEKDAYS_MEDIUM
+		* @type String[]
+		* @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
+		*/	
+		this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key,	{ value:defCfg.WEEKDAYS_MEDIUM.value, handler:this.configLocale } );
+		
 		/**
-		* @property Style.CSS_BODY
-		*/
-		CSS_BODY : defStyle.CSS_BODY,
+		* The long weekday labels for the current locale.
+		* @config WEEKDAYS_LONG
+		* @type String[]
+		* @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
+		*/	
+		this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key,	{ value:defCfg.WEEKDAYS_LONG.value, handler:this.configLocale } );
+	
 		/**
-		* @property Style.CSS_WEEKDAY_CELL
+		* Refreshes the locale values used to build the Calendar.
+		* @method refreshLocale
+		* @private
 		*/
-		CSS_WEEKDAY_CELL : defStyle.CSS_WEEKDAY_CELL,
+		var refreshLocale = function() {
+			this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);
+			this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);
+		};
+	
+		this.cfg.subscribeToConfigEvent(defCfg.START_WEEKDAY.key, refreshLocale, this, true);
+		this.cfg.subscribeToConfigEvent(defCfg.MONTHS_SHORT.key, refreshLocale, this, true);
+		this.cfg.subscribeToConfigEvent(defCfg.MONTHS_LONG.key, refreshLocale, this, true);
+		this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_1CHAR.key, refreshLocale, this, true);
+		this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_SHORT.key, refreshLocale, this, true);
+		this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_MEDIUM.key, refreshLocale, this, true);
+		this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_LONG.key, refreshLocale, this, true);
+		
 		/**
-		* @property Style.CSS_WEEKDAY_ROW
-		*/
-		CSS_WEEKDAY_ROW : defStyle.CSS_WEEKDAY_ROW,
+		* The setting that determines which length of month labels should be used. Possible values are "short" and "long".
+		* @config LOCALE_MONTHS
+		* @type String
+		* @default "long"
+		*/	
+		this.cfg.addProperty(defCfg.LOCALE_MONTHS.key,	{ value:defCfg.LOCALE_MONTHS.value, handler:this.configLocaleValues } );
+		
 		/**
-		* @property Style.CSS_FOOTER
-		*/
-		CSS_FOOTER : defStyle.CSS_FOOTER,
+		* The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
+		* @config LOCALE_WEEKDAYS
+		* @type String
+		* @default "short"
+		*/	
+		this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key,	{ value:defCfg.LOCALE_WEEKDAYS.value, handler:this.configLocaleValues } );
+	
 		/**
-		* @property Style.CSS_CALENDAR
-		*/
-		CSS_CALENDAR : defStyle.CSS_CALENDAR,
+		* The value used to delimit individual dates in a date string passed to various Calendar functions.
+		* @config DATE_DELIMITER
+		* @type String
+		* @default ","
+		*/	
+		this.cfg.addProperty(defCfg.DATE_DELIMITER.key,		{ value:defCfg.DATE_DELIMITER.value, handler:this.configLocale } );
+	
 		/**
-		* @property Style.CSS_SINGLE
-		*/
-		CSS_SINGLE : defStyle.CSS_SINGLE,
+		* The value used to delimit date fields in a date string passed to various Calendar functions.
+		* @config DATE_FIELD_DELIMITER
+		* @type String
+		* @default "/"
+		*/	
+		this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key, { value:defCfg.DATE_FIELD_DELIMITER.value, handler:this.configLocale } );
+	
 		/**
-		* @property Style.CSS_CONTAINER
+		* The value used to delimit date ranges in a date string passed to various Calendar functions.
+		* @config DATE_RANGE_DELIMITER
+		* @type String
+		* @default "-"
 		*/
-		CSS_CONTAINER : defStyle.CSS_CONTAINER,
+		this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key, { value:defCfg.DATE_RANGE_DELIMITER.value, handler:this.configLocale } );
+	
 		/**
-		* @property Style.CSS_NAV_LEFT
+		* The position of the month in a month/year date string
+		* @config MY_MONTH_POSITION
+		* @type Number
+		* @default 1
 		*/
-		CSS_NAV_LEFT : defStyle.CSS_NAV_LEFT,
+		this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key,	{ value:defCfg.MY_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+	
 		/**
-		* @property Style.CSS_NAV_RIGHT
+		* The position of the year in a month/year date string
+		* @config MY_YEAR_POSITION
+		* @type Number
+		* @default 2
 		*/
-		CSS_NAV_RIGHT : defStyle.CSS_NAV_RIGHT,
+		this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key,	{ value:defCfg.MY_YEAR_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+	
 		/**
-		* @property Style.CSS_CLOSE
+		* The position of the month in a month/day date string
+		* @config MD_MONTH_POSITION
+		* @type Number
+		* @default 1
 		*/
-		CSS_CLOSE : defStyle.CSS_CLOSE,
+		this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key,	{ value:defCfg.MD_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+	
 		/**
-		* @property Style.CSS_CELL_TOP
+		* The position of the day in a month/year date string
+		* @config MD_DAY_POSITION
+		* @type Number
+		* @default 2
 		*/
-		CSS_CELL_TOP : defStyle.CSS_CELL_TOP,
+		this.cfg.addProperty(defCfg.MD_DAY_POSITION.key,		{ value:defCfg.MD_DAY_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+	
 		/**
-		* @property Style.CSS_CELL_LEFT
+		* The position of the month in a month/day/year date string
+		* @config MDY_MONTH_POSITION
+		* @type Number
+		* @default 1
 		*/
-		CSS_CELL_LEFT : defStyle.CSS_CELL_LEFT,
+		this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key,	{ value:defCfg.MDY_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+	
 		/**
-		* @property Style.CSS_CELL_RIGHT
+		* The position of the day in a month/day/year date string
+		* @config MDY_DAY_POSITION
+		* @type Number
+		* @default 2
 		*/
-		CSS_CELL_RIGHT : defStyle.CSS_CELL_RIGHT,
+		this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key,	{ value:defCfg.MDY_DAY_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+	
 		/**
-		* @property Style.CSS_CELL_BOTTOM
+		* The position of the year in a month/day/year date string
+		* @config MDY_YEAR_POSITION
+		* @type Number
+		* @default 3
 		*/
-		CSS_CELL_BOTTOM : defStyle.CSS_CELL_BOTTOM,
+		this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key,	{ value:defCfg.MDY_YEAR_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+		
 		/**
-		* @property Style.CSS_CELL_HOVER
+		* The position of the month in the month year label string used as the Calendar header
+		* @config MY_LABEL_MONTH_POSITION
+		* @type Number
+		* @default 1
 		*/
-		CSS_CELL_HOVER : defStyle.CSS_CELL_HOVER,
+		this.cfg.addProperty(defCfg.MY_LABEL_MONTH_POSITION.key,	{ value:defCfg.MY_LABEL_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+	
 		/**
-		* @property Style.CSS_CELL_HIGHLIGHT1
+		* The position of the year in the month year label string used as the Calendar header
+		* @config MY_LABEL_YEAR_POSITION
+		* @type Number
+		* @default 2
 		*/
-		CSS_CELL_HIGHLIGHT1 : defStyle.CSS_CELL_HIGHLIGHT1,
+		this.cfg.addProperty(defCfg.MY_LABEL_YEAR_POSITION.key,	{ value:defCfg.MY_LABEL_YEAR_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
+		
 		/**
-		* @property Style.CSS_CELL_HIGHLIGHT2
+		* The suffix used after the month when rendering the Calendar header
+		* @config MY_LABEL_MONTH_SUFFIX
+		* @type String
+		* @default " "
 		*/
-		CSS_CELL_HIGHLIGHT2 : defStyle.CSS_CELL_HIGHLIGHT2,
+		this.cfg.addProperty(defCfg.MY_LABEL_MONTH_SUFFIX.key,	{ value:defCfg.MY_LABEL_MONTH_SUFFIX.value, handler:this.configLocale } );
+		
 		/**
-		* @property Style.CSS_CELL_HIGHLIGHT3
+		* The suffix used after the year when rendering the Calendar header
+		* @config MY_LABEL_YEAR_SUFFIX
+		* @type String
+		* @default ""
 		*/
-		CSS_CELL_HIGHLIGHT3 : defStyle.CSS_CELL_HIGHLIGHT3,
+		this.cfg.addProperty(defCfg.MY_LABEL_YEAR_SUFFIX.key, { value:defCfg.MY_LABEL_YEAR_SUFFIX.value, handler:this.configLocale } );
+
 		/**
-		* @property Style.CSS_CELL_HIGHLIGHT4
+		* Configuration for the Month/Year CalendarNavigator UI which allows the user to jump directly to a 
+		* specific Month/Year without having to scroll sequentially through months.
+		* <p>
+		* Setting this property to null (default value) or false, will disable the CalendarNavigator UI.
+		* </p>
+		* <p>
+		* Setting this property to true will enable the CalendarNavigatior UI with the default CalendarNavigator configuration values.
+		* </p>
+		* <p>
+		* This property can also be set to an object literal containing configuration properties for the CalendarNavigator UI.
+		* The configuration object expects the the following case-sensitive properties, with the "strings" property being a nested object.
+		* Any properties which are not provided will use the default values (defined in the CalendarNavigator class).
+		* </p>
+		* <dl>
+		* <dt>strings</dt>
+		* <dd><em>Object</em> :  An object with the properties shown below, defining the string labels to use in the Navigator's UI
+		*     <dl>
+		*         <dt>month</dt><dd><em>String</em> : The string to use for the month label. Defaults to "Month".</dd>
+		*         <dt>year</dt><dd><em>String</em> : The string to use for the year label. Defaults to "Year".</dd>
+		*         <dt>submit</dt><dd><em>String</em> : The string to use for the submit button label. Defaults to "Okay".</dd>
+		*         <dt>cancel</dt><dd><em>String</em> : The string to use for the cancel button label. Defaults to "Cancel".</dd>
+		*         <dt>invalidYear</dt><dd><em>String</em> : The string to use for invalid year values. Defaults to "Year needs to be a number".</dd>
+		*     </dl>
+		* </dd>
+		* <dt>monthFormat</dt><dd><em>String</em> : The month format to use. Either YAHOO.widget.Calendar.LONG, or YAHOO.widget.Calendar.SHORT. Defaults to YAHOO.widget.Calendar.LONG</dd>
+		* <dt>initialFocus</dt><dd><em>String</em> : Either "year" or "month" specifying which input control should get initial focus. Defaults to "year"</dd>
+		* </dl>
+		* <p>E.g.</p>
+		* <pre>
+		* var navConfig = {
+		*	  strings: {
+		*		  month:"Calendar Month",
+		*		  year:"Calendar Year",
+		*		  submit: "Submit",
+		*		  cancel: "Cancel",
+		*		  invalidYear: "Please enter a valid year"
+		*	  },
+		*	  monthFormat: YAHOO.widget.Calendar.SHORT,
+		*	  initialFocus: "month"
+		* }
+		* </pre>
+		* @config navigator
+		* @type {Object|Boolean}
+		* @default null
 		*/
-		CSS_CELL_HIGHLIGHT4 : defStyle.CSS_CELL_HIGHLIGHT4
-	};
-};
+		this.cfg.addProperty(defCfg.NAV.key, { value:defCfg.NAV.value, handler:this.configNavigator } );
+	},
 
-/**
-* Builds the date label that will be displayed in the calendar header or
-* footer, depending on configuration.
-* @method buildMonthLabel
-* @return	{String}	The formatted calendar month label
-*/
-YAHOO.widget.Calendar.prototype.buildMonthLabel = function() {
-	var pageDate = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key);
-	return this.Locale.LOCALE_MONTHS[pageDate.getMonth()] + " " + pageDate.getFullYear();
-};
+	/**
+	* The default handler for the "pagedate" property
+	* @method configPageDate
+	*/
+	configPageDate : function(type, args, obj) {
+		this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key, this._parsePageDate(args[0]), true);
+	},
 
-/**
-* Builds the date digit that will be displayed in calendar cells
-* @method buildDayLabel
-* @param {Date}	workingDate	The current working date
-* @return	{String}	The formatted day label
-*/
-YAHOO.widget.Calendar.prototype.buildDayLabel = function(workingDate) {
-	return workingDate.getDate();
-};
+	/**
+	* The default handler for the "mindate" property
+	* @method configMinDate
+	*/
+	configMinDate : function(type, args, obj) {
+		var val = args[0];
+		if (YAHOO.lang.isString(val)) {
+			val = this._parseDate(val);
+			this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MINDATE.key, YAHOO.widget.DateMath.getDate(val[0],(val[1]-1),val[2]));
+		}
+	},
 
-/**
-* Renders the calendar header.
-* @method renderHeader
-* @param {Array}	html	The current working HTML array
-* @return {Array} The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.renderHeader = function(html) {
-	var colSpan = 7;
-	
-	var DEPR_NAV_LEFT = "us/tr/callt.gif";
-	var DEPR_NAV_RIGHT = "us/tr/calrt.gif";	
-	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+	/**
+	* The default handler for the "maxdate" property
+	* @method configMaxDate
+	*/
+	configMaxDate : function(type, args, obj) {
+		var val = args[0];
+		if (YAHOO.lang.isString(val)) {
+			val = this._parseDate(val);
+			this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MAXDATE.key, YAHOO.widget.DateMath.getDate(val[0],(val[1]-1),val[2]));
+		}
+	},
 	
-	if (this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)) {
-		colSpan += 1;
-	}
-
-	if (this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)) {
-		colSpan += 1;
-	}
-
-	html[html.length] = "<thead>";
-	html[html.length] =		"<tr>";
-	html[html.length] =			'<th colspan="' + colSpan + '" class="' + this.Style.CSS_HEADER_TEXT + '">';
-	html[html.length] =				'<div class="' + this.Style.CSS_HEADER + '">';
-
-	var renderLeft, renderRight = false;
-
-	if (this.parent) {
-		if (this.index === 0) {
-			renderLeft = true;
+	/**
+	* The default handler for the "selected" property
+	* @method configSelected
+	*/
+	configSelected : function(type, args, obj) {
+		var selected = args[0];
+		var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
+		
+		if (selected) {
+			if (YAHOO.lang.isString(selected)) {
+				this.cfg.setProperty(cfgSelected, this._parseDates(selected), true);
+			} 
 		}
-		if (this.index == (this.parent.cfg.getProperty("pages") -1)) {
-			renderRight = true;
+		if (! this._selectedDates) {
+			this._selectedDates = this.cfg.getProperty(cfgSelected);
 		}
-	} else {
-		renderLeft = true;
-		renderRight = true;
-	}
-
-	var cal = this.parent || this;
+	},
 	
-	if (renderLeft) {
-		var leftArrow = this.cfg.getProperty(defCfg.NAV_ARROW_LEFT.key);
-		// Check for deprecated customization - If someone set IMG_ROOT, but didn't set NAV_ARROW_LEFT, then set NAV_ARROW_LEFT to the old deprecated value
-		if (leftArrow === null && YAHOO.widget.Calendar.IMG_ROOT !== null) {
-			leftArrow = YAHOO.widget.Calendar.IMG_ROOT + DEPR_NAV_LEFT;
-		}
-		var leftStyle = (leftArrow === null) ? "" : ' style="background-image:url(' + leftArrow + ')"';
-		html[html.length] = '<a class="' + this.Style.CSS_NAV_LEFT + '"' + leftStyle + ' >&#160;</a>';
-	}
+	/**
+	* The default handler for all configuration options properties
+	* @method configOptions
+	*/
+	configOptions : function(type, args, obj) {
+		this.Options[type.toUpperCase()] = args[0];
+	},
 	
-	html[html.length] = this.buildMonthLabel();
+	/**
+	* The default handler for all configuration locale properties
+	* @method configLocale
+	*/
+	configLocale : function(type, args, obj) {
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+		this.Locale[type.toUpperCase()] = args[0];
+	
+		this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);
+		this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);
+	},
+	
+	/**
+	* The default handler for all configuration locale field length properties
+	* @method configLocaleValues
+	*/
+	configLocaleValues : function(type, args, obj) {
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG; 
+	
+		type = type.toLowerCase();
+		var val = args[0];
+	
+		switch (type) {
+			case defCfg.LOCALE_MONTHS.key:
+				switch (val) {
+					case YAHOO.widget.Calendar.SHORT:
+						this.Locale.LOCALE_MONTHS = this.cfg.getProperty(defCfg.MONTHS_SHORT.key).concat();
+						break;
+					case YAHOO.widget.Calendar.LONG:
+						this.Locale.LOCALE_MONTHS = this.cfg.getProperty(defCfg.MONTHS_LONG.key).concat();
+						break;
+				}
+				break;
+			case defCfg.LOCALE_WEEKDAYS.key:
+				switch (val) {
+					case YAHOO.widget.Calendar.ONE_CHAR:
+						this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_1CHAR.key).concat();
+						break;
+					case YAHOO.widget.Calendar.SHORT:
+						this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_SHORT.key).concat();
+						break;
+					case YAHOO.widget.Calendar.MEDIUM:
+						this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_MEDIUM.key).concat();
+						break;
+					case YAHOO.widget.Calendar.LONG:
+						this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_LONG.key).concat();
+						break;
+				}
+				
+				var START_WEEKDAY = this.cfg.getProperty(defCfg.START_WEEKDAY.key);
 	
-	if (renderRight) {
-		var rightArrow = this.cfg.getProperty(defCfg.NAV_ARROW_RIGHT.key);
-		if (rightArrow === null && YAHOO.widget.Calendar.IMG_ROOT !== null) {
-			rightArrow = YAHOO.widget.Calendar.IMG_ROOT + DEPR_NAV_RIGHT;
+				if (START_WEEKDAY > 0) {
+					for (var w=0;w<START_WEEKDAY;++w) {
+						this.Locale.LOCALE_WEEKDAYS.push(this.Locale.LOCALE_WEEKDAYS.shift());
+					}
+				}
+				break;
 		}
-		var rightStyle = (rightArrow === null) ? "" : ' style="background-image:url(' + rightArrow + ')"';
-		html[html.length] = '<a class="' + this.Style.CSS_NAV_RIGHT + '"' + rightStyle + ' >&#160;</a>';
-	}
-
-	html[html.length] =	'</div>\n</th>\n</tr>';
+	},
 
-	if (this.cfg.getProperty(defCfg.SHOW_WEEKDAYS.key)) {
-		html = this.buildWeekdays(html);
-	}
-	
-	html[html.length] = '</thead>';
+	/**
+	 * The default handler for the "navigator" property
+	 * @method configNavigator
+	 */
+	configNavigator : function(type, args, obj) {
+		var val = args[0];
+		if (YAHOO.widget.CalendarNavigator && (val === true || YAHOO.lang.isObject(val))) {
+			if (!this.oNavigator) {
+				this.oNavigator = new YAHOO.widget.CalendarNavigator(this);
+				// Cleanup DOM Refs/Events before innerHTML is removed.
+				function erase() {
+					if (!this.pages) {
+						this.oNavigator.erase();
+					}
+				}
+				this.beforeRenderEvent.subscribe(erase, this, true);
+			}
+		} else {
+			if (this.oNavigator) {
+				this.oNavigator.destroy();
+				this.oNavigator = null;
+			}
+		}
+	},
 
-	return html;
-};
+	/**
+	* Defines the style constants for the Calendar
+	* @method initStyles
+	*/
+	initStyles : function() {
 
-/**
-* Renders the Calendar's weekday headers.
-* @method buildWeekdays
-* @param {Array}	html	The current working HTML array
-* @return {Array} The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.buildWeekdays = function(html) {
+		var defStyle = YAHOO.widget.Calendar._STYLES;
 
-	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+		this.Style = {
+			/**
+			* @property Style.CSS_ROW_HEADER
+			*/
+			CSS_ROW_HEADER: defStyle.CSS_ROW_HEADER,
+			/**
+			* @property Style.CSS_ROW_FOOTER
+			*/
+			CSS_ROW_FOOTER: defStyle.CSS_ROW_FOOTER,
+			/**
+			* @property Style.CSS_CELL
+			*/
+			CSS_CELL : defStyle.CSS_CELL,
+			/**
+			* @property Style.CSS_CELL_SELECTOR
+			*/
+			CSS_CELL_SELECTOR : defStyle.CSS_CELL_SELECTOR,
+			/**
+			* @property Style.CSS_CELL_SELECTED
+			*/
+			CSS_CELL_SELECTED : defStyle.CSS_CELL_SELECTED,
+			/**
+			* @property Style.CSS_CELL_SELECTABLE
+			*/
+			CSS_CELL_SELECTABLE : defStyle.CSS_CELL_SELECTABLE,
+			/**
+			* @property Style.CSS_CELL_RESTRICTED
+			*/
+			CSS_CELL_RESTRICTED : defStyle.CSS_CELL_RESTRICTED,
+			/**
+			* @property Style.CSS_CELL_TODAY
+			*/
+			CSS_CELL_TODAY : defStyle.CSS_CELL_TODAY,
+			/**
+			* @property Style.CSS_CELL_OOM
+			*/
+			CSS_CELL_OOM : defStyle.CSS_CELL_OOM,
+			/**
+			* @property Style.CSS_CELL_OOB
+			*/
+			CSS_CELL_OOB : defStyle.CSS_CELL_OOB,
+			/**
+			* @property Style.CSS_HEADER
+			*/
+			CSS_HEADER : defStyle.CSS_HEADER,
+			/**
+			* @property Style.CSS_HEADER_TEXT
+			*/
+			CSS_HEADER_TEXT : defStyle.CSS_HEADER_TEXT,
+			/**
+			* @property Style.CSS_BODY
+			*/
+			CSS_BODY : defStyle.CSS_BODY,
+			/**
+			* @property Style.CSS_WEEKDAY_CELL
+			*/
+			CSS_WEEKDAY_CELL : defStyle.CSS_WEEKDAY_CELL,
+			/**
+			* @property Style.CSS_WEEKDAY_ROW
+			*/
+			CSS_WEEKDAY_ROW : defStyle.CSS_WEEKDAY_ROW,
+			/**
+			* @property Style.CSS_FOOTER
+			*/
+			CSS_FOOTER : defStyle.CSS_FOOTER,
+			/**
+			* @property Style.CSS_CALENDAR
+			*/
+			CSS_CALENDAR : defStyle.CSS_CALENDAR,
+			/**
+			* @property Style.CSS_SINGLE
+			*/
+			CSS_SINGLE : defStyle.CSS_SINGLE,
+			/**
+			* @property Style.CSS_CONTAINER
+			*/
+			CSS_CONTAINER : defStyle.CSS_CONTAINER,
+			/**
+			* @property Style.CSS_NAV_LEFT
+			*/
+			CSS_NAV_LEFT : defStyle.CSS_NAV_LEFT,
+			/**
+			* @property Style.CSS_NAV_RIGHT
+			*/
+			CSS_NAV_RIGHT : defStyle.CSS_NAV_RIGHT,
+			/**
+			* @property Style.CSS_NAV
+			*/
+			CSS_NAV : defStyle.CSS_NAV,
+			/**
+			* @property Style.CSS_CLOSE
+			*/
+			CSS_CLOSE : defStyle.CSS_CLOSE,
+			/**
+			* @property Style.CSS_CELL_TOP
+			*/
+			CSS_CELL_TOP : defStyle.CSS_CELL_TOP,
+			/**
+			* @property Style.CSS_CELL_LEFT
+			*/
+			CSS_CELL_LEFT : defStyle.CSS_CELL_LEFT,
+			/**
+			* @property Style.CSS_CELL_RIGHT
+			*/
+			CSS_CELL_RIGHT : defStyle.CSS_CELL_RIGHT,
+			/**
+			* @property Style.CSS_CELL_BOTTOM
+			*/
+			CSS_CELL_BOTTOM : defStyle.CSS_CELL_BOTTOM,
+			/**
+			* @property Style.CSS_CELL_HOVER
+			*/
+			CSS_CELL_HOVER : defStyle.CSS_CELL_HOVER,
+			/**
+			* @property Style.CSS_CELL_HIGHLIGHT1
+			*/
+			CSS_CELL_HIGHLIGHT1 : defStyle.CSS_CELL_HIGHLIGHT1,
+			/**
+			* @property Style.CSS_CELL_HIGHLIGHT2
+			*/
+			CSS_CELL_HIGHLIGHT2 : defStyle.CSS_CELL_HIGHLIGHT2,
+			/**
+			* @property Style.CSS_CELL_HIGHLIGHT3
+			*/
+			CSS_CELL_HIGHLIGHT3 : defStyle.CSS_CELL_HIGHLIGHT3,
+			/**
+			* @property Style.CSS_CELL_HIGHLIGHT4
+			*/
+			CSS_CELL_HIGHLIGHT4 : defStyle.CSS_CELL_HIGHLIGHT4
+		};
+	},
+	
+	/**
+	* Builds the date label that will be displayed in the calendar header or
+	* footer, depending on configuration.
+	* @method buildMonthLabel
+	* @return	{String}	The formatted calendar month label
+	*/
+	buildMonthLabel : function() {
+		var pageDate = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key);
+	
+		var monthLabel  = this.Locale.LOCALE_MONTHS[pageDate.getMonth()] + this.Locale.MY_LABEL_MONTH_SUFFIX;
+		var yearLabel = pageDate.getFullYear() + this.Locale.MY_LABEL_YEAR_SUFFIX;
 
-	html[html.length] = '<tr class="' + this.Style.CSS_WEEKDAY_ROW + '">';
-
-	if (this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)) {
-		html[html.length] = '<th>&#160;</th>';
-	}
-
-	for(var i=0;i<this.Locale.LOCALE_WEEKDAYS.length;++i) {
-		html[html.length] = '<th class="calweekdaycell">' + this.Locale.LOCALE_WEEKDAYS[i] + '</th>';
-	}
-
-	if (this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)) {
-		html[html.length] = '<th>&#160;</th>';
-	}
-
-	html[html.length] = '</tr>';
-
-	return html;
-};
-
-/**
-* Renders the calendar body.
-* @method renderBody
-* @param {Date}	workingDate	The current working Date being used for the render process
-* @param {Array}	html	The current working HTML array
-* @return {Array} The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.renderBody = function(workingDate, html) {
-	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
-
-	var startDay = this.cfg.getProperty(defCfg.START_WEEKDAY.key);
-
-	this.preMonthDays = workingDate.getDay();
-	if (startDay > 0) {
-		this.preMonthDays -= startDay;
-	}
-	if (this.preMonthDays < 0) {
-		this.preMonthDays += 7;
-	}
+		if (this.Locale.MY_LABEL_MONTH_POSITION == 2 || this.Locale.MY_LABEL_YEAR_POSITION == 1) {
+			return yearLabel + monthLabel;
+		} else {
+			return monthLabel + yearLabel;
+		}
+	},
 	
-	this.monthDays = YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();
-	this.postMonthDays = YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;
+	/**
+	* Builds the date digit that will be displayed in calendar cells
+	* @method buildDayLabel
+	* @param {Date}	workingDate	The current working date
+	* @return	{String}	The formatted day label
+	*/
+	buildDayLabel : function(workingDate) {
+		return workingDate.getDate();
+	},
 	
-	workingDate = YAHOO.widget.DateMath.subtract(workingDate, YAHOO.widget.DateMath.DAY, this.preMonthDays);
-
-	var weekNum,weekClass;
-	var weekPrefix = "w";
-	var cellPrefix = "_cell";
-	var workingDayPrefix = "wd";
-	var dayPrefix = "d";
-	
-	var cellRenderers;
-	var renderer;
-	
-	var todayYear = this.today.getFullYear();
-	var todayMonth = this.today.getMonth();
-	var todayDate = this.today.getDate();
-	
-	var useDate = this.cfg.getProperty(defCfg.PAGEDATE.key);
-	var hideBlankWeeks = this.cfg.getProperty(defCfg.HIDE_BLANK_WEEKS.key);
-	var showWeekFooter = this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key);
-	var showWeekHeader = this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key);
-	var mindate = this.cfg.getProperty(defCfg.MINDATE.key);
-	var maxdate = this.cfg.getProperty(defCfg.MAXDATE.key);
-
-	if (mindate) {
-		mindate = YAHOO.widget.DateMath.clearTime(mindate);
-	}
-	if (maxdate) {
-		maxdate = YAHOO.widget.DateMath.clearTime(maxdate);
-	}
+	/**
+	 * Creates the title bar element and adds it to Calendar container DIV
+	 * 
+	 * @method createTitleBar
+	 * @param {String} strTitle The title to display in the title bar
+	 * @return The title bar element
+	 */
+	createTitleBar : function(strTitle) {
+		var tDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");
+		tDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;
+		tDiv.innerHTML = strTitle;
+		this.oDomContainer.insertBefore(tDiv, this.oDomContainer.firstChild);
 	
-	html[html.length] = '<tbody class="m' + (useDate.getMonth()+1) + ' ' + this.Style.CSS_BODY + '">';
+		YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
 	
-	var i = 0;
-
-	var tempDiv = document.createElement("div");
-	var cell = document.createElement("td");
-	tempDiv.appendChild(cell);
-
-	var jan1 = new Date(useDate.getFullYear(),0,1);
-
-	var cal = this.parent || this;
+		return tDiv;
+	},
+	
+	/**
+	 * Removes the title bar element from the DOM
+	 * 
+	 * @method removeTitleBar
+	 */
+	removeTitleBar : function() {
+		var tDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
+		if (tDiv) {
+			YAHOO.util.Event.purgeElement(tDiv);
+			this.oDomContainer.removeChild(tDiv);
+		}
+		YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
+	},
+	
+	/**
+	 * Creates the close button HTML element and adds it to Calendar container DIV
+	 * 
+	 * @method createCloseButton
+	 * @return The close HTML element created
+	 */
+	createCloseButton : function() {
+		var Dom = YAHOO.util.Dom,
+			Event = YAHOO.util.Event,
+			cssClose = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,
+			DEPR_CLOSE_PATH = "us/my/bn/x_d.gif";
+	
+		var lnk = Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0];
+	
+		if (!lnk) {
+			lnk = document.createElement("a");  
+			Event.addListener(lnk, "click", function(e, cal) {
+				cal.hide(); 
+				Event.preventDefault(e);
+			}, this);        
+		}
+	
+		lnk.href = "#";
+		lnk.className = "link-close";
+	
+		if (YAHOO.widget.Calendar.IMG_ROOT !== null) {
+			var img = Dom.getElementsByClassName(cssClose, "img", lnk)[0] || document.createElement("img");
+			img.src = YAHOO.widget.Calendar.IMG_ROOT + DEPR_CLOSE_PATH;
+			img.className = cssClose;
+			lnk.appendChild(img);
+		} else {
+			lnk.innerHTML = '<span class="' + cssClose + ' ' + this.Style.CSS_CLOSE + '"></span>';
+		}
+		this.oDomContainer.appendChild(lnk);
+	
+		return lnk;
+	},
+	
+	/**
+	 * Removes the close button HTML element from the DOM
+	 * 
+	 * @method removeCloseButton
+	 */
+	removeCloseButton : function() {
+		var btn = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || null;
+		if (btn) {
+			YAHOO.util.Event.purgeElement(btn);
+			this.oDomContainer.removeChild(btn);
+		}
+	},
 
-	for (var r=0;r<6;r++) {
+	/**
+	* Renders the calendar header.
+	* @method renderHeader
+	* @param {Array}	html	The current working HTML array
+	* @return {Array} The current working HTML array
+	*/
+	renderHeader : function(html) {
+		var colSpan = 7;
+		
+		var DEPR_NAV_LEFT = "us/tr/callt.gif";
+		var DEPR_NAV_RIGHT = "us/tr/calrt.gif";	
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+		
+		if (this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)) {
+			colSpan += 1;
+		}
+	
+		if (this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)) {
+			colSpan += 1;
+		}
+	
+		html[html.length] = "<thead>";
+		html[html.length] =		"<tr>";
+		html[html.length] =			'<th colspan="' + colSpan + '" class="' + this.Style.CSS_HEADER_TEXT + '">';
+		html[html.length] =				'<div class="' + this.Style.CSS_HEADER + '">';
+	
+		var renderLeft, renderRight = false;
+	
+		if (this.parent) {
+			if (this.index === 0) {
+				renderLeft = true;
+			}
+			if (this.index == (this.parent.cfg.getProperty("pages") -1)) {
+				renderRight = true;
+			}
+		} else {
+			renderLeft = true;
+			renderRight = true;
+		}
+	
+		if (renderLeft) {
+			var leftArrow = this.cfg.getProperty(defCfg.NAV_ARROW_LEFT.key);
+			// Check for deprecated customization - If someone set IMG_ROOT, but didn't set NAV_ARROW_LEFT, then set NAV_ARROW_LEFT to the old deprecated value
+			if (leftArrow === null && YAHOO.widget.Calendar.IMG_ROOT !== null) {
+				leftArrow = YAHOO.widget.Calendar.IMG_ROOT + DEPR_NAV_LEFT;
+			}
+			var leftStyle = (leftArrow === null) ? "" : ' style="background-image:url(' + leftArrow + ')"';
+			html[html.length] = '<a class="' + this.Style.CSS_NAV_LEFT + '"' + leftStyle + ' >&#160;</a>';
+		}
 
-		weekNum = YAHOO.widget.DateMath.getWeekNumber(workingDate, useDate.getFullYear(), startDay);
-		weekClass = weekPrefix + weekNum;
+		var lbl = this.buildMonthLabel();
+		var cal = this.parent || this;
+		if (cal.cfg.getProperty("navigator")) {
+			lbl = "<a class=\"" + this.Style.CSS_NAV + "\" href=\"#\">" + lbl + "</a>";
+		}
+		html[html.length] = lbl;
 
-		// Local OOM check for performance, since we already have pagedate
-		if (r !== 0 && hideBlankWeeks === true && workingDate.getMonth() != useDate.getMonth() && !this.cfg.getProperty(defCfg.OOM_SELECT.key)) {
-			break;
-		} else {
+		if (renderRight) {
+			var rightArrow = this.cfg.getProperty(defCfg.NAV_ARROW_RIGHT.key);
+			if (rightArrow === null && YAHOO.widget.Calendar.IMG_ROOT !== null) {
+				rightArrow = YAHOO.widget.Calendar.IMG_ROOT + DEPR_NAV_RIGHT;
+			}
+			var rightStyle = (rightArrow === null) ? "" : ' style="background-image:url(' + rightArrow + ')"';
+			html[html.length] = '<a class="' + this.Style.CSS_NAV_RIGHT + '"' + rightStyle + ' >&#160;</a>';
+		}
 
-			html[html.length] = '<tr class="' + weekClass + '">';
-			
-			if (showWeekHeader) { html = this.renderRowHeader(weekNum, html); }
-			
-			for (var d=0;d<7;d++){ // Render actual days
+		html[html.length] =	'</div>\n</th>\n</tr>';
 
-				cellRenderers = [];
-				renderer = null;
+		if (this.cfg.getProperty(defCfg.SHOW_WEEKDAYS.key)) {
+			html = this.buildWeekdays(html);
+		}
+		
+		html[html.length] = '</thead>';
+	
+		return html;
+	},
+	
+	/**
+	* Renders the Calendar's weekday headers.
+	* @method buildWeekdays
+	* @param {Array}	html	The current working HTML array
+	* @return {Array} The current working HTML array
+	*/
+	buildWeekdays : function(html) {
+	
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+	
+		html[html.length] = '<tr class="' + this.Style.CSS_WEEKDAY_ROW + '">';
+	
+		if (this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)) {
+			html[html.length] = '<th>&#160;</th>';
+		}
+	
+		for(var i=0;i<this.Locale.LOCALE_WEEKDAYS.length;++i) {
+			html[html.length] = '<th class="calweekdaycell">' + this.Locale.LOCALE_WEEKDAYS[i] + '</th>';
+		}
+	
+		if (this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)) {
+			html[html.length] = '<th>&#160;</th>';
+		}
+	
+		html[html.length] = '</tr>';
+	
+		return html;
+	},
+	
+	/**
+	* Renders the calendar body.
+	* @method renderBody
+	* @param {Date}	workingDate	The current working Date being used for the render process
+	* @param {Array}	html	The current working HTML array
+	* @return {Array} The current working HTML array
+	*/
+	renderBody : function(workingDate, html) {
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+	
+		var startDay = this.cfg.getProperty(defCfg.START_WEEKDAY.key);
+	
+		this.preMonthDays = workingDate.getDay();
+		if (startDay > 0) {
+			this.preMonthDays -= startDay;
+		}
+		if (this.preMonthDays < 0) {
+			this.preMonthDays += 7;
+		}
+		
+		this.monthDays = YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();
+		this.postMonthDays = YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;
+		
+		workingDate = YAHOO.widget.DateMath.subtract(workingDate, YAHOO.widget.DateMath.DAY, this.preMonthDays);
+	
+		var weekNum,weekClass;
+		var weekPrefix = "w";
+		var cellPrefix = "_cell";
+		var workingDayPrefix = "wd";
+		var dayPrefix = "d";
+		
+		var cellRenderers;
+		var renderer;
+		
+		var todayYear = this.today.getFullYear();
+		var todayMonth = this.today.getMonth();
+		var todayDate = this.today.getDate();
+		
+		var useDate = this.cfg.getProperty(defCfg.PAGEDATE.key);
+		var hideBlankWeeks = this.cfg.getProperty(defCfg.HIDE_BLANK_WEEKS.key);
+		var showWeekFooter = this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key);
+		var showWeekHeader = this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key);
+		var mindate = this.cfg.getProperty(defCfg.MINDATE.key);
+		var maxdate = this.cfg.getProperty(defCfg.MAXDATE.key);
+	
+        var outOfMonthSelect = this.cfg.getProperty(defCfg.OUT_OF_MONTH_SELECT.key);
 
-				this.clearElement(cell);
-				cell.className = this.Style.CSS_CELL;
-				cell.id = this.id + cellPrefix + i;
-
-				if (workingDate.getDate()		== todayDate && 
-					workingDate.getMonth()		== todayMonth &&
-					workingDate.getFullYear()	== todayYear) {
-					cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;
-				}
-				
-				var workingArray = [workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];
-				this.cellDates[this.cellDates.length] = workingArray; // Add this date to cellDates
+		if (mindate) {
+			mindate = YAHOO.widget.DateMath.clearTime(mindate);
+		}
+		if (maxdate) {
+			maxdate = YAHOO.widget.DateMath.clearTime(maxdate);
+		}
+		
+		html[html.length] = '<tbody class="m' + (useDate.getMonth()+1) + ' ' + this.Style.CSS_BODY + '">';
+		
+		var i = 0;
+	
+		var tempDiv = document.createElement("div");
+		var cell = document.createElement("td");
+		tempDiv.appendChild(cell);
+	
+		var cal = this.parent || this;
+	
+		for (var r=0;r<6;r++) {
+	
+			weekNum = YAHOO.widget.DateMath.getWeekNumber(workingDate, useDate.getFullYear(), startDay);
+			weekClass = weekPrefix + weekNum;
+	
+			// Local OOM check for performance, since we already have pagedate
+			if (r !== 0 && hideBlankWeeks === true && workingDate.getMonth() != useDate.getMonth() && !outOfMonthSelect) {
+				break;
+			} else {
+	
+				html[html.length] = '<tr class="' + weekClass + '">';
 				
-				// Local OOM check for performance, since we already have pagedate
-				if (workingDate.getMonth() != useDate.getMonth() && !this.cfg.getProperty(defCfg.OOM_SELECT.key)) {
-					cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;
-				} else {
-					YAHOO.util.Dom.addClass(cell, workingDayPrefix + workingDate.getDay());
-					YAHOO.util.Dom.addClass(cell, dayPrefix + workingDate.getDate());
+				if (showWeekHeader) { html = this.renderRowHeader(weekNum, html); }
 				
-					for (var s=0;s<this.renderStack.length;++s) {
-
-						var rArray = this.renderStack[s];
-						var type = rArray[0];
-						
-						var month;
-						var day;
-						var year;
-						
-						switch (type) {
-							case YAHOO.widget.Calendar.DATE:
-								month = rArray[1][1];
-								day = rArray[1][2];
-								year = rArray[1][0];
-
-								if (workingDate.getMonth()+1 == month && workingDate.getDate() == day && workingDate.getFullYear() == year) {
-									renderer = rArray[2];
-									this.renderStack.splice(s,1);
-								}
-								break;
-							case YAHOO.widget.Calendar.MONTH_DAY:
-								month = rArray[1][0];
-								day = rArray[1][1];
-								
-								if (workingDate.getMonth()+1 == month && workingDate.getDate() == day) {
-									renderer = rArray[2];
-									this.renderStack.splice(s,1);
-								}
-								break;
-							case YAHOO.widget.Calendar.RANGE:
-								var date1 = rArray[1][0];
-								var date2 = rArray[1][1];
-
-								var d1month = date1[1];
-								var d1day = date1[2];
-								var d1year = date1[0];
-								
-								var d1 = new Date(d1year, d1month-1, d1day);
-
-								var d2month = date2[1];
-								var d2day = date2[2];
-								var d2year = date2[0];
-
-								var d2 = new Date(d2year, d2month-1, d2day);
-
-								if (workingDate.getTime() >= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
-									renderer = rArray[2];
-
-									if (workingDate.getTime()==d2.getTime()) { 
+				for (var d=0;d<7;d++){ // Render actual days
+	
+					cellRenderers = [];
+	
+					this.clearElement(cell);
+					cell.className = this.Style.CSS_CELL;
+					cell.id = this.id + cellPrefix + i;
+
+					if (workingDate.getDate()		== todayDate && 
+						workingDate.getMonth()		== todayMonth &&
+						workingDate.getFullYear()	== todayYear) {
+						cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;
+					}
+					
+					var workingArray = [workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];
+					this.cellDates[this.cellDates.length] = workingArray; // Add this date to cellDates
+					
+					// Local OOM check for performance, since we already have pagedate
+					if (workingDate.getMonth() != useDate.getMonth()) {
+                        if (outOfMonthSelect) {
+                            cellRenderers[cellRenderers.length]=cal.renderCellStyleNotThisMonth;
+                        } else {
+                            cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;
+                        }
+					} else {
+						YAHOO.util.Dom.addClass(cell, workingDayPrefix + workingDate.getDay());
+						YAHOO.util.Dom.addClass(cell, dayPrefix + workingDate.getDate());
+					
+						for (var s=0;s<this.renderStack.length;++s) {
+	
+							renderer = null;
+	
+							var rArray = this.renderStack[s];
+							var type = rArray[0];
+							
+							var month;
+							var day;
+							var year;
+							
+							switch (type) {
+								case YAHOO.widget.Calendar.DATE:
+									month = rArray[1][1];
+									day = rArray[1][2];
+									year = rArray[1][0];
+	
+									if (workingDate.getMonth()+1 == month && workingDate.getDate() == day && workingDate.getFullYear() == year) {
+										renderer = rArray[2];
+										this.renderStack.splice(s,1);
+									}
+									break;
+								case YAHOO.widget.Calendar.MONTH_DAY:
+									month = rArray[1][0];
+									day = rArray[1][1];
+									
+									if (workingDate.getMonth()+1 == month && workingDate.getDate() == day) {
+										renderer = rArray[2];
 										this.renderStack.splice(s,1);
 									}
-								}
-								break;
-							case YAHOO.widget.Calendar.WEEKDAY:
-								
-								var weekday = rArray[1][0];
-								if (workingDate.getDay()+1 == weekday) {
-									renderer = rArray[2];
-								}
-								break;
-							case YAHOO.widget.Calendar.MONTH:
-								
-								month = rArray[1][0];
-								if (workingDate.getMonth()+1 == month) {
-									renderer = rArray[2];
-								}
-								break;
+									break;
+								case YAHOO.widget.Calendar.RANGE:
+									var date1 = rArray[1][0];
+									var date2 = rArray[1][1];
+	
+									var d1month = date1[1];
+									var d1day = date1[2];
+									var d1year = date1[0];
+									
+									var d1 = YAHOO.widget.DateMath.getDate(d1year, d1month-1, d1day);
+	
+									var d2month = date2[1];
+									var d2day = date2[2];
+									var d2year = date2[0];
+	
+									var d2 = YAHOO.widget.DateMath.getDate(d2year, d2month-1, d2day);
+	
+									if (workingDate.getTime() >= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
+										renderer = rArray[2];
+	
+										if (workingDate.getTime()==d2.getTime()) { 
+											this.renderStack.splice(s,1);
+										}
+									}
+									break;
+								case YAHOO.widget.Calendar.WEEKDAY:
+									
+									var weekday = rArray[1][0];
+									if (workingDate.getDay()+1 == weekday) {
+										renderer = rArray[2];
+									}
+									break;
+								case YAHOO.widget.Calendar.MONTH:
+									
+									month = rArray[1][0];
+									if (workingDate.getMonth()+1 == month) {
+										renderer = rArray[2];
+									}
+									break;
+							}
+							
+							if (renderer) {
+								cellRenderers[cellRenderers.length]=renderer;
+							}
 						}
-						
-						if (renderer) {
-							cellRenderers[cellRenderers.length]=renderer;
+	
+					}
+	
+					if (this._indexOfSelectedFieldArray(workingArray) > -1) {
+						cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected; 
+					}
+	
+					if ((mindate && (workingDate.getTime() < mindate.getTime())) ||
+						(maxdate && (workingDate.getTime() > maxdate.getTime()))
+					) {
+						cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;
+					} else {
+						cellRenderers[cellRenderers.length]=cal.styleCellDefault;
+						cellRenderers[cellRenderers.length]=cal.renderCellDefault;	
+					}
+					
+					for (var x=0; x < cellRenderers.length; ++x) {
+						if (cellRenderers[x].call(cal, workingDate, cell) == YAHOO.widget.Calendar.STOP_RENDER) {
+							break;
 						}
 					}
-
-				}
-
-				if (this._indexOfSelectedFieldArray(workingArray) > -1) {
-					cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected; 
-				}
-
-				if ((mindate && (workingDate.getTime() < mindate.getTime())) ||
-					(maxdate && (workingDate.getTime() > maxdate.getTime()))
-				) {
-					cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;
-				} else {
-					cellRenderers[cellRenderers.length]=cal.styleCellDefault;
-					cellRenderers[cellRenderers.length]=cal.renderCellDefault;	
-				}
-				
-				for (var x=0; x < cellRenderers.length; ++x) {
-					if (cellRenderers[x].call(cal, workingDate, cell) == YAHOO.widget.Calendar.STOP_RENDER) {
-						break;
+	
+					workingDate.setTime(workingDate.getTime() + YAHOO.widget.DateMath.ONE_DAY_MS);
+	
+					if (i >= 0 && i <= 6) {
+						YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TOP);
 					}
-				}
-
-				workingDate.setTime(workingDate.getTime() + YAHOO.widget.DateMath.ONE_DAY_MS);
-
-				if (i >= 0 && i <= 6) {
-					YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TOP);
-				}
-				if ((i % 7) === 0) {
-					YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
-				}
-				if (((i+1) % 7) === 0) {
-					YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);
-				}
-				
-				var postDays = this.postMonthDays; 
-				if (hideBlankWeeks && postDays >= 7) {
-					var blankWeeks = Math.floor(postDays/7);
-					for (var p=0;p<blankWeeks;++p) {
-						postDays -= 7;
+					if ((i % 7) === 0) {
+						YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
 					}
+					if (((i+1) % 7) === 0) {
+						YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);
+					}
+					
+					var postDays = this.postMonthDays; 
+					if (hideBlankWeeks && postDays >= 7) {
+						var blankWeeks = Math.floor(postDays/7);
+						for (var p=0;p<blankWeeks;++p) {
+							postDays -= 7;
+						}
+					}
+					
+					if (i >= ((this.preMonthDays+postDays+this.monthDays)-7)) {
+						YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
+					}
+	
+					html[html.length] = tempDiv.innerHTML;
+					i++;
 				}
-				
-				if (i >= ((this.preMonthDays+postDays+this.monthDays)-7)) {
-					YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
-				}
-
-				html[html.length] = tempDiv.innerHTML;
-				i++;
+	
+				if (showWeekFooter) { html = this.renderRowFooter(weekNum, html); }
+	
+				html[html.length] = '</tr>';
 			}
-
-			if (showWeekFooter) { html = this.renderRowFooter(weekNum, html); }
-
-			html[html.length] = '</tr>';
 		}
-	}
-
-	html[html.length] = '</tbody>';
-
-	return html;
-};
-
-/**
-* Renders the calendar footer. In the default implementation, there is
-* no footer.
-* @method renderFooter
-* @param {Array}	html	The current working HTML array
-* @return {Array} The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.renderFooter = function(html) { return html; };
-
-/**
-* Renders the calendar after it has been configured. The render() method has a specific call chain that will execute
-* when the method is called: renderHeader, renderBody, renderFooter.
-* Refer to the documentation for those methods for information on 
-* individual render tasks.
-* @method render
-*/
-YAHOO.widget.Calendar.prototype.render = function() {
-	this.beforeRenderEvent.fire();
-
-	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
-
-	// Find starting day of the current month
-	var workingDate = YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty(defCfg.PAGEDATE.key));
-
-	this.resetRenderers();
-	this.cellDates.length = 0;
-
-	YAHOO.util.Event.purgeElement(this.oDomContainer, true);
-
-	var html = [];
-
-	html[html.length] = '<table cellSpacing="0" class="' + this.Style.CSS_CALENDAR + ' y' + workingDate.getFullYear() + '" id="' + this.id + '">';
-	html = this.renderHeader(html);
-	html = this.renderBody(workingDate, html);
-	html = this.renderFooter(html);
-	html[html.length] = '</table>';
-
-	this.oDomContainer.innerHTML = html.join("\n");
+	
+		html[html.length] = '</tbody>';
+	
+		return html;
+	},
+	
+	/**
+	* Renders the calendar footer. In the default implementation, there is
+	* no footer.
+	* @method renderFooter
+	* @param {Array}	html	The current working HTML array
+	* @return {Array} The current working HTML array
+	*/
+	renderFooter : function(html) { return html; },
+	
+	/**
+	* Renders the calendar after it has been configured. The render() method has a specific call chain that will execute
+	* when the method is called: renderHeader, renderBody, renderFooter.
+	* Refer to the documentation for those methods for information on 
+	* individual render tasks.
+	* @method render
+	*/
+	render : function() {
+		this.beforeRenderEvent.fire();
+	
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+	
+		// Find starting day of the current month
+		var workingDate = YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty(defCfg.PAGEDATE.key));
+	
+		this.resetRenderers();
+		this.cellDates.length = 0;
 
-	this.applyListeners();
-	this.cells = this.oDomContainer.getElementsByTagName("td");
+		YAHOO.util.Event.purgeElement(this.oDomContainer, true);
 
-	this.cfg.refireEvent(defCfg.TITLE.key);
-	this.cfg.refireEvent(defCfg.CLOSE.key);
-	this.cfg.refireEvent(defCfg.IFRAME.key);
+		var html = [];
+	
+		html[html.length] = '<table cellSpacing="0" class="' + this.Style.CSS_CALENDAR + ' y' + workingDate.getFullYear() + '" id="' + this.id + '">';
+		html = this.renderHeader(html);
+		html = this.renderBody(workingDate, html);
+		html = this.renderFooter(html);
+		html[html.length] = '</table>';
 
-	this.renderEvent.fire();
-};
+		this.oDomContainer.innerHTML = html.join("\n");
 
-/**
-* Applies the Calendar's DOM listeners to applicable elements.
-* @method applyListeners
-*/
-YAHOO.widget.Calendar.prototype.applyListeners = function() {
+		this.applyListeners();
+		this.cells = this.oDomContainer.getElementsByTagName("td");
 	
-	var root = this.oDomContainer;
-	var cal = this.parent || this;
+		this.cfg.refireEvent(defCfg.TITLE.key);
+		this.cfg.refireEvent(defCfg.CLOSE.key);
+		this.cfg.refireEvent(defCfg.IFRAME.key);
 	
-	var anchor = "a";
-	var mousedown = "mousedown";
-
-	var linkLeft = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, anchor, root);
-	var linkRight = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, anchor, root);
+		this.renderEvent.fire();
+	},
 
-	if (linkLeft && linkLeft.length > 0) {
-		this.linkLeft = linkLeft[0];
-		YAHOO.util.Event.addListener(this.linkLeft, mousedown, cal.previousMonth, cal, true);
-	}
+	/**
+	* Applies the Calendar's DOM listeners to applicable elements.
+	* @method applyListeners
+	*/
+	applyListeners : function() {
+		var root = this.oDomContainer;
+		var cal = this.parent || this;
+		var anchor = "a";
+		var mousedown = "mousedown";
 
-	if (linkRight && linkRight.length > 0) {
-		this.linkRight = linkRight[0];
-		YAHOO.util.Event.addListener(this.linkRight, mousedown, cal.nextMonth, cal, true);
-	}
+		var linkLeft = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, anchor, root);
+		var linkRight = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, anchor, root);
+	
+		if (linkLeft && linkLeft.length > 0) {
+			this.linkLeft = linkLeft[0];
+			YAHOO.util.Event.addListener(this.linkLeft, mousedown, cal.previousMonth, cal, true);
+		}
 
-	if (this.domEventMap) {
-		var el,elements;
-		for (var cls in this.domEventMap) {	
-			if (YAHOO.lang.hasOwnProperty(this.domEventMap, cls)) {
-				var items = this.domEventMap[cls];
+		if (linkRight && linkRight.length > 0) {
+			this.linkRight = linkRight[0];
+			YAHOO.util.Event.addListener(this.linkRight, mousedown, cal.nextMonth, cal, true);
+		}
 
-				if (! (items instanceof Array)) {
-					items = [items];
-				}
+		if (cal.cfg.getProperty("navigator") !== null) {
+			this.applyNavListeners();
+		}
 
-				for (var i=0;i<items.length;i++)	{
-					var item = items[i];
-					elements = YAHOO.util.Dom.getElementsByClassName(cls, item.tag, this.oDomContainer);
-
-					for (var c=0;c<elements.length;c++) {
-						el = elements[c];
-						 YAHOO.util.Event.addListener(el, item.event, item.handler, item.scope, item.correct );
+		if (this.domEventMap) {
+			var el,elements;
+			for (var cls in this.domEventMap) {	
+				if (YAHOO.lang.hasOwnProperty(this.domEventMap, cls)) {
+					var items = this.domEventMap[cls];
+	
+					if (! (items instanceof Array)) {
+						items = [items];
+					}
+	
+					for (var i=0;i<items.length;i++)	{
+						var item = items[i];
+						elements = YAHOO.util.Dom.getElementsByClassName(cls, item.tag, this.oDomContainer);
+	
+						for (var c=0;c<elements.length;c++) {
+							el = elements[c];
+							 YAHOO.util.Event.addListener(el, item.event, item.handler, item.scope, item.correct );
+						}
 					}
 				}
 			}
 		}
-	}
-
-	YAHOO.util.Event.addListener(this.oDomContainer, "click", this.doSelectCell, this);
-	YAHOO.util.Event.addListener(this.oDomContainer, "mouseover", this.doCellMouseOver, this);
-	YAHOO.util.Event.addListener(this.oDomContainer, "mouseout", this.doCellMouseOut, this);
-};
+	
+		YAHOO.util.Event.addListener(this.oDomContainer, "click", this.doSelectCell, this);
+		YAHOO.util.Event.addListener(this.oDomContainer, "mouseover", this.doCellMouseOver, this);
+		YAHOO.util.Event.addListener(this.oDomContainer, "mouseout", this.doCellMouseOut, this);
+	},
 
-/**
-* Retrieves the Date object for the specified Calendar cell
-* @method getDateByCellId
-* @param {String}	id	The id of the cell
-* @return {Date} The Date object for the specified Calendar cell
-*/
-YAHOO.widget.Calendar.prototype.getDateByCellId = function(id) {
-	var date = this.getDateFieldsByCellId(id);
-	return new Date(date[0],date[1]-1,date[2]);
-};
+	applyNavListeners : function() {
 
-/**
-* Retrieves the Date object for the specified Calendar cell
-* @method getDateFieldsByCellId
-* @param {String}	id	The id of the cell
-* @return {Array}	The array of Date fields for the specified Calendar cell
-*/
-YAHOO.widget.Calendar.prototype.getDateFieldsByCellId = function(id) {
-	id = id.toLowerCase().split("_cell")[1];
-	id = parseInt(id, 10);
-	return this.cellDates[id];
-};
+		var E = YAHOO.util.Event;
 
-// BEGIN BUILT-IN TABLE CELL RENDERERS
+		var calParent = this.parent || this;
+		var cal = this;
 
-/**
-* Renders a cell that falls before the minimum date or after the maximum date.
-* widget class.
-* @method renderOutOfBoundsDate
-* @param {Date}					workingDate		The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
-* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
-*			should not be terminated
-*/
-YAHOO.widget.Calendar.prototype.renderOutOfBoundsDate = function(workingDate, cell) {
-	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOB);
-	cell.innerHTML = workingDate.getDate();
-	return YAHOO.widget.Calendar.STOP_RENDER;
-};
+		var navBtns = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV, "a", this.oDomContainer);
 
-/**
-* Renders the row header for a week.
-* @method renderRowHeader
-* @param {Number}	weekNum	The week number of the current row
-* @param {Array}	cell	The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.renderRowHeader = function(weekNum, html) {
-	html[html.length] = '<th class="calrowhead">' + weekNum + '</th>';
-	return html;
-};
+		if (navBtns.length > 0) {
 
-/**
-* Renders the row footer for a week.
-* @method renderRowFooter
-* @param {Number}	weekNum	The week number of the current row
-* @param {Array}	cell	The current working HTML array
-*/
-YAHOO.widget.Calendar.prototype.renderRowFooter = function(weekNum, html) {
-	html[html.length] = '<th class="calrowfoot">' + weekNum + '</th>';
-	return html;
-};
+			function show(e, obj) {
+				var target = E.getTarget(e);
+				// this == navBtn
+				if (this === target || YAHOO.util.Dom.isAncestor(this, target)) {
+					E.preventDefault(e);
+				}
+				var navigator = calParent.oNavigator;
+				if (navigator) {
+					var pgdate = cal.cfg.getProperty("pagedate");
+					navigator.setYear(pgdate.getFullYear());
+					navigator.setMonth(pgdate.getMonth());
+					navigator.show();
+				}
+			}
+			E.addListener(navBtns, "click", show);
+		}
+	},
 
-/**
-* Renders a single standard calendar cell in the calendar widget table.
-* All logic for determining how a standard default cell will be rendered is 
-* encapsulated in this method, and must be accounted for when extending the
-* widget class.
-* @method renderCellDefault
-* @param {Date}					workingDate		The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellDefault = function(workingDate, cell) {
-	cell.innerHTML = '<a href="#" class="' + this.Style.CSS_CELL_SELECTOR + '">' + this.buildDayLabel(workingDate) + "</a>";
-};
-
-/**
-* Styles a selectable cell.
-* @method styleCellDefault
-* @param {Date}					workingDate		The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.styleCellDefault = function(workingDate, cell) {
-	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTABLE);
-};
-
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight1 style
-* @method renderCellStyleHighlight1
-* @param {Date}					workingDate		The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight1 = function(workingDate, cell) {
-	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);
-};
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight2 style
-* @method renderCellStyleHighlight2
-* @param {Date}					workingDate		The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight2 = function(workingDate, cell) {
-	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);
-};
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight3 style
-* @method renderCellStyleHighlight3
-* @param {Date}					workingDate		The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight3 = function(workingDate, cell) {
-	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);
-};
-
-/**
-* Renders a single standard calendar cell using the CSS hightlight4 style
-* @method renderCellStyleHighlight4
-* @param {Date}					workingDate		The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleHighlight4 = function(workingDate, cell) {
-	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
-};
-
-/**
-* Applies the default style used for rendering today's date to the current calendar cell
-* @method renderCellStyleToday
-* @param {Date}					workingDate		The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleToday = function(workingDate, cell) {
-	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TODAY);
-};
-
-/**
-* Applies the default style used for rendering selected dates to the current calendar cell
-* @method renderCellStyleSelected
-* @param {Date}					workingDate		The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
-* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
-*			should not be terminated
-*/
-YAHOO.widget.Calendar.prototype.renderCellStyleSelected = function(workingDate, cell) {
-	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);
-};
-
-/**
-* Applies the default style used for rendering dates that are not a part of the current
-* month (preceding or trailing the cells for the current month)
-* @method renderCellNotThisMonth
-* @param {Date}					workingDate		The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
-* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
-*			should not be terminated
-*/
-YAHOO.widget.Calendar.prototype.renderCellNotThisMonth = function(workingDate, cell) {
-	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);
-	cell.innerHTML=workingDate.getDate();
-	return YAHOO.widget.Calendar.STOP_RENDER;
-};
-
-/**
-* Renders the current calendar cell as a non-selectable "black-out" date using the default
-* restricted style.
-* @method renderBodyCellRestricted
-* @param {Date}					workingDate		The current working Date object being used to generate the calendar
-* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
-* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
-*			should not be terminated
-*/
-YAHOO.widget.Calendar.prototype.renderBodyCellRestricted = function(workingDate, cell) {
-	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);
-	YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
-	cell.innerHTML=workingDate.getDate();
-	return YAHOO.widget.Calendar.STOP_RENDER;
-};
-
-// END BUILT-IN TABLE CELL RENDERERS
-
-// BEGIN MONTH NAVIGATION METHODS
-
-/**
-* Adds the designated number of months to the current calendar month, and sets the current
-* calendar page date to the new month.
-* @method addMonths
-* @param {Number}	count	The number of months to add to the current calendar
-*/
-YAHOO.widget.Calendar.prototype.addMonths = function(count) {
-	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
-	this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.MONTH, count));
-	this.resetRenderers();
-	this.changePageEvent.fire();
-};
-
-/**
-* Subtracts the designated number of months from the current calendar month, and sets the current
-* calendar page date to the new month.
-* @method subtractMonths
-* @param {Number}	count	The number of months to subtract from the current calendar
-*/
-YAHOO.widget.Calendar.prototype.subtractMonths = function(count) {
-	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
-	this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.MONTH, count));
-	this.resetRenderers();
-	this.changePageEvent.fire();
-};
-
-/**
-* Adds the designated number of years to the current calendar, and sets the current
-* calendar page date to the new month.
-* @method addYears
-* @param {Number}	count	The number of years to add to the current calendar
-*/
-YAHOO.widget.Calendar.prototype.addYears = function(count) {
-	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
-	this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.YEAR, count));
-	this.resetRenderers();
-	this.changePageEvent.fire();
-};
-
-/**
-* Subtcats the designated number of years from the current calendar, and sets the current
-* calendar page date to the new month.
-* @method subtractYears
-* @param {Number}	count	The number of years to subtract from the current calendar
-*/
-YAHOO.widget.Calendar.prototype.subtractYears = function(count) {
-	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
-	this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.YEAR, count));
-	this.resetRenderers();
-	this.changePageEvent.fire();
-};
-
-/**
-* Navigates to the next month page in the calendar widget.
-* @method nextMonth
-*/
-YAHOO.widget.Calendar.prototype.nextMonth = function() {
-	this.addMonths(1);
-};
-
-/**
-* Navigates to the previous month page in the calendar widget.
-* @method previousMonth
-*/
-YAHOO.widget.Calendar.prototype.previousMonth = function() {
-	this.subtractMonths(1);
-};
-
-/**
-* Navigates to the next year in the currently selected month in the calendar widget.
-* @method nextYear
-*/
-YAHOO.widget.Calendar.prototype.nextYear = function() {
-	this.addYears(1);
-};
-
-/**
-* Navigates to the previous year in the currently selected month in the calendar widget.
-* @method previousYear
-*/
-YAHOO.widget.Calendar.prototype.previousYear = function() {
-	this.subtractYears(1);
-};
-
-// END MONTH NAVIGATION METHODS
-
-// BEGIN SELECTION METHODS
-
-/**
-* Resets the calendar widget to the originally selected month and year, and 
-* sets the calendar to the initial selection(s).
-* @method reset
-*/
-YAHOO.widget.Calendar.prototype.reset = function() {
-	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
-	this.cfg.resetProperty(defCfg.SELECTED.key);
-	this.cfg.resetProperty(defCfg.PAGEDATE.key);
-	this.resetEvent.fire();
-};
-
-/**
-* Clears the selected dates in the current calendar widget and sets the calendar
-* to the current month and year.
-* @method clear
-*/
-YAHOO.widget.Calendar.prototype.clear = function() {
-	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
-	this.cfg.setProperty(defCfg.SELECTED.key, []);
-	this.cfg.setProperty(defCfg.PAGEDATE.key, new Date(this.today.getTime()));
-	this.clearEvent.fire();
-};
-
-/**
-* Selects a date or a collection of dates on the current calendar. This method, by default,
-* does not call the render method explicitly. Once selection has completed, render must be 
-* called for the changes to be reflected visually.
-* @method select
-* @param	{String/Date/Date[]}	date	The date string of dates to select in the current calendar. Valid formats are
-*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
-*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
-*								This method can also take a JavaScript Date object or an array of Date objects.
-* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
-*/
-YAHOO.widget.Calendar.prototype.select = function(date) {
-	this.beforeSelectEvent.fire();
+	/**
+	* Retrieves the Date object for the specified Calendar cell
+	* @method getDateByCellId
+	* @param {String}	id	The id of the cell
+	* @return {Date} The Date object for the specified Calendar cell
+	*/
+	getDateByCellId : function(id) {
+		var date = this.getDateFieldsByCellId(id);
+		return YAHOO.widget.DateMath.getDate(date[0],date[1]-1,date[2]);
+	},
 	
-	var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
-
-	var selected = this.cfg.getProperty(cfgSelected);
-	var aToBeSelected = this._toFieldArray(date);
-
-	for (var a=0;a<aToBeSelected.length;++a) {
-		var toSelect = aToBeSelected[a]; // For each date item in the list of dates we're trying to select
-		if (this._indexOfSelectedFieldArray(toSelect) == -1) { // not already selected?
-			selected[selected.length]=toSelect;
+	/**
+	* Retrieves the Date object for the specified Calendar cell
+	* @method getDateFieldsByCellId
+	* @param {String}	id	The id of the cell
+	* @return {Array}	The array of Date fields for the specified Calendar cell
+	*/
+	getDateFieldsByCellId : function(id) {
+		id = id.toLowerCase().split("_cell")[1];
+		id = parseInt(id, 10);
+		return this.cellDates[id];
+	},
+	
+	/**
+	 * Find the Calendar's cell index for a given date.
+	 * If the date is not found, the method returns -1.
+	 * <p>
+	 * The returned index can be used to lookup the cell HTMLElement  
+	 * using the Calendar's cells array or passed to selectCell to select 
+	 * cells by index. 
+	 * </p>
+	 *
+	 * See <a href="#cells">cells</a>, <a href="#selectCell">selectCell</a>.
+	 *
+	 * @method getCellIndex
+	 * @param {Date} date JavaScript Date object, for which to find a cell index.
+	 * @return {Number} The index of the date in Calendars cellDates/cells arrays, or -1 if the date 
+	 * is not on the curently rendered Calendar page.
+	 */
+	getCellIndex : function(date) {
+		var idx = -1;
+		if (date) {
+			var m = date.getMonth(),
+				y = date.getFullYear(),
+				d = date.getDate(),
+				dates = this.cellDates;
+
+			for (var i = 0; i < dates.length; ++i) {
+				var cellDate = dates[i];
+				if (cellDate[0] === y && cellDate[1] === m+1 && cellDate[2] === d) {
+					idx = i;
+					break;
+				}
+			}
 		}
-	}
+		return idx;
+	},
 	
-	if (this.parent) {
-		this.parent.cfg.setProperty(cfgSelected, selected);
-	} else {
-		this.cfg.setProperty(cfgSelected, selected);
-	}
-
-	this.selectEvent.fire(aToBeSelected);
+	// BEGIN BUILT-IN TABLE CELL RENDERERS
 	
-	return this.getSelectedDates();
-};
-
-/**
-* Selects a date on the current calendar by referencing the index of the cell that should be selected.
-* This method is used to easily select a single cell (usually with a mouse click) without having to do
-* a full render. The selected style is applied to the cell directly.
-* @method selectCell
-* @param	{Number}	cellIndex	The index of the cell to select in the current calendar. 
-* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
-*/
-YAHOO.widget.Calendar.prototype.selectCell = function(cellIndex) {
-	this.beforeSelectEvent.fire();
+	/**
+	* Renders a cell that falls before the minimum date or after the maximum date.
+	* widget class.
+	* @method renderOutOfBoundsDate
+	* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+	* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+	* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+	*			should not be terminated
+	*/
+	renderOutOfBoundsDate : function(workingDate, cell) {
+		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOB);
+		cell.innerHTML = workingDate.getDate();
+		return YAHOO.widget.Calendar.STOP_RENDER;
+	},
 	
-	var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
-	var selected = this.cfg.getProperty(cfgSelected);
-
-	var cell = this.cells[cellIndex];
-	var cellDate = this.cellDates[cellIndex];
-
-	var dCellDate = this._toDate(cellDate);
-
-	var selectDate = cellDate.concat();
-
-	if (this._indexOfSelectedFieldArray(selectDate) == -1) {
-		selected[selected.length] = selectDate;
-	}
-
-	if (this.parent) {
-		this.parent.cfg.setProperty(cfgSelected, selected);
-	} else {
-		this.cfg.setProperty(cfgSelected, selected);
-	}
-
-	this.renderCellStyleSelected(dCellDate,cell);
-
-	this.selectEvent.fire([selectDate]);
-
-	this.doCellMouseOut.call(cell, null, this);
-
-	return this.getSelectedDates();
-};
-
-/**
-* Deselects a date or a collection of dates on the current calendar. This method, by default,
-* does not call the render method explicitly. Once deselection has completed, render must be 
-* called for the changes to be reflected visually.
-* @method deselect
-* @param	{String/Date/Date[]}	date	The date string of dates to deselect in the current calendar. Valid formats are
-*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
-*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
-*								This method can also take a JavaScript Date object or an array of Date objects.	
-* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
-*/
-YAHOO.widget.Calendar.prototype.deselect = function(date) {
-	this.beforeDeselectEvent.fire();
-	var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
-
-	var selected = this.cfg.getProperty(cfgSelected);
-
-	var aToBeSelected = this._toFieldArray(date);
+	/**
+	* Renders the row header for a week.
+	* @method renderRowHeader
+	* @param {Number}	weekNum	The week number of the current row
+	* @param {Array}	cell	The current working HTML array
+	*/
+	renderRowHeader : function(weekNum, html) {
+		html[html.length] = '<th class="calrowhead">' + weekNum + '</th>';
+		return html;
+	},
+	
+	/**
+	* Renders the row footer for a week.
+	* @method renderRowFooter
+	* @param {Number}	weekNum	The week number of the current row
+	* @param {Array}	cell	The current working HTML array
+	*/
+	renderRowFooter : function(weekNum, html) {
+		html[html.length] = '<th class="calrowfoot">' + weekNum + '</th>';
+		return html;
+	},
+	
+	/**
+	* Renders a single standard calendar cell in the calendar widget table.
+	* All logic for determining how a standard default cell will be rendered is 
+	* encapsulated in this method, and must be accounted for when extending the
+	* widget class.
+	* @method renderCellDefault
+	* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+	* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+	*/
+	renderCellDefault : function(workingDate, cell) {
+		cell.innerHTML = '<a href="#" class="' + this.Style.CSS_CELL_SELECTOR + '">' + this.buildDayLabel(workingDate) + "</a>";
+	},
+	
+	/**
+	* Styles a selectable cell.
+	* @method styleCellDefault
+	* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+	* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+	*/
+	styleCellDefault : function(workingDate, cell) {
+		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTABLE);
+	},
+	
+	
+	/**
+	* Renders a single standard calendar cell using the CSS hightlight1 style
+	* @method renderCellStyleHighlight1
+	* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+	* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+	*/
+	renderCellStyleHighlight1 : function(workingDate, cell) {
+		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);
+	},
+	
+	/**
+	* Renders a single standard calendar cell using the CSS hightlight2 style
+	* @method renderCellStyleHighlight2
+	* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+	* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+	*/
+	renderCellStyleHighlight2 : function(workingDate, cell) {
+		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);
+	},
+	
+	/**
+	* Renders a single standard calendar cell using the CSS hightlight3 style
+	* @method renderCellStyleHighlight3
+	* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+	* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+	*/
+	renderCellStyleHighlight3 : function(workingDate, cell) {
+		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);
+	},
+	
+	/**
+	* Renders a single standard calendar cell using the CSS hightlight4 style
+	* @method renderCellStyleHighlight4
+	* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+	* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+	*/
+	renderCellStyleHighlight4 : function(workingDate, cell) {
+		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
+	},
+	
+	/**
+	* Applies the default style used for rendering today's date to the current calendar cell
+	* @method renderCellStyleToday
+	* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+	* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+	*/
+	renderCellStyleToday : function(workingDate, cell) {
+		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TODAY);
+	},
+	
+    /**
+    * Styles an out of month cell.
+    * @method renderCellStyleNotThisMonth
+    * @param {Date}					workingDate		The current working Date object being used to generate the calendar
+    * @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+    */
+    renderCellStyleNotThisMonth : function(workingDate, cell) {
+        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);
+    },
 
-	for (var a=0;a<aToBeSelected.length;++a) {
-		var toSelect = aToBeSelected[a]; // For each date item in the list of dates we're trying to select
-		var index = this._indexOfSelectedFieldArray(toSelect);
+	/**
+	* Applies the default style used for rendering selected dates to the current calendar cell
+	* @method renderCellStyleSelected
+	* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+	* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+	* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+	*			should not be terminated
+	*/
+	renderCellStyleSelected : function(workingDate, cell) {
+		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);
+	},
+	
+	/**
+	* Applies the default style used for rendering dates that are not a part of the current
+	* month (preceding or trailing the cells for the current month)
+	* @method renderCellNotThisMonth
+	* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+	* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+	* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+	*			should not be terminated
+	*/
+	renderCellNotThisMonth : function(workingDate, cell) {
+		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);
+		cell.innerHTML=workingDate.getDate();
+		return YAHOO.widget.Calendar.STOP_RENDER;
+	},
+	
+	/**
+	* Renders the current calendar cell as a non-selectable "black-out" date using the default
+	* restricted style.
+	* @method renderBodyCellRestricted
+	* @param {Date}					workingDate		The current working Date object being used to generate the calendar
+	* @param {HTMLTableCellElement}	cell			The current working cell in the calendar
+	* @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
+	*			should not be terminated
+	*/
+	renderBodyCellRestricted : function(workingDate, cell) {
+		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);
+		YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
+		cell.innerHTML=workingDate.getDate();
+		return YAHOO.widget.Calendar.STOP_RENDER;
+	},
+	
+	// END BUILT-IN TABLE CELL RENDERERS
+	
+	// BEGIN MONTH NAVIGATION METHODS
+	
+	/**
+	* Adds the designated number of months to the current calendar month, and sets the current
+	* calendar page date to the new month.
+	* @method addMonths
+	* @param {Number}	count	The number of months to add to the current calendar
+	*/
+	addMonths : function(count) {
+		var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+		this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.MONTH, count));
+		this.resetRenderers();
+		this.changePageEvent.fire();
+	},
+	
+	/**
+	* Subtracts the designated number of months from the current calendar month, and sets the current
+	* calendar page date to the new month.
+	* @method subtractMonths
+	* @param {Number}	count	The number of months to subtract from the current calendar
+	*/
+	subtractMonths : function(count) {
+		var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+		this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.MONTH, count));
+		this.resetRenderers();
+		this.changePageEvent.fire();
+	},
+	
+	/**
+	* Adds the designated number of years to the current calendar, and sets the current
+	* calendar page date to the new month.
+	* @method addYears
+	* @param {Number}	count	The number of years to add to the current calendar
+	*/
+	addYears : function(count) {
+		var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+		this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.YEAR, count));
+		this.resetRenderers();
+		this.changePageEvent.fire();
+	},
+	
+	/**
+	* Subtcats the designated number of years from the current calendar, and sets the current
+	* calendar page date to the new month.
+	* @method subtractYears
+	* @param {Number}	count	The number of years to subtract from the current calendar
+	*/
+	subtractYears : function(count) {
+		var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+		this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.YEAR, count));
+		this.resetRenderers();
+		this.changePageEvent.fire();
+	},
+	
+	/**
+	* Navigates to the next month page in the calendar widget.
+	* @method nextMonth
+	*/
+	nextMonth : function() {
+		this.addMonths(1);
+	},
+	
+	/**
+	* Navigates to the previous month page in the calendar widget.
+	* @method previousMonth
+	*/
+	previousMonth : function() {
+		this.subtractMonths(1);
+	},
+	
+	/**
+	* Navigates to the next year in the currently selected month in the calendar widget.
+	* @method nextYear
+	*/
+	nextYear : function() {
+		this.addYears(1);
+	},
+	
+	/**
+	* Navigates to the previous year in the currently selected month in the calendar widget.
+	* @method previousYear
+	*/
+	previousYear : function() {
+		this.subtractYears(1);
+	},
+	
+	// END MONTH NAVIGATION METHODS
+	
+	// BEGIN SELECTION METHODS
 	
-		if (index != -1) {	
-			selected.splice(index,1);
+	/**
+	* Resets the calendar widget to the originally selected month and year, and 
+	* sets the calendar to the initial selection(s).
+	* @method reset
+	*/
+	reset : function() {
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+		this.cfg.resetProperty(defCfg.SELECTED.key);
+		this.cfg.resetProperty(defCfg.PAGEDATE.key);
+		this.resetEvent.fire();
+	},
+	
+	/**
+	* Clears the selected dates in the current calendar widget and sets the calendar
+	* to the current month and year.
+	* @method clear
+	*/
+	clear : function() {
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+		this.cfg.setProperty(defCfg.SELECTED.key, []);
+		this.cfg.setProperty(defCfg.PAGEDATE.key, new Date(this.today.getTime()));
+		this.clearEvent.fire();
+	},
+	
+	/**
+	* Selects a date or a collection of dates on the current calendar. This method, by default,
+	* does not call the render method explicitly. Once selection has completed, render must be 
+	* called for the changes to be reflected visually.
+	*
+	* Any dates which are OOB (out of bounds, not selectable) will not be selected and the array of 
+	* selected dates passed to the selectEvent will not contain OOB dates.
+	* 
+	* If all dates are OOB, the no state change will occur; beforeSelect and select events will not be fired.
+	*
+	* @method select
+	* @param	{String/Date/Date[]}	date	The date string of dates to select in the current calendar. Valid formats are
+	*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+	*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+	*								This method can also take a JavaScript Date object or an array of Date objects.
+	* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
+	*/
+	select : function(date) {
+	
+		var aToBeSelected = this._toFieldArray(date);
+	
+		// Filtered array of valid dates
+		var validDates = [];
+		var selected = [];
+		var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
+		
+		for (var a=0; a < aToBeSelected.length; ++a) {
+			var toSelect = aToBeSelected[a];
+	
+			if (!this.isDateOOB(this._toDate(toSelect))) {
+				
+				if (validDates.length === 0) {
+					this.beforeSelectEvent.fire();
+					selected = this.cfg.getProperty(cfgSelected);
+				}
+	
+				validDates.push(toSelect);
+				
+				if (this._indexOfSelectedFieldArray(toSelect) == -1) { 
+					selected[selected.length] = toSelect;
+				}
+			}
 		}
-	}
-
-	if (this.parent) {
-		this.parent.cfg.setProperty(cfgSelected, selected);
-	} else {
-		this.cfg.setProperty(cfgSelected, selected);
-	}
-
-	this.deselectEvent.fire(aToBeSelected);
+		
 	
-	return this.getSelectedDates();
-};
-
-/**
-* Deselects a date on the current calendar by referencing the index of the cell that should be deselected.
-* This method is used to easily deselect a single cell (usually with a mouse click) without having to do
-* a full render. The selected style is removed from the cell directly.
-* @method deselectCell
-* @param	{Number}	cellIndex	The index of the cell to deselect in the current calendar. 
-* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
-*/
-YAHOO.widget.Calendar.prototype.deselectCell = function(i) {
-	this.beforeDeselectEvent.fire();
+		if (validDates.length > 0) {
+			if (this.parent) {
+				this.parent.cfg.setProperty(cfgSelected, selected);
+			} else {
+				this.cfg.setProperty(cfgSelected, selected);
+			}
+			this.selectEvent.fire(validDates);
+		}
 	
-	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+		return this.getSelectedDates();
+	},
 	
-	var selected = this.cfg.getProperty(defCfg.SELECTED.key);
-
-	var cell = this.cells[i];
-	var cellDate = this.cellDates[i];
-	var cellDateIndex = this._indexOfSelectedFieldArray(cellDate);
-
-	var dCellDate = this._toDate(cellDate);
-
-	var selectDate = cellDate.concat();
-
-	if (cellDateIndex > -1) {
-		if (this.cfg.getProperty(defCfg.PAGEDATE.key).getMonth() == dCellDate.getMonth() &&
-			this.cfg.getProperty(defCfg.PAGEDATE.key).getFullYear() == dCellDate.getFullYear()) {
-			YAHOO.util.Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
+	/**
+	* Selects a date on the current calendar by referencing the index of the cell that should be selected.
+	* This method is used to easily select a single cell (usually with a mouse click) without having to do
+	* a full render. The selected style is applied to the cell directly.
+	*
+	* If the cell is not marked with the CSS_CELL_SELECTABLE class (as is the case by default for out of month 
+	* or out of bounds cells), it will not be selected and in such a case beforeSelect and select events will not be fired.
+	* 
+	* @method selectCell
+	* @param	{Number}	cellIndex	The index of the cell to select in the current calendar. 
+	* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
+	*/
+	selectCell : function(cellIndex) {
+	
+		var cell = this.cells[cellIndex];
+		var cellDate = this.cellDates[cellIndex];
+		var dCellDate = this._toDate(cellDate);
+		
+		var selectable = YAHOO.util.Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
+	
+		if (selectable) {
+	
+			this.beforeSelectEvent.fire();
+	
+			var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
+			var selected = this.cfg.getProperty(cfgSelected);
+	
+			var selectDate = cellDate.concat();
+	
+			if (this._indexOfSelectedFieldArray(selectDate) == -1) {
+				selected[selected.length] = selectDate;
+			}
+			if (this.parent) {
+				this.parent.cfg.setProperty(cfgSelected, selected);
+			} else {
+				this.cfg.setProperty(cfgSelected, selected);
+			}
+			this.renderCellStyleSelected(dCellDate,cell);
+			this.selectEvent.fire([selectDate]);
+	
+			this.doCellMouseOut.call(cell, null, this);		
 		}
-
-		selected.splice(cellDateIndex, 1);
-	}
-
-	if (this.parent) {
-		this.parent.cfg.setProperty(defCfg.SELECTED.key, selected);
-	} else {
-		this.cfg.setProperty(defCfg.SELECTED.key, selected);
-	}
 	
-	this.deselectEvent.fire(selectDate);
-	return this.getSelectedDates();
-};
-
-/**
-* Deselects all dates on the current calendar.
-* @method deselectAll
-* @return {Date[]}		Array of JavaScript Date objects representing all individual dates that are currently selected.
-*						Assuming that this function executes properly, the return value should be an empty array.
-*						However, the empty array is returned for the sake of being able to check the selection status
-*						of the calendar.
-*/
-YAHOO.widget.Calendar.prototype.deselectAll = function() {
-	this.beforeDeselectEvent.fire();
+		return this.getSelectedDates();
+	},
 	
-	var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
-
-	var selected = this.cfg.getProperty(cfgSelected);
-	var count = selected.length;
-	var sel = selected.concat();
-
-	if (this.parent) {
-		this.parent.cfg.setProperty(cfgSelected, []);
-	} else {
-		this.cfg.setProperty(cfgSelected, []);
-	}
+	/**
+	* Deselects a date or a collection of dates on the current calendar. This method, by default,
+	* does not call the render method explicitly. Once deselection has completed, render must be 
+	* called for the changes to be reflected visually.
+	* 
+	* The method will not attempt to deselect any dates which are OOB (out of bounds, and hence not selectable) 
+	* and the array of deselected dates passed to the deselectEvent will not contain any OOB dates.
+	* 
+	* If all dates are OOB, beforeDeselect and deselect events will not be fired.
+	* 
+	* @method deselect
+	* @param	{String/Date/Date[]}	date	The date string of dates to deselect in the current calendar. Valid formats are
+	*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+	*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+	*								This method can also take a JavaScript Date object or an array of Date objects.	
+	* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
+	*/
+	deselect : function(date) {
+	
+		var aToBeDeselected = this._toFieldArray(date);
+	
+		var validDates = [];
+		var selected = [];
+		var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
+	
+		for (var a=0; a < aToBeDeselected.length; ++a) {
+			var toDeselect = aToBeDeselected[a];
+	
+			if (!this.isDateOOB(this._toDate(toDeselect))) {
+	
+				if (validDates.length === 0) {
+					this.beforeDeselectEvent.fire();
+					selected = this.cfg.getProperty(cfgSelected);
+				}
 	
-	if (count > 0) {
-		this.deselectEvent.fire(sel);
-	}
-
-	return this.getSelectedDates();
-};
-
-// END SELECTION METHODS
-
-// BEGIN TYPE CONVERSION METHODS
-
-/**
-* Converts a date (either a JavaScript Date object, or a date string) to the internal data structure
-* used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].
-* @method _toFieldArray
-* @private
-* @param	{String/Date/Date[]}	date	The date string of dates to deselect in the current calendar. Valid formats are
-*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
-*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
-*								This method can also take a JavaScript Date object or an array of Date objects.	
-* @return {Array[](Number[])}	Array of date field arrays
-*/
-YAHOO.widget.Calendar.prototype._toFieldArray = function(date) {
-	var returnDate = [];
-
-	if (date instanceof Date) {
-		returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];
-	} else if (YAHOO.lang.isString(date)) {
-		returnDate = this._parseDates(date);
-	} else if (YAHOO.lang.isArray(date)) {
-		for (var i=0;i<date.length;++i) {
-			var d = date[i];
-			returnDate[returnDate.length] = [d.getFullYear(),d.getMonth()+1,d.getDate()];
+				validDates.push(toDeselect);
+	
+				var index = this._indexOfSelectedFieldArray(toDeselect);
+				if (index != -1) {	
+					selected.splice(index,1);
+				}
+			}
 		}
-	}
 	
-	return returnDate;
-};
-
-/**
-* Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
-* @method _toDate
-* @private
-* @param	{Number[]}		dateFieldArray	The date field array to convert to a JavaScript Date.
-* @return	{Date}	JavaScript Date object representing the date field array
-*/
-YAHOO.widget.Calendar.prototype._toDate = function(dateFieldArray) {
-	if (dateFieldArray instanceof Date) {
-		return dateFieldArray;
-	} else {
-		return new Date(dateFieldArray[0],dateFieldArray[1]-1,dateFieldArray[2]);
-	}
-};
-
-// END TYPE CONVERSION METHODS 
-
-// BEGIN UTILITY METHODS
-
-/**
-* Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
-* @method _fieldArraysAreEqual
-* @private
-* @param	{Number[]}	array1	The first date field array to compare
-* @param	{Number[]}	array2	The first date field array to compare
-* @return	{Boolean}	The boolean that represents the equality of the two arrays
-*/
-YAHOO.widget.Calendar.prototype._fieldArraysAreEqual = function(array1, array2) {
-	var match = false;
-
-	if (array1[0]==array2[0]&&array1[1]==array2[1]&&array1[2]==array2[2]) {
-		match=true;	
-	}
-
-	return match;
-};
+	
+		if (validDates.length > 0) {
+			if (this.parent) {
+				this.parent.cfg.setProperty(cfgSelected, selected);
+			} else {
+				this.cfg.setProperty(cfgSelected, selected);
+			}
+			this.deselectEvent.fire(validDates);
+		}
+	
+		return this.getSelectedDates();
+	},
+	
+	/**
+	* Deselects a date on the current calendar by referencing the index of the cell that should be deselected.
+	* This method is used to easily deselect a single cell (usually with a mouse click) without having to do
+	* a full render. The selected style is removed from the cell directly.
+	* 
+	* If the cell is not marked with the CSS_CELL_SELECTABLE class (as is the case by default for out of month 
+	* or out of bounds cells), the method will not attempt to deselect it and in such a case, beforeDeselect and 
+	* deselect events will not be fired.
+	* 
+	* @method deselectCell
+	* @param	{Number}	cellIndex	The index of the cell to deselect in the current calendar. 
+	* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
+	*/
+	deselectCell : function(cellIndex) {
+		var cell = this.cells[cellIndex];
+		var cellDate = this.cellDates[cellIndex];
+		var cellDateIndex = this._indexOfSelectedFieldArray(cellDate);
+		
+		var selectable = YAHOO.util.Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
+	
+		if (selectable) {
+	
+			this.beforeDeselectEvent.fire();
+	
+			var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+			var selected = this.cfg.getProperty(defCfg.SELECTED.key);
+	
+			var dCellDate = this._toDate(cellDate);
+			var selectDate = cellDate.concat();
+	
+			if (cellDateIndex > -1) {
+				if (this.cfg.getProperty(defCfg.PAGEDATE.key).getMonth() == dCellDate.getMonth() &&
+					this.cfg.getProperty(defCfg.PAGEDATE.key).getFullYear() == dCellDate.getFullYear()) {
+					YAHOO.util.Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
+				}
+				selected.splice(cellDateIndex, 1);
+			}
+	
+			if (this.parent) {
+				this.parent.cfg.setProperty(defCfg.SELECTED.key, selected);
+			} else {
+				this.cfg.setProperty(defCfg.SELECTED.key, selected);
+			}
+	
+			this.deselectEvent.fire(selectDate);
+		}
+	
+		return this.getSelectedDates();
+	},
+	
+	/**
+	* Deselects all dates on the current calendar.
+	* @method deselectAll
+	* @return {Date[]}		Array of JavaScript Date objects representing all individual dates that are currently selected.
+	*						Assuming that this function executes properly, the return value should be an empty array.
+	*						However, the empty array is returned for the sake of being able to check the selection status
+	*						of the calendar.
+	*/
+	deselectAll : function() {
+		this.beforeDeselectEvent.fire();
+		
+		var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
+	
+		var selected = this.cfg.getProperty(cfgSelected);
+		var count = selected.length;
+		var sel = selected.concat();
+	
+		if (this.parent) {
+			this.parent.cfg.setProperty(cfgSelected, []);
+		} else {
+			this.cfg.setProperty(cfgSelected, []);
+		}
+		
+		if (count > 0) {
+			this.deselectEvent.fire(sel);
+		}
+	
+		return this.getSelectedDates();
+	},
+	
+	// END SELECTION METHODS
+	
+	// BEGIN TYPE CONVERSION METHODS
+	
+	/**
+	* Converts a date (either a JavaScript Date object, or a date string) to the internal data structure
+	* used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].
+	* @method _toFieldArray
+	* @private
+	* @param	{String/Date/Date[]}	date	The date string of dates to deselect in the current calendar. Valid formats are
+	*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+	*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+	*								This method can also take a JavaScript Date object or an array of Date objects.	
+	* @return {Array[](Number[])}	Array of date field arrays
+	*/
+	_toFieldArray : function(date) {
+		var returnDate = [];
+	
+		if (date instanceof Date) {
+			returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];
+		} else if (YAHOO.lang.isString(date)) {
+			returnDate = this._parseDates(date);
+		} else if (YAHOO.lang.isArray(date)) {
+			for (var i=0;i<date.length;++i) {
+				var d = date[i];
+				returnDate[returnDate.length] = [d.getFullYear(),d.getMonth()+1,d.getDate()];
+			}
+		}
+		
+		return returnDate;
+	},
+	
+	/**
+	* Converts a date field array [yyyy,mm,dd] to a JavaScript Date object. The date field array
+	* is the format in which dates are as provided as arguments to selectEvent and deselectEvent listeners.
+	* 
+	* @method toDate
+	* @param	{Number[]}	dateFieldArray	The date field array to convert to a JavaScript Date.
+	* @return	{Date}	JavaScript Date object representing the date field array.
+	*/
+	toDate : function(dateFieldArray) {
+		return this._toDate(dateFieldArray);
+	},
+	
+	/**
+	* Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
+	* @method _toDate
+	* @private
+	* @deprecated Made public, toDate 
+	* @param	{Number[]}		dateFieldArray	The date field array to convert to a JavaScript Date.
+	* @return	{Date}	JavaScript Date object representing the date field array
+	*/
+	_toDate : function(dateFieldArray) {
+		if (dateFieldArray instanceof Date) {
+			return dateFieldArray;
+		} else {
+			return YAHOO.widget.DateMath.getDate(dateFieldArray[0],dateFieldArray[1]-1,dateFieldArray[2]);
+		}
+	},
+	
+	// END TYPE CONVERSION METHODS 
+	
+	// BEGIN UTILITY METHODS
+	
+	/**
+	* Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
+	* @method _fieldArraysAreEqual
+	* @private
+	* @param	{Number[]}	array1	The first date field array to compare
+	* @param	{Number[]}	array2	The first date field array to compare
+	* @return	{Boolean}	The boolean that represents the equality of the two arrays
+	*/
+	_fieldArraysAreEqual : function(array1, array2) {
+		var match = false;
+	
+		if (array1[0]==array2[0]&&array1[1]==array2[1]&&array1[2]==array2[2]) {
+			match=true;	
+		}
+	
+		return match;
+	},
+	
+	/**
+	* Gets the index of a date field array [yyyy,mm,dd] in the current list of selected dates.
+	* @method	_indexOfSelectedFieldArray
+	* @private
+	* @param	{Number[]}		find	The date field array to search for
+	* @return	{Number}			The index of the date field array within the collection of selected dates.
+	*								-1 will be returned if the date is not found.
+	*/
+	_indexOfSelectedFieldArray : function(find) {
+		var selected = -1;
+		var seldates = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);
+	
+		for (var s=0;s<seldates.length;++s) {
+			var sArray = seldates[s];
+			if (find[0]==sArray[0]&&find[1]==sArray[1]&&find[2]==sArray[2]) {
+				selected = s;
+				break;
+			}
+		}
+	
+		return selected;
+	},
+	
+	/**
+	* Determines whether a given date is OOM (out of month).
+	* @method	isDateOOM
+	* @param	{Date}	date	The JavaScript Date object for which to check the OOM status
+	* @return	{Boolean}	true if the date is OOM
+	*/
+	isDateOOM : function(date) {
+		return (date.getMonth() != this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key).getMonth());
+	},
+	
+	/**
+	* Determines whether a given date is OOB (out of bounds - less than the mindate or more than the maxdate).
+	*
+	* @method	isDateOOB
+	* @param	{Date}	date	The JavaScript Date object for which to check the OOB status
+	* @return	{Boolean}	true if the date is OOB
+	*/
+	isDateOOB : function(date) {
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+		
+		var minDate = this.cfg.getProperty(defCfg.MINDATE.key);
+		var maxDate = this.cfg.getProperty(defCfg.MAXDATE.key);
+		var dm = YAHOO.widget.DateMath;
+		
+		if (minDate) {
+			minDate = dm.clearTime(minDate);
+		} 
+		if (maxDate) {
+			maxDate = dm.clearTime(maxDate);
+		}
+	
+		var clearedDate = new Date(date.getTime());
+		clearedDate = dm.clearTime(clearedDate);
+	
+		return ((minDate && clearedDate.getTime() < minDate.getTime()) || (maxDate && clearedDate.getTime() > maxDate.getTime()));
+	},
+	
+	/**
+	 * Parses a pagedate configuration property value. The value can either be specified as a string of form "mm/yyyy" or a Date object 
+	 * and is parsed into a Date object normalized to the first day of the month. If no value is passed in, the month and year from today's date are used to create the Date object 
+	 * @method	_parsePageDate
+	 * @private
+	 * @param {Date|String}	date	Pagedate value which needs to be parsed
+	 * @return {Date}	The Date object representing the pagedate
+	 */
+	_parsePageDate : function(date) {
+		var parsedDate;
+		
+		var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+	
+		if (date) {
+			if (date instanceof Date) {
+				parsedDate = YAHOO.widget.DateMath.findMonthStart(date);
+			} else {
+				var month, year, aMonthYear;
+				aMonthYear = date.split(this.cfg.getProperty(defCfg.DATE_FIELD_DELIMITER.key));
+				month = parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_MONTH_POSITION.key)-1], 10)-1;
+				year = parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_YEAR_POSITION.key)-1], 10);
 
-/**
-* Gets the index of a date field array [yyyy,mm,dd] in the current list of selected dates.
-* @method	_indexOfSelectedFieldArray
-* @private
-* @param	{Number[]}		find	The date field array to search for
-* @return	{Number}			The index of the date field array within the collection of selected dates.
-*								-1 will be returned if the date is not found.
-*/
-YAHOO.widget.Calendar.prototype._indexOfSelectedFieldArray = function(find) {
-	var selected = -1;
-	var seldates = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);
-
-	for (var s=0;s<seldates.length;++s) {
-		var sArray = seldates[s];
-		if (find[0]==sArray[0]&&find[1]==sArray[1]&&find[2]==sArray[2]) {
-			selected = s;
-			break;
+				parsedDate = YAHOO.widget.DateMath.getDate(year, month, 1);
+			}
+		} else {
+			parsedDate = YAHOO.widget.DateMath.getDate(this.today.getFullYear(), this.today.getMonth(), 1);
+		}
+		return parsedDate;
+	},
+	
+	// END UTILITY METHODS
+	
+	// BEGIN EVENT HANDLERS
+	
+	/**
+	* Event executed before a date is selected in the calendar widget.
+	* @deprecated Event handlers for this event should be susbcribed to beforeSelectEvent.
+	*/
+	onBeforeSelect : function() {
+		if (this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MULTI_SELECT.key) === false) {
+			if (this.parent) {
+				this.parent.callChildFunction("clearAllBodyCellStyles", this.Style.CSS_CELL_SELECTED);
+				this.parent.deselectAll();
+			} else {
+				this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);
+				this.deselectAll();
+			}
+		}
+	},
+	
+	/**
+	* Event executed when a date is selected in the calendar widget.
+	* @param	{Array}	selected	An array of date field arrays representing which date or dates were selected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
+	* @deprecated Event handlers for this event should be susbcribed to selectEvent.
+	*/
+	onSelect : function(selected) { },
+	
+	/**
+	* Event executed before a date is deselected in the calendar widget.
+	* @deprecated Event handlers for this event should be susbcribed to beforeDeselectEvent.
+	*/
+	onBeforeDeselect : function() { },
+	
+	/**
+	* Event executed when a date is deselected in the calendar widget.
+	* @param	{Array}	selected	An array of date field arrays representing which date or dates were deselected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
+	* @deprecated Event handlers for this event should be susbcribed to deselectEvent.
+	*/
+	onDeselect : function(deselected) { },
+	
+	/**
+	* Event executed when the user navigates to a different calendar page.
+	* @deprecated Event handlers for this event should be susbcribed to changePageEvent.
+	*/
+	onChangePage : function() {
+		this.render();
+	},
+	
+	/**
+	* Event executed when the calendar widget is rendered.
+	* @deprecated Event handlers for this event should be susbcribed to renderEvent.
+	*/
+	onRender : function() { },
+	
+	/**
+	* Event executed when the calendar widget is reset to its original state.
+	* @deprecated Event handlers for this event should be susbcribed to resetEvemt.
+	*/
+	onReset : function() { this.render(); },
+	
+	/**
+	* Event executed when the calendar widget is completely cleared to the current month with no selections.
+	* @deprecated Event handlers for this event should be susbcribed to clearEvent.
+	*/
+	onClear : function() { this.render(); },
+	
+	/**
+	* Validates the calendar widget. This method has no default implementation
+	* and must be extended by subclassing the widget.
+	* @return	Should return true if the widget validates, and false if
+	* it doesn't.
+	* @type Boolean
+	*/
+	validate : function() { return true; },
+	
+	// END EVENT HANDLERS
+	
+	// BEGIN DATE PARSE METHODS
+	
+	/**
+	* Converts a date string to a date field array
+	* @private
+	* @param	{String}	sDate			Date string. Valid formats are mm/dd and mm/dd/yyyy.
+	* @return				A date field array representing the string passed to the method
+	* @type Array[](Number[])
+	*/
+	_parseDate : function(sDate) {
+		var aDate = sDate.split(this.Locale.DATE_FIELD_DELIMITER);
+		var rArray;
+	
+		if (aDate.length == 2) {
+			rArray = [aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];
+			rArray.type = YAHOO.widget.Calendar.MONTH_DAY;
+		} else {
+			rArray = [aDate[this.Locale.MDY_YEAR_POSITION-1],aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];
+			rArray.type = YAHOO.widget.Calendar.DATE;
+		}
+	
+		for (var i=0;i<rArray.length;i++) {
+			rArray[i] = parseInt(rArray[i], 10);
+		}
+	
+		return rArray;
+	},
+	
+	/**
+	* Converts a multi or single-date string to an array of date field arrays
+	* @private
+	* @param	{String}	sDates		Date string with one or more comma-delimited dates. Valid formats are mm/dd, mm/dd/yyyy, mm/dd/yyyy-mm/dd/yyyy
+	* @return							An array of date field arrays
+	* @type Array[](Number[])
+	*/
+	_parseDates : function(sDates) {
+		var aReturn = [];
+	
+		var aDates = sDates.split(this.Locale.DATE_DELIMITER);
+		
+		for (var d=0;d<aDates.length;++d) {
+			var sDate = aDates[d];
+	
+			if (sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER) != -1) {
+				// This is a range
+				var aRange = sDate.split(this.Locale.DATE_RANGE_DELIMITER);
+	
+				var dateStart = this._parseDate(aRange[0]);
+				var dateEnd = this._parseDate(aRange[1]);
+	
+				var fullRange = this._parseRange(dateStart, dateEnd);
+				aReturn = aReturn.concat(fullRange);
+			} else {
+				// This is not a range
+				var aDate = this._parseDate(sDate);
+				aReturn.push(aDate);
+			}
+		}
+		return aReturn;
+	},
+	
+	/**
+	* Converts a date range to the full list of included dates
+	* @private
+	* @param	{Number[]}	startDate	Date field array representing the first date in the range
+	* @param	{Number[]}	endDate		Date field array representing the last date in the range
+	* @return							An array of date field arrays
+	* @type Array[](Number[])
+	*/
+	_parseRange : function(startDate, endDate) {
+		var dCurrent = YAHOO.widget.DateMath.add(YAHOO.widget.DateMath.getDate(startDate[0],startDate[1]-1,startDate[2]),YAHOO.widget.DateMath.DAY,1);
+		var dEnd     = YAHOO.widget.DateMath.getDate(endDate[0],  endDate[1]-1,  endDate[2]);
+	
+		var results = [];
+		results.push(startDate);
+		while (dCurrent.getTime() <= dEnd.getTime()) {
+			results.push([dCurrent.getFullYear(),dCurrent.getMonth()+1,dCurrent.getDate()]);
+			dCurrent = YAHOO.widget.DateMath.add(dCurrent,YAHOO.widget.DateMath.DAY,1);
 		}
-	}
-
-	return selected;
-};
-
-/**
-* Determines whether a given date is OOM (out of month).
-* @method	isDateOOM
-* @param	{Date}	date	The JavaScript Date object for which to check the OOM status
-* @return	{Boolean}	true if the date is OOM
-*/
-YAHOO.widget.Calendar.prototype.isDateOOM = function(date) {
-	return (date.getMonth() != this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key).getMonth());
-};
-
-/**
- * Parses a pagedate configuration property value. The value can either be specified as a string of form "mm/yyyy" or a Date object 
- * and is parsed into a Date object normalized to the first day of the month. If no value is passed in, the month and year from today's date are used to create the Date object 
- * @method	_parsePageDate
- * @private
- * @param {Date|String}	date	Pagedate value which needs to be parsed
- * @return {Date}	The Date object representing the pagedate
- */
-YAHOO.widget.Calendar.prototype._parsePageDate = function(date) {
-	var parsedDate;
+		return results;
+	},
+	
+	// END DATE PARSE METHODS
+	
+	// BEGIN RENDERER METHODS
+	
+	/**
+	* Resets the render stack of the current calendar to its original pre-render value.
+	*/
+	resetRenderers : function() {
+		this.renderStack = this._renderStack.concat();
+	},
 	
-	var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
+	/**
+	 * Removes all custom renderers added to the Calendar through the addRenderer, addMonthRenderer and 
+	 * addWeekdayRenderer methods. Calendar's render method needs to be called after removing renderers 
+	 * to re-render the Calendar without custom renderers applied.
+	 */
+	removeRenderers : function() {
+		this._renderStack = [];
+		this.renderStack = [];
+	},
 
-	if (date) {
-		if (date instanceof Date) {
-			parsedDate = YAHOO.widget.DateMath.findMonthStart(date);
-		} else {
-			var month, year, aMonthYear;
-			aMonthYear = date.split(this.cfg.getProperty(defCfg.DATE_FIELD_DELIMITER.key));
-			month = parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_MONTH_POSITION.key)-1], 10)-1;
-			year = parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_YEAR_POSITION.key)-1], 10);
-			
-			parsedDate = new Date(year, month, 1);
+	/**
+	* Clears the inner HTML, CSS class and style information from the specified cell.
+	* @method clearElement
+	* @param	{HTMLTableCellElement} cell The cell to clear
+	*/ 
+	clearElement : function(cell) {
+		cell.innerHTML = "&#160;";
+		cell.className="";
+	},
+	
+	/**
+	* Adds a renderer to the render stack. The function reference passed to this method will be executed
+	* when a date cell matches the conditions specified in the date string for this renderer.
+	* @method addRenderer
+	* @param	{String}	sDates		A date string to associate with the specified renderer. Valid formats
+	*									include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
+	* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+	*/
+	addRenderer : function(sDates, fnRender) {
+		var aDates = this._parseDates(sDates);
+		for (var i=0;i<aDates.length;++i) {
+			var aDate = aDates[i];
+		
+			if (aDate.length == 2) { // this is either a range or a month/day combo
+				if (aDate[0] instanceof Array) { // this is a range
+					this._addRenderer(YAHOO.widget.Calendar.RANGE,aDate,fnRender);
+				} else { // this is a month/day combo
+					this._addRenderer(YAHOO.widget.Calendar.MONTH_DAY,aDate,fnRender);
+				}
+			} else if (aDate.length == 3) {
+				this._addRenderer(YAHOO.widget.Calendar.DATE,aDate,fnRender);
+			}
 		}
-	} else {
-		parsedDate = new Date(this.today.getFullYear(), this.today.getMonth(), 1);
-	}
-	return parsedDate;
-};
-
-// END UTILITY METHODS
+	},
+	
+	/**
+	* The private method used for adding cell renderers to the local render stack.
+	* This method is called by other methods that set the renderer type prior to the method call.
+	* @method _addRenderer
+	* @private
+	* @param	{String}	type		The type string that indicates the type of date renderer being added.
+	*									Values are YAHOO.widget.Calendar.DATE, YAHOO.widget.Calendar.MONTH_DAY, YAHOO.widget.Calendar.WEEKDAY,
+	*									YAHOO.widget.Calendar.RANGE, YAHOO.widget.Calendar.MONTH
+	* @param	{Array}		aDates		An array of dates used to construct the renderer. The format varies based
+	*									on the renderer type
+	* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+	*/
+	_addRenderer : function(type, aDates, fnRender) {
+		var add = [type,aDates,fnRender];
+		this.renderStack.unshift(add);	
+		this._renderStack = this.renderStack.concat();
+	},
 
-// BEGIN EVENT HANDLERS
+	/**
+	* Adds a month to the render stack. The function reference passed to this method will be executed
+	* when a date cell matches the month passed to this method.
+	* @method addMonthRenderer
+	* @param	{Number}	month		The month (1-12) to associate with this renderer
+	* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+	*/
+	addMonthRenderer : function(month, fnRender) {
+		this._addRenderer(YAHOO.widget.Calendar.MONTH,[month],fnRender);
+	},
 
-/**
-* Event executed before a date is selected in the calendar widget.
-* @deprecated Event handlers for this event should be susbcribed to beforeSelectEvent.
-*/
-YAHOO.widget.Calendar.prototype.onBeforeSelect = function() {
-	if (this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MULTI_SELECT.key) === false) {
-		if (this.parent) {
-			this.parent.callChildFunction("clearAllBodyCellStyles", this.Style.CSS_CELL_SELECTED);
-			this.parent.deselectAll();
-		} else {
-			this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);
-			this.deselectAll();
+	/**
+	* Adds a weekday to the render stack. The function reference passed to this method will be executed
+	* when a date cell matches the weekday passed to this method.
+	* @method addWeekdayRenderer
+	* @param	{Number}	weekday		The weekday (0-6) to associate with this renderer
+	* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+	*/
+	addWeekdayRenderer : function(weekday, fnRender) {
+		this._addRenderer(YAHOO.widget.Calendar.WEEKDAY,[weekday],fnRender);
+	},
+	
+	// END RENDERER METHODS
+	
+	// BEGIN CSS METHODS
+	
+	/**
+	* Removes all styles from all body cells in the current calendar table.
+	* @method clearAllBodyCellStyles
+	* @param	{style}	style The CSS class name to remove from all calendar body cells
+	*/
+	clearAllBodyCellStyles : function(style) {
+		for (var c=0;c<this.cells.length;++c) {
+			YAHOO.util.Dom.removeClass(this.cells[c],style);
 		}
-	}
-};
-
-/**
-* Event executed when a date is selected in the calendar widget.
-* @param	{Array}	selected	An array of date field arrays representing which date or dates were selected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
-* @deprecated Event handlers for this event should be susbcribed to selectEvent.
-*/
-YAHOO.widget.Calendar.prototype.onSelect = function(selected) { };
-
-/**
-* Event executed before a date is deselected in the calendar widget.
-* @deprecated Event handlers for this event should be susbcribed to beforeDeselectEvent.
-*/
-YAHOO.widget.Calendar.prototype.onBeforeDeselect = function() { };
-
-/**
-* Event executed when a date is deselected in the calendar widget.
-* @param	{Array}	selected	An array of date field arrays representing which date or dates were deselected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
-* @deprecated Event handlers for this event should be susbcribed to deselectEvent.
-*/
-YAHOO.widget.Calendar.prototype.onDeselect = function(deselected) { };
-
-/**
-* Event executed when the user navigates to a different calendar page.
-* @deprecated Event handlers for this event should be susbcribed to changePageEvent.
-*/
-YAHOO.widget.Calendar.prototype.onChangePage = function() {
-	this.render();
-};
-
-/**
-* Event executed when the calendar widget is rendered.
-* @deprecated Event handlers for this event should be susbcribed to renderEvent.
-*/
-YAHOO.widget.Calendar.prototype.onRender = function() { };
-
-/**
-* Event executed when the calendar widget is reset to its original state.
-* @deprecated Event handlers for this event should be susbcribed to resetEvemt.
-*/
-YAHOO.widget.Calendar.prototype.onReset = function() { this.render(); };
-
-/**
-* Event executed when the calendar widget is completely cleared to the current month with no selections.
-* @deprecated Event handlers for this event should be susbcribed to clearEvent.
-*/
-YAHOO.widget.Calendar.prototype.onClear = function() { this.render(); };
-
-/**
-* Validates the calendar widget. This method has no default implementation
-* and must be extended by subclassing the widget.
-* @return	Should return true if the widget validates, and false if
-* it doesn't.
-* @type Boolean
-*/
-YAHOO.widget.Calendar.prototype.validate = function() { return true; };
-
-// END EVENT HANDLERS
+	},
+	
+	// END CSS METHODS
+	
+	// BEGIN GETTER/SETTER METHODS
+	/**
+	* Sets the calendar's month explicitly
+	* @method setMonth
+	* @param {Number}	month		The numeric month, from 0 (January) to 11 (December)
+	*/
+	setMonth : function(month) {
+		var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+		var current = this.cfg.getProperty(cfgPageDate);
+		current.setMonth(parseInt(month, 10));
+		this.cfg.setProperty(cfgPageDate, current);
+	},
 
-// BEGIN DATE PARSE METHODS
+	/**
+	* Sets the calendar's year explicitly.
+	* @method setYear
+	* @param {Number}	year		The numeric 4-digit year
+	*/
+	setYear : function(year) {
+		var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
+		var current = this.cfg.getProperty(cfgPageDate);
+		current.setFullYear(parseInt(year, 10));
+		this.cfg.setProperty(cfgPageDate, current);
+	},
 
-/**
-* Converts a date string to a date field array
-* @private
-* @param	{String}	sDate			Date string. Valid formats are mm/dd and mm/dd/yyyy.
-* @return				A date field array representing the string passed to the method
-* @type Array[](Number[])
-*/
-YAHOO.widget.Calendar.prototype._parseDate = function(sDate) {
-	var aDate = sDate.split(this.Locale.DATE_FIELD_DELIMITER);
-	var rArray;
-
-	if (aDate.length == 2) {
-		rArray = [aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];
-		rArray.type = YAHOO.widget.Calendar.MONTH_DAY;
-	} else {
-		rArray = [aDate[this.Locale.MDY_YEAR_POSITION-1],aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];
-		rArray.type = YAHOO.widget.Calendar.DATE;
-	}
+	/**
+	* Gets the list of currently selected dates from the calendar.
+	* @method getSelectedDates
+	* @return {Date[]} An array of currently selected JavaScript Date objects.
+	*/
+	getSelectedDates : function() {
+		var returnDates = [];
+		var selected = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);
 
-	for (var i=0;i<rArray.length;i++) {
-		rArray[i] = parseInt(rArray[i], 10);
-	}
+		for (var d=0;d<selected.length;++d) {
+			var dateArray = selected[d];
 
-	return rArray;
-};
+			var date = YAHOO.widget.DateMath.getDate(dateArray[0],dateArray[1]-1,dateArray[2]);
+			returnDates.push(date);
+		}
 
-/**
-* Converts a multi or single-date string to an array of date field arrays
-* @private
-* @param	{String}	sDates		Date string with one or more comma-delimited dates. Valid formats are mm/dd, mm/dd/yyyy, mm/dd/yyyy-mm/dd/yyyy
-* @return							An array of date field arrays
-* @type Array[](Number[])
-*/
-YAHOO.widget.Calendar.prototype._parseDates = function(sDates) {
-	var aReturn = [];
+		returnDates.sort( function(a,b) { return a-b; } );
+		return returnDates;
+	},
 
-	var aDates = sDates.split(this.Locale.DATE_DELIMITER);
+	/// END GETTER/SETTER METHODS ///
 	
-	for (var d=0;d<aDates.length;++d) {
-		var sDate = aDates[d];
-
-		if (sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER) != -1) {
-			// This is a range
-			var aRange = sDate.split(this.Locale.DATE_RANGE_DELIMITER);
-
-			var dateStart = this._parseDate(aRange[0]);
-			var dateEnd = this._parseDate(aRange[1]);
-
-			var fullRange = this._parseRange(dateStart, dateEnd);
-			aReturn = aReturn.concat(fullRange);
-		} else {
-			// This is not a range
-			var aDate = this._parseDate(sDate);
-			aReturn.push(aDate);
+	/**
+	* Hides the Calendar's outer container from view.
+	* @method hide
+	*/
+	hide : function() {
+		if (this.beforeHideEvent.fire()) {
+			this.oDomContainer.style.display = "none";
+			this.hideEvent.fire();
 		}
-	}
-	return aReturn;
-};
-
-/**
-* Converts a date range to the full list of included dates
-* @private
-* @param	{Number[]}	startDate	Date field array representing the first date in the range
-* @param	{Number[]}	endDate		Date field array representing the last date in the range
-* @return							An array of date field arrays
-* @type Array[](Number[])
-*/
-YAHOO.widget.Calendar.prototype._parseRange = function(startDate, endDate) {
-	var dStart   = new Date(startDate[0],startDate[1]-1,startDate[2]);
-	var dCurrent = YAHOO.widget.DateMath.add(new Date(startDate[0],startDate[1]-1,startDate[2]),YAHOO.widget.DateMath.DAY,1);
-	var dEnd     = new Date(endDate[0],  endDate[1]-1,  endDate[2]);
-
-	var results = [];
-	results.push(startDate);
-	while (dCurrent.getTime() <= dEnd.getTime()) {
-		results.push([dCurrent.getFullYear(),dCurrent.getMonth()+1,dCurrent.getDate()]);
-		dCurrent = YAHOO.widget.DateMath.add(dCurrent,YAHOO.widget.DateMath.DAY,1);
-	}
-	return results;
-};
-
-// END DATE PARSE METHODS
-
-// BEGIN RENDERER METHODS
-
-/**
-* Resets the render stack of the current calendar to its original pre-render value.
-*/
-YAHOO.widget.Calendar.prototype.resetRenderers = function() {
-	this.renderStack = this._renderStack.concat();
-};
-
-/**
-* Clears the inner HTML, CSS class and style information from the specified cell.
-* @method clearElement
-* @param	{HTMLTableCellElement}	The cell to clear
-*/ 
-YAHOO.widget.Calendar.prototype.clearElement = function(cell) {
-	cell.innerHTML = "&#160;";
-	cell.className="";
-};
+	},
 
-/**
-* Adds a renderer to the render stack. The function reference passed to this method will be executed
-* when a date cell matches the conditions specified in the date string for this renderer.
-* @method addRenderer
-* @param	{String}	sDates		A date string to associate with the specified renderer. Valid formats
-*									include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
-* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
-*/
-YAHOO.widget.Calendar.prototype.addRenderer = function(sDates, fnRender) {
-	var aDates = this._parseDates(sDates);
-	for (var i=0;i<aDates.length;++i) {
-		var aDate = aDates[i];
-	
-		if (aDate.length == 2) { // this is either a range or a month/day combo
-			if (aDate[0] instanceof Array) { // this is a range
-				this._addRenderer(YAHOO.widget.Calendar.RANGE,aDate,fnRender);
-			} else { // this is a month/day combo
-				this._addRenderer(YAHOO.widget.Calendar.MONTH_DAY,aDate,fnRender);
-			}
-		} else if (aDate.length == 3) {
-			this._addRenderer(YAHOO.widget.Calendar.DATE,aDate,fnRender);
+	/**
+	* Shows the Calendar's outer container.
+	* @method show
+	*/
+	show : function() {
+		if (this.beforeShowEvent.fire()) {
+			this.oDomContainer.style.display = "block";
+			this.showEvent.fire();
 		}
-	}
-};
-
-/**
-* The private method used for adding cell renderers to the local render stack.
-* This method is called by other methods that set the renderer type prior to the method call.
-* @method _addRenderer
-* @private
-* @param	{String}	type		The type string that indicates the type of date renderer being added.
-*									Values are YAHOO.widget.Calendar.DATE, YAHOO.widget.Calendar.MONTH_DAY, YAHOO.widget.Calendar.WEEKDAY,
-*									YAHOO.widget.Calendar.RANGE, YAHOO.widget.Calendar.MONTH
-* @param	{Array}		aDates		An array of dates used to construct the renderer. The format varies based
-*									on the renderer type
-* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
-*/
-YAHOO.widget.Calendar.prototype._addRenderer = function(type, aDates, fnRender) {
-	var add = [type,aDates,fnRender];
-	this.renderStack.unshift(add);	
-	this._renderStack = this.renderStack.concat();
-};
-
-/**
-* Adds a month to the render stack. The function reference passed to this method will be executed
-* when a date cell matches the month passed to this method.
-* @method addMonthRenderer
-* @param	{Number}	month		The month (1-12) to associate with this renderer
-* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
-*/
-YAHOO.widget.Calendar.prototype.addMonthRenderer = function(month, fnRender) {
-	this._addRenderer(YAHOO.widget.Calendar.MONTH,[month],fnRender);
-};
-
-/**
-* Adds a weekday to the render stack. The function reference passed to this method will be executed
-* when a date cell matches the weekday passed to this method.
-* @method addWeekdayRenderer
-* @param	{Number}	weekday		The weekday (0-6) to associate with this renderer
-* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
-*/
-YAHOO.widget.Calendar.prototype.addWeekdayRenderer = function(weekday, fnRender) {
-	this._addRenderer(YAHOO.widget.Calendar.WEEKDAY,[weekday],fnRender);
-};
-
-// END RENDERER METHODS
-
-// BEGIN CSS METHODS
-
-/**
-* Removes all styles from all body cells in the current calendar table.
-* @method clearAllBodyCellStyles
-* @param	{style}		The CSS class name to remove from all calendar body cells
-*/
-YAHOO.widget.Calendar.prototype.clearAllBodyCellStyles = function(style) {
-	for (var c=0;c<this.cells.length;++c) {
-		YAHOO.util.Dom.removeClass(this.cells[c],style);
-	}
-};
-
-// END CSS METHODS
-
-// BEGIN GETTER/SETTER METHODS
-/**
-* Sets the calendar's month explicitly
-* @method setMonth
-* @param {Number}	month		The numeric month, from 0 (January) to 11 (December)
-*/
-YAHOO.widget.Calendar.prototype.setMonth = function(month) {
-	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
-	var current = this.cfg.getProperty(cfgPageDate);
-	current.setMonth(parseInt(month, 10));
-	this.cfg.setProperty(cfgPageDate, current);
-};
-
-/**
-* Sets the calendar's year explicitly.
-* @method setYear
-* @param {Number}	year		The numeric 4-digit year
-*/
-YAHOO.widget.Calendar.prototype.setYear = function(year) {
-	var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
-	var current = this.cfg.getProperty(cfgPageDate);
-	current.setFullYear(parseInt(year, 10));
-	this.cfg.setProperty(cfgPageDate, current);
-};
-
-/**
-* Gets the list of currently selected dates from the calendar.
-* @method getSelectedDates
-* @return {Date[]} An array of currently selected JavaScript Date objects.
-*/
-YAHOO.widget.Calendar.prototype.getSelectedDates = function() {
-	var returnDates = [];
-	var selected = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);
-
-	for (var d=0;d<selected.length;++d) {
-		var dateArray = selected[d];
+	},
 
-		var date = new Date(dateArray[0],dateArray[1]-1,dateArray[2]);
-		returnDates.push(date);
+	/**
+	* Returns a string representing the current browser.
+	* @deprecated As of 2.3.0, environment information is available in YAHOO.env.ua
+	* @see YAHOO.env.ua
+	* @property browser
+	* @type String
+	*/
+	browser : (function() {
+				var ua = navigator.userAgent.toLowerCase();
+					  if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
+						 return 'opera';
+					  } else if (ua.indexOf('msie 7')!=-1) { // IE7
+						 return 'ie7';
+					  } else if (ua.indexOf('msie') !=-1) { // IE
+						 return 'ie';
+					  } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
+						 return 'safari';
+					  } else if (ua.indexOf('gecko') != -1) { // Gecko
+						 return 'gecko';
+					  } else {
+						 return false;
+					  }
+				})(),
+	/**
+	* Returns a string representation of the object.
+	* @method toString
+	* @return {String}	A string representation of the Calendar object.
+	*/
+	toString : function() {
+		return "Calendar " + this.id;
 	}
-
-	returnDates.sort( function(a,b) { return a-b; } );
-	return returnDates;
-};
-
-/// END GETTER/SETTER METHODS ///
-
-/**
-* Hides the Calendar's outer container from view.
-* @method hide
-*/
-YAHOO.widget.Calendar.prototype.hide = function() {
-	this.oDomContainer.style.display = "none";
-};
-
-/**
-* Shows the Calendar's outer container.
-* @method show
-*/
-YAHOO.widget.Calendar.prototype.show = function() {
-	this.oDomContainer.style.display = "block";
-};
-
-/**
-* Returns a string representing the current browser.
-* @property browser
-* @type String
-*/
-YAHOO.widget.Calendar.prototype.browser = function() {
-			var ua = navigator.userAgent.toLowerCase();
-				  if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
-					 return 'opera';
-				  } else if (ua.indexOf('msie 7')!=-1) { // IE7
-					 return 'ie7';
-				  } else if (ua.indexOf('msie') !=-1) { // IE
-					 return 'ie';
-				  } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
-					 return 'safari';
-				  } else if (ua.indexOf('gecko') != -1) { // Gecko
-					 return 'gecko';
-				  } else {
-					 return false;
-				  }
-			}();
-/**
-* Returns a string representation of the object.
-* @method toString
-* @return {String}	A string representation of the Calendar object.
-*/
-YAHOO.widget.Calendar.prototype.toString = function() {
-	return "Calendar " + this.id;
 };
 
 /**
@@ -3443,7 +4245,7 @@
 * YAHOO.widget.CalendarGroup is a special container class for YAHOO.widget.Calendar. This class facilitates
 * the ability to have multi-page calendar views that share a single dataset and are
 * dependent on each other.
-* 
+*
 * The calendar group instance will refer to each of its elements using a 0-based index.
 * For example, to construct the placeholder for a calendar group widget with id "cal1" and
 * containerId of "cal1Container", the markup would be as follows:
@@ -3452,1012 +4254,1211 @@
 *		<div id="cal1Container_1"></div>
 *	</xmp>
 * The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.
+* 
+* <p>
+* <strong>NOTE: As of 2.4.0, the constructor's ID argument is optional.</strong>
+* The CalendarGroup can be constructed by simply providing a container ID string, 
+* or a reference to a container DIV HTMLElement (the element needs to exist 
+* in the document).
+* 
+* E.g.:
+*	<xmp>
+*		var c = new YAHOO.widget.CalendarGroup("calContainer", configOptions);
+*	</xmp>
+* or:
+*   <xmp>
+*       var containerDiv = YAHOO.util.Dom.get("calContainer");
+*		var c = new YAHOO.widget.CalendarGroup(containerDiv, configOptions);
+*	</xmp>
+* </p>
+* <p>
+* If not provided, the ID will be generated from the container DIV ID by adding an "_t" suffix.
+* For example if an ID is not provided, and the container's ID is "calContainer", the CalendarGroup's ID will be set to "calContainer_t".
+* </p>
+* 
 * @namespace YAHOO.widget
 * @class CalendarGroup
 * @constructor
-* @param {String}	id			The id of the table element that will represent the calendar widget
-* @param {String}	containerId	The id of the container div element that will wrap the calendar table
-* @param {Object}	config		The configuration object containing the Calendar's arguments
+* @param {String} id optional The id of the table element that will represent the CalendarGroup widget. As of 2.4.0, this argument is optional.
+* @param {String | HTMLElement} container The id of the container div element that will wrap the CalendarGroup table, or a reference to a DIV element which exists in the document.
+* @param {Object} config optional The configuration object containing the initial configuration values for the CalendarGroup.
 */
 YAHOO.widget.CalendarGroup = function(id, containerId, config) {
 	if (arguments.length > 0) {
-		this.init(id, containerId, config);
+		this.init.apply(this, arguments);
 	}
 };
 
-/**
-* Initializes the calendar group. All subclasses must call this method in order for the
-* group to be initialized properly.
-* @method init
-* @param {String}	id			The id of the table element that will represent the calendar widget
-* @param {String}	containerId	The id of the container div element that will wrap the calendar table
-* @param {Object}	config		The configuration object containing the Calendar's arguments
-*/
-YAHOO.widget.CalendarGroup.prototype.init = function(id, containerId, config) {
-	this.initEvents();
-	this.initStyles();
+YAHOO.widget.CalendarGroup.prototype = {
 
 	/**
-	* The collection of Calendar pages contained within the CalendarGroup
-	* @property pages
-	* @type YAHOO.widget.Calendar[]
-	*/
-	this.pages = [];
-	
-	/**
-	* The unique id associated with the CalendarGroup
-	* @property id
-	* @type String
+	* Initializes the calendar group. All subclasses must call this method in order for the
+	* group to be initialized properly.
+	* @method init
+	* @param {String} id optional The id of the table element that will represent the CalendarGroup widget. As of 2.4.0, this argument is optional.
+	* @param {String | HTMLElement} container The id of the container div element that will wrap the CalendarGroup table, or a reference to a DIV element which exists in the document.
+	* @param {Object} config optional The configuration object containing the initial configuration values for the CalendarGroup.
 	*/
-	this.id = id;
+	init : function(id, container, config) {
 
-	/**
-	* The unique id associated with the CalendarGroup container
-	* @property containerId
-	* @type String
-	*/
-	this.containerId = containerId;
+		// Normalize 2.4.0, pre 2.4.0 args
+		var nArgs = this._parseArgs(arguments);
 
-	/**
-	* The outer containing element for the CalendarGroup
-	* @property oDomContainer
-	* @type HTMLElement
-	*/
-	this.oDomContainer = document.getElementById(containerId);
+		id = nArgs.id;
+		container = nArgs.container;
+		config = nArgs.config;
 
-	YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_CONTAINER);
-	YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_MULTI_UP);
+		this.oDomContainer = YAHOO.util.Dom.get(container);
 
-	/**
-	* The Config object used to hold the configuration variables for the CalendarGroup
-	* @property cfg
-	* @type YAHOO.util.Config
-	*/
-	this.cfg = new YAHOO.util.Config(this);
+		if (!this.oDomContainer.id) {
+			this.oDomContainer.id = YAHOO.util.Dom.generateId();
+		}
+		if (!id) {
+			id = this.oDomContainer.id + "_t";
+		}
 
-	/**
-	* The local object which contains the CalendarGroup's options
-	* @property Options
-	* @type Object
-	*/
-	this.Options = {};
+		/**
+		* The unique id associated with the CalendarGroup
+		* @property id
+		* @type String
+		*/
+		this.id = id;
 
-	/**
-	* The local object which contains the CalendarGroup's locale settings
-	* @property Locale
-	* @type Object
-	*/
-	this.Locale = {};
+		/**
+		* The unique id associated with the CalendarGroup container
+		* @property containerId
+		* @type String
+		*/
+		this.containerId = this.oDomContainer.id;
+
+		this.initEvents();
+		this.initStyles();
+
+		/**
+		* The collection of Calendar pages contained within the CalendarGroup
+		* @property pages
+		* @type YAHOO.widget.Calendar[]
+		*/
+		this.pages = [];
+
+		YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_CONTAINER);
+		YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_MULTI_UP);
+
+		/**
+		* The Config object used to hold the configuration variables for the CalendarGroup
+		* @property cfg
+		* @type YAHOO.util.Config
+		*/
+		this.cfg = new YAHOO.util.Config(this);
+
+		/**
+		* The local object which contains the CalendarGroup's options
+		* @property Options
+		* @type Object
+		*/
+		this.Options = {};
+
+		/**
+		* The local object which contains the CalendarGroup's locale settings
+		* @property Locale
+		* @type Object
+		*/
+		this.Locale = {};
+
+		this.setupConfig();
+
+		if (config) {
+			this.cfg.applyConfig(config, true);
+		}
+
+		this.cfg.fireQueue();
 
-	this.setupConfig();
+		// OPERA HACK FOR MISWRAPPED FLOATS
+		if (YAHOO.env.ua.opera){
+			this.renderEvent.subscribe(this._fixWidth, this, true);
+			this.showEvent.subscribe(this._fixWidth, this, true);
+		}
+
+	},
+
+	setupConfig : function() {
+
+		var defCfg = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG;
+
+		/**
+		* The number of pages to include in the CalendarGroup. This value can only be set once, in the CalendarGroup's constructor arguments.
+		* @config pages
+		* @type Number
+		* @default 2
+		*/
+		this.cfg.addProperty(defCfg.PAGES.key, { value:defCfg.PAGES.value, validator:this.cfg.checkNumber, handler:this.configPages } );
 
-	if (config) {
-		this.cfg.applyConfig(config, true);
-	}
+		/**
+		* The month/year representing the current visible Calendar date (mm/yyyy)
+		* @config pagedate
+		* @type String
+		* @default today's date
+		*/
+		this.cfg.addProperty(defCfg.PAGEDATE.key, { value:new Date(), handler:this.configPageDate } );
 
-	this.cfg.fireQueue();
+		/**
+		* The date or range of dates representing the current Calendar selection
+		* @config selected
+		* @type String
+		* @default []
+		*/
+		this.cfg.addProperty(defCfg.SELECTED.key, { value:[], handler:this.configSelected } );
 
-	// OPERA HACK FOR MISWRAPPED FLOATS
-	if (this.browser == "opera"){
-		var fixWidth = function() {
-			var startW = this.oDomContainer.offsetWidth;
-			var w = 0;
-			for (var p=0;p<this.pages.length;++p) {
-				var cal = this.pages[p];
-				w += cal.oDomContainer.offsetWidth;
-			}
-			if (w > 0) {
-				this.oDomContainer.style.width = w + "px";
-			}
-		};
-		this.renderEvent.subscribe(fixWidth,this,true);
-	}
-};
+		/**
+		* The title to display above the CalendarGroup's month header
+		* @config title
+		* @type String
+		* @default ""
+		*/
+		this.cfg.addProperty(defCfg.TITLE.key, { value:defCfg.TITLE.value, handler:this.configTitle } );
 
+		/**
+		* Whether or not a close button should be displayed for this CalendarGroup
+		* @config close
+		* @type Boolean
+		* @default false
+		*/
+		this.cfg.addProperty(defCfg.CLOSE.key, { value:defCfg.CLOSE.value, handler:this.configClose } );
 
-YAHOO.widget.CalendarGroup.prototype.setupConfig = function() {
+		/**
+		* Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
+		* This property is enabled by default for IE6 and below. It is disabled by default for other browsers for performance reasons, but can be 
+		* enabled if required.
+		* 
+		* @config iframe
+		* @type Boolean
+		* @default true for IE6 and below, false for all other browsers
+		*/
+		this.cfg.addProperty(defCfg.IFRAME.key, { value:defCfg.IFRAME.value, handler:this.configIframe, validator:this.cfg.checkBoolean } );
 	
-	var defCfg = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG;
+		/**
+		* The minimum selectable date in the current Calendar (mm/dd/yyyy)
+		* @config mindate
+		* @type String
+		* @default null
+		*/
+		this.cfg.addProperty(defCfg.MINDATE.key, { value:defCfg.MINDATE.value, handler:this.delegateConfig } );
 	
-	/**
-	* The number of pages to include in the CalendarGroup. This value can only be set once, in the CalendarGroup's constructor arguments.
-	* @config pages
-	* @type Number
-	* @default 2
-	*/
-	this.cfg.addProperty(defCfg.PAGES.key, { value:defCfg.PAGES.value, validator:this.cfg.checkNumber, handler:this.configPages } );
-
-	/**
-	* The month/year representing the current visible Calendar date (mm/yyyy)
-	* @config pagedate
-	* @type String
-	* @default today's date
-	*/
-	this.cfg.addProperty(defCfg.PAGEDATE.key, { value:defCfg.PAGEDATE.value, handler:this.configPageDate } );
+		/**
+		* The maximum selectable date in the current Calendar (mm/dd/yyyy)
+		* @config maxdate
+		* @type String
+		* @default null
+		*/	
+		this.cfg.addProperty(defCfg.MAXDATE.key, { value:defCfg.MAXDATE.value, handler:this.delegateConfig  } );
+	
+		// Options properties
+	
+		/**
+		* True if the Calendar should allow multiple selections. False by default.
+		* @config MULTI_SELECT
+		* @type Boolean
+		* @default false
+		*/
+		this.cfg.addProperty(defCfg.MULTI_SELECT.key,	{ value:defCfg.MULTI_SELECT.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+	
+		/**
+		* The weekday the week begins on. Default is 0 (Sunday).
+		* @config START_WEEKDAY
+		* @type number
+		* @default 0
+		*/	
+		this.cfg.addProperty(defCfg.START_WEEKDAY.key,	{ value:defCfg.START_WEEKDAY.value, handler:this.delegateConfig, validator:this.cfg.checkNumber  } );
+		
+		/**
+		* True if the Calendar should show weekday labels. True by default.
+		* @config SHOW_WEEKDAYS
+		* @type Boolean
+		* @default true
+		*/	
+		this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key,	{ value:defCfg.SHOW_WEEKDAYS.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+		
+		/**
+		* True if the Calendar should show week row headers. False by default.
+		* @config SHOW_WEEK_HEADER
+		* @type Boolean
+		* @default false
+		*/	
+		this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key,{ value:defCfg.SHOW_WEEK_HEADER.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+		
+		/**
+		* True if the Calendar should show week row footers. False by default.
+		* @config SHOW_WEEK_FOOTER
+		* @type Boolean
+		* @default false
+		*/
+		this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key,{ value:defCfg.SHOW_WEEK_FOOTER.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+		
+		/**
+		* True if the Calendar should suppress weeks that are not a part of the current month. False by default.
+		* @config HIDE_BLANK_WEEKS
+		* @type Boolean
+		* @default false
+		*/		
+		this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key,{ value:defCfg.HIDE_BLANK_WEEKS.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+		
+        /**
+        * True if the Calendar should allow out of month selections. false by default.
+        * @config OUT_OF_MONTH_SELECT
+        * @type Boolean
+        * @default false
+        */
+        this.cfg.addProperty(defCfg.OUT_OF_MONTH_SELECT.key,{ value:defCfg.OUT_OF_MONTH_SELECT.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
 
-	/**
-	* The date or range of dates representing the current Calendar selection
-	* @config selected
-	* @type String
-	* @default []
-	*/
-	this.cfg.addProperty(defCfg.SELECTED.key, { value:defCfg.SELECTED.value, handler:this.configSelected } );
+		/**
+		* The image that should be used for the left navigation arrow.
+		* @config NAV_ARROW_LEFT
+		* @type String
+		* @deprecated	You can customize the image by overriding the default CSS class for the left arrow - "calnavleft"
+		* @default null
+		*/		
+		this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key,	{ value:defCfg.NAV_ARROW_LEFT.value, handler:this.delegateConfig } );
+		
+		/**
+		* The image that should be used for the right navigation arrow.
+		* @config NAV_ARROW_RIGHT
+		* @type String
+		* @deprecated	You can customize the image by overriding the default CSS class for the right arrow - "calnavright"
+		* @default null
+		*/		
+		this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key,	{ value:defCfg.NAV_ARROW_RIGHT.value, handler:this.delegateConfig } );
+	
+		// Locale properties
+		
+		/**
+		* The short month labels for the current locale.
+		* @config MONTHS_SHORT
+		* @type String[]
+		* @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+		*/
+		this.cfg.addProperty(defCfg.MONTHS_SHORT.key,	{ value:defCfg.MONTHS_SHORT.value, handler:this.delegateConfig } );
+		
+		/**
+		* The long month labels for the current locale.
+		* @config MONTHS_LONG
+		* @type String[]
+		* @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+		*/		
+		this.cfg.addProperty(defCfg.MONTHS_LONG.key,		{ value:defCfg.MONTHS_LONG.value, handler:this.delegateConfig } );
+		
+		/**
+		* The 1-character weekday labels for the current locale.
+		* @config WEEKDAYS_1CHAR
+		* @type String[]
+		* @default ["S", "M", "T", "W", "T", "F", "S"]
+		*/		
+		this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key,	{ value:defCfg.WEEKDAYS_1CHAR.value, handler:this.delegateConfig } );
+		
+		/**
+		* The short weekday labels for the current locale.
+		* @config WEEKDAYS_SHORT
+		* @type String[]
+		* @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
+		*/		
+		this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key,	{ value:defCfg.WEEKDAYS_SHORT.value, handler:this.delegateConfig } );
+		
+		/**
+		* The medium weekday labels for the current locale.
+		* @config WEEKDAYS_MEDIUM
+		* @type String[]
+		* @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
+		*/		
+		this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key,	{ value:defCfg.WEEKDAYS_MEDIUM.value, handler:this.delegateConfig } );
+		
+		/**
+		* The long weekday labels for the current locale.
+		* @config WEEKDAYS_LONG
+		* @type String[]
+		* @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
+		*/		
+		this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key,	{ value:defCfg.WEEKDAYS_LONG.value, handler:this.delegateConfig } );
+	
+		/**
+		* The setting that determines which length of month labels should be used. Possible values are "short" and "long".
+		* @config LOCALE_MONTHS
+		* @type String
+		* @default "long"
+		*/
+		this.cfg.addProperty(defCfg.LOCALE_MONTHS.key,	{ value:defCfg.LOCALE_MONTHS.value, handler:this.delegateConfig } );
+	
+		/**
+		* The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
+		* @config LOCALE_WEEKDAYS
+		* @type String
+		* @default "short"
+		*/	
+		this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key,	{ value:defCfg.LOCALE_WEEKDAYS.value, handler:this.delegateConfig } );
+	
+		/**
+		* The value used to delimit individual dates in a date string passed to various Calendar functions.
+		* @config DATE_DELIMITER
+		* @type String
+		* @default ","
+		*/
+		this.cfg.addProperty(defCfg.DATE_DELIMITER.key,		{ value:defCfg.DATE_DELIMITER.value, handler:this.delegateConfig } );
+	
+		/**
+		* The value used to delimit date fields in a date string passed to various Calendar functions.
+		* @config DATE_FIELD_DELIMITER
+		* @type String
+		* @default "/"
+		*/	
+		this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key,{ value:defCfg.DATE_FIELD_DELIMITER.value, handler:this.delegateConfig } );
+	
+		/**
+		* The value used to delimit date ranges in a date string passed to various Calendar functions.
+		* @config DATE_RANGE_DELIMITER
+		* @type String
+		* @default "-"
+		*/
+		this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key,{ value:defCfg.DATE_RANGE_DELIMITER.value, handler:this.delegateConfig } );
+	
+		/**
+		* The position of the month in a month/year date string
+		* @config MY_MONTH_POSITION
+		* @type Number
+		* @default 1
+		*/
+		this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key,	{ value:defCfg.MY_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+		
+		/**
+		* The position of the year in a month/year date string
+		* @config MY_YEAR_POSITION
+		* @type Number
+		* @default 2
+		*/	
+		this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key,	{ value:defCfg.MY_YEAR_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+		
+		/**
+		* The position of the month in a month/day date string
+		* @config MD_MONTH_POSITION
+		* @type Number
+		* @default 1
+		*/	
+		this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key,	{ value:defCfg.MD_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+		
+		/**
+		* The position of the day in a month/year date string
+		* @config MD_DAY_POSITION
+		* @type Number
+		* @default 2
+		*/	
+		this.cfg.addProperty(defCfg.MD_DAY_POSITION.key,		{ value:defCfg.MD_DAY_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+		
+		/**
+		* The position of the month in a month/day/year date string
+		* @config MDY_MONTH_POSITION
+		* @type Number
+		* @default 1
+		*/	
+		this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key,	{ value:defCfg.MDY_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+		
+		/**
+		* The position of the day in a month/day/year date string
+		* @config MDY_DAY_POSITION
+		* @type Number
+		* @default 2
+		*/	
+		this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key,	{ value:defCfg.MDY_DAY_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+		
+		/**
+		* The position of the year in a month/day/year date string
+		* @config MDY_YEAR_POSITION
+		* @type Number
+		* @default 3
+		*/	
+		this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key,	{ value:defCfg.MDY_YEAR_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	
+		/**
+		* The position of the month in the month year label string used as the Calendar header
+		* @config MY_LABEL_MONTH_POSITION
+		* @type Number
+		* @default 1
+		*/
+		this.cfg.addProperty(defCfg.MY_LABEL_MONTH_POSITION.key,	{ value:defCfg.MY_LABEL_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	
+		/**
+		* The position of the year in the month year label string used as the Calendar header
+		* @config MY_LABEL_YEAR_POSITION
+		* @type Number
+		* @default 2
+		*/
+		this.cfg.addProperty(defCfg.MY_LABEL_YEAR_POSITION.key,	{ value:defCfg.MY_LABEL_YEAR_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+		
+		/**
+		* The suffix used after the month when rendering the Calendar header
+		* @config MY_LABEL_MONTH_SUFFIX
+		* @type String
+		* @default " "
+		*/
+		this.cfg.addProperty(defCfg.MY_LABEL_MONTH_SUFFIX.key,	{ value:defCfg.MY_LABEL_MONTH_SUFFIX.value, handler:this.delegateConfig } );
+		
+		/**
+		* The suffix used after the year when rendering the Calendar header
+		* @config MY_LABEL_YEAR_SUFFIX
+		* @type String
+		* @default ""
+		*/
+		this.cfg.addProperty(defCfg.MY_LABEL_YEAR_SUFFIX.key, { value:defCfg.MY_LABEL_YEAR_SUFFIX.value, handler:this.delegateConfig } );
 
-	/**
-	* The title to display above the CalendarGroup's month header
-	* @config title
-	* @type String
-	* @default ""
-	*/
-	this.cfg.addProperty(defCfg.TITLE.key, { value:defCfg.TITLE.value, handler:this.configTitle } );
+		/**
+		* Configuration for the Month Year Navigation UI. By default it is disabled
+		* @config NAV
+		* @type Object
+		* @default null
+		*/
+		this.cfg.addProperty(defCfg.NAV.key, { value:defCfg.NAV.value, handler:this.configNavigator } );
+	},
 
 	/**
-	* Whether or not a close button should be displayed for this CalendarGroup
-	* @config close
-	* @type Boolean
-	* @default false
+	* Initializes CalendarGroup's built-in CustomEvents
+	* @method initEvents
 	*/
-	this.cfg.addProperty(defCfg.CLOSE.key, { value:defCfg.CLOSE.value, handler:this.configClose } );
+	initEvents : function() {
+		var me = this;
+		var strEvent = "Event";
 
-	/**
-	* Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
-	* @config iframe
-	* @type Boolean
-	* @default true
-	*/
-	this.cfg.addProperty(defCfg.IFRAME.key, { value:defCfg.IFRAME.value, handler:this.configIframe, validator:this.cfg.checkBoolean } );
+		/**
+		* Proxy subscriber to subscribe to the CalendarGroup's child Calendars' CustomEvents
+		* @method sub
+		* @private
+		* @param {Function} fn	The function to subscribe to this CustomEvent
+		* @param {Object}	obj	The CustomEvent's scope object
+		* @param {Boolean}	bOverride	Whether or not to apply scope correction
+		*/
+		var sub = function(fn, obj, bOverride) {
+			for (var p=0;p<me.pages.length;++p) {
+				var cal = me.pages[p];
+				cal[this.type + strEvent].subscribe(fn, obj, bOverride);
+			}
+		};
 
-	/**
-	* The minimum selectable date in the current Calendar (mm/dd/yyyy)
-	* @config mindate
-	* @type String
-	* @default null
-	*/
-	this.cfg.addProperty(defCfg.MINDATE.key, { value:defCfg.MINDATE.value, handler:this.delegateConfig } );
+		/**
+		* Proxy unsubscriber to unsubscribe from the CalendarGroup's child Calendars' CustomEvents
+		* @method unsub
+		* @private
+		* @param {Function} fn	The function to subscribe to this CustomEvent
+		* @param {Object}	obj	The CustomEvent's scope object
+		*/
+		var unsub = function(fn, obj) {
+			for (var p=0;p<me.pages.length;++p) {
+				var cal = me.pages[p];
+				cal[this.type + strEvent].unsubscribe(fn, obj);
+			}
+		};
+		
+		var defEvents = YAHOO.widget.Calendar._EVENT_TYPES;
+	
+		/**
+		* Fired before a selection is made
+		* @event beforeSelectEvent
+		*/
+		this.beforeSelectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT);
+		this.beforeSelectEvent.subscribe = sub; this.beforeSelectEvent.unsubscribe = unsub;
+	
+		/**
+		* Fired when a selection is made
+		* @event selectEvent
+		* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
+		*/
+		this.selectEvent = new YAHOO.util.CustomEvent(defEvents.SELECT); 
+		this.selectEvent.subscribe = sub; this.selectEvent.unsubscribe = unsub;
+	
+		/**
+		* Fired before a selection is made
+		* @event beforeDeselectEvent
+		*/
+		this.beforeDeselectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT); 
+		this.beforeDeselectEvent.subscribe = sub; this.beforeDeselectEvent.unsubscribe = unsub;
+	
+		/**
+		* Fired when a selection is made
+		* @event deselectEvent
+		* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
+		*/
+		this.deselectEvent = new YAHOO.util.CustomEvent(defEvents.DESELECT); 
+		this.deselectEvent.subscribe = sub; this.deselectEvent.unsubscribe = unsub;
+		
+		/**
+		* Fired when the Calendar page is changed
+		* @event changePageEvent
+		*/
+		this.changePageEvent = new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE); 
+		this.changePageEvent.subscribe = sub; this.changePageEvent.unsubscribe = unsub;
+	
+		/**
+		* Fired before the Calendar is rendered
+		* @event beforeRenderEvent
+		*/
+		this.beforeRenderEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);
+		this.beforeRenderEvent.subscribe = sub; this.beforeRenderEvent.unsubscribe = unsub;
+	
+		/**
+		* Fired when the Calendar is rendered
+		* @event renderEvent
+		*/
+		this.renderEvent = new YAHOO.util.CustomEvent(defEvents.RENDER);
+		this.renderEvent.subscribe = sub; this.renderEvent.unsubscribe = unsub;
+	
+		/**
+		* Fired when the Calendar is reset
+		* @event resetEvent
+		*/
+		this.resetEvent = new YAHOO.util.CustomEvent(defEvents.RESET); 
+		this.resetEvent.subscribe = sub; this.resetEvent.unsubscribe = unsub;
+	
+		/**
+		* Fired when the Calendar is cleared
+		* @event clearEvent
+		*/
+		this.clearEvent = new YAHOO.util.CustomEvent(defEvents.CLEAR);
+		this.clearEvent.subscribe = sub; this.clearEvent.unsubscribe = unsub;
+	
+		/**
+		* Fired just before the CalendarGroup is to be shown
+		* @event beforeShowEvent
+		*/
+		this.beforeShowEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SHOW);
+	
+		/**
+		* Fired after the CalendarGroup is shown
+		* @event showEvent
+		*/
+		this.showEvent = new YAHOO.util.CustomEvent(defEvents.SHOW);
+	
+		/**
+		* Fired just before the CalendarGroup is to be hidden
+		* @event beforeHideEvent
+		*/
+		this.beforeHideEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_HIDE);
+	
+		/**
+		* Fired after the CalendarGroup is hidden
+		* @event hideEvent
+		*/
+		this.hideEvent = new YAHOO.util.CustomEvent(defEvents.HIDE);
 
-	/**
-	* The maximum selectable date in the current Calendar (mm/dd/yyyy)
-	* @config maxdate
-	* @type String
-	* @default null
-	*/	
-	this.cfg.addProperty(defCfg.MAXDATE.key, { value:defCfg.MAXDATE.value, handler:this.delegateConfig  } );
+		/**
+		* Fired just before the CalendarNavigator is to be shown
+		* @event beforeShowNavEvent
+		*/
+		this.beforeShowNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SHOW_NAV);
+	
+		/**
+		* Fired after the CalendarNavigator is shown
+		* @event showNavEvent
+		*/
+		this.showNavEvent = new YAHOO.util.CustomEvent(defEvents.SHOW_NAV);
+	
+		/**
+		* Fired just before the CalendarNavigator is to be hidden
+		* @event beforeHideNavEvent
+		*/
+		this.beforeHideNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_HIDE_NAV);
+	
+		/**
+		* Fired after the CalendarNavigator is hidden
+		* @event hideNavEvent
+		*/
+		this.hideNavEvent = new YAHOO.util.CustomEvent(defEvents.HIDE_NAV);
 
-	// Options properties
+		/**
+		* Fired just before the CalendarNavigator is to be rendered
+		* @event beforeRenderNavEvent
+		*/
+		this.beforeRenderNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER_NAV);
 
+		/**
+		* Fired after the CalendarNavigator is rendered
+		* @event renderNavEvent
+		*/
+		this.renderNavEvent = new YAHOO.util.CustomEvent(defEvents.RENDER_NAV);
+	},
+	
 	/**
-	* True if the Calendar should allow multiple selections. False by default.
-	* @config MULTI_SELECT
-	* @type Boolean
-	* @default false
-	*/
-	this.cfg.addProperty(defCfg.MULTI_SELECT.key,	{ value:defCfg.MULTI_SELECT.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+	* The default Config handler for the "pages" property
+	* @method configPages
+	* @param {String} type	The CustomEvent type (usually the property name)
+	* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+	* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
+	*/
+	configPages : function(type, args, obj) {
+		var pageCount = args[0];
+	
+		var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
+	
+		// Define literals outside loop	
+		var sep = "_";
+		var groupCalClass = "groupcal";
+	
+		var firstClass = "first-of-type";
+		var lastClass = "last-of-type";
+	
+		for (var p=0;p<pageCount;++p) {
+			var calId = this.id + sep + p;
+			var calContainerId = this.containerId + sep + p;
+	
+			var childConfig = this.cfg.getConfig();
+			childConfig.close = false;
+			childConfig.title = false;
+			childConfig.navigator = null;
+
+			var cal = this.constructChild(calId, calContainerId, childConfig);
+			var caldate = cal.cfg.getProperty(cfgPageDate);
+			this._setMonthOnDate(caldate, caldate.getMonth() + p);
+			cal.cfg.setProperty(cfgPageDate, caldate);
+	
+			YAHOO.util.Dom.removeClass(cal.oDomContainer, this.Style.CSS_SINGLE);
+			YAHOO.util.Dom.addClass(cal.oDomContainer, groupCalClass);
 
-	/**
-	* The weekday the week begins on. Default is 0 (Sunday).
-	* @config START_WEEKDAY
-	* @type number
-	* @default 0
-	*/	
-	this.cfg.addProperty(defCfg.START_WEEKDAY.key,	{ value:defCfg.START_WEEKDAY.value, handler:this.delegateConfig, validator:this.cfg.checkNumber  } );
+			if (p===0) {
+				YAHOO.util.Dom.addClass(cal.oDomContainer, firstClass);
+			}
 	
-	/**
-	* True if the Calendar should show weekday labels. True by default.
-	* @config SHOW_WEEKDAYS
-	* @type Boolean
-	* @default true
-	*/	
-	this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key,	{ value:defCfg.SHOW_WEEKDAYS.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+			if (p==(pageCount-1)) {
+				YAHOO.util.Dom.addClass(cal.oDomContainer, lastClass);
+			}
 	
-	/**
-	* True if the Calendar should show week row headers. False by default.
-	* @config SHOW_WEEK_HEADER
-	* @type Boolean
-	* @default false
-	*/	
-	this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key,{ value:defCfg.SHOW_WEEK_HEADER.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+			cal.parent = this;
+			cal.index = p; 
 	
-	/**
-	* True if the Calendar should show week row footers. False by default.
-	* @config SHOW_WEEK_FOOTER
-	* @type Boolean
-	* @default false
-	*/
-	this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key,{ value:defCfg.SHOW_WEEK_FOOTER.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+			this.pages[this.pages.length] = cal;
+		}
+	},
 	
 	/**
-	* True if the Calendar should suppress weeks that are not a part of the current month. False by default.
-	* @config HIDE_BLANK_WEEKS
-	* @type Boolean
-	* @default false
-	*/		
-	this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key,{ value:defCfg.HIDE_BLANK_WEEKS.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
+	* The default Config handler for the "pagedate" property
+	* @method configPageDate
+	* @param {String} type	The CustomEvent type (usually the property name)
+	* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+	* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
+	*/
+	configPageDate : function(type, args, obj) {
+		var val = args[0];
+		var firstPageDate;
+		
+		var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
+		
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			if (p === 0) {
+				firstPageDate = cal._parsePageDate(val);
+				cal.cfg.setProperty(cfgPageDate, firstPageDate);
+			} else {
+				var pageDate = new Date(firstPageDate);
+				this._setMonthOnDate(pageDate, pageDate.getMonth() + p);
+				cal.cfg.setProperty(cfgPageDate, pageDate);
+			}
+		}
+	},
 	
 	/**
-	* The image that should be used for the left navigation arrow.
-	* @config NAV_ARROW_LEFT
-	* @type String
-	* @deprecated	You can customize the image by overriding the default CSS class for the left arrow - "calnavleft"
-	* @default null
-	*/		
-	this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key,	{ value:defCfg.NAV_ARROW_LEFT.value, handler:this.delegateConfig } );
+	* The default Config handler for the CalendarGroup "selected" property
+	* @method configSelected
+	* @param {String} type	The CustomEvent type (usually the property name)
+	* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+	* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
+	*/
+	configSelected : function(type, args, obj) {
+		var cfgSelected = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key;
+		this.delegateConfig(type, args, obj);
+		var selected = (this.pages.length > 0) ? this.pages[0].cfg.getProperty(cfgSelected) : []; 
+		this.cfg.setProperty(cfgSelected, selected, true);
+	},
+
 	
 	/**
-	* The image that should be used for the right navigation arrow.
-	* @config NAV_ARROW_RIGHT
-	* @type String
-	* @deprecated	You can customize the image by overriding the default CSS class for the right arrow - "calnavright"
-	* @default null
-	*/		
-	this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key,	{ value:defCfg.NAV_ARROW_RIGHT.value, handler:this.delegateConfig } );
+	* Delegates a configuration property to the CustomEvents associated with the CalendarGroup's children
+	* @method delegateConfig
+	* @param {String} type	The CustomEvent type (usually the property name)
+	* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
+	* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
+	*/
+	delegateConfig : function(type, args, obj) {
+		var val = args[0];
+		var cal;
+	
+		for (var p=0;p<this.pages.length;p++) {
+			cal = this.pages[p];
+			cal.cfg.setProperty(type, val);
+		}
+	},
 
-	// Locale properties
-	
 	/**
-	* The short month labels for the current locale.
-	* @config MONTHS_SHORT
-	* @type String[]
-	* @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+	* Adds a function to all child Calendars within this CalendarGroup.
+	* @method setChildFunction
+	* @param {String}		fnName		The name of the function
+	* @param {Function}		fn			The function to apply to each Calendar page object
 	*/
-	this.cfg.addProperty(defCfg.MONTHS_SHORT.key,	{ value:defCfg.MONTHS_SHORT.value, handler:this.delegateConfig } );
+	setChildFunction : function(fnName, fn) {
+		var pageCount = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);
 	
+		for (var p=0;p<pageCount;++p) {
+			this.pages[p][fnName] = fn;
+		}
+	},
+
 	/**
-	* The long month labels for the current locale.
-	* @config MONTHS_LONG
-	* @type String[]
-	* @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
-	*/		
-	this.cfg.addProperty(defCfg.MONTHS_LONG.key,		{ value:defCfg.MONTHS_LONG.value, handler:this.delegateConfig } );
-	
+	* Calls a function within all child Calendars within this CalendarGroup.
+	* @method callChildFunction
+	* @param {String}		fnName		The name of the function
+	* @param {Array}		args		The arguments to pass to the function
+	*/
+	callChildFunction : function(fnName, args) {
+		var pageCount = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);
+	
+		for (var p=0;p<pageCount;++p) {
+			var page = this.pages[p];
+			if (page[fnName]) {
+				var fn = page[fnName];
+				fn.call(page, args);
+			}
+		}	
+	},
+
 	/**
-	* The 1-character weekday labels for the current locale.
-	* @config WEEKDAYS_1CHAR
-	* @type String[]
-	* @default ["S", "M", "T", "W", "T", "F", "S"]
-	*/		
-	this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key,	{ value:defCfg.WEEKDAYS_1CHAR.value, handler:this.delegateConfig } );
+	* Constructs a child calendar. This method can be overridden if a subclassed version of the default
+	* calendar is to be used.
+	* @method constructChild
+	* @param {String}	id			The id of the table element that will represent the calendar widget
+	* @param {String}	containerId	The id of the container div element that will wrap the calendar table
+	* @param {Object}	config		The configuration object containing the Calendar's arguments
+	* @return {YAHOO.widget.Calendar}	The YAHOO.widget.Calendar instance that is constructed
+	*/
+	constructChild : function(id,containerId,config) {
+		var container = document.getElementById(containerId);
+		if (! container) {
+			container = document.createElement("div");
+			container.id = containerId;
+			this.oDomContainer.appendChild(container);
+		}
+		return new YAHOO.widget.Calendar(id,containerId,config);
+	},
 	
 	/**
-	* The short weekday labels for the current locale.
-	* @config WEEKDAYS_SHORT
-	* @type String[]
-	* @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
-	*/		
-	this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key,	{ value:defCfg.WEEKDAYS_SHORT.value, handler:this.delegateConfig } );
-	
+	* Sets the calendar group's month explicitly. This month will be set into the first
+	* page of the multi-page calendar, and all other months will be iterated appropriately.
+	* @method setMonth
+	* @param {Number}	month		The numeric month, from 0 (January) to 11 (December)
+	*/
+	setMonth : function(month) {
+		month = parseInt(month, 10);
+		var currYear;
+
+		var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
+
+		for (var p=0; p<this.pages.length; ++p) {
+			var cal = this.pages[p];
+			var pageDate = cal.cfg.getProperty(cfgPageDate);
+			if (p === 0) {
+				currYear = pageDate.getFullYear();
+			} else {
+				pageDate.setFullYear(currYear);
+			}
+			this._setMonthOnDate(pageDate, month+p); 
+			cal.cfg.setProperty(cfgPageDate, pageDate);
+		}
+	},
+
 	/**
-	* The medium weekday labels for the current locale.
-	* @config WEEKDAYS_MEDIUM
-	* @type String[]
-	* @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
-	*/		
-	this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key,	{ value:defCfg.WEEKDAYS_MEDIUM.value, handler:this.delegateConfig } );
+	* Sets the calendar group's year explicitly. This year will be set into the first
+	* page of the multi-page calendar, and all other months will be iterated appropriately.
+	* @method setYear
+	* @param {Number}	year		The numeric 4-digit year
+	*/
+	setYear : function(year) {
+	
+		var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
+	
+		year = parseInt(year, 10);
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			var pageDate = cal.cfg.getProperty(cfgPageDate);
 	
-	/**
-	* The long weekday labels for the current locale.
-	* @config WEEKDAYS_LONG
-	* @type String[]
-	* @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
-	*/		
-	this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key,	{ value:defCfg.WEEKDAYS_LONG.value, handler:this.delegateConfig } );
+			if ((pageDate.getMonth()+1) == 1 && p>0) {
+				year+=1;
+			}
+			cal.setYear(year);
+		}
+	},
 
 	/**
-	* The setting that determines which length of month labels should be used. Possible values are "short" and "long".
-	* @config LOCALE_MONTHS
-	* @type String
-	* @default "long"
+	* Calls the render function of all child calendars within the group.
+	* @method render
 	*/
-	this.cfg.addProperty(defCfg.LOCALE_MONTHS.key,	{ value:defCfg.LOCALE_MONTHS.value, handler:this.delegateConfig } );
-
-	/**
-	* The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
-	* @config LOCALE_WEEKDAYS
-	* @type String
-	* @default "short"
-	*/	
-	this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key,	{ value:defCfg.LOCALE_WEEKDAYS.value, handler:this.delegateConfig } );
+	render : function() {
+		this.renderHeader();
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.render();
+		}
+		this.renderFooter();
+	},
 
 	/**
-	* The value used to delimit individual dates in a date string passed to various Calendar functions.
-	* @config DATE_DELIMITER
-	* @type String
-	* @default ","
-	*/
-	this.cfg.addProperty(defCfg.DATE_DELIMITER.key,		{ value:defCfg.DATE_DELIMITER.value, handler:this.delegateConfig } );
+	* Selects a date or a collection of dates on the current calendar. This method, by default,
+	* does not call the render method explicitly. Once selection has completed, render must be 
+	* called for the changes to be reflected visually.
+	* @method select
+	* @param	{String/Date/Date[]}	date	The date string of dates to select in the current calendar. Valid formats are
+	*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+	*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+	*								This method can also take a JavaScript Date object or an array of Date objects.
+	* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
+	*/
+	select : function(date) {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.select(date);
+		}
+		return this.getSelectedDates();
+	},
 
 	/**
-	* The value used to delimit date fields in a date string passed to various Calendar functions.
-	* @config DATE_FIELD_DELIMITER
-	* @type String
-	* @default "/"
-	*/	
-	this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key,{ value:defCfg.DATE_FIELD_DELIMITER.value, handler:this.delegateConfig } );
-
+	* Selects dates in the CalendarGroup based on the cell index provided. This method is used to select cells without having to do a full render. The selected style is applied to the cells directly.
+	* The value of the MULTI_SELECT Configuration attribute will determine the set of dates which get selected. 
+	* <ul>
+	*    <li>If MULTI_SELECT is false, selectCell will select the cell at the specified index for only the last displayed Calendar page.</li>
+	*    <li>If MULTI_SELECT is true, selectCell will select the cell at the specified index, on each displayed Calendar page.</li>
+	* </ul>
+	* @method selectCell
+	* @param	{Number}	cellIndex	The index of the cell to be selected. 
+	* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
+	*/
+	selectCell : function(cellIndex) {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.selectCell(cellIndex);
+		}
+		return this.getSelectedDates();
+	},
+	
 	/**
-	* The value used to delimit date ranges in a date string passed to various Calendar functions.
-	* @config DATE_RANGE_DELIMITER
-	* @type String
-	* @default "-"
-	*/
-	this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key,{ value:defCfg.DATE_RANGE_DELIMITER.value, handler:this.delegateConfig } );
-
+	* Deselects a date or a collection of dates on the current calendar. This method, by default,
+	* does not call the render method explicitly. Once deselection has completed, render must be 
+	* called for the changes to be reflected visually.
+	* @method deselect
+	* @param	{String/Date/Date[]}	date	The date string of dates to deselect in the current calendar. Valid formats are
+	*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
+	*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
+	*								This method can also take a JavaScript Date object or an array of Date objects.	
+	* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
+	*/
+	deselect : function(date) {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.deselect(date);
+		}
+		return this.getSelectedDates();
+	},
+	
 	/**
-	* The position of the month in a month/year date string
-	* @config MY_MONTH_POSITION
-	* @type Number
-	* @default 1
-	*/
-	this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key,	{ value:defCfg.MY_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	* Deselects all dates on the current calendar.
+	* @method deselectAll
+	* @return {Date[]}		Array of JavaScript Date objects representing all individual dates that are currently selected.
+	*						Assuming that this function executes properly, the return value should be an empty array.
+	*						However, the empty array is returned for the sake of being able to check the selection status
+	*						of the calendar.
+	*/
+	deselectAll : function() {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.deselectAll();
+		}
+		return this.getSelectedDates();
+	},
 	
 	/**
-	* The position of the year in a month/year date string
-	* @config MY_YEAR_POSITION
-	* @type Number
-	* @default 2
-	*/	
-	this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key,	{ value:defCfg.MY_YEAR_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	* Deselects dates in the CalendarGroup based on the cell index provided. This method is used to select cells without having to do a full render. The selected style is applied to the cells directly.
+	* deselectCell will deselect the cell at the specified index on each displayed Calendar page.
+	*
+	* @method deselectCell
+	* @param	{Number}	cellIndex	The index of the cell to deselect. 
+	* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
+	*/
+	deselectCell : function(cellIndex) {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.deselectCell(cellIndex);
+		}
+		return this.getSelectedDates();
+	},
 	
 	/**
-	* The position of the month in a month/day date string
-	* @config MD_MONTH_POSITION
-	* @type Number
-	* @default 1
-	*/	
-	this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key,	{ value:defCfg.MD_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	* Resets the calendar widget to the originally selected month and year, and 
+	* sets the calendar to the initial selection(s).
+	* @method reset
+	*/
+	reset : function() {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.reset();
+		}
+	},
 	
 	/**
-	* The position of the day in a month/year date string
-	* @config MD_DAY_POSITION
-	* @type Number
-	* @default 2
-	*/	
-	this.cfg.addProperty(defCfg.MD_DAY_POSITION.key,		{ value:defCfg.MD_DAY_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	* Clears the selected dates in the current calendar widget and sets the calendar
+	* to the current month and year.
+	* @method clear
+	*/
+	clear : function() {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.clear();
+		}
+	},
 	
 	/**
-	* The position of the month in a month/day/year date string
-	* @config MDY_MONTH_POSITION
-	* @type Number
-	* @default 1
-	*/	
-	this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key,	{ value:defCfg.MDY_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	* Navigates to the next month page in the calendar widget.
+	* @method nextMonth
+	*/
+	nextMonth : function() {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.nextMonth();
+		}
+	},
 	
 	/**
-	* The position of the day in a month/day/year date string
-	* @config MDY_DAY_POSITION
-	* @type Number
-	* @default 2
-	*/	
-	this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key,	{ value:defCfg.MDY_DAY_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	* Navigates to the previous month page in the calendar widget.
+	* @method previousMonth
+	*/
+	previousMonth : function() {
+		for (var p=this.pages.length-1;p>=0;--p) {
+			var cal = this.pages[p];
+			cal.previousMonth();
+		}
+	},
 	
 	/**
-	* The position of the year in a month/day/year date string
-	* @config MDY_YEAR_POSITION
-	* @type Number
-	* @default 3
-	*/	
-	this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key,	{ value:defCfg.MDY_YEAR_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
+	* Navigates to the next year in the currently selected month in the calendar widget.
+	* @method nextYear
+	*/
+	nextYear : function() {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.nextYear();
+		}
+	},
 
-};
+	/**
+	* Navigates to the previous year in the currently selected month in the calendar widget.
+	* @method previousYear
+	*/
+	previousYear : function() {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.previousYear();
+		}
+	},
 
-/**
-* Initializes CalendarGroup's built-in CustomEvents
-* @method initEvents
-*/
-YAHOO.widget.CalendarGroup.prototype.initEvents = function() {
-	var me = this;
-	var strEvent = "Event";
+	/**
+	* Gets the list of currently selected dates from the calendar.
+	* @return			An array of currently selected JavaScript Date objects.
+	* @type Date[]
+	*/
+	getSelectedDates : function() { 
+		var returnDates = [];
+		var selected = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key);
+		for (var d=0;d<selected.length;++d) {
+			var dateArray = selected[d];
+
+			var date = YAHOO.widget.DateMath.getDate(dateArray[0],dateArray[1]-1,dateArray[2]);
+			returnDates.push(date);
+		}
+
+		returnDates.sort( function(a,b) { return a-b; } );
+		return returnDates;
+	},
 
 	/**
-	* Proxy subscriber to subscribe to the CalendarGroup's child Calendars' CustomEvents
-	* @method sub
-	* @private
-	* @param {Function} fn	The function to subscribe to this CustomEvent
-	* @param {Object}	obj	The CustomEvent's scope object
-	* @param {Boolean}	bOverride	Whether or not to apply scope correction
-	*/
-	var sub = function(fn, obj, bOverride) {
-		for (var p=0;p<me.pages.length;++p) {
-			var cal = me.pages[p];
-			cal[this.type + strEvent].subscribe(fn, obj, bOverride);
+	* Adds a renderer to the render stack. The function reference passed to this method will be executed
+	* when a date cell matches the conditions specified in the date string for this renderer.
+	* @method addRenderer
+	* @param	{String}	sDates		A date string to associate with the specified renderer. Valid formats
+	*									include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
+	* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+	*/
+	addRenderer : function(sDates, fnRender) {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.addRenderer(sDates, fnRender);
 		}
-	};
+	},
 
 	/**
-	* Proxy unsubscriber to unsubscribe from the CalendarGroup's child Calendars' CustomEvents
-	* @method unsub
-	* @private
-	* @param {Function} fn	The function to subscribe to this CustomEvent
-	* @param {Object}	obj	The CustomEvent's scope object
-	*/
-	var unsub = function(fn, obj) {
-		for (var p=0;p<me.pages.length;++p) {
-			var cal = me.pages[p];
-			cal[this.type + strEvent].unsubscribe(fn, obj);
+	* Adds a month to the render stack. The function reference passed to this method will be executed
+	* when a date cell matches the month passed to this method.
+	* @method addMonthRenderer
+	* @param	{Number}	month		The month (1-12) to associate with this renderer
+	* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+	*/
+	addMonthRenderer : function(month, fnRender) {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.addMonthRenderer(month, fnRender);
 		}
-	};
-	
-	var defEvents = YAHOO.widget.Calendar._EVENT_TYPES;
+	},
 
 	/**
-	* Fired before a selection is made
-	* @event beforeSelectEvent
-	*/
-	this.beforeSelectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT);
-	this.beforeSelectEvent.subscribe = sub; this.beforeSelectEvent.unsubscribe = unsub;
+	* Adds a weekday to the render stack. The function reference passed to this method will be executed
+	* when a date cell matches the weekday passed to this method.
+	* @method addWeekdayRenderer
+	* @param	{Number}	weekday		The weekday (1-7) to associate with this renderer. 1=Sunday, 2=Monday etc.
+	* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
+	*/
+	addWeekdayRenderer : function(weekday, fnRender) {
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			cal.addWeekdayRenderer(weekday, fnRender);
+		}
+	},
+
+	/**
+	 * Removes all custom renderers added to the CalendarGroup through the addRenderer, addMonthRenderer and 
+	 * addWeekRenderer methods. CalendarGroup's render method needs to be called to after removing renderers 
+	 * to see the changes applied.
+	 * 
+	 * @method removeRenderers
+	 */
+	removeRenderers : function() {
+		this.callChildFunction("removeRenderers");
+	},
 
 	/**
-	* Fired when a selection is made
-	* @event selectEvent
-	* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
+	* Renders the header for the CalendarGroup.
+	* @method renderHeader
 	*/
-	this.selectEvent = new YAHOO.util.CustomEvent(defEvents.SELECT); 
-	this.selectEvent.subscribe = sub; this.selectEvent.unsubscribe = unsub;
+	renderHeader : function() {
+		// EMPTY DEFAULT IMPL
+	},
 
 	/**
-	* Fired before a selection is made
-	* @event beforeDeselectEvent
+	* Renders a footer for the 2-up calendar container. By default, this method is
+	* unimplemented.
+	* @method renderFooter
 	*/
-	this.beforeDeselectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT); 
-	this.beforeDeselectEvent.subscribe = sub; this.beforeDeselectEvent.unsubscribe = unsub;
+	renderFooter : function() {
+		// EMPTY DEFAULT IMPL
+	},
 
 	/**
-	* Fired when a selection is made
-	* @event deselectEvent
-	* @param {Array}	Array of Date field arrays in the format [YYYY, MM, DD].
+	* Adds the designated number of months to the current calendar month, and sets the current
+	* calendar page date to the new month.
+	* @method addMonths
+	* @param {Number}	count	The number of months to add to the current calendar
 	*/
-	this.deselectEvent = new YAHOO.util.CustomEvent(defEvents.DESELECT); 
-	this.deselectEvent.subscribe = sub; this.deselectEvent.unsubscribe = unsub;
+	addMonths : function(count) {
+		this.callChildFunction("addMonths", count);
+	},
 	
 	/**
-	* Fired when the Calendar page is changed
-	* @event changePageEvent
+	* Subtracts the designated number of months from the current calendar month, and sets the current
+	* calendar page date to the new month.
+	* @method subtractMonths
+	* @param {Number}	count	The number of months to subtract from the current calendar
 	*/
-	this.changePageEvent = new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE); 
-	this.changePageEvent.subscribe = sub; this.changePageEvent.unsubscribe = unsub;
+	subtractMonths : function(count) {
+		this.callChildFunction("subtractMonths", count);
+	},
 
 	/**
-	* Fired before the Calendar is rendered
-	* @event beforeRenderEvent
+	* Adds the designated number of years to the current calendar, and sets the current
+	* calendar page date to the new month.
+	* @method addYears
+	* @param {Number}	count	The number of years to add to the current calendar
 	*/
-	this.beforeRenderEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);
-	this.beforeRenderEvent.subscribe = sub; this.beforeRenderEvent.unsubscribe = unsub;
+	addYears : function(count) {
+		this.callChildFunction("addYears", count);
+	},
 
 	/**
-	* Fired when the Calendar is rendered
-	* @event renderEvent
+	* Subtcats the designated number of years from the current calendar, and sets the current
+	* calendar page date to the new month.
+	* @method subtractYears
+	* @param {Number}	count	The number of years to subtract from the current calendar
 	*/
-	this.renderEvent = new YAHOO.util.CustomEvent(defEvents.RENDER);
-	this.renderEvent.subscribe = sub; this.renderEvent.unsubscribe = unsub;
+	subtractYears : function(count) {
+		this.callChildFunction("subtractYears", count);
+	},
 
 	/**
-	* Fired when the Calendar is reset
-	* @event resetEvent
-	*/
-	this.resetEvent = new YAHOO.util.CustomEvent(defEvents.RESET); 
-	this.resetEvent.subscribe = sub; this.resetEvent.unsubscribe = unsub;
+	 * Returns the Calendar page instance which has a pagedate (month/year) matching the given date. 
+	 * Returns null if no match is found.
+	 * 
+	 * @method getCalendarPage
+	 * @param {Date} date The JavaScript Date object for which a Calendar page is to be found.
+	 * @return {Calendar} The Calendar page instance representing the month to which the date 
+	 * belongs.
+	 */
+	getCalendarPage : function(date) {
+		var cal = null;
+		if (date) {
+			var y = date.getFullYear(),
+				m = date.getMonth();
+
+			var pages = this.pages;
+			for (var i = 0; i < pages.length; ++i) {
+				var pageDate = pages[i].cfg.getProperty("pagedate");
+				if (pageDate.getFullYear() === y && pageDate.getMonth() === m) {
+					cal = pages[i];
+					break;
+				}
+			}
+		}
+		return cal;
+	},
 
 	/**
-	* Fired when the Calendar is cleared
-	* @event clearEvent
+	* Sets the month on a Date object, taking into account year rollover if the month is less than 0 or greater than 11.
+	* The Date object passed in is modified. It should be cloned before passing it into this method if the original value needs to be maintained
+	* @method	_setMonthOnDate
+	* @private
+	* @param	{Date}	date	The Date object on which to set the month index
+	* @param	{Number}	iMonth	The month index to set
 	*/
-	this.clearEvent = new YAHOO.util.CustomEvent(defEvents.CLEAR);
-	this.clearEvent.subscribe = sub; this.clearEvent.unsubscribe = unsub;
-
-};
-
-/**
-* The default Config handler for the "pages" property
-* @method configPages
-* @param {String} type	The CustomEvent type (usually the property name)
-* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.CalendarGroup.prototype.configPages = function(type, args, obj) {
-	var pageCount = args[0];
-
-	var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
-
-	// Define literals outside loop	
-	var sep = "_";
-	var groupCalClass = "groupcal";
-	var firstClass = "first";
-	var lastClass = "last";
-
-	for (var p=0;p<pageCount;++p) {
-		var calId = this.id + sep + p;
-		var calContainerId = this.containerId + sep + p;
-
-		var childConfig = this.cfg.getConfig();
-		childConfig.close = false;
-		childConfig.title = false;
-
-		var cal = this.constructChild(calId, calContainerId, childConfig);
-		var caldate = cal.cfg.getProperty(cfgPageDate);
-		this._setMonthOnDate(caldate, caldate.getMonth() + p);
-		cal.cfg.setProperty(cfgPageDate, caldate);
-		
-		YAHOO.util.Dom.removeClass(cal.oDomContainer, this.Style.CSS_SINGLE);
-		YAHOO.util.Dom.addClass(cal.oDomContainer, groupCalClass);
-		
-		if (p===0) {
-			YAHOO.util.Dom.addClass(cal.oDomContainer, firstClass);
-		}
-
-		if (p==(pageCount-1)) {
-			YAHOO.util.Dom.addClass(cal.oDomContainer, lastClass);
-		}
-		
-		cal.parent = this;
-		cal.index = p; 
-
-		this.pages[this.pages.length] = cal;
-	}
-};
-
-/**
-* The default Config handler for the "pagedate" property
-* @method configPageDate
-* @param {String} type	The CustomEvent type (usually the property name)
-* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.CalendarGroup.prototype.configPageDate = function(type, args, obj) {
-	var val = args[0];
-	var firstPageDate;
-	
-	var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
-	
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		if (p === 0) {
-			firstPageDate = cal._parsePageDate(val);
-			cal.cfg.setProperty(cfgPageDate, firstPageDate);
-		} else {
-			var pageDate = new Date(firstPageDate);
-			this._setMonthOnDate(pageDate, pageDate.getMonth() + p);
-			cal.cfg.setProperty(cfgPageDate, pageDate);
-		}
-	}
-};
-
-/**
-* The default Config handler for the CalendarGroup "selected" property
-* @method configSelected
-* @param {String} type	The CustomEvent type (usually the property name)
-* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.CalendarGroup.prototype.configSelected = function(type, args, obj) {
-	var cfgSelected = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key;
-	this.delegateConfig(type, args, obj);
-	var selected = (this.pages.length > 0) ? this.pages[0].cfg.getProperty(cfgSelected) : []; 
-	this.cfg.setProperty(cfgSelected, selected, true);
-};
-
-
-/**
-* Delegates a configuration property to the CustomEvents associated with the CalendarGroup's children
-* @method delegateConfig
-* @param {String} type	The CustomEvent type (usually the property name)
-* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
-* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.
-*/
-YAHOO.widget.CalendarGroup.prototype.delegateConfig = function(type, args, obj) {
-	var val = args[0];
-	var cal;
-
-	for (var p=0;p<this.pages.length;p++) {
-		cal = this.pages[p];
-		cal.cfg.setProperty(type, val);
-	}
-};
-
-
-/**
-* Adds a function to all child Calendars within this CalendarGroup.
-* @method setChildFunction
-* @param {String}		fnName		The name of the function
-* @param {Function}		fn			The function to apply to each Calendar page object
-*/
-YAHOO.widget.CalendarGroup.prototype.setChildFunction = function(fnName, fn) {
-	var pageCount = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);
-
-	for (var p=0;p<pageCount;++p) {
-		this.pages[p][fnName] = fn;
-	}
-};
-
-/**
-* Calls a function within all child Calendars within this CalendarGroup.
-* @method callChildFunction
-* @param {String}		fnName		The name of the function
-* @param {Array}		args		The arguments to pass to the function
-*/
-YAHOO.widget.CalendarGroup.prototype.callChildFunction = function(fnName, args) {
-	var pageCount = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);
-
-	for (var p=0;p<pageCount;++p) {
-		var page = this.pages[p];
-		if (page[fnName]) {
-			var fn = page[fnName];
-			fn.call(page, args);
-		}
-	}	
-};
-
-/**
-* Constructs a child calendar. This method can be overridden if a subclassed version of the default
-* calendar is to be used.
-* @method constructChild
-* @param {String}	id			The id of the table element that will represent the calendar widget
-* @param {String}	containerId	The id of the container div element that will wrap the calendar table
-* @param {Object}	config		The configuration object containing the Calendar's arguments
-* @return {YAHOO.widget.Calendar}	The YAHOO.widget.Calendar instance that is constructed
-*/
-YAHOO.widget.CalendarGroup.prototype.constructChild = function(id,containerId,config) {
-	var container = document.getElementById(containerId);
-	if (! container) {
-		container = document.createElement("div");
-		container.id = containerId;
-		this.oDomContainer.appendChild(container);
-	}
-	return new YAHOO.widget.Calendar(id,containerId,config);
-};
-
-
-/**
-* Sets the calendar group's month explicitly. This month will be set into the first
-* page of the multi-page calendar, and all other months will be iterated appropriately.
-* @method setMonth
-* @param {Number}	month		The numeric month, from 0 (January) to 11 (December)
-*/
-YAHOO.widget.CalendarGroup.prototype.setMonth = function(month) {
-	month = parseInt(month, 10);
-	var currYear;
-	
-	var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
-	
-	for (var p=0; p<this.pages.length; ++p) {
-		var cal = this.pages[p];
-		var pageDate = cal.cfg.getProperty(cfgPageDate);
-		if (p === 0) {
-			currYear = pageDate.getFullYear();
+	_setMonthOnDate : function(date, iMonth) {
+		// Bug in Safari 1.3, 2.0 (WebKit build < 420), Date.setMonth does not work consistently if iMonth is not 0-11
+		if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420 && (iMonth < 0 || iMonth > 11)) {
+			var DM = YAHOO.widget.DateMath;
+			var newDate = DM.add(date, DM.MONTH, iMonth-date.getMonth());
+			date.setTime(newDate.getTime());
 		} else {
-			pageDate.setYear(currYear);
-		}
-		this._setMonthOnDate(pageDate, month+p); 
-		cal.cfg.setProperty(cfgPageDate, pageDate);
-	}
-};
-
-/**
-* Sets the calendar group's year explicitly. This year will be set into the first
-* page of the multi-page calendar, and all other months will be iterated appropriately.
-* @method setYear
-* @param {Number}	year		The numeric 4-digit year
-*/
-YAHOO.widget.CalendarGroup.prototype.setYear = function(year) {
-
-	var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
-
-	year = parseInt(year, 10);
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		var pageDate = cal.cfg.getProperty(cfgPageDate);
-
-		if ((pageDate.getMonth()+1) == 1 && p>0) {
-			year+=1;
+			date.setMonth(iMonth);
 		}
-		cal.setYear(year);
-	}
-};
-/**
-* Calls the render function of all child calendars within the group.
-* @method render
-*/
-YAHOO.widget.CalendarGroup.prototype.render = function() {
-	this.renderHeader();
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.render();
-	}
-	this.renderFooter();
-};
-
-/**
-* Selects a date or a collection of dates on the current calendar. This method, by default,
-* does not call the render method explicitly. Once selection has completed, render must be 
-* called for the changes to be reflected visually.
-* @method select
-* @param	{String/Date/Date[]}	date	The date string of dates to select in the current calendar. Valid formats are
-*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
-*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
-*								This method can also take a JavaScript Date object or an array of Date objects.
-* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
-*/
-YAHOO.widget.CalendarGroup.prototype.select = function(date) {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.select(date);
-	}
-	return this.getSelectedDates();
-};
-
-/**
-* Selects dates in the CalendarGroup based on the cell index provided. This method is used to select cells without having to do a full render. The selected style is applied to the cells directly.
-* The value of the MULTI_SELECT Configuration attribute will determine the set of dates which get selected. 
-* <ul>
-*    <li>If MULTI_SELECT is false, selectCell will select the cell at the specified index for only the last displayed Calendar page.</li>
-*    <li>If MULTI_SELECT is true, selectCell will select the cell at the specified index, on each displayed Calendar page.</li>
-* </ul>
-* @method selectCell
-* @param	{Number}	cellIndex	The index of the cell to be selected. 
-* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
-*/
-YAHOO.widget.CalendarGroup.prototype.selectCell = function(cellIndex) {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.selectCell(cellIndex);
-	}
-	return this.getSelectedDates();
-};
-
-/**
-* Deselects a date or a collection of dates on the current calendar. This method, by default,
-* does not call the render method explicitly. Once deselection has completed, render must be 
-* called for the changes to be reflected visually.
-* @method deselect
-* @param	{String/Date/Date[]}	date	The date string of dates to deselect in the current calendar. Valid formats are
-*								individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
-*								Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
-*								This method can also take a JavaScript Date object or an array of Date objects.	
-* @return	{Date[]}			Array of JavaScript Date objects representing all individual dates that are currently selected.
-*/
-YAHOO.widget.CalendarGroup.prototype.deselect = function(date) {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.deselect(date);
-	}
-	return this.getSelectedDates();
-};
-
-/**
-* Deselects all dates on the current calendar.
-* @method deselectAll
-* @return {Date[]}		Array of JavaScript Date objects representing all individual dates that are currently selected.
-*						Assuming that this function executes properly, the return value should be an empty array.
-*						However, the empty array is returned for the sake of being able to check the selection status
-*						of the calendar.
-*/
-YAHOO.widget.CalendarGroup.prototype.deselectAll = function() {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.deselectAll();
-	}
-	return this.getSelectedDates();
-};
-
-/**
-* Deselects dates in the CalendarGroup based on the cell index provided. This method is used to select cells without having to do a full render. The selected style is applied to the cells directly.
-* deselectCell will deselect the cell at the specified index on each displayed Calendar page.
-*
-* @method deselectCell
-* @param	{Number}	cellIndex	The index of the cell to deselect. 
-* @return	{Date[]}	Array of JavaScript Date objects representing all individual dates that are currently selected.
-*/
-YAHOO.widget.CalendarGroup.prototype.deselectCell = function(cellIndex) {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.deselectCell(cellIndex);
-	}
-	return this.getSelectedDates();
-};
-
-/**
-* Resets the calendar widget to the originally selected month and year, and 
-* sets the calendar to the initial selection(s).
-* @method reset
-*/
-YAHOO.widget.CalendarGroup.prototype.reset = function() {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.reset();
-	}
-};
-
-/**
-* Clears the selected dates in the current calendar widget and sets the calendar
-* to the current month and year.
-* @method clear
-*/
-YAHOO.widget.CalendarGroup.prototype.clear = function() {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.clear();
-	}
-};
-
-/**
-* Navigates to the next month page in the calendar widget.
-* @method nextMonth
-*/
-YAHOO.widget.CalendarGroup.prototype.nextMonth = function() {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.nextMonth();
-	}
-};
-
-/**
-* Navigates to the previous month page in the calendar widget.
-* @method previousMonth
-*/
-YAHOO.widget.CalendarGroup.prototype.previousMonth = function() {
-	for (var p=this.pages.length-1;p>=0;--p) {
-		var cal = this.pages[p];
-		cal.previousMonth();
-	}
-};
-
-/**
-* Navigates to the next year in the currently selected month in the calendar widget.
-* @method nextYear
-*/
-YAHOO.widget.CalendarGroup.prototype.nextYear = function() {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.nextYear();
-	}
-};
-
-/**
-* Navigates to the previous year in the currently selected month in the calendar widget.
-* @method previousYear
-*/
-YAHOO.widget.CalendarGroup.prototype.previousYear = function() {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.previousYear();
-	}
-};
-
-
-/**
-* Gets the list of currently selected dates from the calendar.
-* @return			An array of currently selected JavaScript Date objects.
-* @type Date[]
-*/
-YAHOO.widget.CalendarGroup.prototype.getSelectedDates = function() { 
-	var returnDates = [];
-	var selected = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key);
-	for (var d=0;d<selected.length;++d) {
-		var dateArray = selected[d];
-
-		var date = new Date(dateArray[0],dateArray[1]-1,dateArray[2]);
-		returnDates.push(date);
-	}
-
-	returnDates.sort( function(a,b) { return a-b; } );
-	return returnDates;
-};
-
-/**
-* Adds a renderer to the render stack. The function reference passed to this method will be executed
-* when a date cell matches the conditions specified in the date string for this renderer.
-* @method addRenderer
-* @param	{String}	sDates		A date string to associate with the specified renderer. Valid formats
-*									include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
-* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
-*/
-YAHOO.widget.CalendarGroup.prototype.addRenderer = function(sDates, fnRender) {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.addRenderer(sDates, fnRender);
-	}
-};
-
-/**
-* Adds a month to the render stack. The function reference passed to this method will be executed
-* when a date cell matches the month passed to this method.
-* @method addMonthRenderer
-* @param	{Number}	month		The month (1-12) to associate with this renderer
-* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
-*/
-YAHOO.widget.CalendarGroup.prototype.addMonthRenderer = function(month, fnRender) {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.addMonthRenderer(month, fnRender);
-	}
-};
-
-/**
-* Adds a weekday to the render stack. The function reference passed to this method will be executed
-* when a date cell matches the weekday passed to this method.
-* @method addWeekdayRenderer
-* @param	{Number}	weekday		The weekday (0-6) to associate with this renderer
-* @param	{Function}	fnRender	The function executed to render cells that match the render rules for this renderer.
-*/
-YAHOO.widget.CalendarGroup.prototype.addWeekdayRenderer = function(weekday, fnRender) {
-	for (var p=0;p<this.pages.length;++p) {
-		var cal = this.pages[p];
-		cal.addWeekdayRenderer(weekday, fnRender);
-	}
-};
-
-/**
-* Renders the header for the CalendarGroup.
-* @method renderHeader
-*/
-YAHOO.widget.CalendarGroup.prototype.renderHeader = function() {};
-
-/**
-* Renders a footer for the 2-up calendar container. By default, this method is
-* unimplemented.
-* @method renderFooter
-*/
-YAHOO.widget.CalendarGroup.prototype.renderFooter = function() {};
-
-/**
-* Adds the designated number of months to the current calendar month, and sets the current
-* calendar page date to the new month.
-* @method addMonths
-* @param {Number}	count	The number of months to add to the current calendar
-*/
-YAHOO.widget.CalendarGroup.prototype.addMonths = function(count) {
-	this.callChildFunction("addMonths", count);
-};
-
-
-/**
-* Subtracts the designated number of months from the current calendar month, and sets the current
-* calendar page date to the new month.
-* @method subtractMonths
-* @param {Number}	count	The number of months to subtract from the current calendar
-*/
-YAHOO.widget.CalendarGroup.prototype.subtractMonths = function(count) {
-	this.callChildFunction("subtractMonths", count);
-};
-
-/**
-* Adds the designated number of years to the current calendar, and sets the current
-* calendar page date to the new month.
-* @method addYears
-* @param {Number}	count	The number of years to add to the current calendar
-*/
-YAHOO.widget.CalendarGroup.prototype.addYears = function(count) {
-	this.callChildFunction("addYears", count);
-};
-
-/**
-* Subtcats the designated number of years from the current calendar, and sets the current
-* calendar page date to the new month.
-* @method subtractYears
-* @param {Number}	count	The number of years to subtract from the current calendar
-*/
-YAHOO.widget.CalendarGroup.prototype.subtractYears = function(count) {
-	this.callChildFunction("subtractYears", count);
-};
-
-/**
-* Sets the month on a Date object, taking into account year rollover if the month is less than 0 or greater than 11.
-* The Date object passed in is modified. It should be cloned before passing it into this method if the original value needs to be maintained
-* @method	_setMonthOnDate
-* @private
-* @param	{Date}	date	The Date object on which to set the month index
-* @param	{Number}	iMonth	The month index to set
-*/
-YAHOO.widget.CalendarGroup.prototype._setMonthOnDate = function(date, iMonth) {
-	// BUG in Safari 1.3, 2.0 (WebKit build < 420), Date.setMonth does not work consistently if iMonth is not 0-11
-	if (this.browser == "safari" && (iMonth < 0 || iMonth > 11)) {
-		var DM = YAHOO.widget.DateMath;
-		var newDate = DM.add(date, DM.MONTH, iMonth-date.getMonth());
-		date.setTime(newDate.getTime());
-	} else {
-		date.setMonth(iMonth);
+	},
+	
+	/**
+	 * Fixes the width of the CalendarGroup container element, to account for miswrapped floats
+	 * @method _fixWidth
+	 * @private
+	 */
+	_fixWidth : function() {
+		var w = 0;
+		for (var p=0;p<this.pages.length;++p) {
+			var cal = this.pages[p];
+			w += cal.oDomContainer.offsetWidth;
+		}
+		if (w > 0) {
+			this.oDomContainer.style.width = w + "px";
+		}
+	},
+	
+	/**
+	* Returns a string representation of the object.
+	* @method toString
+	* @return {String}	A string representation of the CalendarGroup object.
+	*/
+	toString : function() {
+		return "CalendarGroup " + this.id;
 	}
 };
 
-
 /**
 * CSS class representing the container for the calendar
 * @property YAHOO.widget.CalendarGroup.CSS_CONTAINER
@@ -4496,7 +5497,7 @@
 */
 YAHOO.widget.CalendarGroup.CSS_2UPCLOSE = "close-icon";
 
-YAHOO.augment(YAHOO.widget.CalendarGroup, YAHOO.widget.Calendar, "buildDayLabel",
+YAHOO.lang.augmentProto(YAHOO.widget.CalendarGroup, YAHOO.widget.Calendar, "buildDayLabel",
 																 "buildMonthLabel",
 																 "renderOutOfBoundsDate",
 																 "renderRowHeader",
@@ -4510,13 +5511,21 @@
 																 "renderCellStyleToday",
 																 "renderCellStyleSelected",
 																 "renderCellNotThisMonth",
+																 "renderCellStyleNotThisMonth",
 																 "renderBodyCellRestricted",
 																 "initStyles",
 																 "configTitle",
 																 "configClose",
 																 "configIframe",
+																 "configNavigator",
+																 "createTitleBar",
+																 "createCloseButton",
+																 "removeTitleBar",
+																 "removeCloseButton",
 																 "hide",
 																 "show",
+																 "toDate",
+																 "_parseArgs",
 																 "browser");
 
 /**
@@ -4530,15 +5539,6 @@
 YAHOO.widget.CalendarGroup._DEFAULT_CONFIG = YAHOO.widget.Calendar._DEFAULT_CONFIG;
 YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES = {key:"pages", value:2};
 
-/**
-* Returns a string representation of the object.
-* @method toString
-* @return {String}	A string representation of the CalendarGroup object.
-*/
-YAHOO.widget.CalendarGroup.prototype.toString = function() {
-	return "CalendarGroup " + this.id;
-};
-
 YAHOO.widget.CalGrp = YAHOO.widget.CalendarGroup;
 
 /**
@@ -4557,4 +5557,1241 @@
 */
 YAHOO.widget.Cal2up = YAHOO.widget.Calendar2up;
 
-YAHOO.register("calendar", YAHOO.widget.Calendar, {version: "2.2.1", build: "193"});
+/**
+ * The CalendarNavigator is used along with a Calendar/CalendarGroup to 
+ * provide a Month/Year popup navigation control, allowing the user to navigate 
+ * to a specific month/year in the Calendar/CalendarGroup without having to 
+ * scroll through months sequentially
+ *
+ * @namespace YAHOO.widget
+ * @class CalendarNavigator
+ * @constructor
+ * @param {Calendar|CalendarGroup} cal The instance of the Calendar or CalendarGroup to which this CalendarNavigator should be attached.
+ */
+YAHOO.widget.CalendarNavigator = function(cal) {
+	this.init(cal);
+};
+
+(function() {
+	// Setup static properties (inside anon fn, so that we can use shortcuts)
+	var CN = YAHOO.widget.CalendarNavigator;
+
+	/**
+	 * YAHOO.widget.CalendarNavigator.CLASSES contains constants
+	 * for the class values applied to the CalendarNaviatgator's 
+	 * DOM elements
+	 * @property YAHOO.widget.CalendarNavigator.CLASSES
+	 * @type Object
+	 * @static
+	 */
+	CN.CLASSES = {
+		/**
+		 * Class applied to the Calendar Navigator's bounding box
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.NAV
+		 * @type String
+		 * @static
+		 */
+		NAV :"yui-cal-nav",
+		/**
+		 * Class applied to the Calendar/CalendarGroup's bounding box to indicate
+		 * the Navigator is currently visible
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.NAV_VISIBLE
+		 * @type String
+		 * @static
+		 */
+		NAV_VISIBLE: "yui-cal-nav-visible",
+		/**
+		 * Class applied to the Navigator mask's bounding box
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.MASK
+		 * @type String
+		 * @static
+		 */
+		MASK : "yui-cal-nav-mask",
+		/**
+		 * Class applied to the year label/control bounding box
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.YEAR
+		 * @type String
+		 * @static
+		 */
+		YEAR : "yui-cal-nav-y",
+		/**
+		 * Class applied to the month label/control bounding box
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.MONTH
+		 * @type String
+		 * @static
+		 */
+		MONTH : "yui-cal-nav-m",
+		/**
+		 * Class applied to the submit/cancel button's bounding box
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.BUTTONS
+		 * @type String
+		 * @static
+		 */
+		BUTTONS : "yui-cal-nav-b",
+		/**
+		 * Class applied to buttons wrapping element
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.BUTTON
+		 * @type String
+		 * @static
+		 */
+		BUTTON : "yui-cal-nav-btn",
+		/**
+		 * Class applied to the validation error area's bounding box
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.ERROR
+		 * @type String
+		 * @static
+		 */
+		ERROR : "yui-cal-nav-e",
+		/**
+		 * Class applied to the year input control
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.YEAR_CTRL
+		 * @type String
+		 * @static
+		 */
+		YEAR_CTRL : "yui-cal-nav-yc",
+		/**
+		 * Class applied to the month input control
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.MONTH_CTRL
+		 * @type String
+		 * @static
+		 */
+		MONTH_CTRL : "yui-cal-nav-mc",
+		/**
+		 * Class applied to controls with invalid data (e.g. a year input field with invalid an year)
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.INVALID
+		 * @type String
+		 * @static
+		 */
+		INVALID : "yui-invalid",
+		/**
+		 * Class applied to default controls
+		 * @property YAHOO.widget.CalendarNavigator.CLASSES.DEFAULT
+		 * @type String
+		 * @static
+		 */
+		DEFAULT : "yui-default"
+	};
+
+	/**
+	 * Object literal containing the default configuration values for the CalendarNavigator
+	 * The configuration object is expected to follow the format below, with the properties being
+	 * case sensitive.
+	 * <dl>
+	 * <dt>strings</dt>
+	 * <dd><em>Object</em> :  An object with the properties shown below, defining the string labels to use in the Navigator's UI
+	 *     <dl>
+	 *         <dt>month</dt><dd><em>String</em> : The string to use for the month label. Defaults to "Month".</dd>
+	 *         <dt>year</dt><dd><em>String</em> : The string to use for the year label. Defaults to "Year".</dd>
+	 *         <dt>submit</dt><dd><em>String</em> : The string to use for the submit button label. Defaults to "Okay".</dd>
+	 *         <dt>cancel</dt><dd><em>String</em> : The string to use for the cancel button label. Defaults to "Cancel".</dd>
+	 *         <dt>invalidYear</dt><dd><em>String</em> : The string to use for invalid year values. Defaults to "Year needs to be a number".</dd>
+	 *     </dl>
+	 * </dd>
+	 * <dt>monthFormat</dt><dd><em>String</em> : The month format to use. Either YAHOO.widget.Calendar.LONG, or YAHOO.widget.Calendar.SHORT. Defaults to YAHOO.widget.Calendar.LONG</dd>
+	 * <dt>initialFocus</dt><dd><em>String</em> : Either "year" or "month" specifying which input control should get initial focus. Defaults to "year"</dd>
+	 * </dl>
+	 * @property _DEFAULT_CFG
+	 * @protected
+	 * @type Object
+	 * @static
+	 */
+	CN._DEFAULT_CFG = {
+		strings : {
+			month: "Month",
+			year: "Year",
+			submit: "Okay",
+			cancel: "Cancel",
+			invalidYear : "Year needs to be a number"
+		},
+		monthFormat: YAHOO.widget.Calendar.LONG,
+		initialFocus: "year"
+	};
+
+	/**
+	 * The suffix added to the Calendar/CalendarGroup's ID, to generate
+	 * a unique ID for the Navigator and it's bounding box.
+	 * @property YAHOO.widget.CalendarNavigator.ID_SUFFIX
+	 * @static
+	 * @type String
+	 * @final
+	 */
+	CN.ID_SUFFIX = "_nav";
+	/**
+	 * The suffix added to the Navigator's ID, to generate
+	 * a unique ID for the month control.
+	 * @property YAHOO.widget.CalendarNavigator.MONTH_SUFFIX
+	 * @static
+	 * @type String 
+	 * @final
+	 */
+	CN.MONTH_SUFFIX = "_month";
+	/**
+	 * The suffix added to the Navigator's ID, to generate
+	 * a unique ID for the year control.
+	 * @property YAHOO.widget.CalendarNavigator.YEAR_SUFFIX
+	 * @static
+	 * @type String
+	 * @final
+	 */
+	CN.YEAR_SUFFIX = "_year";
+	/**
+	 * The suffix added to the Navigator's ID, to generate
+	 * a unique ID for the error bounding box.
+	 * @property YAHOO.widget.CalendarNavigator.ERROR_SUFFIX
+	 * @static
+	 * @type String
+	 * @final
+	 */
+	CN.ERROR_SUFFIX = "_error";
+	/**
+	 * The suffix added to the Navigator's ID, to generate
+	 * a unique ID for the "Cancel" button.
+	 * @property YAHOO.widget.CalendarNavigator.CANCEL_SUFFIX
+	 * @static
+	 * @type String
+	 * @final
+	 */
+	CN.CANCEL_SUFFIX = "_cancel";
+	/**
+	 * The suffix added to the Navigator's ID, to generate
+	 * a unique ID for the "Submit" button.
+	 * @property YAHOO.widget.CalendarNavigator.SUBMIT_SUFFIX
+	 * @static
+	 * @type String
+	 * @final
+	 */
+	CN.SUBMIT_SUFFIX = "_submit";
+
+	/**
+	 * The number of digits to which the year input control is to be limited.
+	 * @property YAHOO.widget.CalendarNavigator.YR_MAX_DIGITS
+	 * @static
+	 * @type Number
+	 */
+	CN.YR_MAX_DIGITS = 4;
+
+	/**
+	 * The amount by which to increment the current year value,
+	 * when the arrow up/down key is pressed on the year control
+	 * @property YAHOO.widget.CalendarNavigator.YR_MINOR_INC
+	 * @static
+	 * @type Number
+	 */
+	CN.YR_MINOR_INC = 1;
+
+	/**
+	 * The amount by which to increment the current year value,
+	 * when the page up/down key is pressed on the year control
+	 * @property YAHOO.widget.CalendarNavigator.YR_MAJOR_INC
+	 * @static
+	 * @type Number
+	 */
+	CN.YR_MAJOR_INC = 10;
+
+	/**
+	 * Artificial delay (in ms) between the time the Navigator is hidden
+	 * and the Calendar/CalendarGroup state is updated. Allows the user
+	 * the see the Calendar/CalendarGroup page changing. If set to 0
+	 * the Calendar/CalendarGroup page will be updated instantly
+	 * @property YAHOO.widget.CalendarNavigator.UPDATE_DELAY
+	 * @static
+	 * @type Number
+	 */
+	CN.UPDATE_DELAY = 50;
+
+	/**
+	 * Regular expression used to validate the year input
+	 * @property YAHOO.widget.CalendarNavigator.YR_PATTERN
+	 * @static
+	 * @type RegExp
+	 */
+	CN.YR_PATTERN = /^\d+$/;
+	/**
+	 * Regular expression used to trim strings
+	 * @property YAHOO.widget.CalendarNavigator.TRIM
+	 * @static
+	 * @type RegExp
+	 */
+	CN.TRIM = /^\s*(.*?)\s*$/;
+})();
+
+YAHOO.widget.CalendarNavigator.prototype = {
+
+	/**
+	 * The unique ID for this CalendarNavigator instance
+	 * @property id
+	 * @type String
+	 */
+	id : null,
+
+	/**
+	 * The Calendar/CalendarGroup instance to which the navigator belongs
+	 * @property cal
+	 * @type {Calendar|CalendarGroup}
+	 */
+	cal : null,
+
+	/**
+	 * Reference to the HTMLElement used to render the navigator's bounding box
+	 * @property navEl
+	 * @type HTMLElement
+	 */
+	navEl : null,
+
+	/**
+	 * Reference to the HTMLElement used to render the navigator's mask
+	 * @property maskEl
+	 * @type HTMLElement
+	 */
+	maskEl : null,
+
+	/**
+	 * Reference to the HTMLElement used to input the year
+	 * @property yearEl
+	 * @type HTMLElement
+	 */
+	yearEl : null,
+
+	/**
+	 * Reference to the HTMLElement used to input the month
+	 * @property monthEl
+	 * @type HTMLElement
+	 */
+	monthEl : null,
+
+	/**
+	 * Reference to the HTMLElement used to display validation errors
+	 * @property errorEl
+	 * @type HTMLElement
+	 */
+	errorEl : null,
+
+	/**
+	 * Reference to the HTMLElement used to update the Calendar/Calendar group
+	 * with the month/year values
+	 * @property submitEl
+	 * @type HTMLElement
+	 */
+	submitEl : null,
+	
+	/**
+	 * Reference to the HTMLElement used to hide the navigator without updating the 
+	 * Calendar/Calendar group
+	 * @property cancelEl
+	 * @type HTMLElement
+	 */
+	cancelEl : null,
+
+	/** 
+	 * Reference to the first focusable control in the navigator (by default monthEl)
+	 * @property firstCtrl
+	 * @type HTMLElement
+	 */
+	firstCtrl : null,
+	
+	/** 
+	 * Reference to the last focusable control in the navigator (by default cancelEl)
+	 * @property lastCtrl
+	 * @type HTMLElement
+	 */
+	lastCtrl : null,
+
+	/**
+	 * The document containing the Calendar/Calendar group instance
+	 * @protected
+	 * @property _doc
+	 * @type HTMLDocument
+	 */
+	_doc : null,
+
+	/**
+	 * Internal state property for the current year displayed in the navigator
+	 * @protected
+	 * @property _year
+	 * @type Number
+	 */
+	_year: null,
+	
+	/**
+	 * Internal state property for the current month index displayed in the navigator
+	 * @protected
+	 * @property _month
+	 * @type Number
+	 */
+	_month: 0,
+
+	/**
+	 * Private internal state property which indicates whether or not the 
+	 * Navigator has been rendered.
+	 * @private
+	 * @property __rendered
+	 * @type Boolean
+	 */
+	__rendered: false,
+
+	/**
+	 * Init lifecycle method called as part of construction
+	 * 
+	 * @method init
+	 * @param {Calendar} cal The instance of the Calendar or CalendarGroup to which this CalendarNavigator should be attached
+	 */
+	init : function(cal) {
+		var calBox = cal.oDomContainer;
+
+		this.cal = cal;
+		this.id = calBox.id + YAHOO.widget.CalendarNavigator.ID_SUFFIX;
+		this._doc = calBox.ownerDocument;
+
+		/**
+		 * Private flag, to identify IE6/IE7 Quirks
+		 * @private
+		 * @property __isIEQuirks
+		 */
+		var ie = YAHOO.env.ua.ie;
+		this.__isIEQuirks = (ie && ((ie <= 6) || (ie === 7 && this._doc.compatMode == "BackCompat")));
+	},
+
+	/**
+	 * Displays the navigator and mask, updating the input controls to reflect the 
+	 * currently set month and year. The show method will invoke the render method
+	 * if the navigator has not been renderered already, allowing for lazy rendering
+	 * of the control.
+	 * 
+	 * The show method will fire the Calendar/CalendarGroup's beforeShowNav and showNav events
+	 * 
+	 * @method show
+	 */
+	show : function() {
+		var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
+
+		if (this.cal.beforeShowNavEvent.fire()) {
+			if (!this.__rendered) {
+				this.render();
+			}
+			this.clearErrors();
+
+			this._updateMonthUI();
+			this._updateYearUI();
+			this._show(this.navEl, true);
+
+			this.setInitialFocus();
+			this.showMask();
+
+			YAHOO.util.Dom.addClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
+			this.cal.showNavEvent.fire();
+		}
+	},
+
+	/**
+	 * Hides the navigator and mask
+	 * 
+	 * The show method will fire the Calendar/CalendarGroup's beforeHideNav event and hideNav events
+	 * @method hide
+	 */
+	hide : function() {
+		var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
+
+		if (this.cal.beforeHideNavEvent.fire()) {
+			this._show(this.navEl, false);
+			this.hideMask();
+			YAHOO.util.Dom.removeClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
+			this.cal.hideNavEvent.fire();
+		}
+	},
+	
+
+	/**
+	 * Displays the navigator's mask element
+	 * 
+	 * @method showMask
+	 */
+	showMask : function() {
+		this._show(this.maskEl, true);
+		if (this.__isIEQuirks) {
+			this._syncMask();
+		}
+	},
+
+	/**
+	 * Hides the navigator's mask element
+	 * 
+	 * @method hideMask
+	 */
+	hideMask : function() {
+		this._show(this.maskEl, false);
+	},
+
+	/**
+	 * Returns the current month set on the navigator
+	 * 
+	 * Note: This may not be the month set in the UI, if 
+	 * the UI contains an invalid value.
+	 * 
+	 * @method getMonth
+	 * @return {Number} The Navigator's current month index
+	 */
+	getMonth: function() {
+		return this._month;
+	},
+
+	/**
+	 * Returns the current year set on the navigator
+	 * 
+	 * Note: This may not be the year set in the UI, if 
+	 * the UI contains an invalid value.
+	 * 
+	 * @method getYear
+	 * @return {Number} The Navigator's current year value
+	 */
+	getYear: function() {
+		return this._year;
+	},
+
+	/**
+	 * Sets the current month on the Navigator, and updates the UI
+	 * 
+	 * @method setMonth
+	 * @param {Number} nMonth The month index, from 0 (Jan) through 11 (Dec).
+	 */
+	setMonth : function(nMonth) {
+		if (nMonth >= 0 && nMonth < 12) {
+			this._month = nMonth;
+		}
+		this._updateMonthUI();
+	},
+
+	/**
+	 * Sets the current year on the Navigator, and updates the UI. If the 
+	 * provided year is invalid, it will not be set.
+	 * 
+	 * @method setYear
+	 * @param {Number} nYear The full year value to set the Navigator to.
+	 */
+	setYear : function(nYear) {
+		var yrPattern = YAHOO.widget.CalendarNavigator.YR_PATTERN;
+		if (YAHOO.lang.isNumber(nYear) && yrPattern.test(nYear+"")) {
+			this._year = nYear;
+		}
+		this._updateYearUI();
+	},
+
+	/**
+	 * Renders the HTML for the navigator, adding it to the 
+	 * document and attaches event listeners if it has not 
+	 * already been rendered.
+	 * 
+	 * @method render
+	 */
+	render: function() {
+		this.cal.beforeRenderNavEvent.fire();
+		if (!this.__rendered) {
+			this.createNav();
+			this.createMask();
+			this.applyListeners();
+			this.__rendered = true;
+		}
+		this.cal.renderNavEvent.fire();
+	},
+
+	/**
+	 * Creates the navigator's containing HTMLElement, it's contents, and appends 
+	 * the containg element to the Calendar/CalendarGroup's container.
+	 * 
+	 * @method createNav
+	 */
+	createNav : function() {
+		var NAV = YAHOO.widget.CalendarNavigator;
+		var doc = this._doc;
+
+		var d = doc.createElement("div");
+		d.className = NAV.CLASSES.NAV;
+
+		var htmlBuf = this.renderNavContents([]);
+
+		d.innerHTML = htmlBuf.join('');
+		this.cal.oDomContainer.appendChild(d);
+
+		this.navEl = d;
+
+		this.yearEl = doc.getElementById(this.id + NAV.YEAR_SUFFIX);
+		this.monthEl = doc.getElementById(this.id + NAV.MONTH_SUFFIX);
+		this.errorEl = doc.getElementById(this.id + NAV.ERROR_SUFFIX);
+		this.submitEl = doc.getElementById(this.id + NAV.SUBMIT_SUFFIX);
+		this.cancelEl = doc.getElementById(this.id + NAV.CANCEL_SUFFIX);
+
+		if (YAHOO.env.ua.gecko && this.yearEl && this.yearEl.type == "text") {
+			// Avoid XUL error on focus, select [ https://bugzilla.mozilla.org/show_bug.cgi?id=236791, 
+			// supposedly fixed in 1.8.1, but there are reports of it still being around for methods other than blur ]
+			this.yearEl.setAttribute("autocomplete", "off");
+		}
+
+		this._setFirstLastElements();
+	},
+
+	/**
+	 * Creates the Mask HTMLElement and appends it to the Calendar/CalendarGroups
+	 * container.
+	 * 
+	 * @method createMask
+	 */
+	createMask : function() {
+		var C = YAHOO.widget.CalendarNavigator.CLASSES;
+
+		var d = this._doc.createElement("div");
+		d.className = C.MASK;
+
+		this.cal.oDomContainer.appendChild(d);
+		this.maskEl = d;
+	},
+
+	/**
+	 * Used to set the width/height of the mask in pixels to match the Calendar Container.
+	 * Currently only used for IE6 and IE7 quirks mode. The other A-Grade browser are handled using CSS (width/height 100%).
+	 * <p>
+	 * The method is also registered as an HTMLElement resize listener on the Calendars container element.
+	 * </p>
+	 * @protected
+	 * @method _syncMask
+	 */
+	_syncMask : function() {
+		var c = this.cal.oDomContainer;
+		if (c && this.maskEl) {
+			var r = YAHOO.util.Dom.getRegion(c);
+			YAHOO.util.Dom.setStyle(this.maskEl, "width", r.right - r.left + "px");
+			YAHOO.util.Dom.setStyle(this.maskEl, "height", r.bottom - r.top + "px");
+		}
+	},
+
+	/**
+	 * Renders the contents of the navigator
+	 * 
+	 * @method renderNavContents
+	 * 
+	 * @param {Array} html The HTML buffer to append the HTML to.
+	 * @return {Array} A reference to the buffer passed in.
+	 */
+	renderNavContents : function(html) {
+		var NAV = YAHOO.widget.CalendarNavigator,
+			C = NAV.CLASSES,
+			h = html; // just to use a shorter name
+
+		h[h.length] = '<div class="' + C.MONTH + '">';
+		this.renderMonth(h);
+		h[h.length] = '</div>';
+		h[h.length] = '<div class="' + C.YEAR + '">';
+		this.renderYear(h);
+		h[h.length] = '</div>';
+		h[h.length] = '<div class="' + C.BUTTONS + '">';
+		this.renderButtons(h);
+		h[h.length] = '</div>';
+		h[h.length] = '<div class="' + C.ERROR + '" id="' + this.id + NAV.ERROR_SUFFIX + '"></div>';
+
+		return h;
+	},
+
+	/**
+	 * Renders the month label and control for the navigator
+	 * 
+	 * @method renderNavContents
+	 * @param {Array} html The HTML buffer to append the HTML to.
+	 * @return {Array} A reference to the buffer passed in.
+	 */
+	renderMonth : function(html) {
+		var NAV = YAHOO.widget.CalendarNavigator,
+			C = NAV.CLASSES;
+
+		var id = this.id + NAV.MONTH_SUFFIX,
+			mf = this.__getCfg("monthFormat"),
+			months = this.cal.cfg.getProperty((mf == YAHOO.widget.Calendar.SHORT) ? "MONTHS_SHORT" : "MONTHS_LONG"),
+			h = html;
+
+		if (months && months.length > 0) {
+			h[h.length] = '<label for="' + id + '">';
+			h[h.length] = this.__getCfg("month", true);
+			h[h.length] = '</label>';
+			h[h.length] = '<select name="' + id + '" id="' + id + '" class="' + C.MONTH_CTRL + '">';
+			for (var i = 0; i < months.length; i++) {
+				h[h.length] = '<option value="' + i + '">';
+				h[h.length] = months[i];
+				h[h.length] = '</option>';
+			}
+			h[h.length] = '</select>';
+		}
+		return h;
+	},
+
+	/**
+	 * Renders the year label and control for the navigator
+	 * 
+	 * @method renderYear
+	 * @param {Array} html The HTML buffer to append the HTML to.
+	 * @return {Array} A reference to the buffer passed in.
+	 */
+	renderYear : function(html) {
+		var NAV = YAHOO.widget.CalendarNavigator,
+			C = NAV.CLASSES;
+
+		var id = this.id + NAV.YEAR_SUFFIX,
+			size = NAV.YR_MAX_DIGITS,
+			h = html;
+
+		h[h.length] = '<label for="' + id + '">';
+		h[h.length] = this.__getCfg("year", true);
+		h[h.length] = '</label>';
+		h[h.length] = '<input type="text" name="' + id + '" id="' + id + '" class="' + C.YEAR_CTRL + '" maxlength="' + size + '"/>';
+		return h;
+	},
+
+	/**
+	 * Renders the submit/cancel buttons for the navigator
+	 * 
+	 * @method renderButton
+	 * @return {String} The HTML created for the Button UI
+	 */
+	renderButtons : function(html) {
+		var C = YAHOO.widget.CalendarNavigator.CLASSES;
+		var h = html;
+
+		h[h.length] = '<span class="' + C.BUTTON + ' ' + C.DEFAULT + '">';
+		h[h.length] = '<button type="button" id="' + this.id + '_submit' + '">';
+		h[h.length] = this.__getCfg("submit", true);
+		h[h.length] = '</button>';
+		h[h.length] = '</span>';
+		h[h.length] = '<span class="' + C.BUTTON +'">';
+		h[h.length] = '<button type="button" id="' + this.id + '_cancel' + '">';
+		h[h.length] = this.__getCfg("cancel", true);
+		h[h.length] = '</button>';
+		h[h.length] = '</span>';
+
+		return h;
+	},
+
+	/**
+	 * Attaches DOM event listeners to the rendered elements
+	 * <p>
+	 * The method will call applyKeyListeners, to setup keyboard specific 
+	 * listeners
+	 * </p>
+	 * @method applyListeners
+	 */
+	applyListeners : function() {
+		var E = YAHOO.util.Event;
+
+		function yearUpdateHandler() {
+			if (this.validate()) {
+				this.setYear(this._getYearFromUI());
+			}
+		}
+
+		function monthUpdateHandler() {
+			this.setMonth(this._getMonthFromUI());
+		}
+
+		E.on(this.submitEl, "click", this.submit, this, true);
+		E.on(this.cancelEl, "click", this.cancel, this, true);
+		E.on(this.yearEl, "blur", yearUpdateHandler, this, true);
+		E.on(this.monthEl, "change", monthUpdateHandler, this, true);
+
+		if (this.__isIEQuirks) {
+			YAHOO.util.Event.on(this.cal.oDomContainer, "resize", this._syncMask, this, true);
+		}
+
+		this.applyKeyListeners();
+	},
+
+	/**
+	 * Removes/purges DOM event listeners from the rendered elements
+	 * 
+	 * @method purgeListeners
+	 */
+	purgeListeners : function() {
+		var E = YAHOO.util.Event;
+		E.removeListener(this.submitEl, "click", this.submit);
+		E.removeListener(this.cancelEl, "click", this.cancel);
+		E.removeListener(this.yearEl, "blur");
+		E.removeListener(this.monthEl, "change");
+		if (this.__isIEQuirks) {
+			E.removeListener(this.cal.oDomContainer, "resize", this._syncMask);
+		}
+
+		this.purgeKeyListeners();
+	},
+
+	/**
+	 * Attaches DOM listeners for keyboard support. 
+	 * Tab/Shift-Tab looping, Enter Key Submit on Year element,
+	 * Up/Down/PgUp/PgDown year increment on Year element
+	 * <p>
+	 * NOTE: MacOSX Safari 2.x doesn't let you tab to buttons and 
+	 * MacOSX Gecko does not let you tab to buttons or select controls,
+	 * so for these browsers, Tab/Shift-Tab looping is limited to the 
+	 * elements which can be reached using the tab key.
+	 * </p>
+	 * @method applyKeyListeners
+	 */
+	applyKeyListeners : function() {
+		var E = YAHOO.util.Event;
+
+		// IE doesn't fire keypress for arrow/pg keys (non-char keys)
+		var ua = YAHOO.env.ua;
+		var arrowEvt = (ua.ie) ? "keydown" : "keypress";
+
+		// - IE doesn't fire keypress for non-char keys
+		// - Opera doesn't allow us to cancel keydown or keypress for tab, but 
+		//   changes focus successfully on keydown (keypress is too late to change focus - opera's already moved on).
+		var tabEvt = (ua.ie || ua.opera) ? "keydown" : "keypress";
+
+		// Everyone likes keypress for Enter (char keys) - whoo hoo!
+		E.on(this.yearEl, "keypress", this._handleEnterKey, this, true);
+
+		E.on(this.yearEl, arrowEvt, this._handleDirectionKeys, this, true);
+		E.on(this.lastCtrl, tabEvt, this._handleTabKey, this, true);
+		E.on(this.firstCtrl, tabEvt, this._handleShiftTabKey, this, true);
+	},
+
+	/**
+	 * Removes/purges DOM listeners for keyboard support
+	 *
+	 * @method purgeKeyListeners
+	 */
+	purgeKeyListeners : function() {
+		var E = YAHOO.util.Event;
+
+		var arrowEvt = (YAHOO.env.ua.ie) ? "keydown" : "keypress";
+		var tabEvt = (YAHOO.env.ua.ie || YAHOO.env.ua.opera) ? "keydown" : "keypress";
+
+		E.removeListener(this.yearEl, "keypress", this._handleEnterKey);
+		E.removeListener(this.yearEl, arrowEvt, this._handleDirectionKeys);
+		E.removeListener(this.lastCtrl, tabEvt, this._handleTabKey);
+		E.removeListener(this.firstCtrl, tabEvt, this._handleShiftTabKey);
+	},
+
+	/**
+	 * Updates the Calendar/CalendarGroup's pagedate with the currently set month and year if valid.
+	 * <p>
+	 * If the currently set month/year is invalid, a validation error will be displayed and the 
+	 * Calendar/CalendarGroup's pagedate will not be updated.
+	 * </p>
+	 * @method submit
+	 */
+	submit : function() {
+		if (this.validate()) {
+			this.hide();
+
+			this.setMonth(this._getMonthFromUI());
+			this.setYear(this._getYearFromUI());
+
+			var cal = this.cal;
+			var nav = this;
+			
+			function update() {
+				cal.setYear(nav.getYear());
+				cal.setMonth(nav.getMonth());
+				cal.render();
+			}
+			// Artificial delay, just to help the user see something changed
+			var delay = YAHOO.widget.CalendarNavigator.UPDATE_DELAY;
+			if (delay > 0) {
+				window.setTimeout(update, delay);
+			} else {
+				update();
+			}
+		}
+	},
+
+	/**
+	 * Hides the navigator and mask, without updating the Calendar/CalendarGroup's state
+	 * 
+	 * @method cancel
+	 */
+	cancel : function() {
+		this.hide();
+	},
+
+	/**
+	 * Validates the current state of the UI controls
+	 * 
+	 * @method validate
+	 * @return {Boolean} true, if the current UI state contains valid values, false if not
+	 */
+	validate : function() {
+		if (this._getYearFromUI() !== null) {
+			this.clearErrors();
+			return true;
+		} else {
+			this.setYearError();
+			this.setError(this.__getCfg("invalidYear", true));
+			return false;
+		}
+	},
+
+	/**
+	 * Displays an error message in the Navigator's error panel
+	 * @method setError
+	 * @param {String} msg The error message to display
+	 */
+	setError : function(msg) {
+		if (this.errorEl) {
+			this.errorEl.innerHTML = msg;
+			this._show(this.errorEl, true);
+		}
+	},
+
+	/**
+	 * Clears the navigator's error message and hides the error panel
+	 * @method clearError 
+	 */
+	clearError : function() {
+		if (this.errorEl) {
+			this.errorEl.innerHTML = "";
+			this._show(this.errorEl, false);
+		}
+	},
+
+	/**
+	 * Displays the validation error UI for the year control
+	 * @method setYearError
+	 */
+	setYearError : function() {
+		YAHOO.util.Dom.addClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
+	},
+
+	/**
+	 * Removes the validation error UI for the year control
+	 * @method clearYearError
+	 */
+	clearYearError : function() {
+		YAHOO.util.Dom.removeClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
+	},
+
+	/**
+	 * Clears all validation and error messages in the UI
+	 * @method clearErrors
+	 */
+	clearErrors : function() {
+		this.clearError();
+		this.clearYearError();
+	},
+
+	/**
+	 * Sets the initial focus, based on the configured value
+	 * @method setInitialFocus
+	 */
+	setInitialFocus : function() {
+		var el = this.submitEl;
+		var f = this.__getCfg("initialFocus");
+
+		if (f && f.toLowerCase) {
+			f = f.toLowerCase();
+			if (f == "year") {
+				el = this.yearEl;
+				try {
+					this.yearEl.select();
+				} catch (e) {
+					// Ignore;
+				}
+			} else if (f == "month") {
+				el = this.monthEl;
+			}
+		}
+
+		if (el && YAHOO.lang.isFunction(el.focus)) {
+			try {
+				el.focus();
+			} catch (e) {
+				// TODO: Fall back if focus fails?
+			}
+		}
+	},
+
+	/**
+	 * Removes all renderered HTML elements for the Navigator from
+	 * the DOM, purges event listeners and clears (nulls) any property
+	 * references to HTML references
+	 * @method erase
+	 */
+	erase : function() {
+		if (this.__rendered) {
+			this.purgeListeners();
+
+			// Clear out innerHTML references
+			this.yearEl = null;
+			this.monthEl = null;
+			this.errorEl = null;
+			this.submitEl = null;
+			this.cancelEl = null;
+			this.firstCtrl = null;
+			this.lastCtrl = null;
+			if (this.navEl) {
+				this.navEl.innerHTML = "";
+			}
+
+			var p = this.navEl.parentNode;
+			if (p) {
+				p.removeChild(this.navEl);
+			}
+			this.navEl = null;
+
+			var pm = this.maskEl.parentNode;
+			if (pm) {
+				pm.removeChild(this.maskEl);
+			}
+			this.maskEl = null;
+			this.__rendered = false;
+		}
+	},
+
+	/**
+	 * Destroys the Navigator object and any HTML references
+	 * @method destroy
+	 */
+	destroy : function() {
+		this.erase();
+		this._doc = null;
+		this.cal = null;
+		this.id = null;
+	},
+
+	/**
+	 * Protected implementation to handle how UI elements are 
+	 * hidden/shown.
+	 *
+	 * @method _show
+	 * @protected
+	 */
+	_show : function(el, bShow) {
+		if (el) {
+			YAHOO.util.Dom.setStyle(el, "display", (bShow) ? "block" : "none");
+		}
+	},
+
+	/**
+	 * Returns the month value (index), from the month UI element
+	 * @protected
+	 * @method _getMonthFromUI
+	 * @return {Number} The month index, or 0 if a UI element for the month
+	 * is not found
+	 */
+	_getMonthFromUI : function() {
+		if (this.monthEl) {
+			return this.monthEl.selectedIndex;
+		} else {
+			return 0; // Default to Jan
+		}
+	},
+
+	/**
+	 * Returns the year value, from the Navitator's year UI element
+	 * @protected
+	 * @method _getYearFromUI
+	 * @return {Number} The year value set in the UI, if valid. null is returned if 
+	 * the UI does not contain a valid year value.
+	 */
+	_getYearFromUI : function() {
+		var NAV = YAHOO.widget.CalendarNavigator;
+
+		var yr = null;
+		if (this.yearEl) {
+			var value = this.yearEl.value;
+			value = value.replace(NAV.TRIM, "$1");
+
+			if (NAV.YR_PATTERN.test(value)) {
+				yr = parseInt(value, 10);
+			}
+		}
+		return yr;
+	},
+
+	/**
+	 * Updates the Navigator's year UI, based on the year value set on the Navigator object
+	 * @protected
+	 * @method _updateYearUI
+	 */
+	_updateYearUI : function() {
+		if (this.yearEl && this._year !== null) {
+			this.yearEl.value = this._year;
+		}
+	},
+
+	/**
+	 * Updates the Navigator's month UI, based on the month value set on the Navigator object
+	 * @protected
+	 * @method _updateMonthUI
+	 */
+	_updateMonthUI : function() {
+		if (this.monthEl) {
+			this.monthEl.selectedIndex = this._month;
+		}
+	},
+
+	/**
+	 * Sets up references to the first and last focusable element in the Navigator's UI
+	 * in terms of tab order (Naviagator's firstEl and lastEl properties). The references
+	 * are used to control modality by looping around from the first to the last control
+	 * and visa versa for tab/shift-tab navigation.
+	 * <p>
+	 * See <a href="#applyKeyListeners">applyKeyListeners</a>
+	 * </p>
+	 * @protected
+	 * @method _setFirstLastElements
+	 */
+	_setFirstLastElements : function() {
+		this.firstCtrl = this.monthEl;
+		this.lastCtrl = this.cancelEl;
+
+		// Special handling for MacOSX.
+		// - Safari 2.x can't focus on buttons
+		// - Gecko can't focus on select boxes or buttons
+		if (this.__isMac) {
+			if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420){
+				this.firstCtrl = this.monthEl;
+				this.lastCtrl = this.yearEl;
+			}
+			if (YAHOO.env.ua.gecko) {
+				this.firstCtrl = this.yearEl;
+				this.lastCtrl = this.yearEl;
+			}
+		}
+	},
+
+	/**
+	 * Default Keyboard event handler to capture Enter 
+	 * on the Navigator's year control (yearEl)
+	 * 
+	 * @method _handleEnterKey
+	 * @protected
+	 * @param {Event} e The DOM event being handled
+	 */
+	_handleEnterKey : function(e) {
+		var KEYS = YAHOO.util.KeyListener.KEY;
+
+		if (YAHOO.util.Event.getCharCode(e) == KEYS.ENTER) {
+			this.submit();
+		}
+	},
+
+	/**
+	 * Default Keyboard event handler to capture up/down/pgup/pgdown
+	 * on the Navigator's year control (yearEl).
+	 * 
+	 * @method _handleDirectionKeys
+	 * @protected
+	 * @param {Event} e The DOM event being handled
+	 */
+	_handleDirectionKeys : function(e) {
+		var E = YAHOO.util.Event;
+		var KEYS = YAHOO.util.KeyListener.KEY;
+		var NAV = YAHOO.widget.CalendarNavigator;
+
+		var value = (this.yearEl.value) ? parseInt(this.yearEl.value, 10) : null;
+		if (isFinite(value)) {
+			var dir = false;
+			switch(E.getCharCode(e)) {
+				case KEYS.UP:
+					this.yearEl.value = value + NAV.YR_MINOR_INC;
+					dir = true;
+					break;
+				case KEYS.DOWN:
+					this.yearEl.value = Math.max(value - NAV.YR_MINOR_INC, 0);
+					dir = true;
+					break;
+				case KEYS.PAGE_UP:
+					this.yearEl.value = value + NAV.YR_MAJOR_INC;
+					dir = true;
+					break;
+				case KEYS.PAGE_DOWN:
+					this.yearEl.value = Math.max(value - NAV.YR_MAJOR_INC, 0);
+					dir = true;
+					break;
+				default:
+					break;
+			}
+			if (dir) {
+				E.preventDefault(e);
+				try {
+					this.yearEl.select();
+				} catch(e) {
+					// Ignore
+				}
+			}
+		}
+	},
+
+	/**
+	 * Default Keyboard event handler to capture Tab 
+	 * on the last control (lastCtrl) in the Navigator.
+	 * 
+	 * @method _handleTabKey
+	 * @protected
+	 * @param {Event} e The DOM event being handled
+	 */
+	_handleTabKey : function(e) {
+		var E = YAHOO.util.Event;
+		var KEYS = YAHOO.util.KeyListener.KEY;
+
+		if (E.getCharCode(e) == KEYS.TAB && !e.shiftKey) {
+			try {
+				E.preventDefault(e);
+				this.firstCtrl.focus();
+			} catch (e) {
+				// Ignore - mainly for focus edge cases
+			}
+		}
+	},
+
+	/**
+	 * Default Keyboard event handler to capture Shift-Tab 
+	 * on the first control (firstCtrl) in the Navigator.
+	 * 
+	 * @method _handleShiftTabKey
+	 * @protected
+	 * @param {Event} e The DOM event being handled
+	 */
+	_handleShiftTabKey : function(e) {
+		var E = YAHOO.util.Event;
+		var KEYS = YAHOO.util.KeyListener.KEY;
+
+		if (e.shiftKey && E.getCharCode(e) == KEYS.TAB) {
+			try {
+				E.preventDefault(e);
+				this.lastCtrl.focus();
+			} catch (e) {
+				// Ignore - mainly for focus edge cases
+			}
+		}
+	},
+
+	/**
+	 * Retrieve Navigator configuration values from 
+	 * the parent Calendar/CalendarGroup's config value.
+	 * <p>
+	 * If it has not been set in the user provided configuration, the method will 
+	 * return the default value of the configuration property, as set in _DEFAULT_CFG
+	 * </p>
+	 * @private
+	 * @method __getCfg
+	 * @param {String} Case sensitive property name.
+	 * @param {Boolean} true, if the property is a string property, false if not.
+	 * @return The value of the configuration property
+	 */
+	__getCfg : function(prop, bIsStr) {
+		var DEF_CFG = YAHOO.widget.CalendarNavigator._DEFAULT_CFG;
+		var cfg = this.cal.cfg.getProperty("navigator");
+
+		if (bIsStr) {
+			return (cfg !== true && cfg.strings && cfg.strings[prop]) ? cfg.strings[prop] : DEF_CFG.strings[prop];
+		} else {
+			return (cfg !== true && cfg[prop]) ? cfg[prop] : DEF_CFG[prop];
+		}
+	},
+
+	/**
+	 * Private flag, to identify MacOS
+	 * @private
+	 * @property __isMac
+	 */
+	__isMac : (navigator.userAgent.toLowerCase().indexOf("macintosh") != -1)
+
+};
+
+YAHOO.register("calendar", YAHOO.widget.Calendar, {version: "2.4.1", build: "742"});

Modified: jifty/branches/virtual-models/share/web/static/js/yui/container.js
==============================================================================
--- jifty/branches/virtual-models/share/web/static/js/yui/container.js	(original)
+++ jifty/branches/virtual-models/share/web/static/js/yui/container.js	Thu Feb 14 14:59:21 2008
@@ -2,5397 +2,7808 @@
 Copyright (c) 2007, Yahoo! Inc. All rights reserved.
 Code licensed under the BSD License:
 http://developer.yahoo.net/yui/license.txt
-version: 2.2.1
-*/
-/**
-* Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.
-* @namespace YAHOO.util
-* @class Config
-* @constructor
-* @param {Object}	owner	The owner Object to which this Config Object belongs
-*/
-YAHOO.util.Config = function(owner) {
-	if (owner) {
-		this.init(owner);
-	}
-};
-
-/**
- * Constant representing the CustomEvent type for the config changed event.
- * @property YAHOO.util.Config.CONFIG_CHANGED_EVENT
- * @private
- * @static
- * @final
- */
-YAHOO.util.Config.CONFIG_CHANGED_EVENT = "configChanged";
-
-/**
- * Constant representing the boolean type string
- * @property YAHOO.util.Config.BOOLEAN_TYPE
- * @private
- * @static
- * @final
- */
-YAHOO.util.Config.BOOLEAN_TYPE = "boolean";
-
-YAHOO.util.Config.prototype = {
-	
-	/**
-	* Object reference to the owner of this Config Object
-	* @property owner
-	* @type Object
-	*/
-	owner : null,
-
-	/**
-	* Boolean flag that specifies whether a queue is currently being executed
-	* @property queueInProgress
-	* @type Boolean
-	*/
-	queueInProgress : false,
-
-	/**
-	* Maintains the local collection of configuration property objects and their specified values
-	* @property config
-	* @private
-	* @type Object
-	*/ 
-	config : null,
-
-	/**
-	* Maintains the local collection of configuration property objects as they were initially applied.
-	* This object is used when resetting a property.
-	* @property initialConfig
-	* @private
-	* @type Object
-	*/ 
-	initialConfig : null,
-
-	/**
-	* Maintains the local, normalized CustomEvent queue
-	* @property eventQueue
-	* @private
-	* @type Object
-	*/ 
-	eventQueue : null,
-
-	/**
-	* Custom Event, notifying subscribers when Config properties are set (setProperty is called without the silent flag
-	* @event configChangedEvent
-	*/
-	configChangedEvent : null,
-
-	/**
-	* Validates that the value passed in is a Boolean.
-	* @method checkBoolean
-	* @param	{Object}	val	The value to validate
-	* @return	{Boolean}	true, if the value is valid
-	*/	
-	checkBoolean: function(val) {
-		return (typeof val == YAHOO.util.Config.BOOLEAN_TYPE);
-	},
-
-	/**
-	* Validates that the value passed in is a number.
-	* @method checkNumber
-	* @param	{Object}	val	The value to validate
-	* @return	{Boolean}	true, if the value is valid
-	*/
-	checkNumber: function(val) {
-		return (!isNaN(val));
-	},
-
-	/**
-	* Fires a configuration property event using the specified value. 
-	* @method fireEvent
-	* @private
-	* @param {String}	key			The configuration property's name
-	* @param {value}	Object		The value of the correct type for the property
-	*/ 
-	fireEvent : function( key, value ) {
-		var property = this.config[key];
-
-		if (property && property.event) {
-			property.event.fire(value);
-		}	
-	},
-
-	/**
-	* Adds a property to the Config Object's private config hash.
-	* @method addProperty
-	* @param {String}	key	The configuration property's name
-	* @param {Object}	propertyObject	The Object containing all of this property's arguments
-	*/
-	addProperty : function( key, propertyObject ) {
-		key = key.toLowerCase();
-
-		this.config[key] = propertyObject;
-
-		propertyObject.event = new YAHOO.util.CustomEvent(key, this.owner);
-		propertyObject.key = key;
-
-		if (propertyObject.handler) {
-			propertyObject.event.subscribe(propertyObject.handler, this.owner);
-		}
-
-		this.setProperty(key, propertyObject.value, true);
-		
-		if (! propertyObject.suppressEvent) {
-			this.queueProperty(key, propertyObject.value);
-		}
-		
-	},
-
-	/**
-	* Returns a key-value configuration map of the values currently set in the Config Object.
-	* @method getConfig
-	* @return {Object} The current config, represented in a key-value map
-	*/
-	getConfig : function() {
-		var cfg = {};
-			
-		for (var prop in this.config) {
-			var property = this.config[prop];
-			if (property && property.event) {
-				cfg[prop] = property.value;
-			}
-		}
-		
-		return cfg;
-	},
-
-	/**
-	* Returns the value of specified property.
-	* @method getProperty
-	* @param {String} key	The name of the property
-	* @return {Object}		The value of the specified property
-	*/
-	getProperty : function(key) {
-		var property = this.config[key.toLowerCase()];
-		if (property && property.event) {
-			return property.value;
-		} else {
-			return undefined;
-		}
-	},
-
-	/**
-	* Resets the specified property's value to its initial value.
-	* @method resetProperty
-	* @param {String} key	The name of the property
-	* @return {Boolean} True is the property was reset, false if not
-	*/
-	resetProperty : function(key) {
-		key = key.toLowerCase();
-
-		var property = this.config[key];
-		if (property && property.event) {
-			if (this.initialConfig[key] && !YAHOO.lang.isUndefined(this.initialConfig[key]))	{
-				this.setProperty(key, this.initialConfig[key]);
-			}
-			return true;
-		} else {
-			return false;
-		}
-	},
-
-	/**
-	* Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.
-	* @method setProperty
-	* @param {String} key		The name of the property
-	* @param {String} value		The value to set the property to
-	* @param {Boolean} silent	Whether the value should be set silently, without firing the property event.
-	* @return {Boolean}			True, if the set was successful, false if it failed.
-	*/
-	setProperty : function(key, value, silent) {
-		key = key.toLowerCase();
-
-		if (this.queueInProgress && ! silent) {
-			this.queueProperty(key,value); // Currently running through a queue... 
-			return true;
-		} else {
-			var property = this.config[key];
-			if (property && property.event) {
-				if (property.validator && ! property.validator(value)) { // validator
-					return false;
-				} else {
-					property.value = value;
-					if (! silent) {
-						this.fireEvent(key, value);
-						this.configChangedEvent.fire([key, value]);
-					}
-					return true;
-				}
-			} else {
-				return false;
-			}
-		}
-	},
-
-	/**
-	* Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is
-	* moved from its current position to the end of the queue.
-	* @method queueProperty
-	* @param {String} key	The name of the property
-	* @param {String} value	The value to set the property to
-	* @return {Boolean}		true, if the set was successful, false if it failed.
-	*/	
-	queueProperty : function(key, value) {
-		key = key.toLowerCase();
-
-		var property = this.config[key];
-							
-		if (property && property.event) {
-			if (!YAHOO.lang.isUndefined(value) && property.validator && ! property.validator(value)) { // validator
-				return false;
-			} else {
-
-				if (!YAHOO.lang.isUndefined(value)) {
-					property.value = value;
-				} else {
-					value = property.value;
-				}
-
-				var foundDuplicate = false;
-				var iLen = this.eventQueue.length;
-				for (var i=0; i < iLen; i++) {
-					var queueItem = this.eventQueue[i];
-
-					if (queueItem) {
-						var queueItemKey = queueItem[0];
-						var queueItemValue = queueItem[1];
-						
-						if (queueItemKey == key) {
-							// found a dupe... push to end of queue, null current item, and break
-							this.eventQueue[i] = null;
-							this.eventQueue.push([key, (!YAHOO.lang.isUndefined(value) ? value : queueItemValue)]);
-							foundDuplicate = true;
-							break;
-						}
-					}
-				}
-				
-				if (! foundDuplicate && !YAHOO.lang.isUndefined(value)) { // this is a refire, or a new property in the queue
-					this.eventQueue.push([key, value]);
-				}
-			}
-
-			if (property.supercedes) {
-				var sLen = property.supercedes.length;
-				for (var s=0; s < sLen; s++) {
-					var supercedesCheck = property.supercedes[s];
-					var qLen = this.eventQueue.length;
-					for (var q=0; q < qLen; q++) {
-						var queueItemCheck = this.eventQueue[q];
-
-						if (queueItemCheck) {
-							var queueItemCheckKey = queueItemCheck[0];
-							var queueItemCheckValue = queueItemCheck[1];
-							
-							if ( queueItemCheckKey == supercedesCheck.toLowerCase() ) {
-								this.eventQueue.push([queueItemCheckKey, queueItemCheckValue]);
-								this.eventQueue[q] = null;
-								break;
-							}
-						}
-					}
-				}
-			}
-
-			return true;
-		} else {
-			return false;
-		}
-	},
-
-	/**
-	* Fires the event for a property using the property's current value.
-	* @method refireEvent
-	* @param {String} key	The name of the property
-	*/
-	refireEvent : function(key) {
-		key = key.toLowerCase();
-
-		var property = this.config[key];
-		if (property && property.event && !YAHOO.lang.isUndefined(property.value)) {
-			if (this.queueInProgress) {
-				this.queueProperty(key);
-			} else {
-				this.fireEvent(key, property.value);
-			}
-		}
-	},
-
-	/**
-	* Applies a key-value Object literal to the configuration, replacing any existing values, and queueing the property events.
-	* Although the values will be set, fireQueue() must be called for their associated events to execute.
-	* @method applyConfig
-	* @param {Object}	userConfig	The configuration Object literal
-	* @param {Boolean}	init		When set to true, the initialConfig will be set to the userConfig passed in, so that calling a reset will reset the properties to the passed values.
-	*/
-	applyConfig : function(userConfig, init) {
-		if (init) {
-			this.initialConfig = userConfig;
-		}
-		for (var prop in userConfig) {
-			this.queueProperty(prop, userConfig[prop]);
-		}
-	},
-
-	/**
-	* Refires the events for all configuration properties using their current values.
-	* @method refresh
-	*/
-	refresh : function() {
-		for (var prop in this.config) {
-			this.refireEvent(prop);
-		}
-	},
-
-	/**
-	* Fires the normalized list of queued property change events
-	* @method fireQueue
-	*/
-	fireQueue : function() {
-		this.queueInProgress = true;
-		for (var i=0;i<this.eventQueue.length;i++) {
-			var queueItem = this.eventQueue[i];
-			if (queueItem) {
-				var key = queueItem[0];
-				var value = queueItem[1];
-				
-				var property = this.config[key];
-				property.value = value;
-
-				this.fireEvent(key,value);
-			}
-		}
-		
-		this.queueInProgress = false;
-		this.eventQueue = [];
-	},
-
-	/**
-	* Subscribes an external handler to the change event for any given property. 
-	* @method subscribeToConfigEvent
-	* @param {String}	key			The property name
-	* @param {Function}	handler		The handler function to use subscribe to the property's event
-	* @param {Object}	obj			The Object to use for scoping the event handler (see CustomEvent documentation)
-	* @param {Boolean}	override	Optional. If true, will override "this" within the handler to map to the scope Object passed into the method.
-	* @return {Boolean}				True, if the subscription was successful, otherwise false.
-	*/	
-	subscribeToConfigEvent : function(key, handler, obj, override) {
-		var property = this.config[key.toLowerCase()];
-		if (property && property.event) {
-			if (! YAHOO.util.Config.alreadySubscribed(property.event, handler, obj)) {
-				property.event.subscribe(handler, obj, override);
-			}
-			return true;
-		} else {
-			return false;
-		}
-	},
-
-	/**
-	* Unsubscribes an external handler from the change event for any given property. 
-	* @method unsubscribeFromConfigEvent
-	* @param {String}	key			The property name
-	* @param {Function}	handler		The handler function to use subscribe to the property's event
-	* @param {Object}	obj			The Object to use for scoping the event handler (see CustomEvent documentation)
-	* @return {Boolean}				True, if the unsubscription was successful, otherwise false.
-	*/
-	unsubscribeFromConfigEvent : function(key, handler, obj) {
-		var property = this.config[key.toLowerCase()];
-		if (property && property.event) {
-			return property.event.unsubscribe(handler, obj);
-		} else {
-			return false;
-		}
-	},
-
-	/**
-	* Returns a string representation of the Config object
-	* @method toString
-	* @return {String}	The Config object in string format.
-	*/
-	toString : function() {
-		var output = "Config";
-		if (this.owner) {
-			output += " [" + this.owner.toString() + "]";
-		}
-		return output;
-	},
-
-	/**
-	* Returns a string representation of the Config object's current CustomEvent queue
-	* @method outputEventQueue
-	* @return {String}	The string list of CustomEvents currently queued for execution
-	*/
-	outputEventQueue : function() {
-		var output = "";
-		for (var q=0;q<this.eventQueue.length;q++) {
-			var queueItem = this.eventQueue[q];
-			if (queueItem) {
-				output += queueItem[0] + "=" + queueItem[1] + ", ";
-			}
-		}
-		return output;
-	}
-};
-
-
-/**
-* Initializes the configuration Object and all of its local members.
-* @method init
-* @param {Object}	owner	The owner Object to which this Config Object belongs
-*/
-YAHOO.util.Config.prototype.init = function(owner) {
-	this.owner = owner;
-	this.configChangedEvent = new YAHOO.util.CustomEvent(YAHOO.util.CONFIG_CHANGED_EVENT, this);
-	this.queueInProgress = false;
-	this.config = {};
-	this.initialConfig = {};
-	this.eventQueue = [];
-};
-
-/**
-* Checks to determine if a particular function/Object pair are already subscribed to the specified CustomEvent
-* @method YAHOO.util.Config.alreadySubscribed
-* @static
-* @param {YAHOO.util.CustomEvent} evt	The CustomEvent for which to check the subscriptions
-* @param {Function}	fn	The function to look for in the subscribers list
-* @param {Object}	obj	The execution scope Object for the subscription
-* @return {Boolean}	true, if the function/Object pair is already subscribed to the CustomEvent passed in
-*/
-YAHOO.util.Config.alreadySubscribed = function(evt, fn, obj) {
-	for (var e=0;e<evt.subscribers.length;e++) {
-		var subsc = evt.subscribers[e];
-		if (subsc && subsc.obj == obj && subsc.fn == fn) {
-			return true;
-		}
-	}
-	return false;
-};
-/**
-*  The Container family of components is designed to enable developers to create different kinds of content-containing modules on the web. Module and Overlay are the most basic containers, and they can be used directly or extended to build custom containers. Also part of the Container family are four UI controls that extend Module and Overlay: Tooltip, Panel, Dialog, and SimpleDialog.
-* @module container
-* @title Container
-* @requires yahoo,dom,event,dragdrop,animation
+version: 2.4.1
 */
+(function () {
+
+    /**
+    * Config is a utility used within an Object to allow the implementer to
+    * maintain a list of local configuration properties and listen for changes 
+    * to those properties dynamically using CustomEvent. The initial values are 
+    * also maintained so that the configuration can be reset at any given point 
+    * to its initial state.
+    * @namespace YAHOO.util
+    * @class Config
+    * @constructor
+    * @param {Object} owner The owner Object to which this Config Object belongs
+    */
+    YAHOO.util.Config = function (owner) {
+
+        if (owner) {
+            this.init(owner);
+        }
+
+
+    };
+
+
+    var Lang = YAHOO.lang,
+        CustomEvent = YAHOO.util.CustomEvent,
+        Config = YAHOO.util.Config;
+
+
+    /**
+     * Constant representing the CustomEvent type for the config changed event.
+     * @property YAHOO.util.Config.CONFIG_CHANGED_EVENT
+     * @private
+     * @static
+     * @final
+     */
+    Config.CONFIG_CHANGED_EVENT = "configChanged";
+    
+    /**
+     * Constant representing the boolean type string
+     * @property YAHOO.util.Config.BOOLEAN_TYPE
+     * @private
+     * @static
+     * @final
+     */
+    Config.BOOLEAN_TYPE = "boolean";
+    
+    Config.prototype = {
+     
+        /**
+        * Object reference to the owner of this Config Object
+        * @property owner
+        * @type Object
+        */
+        owner: null,
+        
+        /**
+        * Boolean flag that specifies whether a queue is currently 
+        * being executed
+        * @property queueInProgress
+        * @type Boolean
+        */
+        queueInProgress: false,
+        
+        /**
+        * Maintains the local collection of configuration property objects and 
+        * their specified values
+        * @property config
+        * @private
+        * @type Object
+        */ 
+        config: null,
+        
+        /**
+        * Maintains the local collection of configuration property objects as 
+        * they were initially applied.
+        * This object is used when resetting a property.
+        * @property initialConfig
+        * @private
+        * @type Object
+        */ 
+        initialConfig: null,
+        
+        /**
+        * Maintains the local, normalized CustomEvent queue
+        * @property eventQueue
+        * @private
+        * @type Object
+        */ 
+        eventQueue: null,
+        
+        /**
+        * Custom Event, notifying subscribers when Config properties are set 
+        * (setProperty is called without the silent flag
+        * @event configChangedEvent
+        */
+        configChangedEvent: null,
+    
+        /**
+        * Initializes the configuration Object and all of its local members.
+        * @method init
+        * @param {Object} owner The owner Object to which this Config 
+        * Object belongs
+        */
+        init: function (owner) {
+    
+            this.owner = owner;
+    
+            this.configChangedEvent = 
+                this.createEvent(Config.CONFIG_CHANGED_EVENT);
+    
+            this.configChangedEvent.signature = CustomEvent.LIST;
+            this.queueInProgress = false;
+            this.config = {};
+            this.initialConfig = {};
+            this.eventQueue = [];
+        
+        },
+        
+        /**
+        * Validates that the value passed in is a Boolean.
+        * @method checkBoolean
+        * @param {Object} val The value to validate
+        * @return {Boolean} true, if the value is valid
+        */ 
+        checkBoolean: function (val) {
+            return (typeof val == Config.BOOLEAN_TYPE);
+        },
+        
+        /**
+        * Validates that the value passed in is a number.
+        * @method checkNumber
+        * @param {Object} val The value to validate
+        * @return {Boolean} true, if the value is valid
+        */
+        checkNumber: function (val) {
+            return (!isNaN(val));
+        },
+        
+        /**
+        * Fires a configuration property event using the specified value. 
+        * @method fireEvent
+        * @private
+        * @param {String} key The configuration property's name
+        * @param {value} Object The value of the correct type for the property
+        */ 
+        fireEvent: function ( key, value ) {
+            var property = this.config[key];
+        
+            if (property && property.event) {
+                property.event.fire(value);
+            } 
+        },
+        
+        /**
+        * Adds a property to the Config Object's private config hash.
+        * @method addProperty
+        * @param {String} key The configuration property's name
+        * @param {Object} propertyObject The Object containing all of this 
+        * property's arguments
+        */
+        addProperty: function ( key, propertyObject ) {
+            key = key.toLowerCase();
+        
+            this.config[key] = propertyObject;
+        
+            propertyObject.event = this.createEvent(key, { scope: this.owner });
+            propertyObject.event.signature = CustomEvent.LIST;
+            
+            
+            propertyObject.key = key;
+        
+            if (propertyObject.handler) {
+                propertyObject.event.subscribe(propertyObject.handler, 
+                    this.owner);
+            }
+        
+            this.setProperty(key, propertyObject.value, true);
+            
+            if (! propertyObject.suppressEvent) {
+                this.queueProperty(key, propertyObject.value);
+            }
+            
+        },
+        
+        /**
+        * Returns a key-value configuration map of the values currently set in  
+        * the Config Object.
+        * @method getConfig
+        * @return {Object} The current config, represented in a key-value map
+        */
+        getConfig: function () {
+        
+            var cfg = {},
+                prop,
+                property;
+                
+            for (prop in this.config) {
+                property = this.config[prop];
+                if (property && property.event) {
+                    cfg[prop] = property.value;
+                }
+            }
+            
+            return cfg;
+        },
+        
+        /**
+        * Returns the value of specified property.
+        * @method getProperty
+        * @param {String} key The name of the property
+        * @return {Object}  The value of the specified property
+        */
+        getProperty: function (key) {
+            var property = this.config[key.toLowerCase()];
+            if (property && property.event) {
+                return property.value;
+            } else {
+                return undefined;
+            }
+        },
+        
+        /**
+        * Resets the specified property's value to its initial value.
+        * @method resetProperty
+        * @param {String} key The name of the property
+        * @return {Boolean} True is the property was reset, false if not
+        */
+        resetProperty: function (key) {
+    
+            key = key.toLowerCase();
+        
+            var property = this.config[key];
+    
+            if (property && property.event) {
+    
+                if (this.initialConfig[key] && 
+                    !Lang.isUndefined(this.initialConfig[key])) {
+    
+                    this.setProperty(key, this.initialConfig[key]);
+
+                    return true;
+    
+                }
+    
+            } else {
+    
+                return false;
+            }
+    
+        },
+        
+        /**
+        * Sets the value of a property. If the silent property is passed as 
+        * true, the property's event will not be fired.
+        * @method setProperty
+        * @param {String} key The name of the property
+        * @param {String} value The value to set the property to
+        * @param {Boolean} silent Whether the value should be set silently, 
+        * without firing the property event.
+        * @return {Boolean} True, if the set was successful, false if it failed.
+        */
+        setProperty: function (key, value, silent) {
+        
+            var property;
+        
+            key = key.toLowerCase();
+        
+            if (this.queueInProgress && ! silent) {
+                // Currently running through a queue... 
+                this.queueProperty(key,value);
+                return true;
+    
+            } else {
+                property = this.config[key];
+                if (property && property.event) {
+                    if (property.validator && !property.validator(value)) {
+                        return false;
+                    } else {
+                        property.value = value;
+                        if (! silent) {
+                            this.fireEvent(key, value);
+                            this.configChangedEvent.fire([key, value]);
+                        }
+                        return true;
+                    }
+                } else {
+                    return false;
+                }
+            }
+        },
+        
+        /**
+        * Sets the value of a property and queues its event to execute. If the 
+        * event is already scheduled to execute, it is
+        * moved from its current position to the end of the queue.
+        * @method queueProperty
+        * @param {String} key The name of the property
+        * @param {String} value The value to set the property to
+        * @return {Boolean}  true, if the set was successful, false if 
+        * it failed.
+        */ 
+        queueProperty: function (key, value) {
+        
+            key = key.toLowerCase();
+        
+            var property = this.config[key],
+                foundDuplicate = false,
+                iLen,
+                queueItem,
+                queueItemKey,
+                queueItemValue,
+                sLen,
+                supercedesCheck,
+                qLen,
+                queueItemCheck,
+                queueItemCheckKey,
+                queueItemCheckValue,
+                i,
+                s,
+                q;
+                                
+            if (property && property.event) {
+    
+                if (!Lang.isUndefined(value) && property.validator && 
+                    !property.validator(value)) { // validator
+                    return false;
+                } else {
+        
+                    if (!Lang.isUndefined(value)) {
+                        property.value = value;
+                    } else {
+                        value = property.value;
+                    }
+        
+                    foundDuplicate = false;
+                    iLen = this.eventQueue.length;
+        
+                    for (i = 0; i < iLen; i++) {
+                        queueItem = this.eventQueue[i];
+        
+                        if (queueItem) {
+                            queueItemKey = queueItem[0];
+                            queueItemValue = queueItem[1];
+
+                            if (queueItemKey == key) {
+    
+                                /*
+                                    found a dupe... push to end of queue, null 
+                                    current item, and break
+                                */
+    
+                                this.eventQueue[i] = null;
+    
+                                this.eventQueue.push(
+                                    [key, (!Lang.isUndefined(value) ? 
+                                    value : queueItemValue)]);
+    
+                                foundDuplicate = true;
+                                break;
+                            }
+                        }
+                    }
+                    
+                    // this is a refire, or a new property in the queue
+    
+                    if (! foundDuplicate && !Lang.isUndefined(value)) { 
+                        this.eventQueue.push([key, value]);
+                    }
+                }
+        
+                if (property.supercedes) {
+
+                    sLen = property.supercedes.length;
+
+                    for (s = 0; s < sLen; s++) {
+
+                        supercedesCheck = property.supercedes[s];
+                        qLen = this.eventQueue.length;
+
+                        for (q = 0; q < qLen; q++) {
+                            queueItemCheck = this.eventQueue[q];
+
+                            if (queueItemCheck) {
+                                queueItemCheckKey = queueItemCheck[0];
+                                queueItemCheckValue = queueItemCheck[1];
+
+                                if (queueItemCheckKey == 
+                                    supercedesCheck.toLowerCase() ) {
+
+                                    this.eventQueue.push([queueItemCheckKey, 
+                                        queueItemCheckValue]);
+
+                                    this.eventQueue[q] = null;
+                                    break;
+
+                                }
+                            }
+                        }
+                    }
+                }
+
+
+                return true;
+            } else {
+                return false;
+            }
+        },
+        
+        /**
+        * Fires the event for a property using the property's current value.
+        * @method refireEvent
+        * @param {String} key The name of the property
+        */
+        refireEvent: function (key) {
+    
+            key = key.toLowerCase();
+        
+            var property = this.config[key];
+    
+            if (property && property.event && 
+    
+                !Lang.isUndefined(property.value)) {
+    
+                if (this.queueInProgress) {
+    
+                    this.queueProperty(key);
+    
+                } else {
+    
+                    this.fireEvent(key, property.value);
+    
+                }
+    
+            }
+        },
+        
+        /**
+        * Applies a key-value Object literal to the configuration, replacing  
+        * any existing values, and queueing the property events.
+        * Although the values will be set, fireQueue() must be called for their 
+        * associated events to execute.
+        * @method applyConfig
+        * @param {Object} userConfig The configuration Object literal
+        * @param {Boolean} init  When set to true, the initialConfig will 
+        * be set to the userConfig passed in, so that calling a reset will 
+        * reset the properties to the passed values.
+        */
+        applyConfig: function (userConfig, init) {
+        
+            var sKey,
+                oConfig;
+
+            if (init) {
+                oConfig = {};
+                for (sKey in userConfig) {
+                    if (Lang.hasOwnProperty(userConfig, sKey)) {
+                        oConfig[sKey.toLowerCase()] = userConfig[sKey];
+                    }
+                }
+                this.initialConfig = oConfig;
+            }
+
+            for (sKey in userConfig) {
+                if (Lang.hasOwnProperty(userConfig, sKey)) {
+                    this.queueProperty(sKey, userConfig[sKey]);
+                }
+            }
+        },
+        
+        /**
+        * Refires the events for all configuration properties using their 
+        * current values.
+        * @method refresh
+        */
+        refresh: function () {
+        
+            var prop;
+        
+            for (prop in this.config) {
+                this.refireEvent(prop);
+            }
+        },
+        
+        /**
+        * Fires the normalized list of queued property change events
+        * @method fireQueue
+        */
+        fireQueue: function () {
+        
+            var i, 
+                queueItem,
+                key,
+                value,
+                property;
+        
+            this.queueInProgress = true;
+            for (i = 0;i < this.eventQueue.length; i++) {
+                queueItem = this.eventQueue[i];
+                if (queueItem) {
+        
+                    key = queueItem[0];
+                    value = queueItem[1];
+                    property = this.config[key];
+        
+                    property.value = value;
+        
+                    this.fireEvent(key,value);
+                }
+            }
+            
+            this.queueInProgress = false;
+            this.eventQueue = [];
+        },
+        
+        /**
+        * Subscribes an external handler to the change event for any 
+        * given property. 
+        * @method subscribeToConfigEvent
+        * @param {String} key The property name
+        * @param {Function} handler The handler function to use subscribe to 
+        * the property's event
+        * @param {Object} obj The Object to use for scoping the event handler 
+        * (see CustomEvent documentation)
+        * @param {Boolean} override Optional. If true, will override "this"  
+        * within the handler to map to the scope Object passed into the method.
+        * @return {Boolean} True, if the subscription was successful, 
+        * otherwise false.
+        */ 
+        subscribeToConfigEvent: function (key, handler, obj, override) {
+    
+            var property = this.config[key.toLowerCase()];
+    
+            if (property && property.event) {
+                if (!Config.alreadySubscribed(property.event, handler, obj)) {
+                    property.event.subscribe(handler, obj, override);
+                }
+                return true;
+            } else {
+                return false;
+            }
+    
+        },
+        
+        /**
+        * Unsubscribes an external handler from the change event for any 
+        * given property. 
+        * @method unsubscribeFromConfigEvent
+        * @param {String} key The property name
+        * @param {Function} handler The handler function to use subscribe to 
+        * the property's event
+        * @param {Object} obj The Object to use for scoping the event 
+        * handler (see CustomEvent documentation)
+        * @return {Boolean} True, if the unsubscription was successful, 
+        * otherwise false.
+        */
+        unsubscribeFromConfigEvent: function (key, handler, obj) {
+            var property = this.config[key.toLowerCase()];
+            if (property && property.event) {
+                return property.event.unsubscribe(handler, obj);
+            } else {
+                return false;
+            }
+        },
+        
+        /**
+        * Returns a string representation of the Config object
+        * @method toString
+        * @return {String} The Config object in string format.
+        */
+        toString: function () {
+            var output = "Config";
+            if (this.owner) {
+                output += " [" + this.owner.toString() + "]";
+            }
+            return output;
+        },
+        
+        /**
+        * Returns a string representation of the Config object's current 
+        * CustomEvent queue
+        * @method outputEventQueue
+        * @return {String} The string list of CustomEvents currently queued 
+        * for execution
+        */
+        outputEventQueue: function () {
+
+            var output = "",
+                queueItem,
+                q,
+                nQueue = this.eventQueue.length;
+              
+            for (q = 0; q < nQueue; q++) {
+                queueItem = this.eventQueue[q];
+                if (queueItem) {
+                    output += queueItem[0] + "=" + queueItem[1] + ", ";
+                }
+            }
+            return output;
+        },
+
+        /**
+        * Sets all properties to null, unsubscribes all listeners from each 
+        * property's change event and all listeners from the configChangedEvent.
+        * @method destroy
+        */
+        destroy: function () {
+
+            var oConfig = this.config,
+                sProperty,
+                oProperty;
+
+
+            for (sProperty in oConfig) {
+            
+                if (Lang.hasOwnProperty(oConfig, sProperty)) {
+
+                    oProperty = oConfig[sProperty];
+
+                    oProperty.event.unsubscribeAll();
+                    oProperty.event = null;
+
+                }
+            
+            }
+            
+            this.configChangedEvent.unsubscribeAll();
+            
+            this.configChangedEvent = null;
+            this.owner = null;
+            this.config = null;
+            this.initialConfig = null;
+            this.eventQueue = null;
+        
+        }
+
+    };
+    
+    
+    
+    /**
+    * Checks to determine if a particular function/Object pair are already 
+    * subscribed to the specified CustomEvent
+    * @method YAHOO.util.Config.alreadySubscribed
+    * @static
+    * @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check 
+    * the subscriptions
+    * @param {Function} fn The function to look for in the subscribers list
+    * @param {Object} obj The execution scope Object for the subscription
+    * @return {Boolean} true, if the function/Object pair is already subscribed 
+    * to the CustomEvent passed in
+    */
+    Config.alreadySubscribed = function (evt, fn, obj) {
+    
+        var nSubscribers = evt.subscribers.length,
+            subsc,
+            i;
+
+        if (nSubscribers > 0) {
+            i = nSubscribers - 1;
+            do {
+                subsc = evt.subscribers[i];
+                if (subsc && subsc.obj == obj && subsc.fn == fn) {
+                    return true;
+                }
+            }
+            while (i--);
+        }
+
+        return false;
+
+    };
+
+    YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider);
+
+}());
+
+(function () {
+
+    /**
+    * The Container family of components is designed to enable developers to 
+    * create different kinds of content-containing modules on the web. Module 
+    * and Overlay are the most basic containers, and they can be used directly 
+    * or extended to build custom containers. Also part of the Container family 
+    * are four UI controls that extend Module and Overlay: Tooltip, Panel, 
+    * Dialog, and SimpleDialog.
+    * @module container
+    * @title Container
+    * @requires yahoo, dom, event 
+    * @optional dragdrop, animation, button
+    */
+    
+    /**
+    * Module is a JavaScript representation of the Standard Module Format. 
+    * Standard Module Format is a simple standard for markup containers where 
+    * child nodes representing the header, body, and footer of the content are 
+    * denoted using the CSS classes "hd", "bd", and "ft" respectively. 
+    * Module is the base class for all other classes in the YUI 
+    * Container package.
+    * @namespace YAHOO.widget
+    * @class Module
+    * @constructor
+    * @param {String} el The element ID representing the Module <em>OR</em>
+    * @param {HTMLElement} el The element representing the Module
+    * @param {Object} userConfig The configuration Object literal containing 
+    * the configuration that should be set for this module. See configuration 
+    * documentation for more details.
+    */
+    YAHOO.widget.Module = function (el, userConfig) {
+        if (el) {
+            this.init(el, userConfig);
+        } else {
+        }
+    };
+
+    var Dom = YAHOO.util.Dom,
+        Config = YAHOO.util.Config,
+        Event = YAHOO.util.Event,
+        CustomEvent = YAHOO.util.CustomEvent,
+        Module = YAHOO.widget.Module,
+
+        m_oModuleTemplate,
+        m_oHeaderTemplate,
+        m_oBodyTemplate,
+        m_oFooterTemplate,
+
+        /**
+        * Constant representing the name of the Module's events
+        * @property EVENT_TYPES
+        * @private
+        * @final
+        * @type Object
+        */
+        EVENT_TYPES = {
+        
+            "BEFORE_INIT": "beforeInit",
+            "INIT": "init",
+            "APPEND": "append",
+            "BEFORE_RENDER": "beforeRender",
+            "RENDER": "render",
+            "CHANGE_HEADER": "changeHeader",
+            "CHANGE_BODY": "changeBody",
+            "CHANGE_FOOTER": "changeFooter",
+            "CHANGE_CONTENT": "changeContent",
+            "DESTORY": "destroy",
+            "BEFORE_SHOW": "beforeShow",
+            "SHOW": "show",
+            "BEFORE_HIDE": "beforeHide",
+            "HIDE": "hide"
+        
+        },
+            
+        /**
+        * Constant representing the Module's configuration properties
+        * @property DEFAULT_CONFIG
+        * @private
+        * @final
+        * @type Object
+        */
+        DEFAULT_CONFIG = {
+        
+            "VISIBLE": { 
+                key: "visible", 
+                value: true, 
+                validator: YAHOO.lang.isBoolean 
+            },
+        
+            "EFFECT": { 
+                key: "effect", 
+                suppressEvent: true, 
+                supercedes: ["visible"] 
+            },
+
+            "MONITOR_RESIZE": { 
+                key: "monitorresize", 
+                value: true  
+            },
+
+            "APPEND_TO_DOCUMENT_BODY": { 
+                key: "appendtodocumentbody", 
+                value: false
+            }
+        };
+    
+    /**
+    * Constant representing the prefix path to use for non-secure images
+    * @property YAHOO.widget.Module.IMG_ROOT
+    * @static
+    * @final
+    * @type String
+    */
+    Module.IMG_ROOT = null;
+    
+    /**
+    * Constant representing the prefix path to use for securely served images
+    * @property YAHOO.widget.Module.IMG_ROOT_SSL
+    * @static
+    * @final
+    * @type String
+    */
+    Module.IMG_ROOT_SSL = null;
+    
+    /**
+    * Constant for the default CSS class name that represents a Module
+    * @property YAHOO.widget.Module.CSS_MODULE
+    * @static
+    * @final
+    * @type String
+    */
+    Module.CSS_MODULE = "yui-module";
+    
+    /**
+    * Constant representing the module header
+    * @property YAHOO.widget.Module.CSS_HEADER
+    * @static
+    * @final
+    * @type String
+    */
+    Module.CSS_HEADER = "hd";
+    
+    /**
+    * Constant representing the module body
+    * @property YAHOO.widget.Module.CSS_BODY
+    * @static
+    * @final
+    * @type String
+    */
+    Module.CSS_BODY = "bd";
+    
+    /**
+    * Constant representing the module footer
+    * @property YAHOO.widget.Module.CSS_FOOTER
+    * @static
+    * @final
+    * @type String
+    */
+    Module.CSS_FOOTER = "ft";
+    
+    /**
+    * Constant representing the url for the "src" attribute of the iframe 
+    * used to monitor changes to the browser's base font size
+    * @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
+    * @static
+    * @final
+    * @type String
+    */
+    Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
+    
+    /**
+    * Singleton CustomEvent fired when the font size is changed in the browser.
+    * Opera's "zoom" functionality currently does not support text 
+    * size detection.
+    * @event YAHOO.widget.Module.textResizeEvent
+    */
+    Module.textResizeEvent = new CustomEvent("textResize");
+
+    function createModuleTemplate() {
+
+        if (!m_oModuleTemplate) {
+            m_oModuleTemplate = document.createElement("div");
+            
+            m_oModuleTemplate.innerHTML = ("<div class=\"" + 
+                Module.CSS_HEADER + "\"></div>" + "<div class=\"" + 
+                Module.CSS_BODY + "\"></div><div class=\"" + 
+                Module.CSS_FOOTER + "\"></div>");
+
+            m_oHeaderTemplate = m_oModuleTemplate.firstChild;
+            m_oBodyTemplate = m_oHeaderTemplate.nextSibling;
+            m_oFooterTemplate = m_oBodyTemplate.nextSibling;
+        }
+
+        return m_oModuleTemplate;
+    }
+
+    function createHeader() {
+        if (!m_oHeaderTemplate) {
+            createModuleTemplate();
+        }
+        return (m_oHeaderTemplate.cloneNode(false));
+    }
+
+    function createBody() {
+        if (!m_oBodyTemplate) {
+            createModuleTemplate();
+        }
+        return (m_oBodyTemplate.cloneNode(false));
+    }
+
+    function createFooter() {
+        if (!m_oFooterTemplate) {
+            createModuleTemplate();
+        }
+        return (m_oFooterTemplate.cloneNode(false));
+    }
+
+    Module.prototype = {
+
+        /**
+        * The class's constructor function
+        * @property contructor
+        * @type Function
+        */
+        constructor: Module,
+        
+        /**
+        * The main module element that contains the header, body, and footer
+        * @property element
+        * @type HTMLElement
+        */
+        element: null,
+
+        /**
+        * The header element, denoted with CSS class "hd"
+        * @property header
+        * @type HTMLElement
+        */
+        header: null,
+
+        /**
+        * The body element, denoted with CSS class "bd"
+        * @property body
+        * @type HTMLElement
+        */
+        body: null,
+
+        /**
+        * The footer element, denoted with CSS class "ft"
+        * @property footer
+        * @type HTMLElement
+        */
+        footer: null,
+
+        /**
+        * The id of the element
+        * @property id
+        * @type String
+        */
+        id: null,
+
+        /**
+        * A string representing the root path for all images created by
+        * a Module instance.
+        * @deprecated It is recommend that any images for a Module be applied
+        * via CSS using the "background-image" property.
+        * @property imageRoot
+        * @type String
+        */
+        imageRoot: Module.IMG_ROOT,
+
+        /**
+        * Initializes the custom events for Module which are fired 
+        * automatically at appropriate times by the Module class.
+        * @method initEvents
+        */
+        initEvents: function () {
+
+            var SIGNATURE = CustomEvent.LIST;
+
+            /**
+            * CustomEvent fired prior to class initalization.
+            * @event beforeInitEvent
+            * @param {class} classRef class reference of the initializing 
+            * class, such as this.beforeInitEvent.fire(Module)
+            */
+            this.beforeInitEvent = this.createEvent(EVENT_TYPES.BEFORE_INIT);
+            this.beforeInitEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired after class initalization.
+            * @event initEvent
+            * @param {class} classRef class reference of the initializing 
+            * class, such as this.beforeInitEvent.fire(Module)
+            */  
+            this.initEvent = this.createEvent(EVENT_TYPES.INIT);
+            this.initEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired when the Module is appended to the DOM
+            * @event appendEvent
+            */
+            this.appendEvent = this.createEvent(EVENT_TYPES.APPEND);
+            this.appendEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired before the Module is rendered
+            * @event beforeRenderEvent
+            */
+            this.beforeRenderEvent = this.createEvent(EVENT_TYPES.BEFORE_RENDER);
+            this.beforeRenderEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent fired after the Module is rendered
+            * @event renderEvent
+            */
+            this.renderEvent = this.createEvent(EVENT_TYPES.RENDER);
+            this.renderEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent fired when the header content of the Module 
+            * is modified
+            * @event changeHeaderEvent
+            * @param {String/HTMLElement} content String/element representing 
+            * the new header content
+            */
+            this.changeHeaderEvent = this.createEvent(EVENT_TYPES.CHANGE_HEADER);
+            this.changeHeaderEvent.signature = SIGNATURE;
+            
+            /**
+            * CustomEvent fired when the body content of the Module is modified
+            * @event changeBodyEvent
+            * @param {String/HTMLElement} content String/element representing 
+            * the new body content
+            */  
+            this.changeBodyEvent = this.createEvent(EVENT_TYPES.CHANGE_BODY);
+            this.changeBodyEvent.signature = SIGNATURE;
+            
+            /**
+            * CustomEvent fired when the footer content of the Module 
+            * is modified
+            * @event changeFooterEvent
+            * @param {String/HTMLElement} content String/element representing 
+            * the new footer content
+            */
+            this.changeFooterEvent = this.createEvent(EVENT_TYPES.CHANGE_FOOTER);
+            this.changeFooterEvent.signature = SIGNATURE;
+        
+            /**
+            * CustomEvent fired when the content of the Module is modified
+            * @event changeContentEvent
+            */
+            this.changeContentEvent = this.createEvent(EVENT_TYPES.CHANGE_CONTENT);
+            this.changeContentEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired when the Module is destroyed
+            * @event destroyEvent
+            */
+            this.destroyEvent = this.createEvent(EVENT_TYPES.DESTORY);
+            this.destroyEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired before the Module is shown
+            * @event beforeShowEvent
+            */
+            this.beforeShowEvent = this.createEvent(EVENT_TYPES.BEFORE_SHOW);
+            this.beforeShowEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired after the Module is shown
+            * @event showEvent
+            */
+            this.showEvent = this.createEvent(EVENT_TYPES.SHOW);
+            this.showEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired before the Module is hidden
+            * @event beforeHideEvent
+            */
+            this.beforeHideEvent = this.createEvent(EVENT_TYPES.BEFORE_HIDE);
+            this.beforeHideEvent.signature = SIGNATURE;
+
+            /**
+            * CustomEvent fired after the Module is hidden
+            * @event hideEvent
+            */
+            this.hideEvent = this.createEvent(EVENT_TYPES.HIDE);
+            this.hideEvent.signature = SIGNATURE;
+        }, 
+
+        /**
+        * String representing the current user-agent platform
+        * @property platform
+        * @type String
+        */
+        platform: function () {
+            var ua = navigator.userAgent.toLowerCase();
+
+            if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {
+                return "windows";
+            } else if (ua.indexOf("macintosh") != -1) {
+                return "mac";
+            } else {
+                return false;
+            }
+        }(),
+        
+        /**
+        * String representing the user-agent of the browser
+        * @deprecated Use YAHOO.env.ua
+        * @property browser
+        * @type String
+        */
+        browser: function () {
+            var ua = navigator.userAgent.toLowerCase();
+            /*
+                 Check Opera first in case of spoof and check Safari before
+                 Gecko since Safari's user agent string includes "like Gecko"
+            */
+            if (ua.indexOf('opera') != -1) { 
+                return 'opera';
+            } else if (ua.indexOf('msie 7') != -1) {
+                return 'ie7';
+            } else if (ua.indexOf('msie') != -1) {
+                return 'ie';
+            } else if (ua.indexOf('safari') != -1) { 
+                return 'safari';
+            } else if (ua.indexOf('gecko') != -1) {
+                return 'gecko';
+            } else {
+                return false;
+            }
+        }(),
+        
+        /**
+        * Boolean representing whether or not the current browsing context is 
+        * secure (https)
+        * @property isSecure
+        * @type Boolean
+        */
+        isSecure: function () {
+            if (window.location.href.toLowerCase().indexOf("https") === 0) {
+                return true;
+            } else {
+                return false;
+            }
+        }(),
+        
+        /**
+        * Initializes the custom events for Module which are fired 
+        * automatically at appropriate times by the Module class.
+        */
+        initDefaultConfig: function () {
+            // Add properties //
+            /**
+            * Specifies whether the Module is visible on the page.
+            * @config visible
+            * @type Boolean
+            * @default true
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.VISIBLE.key, {
+                handler: this.configVisible, 
+                value: DEFAULT_CONFIG.VISIBLE.value, 
+                validator: DEFAULT_CONFIG.VISIBLE.validator
+            });
+
+            /**
+            * Object or array of objects representing the ContainerEffect 
+            * classes that are active for animating the container.
+            * @config effect
+            * @type Object
+            * @default null
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.EFFECT.key, {
+                suppressEvent: DEFAULT_CONFIG.EFFECT.suppressEvent, 
+                supercedes: DEFAULT_CONFIG.EFFECT.supercedes
+            });
+
+            /**
+            * Specifies whether to create a special proxy iframe to monitor 
+            * for user font resizing in the document
+            * @config monitorresize
+            * @type Boolean
+            * @default true
+            */
+            this.cfg.addProperty(DEFAULT_CONFIG.MONITOR_RESIZE.key, {
+                handler: this.configMonitorResize,
+                value: DEFAULT_CONFIG.MONITOR_RESIZE.value
+