Index: media/css/widgets.css
===================================================================
--- media/css/widgets.css	(revision 2653)
+++ media/css/widgets.css	(working copy)
@@ -42,10 +42,10 @@
 .file-upload .deletelink { margin-left:5px; }
 
 /* CALENDARS & CLOCKS */
-.calendarbox, .clockbox { margin:5px auto; width: 10em; text-align: center; background:white; position:relative; }
+.calendarbox, .clockbox { margin:5px auto; font-size: 11px; width: 16em; text-align: center; background:white; position:relative; }
 .clockbox { width:6em; }
 .calendar { margin:0; padding: 0; }
-.calendar table { margin: 0; padding: 0; border-collapse:collapse; background:white; width:99%; }
+.calendar table { margin:0; padding:0; border-collapse:collapse; background:white; width:99%; }
 .calendar caption, .calendarbox h2 { margin: 0; font-size:11px; text-align:center; border-top:none; }
 .calendar th { font-size:10px; color:#666; padding:2px 3px; text-align:center; background:#e1e1e1 url(../img/admin/nav-bg.gif) 0 50% repeat-x; border-bottom:1px solid #ddd; }
 .calendar td { font-size:11px; text-align: center; padding: 0; border-top:1px solid #eee; border-bottom:none; }
Index: media/js/SelectFilter.js
===================================================================
--- media/js/SelectFilter.js	(revision 2653)
+++ media/js/SelectFilter.js	(working copy)
@@ -1,81 +0,0 @@
-/*
-SelectFilter - Turns a multiple-select box into a filter interface.
-
-Requires SelectBox.js and addevent.js.
-*/
-
-function findForm(node) {
-    // returns the node of the form containing the given node
-    if (node.tagName.toLowerCase() != 'form') {
-        return findForm(node.parentNode);
-    }
-    return node;
-}
-
-var SelectFilter = {
-    init: function(field_id) {
-        var from_box = document.getElementById(field_id);
-        from_box.id += '_from'; // change its ID
-        // Create the INPUT input box
-        var input_box = document.createElement('input');
-        input_box.id = field_id + '_input';
-        input_box.setAttribute('type', 'text');
-        from_box.parentNode.insertBefore(input_box, from_box);
-        from_box.parentNode.insertBefore(document.createElement('br'), input_box.nextSibling);
-        // Create the TO box
-        var to_box = document.createElement('select');
-        to_box.id = field_id + '_to';
-        to_box.setAttribute('multiple', 'multiple');
-        to_box.setAttribute('size', from_box.size);
-        from_box.parentNode.insertBefore(to_box, from_box.nextSibling);
-        to_box.setAttribute('name', from_box.getAttribute('name'));
-        from_box.setAttribute('name', from_box.getAttribute('name') + '_old');
-        // Give the filters a CSS hook
-        from_box.setAttribute('class', 'filtered');
-        to_box.setAttribute('class', 'filtered');
-        // Set up the JavaScript event handlers for the select box filter interface
-        addEvent(input_box, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); });
-        addEvent(input_box, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); });
-        addEvent(from_box, 'dblclick', function() { SelectBox.move(field_id + '_from', field_id + '_to'); });
-        addEvent(from_box, 'focus', function() { input_box.focus(); });
-        addEvent(to_box, 'dblclick', function() { SelectBox.move(field_id + '_to', field_id + '_from'); });
-        addEvent(findForm(from_box), 'submit', function() { SelectBox.select_all(field_id + '_to'); });
-        SelectBox.init(field_id + '_from');
-        SelectBox.init(field_id + '_to');
-        // Move selected from_box options to to_box
-        SelectBox.move(field_id + '_from', field_id + '_to');
-    },
-    filter_key_up: function(event, field_id) {
-        from = document.getElementById(field_id + '_from');
-        // don't submit form if user pressed Enter
-        if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
-            from.selectedIndex = 0;
-            SelectBox.move(field_id + '_from', field_id + '_to');
-            from.selectedIndex = 0;
-            return false;
-        }
-        var temp = from.selectedIndex;
-        SelectBox.filter(field_id + '_from', document.getElementById(field_id + '_input').value);
-        from.selectedIndex = temp;
-        return true;
-    },
-    filter_key_down: function(event, field_id) {
-        from = document.getElementById(field_id + '_from');
-        // right arrow -- move across
-        if ((event.which && event.which == 39) || (event.keyCode && event.keyCode == 39)) {
-            var old_index = from.selectedIndex;
-            SelectBox.move(field_id + '_from', field_id + '_to');
-            from.selectedIndex = (old_index == from.length) ? from.length - 1 : old_index;
-            return false;
-        }
-        // down arrow -- wrap around
-        if ((event.which && event.which == 40) || (event.keyCode && event.keyCode == 40)) {
-            from.selectedIndex = (from.length == from.selectedIndex + 1) ? 0 : from.selectedIndex + 1;
-        }
-        // up arrow -- wrap around
-        if ((event.which && event.which == 38) || (event.keyCode && event.keyCode == 38)) {
-            from.selectedIndex = (from.selectedIndex == 0) ? from.length - 1 : from.selectedIndex - 1;
-        }
-        return true;
-    }
-}
Index: media/js/SelectFilter2.js
===================================================================
--- media/js/SelectFilter2.js	(revision 2653)
+++ media/js/SelectFilter2.js	(working copy)
@@ -1,113 +0,0 @@
-/*
-SelectFilter2 - Turns a multiple-select box into a filter interface.
-
-Different than SelectFilter because this is coupled to the admin framework.
-
-Requires core.js, SelectBox.js and addevent.js.
-*/
-
-function findForm(node) {
-    // returns the node of the form containing the given node
-    if (node.tagName.toLowerCase() != 'form') {
-        return findForm(node.parentNode);
-    }
-    return node;
-}
-
-var SelectFilter = {
-    init: function(field_id, field_name, is_stacked, admin_media_prefix) {
-        var from_box = document.getElementById(field_id);
-        from_box.id += '_from'; // change its ID
-        from_box.className = 'filtered';
-
-        // Remove <p class="info">, because it just gets in the way.
-        var ps = from_box.parentNode.getElementsByTagName('p');
-        for (var i=0; i<ps.length; i++) {
-            from_box.parentNode.removeChild(ps[i]);
-        }
-
-        // <div class="selector"> or <div class="selector stacked">
-        var selector_div = quickElement('div', from_box.parentNode);
-        selector_div.className = is_stacked ? 'selector stacked' : 'selector';
-
-        // <div class="selector-available">
-        var selector_available = quickElement('div', selector_div, '');
-        selector_available.className = 'selector-available';
-        quickElement('h2', selector_available, interpolate(gettext('Available %s'), [field_name]));
-        var filter_p = quickElement('p', selector_available, '');
-        filter_p.className = 'selector-filter';
-        quickElement('img', filter_p, '', 'src', admin_media_prefix + 'img/admin/selector-search.gif');
-        filter_p.appendChild(document.createTextNode(' '));
-        var filter_input = quickElement('input', filter_p, '', 'type', 'text');
-        filter_input.id = field_id + '_input';
-        selector_available.appendChild(from_box);
-        var choose_all = quickElement('a', selector_available, gettext('Choose all'), 'href', 'javascript: (function(){ SelectBox.move_all("' + field_id + '_from", "' + field_id + '_to"); })()');
-        choose_all.className = 'selector-chooseall';
-
-        // <ul class="selector-chooser">
-        var selector_chooser = quickElement('ul', selector_div, '');
-        selector_chooser.className = 'selector-chooser';
-        var add_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Add'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_from","' + field_id + '_to");})()');
-        add_link.className = 'selector-add';
-        var remove_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Remove'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_to","' + field_id + '_from");})()');
-        remove_link.className = 'selector-remove';
-
-        // <div class="selector-chosen">
-        var selector_chosen = quickElement('div', selector_div, '');
-        selector_chosen.className = 'selector-chosen';
-        quickElement('h2', selector_chosen, interpolate(gettext('Chosen %s'), [field_name]));
-        var selector_filter = quickElement('p', selector_chosen, gettext('Select your choice(s) and click '));
-        selector_filter.className = 'selector-filter';
-        quickElement('img', selector_filter, '', 'src', admin_media_prefix + 'img/admin/selector-add.gif', 'alt', 'Add');
-        var to_box = quickElement('select', selector_chosen, '', 'id', field_id + '_to', 'multiple', 'multiple', 'size', from_box.size, 'name', from_box.getAttribute('name'));
-        to_box.className = 'filtered';
-        var clear_all = quickElement('a', selector_chosen, gettext('Clear all'), 'href', 'javascript: (function() { SelectBox.move_all("' + field_id + '_to", "' + field_id + '_from");})()');
-        clear_all.className = 'selector-clearall';
-
-        from_box.setAttribute('name', from_box.getAttribute('name') + '_old');
-
-        // Set up the JavaScript event handlers for the select box filter interface
-        addEvent(filter_input, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); });
-        addEvent(filter_input, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); });
-        addEvent(from_box, 'dblclick', function() { SelectBox.move(field_id + '_from', field_id + '_to'); });
-        addEvent(to_box, 'dblclick', function() { SelectBox.move(field_id + '_to', field_id + '_from'); });
-        addEvent(findForm(from_box), 'submit', function() { SelectBox.select_all(field_id + '_to'); });
-        SelectBox.init(field_id + '_from');
-        SelectBox.init(field_id + '_to');
-        // Move selected from_box options to to_box
-        SelectBox.move(field_id + '_from', field_id + '_to');
-    },
-    filter_key_up: function(event, field_id) {
-        from = document.getElementById(field_id + '_from');
-        // don't submit form if user pressed Enter
-        if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
-            from.selectedIndex = 0;
-            SelectBox.move(field_id + '_from', field_id + '_to');
-            from.selectedIndex = 0;
-            return false;
-        }
-        var temp = from.selectedIndex;
-        SelectBox.filter(field_id + '_from', document.getElementById(field_id + '_input').value);
-        from.selectedIndex = temp;
-        return true;
-    },
-    filter_key_down: function(event, field_id) {
-        from = document.getElementById(field_id + '_from');
-        // right arrow -- move across
-        if ((event.which && event.which == 39) || (event.keyCode && event.keyCode == 39)) {
-            var old_index = from.selectedIndex;
-            SelectBox.move(field_id + '_from', field_id + '_to');
-            from.selectedIndex = (old_index == from.length) ? from.length - 1 : old_index;
-            return false;
-        }
-        // down arrow -- wrap around
-        if ((event.which && event.which == 40) || (event.keyCode && event.keyCode == 40)) {
-            from.selectedIndex = (from.length == from.selectedIndex + 1) ? 0 : from.selectedIndex + 1;
-        }
-        // up arrow -- wrap around
-        if ((event.which && event.which == 38) || (event.keyCode && event.keyCode == 38)) {
-            from.selectedIndex = (from.selectedIndex == 0) ? from.length - 1 : from.selectedIndex - 1;
-        }
-        return true;
-    }
-}
Index: media/js/django/string.js
===================================================================
--- media/js/django/string.js	(revision 0)
+++ media/js/django/string.js	(revision 0)
@@ -0,0 +1,11 @@
+dojo.provide('django.string');
+
+django.string = {
+   pad_left: function(str, pad_length, pad_string) {
+      var new_string = str;
+      for (var i = 0; new_string.length < pad_length; i++) {
+	 new_string = pad_string + new_string;
+      }
+      return new_string;
+   }
+};
\ No newline at end of file
Index: media/js/django/admin.js
===================================================================
--- media/js/django/admin.js	(revision 0)
+++ media/js/django/admin.js	(revision 0)
@@ -0,0 +1,36 @@
+dojo.provide('django.admin');
+dojo.require('django.util');
+
+django.admin = {
+   init: function() {
+      if(typeof(auto_populate_array) != 'undefined') {
+//	 dojo.require('django.admin.AutoPopulate');
+	 django.admin.AutoPopulate.init(auto_populate_array);
+      }
+
+      if(typeof(select_filter_array) != 'undefined') {
+	 dojo.require('django.widget.SelectFilter');
+	 django.admin.initFilterWidgets(select_filter_array, admin_media_prefix);
+      }
+
+      if(typeof(date_time_fields) != 'undefined') {
+	 dojo.require('django.widget.DateTime');
+      }
+
+      if(typeof(first_form_field_id) != 'undefined') {
+	 document.getElementById(first_form_field_id).focus();
+      }
+
+      dojo.require('django.admin.RelatedLookups');
+      django.admin.RelatedLookups.init();
+      dojo.require('django.admin.CollapsedFieldsets');
+   },
+
+   initFilterWidgets: function(filterElementArray) {
+      for(var field in filterElementArray) {
+	 django.widget.SelectFilter.init(field, filterElementArray[field][0], filterElementArray[field][1], filterElementArray[field][2]);
+      }
+   }
+};
+
+dojo.addOnLoad(django.admin.init);
\ No newline at end of file
Index: media/js/django/widget/SelectFilter.js
===================================================================
--- media/js/django/widget/SelectFilter.js	(revision 0)
+++ media/js/django/widget/SelectFilter.js	(revision 0)
@@ -0,0 +1,101 @@
+dojo.provide('django.widget.SelectFilter');
+dojo.require('django.util');
+dojo.require('django.widget.SelectBox');
+
+django.widget.SelectFilter = {
+   init: function(field_id, field_name, is_stacked, admin_media_prefix) {
+      var from_box = document.getElementById(field_id);
+      from_box.id += '_from'; // change its ID
+      from_box.className = 'filtered';
+      
+      // Remove <p class="info">, because it just gets in the way.
+      var ps = from_box.parentNode.getElementsByTagName('p');
+      for (var i=0; i<ps.length; i++) {
+         from_box.parentNode.removeChild(ps[i]);
+      }
+      
+      // <div class="selector"> or <div class="selector stacked">
+      var selector_div = django.util.quickElement('div', from_box.parentNode);
+      selector_div.className = is_stacked ? 'selector stacked' : 'selector';
+      
+      // <div class="selector-available">
+      var selector_available = django.util.quickElement('div', selector_div, '');
+      selector_available.className = 'selector-available';
+      django.util.quickElement('h2', selector_available, interpolate(gettext('Available %s'), [field_name]));
+      var filter_p = django.util.quickElement('p', selector_available, '');
+      filter_p.className = 'selector-filter';
+      django.util.quickElement('img', filter_p, '', 'src', admin_media_prefix + 'img/admin/selector-search.gif');
+      filter_p.appendChild(document.createTextNode(' '));
+      var filter_input = django.util.quickElement('input', filter_p, '', 'type', 'text');
+      filter_input.id = field_id + '_input';
+      selector_available.appendChild(from_box);
+      var choose_all = django.util.quickElement('a', selector_available, gettext('Choose all'), 'href', 'javascript: (function(){ django.widget.SelectBox.move_all("' + field_id + '_from", "' + field_id + '_to"); })()');
+      choose_all.className = 'selector-chooseall';
+      
+      // <ul class="selector-chooser">
+      var selector_chooser = django.util.quickElement('ul', selector_div, '');
+      selector_chooser.className = 'selector-chooser';
+      var add_link = django.util.quickElement('a', django.util.quickElement('li', selector_chooser, ''), gettext('Add'), 'href', 'javascript: (function(){ django.widget.SelectBox.move("' + field_id + '_from","' + field_id + '_to");})()');
+      add_link.className = 'selector-add';
+      var remove_link = django.util.quickElement('a', django.util.quickElement('li', selector_chooser, ''), gettext('Remove'), 'href', 'javascript: (function(){ django.widget.SelectBox.move("' + field_id + '_to","' + field_id + '_from");})()');
+      remove_link.className = 'selector-remove';
+      
+      // <div class="selector-chosen">
+      var selector_chosen = django.util.quickElement('div', selector_div, '');
+      selector_chosen.className = 'selector-chosen';
+      django.util.quickElement('h2', selector_chosen, interpolate(gettext('Chosen %s'), [field_name]));
+      var selector_filter = django.util.quickElement('p', selector_chosen, gettext('Select your choice(s) and click '));
+      selector_filter.className = 'selector-filter';
+      django.util.quickElement('img', selector_filter, '', 'src', admin_media_prefix + 'img/admin/selector-add.gif', 'alt', 'Add');
+      var to_box = django.util.quickElement('select', selector_chosen, '', 'id', field_id + '_to', 'multiple', 'multiple', 'size', from_box.size, 'name', from_box.getAttribute('name'));
+      to_box.className = 'filtered';
+      var clear_all = django.util.quickElement('a', selector_chosen, gettext('Clear all'), 'href', 'javascript: (function() { django.widget.SelectBox.move_all("' + field_id + '_to", "' + field_id + '_from");})()');
+      clear_all.className = 'selector-clearall';
+      
+      from_box.setAttribute('name', from_box.getAttribute('name') + '_old');
+      
+      // Set up the JavaScript event handlers for the select box filter interface
+      django.util.addEvent(filter_input, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); });
+      django.util.addEvent(filter_input, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); });
+      django.util.addEvent(from_box, 'dblclick', function() { django.widget.SelectBox.move(field_id + '_from', field_id + '_to'); });
+      django.util.addEvent(to_box, 'dblclick', function() { django.widget.SelectBox.move(field_id + '_to', field_id + '_from'); });
+      django.util.addEvent(django.util.findForm(from_box), 'submit', function() { django.widget.SelectBox.select_all(field_id + '_to'); });
+      django.widget.SelectBox.init(field_id + '_from');
+      django.widget.SelectBox.init(field_id + '_to');
+      // Move selected from_box options to to_box
+      django.widget.SelectBox.move(field_id + '_from', field_id + '_to');
+   },
+   filter_key_up: function(event, field_id) {
+      from = document.getElementById(field_id + '_from');
+      // don't submit form if user pressed Enter
+      if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
+         from.selectedIndex = 0;
+         django.widget.SelectBox.move(field_id + '_from', field_id + '_to');
+         from.selectedIndex = 0;
+         return false;
+      }
+      var temp = from.selectedIndex;
+      django.widget.SelectBox.filter(field_id + '_from', document.getElementById(field_id + '_input').value);
+      from.selectedIndex = temp;
+      return true;
+   },
+   filter_key_down: function(event, field_id) {
+      from = document.getElementById(field_id + '_from');
+      // right arrow -- move across
+      if ((event.which && event.which == 39) || (event.keyCode && event.keyCode == 39)) {
+         var old_index = from.selectedIndex;
+         django.widget.SelectBox.move(field_id + '_from', field_id + '_to');
+         from.selectedIndex = (old_index == from.length) ? from.length - 1 : old_index;
+         return false;
+      }
+      // down arrow -- wrap around
+      if ((event.which && event.which == 40) || (event.keyCode && event.keyCode == 40)) {
+         from.selectedIndex = (from.length == from.selectedIndex + 1) ? 0 : from.selectedIndex + 1;
+      }
+      // up arrow -- wrap around
+      if ((event.which && event.which == 38) || (event.keyCode && event.keyCode == 38)) {
+         from.selectedIndex = (from.selectedIndex === 0) ? from.length - 1 : from.selectedIndex - 1;
+      }
+      return true;
+   }
+};
\ No newline at end of file
Index: media/js/django/widget/SelectBox.js
===================================================================
--- media/js/django/widget/SelectBox.js	(revision 0)
+++ media/js/django/widget/SelectBox.js	(revision 0)
@@ -0,0 +1,111 @@
+dojo.provide('django.widget.SelectBox');
+
+django.widget.SelectBox = {
+   cache: new Object(),
+   init: function(id) {
+      var box = document.getElementById(id);
+      var node;
+      django.widget.SelectBox.cache[id] = new Array();
+      var cache = django.widget.SelectBox.cache[id];
+      for (var i = 0; (node = box.options[i]); i++) {
+         cache.push({ value: node.value, text: node.text, displayed: 1 });
+      }
+   },
+   redisplay: function(id) {
+      // Repopulate HTML select box from cache
+      var box = document.getElementById(id);
+      box.options.length = 0; // clear all options
+      for (var i = 0, j = django.widget.SelectBox.cache[id].length; i < j; i++) {
+         var node = django.widget.SelectBox.cache[id][i];
+         if (node.displayed) {
+            box.options[box.options.length] = new Option(node.text, node.value, false, false);
+         }
+      }
+   },
+   filter: function(id, text) {
+      // Redisplay the HTML select box, displaying only the choices containing ALL
+      // the words in text. (It's an AND search.)
+      var tokens = text.toLowerCase().split(/\s+/);
+      var node, token;
+      for (var i = 0; (node = django.widget.SelectBox.cache[id][i]); i++) {
+         node.displayed = 1;
+         for (var j = 0; (token = tokens[j]); j++) {
+            if (node.text.toLowerCase().indexOf(token) == -1) {
+               node.displayed = 0;
+            }
+         }
+      }
+      django.widget.SelectBox.redisplay(id);
+   },
+    delete_from_cache: function(id, value) {
+       var node, delete_index = null;
+       for (var i = 0; (node = django.widget.SelectBox.cache[id][i]); i++) {
+          if (node.value == value) {
+             delete_index = i;
+             break;
+          }
+       }
+       var j = django.widget.SelectBox.cache[id].length - 1;
+       for (var i = delete_index; i < j; i++) {
+          django.widget.SelectBox.cache[id][i] = django.widget.SelectBox.cache[id][i+1];
+       }
+       django.widget.SelectBox.cache[id].length--;
+    },
+   add_to_cache: function(id, option) {
+      django.widget.SelectBox.cache[id].push({ value: option.value, text: option.text, displayed: 1 });
+   },
+   cache_contains: function(id, value) {
+      // Check if an item is contained in the cache
+      var node;
+      for (var i = 0; (node = django.widget.SelectBox.cache[id][i]); i++) {
+         if (node.value == value) {
+            return true;
+         }
+      }
+      return false;
+   },
+   move: function(from, to) {
+      var from_box = document.getElementById(from);
+      var to_box = document.getElementById(to);
+      var option;
+      for (var i = 0; (option = from_box.options[i]); i++) {
+         if (option.selected && django.widget.SelectBox.cache_contains(from, option.value)) {
+            django.widget.SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 });
+            django.widget.SelectBox.delete_from_cache(from, option.value);
+         }
+      }
+      django.widget.SelectBox.redisplay(from);
+      django.widget.SelectBox.redisplay(to);
+   },
+   move_all: function(from, to) {
+      var from_box = document.getElementById(from);
+      var to_box = document.getElementById(to);
+      var option;
+      for (var i = 0; (option = from_box.options[i]); i++) {
+         django.widget.SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 });
+         django.widget.SelectBox.delete_from_cache(from, option.value);
+      }
+      django.widget.SelectBox.redisplay(from);
+      django.widget.SelectBox.redisplay(to);
+   },
+   sort: function(id) {
+      django.widget.SelectBox.cache[id].sort( function(a, b) {
+          a = a.text.toLowerCase();
+          b = b.text.toLowerCase();
+	  try {
+              if (a > b) return 1;
+              if (a < b) return -1;
+          }
+          catch (e) {
+          // silently fail on IE 'unknown' exception
+          }
+          return 0;
+          });
+   },
+   select_all: function(id) {
+      var box = document.getElementById(id);
+      for (var i = 0; i < box.options.length; i++) {
+         box.options[i].selected = 'selected';
+      }
+   }
+};
\ No newline at end of file
Index: media/js/django/widget/DateTime.js
===================================================================
--- media/js/django/widget/DateTime.js	(revision 0)
+++ media/js/django/widget/DateTime.js	(revision 0)
@@ -0,0 +1,202 @@
+dojo.provide('django.widget.DateTime');
+dojo.require('django.datetime.*');
+
+// Inserts shortcut buttons after all of the following:
+//     <input type="text" class="vDateField">
+//     <input type="text" class="vTimeField">
+
+django.widget.DateTime = {
+   widgetType: 'DjangoDateTime',
+   calendars: [],
+   calendarInputs: [],
+   clockInputs: [],
+   calendarDivName1: 'calendarbox', // name of calendar <div> that gets toggled
+   calendarDivName2: 'calendarin',  // name of <div> that contains calendar
+   clockDivName: 'clockbox',        // name of clock <div> that gets toggled
+   admin_media_prefix: '',
+   init: function() {
+      django.widget.DateTime.admin_media_prefix = admin_media_prefix;
+      
+      var inputs = document.getElementsByTagName('input');
+      for (i=0; i<inputs.length; i++) {
+         var inp = inputs[i];
+         if (inp.getAttribute('type') == 'text' && inp.className.match(/vTimeField/)) {
+            django.widget.DateTime.addClock(inp);
+         }
+         else if (inp.getAttribute('type') == 'text' && inp.className.match(/vDateField/)) {
+            django.widget.DateTime.addCalendar(inp);
+         }
+      }
+   },
+   // Add clock widget to a given field
+   addClock: function(inp) {
+      var num = django.widget.DateTime.clockInputs.length;
+      django.widget.DateTime.clockInputs[num] = inp;
+      
+      // Shortcut links (clock icon and "Now" link)
+      var shortcuts_span = document.createElement('span');
+      inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling);
+      var now_link = document.createElement('a');
+      now_link.setAttribute('href', "javascript:django.widget.DateTime.handleClockQuicklink(" + num + ", django.datetime.getHourMinute(new Date()));");
+      now_link.appendChild(document.createTextNode(gettext('Now')));
+      var clock_link = document.createElement('a');
+      clock_link.setAttribute('href', 'javascript:django.widget.DateTime.openClock(' + num + ');');
+      django.util.quickElement('img', clock_link, '', 'src', django.widget.DateTime.admin_media_prefix + 'img/admin/icon_clock.gif', 'alt', gettext('Clock'));
+      shortcuts_span.appendChild(document.createTextNode('\240'));
+      shortcuts_span.appendChild(now_link);
+      shortcuts_span.appendChild(document.createTextNode('\240|\240'));
+      shortcuts_span.appendChild(clock_link);
+      
+      // Create clock link div
+      //
+      // Markup looks like:
+      // <div id="clockbox1" class="clockbox module">
+      //     <h2>Choose a time</h2>
+      //     <ul class="timelist">
+      //         <li><a href="#">Now</a></li>
+      //         <li><a href="#">Midnight</a></li>
+      //         <li><a href="#">6 a.m.</a></li>
+      //         <li><a href="#">Noon</a></li>
+      //     </ul>
+      //     <p class="calendar-cancel"><a href="#">Cancel</a></p>
+      // </div>
+      
+      var clock_box = document.createElement('div');
+      clock_box.style.display = 'none';
+      clock_box.style.position = 'absolute';
+      clock_box.style.left = django.util.findPosX(clock_link) + 17 + 'px';
+      clock_box.style.top = django.util.findPosY(clock_link) - 30 + 'px';
+      clock_box.className = 'clockbox module';
+      clock_box.setAttribute('id', django.widget.DateTime.clockDivName + num);
+      document.body.appendChild(clock_box);
+      django.util.addEvent(clock_box, 'click', django.widget.DateTime.cancelEventPropagation);
+      
+      django.util.quickElement('h2', clock_box, gettext('Choose a time'));
+      time_list = django.util.quickElement('ul', clock_box, '');
+      time_list.className = 'timelist';
+      django.util.quickElement("a", django.util.quickElement("li", time_list, ""), gettext("Now"), "href", "javascript:django.widget.DateTime.handleClockQuicklink(" + num + ", django.datetime.getHourMinute(new Date()));")
+      django.util.quickElement("a", django.util.quickElement("li", time_list, ""), gettext("Midnight"), "href", "javascript:django.widget.DateTime.handleClockQuicklink(" + num + ", '00:00');")
+      django.util.quickElement("a", django.util.quickElement("li", time_list, ""), gettext("6 a.m."), "href", "javascript:django.widget.DateTime.handleClockQuicklink(" + num + ", '06:00');")
+      django.util.quickElement("a", django.util.quickElement("li", time_list, ""), gettext("Noon"), "href", "javascript:django.widget.DateTime.handleClockQuicklink(" + num + ", '12:00');")
+      
+      cancel_p = django.util.quickElement('p', clock_box, '');
+      cancel_p.className = 'calendar-cancel';
+      django.util.quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:django.widget.DateTime.dismissClock(' + num + ');');
+   },
+   openClock: function(num) {
+      document.getElementById(django.widget.DateTime.clockDivName + num).style.display = 'block';
+      django.util.addEvent(window, 'click', function() { django.widget.DateTime.dismissClock(num); return true; });
+   },
+   dismissClock: function(num) {
+      document.getElementById(django.widget.DateTime.clockDivName + num).style.display = 'none';
+      window.onclick = null;
+   },
+   handleClockQuicklink: function(num, val) {
+      django.widget.DateTime.clockInputs[num].value = val;
+      django.widget.DateTime.dismissClock(num);
+   },
+   // Add calendar widget to a given field.
+   addCalendar: function(inp) {
+      var num = django.widget.DateTime.calendars.length;
+      
+      django.widget.DateTime.calendarInputs[num] = inp;
+      
+      // Shortcut links (calendar icon and "Today" link)
+      var shortcuts_span = document.createElement('span');
+      inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling);
+      var today_link = document.createElement('a');
+      today_link.setAttribute('href', 'javascript:django.widget.DateTime.handleCalendarQuickLink(' + num + ', 0);');
+      today_link.appendChild(document.createTextNode(gettext('Today')));
+      var cal_link = document.createElement('a');
+      cal_link.setAttribute('href', 'javascript:django.widget.DateTime.openCalendar(' + num + ');');
+      django.util.quickElement('img', cal_link, '', 'src', django.widget.DateTime.admin_media_prefix + 'img/admin/icon_calendar.gif', 'alt', gettext('Calendar'));
+      shortcuts_span.appendChild(document.createTextNode('\240'));
+      shortcuts_span.appendChild(today_link);
+      shortcuts_span.appendChild(document.createTextNode('\240|\240'));
+      shortcuts_span.appendChild(cal_link);
+      
+      // Create calendarbox div.
+      //
+      // Markup looks like:
+      //
+      // <div id="calendarbox3" class="calendarbox module">
+      //     <h2>
+      //           <a href="#" class="link-previous">&lsaquo;</a>
+      //           <a href="#" class="link-next">&rsaquo;</a> February 2003
+      //     </h2>
+      //     <div class="calendar" id="calendarin3">
+      //         <!-- (cal) -->
+      //     </div>
+      //     <div class="calendar-shortcuts">
+      //          <a href="#">Yesterday</a> | <a href="#">Today</a> | <a href="#">Tomorrow</a>
+      //     </div>
+      //     <p class="calendar-cancel"><a href="#">Cancel</a></p>
+      // </div>
+      var cal_box = document.createElement('div');
+      cal_box.style.display = 'none';
+      cal_box.style.position = 'absolute';
+      cal_box.style.left = django.util.findPosX(cal_link) + 17 + 'px';
+      cal_box.style.top = django.util.findPosY(cal_link) - 75 + 'px';
+      cal_box.className = 'calendarbox module';
+      cal_box.setAttribute('id', django.widget.DateTime.calendarDivName1 + num);
+      document.body.appendChild(cal_box);
+      django.util.addEvent(cal_box, 'click', django.widget.DateTime.cancelEventPropagation);
+      
+      // next-prev links
+      var cal_nav = django.util.quickElement('div', cal_box, '');
+      var cal_nav_prev = django.util.quickElement('a', cal_nav, '<', 'href', 'javascript:django.widget.DateTime.drawPrev('+num+');');
+      cal_nav_prev.className = 'calendarnav-previous';
+      var cal_nav_next = django.util.quickElement('a', cal_nav, '>', 'href', 'javascript:django.widget.DateTime.drawNext('+num+');');
+      cal_nav_next.className = 'calendarnav-next';
+      cal_box.appendChild(cal_nav);
+      
+      // main box
+      var cal_main = django.util.quickElement('div', cal_box, '', 'id', django.widget.DateTime.calendarDivName2 + num);
+      cal_main.className = 'calendar';
+      django.widget.DateTime.calendars[num] = new django.datetime.calendar.Calendar(django.widget.DateTime.calendarDivName2 + num, django.widget.DateTime.handleCalendarCallback(num));
+      django.widget.DateTime.calendars[num].drawCurrent();
+      
+      // calendar shortcuts
+      var shortcuts = django.util.quickElement('div', cal_box, '');
+      shortcuts.className = 'calendar-shortcuts';
+      django.util.quickElement('a', shortcuts, gettext('Yesterday'), 'href', 'javascript:django.widget.DateTime.handleCalendarQuickLink(' + num + ', -1);');
+      shortcuts.appendChild(document.createTextNode('\240|\240'));
+      django.util.quickElement('a', shortcuts, gettext('Today'), 'href', 'javascript:django.widget.DateTime.handleCalendarQuickLink(' + num + ', 0);');
+      shortcuts.appendChild(document.createTextNode('\240|\240'));
+      django.util.quickElement('a', shortcuts, gettext('Tomorrow'), 'href', 'javascript:django.widget.DateTime.handleCalendarQuickLink(' + num + ', +1);');
+      
+      // cancel bar
+      var cancel_p = django.util.quickElement('p', cal_box, '');
+      cancel_p.className = 'calendar-cancel';
+      django.util.quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:django.widget.DateTime.dismissCalendar(' + num + ');');
+   },
+   openCalendar: function(num) {
+      document.getElementById(django.widget.DateTime.calendarDivName1+num).style.display = 'block';
+      django.util.addEvent(window, 'click', function() { django.widget.DateTime.dismissCalendar(num); return true; });
+   },
+   dismissCalendar: function(num) {
+      document.getElementById(django.widget.DateTime.calendarDivName1+num).style.display = 'none';
+   },
+   drawPrev: function(num) {
+      django.widget.DateTime.calendars[num].drawPreviousMonth();
+   },
+   drawNext: function(num) {
+      django.widget.DateTime.calendars[num].drawNextMonth();
+   },
+   handleCalendarCallback: function(num) {
+      return "function(y, m, d) { django.widget.DateTime.calendarInputs["+num+"].value = y+'-'+m+'-'+d; document.getElementById(django.widget.DateTime.calendarDivName1+"+num+").style.display='none';}";
+   },
+   handleCalendarQuickLink: function(num, offset) {
+      var d = new Date();
+      d.setDate(d.getDate() + offset)
+      django.widget.DateTime.calendarInputs[num].value = django.datetime.getISODate(d);
+      django.widget.DateTime.dismissCalendar(num);
+   },
+   cancelEventPropagation: function(e) {
+      if (!e) var e = window.event;
+      e.cancelBubble = true;
+      if (e.stopPropagation) e.stopPropagation();
+   }
+};
+
+dojo.addOnLoad(django.widget.DateTime.init);
\ No newline at end of file
Index: media/js/django/datetime.js
===================================================================
--- media/js/django/datetime.js	(revision 0)
+++ media/js/django/datetime.js	(revision 0)
@@ -0,0 +1,323 @@
+dojo.provide('django.datetime');
+
+django.datetime = {
+   getCorrectYear: function(date) {
+      // Date.getYear() is unreliable --
+      // see http://www.quirksmode.org/js/introdate.html#year
+      var y = date.getYear() % 100;
+      return (y < 38) ? y + 2000 : y + 1900;
+   },
+
+   getTwoDigitMonth: function(date) {
+      return (date.getMonth() < 9) ? '0' + (date.getMonth()+1) : (date.getMonth()+1);
+   },
+
+   getTwoDigitDate: function(date) {
+      return (date.getDate() < 10) ? '0' + date.getDate() : date.getDate();
+   },
+
+   getTwoDigitMinute: function(date) {
+      return (date.getMinutes() < 10) ? '0' + date.getMinutes() : date.getMinutes();
+   },
+
+   getTwoDigitHour: function(date) {
+      return (date.getHours() < 10) ? '0' + date.getHours() : date.getHours();
+   },
+
+   getISODate: function(date) {
+      return django.datetime.getCorrectYear(date) + '-' + django.datetime.getTwoDigitMonth(date) + '-' + django.datetime.getTwoDigitDate(date);
+   },
+
+   getHourMinute: function(date) {
+      return django.datetime.getTwoDigitHour(date) + ':' + django.datetime.getTwoDigitMinute(date);
+   },
+
+   monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+
+   weekdayNames: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
+
+   weekdayInitials: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
+
+   parseToNum: function(english) {
+      var dateTypeInfo = (english.match(/day$/)) ? {'array': django.datetime.weekdayNames, 'type': 'weekday'} : {'array': django.datetime.monthNames, 'type': 'weekday'};
+
+      var matches = dateTypeInfo['array'].filter(function(item) {
+         return new RegExp("^" + english, "i").test(item);
+      })
+
+      if(matches.length == 0) {
+         var errString = 'Invalid ' + dateTypeInfo['type'] + ' string';
+         throw new Error(errString);
+      }
+
+      if(matches.length > 1) {
+         var errString = 'Ambiguous ' + dateTypeInfo['type'];
+         throw new Error(errString);
+      }
+
+      return dateTypeInfo['array'].indexOf(matches[0]);
+   },
+
+   dateParsePatterns: [
+      // Today
+      {   re: /^tod/i,
+          handler: function() { 
+             return new Date();
+          } 
+      },
+      // Tomorrow
+      {   re: /^tom/i,
+          handler: function() {
+             var d = new Date(); 
+             d.setDate(d.getDate() + 1); 
+             return d;
+          }
+      },
+      // Yesterday
+      {   re: /^yes/i,
+          handler: function() {
+             var d = new Date();
+             d.setDate(d.getDate() - 1);
+             return d;
+          }
+      },
+      // 4th
+      {   re: /^(\d{1,2})(st|nd|rd|th)?$/i, 
+          handler: function(bits) {
+             var d = new Date();
+             d.setDate(parseInt(bits[1], 10));
+             return d;
+          }
+      },
+      // 4th Jan
+      {   re: /^(\d{1,2})(?:st|nd|rd|th)? (\w+)$/i, 
+          handler: function(bits) {
+             var d = new Date();
+             d.setDate(parseInt(bits[1], 10));
+             d.setMonth(parseToNum(bits[2]));
+             return d;
+          }
+      },
+      // 4th Jan 2003
+      {   re: /^(\d{1,2})(?:st|nd|rd|th)? (\w+),? (\d{4})$/i,
+          handler: function(bits) {
+             var d = new Date();
+             d.setDate(parseInt(bits[1], 10));
+             d.setMonth(parseToNum(bits[2]));
+             d.setYear(bits[3]);
+             return d;
+          }
+      },
+      // Jan 4th
+      {   re: /^(\w+) (\d{1,2})(?:st|nd|rd|th)?$/i, 
+          handler: function(bits) {
+             var d = new Date();
+             d.setDate(parseInt(bits[2], 10));
+             d.setMonth(parseToNum(bits[1]));
+             return d;
+          }
+      },
+      // Jan 4th 2003
+      {   re: /^(\d{1,2})(?:st|nd|rd|th)? (?:of )?(\w+),? (\d{4})$/i,
+          handler: function(bits) {
+             var d = new Date();
+             d.setDate(parseInt(bits[2], 10));
+             d.setMonth(parseToNum(bits[1]));
+             d.setYear(bits[3]);
+             return d;
+          }
+      },
+      // next Tuesday - this is suspect due to weird meaning of "next"
+      {   re: /^next (\w+)$/i,
+          handler: function(bits) {
+             var d = new Date();
+             var day = d.getDay();
+             var newDay = parseToNum(bits[1]);
+             var addDays = newDay - day;
+             if (newDay <= day) {
+                addDays += 7;
+             }
+             d.setDate(d.getDate() + addDays);
+             return d;
+          }
+      },
+      // last Tuesday
+      {   re: /^last (\w+)$/i,
+          handler: function(bits) {
+             throw new Error("Not yet implemented");
+          }
+      },
+      // mm/dd/yyyy (American style)
+      {   re: /(\d{1,2})\/(\d{1,2})\/(\d{4})/,
+          handler: function(bits) {
+             var d = new Date();
+             d.setYear(bits[3]);
+             d.setDate(parseInt(bits[2], 10));
+             d.setMonth(parseInt(bits[1], 10) - 1); // Because months indexed from 0
+             return d;
+          }
+      },
+      // yyyy-mm-dd (ISO style)
+      {   re: /(\d{4})-(\d{1,2})-(\d{1,2})/,
+          handler: function(bits) {
+             var d = new Date();
+             d.setYear(parseInt(bits[1]));
+             d.setDate(parseInt(bits[3], 10));
+             d.setMonth(parseInt(bits[2], 10) - 1);
+             return d;
+          }
+      },
+   ],
+   
+   parseDateString: function(s) {
+      for (var i = 0; i < django.datetime.dateParsePatterns.length; i++) {
+         var re = django.datetime.dateParsePatterns[i].re;
+         var handler = django.datetime.dateParsePatterns[i].handler;
+         var bits = re.exec(s);
+         if (bits) {
+            return handler(bits);
+         }
+      }
+      throw new Error("Invalid date string");
+   },
+   
+   fmt00: function(x) {
+      // fmt00: Tags leading zero onto numbers 0 - 9.
+      // Particularly useful for displaying results from Date methods.
+      //
+      if (Math.abs(parseInt(x)) < 10){
+         x = "0"+ Math.abs(x);
+      }
+      return x;
+   },
+   
+   parseDateStringISO: function(s) {
+      try {
+         var d = django.datetime.parseDateString(s);
+         return d.getFullYear() + '-' + (django.datetime.fmt00(d.getMonth() + 1)) + '-' + django.datetime.fmt00(d.getDate())
+      }
+      catch (e) { return s; }
+   },
+   
+   magicDate: function(input) {
+      var messagespan = input.id + 'Msg';
+      try {
+         var d = django.datetime.parseDateString(input.value);
+         input.value = d.getFullYear() + '-' + (django.datetime.fmt00(d.getMonth() + 1)) + '-' + 
+            django.datetime.fmt00(d.getDate());
+         input.className = '';
+         // Human readable date
+         if (document.getElementById(messagespan)) {
+            document.getElementById(messagespan).firstChild.nodeValue = d.toDateString();
+            document.getElementById(messagespan).className = 'normal';
+         }
+      }
+      catch (e) {
+         input.className = 'error';
+         var message = e.message;
+         // Fix for IE6 bug
+         if (message.indexOf('is null or not an object') > -1) {
+            message = 'Invalid date string';
+         }
+         if (document.getElementById(messagespan)) {
+            document.getElementById(messagespan).firstChild.nodeValue = message;
+            document.getElementById(messagespan).className = 'error';
+         }
+      }
+   },
+   
+   timeParsePatterns: [
+      // 9
+      {   re: /^\d{1,2}$/i,
+          handler: function(bits) {
+             if (bits[0].length == 1) {
+                return '0' + bits[0] + ':00';
+             } else {
+                return bits[0] + ':00';
+             }
+          }
+      },
+      // 13:00
+      {   re: /^\d{2}[:.]\d{2}$/i,
+          handler: function(bits) {
+             return bits[0].replace('.', ':');
+          }
+      },
+      // 9:00
+      {   re: /^\d[:.]\d{2}$/i,
+          handler: function(bits) {
+             return '0' + bits[0].replace('.', ':');
+          }
+      },
+      // 3 am / 3 a.m. / 3am
+      {   re: /^(\d+)\s*([ap])(?:.?m.?)?$/i,
+          handler: function(bits) {
+             var hour = parseInt(bits[1]);
+             if (hour == 12) {
+                hour = 0;
+             }
+             if (bits[2].toLowerCase() == 'p') {
+                if (hour == 12) {
+                   hour = 0;
+                }
+                return (hour + 12) + ':00';
+             } else {
+                if (hour < 10) {
+                   return '0' + hour + ':00';
+                } else {
+                   return hour + ':00';
+                }
+             }
+          }
+      },
+      // 3.30 am / 3:15 a.m. / 3.00am
+      {   re: /^(\d+)[.:](\d{2})\s*([ap]).?m.?$/i,
+          handler: function(bits) {
+             var hour = parseInt(bits[1]);
+             var mins = parseInt(bits[2]);
+             if (mins < 10) {
+                mins = '0' + mins;
+             }
+             if (hour == 12) {
+                hour = 0;
+             }
+             if (bits[3].toLowerCase() == 'p') {
+                if (hour == 12) {
+                   hour = 0;
+                }
+                return (hour + 12) + ':' + mins;
+             } else {
+                if (hour < 10) {
+                   return '0' + hour + ':' + mins;
+                } else {
+                   return hour + ':' + mins;
+                }
+             }
+          }
+      },
+      // noon
+      {   re: /^no/i,
+          handler: function(bits) {
+             return '12:00';
+          }
+      },
+      // midnight
+      {   re: /^mid/i,
+          handler: function(bits) {
+             return '00:00';
+          }
+      }
+   ],
+   
+   parseTimeString: function(s) {
+      for (var i = 0; i < timeParsePatterns.length; i++) {
+         var re = timeParsePatterns[i].re;
+         var handler = timeParsePatterns[i].handler;
+         var bits = re.exec(s);
+         if (bits) {
+            return handler(bits);
+         }
+      }
+      return s;
+   }    
+};
\ No newline at end of file
Index: media/js/django/util.js
===================================================================
--- media/js/django/util.js	(revision 0)
+++ media/js/django/util.js	(revision 0)
@@ -0,0 +1,96 @@
+dojo.provide('django.util');
+
+django.util = {
+   URLify: function(s, num_chars) {
+      // changes, e.g., "Petty theft" to "petty_theft"
+      // remove all these words from the string before urlifying
+      removelist = ["a", "an", "as", "at", "before", "but", "by", "for", "from",
+	            "is", "in", "into", "like", "of", "off", "on", "onto", "per",
+	            "since", "than", "the", "this", "that", "to", "up", "via",
+	            "with"];
+      r = new RegExp('\\b(' + removelist.join('|') + ')\\b', 'gi');
+      s = s.replace(r, '');
+      s = s.replace(/[^-A-Z0-9\s]/gi, '');  // remove unneeded chars
+      s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces
+      s = s.replace(/\s+/g, '-');      // convert spaces to hyphens
+      s = s.toLowerCase();             // convert to lowercase
+      return s.substring(0, num_chars);// trim to first num_chars chars
+   },
+   
+   findForm: function(node) {
+      // returns the node of the form containing the given node
+      if (node.tagName.toLowerCase() != 'form') {
+         return django.util.findForm(node.parentNode);
+      }
+      return node;
+   },
+   
+   quickElement: function() {
+      var obj = document.createElement(arguments[0]);
+      if (arguments[2] != '' && arguments[2] != null) {
+	 var textNode = document.createTextNode(arguments[2]);
+	 obj.appendChild(textNode);
+      }
+      var len = arguments.length;
+      for (var i = 3; i < len; i += 2) {
+	 obj.setAttribute(arguments[i], arguments[i+1]);
+      }
+      arguments[1].appendChild(obj);
+      return obj;
+   },
+   
+   removeChildren: function(a) { // "a" is reference to an object
+      while (a.hasChildNodes()) a.removeChild(a.lastChild);
+   },
+   
+   findPosX: function(obj) {
+      var curleft = 0;
+      if (obj.offsetParent) {
+	 while (obj.offsetParent) {
+	    curleft += obj.offsetLeft;
+	    obj = obj.offsetParent;
+	 }
+      } else if (obj.x) {
+	 curleft += obj.x;
+      }
+      return curleft;
+   },
+   
+   findPosY: function(obj) {
+      var curtop = 0;
+      if (obj.offsetParent) {
+	 while (obj.offsetParent) {
+	    curtop += obj.offsetTop;
+	    obj = obj.offsetParent;
+	 }
+      } else if (obj.y) {
+	 curtop += obj.y;
+      }
+      return curtop;
+   },
+   
+   addEvent: function(obj, type, fn) {
+      /* John Resig's addEvent, with modifications by Peter-Paul Koch.
+         * See http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
+         */
+      if (obj.addEventListener) {
+    	 obj.addEventListener( type, fn, false );
+      }
+      else if (obj.attachEvent) {
+    	 obj["e"+type+fn] = fn;
+    	 obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
+    	 obj.attachEvent("on"+type, obj[type+fn]);
+      }
+   },
+
+    removeEvent: function(obj, evType, fn) {
+       if (obj.removeEventListener) {
+          obj.removeEventListener(evType, fn, false);
+          return true;
+       } else if (obj.detachEvent) {
+          obj.detachEvent("on" + evType, fn);
+       } else {
+          return false;
+       }
+    }
+};
\ No newline at end of file
Index: media/js/django/admin/__package__.js
===================================================================
--- media/js/django/admin/__package__.js	(revision 0)
+++ media/js/django/admin/__package__.js	(revision 0)
@@ -0,0 +1,9 @@
+dojo.hostenv.conditionalLoadModule({
+	common: [
+		"django.admin",
+		"django.admin.CollapsedFieldsets",
+		"django.admin.AutoPopulate",
+		"django.admin.RelatedLookups"
+	]
+});
+dojo.hostenv.moduleLoaded("django.admin.*");
Index: media/js/django/admin/CollapsedFieldsets.js
===================================================================
--- media/js/django/admin/CollapsedFieldsets.js	(revision 0)
+++ media/js/django/admin/CollapsedFieldsets.js	(revision 0)
@@ -0,0 +1,87 @@
+dojo.provide('django.admin.CollapsedFieldsets');
+dojo.require('dojo.event');
+dojo.require('django.util');
+
+// Finds all fieldsets with class="collapse", collapses them, and gives each
+// one a "Show" link that uncollapses it. The "Show" link becomes a "Hide"
+// link when the fieldset is visible.
+
+
+django.admin.CollapsedFieldsets = {
+   collapse_re: /\bcollapse\b/,   // Class of fieldsets that should be dealt with.
+   collapsed_re: /\bcollapsed\b/, // Class that fieldsets get when they're hidden.
+   collapsed_class: 'collapsed',
+   init: function() {
+      var fieldsets = document.getElementsByTagName('fieldset');
+      var collapsed_seen = false;
+      for (var i=0; i<fieldsets.length; i++) {
+         // Collapse this fieldset if it has the correct class, and if it
+         // doesn't have any errors. (Collapsing shouldn't apply in the case
+         // of error messages.)
+         var fs = fieldsets[i];
+         if (fs.className.match(django.admin.CollapsedFieldsets.collapse_re) && !django.admin.CollapsedFieldsets.fieldset_has_errors(fs)) {
+            collapsed_seen = true;
+            // Give it an additional class, used by CSS to hide it.
+            fs.className += ' ' + django.admin.CollapsedFieldsets.collapsed_class;
+            // (<a id="fieldsetcollapser3" class="collapse-toggle" href="#">Show</a>)
+            var collapse_link = document.createElement('a');
+            collapse_link.className = 'collapse-toggle';
+            collapse_link.id = 'fieldsetcollapser' + i;
+            collapse_link.onclick = new Function('django.admin.CollapsedFieldsets.show('+i+'); return false;');
+            collapse_link.href = '#';
+            collapse_link.innerHTML = 'Show';
+            var h2 = fs.getElementsByTagName('h2')[0];
+            h2.appendChild(document.createTextNode(' ('));
+            h2.appendChild(collapse_link);
+            h2.appendChild(document.createTextNode(')'));
+         }
+         if (collapsed_seen) {
+            // Expand all collapsed fieldsets when form is submitted.
+            dojo.event.connect(django.util.findForm(document.getElementsByTagName('fieldset')[0]), 'onsubmit', function() { django.admin.CollapsedFieldsets.uncollapse_all(); });
+         }
+      }
+   },
+
+   fieldset_has_errors: function(fs) {
+      // Returns true if any fields in the fieldset have validation errors.
+      var divs = fs.getElementsByTagName('div');
+      for (var i=0; i<divs.length; i++) {
+    	 if (divs[i].className.match(/\berror\b/)) {
+    	    return true;
+    	 }
+      }
+      return false;
+   },
+    
+   show: function(fieldset_index) {
+      var fs = document.getElementsByTagName('fieldset')[fieldset_index];
+      // Remove the class name that causes the "display: none".
+      fs.className = fs.className.replace(django.admin.CollapsedFieldsets.collapsed_re, '');
+      // Toggle the "Show" link to a "Hide" link
+      var collapse_link = document.getElementById('fieldsetcollapser' + fieldset_index);
+      collapse_link.onclick = new Function('django.admin.CollapsedFieldsets.hide('+fieldset_index+'); return false;');
+      collapse_link.innerHTML = 'Hide';
+   },
+      
+   hide: function(fieldset_index) {
+      var fs = document.getElementsByTagName('fieldset')[fieldset_index];
+      // Add the class name that causes the "display: none".
+      fs.className += ' ' + django.admin.CollapsedFieldsets.collapsed_class;
+      // Toggle the "Hide" link to a "Show" link
+      var collapse_link = document.getElementById('fieldsetcollapser' + fieldset_index);
+      collapse_link.onclick = new Function('django.admin.CollapsedFieldsets.show('+fieldset_index+'); return false;');
+      collapse_link.innerHTML = 'Show';
+   },
+      
+   uncollapse_all: function() {
+      var fieldsets = document.getElementsByTagName('fieldset');
+      for (var i=0; i<fieldsets.length; i++) {
+	 if (fieldsets[i].className.match(django.admin.CollapsedFieldsets.collapsed_re)) {
+	    django.admin.CollapsedFieldsets.show(i);
+	 }
+      }
+   }
+}; 
+
+
+dojo.addOnLoad(django.admin.CollapsedFieldsets.init);
Index: media/js/django/admin/RelatedLookups.js
===================================================================
--- media/js/django/admin/RelatedLookups.js	(revision 0)
+++ media/js/django/admin/RelatedLookups.js	(revision 0)
@@ -0,0 +1,72 @@
+dojo.provide('django.admin.RelatedLookups');
+dojo.require('dojo.event.*');
+
+django.admin.RelatedLookups = {
+   relatedPopups: {},
+   addPopups: {},
+   
+   createRelatedHandler: function(elem) {
+      return function(evt) {
+         var href = django.admin.RelatedLookups.relatedPopups[elem.id];
+         var name = elem.id.replace(/^lookup_/, '').replace(/\./g, '___');
+         win = window.open(href + '?_popup=1', name, 'height=500,width=800,resizable=yes,scrollbars=yes');
+         win.focus();
+      }
+   },
+
+   createAddHandler: function(elem) {
+      return function(evt) {
+         var href = django.admin.RelatedLookups.addPopups[elem.id];
+         var name = elem.id.replace(/^add_/, '').replace(/\./g, '___');
+         win = window.open(href + '?_popup=1', name, 'height=500,width=800,resizable=yes,scrollbars=yes');
+         win.focus();
+      }
+   },
+   
+   init: function() {
+      var links = document.getElementsByTagName('a');
+      var num_links = links.length;
+      for(var i=0; i<num_links; i++) {
+         if(links[i].className.indexOf('related-lookup') != -1) {
+            django.admin.RelatedLookups.relatedPopups[links[i].id] = links[i].href;
+            links[i].href = 'javascript:void(0)'; //This is easier than trying to make preventDefault work in Safari.
+            dojo.event.connect(links[i], 'onclick', django.admin.RelatedLookups.createRelatedHandler(links[i]));
+	 } else if(links[i].className.indexOf('add-another') != -1) {
+            django.admin.RelatedLookups.addPopups[links[i].id] = links[i].href;
+            links[i].href = 'javascript:void(0)';
+            dojo.event.connect(links[i], 'onclick', django.admin.RelatedLookups.createAddHandler(links[i]));
+	 }
+      }
+   },
+   
+   dismissRelatedLookupPopup: function(win, chosenId) {
+      var elem = document.getElementById(win.name);
+      if (elem.className.indexOf('vRawIdAdminField') != -1 && elem.value) {
+         elem.value += ',' + chosenId;
+      } else {
+         document.getElementById(win.name).value = chosenId;
+      }
+      win.close();
+   },
+   
+   dismissAddAnotherPopup: function(win, newId, newRepr) {
+      var name = win.name.replace(/___/g, '.');
+      var elem = document.getElementById(name);
+      if (elem) {
+         if (elem.nodeName == 'SELECT') {
+            var o = new Option(newRepr, newId);
+            elem.options[elem.options.length] = o;
+            elem.selectedIndex = elem.length - 1;
+         } else if (elem.nodeName == 'INPUT') {
+            elem.value = newId;
+         }
+      } else {
+         var toId = name + "_to";
+         elem = document.getElementById(toId);
+         var o = new Option(newRepr, newId);
+         django.widget.SelectBox.add_to_cache(toId, o);
+         django.widget.SelectBox.redisplay(toId);
+      }
+      win.close();
+   }
+}
\ No newline at end of file
Index: media/js/django/admin/AutoPopulate.js
===================================================================
--- media/js/django/admin/AutoPopulate.js	(revision 0)
+++ media/js/django/admin/AutoPopulate.js	(revision 0)
@@ -0,0 +1,46 @@
+dojo.provide('django.admin.AutoPopulate');
+dojo.require('dojo.event.*');
+
+django.admin.AutoPopulate = {
+   createHandler: function(elem) {
+      return function(evt) {
+	 var destFields = django.admin.AutoPopulate.sourceIndexedArray[elem.id];
+	 var num_dests = destFields.length;
+	 for(var i=0; i<num_dests; i++) {
+	    var destField = document.getElementById(destFields[i]);
+	    if(!destField.className.indexOf('changed') != 1) {
+	       var sources = django.admin.AutoPopulate.destIndexedArray[destFields[i]];
+	       var num_sources = sources.length;
+	       var newValues = '';
+	       for(var j=0; j<num_sources; j++) {
+		  newValues += document.getElementById(sources[j]).value + " ";
+	       }
+	       destField.value = django.util.URLify(newValues, 250);
+	    }
+	 }
+      }
+   },
+
+   init: function(auto_populate_array) {
+      django.admin.AutoPopulate.sourceIndexedArray = {};
+      django.admin.AutoPopulate.destIndexedArray = auto_populate_array;
+      var num_dests = django.admin.AutoPopulate.destIndexedArray.length;
+      for(var destField in django.admin.AutoPopulate.destIndexedArray) {
+	 dojo.event.connect(document.getElementById(destField), "onchange", function(evt) {
+			       document.getElementById(destField).className += " changed";
+			    });
+	 var sources = django.admin.AutoPopulate.destIndexedArray[destField];
+	 var num_sources = sources.length;
+	 for(var i=0; i<num_sources; i++) {
+	    var sourceField = document.getElementById(sources[i]);
+	    if(typeof(django.admin.AutoPopulate.sourceIndexedArray[sources[i]] == 'undefined')) {
+	       django.admin.AutoPopulate.sourceIndexedArray[sources[i]] = [destField];
+	    } else {
+	       django.admin.AutoPopulate.sourceIndexedArray[sources[i]].push(destField);
+	    }
+	    var handler = django.admin.AutoPopulate.createHandler(document.getElementById(sources[i]));
+	    dojo.event.connect(sourceField, "onkeyup", handler);
+	 }
+      }
+   }    
+}
\ No newline at end of file
Index: media/js/django/datetime/__package__.js
===================================================================
--- media/js/django/datetime/__package__.js	(revision 0)
+++ media/js/django/datetime/__package__.js	(revision 0)
@@ -0,0 +1,7 @@
+dojo.hostenv.conditionalLoadModule({
+    common: [
+        "django.datetime",
+        "django.datetime.calendar"
+    ]
+});
+dojo.hostenv.moduleLoaded("django.calendar.*");
Index: media/js/django/datetime/calendar.js
===================================================================
--- media/js/django/datetime/calendar.js	(revision 0)
+++ media/js/django/datetime/calendar.js	(revision 0)
@@ -0,0 +1,121 @@
+dojo.provide('django.datetime.calendar');
+dojo.require('django.datetime');
+dojo.require('django.util');
+
+django.datetime.calendar = {
+   /*
+     calendar.js - Calendar functions by Adrian Holovaty
+    */
+   
+   // CalendarNamespace -- Provides a collection of HTML calendar-related helper functions
+   CalendarNamespace: {
+      isLeapYear: function(year) {
+         return (((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0));
+      },
+      
+      getDaysInMonth: function(month, year) {
+         var days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+         if (month == 1 && django.datetime.calendar.CalendarNamespace.isLeapYear(year)) { return 29; }
+         else { return days[month]; }
+      },
+      
+      draw: function(month, year, div_id, callback) { // month = 1-12, year = 1-9999
+         month = parseInt(month);
+         year = parseInt(year);
+         var calDiv = document.getElementById(div_id);
+         django.util.removeChildren(calDiv);
+         var calTable = document.createElement('table');
+         django.util.quickElement('caption', calTable, django.datetime.monthNames[month-1] + ' ' + year);
+         var tableBody = django.util.quickElement('tbody', calTable);
+         
+         // Draw days-of-week header
+         var tableRow = django.util.quickElement('tr', tableBody);
+         for (var i = 0; i < 7; i++) {
+            django.util.quickElement('th', tableRow, django.datetime.weekdayInitials[i]);
+         }
+         
+         var startingPos = new Date(year, month, 1).getDay();
+         var days = django.datetime.calendar.CalendarNamespace.getDaysInMonth(month - 1, year);
+         
+         // Draw blanks before first of month
+         tableRow = django.util.quickElement('tr', tableBody);
+         for (var i = 0; i < startingPos; i++) {
+            var _cell = django.util.quickElement('td', tableRow, ' ');
+            _cell.style.backgroundColor = '#f3f3f3';
+         }
+         
+         // Draw days of month
+         var currentDay = 1;
+         for (var i = startingPos; currentDay <= days; i++) {
+            if (i%7 == 0 && currentDay != 1) {
+               tableRow = django.util.quickElement('tr', tableBody);
+            }
+            var cell = django.util.quickElement('td', tableRow, '');
+            django.util.quickElement('a', cell, currentDay, 'href', 'javascript:void(' + callback + '('+year+','+month+','+currentDay+'));');
+            currentDay++;
+         }
+         
+         // Draw blanks after end of month (optional, but makes for valid code)
+         while (tableRow.childNodes.length < 7) {
+            var _cell = django.util.quickElement('td', tableRow, ' ');
+            _cell.style.backgroundColor = '#f3f3f3';
+         }
+         
+         calDiv.appendChild(calTable);
+      }
+   },
+   
+   // Calendar -- A calendar instance
+   Calendar: function(div_id, callback) {
+      // div_id (string) is the ID of the element in which the calendar will
+      //     be displayed
+      // callback (string) is the name of a JavaScript function that will be
+      //     called with the parameters (year, month, day) when a day in the
+      //     calendar is clicked
+      this.div_id = div_id;
+      this.callback = callback;
+      this.today = new Date();
+      this.currentMonth = this.today.getMonth() + 1;
+      this.currentYear = this.today.getFullYear();
+   }
+   
+};
+
+django.datetime.calendar.Calendar.prototype = {
+   drawCurrent: function() {
+      django.datetime.calendar.CalendarNamespace.draw(this.currentMonth, this.currentYear, this.div_id, this.callback);
+   },
+   drawDate: function(month, year) {
+      this.currentMonth = month;
+      this.currentYear = year;
+      this.drawCurrent();
+   },
+   drawPreviousMonth: function() {
+      if (this.currentMonth == 1) {
+         this.currentMonth = 12;
+         this.currentYear--;
+      }
+      else {
+         this.currentMonth--;
+      }
+      this.drawCurrent();
+   },
+   drawNextMonth: function() {
+      if (this.currentMonth == 12) {
+         this.currentMonth = 1;
+         this.currentYear++;
+      }
+      else {
+         this.currentMonth++;
+      }
+      this.drawCurrent();
+   },
+   drawPreviousYear: function() {
+      this.currentYear--;
+      this.drawCurrent();
+   },
+   drawNextYear: function() {
+      this.currentYear++;
+      this.drawCurrent();
+   }
+}	
Index: media/js/SelectBox.js
===================================================================
--- media/js/SelectBox.js	(revision 2653)
+++ media/js/SelectBox.js	(working copy)
@@ -1,109 +0,0 @@
-var SelectBox = {
-    cache: new Object(),
-    init: function(id) {
-        var box = document.getElementById(id);
-        var node;
-        SelectBox.cache[id] = new Array();
-        var cache = SelectBox.cache[id];
-        for (var i = 0; (node = box.options[i]); i++) {
-            cache.push({ value: node.value, text: node.text, displayed: 1 });
-        }
-    },
-    redisplay: function(id) {
-        // Repopulate HTML select box from cache
-        var box = document.getElementById(id);
-        box.options.length = 0; // clear all options
-        for (var i = 0, j = SelectBox.cache[id].length; i < j; i++) {
-            var node = SelectBox.cache[id][i];
-            if (node.displayed) {
-                box.options[box.options.length] = new Option(node.text, node.value, false, false);
-            }
-        }
-    },
-    filter: function(id, text) {
-        // Redisplay the HTML select box, displaying only the choices containing ALL
-        // the words in text. (It's an AND search.)
-        var tokens = text.toLowerCase().split(/\s+/);
-        var node, token;
-        for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
-            node.displayed = 1;
-            for (var j = 0; (token = tokens[j]); j++) {
-                if (node.text.toLowerCase().indexOf(token) == -1) {
-                    node.displayed = 0;
-                }
-            }
-        }
-        SelectBox.redisplay(id);
-    },
-    delete_from_cache: function(id, value) {
-        var node, delete_index = null;
-        for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
-            if (node.value == value) {
-                delete_index = i;
-                break;
-            }
-        }
-        var j = SelectBox.cache[id].length - 1;
-        for (var i = delete_index; i < j; i++) {
-            SelectBox.cache[id][i] = SelectBox.cache[id][i+1];
-        }
-        SelectBox.cache[id].length--;
-    },
-    add_to_cache: function(id, option) {
-        SelectBox.cache[id].push({ value: option.value, text: option.text, displayed: 1 });
-    },
-    cache_contains: function(id, value) {
-        // Check if an item is contained in the cache
-        var node;
-        for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
-            if (node.value == value) {
-                return true;
-            }
-        }
-        return false;
-    },
-    move: function(from, to) {
-        var from_box = document.getElementById(from);
-        var to_box = document.getElementById(to);
-        var option;
-        for (var i = 0; (option = from_box.options[i]); i++) {
-            if (option.selected && SelectBox.cache_contains(from, option.value)) {
-                SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 });
-                SelectBox.delete_from_cache(from, option.value);
-            }
-        }
-        SelectBox.redisplay(from);
-        SelectBox.redisplay(to);
-    },
-    move_all: function(from, to) {
-        var from_box = document.getElementById(from);
-        var to_box = document.getElementById(to);
-        var option;
-        for (var i = 0; (option = from_box.options[i]); i++) {
-            SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 });
-            SelectBox.delete_from_cache(from, option.value);
-        }
-        SelectBox.redisplay(from);
-        SelectBox.redisplay(to);
-    },
-    sort: function(id) {
-        SelectBox.cache[id].sort( function(a, b) {
-            a = a.text.toLowerCase();
-            b = b.text.toLowerCase();
-            try {
-                if (a > b) return 1;
-                if (a < b) return -1;
-            }
-            catch (e) {
-                // silently fail on IE 'unknown' exception
-            }
-            return 0;
-        } );
-    },
-    select_all: function(id) {
-        var box = document.getElementById(id);
-        for (var i = 0; i < box.options.length; i++) {
-            box.options[i].selected = 'selected';
-        }
-    }
-}
Index: media/js/core.js
===================================================================
--- media/js/core.js	(revision 2653)
+++ media/js/core.js	(working copy)
@@ -1,138 +0,0 @@
-// Core javascript helper functions
-
-// Cross-browser event handlers.
-function addEvent(obj, evType, fn) {
-    if (obj.addEventListener) {
-        obj.addEventListener(evType, fn, false);
-        return true;
-    } else if (obj.attachEvent) {
-        var r = obj.attachEvent("on" + evType, fn);
-        return r;
-    } else {
-        return false;
-    }
-}
-
-function removeEvent(obj, evType, fn) {
-    if (obj.removeEventListener) {
-        obj.removeEventListener(evType, fn, false);
-        return true;
-    } else if (obj.detachEvent) {
-        obj.detachEvent("on" + evType, fn);
-    } else {
-        return false;
-    }
-}
-
-// quickElement(tagType, parentReference, textInChildNode, [, attribute, attributeValue ...]);
-function quickElement() {
-    var obj = document.createElement(arguments[0]);
-    if (arguments[2] != '' && arguments[2] != null) {
-        var textNode = document.createTextNode(arguments[2]);
-        obj.appendChild(textNode);
-    }
-    var len = arguments.length;
-    for (var i = 3; i < len; i += 2) {
-        obj.setAttribute(arguments[i], arguments[i+1]);
-    }
-    arguments[1].appendChild(obj);
-    return obj;
-}
-
-// ----------------------------------------------------------------------------
-// Cross-browser xmlhttp object
-// from http://jibbering.com/2002/4/httprequest.html
-// ----------------------------------------------------------------------------
-var xmlhttp;
-/*@cc_on @*/
-/*@if (@_jscript_version >= 5)
-    try {
-        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
-    } catch (e) {
-        try {
-            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
-        } catch (E) {
-            xmlhttp = false;
-        }
-    }
-@else
-    xmlhttp = false;
-@end @*/
-if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
-  xmlhttp = new XMLHttpRequest();
-}
-
-// ----------------------------------------------------------------------------
-// Find-position functions by PPK
-// See http://www.quirksmode.org/js/findpos.html
-// ----------------------------------------------------------------------------
-function findPosX(obj) {
-    var curleft = 0;
-    if (obj.offsetParent) {
-        while (obj.offsetParent) {
-            curleft += obj.offsetLeft;
-            obj = obj.offsetParent;
-        }
-    } else if (obj.x) {
-        curleft += obj.x;
-    }
-    return curleft;
-}
-
-function findPosY(obj) {
-    var curtop = 0;
-    if (obj.offsetParent) {
-        while (obj.offsetParent) {
-            curtop += obj.offsetTop;
-            obj = obj.offsetParent;
-        }
-    } else if (obj.y) {
-        curtop += obj.y;
-    }
-    return curtop;
-}
-
-//-----------------------------------------------------------------------------
-// Date object extensions
-// ----------------------------------------------------------------------------
-Date.prototype.getCorrectYear = function() {
-    // Date.getYear() is unreliable --
-    // see http://www.quirksmode.org/js/introdate.html#year
-    var y = this.getYear() % 100;
-    return (y < 38) ? y + 2000 : y + 1900;
-}
-
-Date.prototype.getTwoDigitMonth = function() {
-    return (this.getMonth() < 9) ? '0' + (this.getMonth()+1) : (this.getMonth()+1);
-}
-
-Date.prototype.getTwoDigitDate = function() {
-    return (this.getDate() < 10) ? '0' + this.getDate() : this.getDate();
-}
-
-Date.prototype.getTwoDigitHour = function() {
-    return (this.getHours() < 10) ? '0' + this.getHours() : this.getHours();
-}
-
-Date.prototype.getTwoDigitMinute = function() {
-    return (this.getMinutes() < 10) ? '0' + this.getMinutes() : this.getMinutes();
-}
-
-Date.prototype.getISODate = function() {
-    return this.getCorrectYear() + '-' + this.getTwoDigitMonth() + '-' + this.getTwoDigitDate();
-}
-
-Date.prototype.getHourMinute = function() {
-    return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute();
-}
-
-// ----------------------------------------------------------------------------
-// String object extensions
-// ----------------------------------------------------------------------------
-String.prototype.pad_left = function(pad_length, pad_string) {
-    var new_string = this;
-    for (var i = 0; new_string.length < pad_length; i++) {
-        new_string = pad_string + new_string;
-    }
-    return new_string;
-}
\ No newline at end of file
Index: media/js/dateparse.js
===================================================================
--- media/js/dateparse.js	(revision 2653)
+++ media/js/dateparse.js	(working copy)
@@ -1,233 +0,0 @@
-/* 'Magic' date parsing, by Simon Willison (6th October 2003)
-   http://simon.incutio.com/archive/2003/10/06/betterDateInput
-   Adapted for 6newslawrence.com, 28th January 2004
-*/
-
-/* Finds the index of the first occurence of item in the array, or -1 if not found */
-if (typeof Array.prototype.indexOf == 'undefined') {
-    Array.prototype.indexOf = function(item) {
-        var len = this.length;
-        for (var i = 0; i < len; i++) {
-            if (this[i] == item) {
-                return i;
-            }
-        }
-        return -1;
-    };
-}
-/* Returns an array of items judged 'true' by the passed in test function */
-if (typeof Array.prototype.filter == 'undefined') {
-    Array.prototype.filter = function(test) {
-        var matches = [];
-        var len = this.length;
-        for (var i = 0; i < len; i++) {
-            if (test(this[i])) {
-                matches[matches.length] = this[i];
-            }
-        }
-        return matches;
-    };
-}
-
-var monthNames = gettext("January February March April May June July August September October November December").split(" ");
-var weekdayNames = gettext("Sunday Monday Tuesday Wednesday Thursday Friday Saturday").split(" ");
-
-/* Takes a string, returns the index of the month matching that string, throws
-   an error if 0 or more than 1 matches
-*/
-function parseMonth(month) {
-    var matches = monthNames.filter(function(item) { 
-        return new RegExp("^" + month, "i").test(item);
-    });
-    if (matches.length == 0) {
-        throw new Error("Invalid month string");
-    }
-    if (matches.length > 1) {
-        throw new Error("Ambiguous month");
-    }
-    return monthNames.indexOf(matches[0]);
-}
-/* Same as parseMonth but for days of the week */
-function parseWeekday(weekday) {
-    var matches = weekdayNames.filter(function(item) {
-        return new RegExp("^" + weekday, "i").test(item);
-    });
-    if (matches.length == 0) {
-        throw new Error("Invalid day string");
-    }
-    if (matches.length > 1) {
-        throw new Error("Ambiguous weekday");
-    }
-    return weekdayNames.indexOf(matches[0]);
-}
-
-/* Array of objects, each has 're', a regular expression and 'handler', a 
-   function for creating a date from something that matches the regular 
-   expression. Handlers may throw errors if string is unparseable. 
-*/
-var dateParsePatterns = [
-    // Today
-    {   re: /^tod/i,
-        handler: function() { 
-            return new Date();
-        } 
-    },
-    // Tomorrow
-    {   re: /^tom/i,
-        handler: function() {
-            var d = new Date(); 
-            d.setDate(d.getDate() + 1); 
-            return d;
-        }
-    },
-    // Yesterday
-    {   re: /^yes/i,
-        handler: function() {
-            var d = new Date();
-            d.setDate(d.getDate() - 1);
-            return d;
-        }
-    },
-    // 4th
-    {   re: /^(\d{1,2})(st|nd|rd|th)?$/i, 
-        handler: function(bits) {
-            var d = new Date();
-            d.setDate(parseInt(bits[1], 10));
-            return d;
-        }
-    },
-    // 4th Jan
-    {   re: /^(\d{1,2})(?:st|nd|rd|th)? (\w+)$/i, 
-        handler: function(bits) {
-            var d = new Date();
-            d.setDate(parseInt(bits[1], 10));
-            d.setMonth(parseMonth(bits[2]));
-            return d;
-        }
-    },
-    // 4th Jan 2003
-    {   re: /^(\d{1,2})(?:st|nd|rd|th)? (\w+),? (\d{4})$/i,
-        handler: function(bits) {
-            var d = new Date();
-            d.setDate(parseInt(bits[1], 10));
-            d.setMonth(parseMonth(bits[2]));
-            d.setYear(bits[3]);
-            return d;
-        }
-    },
-    // Jan 4th
-    {   re: /^(\w+) (\d{1,2})(?:st|nd|rd|th)?$/i, 
-        handler: function(bits) {
-            var d = new Date();
-            d.setDate(parseInt(bits[2], 10));
-            d.setMonth(parseMonth(bits[1]));
-            return d;
-        }
-    },
-    // Jan 4th 2003
-    {   re: /^(\w+) (\d{1,2})(?:st|nd|rd|th)?,? (\d{4})$/i,
-        handler: function(bits) {
-            var d = new Date();
-            d.setDate(parseInt(bits[2], 10));
-            d.setMonth(parseMonth(bits[1]));
-            d.setYear(bits[3]);
-            return d;
-        }
-    },
-    // next Tuesday - this is suspect due to weird meaning of "next"
-    {   re: /^next (\w+)$/i,
-        handler: function(bits) {
-            var d = new Date();
-            var day = d.getDay();
-            var newDay = parseWeekday(bits[1]);
-            var addDays = newDay - day;
-            if (newDay <= day) {
-                addDays += 7;
-            }
-            d.setDate(d.getDate() + addDays);
-            return d;
-        }
-    },
-    // last Tuesday
-    {   re: /^last (\w+)$/i,
-        handler: function(bits) {
-            throw new Error("Not yet implemented");
-        }
-    },
-    // mm/dd/yyyy (American style)
-    {   re: /(\d{1,2})\/(\d{1,2})\/(\d{4})/,
-        handler: function(bits) {
-            var d = new Date();
-            d.setYear(bits[3]);
-            d.setDate(parseInt(bits[2], 10));
-            d.setMonth(parseInt(bits[1], 10) - 1); // Because months indexed from 0
-            return d;
-        }
-    },
-    // yyyy-mm-dd (ISO style)
-    {   re: /(\d{4})-(\d{1,2})-(\d{1,2})/,
-        handler: function(bits) {
-            var d = new Date();
-            d.setYear(parseInt(bits[1]));
-            d.setDate(parseInt(bits[3], 10));
-            d.setMonth(parseInt(bits[2], 10) - 1);
-            return d;
-        }
-    },
-];
-
-function parseDateString(s) {
-    for (var i = 0; i < dateParsePatterns.length; i++) {
-        var re = dateParsePatterns[i].re;
-        var handler = dateParsePatterns[i].handler;
-        var bits = re.exec(s);
-        if (bits) {
-            return handler(bits);
-        }
-    }
-    throw new Error("Invalid date string");
-}
-
-function fmt00(x) {
-    // fmt00: Tags leading zero onto numbers 0 - 9.
-    // Particularly useful for displaying results from Date methods.
-    //
-    if (Math.abs(parseInt(x)) < 10){
-        x = "0"+ Math.abs(x);
-    }
-    return x;
-}
-
-function parseDateStringISO(s) {
-    try {
-        var d = parseDateString(s);
-        return d.getFullYear() + '-' + (fmt00(d.getMonth() + 1)) + '-' + fmt00(d.getDate())
-    }
-    catch (e) { return s; }
-}
-function magicDate(input) {
-    var messagespan = input.id + 'Msg';
-    try {
-        var d = parseDateString(input.value);
-        input.value = d.getFullYear() + '-' + (fmt00(d.getMonth() + 1)) + '-' + 
-            fmt00(d.getDate());
-        input.className = '';
-        // Human readable date
-        if (document.getElementById(messagespan)) {
-            document.getElementById(messagespan).firstChild.nodeValue = d.toDateString();
-            document.getElementById(messagespan).className = 'normal';
-        }
-    }
-    catch (e) {
-        input.className = 'error';
-        var message = e.message;
-        // Fix for IE6 bug
-        if (message.indexOf('is null or not an object') > -1) {
-            message = 'Invalid date string';
-        }
-        if (document.getElementById(messagespan)) {
-            document.getElementById(messagespan).firstChild.nodeValue = message;
-            document.getElementById(messagespan).className = 'error';
-        }
-    }
-}
Index: media/js/getElementsBySelector.js
===================================================================
--- media/js/getElementsBySelector.js	(revision 2653)
+++ media/js/getElementsBySelector.js	(working copy)
@@ -1,167 +0,0 @@
-/* document.getElementsBySelector(selector)
-   - returns an array of element objects from the current document
-     matching the CSS selector. Selectors can contain element names, 
-     class names and ids and can be nested. For example:
-     
-       elements = document.getElementsBySelect('div#main p a.external')
-     
-     Will return an array of all 'a' elements with 'external' in their 
-     class attribute that are contained inside 'p' elements that are 
-     contained inside the 'div' element which has id="main"
-
-   New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
-   See http://www.w3.org/TR/css3-selectors/#attribute-selectors
-
-   Version 0.4 - Simon Willison, March 25th 2003
-   -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
-   -- Opera 7 fails 
-*/
-
-function getAllChildren(e) {
-  // Returns all children of element. Workaround required for IE5/Windows. Ugh.
-  return e.all ? e.all : e.getElementsByTagName('*');
-}
-
-document.getElementsBySelector = function(selector) {
-  // Attempt to fail gracefully in lesser browsers
-  if (!document.getElementsByTagName) {
-    return new Array();
-  }
-  // Split selector in to tokens
-  var tokens = selector.split(' ');
-  var currentContext = new Array(document);
-  for (var i = 0; i < tokens.length; i++) {
-    token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;
-    if (token.indexOf('#') > -1) {
-      // Token is an ID selector
-      var bits = token.split('#');
-      var tagName = bits[0];
-      var id = bits[1];
-      var element = document.getElementById(id);
-      if (tagName && element.nodeName.toLowerCase() != tagName) {
-        // tag with that ID not found, return false
-        return new Array();
-      }
-      // Set currentContext to contain just this element
-      currentContext = new Array(element);
-      continue; // Skip to next token
-    }
-    if (token.indexOf('.') > -1) {
-      // Token contains a class selector
-      var bits = token.split('.');
-      var tagName = bits[0];
-      var className = bits[1];
-      if (!tagName) {
-        tagName = '*';
-      }
-      // Get elements matching tag, filter them for class selector
-      var found = new Array;
-      var foundCount = 0;
-      for (var h = 0; h < currentContext.length; h++) {
-        var elements;
-        if (tagName == '*') {
-            elements = getAllChildren(currentContext[h]);
-        } else {
-            try {
-                elements = currentContext[h].getElementsByTagName(tagName);
-            }
-            catch(e) {
-                elements = [];
-            }
-        }
-        for (var j = 0; j < elements.length; j++) {
-          found[foundCount++] = elements[j];
-        }
-      }
-      currentContext = new Array;
-      var currentContextIndex = 0;
-      for (var k = 0; k < found.length; k++) {
-        if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
-          currentContext[currentContextIndex++] = found[k];
-        }
-      }
-      continue; // Skip to next token
-    }
-    // Code to deal with attribute selectors
-    if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
-      var tagName = RegExp.$1;
-      var attrName = RegExp.$2;
-      var attrOperator = RegExp.$3;
-      var attrValue = RegExp.$4;
-      if (!tagName) {
-        tagName = '*';
-      }
-      // Grab all of the tagName elements within current context
-      var found = new Array;
-      var foundCount = 0;
-      for (var h = 0; h < currentContext.length; h++) {
-        var elements;
-        if (tagName == '*') {
-            elements = getAllChildren(currentContext[h]);
-        } else {
-            elements = currentContext[h].getElementsByTagName(tagName);
-        }
-        for (var j = 0; j < elements.length; j++) {
-          found[foundCount++] = elements[j];
-        }
-      }
-      currentContext = new Array;
-      var currentContextIndex = 0;
-      var checkFunction; // This function will be used to filter the elements
-      switch (attrOperator) {
-        case '=': // Equality
-          checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
-          break;
-        case '~': // Match one of space seperated words 
-          checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
-          break;
-        case '|': // Match start with value followed by optional hyphen
-          checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
-          break;
-        case '^': // Match starts with value
-          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
-          break;
-        case '$': // Match ends with value - fails with "Warning" in Opera 7
-          checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
-          break;
-        case '*': // Match ends with value
-          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
-          break;
-        default :
-          // Just test for existence of attribute
-          checkFunction = function(e) { return e.getAttribute(attrName); };
-      }
-      currentContext = new Array;
-      var currentContextIndex = 0;
-      for (var k = 0; k < found.length; k++) {
-        if (checkFunction(found[k])) {
-          currentContext[currentContextIndex++] = found[k];
-        }
-      }
-      // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
-      continue; // Skip to next token
-    }
-    // If we get here, token is JUST an element (not a class or ID selector)
-    tagName = token;
-    var found = new Array;
-    var foundCount = 0;
-    for (var h = 0; h < currentContext.length; h++) {
-      var elements = currentContext[h].getElementsByTagName(tagName);
-      for (var j = 0; j < elements.length; j++) {
-        found[foundCount++] = elements[j];
-      }
-    }
-    currentContext = found;
-  }
-  return currentContext;
-}
-
-/* That revolting regular expression explained 
-/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
-  \---/  \---/\-------------/    \-------/
-    |      |         |               |
-    |      |         |           The value
-    |      |    ~,|,^,$,* or =
-    |   Attribute 
-   Tag
-*/
Index: media/js/calendar.js
===================================================================
--- media/js/calendar.js	(revision 2653)
+++ media/js/calendar.js	(working copy)
@@ -1,143 +0,0 @@
-/*
-calendar.js - Calendar functions by Adrian Holovaty
-*/
-
-function removeChildren(a) { // "a" is reference to an object
-    while (a.hasChildNodes()) a.removeChild(a.lastChild);
-}
-
-// quickElement(tagType, parentReference, textInChildNode, [, attribute, attributeValue ...]);
-function quickElement() {
-    var obj = document.createElement(arguments[0]);
-    if (arguments[2] != '' && arguments[2] != null) {
-        var textNode = document.createTextNode(arguments[2]);
-        obj.appendChild(textNode);
-    }
-    var len = arguments.length;
-    for (var i = 3; i < len; i += 2) {
-        obj.setAttribute(arguments[i], arguments[i+1]);
-    }
-    arguments[1].appendChild(obj);
-    return obj;
-}
-
-// CalendarNamespace -- Provides a collection of HTML calendar-related helper functions
-var CalendarNamespace = {
-    monthsOfYear: gettext('January February March April May June July August September October November December').split(' '),
-    daysOfWeek: gettext('S M T W T F S').split(' '),
-    isLeapYear: function(year) {
-        return (((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0));
-    },
-    getDaysInMonth: function(month,year) {
-        var days;
-        if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12) {
-            days = 31;
-        }
-        else if (month==4 || month==6 || month==9 || month==11) {
-            days = 30;
-        }
-        else if (month==2 && CalendarNamespace.isLeapYear(year)) {
-            days = 29;
-        }
-        else {
-            days = 28;
-        }
-        return days;
-    },
-    draw: function(month, year, div_id, callback) { // month = 1-12, year = 1-9999
-        month = parseInt(month);
-        year = parseInt(year);
-        var calDiv = document.getElementById(div_id);
-        removeChildren(calDiv);
-        var calTable = document.createElement('table');
-        quickElement('caption', calTable, CalendarNamespace.monthsOfYear[month-1] + ' ' + year);
-        var tableBody = quickElement('tbody', calTable);
-
-        // Draw days-of-week header
-        var tableRow = quickElement('tr', tableBody);
-        for (var i = 0; i < 7; i++) {
-            quickElement('th', tableRow, CalendarNamespace.daysOfWeek[i]);
-        }
-
-        var startingPos = new Date(year, month-1, 1).getDay();
-        var days = CalendarNamespace.getDaysInMonth(month, year);
-
-        // Draw blanks before first of month
-        tableRow = quickElement('tr', tableBody);
-        for (var i = 0; i < startingPos; i++) {
-            var _cell = quickElement('td', tableRow, ' ');
-            _cell.style.backgroundColor = '#f3f3f3';
-        }
-
-        // Draw days of month
-        var currentDay = 1;
-        for (var i = startingPos; currentDay <= days; i++) {
-            if (i%7 == 0 && currentDay != 1) {
-                tableRow = quickElement('tr', tableBody);
-            }
-            var cell = quickElement('td', tableRow, '');
-            quickElement('a', cell, currentDay, 'href', 'javascript:void(' + callback + '('+year+','+month+','+currentDay+'));');
-            currentDay++;
-        }
-
-        // Draw blanks after end of month (optional, but makes for valid code)
-        while (tableRow.childNodes.length < 7) {
-            var _cell = quickElement('td', tableRow, ' ');
-            _cell.style.backgroundColor = '#f3f3f3';
-        }
-
-        calDiv.appendChild(calTable);
-    }
-}
-
-// Calendar -- A calendar instance
-function Calendar(div_id, callback) {
-    // div_id (string) is the ID of the element in which the calendar will
-    //     be displayed
-    // callback (string) is the name of a JavaScript function that will be
-    //     called with the parameters (year, month, day) when a day in the
-    //     calendar is clicked
-    this.div_id = div_id;
-    this.callback = callback;
-    this.today = new Date();
-    this.currentMonth = this.today.getMonth() + 1;
-    this.currentYear = this.today.getFullYear();
-}
-Calendar.prototype = {
-    drawCurrent: function() {
-        CalendarNamespace.draw(this.currentMonth, this.currentYear, this.div_id, this.callback);
-    },
-    drawDate: function(month, year) {
-        this.currentMonth = month;
-        this.currentYear = year;
-        this.drawCurrent();
-    },
-    drawPreviousMonth: function() {
-        if (this.currentMonth == 1) {
-            this.currentMonth = 12;
-            this.currentYear--;
-        }
-        else {
-            this.currentMonth--;
-        }
-        this.drawCurrent();
-    },
-    drawNextMonth: function() {
-        if (this.currentMonth == 12) {
-            this.currentMonth = 1;
-            this.currentYear++;
-        }
-        else {
-            this.currentMonth++;
-        }
-        this.drawCurrent();
-    },
-    drawPreviousYear: function() {
-        this.currentYear--;
-        this.drawCurrent();
-    },
-    drawNextYear: function() {
-        this.currentYear++;
-        this.drawCurrent();
-    }
-}
Index: media/js/timeparse.js
===================================================================
--- media/js/timeparse.js	(revision 2653)
+++ media/js/timeparse.js	(working copy)
@@ -1,94 +0,0 @@
-var timeParsePatterns = [
-    // 9
-    {   re: /^\d{1,2}$/i,
-        handler: function(bits) {
-            if (bits[0].length == 1) {
-                return '0' + bits[0] + ':00';
-            } else {
-                return bits[0] + ':00';
-            }
-        }
-    },
-    // 13:00
-    {   re: /^\d{2}[:.]\d{2}$/i,
-        handler: function(bits) {
-            return bits[0].replace('.', ':');
-        }
-    },
-    // 9:00
-    {   re: /^\d[:.]\d{2}$/i,
-        handler: function(bits) {
-            return '0' + bits[0].replace('.', ':');
-        }
-    },
-    // 3 am / 3 a.m. / 3am
-    {   re: /^(\d+)\s*([ap])(?:.?m.?)?$/i,
-        handler: function(bits) {
-            var hour = parseInt(bits[1]);
-            if (hour == 12) {
-                hour = 0;
-            }
-            if (bits[2].toLowerCase() == 'p') {
-                if (hour == 12) {
-                    hour = 0;
-                }
-                return (hour + 12) + ':00';
-            } else {
-                if (hour < 10) {
-                    return '0' + hour + ':00';
-                } else {
-                    return hour + ':00';
-                }
-            }
-        }
-    },
-    // 3.30 am / 3:15 a.m. / 3.00am
-    {   re: /^(\d+)[.:](\d{2})\s*([ap]).?m.?$/i,
-        handler: function(bits) {
-            var hour = parseInt(bits[1]);
-            var mins = parseInt(bits[2]);
-            if (mins < 10) {
-                mins = '0' + mins;
-            }
-            if (hour == 12) {
-                hour = 0;
-            }
-            if (bits[3].toLowerCase() == 'p') {
-                if (hour == 12) {
-                    hour = 0;
-                }
-                return (hour + 12) + ':' + mins;
-            } else {
-                if (hour < 10) {
-                    return '0' + hour + ':' + mins;
-                } else {
-                    return hour + ':' + mins;
-                }
-            }
-        }
-    },
-    // noon
-    {   re: /^no/i,
-        handler: function(bits) {
-            return '12:00';
-        }
-    },
-    // midnight
-    {   re: /^mid/i,
-        handler: function(bits) {
-            return '00:00';
-        }
-    }
-];
-
-function parseTimeString(s) {
-    for (var i = 0; i < timeParsePatterns.length; i++) {
-        var re = timeParsePatterns[i].re;
-        var handler = timeParsePatterns[i].handler;
-        var bits = re.exec(s);
-        if (bits) {
-            return handler(bits);
-        }
-    }
-    return s;
-}
Index: media/js/urlify.js
===================================================================
--- media/js/urlify.js	(revision 2653)
+++ media/js/urlify.js	(working copy)
@@ -1,15 +0,0 @@
-function URLify(s, num_chars) {
-    // changes, e.g., "Petty theft" to "petty_theft"
-    // remove all these words from the string before urlifying
-    removelist = ["a", "an", "as", "at", "before", "but", "by", "for", "from",
-                  "is", "in", "into", "like", "of", "off", "on", "onto", "per",
-                  "since", "than", "the", "this", "that", "to", "up", "via",
-                  "with"];
-    r = new RegExp('\\b(' + removelist.join('|') + ')\\b', 'gi');
-    s = s.replace(r, '');
-    s = s.replace(/[^-A-Z0-9\s]/gi, '');  // remove unneeded chars
-    s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces
-    s = s.replace(/\s+/g, '-');      // convert spaces to hyphens
-    s = s.toLowerCase();             // convert to lowercase
-    return s.substring(0, num_chars);// trim to first num_chars chars
-}
\ No newline at end of file
Index: media/js/admin/RelatedObjectLookups.js
===================================================================
--- media/js/admin/RelatedObjectLookups.js	(revision 2653)
+++ media/js/admin/RelatedObjectLookups.js	(working copy)
@@ -1,54 +0,0 @@
-// Handles related-objects functionality: lookup link for raw_id_admin=True
-// and Add Another links.
-
-function showRelatedObjectLookupPopup(triggeringLink) {
-    var name = triggeringLink.id.replace(/^lookup_/, '');
-    var href;
-    if (triggeringLink.href.search(/\?/) >= 0) {
-        href = triggeringLink.href + '&pop=1';
-    } else {
-        href = triggeringLink.href + '?pop=1';
-    }
-    var win = window.open(href, name, 'height=500,width=740,resizable=yes,scrollbars=yes');
-    win.focus();
-    return false;
-}
-
-function dismissRelatedLookupPopup(win, chosenId) {
-    var elem = document.getElementById(win.name);
-    if (elem.className.indexOf('vRawIdAdminField') != -1 && elem.value) {
-        elem.value += ',' + chosenId;
-    } else {
-        document.getElementById(win.name).value = chosenId;
-    }
-    win.close();
-}
-
-function showAddAnotherPopup(triggeringLink) {
-    var name = triggeringLink.id.replace(/^add_/, '');
-    name = name.replace(/\./g, '___');
-    var win = window.open(triggeringLink.href + '?_popup=1', name, 'height=500,width=800,resizable=yes,scrollbars=yes');
-    win.focus();
-    return false;
-}
-
-function dismissAddAnotherPopup(win, newId, newRepr) {
-    var name = win.name.replace(/___/g, '.');
-    var elem = document.getElementById(name);
-    if (elem) {
-        if (elem.nodeName == 'SELECT') {
-            var o = new Option(newRepr, newId);
-            elem.options[elem.options.length] = o;
-            elem.selectedIndex = elem.length - 1;
-        } else if (elem.nodeName == 'INPUT') {
-            elem.value = newId;
-        }
-    } else {
-        var toId = name + "_to";
-        elem = document.getElementById(toId);
-        var o = new Option(newRepr, newId);
-        SelectBox.add_to_cache(toId, o);
-        SelectBox.redisplay(toId);
-    }
-    win.close();
-}
Index: media/js/admin/CollapsedFieldsets.js
===================================================================
--- media/js/admin/CollapsedFieldsets.js	(revision 2653)
+++ media/js/admin/CollapsedFieldsets.js	(working copy)
@@ -1,85 +0,0 @@
-// Finds all fieldsets with class="collapse", collapses them, and gives each
-// one a "Show" link that uncollapses it. The "Show" link becomes a "Hide"
-// link when the fieldset is visible.
-
-function findForm(node) {
-	// returns the node of the form containing the given node
-	if (node.tagName.toLowerCase() != 'form') {
-		return findForm(node.parentNode);
-	}
-	return node;
-}
-
-var CollapsedFieldsets = {
-	collapse_re: /\bcollapse\b/,   // Class of fieldsets that should be dealt with.
-	collapsed_re: /\bcollapsed\b/, // Class that fieldsets get when they're hidden.
-	collapsed_class: 'collapsed',
-	init: function() {
-		var fieldsets = document.getElementsByTagName('fieldset');
-		var collapsed_seen = false;
-		for (var i = 0, fs; fs = fieldsets[i]; i++) {
-			// Collapse this fieldset if it has the correct class, and if it
-			// doesn't have any errors. (Collapsing shouldn't apply in the case
-			// of error messages.)
-			if (fs.className.match(CollapsedFieldsets.collapse_re) && !CollapsedFieldsets.fieldset_has_errors(fs)) {
-				collapsed_seen = true;
-				// Give it an additional class, used by CSS to hide it.
-				fs.className += ' ' + CollapsedFieldsets.collapsed_class;
-				// (<a id="fieldsetcollapser3" class="collapse-toggle" href="#">Show</a>)
-				var collapse_link = document.createElement('a');
-				collapse_link.className = 'collapse-toggle';
-				collapse_link.id = 'fieldsetcollapser' + i;
-				collapse_link.onclick = new Function('CollapsedFieldsets.show('+i+'); return false;');
-				collapse_link.href = '#';
-				collapse_link.innerHTML = 'Show';
-				var h2 = fs.getElementsByTagName('h2')[0];
-				h2.appendChild(document.createTextNode(' ('));
-				h2.appendChild(collapse_link);
-				h2.appendChild(document.createTextNode(')'));
-			}
-		}
-		if (collapsed_seen) {
-			// Expand all collapsed fieldsets when form is submitted.
-			addEvent(findForm(document.getElementsByTagName('fieldset')[0]), 'submit', function() { CollapsedFieldsets.uncollapse_all(); });
-		}
-	},
-	fieldset_has_errors: function(fs) {
-		// Returns true if any fields in the fieldset have validation errors.
-		var divs = fs.getElementsByTagName('div');
-		for (var i=0; i<divs.length; i++) {
-			if (divs[i].className.match(/\berror\b/)) {
-				return true;
-			}
-		}
-		return false;
-	},
-	show: function(fieldset_index) {
-		var fs = document.getElementsByTagName('fieldset')[fieldset_index];
-		// Remove the class name that causes the "display: none".
-		fs.className = fs.className.replace(CollapsedFieldsets.collapsed_re, '');
-		// Toggle the "Show" link to a "Hide" link
-		var collapse_link = document.getElementById('fieldsetcollapser' + fieldset_index);
-		collapse_link.onclick = new Function('CollapsedFieldsets.hide('+fieldset_index+'); return false;');
-		collapse_link.innerHTML = 'Hide';
-	},
-	hide: function(fieldset_index) {
-		var fs = document.getElementsByTagName('fieldset')[fieldset_index];
-		// Add the class name that causes the "display: none".
-		fs.className += ' ' + CollapsedFieldsets.collapsed_class;
-		// Toggle the "Hide" link to a "Show" link
-		var collapse_link = document.getElementById('fieldsetcollapser' + fieldset_index);
-        collapse_link.onclick = new Function('CollapsedFieldsets.show('+fieldset_index+'); return false;');
-		collapse_link.innerHTML = 'Show';
-	},
-	
-	uncollapse_all: function() {
-		var fieldsets = document.getElementsByTagName('fieldset');
-		for (var i=0; i<fieldsets.length; i++) {
-			if (fieldsets[i].className.match(CollapsedFieldsets.collapsed_re)) {
-				CollapsedFieldsets.show(i);
-			}
-		}
-	}
-}
-
-addEvent(window, 'load', CollapsedFieldsets.init);
Index: media/js/admin/ordering.js
===================================================================
--- media/js/admin/ordering.js	(revision 2653)
+++ media/js/admin/ordering.js	(working copy)
@@ -1,137 +0,0 @@
-addEvent(window, 'load', reorder_init);
-
-var lis;
-var top = 0;
-var left = 0;
-var height = 30;
-
-function reorder_init() {
-    lis = document.getElementsBySelector('ul#orderthese li');
-    var input = document.getElementsBySelector('input[name=order_]')[0];
-    setOrder(input.value.split(','));
-    input.disabled = true;
-    draw();
-    // Now initialise the dragging behaviour
-    var limit = (lis.length - 1) * height;
-    for (var i = 0; i < lis.length; i++) {
-        var li = lis[i];
-        var img = document.getElementById('handle'+li.id);
-        li.style.zIndex = 1;
-        Drag.init(img, li, left + 10, left + 10, top + 10, top + 10 + limit);
-        li.onDragStart = startDrag;
-        li.onDragEnd = endDrag;
-        img.style.cursor = 'move';
-    }
-}
-
-function submitOrderForm() {
-    var inputOrder = document.getElementsBySelector('input[name=order_]')[0];
-    inputOrder.value = getOrder();
-    inputOrder.disabled=false;
-}
-
-function startDrag() {
-    this.style.zIndex = '10';
-    this.className = 'dragging';
-}
-
-function endDrag(x, y) {
-    this.style.zIndex = '1';
-    this.className = '';
-    // Work out how far along it has been dropped, using x co-ordinate
-    var oldIndex = this.index;
-    var newIndex = Math.round((y - 10 - top) / height);
-    // 'Snap' to the correct position
-    this.style.top = (10 + top + newIndex * height) + 'px';
-    this.index = newIndex;
-    moveItem(oldIndex, newIndex);
-}
-
-function moveItem(oldIndex, newIndex) {
-    // Swaps two items, adjusts the index and left co-ord for all others
-    if (oldIndex == newIndex) {
-        return; // Nothing to swap;
-    }
-    var direction, lo, hi;
-    if (newIndex > oldIndex) {
-        lo = oldIndex;
-        hi = newIndex;
-        direction = -1;
-    } else {
-        direction = 1;
-        hi = oldIndex;
-        lo = newIndex;
-    }
-    var lis2 = new Array(); // We will build the new order in this array
-    for (var i = 0; i < lis.length; i++) {
-        if (i < lo || i > hi) {
-            // Position of items not between the indexes is unaffected
-            lis2[i] = lis[i];
-            continue;
-        } else if (i == newIndex) {
-            lis2[i] = lis[oldIndex];
-            continue;
-        } else {
-            // Item is between the two indexes - move it along 1
-            lis2[i] = lis[i - direction];
-        }
-    }
-    // Re-index everything
-    reIndex(lis2);
-    lis = lis2;
-    draw();
-//    document.getElementById('hiddenOrder').value = getOrder();
-    document.getElementsBySelector('input[name=order_]')[0].value = getOrder();
-}
-
-function reIndex(lis) {
-    for (var i = 0; i < lis.length; i++) {
-        lis[i].index = i;
-    }
-}
-
-function draw() {
-    for (var i = 0; i < lis.length; i++) {
-        var li = lis[i];
-        li.index = i;
-        li.style.position = 'absolute';
-        li.style.left = (10 + left) + 'px';
-        li.style.top = (10 + top + (i * height)) + 'px';
-    }
-}
-
-function getOrder() {
-    var order = new Array(lis.length);
-    for (var i = 0; i < lis.length; i++) {
-        order[i] = lis[i].id.substring(1, 100);
-    }
-    return order.join(',');
-}
-
-function setOrder(id_list) {
-    /* Set the current order to match the lsit of IDs */
-    var temp_lis = new Array();
-    for (var i = 0; i < id_list.length; i++) {
-        var id = 'p' + id_list[i];
-        temp_lis[temp_lis.length] = document.getElementById(id);
-    }
-    reIndex(temp_lis);
-    lis = temp_lis;
-    draw();
-}
-
-function addEvent(elm, evType, fn, useCapture)
-// addEvent and removeEvent
-// cross-browser event handling for IE5+,  NS6 and Mozilla
-// By Scott Andrew
-{
-  if (elm.addEventListener){
-    elm.addEventListener(evType, fn, useCapture);
-    return true;
-  } else if (elm.attachEvent){
-    var r = elm.attachEvent("on"+evType, fn);
-    return r;
-  } else {
-    elm['on'+evType] = fn;
-  }
-}
Index: media/js/admin/DateTimeShortcuts.js
===================================================================
--- media/js/admin/DateTimeShortcuts.js	(revision 2653)
+++ media/js/admin/DateTimeShortcuts.js	(working copy)
@@ -1,207 +0,0 @@
-// Inserts shortcut buttons after all of the following:
-//     <input type="text" class="vDateField">
-//     <input type="text" class="vTimeField">
-
-var DateTimeShortcuts = {
-    calendars: [],
-    calendarInputs: [],
-    clockInputs: [],
-    calendarDivName1: 'calendarbox', // name of calendar <div> that gets toggled
-    calendarDivName2: 'calendarin',  // name of <div> that contains calendar
-    clockDivName: 'clockbox',        // name of clock <div> that gets toggled
-    admin_media_prefix: '',
-    init: function() {
-        // Deduce admin_media_prefix by looking at the <script>s in the
-        // current document and finding the URL of *this* module.
-        var scripts = document.getElementsByTagName('script');
-        for (var i=0; i<scripts.length; i++) {
-            if (scripts[i].src.match(/DateTimeShortcuts/)) {
-                var idx = scripts[i].src.indexOf('js/admin/DateTimeShortcuts');
-                DateTimeShortcuts.admin_media_prefix = scripts[i].src.substring(0, idx);
-                break;
-            }
-        }
-
-        var inputs = document.getElementsByTagName('input');
-        for (i=0; i<inputs.length; i++) {
-            var inp = inputs[i];
-            if (inp.getAttribute('type') == 'text' && inp.className.match(/vTimeField/)) {
-                DateTimeShortcuts.addClock(inp);
-            }
-            else if (inp.getAttribute('type') == 'text' && inp.className.match(/vDateField/)) {
-                DateTimeShortcuts.addCalendar(inp);
-            }
-        }
-    },
-    // Add clock widget to a given field
-    addClock: function(inp) {
-        var num = DateTimeShortcuts.clockInputs.length;
-        DateTimeShortcuts.clockInputs[num] = inp;
-
-        // Shortcut links (clock icon and "Now" link)
-        var shortcuts_span = document.createElement('span');
-        inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling);
-        var now_link = document.createElement('a');
-        now_link.setAttribute('href', "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date().getHourMinute());");
-        now_link.appendChild(document.createTextNode(gettext('Now')));
-        var clock_link = document.createElement('a');
-        clock_link.setAttribute('href', 'javascript:DateTimeShortcuts.openClock(' + num + ');');
-        quickElement('img', clock_link, '', 'src', DateTimeShortcuts.admin_media_prefix + 'img/admin/icon_clock.gif', 'alt', gettext('Clock'));
-        shortcuts_span.appendChild(document.createTextNode('\240'));
-        shortcuts_span.appendChild(now_link);
-        shortcuts_span.appendChild(document.createTextNode('\240|\240'));
-        shortcuts_span.appendChild(clock_link);
-
-        // Create clock link div
-        //
-        // Markup looks like:
-        // <div id="clockbox1" class="clockbox module">
-        //     <h2>Choose a time</h2>
-        //     <ul class="timelist">
-        //         <li><a href="#">Now</a></li>
-        //         <li><a href="#">Midnight</a></li>
-        //         <li><a href="#">6 a.m.</a></li>
-        //         <li><a href="#">Noon</a></li>
-        //     </ul>
-        //     <p class="calendar-cancel"><a href="#">Cancel</a></p>
-        // </div>
-
-        var clock_box = document.createElement('div');
-        clock_box.style.display = 'none';
-        clock_box.style.position = 'absolute';
-        clock_box.style.left = findPosX(clock_link) + 17 + 'px';
-        clock_box.style.top = findPosY(clock_link) - 30 + 'px';
-        clock_box.className = 'clockbox module';
-        clock_box.setAttribute('id', DateTimeShortcuts.clockDivName + num);
-        document.body.appendChild(clock_box);
-        addEvent(clock_box, 'click', DateTimeShortcuts.cancelEventPropagation);
-
-        quickElement('h2', clock_box, gettext('Choose a time'));
-        time_list = quickElement('ul', clock_box, '');
-        time_list.className = 'timelist';
-        quickElement("a", quickElement("li", time_list, ""), gettext("Now"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date().getHourMinute());")
-        quickElement("a", quickElement("li", time_list, ""), gettext("Midnight"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '00:00');")
-        quickElement("a", quickElement("li", time_list, ""), gettext("6 a.m."), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '06:00');")
-        quickElement("a", quickElement("li", time_list, ""), gettext("Noon"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '12:00');")
-
-        cancel_p = quickElement('p', clock_box, '');
-        cancel_p.className = 'calendar-cancel';
-        quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:DateTimeShortcuts.dismissClock(' + num + ');');
-    },
-    openClock: function(num) {
-        document.getElementById(DateTimeShortcuts.clockDivName + num).style.display = 'block';
-        addEvent(window, 'click', function() { DateTimeShortcuts.dismissClock(num); return true; });
-    },
-    dismissClock: function(num) {
-       document.getElementById(DateTimeShortcuts.clockDivName + num).style.display = 'none';
-       window.onclick = null;
-    },
-    handleClockQuicklink: function(num, val) {
-       DateTimeShortcuts.clockInputs[num].value = val;
-       DateTimeShortcuts.dismissClock(num);
-    },
-    // Add calendar widget to a given field.
-    addCalendar: function(inp) {
-        var num = DateTimeShortcuts.calendars.length;
-
-        DateTimeShortcuts.calendarInputs[num] = inp;
-
-        // Shortcut links (calendar icon and "Today" link)
-        var shortcuts_span = document.createElement('span');
-        inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling);
-        var today_link = document.createElement('a');
-        today_link.setAttribute('href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', 0);');
-        today_link.appendChild(document.createTextNode(gettext('Today')));
-        var cal_link = document.createElement('a');
-        cal_link.setAttribute('href', 'javascript:DateTimeShortcuts.openCalendar(' + num + ');');
-        quickElement('img', cal_link, '', 'src', DateTimeShortcuts.admin_media_prefix + 'img/admin/icon_calendar.gif', 'alt', gettext('Calendar'));
-        shortcuts_span.appendChild(document.createTextNode('\240'));
-        shortcuts_span.appendChild(today_link);
-        shortcuts_span.appendChild(document.createTextNode('\240|\240'));
-        shortcuts_span.appendChild(cal_link);
-
-        // Create calendarbox div.
-        //
-        // Markup looks like:
-        //
-        // <div id="calendarbox3" class="calendarbox module">
-        //     <h2>
-        //           <a href="#" class="link-previous">&lsaquo;</a>
-        //           <a href="#" class="link-next">&rsaquo;</a> February 2003
-        //     </h2>
-        //     <div class="calendar" id="calendarin3">
-        //         <!-- (cal) -->
-        //     </div>
-        //     <div class="calendar-shortcuts">
-        //          <a href="#">Yesterday</a> | <a href="#">Today</a> | <a href="#">Tomorrow</a>
-        //     </div>
-        //     <p class="calendar-cancel"><a href="#">Cancel</a></p>
-        // </div>
-        var cal_box = document.createElement('div');
-        cal_box.style.display = 'none';
-        cal_box.style.position = 'absolute';
-        cal_box.style.left = findPosX(cal_link) + 17 + 'px';
-        cal_box.style.top = findPosY(cal_link) - 75 + 'px';
-        cal_box.className = 'calendarbox module';
-        cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num);
-        document.body.appendChild(cal_box);
-        addEvent(cal_box, 'click', DateTimeShortcuts.cancelEventPropagation);
-
-        // next-prev links
-        var cal_nav = quickElement('div', cal_box, '');
-        var cal_nav_prev = quickElement('a', cal_nav, '<', 'href', 'javascript:DateTimeShortcuts.drawPrev('+num+');');
-        cal_nav_prev.className = 'calendarnav-previous';
-        var cal_nav_next = quickElement('a', cal_nav, '>', 'href', 'javascript:DateTimeShortcuts.drawNext('+num+');');
-        cal_nav_next.className = 'calendarnav-next';
-        cal_box.appendChild(cal_nav);
-
-        // main box
-        var cal_main = quickElement('div', cal_box, '', 'id', DateTimeShortcuts.calendarDivName2 + num);
-        cal_main.className = 'calendar';
-        DateTimeShortcuts.calendars[num] = new Calendar(DateTimeShortcuts.calendarDivName2 + num, DateTimeShortcuts.handleCalendarCallback(num));
-        DateTimeShortcuts.calendars[num].drawCurrent();
-
-        // calendar shortcuts
-        var shortcuts = quickElement('div', cal_box, '');
-        shortcuts.className = 'calendar-shortcuts';
-        quickElement('a', shortcuts, gettext('Yesterday'), 'href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', -1);');
-        shortcuts.appendChild(document.createTextNode('\240|\240'));
-        quickElement('a', shortcuts, gettext('Today'), 'href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', 0);');
-        shortcuts.appendChild(document.createTextNode('\240|\240'));
-        quickElement('a', shortcuts, gettext('Tomorrow'), 'href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', +1);');
-
-        // cancel bar
-        var cancel_p = quickElement('p', cal_box, '');
-        cancel_p.className = 'calendar-cancel';
-        quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:DateTimeShortcuts.dismissCalendar(' + num + ');');
-    },
-    openCalendar: function(num) {
-        document.getElementById(DateTimeShortcuts.calendarDivName1+num).style.display = 'block';
-        addEvent(window, 'click', function() { DateTimeShortcuts.dismissCalendar(num); return true; });
-    },
-    dismissCalendar: function(num) {
-        document.getElementById(DateTimeShortcuts.calendarDivName1+num).style.display = 'none';
-    },
-    drawPrev: function(num) {
-        DateTimeShortcuts.calendars[num].drawPreviousMonth();
-    },
-    drawNext: function(num) {
-        DateTimeShortcuts.calendars[num].drawNextMonth();
-    },
-    handleCalendarCallback: function(num) {
-        return "function(y, m, d) { DateTimeShortcuts.calendarInputs["+num+"].value = y+'-'+m+'-'+d; document.getElementById(DateTimeShortcuts.calendarDivName1+"+num+").style.display='none';}";
-    },
-    handleCalendarQuickLink: function(num, offset) {
-       var d = new Date();
-       d.setDate(d.getDate() + offset)
-       DateTimeShortcuts.calendarInputs[num].value = d.getISODate();
-       DateTimeShortcuts.dismissCalendar(num);
-    },
-    cancelEventPropagation: function(e) {
-        if (!e) var e = window.event;
-        e.cancelBubble = true;
-        if (e.stopPropagation) e.stopPropagation();
-    }
-}
-
-addEvent(window, 'load', DateTimeShortcuts.init);
Index: media/js/dojo/dojo.js
===================================================================
--- media/js/dojo/dojo.js	(revision 0)
+++ media/js/dojo/dojo.js	(revision 0)
@@ -0,0 +1,3195 @@
+/*
+	Copyright (c) 2004-2005, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+/*
+	This is a compiled version of Dojo, built for deployment and not for
+	development. To get an editable version, please visit:
+
+		http://dojotoolkit.org
+
+	for documentation and information on getting the source.
+*/
+
+var dj_global=this;
+function dj_undef(_1,_2){
+if(!_2){
+_2=dj_global;
+}
+return (typeof _2[_1]=="undefined");
+}
+if(dj_undef("djConfig")){
+var djConfig={};
+}
+var dojo;
+if(dj_undef("dojo")){
+dojo={};
+}
+dojo.version={major:0,minor:2,patch:2,flag:"",revision:Number("$Rev: 2836 $".match(/[0-9]+/)[0]),toString:function(){
+with(dojo.version){
+return major+"."+minor+"."+patch+flag+" ("+revision+")";
+}
+}};
+dojo.evalObjPath=function(_3,_4){
+if(typeof _3!="string"){
+return dj_global;
+}
+if(_3.indexOf(".")==-1){
+if((dj_undef(_3,dj_global))&&(_4)){
+dj_global[_3]={};
+}
+return dj_global[_3];
+}
+var _5=_3.split(/\./);
+var _6=dj_global;
+for(var i=0;i<_5.length;++i){
+if(!_4){
+_6=_6[_5[i]];
+if((typeof _6=="undefined")||(!_6)){
+return _6;
+}
+}else{
+if(dj_undef(_5[i],_6)){
+_6[_5[i]]={};
+}
+_6=_6[_5[i]];
+}
+}
+return _6;
+};
+dojo.errorToString=function(_8){
+return ((!dj_undef("message",_8))?_8.message:(dj_undef("description",_8)?_8:_8.description));
+};
+dojo.raise=function(_9,_a){
+if(_a){
+_9=_9+": "+dojo.errorToString(_a);
+}
+var he=dojo.hostenv;
+if((!dj_undef("hostenv",dojo))&&(!dj_undef("println",dojo.hostenv))){
+dojo.hostenv.println("FATAL: "+_9);
+}
+throw Error(_9);
+};
+dj_throw=dj_rethrow=function(m,e){
+dojo.deprecated("dj_throw and dj_rethrow deprecated, use dojo.raise instead");
+dojo.raise(m,e);
+};
+dojo.debug=function(){
+if(!djConfig.isDebug){
+return;
+}
+var _e=arguments;
+if(dj_undef("println",dojo.hostenv)){
+dojo.raise("dojo.debug not available (yet?)");
+}
+var _f=dj_global["jum"]&&!dj_global["jum"].isBrowser;
+var s=[(_f?"":"DEBUG: ")];
+for(var i=0;i<_e.length;++i){
+if(!false&&_e[i] instanceof Error){
+var msg="["+_e[i].name+": "+dojo.errorToString(_e[i])+(_e[i].fileName?", file: "+_e[i].fileName:"")+(_e[i].lineNumber?", line: "+_e[i].lineNumber:"")+"]";
+}else{
+try{
+var msg=String(_e[i]);
+}
+catch(e){
+if(dojo.render.html.ie){
+var msg="[ActiveXObject]";
+}else{
+var msg="[unknown]";
+}
+}
+}
+s.push(msg);
+}
+if(_f){
+jum.debug(s.join(" "));
+}else{
+dojo.hostenv.println(s.join(" "));
+}
+};
+dojo.debugShallow=function(obj){
+if(!djConfig.isDebug){
+return;
+}
+dojo.debug("------------------------------------------------------------");
+dojo.debug("Object: "+obj);
+for(i in obj){
+dojo.debug(i+": "+obj[i]);
+}
+dojo.debug("------------------------------------------------------------");
+};
+var dj_debug=dojo.debug;
+function dj_eval(s){
+return dj_global.eval?dj_global.eval(s):eval(s);
+}
+dj_unimplemented=dojo.unimplemented=function(_15,_16){
+var _17="'"+_15+"' not implemented";
+if((!dj_undef(_16))&&(_16)){
+_17+=" "+_16;
+}
+dojo.raise(_17);
+};
+dj_deprecated=dojo.deprecated=function(_18,_19,_1a){
+var _1b="DEPRECATED: "+_18;
+if(_19){
+_1b+=" "+_19;
+}
+if(_1a){
+_1b+=" -- will be removed in version: "+_1a;
+}
+dojo.debug(_1b);
+};
+dojo.inherits=function(_1c,_1d){
+if(typeof _1d!="function"){
+dojo.raise("superclass: "+_1d+" borken");
+}
+_1c.prototype=new _1d();
+_1c.prototype.constructor=_1c;
+_1c.superclass=_1d.prototype;
+_1c["super"]=_1d.prototype;
+};
+dj_inherits=function(_1e,_1f){
+dojo.deprecated("dj_inherits deprecated, use dojo.inherits instead");
+dojo.inherits(_1e,_1f);
+};
+dojo.render=(function(){
+function vscaffold(_20,_21){
+var tmp={capable:false,support:{builtin:false,plugin:false},prefixes:_20};
+for(var x in _21){
+tmp[x]=false;
+}
+return tmp;
+}
+return {name:"",ver:dojo.version,os:{win:false,linux:false,osx:false},html:vscaffold(["html"],["ie","opera","khtml","safari","moz"]),svg:vscaffold(["svg"],["corel","adobe","batik"]),vml:vscaffold(["vml"],["ie"]),swf:vscaffold(["Swf","Flash","Mm"],["mm"]),swt:vscaffold(["Swt"],["ibm"])};
+})();
+dojo.hostenv=(function(){
+var _24={isDebug:false,allowQueryConfig:false,baseScriptUri:"",baseRelativePath:"",libraryScriptUri:"",iePreventClobber:false,ieClobberMinimal:true,preventBackButtonFix:true,searchIds:[],parseWidgets:true};
+if(typeof djConfig=="undefined"){
+djConfig=_24;
+}else{
+for(var _25 in _24){
+if(typeof djConfig[_25]=="undefined"){
+djConfig[_25]=_24[_25];
+}
+}
+}
+var djc=djConfig;
+function _def(obj,_28,def){
+return (dj_undef(_28,obj)?def:obj[_28]);
+}
+return {name_:"(unset)",version_:"(unset)",pkgFileName:"__package__",loading_modules_:{},loaded_modules_:{},addedToLoadingCount:[],removedFromLoadingCount:[],inFlightCount:0,modulePrefixes_:{dojo:{name:"dojo",value:"src"}},setModulePrefix:function(_2a,_2b){
+this.modulePrefixes_[_2a]={name:_2a,value:_2b};
+},getModulePrefix:function(_2c){
+var mp=this.modulePrefixes_;
+if((mp[_2c])&&(mp[_2c]["name"])){
+return mp[_2c].value;
+}
+return _2c;
+},getTextStack:[],loadUriStack:[],loadedUris:[],post_load_:false,modulesLoadedListeners:[],getName:function(){
+return this.name_;
+},getVersion:function(){
+return this.version_;
+},getText:function(uri){
+dojo.unimplemented("getText","uri="+uri);
+},getLibraryScriptUri:function(){
+dojo.unimplemented("getLibraryScriptUri","");
+}};
+})();
+dojo.hostenv.getBaseScriptUri=function(){
+if(djConfig.baseScriptUri.length){
+return djConfig.baseScriptUri;
+}
+var uri=new String(djConfig.libraryScriptUri||djConfig.baseRelativePath);
+if(!uri){
+dojo.raise("Nothing returned by getLibraryScriptUri(): "+uri);
+}
+var _30=uri.lastIndexOf("/");
+djConfig.baseScriptUri=djConfig.baseRelativePath;
+return djConfig.baseScriptUri;
+};
+dojo.hostenv.setBaseScriptUri=function(uri){
+djConfig.baseScriptUri=uri;
+};
+dojo.hostenv.loadPath=function(_32,_33,cb){
+if((_32.charAt(0)=="/")||(_32.match(/^\w+:/))){
+dojo.raise("relpath '"+_32+"'; must be relative");
+}
+var uri=this.getBaseScriptUri()+_32;
+if(djConfig.cacheBust&&dojo.render.html.capable){
+uri+="?"+String(djConfig.cacheBust).replace(/\W+/g,"");
+}
+try{
+return ((!_33)?this.loadUri(uri,cb):this.loadUriAndCheck(uri,_33,cb));
+}
+catch(e){
+dojo.debug(e);
+return false;
+}
+};
+dojo.hostenv.loadUri=function(uri,cb){
+if(this.loadedUris[uri]){
+return;
+}
+var _38=this.getText(uri,null,true);
+if(_38==null){
+return 0;
+}
+this.loadedUris[uri]=true;
+var _39=dj_eval(_38);
+return 1;
+};
+dojo.hostenv.loadUriAndCheck=function(uri,_3b,cb){
+var ok=true;
+try{
+ok=this.loadUri(uri,cb);
+}
+catch(e){
+dojo.debug("failed loading ",uri," with error: ",e);
+}
+return ((ok)&&(this.findModule(_3b,false)))?true:false;
+};
+dojo.loaded=function(){
+};
+dojo.hostenv.loaded=function(){
+this.post_load_=true;
+var mll=this.modulesLoadedListeners;
+for(var x=0;x<mll.length;x++){
+mll[x]();
+}
+dojo.loaded();
+};
+dojo.addOnLoad=function(obj,_41){
+if(arguments.length==1){
+dojo.hostenv.modulesLoadedListeners.push(obj);
+}else{
+if(arguments.length>1){
+dojo.hostenv.modulesLoadedListeners.push(function(){
+obj[_41]();
+});
+}
+}
+};
+dojo.hostenv.modulesLoaded=function(){
+if(this.post_load_){
+return;
+}
+if((this.loadUriStack.length==0)&&(this.getTextStack.length==0)){
+if(this.inFlightCount>0){
+dojo.debug("files still in flight!");
+return;
+}
+if(typeof setTimeout=="object"){
+setTimeout("dojo.hostenv.loaded();",0);
+}else{
+dojo.hostenv.loaded();
+}
+}
+};
+dojo.hostenv.moduleLoaded=function(_42){
+var _43=dojo.evalObjPath((_42.split(".").slice(0,-1)).join("."));
+this.loaded_modules_[(new String(_42)).toLowerCase()]=_43;
+};
+dojo.hostenv._global_omit_module_check=false;
+dojo.hostenv.loadModule=function(_44,_45,_46){
+if(!_44){
+return;
+}
+_46=this._global_omit_module_check||_46;
+var _47=this.findModule(_44,false);
+if(_47){
+return _47;
+}
+if(dj_undef(_44,this.loading_modules_)){
+this.addedToLoadingCount.push(_44);
+}
+this.loading_modules_[_44]=1;
+var _48=_44.replace(/\./g,"/")+".js";
+var _49=_44.split(".");
+var _4a=_44.split(".");
+for(var i=_49.length-1;i>0;i--){
+var _4c=_49.slice(0,i).join(".");
+var _4d=this.getModulePrefix(_4c);
+if(_4d!=_4c){
+_49.splice(0,i,_4d);
+break;
+}
+}
+var _4e=_49[_49.length-1];
+if(_4e=="*"){
+_44=(_4a.slice(0,-1)).join(".");
+while(_49.length){
+_49.pop();
+_49.push(this.pkgFileName);
+_48=_49.join("/")+".js";
+if(_48.charAt(0)=="/"){
+_48=_48.slice(1);
+}
+ok=this.loadPath(_48,((!_46)?_44:null));
+if(ok){
+break;
+}
+_49.pop();
+}
+}else{
+_48=_49.join("/")+".js";
+_44=_4a.join(".");
+var ok=this.loadPath(_48,((!_46)?_44:null));
+if((!ok)&&(!_45)){
+_49.pop();
+while(_49.length){
+_48=_49.join("/")+".js";
+ok=this.loadPath(_48,((!_46)?_44:null));
+if(ok){
+break;
+}
+_49.pop();
+_48=_49.join("/")+"/"+this.pkgFileName+".js";
+if(_48.charAt(0)=="/"){
+_48=_48.slice(1);
+}
+ok=this.loadPath(_48,((!_46)?_44:null));
+if(ok){
+break;
+}
+}
+}
+if((!ok)&&(!_46)){
+dojo.raise("Could not load '"+_44+"'; last tried '"+_48+"'");
+}
+}
+if(!_46){
+_47=this.findModule(_44,false);
+if(!_47){
+dojo.raise("symbol '"+_44+"' is not defined after loading '"+_48+"'");
+}
+}
+return _47;
+};
+dojo.hostenv.startPackage=function(_50){
+var _51=_50.split(/\./);
+if(_51[_51.length-1]=="*"){
+_51.pop();
+}
+return dojo.evalObjPath(_51.join("."),true);
+};
+dojo.hostenv.findModule=function(_52,_53){
+var lmn=(new String(_52)).toLowerCase();
+if(this.loaded_modules_[lmn]){
+return this.loaded_modules_[lmn];
+}
+var _55=dojo.evalObjPath(_52);
+if((_52)&&(typeof _55!="undefined")&&(_55)){
+this.loaded_modules_[lmn]=_55;
+return _55;
+}
+if(_53){
+dojo.raise("no loaded module named '"+_52+"'");
+}
+return null;
+};
+if(typeof window=="undefined"){
+dojo.raise("no window object");
+}
+(function(){
+if(djConfig.allowQueryConfig){
+var _56=document.location.toString();
+var _57=_56.split("?",2);
+if(_57.length>1){
+var _58=_57[1];
+var _59=_58.split("&");
+for(var x in _59){
+var sp=_59[x].split("=");
+if((sp[0].length>9)&&(sp[0].substr(0,9)=="djConfig.")){
+var opt=sp[0].substr(9);
+try{
+djConfig[opt]=eval(sp[1]);
+}
+catch(e){
+djConfig[opt]=sp[1];
+}
+}
+}
+}
+}
+if(((djConfig["baseScriptUri"]=="")||(djConfig["baseRelativePath"]==""))&&(document&&document.getElementsByTagName)){
+var _5d=document.getElementsByTagName("script");
+var _5e=/(__package__|dojo)\.js([\?\.]|$)/i;
+for(var i=0;i<_5d.length;i++){
+var src=_5d[i].getAttribute("src");
+if(!src){
+continue;
+}
+var m=src.match(_5e);
+if(m){
+root=src.substring(0,m.index);
+if(!this["djConfig"]){
+djConfig={};
+}
+if(djConfig["baseScriptUri"]==""){
+djConfig["baseScriptUri"]=root;
+}
+if(djConfig["baseRelativePath"]==""){
+djConfig["baseRelativePath"]=root;
+}
+break;
+}
+}
+}
+var dr=dojo.render;
+var drh=dojo.render.html;
+var dua=drh.UA=navigator.userAgent;
+var dav=drh.AV=navigator.appVersion;
+var t=true;
+var f=false;
+drh.capable=t;
+drh.support.builtin=t;
+dr.ver=parseFloat(drh.AV);
+dr.os.mac=dav.indexOf("Macintosh")>=0;
+dr.os.win=dav.indexOf("Windows")>=0;
+dr.os.linux=dav.indexOf("X11")>=0;
+drh.opera=dua.indexOf("Opera")>=0;
+drh.khtml=(dav.indexOf("Konqueror")>=0)||(dav.indexOf("Safari")>=0);
+drh.safari=dav.indexOf("Safari")>=0;
+var _68=dua.indexOf("Gecko");
+drh.mozilla=drh.moz=(_68>=0)&&(!drh.khtml);
+if(drh.mozilla){
+drh.geckoVersion=dua.substring(_68+6,_68+14);
+}
+drh.ie=(document.all)&&(!drh.opera);
+drh.ie50=drh.ie&&dav.indexOf("MSIE 5.0")>=0;
+drh.ie55=drh.ie&&dav.indexOf("MSIE 5.5")>=0;
+drh.ie60=drh.ie&&dav.indexOf("MSIE 6.0")>=0;
+dr.vml.capable=drh.ie;
+dr.svg.capable=f;
+dr.svg.support.plugin=f;
+dr.svg.support.builtin=f;
+dr.svg.adobe=f;
+if(document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("org.w3c.dom.svg","1.0")){
+dr.svg.capable=t;
+dr.svg.support.builtin=t;
+dr.svg.support.plugin=f;
+dr.svg.adobe=f;
+}else{
+if(navigator.mimeTypes&&navigator.mimeTypes.length>0){
+var _69=navigator.mimeTypes["image/svg+xml"]||navigator.mimeTypes["image/svg"]||navigator.mimeTypes["image/svg-xml"];
+if(_69){
+dr.svg.adobe=_69&&_69.enabledPlugin&&_69.enabledPlugin.description&&(_69.enabledPlugin.description.indexOf("Adobe")>-1);
+if(dr.svg.adobe){
+dr.svg.capable=t;
+dr.svg.support.plugin=t;
+}
+}
+}else{
+if(drh.ie&&dr.os.win){
+var _69=f;
+try{
+var _6a=new ActiveXObject("Adobe.SVGCtl");
+_69=t;
+}
+catch(e){
+}
+if(_69){
+dr.svg.capable=t;
+dr.svg.support.plugin=t;
+dr.svg.adobe=t;
+}
+}else{
+dr.svg.capable=f;
+dr.svg.support.plugin=f;
+dr.svg.adobe=f;
+}
+}
+}
+})();
+dojo.hostenv.startPackage("dojo.hostenv");
+dojo.hostenv.name_="browser";
+dojo.hostenv.searchIds=[];
+var DJ_XMLHTTP_PROGIDS=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"];
+dojo.hostenv.getXmlhttpObject=function(){
+var _6b=null;
+var _6c=null;
+try{
+_6b=new XMLHttpRequest();
+}
+catch(e){
+}
+if(!_6b){
+for(var i=0;i<3;++i){
+var _6e=DJ_XMLHTTP_PROGIDS[i];
+try{
+_6b=new ActiveXObject(_6e);
+}
+catch(e){
+_6c=e;
+}
+if(_6b){
+DJ_XMLHTTP_PROGIDS=[_6e];
+break;
+}
+}
+}
+if(!_6b){
+return dojo.raise("XMLHTTP not available",_6c);
+}
+return _6b;
+};
+dojo.hostenv.getText=function(uri,_70,_71){
+var _72=this.getXmlhttpObject();
+if(_70){
+_72.onreadystatechange=function(){
+if((4==_72.readyState)&&(_72["status"])){
+if(_72.status==200){
+_70(_72.responseText);
+}
+}
+};
+}
+_72.open("GET",uri,_70?true:false);
+_72.send(null);
+if(_70){
+return null;
+}
+return _72.responseText;
+};
+dojo.hostenv.defaultDebugContainerId="dojoDebug";
+dojo.hostenv._println_buffer=[];
+dojo.hostenv._println_safe=false;
+dojo.hostenv.println=function(_73){
+if(!dojo.hostenv._println_safe){
+dojo.hostenv._println_buffer.push(_73);
+}else{
+try{
+var _74=document.getElementById(djConfig.debugContainerId?djConfig.debugContainerId:dojo.hostenv.defaultDebugContainerId);
+if(!_74){
+_74=document.getElementsByTagName("body")[0]||document.body;
+}
+var div=document.createElement("div");
+div.appendChild(document.createTextNode(_73));
+_74.appendChild(div);
+}
+catch(e){
+try{
+document.write("<div>"+_73+"</div>");
+}
+catch(e2){
+window.status=_73;
+}
+}
+}
+};
+dojo.addOnLoad(function(){
+dojo.hostenv._println_safe=true;
+while(dojo.hostenv._println_buffer.length>0){
+dojo.hostenv.println(dojo.hostenv._println_buffer.shift());
+}
+});
+function dj_addNodeEvtHdlr(_76,_77,fp,_79){
+var _7a=_76["on"+_77]||function(){
+};
+_76["on"+_77]=function(){
+fp.apply(_76,arguments);
+_7a.apply(_76,arguments);
+};
+return true;
+}
+dj_addNodeEvtHdlr(window,"load",function(){
+if(dojo.render.html.ie){
+dojo.hostenv.makeWidgets();
+}
+dojo.hostenv.modulesLoaded();
+});
+dojo.hostenv.makeWidgets=function(){
+var _7b=[];
+if(djConfig.searchIds&&djConfig.searchIds.length>0){
+_7b=_7b.concat(djConfig.searchIds);
+}
+if(dojo.hostenv.searchIds&&dojo.hostenv.searchIds.length>0){
+_7b=_7b.concat(dojo.hostenv.searchIds);
+}
+if((djConfig.parseWidgets)||(_7b.length>0)){
+if(dojo.evalObjPath("dojo.widget.Parse")){
+try{
+var _7c=new dojo.xml.Parse();
+if(_7b.length>0){
+for(var x=0;x<_7b.length;x++){
+var _7e=document.getElementById(_7b[x]);
+if(!_7e){
+continue;
+}
+var _7f=_7c.parseElement(_7e,null,true);
+dojo.widget.getParser().createComponents(_7f);
+}
+}else{
+if(djConfig.parseWidgets){
+var _7f=_7c.parseElement(document.getElementsByTagName("body")[0]||document.body,null,true);
+dojo.widget.getParser().createComponents(_7f);
+}
+}
+}
+catch(e){
+dojo.debug("auto-build-widgets error:",e);
+}
+}
+}
+};
+dojo.hostenv.modulesLoadedListeners.push(function(){
+if(!dojo.render.html.ie){
+dojo.hostenv.makeWidgets();
+}
+});
+try{
+if(dojo.render.html.ie){
+document.write("<style>v:*{ behavior:url(#default#VML); }</style>");
+document.write("<xml:namespace ns=\"urn:schemas-microsoft-com:vml\" prefix=\"v\"/>");
+}
+}
+catch(e){
+}
+dojo.hostenv.writeIncludes=function(){
+};
+dojo.hostenv.byId=dojo.byId=function(id,doc){
+if(typeof id=="string"||id instanceof String){
+if(!doc){
+doc=document;
+}
+return doc.getElementById(id);
+}
+return id;
+};
+dojo.hostenv.byIdArray=dojo.byIdArray=function(){
+var ids=[];
+for(var i=0;i<arguments.length;i++){
+if((arguments[i] instanceof Array)||(typeof arguments[i]=="array")){
+for(var j=0;j<arguments[i].length;j++){
+ids=ids.concat(dojo.hostenv.byIdArray(arguments[i][j]));
+}
+}else{
+ids.push(dojo.hostenv.byId(arguments[i]));
+}
+}
+return ids;
+};
+dojo.hostenv.conditionalLoadModule=function(_85){
+var _86=_85["common"]||[];
+var _87=(_85[dojo.hostenv.name_])?_86.concat(_85[dojo.hostenv.name_]||[]):_86.concat(_85["default"]||[]);
+for(var x=0;x<_87.length;x++){
+var _89=_87[x];
+if(_89.constructor==Array){
+dojo.hostenv.loadModule.apply(dojo.hostenv,_89);
+}else{
+dojo.hostenv.loadModule(_89);
+}
+}
+};
+dojo.hostenv.require=dojo.hostenv.loadModule;
+dojo.require=function(){
+dojo.hostenv.loadModule.apply(dojo.hostenv,arguments);
+};
+dojo.requireAfter=dojo.require;
+dojo.requireIf=function(){
+if((arguments[0]===true)||(arguments[0]=="common")||(dojo.render[arguments[0]].capable)){
+var _8a=[];
+for(var i=1;i<arguments.length;i++){
+_8a.push(arguments[i]);
+}
+dojo.require.apply(dojo,_8a);
+}
+};
+dojo.requireAfterIf=dojo.requireIf;
+dojo.conditionalRequire=dojo.requireIf;
+dojo.kwCompoundRequire=function(){
+dojo.hostenv.conditionalLoadModule.apply(dojo.hostenv,arguments);
+};
+dojo.hostenv.provide=dojo.hostenv.startPackage;
+dojo.provide=function(){
+return dojo.hostenv.startPackage.apply(dojo.hostenv,arguments);
+};
+dojo.setModulePrefix=function(_8c,_8d){
+return dojo.hostenv.setModulePrefix(_8c,_8d);
+};
+dojo.profile={start:function(){
+},end:function(){
+},dump:function(){
+}};
+dojo.exists=function(obj,_8f){
+var p=_8f.split(".");
+for(var i=0;i<p.length;i++){
+if(!(obj[p[i]])){
+return false;
+}
+obj=obj[p[i]];
+}
+return true;
+};
+dojo.provide("dojo.lang");
+dojo.provide("dojo.AdapterRegistry");
+dojo.provide("dojo.lang.Lang");
+dojo.lang.mixin=function(obj,_93){
+var _94={};
+for(var x in _93){
+if(typeof _94[x]=="undefined"||_94[x]!=_93[x]){
+obj[x]=_93[x];
+}
+}
+if(dojo.render.html.ie&&dojo.lang.isFunction(_93["toString"])&&_93["toString"]!=obj["toString"]){
+obj.toString=_93.toString;
+}
+return obj;
+};
+dojo.lang.extend=function(_96,_97){
+this.mixin(_96.prototype,_97);
+};
+dojo.lang.extendPrototype=function(obj,_99){
+this.extend(obj.constructor,_99);
+};
+dojo.lang.anonCtr=0;
+dojo.lang.anon={};
+dojo.lang.nameAnonFunc=function(_9a,_9b){
+var nso=(_9b||dojo.lang.anon);
+if((dj_global["djConfig"])&&(djConfig["slowAnonFuncLookups"]==true)){
+for(var x in nso){
+if(nso[x]===_9a){
+return x;
+}
+}
+}
+var ret="__"+dojo.lang.anonCtr++;
+while(typeof nso[ret]!="undefined"){
+ret="__"+dojo.lang.anonCtr++;
+}
+nso[ret]=_9a;
+return ret;
+};
+dojo.lang.hitch=function(_9f,_a0){
+if(dojo.lang.isString(_a0)){
+var fcn=_9f[_a0];
+}else{
+var fcn=_a0;
+}
+return function(){
+return fcn.apply(_9f,arguments);
+};
+};
+dojo.lang.forward=function(_a2){
+return function(){
+return this[_a2].apply(this,arguments);
+};
+};
+dojo.lang.curry=function(ns,_a4){
+var _a5=[];
+ns=ns||dj_global;
+if(dojo.lang.isString(_a4)){
+_a4=ns[_a4];
+}
+for(var x=2;x<arguments.length;x++){
+_a5.push(arguments[x]);
+}
+var _a7=_a4.length-_a5.length;
+function gather(_a8,_a9,_aa){
+var _ab=_aa;
+var _ac=_a9.slice(0);
+for(var x=0;x<_a8.length;x++){
+_ac.push(_a8[x]);
+}
+_aa=_aa-_a8.length;
+if(_aa<=0){
+var res=_a4.apply(ns,_ac);
+_aa=_ab;
+return res;
+}else{
+return function(){
+return gather(arguments,_ac,_aa);
+};
+}
+}
+return gather([],_a5,_a7);
+};
+dojo.lang.curryArguments=function(ns,_b0,_b1,_b2){
+var _b3=[];
+var x=_b2||0;
+for(x=_b2;x<_b1.length;x++){
+_b3.push(_b1[x]);
+}
+return dojo.lang.curry.apply(dojo.lang,[ns,_b0].concat(_b3));
+};
+dojo.lang.setTimeout=function(_b5,_b6){
+var _b7=window,argsStart=2;
+if(!dojo.lang.isFunction(_b5)){
+_b7=_b5;
+_b5=_b6;
+_b6=arguments[2];
+argsStart++;
+}
+if(dojo.lang.isString(_b5)){
+_b5=_b7[_b5];
+}
+var _b8=[];
+for(var i=argsStart;i<arguments.length;i++){
+_b8.push(arguments[i]);
+}
+return setTimeout(function(){
+_b5.apply(_b7,_b8);
+},_b6);
+};
+dojo.lang.isObject=function(wh){
+return typeof wh=="object"||dojo.lang.isArray(wh)||dojo.lang.isFunction(wh);
+};
+dojo.lang.isArray=function(wh){
+return (wh instanceof Array||typeof wh=="array");
+};
+dojo.lang.isArrayLike=function(wh){
+if(dojo.lang.isString(wh)){
+return false;
+}
+if(dojo.lang.isArray(wh)){
+return true;
+}
+if(typeof wh!="undefined"&&wh&&dojo.lang.isNumber(wh.length)&&isFinite(wh.length)){
+return true;
+}
+return false;
+};
+dojo.lang.isFunction=function(wh){
+return (wh instanceof Function||typeof wh=="function");
+};
+dojo.lang.isString=function(wh){
+return (wh instanceof String||typeof wh=="string");
+};
+dojo.lang.isAlien=function(wh){
+return !dojo.lang.isFunction()&&/\{\s*\[native code\]\s*\}/.test(String(wh));
+};
+dojo.lang.isBoolean=function(wh){
+return (wh instanceof Boolean||typeof wh=="boolean");
+};
+dojo.lang.isNumber=function(wh){
+return (wh instanceof Number||typeof wh=="number");
+};
+dojo.lang.isUndefined=function(wh){
+return ((wh==undefined)&&(typeof wh=="undefined"));
+};
+dojo.lang.whatAmI=function(wh){
+try{
+if(dojo.lang.isArray(wh)){
+return "array";
+}
+if(dojo.lang.isFunction(wh)){
+return "function";
+}
+if(dojo.lang.isString(wh)){
+return "string";
+}
+if(dojo.lang.isNumber(wh)){
+return "number";
+}
+if(dojo.lang.isBoolean(wh)){
+return "boolean";
+}
+if(dojo.lang.isAlien(wh)){
+return "alien";
+}
+if(dojo.lang.isUndefined(wh)){
+return "undefined";
+}
+for(var _c4 in dojo.lang.whatAmI.custom){
+if(dojo.lang.whatAmI.custom[_c4](wh)){
+return _c4;
+}
+}
+if(dojo.lang.isObject(wh)){
+return "object";
+}
+}
+catch(E){
+}
+return "unknown";
+};
+dojo.lang.whatAmI.custom={};
+dojo.lang.find=function(arr,val,_c7){
+if(!dojo.lang.isArrayLike(arr)&&dojo.lang.isArrayLike(val)){
+var a=arr;
+arr=val;
+val=a;
+}
+var _c9=dojo.lang.isString(arr);
+if(_c9){
+arr=arr.split("");
+}
+if(_c7){
+for(var i=0;i<arr.length;++i){
+if(arr[i]===val){
+return i;
+}
+}
+}else{
+for(var i=0;i<arr.length;++i){
+if(arr[i]==val){
+return i;
+}
+}
+}
+return -1;
+};
+dojo.lang.indexOf=dojo.lang.find;
+dojo.lang.findLast=function(arr,val,_cd){
+if(!dojo.lang.isArrayLike(arr)&&dojo.lang.isArrayLike(val)){
+var a=arr;
+arr=val;
+val=a;
+}
+var _cf=dojo.lang.isString(arr);
+if(_cf){
+arr=arr.split("");
+}
+if(_cd){
+for(var i=arr.length-1;i>=0;i--){
+if(arr[i]===val){
+return i;
+}
+}
+}else{
+for(var i=arr.length-1;i>=0;i--){
+if(arr[i]==val){
+return i;
+}
+}
+}
+return -1;
+};
+dojo.lang.lastIndexOf=dojo.lang.findLast;
+dojo.lang.inArray=function(arr,val){
+return dojo.lang.find(arr,val)>-1;
+};
+dojo.lang.getNameInObj=function(ns,_d4){
+if(!ns){
+ns=dj_global;
+}
+for(var x in ns){
+if(ns[x]===_d4){
+return new String(x);
+}
+}
+return null;
+};
+dojo.lang.has=function(obj,_d7){
+return (typeof obj[_d7]!=="undefined");
+};
+dojo.lang.isEmpty=function(obj){
+if(dojo.lang.isObject(obj)){
+var tmp={};
+var _da=0;
+for(var x in obj){
+if(obj[x]&&(!tmp[x])){
+_da++;
+break;
+}
+}
+return (_da==0);
+}else{
+if(dojo.lang.isArrayLike(obj)||dojo.lang.isString(obj)){
+return obj.length==0;
+}
+}
+};
+dojo.lang.forEach=function(arr,_dd,_de){
+var _df=dojo.lang.isString(arr);
+if(_df){
+arr=arr.split("");
+}
+var il=arr.length;
+for(var i=0;i<((_de)?il:arr.length);i++){
+if(_dd(arr[i],i,arr)=="break"){
+break;
+}
+}
+};
+dojo.lang.map=function(arr,obj,_e4){
+var _e5=dojo.lang.isString(arr);
+if(_e5){
+arr=arr.split("");
+}
+if(dojo.lang.isFunction(obj)&&(!_e4)){
+_e4=obj;
+obj=dj_global;
+}else{
+if(dojo.lang.isFunction(obj)&&_e4){
+var _e6=obj;
+obj=_e4;
+_e4=_e6;
+}
+}
+if(Array.map){
+var _e7=Array.map(arr,_e4,obj);
+}else{
+var _e7=[];
+for(var i=0;i<arr.length;++i){
+_e7.push(_e4.call(obj,arr[i]));
+}
+}
+if(_e5){
+return _e7.join("");
+}else{
+return _e7;
+}
+};
+dojo.lang.tryThese=function(){
+for(var x=0;x<arguments.length;x++){
+try{
+if(typeof arguments[x]=="function"){
+var ret=(arguments[x]());
+if(ret){
+return ret;
+}
+}
+}
+catch(e){
+dojo.debug(e);
+}
+}
+};
+dojo.lang.delayThese=function(_eb,cb,_ed,_ee){
+if(!_eb.length){
+if(typeof _ee=="function"){
+_ee();
+}
+return;
+}
+if((typeof _ed=="undefined")&&(typeof cb=="number")){
+_ed=cb;
+cb=function(){
+};
+}else{
+if(!cb){
+cb=function(){
+};
+if(!_ed){
+_ed=0;
+}
+}
+}
+setTimeout(function(){
+(_eb.shift())();
+cb();
+dojo.lang.delayThese(_eb,cb,_ed,_ee);
+},_ed);
+};
+dojo.lang.shallowCopy=function(obj){
+var ret={},key;
+for(key in obj){
+if(dojo.lang.isUndefined(ret[key])){
+ret[key]=obj[key];
+}
+}
+return ret;
+};
+dojo.lang.every=function(arr,_f2,_f3){
+var _f4=dojo.lang.isString(arr);
+if(_f4){
+arr=arr.split("");
+}
+if(Array.every){
+return Array.every(arr,_f2,_f3);
+}else{
+if(!_f3){
+if(arguments.length>=3){
+dojo.raise("thisObject doesn't exist!");
+}
+_f3=dj_global;
+}
+for(var i=0;i<arr.length;i++){
+if(!_f2.call(_f3,arr[i],i,arr)){
+return false;
+}
+}
+return true;
+}
+};
+dojo.lang.some=function(arr,_f7,_f8){
+var _f9=dojo.lang.isString(arr);
+if(_f9){
+arr=arr.split("");
+}
+if(Array.some){
+return Array.some(arr,_f7,_f8);
+}else{
+if(!_f8){
+if(arguments.length>=3){
+dojo.raise("thisObject doesn't exist!");
+}
+_f8=dj_global;
+}
+for(var i=0;i<arr.length;i++){
+if(_f7.call(_f8,arr[i],i,arr)){
+return true;
+}
+}
+return false;
+}
+};
+dojo.lang.filter=function(arr,_fc,_fd){
+var _fe=dojo.lang.isString(arr);
+if(_fe){
+arr=arr.split("");
+}
+if(Array.filter){
+var _ff=Array.filter(arr,_fc,_fd);
+}else{
+if(!_fd){
+if(arguments.length>=3){
+dojo.raise("thisObject doesn't exist!");
+}
+_fd=dj_global;
+}
+var _ff=[];
+for(var i=0;i<arr.length;i++){
+if(_fc.call(_fd,arr[i],i,arr)){
+_ff.push(arr[i]);
+}
+}
+}
+if(_fe){
+return _ff.join("");
+}else{
+return _ff;
+}
+};
+dojo.AdapterRegistry=function(){
+this.pairs=[];
+};
+dojo.lang.extend(dojo.AdapterRegistry,{register:function(name,_102,wrap,_104){
+if(_104){
+this.pairs.unshift([name,_102,wrap]);
+}else{
+this.pairs.push([name,_102,wrap]);
+}
+},match:function(){
+for(var i=0;i<this.pairs.length;i++){
+var pair=this.pairs[i];
+if(pair[1].apply(this,arguments)){
+return pair[2].apply(this,arguments);
+}
+}
+throw new Error("No match found");
+},unregister:function(name){
+for(var i=0;i<this.pairs.length;i++){
+var pair=this.pairs[i];
+if(pair[0]==name){
+this.pairs.splice(i,1);
+return true;
+}
+}
+return false;
+}});
+dojo.lang.reprRegistry=new dojo.AdapterRegistry();
+dojo.lang.registerRepr=function(name,_10b,wrap,_10d){
+dojo.lang.reprRegistry.register(name,_10b,wrap,_10d);
+};
+dojo.lang.repr=function(obj){
+if(typeof (obj)=="undefined"){
+return "undefined";
+}else{
+if(obj===null){
+return "null";
+}
+}
+try{
+if(typeof (obj["__repr__"])=="function"){
+return obj["__repr__"]();
+}else{
+if((typeof (obj["repr"])=="function")&&(obj.repr!=arguments.callee)){
+return obj["repr"]();
+}
+}
+return dojo.lang.reprRegistry.match(obj);
+}
+catch(e){
+if(typeof (obj.NAME)=="string"&&(obj.toString==Function.prototype.toString||obj.toString==Object.prototype.toString)){
+return o.NAME;
+}
+}
+if(typeof (obj)=="function"){
+obj=(obj+"").replace(/^\s+/,"");
+var idx=obj.indexOf("{");
+if(idx!=-1){
+obj=obj.substr(0,idx)+"{...}";
+}
+}
+return obj+"";
+};
+dojo.lang.reprArrayLike=function(arr){
+try{
+var na=dojo.lang.map(arr,dojo.lang.repr);
+return "["+na.join(", ")+"]";
+}
+catch(e){
+}
+};
+dojo.lang.reprString=function(str){
+return ("\""+str.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r");
+};
+dojo.lang.reprNumber=function(num){
+return num+"";
+};
+(function(){
+var m=dojo.lang;
+m.registerRepr("arrayLike",m.isArrayLike,m.reprArrayLike);
+m.registerRepr("string",m.isString,m.reprString);
+m.registerRepr("numbers",m.isNumber,m.reprNumber);
+m.registerRepr("boolean",m.isBoolean,m.reprNumber);
+})();
+dojo.lang.unnest=function(){
+var out=[];
+for(var i=0;i<arguments.length;i++){
+if(dojo.lang.isArrayLike(arguments[i])){
+var add=dojo.lang.unnest.apply(this,arguments[i]);
+out=out.concat(add);
+}else{
+out.push(arguments[i]);
+}
+}
+return out;
+};
+dojo.lang.firstValued=function(){
+for(var i=0;i<arguments.length;i++){
+if(typeof arguments[i]!="undefined"){
+return arguments[i];
+}
+}
+return undefined;
+};
+dojo.lang.toArray=function(_119,_11a){
+var _11b=[];
+for(var i=_11a||0;i<_119.length;i++){
+_11b.push(_119[i]);
+}
+return _11b;
+};
+dojo.provide("dojo.string");
+dojo.require("dojo.lang");
+dojo.string.trim=function(str,wh){
+if(!dojo.lang.isString(str)){
+return str;
+}
+if(!str.length){
+return str;
+}
+if(wh>0){
+return str.replace(/^\s+/,"");
+}else{
+if(wh<0){
+return str.replace(/\s+$/,"");
+}else{
+return str.replace(/^\s+|\s+$/g,"");
+}
+}
+};
+dojo.string.trimStart=function(str){
+return dojo.string.trim(str,1);
+};
+dojo.string.trimEnd=function(str){
+return dojo.string.trim(str,-1);
+};
+dojo.string.paramString=function(str,_122,_123){
+for(var name in _122){
+var re=new RegExp("\\%\\{"+name+"\\}","g");
+str=str.replace(re,_122[name]);
+}
+if(_123){
+str=str.replace(/%\{([^\}\s]+)\}/g,"");
+}
+return str;
+};
+dojo.string.capitalize=function(str){
+if(!dojo.lang.isString(str)){
+return "";
+}
+if(arguments.length==0){
+str=this;
+}
+var _127=str.split(" ");
+var _128="";
+var len=_127.length;
+for(var i=0;i<len;i++){
+var word=_127[i];
+word=word.charAt(0).toUpperCase()+word.substring(1,word.length);
+_128+=word;
+if(i<len-1){
+_128+=" ";
+}
+}
+return new String(_128);
+};
+dojo.string.isBlank=function(str){
+if(!dojo.lang.isString(str)){
+return true;
+}
+return (dojo.string.trim(str).length==0);
+};
+dojo.string.encodeAscii=function(str){
+if(!dojo.lang.isString(str)){
+return str;
+}
+var ret="";
+var _12f=escape(str);
+var _130,re=/%u([0-9A-F]{4})/i;
+while((_130=_12f.match(re))){
+var num=Number("0x"+_130[1]);
+var _132=escape("&#"+num+";");
+ret+=_12f.substring(0,_130.index)+_132;
+_12f=_12f.substring(_130.index+_130[0].length);
+}
+ret+=_12f.replace(/\+/g,"%2B");
+return ret;
+};
+dojo.string.summary=function(str,len){
+if(!len||str.length<=len){
+return str;
+}else{
+return str.substring(0,len).replace(/\.+$/,"")+"...";
+}
+};
+dojo.string.escape=function(type,str){
+var args=[];
+for(var i=1;i<arguments.length;i++){
+args.push(arguments[i]);
+}
+switch(type.toLowerCase()){
+case "xml":
+case "html":
+case "xhtml":
+return dojo.string.escapeXml.apply(this,args);
+case "sql":
+return dojo.string.escapeSql.apply(this,args);
+case "regexp":
+case "regex":
+return dojo.string.escapeRegExp.apply(this,args);
+case "javascript":
+case "jscript":
+case "js":
+return dojo.string.escapeJavaScript.apply(this,args);
+case "ascii":
+return dojo.string.encodeAscii.apply(this,args);
+default:
+return str;
+}
+};
+dojo.string.escapeXml=function(str,_13a){
+str=str.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;").replace(/"/gm,"&quot;");
+if(!_13a){
+str=str.replace(/'/gm,"&#39;");
+}
+return str;
+};
+dojo.string.escapeSql=function(str){
+return str.replace(/'/gm,"''");
+};
+dojo.string.escapeRegExp=function(str){
+return str.replace(/\\/gm,"\\\\").replace(/([\f\b\n\t\r])/gm,"\\$1");
+};
+dojo.string.escapeJavaScript=function(str){
+return str.replace(/(["'\f\b\n\t\r])/gm,"\\$1");
+};
+dojo.string.repeat=function(str,_13f,_140){
+var out="";
+for(var i=0;i<_13f;i++){
+out+=str;
+if(_140&&i<_13f-1){
+out+=_140;
+}
+}
+return out;
+};
+dojo.string.endsWith=function(str,end,_145){
+if(_145){
+str=str.toLowerCase();
+end=end.toLowerCase();
+}
+return str.lastIndexOf(end)==str.length-end.length;
+};
+dojo.string.endsWithAny=function(str){
+for(var i=1;i<arguments.length;i++){
+if(dojo.string.endsWith(str,arguments[i])){
+return true;
+}
+}
+return false;
+};
+dojo.string.startsWith=function(str,_149,_14a){
+if(_14a){
+str=str.toLowerCase();
+_149=_149.toLowerCase();
+}
+return str.indexOf(_149)==0;
+};
+dojo.string.startsWithAny=function(str){
+for(var i=1;i<arguments.length;i++){
+if(dojo.string.startsWith(str,arguments[i])){
+return true;
+}
+}
+return false;
+};
+dojo.string.has=function(str){
+for(var i=1;i<arguments.length;i++){
+if(str.indexOf(arguments[i]>-1)){
+return true;
+}
+}
+return false;
+};
+dojo.string.pad=function(str,len,c,dir){
+var out=String(str);
+if(!c){
+c="0";
+}
+if(!dir){
+dir=1;
+}
+while(out.length<len){
+if(dir>0){
+out=c+out;
+}else{
+out+=c;
+}
+}
+return out;
+};
+dojo.string.padLeft=function(str,len,c){
+return dojo.string.pad(str,len,c,1);
+};
+dojo.string.padRight=function(str,len,c){
+return dojo.string.pad(str,len,c,-1);
+};
+dojo.string.normalizeNewlines=function(text,_15b){
+if(_15b=="\n"){
+text=text.replace(/\r\n/g,"\n");
+text=text.replace(/\r/g,"\n");
+}else{
+if(_15b=="\r"){
+text=text.replace(/\r\n/g,"\r");
+text=text.replace(/\n/g,"\r");
+}else{
+text=text.replace(/([^\r])\n/g,"$1\r\n");
+text=text.replace(/\r([^\n])/g,"\r\n$1");
+}
+}
+return text;
+};
+dojo.string.splitEscaped=function(str,_15d){
+var _15e=[];
+for(var i=0,prevcomma=0;i<str.length;i++){
+if(str.charAt(i)=="\\"){
+i++;
+continue;
+}
+if(str.charAt(i)==_15d){
+_15e.push(str.substring(prevcomma,i));
+prevcomma=i+1;
+}
+}
+_15e.push(str.substr(prevcomma));
+return _15e;
+};
+dojo.string.addToPrototype=function(){
+for(var _160 in dojo.string){
+if(dojo.lang.isFunction(dojo.string[_160])){
+var func=(function(){
+var meth=_160;
+switch(meth){
+case "addToPrototype":
+return null;
+break;
+case "escape":
+return function(type){
+return dojo.string.escape(type,this);
+};
+break;
+default:
+return function(){
+var args=[this];
+for(var i=0;i<arguments.length;i++){
+args.push(arguments[i]);
+}
+dojo.debug(args);
+return dojo.string[meth].apply(dojo.string,args);
+};
+}
+})();
+if(func){
+String.prototype[_160]=func;
+}
+}
+}
+};
+dojo.provide("dojo.io.IO");
+dojo.require("dojo.string");
+dojo.io.transports=[];
+dojo.io.hdlrFuncNames=["load","error"];
+dojo.io.Request=function(url,_167,_168,_169){
+if((arguments.length==1)&&(arguments[0].constructor==Object)){
+this.fromKwArgs(arguments[0]);
+}else{
+this.url=url;
+if(_167){
+this.mimetype=_167;
+}
+if(_168){
+this.transport=_168;
+}
+if(arguments.length>=4){
+this.changeUrl=_169;
+}
+}
+};
+dojo.lang.extend(dojo.io.Request,{url:"",mimetype:"text/plain",method:"GET",content:undefined,transport:undefined,changeUrl:undefined,formNode:undefined,sync:false,bindSuccess:false,useCache:false,preventCache:false,load:function(type,data,evt){
+},error:function(type,_16e){
+},handle:function(){
+},abort:function(){
+},fromKwArgs:function(_16f){
+if(_16f["url"]){
+_16f.url=_16f.url.toString();
+}
+if(!_16f["method"]&&_16f["formNode"]&&_16f["formNode"].method){
+_16f.method=_16f["formNode"].method;
+}
+if(!_16f["handle"]&&_16f["handler"]){
+_16f.handle=_16f.handler;
+}
+if(!_16f["load"]&&_16f["loaded"]){
+_16f.load=_16f.loaded;
+}
+if(!_16f["changeUrl"]&&_16f["changeURL"]){
+_16f.changeUrl=_16f.changeURL;
+}
+_16f.encoding=dojo.lang.firstValued(_16f["encoding"],djConfig["bindEncoding"],"");
+_16f.sendTransport=dojo.lang.firstValued(_16f["sendTransport"],djConfig["ioSendTransport"],true);
+var _170=dojo.lang.isFunction;
+for(var x=0;x<dojo.io.hdlrFuncNames.length;x++){
+var fn=dojo.io.hdlrFuncNames[x];
+if(_170(_16f[fn])){
+continue;
+}
+if(_170(_16f["handle"])){
+_16f[fn]=_16f.handle;
+}
+}
+dojo.lang.mixin(this,_16f);
+}});
+dojo.io.Error=function(msg,type,num){
+this.message=msg;
+this.type=type||"unknown";
+this.number=num||0;
+};
+dojo.io.transports.addTransport=function(name){
+this.push(name);
+this[name]=dojo.io[name];
+};
+dojo.io.bind=function(_177){
+if(!(_177 instanceof dojo.io.Request)){
+try{
+_177=new dojo.io.Request(_177);
+}
+catch(e){
+dojo.debug(e);
+}
+}
+var _178="";
+if(_177["transport"]){
+_178=_177["transport"];
+if(!this[_178]){
+return _177;
+}
+}else{
+for(var x=0;x<dojo.io.transports.length;x++){
+var tmp=dojo.io.transports[x];
+if((this[tmp])&&(this[tmp].canHandle(_177))){
+_178=tmp;
+}
+}
+if(_178==""){
+return _177;
+}
+}
+this[_178].bind(_177);
+_177.bindSuccess=true;
+return _177;
+};
+dojo.io.queueBind=function(_17b){
+if(!(_17b instanceof dojo.io.Request)){
+try{
+_17b=new dojo.io.Request(_17b);
+}
+catch(e){
+dojo.debug(e);
+}
+}
+var _17c=_17b.load;
+_17b.load=function(){
+dojo.io._queueBindInFlight=false;
+var ret=_17c.apply(this,arguments);
+dojo.io._dispatchNextQueueBind();
+return ret;
+};
+var _17e=_17b.error;
+_17b.error=function(){
+dojo.io._queueBindInFlight=false;
+var ret=_17e.apply(this,arguments);
+dojo.io._dispatchNextQueueBind();
+return ret;
+};
+dojo.io._bindQueue.push(_17b);
+dojo.io._dispatchNextQueueBind();
+return _17b;
+};
+dojo.io._dispatchNextQueueBind=function(){
+if(!dojo.io._queueBindInFlight){
+dojo.io._queueBindInFlight=true;
+dojo.io.bind(dojo.io._bindQueue.shift());
+}
+};
+dojo.io._bindQueue=[];
+dojo.io._queueBindInFlight=false;
+dojo.io.argsFromMap=function(map,_181){
+var _182=new Object();
+var _183="";
+var enc=/utf/i.test(_181||"")?encodeURIComponent:dojo.string.encodeAscii;
+for(var x in map){
+if(!_182[x]){
+_183+=enc(x)+"="+enc(map[x])+"&";
+}
+}
+return _183;
+};
+dojo.provide("dojo.dom");
+dojo.require("dojo.lang");
+dojo.dom.ELEMENT_NODE=1;
+dojo.dom.ATTRIBUTE_NODE=2;
+dojo.dom.TEXT_NODE=3;
+dojo.dom.CDATA_SECTION_NODE=4;
+dojo.dom.ENTITY_REFERENCE_NODE=5;
+dojo.dom.ENTITY_NODE=6;
+dojo.dom.PROCESSING_INSTRUCTION_NODE=7;
+dojo.dom.COMMENT_NODE=8;
+dojo.dom.DOCUMENT_NODE=9;
+dojo.dom.DOCUMENT_TYPE_NODE=10;
+dojo.dom.DOCUMENT_FRAGMENT_NODE=11;
+dojo.dom.NOTATION_NODE=12;
+dojo.dom.dojoml="http://www.dojotoolkit.org/2004/dojoml";
+dojo.dom.xmlns={svg:"http://www.w3.org/2000/svg",smil:"http://www.w3.org/2001/SMIL20/",mml:"http://www.w3.org/1998/Math/MathML",cml:"http://www.xml-cml.org",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml",xul:"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",xbl:"http://www.mozilla.org/xbl",fo:"http://www.w3.org/1999/XSL/Format",xsl:"http://www.w3.org/1999/XSL/Transform",xslt:"http://www.w3.org/1999/XSL/Transform",xi:"http://www.w3.org/2001/XInclude",xforms:"http://www.w3.org/2002/01/xforms",saxon:"http://icl.com/saxon",xalan:"http://xml.apache.org/xslt",xsd:"http://www.w3.org/2001/XMLSchema",dt:"http://www.w3.org/2001/XMLSchema-datatypes",xsi:"http://www.w3.org/2001/XMLSchema-instance",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",dc:"http://purl.org/dc/elements/1.1/",dcq:"http://purl.org/dc/qualifiers/1.0","soap-env":"http://schemas.xmlsoap.org/soap/envelope/",wsdl:"http://schemas.xmlsoap.org/wsdl/",AdobeExtensions:"http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"};
+dojo.dom.isNode=dojo.lang.isDomNode=function(wh){
+if(typeof Element=="object"){
+try{
+return wh instanceof Element;
+}
+catch(E){
+}
+}else{
+return wh&&!isNaN(wh.nodeType);
+}
+};
+dojo.lang.whatAmI.custom["node"]=dojo.dom.isNode;
+dojo.dom.getTagName=function(node){
+var _188=node.tagName;
+if(_188.substr(0,5).toLowerCase()!="dojo:"){
+if(_188.substr(0,4).toLowerCase()=="dojo"){
+return "dojo:"+_188.substring(4).toLowerCase();
+}
+var djt=node.getAttribute("dojoType")||node.getAttribute("dojotype");
+if(djt){
+return "dojo:"+djt.toLowerCase();
+}
+if((node.getAttributeNS)&&(node.getAttributeNS(this.dojoml,"type"))){
+return "dojo:"+node.getAttributeNS(this.dojoml,"type").toLowerCase();
+}
+try{
+djt=node.getAttribute("dojo:type");
+}
+catch(e){
+}
+if(djt){
+return "dojo:"+djt.toLowerCase();
+}
+if((!dj_global["djConfig"])||(!djConfig["ignoreClassNames"])){
+var _18a=node.className||node.getAttribute("class");
+if((_18a)&&(_18a.indexOf)&&(_18a.indexOf("dojo-")!=-1)){
+var _18b=_18a.split(" ");
+for(var x=0;x<_18b.length;x++){
+if((_18b[x].length>5)&&(_18b[x].indexOf("dojo-")>=0)){
+return "dojo:"+_18b[x].substr(5).toLowerCase();
+}
+}
+}
+}
+}
+return _188.toLowerCase();
+};
+dojo.dom.getUniqueId=function(){
+do{
+var id="dj_unique_"+(++arguments.callee._idIncrement);
+}while(document.getElementById(id));
+return id;
+};
+dojo.dom.getUniqueId._idIncrement=0;
+dojo.dom.firstElement=dojo.dom.getFirstChildElement=function(_18e,_18f){
+var node=_18e.firstChild;
+while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE){
+node=node.nextSibling;
+}
+if(_18f&&node&&node.tagName&&node.tagName.toLowerCase()!=_18f.toLowerCase()){
+node=dojo.dom.nextElement(node,_18f);
+}
+return node;
+};
+dojo.dom.lastElement=dojo.dom.getLastChildElement=function(_191,_192){
+var node=_191.lastChild;
+while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE){
+node=node.previousSibling;
+}
+if(_192&&node&&node.tagName&&node.tagName.toLowerCase()!=_192.toLowerCase()){
+node=dojo.dom.prevElement(node,_192);
+}
+return node;
+};
+dojo.dom.nextElement=dojo.dom.getNextSiblingElement=function(node,_195){
+if(!node){
+return null;
+}
+do{
+node=node.nextSibling;
+}while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE);
+if(node&&_195&&_195.toLowerCase()!=node.tagName.toLowerCase()){
+return dojo.dom.nextElement(node,_195);
+}
+return node;
+};
+dojo.dom.prevElement=dojo.dom.getPreviousSiblingElement=function(node,_197){
+if(!node){
+return null;
+}
+if(_197){
+_197=_197.toLowerCase();
+}
+do{
+node=node.previousSibling;
+}while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE);
+if(node&&_197&&_197.toLowerCase()!=node.tagName.toLowerCase()){
+return dojo.dom.prevElement(node,_197);
+}
+return node;
+};
+dojo.dom.moveChildren=function(_198,_199,trim){
+var _19b=0;
+if(trim){
+while(_198.hasChildNodes()&&_198.firstChild.nodeType==dojo.dom.TEXT_NODE){
+_198.removeChild(_198.firstChild);
+}
+while(_198.hasChildNodes()&&_198.lastChild.nodeType==dojo.dom.TEXT_NODE){
+_198.removeChild(_198.lastChild);
+}
+}
+while(_198.hasChildNodes()){
+_199.appendChild(_198.firstChild);
+_19b++;
+}
+return _19b;
+};
+dojo.dom.copyChildren=function(_19c,_19d,trim){
+var _19f=_19c.cloneNode(true);
+return this.moveChildren(_19f,_19d,trim);
+};
+dojo.dom.removeChildren=function(node){
+var _1a1=node.childNodes.length;
+while(node.hasChildNodes()){
+node.removeChild(node.firstChild);
+}
+return _1a1;
+};
+dojo.dom.replaceChildren=function(node,_1a3){
+dojo.dom.removeChildren(node);
+node.appendChild(_1a3);
+};
+dojo.dom.removeNode=function(node){
+if(node&&node.parentNode){
+return node.parentNode.removeChild(node);
+}
+};
+dojo.dom.getAncestors=function(node,_1a6,_1a7){
+var _1a8=[];
+var _1a9=dojo.lang.isFunction(_1a6);
+while(node){
+if(!_1a9||_1a6(node)){
+_1a8.push(node);
+}
+if(_1a7&&_1a8.length>0){
+return _1a8[0];
+}
+node=node.parentNode;
+}
+if(_1a7){
+return null;
+}
+return _1a8;
+};
+dojo.dom.getAncestorsByTag=function(node,tag,_1ac){
+tag=tag.toLowerCase();
+return dojo.dom.getAncestors(node,function(el){
+return ((el.tagName)&&(el.tagName.toLowerCase()==tag));
+},_1ac);
+};
+dojo.dom.getFirstAncestorByTag=function(node,tag){
+return dojo.dom.getAncestorsByTag(node,tag,true);
+};
+dojo.dom.isDescendantOf=function(node,_1b1,_1b2){
+if(_1b2&&node){
+node=node.parentNode;
+}
+while(node){
+if(node==_1b1){
+return true;
+}
+node=node.parentNode;
+}
+return false;
+};
+dojo.dom.innerXML=function(node){
+if(node.innerXML){
+return node.innerXML;
+}else{
+if(typeof XMLSerializer!="undefined"){
+return (new XMLSerializer()).serializeToString(node);
+}
+}
+};
+dojo.dom.createDocumentFromText=function(str,_1b5){
+if(!_1b5){
+_1b5="text/xml";
+}
+if(typeof DOMParser!="undefined"){
+var _1b6=new DOMParser();
+return _1b6.parseFromString(str,_1b5);
+}else{
+if(typeof ActiveXObject!="undefined"){
+var _1b7=new ActiveXObject("Microsoft.XMLDOM");
+if(_1b7){
+_1b7.async=false;
+_1b7.loadXML(str);
+return _1b7;
+}else{
+dojo.debug("toXml didn't work?");
+}
+}else{
+if(document.createElement){
+var tmp=document.createElement("xml");
+tmp.innerHTML=str;
+if(document.implementation&&document.implementation.createDocument){
+var _1b9=document.implementation.createDocument("foo","",null);
+for(var i=0;i<tmp.childNodes.length;i++){
+_1b9.importNode(tmp.childNodes.item(i),true);
+}
+return _1b9;
+}
+return tmp.document&&tmp.document.firstChild?tmp.document.firstChild:tmp;
+}
+}
+}
+return null;
+};
+dojo.dom.prependChild=function(node,_1bc){
+if(_1bc.firstChild){
+_1bc.insertBefore(node,_1bc.firstChild);
+}else{
+_1bc.appendChild(node);
+}
+return true;
+};
+dojo.dom.insertBefore=function(node,ref,_1bf){
+if(_1bf!=true&&(node===ref||node.nextSibling===ref)){
+return false;
+}
+var _1c0=ref.parentNode;
+_1c0.insertBefore(node,ref);
+return true;
+};
+dojo.dom.insertAfter=function(node,ref,_1c3){
+var pn=ref.parentNode;
+if(ref==pn.lastChild){
+if((_1c3!=true)&&(node===ref)){
+return false;
+}
+pn.appendChild(node);
+}else{
+return this.insertBefore(node,ref.nextSibling,_1c3);
+}
+return true;
+};
+dojo.dom.insertAtPosition=function(node,ref,_1c7){
+if((!node)||(!ref)||(!_1c7)){
+return false;
+}
+switch(_1c7.toLowerCase()){
+case "before":
+return dojo.dom.insertBefore(node,ref);
+case "after":
+return dojo.dom.insertAfter(node,ref);
+case "first":
+if(ref.firstChild){
+return dojo.dom.insertBefore(node,ref.firstChild);
+}else{
+ref.appendChild(node);
+return true;
+}
+break;
+default:
+ref.appendChild(node);
+return true;
+}
+};
+dojo.dom.insertAtIndex=function(node,_1c9,_1ca){
+var _1cb=_1c9.childNodes;
+if(!_1cb.length){
+_1c9.appendChild(node);
+return true;
+}
+var _1cc=null;
+for(var i=0;i<_1cb.length;i++){
+var _1ce=_1cb.item(i)["getAttribute"]?parseInt(_1cb.item(i).getAttribute("dojoinsertionindex")):-1;
+if(_1ce<_1ca){
+_1cc=_1cb.item(i);
+}
+}
+if(_1cc){
+return dojo.dom.insertAfter(node,_1cc);
+}else{
+return dojo.dom.insertBefore(node,_1cb.item(0));
+}
+};
+dojo.dom.textContent=function(node,text){
+if(text){
+dojo.dom.replaceChildren(node,document.createTextNode(text));
+return text;
+}else{
+var _1d1="";
+if(node==null){
+return _1d1;
+}
+for(var i=0;i<node.childNodes.length;i++){
+switch(node.childNodes[i].nodeType){
+case 1:
+case 5:
+_1d1+=dojo.dom.textContent(node.childNodes[i]);
+break;
+case 3:
+case 2:
+case 4:
+_1d1+=node.childNodes[i].nodeValue;
+break;
+default:
+break;
+}
+}
+return _1d1;
+}
+};
+dojo.dom.collectionToArray=function(_1d3){
+dojo.deprecated("dojo.dom.collectionToArray","use dojo.lang.toArray instead");
+return dojo.lang.toArray(_1d3);
+};
+dojo.dom.hasParent=function(node){
+if(!node||!node.parentNode||(node.parentNode&&!node.parentNode.tagName)){
+return false;
+}
+return true;
+};
+dojo.dom.isTag=function(node){
+if(node&&node.tagName){
+var arr=dojo.lang.toArray(arguments,1);
+return arr[dojo.lang.find(node.tagName,arr)]||"";
+}
+return "";
+};
+dojo.provide("dojo.io.BrowserIO");
+dojo.require("dojo.io");
+dojo.require("dojo.lang");
+dojo.require("dojo.dom");
+try{
+if((!djConfig["preventBackButtonFix"])&&(!dojo.hostenv.post_load_)){
+document.write("<iframe style='border: 0px; width: 1px; height: 1px; position: absolute; bottom: 0px; right: 0px; visibility: visible;' name='djhistory' id='djhistory' src='"+(dojo.hostenv.getBaseScriptUri()+"iframe_history.html")+"'></iframe>");
+}
+}
+catch(e){
+}
+dojo.io.checkChildrenForFile=function(node){
+var _1d8=false;
+var _1d9=node.getElementsByTagName("input");
+dojo.lang.forEach(_1d9,function(_1da){
+if(_1d8){
+return;
+}
+if(_1da.getAttribute("type")=="file"){
+_1d8=true;
+}
+});
+return _1d8;
+};
+dojo.io.formHasFile=function(_1db){
+return dojo.io.checkChildrenForFile(_1db);
+};
+dojo.io.encodeForm=function(_1dc,_1dd){
+if((!_1dc)||(!_1dc.tagName)||(!_1dc.tagName.toLowerCase()=="form")){
+dojo.raise("Attempted to encode a non-form element.");
+}
+var enc=/utf/i.test(_1dd||"")?encodeURIComponent:dojo.string.encodeAscii;
+var _1df=[];
+for(var i=0;i<_1dc.elements.length;i++){
+var elm=_1dc.elements[i];
+if(elm.disabled||elm.tagName.toLowerCase()=="fieldset"||!elm.name){
+continue;
+}
+var name=enc(elm.name);
+var type=elm.type.toLowerCase();
+if(type=="select-multiple"){
+for(var j=0;j<elm.options.length;j++){
+if(elm.options[j].selected){
+_1df.push(name+"="+enc(elm.options[j].value));
+}
+}
+}else{
+if(dojo.lang.inArray(type,["radio","checkbox"])){
+if(elm.checked){
+_1df.push(name+"="+enc(elm.value));
+}
+}else{
+if(!dojo.lang.inArray(type,["file","submit","reset","button"])){
+_1df.push(name+"="+enc(elm.value));
+}
+}
+}
+}
+var _1e5=_1dc.getElementsByTagName("input");
+for(var i=0;i<_1e5.length;i++){
+var _1e6=_1e5[i];
+if(_1e6.type.toLowerCase()=="image"&&_1e6.form==_1dc){
+var name=enc(_1e6.name);
+_1df.push(name+"="+enc(_1e6.value));
+_1df.push(name+".x=0");
+_1df.push(name+".y=0");
+}
+}
+return _1df.join("&")+"&";
+};
+dojo.io.setIFrameSrc=function(_1e7,src,_1e9){
+try{
+var r=dojo.render.html;
+if(!_1e9){
+if(r.safari){
+_1e7.location=src;
+}else{
+frames[_1e7.name].location=src;
+}
+}else{
+var idoc;
+if(r.ie){
+idoc=_1e7.contentWindow.document;
+}else{
+if(r.moz){
+idoc=_1e7.contentWindow;
+}else{
+if(r.safari){
+idoc=_1e7.document;
+}
+}
+}
+idoc.location.replace(src);
+}
+}
+catch(e){
+dojo.debug(e);
+dojo.debug("setIFrameSrc: "+e);
+}
+};
+dojo.io.XMLHTTPTransport=new function(){
+var _1ec=this;
+this.initialHref=window.location.href;
+this.initialHash=window.location.hash;
+this.moveForward=false;
+var _1ed={};
+this.useCache=false;
+this.preventCache=false;
+this.historyStack=[];
+this.forwardStack=[];
+this.historyIframe=null;
+this.bookmarkAnchor=null;
+this.locationTimer=null;
+function getCacheKey(url,_1ef,_1f0){
+return url+"|"+_1ef+"|"+_1f0.toLowerCase();
+}
+function addToCache(url,_1f2,_1f3,http){
+_1ed[getCacheKey(url,_1f2,_1f3)]=http;
+}
+function getFromCache(url,_1f6,_1f7){
+return _1ed[getCacheKey(url,_1f6,_1f7)];
+}
+this.clearCache=function(){
+_1ed={};
+};
+function doLoad(_1f8,http,url,_1fb,_1fc){
+if((http.status==200)||(location.protocol=="file:"&&http.status==0)){
+var ret;
+if(_1f8.method.toLowerCase()=="head"){
+var _1fe=http.getAllResponseHeaders();
+ret={};
+ret.toString=function(){
+return _1fe;
+};
+var _1ff=_1fe.split(/[\r\n]+/g);
+for(var i=0;i<_1ff.length;i++){
+var pair=_1ff[i].match(/^([^:]+)\s*:\s*(.+)$/i);
+if(pair){
+ret[pair[1]]=pair[2];
+}
+}
+}else{
+if(_1f8.mimetype=="text/javascript"){
+try{
+ret=dj_eval(http.responseText);
+}
+catch(e){
+dojo.debug(e);
+dojo.debug(http.responseText);
+ret=null;
+}
+}else{
+if(_1f8.mimetype=="text/json"){
+try{
+ret=dj_eval("("+http.responseText+")");
+}
+catch(e){
+dojo.debug(e);
+dojo.debug(http.responseText);
+ret=false;
+}
+}else{
+if((_1f8.mimetype=="application/xml")||(_1f8.mimetype=="text/xml")){
+ret=http.responseXML;
+if(!ret||typeof ret=="string"){
+ret=dojo.dom.createDocumentFromText(http.responseText);
+}
+}else{
+ret=http.responseText;
+}
+}
+}
+}
+if(_1fc){
+addToCache(url,_1fb,_1f8.method,http);
+}
+_1f8[(typeof _1f8.load=="function")?"load":"handle"]("load",ret,http);
+}else{
+var _202=new dojo.io.Error("XMLHttpTransport Error: "+http.status+" "+http.statusText);
+_1f8[(typeof _1f8.error=="function")?"error":"handle"]("error",_202,http);
+}
+}
+function setHeaders(http,_204){
+if(_204["headers"]){
+for(var _205 in _204["headers"]){
+if(_205.toLowerCase()=="content-type"&&!_204["contentType"]){
+_204["contentType"]=_204["headers"][_205];
+}else{
+http.setRequestHeader(_205,_204["headers"][_205]);
+}
+}
+}
+}
+this.addToHistory=function(args){
+var _207=args["back"]||args["backButton"]||args["handle"];
+var hash=null;
+if(!this.historyIframe){
+this.historyIframe=window.frames["djhistory"];
+}
+if(!this.bookmarkAnchor){
+this.bookmarkAnchor=document.createElement("a");
+(document.body||document.getElementsByTagName("body")[0]).appendChild(this.bookmarkAnchor);
+this.bookmarkAnchor.style.display="none";
+}
+if((!args["changeUrl"])||(dojo.render.html.ie)){
+var url=dojo.hostenv.getBaseScriptUri()+"iframe_history.html?"+(new Date()).getTime();
+this.moveForward=true;
+dojo.io.setIFrameSrc(this.historyIframe,url,false);
+}
+if(args["changeUrl"]){
+hash="#"+((args["changeUrl"]!==true)?args["changeUrl"]:(new Date()).getTime());
+setTimeout("window.location.href = '"+hash+"';",1);
+this.bookmarkAnchor.href=hash;
+if(dojo.render.html.ie){
+var _20a=_207;
+var lh=null;
+var hsl=this.historyStack.length-1;
+if(hsl>=0){
+while(!this.historyStack[hsl]["urlHash"]){
+hsl--;
+}
+lh=this.historyStack[hsl]["urlHash"];
+}
+if(lh){
+_207=function(){
+if(window.location.hash!=""){
+setTimeout("window.location.href = '"+lh+"';",1);
+}
+_20a();
+};
+}
+this.forwardStack=[];
+var _20d=args["forward"]||args["forwardButton"];
+var tfw=function(){
+if(window.location.hash!=""){
+window.location.href=hash;
+}
+if(_20d){
+_20d();
+}
+};
+if(args["forward"]){
+args.forward=tfw;
+}else{
+if(args["forwardButton"]){
+args.forwardButton=tfw;
+}
+}
+}else{
+if(dojo.render.html.moz){
+if(!this.locationTimer){
+this.locationTimer=setInterval("dojo.io.XMLHTTPTransport.checkLocation();",200);
+}
+}
+}
+}
+this.historyStack.push({"url":url,"callback":_207,"kwArgs":args,"urlHash":hash});
+};
+this.checkLocation=function(){
+var hsl=this.historyStack.length;
+if((window.location.hash==this.initialHash)||(window.location.href==this.initialHref)&&(hsl==1)){
+this.handleBackButton();
+return;
+}
+if(this.forwardStack.length>0){
+if(this.forwardStack[this.forwardStack.length-1].urlHash==window.location.hash){
+this.handleForwardButton();
+return;
+}
+}
+if((hsl>=2)&&(this.historyStack[hsl-2])){
+if(this.historyStack[hsl-2].urlHash==window.location.hash){
+this.handleBackButton();
+return;
+}
+}
+};
+this.iframeLoaded=function(evt,_211){
+var isp=_211.href.split("?");
+if(isp.length<2){
+if(this.historyStack.length==1){
+this.handleBackButton();
+}
+return;
+}
+var _213=isp[1];
+if(this.moveForward){
+this.moveForward=false;
+return;
+}
+var last=this.historyStack.pop();
+if(!last){
+if(this.forwardStack.length>0){
+var next=this.forwardStack[this.forwardStack.length-1];
+if(_213==next.url.split("?")[1]){
+this.handleForwardButton();
+}
+}
+return;
+}
+this.historyStack.push(last);
+if(this.historyStack.length>=2){
+if(isp[1]==this.historyStack[this.historyStack.length-2].url.split("?")[1]){
+this.handleBackButton();
+}
+}else{
+this.handleBackButton();
+}
+};
+this.handleBackButton=function(){
+var last=this.historyStack.pop();
+if(!last){
+return;
+}
+if(last["callback"]){
+last.callback();
+}else{
+if(last.kwArgs["backButton"]){
+last.kwArgs["backButton"]();
+}else{
+if(last.kwArgs["back"]){
+last.kwArgs["back"]();
+}else{
+if(last.kwArgs["handle"]){
+last.kwArgs.handle("back");
+}
+}
+}
+}
+this.forwardStack.push(last);
+};
+this.handleForwardButton=function(){
+var last=this.forwardStack.pop();
+if(!last){
+return;
+}
+if(last.kwArgs["forward"]){
+last.kwArgs.forward();
+}else{
+if(last.kwArgs["forwardButton"]){
+last.kwArgs.forwardButton();
+}else{
+if(last.kwArgs["handle"]){
+last.kwArgs.handle("forward");
+}
+}
+}
+this.historyStack.push(last);
+};
+this.inFlight=[];
+this.inFlightTimer=null;
+this.startWatchingInFlight=function(){
+if(!this.inFlightTimer){
+this.inFlightTimer=setInterval("dojo.io.XMLHTTPTransport.watchInFlight();",10);
+}
+};
+this.watchInFlight=function(){
+for(var x=this.inFlight.length-1;x>=0;x--){
+var tif=this.inFlight[x];
+if(!tif){
+this.inFlight.splice(x,1);
+continue;
+}
+if(4==tif.http.readyState){
+this.inFlight.splice(x,1);
+doLoad(tif.req,tif.http,tif.url,tif.query,tif.useCache);
+if(this.inFlight.length==0){
+clearInterval(this.inFlightTimer);
+this.inFlightTimer=null;
+}
+}
+}
+};
+var _21a=dojo.hostenv.getXmlhttpObject()?true:false;
+this.canHandle=function(_21b){
+return _21a&&dojo.lang.inArray((_21b["mimetype"]||"".toLowerCase()),["text/plain","text/html","application/xml","text/xml","text/javascript","text/json"])&&dojo.lang.inArray(_21b["method"].toLowerCase(),["post","get","head"])&&!(_21b["formNode"]&&dojo.io.formHasFile(_21b["formNode"]));
+};
+this.multipartBoundary="45309FFF-BD65-4d50-99C9-36986896A96F";
+this.bind=function(_21c){
+if(!_21c["url"]){
+if(!_21c["formNode"]&&(_21c["backButton"]||_21c["back"]||_21c["changeUrl"]||_21c["watchForURL"])&&(!djConfig.preventBackButtonFix)){
+this.addToHistory(_21c);
+return true;
+}
+}
+var url=_21c.url;
+var _21e="";
+if(_21c["formNode"]){
+var ta=_21c.formNode.getAttribute("action");
+if((ta)&&(!_21c["url"])){
+url=ta;
+}
+var tp=_21c.formNode.getAttribute("method");
+if((tp)&&(!_21c["method"])){
+_21c.method=tp;
+}
+_21e+=dojo.io.encodeForm(_21c.formNode,_21c.encoding);
+}
+if(url.indexOf("#")>-1){
+dojo.debug("Warning: dojo.io.bind: stripping hash values from url:",url);
+url=url.split("#")[0];
+}
+if(_21c["file"]){
+_21c.method="post";
+}
+if(!_21c["method"]){
+_21c.method="get";
+}
+if(_21c.method.toLowerCase()=="get"){
+_21c.multipart=false;
+}else{
+if(_21c["file"]){
+_21c.multipart=true;
+}else{
+if(!_21c["multipart"]){
+_21c.multipart=false;
+}
+}
+}
+if(_21c["backButton"]||_21c["back"]||_21c["changeUrl"]){
+this.addToHistory(_21c);
+}
+var _221=_21c["content"]||{};
+if(_21c.sendTransport){
+_221["dojo.transport"]="xmlhttp";
+}
+do{
+if(_21c.postContent){
+_21e=_21c.postContent;
+break;
+}
+if(_221){
+_21e+=dojo.io.argsFromMap(_221,_21c.encoding);
+}
+if(_21c.method.toLowerCase()=="get"||!_21c.multipart){
+break;
+}
+var t=[];
+if(_21e.length){
+var q=_21e.split("&");
+for(var i=0;i<q.length;++i){
+if(q[i].length){
+var p=q[i].split("=");
+t.push("--"+this.multipartBoundary,"Content-Disposition: form-data; name=\""+p[0]+"\"","",p[1]);
+}
+}
+}
+if(_21c.file){
+if(dojo.lang.isArray(_21c.file)){
+for(var i=0;i<_21c.file.length;++i){
+var o=_21c.file[i];
+t.push("--"+this.multipartBoundary,"Content-Disposition: form-data; name=\""+o.name+"\"; filename=\""+("fileName" in o?o.fileName:o.name)+"\"","Content-Type: "+("contentType" in o?o.contentType:"application/octet-stream"),"",o.content);
+}
+}else{
+var o=_21c.file;
+t.push("--"+this.multipartBoundary,"Content-Disposition: form-data; name=\""+o.name+"\"; filename=\""+("fileName" in o?o.fileName:o.name)+"\"","Content-Type: "+("contentType" in o?o.contentType:"application/octet-stream"),"",o.content);
+}
+}
+if(t.length){
+t.push("--"+this.multipartBoundary+"--","");
+_21e=t.join("\r\n");
+}
+}while(false);
+var _227=_21c["sync"]?false:true;
+var _228=_21c["preventCache"]||(this.preventCache==true&&_21c["preventCache"]!=false);
+var _229=_21c["useCache"]==true||(this.useCache==true&&_21c["useCache"]!=false);
+if(!_228&&_229){
+var _22a=getFromCache(url,_21e,_21c.method);
+if(_22a){
+doLoad(_21c,_22a,url,_21e,false);
+return;
+}
+}
+var http=dojo.hostenv.getXmlhttpObject();
+var _22c=false;
+if(_227){
+this.inFlight.push({"req":_21c,"http":http,"url":url,"query":_21e,"useCache":_229});
+this.startWatchingInFlight();
+}
+if(_21c.method.toLowerCase()=="post"){
+http.open("POST",url,_227);
+setHeaders(http,_21c);
+http.setRequestHeader("Content-Type",_21c.multipart?("multipart/form-data; boundary="+this.multipartBoundary):(_21c.contentType||"application/x-www-form-urlencoded"));
+http.send(_21e);
+}else{
+var _22d=url;
+if(_21e!=""){
+_22d+=(_22d.indexOf("?")>-1?"&":"?")+_21e;
+}
+if(_228){
+_22d+=(dojo.string.endsWithAny(_22d,"?","&")?"":(_22d.indexOf("?")>-1?"&":"?"))+"dojo.preventCache="+new Date().valueOf();
+}
+http.open(_21c.method.toUpperCase(),_22d,_227);
+setHeaders(http,_21c);
+http.send(null);
+}
+if(!_227){
+doLoad(_21c,http,url,_21e,_229);
+}
+_21c.abort=function(){
+return http.abort();
+};
+return;
+};
+dojo.io.transports.addTransport("XMLHTTPTransport");
+};
+dojo.require("dojo.lang");
+dojo.provide("dojo.event");
+dojo.event=new function(){
+this.canTimeout=dojo.lang.isFunction(dj_global["setTimeout"])||dojo.lang.isAlien(dj_global["setTimeout"]);
+function interpolateArgs(args){
+var dl=dojo.lang;
+var ao={srcObj:dj_global,srcFunc:null,adviceObj:dj_global,adviceFunc:null,aroundObj:null,aroundFunc:null,adviceType:(args.length>2)?args[0]:"after",precedence:"last",once:false,delay:null,rate:0,adviceMsg:false};
+switch(args.length){
+case 0:
+return;
+case 1:
+return;
+case 2:
+ao.srcFunc=args[0];
+ao.adviceFunc=args[1];
+break;
+case 3:
+if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isString(args[2]))){
+ao.adviceType="after";
+ao.srcObj=args[0];
+ao.srcFunc=args[1];
+ao.adviceFunc=args[2];
+}else{
+if((dl.isString(args[1]))&&(dl.isString(args[2]))){
+ao.srcFunc=args[1];
+ao.adviceFunc=args[2];
+}else{
+if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isFunction(args[2]))){
+ao.adviceType="after";
+ao.srcObj=args[0];
+ao.srcFunc=args[1];
+var _231=dojo.lang.nameAnonFunc(args[2],ao.adviceObj);
+ao.adviceFunc=_231;
+}else{
+if((dl.isFunction(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))){
+ao.adviceType="after";
+ao.srcObj=dj_global;
+var _231=dojo.lang.nameAnonFunc(args[0],ao.srcObj);
+ao.srcFunc=_231;
+ao.adviceObj=args[1];
+ao.adviceFunc=args[2];
+}
+}
+}
+}
+break;
+case 4:
+if((dl.isObject(args[0]))&&(dl.isObject(args[2]))){
+ao.adviceType="after";
+ao.srcObj=args[0];
+ao.srcFunc=args[1];
+ao.adviceObj=args[2];
+ao.adviceFunc=args[3];
+}else{
+if((dl.isString(args[0]))&&(dl.isString(args[1]))&&(dl.isObject(args[2]))){
+ao.adviceType=args[0];
+ao.srcObj=dj_global;
+ao.srcFunc=args[1];
+ao.adviceObj=args[2];
+ao.adviceFunc=args[3];
+}else{
+if((dl.isString(args[0]))&&(dl.isFunction(args[1]))&&(dl.isObject(args[2]))){
+ao.adviceType=args[0];
+ao.srcObj=dj_global;
+var _231=dojo.lang.nameAnonFunc(args[1],dj_global);
+ao.srcFunc=_231;
+ao.adviceObj=args[2];
+ao.adviceFunc=args[3];
+}else{
+if(dl.isObject(args[1])){
+ao.srcObj=args[1];
+ao.srcFunc=args[2];
+ao.adviceObj=dj_global;
+ao.adviceFunc=args[3];
+}else{
+if(dl.isObject(args[2])){
+ao.srcObj=dj_global;
+ao.srcFunc=args[1];
+ao.adviceObj=args[2];
+ao.adviceFunc=args[3];
+}else{
+ao.srcObj=ao.adviceObj=ao.aroundObj=dj_global;
+ao.srcFunc=args[1];
+ao.adviceFunc=args[2];
+ao.aroundFunc=args[3];
+}
+}
+}
+}
+}
+break;
+case 6:
+ao.srcObj=args[1];
+ao.srcFunc=args[2];
+ao.adviceObj=args[3];
+ao.adviceFunc=args[4];
+ao.aroundFunc=args[5];
+ao.aroundObj=dj_global;
+break;
+default:
+ao.srcObj=args[1];
+ao.srcFunc=args[2];
+ao.adviceObj=args[3];
+ao.adviceFunc=args[4];
+ao.aroundObj=args[5];
+ao.aroundFunc=args[6];
+ao.once=args[7];
+ao.delay=args[8];
+ao.rate=args[9];
+ao.adviceMsg=args[10];
+break;
+}
+if((typeof ao.srcFunc).toLowerCase()!="string"){
+ao.srcFunc=dojo.lang.getNameInObj(ao.srcObj,ao.srcFunc);
+}
+if((typeof ao.adviceFunc).toLowerCase()!="string"){
+ao.adviceFunc=dojo.lang.getNameInObj(ao.adviceObj,ao.adviceFunc);
+}
+if((ao.aroundObj)&&((typeof ao.aroundFunc).toLowerCase()!="string")){
+ao.aroundFunc=dojo.lang.getNameInObj(ao.aroundObj,ao.aroundFunc);
+}
+if(!ao.srcObj){
+dojo.raise("bad srcObj for srcFunc: "+ao.srcFunc);
+}
+if(!ao.adviceObj){
+dojo.raise("bad adviceObj for adviceFunc: "+ao.adviceFunc);
+}
+return ao;
+}
+this.connect=function(){
+var ao=interpolateArgs(arguments);
+var mjp=dojo.event.MethodJoinPoint.getForMethod(ao.srcObj,ao.srcFunc);
+if(ao.adviceFunc){
+var mjp2=dojo.event.MethodJoinPoint.getForMethod(ao.adviceObj,ao.adviceFunc);
+}
+mjp.kwAddAdvice(ao);
+return mjp;
+};
+this.connectBefore=function(){
+var args=["before"];
+for(var i=0;i<arguments.length;i++){
+args.push(arguments[i]);
+}
+return this.connect.apply(this,args);
+};
+this.connectAround=function(){
+var args=["around"];
+for(var i=0;i<arguments.length;i++){
+args.push(arguments[i]);
+}
+return this.connect.apply(this,args);
+};
+this._kwConnectImpl=function(_239,_23a){
+var fn=(_23a)?"disconnect":"connect";
+if(typeof _239["srcFunc"]=="function"){
+_239.srcObj=_239["srcObj"]||dj_global;
+var _23c=dojo.lang.nameAnonFunc(_239.srcFunc,_239.srcObj);
+_239.srcFunc=_23c;
+}
+if(typeof _239["adviceFunc"]=="function"){
+_239.adviceObj=_239["adviceObj"]||dj_global;
+var _23c=dojo.lang.nameAnonFunc(_239.adviceFunc,_239.adviceObj);
+_239.adviceFunc=_23c;
+}
+return dojo.event[fn]((_239["type"]||_239["adviceType"]||"after"),_239["srcObj"]||dj_global,_239["srcFunc"],_239["adviceObj"]||_239["targetObj"]||dj_global,_239["adviceFunc"]||_239["targetFunc"],_239["aroundObj"],_239["aroundFunc"],_239["once"],_239["delay"],_239["rate"],_239["adviceMsg"]||false);
+};
+this.kwConnect=function(_23d){
+return this._kwConnectImpl(_23d,false);
+};
+this.disconnect=function(){
+var ao=interpolateArgs(arguments);
+if(!ao.adviceFunc){
+return;
+}
+var mjp=dojo.event.MethodJoinPoint.getForMethod(ao.srcObj,ao.srcFunc);
+return mjp.removeAdvice(ao.adviceObj,ao.adviceFunc,ao.adviceType,ao.once);
+};
+this.kwDisconnect=function(_240){
+return this._kwConnectImpl(_240,true);
+};
+};
+dojo.event.MethodInvocation=function(_241,obj,args){
+this.jp_=_241;
+this.object=obj;
+this.args=[];
+for(var x=0;x<args.length;x++){
+this.args[x]=args[x];
+}
+this.around_index=-1;
+};
+dojo.event.MethodInvocation.prototype.proceed=function(){
+this.around_index++;
+if(this.around_index>=this.jp_.around.length){
+return this.jp_.object[this.jp_.methodname].apply(this.jp_.object,this.args);
+}else{
+var ti=this.jp_.around[this.around_index];
+var mobj=ti[0]||dj_global;
+var meth=ti[1];
+return mobj[meth].call(mobj,this);
+}
+};
+dojo.event.MethodJoinPoint=function(obj,_249){
+this.object=obj||dj_global;
+this.methodname=_249;
+this.methodfunc=this.object[_249];
+this.before=[];
+this.after=[];
+this.around=[];
+};
+dojo.event.MethodJoinPoint.getForMethod=function(obj,_24b){
+if(!obj){
+obj=dj_global;
+}
+if(!obj[_24b]){
+obj[_24b]=function(){
+};
+}else{
+if((!dojo.lang.isFunction(obj[_24b]))&&(!dojo.lang.isAlien(obj[_24b]))){
+return null;
+}
+}
+var _24c=_24b+"$joinpoint";
+var _24d=_24b+"$joinpoint$method";
+var _24e=obj[_24c];
+if(!_24e){
+var _24f=false;
+if(dojo.event["browser"]){
+if((obj["attachEvent"])||(obj["nodeType"])||(obj["addEventListener"])){
+_24f=true;
+dojo.event.browser.addClobberNodeAttrs(obj,[_24c,_24d,_24b]);
+}
+}
+obj[_24d]=obj[_24b];
+_24e=obj[_24c]=new dojo.event.MethodJoinPoint(obj,_24d);
+obj[_24b]=function(){
+var args=[];
+if((_24f)&&(!arguments.length)&&(window.event)){
+args.push(dojo.event.browser.fixEvent(window.event));
+}else{
+for(var x=0;x<arguments.length;x++){
+if((x==0)&&(_24f)&&(dojo.event.browser.isEvent(arguments[x]))){
+args.push(dojo.event.browser.fixEvent(arguments[x]));
+}else{
+args.push(arguments[x]);
+}
+}
+}
+return _24e.run.apply(_24e,args);
+};
+}
+return _24e;
+};
+dojo.lang.extend(dojo.event.MethodJoinPoint,{unintercept:function(){
+this.object[this.methodname]=this.methodfunc;
+},run:function(){
+var obj=this.object||dj_global;
+var args=arguments;
+var _254=[];
+for(var x=0;x<args.length;x++){
+_254[x]=args[x];
+}
+var _256=function(marr){
+if(!marr){
+dojo.debug("Null argument to unrollAdvice()");
+return;
+}
+var _258=marr[0]||dj_global;
+var _259=marr[1];
+if(!_258[_259]){
+dojo.raise("function \""+_259+"\" does not exist on \""+_258+"\"");
+}
+var _25a=marr[2]||dj_global;
+var _25b=marr[3];
+var msg=marr[6];
+var _25d;
+var to={args:[],jp_:this,object:obj,proceed:function(){
+return _258[_259].apply(_258,to.args);
+}};
+to.args=_254;
+var _25f=parseInt(marr[4]);
+var _260=((!isNaN(_25f))&&(marr[4]!==null)&&(typeof marr[4]!="undefined"));
+if(marr[5]){
+var rate=parseInt(marr[5]);
+var cur=new Date();
+var _263=false;
+if((marr["last"])&&((cur-marr.last)<=rate)){
+if(dojo.event.canTimeout){
+if(marr["delayTimer"]){
+clearTimeout(marr.delayTimer);
+}
+var tod=parseInt(rate*2);
+var mcpy=dojo.lang.shallowCopy(marr);
+marr.delayTimer=setTimeout(function(){
+mcpy[5]=0;
+_256(mcpy);
+},tod);
+}
+return;
+}else{
+marr.last=cur;
+}
+}
+if(_25b){
+_25a[_25b].call(_25a,to);
+}else{
+if((_260)&&((dojo.render.html)||(dojo.render.svg))){
+dj_global["setTimeout"](function(){
+if(msg){
+_258[_259].call(_258,to);
+}else{
+_258[_259].apply(_258,args);
+}
+},_25f);
+}else{
+if(msg){
+_258[_259].call(_258,to);
+}else{
+_258[_259].apply(_258,args);
+}
+}
+}
+};
+if(this.before.length>0){
+dojo.lang.forEach(this.before,_256,true);
+}
+var _266;
+if(this.around.length>0){
+var mi=new dojo.event.MethodInvocation(this,obj,args);
+_266=mi.proceed();
+}else{
+if(this.methodfunc){
+_266=this.object[this.methodname].apply(this.object,args);
+}
+}
+if(this.after.length>0){
+dojo.lang.forEach(this.after,_256,true);
+}
+return (this.methodfunc)?_266:null;
+},getArr:function(kind){
+var arr=this.after;
+if((typeof kind=="string")&&(kind.indexOf("before")!=-1)){
+arr=this.before;
+}else{
+if(kind=="around"){
+arr=this.around;
+}
+}
+return arr;
+},kwAddAdvice:function(args){
+this.addAdvice(args["adviceObj"],args["adviceFunc"],args["aroundObj"],args["aroundFunc"],args["adviceType"],args["precedence"],args["once"],args["delay"],args["rate"],args["adviceMsg"]);
+},addAdvice:function(_26b,_26c,_26d,_26e,_26f,_270,once,_272,rate,_274){
+var arr=this.getArr(_26f);
+if(!arr){
+dojo.raise("bad this: "+this);
+}
+var ao=[_26b,_26c,_26d,_26e,_272,rate,_274];
+if(once){
+if(this.hasAdvice(_26b,_26c,_26f,arr)>=0){
+return;
+}
+}
+if(_270=="first"){
+arr.unshift(ao);
+}else{
+arr.push(ao);
+}
+},hasAdvice:function(_277,_278,_279,arr){
+if(!arr){
+arr=this.getArr(_279);
+}
+var ind=-1;
+for(var x=0;x<arr.length;x++){
+if((arr[x][0]==_277)&&(arr[x][1]==_278)){
+ind=x;
+}
+}
+return ind;
+},removeAdvice:function(_27d,_27e,_27f,once){
+var arr=this.getArr(_27f);
+var ind=this.hasAdvice(_27d,_27e,_27f,arr);
+if(ind==-1){
+return false;
+}
+while(ind!=-1){
+arr.splice(ind,1);
+if(once){
+break;
+}
+ind=this.hasAdvice(_27d,_27e,_27f,arr);
+}
+return true;
+}});
+dojo.require("dojo.event");
+dojo.provide("dojo.event.topic");
+dojo.event.topic=new function(){
+this.topics={};
+this.getTopic=function(_283){
+if(!this.topics[_283]){
+this.topics[_283]=new this.TopicImpl(_283);
+}
+return this.topics[_283];
+};
+this.registerPublisher=function(_284,obj,_286){
+var _284=this.getTopic(_284);
+_284.registerPublisher(obj,_286);
+};
+this.subscribe=function(_287,obj,_289){
+var _287=this.getTopic(_287);
+_287.subscribe(obj,_289);
+};
+this.unsubscribe=function(_28a,obj,_28c){
+var _28a=this.getTopic(_28a);
+_28a.unsubscribe(obj,_28c);
+};
+this.publish=function(_28d,_28e){
+var _28d=this.getTopic(_28d);
+var args=[];
+if((arguments.length==2)&&(_28e.length)&&(typeof _28e!="string")){
+args=_28e;
+}else{
+var args=[];
+for(var x=1;x<arguments.length;x++){
+args.push(arguments[x]);
+}
+}
+_28d.sendMessage.apply(_28d,args);
+};
+};
+dojo.event.topic.TopicImpl=function(_291){
+this.topicName=_291;
+var self=this;
+self.subscribe=function(_293,_294){
+var tf=_294||_293;
+var to=(!_294)?dj_global:_293;
+dojo.event.kwConnect({srcObj:self,srcFunc:"sendMessage",adviceObj:to,adviceFunc:tf});
+};
+self.unsubscribe=function(_297,_298){
+var tf=(!_298)?_297:_298;
+var to=(!_298)?null:_297;
+dojo.event.kwDisconnect({srcObj:self,srcFunc:"sendMessage",adviceObj:to,adviceFunc:tf});
+};
+self.registerPublisher=function(_29b,_29c){
+dojo.event.connect(_29b,_29c,self,"sendMessage");
+};
+self.sendMessage=function(_29d){
+};
+};
+dojo.provide("dojo.event.browser");
+dojo.require("dojo.event");
+dojo_ie_clobber=new function(){
+this.clobberNodes=[];
+function nukeProp(node,prop){
+try{
+node[prop]=null;
+}
+catch(e){
+}
+try{
+delete node[prop];
+}
+catch(e){
+}
+try{
+node.removeAttribute(prop);
+}
+catch(e){
+}
+}
+this.clobber=function(_2a0){
+var na;
+var tna;
+if(_2a0){
+tna=_2a0.getElementsByTagName("*");
+na=[_2a0];
+for(var x=0;x<tna.length;x++){
+if(tna[x]["__doClobber__"]){
+na.push(tna[x]);
+}
+}
+}else{
+try{
+window.onload=null;
+}
+catch(e){
+}
+na=(this.clobberNodes.length)?this.clobberNodes:document.all;
+}
+tna=null;
+var _2a4={};
+for(var i=na.length-1;i>=0;i=i-1){
+var el=na[i];
+if(el["__clobberAttrs__"]){
+for(var j=0;j<el.__clobberAttrs__.length;j++){
+nukeProp(el,el.__clobberAttrs__[j]);
+}
+nukeProp(el,"__clobberAttrs__");
+nukeProp(el,"__doClobber__");
+}
+}
+na=null;
+};
+};
+if(dojo.render.html.ie){
+window.onunload=function(){
+dojo_ie_clobber.clobber();
+try{
+if((dojo["widget"])&&(dojo.widget["manager"])){
+dojo.widget.manager.destroyAll();
+}
+}
+catch(e){
+}
+try{
+window.onload=null;
+}
+catch(e){
+}
+try{
+window.onunload=null;
+}
+catch(e){
+}
+dojo_ie_clobber.clobberNodes=[];
+};
+}
+dojo.event.browser=new function(){
+var _2a8=0;
+this.clean=function(node){
+if(dojo.render.html.ie){
+dojo_ie_clobber.clobber(node);
+}
+};
+this.addClobberNode=function(node){
+if(!node["__doClobber__"]){
+node.__doClobber__=true;
+dojo_ie_clobber.clobberNodes.push(node);
+node.__clobberAttrs__=[];
+}
+};
+this.addClobberNodeAttrs=function(node,_2ac){
+this.addClobberNode(node);
+for(var x=0;x<_2ac.length;x++){
+node.__clobberAttrs__.push(_2ac[x]);
+}
+};
+this.removeListener=function(node,_2af,fp,_2b1){
+if(!_2b1){
+var _2b1=false;
+}
+_2af=_2af.toLowerCase();
+if(_2af.substr(0,2)=="on"){
+_2af=_2af.substr(2);
+}
+if(node.removeEventListener){
+node.removeEventListener(_2af,fp,_2b1);
+}
+};
+this.addListener=function(node,_2b3,fp,_2b5,_2b6){
+if(!node){
+return;
+}
+if(!_2b5){
+var _2b5=false;
+}
+_2b3=_2b3.toLowerCase();
+if(_2b3.substr(0,2)!="on"){
+_2b3="on"+_2b3;
+}
+if(!_2b6){
+var _2b7=function(evt){
+if(!evt){
+evt=window.event;
+}
+var ret=fp(dojo.event.browser.fixEvent(evt));
+if(_2b5){
+dojo.event.browser.stopEvent(evt);
+}
+return ret;
+};
+}else{
+_2b7=fp;
+}
+if(node.addEventListener){
+node.addEventListener(_2b3.substr(2),_2b7,_2b5);
+return _2b7;
+}else{
+if(typeof node[_2b3]=="function"){
+var _2ba=node[_2b3];
+node[_2b3]=function(e){
+_2ba(e);
+return _2b7(e);
+};
+}else{
+node[_2b3]=_2b7;
+}
+if(dojo.render.html.ie){
+this.addClobberNodeAttrs(node,[_2b3]);
+}
+return _2b7;
+}
+};
+this.isEvent=function(obj){
+return (typeof obj!="undefined")&&(typeof Event!="undefined")&&(obj.eventPhase);
+};
+this.currentEvent=null;
+this.callListener=function(_2bd,_2be){
+if(typeof _2bd!="function"){
+dojo.raise("listener not a function: "+_2bd);
+}
+dojo.event.browser.currentEvent.currentTarget=_2be;
+return _2bd.call(_2be,dojo.event.browser.currentEvent);
+};
+this.stopPropagation=function(){
+dojo.event.browser.currentEvent.cancelBubble=true;
+};
+this.preventDefault=function(){
+dojo.event.browser.currentEvent.returnValue=false;
+};
+this.keys={KEY_BACKSPACE:8,KEY_TAB:9,KEY_ENTER:13,KEY_SHIFT:16,KEY_CTRL:17,KEY_ALT:18,KEY_PAUSE:19,KEY_CAPS_LOCK:20,KEY_ESCAPE:27,KEY_SPACE:32,KEY_PAGE_UP:33,KEY_PAGE_DOWN:34,KEY_END:35,KEY_HOME:36,KEY_LEFT_ARROW:37,KEY_UP_ARROW:38,KEY_RIGHT_ARROW:39,KEY_DOWN_ARROW:40,KEY_INSERT:45,KEY_DELETE:46,KEY_LEFT_WINDOW:91,KEY_RIGHT_WINDOW:92,KEY_SELECT:93,KEY_F1:112,KEY_F2:113,KEY_F3:114,KEY_F4:115,KEY_F5:116,KEY_F6:117,KEY_F7:118,KEY_F8:119,KEY_F9:120,KEY_F10:121,KEY_F11:122,KEY_F12:123,KEY_NUM_LOCK:144,KEY_SCROLL_LOCK:145};
+this.revKeys=[];
+for(var key in this.keys){
+this.revKeys[this.keys[key]]=key;
+}
+this.fixEvent=function(evt){
+if((!evt)&&(window["event"])){
+var evt=window.event;
+}
+if((evt["type"])&&(evt["type"].indexOf("key")==0)){
+evt.keys=this.revKeys;
+for(var key in this.keys){
+evt[key]=this.keys[key];
+}
+if((dojo.render.html.ie)&&(evt["type"]=="keypress")){
+evt.charCode=evt.keyCode;
+}
+}
+if(dojo.render.html.ie){
+if(!evt.target){
+evt.target=evt.srcElement;
+}
+if(!evt.currentTarget){
+evt.currentTarget=evt.srcElement;
+}
+if(!evt.layerX){
+evt.layerX=evt.offsetX;
+}
+if(!evt.layerY){
+evt.layerY=evt.offsetY;
+}
+if(evt.fromElement){
+evt.relatedTarget=evt.fromElement;
+}
+if(evt.toElement){
+evt.relatedTarget=evt.toElement;
+}
+this.currentEvent=evt;
+evt.callListener=this.callListener;
+evt.stopPropagation=this.stopPropagation;
+evt.preventDefault=this.preventDefault;
+}
+return evt;
+};
+this.stopEvent=function(ev){
+if(window.event){
+ev.returnValue=false;
+ev.cancelBubble=true;
+}else{
+ev.preventDefault();
+ev.stopPropagation();
+}
+};
+};
+dojo.hostenv.conditionalLoadModule({common:["dojo.event","dojo.event.topic"],browser:["dojo.event.browser"]});
+dojo.hostenv.moduleLoaded("dojo.event.*");
+
Index: templatetags/admin_modify.py
===================================================================
--- templatetags/admin_modify.py	(revision 2653)
+++ templatetags/admin_modify.py	(working copy)
@@ -17,10 +17,6 @@
 def class_name_to_underscored(name):
     return '_'.join([s.lower() for s in word_re.findall(name)[:-1]])
 
-def include_admin_script(script_path):
-    return '<script type="text/javascript" src="%s%s"></script>' % (settings.ADMIN_MEDIA_PREFIX, script_path)
-include_admin_script = register.simple_tag(include_admin_script)
-
 def submit_row(context):
     opts = context['opts']
     change = context['change']
@@ -163,33 +159,6 @@
     return ''.join([str(f) for f in form_fields])
 output_all = register.simple_tag(output_all)
 
-def auto_populated_field_script(auto_pop_fields, change = False):
-    for field in auto_pop_fields:
-        t = []
-        if change:
-            t.append('document.getElementById("id_%s")._changed = true;' % field.name)
-        else:
-            t.append('document.getElementById("id_%s").onchange = function() { this._changed = true; };' % field.name)
-
-        add_values = ' + " " + '.join(['document.getElementById("id_%s").value' % g for g in field.prepopulate_from])
-        for f in field.prepopulate_from:
-            t.append('document.getElementById("id_%s").onkeyup = function() {' \
-                     ' var e = document.getElementById("id_%s");' \
-                     ' if(!e._changed) { e.value = URLify(%s, %s);} }; ' % (
-                     f, field.name, add_values, field.maxlength))
-    return ''.join(t)
-auto_populated_field_script = register.simple_tag(auto_populated_field_script)
-
-def filter_interface_script_maybe(bound_field):
-    f = bound_field.field
-    if f.rel and isinstance(f.rel, models.ManyToManyRel) and f.rel.filter_interface:
-       return '<script type="text/javascript">addEvent(window, "load", function(e) {' \
-              ' SelectFilter.init("id_%s", "%s", %s, "%s"); });</script>\n' % (
-              f.name, f.verbose_name, f.rel.filter_interface-1, settings.ADMIN_MEDIA_PREFIX)
-    else:
-        return ''
-filter_interface_script_maybe = register.simple_tag(filter_interface_script_maybe)
-
 def field_widget(parser, token):
     bits = token.contents.split()
     if len(bits) != 2:
Index: views/main.py
===================================================================
--- views/main.py	(revision 2653)
+++ views/main.py	(working copy)
@@ -79,33 +79,6 @@
             myappend('_' + item)
     return "".join(res)
 
-def get_javascript_imports(opts, auto_populated_fields, field_sets):
-# Put in any necessary JavaScript imports.
-    js = ['js/core.js', 'js/admin/RelatedObjectLookups.js']
-    if auto_populated_fields:
-        js.append('js/urlify.js')
-    if opts.has_field_type(models.DateTimeField) or opts.has_field_type(models.TimeField) or opts.has_field_type(models.DateField):
-        js.extend(['js/calendar.js', 'js/admin/DateTimeShortcuts.js'])
-    if opts.get_ordered_objects():
-        js.extend(['js/getElementsBySelector.js', 'js/dom-drag.js' , 'js/admin/ordering.js'])
-    if opts.admin.js:
-        js.extend(opts.admin.js)
-    seen_collapse = False
-    for field_set in field_sets:
-        if not seen_collapse and 'collapse' in field_set.classes:
-            seen_collapse = True
-            js.append('js/admin/CollapsedFieldsets.js')
-
-        for field_line in field_set:
-            try:
-                for f in field_line:
-                    if f.rel and isinstance(f, models.ManyToManyField) and f.rel.filter_interface:
-                        js.extend(['js/SelectBox.js' , 'js/SelectFilter2.js'])
-                        raise StopIteration
-            except StopIteration:
-                break
-    return js
-
 class AdminBoundField(object):
     def __init__(self, field, field_mapping, original):
         self.field = field
@@ -190,7 +163,9 @@
 def render_change_form(model, manipulator, context, add=False, change=False, form_url=''):
     opts = model._meta
     app_label = opts.app_label
-    auto_populated_fields = [f for f in opts.fields if f.prepopulate_from]
+    auto_populated_fields = add and [f for f in opts.fields if f.prepopulate_from]
+    many_to_many_filters = [f for f in opts.many_to_many if isinstance(f.rel, models.ManyToManyRel) and f.rel.filter_interface]
+    date_time_fields = [f for f in opts.fields if f.get_internal_type() in ['DateField', 'TimeField', 'DateTimeField']]
     field_sets = opts.admin.get_field_sets(opts)
     original = getattr(manipulator, 'original_object', None)
     bound_field_sets = [field_set.bind(context['form'], original, AdminBoundFieldSet) for field_set in field_sets]
@@ -201,13 +176,13 @@
         'add': add,
         'change': change,
         'has_delete_permission': context['perms'][app_label][opts.get_delete_permission()],
-        'has_change_permission': context['perms'][app_label][opts.get_change_permission()],
         'has_file_field': opts.has_field_type(models.FileField),
         'has_absolute_url': hasattr(model, 'get_absolute_url'),
         'auto_populated_fields': auto_populated_fields,
+        'many_to_many_filters': many_to_many_filters,
+        'date_time_fields': date_time_fields,
         'bound_field_sets': bound_field_sets,
         'first_form_field_id': first_form_field_id,
-        'javascript_imports': get_javascript_imports(opts, auto_populated_fields, field_sets),
         'ordered_objects': ordered_objects,
         'inline_related_objects': inline_related_objects,
         'form_url': form_url,
@@ -220,6 +195,7 @@
         "admin/%s/change_form" % app_label,
         "admin/change_form"], context_instance=context)
 
+
 def index(request):
     return render_to_response('admin/index', {'title': _('Site administration')}, context_instance=template.RequestContext(request))
 index = staff_member_required(never_cache(index))
@@ -264,7 +240,7 @@
                     post_url_continue += "?_popup=1"
                 return HttpResponseRedirect(post_url_continue % pk_value)
             if request.POST.has_key("_popup"):
-                return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %s, "%s");</script>' % \
+                return HttpResponse('<script type="text/javascript">opener.django.admin.RelatedLookups.dismissAddAnotherPopup(window, %s, "%s");</script>' % \
                     (pk_value, str(new_object).replace('"', '\\"')))
             elif request.POST.has_key("_addanother"):
                 request.user.message_set.create(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name))
Index: templates/widget/foreign.html
===================================================================
--- templates/widget/foreign.html	(revision 2653)
+++ templates/widget/foreign.html	(working copy)
@@ -2,11 +2,11 @@
 {% output_all bound_field.form_fields %}
 {% if bound_field.raw_id_admin %}
     {% if bound_field.field.rel.limit_choices_to %}
-        <a href="../../../{{ bound_field.field.rel.to.app_label }}/{{ bound_field.field.rel.to.module_name }}/?{% for limit_choice in bound_field.field.rel.limit_choices_to.items %}{% if not forloop.first %}&amp;{% endif %}{{ limit_choice|join:"=" }}{% endfor %}" class="related-lookup" id="lookup_{{ bound_field.element_id }}" onclick="return showRelatedObjectLookupPopup(this);"> <img src="{% admin_media_prefix %}img/admin/selector-search.gif" width="16" height="16" alt="Lookup"></a>
+        <a href="../../../{{ bound_field.field.rel.to.app_label }}/{{ bound_field.field.rel.to.module_name }}/?{% for limit_choice in bound_field.field.rel.limit_choices_to.items %}{% if not forloop.first %}&amp;{% endif %}{{ limit_choice|join:"=" }}{% endfor %}" class="related-lookup" id="lookup_{{ bound_field.element_id }}" onclick="return django.admin.RelatedLookups.showRelatedObjectLookupPopup(this);"> <img src="{% admin_media_prefix %}img/admin/selector-search.gif" width="16" height="16" alt="Lookup"></a>
     {% else %}
-        <a href="{{ bound_field.related_url }}" class="related-lookup" id="lookup_{{ bound_field.element_id }}" onclick="return showRelatedObjectLookupPopup(this);"> <img src="{% admin_media_prefix %}img/admin/selector-search.gif" width="16" height="16" alt="Lookup"></a>
+        <a href="{{ bound_field.related_url }}" class="related-lookup" id="lookup_{{ bound_field.element_id }}" onclick="return django.admin.RelatedLookups.showRelatedObjectLookupPopup(this);"> <img src="{% admin_media_prefix %}img/admin/selector-search.gif" width="16" height="16" alt="Lookup"></a>
     {% endif %}
 {% else %}
 {% if bound_field.needs_add_label %}
-    <a href="{{ bound_field.related_url }}add/" class="add-another" id="add_{{ bound_field.element_id }}" onclick="return showAddAnotherPopup(this);"> <img src="{% admin_media_prefix %}img/admin/icon_addlink.gif" width="10" height="10" alt="Add Another"/></a>
+    <a href="{{ bound_field.related_url }}add/" class="add-another" id="add_{{ bound_field.element_id }}"> <img src="{% admin_media_prefix %}img/admin/icon_addlink.gif" width="10" height="10" alt="Add Another"/></a>
 {% endif %}{% endif %}
Index: templates/admin/change_form.html
===================================================================
--- templates/admin/change_form.html	(revision 2653)
+++ templates/admin/change_form.html	(working copy)
@@ -2,7 +2,32 @@
 {% load i18n admin_modify adminmedia %}
 {% block extrahead %}{{ block.super }}
 <script type="text/javascript" src="../../../jsi18n/"></script>
-{% for js in javascript_imports %}{% include_admin_script js %}{% endfor %}
+<script type="text/javascript" src="../../../../media/js/dojo/dojo.js"></script>
+<script type="text/javascript">
+	dojo.setModulePrefix('django', '../django');
+	var admin_media_prefix = '{% admin_media_prefix %}';
+{% if add %}
+	var first_form_field_id = '{{ first_form_field_id }}';
+{% endif %}
+{% if auto_populated_fields %}
+	var auto_populate_array = {
+	{% for field in auto_populated_fields %}
+		'id_{{ field.name }}': [{% for source_field in field.prepopulate_from %}'id_{{ source_field }}'{% if not forloop.last %},{% endif %}{% endfor %}]{% if not forloop.last %},{% endif %}
+	{% endfor %}		
+	};
+{% endif %}
+{% if many_to_many_filters %}
+	var select_filter_array = {
+		{% for field in many_to_many_filters %}
+			'id_{{ field.name }}': ['{{ field.verbose_name }}', {% ifequal field.rel.filter_interface 1 %}0{% else %}1{% endifequal %}, admin_media_prefix]{% if not forloop.last %},{% endif %}
+		{% endfor %}
+	};
+{% endif %}
+{% if date_time_fields %}
+	var date_time_fields = true;
+{% endif %}
+	dojo.require('django.admin.*');
+</script>
 {% endblock %}
 {% block stylesheet %}{% admin_media_prefix %}css/forms.css{% endblock %}
 {% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %}
@@ -37,7 +62,6 @@
     {% for bound_field_line in bound_field_set %}
         {% admin_field_line bound_field_line %}
         {% for bound_field in bound_field_line %}
-            {% filter_interface_script_maybe bound_field %}
         {% endfor %}
     {% endfor %}
    </fieldset>
@@ -55,14 +79,6 @@
 {% for related_object in inline_related_objects %}{% edit_inline related_object %}{% endfor %}
 {% block after_related_objects %}{% endblock %}
 {% submit_row %}
-{% if add %}
-   <script type="text/javascript">document.getElementById("{{ first_form_field_id }}").focus();</script>
-{% endif %}
-{% if auto_populated_fields %}
-   <script type="text/javascript">
-   {% auto_populated_field_script auto_populated_fields change %}
-   </script>
-{% endif %}
 </div>
 </form></div>
 {% endblock %}
