<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>History.txt</filename>
    </added>
    <added>
      <filename>Manifest.txt</filename>
    </added>
    <added>
      <filename>Rakefile</filename>
    </added>
    <added>
      <filename>Readme.txt</filename>
    </added>
    <added>
      <filename>lib/calendar_date_select/calendar_date_select.rb</filename>
    </added>
    <added>
      <filename>lib/calendar_date_select/form_helpers.rb</filename>
    </added>
    <added>
      <filename>lib/calendar_date_select/includes_helper.rb</filename>
    </added>
    <added>
      <filename>public/javascripts/calendar_date_select/locale/de.js</filename>
    </added>
    <added>
      <filename>public/javascripts/calendar_date_select/locale/ru.js</filename>
    </added>
    <added>
      <filename>spec/calendar_date_select/calendar_date_select_spec.rb</filename>
    </added>
    <added>
      <filename>spec/calendar_date_select/form_helpers_spec.rb</filename>
    </added>
    <added>
      <filename>spec/calendar_date_select/includes_helper_spec.rb</filename>
    </added>
    <added>
      <filename>spec/spec_helper.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,14 +1,33 @@
 Gem::Specification.new do |s|
-  s.name = &quot;calendar_date_select&quot;
-  s.version = &quot;1.11&quot;
-  s.date = &quot;2008-06-24&quot;
-  s.summary = &quot;A popular and flexible JavaScript DatePicker for RubyOnRails&quot;
-  s.email = &quot;timcharper@gmail.com&quot;
-  s.homepage = &quot;http://github.com/timcharper/calendar_date_select&quot;
-  s.description = &quot;CalendarDateSelect is semi-light-weight and easy to use! It takes full advantage of the prototype.js library, resulting in less code, but maintaining a great deal of functionality. Project site: http://code.google.com/p/calendardateselect/&quot;
-  s.has_rdoc = false
+  s.name = %q{calendar_date_select}
+  s.version = &quot;1.11.1&quot;
+
+  s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;Tim Harper&quot;]
-  s.files = [&quot;CHANGELOG&quot;,&quot;MIT-LICENSE&quot;,&quot;README&quot;,&quot;calendar_date_select.gemspec&quot;,&quot;init.rb&quot;,&quot;js_test/prototype.js&quot;,&quot;js_test/test.css&quot;,&quot;js_test/unittest.js&quot;,&quot;js_test/functional/cds_test.html&quot;,&quot;js_test/unit/cds_helper_methods.html&quot;,&quot;lib/calendar_date_select.rb&quot;,&quot;lib/gem_init.rb&quot;,&quot;lib/includes_helper.rb&quot;,&quot;public/blank_iframe.html&quot;,&quot;public/images/calendar_date_select/calendar.gif&quot;,&quot;public/javascripts/calendar_date_select/calendar_date_select.js&quot;,&quot;public/javascripts/calendar_date_select/format_american.js&quot;,&quot;public/javascripts/calendar_date_select/format_db.js&quot;,&quot;public/javascripts/calendar_date_select/format_euro_24hr.js&quot;,&quot;public/javascripts/calendar_date_select/format_euro_24hr_ymd.js&quot;,&quot;public/javascripts/calendar_date_select/format_finnish.js&quot;,&quot;public/javascripts/calendar_date_select/format_hyphen_ampm.js&quot;,&quot;public/javascripts/calendar_date_select/format_iso_date.js&quot;,&quot;public/javascripts/calendar_date_select/format_italian.js&quot;,&quot;public/javascripts/calendar_date_select/locale/fi.js&quot;,&quot;public/javascripts/calendar_date_select/locale/pl.js&quot;,&quot;public/javascripts/calendar_date_select/locale/pt.js&quot;,&quot;public/stylesheets/calendar_date_select/blue.css&quot;,&quot;public/stylesheets/calendar_date_select/default.css&quot;,&quot;public/stylesheets/calendar_date_select/plain.css&quot;,&quot;public/stylesheets/calendar_date_select/red.css&quot;,&quot;public/stylesheets/calendar_date_select/silver.css&quot;,&quot;test/test_helper.rb&quot;,&quot;test/functional/calendar_date_select_test.rb&quot;,&quot;test/functional/helper_methods_test.rb&quot;]
-  s.test_files = [&quot;test/test_helper.rb&quot;,&quot;test/functional/calendar_date_select_test.rb&quot;,&quot;test/functional/helper_methods_test.rb&quot;]
-end
+  s.date = %q{2008-11-23}
+  s.description = %q{}
+  s.email = [&quot;tim c harper at gmail dot com&quot;]
+  s.extra_rdoc_files = [&quot;History.txt&quot;, &quot;Manifest.txt&quot;, &quot;Readme.txt&quot;]
+  s.files = [&quot;History.txt&quot;, &quot;init.rb&quot;, &quot;js_test/functional/cds_test.html&quot;, &quot;js_test/prototype.js&quot;, &quot;js_test/test.css&quot;, &quot;js_test/unit/cds_helper_methods.html&quot;, &quot;js_test/unittest.js&quot;, &quot;lib/calendar_date_select/calendar_date_select.rb&quot;, &quot;lib/calendar_date_select/includes_helper.rb&quot;, &quot;lib/calendar_date_select.rb&quot;, &quot;Manifest.txt&quot;, &quot;MIT-LICENSE&quot;, &quot;public/blank_iframe.html&quot;, &quot;public/images/calendar_date_select/calendar.gif&quot;, &quot;public/javascripts/calendar_date_select/calendar_date_select.js&quot;, &quot;public/javascripts/calendar_date_select/format_american.js&quot;, &quot;public/javascripts/calendar_date_select/format_db.js&quot;, &quot;public/javascripts/calendar_date_select/format_euro_24hr.js&quot;, &quot;public/javascripts/calendar_date_select/format_euro_24hr_ymd.js&quot;, &quot;public/javascripts/calendar_date_select/format_finnish.js&quot;, &quot;public/javascripts/calendar_date_select/format_hyphen_ampm.js&quot;, &quot;public/javascripts/calendar_date_select/format_iso_date.js&quot;, &quot;public/javascripts/calendar_date_select/format_italian.js&quot;, &quot;public/javascripts/calendar_date_select/locale/de.js&quot;, &quot;public/javascripts/calendar_date_select/locale/fi.js&quot;, &quot;public/javascripts/calendar_date_select/locale/fr.js&quot;, &quot;public/javascripts/calendar_date_select/locale/pl.js&quot;, &quot;public/javascripts/calendar_date_select/locale/pt.js&quot;, &quot;public/javascripts/calendar_date_select/locale/ru.js&quot;, &quot;public/stylesheets/calendar_date_select/blue.css&quot;, &quot;public/stylesheets/calendar_date_select/default.css&quot;, &quot;public/stylesheets/calendar_date_select/plain.css&quot;, &quot;public/stylesheets/calendar_date_select/red.css&quot;, &quot;public/stylesheets/calendar_date_select/silver.css&quot;, &quot;Rakefile&quot;, &quot;Readme.txt&quot;, &quot;test/functional/calendar_date_select_test.rb&quot;, &quot;test/functional/helper_methods_test.rb&quot;, &quot;test/test_helper.rb&quot;]
+  s.has_rdoc = true
+  s.homepage = %q{http://code.google.com/p/calendardateselect/}
+  s.rdoc_options = [&quot;--main&quot;, &quot;README.txt&quot;]
+  s.require_paths = [&quot;lib&quot;]
+  s.rubyforge_project = %q{calendar_date_select}
+  s.rubygems_version = %q{1.3.0}
+  s.summary = %q{}
+  s.test_files = [&quot;test/test_helper.rb&quot;]
 
+  if s.respond_to? :specification_version then
+    current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+    s.specification_version = 2
+
+    if Gem::Version.new(Gem::RubyGemsVersion) &gt;= Gem::Version.new('1.2.0') then
+      s.add_development_dependency(%q&lt;hoe&gt;, [&quot;&gt;= 1.8.0&quot;])
+    else
+      s.add_dependency(%q&lt;hoe&gt;, [&quot;&gt;= 1.8.0&quot;])
+    end
+  else
+    s.add_dependency(%q&lt;hoe&gt;, [&quot;&gt;= 1.8.0&quot;])
+  end
+end</diff>
      <filename>calendar_date_select.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -1,17 +1 @@
-%w[calendar_date_select includes_helper].each { |file| 
-  require File.join( File.dirname(__FILE__), &quot;lib&quot;,file) 
-}
-
-ActionView::Helpers::FormHelper.send(:include, CalendarDateSelect::FormHelper)
-ActionView::Base.send(:include, CalendarDateSelect::FormHelper)
-ActionView::Base.send(:include, CalendarDateSelect::IncludesHelper)
-
-# install files
-unless File.exists?(RAILS_ROOT + '/public/javascripts/calendar_date_select/calendar_date_select.js')
-  ['/public', '/public/javascripts/calendar_date_select', '/public/stylesheets/calendar_date_select', '/public/images/calendar_date_select', '/public/javascripts/calendar_date_select/locale'].each do |dir|
-    source = File.join(directory,dir)
-    dest = RAILS_ROOT + dir
-    FileUtils.mkdir_p(dest)
-    FileUtils.cp(Dir.glob(source+'/*.*'), dest)
-  end
-end
+require File.dirname(__FILE__) + &quot;/lib/calendar_date_select.rb&quot;</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,222 +1,33 @@
-class CalendarDateSelect
-  FORMATS = {
-    :natural =&gt; {
-      :date =&gt; &quot;%B %d, %Y&quot;,
-      :time =&gt; &quot; %I:%M %p&quot;
-    },
-    :hyphen_ampm =&gt; {
-      :date =&gt; &quot;%Y-%m-%d&quot;,
-      :time =&gt; &quot; %I:%M %p&quot;,
-      :javascript_include =&gt; &quot;format_hyphen_ampm&quot;
-    },
-    :iso_date =&gt; {
-      :date =&gt; &quot;%Y-%m-%d&quot;, 
-      :time =&gt; &quot; %H:%M&quot;,
-      :javascript_include =&gt; &quot;format_iso_date&quot;
-    }, 
-    :finnish =&gt; {
-      :date =&gt; &quot;%d.%m.%Y&quot;,
-      :time =&gt; &quot; %H:%M&quot;,
-      :javascript_include =&gt; &quot;format_finnish&quot;
-    },
-    :american =&gt; {
-      :date =&gt; &quot;%m/%d/%Y&quot;,
-      :time =&gt; &quot; %I:%M %p&quot;,
-      :javascript_include =&gt; &quot;format_american&quot;
-    },
-    :euro_24hr =&gt; {
-      :date =&gt; &quot;%d %B %Y&quot;,
-      :time =&gt; &quot; %H:%M&quot;, 
-      :javascript_include =&gt; &quot;format_euro_24hr&quot;
-    },
-    :euro_24hr_ymd =&gt; {
-      :date =&gt; &quot;%Y.%m.%d&quot;,
-      :time =&gt; &quot; %H:%M&quot;, 
-      :javascript_include =&gt; &quot;format_euro_24hr_ymd&quot;
-    },
-    :italian =&gt; {
-      :date =&gt; &quot;%d/%m/%Y&quot;,
-      :time =&gt; &quot; %H:%M&quot;,
-      :javascript_include =&gt; &quot;format_italian&quot;
-    },
-    :db =&gt; {
-      :date =&gt; &quot;%Y-%m-%d&quot;,
-      :time =&gt; &quot;%H:%M&quot;,
-      :javascript_include =&gt; &quot;format_db&quot;
-    }
-  }
-  
-  cattr_accessor :image
-  @@image = &quot;calendar_date_select/calendar.gif&quot;
-  
-  cattr_reader :format
-  @@format = FORMATS[:natural]
-  
-  class &lt;&lt; self
-    def format=(format)
-      raise &quot;CalendarDateSelect: Unrecognized format specification: #{format}&quot; unless FORMATS.has_key?(format)
-      @@format = FORMATS[format]
-    end
-    
-    def javascript_format_include
-      @@format[:javascript_include] &amp;&amp; &quot;calendar_date_select/#{@@format[:javascript_include]}&quot;
-    end
-    
-    def date_format_string(time=false)
-      @@format[:date] + ( time ? @@format[:time] : &quot;&quot; )
-    end
-    
-    def format_date(date)
-      if Date===date
-        date.strftime(date_format_string(false))
-      else
-        date.strftime(date_format_string(true))
-      end
-    end
-    
-    def has_time?(value)
-      /[0-9]:[0-9]{2}/.match(value.to_s)
-    end
-  end
-  
-  module FormHelper
-    def calendar_date_select_tag( name, value = nil, options = {})
-      calendar_options = calendar_date_select_process_options(options)
-      value = format_time(value, calendar_options)
-      
-      calendar_options.delete(:format)
-      
-      options[:id] ||= name
-      tag = calendar_options[:hidden] || calendar_options[:embedded] ? 
-        hidden_field_tag(name, value, options) :
-        text_field_tag(name, value, options)
-      
-      calendar_date_select_output(tag, calendar_options)
-    end
-    
-    def format_time(value, options = {})
-      if value.respond_to?(&quot;strftime&quot;)
-        if options[:format]
-          value = value.strftime(options[:format])
-        else
-          if options.has_key? :time
-            value = value.strftime(CalendarDateSelect.date_format_string(options[:time]))
-          else
-            value = CalendarDateSelect.format_date(value)
-          end
-        end
-      end
-      value
-   end
-    
-    # extracts any options passed into calendar date select, appropriating them to either the Javascript call or the html tag.
-    def calendar_date_select_process_options(options)
-      calendar_options = {}
-      callbacks = [:before_show, :before_close, :after_show, :after_close, :after_navigate]
-      for key in [:time, :valid_date_check, :embedded, :buttons, :format, :year_range, :month_year, :popup, :hidden] + callbacks
-        calendar_options[key] = options.delete(key) if options.has_key?(key)
-      end
-      
-      # if passing in mixed, pad it with single quotes
-      calendar_options[:time] = &quot;'mixed'&quot; if calendar_options[:time].to_s==&quot;mixed&quot;
-      calendar_options[:month_year] = &quot;'#{calendar_options[:month_year]}'&quot; if calendar_options[:month_year]
-      
-      # if we are forcing the popup, automatically set the readonly property on the input control.
-      if calendar_options[:popup].to_s == &quot;force&quot;
-        calendar_options[:popup] = &quot;'force'&quot;
-        options[:readonly] = true 
-      end
-      
-      if (vdc=calendar_options.delete(:valid_date_check))
-        if vdc.include?(&quot;;&quot;) || vdc.include?(&quot;function&quot;)
-          throw &quot;:valid_date_check function is missing a 'return' statement.  Try something like: :valid_date_check =&gt; 'if (date &gt; new(Date)) return true; else return false;'&quot; unless vdc.include?(&quot;return&quot;);
-        end
-        
-        vdc = &quot;return(#{vdc})&quot; unless vdc.include?(&quot;return&quot;)
-        vdc = &quot;function(date) { #{vdc} }&quot; unless vdc.include?(&quot;function&quot;)
-        calendar_options[:valid_date_check] = vdc
-      end
-      
-      calendar_options[:popup_by] ||= &quot;this&quot; if calendar_options[:hidden]
-      
-      # surround any callbacks with a function, if not already done so
-      for key in callbacks
-        calendar_options[key] = &quot;function(param) { #{calendar_options[key]} }&quot; unless calendar_options[key].include?(&quot;function&quot;) if calendar_options[key]
-      end
-      
-      calendar_options[:year_range] = format_year_range(calendar_options[:year_range] || 10)
-      calendar_options
-    end
-    
-    def calendar_date_select(object, method, options={})
-      obj = options[:object] || instance_variable_get(&quot;@#{object}&quot;)
-      
-      if !options.include?(:time) &amp;&amp; obj.class.respond_to?(&quot;columns_hash&quot;)
-        column_type = (obj.class.columns_hash[method.to_s].type rescue nil)
-        options[:time] = true if column_type == :datetime
-      end
-      
-      use_time = options[:time]
-      
-      if options[:time].to_s==&quot;mixed&quot;
-        use_time = false if Date===(obj.respond_to?(method) &amp;&amp; obj.send(method))
-      end
-      
-      calendar_options = calendar_date_select_process_options(options)
-      
-      options[:value] ||= 
-        if(obj.respond_to?(method) &amp;&amp; obj.send(method).respond_to?(:strftime))
-          obj.send(method).strftime(CalendarDateSelect.date_format_string(use_time))
-        elsif obj.respond_to?(&quot;#{method}_before_type_cast&quot;) 
-          obj.send(&quot;#{method}_before_type_cast&quot;)
-        elsif obj.respond_to?(method)
-          obj.send(method).to_s
-        else
-          nil
-        end
-
-      tag = ActionView::Helpers::InstanceTag.new(object, method, self, nil, options.delete(:object))
-      calendar_date_select_output(
-        tag.to_input_field_tag( (calendar_options[:hidden] || calendar_options[:embedded]) ? &quot;hidden&quot; : &quot;text&quot;, options), 
-        calendar_options
-      )
-    end  
-    
-    def calendar_date_select_output(input, calendar_options = {})
-      out = input
-      if calendar_options[:embedded]
-        uniq_id = &quot;cds_placeholder_#{(rand*100000).to_i}&quot;
-        # we need to be able to locate the target input element, so lets stick an invisible span tag here we can easily locate
-        out &lt;&lt; content_tag(:span, nil, :style =&gt; &quot;display: none; position: absolute;&quot;, :id =&gt; uniq_id)
-        
-        out &lt;&lt; javascript_tag(&quot;new CalendarDateSelect( $('#{uniq_id}').previous(), #{options_for_javascript(calendar_options)} ); &quot;)
-      else
-        out &lt;&lt; &quot; &quot;
-        
-        out &lt;&lt; image_tag(CalendarDateSelect.image, 
-            :onclick =&gt; &quot;new CalendarDateSelect( $(this).previous(), #{options_for_javascript(calendar_options)} );&quot;,
-            :style =&gt; 'border:0px; cursor:pointer;')
-      end
-      
-      out
-    end
-    
-  private
-    def format_year_range(year) # nodoc
-      return year unless year.respond_to?(:first)
-      return &quot;[#{year.first}, #{year.last}]&quot; unless year.first.respond_to?(:strftime)
-      return &quot;[#{year.first.year}, #{year.last.year}]&quot;
-    end
-  end
-end
-
-
-module ActionView
-  module Helpers
-    class FormBuilder
-      def calendar_date_select(method, options = {})
-        @template.calendar_date_select(@object_name, method, options.merge(:object =&gt; @object))
-      end
-    end
-  end
-end
+require &quot;calendar_date_select/calendar_date_select.rb&quot;
+require &quot;calendar_date_select/form_helpers.rb&quot;
+require &quot;calendar_date_select/includes_helper.rb&quot;
+
+if Object.const_defined?(:Rails) &amp;&amp; File.directory?(Rails.root + &quot;/public&quot;)
+  ActionView::Helpers::FormHelper.send(:include, CalendarDateSelect::FormHelpers)
+  ActionView::Base.send(:include, CalendarDateSelect::FormHelpers)
+  ActionView::Base.send(:include, CalendarDateSelect::IncludesHelper)
+  
+  # Filthy backwards compatibility hooks... grumble
+  if ([Rails::VERSION::MAJOR, Rails::VERSION::MINOR] &lt;=&gt; [2, 2]) == -1
+    ActionView::Helpers::InstanceTag.class_eval do
+      def self.new_with_backwards_compatibility(object_name, method_name, template_object, object = nil)
+        new(object_name, method_name, template_object, nil, object)
+      end
+    end
+    
+  else
+    ActionView::Helpers::InstanceTag.class_eval do
+      class &lt;&lt; self; alias new_with_backwards_compatibility new; end
+    end
+  end
+
+  # install files
+  unless File.exists?(RAILS_ROOT + '/public/javascripts/calendar_date_select/calendar_date_select.js')
+    ['/public', '/public/javascripts/calendar_date_select', '/public/stylesheets/calendar_date_select', '/public/images/calendar_date_select', '/public/javascripts/calendar_date_select/locale'].each do |dir|
+      source = File.dirname(__FILE__) + &quot;/../#{dir}&quot;
+      dest = RAILS_ROOT + dir
+      FileUtils.mkdir_p(dest)
+      FileUtils.cp(Dir.glob(source+'/*.*'), dest)
+    end
+  end
+end
\ No newline at end of file</diff>
      <filename>lib/calendar_date_select.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,2 @@
-&lt;!-- Nothing here --&gt;
-&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;
\ No newline at end of file
+&lt;!-- Nothing here; part of the calendar_date_select plugin --&gt;
+&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;</diff>
      <filename>public/blank_iframe.html</filename>
    </modified>
    <modified>
      <diff>@@ -1,23 +1,22 @@
-// CalendarDateSelect version 1.10.2 - a prototype based date picker
-// Questions, comments, bugs? - email the Author - Tim Harper &lt;&quot;timseeharper@gmail.seeom&quot;.gsub(&quot;see&quot;, &quot;c&quot;)&gt; 
+// CalendarDateSelect version 1.13 - a prototype based date picker
+// Questions, comments, bugs? - see the project page: http://code.google.com/p/calendardateselect
 if (typeof Prototype == 'undefined') alert(&quot;CalendarDateSelect Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (.g. &lt;%= javascript_include_tag :defaults %&gt;) *before* it includes calendar_date_select.js (.g. &lt;%= calendar_date_select_includes %&gt;).&quot;);
 if (Prototype.Version &lt; &quot;1.6&quot;) alert(&quot;Prototype 1.6.0 is required.  If using earlier version of prototype, please use calendar_date_select version 1.8.3&quot;);
 
 Element.addMethods({
   purgeChildren: function(element) { $A(element.childNodes).each(function(e){$(e).remove();}); },
   build: function(element, type, options, style) {
-    var newElement = Element.build(type, options, style);
+    var newElement = Element.buildAndAppend(type, options, style);
     element.appendChild(newElement);
     return newElement;
   }
 });
 
-Element.build = function(type, options, style)
+Element.buildAndAppend = function(type, options, style)
 {
   var e = $(document.createElement(type));
-  $H(options).each(function(pair) { eval(&quot;e.&quot; + pair.key + &quot; = pair.value&quot; ); });
-  if (style) 
-    $H(style).each(function(pair) { eval(&quot;e.style.&quot; + pair.key + &quot; = pair.value&quot; ); });
+  $H(options).each(function(pair) { e[pair.key] = pair.value });
+  if (style) e.setStyle(style);
   return e;
 };
 nil = null;
@@ -47,7 +46,8 @@ window.f_scrollTop = function() { return ([window.pageYOffset ? window.pageYOffs
 _translations = {
   &quot;OK&quot;: &quot;OK&quot;,
   &quot;Now&quot;: &quot;Now&quot;,
-  &quot;Today&quot;: &quot;Today&quot;
+  &quot;Today&quot;: &quot;Today&quot;,
+  &quot;Clear&quot;: &quot;Clear&quot;
 }
 SelectBox = Class.create();
 SelectBox.prototype = {
@@ -82,6 +82,7 @@ CalendarDateSelect.prototype = {
       popup: nil,
       time: false,
       buttons: true,
+      clear_button: true,
       year_range: 10,
       close_on_click: nil,
       minute_interval: 5,
@@ -104,9 +105,9 @@ CalendarDateSelect.prototype = {
   },
   positionCalendarDiv: function() {
     var above = false;
-    var c_pos = this.calendar_div.viewportOffset(), c_left = c_pos[0], c_top = c_pos[1], c_dim = this.calendar_div.getDimensions(), c_height = c_dim.height, c_width = c_dim.width; 
+    var c_pos = this.calendar_div.cumulativeOffset(), c_left = c_pos[0], c_top = c_pos[1], c_dim = this.calendar_div.getDimensions(), c_height = c_dim.height, c_width = c_dim.width; 
     var w_top = window.f_scrollTop(), w_height = window.f_height();
-    var e_dim = $(this.options.get(&quot;popup_by&quot;)).viewportOffset(), e_top = e_dim[1], e_left = e_dim[0], e_height = $(this.options.get(&quot;popup_by&quot;)).getDimensions().height, e_bottom = e_top + e_height;
+    var e_dim = $(this.options.get(&quot;popup_by&quot;)).cumulativeOffset(), e_top = e_dim[1], e_left = e_dim[0], e_height = $(this.options.get(&quot;popup_by&quot;)).getDimensions().height, e_bottom = e_top + e_height;
     
     if ( (( e_bottom + c_height ) &gt; (w_top + w_height)) &amp;&amp; ( e_bottom - c_height &gt; w_top )) above = true;
     var left_px = e_left.toString() + &quot;px&quot;, top_px = (above ? (e_top - c_height ) : ( e_top + e_height )).toString() + &quot;px&quot;;
@@ -223,7 +224,7 @@ CalendarDateSelect.prototype = {
           onclick: function() {this.today(false); return false;}.bindAsEventListener(this)
         });
       
-      if (this.options.get(&quot;time&quot;)==&quot;mixed&quot;) buttons_div.build(&quot;span&quot;, {innerHTML: &quot; | &quot;, className:&quot;button_seperator&quot;})
+      if (this.options.get(&quot;time&quot;)==&quot;mixed&quot;) buttons_div.build(&quot;span&quot;, {innerHTML: &quot;&amp;#160;|&amp;#160;&quot;, className:&quot;button_seperator&quot;})
       
       if (this.options.get(&quot;time&quot;)) b = buttons_div.build(&quot;a&quot;, {
         innerHTML: _translations[&quot;Now&quot;],
@@ -231,11 +232,15 @@ CalendarDateSelect.prototype = {
         onclick: function() {this.today(true); return false}.bindAsEventListener(this)
       });
       
-      if (!this.options.get(&quot;embedded&quot;))
+      if (!this.options.get(&quot;embedded&quot;) &amp;&amp; !this.closeOnClick())
       {
-        buttons_div.build(&quot;span&quot;, {innerHTML: &quot;&amp;#160;&quot;});
+        buttons_div.build(&quot;span&quot;, {innerHTML: &quot;&amp;#160;|&amp;#160;&quot;, className:&quot;button_seperator&quot;})
         buttons_div.build(&quot;a&quot;, { innerHTML: _translations[&quot;OK&quot;], href: &quot;#&quot;, onclick: function() {this.close(); return false;}.bindAsEventListener(this) });
       }
+      if (this.options.get('clear_button')) {
+        buttons_div.build(&quot;span&quot;, {innerHTML: &quot;&amp;#160;|&amp;#160;&quot;, className:&quot;button_seperator&quot;})
+        buttons_div.build(&quot;a&quot;, { innerHTML: _translations[&quot;Clear&quot;], href: &quot;#&quot;, onclick: function() {this.clearDate(); if (!this.options.get(&quot;embedded&quot;)) this.close(); return false;}.bindAsEventListener(this) });
+      }
     }
   },
   refresh: function ()
@@ -337,6 +342,14 @@ CalendarDateSelect.prototype = {
     this.date.setDate(1);
   },
   updateFooter:function(text) { if (!text) text = this.dateString(); this.footer_div.purgeChildren(); this.footer_div.build(&quot;span&quot;, {innerHTML: text }); },
+  clearDate:function() {
+    if ((this.target_element.disabled || this.target_element.readOnly) &amp;&amp; this.options.get(&quot;popup&quot;) != &quot;force&quot;) return false;
+    var last_value = this.target_element.value;
+    this.target_element.value = &quot;&quot;;
+    this.clearSelectedClass();
+    this.updateFooter('&amp;#160;');
+    if (last_value!=this.target_element.value) this.callback(&quot;onchange&quot;);
+  },
   updateSelectedDate:function(partsOrElement, via_click) {
     var parts = $H(partsOrElement);
     if ((this.target_element.disabled || this.target_element.readOnly) &amp;&amp; this.options.get(&quot;popup&quot;) != &quot;force&quot;) return false;
@@ -417,7 +430,7 @@ CalendarDateSelect.prototype = {
     Event.stopObserving(document, &quot;keypress&quot;, this.keyPress_handler);
     this.calendar_div.remove(); this.closed = true;
     if (this.iframe) this.iframe.remove();
-    if (this.target_element.type!=&quot;hidden&quot;) this.target_element.focus();
+    if (this.target_element.type != &quot;hidden&quot; &amp;&amp; ! this.target_element.disabled) this.target_element.focus();
     this.callback(&quot;after_close&quot;);
   },
   closeIfClickedOut: function(e) {</diff>
      <filename>public/javascripts/calendar_date_select/calendar_date_select.js</filename>
    </modified>
    <modified>
      <diff>@@ -8,10 +8,18 @@ Date.prototype.toFormattedString = function(include_time){
   return str;
 }
 Date.parseFormattedString = function (string) {
-  var regexp = '([0-9]{1,2})\.(([0-9]{1,2})\.(([0-9]{4})( ([0-9]{1,2}):([0-9]{2})? *)?)?)?';
+  var regexp = '([0-9]{1,2})\.(([0-9]{1,2})\.(([0-9]{2,4})( ([0-9]{1,2}):([0-9]{2})? *)?)?)?';
   var d = string.match(new RegExp(regexp, &quot;i&quot;));
   if (d==null) return Date.parse(string); // at least give javascript a crack at it.
   var offset = 0;
+  if (d[5] &amp;&amp; d[5].length == 2) {
+    // we got only two digits for the year...
+    d[5] = Number(d[5]);
+    if (d[5] &gt; 30)
+      d[5] += 1900;
+    else
+      d[5] += 2000;
+  }
   var date = new Date(d[5], 0, 1);
   if (d[3]) { date.setMonth(d[3] - 1); }
   if (d[5]) { date.setDate(d[1]); }</diff>
      <filename>public/javascripts/calendar_date_select/format_finnish.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,36 +1,37 @@
-Date.prototype.toFormattedString = function(include_time){
-  str = this.getFullYear() + &quot;-&quot; + Date.padded2(this.getMonth() + 1) + &quot;-&quot; +Date.padded2(this.getDate()); 
-
-if (include_time) { hour=this.getHours(); str += &quot; &quot; + this.getAMPMHour() + &quot;:&quot; + this.getPaddedMinutes() + &quot; &quot; + this.getAMPM() }
-return str;
-}
-
-Date.parseFormattedString = function (string) {
-  var regexp = &quot;([0-9]{4})(-([0-9]{2})(-([0-9]{2})&quot; +
-      &quot;( ([0-9]{1,2}):([0-9]{2})? *(pm|am)&quot; +
-      &quot;?)?)?)?&quot;;
-  var d = string.match(new RegExp(regexp, &quot;i&quot;));
-  if (d==null) return Date.parse(string); // at least give javascript a crack at it.
-  var offset = 0;
-  var date = new Date(d[1], 0, 1);
-  if (d[3]) { date.setMonth(d[3] - 1); }
-  if (d[5]) { date.setDate(d[5]); }
-  if (d[7]) {
-    hours = parseInt(d[7], 10);
-    offset=0;
-    is_pm = (d[9].toLowerCase()==&quot;pm&quot;)
-    if (is_pm &amp;&amp; hours &lt;= 11) hours+=12;
-    if (!is_pm &amp;&amp; hours == 12) hours=0;
-    date.setHours(hours); 
-    
-  }
-  if (d[8]) { date.setMinutes(d[8]); }
-  if (d[10]) { date.setSeconds(d[10]); }
-  if (d[12]) { date.setMilliseconds(Number(&quot;0.&quot; + d[12]) * 1000); }
-  if (d[14]) {
-      offset = (Number(d[16]) * 60) + Number(d[17]);
-      offset *= ((d[15] == '-') ? 1 : -1);
-  }
-
-  return date;
+Date.prototype.toFormattedString = function(include_time){
+  str = this.getFullYear() + &quot;-&quot; + Date.padded2(this.getMonth() + 1) + &quot;-&quot; +Date.padded2(this.getDate()); 
+
+if (include_time) { hour=this.getHours(); str += &quot; &quot; + this.getAMPMHour() + &quot;:&quot; + this.getPaddedMinutes() + &quot; &quot; + this.getAMPM() }
+return str;
+}
+
+Date.parseFormattedString = function (string) {
+  var regexp = &quot;([0-9]{4})(-([0-9]{2})(-([0-9]{2})&quot; +
+      &quot;( ([0-9]{1,2}):([0-9]{2})? *(pm|am)&quot; +
+      &quot;?)?)?)?&quot;;
+  var d = string.match(new RegExp(regexp, &quot;i&quot;));
+  if (d==null) return Date.parse(string); // at least give javascript a crack at it.
+  var offset = 0;
+  var date = new Date(d[1], 0, 1);
+  if (d[3]) { date.setMonth(d[3] - 1); }
+  if (d[5]) { date.setDate(d[5]); }
+  if (d[7]) {
+    hours = parseInt(d[7], 10);
+    offset=0;
+    if (d[9]) {
+        is_pm = (d[9].toLowerCase()==&quot;pm&quot;);
+        if (is_pm &amp;&amp; hours &lt;= 11) hours+=12;
+        if (!is_pm &amp;&amp; hours == 12) hours=0;
+    }
+    date.setHours(hours); 
+  }
+  if (d[8]) { date.setMinutes(d[8]); }
+  if (d[10]) { date.setSeconds(d[10]); }
+  if (d[12]) { date.setMilliseconds(Number(&quot;0.&quot; + d[12]) * 1000); }
+  if (d[14]) {
+      offset = (Number(d[16]) * 60) + Number(d[17]);
+      offset *= ((d[15] == '-') ? 1 : -1);
+  }
+
+  return date;
 }
\ No newline at end of file</diff>
      <filename>public/javascripts/calendar_date_select/format_hyphen_ampm.js</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@
 
 Date.prototype.toFormattedString = function(include_time){
   str = this.getDate() + &quot;/&quot; + (this.getMonth() + 1) + &quot;/&quot; + this.getFullYear();
-  if (include_time) { hour=this.getHours(); str += &quot; &quot; + this.getAMPMHour() + &quot;:&quot; + this.getPaddedMinutes() }
+  if (include_time) { str += &quot; &quot; + this.getHours() + &quot;:&quot; + this.getPaddedMinutes() }
   return str;
 }
 </diff>
      <filename>public/javascripts/calendar_date_select/format_italian.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,11 @@
-Date.weekdays = $w('D S T Q Q S S');
-Date.months = $w('Janeiro Fevereiro Mar&#231;o Abril Maio Junho Julho Agosto Setembro Novembro Dezembro');
-
-Date.first_day_of_week = 0
-
-_translations = {
-  &quot;OK&quot;: &quot;OK&quot;,
-  &quot;Now&quot;: &quot;Agora&quot;,
-  &quot;Today&quot;: &quot;Hoje&quot;
-}
\ No newline at end of file
+Date.weekdays = $w('D S T Q Q S S');
+Date.months = $w('Janeiro Fevereiro Mar&#231;o Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro');
+
+Date.first_day_of_week = 0
+
+_translations = {
+  &quot;OK&quot;: &quot;OK&quot;,
+  &quot;Now&quot;: &quot;Agora&quot;,
+  &quot;Today&quot;: &quot;Hoje&quot;,
+  &quot;Clear&quot;: &quot;Limpar&quot;
+}</diff>
      <filename>public/javascripts/calendar_date_select/locale/pt.js</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>CHANGELOG</filename>
    </removed>
    <removed>
      <filename>README</filename>
    </removed>
    <removed>
      <filename>lib/gem_init.rb</filename>
    </removed>
    <removed>
      <filename>lib/includes_helper.rb</filename>
    </removed>
    <removed>
      <filename>test/functional/calendar_date_select_test.rb</filename>
    </removed>
    <removed>
      <filename>test/functional/helper_methods_test.rb</filename>
    </removed>
    <removed>
      <filename>test/test_helper.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>71ec974bf96c332b9c171488ac2a77b406740ee0</id>
    </parent>
    <parent>
      <id>b63886b73d25bbebd482abbfdacc29bac1b09f90</id>
    </parent>
  </parents>
  <author>
    <name>Edwin Moss</name>
    <email>edwin.moss@gmail.com</email>
  </author>
  <url>http://github.com/edwinmoss/calendar_date_select/commit/e411f879880c3a08ec69e95895df146db1e7ba83</url>
  <id>e411f879880c3a08ec69e95895df146db1e7ba83</id>
  <committed-date>2009-02-19T10:38:49-08:00</committed-date>
  <authored-date>2009-02-19T10:38:49-08:00</authored-date>
  <message>Merge branch 'core'

Conflicts:
	lib/calendar_date_select/includes_helper.rb
	public/javascripts/calendar_date_select/format_hyphen_ampm.js</message>
  <tree>9f1f2bfd1da19463c5f024c13946cbbaa6cd3a03</tree>
  <committer>
    <name>Edwin Moss</name>
    <email>edwin.moss@gmail.com</email>
  </committer>
</commit>
