]> git.0d.be Git - pige-extractor.git/commitdiff
start
authorFrédéric Péters <fpeters@0d.be>
Wed, 29 Jul 2009 08:57:17 +0000 (10:57 +0200)
committerFrédéric Péters <fpeters@0d.be>
Wed, 29 Jul 2009 08:57:17 +0000 (10:57 +0200)
29 files changed:
dojobs.py [new file with mode: 0644]
extract.py [new file with mode: 0644]
index.cgi [new file with mode: 0755]
indicator.gif [new file with mode: 0644]
js/bgiframe/ChangeLog.txt [new file with mode: 0644]
js/bgiframe/META.json [new file with mode: 0644]
js/bgiframe/docs/index.html [new file with mode: 0644]
js/bgiframe/jquery.bgiframe.js [new file with mode: 0644]
js/bgiframe/jquery.bgiframe.min.js [new file with mode: 0644]
js/bgiframe/jquery.bgiframe.pack.js [new file with mode: 0644]
js/bgiframe/test/index.html [new file with mode: 0644]
js/calendar.png [new file with mode: 0644]
js/datePicker/jquery.datePicker.js [new file with mode: 0644]
js/jquery.js [new file with mode: 0644]
js/jquery.simplemodal.js [new file with mode: 0644]
js/methods/array.js [new file with mode: 0644]
js/methods/date.js [new file with mode: 0644]
js/methods/date_de.js [new file with mode: 0644]
js/methods/date_es.js [new file with mode: 0644]
js/methods/date_fr.js [new file with mode: 0644]
js/methods/date_it.js [new file with mode: 0644]
js/methods/date_pl.js [new file with mode: 0644]
js/methods/date_ru_utf8.js [new file with mode: 0644]
js/methods/date_ru_win1251.js [new file with mode: 0644]
js/methods/date_ua_utf8.js [new file with mode: 0644]
js/methods/methodsTest.html [new file with mode: 0644]
js/methods/string.js [new file with mode: 0644]
pige.css [new file with mode: 0644]
static.html [new file with mode: 0644]

diff --git a/dojobs.py b/dojobs.py
new file mode 100644 (file)
index 0000000..ce2d2be
--- /dev/null
+++ b/dojobs.py
@@ -0,0 +1,71 @@
+#! /usr/bin/env python
+
+import os
+import time
+import sys
+from extract import extract
+from datetime import datetime, timedelta
+
+JOBS_DIR = '/tmp/jobs'
+
+class Job:
+    def __init__(self, job_id):
+        self.job_id = job_id
+        self.filename = os.path.join(JOBS_DIR, self.job_id)
+        line = file(self.filename).readline()
+        self.cmd = line.split(':', 1)[0].strip()
+        self.timestamp = os.stat(self.filename)[-3]
+
+    def add_info(self, info):
+        first_line = file(self.filename).readline()
+        if not first_line.endswith('\n'):
+            first_line += '\n'
+        open(self.filename, 'w').write(first_line + info + '\n')
+
+    def start(self):
+        if os.fork():
+            return
+        firstline = file(self.filename).readline()
+        open(self.filename, 'w').write('running\nEn cours de traitement ...\n')
+        first_word, date, start, end = firstline.strip().split()
+
+        year, month, day = date.split('-')
+        start_hour, start_minutes = [int(x) for x in start.split(':')]
+        end_hour, end_minutes = [int(x) for x in end.split(':')]
+        output_filename = 'extrait-%s%s%s-%02d%02d-%02d%02d.wav' % (
+                year, month, day, start_hour, start_minutes, end_hour, end_minutes)
+        start_time = datetime(int(year), int(month), int(day), int(start_hour), int(start_minutes))
+        end_time = datetime(int(year), int(month), int(day), int(end_hour), int(end_minutes))
+        if end_time < start_time:
+            end_time += timedelta(days=1)
+        extract(start_time, end_time, output_filename)
+        open(self.filename, 'w').write('done:%s\n' % output_filename)
+        sys.exit(0)
+
+    def cleanup(self):
+        if os.stat(self.filename)[-2]+300 > time.time():
+            try:
+                os.unlink(self.filename)
+            except OSError:
+                pass
+
+    def __repr__(self):
+        return '<Job id=%s>' % self.job_id
+
+
+jobs = [Job(x) for x in os.listdir(JOBS_DIR)]
+jobs.sort(lambda x, y: cmp(x.timestamp, y.timestamp))
+
+running_jobs = [x for x in jobs if x.cmd == 'running']
+
+waiting = 0
+for job in jobs:
+    if job.cmd == 'start':
+        if running_jobs:
+            job.add_info('Encore %s jobs ...' % (len(running_jobs)+waiting))
+            waiting += 1
+        else:
+            running_jobs.append(job)
+            job.start()
+    elif job.cmd == 'done':
+        job.cleanup()
diff --git a/extract.py b/extract.py
new file mode 100644 (file)
index 0000000..84eae6c
--- /dev/null
@@ -0,0 +1,133 @@
+#! /usr/bin/env python
+
+import sys
+from datetime import datetime, timedelta
+import os
+import urllib2
+import md5
+import random
+from optparse import OptionParser
+import shutil
+
+def print_cmd(x):
+    print x
+#os.system = print_cmd
+
+tmpdir = '/var/tmp/esperanzah/'
+
+
+class Source:
+    def get_files(self, start, end):
+        filenames = []
+        t = start
+        while t <= end:
+            filenames.append(self.get_file(t))
+            t = t + timedelta(seconds=15*60)
+        return filenames
+
+    def get_file(self, timestamp):
+        formatted = timestamp.strftime('record-%Y-%m-%d-%a-%H-%M')
+        t = self.get_current_file(formatted)
+        if t:
+            return t
+        return self.get_archive_file(formatted)
+
+class LocalSource(Source):
+    base_directory = '/var/www/current/record/'
+
+    def get_current_file(self, filename):
+        fullpath = os.path.join(self.base_directory, 'current', filename + '.wav')
+        if os.path.exists(fullpath):
+            return fullpath
+
+    def get_archive_file(self, filename):
+        fullpath = os.path.join(self.base_directory, 'archives', filename + '.ogg')
+        localwav = os.path.join(tmpdir, filename.replace('.ogg', '.wav'))
+        os.system('oggdec %s --output %s' % (fullpath, localwav))
+        return localwav
+
+class HttpSource(Source):
+    base_url = 'http://nas.studio.priv/current/record/'
+
+    def get_http_file(self, filename):
+        dstfile = os.path.join(tmpdir, os.path.basename(filename))
+        if os.path.exists(dstfile):
+            return dstfile
+        url = self.base_url + filename
+        try:
+            fd = urllib2.urlopen(url)
+        except urllib2.HTTPError:
+            print 'url 404:', url
+            return
+        extension = filename.split('.')[-1]
+        tmpfile = os.path.join(tmpdir, md5.md5(str(random.random())).hexdigest()) + '.' + extension
+        dst = open(tmpfile, 'w')
+        BLOCK_SIZE = 10*1000*1000
+        while True:
+            s = fd.read(BLOCK_SIZE)
+            dst.write(s)
+            if len(s) != BLOCK_SIZE:
+                break
+        dst.close()
+        os.rename(tmpfile, dstfile)
+        return dstfile
+
+
+    def get_current_file(self, filename):
+        return self.get_http_file('current/' + filename + '.wav')
+
+    def get_archive_file(self, filename):
+        dstfile = self.get_http_file('archives/' + filename + '.ogg')
+        localwav = os.path.join(tmpdir, dstfile.replace('.ogg', '.wav'))
+        os.system('oggdec %s --output %s' % (dstfile, localwav))
+        return localwav
+
+
+source = HttpSource()
+
+def get_lower(date):
+    lower = date.replace(minute = (date.minute - (date.minute % 15)))
+    return lower
+
+def get_upper(date):
+    upper = get_lower(date)
+    return upper + timedelta(seconds=15*60)
+
+def extract(start, end, output):
+    lower = get_lower(start)
+    upper = get_lower(end - timedelta(seconds=60))
+
+    filenames = source.get_files(lower, upper)
+    if start.minute % 15 != 0:
+        delay = (start.minute % 15) * 60
+        tmpfile = os.path.join(tmpdir, md5.md5(str(random.random())).hexdigest()) + '.wav'
+        os.system('sox --show-progress %s %s trim %d %d' % (
+                    filenames[0], output, delay, 15*60-delay))
+        filenames[0] = tmpfile
+
+    if end.minute % 15 != 0:
+        delay = (end.minute % 15) * 60
+        tmpfile = os.path.join(tmpdir, md5.md5(str(random.random())).hexdigest()) + '.wav'
+        os.system('sox --show-progress %s %s trim 0 %d' % (filenames[-1], tmpfile, delay))
+        filenames[-1] = tmpfile
+
+    tmpfile = os.path.join(tmpdir, md5.md5(str(random.random())).hexdigest()) + '.wav'
+    if len(filenames) > 1:
+        os.system('sox --show-progress %s %s' % (' '.join(filenames), tmpfile))
+        shutil.move(tmpfile, output)
+    else:
+        shutil.copy(filenames[0], output)
+
+if __name__ == '__main__':
+    parser = OptionParser()
+    parser.add_option('--start', dest='start', metavar='TIME')
+    parser.add_option('--stop', dest='stop', metavar='TIME')
+    parser.add_option('--output', dest='output', metavar='FILENAME')
+    options, args = parser.parse_args()
+    if not (options.start and options.stop and options.output):
+        parser.print_help()
+        sys.exit(1)
+    sys.exit(extract(
+            datetime.strptime(options.start, '%Y-%m-%d %H:%M'),
+            datetime.strptime(options.stop, '%Y-%m-%d %H:%M'),
+            options.output))
diff --git a/index.cgi b/index.cgi
new file mode 100755 (executable)
index 0000000..6ff71de
--- /dev/null
+++ b/index.cgi
@@ -0,0 +1,82 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import cgi
+import os
+import sys
+import time
+import stat
+import md5
+import random
+
+JOBS_DIR = '/tmp/jobs'
+
+d = cgi.parse_qs(os.environ.get('QUERY_STRING', ''))
+
+if not d:
+    print 'Content-type: text/html\n'
+    print open('static.html').read()
+    sys.exit(0)
+
+
+print 'Content-type: text/plain\n'
+
+if d.get('cmd') == ['new']:
+    try:
+        date_val = d.get('date_val')[0]
+        start_val = d.get('start_val')[0]
+        end_val = d.get('end_val')[0]
+        assert date_val
+        assert start_val
+        assert end_val
+
+        start_time = '%s %s' % (date_val, start_val)
+        end_time = '%s %s' % (date_val, end_val)
+        try:
+            time.strptime(start_time, '%d/%m/%Y %H:%M')
+        except ValueError:
+            time.strptime(start_time, '%Y-%m-%d %H:%M')
+        try:
+            time.strptime(end_time, '%d/%m/%Y %H:%M')
+        except ValueError:
+            time.strptime(end_time, '%Y-%m-%d %H:%M')
+
+        job_number = md5.md5(str(random.random())).hexdigest()
+        job_filename = os.path.join(JOBS_DIR, job_number)
+        file(job_filename, 'w').write(
+                'start: %s %s %s' % (date_val, start_val, end_val))
+        os.chmod(job_filename, 0666)
+        print 'ok:' + job_number
+
+    except IOError:
+        print 'valeur manquante'
+    sys.exit(0)
+
+if d.get('cmd') == ['status']:
+    job_number = d.get('job')[0]
+    job_filename = os.path.join(JOBS_DIR, job_number)
+    if not os.path.exists(job_filename):
+        print 'error (missing job definition)'
+    else:
+        fd = open(job_filename)
+        cmd = fd.readline()
+        secondline = fd.readline()
+        first_word = cmd.split(':', 1)[0]
+        if secondline:
+            print secondline
+        elif first_word == 'start':
+            print 'commande enregistrée, traitement dans une petite minute ...'
+        else:
+            print cmd
+
+if d.get('cmd') == ['list']:
+    filenames = [os.path.join(os.getcwd(), x) for x in os.listdir(os.getcwd()) if \
+                x.endswith('.ogg') or x.endswith('.wav')]
+    def cmp_stat(x, y):
+        return cmp(os.stat(x)[stat.ST_CTIME], os.stat(y)[stat.ST_CTIME])
+    filenames.sort(cmp_stat)
+    filenames.reverse()
+
+    for x in filenames:
+        print os.path.basename(x)
+
diff --git a/indicator.gif b/indicator.gif
new file mode 100644 (file)
index 0000000..085ccae
Binary files /dev/null and b/indicator.gif differ
diff --git a/js/bgiframe/ChangeLog.txt b/js/bgiframe/ChangeLog.txt
new file mode 100644 (file)
index 0000000..995b351
--- /dev/null
@@ -0,0 +1,20 @@
+== New and Noteworthy ==
+
+== 2.1.1 ==
+
+* Removed $.browser.version for jQuery < 1.1.3
+
+== 2.1 ==
+
+* Updated to work with jQuery 1.1.3
+* Added $.browser.version for jQuery < 1.1.3
+* Optimized duplication check by using child selector and using .length test
+
+== 2.0 ==
+
+* Added ability change settings like width, height, src and more.
+
+== 1.0 ==
+
+* Only adds iframe once per an element
+* Works with SSL enabled pages
\ No newline at end of file
diff --git a/js/bgiframe/META.json b/js/bgiframe/META.json
new file mode 100644 (file)
index 0000000..766190b
--- /dev/null
@@ -0,0 +1,32 @@
+{
+       "name": "jQuery-bgiframe",
+       "version": 2.1,
+       "author": [
+               "Brandon Aaron <brandon.aaron@gmail.com>"
+       ],
+       "abstract": "jQuery plugin for fixing z-index issues in IE6",
+       "license": "mit, gpl",
+       "distribution_type": "plugin",
+       "requires": {
+               "jQuery": ">=1.0.3"
+       },
+       "provides": {
+               "jQuery.bgiframe": {
+                       "version": 2.1,
+                       "file": "jquery.bgiframe.js"
+               }
+       },
+       "keywords": [
+               "iframe",
+               "hack",
+               "zIndex",
+               "z-index",
+               "ie6"
+       ],
+       "stability": "Official",
+       "meta-spec": {
+               "version": 1.3,
+               "url": "http://module-build.sourceforge.net/META-spec-v1.3.html"
+       },
+       "generated_by": "Brandon Aaron"
+}
diff --git a/js/bgiframe/docs/index.html b/js/bgiframe/docs/index.html
new file mode 100644 (file)
index 0000000..1776b4d
--- /dev/null
@@ -0,0 +1,113 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+       "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+       <head>
+               <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+               <title>bgiframe 2.1.1 docs</title>
+               <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.2.2/build/reset/reset-min.css">
+               <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.2.2/build/fonts/fonts-min.css">
+               <style type="text/css" media="screen">
+                       body { margin: 25px; }
+                       h1 { margin: 1.0em 0; font-size: 167%; font-weight: bold; }
+                       #toc { margin: 0 0 3.0em; }
+                               #toc li { margin: 0.4em 0; font-size: 100%; }
+                       #qa { margin: 0 0 3.0em; }
+                               #qa dt.question { margin: 2.0em 0 1.0em; font-size: 122%; font-weight: bold; }
+                               #qa dd.answer { margin: 0 2.0em; }
+                                       #qa dd.answer p { margin: 0 0 1.5em; }
+                                       #qa dd.answer code { font-size: 92%; }
+                                       
+                                       #qa dd.answer #options dt { margin: 2.0em 0 1.0em;  }
+                                       #qa dd.answer #options dd { margin: 0 2.0em; }
+                                       
+               </style>
+       </head>
+       <body>
+               <div id="wrapper">
+                       <div id="container">
+                               <h1>bgiframe 2.1.1</h1>
+                               <ul id="toc">
+                                       <li><a href="#what_does_it_do">What does it do</a></li>
+                                       <li><a href="#when_should_i_use_it">When should I use it</a></li>
+                                       <li><a href="#how_do_i_use_it">How do I use it</a></li>
+                                       <li><a href="#how_does_it_work">How does it work</a></li>
+                                       <li><a href="#where_can_i_get_it">Where can I get it</a></li>
+                                       <li><a href="#what_has_changed">What has changed</a></li>
+                                       <li><a href="#suggestions_bugs_patches">Suggestions? Bugs? Patches?</a></li>
+                               </ul>
+                               <dl id="qa">
+                                       <dt id="what_does_it_do" class="question">What does it do?</dt>
+                                       <dd class="answer">
+                                               <p>Have you ever experienced the select form element z-index issue in Internet Explorer 6? Most likely you have if you've implemented some sort of drop down menu navigation that shows up over a select form element.</p>
+                                               <p>The background iframe (bgiframe) plugin provides a very small, quick and easy way to fix that problem so you don't have to worry about it. No matter the size, borders or position the bgiframe plugin can fix it.</p>
+                                       </dd>
+                                       
+                                       <dt id="when_should_i_use_it" class="question">When should I use it?</dt>
+                                       <dd class="answer">
+                                               <p>The bgiframe plugin should be used when you are trying to show elements above a select form control in Internet Explorer 6.</p>
+                                       </dd>
+                                       
+                                       <dt id="how_do_i_use_it" class="question">How do I use it?</dt>
+                                       <dd class="answer">
+                                               <p>The usage is simple. Just call <code>bgiframe</code> on a jQuery collection of elements.</p>
+                                               <p><code>$('.fix-z-index').bgiframe();</code></p>
+                                               <p>The plugin tries its best to handle most situations but sometimes some configuration is necessary. For example if your borders are defined in a unit other than pixels, you will need to manually set the <code>top</code> and <code>left</code> properties to the negative width of the border. Here are the options/settings available to configure the output.</p>
+                                               <dl id="options">
+                                                       <dt><code>top</code></dt>
+                                                       <dd>
+                                                               <p>The iframe must be offset to the top by the width of the top border. This should be a negative number representing the border-top-width. If a number is is used here, pixels will be assumed. Otherwise, be sure to specify a unit. An expression could also be used. By default the value is "auto" which will use an expression to get the border-top-width if it is in pixels.</p>
+                                                               <p><code>$('.fix-z-index').bgiframe({ top: '-1em' });</code></p>
+                                                       </dd>
+                                                       <dt><code>left</code></dt>
+                                                       <dd>
+                                                               <p>The iframe must be offset to the left by the width of the left border. This should be a negative number representing the border-left-width. If a number is used here, pixels will be assumed. Otherwise, be sure to specify a unit. An expression could also be used. By default the value is "auto" which will use an expression to get the border-left-width if it is in pixels.</p>
+                                                               <p><code>$('.fix-z-index').bgiframe({ left: '-1em' });</code></p>
+                                                       </dd>
+                                                       <dt><code>width</code></dt>
+                                                       <dd>
+                                                               <p>This is the width of the iframe. If a number is used here, pixels will be assume. Otherwise, be sure to specify a unit. An expression could also be used. By default the value is "auto" which will use an expression to get the offsetWidth.</p>
+                                                               <p><code>$('.fix-z-index').bgiframe({ width: 100 });</code></p>
+                                                       </dd>
+                                                       <dt><code>height</code></dt>
+                                                       <dd>
+                                                               <p>This is the height of the iframe. If a number is used here, pixels will be assume. Otherwise, be sure to specify a unit. An expression could also be used. By default the value is "auto" which will use an expression to get the offsetHeight.</p>
+                                                               <p><code>$('.fix-z-index').bgiframe({ height: 100 });</code></p>
+                                                       </dd>
+                                                       <dt><code>opacity</code></dt>
+                                                       <dd>
+                                                               <p>This is a boolean representing whether or not to use opacity. If set to true, the opacity of 0 is applied. If set to false, the opacity filter is not applied. Default: true.</p>
+                                                               <p><code>$('.fix-z-index').bgiframe({ opacity: false });</code></p>
+                                                       </dd>
+                                                       <dt><code>src</code></dt>
+                                                       <dd>
+                                                               <p>This setting is provided so that one could change the src of the iframe to whatever they need. Default: "javascript:false;"</p>
+                                                               <p><code>$('.fix-z-index').bgiframe({ src: '#' });</code></p>
+                                                       </dd>
+                                               </dl>
+                                       </dd>
+
+                                       <dt id="how_does_it_work" class="question">How does it work?</dt>
+                                       <dd class="answer">
+                                               <p>The bgiframe plugin works by prepending an iframe to the element. The iframe is given a class of bgiframe and positioned below all the other children of the element. In the default configuration it automatically adjusts to the width and height of the element (including the borders) and the opacity is set to 0. The element needs to have position (relative or absolute) and should have a background (color or image).</p>
+                                               <p>Check out the <a href="http://brandonaaron.net/jquery/plugins/bgiframe/test/">test page</a> to see the plugin in action.</p>
+                                       </dd>
+
+                                       <dt id="where_can_i_get_it" class="question">Where can I get it?</dt>
+                                       <dd class="answer">
+                                               <ul>
+                                                       <li><a href="http://jquery.com/plugins/files/bgiframe-2.1.zip">2.1 zip</a> from the bgiframe <a href="http://jquery.com/plugins/project/bgiframe">project page</a>.</li>
+                                                       <li>Latest SVN: http://jqueryjs.googlecode.com/svn/trunk/plugins/bgiframe/</li>
+                                                       <li>Tagged Versions in SVN: Latest SVN: http://jqueryjs.googlecode.com/svn/tags/plugins/bgiframe/</li>
+                                               </ul>
+                                       </dd>
+                                       
+                                       <dt id="suggestions_bugs_patches" class="question">Suggestions? Bugs? Patches?</dt>
+                                       <dd class="answer">
+                                               <p>Feel free to make any suggestions, bug reports or add any patches via the <a href="http://jquery.com/plugins/project/bgiframe">project page</a>.</p>
+                                       </dd>
+                               </dl>
+                               <p>The bgiframe plugin is authored by <a href="http://blog.brandonaaron.net/">Brandon Aaron (http://brandonaaron.net/)</a></p>
+                       </div>
+               </div>
+       </body>
+</html>
\ No newline at end of file
diff --git a/js/bgiframe/jquery.bgiframe.js b/js/bgiframe/jquery.bgiframe.js
new file mode 100644 (file)
index 0000000..49dc869
--- /dev/null
@@ -0,0 +1,100 @@
+/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ *
+ * $LastChangedDate: 2007-07-22 01:44:59 +0200 (dim, 22 jui 2007) $
+ * $Rev: 2446 $
+ *
+ * Version 2.1.1
+ */
+
+(function($){
+
+/**
+ * The bgiframe is chainable and applies the iframe hack to get 
+ * around zIndex issues in IE6. It will only apply itself in IE6 
+ * and adds a class to the iframe called 'bgiframe'. The iframe
+ * is appeneded as the first child of the matched element(s) 
+ * with a tabIndex and zIndex of -1.
+ * 
+ * By default the plugin will take borders, sized with pixel units,
+ * into account. If a different unit is used for the border's width,
+ * then you will need to use the top and left settings as explained below.
+ *
+ * NOTICE: This plugin has been reported to cause perfromance problems
+ * when used on elements that change properties (like width, height and
+ * opacity) a lot in IE6. Most of these problems have been caused by 
+ * the expressions used to calculate the elements width, height and 
+ * borders. Some have reported it is due to the opacity filter. All 
+ * these settings can be changed if needed as explained below.
+ *
+ * @example $('div').bgiframe();
+ * @before <div><p>Paragraph</p></div>
+ * @result <div><iframe class="bgiframe".../><p>Paragraph</p></div>
+ *
+ * @param Map settings Optional settings to configure the iframe.
+ * @option String|Number top The iframe must be offset to the top
+ *             by the width of the top border. This should be a negative 
+ *      number representing the border-top-width. If a number is 
+ *             is used here, pixels will be assumed. Otherwise, be sure
+ *             to specify a unit. An expression could also be used. 
+ *             By default the value is "auto" which will use an expression 
+ *             to get the border-top-width if it is in pixels.
+ * @option String|Number left The iframe must be offset to the left
+ *             by the width of the left border. This should be a negative 
+ *      number representing the border-left-width. If a number is 
+ *             is used here, pixels will be assumed. Otherwise, be sure
+ *             to specify a unit. An expression could also be used. 
+ *             By default the value is "auto" which will use an expression 
+ *             to get the border-left-width if it is in pixels.
+ * @option String|Number width This is the width of the iframe. If
+ *             a number is used here, pixels will be assume. Otherwise, be sure
+ *             to specify a unit. An experssion could also be used.
+ *             By default the value is "auto" which will use an experssion
+ *             to get the offsetWidth.
+ * @option String|Number height This is the height of the iframe. If
+ *             a number is used here, pixels will be assume. Otherwise, be sure
+ *             to specify a unit. An experssion could also be used.
+ *             By default the value is "auto" which will use an experssion
+ *             to get the offsetHeight.
+ * @option Boolean opacity This is a boolean representing whether or not
+ *             to use opacity. If set to true, the opacity of 0 is applied. If
+ *             set to false, the opacity filter is not applied. Default: true.
+ * @option String src This setting is provided so that one could change 
+ *             the src of the iframe to whatever they need.
+ *             Default: "javascript:false;"
+ *
+ * @name bgiframe
+ * @type jQuery
+ * @cat Plugins/bgiframe
+ * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
+ */
+$.fn.bgIframe = $.fn.bgiframe = function(s) {
+       // This is only for IE6
+       if ( $.browser.msie && /6.0/.test(navigator.userAgent) ) {
+               s = $.extend({
+                       top     : 'auto', // auto == .currentStyle.borderTopWidth
+                       left    : 'auto', // auto == .currentStyle.borderLeftWidth
+                       width   : 'auto', // auto == offsetWidth
+                       height  : 'auto', // auto == offsetHeight
+                       opacity : true,
+                       src     : 'javascript:false;'
+               }, s || {});
+               var prop = function(n){return n&&n.constructor==Number?n+'px':n;},
+                   html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+
+                              'style="display:block;position:absolute;z-index:-1;'+
+                                      (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+
+                                              'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+
+                                              'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+
+                                              'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+
+                                              'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+
+                                       '"/>';
+               return this.each(function() {
+                       if ( $('> iframe.bgiframe', this).length == 0 )
+                               this.insertBefore( document.createElement(html), this.firstChild );
+               });
+       }
+       return this;
+};
+
+})(jQuery);
\ No newline at end of file
diff --git a/js/bgiframe/jquery.bgiframe.min.js b/js/bgiframe/jquery.bgiframe.min.js
new file mode 100644 (file)
index 0000000..876ff43
--- /dev/null
@@ -0,0 +1,10 @@
+/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ *
+ * $LastChangedDate: 2007-07-22 01:45:56 +0200 (dim, 22 jui 2007) $
+ * $Rev: 2447 $
+ *
+ * Version 2.1.1
+ */
+(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);
\ No newline at end of file
diff --git a/js/bgiframe/jquery.bgiframe.pack.js b/js/bgiframe/jquery.bgiframe.pack.js
new file mode 100644 (file)
index 0000000..90dee9a
--- /dev/null
@@ -0,0 +1,10 @@
+/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ *
+ * $LastChangedDate: 2007-07-21 18:44:59 -0500 (Sat, 21 Jul 2007) $
+ * $Rev: 2446 $
+ *
+ * Version 2.1.1
+ */
+eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(b($){$.m.E=$.m.g=b(s){h($.x.10&&/6.0/.I(D.B)){s=$.w({c:\'3\',5:\'3\',8:\'3\',d:\'3\',k:M,e:\'F:i;\'},s||{});C a=b(n){f n&&n.t==r?n+\'4\':n},p=\'<o Y="g"W="0"R="-1"e="\'+s.e+\'"\'+\'Q="P:O;N:L;z-H:-1;\'+(s.k!==i?\'G:J(K=\\\'0\\\');\':\'\')+\'c:\'+(s.c==\'3\'?\'7(((l(2.9.j.A)||0)*-1)+\\\'4\\\')\':a(s.c))+\';\'+\'5:\'+(s.5==\'3\'?\'7(((l(2.9.j.y)||0)*-1)+\\\'4\\\')\':a(s.5))+\';\'+\'8:\'+(s.8==\'3\'?\'7(2.9.S+\\\'4\\\')\':a(s.8))+\';\'+\'d:\'+(s.d==\'3\'?\'7(2.9.v+\\\'4\\\')\':a(s.d))+\';\'+\'"/>\';f 2.T(b(){h($(\'> o.g\',2).U==0)2.V(q.X(p),2.u)})}f 2}})(Z);',62,63,'||this|auto|px|left||expression|width|parentNode||function|top|height|src|return|bgiframe|if|false|currentStyle|opacity|parseInt|fn||iframe|html|document|Number||constructor|firstChild|offsetHeight|extend|browser|borderLeftWidth||borderTopWidth|userAgent|var|navigator|bgIframe|javascript|filter|index|test|Alpha|Opacity|absolute|true|position|block|display|style|tabindex|offsetWidth|each|length|insertBefore|frameborder|createElement|class|jQuery|msie'.split('|'),0,{}))
\ No newline at end of file
diff --git a/js/bgiframe/test/index.html b/js/bgiframe/test/index.html
new file mode 100644 (file)
index 0000000..82be8e8
--- /dev/null
@@ -0,0 +1,197 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+       "http://www.w3.org/TR/html4/strict.dtd">
+<html debug="true">
+       <head>
+               <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+               <title>jQuery bgiframe Visual Test</title>
+               
+               <!-- load latest build of jquery.js -->
+               <script type="text/javascript" src="../../../jquery/dist/jquery.js"></script>
+
+               <!-- load dimensions.js (this is what we're testing! -->
+               <script type="text/javascript" src="../jquery.bgiframe.js"></script>
+               
+               <!-- load firebug lite 
+               <script type="text/javascript" src="http://brandon.jquery.com/firebuglite/firebug.js"></script>-->
+               
+               <link rel="Stylesheet" media="screen" href="../../../jquery/test/data/testsuite.css" />
+               
+               <script type="text/javascript" charset="utf-8">
+                       $(function() {
+                               $('#userAgent').html(navigator.userAgent);
+                               $('#box2').bgiframe();
+                               $('#box3').bgiframe({top: -5, left: -5});
+                               $('#box4').bgiframe({top: -5, left: -5, width: 270, height: 120});
+                               $('#box5').bgiframe({top: 0, left: 0, width: 260, height: 110});
+                               $('#box6').bgiframe({top: '-5px', left: '-5px', width: '270px', height: '120px'});
+                               $('#box7').bgiframe({top: '-.5em', left: '-.5em', width: '17em', height: '12em'});
+                               $('#box8').bgiframe({top: '-.5em', left: '-.5em'});
+                               $('#box9').bgiframe({opacity:false});
+                       });
+               </script>
+               
+               <style type="text/css" media="screen">
+                       #wrapper { position: relative; width: 100%; font: 12px Arial; }
+                               form { position: absolute; top: 0; left: 0; width: 100%; }
+                                       select { position: relative; width: 100%; margin: 0 0 2px; z-index: 1; }
+                               
+                               .box { position: relative; z-index: 2; float: left; margin: 5px; border: 5px solid #666; padding: 5px; width: 250px; height: 100px; color: #000; background-color: #999; }
+                                       dl { margin: 0; padding: 0; }
+                                               dt { float: left; margin: 0; padding: 0; width: 50px; }
+                                               dd { margin: 0; padding: 0; }
+                               #box7, #box8 { border-width: .5em; padding: .5em; width: 15em; height: 10em; }
+               </style>
+       </head>
+       <body>
+               <h1 id="banner">jQuery bgiframe - Visual Test</h1>
+               <h2 id="userAgent"></h2>
+               <div id="wrapper">
+                       <form action="#" method="get" accept-charset="utf-8">
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                               <select name="test"><option>Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing</option></select>
+                       </form>
+                       
+                       <div id="box1" class="box">nothing</div>
+                       <div id="box2" class="box">
+                               <dl>
+                                       <dt>top:</dt>
+                                       <dd>'auto'</dd>
+                                       
+                                       <dt>left:</dt>
+                                       <dd>'auto'</dd>
+                                       
+                                       <dt>width:</dt>
+                                       <dd>'auto'</dd>
+                                       
+                                       <dt>height:</dt>
+                                       <dd>'auto'</dd>
+                               </dl>
+                       </div>
+                       <div id="box3" class="box">
+                               <dl>
+                                       <dt>top:</dt>
+                                       <dd>0</dd>
+                                       
+                                       <dt>left:</dt>
+                                       <dd>0</dd>
+                                       
+                                       <dt>width:</dt>
+                                       <dd>'auto'</dd>
+                                       
+                                       <dt>height:</dt>
+                                       <dd>'auto'</dd>
+                               </dl>
+                       </div>
+                       <div id="box4" class="box">
+                               <dl>
+                                       <dt>top:</dt>
+                                       <dd>-5</dd>
+                                       
+                                       <dt>left:</dt>
+                                       <dd>-5</dd>
+                                       
+                                       <dt>width:</dt>
+                                       <dd>270</dd>
+                                       
+                                       <dt>height:</dt>
+                                       <dd>120</dd>
+                               </dl>
+                       </div>
+                       <div id="box5" class="box">
+                               <dl>
+                                       <dt>top:</dt>
+                                       <dd>0</dd>
+                                       
+                                       <dt>left:</dt>
+                                       <dd>0</dd>
+                                       
+                                       <dt>width:</dt>
+                                       <dd>260</dd>
+                                       
+                                       <dt>height:</dt>
+                                       <dd>110</dd>
+                               </dl>
+                       </div>
+                       <div id="box6" class="box">
+                               <dl>
+                                       <dt>top:</dt>
+                                       <dd>'-5px'</dd>
+                                       
+                                       <dt>left:</dt>
+                                       <dd>'-5px'</dd>
+                                       
+                                       <dt>width:</dt>
+                                       <dd>'270px'</dd>
+                                       
+                                       <dt>height:</dt>
+                                       <dd>'120px'</dd>
+                               </dl>
+                       </div>
+                       <div id="box7" class="box">
+                               <dl>
+                                       <dt>top:</dt>
+                                       <dd>'-.5em'</dd>
+                                       
+                                       <dt>left:</dt>
+                                       <dd>'-.5em'</dd>
+                                       
+                                       <dt>width:</dt>
+                                       <dd>'17em'</dd>
+                                       
+                                       <dt>height:</dt>
+                                       <dd>'12em'</dd>
+                               </dl>
+                       </div>
+                       <div id="box8" class="box">
+                               <dl>
+                                       <dt>top:</dt>
+                                       <dd>'-.5em'</dd>
+
+                                       <dt>left:</dt>
+                                       <dd>'-.5em'</dd>
+
+                                       <dt>width:</dt>
+                                       <dd>'auto'</dd>
+
+                                       <dt>height:</dt>
+                                       <dd>'auto'</dd>
+                               </dl>
+                       </div>
+                       <div id="box9" class="box">
+                               <dl>
+                                       <dt>top:</dt>
+                                       <dd>'auto'</dd>
+                                       
+                                       <dt>left:</dt>
+                                       <dd>'auto'</dd>
+                                       
+                                       <dt>width:</dt>
+                                       <dd>'auto'</dd>
+                                       
+                                       <dt>height:</dt>
+                                       <dd>'auto'</dd>
+                                       
+                                       <dt>opacity:</dt>
+                                       <dd>false</dd>
+                               </dl>
+                       </div>
+               </div>
+       </body>
+</html>
\ No newline at end of file
diff --git a/js/calendar.png b/js/calendar.png
new file mode 100644 (file)
index 0000000..05d0eae
Binary files /dev/null and b/js/calendar.png differ
diff --git a/js/datePicker/jquery.datePicker.js b/js/datePicker/jquery.datePicker.js
new file mode 100644 (file)
index 0000000..4999258
--- /dev/null
@@ -0,0 +1,1056 @@
+/**\r
+ * Copyright (c) 2007 Kelvin Luck (http://www.kelvinluck.com/)\r
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) \r
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.\r
+ *\r
+ * $Id: jquery.datePicker.js 3739 2007-10-25 13:55:30Z kelvin.luck $\r
+ **/\r
+\r
+(function($){\r
+    \r
+       $.fn.extend({\r
+/**\r
+ * Render a calendar table into any matched elements.\r
+ * \r
+ * @param Object s (optional) Customize your calendars.\r
+ * @option Number month The month to render (NOTE that months are zero based). Default is today's month.\r
+ * @option Number year The year to render. Default is today's year.\r
+ * @option Function renderCallback A reference to a function that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Default is no callback.\r
+ * @option Number showHeader Whether or not to show the header row, possible values are: $.dpConst.SHOW_HEADER_NONE (no header), $.dpConst.SHOW_HEADER_SHORT (first letter of each day) and $.dpConst.SHOW_HEADER_LONG (full name of each day). Default is $.dpConst.SHOW_HEADER_SHORT.\r
+ * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class.\r
+ * @type jQuery\r
+ * @name renderCalendar\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('#calendar-me').renderCalendar({month:0, year:2007});\r
+ * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me.\r
+ *\r
+ * @example\r
+ * var testCallback = function($td, thisDate, month, year)\r
+ * {\r
+ * if ($td.is('.current-month') && thisDate.getDay() == 4) {\r
+ *             var d = thisDate.getDate();\r
+ *             $td.bind(\r
+ *                     'click',\r
+ *                     function()\r
+ *                     {\r
+ *                             alert('You clicked on ' + d + '/' + (Number(month)+1) + '/' + year);\r
+ *                     }\r
+ *             ).addClass('thursday');\r
+ *     } else if (thisDate.getDay() == 5) {\r
+ *             $td.html('Friday the ' + $td.html() + 'th');\r
+ *     }\r
+ * }\r
+ * $('#calendar-me').renderCalendar({month:0, year:2007, renderCallback:testCallback});\r
+ * \r
+ * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me. Every Thursday in the current month has a class of "thursday" applied to it, is clickable and shows an alert when clicked. Every Friday on the calendar has the number inside replaced with text.\r
+ **/\r
+               renderCalendar  :   function(s)\r
+               {\r
+                       var dc = function(a)\r
+                       {\r
+                               return document.createElement(a);\r
+                       };\r
+                       \r
+                       s = $.extend(\r
+                               {\r
+                                       month                   : null,\r
+                                       year                    : null,\r
+                                       renderCallback  : null,\r
+                                       showHeader              : $.dpConst.SHOW_HEADER_SHORT,\r
+                                       dpController    : null,\r
+                                       hoverClass              : 'dp-hover'\r
+                               }\r
+                               , s\r
+                       );\r
+                       \r
+                       if (s.showHeader != $.dpConst.SHOW_HEADER_NONE) {\r
+                               var headRow = $(dc('tr'));\r
+                               for (var i=Date.firstDayOfWeek; i<Date.firstDayOfWeek+7; i++) {\r
+                                       var weekday = i%7;\r
+                                       var day = Date.dayNames[weekday];\r
+                                       headRow.append(\r
+                                               jQuery(dc('th')).attr({'scope':'col', 'abbr':day, 'title':day, 'class':(weekday == 0 || weekday == 6 ? 'weekend' : 'weekday')}).html(s.showHeader == $.dpConst.SHOW_HEADER_SHORT ? day.substr(0, 1) : day)\r
+                                       );\r
+                               }\r
+                       };\r
+                       \r
+                       var calendarTable = $(dc('table'))\r
+                                                                       .attr(\r
+                                                                               {\r
+                                                                                       'cellspacing':2,\r
+                                                                                       'className':'jCalendar'\r
+                                                                               }\r
+                                                                       )\r
+                                                                       .append(\r
+                                                                               (s.showHeader != $.dpConst.SHOW_HEADER_NONE ? \r
+                                                                                       $(dc('thead'))\r
+                                                                                               .append(headRow)\r
+                                                                                       :\r
+                                                                                       dc('thead')\r
+                                                                               )\r
+                                                                       );\r
+                       var tbody = $(dc('tbody'));\r
+                       \r
+                       var today = (new Date()).zeroTime();\r
+                       \r
+                       var month = s.month == undefined ? today.getMonth() : s.month;\r
+                       var year = s.year || today.getFullYear();\r
+                       \r
+                       var currentDate = new Date(year, month, 1);\r
+                       \r
+                       \r
+                       var firstDayOffset = Date.firstDayOfWeek - currentDate.getDay() + 1;\r
+                       if (firstDayOffset > 1) firstDayOffset -= 7;\r
+                       var weeksToDraw = Math.ceil(( (-1*firstDayOffset+1) + currentDate.getDaysInMonth() ) /7);\r
+                       currentDate.addDays(firstDayOffset-1);\r
+                       \r
+                       var doHover = function()\r
+                       {\r
+                               if (s.hoverClass) {\r
+                                       $(this).addClass(s.hoverClass);\r
+                               }\r
+                       };\r
+                       var unHover = function()\r
+                       {\r
+                               if (s.hoverClass) {\r
+                                       $(this).removeClass(s.hoverClass);\r
+                               }\r
+                       };\r
+                       \r
+                       var w = 0;\r
+                       while (w++<weeksToDraw) {\r
+                               var r = jQuery(dc('tr'));\r
+                               for (var i=0; i<7; i++) {\r
+                                       var thisMonth = currentDate.getMonth() == month;\r
+                                       var d = $(dc('td'))\r
+                                                               .text(currentDate.getDate() + '')\r
+                                                               .attr('className', (thisMonth ? 'current-month ' : 'other-month ') +\r
+                                                                                                       (currentDate.isWeekend() ? 'weekend ' : 'weekday ') +\r
+                                                                                                       (thisMonth && currentDate.getTime() == today.getTime() ? 'today ' : '')\r
+                                                               )\r
+                                                               .hover(doHover, unHover)\r
+                                                       ;\r
+                                       if (s.renderCallback) {\r
+                                               s.renderCallback(d, currentDate, month, year);\r
+                                       }\r
+                                       r.append(d);\r
+                                       currentDate.addDays(1);\r
+                               }\r
+                               tbody.append(r);\r
+                       }\r
+                       calendarTable.append(tbody);\r
+                       \r
+                       return this.each(\r
+                               function()\r
+                               {\r
+                                       $(this).empty().append(calendarTable);\r
+                               }\r
+                       );\r
+               },\r
+/**\r
+ * Create a datePicker associated with each of the matched elements.\r
+ *\r
+ * The matched element will receive a few custom events with the following signatures:\r
+ *\r
+ * dateSelected(event, date, $td, status)\r
+ * Triggered when a date is selected. event is a reference to the event, date is the Date selected, $td is a jquery object wrapped around the TD that was clicked on and status is whether the date was selected (true) or deselected (false)\r
+ * \r
+ * dpClosed(event, selected)\r
+ * Triggered when the date picker is closed. event is a reference to the event and selected is an Array containing Date objects.\r
+ *\r
+ * dpMonthChanged(event, displayedMonth, displayedYear)\r
+ * Triggered when the month of the popped up calendar is changed. event is a reference to the event, displayedMonth is the number of the month now displayed (zero based) and displayedYear is the year of the month.\r
+ *\r
+ * dpDisplayed(event, $datePickerDiv)\r
+ * Triggered when the date picker is created. $datePickerDiv is the div containing the date picker. Use this event to add custom content/ listeners to the popped up date picker.\r
+ *\r
+ * @param Object s (optional) Customize your date pickers.\r
+ * @option Number month The month to render when the date picker is opened (NOTE that months are zero based). Default is today's month.\r
+ * @option Number year The year to render when the date picker is opened. Default is today's year.\r
+ * @option String startDate The first date date can be selected.\r
+ * @option String endDate The last date that can be selected.\r
+ * @option Boolean inline Whether to create the datePicker as inline (e.g. always on the page) or as a model popup. Default is false (== modal popup)\r
+ * @option Boolean createButton Whether to create a .dp-choose-date anchor directly after the matched element which when clicked will trigger the showing of the date picker. Default is true.\r
+ * @option Boolean showYearNavigation Whether to display buttons which allow the user to navigate through the months a year at a time. Default is true.\r
+ * @option Boolean closeOnSelect Whether to close the date picker when a date is selected. Default is true.\r
+ * @option Boolean displayClose Whether to create a "Close" button within the date picker popup. Default is false.\r
+ * @option Boolean selectMultiple Whether a user should be able to select multiple dates with this date picker. Default is false.\r
+ * @option Boolean clickInput If the matched element is an input type="text" and this option is true then clicking on the input will cause the date picker to appear.\r
+ * @option Number verticalPosition The vertical alignment of the popped up date picker to the matched element. One of $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM. Default is $.dpConst.POS_TOP.\r
+ * @option Number horizontalPosition The horizontal alignment of the popped up date picker to the matched element. One of $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT.\r
+ * @option Number verticalOffset The number of pixels offset from the defined verticalPosition of this date picker that it should pop up in. Default in 0.\r
+ * @option Number horizontalOffset The number of pixels offset from the defined horizontalPosition of this date picker that it should pop up in. Default in 0.\r
+ * @option (Function|Array) renderCallback A reference to a function (or an array of seperate functions) that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Each callback function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. Default is no callback.\r
+ * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class.\r
+ * @type jQuery\r
+ * @name datePicker\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('input.date-picker').datePicker();\r
+ * @desc Creates a date picker button next to all matched input elements. When the button is clicked on the value of the selected date will be placed in the corresponding input (formatted according to Date.format).\r
+ *\r
+ * @example demo/index.html\r
+ * @desc See the projects homepage for many more complex examples...\r
+ **/\r
+               datePicker : function(s)\r
+               {                       \r
+                       if (!$.event._dpCache) $.event._dpCache = [];\r
+                       \r
+                       // initialise the date picker controller with the relevant settings...\r
+                       s = $.extend(\r
+                               {\r
+                                       month                           : undefined,\r
+                                       year                            : undefined,\r
+                                       startDate                       : undefined,\r
+                                       endDate                         : undefined,\r
+                                       inline                          : false,\r
+                                       renderCallback          : [],\r
+                                       createButton            : true,\r
+                                       showYearNavigation      : true,\r
+                                       closeOnSelect           : true,\r
+                                       displayClose            : false,\r
+                                       selectMultiple          : false,\r
+                                       clickInput                      : false,\r
+                                       verticalPosition        : $.dpConst.POS_TOP,\r
+                                       horizontalPosition      : $.dpConst.POS_LEFT,\r
+                                       verticalOffset          : 0,\r
+                                       horizontalOffset        : 0,\r
+                                       hoverClass                      : 'dp-hover'\r
+                               }\r
+                               , s\r
+                       );\r
+                       \r
+                       return this.each(\r
+                               function()\r
+                               {\r
+                                       var $this = $(this);\r
+                                       var alreadyExists = true;\r
+                                       \r
+                                       if (!this._dpId) {\r
+                                               this._dpId = $.event.guid++;\r
+                                               $.event._dpCache[this._dpId] = new DatePicker(this);\r
+                                               alreadyExists = false;\r
+                                       }\r
+                                       \r
+                                       if (s.inline) {\r
+                                               s.createButton = false;\r
+                                               s.displayClose = false;\r
+                                               s.closeOnSelect = false;\r
+                                               $this.empty();\r
+                                       }\r
+                                       \r
+                                       var controller = $.event._dpCache[this._dpId];\r
+                                       \r
+                                       controller.init(s);\r
+                                       \r
+                                       if (!alreadyExists && s.createButton) {\r
+                                               // create it!\r
+                                               controller.button = $('<a href="#" class="dp-choose-date" title="' + $.dpText.TEXT_CHOOSE_DATE + '">' + $.dpText.TEXT_CHOOSE_DATE + '</a>')\r
+                                                               .bind(\r
+                                                                       'click',\r
+                                                                       function()\r
+                                                                       {\r
+                                                                               $this.dpDisplay(this);\r
+                                                                               this.blur();\r
+                                                                               return false;\r
+                                                                       }\r
+                                                               );\r
+                                               $this.after(controller.button);\r
+                                       }\r
+                                       \r
+                                       if (!alreadyExists && $this.is(':text')) {\r
+                                               $this\r
+                                                       .bind(\r
+                                                               'dateSelected',\r
+                                                               function(e, selectedDate, $td)\r
+                                                               {\r
+                                                                       this.value = selectedDate.asString();\r
+                                                               }\r
+                                                       ).bind(\r
+                                                               'change',\r
+                                                               function()\r
+                                                               {\r
+                                                                       var d = Date.fromString(this.value);\r
+                                                                       if (d) {\r
+                                                                               controller.setSelected(d, true, true);\r
+                                                                       }\r
+                                                               }\r
+                                                       );\r
+                                               if (s.clickInput) {\r
+                                                       $this.bind(\r
+                                                               'click',\r
+                                                               function()\r
+                                                               {\r
+                                                                       $this.dpDisplay();\r
+                                                               }\r
+                                                       );\r
+                                               }\r
+                                               var d = Date.fromString(this.value);\r
+                                               if (this.value != '' && d) {\r
+                                                       controller.setSelected(d, true, true);\r
+                                               }\r
+                                       }\r
+                                       \r
+                                       $this.addClass('dp-applied');\r
+                                       \r
+                               }\r
+                       )\r
+               },\r
+/**\r
+ * Disables or enables this date picker\r
+ *\r
+ * @param Boolean s Whether to disable (true) or enable (false) this datePicker\r
+ * @type jQuery\r
+ * @name dpSetDisabled\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('.date-picker').datePicker();\r
+ * $('.date-picker').dpSetDisabled(true);\r
+ * @desc Prevents this date picker from displaying and adds a class of dp-disabled to it (and it's associated button if it has one) for styling purposes. If the matched element is an input field then it will also set the disabled attribute to stop people directly editing the field.\r
+ **/\r
+               dpSetDisabled : function(s)\r
+               {\r
+                       return _w.call(this, 'setDisabled', s);\r
+               },\r
+/**\r
+ * Updates the first selectable date for any date pickers on any matched elements.\r
+ *\r
+ * @param String d A string representing the first selectable date (formatted according to Date.format).\r
+ * @type jQuery\r
+ * @name dpSetStartDate\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('.date-picker').datePicker();\r
+ * $('.date-picker').dpSetStartDate('01/01/2000');\r
+ * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the first selectable date for each of these to the first day of the millenium.\r
+ **/\r
+               dpSetStartDate : function(d)\r
+               {\r
+                       return _w.call(this, 'setStartDate', d);\r
+               },\r
+/**\r
+ * Updates the last selectable date for any date pickers on any matched elements.\r
+ *\r
+ * @param String d A string representing the last selectable date (formatted according to Date.format).\r
+ * @type jQuery\r
+ * @name dpSetEndDate\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('.date-picker').datePicker();\r
+ * $('.date-picker').dpSetEndDate('01/01/2010');\r
+ * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the last selectable date for each of these to the first Janurary 2010.\r
+ **/\r
+               dpSetEndDate : function(d)\r
+               {\r
+                       return _w.call(this, 'setEndDate', d);\r
+               },\r
+/**\r
+ * Gets a list of Dates currently selected by this datePicker. This will be an empty array if no dates are currently selected or NULL if there is no datePicker associated with the matched element.\r
+ *\r
+ * @type Array\r
+ * @name dpGetSelected\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('.date-picker').datePicker();\r
+ * alert($('.date-picker').dpGetSelected());\r
+ * @desc Will alert an empty array (as nothing is selected yet)\r
+ **/\r
+               dpGetSelected : function()\r
+               {\r
+                       var c = _getController(this[0]);\r
+                       if (c) {\r
+                               return c.getSelected();\r
+                       }\r
+                       return null;\r
+               },\r
+/**\r
+ * Selects or deselects a date on any matched element's date pickers. Deselcting is only useful on date pickers where selectMultiple==true. Selecting will only work if the passed date is within the startDate and endDate boundries for a given date picker.\r
+ *\r
+ * @param String d A string representing the date you want to select (formatted according to Date.format).\r
+ * @param Boolean v Whether you want to select (true) or deselect (false) this date. Optional - default = true.\r
+ * @param Boolean m Whether you want the date picker to open up on the month of this date when it is next opened. Optional - default = true.\r
+ * @type jQuery\r
+ * @name dpSetSelected\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('.date-picker').datePicker();\r
+ * $('.date-picker').dpSetSelected('01/01/2010');\r
+ * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010.\r
+ **/\r
+               dpSetSelected : function(d, v, m)\r
+               {\r
+                       if (v == undefined) v=true;\r
+                       if (m == undefined) m=true;\r
+                       return _w.call(this, 'setSelected', Date.fromString(d), v, m);\r
+               },\r
+/**\r
+ * Sets the month that will be displayed when the date picker is next opened. If the passed month is before startDate then the month containing startDate will be displayed instead. If the passed month is after endDate then the month containing the endDate will be displayed instead.\r
+ *\r
+ * @param Number m The month you want the date picker to display. Optional - defaults to the currently displayed month.\r
+ * @param Number y The year you want the date picker to display. Optional - defaults to the currently displayed year.\r
+ * @type jQuery\r
+ * @name dpSetDisplayedMonth\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('.date-picker').datePicker();\r
+ * $('.date-picker').dpSetDisplayedMonth(10, 2008);\r
+ * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010.\r
+ **/\r
+               dpSetDisplayedMonth : function(m, y)\r
+               {\r
+                       return _w.call(this, 'setDisplayedMonth', Number(m), Number(y));\r
+               },\r
+/**\r
+ * Displays the date picker associated with the matched elements. Since only one date picker can be displayed at once then the date picker associated with the last matched element will be the one that is displayed.\r
+ *\r
+ * @param HTMLElement e An element that you want the date picker to pop up relative in position to. Optional - default behaviour is to pop up next to the element associated with this date picker.\r
+ * @type jQuery\r
+ * @name dpDisplay\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('#date-picker').datePicker();\r
+ * $('#date-picker').dpDisplay();\r
+ * @desc Creates a date picker associated with the element with an id of date-picker and then causes it to pop up.\r
+ **/\r
+               dpDisplay : function(e)\r
+               {\r
+                       return _w.call(this, 'display', e);\r
+               },\r
+/**\r
+ * Sets a function or array of functions that is called when each TD of the date picker popup is rendered to the page\r
+ *\r
+ * @param (Function|Array) a A function or an array of functions that are called when each td is rendered. Each function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year.\r
+ * @type jQuery\r
+ * @name dpSetRenderCallback\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('#date-picker').datePicker();\r
+ * $('#date-picker').dpSetRenderCallback(function($td, thisDate, month, year)\r
+ * {\r
+ *     // do stuff as each td is rendered dependant on the date in the td and the displayed month and year\r
+ * });\r
+ * @desc Creates a date picker associated with the element with an id of date-picker and then creates a function which is called as each td is rendered when this date picker is displayed.\r
+ **/\r
+               dpSetRenderCallback : function(a)\r
+               {\r
+                       return _w.call(this, 'setRenderCallback', a);\r
+               },\r
+/**\r
+ * Sets the position that the datePicker will pop up (relative to it's associated element)\r
+ *\r
+ * @param Number v The vertical alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM\r
+ * @param Number h The horizontal alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT\r
+ * @type jQuery\r
+ * @name dpSetPosition\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('#date-picker').datePicker();\r
+ * $('#date-picker').dpSetPosition($.dpConst.POS_BOTTOM, $.dpConst.POS_RIGHT);\r
+ * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be bottom and right aligned to the #date-picker element.\r
+ **/\r
+               dpSetPosition : function(v, h)\r
+               {\r
+                       return _w.call(this, 'setPosition', v, h);\r
+               },\r
+/**\r
+ * Sets the offset that the popped up date picker will have from it's default position relative to it's associated element (as set by dpSetPosition)\r
+ *\r
+ * @param Number v The vertical offset of the created date picker.\r
+ * @param Number h The horizontal offset of the created date picker.\r
+ * @type jQuery\r
+ * @name dpSetOffset\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('#date-picker').datePicker();\r
+ * $('#date-picker').dpSetOffset(-20, 200);\r
+ * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be 20 pixels above and 200 pixels to the right of it's default position.\r
+ **/\r
+               dpSetOffset : function(v, h)\r
+               {\r
+                       return _w.call(this, 'setOffset', v, h);\r
+               },\r
+/**\r
+ * Closes the open date picker associated with this element.\r
+ *\r
+ * @type jQuery\r
+ * @name dpClose\r
+ * @cat plugins/datePicker\r
+ * @author Kelvin Luck (http://www.kelvinluck.com/)\r
+ *\r
+ * @example $('.date-pick')\r
+ *             .datePicker()\r
+ *             .bind(\r
+ *                     'focus',\r
+ *                     function()\r
+ *                     {\r
+ *                             $(this).dpDisplay();\r
+ *                     }\r
+ *             ).bind(\r
+ *                     'blur',\r
+ *                     function()\r
+ *                     {\r
+ *                             $(this).dpClose();\r
+ *                     }\r
+ *             );\r
+ * @desc Creates a date picker and makes it appear when the relevant element is focused and disappear when it is blurred.\r
+ **/\r
+               dpClose : function()\r
+               {\r
+                       return _w.call(this, '_closeCalendar', false, this[0]);\r
+               },\r
+               // private function called on unload to clean up any expandos etc and prevent memory links...\r
+               _dpDestroy : function()\r
+               {\r
+                       // TODO - implement this?\r
+               }\r
+       });\r
+       \r
+       // private internal function to cut down on the amount of code needed where we forward\r
+       // dp* methods on the jQuery object on to the relevant DatePicker controllers...\r
+       var _w = function(f, a1, a2, a3)\r
+       {\r
+               return this.each(\r
+                       function()\r
+                       {\r
+                               var c = _getController(this);\r
+                               if (c) {\r
+                                       c[f](a1, a2, a3);\r
+                               }\r
+                       }\r
+               );\r
+       };\r
+       \r
+       function DatePicker(ele)\r
+       {\r
+               this.ele = ele;\r
+               \r
+               // initial values...\r
+               this.displayedMonth             =       null;\r
+               this.displayedYear              =       null;\r
+               this.startDate                  =       null;\r
+               this.endDate                    =       null;\r
+               this.showYearNavigation =       null;\r
+               this.closeOnSelect              =       null;\r
+               this.displayClose               =       null;\r
+               this.selectMultiple             =       null;\r
+               this.verticalPosition   =       null;\r
+               this.horizontalPosition =       null;\r
+               this.verticalOffset             =       null;\r
+               this.horizontalOffset   =       null;\r
+               this.button                             =       null;\r
+               this.renderCallback             =       [];\r
+               this.selectedDates              =       {};\r
+               this.inline                             =       null;\r
+               this.context                    =       '#dp-popup';\r
+       };\r
+       $.extend(\r
+               DatePicker.prototype,\r
+               {       \r
+                       init : function(s)\r
+                       {\r
+                               this.setStartDate(s.startDate);\r
+                               this.setEndDate(s.endDate);\r
+                               this.setDisplayedMonth(Number(s.month), Number(s.year));\r
+                               this.setRenderCallback(s.renderCallback);\r
+                               this.showYearNavigation = s.showYearNavigation;\r
+                               this.closeOnSelect = s.closeOnSelect;\r
+                               this.displayClose = s.displayClose;\r
+                               this.selectMultiple = s.selectMultiple;\r
+                               this.verticalPosition = s.verticalPosition;\r
+                               this.horizontalPosition = s.horizontalPosition;\r
+                               this.hoverClass = s.hoverClass;\r
+                               this.setOffset(s.verticalOffset, s.horizontalOffset);\r
+                               this.inline = s.inline;\r
+                               if (this.inline) {\r
+                                       this.context = this.ele;\r
+                                       this.display();\r
+                               }\r
+                       },\r
+                       setStartDate : function(d)\r
+                       {\r
+                               if (d) {\r
+                                       this.startDate = Date.fromString(d);\r
+                               }\r
+                               if (!this.startDate) {\r
+                                       this.startDate = (new Date()).zeroTime();\r
+                               }\r
+                               this.setDisplayedMonth(this.displayedMonth, this.displayedYear);\r
+                       },\r
+                       setEndDate : function(d)\r
+                       {\r
+                               if (d) {\r
+                                       this.endDate = Date.fromString(d);\r
+                               }\r
+                               if (!this.endDate) {\r
+                                       this.endDate = (new Date('12/31/2999')); // using the JS Date.parse function which expects mm/dd/yyyy\r
+                               }\r
+                               if (this.endDate.getTime() < this.startDate.getTime()) {\r
+                                       this.endDate = this.startDate;\r
+                               }\r
+                               this.setDisplayedMonth(this.displayedMonth, this.displayedYear);\r
+                       },\r
+                       setPosition : function(v, h)\r
+                       {\r
+                               this.verticalPosition = v;\r
+                               this.horizontalPosition = h;\r
+                       },\r
+                       setOffset : function(v, h)\r
+                       {\r
+                               this.verticalOffset = parseInt(v) || 0;\r
+                               this.horizontalOffset = parseInt(h) || 0;\r
+                       },\r
+                       setDisabled : function(s)\r
+                       {\r
+                               $e = $(this.ele);\r
+                               $e[s ? 'addClass' : 'removeClass']('dp-disabled');\r
+                               if (this.button) {\r
+                                       $but = $(this.button);\r
+                                       $but[s ? 'addClass' : 'removeClass']('dp-disabled');\r
+                                       $but.attr('title', s ? '' : $.dpText.TEXT_CHOOSE_DATE);\r
+                               }\r
+                               if ($e.is(':text')) {\r
+                                       $e.attr('disabled', s ? 'disabled' : '');\r
+                               }\r
+                       },\r
+                       setDisplayedMonth : function(m, y)\r
+                       {\r
+                               if (this.startDate == undefined || this.endDate == undefined) {\r
+                                       return;\r
+                               }\r
+                               var s = new Date(this.startDate.getTime());\r
+                               s.setDate(1);\r
+                               var e = new Date(this.endDate.getTime());\r
+                               e.setDate(1);\r
+                               \r
+                               var t;\r
+                               if ((!m && !y) || (isNaN(m) && isNaN(y))) {\r
+                                       // no month or year passed - default to current month\r
+                                       t = new Date().zeroTime();\r
+                                       t.setDate(1);\r
+                               } else if (isNaN(m)) {\r
+                                       // just year passed in - presume we want the displayedMonth\r
+                                       t = new Date(y, this.displayedMonth, 1);\r
+                               } else if (isNaN(y)) {\r
+                                       // just month passed in - presume we want the displayedYear\r
+                                       t = new Date(this.displayedYear, m, 1);\r
+                               } else {\r
+                                       // year and month passed in - that's the date we want!\r
+                                       t = new Date(y, m, 1)\r
+                               }\r
+                               \r
+                               // check if the desired date is within the range of our defined startDate and endDate\r
+                               if (t.getTime() < s.getTime()) {\r
+                                       t = s;\r
+                               } else if (t.getTime() > e.getTime()) {\r
+                                       t = e;\r
+                               }\r
+                               this.displayedMonth = t.getMonth();\r
+                               this.displayedYear = t.getFullYear();\r
+                       },\r
+                       setSelected : function(d, v, moveToMonth)\r
+                       {\r
+                               if (this.selectMultiple == false) {\r
+                                       this.selectedDates = {};\r
+                                       $('td.selected', this.context).removeClass('selected');\r
+                               }\r
+                               if (moveToMonth) {\r
+                                       this.setDisplayedMonth(d.getMonth(), d.getFullYear());\r
+                               }\r
+                               this.selectedDates[d.toString()] = v;\r
+                       },\r
+                       isSelected : function(d)\r
+                       {\r
+                               return this.selectedDates[d.toString()];\r
+                       },\r
+                       getSelected : function()\r
+                       {\r
+                               var r = [];\r
+                               for(s in this.selectedDates) {\r
+                                       if (this.selectedDates[s] == true) {\r
+                                               r.push(Date.parse(s));\r
+                                       }\r
+                               }\r
+                               return r;\r
+                       },\r
+                       display : function(eleAlignTo)\r
+                       {\r
+                               if ($(this.ele).is('.dp-disabled')) return;\r
+                               \r
+                               eleAlignTo = eleAlignTo || this.ele;\r
+                               var c = this;\r
+                               var $ele = $(eleAlignTo);\r
+                               var eleOffset = $ele.offset();\r
+                               \r
+                               var $createIn;\r
+                               var attrs;\r
+                               var attrsCalendarHolder;\r
+                               var cssRules;\r
+                               \r
+                               if (c.inline) {\r
+                                       $createIn = $(this.ele);\r
+                                       attrs = {\r
+                                               'id'            :       'calendar-' + this.ele._dpId,\r
+                                               'className'     :       'dp-popup dp-popup-inline'\r
+                                       };\r
+                                       cssRules = {\r
+                                       };\r
+                               } else {\r
+                                       $createIn = $('body');\r
+                                       attrs = {\r
+                                               'id'            :       'dp-popup',\r
+                                               'className'     :       'dp-popup'\r
+                                       };\r
+                                       cssRules = {\r
+                                               'top'   :       eleOffset.top + c.verticalOffset,\r
+                                               'left'  :       eleOffset.left + c.horizontalOffset\r
+                                       };\r
+                                       \r
+                                       var _checkMouse = function(e)\r
+                                       {\r
+                                               var el = e.target;\r
+                                               var cal = $('#dp-popup')[0];\r
+                                               \r
+                                               while (true){\r
+                                                       if (el == cal) {\r
+                                                               return true;\r
+                                                       } else if (el == document) {\r
+                                                               c._closeCalendar();\r
+                                                               return false;\r
+                                                       } else {\r
+                                                               el = $(el).parent()[0];\r
+                                                       }\r
+                                               }\r
+                                       };\r
+                                       this._checkMouse = _checkMouse;\r
+                               \r
+                                       this._closeCalendar(true);\r
+                               }\r
+                               \r
+                               \r
+                               $createIn\r
+                                       .append(\r
+                                               $('<div></div>')\r
+                                                       .attr(attrs)\r
+                                                       .css(cssRules)\r
+                                                       .append(\r
+                                                               $('<h2></h2>'),\r
+                                                               $('<div class="dp-nav-prev"></div>')\r
+                                                                       .append(\r
+                                                                               $('<a class="dp-nav-prev-year" href="#" title="' + $.dpText.TEXT_PREV_YEAR + '">&lt;&lt;</a>')\r
+                                                                                       .bind(\r
+                                                                                               'click',\r
+                                                                                               function()\r
+                                                                                               {\r
+                                                                                                       return c._displayNewMonth.call(c, this, 0, -1);\r
+                                                                                               }\r
+                                                                                       ),\r
+                                                                               $('<a class="dp-nav-prev-month" href="#" title="' + $.dpText.TEXT_PREV_MONTH + '">&lt;</a>')\r
+                                                                                       .bind(\r
+                                                                                               'click',\r
+                                                                                               function()\r
+                                                                                               {\r
+                                                                                                       return c._displayNewMonth.call(c, this, -1, 0);\r
+                                                                                               }\r
+                                                                                       )\r
+                                                                       ),\r
+                                                               $('<div class="dp-nav-next"></div>')\r
+                                                                       .append(\r
+                                                                               $('<a class="dp-nav-next-year" href="#" title="' + $.dpText.TEXT_NEXT_YEAR + '">&gt;&gt;</a>')\r
+                                                                                       .bind(\r
+                                                                                               'click',\r
+                                                                                               function()\r
+                                                                                               {\r
+                                                                                                       return c._displayNewMonth.call(c, this, 0, 1);\r
+                                                                                               }\r
+                                                                                       ),\r
+                                                                               $('<a class="dp-nav-next-month" href="#" title="' + $.dpText.TEXT_NEXT_MONTH + '">&gt;</a>')\r
+                                                                                       .bind(\r
+                                                                                               'click',\r
+                                                                                               function()\r
+                                                                                               {\r
+                                                                                                       return c._displayNewMonth.call(c, this, 1, 0);\r
+                                                                                               }\r
+                                                                                       )\r
+                                                                       ),\r
+                                                               $('<div></div>')\r
+                                                                       .attr('className', 'dp-calendar')\r
+                                                       )\r
+                                                       .bgIframe()\r
+                                               );\r
+                                       \r
+                               var $pop = this.inline ? $('.dp-popup', this.context) : $('#dp-popup');\r
+                               \r
+                               if (this.showYearNavigation == false) {\r
+                                       $('.dp-nav-prev-year, .dp-nav-next-year', c.context).css('display', 'none');\r
+                               }\r
+                               if (this.displayClose) {\r
+                                       $pop.append(\r
+                                               $('<a href="#" id="dp-close">' + $.dpText.TEXT_CLOSE + '</a>')\r
+                                                       .bind(\r
+                                                               'click',\r
+                                                               function()\r
+                                                               {\r
+                                                                       c._closeCalendar();\r
+                                                                       return false;\r
+                                                               }\r
+                                                       )\r
+                                       );\r
+                               }\r
+                               c._renderCalendar();\r
+                               \r
+                               $(this.ele).trigger('dpDisplayed', $pop);\r
+                               \r
+                               if (!c.inline) {\r
+                                       if (this.verticalPosition == $.dpConst.POS_BOTTOM) {\r
+                                               $pop.css('top', eleOffset.top + $ele.height() - $pop.height() + c.verticalOffset);\r
+                                       }\r
+                                       if (this.horizontalPosition == $.dpConst.POS_RIGHT) {\r
+                                               $pop.css('left', eleOffset.left + $ele.width() - $pop.width() + c.horizontalOffset);\r
+                                       }\r
+                                       $(document).bind('mousedown', this._checkMouse);\r
+                               }\r
+                       },\r
+                       setRenderCallback : function(a)\r
+                       {\r
+                               if (a && typeof(a) == 'function') {\r
+                                       a = [a];\r
+                               }\r
+                               this.renderCallback = this.renderCallback.concat(a);\r
+                       },\r
+                       cellRender : function ($td, thisDate, month, year) {\r
+                               var c = this.dpController;\r
+                               var d = new Date(thisDate.getTime());\r
+                               \r
+                               // add our click handlers to deal with it when the days are clicked...\r
+                               \r
+                               $td.bind(\r
+                                       'click',\r
+                                       function()\r
+                                       {\r
+                                               var $this = $(this);\r
+                                               if (!$this.is('.disabled')) {\r
+                                                       c.setSelected(d, !$this.is('.selected') || !c.selectMultiple);\r
+                                                       var s = c.isSelected(d);\r
+                                                       $(c.ele).trigger('dateSelected', [d, $td, s]);\r
+                                                       $(c.ele).trigger('change');\r
+                                                       if (c.closeOnSelect) {\r
+                                                               c._closeCalendar();\r
+                                                       } else {\r
+                                                               $this[s ? 'addClass' : 'removeClass']('selected');\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               );\r
+                               \r
+                               if (c.isSelected(d)) {\r
+                                       $td.addClass('selected');\r
+                               }\r
+                               \r
+                               // call any extra renderCallbacks that were passed in\r
+                               for (var i=0; i<c.renderCallback.length; i++) {\r
+                                       c.renderCallback[i].apply(this, arguments);\r
+                               }\r
+                               \r
+                               \r
+                       },\r
+                       // ele is the clicked button - only proceed if it doesn't have the class disabled...\r
+                       // m and y are -1, 0 or 1 depending which direction we want to go in...\r
+                       _displayNewMonth : function(ele, m, y) \r
+                       {\r
+                               if (!$(ele).is('.disabled')) {\r
+                                       this.setDisplayedMonth(this.displayedMonth + m, this.displayedYear + y);\r
+                                       this._clearCalendar();\r
+                                       this._renderCalendar();\r
+                                       $(this.ele).trigger('dpMonthChanged', [this.displayedMonth, this.displayedYear]);\r
+                               }\r
+                               ele.blur();\r
+                               return false;\r
+                       },\r
+                       _renderCalendar : function()\r
+                       {\r
+                               // set the title...\r
+                               $('h2', this.context).html(Date.monthNames[this.displayedMonth] + ' ' + this.displayedYear);\r
+                               \r
+                               // render the calendar...\r
+                               $('.dp-calendar', this.context).renderCalendar(\r
+                                       {\r
+                                               month                   : this.displayedMonth,\r
+                                               year                    : this.displayedYear,\r
+                                               renderCallback  : this.cellRender,\r
+                                               dpController    : this,\r
+                                               hoverClass              : this.hoverClass\r
+                                       }\r
+                               );\r
+                               \r
+                               // update the status of the control buttons and disable dates before startDate or after endDate...\r
+                               // TODO: When should the year buttons be disabled? When you can't go forward a whole year from where you are or is that annoying?\r
+                               if (this.displayedYear == this.startDate.getFullYear() && this.displayedMonth == this.startDate.getMonth()) {\r
+                                       $('.dp-nav-prev-year', this.context).addClass('disabled');\r
+                                       $('.dp-nav-prev-month', this.context).addClass('disabled');\r
+                                       $('.dp-calendar td.other-month', this.context).each(\r
+                                               function()\r
+                                               {\r
+                                                       var $this = $(this);\r
+                                                       if (Number($this.text()) > 20) {\r
+                                                               $this.addClass('disabled');\r
+                                                       }\r
+                                               }\r
+                                       );\r
+                                       var d = this.startDate.getDate();\r
+                                       $('.dp-calendar td.current-month', this.context).each(\r
+                                               function()\r
+                                               {\r
+                                                       var $this = $(this);\r
+                                                       if (Number($this.text()) < d) {\r
+                                                               $this.addClass('disabled');\r
+                                                       }\r
+                                               }\r
+                                       );\r
+                               } else {\r
+                                       $('.dp-nav-prev-year', this.context).removeClass('disabled');\r
+                                       $('.dp-nav-prev-month', this.context).removeClass('disabled');\r
+                                       var d = this.startDate.getDate();\r
+                                       if (d > 20) {\r
+                                               // check if the startDate is last month as we might need to add some disabled classes...\r
+                                               var sd = new Date(this.startDate.getTime());\r
+                                               sd.addMonths(1);\r
+                                               if (this.displayedYear == sd.getFullYear() && this.displayedMonth == sd.getMonth()) {\r
+                                                       $('dp-calendar td.other-month', this.context).each(\r
+                                                               function()\r
+                                                               {\r
+                                                                       var $this = $(this);\r
+                                                                       if (Number($this.text()) < d) {\r
+                                                                               $this.addClass('disabled');\r
+                                                                       }\r
+                                                               }\r
+                                                       );\r
+                                               }\r
+                                       }\r
+                               }\r
+                               if (this.displayedYear == this.endDate.getFullYear() && this.displayedMonth == this.endDate.getMonth()) {\r
+                                       $('.dp-nav-next-year', this.context).addClass('disabled');\r
+                                       $('.dp-nav-next-month', this.context).addClass('disabled');\r
+                                       $('.dp-calendar td.other-month', this.context).each(\r
+                                               function()\r
+                                               {\r
+                                                       var $this = $(this);\r
+                                                       if (Number($this.text()) < 14) {\r
+                                                               $this.addClass('disabled');\r
+                                                       }\r
+                                               }\r
+                                       );\r
+                                       var d = this.endDate.getDate();\r
+                                       $('.dp-calendar td.current-month', this.context).each(\r
+                                               function()\r
+                                               {\r
+                                                       var $this = $(this);\r
+                                                       if (Number($this.text()) > d) {\r
+                                                               $this.addClass('disabled');\r
+                                                       }\r
+                                               }\r
+                                       );\r
+                               } else {\r
+                                       $('.dp-nav-next-year', this.context).removeClass('disabled');\r
+                                       $('.dp-nav-next-month', this.context).removeClass('disabled');\r
+                                       var d = this.endDate.getDate();\r
+                                       if (d < 13) {\r
+                                               // check if the endDate is next month as we might need to add some disabled classes...\r
+                                               var ed = new Date(this.endDate.getTime());\r
+                                               ed.addMonths(-1);\r
+                                               if (this.displayedYear == ed.getFullYear() && this.displayedMonth == ed.getMonth()) {\r
+                                                       $('.dp-calendar td.other-month', this.context).each(\r
+                                                               function()\r
+                                                               {\r
+                                                                       var $this = $(this);\r
+                                                                       if (Number($this.text()) > d) {\r
+                                                                               $this.addClass('disabled');\r
+                                                                       }\r
+                                                               }\r
+                                                       );\r
+                                               }\r
+                                       }\r
+                               }\r
+                       },\r
+                       _closeCalendar : function(programatic, ele)\r
+                       {\r
+                               if (!ele || ele == this.ele)\r
+                               {\r
+                                       $(document).unbind('mousedown', this._checkMouse);\r
+                                       this._clearCalendar();\r
+                                       $('#dp-popup a').unbind();\r
+                                       $('#dp-popup').empty().remove();\r
+                                       if (!programatic) {\r
+                                               $(this.ele).trigger('dpClosed', [this.getSelected()]);\r
+                                       }\r
+                               }\r
+                       },\r
+                       // empties the current dp-calendar div and makes sure that all events are unbound\r
+                       // and expandos removed to avoid memory leaks...\r
+                       _clearCalendar : function()\r
+                       {\r
+                               // TODO.\r
+                               $('.dp-calendar td', this.context).unbind();\r
+                               $('.dp-calendar', this.context).empty();\r
+                       }\r
+               }\r
+       );\r
+       \r
+       // static constants\r
+       $.dpConst = {\r
+               SHOW_HEADER_NONE        :       0,\r
+               SHOW_HEADER_SHORT       :       1,\r
+               SHOW_HEADER_LONG        :       2,\r
+               POS_TOP                         :       0,\r
+               POS_BOTTOM                      :       1,\r
+               POS_LEFT                        :       0,\r
+               POS_RIGHT                       :       1\r
+       };\r
+       // localisable text\r
+       $.dpText = {\r
+               TEXT_PREV_YEAR          :       'Previous year',\r
+               TEXT_PREV_MONTH         :       'Previous month',\r
+               TEXT_NEXT_YEAR          :       'Next year',\r
+               TEXT_NEXT_MONTH         :       'Next month',\r
+               TEXT_CLOSE                      :       'Close',\r
+               TEXT_CHOOSE_DATE        :       'Choose date'\r
+       };\r
+       // version\r
+       $.dpVersion = '$Id: jquery.datePicker.js 3739 2007-10-25 13:55:30Z kelvin.luck $';\r
+\r
+       function _getController(ele)\r
+       {\r
+               if (ele._dpId) return $.event._dpCache[ele._dpId];\r
+               return false;\r
+       };\r
+       \r
+       // make it so that no error is thrown if bgIframe plugin isn't included (allows you to use conditional\r
+       // comments to only include bgIframe where it is needed in IE without breaking this plugin).\r
+       if ($.fn.bgIframe == undefined) {\r
+               $.fn.bgIframe = function() {return this; };\r
+       };\r
+\r
+\r
+       // clean-up\r
+       $(window)\r
+               .bind('unload', function() {\r
+                       var els = $.event._dpCache || [];\r
+                       for (var i in els) {\r
+                               $(els[i].ele)._dpDestroy();\r
+                       }\r
+               });\r
+               \r
+       \r
+})(jQuery);\r
diff --git a/js/jquery.js b/js/jquery.js
new file mode 100644 (file)
index 0000000..fbe2312
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * jQuery 1.2.2 - New Wave Javascript
+ *
+ * Copyright (c) 2007 John Resig (jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: 2008-01-14 17:56:07 -0500 (Mon, 14 Jan 2008) $
+ * $Rev: 4454 $
+ */
+(function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else
+selector=[];}}else
+return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.2",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div"),container2=document.createElement("div");container.appendChild(clone);container2.innerHTML=container.innerHTML;return container2.firstChild;}else
+return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
+selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
+return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[value];jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
+this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
+jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){if(target===options[name])continue;if(deep&&options[name]&&typeof options[name]=="object"&&target[name]&&!options[name].nodeType)target[name]=jQuery.extend(target[name],options[name]);else if(options[name]!=undefined)target[name]=options[name];}return target;};var expando="jQuery"+(new Date()).getTime(),uuid=0,windowData={};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/function/i.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
+script.appendChild(document.createTextNode(data));head.appendChild(script);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!=undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){if(args){if(object.length==undefined){for(var name in object)if(callback.apply(object[name],args)===false)break;}else
+for(var i=0,length=object.length;i<length;i++)if(callback.apply(object[i],args)===false)break;}else{if(object.length==undefined){for(var name in object)if(callback.call(object[name],name,object[name])===false)break;}else
+for(var i=0,length=object.length,value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
+jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.display;elem.style.display="block";elem.style.display=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(getComputedStyle&&getComputedStyle.getPropertyValue(name))||"";for(var i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var style=elem.style.left,runtimeStyle=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;elem.style.left=ret||0;ret=elem.style.pixelLeft+"px";elem.style.left=style;elem.runtimeStyle.left=runtimeStyle;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem=elem.toString();if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
+ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(fix[name]){if(value!=undefined)elem[fix[name]]=value;return elem[fix[name]];}else if(jQuery.browser.msie&&name=="style")return jQuery.attr(elem.style,"cssText",value);else if(value==undefined&&jQuery.browser.msie&&jQuery.nodeName(elem,"form")&&(name=="action"||name=="method"))return elem.getAttributeNode(name).nodeValue;else if(elem.tagName){if(value!=undefined){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem.setAttribute(name,""+value);}if(jQuery.browser.msie&&/href|src/.test(name)&&!jQuery.isXMLDoc(elem))return elem.getAttribute(name,2);return elem.getAttribute(name);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i<length;i++)ret.push(array[i]);else
+ret=array.slice(0);return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]==elem)return i;return-1;},merge:function(first,second){if(jQuery.browser.msie){for(var i=0;second[i];i++)if(second[i].nodeType!=8)first.push(second[i]);}else
+for(var i=0;second[i];i++)first.push(second[i]);return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){if(typeof callback=="string")callback=eval("false||function(a,i){return "+callback+"}");var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv&&callback(elems[i],i)||inv&&!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!==null&&value!=undefined){if(value.constructor!=Array)value=[value];ret=ret.concat(value);}}return ret;}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected",maxlength:"maxLength",selectedIndex:"selectedIndex",defaultValue:"defaultValue",tagName:"tagName",nodeName:"nodeName"}});jQuery.each({parent:"elem.parentNode",parents:"jQuery.dir(elem,'parentNode')",next:"jQuery.nth(elem,2,'nextSibling')",prev:"jQuery.nth(elem,2,'previousSibling')",nextAll:"jQuery.dir(elem,'nextSibling')",prevAll:"jQuery.dir(elem,'previousSibling')",siblings:"jQuery.sibling(elem.parentNode.firstChild,elem)",children:"jQuery.sibling(elem.firstChild)",contents:"jQuery.nodeName(elem,'iframe')?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)"},function(name,fn){fn=eval("false||function(elem){return "+fn+"}");jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":"m[2]=='*'||jQuery.nodeName(a,m[2])","#":"a.getAttribute('id')==m[2]",":":{lt:"i<m[3]-0",gt:"i>m[3]-0",nth:"m[3]-0==i",eq:"m[3]-0==i",first:"i==0",last:"i==r.length-1",even:"i%2==0",odd:"i%2","first-child":"a.parentNode.getElementsByTagName('*')[0]==a","last-child":"jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a","only-child":"!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')",parent:"a.firstChild",empty:"!a.firstChild",contains:"(a.textContent||a.innerText||jQuery(a).text()||'').indexOf(m[3])>=0",visible:'"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"',hidden:'"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"',enabled:"!a.disabled",disabled:"a.disabled",checked:"a.checked",selected:"a.selected||jQuery.attr(a,'selected')",text:"'text'==a.type",radio:"'radio'==a.type",checkbox:"'checkbox'==a.type",file:"'file'==a.type",password:"'password'==a.type",submit:"'submit'==a.type",image:"'image'==a.type",reset:"'reset'==a.type",button:'"button"==a.type||jQuery.nodeName(a,"button")',input:"/input|select|textarea|button/i.test(a.nodeName)",has:"jQuery.find(m[3],a).length",header:"/h\\d/i.test(a.nodeName)",animated:"jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length"}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var f=jQuery.expr[m[1]];if(typeof f!="string")f=jQuery.expr[m[1]][m[2]];f=eval("false||function(a,i){return "+f+"}");r=jQuery.grep(r,f,not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[];var cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&(!elem||n!=elem))r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined)for(var type in events)this.remove(elem,type);else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
+for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}if(jQuery.browser.msie)event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=originalEvent.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){return this.each(function(){jQuery.event.add(this,type,function(event){jQuery(this).unbind(event);return(fn||data).apply(this,arguments);},fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){if(this[0])return jQuery.event.trigger(type,data,this[0],false,fn);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
+jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({load:function(url,params,callback){if(jQuery.isFunction(url))return this.bind("load",url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=(new Date).getTime();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(s.type.toLowerCase()=="get"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&(s.dataType=="script"||s.dataType=="json")&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{if(s.data)xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend)s.beforeSend(xml);if(s.global)jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
+jQuery.handleError(s,xml,status);complete();if(s.async)xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xml){xml.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||r.status==1223||jQuery.browser.safari&&r.status==undefined;}catch(e){}return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");return xml.status==304||xmlRes==jQuery.lastModified[url]||jQuery.browser.safari&&xml.status==undefined;}catch(e){}return false;},httpData:function(r,type){var ct=r.getResponseHeader("content-type");var xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0;var data=xml?r.responseXML:r.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
+for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
+s.push(encodeURIComponent(j)+"="+encodeURIComponent(a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(fn,fn2):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);var hidden=jQuery(this).is(":hidden"),self=this;for(var p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return jQuery.isFunction(opt.complete)&&opt.complete.apply(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
+e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.apply(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",array?jQuery.makeArray(array):[]);return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].apply(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:{slow:600,fast:200}[opt.duration])||400;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.apply(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.apply(this.elem,[this.now,this]);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=(new Date()).getTime();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=(new Date()).getTime();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.fx.step={scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522,fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})();
\ No newline at end of file
diff --git a/js/jquery.simplemodal.js b/js/jquery.simplemodal.js
new file mode 100644 (file)
index 0000000..3e85c00
--- /dev/null
@@ -0,0 +1,368 @@
+/*
+ * SimpleModal @VERSION - jQuery Plugin
+ * http://www.ericmmartin.com/projects/simplemodal/
+ * http://plugins.jquery.com/project/SimpleModal
+ * http://code.google.com/p/simplemodal/
+ *
+ * Copyright (c) 2007 Eric Martin - http://ericmmartin.com
+ *
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * Revision: $Id: jquery.simplemodal.js 99 2008-02-04 16:31:09Z emartin24 $
+ *
+ */
+
+/**
+ * SimpleModal is a lightweight jQuery plugin that provides a simple
+ * interface to create a modal dialog.
+ *
+ * The goal of SimpleModal is to provide developers with a cross-browser 
+ * overlay and container that will be populated with data provided to
+ * SimpleModal.
+ *
+ * There are two ways to call SimpleModal:
+ * 1) As a chained function on a jQuery object, like $('#myDiv').modal();.
+ * This call would place the DOM object, #myDiv, inside a modal dialog.
+ * Chaining requires a jQuery object. An optional options object can be
+ * passed as a parameter.
+ *
+ * @example $('<div>my data</div>').modal({options});
+ * @example $('#myDiv').modal({options});
+ * @example jQueryObject.modal({options});
+ *
+ * 2) As a stand-alone function, like $.modal(data). The data parameter
+ * is required and an optional options object can be passed as a second
+ * parameter. This method provides more flexibility in the types of data 
+ * that are allowed. The data could be a DOM object, a jQuery object, HTML
+ * or a string.
+ * 
+ * @example $.modal('<div>my data</div>', {options});
+ * @example $.modal('my data', {options});
+ * @example $.modal($('#myDiv'), {options});
+ * @example $.modal(jQueryObject, {options});
+ * @example $.modal(document.getElementById('myDiv'), {options}); 
+ * 
+ * A SimpleModal call can contain multiple elements, but only one modal 
+ * dialog can be created at a time. Which means that all of the matched
+ * elements will be displayed within the modal container.
+ * 
+ * SimpleModal internally sets the CSS needed to display the modal dialog
+ * properly in all browsers, yet provides the developer with the flexibility
+ * to easily control the look and feel. The styling for SimpleModal can be 
+ * done through external stylesheets, or through SimpleModal, using the
+ * overlayCss and/or containerCss options.
+ *
+ * SimpleModal has been tested in the following browsers:
+ * - IE 6, 7
+ * - Firefox 2
+ * - Opera 9
+ * - Safari 3
+ *
+ * @name SimpleModal
+ * @type jQuery
+ * @requires jQuery v1.1.2
+ * @cat Plugins/Windows and Overlays
+ * @author Eric Martin (http://ericmmartin.com)
+ * @version @VERSION
+ */
+(function ($) {
+       /*
+        * Stand-alone function to create a modal dialog.
+        * 
+        * @param {string, object} data A string, jQuery object or DOM object
+        * @param {object} [options] An optional object containing options overrides
+        */
+       $.modal = function (data, options) {
+               return $.modal.impl.init(data, options);
+       };
+
+       /*
+        * Stand-alone close function to close the modal dialog
+        */
+       $.modal.close = function () {
+               // call close with the external parameter set to true
+               $.modal.impl.close(true);
+       };
+
+       /*
+        * Chained function to create a modal dialog.
+        * 
+        * @param {object} [options] An optional object containing options overrides
+        */
+       $.fn.modal = function (options) {
+               return $.modal.impl.init(this, options);
+       };
+
+       /*
+        * SimpleModal default options
+        * 
+        * overlay: (Number:50) The overlay div opacity value, from 0 - 100
+        * overlayId: (String:'modalOverlay') The DOM element id for the overlay div
+        * overlayCss: (Object:{}) The CSS styling for the overlay div
+        * containerId: (String:'modalContainer') The DOM element id for the container div
+        * containerCss: (Object:{}) The CSS styling for the container div
+        * close: (Boolean:true) Show the default window close icon? Uses CSS class modalCloseImg
+        * closeTitle: (String:'Close') The title value of the default close link. Depends on close
+        * closeClass: (String:'modalClose') The CSS class used to bind to the close event
+        * persist: (Boolean:false) Persist the data across modal calls? Only used for existing
+                   DOM elements. If true, the data will be maintained across modal calls, if false,
+                               the data will be reverted to its original state.
+        * onOpen: (Function:null) The callback function used in place of SimpleModal's open
+        * onShow: (Function:null) The callback function used after the modal dialog has opened
+        * onClose: (Function:null) The callback function used in place of SimpleModal's close
+        */
+       $.modal.defaults = {
+               overlay: 50,
+               overlayId: 'modalOverlay',
+               overlayCss: {},
+               containerId: 'modalContainer',
+               containerCss: {},
+               close: true,
+               closeTitle: 'Close',
+               closeClass: 'modalClose',
+               persist: false,
+               onOpen: null,
+               onShow: null,
+               onClose: null
+       };
+
+       /*
+        * Main modal object
+        */
+       $.modal.impl = {
+               /*
+                * Modal dialog options
+                */
+               opts: null,
+               /*
+                * Contains the modal dialog elements and is the object passed 
+                * back to the callback (onOpen, onShow, onClose) functions
+                */
+               dialog: {},
+               /*
+                * Initialize the modal dialog
+                */
+               init: function (data, options) {
+                       // don't allow multiple calls
+                       if (this.dialog.data) {
+                               return false;
+                       }
+
+                       // merge defaults and user options
+                       this.opts = $.extend({}, $.modal.defaults, options);
+
+                       // determine how to handle the data based on its type
+                       if (typeof data == 'object') {
+                               // convert DOM object to a jQuery object
+                               data = data instanceof jQuery ? data : $(data);
+
+                               // if the object came from the DOM, keep track of its parent
+                               if (data.parent().parent().size() > 0) {
+                                       this.dialog.parentNode = data.parent();
+
+                                       // persist changes? if not, make a clone of the element
+                                       if (!this.opts.persist) {
+                                               this.dialog.original = data.clone(true);
+                                       }
+                               }
+                       }
+                       else if (typeof data == 'string' || typeof data == 'number') {
+                               // just insert the data as innerHTML
+                               data = $('<div>').html(data);
+                       }
+                       else {
+                               // unsupported data type!
+                               if (console) {
+                                       console.log('SimpleModal Error: Unsupported data type: ' + typeof data);
+                               }
+                               return false;
+                       }
+                       this.dialog.data = data.addClass('modalData');
+                       data = null;
+
+                       // create the modal overlay, container and, if necessary, iframe
+                       this.create();
+
+                       // display the modal dialog
+                       this.open();
+
+                       // useful for adding events/manipulating data in the modal dialog
+                       if ($.isFunction(this.opts.onShow)) {
+                               this.opts.onShow.apply(this, [this.dialog]);
+                       }
+
+                       // don't break the chain =)
+                       return this;
+               },
+               /*
+                * Create and add the modal overlay and container to the page
+                */
+               create: function () {
+                       // create the overlay
+                       this.dialog.overlay = $('<div>')
+                               .attr('id', this.opts.overlayId)
+                               .addClass('modalOverlay')
+                               .css($.extend(this.opts.overlayCss, {
+                                       opacity: this.opts.overlay / 100,
+                                       height: '100%',
+                                       width: '100%',
+                                       position: 'fixed',
+                                       left: 0,
+                                       top: 0,
+                                       zIndex: 3000
+                               }))
+                               .hide()
+                               .appendTo('body');
+
+                       // create the container
+                       this.dialog.container = $('<div>')
+                               .attr('id', this.opts.containerId)
+                               .addClass('modalContainer')
+                               .css($.extend(this.opts.containerCss, {
+                                       position: 'fixed', 
+                                       zIndex: 3100
+                               }))
+                               .append(this.opts.close 
+                                       ? '<a class="modalCloseImg ' 
+                                               + this.opts.closeClass 
+                                               + '" title="' 
+                                               + this.opts.closeTitle + '"></a>'
+                                       : '')
+                               .hide()
+                               .appendTo('body');
+
+                       // fix issues with IE and create an iframe
+                       if ($.browser.msie && ($.browser.version < 7)) {
+                               this.fixIE();
+                       }
+
+                       // hide the data and add it to the container
+                       this.dialog.container.append(this.dialog.data.hide());
+               },
+               /*
+                * Bind events
+                */
+               bindEvents: function () {
+                       var modal = this;
+
+                       // bind the close event to any element with the closeClass class
+                       $('.' + this.opts.closeClass).click(function (e) {
+                               e.preventDefault();
+                               modal.close();
+                       });
+               },
+               /*
+                * Unbind events
+                */
+               unbindEvents: function () {
+                       // remove the close event
+                       $('.' + this.opts.closeClass).unbind('click');
+               },
+               /*
+                * Fix issues in IE 6
+                */
+               fixIE: function () {
+                       var wHeight = $(document.body).height() + 'px';
+                       var wWidth = $(document.body).width() + 'px';
+
+                       // position hacks
+                       this.dialog.overlay.css({position: 'absolute', height: wHeight, width: wWidth});
+                       this.dialog.container.css({position: 'absolute'});
+
+                       // add an iframe to prevent select options from bleeding through
+                       this.dialog.iframe = $('<iframe src="javascript:false;">')
+                               .css($.extend(this.opts.iframeCss, {
+                                       opacity: 0, 
+                                       position: 'absolute',
+                                       height: wHeight,
+                                       width: wWidth,
+                                       zIndex: 1000,
+                                       width: '100%',
+                                       top: 0,
+                                       left: 0
+                               }))
+                               .hide()
+                               .appendTo('body');
+               },
+               /*
+                * Open the modal dialog elements
+                * - Note: If you use the onOpen callback, you must "show" the 
+                *         overlay and container elements manually 
+                *         (the iframe will be handled by SimpleModal)
+                */
+               open: function () {
+                       // display the iframe
+                       if (this.dialog.iframe) {
+                               this.dialog.iframe.show();
+                       }
+
+                       if ($.isFunction(this.opts.onOpen)) {
+                               // execute the onOpen callback 
+                               this.opts.onOpen.apply(this, [this.dialog]);
+                       }
+                       else {
+                               // display the remaining elements
+                               this.dialog.overlay.show();
+                               this.dialog.container.show();
+                               this.dialog.data.show();
+                       }
+
+                       // bind default events
+                       this.bindEvents();
+               },
+               /*
+                * Close the modal dialog
+                * - Note: If you use an onClose callback, you must remove the 
+                *         overlay, container and iframe elements manually
+                *
+                * @param {boolean} external Indicates whether the call to this
+                *     function was internal or external. If it was external, the
+                *     onClose callback will be ignored
+                */
+               close: function (external) {
+                       // prevent close when dialog does not exist
+                       if (!this.dialog.data) {
+                               return false;
+                       }
+
+                       if ($.isFunction(this.opts.onClose) && !external) {
+                               // execute the onClose callback
+                               this.opts.onClose.apply(this, [this.dialog]);
+                       }
+                       else {
+                               // if the data came from the DOM, put it back
+                               if (this.dialog.parentNode) {
+                                       // save changes to the data?
+                                       if (this.opts.persist) {
+                                               // insert the (possibly) modified data back into the DOM
+                                               this.dialog.data.hide().appendTo(this.dialog.parentNode);
+                                       }
+                                       else {
+                                               // remove the current and insert the original, 
+                                               // unmodified data back into the DOM
+                                               this.dialog.data.remove();
+                                               this.dialog.original.appendTo(this.dialog.parentNode);
+                                       }
+                               }
+                               else {
+                                       // otherwise, remove it
+                                       this.dialog.data.remove();
+                               }
+
+                               // remove the remaining elements
+                               this.dialog.container.remove();
+                               this.dialog.overlay.remove();
+                               if (this.dialog.iframe) {
+                                       this.dialog.iframe.remove();
+                               }
+
+                               // reset the dialog object
+                               this.dialog = {};
+                       }
+
+                       // remove the default events
+                       this.unbindEvents();
+               }
+       };
+})(jQuery);
\ No newline at end of file
diff --git a/js/methods/array.js b/js/methods/array.js
new file mode 100644 (file)
index 0000000..a1ced15
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * Array prototype extensions. Doesn't depend on any
+ * other code. Doens't overwrite existing methods.
+ *
+ * Adds forEach, every, some, map, filter, indexOf and unique.
+ *
+ * Copyright (c) 2006 Jörn Zaefferer
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ *
+ */
+
+(function() {
+       
+       /**
+        * Adds a given method under the given name 
+        * to the Array prototype if it doesn't
+        * currently exist.
+        *
+        * @private
+        */
+       function add(name, method) {
+               if( !Array.prototype[name] ) {
+                       Array.prototype[name] = method;
+               }
+       };
+       
+       /**
+        * Executes a provided function once per array element.
+        *
+        * @example var stuff = "";
+        * ["foo", "bar"].forEach(function(element, index, array) {
+        *   stuff += element;
+        * });
+        * @result "foobar";
+        *
+        * @param Function handler Function to execute for each element.
+        * @param Object scope (optional) Object to use as 'this' when executing handler.
+        * @name forEach
+        * @type undefined
+        * @cat Plugins/Methods/Array
+        */
+       add("forEach", function(handler, scope) {
+               scope = scope || window;
+               for( var i = 0; i < this.length; i++)
+                       handler.call(scope, this[i], i, this);
+       });
+       
+       /**
+        * Tests whether all elements in the array pass the test
+        * implemented by the provided function.
+        *
+        * @example [12, 54, 18, 130, 44].every(function(element, index, array) {
+        *   return element >= 10;
+        * });
+        * @result true;
+        *
+        * @example [12, 5, 8, 130, 44].every(function(element, index, array) {
+        *   return element >= 10;
+        * });
+        * @result false;
+        *
+        * @param Function handler Function to execute for each element.
+        * @param Object scope (optional) Object to use as 'this' when executing handler.
+        * @name every
+        * @type Boolean
+        * @cat Plugins/Methods/Array
+        */
+       add("every", function(handler, scope) {
+               scope = scope || window;
+               for( var i = 0; i < this.length; i++)
+                       if( !handler.call(scope, this[i], i, this) )
+                               return false;
+               return true;
+       });
+       
+       /**
+        * Tests whether at least one element in the array passes the test
+        * implemented by the provided function.
+        *
+        * @example [12, 5, 8, 1, 44].some(function(element, index, array) {
+        *   return element >= 10;
+        * });
+        * @result true;
+        *
+        * @example [2, 5, 8, 1, 4].some(function(element, index, array) {
+        *   return element >= 10;
+        * });
+        * @result false;
+        *
+        * @param Function handler Function to execute for each element.
+        * @param Object scope (optional) Object to use as 'this' when executing handler.
+        * @name some
+        * @type Boolean
+        * @cat Plugins/Methods/Array
+        */
+       add("some", function(handler, scope) {
+               scope = scope || window;
+               for( var i = 0; i < this.length; i++)
+                       if( handler.call(scope, this[i], i, this) )
+                               return true;
+               return false;
+       });
+       
+       /**
+        * Creates a new array with the results of
+        * calling a provided function on every element in this array.
+        *
+        * @example ["hello", "Array", "WORLD"].map(function(element, index, array) {
+        *   return element.toUpperCase();
+        * });
+        * @result ["HELLO", "ARRAY", "WORLD"];
+        *
+        * @example [1, 4, 9].map(Math.sqrt);
+        * @result [1, 2, 3];
+        *
+        * @param Function handler Function to execute for each element.
+        * @param Object scope (optional) Object to use as 'this' when executing handler.
+        * @name map
+        * @type Array
+        * @cat Plugins/Methods/Array
+        */
+       add("map", function(handler, scope) {
+               scope = scope || window;
+               var r = [];
+               for( var i = 0; i < this.length; i++)
+                       r[r.length] = handler.call(scope, this[i], i, this);
+               return r;
+       });
+       
+       /**
+        * Creates a new array with all elements that pass
+        * the test implemented by the provided function.
+        *
+        * @example [12, 5, 8, 1, 44].filter(function(element, index, array) {
+        *   return element >= 10;
+        * });
+        * @result [12, 44];
+        *
+        * @param Function handler Function to execute for each element.
+        * @param Object scope (optional) Object to use as 'this' when executing handler.
+        * @name filter
+        * @type Array
+        * @cat Plugins/Methods/Array
+        */
+       add("filter", function(handler, scope) {
+               scope = scope || window;
+               var r = [];
+               for( var i = 0; i < this.length; i++)
+                       if( handler.call(scope, this[i], i, this) )
+                               r[r.length] = this[i];
+               return r;
+       });
+       
+       /**
+        * Returns the first index at which a given element can
+        * be found in the array, or -1 if it is not present.
+        *
+        * @example [12, 5, 8, 5, 44].indexOf(5);
+        * @result 1;
+        *
+        * @example [12, 5, 8, 5, 44].indexOf(5, 2);
+        * @result 3;
+        *
+        * @param Object subject Object to search for
+        * @param Number offset (optional) Index at which to start searching
+        * @name filter
+        * @type Array
+        * @cat Plugins/Methods/Array
+        */
+       add("indexOf", function(subject, offset) {
+               for( var i = offset || 0; i < this.length; i++)
+                       if ( this[i] === subject )
+                   return i;
+               return -1;
+       });
+       
+       /**
+        * Returns a new array that contains all unique elements
+        * of this array.
+        *
+        * @example [1, 2, 1, 4, 5, 4].unique();
+        * @result [1, 2, 4, 5]
+        *
+        * @name unique
+        * @type Array
+        * @cat Plugins/Methods/Array
+        */
+       add("unique", function() {
+               return this.filter(function(element, index, array) {
+                       return array.indexOf(element) >= index;
+               });
+       });
+       
+})();
\ No newline at end of file
diff --git a/js/methods/date.js b/js/methods/date.js
new file mode 100644 (file)
index 0000000..d35b126
--- /dev/null
@@ -0,0 +1,467 @@
+/*
+ * Date prototype extensions. Doesn't depend on any
+ * other code. Doens't overwrite existing methods.
+ *
+ * Adds dayNames, abbrDayNames, monthNames and abbrMonthNames static properties and isLeapYear,
+ * isWeekend, isWeekDay, getDaysInMonth, getDayName, getMonthName, getDayOfYear, getWeekOfYear,
+ * setDayOfYear, addYears, addMonths, addDays, addHours, addMinutes, addSeconds methods
+ *
+ * Copyright (c) 2006 Jörn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
+ *
+ * Additional methods and properties added by Kelvin Luck: firstDayOfWeek, dateFormat, zeroTime, asString, fromString -
+ * I've added my name to these methods so you know who to blame if they are broken!
+ * 
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ *
+ */
+
+/**
+ * An Array of day names starting with Sunday.
+ * 
+ * @example dayNames[0]
+ * @result 'Sunday'
+ *
+ * @name dayNames
+ * @type Array
+ * @cat Plugins/Methods/Date
+ */
+Date.dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
+
+/**
+ * An Array of abbreviated day names starting with Sun.
+ * 
+ * @example abbrDayNames[0]
+ * @result 'Sun'
+ *
+ * @name abbrDayNames
+ * @type Array
+ * @cat Plugins/Methods/Date
+ */
+Date.abbrDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
+
+/**
+ * An Array of month names starting with Janurary.
+ * 
+ * @example monthNames[0]
+ * @result 'January'
+ *
+ * @name monthNames
+ * @type Array
+ * @cat Plugins/Methods/Date
+ */
+Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
+
+/**
+ * An Array of abbreviated month names starting with Jan.
+ * 
+ * @example abbrMonthNames[0]
+ * @result 'Jan'
+ *
+ * @name monthNames
+ * @type Array
+ * @cat Plugins/Methods/Date
+ */
+Date.abbrMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+
+/**
+ * The first day of the week for this locale.
+ *
+ * @name firstDayOfWeek
+ * @type Number
+ * @cat Plugins/Methods/Date
+ * @author Kelvin Luck
+ */
+Date.firstDayOfWeek = 1;
+
+/**
+ * The format that string dates should be represented as (e.g. 'dd/mm/yyyy' for UK, 'mm/dd/yyyy' for US, 'yyyy-mm-dd' for Unicode etc).
+ *
+ * @name format
+ * @type String
+ * @cat Plugins/Methods/Date
+ * @author Kelvin Luck
+ */
+Date.format = 'dd/mm/yyyy';
+//Date.format = 'mm/dd/yyyy';
+//Date.format = 'yyyy-mm-dd';
+//Date.format = 'dd mmm yy';
+
+/**
+ * The first two numbers in the century to be used when decoding a two digit year. Since a two digit year is ambiguous (and date.setYear
+ * only works with numbers < 99 and so doesn't allow you to set years after 2000) we need to use this to disambiguate the two digit year codes.
+ *
+ * @name format
+ * @type String
+ * @cat Plugins/Methods/Date
+ * @author Kelvin Luck
+ */
+Date.fullYearStart = '20';
+
+(function() {
+
+       /**
+        * Adds a given method under the given name 
+        * to the Date prototype if it doesn't
+        * currently exist.
+        *
+        * @private
+        */
+       function add(name, method) {
+               if( !Date.prototype[name] ) {
+                       Date.prototype[name] = method;
+               }
+       };
+       
+       /**
+        * Checks if the year is a leap year.
+        *
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.isLeapYear();
+        * @result true
+        *
+        * @name isLeapYear
+        * @type Boolean
+        * @cat Plugins/Methods/Date
+        */
+       add("isLeapYear", function() {
+               var y = this.getFullYear();
+               return (y%4==0 && y%100!=0) || y%400==0;
+       });
+       
+       /**
+        * Checks if the day is a weekend day (Sat or Sun).
+        *
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.isWeekend();
+        * @result false
+        *
+        * @name isWeekend
+        * @type Boolean
+        * @cat Plugins/Methods/Date
+        */
+       add("isWeekend", function() {
+               return this.getDay()==0 || this.getDay()==6;
+       });
+       
+       /**
+        * Check if the day is a day of the week (Mon-Fri)
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.isWeekDay();
+        * @result false
+        * 
+        * @name isWeekDay
+        * @type Boolean
+        * @cat Plugins/Methods/Date
+        */
+       add("isWeekDay", function() {
+               return !this.isWeekend();
+       });
+       
+       /**
+        * Gets the number of days in the month.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.getDaysInMonth();
+        * @result 31
+        * 
+        * @name getDaysInMonth
+        * @type Number
+        * @cat Plugins/Methods/Date
+        */
+       add("getDaysInMonth", function() {
+               return [31,(this.isLeapYear() ? 29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];
+       });
+       
+       /**
+        * Gets the name of the day.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.getDayName();
+        * @result 'Saturday'
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.getDayName(true);
+        * @result 'Sat'
+        * 
+        * @param abbreviated Boolean When set to true the name will be abbreviated.
+        * @name getDayName
+        * @type String
+        * @cat Plugins/Methods/Date
+        */
+       add("getDayName", function(abbreviated) {
+               return abbreviated ? Date.abbrDayNames[this.getDay()] : Date.dayNames[this.getDay()];
+       });
+
+       /**
+        * Gets the name of the month.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.getMonthName();
+        * @result 'Janurary'
+        *
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.getMonthName(true);
+        * @result 'Jan'
+        * 
+        * @param abbreviated Boolean When set to true the name will be abbreviated.
+        * @name getDayName
+        * @type String
+        * @cat Plugins/Methods/Date
+        */
+       add("getMonthName", function(abbreviated) {
+               return abbreviated ? Date.abbrMonthNames[this.getMonth()] : Date.monthNames[this.getMonth()];
+       });
+
+       /**
+        * Get the number of the day of the year.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.getDayOfYear();
+        * @result 11
+        * 
+        * @name getDayOfYear
+        * @type Number
+        * @cat Plugins/Methods/Date
+        */
+       add("getDayOfYear", function() {
+               var tmpdtm = new Date("1/1/" + this.getFullYear());
+               return Math.floor((this.getTime() - tmpdtm.getTime()) / 86400000);
+       });
+       
+       /**
+        * Get the number of the week of the year.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.getWeekOfYear();
+        * @result 2
+        * 
+        * @name getWeekOfYear
+        * @type Number
+        * @cat Plugins/Methods/Date
+        */
+       add("getWeekOfYear", function() {
+               return Math.ceil(this.getDayOfYear() / 7);
+       });
+
+       /**
+        * Set the day of the year.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.setDayOfYear(1);
+        * dtm.toString();
+        * @result 'Tue Jan 01 2008 00:00:00'
+        * 
+        * @name setDayOfYear
+        * @type Date
+        * @cat Plugins/Methods/Date
+        */
+       add("setDayOfYear", function(day) {
+               this.setMonth(0);
+               this.setDate(day);
+               return this;
+       });
+       
+       /**
+        * Add a number of years to the date object.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.addYears(1);
+        * dtm.toString();
+        * @result 'Mon Jan 12 2009 00:00:00'
+        * 
+        * @name addYears
+        * @type Date
+        * @cat Plugins/Methods/Date
+        */
+       add("addYears", function(num) {
+               this.setFullYear(this.getFullYear() + num);
+               return this;
+       });
+       
+       /**
+        * Add a number of months to the date object.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.addMonths(1);
+        * dtm.toString();
+        * @result 'Tue Feb 12 2008 00:00:00'
+        * 
+        * @name addMonths
+        * @type Date
+        * @cat Plugins/Methods/Date
+        */
+       add("addMonths", function(num) {
+               var tmpdtm = this.getDate();
+               
+               this.setMonth(this.getMonth() + num);
+               
+               if (tmpdtm > this.getDate())
+                       this.addDays(-this.getDate());
+               
+               return this;
+       });
+       
+       /**
+        * Add a number of days to the date object.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.addDays(1);
+        * dtm.toString();
+        * @result 'Sun Jan 13 2008 00:00:00'
+        * 
+        * @name addDays
+        * @type Date
+        * @cat Plugins/Methods/Date
+        */
+       add("addDays", function(num) {
+               this.setDate(this.getDate() + num);
+               return this;
+       });
+       
+       /**
+        * Add a number of hours to the date object.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.addHours(24);
+        * dtm.toString();
+        * @result 'Sun Jan 13 2008 00:00:00'
+        * 
+        * @name addHours
+        * @type Date
+        * @cat Plugins/Methods/Date
+        */
+       add("addHours", function(num) {
+               this.setHours(this.getHours() + num);
+               return this;
+       });
+
+       /**
+        * Add a number of minutes to the date object.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.addMinutes(60);
+        * dtm.toString();
+        * @result 'Sat Jan 12 2008 01:00:00'
+        * 
+        * @name addMinutes
+        * @type Date
+        * @cat Plugins/Methods/Date
+        */
+       add("addMinutes", function(num) {
+               this.setMinutes(this.getMinutes() + num);
+               return this;
+       });
+       
+       /**
+        * Add a number of seconds to the date object.
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.addSeconds(60);
+        * dtm.toString();
+        * @result 'Sat Jan 12 2008 00:01:00'
+        * 
+        * @name addSeconds
+        * @type Date
+        * @cat Plugins/Methods/Date
+        */
+       add("addSeconds", function(num) {
+               this.setSeconds(this.getSeconds() + num);
+               return this;
+       });
+       
+       /**
+        * Sets the time component of this Date to zero for cleaner, easier comparison of dates where time is not relevant.
+        * 
+        * @example var dtm = new Date();
+        * dtm.zeroTime();
+        * dtm.toString();
+        * @result 'Sat Jan 12 2008 00:01:00'
+        * 
+        * @name zeroTime
+        * @type Date
+        * @cat Plugins/Methods/Date
+        * @author Kelvin Luck
+        */
+       add("zeroTime", function() {
+               this.setMilliseconds(0);
+               this.setSeconds(0);
+               this.setMinutes(0);
+               this.setHours(0);
+               return this;
+       });
+       
+       /**
+        * Returns a string representation of the date object according to Date.format.
+        * (Date.toString may be used in other places so I purposefully didn't overwrite it)
+        * 
+        * @example var dtm = new Date("01/12/2008");
+        * dtm.asString();
+        * @result '12/01/2008' // (where Date.format == 'dd/mm/yyyy'
+        * 
+        * @name asString
+        * @type Date
+        * @cat Plugins/Methods/Date
+        * @author Kelvin Luck
+        */
+       add("asString", function() {
+               var r = Date.format;
+               return r
+                       .split('yyyy').join(this.getFullYear())
+                       .split('yy').join((this.getFullYear() + '').substring(2))
+                       .split('mmm').join(this.getMonthName(true))
+                       .split('mm').join(_zeroPad(this.getMonth()+1))
+                       .split('dd').join(_zeroPad(this.getDate()));
+       });
+       
+       /**
+        * Returns a new date object created from the passed String according to Date.format or false if the attempt to do this results in an invalid date object
+        * (We can't simple use Date.parse as it's not aware of locale and I chose not to overwrite it incase it's functionality is being relied on elsewhere)
+        *
+        * @example var dtm = Date.fromString("12/01/2008");
+        * dtm.toString();
+        * @result 'Sat Jan 12 2008 00:00:00' // (where Date.format == 'dd/mm/yyyy'
+        * 
+        * @name fromString
+        * @type Date
+        * @cat Plugins/Methods/Date
+        * @author Kelvin Luck
+        */
+       Date.fromString = function(s)
+       {
+               var f = Date.format;
+               var d = new Date('01/01/1977');
+               var iY = f.indexOf('yyyy');
+               if (iY > -1) {
+                       d.setFullYear(Number(s.substr(iY, 4)));
+               } else {
+                       // TODO - this doesn't work very well - are there any rules for what is meant by a two digit year?
+                       d.setFullYear(Number(Date.fullYearStart + s.substr(f.indexOf('yy'), 2)));
+               }
+               var iM = f.indexOf('mmm');
+               if (iM > -1) {
+                       var mStr = s.substr(iM, 3);
+                       for (var i=0; i<Date.abbrMonthNames.length; i++) {
+                               if (Date.abbrMonthNames[i] == mStr) break;
+                       }
+                       d.setMonth(i);
+               } else {
+                       d.setMonth(Number(s.substr(f.indexOf('mm'), 2)) - 1);
+               }
+               d.setDate(Number(s.substr(f.indexOf('dd'), 2)));
+               if (isNaN(d.getTime())) {
+                       return false;
+               }
+               return d;
+       };
+       
+       // utility method
+       var _zeroPad = function(num) {
+               var s = '0'+num;
+               return s.substring(s.length-2)
+               //return ('0'+num).substring(-2); // doesn't work on IE :(
+       };
+       
+})();
\ No newline at end of file
diff --git a/js/methods/date_de.js b/js/methods/date_de.js
new file mode 100644 (file)
index 0000000..c18997f
--- /dev/null
@@ -0,0 +1,6 @@
+// date localization for locale 'de'
+// generated by Jörn Zaefferer using Java's java.util.SimpleDateFormat
+Date.dayNames = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'];
+Date.abbrDayNames = ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'];
+Date.monthNames = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
+Date.abbrMonthNames = ['Jan', 'Feb', 'Mrz', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'];
diff --git a/js/methods/date_es.js b/js/methods/date_es.js
new file mode 100644 (file)
index 0000000..12f1170
--- /dev/null
@@ -0,0 +1,6 @@
+// date localization for locale 'es'
+// generated by Jörn Zaefferer using Java's java.util.SimpleDateFormat
+Date.dayNames = ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'];
+Date.abbrDayNames = ['dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb'];
+Date.monthNames = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'];
+Date.abbrMonthNames = ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'];
diff --git a/js/methods/date_fr.js b/js/methods/date_fr.js
new file mode 100644 (file)
index 0000000..4a43379
--- /dev/null
@@ -0,0 +1,6 @@
+// date localization for locale 'fr'
+// generated by Jörn Zaefferer using Java's java.util.SimpleDateFormat
+Date.dayNames = ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'];
+Date.abbrDayNames = ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'];
+Date.monthNames = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'];
+Date.abbrMonthNames = ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'];
diff --git a/js/methods/date_it.js b/js/methods/date_it.js
new file mode 100644 (file)
index 0000000..d913d1d
--- /dev/null
@@ -0,0 +1,6 @@
+// date localization for locale 'it'
+// generated by Jörn Zaefferer using Java's java.util.SimpleDateFormat
+Date.dayNames = ['domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato'];
+Date.abbrDayNames = ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'];
+Date.monthNames = ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'];
+Date.abbrMonthNames = ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'];
diff --git a/js/methods/date_pl.js b/js/methods/date_pl.js
new file mode 100644 (file)
index 0000000..2fe6070
--- /dev/null
@@ -0,0 +1,11 @@
+// date localization for locale 'po'
+// provided by eRIZ (http://eriz.pcinside.pl/)
+
+Date.dayNames = ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'];
+Date.abbrDayNames = ['Ni', 'Po', 'Wt', 'Śr', 'Cz', 'Pt', 'So'];
+Date.monthNames = ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'];
+Date.abbrMonthNames = ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'];
+
+
+Date.firstDayOfWeek = 1;
+Date.format = 'dd.mmm.yyyy';
\ No newline at end of file
diff --git a/js/methods/date_ru_utf8.js b/js/methods/date_ru_utf8.js
new file mode 100644 (file)
index 0000000..a1ce06a
--- /dev/null
@@ -0,0 +1,10 @@
+// date localization for locale 'ru-RU', utf-8 encoding
+// provided by Sergey Nechaev http://nechaev.org/)
+
+Date.dayNames = ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'];
+Date.abbrDayNames = ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'];
+Date.monthNames = ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'];
+Date.abbrMonthNames = ['Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'];
+
+Date.firstDayOfWeek = 1;
+Date.format = 'dd.mm.yyyy';
\ No newline at end of file
diff --git a/js/methods/date_ru_win1251.js b/js/methods/date_ru_win1251.js
new file mode 100644 (file)
index 0000000..1b293ba
--- /dev/null
@@ -0,0 +1,10 @@
+// date localization for locale 'ru-RU', win-1251 encoding
+// provided by Sergey Nechaev http://nechaev.org/)
+
+Date.dayNames = ['Âîñêðåñåíüå', 'Ïîíåäåëüíèê', 'Âòîðíèê', 'Ñðåäà', '×åòâåðã', 'Ïÿòíèöà', 'Ñóááîòà'];
+Date.abbrDayNames = ['Âñ', 'Ïí', 'Âò', 'Ñð', '×ò', 'Ïò', 'Ñá'];
+Date.monthNames = ['ßíâàðü', 'Ôåâðàëü', 'Ìàðò', 'Àïðåëü', 'Ìàé', 'Èþíü', 'Èþëü', 'Àâãóñò', 'Ñåíòÿáðü', 'Îêòÿáðü', 'Íîÿáðü', 'Äåêàáðü'];
+Date.abbrMonthNames = ['ßíâ', 'Ôåâ', 'Ìàð', 'Àïð', 'Ìàé', 'Èþí', 'Èþë', 'Àâã', 'Ñåí', 'Îêò', 'Íîÿ', 'Äåê'];
+
+Date.firstDayOfWeek = 1;
+Date.format = 'dd.mm.yyyy';
\ No newline at end of file
diff --git a/js/methods/date_ua_utf8.js b/js/methods/date_ua_utf8.js
new file mode 100644 (file)
index 0000000..d4f99d4
--- /dev/null
@@ -0,0 +1,11 @@
+// date localization for locale 'ru-UA' (Ukrainian), utf-8 encoding
+// just put it after "date.js" declaration
+// provided by Frankovskyi Bogdan, bfrankovskyi@gmail.com
+
+Date.dayNames = ['Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', 'Пятниця', 'Субота'];
+Date.abbrDayNames = ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'];
+Date.monthNames = ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'];
+Date.abbrMonthNames = ['Січ', 'Лют', 'Бер', 'Квіт', 'Трав', 'Чер', 'Лип', 'Сер', 'Вер', 'Жов', 'Лис', 'Груд'];
+
+Date.firstDayOfWeek = 1;
+Date.format = 'dd.mm.yyyy';
diff --git a/js/methods/methodsTest.html b/js/methods/methodsTest.html
new file mode 100644 (file)
index 0000000..ca0265c
--- /dev/null
@@ -0,0 +1,412 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html>\r
+<head>\r
+<link rel="stylesheet" href="../../jquery/build/test/data/testsuite.css" />\r
+<script type="text/javascript" src="../../jquery/dist/jquery.js"></script>\r
+<script type="text/javascript" src="../../jquery/build/test/data/testrunner.js"></script>\r
+<script type="text/javascript" src="jquery.string.js"></script>\r
+<script type="text/javascript" src="jquery.array.js"></script>\r
+<script type="text/javascript" src="jquery.date.js"></script>\r
+<script type="text/javascript">\r
+test("String.trim()", function() {\r
+       ok( "" == "".trim(), "Expected no modification" );\r
+       ok( "" == " ".trim(), "Expected removal of single whitespace" );\r
+       ok( "" == "   ".trim(), "Expected removal of multiple whitespace" );\r
+       ok( "peter" == "peter".trim(), "Expected no modification" );\r
+       ok( "peter" == " peter".trim(), "Expected trim at start" );\r
+       ok( "peter" == "peter ".trim(), "Expected trim at end" );\r
+       ok( "peter" == " peter ".trim(), "Expected trim at start and end" );\r
+       ok( "peter" == "      peter           ".trim(), "Expected lots of trim at start and end" );\r
+       ok( "pet er" == "pet er".trim(), "Expected no modification" );\r
+       ok( "pet er" == " pet er".trim(), "Expected trim at start" );\r
+       ok( "pet er" == "pet er ".trim(), "Expected trim at end" );\r
+       ok( "pet er" == " pet er ".trim(), "Expected trim at start and end" );\r
+       ok( "pet er" == "      pet er           ".trim(), "Expected lots of trim at start and end" );\r
+       ok( "p  et er" == "p  et er".trim(), "Expected no modification" );\r
+       ok( "p  et er" == " p  et er".trim(), "Expected trim at start" );\r
+       ok( "p  et er" == "p  et er ".trim(), "Expected trim at end" );\r
+       ok( "p  et er" == " p  et er ".trim(), "Expected trim at start and end" );\r
+       ok( "p  et er" == "      p  et er           ".trim(), "Expected lots of trim at start and end" );\r
+       ok( "Hello Boys and Girls!" == " Hello Boys and Girls!   ".trim(), "Check example" );\r
+} );\r
+\r
+test("String.startsWith(prefix)", function() {\r
+       ok( "peter".startsWith("p") );\r
+       ok( "peter".startsWith("pet") );\r
+       ok( "peter".startsWith("pete") );\r
+       ok( "peter".startsWith("peter") );\r
+       ok( !"peter".startsWith("xst") );\r
+       ok( !"peter".startsWith("petr") );\r
+       ok( "/%$/".startsWith("/") );\r
+       ok( "/%$/".startsWith("/%") );\r
+       ok( !"/%$/".startsWith("/$") );\r
+       ok( "/%$/".startsWith("") );\r
+       ok( "".startsWith("") );\r
+});\r
+\r
+test("String.startsWith(prefix, offset)", function() {\r
+       ok( "peter".startsWith("e", 1) );\r
+       ok( "peter".startsWith("et", 1) );\r
+       ok( "peter".startsWith("ete", 1) );\r
+       ok( "peter".startsWith("eter", 1) );\r
+       ok( "peter".startsWith("t", 2) );\r
+       ok( "peter".startsWith("te", 2) );\r
+       ok( "peter".startsWith("ter", 2) );\r
+       ok( !"peter".startsWith("p", 1) );\r
+       ok( !"peter".startsWith("pe", 1) );\r
+       ok( !"peter".startsWith("e", 2) );\r
+       ok( !"peter".startsWith("et", 2) );\r
+       ok( !"peter".startsWith("pe", -1) );\r
+       ok( "peter".startsWith("r", 4) );\r
+       ok( !"peter".startsWith("r", 5) );\r
+       ok( "/%$/".startsWith("%", 1) );\r
+       ok( "/%$/".startsWith("%$", 1) );\r
+       ok( "/%$/".startsWith("$/", 2) );\r
+       ok( !"/%$/".startsWith("%$\"", 1) );\r
+       ok( "/%$/".startsWith("", 0) );\r
+       ok( "".startsWith("", 0) );\r
+});\r
+\r
+test("String.endsWith(suffix)", function() {\r
+       ok( "peter".endsWith("r") );\r
+       ok( "peter".endsWith("er") );\r
+       ok( "peter".endsWith("ter") );\r
+       ok( "peter".endsWith("eter") );\r
+       ok( "peter".endsWith("peter") );\r
+       ok( !"peter".endsWith("x") );\r
+       ok( !"peter".endsWith("xer") );\r
+       ok( !"peter".endsWith("pter") );\r
+       ok( "/%$/".endsWith("/") );\r
+       ok( "/%$/".endsWith("$/") );\r
+       ok( !"/%$/".endsWith("%/") );\r
+       ok( "/%$/".endsWith("") );\r
+       ok( "".endsWith("") );\r
+});\r
+\r
+test("String.truncate()", function() {\r
+       ok( "thisistenc thisistenc thisistenc ".truncate() == "thisistenc thisistenc thisi..." );\r
+       ok( "thisistenc thisistenc ".truncate() == "thisistenc thisistenc " );\r
+});\r
+\r
+test("String.truncate(length)", function() {\r
+       ok( "thisistenc ".truncate(5) == "th..." );\r
+       ok( "thisi".truncate() == "thisi" );\r
+});\r
+\r
+test("String.truncate(length, truncation)", function() {\r
+       ok( "thisistenc thisistenc thisistenc ".truncate(30, "x") == "thisistenc thisistenc thisistx" );\r
+       ok( "thisistenc thisistenc ".truncate(30, "x") == "thisistenc thisistenc " );\r
+       ok( "thisistenc ".truncate(5, "x") == "thisx" );\r
+       ok( "thisi".truncate(5, "x") == "thisi" );\r
+});\r
+\r
+test("String.stripTags()", function() {\r
+       ok( "<div id='hi'>Bla</div>".stripTags() == "Bla" );\r
+       var testString = [\r
+               '<html>',\r
+               '<head>',\r
+               '<link rel="stylesheet" href="../../jquery/build/test/data/testsuite.css" />',\r
+               '<script type="text/javascript" src="../../jquery/dist/jquery.js"><\/script>',\r
+               '<script type="text/javascript" src="../../jquery/build/test/data/testrunner.js"><\/script>',\r
+               '<script type="text/javascript" src="jquery.string.js"><\/script>',\r
+               '<script type="text/javascript" src="jquery.array.js"><\/script>',\r
+               '<script type="text/javascript">'\r
+       ].join('');\r
+       ok( !testString.stripTags() );\r
+});\r
+\r
+test("Array.forEach()", function() {\r
+       var stuff = "";\r
+       ["foo", "bar"].forEach(function(element, index, array) {\r
+               stuff += element;\r
+       });\r
+       ok( stuff == "foobar" );\r
+});\r
+\r
+test("Array.every()", function() {\r
+        ok( [12, 54, 18, 130, 44].every(function(element, index, array) {\r
+               return element >= 10;\r
+        }) === true );\r
+        ok( [12, 5, 8, 130, 44].every(function(element, index, array) {\r
+               return element >= 10;\r
+        }) === false );\r
+});\r
+\r
+test("Array.some()", function() {\r
+       ok( [12, 5, 8, 1, 44].some(function(element, index, array) {\r
+               return element >= 10;\r
+       }) === true );\r
+       ok( [2, 5, 8, 1, 4].some(function(element, index, array) {\r
+               return element >= 10;\r
+       }) === false );\r
+});\r
+\r
+test("Array.map()", function() {\r
+       var s = ["hello", "Array", "WORLD"];\r
+       var r = s.map(function(element, index, array) {\r
+               return element.toUpperCase();\r
+       });\r
+       isSet( s, ["hello", "Array", "WORLD"] );\r
+       isSet( r, ["HELLO", "ARRAY", "WORLD"] );\r
+\r
+       s = [1, 4, 9];\r
+       r = s.map(Math.sqrt);\r
+       isSet( s, [1, 4, 9] );\r
+       isSet( r, [1, 2, 3] );\r
+});\r
+\r
+test("Array.filter()", function() {\r
+       var s = [12, 5, 8, 1, 44];\r
+       var r = s.filter(function(element, index, array) {\r
+               return element >= 10;\r
+       });\r
+       isSet( s, [12, 5, 8, 1, 44] );\r
+       isSet( r, [12, 44] );\r
+});\r
+\r
+test("Array.indexOf()", function() {\r
+       ok( [12, 5, 8, 5, 44].indexOf(5) == 1 );\r
+       ok( [12, 5, 8, 5, 44].indexOf(5, 2) == 3 );\r
+       ok( [12, 5, 8, 5, 44].indexOf(5, 4) == -1 );\r
+});\r
+\r
+test("Array.unique()", function() {\r
+       var s = [1, 2, 1, 4, 5, 4];\r
+       var r = s.unique();\r
+       isSet( s, [1, 2, 1, 4, 5, 4] );\r
+       isSet( r, [1, 2, 4, 5] );\r
+});\r
+\r
+test("Date.isLeapYear()", function() {\r
+       var dtm = new Date('01/01/2008');\r
+       ok( dtm.isLeapYear() == true, 'is a leap year' );\r
+       dtm = new Date('01/01/2007');\r
+       ok( dtm.isLeapYear() == false, 'is not a lear' );\r
+});\r
+\r
+test("Date.isWeekend()", function() {\r
+       var dtm = new Date('01/07/2007');\r
+       ok( dtm.isWeekend() == true, 'on a Sunday' );\r
+       dtm = new Date('01/08/2007');\r
+       ok( dtm.isWeekend() == false, 'on a Monday' );\r
+       dtm = new Date('01/09/2007');\r
+       ok( dtm.isWeekend() == false, 'on a Tuesday' );\r
+       dtm = new Date('01/10/2007');\r
+       ok( dtm.isWeekend() == false, 'on a Wednesday' );\r
+       dtm = new Date('01/11/2007');\r
+       ok( dtm.isWeekend() == false, 'on a Thursday' );\r
+       dtm = new Date('01/12/2007');\r
+       ok( dtm.isWeekend() == false, 'on a Friday' );\r
+       dtm = new Date('01/06/2007');\r
+       ok( dtm.isWeekend() == true, 'on a Saturday' );\r
+});\r
+\r
+test("Date.isWeekDay()", function() {\r
+       var dtm = new Date('01/07/2007');\r
+       ok( dtm.isWeekDay() == false, 'on a Sunday' );\r
+       dtm = new Date('01/08/2007');\r
+       ok( dtm.isWeekDay() == true, 'on a Monday' );\r
+       dtm = new Date('01/09/2007');\r
+       ok( dtm.isWeekDay() == true, 'on a Tuesday' );\r
+       dtm = new Date('01/10/2007');\r
+       ok( dtm.isWeekDay() == true, 'on a Wednesday' );\r
+       dtm = new Date('01/11/2007');\r
+       ok( dtm.isWeekDay() == true, 'on a Thursday' );\r
+       dtm = new Date('01/12/2007');\r
+       ok( dtm.isWeekDay() == true, 'on a Friday' );\r
+       dtm = new Date('01/06/2007');\r
+       ok( dtm.isWeekDay() == false, 'on a Saturday' );\r
+});\r
+\r
+test("Date.getDaysInMonth()", function() {\r
+       var dtm = new Date('01/01/2007');\r
+       ok( dtm.getDaysInMonth() == 31, 'in January');\r
+       dtm = new Date('02/01/2007');\r
+       ok( dtm.getDaysInMonth() == 28, 'in February');\r
+       dtm = new Date('02/01/2008');\r
+       ok( dtm.getDaysInMonth() == 29, 'in February on a leap year');\r
+       dtm = new Date('03/01/2007');\r
+       ok( dtm.getDaysInMonth() == 31, 'in March');\r
+       dtm = new Date('04/01/2007');\r
+       ok( dtm.getDaysInMonth() == 30, 'in April');\r
+       dtm = new Date('05/01/2007');\r
+       ok( dtm.getDaysInMonth() == 31, 'in May');\r
+       dtm = new Date('06/01/2007');\r
+       ok( dtm.getDaysInMonth() == 30, 'in June');\r
+       dtm = new Date('07/01/2007');\r
+       ok( dtm.getDaysInMonth() == 31, 'in July');\r
+       dtm = new Date('08/01/2007');\r
+       ok( dtm.getDaysInMonth() == 31, 'in August');\r
+       dtm = new Date('09/01/2007');\r
+       ok( dtm.getDaysInMonth() == 30, 'in September');\r
+       dtm = new Date('10/01/2007');\r
+       ok( dtm.getDaysInMonth() == 31, 'in October');\r
+       dtm = new Date('11/01/2007');\r
+       ok( dtm.getDaysInMonth() == 30, 'in November');\r
+       dtm = new Date('12/01/2007');\r
+       ok( dtm.getDaysInMonth() == 31, 'in December');\r
+});\r
+\r
+test("Date.getDayName()", function() {\r
+       var dtm = new Date('01/07/2007');\r
+       ok( dtm.getDayName() == 'Sunday', 'on a Sunday' );\r
+       dtm = new Date('01/08/2007');\r
+       ok( dtm.getDayName() == 'Monday', 'on a Monday' );\r
+       dtm = new Date('01/09/2007');\r
+       ok( dtm.getDayName() == 'Tuesday', 'on a Tuesday' );\r
+       dtm = new Date('01/10/2007');\r
+       ok( dtm.getDayName() == 'Wednesday', 'on a Wednesday' );\r
+       dtm = new Date('01/11/2007');\r
+       ok( dtm.getDayName() == 'Thursday', 'on a Thursday' );\r
+       dtm = new Date('01/12/2007');\r
+       ok( dtm.getDayName() == 'Friday', 'on a Friday' );\r
+       dtm = new Date('01/06/2007');\r
+       ok( dtm.getDayName() == 'Saturday', 'on a Saturday' );\r
+       \r
+       dtm = new Date('01/07/2007');\r
+       ok( dtm.getDayName(true) == 'Sun', 'on a Sunday abbreviated' );\r
+       dtm = new Date('01/08/2007');\r
+       ok( dtm.getDayName(true) == 'Mon', 'on a Monday abbreviated' );\r
+       dtm = new Date('01/09/2007');\r
+       ok( dtm.getDayName(true) == 'Tue', 'on a Tuesday abbreviated' );\r
+       dtm = new Date('01/10/2007');\r
+       ok( dtm.getDayName(true) == 'Wed', 'on a Wednesday abbreviated' );\r
+       dtm = new Date('01/11/2007');\r
+       ok( dtm.getDayName(true) == 'Thu', 'on a Thursday abbreviated' );\r
+       dtm = new Date('01/12/2007');\r
+       ok( dtm.getDayName(true) == 'Fri', 'on a Friday abbreviated' );\r
+       dtm = new Date('01/06/2007');\r
+       ok( dtm.getDayName(true) == 'Sat', 'on a Saturday abbreviated' );\r
+});\r
+\r
+test("Date.getMonthName()", function() {\r
+       var dtm = new Date('01/01/2007');\r
+       ok( dtm.getMonthName() == 'January', 'in January');\r
+       dtm = new Date('02/01/2007');\r
+       ok( dtm.getMonthName() == 'February', 'in February');\r
+       dtm = new Date('03/01/2007');\r
+       ok( dtm.getMonthName() == 'March', 'in March');\r
+       dtm = new Date('04/01/2007');\r
+       ok( dtm.getMonthName() == 'April', 'in April');\r
+       dtm = new Date('05/01/2007');\r
+       ok( dtm.getMonthName() == 'May', 'in May');\r
+       dtm = new Date('06/01/2007');\r
+       ok( dtm.getMonthName() == 'June', 'in June');\r
+       dtm = new Date('07/01/2007');\r
+       ok( dtm.getMonthName() == 'July', 'in July');\r
+       dtm = new Date('08/01/2007');\r
+       ok( dtm.getMonthName() == 'August', 'in August');\r
+       dtm = new Date('09/01/2007');\r
+       ok( dtm.getMonthName() == 'September', 'in September');\r
+       dtm = new Date('10/01/2007');\r
+       ok( dtm.getMonthName() == 'October', 'in October');\r
+       dtm = new Date('11/01/2007');\r
+       ok( dtm.getMonthName() == 'November', 'in November');\r
+       dtm = new Date('12/01/2007');\r
+       ok( dtm.getMonthName() == 'December', 'in December');\r
+       \r
+       dtm = new Date('01/01/2007');\r
+       ok( dtm.getMonthName(true) == 'Jan', 'in January');\r
+       dtm = new Date('02/01/2007');\r
+       ok( dtm.getMonthName(true) == 'Feb', 'in February');\r
+       dtm = new Date('03/01/2007');\r
+       ok( dtm.getMonthName(true) == 'Mar', 'in March');\r
+       dtm = new Date('04/01/2007');\r
+       ok( dtm.getMonthName(true) == 'Apr', 'in April');\r
+       dtm = new Date('05/01/2007');\r
+       ok( dtm.getMonthName(true) == 'May', 'in May');\r
+       dtm = new Date('06/01/2007');\r
+       ok( dtm.getMonthName(true) == 'Jun', 'in June');\r
+       dtm = new Date('07/01/2007');\r
+       ok( dtm.getMonthName(true) == 'Jul', 'in July');\r
+       dtm = new Date('08/01/2007');\r
+       ok( dtm.getMonthName(true) == 'Aug', 'in August');\r
+       dtm = new Date('09/01/2007');\r
+       ok( dtm.getMonthName(true) == 'Sep', 'in September');\r
+       dtm = new Date('10/01/2007');\r
+       ok( dtm.getMonthName(true) == 'Oct', 'in October');\r
+       dtm = new Date('11/01/2007');\r
+       ok( dtm.getMonthName(true) == 'Nov', 'in November');\r
+       dtm = new Date('12/01/2007');\r
+       ok( dtm.getMonthName(true) == 'Dec', 'in December');\r
+});\r
+\r
+test("Date.getDayOfYear()", function() {\r
+       var dtm = new Date('01/01/2007');\r
+       ok( dtm.getDayOfYear() == 0, 'First day of the year' );\r
+       dtm = new Date('12/31/2007');\r
+       ok( dtm.getDayOfYear() == 364, 'Last day of the year' );\r
+});\r
+\r
+test("Date.getWeekOfYear()", function() {\r
+       var dtm = new Date('01/01/2007');\r
+       ok( dtm.getWeekOfYear() == 0, 'First week of the year' );\r
+       dtm = new Date('12/31/2007');\r
+       ok( dtm.getWeekOfYear() == 52, 'Last week of the year' );\r
+});\r
+\r
+test("Date.setDayOfYear()", function() {\r
+       var dtm = new Date('01/01/2007');\r
+       ok( dtm.setDayOfYear(365).getDayOfYear() == 364, 'Last day of the year' );\r
+       dtm = new Date('12/31/2007');\r
+       ok( dtm.setDayOfYear(1).getDayOfYear() == 0, 'First day of the year' );\r
+});\r
+\r
+test("Date.addYears()", function() {\r
+       var dtm = new Date('01/01/2007');\r
+       dtm.addYears(1);\r
+       ok( dtm.getFullYear() == 2008, 'Add one year' );\r
+       dtm.addYears(-1);\r
+       ok( dtm.getFullYear() == 2007, 'Subtract one year' );\r
+});\r
+\r
+test("Date.addMonths()", function() {\r
+       var dtm = new Date('01/01/2007');\r
+       dtm.addMonths(1);\r
+       ok( dtm.getMonthName() == 'February', 'Add one month' );\r
+       dtm.addMonths(-1);\r
+       ok( dtm.getMonthName() == 'January', 'Subtract one month' );\r
+});\r
+\r
+test("Date.addDays()", function() {\r
+       var dtm = new Date('01/01/2007');\r
+       dtm.addDays(1);\r
+       ok( dtm.getDayName() == 'Tuesday', 'Add one day' );\r
+       dtm.addDays(-1);\r
+       ok( dtm.getDayName() == 'Monday', 'Subtract one day' );\r
+});\r
+\r
+test("Date.addHours()", function() {\r
+       var dtm = new Date('01/01/2007');\r
+       dtm.addHours(24);\r
+       ok( dtm.getDayName() == 'Tuesday', 'Add 24 hours' );\r
+       dtm.addHours(-24);\r
+       ok( dtm.getDayName() == 'Monday', 'Subtract 24 hours' );\r
+});\r
+\r
+test("Date.addMinutes()", function() {\r
+       var dtm = new Date('01/01/2007');\r
+       dtm.addMinutes(1440);\r
+       ok( dtm.getDayName() == 'Tuesday', 'Add 1440 minutes' );\r
+       dtm.addMinutes(-1440);\r
+       ok( dtm.getDayName() == 'Monday', 'Subtract 1440 minutes' );\r
+});\r
+\r
+test("Date.addSeconds()", function() {\r
+       var dtm = new Date('01/01/2007');\r
+       dtm.addSeconds(86400);\r
+       ok( dtm.getDayName() == 'Tuesday', 'Add 86400 seconds' );\r
+       dtm.addSeconds(-86400);\r
+       ok( dtm.getDayName() == 'Monday', 'Subtract 86400 seconds' );\r
+});\r
+\r
+</script>\r
+</head>\r
+\r
+<body>\r
+<h1>jQuery - Methods Test Suite</h1>\r
+<div id="main"></div>\r
+<ol id="tests"></ol>\r
+</body>\r
+\r
+</html>
\ No newline at end of file
diff --git a/js/methods/string.js b/js/methods/string.js
new file mode 100644 (file)
index 0000000..365f50d
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * String prototype extensions. Doesn't depend on any
+ * other code. Doens't overwrite existing methods.
+ *
+ * Adds trim, camelize, startsWith, endsWith, truncate and stripTags.
+ *
+ * Copyright (c) 2006 Jörn Zaefferer
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ *
+ */
+(function() {
+
+       /**
+        * Adds a given method under the given name 
+        * to the String prototype if it doesn't
+        * currently exist.
+        *
+        * @private
+        */
+       function add(name, method) {
+               if( !String.prototype[name] ) {
+                       String.prototype[name] = method;
+               }
+       }
+       
+       /**
+        * Returns a string with with leading and trailing whitespace removed.
+        *
+        * @example " Hello Boys and Girls!   ".trim()
+        * @result "Hello Boys and Girls!"
+        *
+        * @name trim
+        * @type String
+        * @cat Plugins/Methods/String
+        */
+       add("trim", function(){ 
+               return this.replace(/(^\s+|\s+$)/g, "");
+       });
+       
+       /**
+        * Return a camelized String, removing all underscores and dashes
+        * and replacing the next character with it's uppercase representation.
+        *
+        * @example "font-weight".camelize()
+        * @result "fontWeight"
+        *
+        * @example "border_width_bottom".camelize()
+        * @result "borderWidthBottom"
+        *
+        * @example "border_width-bottom".camelize()
+        * @result "borderWidthBottom"
+        *
+        * @name camelize
+        * @type String
+        * @cat Plugins/Methods/String
+        */
+       add("camelize", function() {
+               return this.replace( /[-_]([a-z])/ig, function(z,b){ return b.toUpperCase();} );
+       });
+       
+       /**
+        * Tests if this string starts with a prefix.
+        *
+        * An optional offset specifies where to start searching,
+        * default is 0 (start of the string).
+        *
+        * Returns false if the offset is negative or greater than the length
+        * of this string.
+        *
+        * @example "goldvein".startsWith("go")
+        * @result true
+        * 
+        * @example "goldvein".startsWith("god")
+        * @result false
+        *
+        * @example "goldvein".startsWith("ld", 2)
+        * @result true
+        * 
+        * @example "goldvein".startsWith("old", 2)
+        * @result false
+        *
+        * @name startsWith
+        * @type Boolean
+        * @param prefix The prefix to test
+        * @param offset (optional) From where to start testing
+        * @cat Plugins/Methods/String
+        */
+       
+       add("startsWith", function(prefix, offset) {
+               var offset = offset || 0;
+               if(offset < 0 || offset > this.length) return false;
+               return this.substring(offset, offset + prefix.length) == prefix;
+       });
+       
+       /**
+        * Tests if this string ends with the specified suffix.
+        *
+        * @example "goldvein".endsWith("ein")
+        * @result true
+        *
+        * @example "goldvein".endsWith("vei")
+        * @result false
+        *
+        * @name endsWith
+        * @type Boolean
+        * @param suffix The suffix to test
+        * @cat Plugins/Methods/String
+        */
+       add("endsWith", function(suffix) {
+               return this.substring(this.length - suffix.length) == suffix;
+       });
+       
+       /**
+        * Returns a new String that is no longer than a certain length.
+        *
+        * @example "thisistenc ".truncate(5);
+        * @result "th..."
+        *
+        * @example "thisistenc ".truncate(5, "x")
+        * @result "thisx"
+        *
+        * @name truncate
+        * @type String
+        * @param Number length (optional) The maximum length of the returned string, default is 30
+        * @param String suffix (optional) The suffix to append to the truncated string, default is "..."
+        * @cat Plugins/Methods/String
+        */
+       add("truncate", function(length, suffix) {
+               length = length || 30;
+               suffix = suffix === undefined ? "..." : suffix;
+               return this.length > length ? 
+                       this.slice(0, length - suffix.length) + suffix : this;
+       });
+       
+       /**
+        * Returns a new String with all tags stripped.
+        *
+        * @example "<div id='hi'>Bla</div>".stripTags()
+        * @result "Bla"
+        *
+        * @name stripTags
+        * @type String
+        * @cat Plugins/Methods/String
+        */
+       add("stripTags", function() {
+               return this.replace(/<\/?[^>]+>/gi, '');
+       });
+
+})();
\ No newline at end of file
diff --git a/pige.css b/pige.css
new file mode 100644 (file)
index 0000000..181704a
--- /dev/null
+++ b/pige.css
@@ -0,0 +1,45 @@
+html, body {
+       padding: 0;
+       margin: 0;
+       color: black;
+       background: white;
+}
+
+h1 {
+       font-family: monospace;
+       background: #d3fa78;
+       padding: 1ex 1em;
+       border-bottom: 2px outset #92fa78;
+}
+
+form {
+       margin: 1em;
+}
+
+form p {
+       font-style: italic;
+}
+
+#modalOverlay {
+       height:100%;
+       width:100%;
+       position:fixed;
+       left:0;
+       top:0;
+       z-index:3000;
+       background-color: black;
+       cursor:wait;
+}
+
+div#status {
+       position:fixed;
+       width:600px;
+       left:50%;
+       margin-left:-300px;
+       z-index:3100;
+       border: 1px solid black;
+       border-color: #333 black black #333;
+       display: none;
+       background: white url(indicator.gif) no-repeat top right;
+       padding: 1em;
+}
diff --git a/static.html b/static.html
new file mode 100644 (file)
index 0000000..5a7acd6
--- /dev/null
@@ -0,0 +1,179 @@
+<html>
+<head>
+
+<title>PigeBox</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+
+<link rel="stylesheet" type="text/css" href="pige.css" />
+<link rel="stylesheet" type="text/css" href="css/datePicker.css" />
+<script type="text/javascript" src="js/jquery.js"></script>
+<script type="text/javascript" src="js/bgiframe/jquery.bgiframe.min.js"></script>
+<script type="text/javascript" src="js/methods/date.js"></script>
+<script type="text/javascript" src="js/methods/date_fr.js"></script>
+<script type="text/javascript" src="js/datePicker/jquery.datePicker.js"></script>
+<script type="text/javascript" src="js/jquery.simplemodal.js"></script>
+
+</head>
+<body>
+
+<h1>PigeBox</h1>
+
+<form method="post">
+
+<p>
+Récupérer un extrait de la pige ...
+</p>
+
+
+<label for="date">Date</label>
+<!--<input name="date" id="date" maxlength="10" type="text" class="date-pick" size="10" />-->
+<select name="date" id="date">
+  <option value="2009-07-28">28 juillet</option>
+  <option value="2009-07-29" selected="selected">29 juillet</option>
+  <option value="2009-07-30">30 juillet</option>
+  <option value="2009-07-31">31 juillet</option>
+  <option value="2009-08-01">1er août</option>
+  <option value="2009-08-02">2 août</option>
+</select>
+
+<label for="start_time">Heure de début</label>
+<input name="start_time" id="start_time" maxlength="5" size="5" type="text" />
+
+<label for="end_time">Heure de fin</label>
+<input name="end_time" id="end_time" maxlength="5" size="5" type="text" />
+
+<button disabled="disabled">Valider</button>
+
+</form>
+
+<div id="status">
+</div>
+
+<ul id="downloads">
+</ul>
+
+</body>
+</html>
+
+<script type="text/javascript">
+Date.format = 'dd/mm/yyyy';
+
+
+function updateDownloads()
+{
+       $.get(document.URL, {cmd: 'list'},
+               function (data) {
+                       data = $.trim(data);
+                       data = data.split('\n');
+                       s = '';
+                       for (i=0; i < data.length; i++) {
+                               if (data[i].length == 0) continue;
+                               s += '<li><a href="' + data[i] + '">';
+                               s += data[i].substring(14, 16);
+                               s += '/';
+                               s += data[i].substring(12, 14);
+                               s += '/';
+                               s += data[i].substring(8, 12);
+                               s += ' ';
+                               s += data[i].substring(17, 19);
+                               s += ':';
+                               s += data[i].substring(19, 21);
+                               s += ' -> ';
+                               s += data[i].substring(22, 24);
+                               s += ':';
+                               s += data[i].substring(24, 26);
+                               s += '</a></li>\n';
+                       }
+                       $('#downloads').html(s);
+               }
+       );
+}
+
+function updateStatus(job_number)
+{
+       console.log('update status');
+       $('#status').addClass('throbber');
+       $.get(document.URL, { cmd: 'status', job: job_number},
+               function (data) {
+                       $('#status').removeClass('throbber');
+                       data = $.trim(data);
+                       if (data == 'available') {
+                               $('#status').text('');
+                               return;
+                       }
+                       if (data.split(':')[0] == 'done') {
+                               updateDownloads();
+                               console.log(document.URL + data.split(':')[1])
+                               $.modal.close();
+                               $('#status').text('').hide();
+                               document.location.href = document.URL + data.split(':')[1];
+                               return;
+                       }
+
+                       $('#status').text(data);
+                       window.setTimeout(updateStatus, 2500, job_number);
+               }
+       );
+}
+
+
+$(function() {
+       var endDate = new Date();
+       endDate.addDays(-2);
+       var startDate = new Date();
+       startDate.addDays(-92);
+       // XXX: get start and end date from server
+       /*
+        $('#date').datePicker({
+               startDate: startDate.asString(),
+               endDate: endDate.asString(),
+               }).next().html(
+                   '<img src="js/calendar.png" width="16" height="16" />');
+       */
+       $('form').submit(
+               function () {
+                       if ($('#start_time').val().indexOf(':') == -1 ||
+                               $('#end_time').val().indexOf(':') == -1) {
+                           $('#status').text('Les heures doivent avoir le format hh:mm');
+                           return false;
+                       }
+                       $('#status').addClass('throbber').text('Envoi ...');
+                       $.get(document.URL, {
+                               cmd: 'new',
+                               date_val: $('#date').val(),
+                               start_val: $('#start_time').val(),
+                               end_val: $('#end_time').val() },
+                               function (data) {
+                                       data = $.trim(data);
+                                       if (data.substring(0, 2) != 'ok') {
+                                               $('#status').removeClass('throbber').text(
+                                                       'Erreur : ' + data);
+                                       } else {
+                                               job_number = data.substring(3, 35);
+                                               $('#status').show().modal();
+                                               updateStatus(job_number);
+                                       }
+                               }
+                       );
+                       //console.log('submit');
+                       return false;
+               }
+       );
+
+       $('input').change(
+               function () {
+                       if ($('#date').val() != '' &&
+                                       $('#start_time').val() != '' &&
+                                       $('#end_time').val() != '') {
+                               $('button').attr('disabled', false);
+                       } else {
+                               $('button').attr('disabled', true);
+                       }
+               }
+       );
+       $('#date').trigger('change');
+
+       updateDownloads();
+});
+
+</script>