Merge branch 'master' into scheduler
authorJordan Augé <jordan.auge@lip6.fr>
Wed, 27 Nov 2013 08:32:58 +0000 (09:32 +0100)
committerJordan Augé <jordan.auge@lip6.fr>
Wed, 27 Nov 2013 08:32:58 +0000 (09:32 +0100)
49 files changed:
plugins/googlemap/static/js/googlemap.js
plugins/scheduler/__init__.py [new file with mode: 0644]
plugins/scheduler/static/css/scheduler.css [new file with mode: 0644]
plugins/scheduler/static/js/raphael-1.5.2.js [new file with mode: 0644]
plugins/scheduler/static/js/raphael.js [new symlink]
plugins/scheduler/static/js/scheduler.js [new file with mode: 0644]
plugins/scheduler/template/scheduler.html [new file with mode: 0644]
portal/sliceview.py
third-party/timepicker-addon [new symlink]
third-party/timepicker-addon-1.2/README.md [new file with mode: 0644]
third-party/timepicker-addon-1.2/component.json [new file with mode: 0644]
third-party/timepicker-addon-1.2/index.html [new file with mode: 0644]
third-party/timepicker-addon-1.2/jquery-ui-sliderAccess.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/jquery-ui-timepicker-addon.css [new file with mode: 0644]
third-party/timepicker-addon-1.2/jquery-ui-timepicker-addon.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-af.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-bg.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ca.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-cs.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-de.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-el.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-es.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-et.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-eu.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-fi.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-fr.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-gl.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-he.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-hu.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-id.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-it.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ja.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ko.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-lt.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-nl.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-no.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-pl.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-pt-BR.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-pt.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ro.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ru.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-sk.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-sv.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-th.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-tr.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-uk.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-vi.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-zh-CN.js [new file with mode: 0644]
third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-zh-TW.js [new file with mode: 0644]

index d3784b8..0c511a0 100644 (file)
@@ -27,10 +27,10 @@ googlemap_debug_detailed=false;
             this.in_set_backlog = [];
 
             // we keep a couple of global hashes
-           // lat_lon --> { marker, <ul> }
-           // hrn --> { <li>, <input> }
-           this.by_lat_lon = {};
-           this.by_hrn = {};
+            // lat_lon --> { marker, <ul> }
+            // hrn --> { <li>, <input> }
+            this.by_lat_lon = {};
+            this.by_hrn = {};
 
             /* XXX Events */
             this.elmt().on('show', this, this.on_show);
@@ -41,15 +41,15 @@ googlemap_debug_detailed=false;
             this.object = query.object;
 
             var keys = manifold.metadata.get_key(this.object);
-           // 
+            // 
             this.key = (keys && keys.length == 1) ? keys[0] : null;
 
             //// Setup query and record handlers 
-           // this query is the one about the slice itself 
-           // event related to this query will trigger callbacks like on_new_record
+            // this query is the one about the slice itself 
+            // event related to this query will trigger callbacks like on_new_record
             this.listen_query(options.query_uuid);
-           // this one is the complete list of resources
-           // and will be bound to callbacks like on_all_new_record
+            // this one is the complete list of resources
+            // and will be bound to callbacks like on_all_new_record
             this.listen_query(options.query_all_uuid, 'all');
 
             /* GUI setup and event binding */
@@ -59,7 +59,7 @@ googlemap_debug_detailed=false;
         /* PLUGIN EVENTS */
 
         on_show: function(e) {
-           if (googlemap_debug) messages.debug("googlemap.on_show");
+            if (googlemap_debug) messages.debug("googlemap.on_show");
             var googlemap = e.data;
             google.maps.event.trigger(googlemap.map, 'resize');
         }, // on_show
@@ -75,132 +75,132 @@ googlemap_debug_detailed=false;
             var myOptions = {
                 zoom: this.options.zoom,
                 center: center,
-               scrollwheel: false,
+                scrollwheel: false,
                 mapTypeId: google.maps.MapTypeId.ROADMAP,
             }
-           
+            
             var domid = this.options.plugin_uuid + '--' + 'googlemap';
-           var elmt = document.getElementById(domid);
-           if (googlemap_debug) messages.debug("gmap.initialize_map based on  domid=" + domid + " elmt=" + elmt);
+            var elmt = document.getElementById(domid);
+            if (googlemap_debug) messages.debug("gmap.initialize_map based on  domid=" + domid + " elmt=" + elmt);
             this.map = new google.maps.Map(elmt, myOptions);
             this.infowindow = new google.maps.InfoWindow();
         }, // initialize_map
 
-       // xxx probably not the right place
+        // xxx probably not the right place
         // The function accepts both records and their key 
-       record_hrn : function (record) {
+        record_hrn : function (record) {
             var key_value;
             switch (manifold.get_type(record)) {
             case TYPE_VALUE:
-               key_value = record;
+                key_value = record;
                 break;
             case TYPE_RECORD:
-               if ( ! this.key in record ) return;
+                if ( ! this.key in record ) return;
                 key_value = record[this.key];
                 break;
             default:
                 throw "Not implemented";
                 break;
             }
-           // XXX BACKSLASHES original code was reading like this
-           //return this.escape_id(key_value).replace(/\\/g, '');
-           //  however this sequence removes backslashes from hrn's and as a result
-           // queryupdater was getting all mixed up
-           // querytable does publish hrn's with backslashes and that seems like the thing to do
-           return key_value;
-       },          
-
-       // return { marker: gmap_marker, ul : <ul DOM> }
-       create_marker_struct: function (object,lat,lon) {
-           // the DOM fragment
-           var dom = $("<p>").addClass("geo").append(object+"(s)");
-           var ul = $("<ul>").addClass("geo");
-           dom.append(ul);
-           // add a gmap marker to the mix
-           var marker = new google.maps.Marker({
-               position: new google.maps.LatLng(lat, lon),
+            // XXX BACKSLASHES original code was reading like this
+            //return this.escape_id(key_value).replace(/\\/g, '');
+            //  however this sequence removes backslashes from hrn's and as a result
+            // queryupdater was getting all mixed up
+            // querytable does publish hrn's with backslashes and that seems like the thing to do
+            return key_value;
+        },            
+
+        // return { marker: gmap_marker, ul : <ul DOM> }
+        create_marker_struct: function (object,lat,lon) {
+            // the DOM fragment
+            var dom = $("<p>").addClass("geo").append(object+"(s)");
+            var ul = $("<ul>").addClass("geo");
+            dom.append(ul);
+            // add a gmap marker to the mix
+            var marker = new google.maps.Marker({
+                position: new google.maps.LatLng(lat, lon),
                 title: object,
-               // gmap can deal with a DOM element but not a jquery object
+                // gmap can deal with a DOM element but not a jquery object
                 content: dom.get(0),
             }); 
-           return {marker:marker, ul:ul};
-       },
-
-       // add an entry in the marker <ul> tag for that record
-       // returns { checkbox : <input DOM> }
-       create_record_checkbox: function (record,ul,checked) {
-           var checkbox = $("<input>", {type:'checkbox', checked:checked, class:'geo'});
-           var hrn=this.record_hrn(record);
-           ul.append($("<li>").addClass("geo").append(checkbox).
-                     append($("<span>").addClass("geo").append(hrn)));
-           var googlemap=this;
-           // the callback for when a user clicks
-           // NOTE: this will *not* be called for changes done by program
-           checkbox.change( function (e) {
-               if (googlemap_debug) messages.debug("googlemap click handler checked= " + this.checked + " hrn=" + hrn);
-               manifold.raise_event (googlemap.options.query_uuid, 
-                                     this.checked ? SET_ADD : SET_REMOVED, hrn);
-           });
-           return checkbox;
-       },
-           
-       // retrieve DOM checkbox and make sure it is checked/unchecked
+            return {marker:marker, ul:ul};
+        },
+
+        // add an entry in the marker <ul> tag for that record
+        // returns { checkbox : <input DOM> }
+        create_record_checkbox: function (record,ul,checked) {
+            var checkbox = $("<input>", {type:'checkbox', checked:checked, class:'geo'});
+            var hrn=this.record_hrn(record);
+            ul.append($("<li>").addClass("geo").append(checkbox).
+                      append($("<span>").addClass("geo").append(hrn)));
+            var googlemap=this;
+            // the callback for when a user clicks
+            // NOTE: this will *not* be called for changes done by program
+            checkbox.change( function (e) {
+                if (googlemap_debug) messages.debug("googlemap click handler checked= " + this.checked + " hrn=" + hrn);
+                manifold.raise_event (googlemap.options.query_uuid, 
+                                      this.checked ? SET_ADD : SET_REMOVED, hrn);
+            });
+            return checkbox;
+        },
+            
+        // retrieve DOM checkbox and make sure it is checked/unchecked
         set_checkbox: function(record, checked) {
-           var hrn=this.record_hrn (record);
-           if (! hrn) { 
-               try {messages.warning ("googlemap.set_checkbox: record has no hrn -- hostname="+record.hostname); }
-               catch (err) {messages.warning ("googlemap.set_checkbox: record has no hrn"); }
-               return; 
-           }
-           var checkbox_s = this.by_hrn [ hrn ];
-           if (! checkbox_s ) { messages.warning ("googlemap.set_checkbox: could not spot checkbox for hrn "+hrn); return; }
-           checkbox_s.checkbox.prop('checked',checked);
+            var hrn=this.record_hrn (record);
+            if (! hrn) { 
+                try {messages.warning ("googlemap.set_checkbox: record has no hrn -- hostname="+record.hostname); }
+                catch (err) {messages.warning ("googlemap.set_checkbox: record has no hrn"); }
+                return; 
+            }
+            var checkbox_s = this.by_hrn [ hrn ];
+            if (! checkbox_s ) { messages.warning ("googlemap.set_checkbox: could not spot checkbox for hrn "+hrn); return; }
+            checkbox_s.checkbox.prop('checked',checked);
         }, // set_checkbox
 
-       // this record is *in* the slice
+        // this record is *in* the slice
         new_record: function(record) {
-               if (googlemap_debug_detailed) messages.debug ("new_record");
+                if (googlemap_debug_detailed) messages.debug ("new_record");
             if (!(record['latitude'])) return false;
-           
+            
             // get the coordinates
             var latitude=unfold.get_value(record['latitude']);
             var longitude=unfold.get_value(record['longitude']);
             var lat_lon = latitude + longitude;
 
-           // check if we've seen anything at that place already
-           // xxx might make sense to allow for some fuzziness, 
-           // i.e. consider 2 places equal if not further away than 300m or so...
-           var marker_s = this.by_lat_lon [lat_lon];
-           if ( marker_s == null ) {
-                       marker_s = this.create_marker_struct (this.object, latitude, longitude);
-                       this.by_lat_lon [ lat_lon ] = marker_s;
-                       this.arm_marker(marker_s.marker, this.map);
-               }
-           
-           // now add a line for this resource in the marker
-           // xxx should compute checked here ?
-           // this is where the checkbox will be appended
-           var ul=marker_s.ul;
-           var checkbox = this.create_record_checkbox (record, ul, false);
-           if ( ! this.key in record ) return;
+                // check if we've seen anything at that place already
+                // xxx might make sense to allow for some fuzziness, 
+                // i.e. consider 2 places equal if not further away than 300m or so...
+                var marker_s = this.by_lat_lon [lat_lon];
+                if ( marker_s == null ) {
+                        marker_s = this.create_marker_struct (this.object, latitude, longitude);
+                        this.by_lat_lon [ lat_lon ] = marker_s;
+                        this.arm_marker(marker_s.marker, this.map);
+                }
+            
+                // now add a line for this resource in the marker
+                // xxx should compute checked here ?
+                // this is where the checkbox will be appended
+                var ul=marker_s.ul;
+                var checkbox = this.create_record_checkbox (record, ul, false);
+                if ( ! this.key in record ) return;
             var key_value = record[this.key];
-           // see XXX BACKSLASHES 
-           //var hrn = this.escape_id(key_value).replace(/\\/g, '');
-           var hrn = key_value;
+                // see XXX BACKSLASHES 
+                //var hrn = this.escape_id(key_value).replace(/\\/g, '');
+                var hrn = key_value;
             this.by_hrn[hrn] = {
-                   checkbox: checkbox,
-                       // xxx Thierry sept 2013
-                       // xxx actually we might have just used a domid-based scheme instead of the hash
-                       // since at this point we only need to retrieve the checkbox from an hrn
-                       // but I was not sure enough that extra needs would not show up so I kept this in place
-                       // xxx not sure these are actually useful :
+                        checkbox: checkbox,
+                        // xxx Thierry sept 2013
+                        // xxx actually we might have just used a domid-based scheme instead of the hash
+                        // since at this point we only need to retrieve the checkbox from an hrn
+                        // but I was not sure enough that extra needs would not show up so I kept this in place
+                        // xxx not sure these are actually useful :
                 value: key_value,
                 record: record,
             }
         }, // new_record
 
         arm_marker: function(marker, map) {
-           if (googlemap_debug_detailed) messages.debug ("arm_marker content="+marker.content);
+            if (googlemap_debug_detailed) messages.debug ("arm_marker content="+marker.content);
             var googlemap = this;
             google.maps.event.addListener(marker, 'click', function () {
                 googlemap.infowindow.close();
@@ -213,7 +213,7 @@ googlemap_debug_detailed=false;
 
         /*************************** RECORD HANDLER ***************************/
         on_new_record: function(record) {
-           if (googlemap_debug_detailed) messages.debug("on_new_record");
+            if (googlemap_debug_detailed) messages.debug("on_new_record");
             if (this.received_all)
                 // update checkbox for record
                 this.set_checkbox(record, true);
@@ -223,25 +223,25 @@ googlemap_debug_detailed=false;
         },
 
         on_clear_records: function(record) {
-           if (googlemap_debug_detailed) messages.debug("on_clear_records");
+            if (googlemap_debug_detailed) messages.debug("on_clear_records");
         },
 
         // Could be the default in parent
         on_query_in_progress: function() {
-           if (googlemap_debug) messages.debug("on_query_in_progress (spinning)");
+            if (googlemap_debug) messages.debug("on_query_in_progress (spinning)");
             this.spin();
         },
 
         on_query_done: function() {
-           if (googlemap_debug) messages.debug("on_query_done");           
+            if (googlemap_debug) messages.debug("on_query_done");            
             if (this.received_all) {
                 this.unspin();
-           }
+            }
             this.received_set = true;
         },
 
         on_field_state_changed: function(data) {
-           if (googlemap_debug_detailed) messages.debug("on_field_state_changed");         
+            if (googlemap_debug_detailed) messages.debug("on_field_state_changed");            
             switch(data.request) {
             case FIELD_REQUEST_ADD:
             case FIELD_REQUEST_ADD_RESET:
@@ -260,22 +260,22 @@ googlemap_debug_detailed=false;
         // all : this 
 
         on_all_new_record: function(record) {
-           if (googlemap_debug_detailed) messages.debug("on_all_new_record");
+            if (googlemap_debug_detailed) messages.debug("on_all_new_record");
             this.new_record(record);
         },
 
         on_all_clear_records: function() {
-           if (googlemap_debug) messages.debug("on_all_clear_records");            
+            if (googlemap_debug) messages.debug("on_all_clear_records");            
         },
 
         on_all_query_in_progress: function() {
-           if (googlemap_debug) messages.debug("on_all_query_in_progress (spinning)");
+            if (googlemap_debug) messages.debug("on_all_query_in_progress (spinning)");
             // XXX parent
             this.spin();
         },
 
         on_all_query_done: function() {
-           if (googlemap_debug) messages.debug("on_all_query_done");
+            if (googlemap_debug) messages.debug("on_all_query_done");
 
             // MarkerClusterer
             var markers = [];
@@ -297,10 +297,10 @@ googlemap_debug_detailed=false;
                 $.each(this.in_set_backlog, function(i, record) {
                     googlemap.set_checkbox(record, true);
                 });
-               // reset 
-               googlemap.in_set_backlog = [];
+                // reset 
+                googlemap.in_set_backlog = [];
 
-               if (googlemap_debug) messages.debug("unspinning");
+                if (googlemap_debug) messages.debug("unspinning");
                 this.unspin();
             }
             this.received_all = true;
diff --git a/plugins/scheduler/__init__.py b/plugins/scheduler/__init__.py
new file mode 100644 (file)
index 0000000..94a7571
--- /dev/null
@@ -0,0 +1,40 @@
+from unfold.plugin import Plugin
+
+class Scheduler(Plugin):
+
+    # set checkboxes if a final column with checkboxes is desired
+    # pass columns as the initial set of columns
+    #   if None then this is taken from the query's fields
+    # latitude,longitude, zoom : the starting point
+    def __init__ (self, query, query_lease = None, **settings):
+        Plugin.__init__ (self, **settings)
+        self.query=query
+        self.query_lease = query_lease
+        self.query_lease_uuid = query_lease.query_uuid if query_lease else None
+
+    def template_file (self):
+        return "scheduler.html"
+
+    def template_env (self, request):
+        env={}
+        return env
+
+    def requirements (self):
+        reqs = {
+            'js_files' : [ "js/scheduler.js",
+                           #"//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js",
+                            "js/raphael.js",
+                            "js/manifold.js", "js/manifold-query.js", 
+                            "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js", 
+                            "js/unfold-helper.js",
+                            "js/jquery-ui-timepicker-addon.js", "js/jquery-ui-sliderAccess.js",
+                           ],
+            'css_files' : [ "css/scheduler.css",
+                            "css/jquery-ui-timepicker-addon.css",
+                            ],
+            }
+        return reqs
+
+    # the list of things passed to the js plugin
+    def json_settings_list (self): 
+        return ['plugin_uuid','query_uuid', 'query_lease_uuid', ]
diff --git a/plugins/scheduler/static/css/scheduler.css b/plugins/scheduler/static/css/scheduler.css
new file mode 100644 (file)
index 0000000..fbaede0
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ $Id: toggle.css 12435 2009-03-11 15:07:00Z thierry $
+ */
+
+/* this class is used to store data that needs to get passed to javascript code */
+/* these elements are not meant to be rendered */
+.hidden {
+    display: none;
+}
+.center {
+    text-align: center;
+}
+
+.scrollx {
+       overflow-x:scroll;
+        height: 340px;
+}
+.scrolly {
+overflow-y : scroll;
+}
+/* space around various messages */
+div.my-slice-renewal {
+    margin: 30px;
+}
+
+/* toggles for the nodes sections */
+div#toggle-container-my-slice-persons-current,
+div#toggle-container-my-slice-nodes-current {
+    background: #f0f0f0;
+}
+
+div#toggle-container-my-slice-persons-add,
+div#toggle-container-my-slice-nodes-add {
+    background: #f0e0e0;
+}
+
+/* the scheduler area */
+div#toggle-container-my-slice-nodes-reserve {
+    background: #def;
+}
+
+/* where the graphics go */
+div#leases_area {
+  /* padding: 10px 25px; */
+}
+
+/* don't display the scheduler data table - not quite sure this works */
+table#leases_data {
+    display: none;
+}
+
+/* the various controls for the scheduler */
+/* upper section, with selection mode */
+#leases_modes { padding: 10px; text-align: center; color: #333; }
+
+#leases_buttons { padding: 0px 10px 10px 10px; }
+#leases_refresh { position: relative; left: 30%;}
+#leases_submit { position: relative; left: 60%; }
+        
+
+/* column configuation style */
+
+div#toggle-container-my-slice-nodes-configuration {
+    background: #f8f8f8;
+}
+
+OPTION.out{background-color:white; color:black}
+OPTION.in{background-color:#CAE8EA; color:#4f6b72}
+
+div.out{background-color:white; color:black}
+div.in{background-color:#CAE8EA; color:#4f6b72}
+div.selected{background-color:gray; color:black}
+div.invisible{display:none}
+
+div.toggle-info {
+       padding: 10px 20px;
+       background-color: #cae8ea;
+       margin: 10px 10px;
+
+}
+
+div#scrolldiv {
+       border : solid 2px grey; 
+       padding:4px; 
+       width:300px; 
+       height:180px; 
+       overflow:auto;
+}
+
+th,td.top {
+       vertical-align: top;
+       text-align: left;
+       padding:10px;
+}
+
+td.smallright {
+       text-align: right;
+       width:20px;
+}
+
+table.center {
+       margin-left:auto; 
+       margin-right:auto;
+}
+
+table.columnlist {
+       width:280px;
+}
+
+td.header {
+       background-color: #CAE8EA;
+       text-align: center;
+       width:30px;
+}
+
+span.header {
+       font-weight: bold;
+       color: #3399CC;
+}
+
+a.source-url{
+        font-weight: bold;
+}
+
+span.gray{
+        color: #555555;
+}
+
+span.short {
+       height:10px;
+}
+
+span.column-title {
+        font-size: 12px;
+        font-weight: bold;
+}
+
+span.column-detail {
+        font-size: 11px; 
+        font-style: italic;
+}
diff --git a/plugins/scheduler/static/js/raphael-1.5.2.js b/plugins/scheduler/static/js/raphael-1.5.2.js
new file mode 100644 (file)
index 0000000..e5e7126
--- /dev/null
@@ -0,0 +1,7 @@
+/*
+ * Raphael 1.5.2 - JavaScript Vector Library
+ *
+ * Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
+ * Licensed under the MIT (http://raphaeljs.com/license.html) license.
+ */
+(function(){function a(){if(a.is(arguments[0],G)){var b=arguments[0],d=bV[m](a,b.splice(0,3+a.is(b[0],E))),e=d.set();for(var g=0,h=b[w];g<h;g++){var i=b[g]||{};c[f](i.type)&&e[L](d[i.type]().attr(i))}return e}return bV[m](a,arguments)}a.version="1.5.2";var b=/[, ]+/,c={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},d=/\{(\d+)\}/g,e="prototype",f="hasOwnProperty",g=document,h=window,i={was:Object[e][f].call(h,"Raphael"),is:h.Raphael},j=function(){this.customAttributes={}},k,l="appendChild",m="apply",n="concat",o="createTouch"in g,p="",q=" ",r=String,s="split",t="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[s](q),u={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},v="join",w="length",x=r[e].toLowerCase,y=Math,z=y.max,A=y.min,B=y.abs,C=y.pow,D=y.PI,E="number",F="string",G="array",H="toString",I="fill",J=Object[e][H],K={},L="push",M=/^url\(['"]?([^\)]+?)['"]?\)$/i,N=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,O={"NaN":1,Infinity:1,"-Infinity":1},P=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,Q=y.round,R="setAttribute",S=parseFloat,T=parseInt,U=" progid:DXImageTransform.Microsoft",V=r[e].toUpperCase,W={blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:"10px \"Arial\"","font-family":"\"Arial\"","font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},X={along:"along",blur:E,"clip-rect":"csv",cx:E,cy:E,fill:"colour","fill-opacity":E,"font-size":E,height:E,opacity:E,path:"path",r:E,rotation:"csv",rx:E,ry:E,scale:"csv",stroke:"colour","stroke-opacity":E,"stroke-width":E,translation:"csv",width:E,x:E,y:E},Y="replace",Z=/^(from|to|\d+%?)$/,$=/\s*,\s*/,_={hs:1,rg:1},ba=/,?([achlmqrstvxz]),?/gi,bb=/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,bc=/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,bd=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/,be=function(a,b){return a.key-b.key};a.type=h.SVGAngle||g.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(a.type=="VML"){var bf=g.createElement("div"),bg;bf.innerHTML="<v:shape adj=\"1\"/>";bg=bf.firstChild;bg.style.behavior="url(#default#VML)";if(!(bg&&typeof bg.adj=="object"))return a.type=null;bf=null}a.svg=!(a.vml=a.type=="VML");j[e]=a[e];k=j[e];a._id=0;a._oid=0;a.fn={};a.is=function(a,b){b=x.call(b);if(b=="finite")return!O[f](+a);return b=="null"&&a===null||b==typeof a||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||J.call(a).slice(8,-1).toLowerCase()==b};a.angle=function(b,c,d,e,f,g){{if(f==null){var h=b-d,i=c-e;if(!h&&!i)return 0;return((h<0)*180+y.atan(-i/-h)*180/D+360)%360}return a.angle(b,c,f,g)-a.angle(d,e,f,g)}};a.rad=function(a){return a%360*D/180};a.deg=function(a){return a*180/D%360};a.snapTo=function(b,c,d){d=a.is(d,"finite")?d:10;if(a.is(b,G)){var e=b.length;while(e--)if(B(b[e]-c)<=d)return b[e]}else{b=+b;var f=c%b;if(f<d)return c-f;if(f>b-d)return c-f+b}return c};function bh(){var a=[],b=0;for(;b<32;b++)a[b]=(~(~(y.random()*16)))[H](16);a[12]=4;a[16]=(a[16]&3|8)[H](16);return"r-"+a[v]("")}a.setWindow=function(a){h=a;g=h.document};var bi=function(b){if(a.vml){var c=/^\s+|\s+$/g,d;try{var e=new ActiveXObject("htmlfile");e.write("<body>");e.close();d=e.body}catch(a){d=createPopup().document.body}var f=d.createTextRange();bi=bm(function(a){try{d.style.color=r(a)[Y](c,p);var b=f.queryCommandValue("ForeColor");b=(b&255)<<16|b&65280|(b&16711680)>>>16;return"#"+("000000"+b[H](16)).slice(-6)}catch(a){return"none"}})}else{var h=g.createElement("i");h.title="Raphaël Colour Picker";h.style.display="none";g.body[l](h);bi=bm(function(a){h.style.color=a;return g.defaultView.getComputedStyle(h,p).getPropertyValue("color")})}return bi(b)},bj=function(){return"hsb("+[this.h,this.s,this.b]+")"},bk=function(){return"hsl("+[this.h,this.s,this.l]+")"},bl=function(){return this.hex};a.hsb2rgb=function(b,c,d,e){if(a.is(b,"object")&&"h"in b&&"s"in b&&"b"in b){d=b.b;c=b.s;b=b.h;e=b.o}return a.hsl2rgb(b,c,d/2,e)};a.hsl2rgb=function(b,c,d,e){if(a.is(b,"object")&&"h"in b&&"s"in b&&"l"in b){d=b.l;c=b.s;b=b.h}if(b>1||c>1||d>1){b/=360;c/=100;d/=100}var f={},g=["r","g","b"],h,i,j,k,l,m;if(c){d<0.5?h=d*(1+c):h=d+c-d*c;i=2*d-h;for(var n=0;n<3;n++){j=b+1/3*-(n-1);j<0&&j++;j>1&&j--;j*6<1?f[g[n]]=i+(h-i)*6*j:j*2<1?f[g[n]]=h:j*3<2?f[g[n]]=i+(h-i)*(2/3-j)*6:f[g[n]]=i}}else f={r:d,g:d,b:d};f.r*=255;f.g*=255;f.b*=255;f.hex="#"+(16777216|f.b|f.g<<8|f.r<<16).toString(16).slice(1);a.is(e,"finite")&&(f.opacity=e);f.toString=bl;return f};a.rgb2hsb=function(b,c,d){if(c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b){d=b.b;c=b.g;b=b.r}if(c==null&&a.is(b,F)){var e=a.getRGB(b);b=e.r;c=e.g;d=e.b}if(b>1||c>1||d>1){b/=255;c/=255;d/=255}var f=z(b,c,d),g=A(b,c,d),h,i,j=f;{if(g==f)return{h:0,s:0,b:f,toString:bj};var k=f-g;i=k/f;b==f?h=(c-d)/k:c==f?h=2+(d-b)/k:h=4+(b-c)/k;h/=6;h<0&&h++;h>1&&h--}return{h:h,s:i,b:j,toString:bj}};a.rgb2hsl=function(b,c,d){if(c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b){d=b.b;c=b.g;b=b.r}if(c==null&&a.is(b,F)){var e=a.getRGB(b);b=e.r;c=e.g;d=e.b}if(b>1||c>1||d>1){b/=255;c/=255;d/=255}var f=z(b,c,d),g=A(b,c,d),h,i,j=(f+g)/2,k;if(g==f)k={h:0,s:0,l:j};else{var l=f-g;i=j<0.5?l/(f+g):l/(2-f-g);b==f?h=(c-d)/l:c==f?h=2+(d-b)/l:h=4+(b-c)/l;h/=6;h<0&&h++;h>1&&h--;k={h:h,s:i,l:j}}k.toString=bk;return k};a._path2string=function(){return this.join(",")[Y](ba,"$1")};function bm(a,b,c){function d(){var g=Array[e].slice.call(arguments,0),h=g[v]("►"),i=d.cache=d.cache||{},j=d.count=d.count||[];if(i[f](h))return c?c(i[h]):i[h];j[w]>=1000&&delete i[j.shift()];j[L](h);i[h]=a[m](b,g);return c?c(i[h]):i[h]}return d}a.getRGB=bm(function(b){if(!b||!(!((b=r(b)).indexOf("-")+1)))return{r:-1,g:-1,b:-1,hex:"none",error:1};if(b=="none")return{r:-1,g:-1,b:-1,hex:"none"};!(_[f](b.toLowerCase().substring(0,2))||b.charAt()=="#")&&(b=bi(b));var c,d,e,g,h,i,j,k=b.match(N);if(k){if(k[2]){g=T(k[2].substring(5),16);e=T(k[2].substring(3,5),16);d=T(k[2].substring(1,3),16)}if(k[3]){g=T((i=k[3].charAt(3))+i,16);e=T((i=k[3].charAt(2))+i,16);d=T((i=k[3].charAt(1))+i,16)}if(k[4]){j=k[4][s]($);d=S(j[0]);j[0].slice(-1)=="%"&&(d*=2.55);e=S(j[1]);j[1].slice(-1)=="%"&&(e*=2.55);g=S(j[2]);j[2].slice(-1)=="%"&&(g*=2.55);k[1].toLowerCase().slice(0,4)=="rgba"&&(h=S(j[3]));j[3]&&j[3].slice(-1)=="%"&&(h/=100)}if(k[5]){j=k[5][s]($);d=S(j[0]);j[0].slice(-1)=="%"&&(d*=2.55);e=S(j[1]);j[1].slice(-1)=="%"&&(e*=2.55);g=S(j[2]);j[2].slice(-1)=="%"&&(g*=2.55);(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360);k[1].toLowerCase().slice(0,4)=="hsba"&&(h=S(j[3]));j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsb2rgb(d,e,g,h)}if(k[6]){j=k[6][s]($);d=S(j[0]);j[0].slice(-1)=="%"&&(d*=2.55);e=S(j[1]);j[1].slice(-1)=="%"&&(e*=2.55);g=S(j[2]);j[2].slice(-1)=="%"&&(g*=2.55);(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360);k[1].toLowerCase().slice(0,4)=="hsla"&&(h=S(j[3]));j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsl2rgb(d,e,g,h)}k={r:d,g:e,b:g};k.hex="#"+(16777216|g|e<<8|d<<16).toString(16).slice(1);a.is(h,"finite")&&(k.opacity=h);return k}return{r:-1,g:-1,b:-1,hex:"none",error:1}},a);a.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||0.75},c=this.hsb2rgb(b.h,b.s,b.b);b.h+=0.075;if(b.h>1){b.h=0;b.s-=0.2;b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b})}return c.hex};a.getColor.reset=function(){delete this.start};a.parsePathString=bm(function(b){if(!b)return null;var c={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},d=[];a.is(b,G)&&a.is(b[0],G)&&(d=bo(b));d[w]||r(b)[Y](bb,function(a,b,e){var f=[],g=x.call(b);e[Y](bc,function(a,b){b&&f[L](+b)});if(g=="m"&&f[w]>2){d[L]([b][n](f.splice(0,2)));g="l";b=b=="m"?"l":"L"}while(f[w]>=c[g]){d[L]([b][n](f.splice(0,c[g])));if(!c[g])break}});d[H]=a._path2string;return d});a.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=C(j,3)*a+C(j,2)*3*i*c+j*3*i*i*e+C(i,3)*g,l=C(j,3)*b+C(j,2)*3*i*d+j*3*i*i*f+C(i,3)*h,m=a+2*i*(c-a)+i*i*(e-2*c+a),n=b+2*i*(d-b)+i*i*(f-2*d+b),o=c+2*i*(e-c)+i*i*(g-2*e+c),p=d+2*i*(f-d)+i*i*(h-2*f+d),q=(1-i)*a+i*c,r=(1-i)*b+i*d,s=(1-i)*e+i*g,t=(1-i)*f+i*h,u=90-y.atan((m-o)/(n-p))*180/D;(m>o||n<p)&&(u+=180);return{x:k,y:l,m:{x:m,y:n},n:{x:o,y:p},start:{x:q,y:r},end:{x:s,y:t},alpha:u}};var bn=bm(function(a){if(!a)return{x:0,y:0,width:0,height:0};a=bw(a);var b=0,c=0,d=[],e=[],f;for(var g=0,h=a[w];g<h;g++){f=a[g];if(f[0]=="M"){b=f[1];c=f[2];d[L](b);e[L](c)}else{var i=bv(b,c,f[1],f[2],f[3],f[4],f[5],f[6]);d=d[n](i.min.x,i.max.x);e=e[n](i.min.y,i.max.y);b=f[5];c=f[6]}}var j=A[m](0,d),k=A[m](0,e);return{x:j,y:k,width:z[m](0,d)-j,height:z[m](0,e)-k}}),bo=function(b){var c=[];if(!a.is(b,G)||!a.is(b&&b[0],G))b=a.parsePathString(b);for(var d=0,e=b[w];d<e;d++){c[d]=[];for(var f=0,g=b[d][w];f<g;f++)c[d][f]=b[d][f]}c[H]=a._path2string;return c},bp=bm(function(b){if(!a.is(b,G)||!a.is(b&&b[0],G))b=a.parsePathString(b);var c=[],d=0,e=0,f=0,g=0,h=0;if(b[0][0]=="M"){d=b[0][1];e=b[0][2];f=d;g=e;h++;c[L](["M",d,e])}for(var i=h,j=b[w];i<j;i++){var k=c[i]=[],l=b[i];if(l[0]!=x.call(l[0])){k[0]=x.call(l[0]);switch(k[0]){case"a":k[1]=l[1];k[2]=l[2];k[3]=l[3];k[4]=l[4];k[5]=l[5];k[6]=+(l[6]-d).toFixed(3);k[7]=+(l[7]-e).toFixed(3);break;case"v":k[1]=+(l[1]-e).toFixed(3);break;case"m":f=l[1];g=l[2];default:for(var m=1,n=l[w];m<n;m++)k[m]=+(l[m]-(m%2?d:e)).toFixed(3)}}else{k=c[i]=[];if(l[0]=="m"){f=l[1]+d;g=l[2]+e}for(var o=0,p=l[w];o<p;o++)c[i][o]=l[o]}var q=c[i][w];switch(c[i][0]){case"z":d=f;e=g;break;case"h":d+=+c[i][q-1];break;case"v":e+=+c[i][q-1];break;default:d+=+c[i][q-2];e+=+c[i][q-1]}}c[H]=a._path2string;return c},0,bo),bq=bm(function(b){if(!a.is(b,G)||!a.is(b&&b[0],G))b=a.parsePathString(b);var c=[],d=0,e=0,f=0,g=0,h=0;if(b[0][0]=="M"){d=+b[0][1];e=+b[0][2];f=d;g=e;h++;c[0]=["M",d,e]}for(var i=h,j=b[w];i<j;i++){var k=c[i]=[],l=b[i];if(l[0]!=V.call(l[0])){k[0]=V.call(l[0]);switch(k[0]){case"A":k[1]=l[1];k[2]=l[2];k[3]=l[3];k[4]=l[4];k[5]=l[5];k[6]=+(l[6]+d);k[7]=+(l[7]+e);break;case"V":k[1]=+l[1]+e;break;case"H":k[1]=+l[1]+d;break;case"M":f=+l[1]+d;g=+l[2]+e;default:for(var m=1,n=l[w];m<n;m++)k[m]=+l[m]+(m%2?d:e)}}else for(var o=0,p=l[w];o<p;o++)c[i][o]=l[o];switch(k[0]){case"Z":d=f;e=g;break;case"H":d=k[1];break;case"V":e=k[1];break;case"M":f=c[i][c[i][w]-2];g=c[i][c[i][w]-1];default:d=c[i][c[i][w]-2];e=c[i][c[i][w]-1]}}c[H]=a._path2string;return c},null,bo),br=function(a,b,c,d){return[a,b,c,d,c,d]},bs=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},bt=function(a,b,c,d,e,f,g,h,i,j){var k=D*120/180,l=D/180*(+e||0),m=[],o,p=bm(function(a,b,c){var d=a*y.cos(c)-b*y.sin(c),e=a*y.sin(c)+b*y.cos(c);return{x:d,y:e}});if(j){G=j[0];H=j[1];E=j[2];F=j[3]}else{o=p(a,b,-l);a=o.x;b=o.y;o=p(h,i,-l);h=o.x;i=o.y;var q=y.cos(D/180*e),r=y.sin(D/180*e),t=(a-h)/2,u=(b-i)/2,x=t*t/(c*c)+u*u/(d*d);if(x>1){x=y.sqrt(x);c=x*c;d=x*d}var z=c*c,A=d*d,C=(f==g?-1:1)*y.sqrt(B((z*A-z*u*u-A*t*t)/(z*u*u+A*t*t))),E=C*c*u/d+(a+h)/2,F=C*-d*t/c+(b+i)/2,G=y.asin(((b-F)/d).toFixed(9)),H=y.asin(((i-F)/d).toFixed(9));G=a<E?D-G:G;H=h<E?D-H:H;G<0&&(G=D*2+G);H<0&&(H=D*2+H);g&&G>H&&(G=G-D*2);!g&&H>G&&(H=H-D*2)}var I=H-G;if(B(I)>k){var J=H,K=h,L=i;H=G+k*(g&&H>G?1:-1);h=E+c*y.cos(H);i=F+d*y.sin(H);m=bt(h,i,c,d,e,0,g,K,L,[H,J,E,F])}I=H-G;var M=y.cos(G),N=y.sin(G),O=y.cos(H),P=y.sin(H),Q=y.tan(I/4),R=4/3*c*Q,S=4/3*d*Q,T=[a,b],U=[a+R*N,b-S*M],V=[h+R*P,i-S*O],W=[h,i];U[0]=2*T[0]-U[0];U[1]=2*T[1]-U[1];{if(j)return[U,V,W][n](m);m=[U,V,W][n](m)[v]()[s](",");var X=[];for(var Y=0,Z=m[w];Y<Z;Y++)X[Y]=Y%2?p(m[Y-1],m[Y],l).y:p(m[Y],m[Y+1],l).x;return X}},bu=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:C(j,3)*a+C(j,2)*3*i*c+j*3*i*i*e+C(i,3)*g,y:C(j,3)*b+C(j,2)*3*i*d+j*3*i*i*f+C(i,3)*h}},bv=bm(function(a,b,c,d,e,f,g,h){var i=e-2*c+a-(g-2*e+c),j=2*(c-a)-2*(e-c),k=a-c,l=(-j+y.sqrt(j*j-4*i*k))/2/i,n=(-j-y.sqrt(j*j-4*i*k))/2/i,o=[b,h],p=[a,g],q;B(l)>"1e12"&&(l=0.5);B(n)>"1e12"&&(n=0.5);if(l>0&&l<1){q=bu(a,b,c,d,e,f,g,h,l);p[L](q.x);o[L](q.y)}if(n>0&&n<1){q=bu(a,b,c,d,e,f,g,h,n);p[L](q.x);o[L](q.y)}i=f-2*d+b-(h-2*f+d);j=2*(d-b)-2*(f-d);k=b-d;l=(-j+y.sqrt(j*j-4*i*k))/2/i;n=(-j-y.sqrt(j*j-4*i*k))/2/i;B(l)>"1e12"&&(l=0.5);B(n)>"1e12"&&(n=0.5);if(l>0&&l<1){q=bu(a,b,c,d,e,f,g,h,l);p[L](q.x);o[L](q.y)}if(n>0&&n<1){q=bu(a,b,c,d,e,f,g,h,n);p[L](q.x);o[L](q.y)}return{min:{x:A[m](0,p),y:A[m](0,o)},max:{x:z[m](0,p),y:z[m](0,o)}}}),bw=bm(function(a,b){var c=bq(a),d=b&&bq(b),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1];b.Y=a[2];break;case"A":a=["C"][n](bt[m](0,[b.x,b.y][n](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x));d=b.y+(b.y-(b.by||b.y));a=["C",c,d][n](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.x));b.qy=b.y+(b.y-(b.qy||b.y));a=["C"][n](bs(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1];b.qy=a[2];a=["C"][n](bs(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][n](br(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][n](br(b.x,b.y,a[1],b.y));break;case"V":a=["C"][n](br(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][n](br(b.x,b.y,b.X,b.Y));break}return a},h=function(a,b){if(a[b][w]>7){a[b].shift();var e=a[b];while(e[w])a.splice(b++,0,["C"][n](e.splice(0,6)));a.splice(b,1);k=z(c[w],d&&d[w]||0)}},i=function(a,b,e,f,g){if(a&&b&&a[g][0]=="M"&&b[g][0]!="M"){b.splice(g,0,["M",f.x,f.y]);e.bx=0;e.by=0;e.x=a[g][1];e.y=a[g][2];k=z(c[w],d&&d[w]||0)}};for(var j=0,k=z(c[w],d&&d[w]||0);j<k;j++){c[j]=g(c[j],e);h(c,j);d&&(d[j]=g(d[j],f));d&&h(d,j);i(c,d,e,f,j);i(d,c,f,e,j);var l=c[j],o=d&&d[j],p=l[w],q=d&&o[w];e.x=l[p-2];e.y=l[p-1];e.bx=S(l[p-4])||e.x;e.by=S(l[p-3])||e.y;f.bx=d&&(S(o[q-4])||f.x);f.by=d&&(S(o[q-3])||f.y);f.x=d&&o[q-2];f.y=d&&o[q-1]}return d?[c,d]:c},null,bo),bx=bm(function(b){var c=[];for(var d=0,e=b[w];d<e;d++){var f={},g=b[d].match(/^([^:]*):?([\d\.]*)/);f.color=a.getRGB(g[1]);if(f.color.error)return null;f.color=f.color.hex;g[2]&&(f.offset=g[2]+"%");c[L](f)}for(d=1,e=c[w]-1;d<e;d++){if(!c[d].offset){var h=S(c[d-1].offset||0),i=0;for(var j=d+1;j<e;j++){if(c[j].offset){i=c[j].offset;break}}if(!i){i=100;j=e}i=S(i);var k=(i-h)/(j-d+1);for(;d<j;d++){h+=k;c[d].offset=h+"%"}}}return c}),by=function(b,c,d,e){var f;if(a.is(b,F)||a.is(b,"object")){f=a.is(b,F)?g.getElementById(b):b;if(f.tagName)return c==null?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:c,height:d}}else return{container:1,x:b,y:c,width:d,height:e}},bz=function(a,b){var c=this;for(var d in b){if(b[f](d)&&!(d in a))switch(typeof b[d]){case"function":(function(b){a[d]=a===c?b:function(){return b[m](c,arguments)}})(b[d]);break;case"object":a[d]=a[d]||{};bz.call(this,a[d],b[d]);break;default:a[d]=b[d];break}}},bA=function(a,b){a==b.top&&(b.top=a.prev);a==b.bottom&&(b.bottom=a.next);a.next&&(a.next.prev=a.prev);a.prev&&(a.prev.next=a.next)},bB=function(a,b){if(b.top===a)return;bA(a,b);a.next=null;a.prev=b.top;b.top.next=a;b.top=a},bC=function(a,b){if(b.bottom===a)return;bA(a,b);a.next=b.bottom;a.prev=null;b.bottom.prev=a;b.bottom=a},bD=function(a,b,c){bA(a,c);b==c.top&&(c.top=a);b.next&&(b.next.prev=a);a.next=b.next;a.prev=b;b.next=a},bE=function(a,b,c){bA(a,c);b==c.bottom&&(c.bottom=a);b.prev&&(b.prev.next=a);a.prev=b.prev;b.prev=a;a.next=b},bF=function(a){return function(){throw new Error("Raphaël: you are calling to method “"+a+"” of removed object")}};a.pathToRelative=bp;if(a.svg){k.svgns="http://www.w3.org/2000/svg";k.xlink="http://www.w3.org/1999/xlink";Q=function(a){return+a+(~(~a)===a)*0.5};var bG=function(a,b){if(b)for(var c in b)b[f](c)&&a[R](c,r(b[c]));else{a=g.createElementNS(k.svgns,a);a.style.webkitTapHighlightColor="rgba(0,0,0,0)";return a}};a[H]=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var bH=function(a,b){var c=bG("path");b.canvas&&b.canvas[l](c);var d=new bN(c,b);d.type="path";bK(d,{fill:"none",stroke:"#000",path:a});return d},bI=function(a,b,c){var d="linear",e=0.5,f=0.5,h=a.style;b=r(b)[Y](bd,function(a,b,c){d="radial";if(b&&c){e=S(b);f=S(c);var g=(f>0.5)*2-1;C(e-0.5,2)+C(f-0.5,2)>0.25&&(f=y.sqrt(0.25-C(e-0.5,2))*g+0.5)&&f!=0.5&&(f=f.toFixed(5)-0.00001*g)}return p});b=b[s](/\s*\-\s*/);if(d=="linear"){var i=b.shift();i=-S(i);if(isNaN(i))return null;var j=[0,0,y.cos(i*D/180),y.sin(i*D/180)],k=1/(z(B(j[2]),B(j[3]))||1);j[2]*=k;j[3]*=k;if(j[2]<0){j[0]=-j[2];j[2]=0}if(j[3]<0){j[1]=-j[3];j[3]=0}}var m=bx(b);if(!m)return null;var n=a.getAttribute(I);n=n.match(/^url\(#(.*)\)$/);n&&c.defs.removeChild(g.getElementById(n[1]));var o=bG(d+"Gradient");o.id=bh();bG(o,d=="radial"?{fx:e,fy:f}:{x1:j[0],y1:j[1],x2:j[2],y2:j[3]});c.defs[l](o);for(var q=0,t=m[w];q<t;q++){var u=bG("stop");bG(u,{offset:m[q].offset?m[q].offset:q?"100%":"0%","stop-color":m[q].color||"#fff"});o[l](u)}bG(a,{fill:"url(#"+o.id+")",opacity:1,"fill-opacity":1});h.fill=p;h.opacity=1;h.fillOpacity=1;return 1},bJ=function(b){var c=b.getBBox();bG(b.pattern,{patternTransform:a.format("translate({0},{1})",c.x,c.y)})},bK=function(c,d){var e={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},h=c.node,i=c.attrs,j=c.rotate(),k=function(a,b){b=e[x.call(b)];if(b){var c=a.attrs["stroke-width"]||"1",f=({round:c,square:c,butt:0})[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],i=b[w];while(i--)g[i]=b[i]*c+(i%2?1:-1)*f;bG(h,{"stroke-dasharray":g[v](",")})}};d[f]("rotation")&&(j=d.rotation);var m=r(j)[s](b);if(m.length-1){m[1]=+m[1];m[2]=+m[2]}else m=null;S(j)&&c.rotate(0,true);for(var n in d){if(d[f](n)){if(!W[f](n))continue;var o=d[n];i[n]=o;switch(n){case"blur":c.blur(o);break;case"rotation":c.rotate(o,true);break;case"href":case"title":case"target":var t=h.parentNode;if(x.call(t.tagName)!="a"){var u=bG("a");t.insertBefore(u,h);u[l](h);t=u}n=="target"&&o=="blank"?t.setAttributeNS(c.paper.xlink,"show","new"):t.setAttributeNS(c.paper.xlink,n,o);break;case"cursor":h.style.cursor=o;break;case"clip-rect":var y=r(o)[s](b);if(y[w]==4){c.clip&&c.clip.parentNode.parentNode.removeChild(c.clip.parentNode);var z=bG("clipPath"),A=bG("rect");z.id=bh();bG(A,{x:y[0],y:y[1],width:y[2],height:y[3]});z[l](A);c.paper.defs[l](z);bG(h,{"clip-path":"url(#"+z.id+")"});c.clip=A}if(!o){var B=g.getElementById(h.getAttribute("clip-path")[Y](/(^url\(#|\)$)/g,p));B&&B.parentNode.removeChild(B);bG(h,{"clip-path":p});delete c.clip}break;case"path":c.type=="path"&&bG(h,{d:o?i.path=bq(o):"M0,0"});break;case"width":h[R](n,o);if(i.fx){n="x";o=i.x}else break;case"x":i.fx&&(o=-i.x-(i.width||0));case"rx":if(n=="rx"&&c.type=="rect")break;case"cx":m&&(n=="x"||n=="cx")&&(m[1]+=o-i[n]);h[R](n,o);c.pattern&&bJ(c);break;case"height":h[R](n,o);if(i.fy){n="y";o=i.y}else break;case"y":i.fy&&(o=-i.y-(i.height||0));case"ry":if(n=="ry"&&c.type=="rect")break;case"cy":m&&(n=="y"||n=="cy")&&(m[2]+=o-i[n]);h[R](n,o);c.pattern&&bJ(c);break;case"r":c.type=="rect"?bG(h,{rx:o,ry:o}):h[R](n,o);break;case"src":c.type=="image"&&h.setAttributeNS(c.paper.xlink,"href",o);break;case"stroke-width":h.style.strokeWidth=o;h[R](n,o);i["stroke-dasharray"]&&k(c,i["stroke-dasharray"]);break;case"stroke-dasharray":k(c,o);break;case"translation":var C=r(o)[s](b);C[0]=+C[0]||0;C[1]=+C[1]||0;if(m){m[1]+=C[0];m[2]+=C[1]}cz.call(c,C[0],C[1]);break;case"scale":C=r(o)[s](b);c.scale(+C[0]||1,+C[1]||+C[0]||1,isNaN(S(C[2]))?null:+C[2],isNaN(S(C[3]))?null:+C[3]);break;case I:var D=r(o).match(M);if(D){z=bG("pattern");var E=bG("image");z.id=bh();bG(z,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1});bG(E,{x:0,y:0});E.setAttributeNS(c.paper.xlink,"href",D[1]);z[l](E);var F=g.createElement("img");F.style.cssText="position:absolute;left:-9999em;top-9999em";F.onload=function(){bG(z,{width:this.offsetWidth,height:this.offsetHeight});bG(E,{width:this.offsetWidth,height:this.offsetHeight});g.body.removeChild(this);c.paper.safari()};g.body[l](F);F.src=D[1];c.paper.defs[l](z);h.style.fill="url(#"+z.id+")";bG(h,{fill:"url(#"+z.id+")"});c.pattern=z;c.pattern&&bJ(c);break}var G=a.getRGB(o);if(G.error)if((({circle:1,ellipse:1})[f](c.type)||r(o).charAt()!="r")&&bI(h,o,c.paper)){i.gradient=o;i.fill="none";break}else{delete d.gradient;delete i.gradient;!a.is(i.opacity,"undefined")&&a.is(d.opacity,"undefined")&&bG(h,{opacity:i.opacity});!a.is(i["fill-opacity"],"undefined")&&a.is(d["fill-opacity"],"undefined")&&bG(h,{"fill-opacity":i["fill-opacity"]})}G[f]("opacity")&&bG(h,{"fill-opacity":G.opacity>1?G.opacity/100:G.opacity});case"stroke":G=a.getRGB(o);h[R](n,G.hex);n=="stroke"&&G[f]("opacity")&&bG(h,{"stroke-opacity":G.opacity>1?G.opacity/100:G.opacity});break;case"gradient":(({circle:1,ellipse:1})[f](c.type)||r(o).charAt()!="r")&&bI(h,o,c.paper);break;case"opacity":i.gradient&&!i[f]("stroke-opacity")&&bG(h,{"stroke-opacity":o>1?o/100:o});case"fill-opacity":if(i.gradient){var H=g.getElementById(h.getAttribute(I)[Y](/^url\(#|\)$/g,p));if(H){var J=H.getElementsByTagName("stop");J[J[w]-1][R]("stop-opacity",o)}break}default:n=="font-size"&&(o=T(o,10)+"px");var K=n[Y](/(\-.)/g,function(a){return V.call(a.substring(1))});h.style[K]=o;h[R](n,o);break}}}bM(c,d);m?c.rotate(m.join(q)):S(j)&&c.rotate(j,true)},bL=1.2,bM=function(b,c){if(b.type!="text"||!(c[f]("text")||c[f]("font")||c[f]("font-size")||c[f]("x")||c[f]("y")))return;var d=b.attrs,e=b.node,h=e.firstChild?T(g.defaultView.getComputedStyle(e.firstChild,p).getPropertyValue("font-size"),10):10;if(c[f]("text")){d.text=c.text;while(e.firstChild)e.removeChild(e.firstChild);var i=r(c.text)[s]("\n");for(var j=0,k=i[w];j<k;j++)if(i[j]){var m=bG("tspan");j&&bG(m,{dy:h*bL,x:d.x});m[l](g.createTextNode(i[j]));e[l](m)}}else{i=e.getElementsByTagName("tspan");for(j=0,k=i[w];j<k;j++)j&&bG(i[j],{dy:h*bL,x:d.x})}bG(e,{y:d.y});var n=b.getBBox(),o=d.y-(n.y+n.height/2);o&&a.is(o,"finite")&&bG(e,{y:d.y+o})},bN=function(b,c){var d=0,e=0;this[0]=b;this.id=a._oid++;this.node=b;b.raphael=this;this.paper=c;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1};!c.bottom&&(c.bottom=this);this.prev=c.top;c.top&&(c.top.next=this);c.top=this;this.next=null},bO=bN[e];bN[e].rotate=function(c,d,e){if(this.removed)return this;if(c==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][v](q);return this._.rt.deg}var f=this.getBBox();c=r(c)[s](b);if(c[w]-1){d=S(c[1]);e=S(c[2])}c=S(c[0]);d!=null&&d!==false?this._.rt.deg=c:this._.rt.deg+=c;e==null&&(d=null);this._.rt.cx=d;this._.rt.cy=e;d=d==null?f.x+f.width/2:d;e=e==null?f.y+f.height/2:e;if(this._.rt.deg){this.transformations[0]=a.format("rotate({0} {1} {2})",this._.rt.deg,d,e);this.clip&&bG(this.clip,{transform:a.format("rotate({0} {1} {2})",-this._.rt.deg,d,e)})}else{this.transformations[0]=p;this.clip&&bG(this.clip,{transform:p})}bG(this.node,{transform:this.transformations[v](q)});return this};bN[e].hide=function(){!this.removed&&(this.node.style.display="none");return this};bN[e].show=function(){!this.removed&&(this.node.style.display="");return this};bN[e].remove=function(){if(this.removed)return;bA(this,this.paper);this.node.parentNode.removeChild(this.node);for(var a in this)delete this[a];this.removed=true};bN[e].getBBox=function(){if(this.removed)return this;if(this.type=="path")return bn(this.attrs.path);if(this.node.style.display=="none"){this.show();var a=true}var b={};try{b=this.node.getBBox()}catch(a){}finally{b=b||{}}if(this.type=="text"){b={x:b.x,y:Infinity,width:0,height:0};for(var c=0,d=this.node.getNumberOfChars();c<d;c++){var e=this.node.getExtentOfChar(c);e.y<b.y&&(b.y=e.y);e.y+e.height-b.y>b.height&&(b.height=e.y+e.height-b.y);e.x+e.width-b.x>b.width&&(b.width=e.x+e.width-b.x)}}a&&this.hide();return b};bN[e].attr=function(b,c){if(this.removed)return this;if(b==null){var d={};for(var e in this.attrs)this.attrs[f](e)&&(d[e]=this.attrs[e]);this._.rt.deg&&(d.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(d.scale=this.scale());d.gradient&&d.fill=="none"&&(d.fill=d.gradient)&&delete d.gradient;return d}if(c==null&&a.is(b,F)){if(b=="translation")return cz.call(this);if(b=="rotation")return this.rotate();if(b=="scale")return this.scale();if(b==I&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[b]}if(c==null&&a.is(b,G)){var g={};for(var h=0,i=b.length;h<i;h++)g[b[h]]=this.attr(b[h]);return g}if(c!=null){var j={};j[b]=c}else b!=null&&a.is(b,"object")&&(j=b);for(var k in this.paper.customAttributes)if(this.paper.customAttributes[f](k)&&j[f](k)&&a.is(this.paper.customAttributes[k],"function")){var l=this.paper.customAttributes[k].apply(this,[][n](j[k]));this.attrs[k]=j[k];for(var m in l)l[f](m)&&(j[m]=l[m])}bK(this,j);return this};bN[e].toFront=function(){if(this.removed)return this;this.node.parentNode[l](this.node);var a=this.paper;a.top!=this&&bB(this,a);return this};bN[e].toBack=function(){if(this.removed)return this;if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);bC(this,this.paper);var a=this.paper}return this};bN[e].insertAfter=function(a){if(this.removed)return this;var b=a.node||a[a.length-1].node;b.nextSibling?b.parentNode.insertBefore(this.node,b.nextSibling):b.parentNode[l](this.node);bD(this,a,this.paper);return this};bN[e].insertBefore=function(a){if(this.removed)return this;var b=a.node||a[0].node;b.parentNode.insertBefore(this.node,b);bE(this,a,this.paper);return this};bN[e].blur=function(a){var b=this;if(+a!==0){var c=bG("filter"),d=bG("feGaussianBlur");b.attrs.blur=a;c.id=bh();bG(d,{stdDeviation:+a||1.5});c.appendChild(d);b.paper.defs.appendChild(c);b._blur=c;bG(b.node,{filter:"url(#"+c.id+")"})}else{if(b._blur){b._blur.parentNode.removeChild(b._blur);delete b._blur;delete b.attrs.blur}b.node.removeAttribute("filter")}};var bP=function(a,b,c,d){var e=bG("circle");a.canvas&&a.canvas[l](e);var f=new bN(e,a);f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"};f.type="circle";bG(e,f.attrs);return f},bQ=function(a,b,c,d,e,f){var g=bG("rect");a.canvas&&a.canvas[l](g);var h=new bN(g,a);h.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"};h.type="rect";bG(g,h.attrs);return h},bR=function(a,b,c,d,e){var f=bG("ellipse");a.canvas&&a.canvas[l](f);var g=new bN(f,a);g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"};g.type="ellipse";bG(f,g.attrs);return g},bS=function(a,b,c,d,e,f){var g=bG("image");bG(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"});g.setAttributeNS(a.xlink,"href",b);a.canvas&&a.canvas[l](g);var h=new bN(g,a);h.attrs={x:c,y:d,width:e,height:f,src:b};h.type="image";return h},bT=function(a,b,c,d){var e=bG("text");bG(e,{x:b,y:c,"text-anchor":"middle"});a.canvas&&a.canvas[l](e);var f=new bN(e,a);f.attrs={x:b,y:c,"text-anchor":"middle",text:d,font:W.font,stroke:"none",fill:"#000"};f.type="text";bK(f,f.attrs);return f},bU=function(a,b){this.width=a||this.width;this.height=b||this.height;this.canvas[R]("width",this.width);this.canvas[R]("height",this.height);return this},bV=function(){var b=by[m](0,arguments),c=b&&b.container,d=b.x,e=b.y,f=b.width,h=b.height;if(!c)throw new Error("SVG container not found.");var i=bG("svg");d=d||0;e=e||0;f=f||512;h=h||342;bG(i,{xmlns:"http://www.w3.org/2000/svg",version:1.1,width:f,height:h});if(c==1){i.style.cssText="position:absolute;left:"+d+"px;top:"+e+"px";g.body[l](i)}else c.firstChild?c.insertBefore(i,c.firstChild):c[l](i);c=new j;c.width=f;c.height=h;c.canvas=i;bz.call(c,c,a.fn);c.clear();return c};k.clear=function(){var a=this.canvas;while(a.firstChild)a.removeChild(a.firstChild);this.bottom=this.top=null;(this.desc=bG("desc"))[l](g.createTextNode("Created with Raphaël"));a[l](this.desc);a[l](this.defs=bG("defs"))};k.remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=bF(a)}}if(a.vml){var bW={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},bX=/([clmz]),?([^clmz]*)/gi,bY=/ progid:\S+Blur\([^\)]+\)/g,bZ=/-?[^,\s-]+/g,b$=1000+q+1000,b_=10,ca={path:1,rect:1},cb=function(a){var b=/[ahqstv]/ig,c=bq;r(a).match(b)&&(c=bw);b=/[clmz]/g;if(c==bq&&!r(a).match(b)){var d=r(a)[Y](bX,function(a,b,c){var d=[],e=x.call(b)=="m",f=bW[b];c[Y](bZ,function(a){if(e&&d[w]==2){f+=d+bW[b=="m"?"l":"L"];d=[]}d[L](Q(a*b_))});return f+d});return d}var e=c(a),f,g;d=[];for(var h=0,i=e[w];h<i;h++){f=e[h];g=x.call(e[h][0]);g=="z"&&(g="x");for(var j=1,k=f[w];j<k;j++)g+=Q(f[j]*b_)+(j!=k-1?",":p);d[L](g)}return d[v](q)};a[H]=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};bH=function(a,b){var c=cd("group");c.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px";c.coordsize=b.coordsize;c.coordorigin=b.coordorigin;var d=cd("shape"),e=d.style;e.width=b.width+"px";e.height=b.height+"px";d.coordsize=b$;d.coordorigin=b.coordorigin;c[l](d);var f=new bN(d,c,b),g={fill:"none",stroke:"#000"};a&&(g.path=a);f.type="path";f.path=[];f.Path=p;bK(f,g);b.canvas[l](c);return f};bK=function(c,d){c.attrs=c.attrs||{};var e=c.node,h=c.attrs,i=e.style,j,k=(d.x!=h.x||d.y!=h.y||d.width!=h.width||d.height!=h.height||d.r!=h.r)&&c.type=="rect",m=c;for(var n in d)d[f](n)&&(h[n]=d[n]);if(k){h.path=cc(h.x,h.y,h.width,h.height,h.r);c.X=h.x;c.Y=h.y;c.W=h.width;c.H=h.height}d.href&&(e.href=d.href);d.title&&(e.title=d.title);d.target&&(e.target=d.target);d.cursor&&(i.cursor=d.cursor);"blur"in d&&c.blur(d.blur);if(d.path&&c.type=="path"||k)e.path=cb(h.path);d.rotation!=null&&c.rotate(d.rotation,true);if(d.translation){j=r(d.translation)[s](b);cz.call(c,j[0],j[1]);if(c._.rt.cx!=null){c._.rt.cx+=+j[0];c._.rt.cy+=+j[1];c.setBox(c.attrs,j[0],j[1])}}if(d.scale){j=r(d.scale)[s](b);c.scale(+j[0]||1,+j[1]||+j[0]||1,+j[2]||null,+j[3]||null)}if("clip-rect"in d){var o=r(d["clip-rect"])[s](b);if(o[w]==4){o[2]=+o[2]+ +o[0];o[3]=+o[3]+ +o[1];var q=e.clipRect||g.createElement("div"),t=q.style,u=e.parentNode;t.clip=a.format("rect({1}px {2}px {3}px {0}px)",o);if(!e.clipRect){t.position="absolute";t.top=0;t.left=0;t.width=c.paper.width+"px";t.height=c.paper.height+"px";u.parentNode.insertBefore(q,u);q[l](u);e.clipRect=q}}d["clip-rect"]||e.clipRect&&(e.clipRect.style.clip=p)}c.type=="image"&&d.src&&(e.src=d.src);if(c.type=="image"&&d.opacity){e.filterOpacity=U+".Alpha(opacity="+d.opacity*100+")";i.filter=(e.filterMatrix||p)+(e.filterOpacity||p)}d.font&&(i.font=d.font);d["font-family"]&&(i.fontFamily="\""+d["font-family"][s](",")[0][Y](/^['"]+|['"]+$/g,p)+"\"");d["font-size"]&&(i.fontSize=d["font-size"]);d["font-weight"]&&(i.fontWeight=d["font-weight"]);d["font-style"]&&(i.fontStyle=d["font-style"]);if(d.opacity!=null||d["stroke-width"]!=null||d.fill!=null||d.stroke!=null||d["stroke-width"]!=null||d["stroke-opacity"]!=null||d["fill-opacity"]!=null||d["stroke-dasharray"]!=null||d["stroke-miterlimit"]!=null||d["stroke-linejoin"]!=null||d["stroke-linecap"]!=null){e=c.shape||e;var v=e.getElementsByTagName(I)&&e.getElementsByTagName(I)[0],x=false;!v&&(x=v=cd(I));if("fill-opacity"in d||"opacity"in d){var y=((+h["fill-opacity"]+1||2)-1)*((+h.opacity+1||2)-1)*((+a.getRGB(d.fill).o+1||2)-1);y=A(z(y,0),1);v.opacity=y}d.fill&&(v.on=true);if(v.on==null||d.fill=="none")v.on=false;if(v.on&&d.fill){var B=d.fill.match(M);if(B){v.src=B[1];v.type="tile"}else{v.color=a.getRGB(d.fill).hex;v.src=p;v.type="solid";if(a.getRGB(d.fill).error&&(m.type in{circle:1,ellipse:1}||r(d.fill).charAt()!="r")&&bI(m,d.fill)){h.fill="none";h.gradient=d.fill}}}x&&e[l](v);var C=e.getElementsByTagName("stroke")&&e.getElementsByTagName("stroke")[0],D=false;!C&&(D=C=cd("stroke"));if(d.stroke&&d.stroke!="none"||d["stroke-width"]||d["stroke-opacity"]!=null||d["stroke-dasharray"]||d["stroke-miterlimit"]||d["stroke-linejoin"]||d["stroke-linecap"])C.on=true;(d.stroke=="none"||C.on==null||d.stroke==0||d["stroke-width"]==0)&&(C.on=false);var E=a.getRGB(d.stroke);C.on&&d.stroke&&(C.color=E.hex);y=((+h["stroke-opacity"]+1||2)-1)*((+h.opacity+1||2)-1)*((+E.o+1||2)-1);var F=(S(d["stroke-width"])||1)*0.75;y=A(z(y,0),1);d["stroke-width"]==null&&(F=h["stroke-width"]);d["stroke-width"]&&(C.weight=F);F&&F<1&&(y*=F)&&(C.weight=1);C.opacity=y;d["stroke-linejoin"]&&(C.joinstyle=d["stroke-linejoin"]||"miter");C.miterlimit=d["stroke-miterlimit"]||8;d["stroke-linecap"]&&(C.endcap=d["stroke-linecap"]=="butt"?"flat":d["stroke-linecap"]=="square"?"square":"round");if(d["stroke-dasharray"]){var G={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};C.dashstyle=G[f](d["stroke-dasharray"])?G[d["stroke-dasharray"]]:p}D&&e[l](C)}if(m.type=="text"){i=m.paper.span.style;h.font&&(i.font=h.font);h["font-family"]&&(i.fontFamily=h["font-family"]);h["font-size"]&&(i.fontSize=h["font-size"]);h["font-weight"]&&(i.fontWeight=h["font-weight"]);h["font-style"]&&(i.fontStyle=h["font-style"]);m.node.string&&(m.paper.span.innerHTML=r(m.node.string)[Y](/</g,"&#60;")[Y](/&/g,"&#38;")[Y](/\n/g,"<br>"));m.W=h.w=m.paper.span.offsetWidth;m.H=h.h=m.paper.span.offsetHeight;m.X=h.x;m.Y=h.y+Q(m.H/2);switch(h["text-anchor"]){case"start":m.node.style["v-text-align"]="left";m.bbx=Q(m.W/2);break;case"end":m.node.style["v-text-align"]="right";m.bbx=-Q(m.W/2);break;default:m.node.style["v-text-align"]="center";break}}};bI=function(a,b){a.attrs=a.attrs||{};var c=a.attrs,d,e="linear",f=".5 .5";a.attrs.gradient=b;b=r(b)[Y](bd,function(a,b,c){e="radial";if(b&&c){b=S(b);c=S(c);C(b-0.5,2)+C(c-0.5,2)>0.25&&(c=y.sqrt(0.25-C(b-0.5,2))*((c>0.5)*2-1)+0.5);f=b+q+c}return p});b=b[s](/\s*\-\s*/);if(e=="linear"){var g=b.shift();g=-S(g);if(isNaN(g))return null}var h=bx(b);if(!h)return null;a=a.shape||a.node;d=a.getElementsByTagName(I)[0]||cd(I);!d.parentNode&&a.appendChild(d);if(h[w]){d.on=true;d.method="none";d.color=h[0].color;d.color2=h[h[w]-1].color;var i=[];for(var j=0,k=h[w];j<k;j++)h[j].offset&&i[L](h[j].offset+q+h[j].color);d.colors&&(d.colors.value=i[w]?i[v]():"0% "+d.color);if(e=="radial"){d.type="gradientradial";d.focus="100%";d.focussize=f;d.focusposition=f}else{d.type="gradient";d.angle=(270-g)%360}}return 1};bN=function(b,c,d){var e=0,f=0,g=0,h=1;this[0]=b;this.id=a._oid++;this.node=b;b.raphael=this;this.X=0;this.Y=0;this.attrs={};this.Group=c;this.paper=d;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};!d.bottom&&(d.bottom=this);this.prev=d.top;d.top&&(d.top.next=this);d.top=this;this.next=null};bO=bN[e];bO.rotate=function(a,c,d){if(this.removed)return this;if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][v](q);return this._.rt.deg}a=r(a)[s](b);if(a[w]-1){c=S(a[1]);d=S(a[2])}a=S(a[0]);c!=null?this._.rt.deg=a:this._.rt.deg+=a;d==null&&(c=null);this._.rt.cx=c;this._.rt.cy=d;this.setBox(this.attrs,c,d);this.Group.style.rotation=this._.rt.deg;return this};bO.setBox=function(a,b,c){if(this.removed)return this;var d=this.Group.style,e=this.shape&&this.shape.style||this.node.style;a=a||{};for(var g in a)a[f](g)&&(this.attrs[g]=a[g]);b=b||this._.rt.cx;c=c||this._.rt.cy;var h=this.attrs,i,j,k,l;switch(this.type){case"circle":i=h.cx-h.r;j=h.cy-h.r;k=l=h.r*2;break;case"ellipse":i=h.cx-h.rx;j=h.cy-h.ry;k=h.rx*2;l=h.ry*2;break;case"image":i=+h.x;j=+h.y;k=h.width||0;l=h.height||0;break;case"text":this.textpath.v=["m",Q(h.x),", ",Q(h.y-2),"l",Q(h.x)+1,", ",Q(h.y-2)][v](p);i=h.x-Q(this.W/2);j=h.y-this.H/2;k=this.W;l=this.H;break;case"rect":case"path":if(this.attrs.path){var m=bn(this.attrs.path);i=m.x;j=m.y;k=m.width;l=m.height}else{i=0;j=0;k=this.paper.width;l=this.paper.height}break;default:i=0;j=0;k=this.paper.width;l=this.paper.height;break}b=b==null?i+k/2:b;c=c==null?j+l/2:c;var n=b-this.paper.width/2,o=c-this.paper.height/2,q;d.left!=(q=n+"px")&&(d.left=q);d.top!=(q=o+"px")&&(d.top=q);this.X=ca[f](this.type)?-n:i;this.Y=ca[f](this.type)?-o:j;this.W=k;this.H=l;if(ca[f](this.type)){e.left!=(q=-n*b_+"px")&&(e.left=q);e.top!=(q=-o*b_+"px")&&(e.top=q)}else if(this.type=="text"){e.left!=(q=-n+"px")&&(e.left=q);e.top!=(q=-o+"px")&&(e.top=q)}else{d.width!=(q=this.paper.width+"px")&&(d.width=q);d.height!=(q=this.paper.height+"px")&&(d.height=q);e.left!=(q=i-n+"px")&&(e.left=q);e.top!=(q=j-o+"px")&&(e.top=q);e.width!=(q=k+"px")&&(e.width=q);e.height!=(q=l+"px")&&(e.height=q)}};bO.hide=function(){!this.removed&&(this.Group.style.display="none");return this};bO.show=function(){!this.removed&&(this.Group.style.display="block");return this};bO.getBBox=function(){if(this.removed)return this;if(ca[f](this.type))return bn(this.attrs.path);return{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}};bO.remove=function(){if(this.removed)return;bA(this,this.paper);this.node.parentNode.removeChild(this.node);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);for(var a in this)delete this[a];this.removed=true};bO.attr=function(b,c){if(this.removed)return this;if(b==null){var d={};for(var e in this.attrs)this.attrs[f](e)&&(d[e]=this.attrs[e]);this._.rt.deg&&(d.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(d.scale=this.scale());d.gradient&&d.fill=="none"&&(d.fill=d.gradient)&&delete d.gradient;return d}if(c==null&&a.is(b,"string")){if(b=="translation")return cz.call(this);if(b=="rotation")return this.rotate();if(b=="scale")return this.scale();if(b==I&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[b]}if(this.attrs&&c==null&&a.is(b,G)){var g,h={};for(e=0,g=b[w];e<g;e++)h[b[e]]=this.attr(b[e]);return h}var i;if(c!=null){i={};i[b]=c}c==null&&a.is(b,"object")&&(i=b);if(i){for(var j in this.paper.customAttributes)if(this.paper.customAttributes[f](j)&&i[f](j)&&a.is(this.paper.customAttributes[j],"function")){var k=this.paper.customAttributes[j].apply(this,[][n](i[j]));this.attrs[j]=i[j];for(var l in k)k[f](l)&&(i[l]=k[l])}i.text&&this.type=="text"&&(this.node.string=i.text);bK(this,i);i.gradient&&(({circle:1,ellipse:1})[f](this.type)||r(i.gradient).charAt()!="r")&&bI(this,i.gradient);(!ca[f](this.type)||this._.rt.deg)&&this.setBox(this.attrs)}return this};bO.toFront=function(){!this.removed&&this.Group.parentNode[l](this.Group);this.paper.top!=this&&bB(this,this.paper);return this};bO.toBack=function(){if(this.removed)return this;if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);bC(this,this.paper)}return this};bO.insertAfter=function(a){if(this.removed)return this;a.constructor==cC&&(a=a[a.length-1]);a.Group.nextSibling?a.Group.parentNode.insertBefore(this.Group,a.Group.nextSibling):a.Group.parentNode[l](this.Group);bD(this,a,this.paper);return this};bO.insertBefore=function(a){if(this.removed)return this;a.constructor==cC&&(a=a[0]);a.Group.parentNode.insertBefore(this.Group,a.Group);bE(this,a,this.paper);return this};bO.blur=function(b){var c=this.node.runtimeStyle,d=c.filter;d=d.replace(bY,p);if(+b!==0){this.attrs.blur=b;c.filter=d+q+U+".Blur(pixelradius="+(+b||1.5)+")";c.margin=a.format("-{0}px 0 0 -{0}px",Q(+b||1.5))}else{c.filter=d;c.margin=0;delete this.attrs.blur}};bP=function(a,b,c,d){var e=cd("group"),f=cd("oval"),g=f.style;e.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";e.coordsize=b$;e.coordorigin=a.coordorigin;e[l](f);var h=new bN(f,e,a);h.type="circle";bK(h,{stroke:"#000",fill:"none"});h.attrs.cx=b;h.attrs.cy=c;h.attrs.r=d;h.setBox({x:b-d,y:c-d,width:d*2,height:d*2});a.canvas[l](e);return h};function cc(b,c,d,e,f){return f?a.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z",b+f,c,d-f*2,f,-f,e-f*2,f*2-d,f*2-e):a.format("M{0},{1}l{2},0,0,{3},{4},0z",b,c,d,e,-d)}bQ=function(a,b,c,d,e,f){var g=cc(b,c,d,e,f),h=a.path(g),i=h.attrs;h.X=i.x=b;h.Y=i.y=c;h.W=i.width=d;h.H=i.height=e;i.r=f;i.path=g;h.type="rect";return h};bR=function(a,b,c,d,e){var f=cd("group"),g=cd("oval"),h=g.style;f.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";f.coordsize=b$;f.coordorigin=a.coordorigin;f[l](g);var i=new bN(g,f,a);i.type="ellipse";bK(i,{stroke:"#000"});i.attrs.cx=b;i.attrs.cy=c;i.attrs.rx=d;i.attrs.ry=e;i.setBox({x:b-d,y:c-e,width:d*2,height:e*2});a.canvas[l](f);return i};bS=function(a,b,c,d,e,f){var g=cd("group"),h=cd("image");g.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";g.coordsize=b$;g.coordorigin=a.coordorigin;h.src=b;g[l](h);var i=new bN(h,g,a);i.type="image";i.attrs.src=b;i.attrs.x=c;i.attrs.y=d;i.attrs.w=e;i.attrs.h=f;i.setBox({x:c,y:d,width:e,height:f});a.canvas[l](g);return i};bT=function(b,c,d,e){var f=cd("group"),g=cd("shape"),h=g.style,i=cd("path"),j=i.style,k=cd("textpath");f.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px";f.coordsize=b$;f.coordorigin=b.coordorigin;i.v=a.format("m{0},{1}l{2},{1}",Q(c*10),Q(d*10),Q(c*10)+1);i.textpathok=true;h.width=b.width;h.height=b.height;k.string=r(e);k.on=true;g[l](k);g[l](i);f[l](g);var m=new bN(k,f,b);m.shape=g;m.textpath=i;m.type="text";m.attrs.text=e;m.attrs.x=c;m.attrs.y=d;m.attrs.w=1;m.attrs.h=1;bK(m,{font:W.font,stroke:"none",fill:"#000"});m.setBox();b.canvas[l](f);return m};bU=function(a,b){var c=this.canvas.style;a==+a&&(a+="px");b==+b&&(b+="px");c.width=a;c.height=b;c.clip="rect(0 "+a+" "+b+" 0)";return this};var cd;g.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!g.namespaces.rvml&&g.namespaces.add("rvml","urn:schemas-microsoft-com:vml");cd=function(a){return g.createElement("<rvml:"+a+" class=\"rvml\">")}}catch(a){cd=function(a){return g.createElement("<"+a+" xmlns=\"urn:schemas-microsoft.com:vml\" class=\"rvml\">")}}bV=function(){var b=by[m](0,arguments),c=b.container,d=b.height,e,f=b.width,h=b.x,i=b.y;if(!c)throw new Error("VML container not found.");var k=new j,n=k.canvas=g.createElement("div"),o=n.style;h=h||0;i=i||0;f=f||512;d=d||342;f==+f&&(f+="px");d==+d&&(d+="px");k.width=1000;k.height=1000;k.coordsize=b_*1000+q+b_*1000;k.coordorigin="0 0";k.span=g.createElement("span");k.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";n[l](k.span);o.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",f,d);if(c==1){g.body[l](n);o.left=h+"px";o.top=i+"px";o.position="absolute"}else c.firstChild?c.insertBefore(n,c.firstChild):c[l](n);bz.call(k,k,a.fn);return k};k.clear=function(){this.canvas.innerHTML=p;this.span=g.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas[l](this.span);this.bottom=this.top=null};k.remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=bF(a);return true}}var ce=navigator.userAgent.match(/Version\\x2f(.*?)\s/);navigator.vendor=="Apple Computer, Inc."&&(ce&&ce[1]<4||navigator.platform.slice(0,2)=="iP")?k.safari=function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});h.setTimeout(function(){a.remove()})}:k.safari=function(){};var cf=function(){this.returnValue=false},cg=function(){return this.originalEvent.preventDefault()},ch=function(){this.cancelBubble=true},ci=function(){return this.originalEvent.stopPropagation()},cj=(function(){{if(g.addEventListener)return function(a,b,c,d){var e=o&&u[b]?u[b]:b,g=function(e){if(o&&u[f](b))for(var g=0,h=e.targetTouches&&e.targetTouches.length;g<h;g++){if(e.targetTouches[g].target==a){var i=e;e=e.targetTouches[g];e.originalEvent=i;e.preventDefault=cg;e.stopPropagation=ci;break}}return c.call(d,e)};a.addEventListener(e,g,false);return function(){a.removeEventListener(e,g,false);return true}};if(g.attachEvent)return function(a,b,c,d){var e=function(a){a=a||h.event;a.preventDefault=a.preventDefault||cf;a.stopPropagation=a.stopPropagation||ch;return c.call(d,a)};a.attachEvent("on"+b,e);var f=function(){a.detachEvent("on"+b,e);return true};return f}}})(),ck=[],cl=function(a){var b=a.clientX,c=a.clientY,d=g.documentElement.scrollTop||g.body.scrollTop,e=g.documentElement.scrollLeft||g.body.scrollLeft,f,h=ck.length;while(h--){f=ck[h];if(o){var i=a.touches.length,j;while(i--){j=a.touches[i];if(j.identifier==f.el._drag.id){b=j.clientX;c=j.clientY;(a.originalEvent?a.originalEvent:a).preventDefault();break}}}else a.preventDefault();b+=e;c+=d;f.move&&f.move.call(f.move_scope||f.el,b-f.el._drag.x,c-f.el._drag.y,b,c,a)}},cm=function(b){a.unmousemove(cl).unmouseup(cm);var c=ck.length,d;while(c--){d=ck[c];d.el._drag={};d.end&&d.end.call(d.end_scope||d.start_scope||d.move_scope||d.el,b)}ck=[]};for(var cn=t[w];cn--;)(function(b){a[b]=bN[e][b]=function(c,d){if(a.is(c,"function")){this.events=this.events||[];this.events.push({name:b,f:c,unbind:cj(this.shape||this.node||g,b,c,d||this)})}return this};a["un"+b]=bN[e]["un"+b]=function(a){var c=this.events,d=c[w];while(d--)if(c[d].name==b&&c[d].f==a){c[d].unbind();c.splice(d,1);!c.length&&delete this.events;return this}return this}})(t[cn]);bO.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)};bO.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};bO.drag=function(b,c,d,e,f,h){this._drag={};this.mousedown(function(i){(i.originalEvent||i).preventDefault();var j=g.documentElement.scrollTop||g.body.scrollTop,k=g.documentElement.scrollLeft||g.body.scrollLeft;this._drag.x=i.clientX+k;this._drag.y=i.clientY+j;this._drag.id=i.identifier;c&&c.call(f||e||this,i.clientX+k,i.clientY+j,i);!ck.length&&a.mousemove(cl).mouseup(cm);ck.push({el:this,move:b,end:d,move_scope:e,start_scope:f,end_scope:h})});return this};bO.undrag=function(b,c,d){var e=ck.length;while(e--)ck[e].el==this&&(ck[e].move==b&&ck[e].end==d)&&ck.splice(e++,1);!ck.length&&a.unmousemove(cl).unmouseup(cm)};k.circle=function(a,b,c){return bP(this,a||0,b||0,c||0)};k.rect=function(a,b,c,d,e){return bQ(this,a||0,b||0,c||0,d||0,e||0)};k.ellipse=function(a,b,c,d){return bR(this,a||0,b||0,c||0,d||0)};k.path=function(b){b&&!a.is(b,F)&&!a.is(b[0],G)&&(b+=p);return bH(a.format[m](a,arguments),this)};k.image=function(a,b,c,d,e){return bS(this,a||"about:blank",b||0,c||0,d||0,e||0)};k.text=function(a,b,c){return bT(this,a||0,b||0,r(c))};k.set=function(a){arguments[w]>1&&(a=Array[e].splice.call(arguments,0,arguments[w]));return new cC(a)};k.setSize=bU;k.top=k.bottom=null;k.raphael=a;function co(){return this.x+q+this.y}bO.resetScale=function(){if(this.removed)return this;this._.sx=1;this._.sy=1;this.attrs.scale="1 1"};bO.scale=function(a,b,c,d){if(this.removed)return this;if(a==null&&b==null)return{x:this._.sx,y:this._.sy,toString:co};b=b||a;!(+b)&&(b=a);var e,f,g,h,i=this.attrs;if(a!=0){var j=this.getBBox(),k=j.x+j.width/2,l=j.y+j.height/2,m=B(a/this._.sx),o=B(b/this._.sy);c=+c||c==0?c:k;d=+d||d==0?d:l;var r=this._.sx>0,s=this._.sy>0,t=~(~(a/B(a))),u=~(~(b/B(b))),x=m*t,y=o*u,z=this.node.style,A=c+B(k-c)*x*(k>c==r?1:-1),C=d+B(l-d)*y*(l>d==s?1:-1),D=a*t>b*u?o:m;switch(this.type){case"rect":case"image":var E=i.width*m,F=i.height*o;this.attr({height:F,r:i.r*D,width:E,x:A-E/2,y:C-F/2});break;case"circle":case"ellipse":this.attr({rx:i.rx*m,ry:i.ry*o,r:i.r*D,cx:A,cy:C});break;case"text":this.attr({x:A,y:C});break;case"path":var G=bp(i.path),H=true,I=r?x:m,J=s?y:o;for(var K=0,L=G[w];K<L;K++){var M=G[K],N=V.call(M[0]);{if(N=="M"&&H)continue;H=false}if(N=="A"){M[G[K][w]-2]*=I;M[G[K][w]-1]*=J;M[1]*=m;M[2]*=o;M[5]=+(t+u?!(!(+M[5])):!(+M[5]))}else if(N=="H")for(var O=1,P=M[w];O<P;O++)M[O]*=I;else if(N=="V")for(O=1,P=M[w];O<P;O++)M[O]*=J;else for(O=1,P=M[w];O<P;O++)M[O]*=O%2?I:J}var Q=bn(G);e=A-Q.x-Q.width/2;f=C-Q.y-Q.height/2;G[0][1]+=e;G[0][2]+=f;this.attr({path:G});break}if(this.type in{text:1,image:1}&&(t!=1||u!=1))if(this.transformations){this.transformations[2]="scale("[n](t,",",u,")");this.node[R]("transform",this.transformations[v](q));e=t==-1?-i.x-(E||0):i.x;f=u==-1?-i.y-(F||0):i.y;this.attr({x:e,y:f});i.fx=t-1;i.fy=u-1}else{this.node.filterMatrix=U+".Matrix(M11="[n](t,", M12=0, M21=0, M22=",u,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");z.filter=(this.node.filterMatrix||p)+(this.node.filterOpacity||p)}else if(this.transformations){this.transformations[2]=p;this.node[R]("transform",this.transformations[v](q));i.fx=0;i.fy=0}else{this.node.filterMatrix=p;z.filter=(this.node.filterMatrix||p)+(this.node.filterOpacity||p)}i.scale=[a,b,c,d][v](q);this._.sx=a;this._.sy=b}return this};bO.clone=function(){if(this.removed)return null;var a=this.attr();delete a.scale;delete a.translation;return this.paper[this.type]().attr(a)};var cp={},cq=function(b,c,d,e,f,g,h,i,j){var k=0,l=100,m=[b,c,d,e,f,g,h,i].join(),n=cp[m],o,p;!n&&(cp[m]=n={data:[]});n.timer&&clearTimeout(n.timer);n.timer=setTimeout(function(){delete cp[m]},2000);if(j!=null){var q=cq(b,c,d,e,f,g,h,i);l=~(~q)*10}for(var r=0;r<l+1;r++){if(n.data[j]>r)p=n.data[r*l];else{p=a.findDotsAtSegment(b,c,d,e,f,g,h,i,r/l);n.data[r]=p}r&&(k+=C(C(o.x-p.x,2)+C(o.y-p.y,2),0.5));if(j!=null&&k>=j)return p;o=p}if(j==null)return k},cr=function(b,c){return function(d,e,f){d=bw(d);var g,h,i,j,k="",l={},m,n=0;for(var o=0,p=d.length;o<p;o++){i=d[o];if(i[0]=="M"){g=+i[1];h=+i[2]}else{j=cq(g,h,i[1],i[2],i[3],i[4],i[5],i[6]);if(n+j>e){if(c&&!l.start){m=cq(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);k+=["C",m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k;k=["M",m.x,m.y+"C",m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]][v]();n+=j;g=+i[5];h=+i[6];continue}if(!b&&!c){m=cq(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j;g=+i[5];h=+i[6]}k+=i}l.end=k;m=b?n:c?l:a.findDotsAtSegment(g,h,i[1],i[2],i[3],i[4],i[5],i[6],1);m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},cs=cr(1),ct=cr(),cu=cr(0,1);bO.getTotalLength=function(){if(this.type!="path")return;if(this.node.getTotalLength)return this.node.getTotalLength();return cs(this.attrs.path)};bO.getPointAtLength=function(a){if(this.type!="path")return;return ct(this.attrs.path,a)};bO.getSubpath=function(a,b){if(this.type!="path")return;if(B(this.getTotalLength()-b)<"1e-6")return cu(this.attrs.path,a).end;var c=cu(this.attrs.path,b,1);return a?cu(c,a).end:c};a.easing_formulas={linear:function(a){return a},"<":function(a){return C(a,3)},">":function(a){return C(a-1,3)+1},"<>":function(a){a=a*2;if(a<1)return C(a,3)/2;a-=2;return(C(a,3)+2)/2},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==0||a==1)return a;var b=0.3,c=b/4;return C(2,-10*a)*y.sin((a-c)*(2*D)/b)+1},bounce:function(a){var b=7.5625,c=2.75,d;if(a<1/c)d=b*a*a;else if(a<2/c){a-=1.5/c;d=b*a*a+0.75}else if(a<2.5/c){a-=2.25/c;d=b*a*a+0.9375}else{a-=2.625/c;d=b*a*a+0.984375}return d}};var cv=[],cw=function(){var b=+(new Date);for(var c=0;c<cv[w];c++){var d=cv[c];if(d.stop||d.el.removed)continue;var e=b-d.start,g=d.ms,h=d.easing,i=d.from,j=d.diff,k=d.to,l=d.t,m=d.el,n={},o;if(e<g){var r=h(e/g);for(var s in i)if(i[f](s)){switch(X[s]){case"along":o=r*g*j[s];k.back&&(o=k.len-o);var t=ct(k[s],o);m.translate(j.sx-j.x||0,j.sy-j.y||0);j.x=t.x;j.y=t.y;m.translate(t.x-j.sx,t.y-j.sy);k.rot&&m.rotate(j.r+t.alpha,t.x,t.y);break;case E:o=+i[s]+r*g*j[s];break;case"colour":o="rgb("+[cy(Q(i[s].r+r*g*j[s].r)),cy(Q(i[s].g+r*g*j[s].g)),cy(Q(i[s].b+r*g*j[s].b))][v](",")+")";break;case"path":o=[];for(var u=0,x=i[s][w];u<x;u++){o[u]=[i[s][u][0]];for(var y=1,z=i[s][u][w];y<z;y++)o[u][y]=+i[s][u][y]+r*g*j[s][u][y];o[u]=o[u][v](q)}o=o[v](q);break;case"csv":switch(s){case"translation":var A=r*g*j[s][0]-l.x,B=r*g*j[s][1]-l.y;l.x+=A;l.y+=B;o=A+q+B;break;case"rotation":o=+i[s][0]+r*g*j[s][0];i[s][1]&&(o+=","+i[s][1]+","+i[s][2]);break;case"scale":o=[+i[s][0]+r*g*j[s][0],+i[s][1]+r*g*j[s][1],2 in k[s]?k[s][2]:p,3 in k[s]?k[s][3]:p][v](q);break;case"clip-rect":o=[];u=4;while(u--)o[u]=+i[s][u]+r*g*j[s][u];break}break;default:var C=[].concat(i[s]);o=[];u=m.paper.customAttributes[s].length;while(u--)o[u]=+C[u]+r*g*j[s][u];break}n[s]=o}m.attr(n);m._run&&m._run.call(m)}else{if(k.along){t=ct(k.along,k.len*!k.back);m.translate(j.sx-(j.x||0)+t.x-j.sx,j.sy-(j.y||0)+t.y-j.sy);k.rot&&m.rotate(j.r+t.alpha,t.x,t.y)}(l.x||l.y)&&m.translate(-l.x,-l.y);k.scale&&(k.scale+=p);m.attr(k);cv.splice(c--,1)}}a.svg&&m&&m.paper&&m.paper.safari();cv[w]&&setTimeout(cw)},cx=function(b,c,d,e,f){var g=d-e;c.timeouts.push(setTimeout(function(){a.is(f,"function")&&f.call(c);c.animate(b,g,b.easing)},e))},cy=function(a){return z(A(a,255),0)},cz=function(a,b){if(a==null)return{x:this._.tx,y:this._.ty,toString:co};this._.tx+=+a;this._.ty+=+b;switch(this.type){case"circle":case"ellipse":this.attr({cx:+a+this.attrs.cx,cy:+b+this.attrs.cy});break;case"rect":case"image":case"text":this.attr({x:+a+this.attrs.x,y:+b+this.attrs.y});break;case"path":var c=bp(this.attrs.path);c[0][1]+=+a;c[0][2]+=+b;this.attr({path:c});break}return this};bO.animateWith=function(a,b,c,d,e){for(var f=0,g=cv.length;f<g;f++)cv[f].el.id==a.id&&(b.start=cv[f].start);return this.animate(b,c,d,e)};bO.animateAlong=cA();bO.animateAlongBack=cA(1);function cA(b){return function(c,d,e,f){var g={back:b};a.is(e,"function")?f=e:g.rot=e;c&&c.constructor==bN&&(c=c.attrs.path);c&&(g.along=c);return this.animate(g,d,f)}}function cB(a,b,c,d,e,f){var g=3*b,h=3*(d-b)-g,i=1-g-h,j=3*c,k=3*(e-c)-j,l=1-j-k;function m(a){return((i*a+h)*a+g)*a}function n(a,b){var c=o(a,b);return((l*c+k)*c+j)*c}function o(a,b){var c,d,e,f,j,k;for(e=a,k=0;k<8;k++){f=m(e)-a;if(B(f)<b)return e;j=(3*i*e+2*h)*e+g;if(B(j)<0.000001)break;e=e-f/j}c=0;d=1;e=a;if(e<c)return c;if(e>d)return d;while(c<d){f=m(e);if(B(f-a)<b)return e;a>f?c=e:d=e;e=(d-c)/2+c}return e}return n(a,1/(200*f))}bO.onAnimation=function(a){this._run=a||0;return this};bO.animate=function(c,d,e,g){var h=this;h.timeouts=h.timeouts||[];if(a.is(e,"function")||!e)g=e||null;if(h.removed){g&&g.call(h);return h}var i={},j={},k=false,l={};for(var m in c)if(c[f](m)){if(X[f](m)||h.paper.customAttributes[f](m)){k=true;i[m]=h.attr(m);i[m]==null&&(i[m]=W[m]);j[m]=c[m];switch(X[m]){case"along":var n=cs(c[m]),o=ct(c[m],n*!(!c.back)),p=h.getBBox();l[m]=n/d;l.tx=p.x;l.ty=p.y;l.sx=o.x;l.sy=o.y;j.rot=c.rot;j.back=c.back;j.len=n;c.rot&&(l.r=S(h.rotate())||0);break;case E:l[m]=(j[m]-i[m])/d;break;case"colour":i[m]=a.getRGB(i[m]);var q=a.getRGB(j[m]);l[m]={r:(q.r-i[m].r)/d,g:(q.g-i[m].g)/d,b:(q.b-i[m].b)/d};break;case"path":var t=bw(i[m],j[m]);i[m]=t[0];var u=t[1];l[m]=[];for(var v=0,x=i[m][w];v<x;v++){l[m][v]=[0];for(var y=1,z=i[m][v][w];y<z;y++)l[m][v][y]=(u[v][y]-i[m][v][y])/d}break;case"csv":var A=r(c[m])[s](b),B=r(i[m])[s](b);switch(m){case"translation":i[m]=[0,0];l[m]=[A[0]/d,A[1]/d];break;case"rotation":i[m]=B[1]==A[1]&&B[2]==A[2]?B:[0,A[1],A[2]];l[m]=[(A[0]-i[m][0])/d,0,0];break;case"scale":c[m]=A;i[m]=r(i[m])[s](b);l[m]=[(A[0]-i[m][0])/d,(A[1]-i[m][1])/d,0,0];break;case"clip-rect":i[m]=r(i[m])[s](b);l[m]=[];v=4;while(v--)l[m][v]=(A[v]-i[m][v])/d;break}j[m]=A;break;default:A=[].concat(c[m]);B=[].concat(i[m]);l[m]=[];v=h.paper.customAttributes[m][w];while(v--)l[m][v]=((A[v]||0)-(B[v]||0))/d;break}}}if(k){var G=a.easing_formulas[e];if(!G){G=r(e).match(P);if(G&&G[w]==5){var H=G;G=function(a){return cB(a,+H[1],+H[2],+H[3],+H[4],d)}}else G=function(a){return a}}cv.push({start:c.start||+(new Date),ms:d,easing:G,from:i,diff:l,to:j,el:h,t:{x:0,y:0}});a.is(g,"function")&&(h._ac=setTimeout(function(){g.call(h)},d));cv[w]==1&&setTimeout(cw)}else{var C=[],D;for(var F in c)if(c[f](F)&&Z.test(F)){m={value:c[F]};F=="from"&&(F=0);F=="to"&&(F=100);m.key=T(F,10);C.push(m)}C.sort(be);C[0].key&&C.unshift({key:0,value:h.attrs});for(v=0,x=C[w];v<x;v++)cx(C[v].value,h,d/100*C[v].key,d/100*(C[v-1]&&C[v-1].key||0),C[v-1]&&C[v-1].value.callback);D=C[C[w]-1].value.callback;D&&h.timeouts.push(setTimeout(function(){D.call(h)},d))}return this};bO.stop=function(){for(var a=0;a<cv.length;a++)cv[a].el.id==this.id&&cv.splice(a--,1);for(a=0,ii=this.timeouts&&this.timeouts.length;a<ii;a++)clearTimeout(this.timeouts[a]);this.timeouts=[];clearTimeout(this._ac);delete this._ac;return this};bO.translate=function(a,b){return this.attr({translation:a+" "+b})};bO[H]=function(){return"Raphaël’s object"};a.ae=cv;var cC=function(a){this.items=[];this[w]=0;this.type="set";if(a)for(var b=0,c=a[w];b<c;b++){if(a[b]&&(a[b].constructor==bN||a[b].constructor==cC)){this[this.items[w]]=this.items[this.items[w]]=a[b];this[w]++}}};cC[e][L]=function(){var a,b;for(var c=0,d=arguments[w];c<d;c++){a=arguments[c];if(a&&(a.constructor==bN||a.constructor==cC)){b=this.items[w];this[b]=this.items[b]=a;this[w]++}}return this};cC[e].pop=function(){delete this[this[w]--];return this.items.pop()};for(var cD in bO)bO[f](cD)&&(cC[e][cD]=(function(a){return function(){for(var b=0,c=this.items[w];b<c;b++)this.items[b][a][m](this.items[b],arguments);return this}})(cD));cC[e].attr=function(b,c){if(b&&a.is(b,G)&&a.is(b[0],"object"))for(var d=0,e=b[w];d<e;d++)this.items[d].attr(b[d]);else for(var f=0,g=this.items[w];f<g;f++)this.items[f].attr(b,c);return this};cC[e].animate=function(b,c,d,e){(a.is(d,"function")||!d)&&(e=d||null);var f=this.items[w],g=f,h,i=this,j;e&&(j=function(){!(--f)&&e.call(i)});d=a.is(d,F)?d:j;h=this.items[--g].animate(b,c,d,j);while(g--)this.items[g]&&!this.items[g].removed&&this.items[g].animateWith(h,b,c,d,j);return this};cC[e].insertAfter=function(a){var b=this.items[w];while(b--)this.items[b].insertAfter(a);return this};cC[e].getBBox=function(){var a=[],b=[],c=[],d=[];for(var e=this.items[w];e--;){var f=this.items[e].getBBox();a[L](f.x);b[L](f.y);c[L](f.x+f.width);d[L](f.y+f.height)}a=A[m](0,a);b=A[m](0,b);return{x:a,y:b,width:z[m](0,c)-a,height:z[m](0,d)-b}};cC[e].clone=function(a){a=new cC;for(var b=0,c=this.items[w];b<c;b++)a[L](this.items[b].clone());return a};a.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[f](d)&&(b.face[d]=a.face[d]);this.fonts[c]?this.fonts[c][L](b):this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=T(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[f](e)){var g=a.glyphs[e];b.glyphs[e]={w:g.w,k:{},d:g.d&&"M"+g.d[Y](/[mlcxtrv]/g,function(a){return({l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"})[a]||"M"})+"z"};if(g.k)for(var h in g.k)g[f](h)&&(b.glyphs[e].k[h]=g.k[h])}}return a};k.getFont=function(b,c,d,e){e=e||"normal";d=d||"normal";c=+c||({normal:400,bold:700,lighter:300,bolder:800})[c]||400;if(!a.fonts)return;var g=a.fonts[b];if(!g){var h=new RegExp("(^|\\s)"+b[Y](/[^\w\d\s+!~.:_-]/g,p)+"(\\s|$)","i");for(var i in a.fonts)if(a.fonts[f](i)){if(h.test(i)){g=a.fonts[i];break}}}var j;if(g)for(var k=0,l=g[w];k<l;k++){j=g[k];if(j.face["font-weight"]==c&&(j.face["font-style"]==d||!j.face["font-style"])&&j.face["font-stretch"]==e)break}return j};k.print=function(c,d,e,f,g,h,i){h=h||"middle";i=z(A(i||0,1),-1);var j=this.set(),k=r(e)[s](p),l=0,m=p,n;a.is(f,e)&&(f=this.getFont(f));if(f){n=(g||16)/f.face["units-per-em"];var o=f.face.bbox.split(b),q=+o[0],t=+o[1]+(h=="baseline"?o[3]-o[1]+ +f.face.descent:(o[3]-o[1])/2);for(var u=0,v=k[w];u<v;u++){var x=u&&f.glyphs[k[u-1]]||{},y=f.glyphs[k[u]];l+=u?(x.w||f.w)+(x.k&&x.k[k[u]]||0)+f.w*i:0;y&&y.d&&j[L](this.path(y.d).attr({fill:"#000",stroke:"none",translation:[l,0]}))}j.scale(n,n,q,t).translate(c-q,d-t)}return j};a.format=function(b,c){var e=a.is(c,G)?[0][n](c):arguments;b&&a.is(b,F)&&e[w]-1&&(b=b[Y](d,function(a,b){return e[++b]==null?p:e[b]}));return b||p};a.ninja=function(){i.was?h.Raphael=i.is:delete Raphael;return a};a.el=bO;a.st=cC[e];i.was?h.Raphael=a:Raphael=a})()
\ No newline at end of file
diff --git a/plugins/scheduler/static/js/raphael.js b/plugins/scheduler/static/js/raphael.js
new file mode 120000 (symlink)
index 0000000..02b8f47
--- /dev/null
@@ -0,0 +1 @@
+raphael-1.5.2.js
\ No newline at end of file
diff --git a/plugins/scheduler/static/js/scheduler.js b/plugins/scheduler/static/js/scheduler.js
new file mode 100644 (file)
index 0000000..3c95832
--- /dev/null
@@ -0,0 +1,665 @@
+/**
+ * Description: display a query result in a Google map
+ * Copyright (c) 2012-2013 UPMC Sorbonne Universite - INRIA
+ * License: GPLv3
+ */
+
+/* based on the leases.js code in PLE WWW interface for MyPLC by Thierry Parmentelat -- INRIA */
+
+/* XXX Those declarations should not be part of the js file... */
+
+/* decorations / headers */
+/* note: looks like the 'font' attr is not effective... */
+
+// vertical rules
+var attr_rules={'fill':"#888", 'stroke-dasharray':'- ', 'stroke-width':0.5};
+// set font-size separately in here rather than depend on the height
+var txt_timelabel = {"font": 'Times, "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif', 
+             stroke: "none", fill: "#008", 'font-size': 9};
+var txt_allnodes = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-serif', stroke: "none", fill: "#404"};
+var txt_nodelabel = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-serif', stroke: "none", fill: "#008"};
+
+var attr_timebutton = {'fill':'#bbf', 'stroke': '#338','stroke-width':1, 
+               'stroke-linecap':'round', 'stroke-linejoin':'miter', 'stroke-miterlimit':3};
+var attr_daymarker = {'stroke':'#000','stroke-width':2};
+var attr_half_daymarker = {'stroke':'#444','stroke-width':2};
+
+/* lease dimensions and colors */
+/* refrain from using gradient color, seems to not be animated properly */
+/* lease was originally free and is still free */
+var attr_lease_free_free={'fill':"#def", 'stroke-width':0.5, 'stroke-dasharray':''};
+/* lease was originally free and is now set for our usage */
+var attr_lease_free_mine={'fill':"green", 'stroke-width':1, 'stroke-dasharray':'-..'};
+/* was mine and is still mine */
+var attr_lease_mine_mine={'fill':"#beb", 'stroke-width':0.5, 'stroke-dasharray':''};
+/* was mine and is about to be released */
+var attr_lease_mine_free={'fill':"white", 'stroke-width':1, 'stroke-dasharray':'-..'};
+var attr_lease_other={'fill':"#f88"};
+
+/* other slices name */
+var txt_otherslice = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-serif', stroke: "none", fill: "#444", "font-size": "12px"};
+
+(function($){
+
+    var Scheduler = Plugin.extend({
+
+        init: function(options, element) 
+        {
+            this._super(options, element);
+
+            /* Member variables */
+            this._canvas_id = this.id('leases_area');
+
+            this.query_uuid = options.query_uuid;
+            this.rows = null;
+            // XXX TODEL
+            //this.current_resources = Array();
+            //this.current_leases = Array();
+
+            /* Managing asynchronous reception of resources and leases */
+            this._tmp_resources = Array();
+            this.listLeases    = Array();
+            this._received_resources = false;
+            this._received_leases    = false;
+
+            this.myLeases = Array();
+            this.allLeases = Array();
+
+            this.axisx = Array();
+            this.resources = Array();
+            this.data = Array();
+            this.default_granularity = 1800; /* 30 min */
+            this.initial_timestamp = null;
+
+            /* This should be updated to be the ppcm of all granularities */
+            this.min_granularity = this.default_granularity;
+
+            // the data contains slice names, and lease_id, we need this to find our own leases (mine)
+            this.paper=null;
+
+            /* XXX Events */
+
+            /* XXX Keys */
+
+            /* Listening to queries */
+            this.listen_query(options.query_uuid);
+            this.listen_query(options.query_lease_uuid, 'lease');
+
+            /* XXX GUI setup and event binding */
+            jQuery("#datepicker").datetimepicker({
+                //Timezone wise selection option
+                //timeFormat: 'hh:mm tt z',
+                //showTimezone: true,
+                
+                onSelect: function(value) { 
+                    //console.log(value);
+                    //converting time to timestamp
+                    currentDate= Math.round(Date.parse(value)/ 1000);
+                    // TODO -- DONE
+                    // convert value to timestamp --done
+                    // Get jQuery("#timepicker").val(); - no need anymore
+                    // convert timepicker into seconds - no need
+                    // Add time to date - done
+                    // pass the result to init_axisx - done
+                    //console.log(currentDate);
+                    s.clear();
+                    s.init_axisx(currentDate);
+                    s.draw();
+                    // Do we need to populate the timeslots with existing leases? 
+                    // Look how to populate with initial_leases [we have to show the leases]
+                    
+                } 
+            });
+            //console.log(s.nodelabels[1]);
+            // Do we need to populate the timeslots with existing leases? 
+            // Look how to populate with initial_leases
+            
+            // TODO -- DONE  Note: autocomplete is not search box
+            // Implement a filtering functionality, on the name of the node
+            // http://jqueryui.com/autocomplete/
+            // pass s.nodelabels to autocomplete function
+            //jQuery("#search").autocomplete('s.nodelabel');
+            //console.log(s.nodelabel);
+            
+            /*
+             * TODO
+             * During init, there are no resources
+             * So the list of nodes is empty
+             * The function triggered by the subscription to the resources query
+             * var RESULTS_RESOURCES = '/results/' + options.resource_query_uuid + '/changed';
+             * $.subscribe(RESULTS_RESOURCES, function(e, resources) { s.set_resources(resources);   });
+             * Will have to update the list of nodes available through autocomplete (availableTags)
+             * 
+             * Be inspired by QueryEditor plugin
+             * 
+             * Resources informations in s.axisy ???
+             * 
+             * Filter what has been selected in other plugins:
+             * QueryEditor
+             * QuickFilter
+             * AdvancedFilter
+             * 
+             * Implement an action of filtering while typing
+             * filter what correspond to the user choice
+             * 
+            $(function() {
+                var availableTags = ['omf','nitos','ple', s.nodelabel];
+            $( "#search" ).autocomplete({
+              source: availableTags
+                });
+            });
+             */
+
+            this.init_axisx('');
+            this.draw();
+
+        }, /* init */
+
+        /* Default settings */
+        default_options: {
+            leases_offset:       0,
+            leases_slots:        36,
+            leases_w:            180,
+            leases_granularity:  3600,
+
+            x_nodelabel:         200,   /* space for the nodenames */
+            x_sep:               20,    /* right space after the nodename - removed from the above */
+            y_header:            12,    /* height for the (two) rows of timelabels */
+            y_sep:               10,    /* space between nodes */
+            leases_w:            20,    /* 1-grain leases attributes */
+            y_node:              15,
+            radius:              6,
+            anim_delay:          350,
+            checkboxes:          false,
+            resource_query_uuid: null,  /* resources */
+            lease_query_uuid:    null,  /* leases */
+        },
+
+        /* PLUGIN EVENTS */
+
+        /* GUI EVENTS */
+
+        /* GUI MANIPULATION */
+
+        /* TEMPLATES */
+
+        /*************************** RECORD HANDLER ***************************/
+
+        /* ------------------------------------------------------------------
+         * Resources
+         * ------------------------------------------------------------------ */
+
+        on_new_record: function(record)
+        {
+            if ((typeof record.exclusive != 'undefined') && (record.exclusive)) {
+                this.resources.push(Array(record.urn, record.record_hrn, record.type));
+            }
+            // ... if we do not have information about slivers (first update), update it
+            if (typeof record.sliver != 'undefined') {
+                // XXX
+            }
+        },
+
+        on_query_in_progress: function() {
+            this.spin();
+        },
+
+        on_query_done: function() {
+            /* We have received all leases */
+            if (this._received_resources) {
+                this.draw(this._canvas_id);
+                this.unspin();
+            }
+            this._received_leases = true;
+        },
+        /* ------------------------------------------------------------------
+         * Leases
+         * ------------------------------------------------------------------ */
+        
+        on_lease_new_record: function(record)
+        {
+            this.listLeases.push(record);
+            // this.initial_leases=leases;
+        },
+
+        on_lease_query_done: function(record)
+        {
+            /* We have received all resources */
+            if (this._received_leases) {
+                this.draw(this._canvas_id);
+                this.unspin();
+            }
+            this._received_resources = true;
+        },
+
+        /* INTERNAL FUNCTIONS */
+
+        /**
+         * @brief Return the number of time slots
+         */
+        nb_grains: function () 
+        {
+            return this.axisx.length; 
+        },
+
+        /**
+         * @brief Returns whether there is a pending lease at this timestamp
+         */
+        find_lease: function(urn, timestamp)
+        {
+            var scheduler = this;
+            var result = null;
+
+            $.each(Array(scheduler.myLeases, scheduler.allLeases), function(i, array) {
+                $.each(array, function(i, lease) {
+                    if (lease[0] == urn) {
+                        if ((timestamp >= lease[1]) && (timestamp < (lease[1] + lease[2] * 1800))) {
+                            result = lease;
+                            
+                            return false;
+                        }
+                    }
+                });
+                if (result)
+                    return false;
+            });
+            return result;
+        },
+
+        /**
+         * @brief Draw
+         */
+        draw: function() 
+        { 
+            var canvas_id = this._canvas_id;
+            var o = this.options;
+            var total_width = o.x_nodelabel + this.nb_grains() * this.options.leases_w;
+            var total_height = 2 * o.y_header /* the timelabels */
+                             + 2 * o.y_sep    /* extra space */
+                             + o.y_node          /* all-nodes & timebuttons row */ 
+                             + (this.resources.length)*(o.y_node+o.y_sep);  /* the regular nodes and preceding space */
+
+            /* reuse for paper if exists with same size, or (re-)create otherwise */
+            var paper;
+            if (this.paper == null) {
+                paper = Raphael (canvas_id, total_width+o.x_sep, total_height);
+            } else if (this.paper.width==total_width && this.paper.height==total_height) {
+                paper=this.paper;
+                paper.clear();
+            } else {
+                $("#"+canvas_id)[0].innerHTML="";
+                paper = Raphael (canvas_id, total_width+o.x_sep, total_height);
+            }
+            this.paper=paper;
+
+            /* the path for the triangle-shaped buttons */
+            this.timebutton_path = "M1,0L"+(this.options.leases_w-1)+",0L"+(this.options.leases_w/2)+","+o.y_header+"L1,0";
+
+            var axisx = this.axisx;
+            var axisy = this.resources;
+
+            /* maintain the list of nodelabels for the 'all nodes' button */
+            this.nodelabels=[];
+            
+
+            /* create the time slots legend */
+            var top = 0;
+            var left = o.x_nodelabel;
+
+            var daymarker_height= 2*o.y_header + 2*o.y_sep + (axisy.length+1)*(o.y_node+o.y_sep);
+            var daymarker_path="M0,0L0," + daymarker_height;
+
+            var half_daymarker_off= 2*o.y_header + o.y_sep;
+            var half_daymarker_path="M0," + half_daymarker_off + "L0," + daymarker_height;
+
+            var col=0;
+            for (var i=0, len=axisx.length; i < len; ++i) {
+                /* pick the printable part */
+                var timelabel=axisx[i][1];
+                var y = top + o.y_header;
+                if (col%2 == 0) y += o.y_header;
+                col +=1;
+                /* display time label */
+                var timelabel=paper.text(left,y,timelabel).attr(txt_timelabel).attr({"text-anchor":"middle"});
+                /* draw vertical line */
+                var path_spec="M"+left+" "+(y+o.y_header/2)+"L"+left+" "+this.total_height;
+                var rule=paper.path(path_spec).attr(attr_rules);
+                /* show a day marker when relevant */
+                var timestamp=parseInt(axisx[i][0]);
+                if ( (timestamp%(24*3600))==0) {
+                    paper.path(daymarker_path).attr({'translation':left+','+top}).attr(attr_daymarker);
+                } else if ( (timestamp%(12*3600))==0) {
+                    paper.path(half_daymarker_path).attr({'translation':left+','+top}).attr(attr_daymarker);
+                }
+                left += this.options.leases_w;
+            }
+
+            ////////// the row with the timeslot buttons (the one labeled 'All nodes')
+            this.granularity= this.min_granularity; // XXX axisx[1][0]-axisx[0][0];
+
+            // move two lines down
+            top += 2*o.y_header + 2*o.y_sep;
+            left=o.x_nodelabel;
+            // all nodes buttons
+            var allnodes = paper.text (o.x_nodelabel-o.x_sep,top+o.y_node/2,"All nodes").attr(txt_allnodes)
+                .attr ({"font-size":o.y_node, "text-anchor":"end","baseline":"bottom"});
+            allnodes.scheduler=this;
+            allnodes.click(this.allnodes_methods.click);
+            
+            // timeslot buttons [it's the triangles above the slots]
+            for (var i=0, len=axisx.length; i < len; ++i) {
+                var timebutton=paper.path(this.timebutton_path).attr({'translation':left+','+top}).attr(attr_timebutton);
+                timebutton.from_time=axisx[i][0];
+                timebutton.scheduler=this;
+                timebutton.click(this.timebutton_methods.click);
+                left+=(this.options.leases_w);
+            }
+            
+            //////// the body of the scheduler : loop on nodes
+            top += o.y_node + o.y_sep;
+            var data_index=0;
+            this.leases=[];
+            for (var i=0, len=axisy.length; i<len; ++i) {
+                var urn=axisy[i][0];
+                var nodename=axisy[i][1];
+                var type=axisy[i][2];
+                left=0;            
+                /*
+                 *  MODIFIED font-size
+                var nodelabel = paper.text(o.x_nodelabel-x_sep,top+y_node/2,nodename).attr(txt_nodelabel)
+                .attr ({"font-size":y_node, "text-anchor":"end","baseline":"bottom"});
+                */
+                var nodelabel = paper.text(o.x_nodelabel-o.x_sep,top+o.y_node/3,nodename).attr(txt_nodelabel)
+                .attr ({"font-size":"12px", "text-anchor":"end","baseline":"bottom"});    
+                //console.log(nodelabel);
+                this.nodelabel_methods.selected(nodelabel,1);
+                //nodelabel_methods.selected( this, ! this.selected );
+                nodelabel.click(this.nodelabel_methods.click); //click action works here
+                //timebutton.click(timebutton_methods.click);
+                
+               // lease_methods.init_free(nodelabel.click, lease_methods.click_mine);
+               //lease_methods.init_free(nodelabel.lease);
+                this.nodelabels.push(nodelabel);
+                
+                left += o.x_nodelabel;
+                var grain=0;
+                // data index contains the full array of leases
+                // not the same amount of grains per node
+
+                // NOTE: remembering the previous lease might help for long leases.
+                while (grain < this.nb_grains()) {
+
+                    if (l = this.find_lease(urn, this.initial_timestamp + grain * 1800)) {
+                        slicename = l.slice_id;
+                    } else {
+                        slicename = "";
+                    }
+
+                    //lease_id  = this.data[data_index][0];
+                    //slicename = this.data[data_index][1];
+                    /* Duration should not be the lease duration, but the grain */
+                    var duration = 1; // this.data[data_index][2];
+
+                    var lease=paper.rect (left,top,this.options.leases_w*duration,o.y_node,o.radius);
+                    // record scheduler in lease - early as we need this in init_other
+                    lease.scheduler=this;
+                    //lease.lease_id=lease_id;
+                    lease.nodename=nodename;
+                    lease.urn=urn;
+                    lease.nodelabel=nodelabel;
+                    if (slicename == "") {
+                        lease.initial="free";
+                        lease_methods.init_free(lease);
+                    } else if (slicename == this.options.slicename) {
+                        lease.initial="mine";
+                        lease_methods.init_mine(lease);
+                    } else {
+                        lease.initial="other";
+                        lease_methods.init_other(lease,slicename);
+                    }
+                    lease.from_time = axisx[grain%this.nb_grains()][0];
+                    grain += duration;
+                    lease.until_time = axisx[grain%this.nb_grains()][0];
+                    // and vice versa
+                    this.leases.push(lease);
+                    // move on with the loop
+                    left += this.options.leases_w*duration;
+                    data_index +=1;
+                }
+                top += o.y_node + o.y_sep;
+            };
+        }, /* draw */
+
+        init_axisx: function(currentDate) 
+        {
+            this.axisx = Array();
+    
+            if(currentDate=="") {
+                // creating timestamp of the current time
+                currentDate = new Date().getTime() / 1000;
+            }
+            this.initial_timestamp = currentDate;
+            //console.log(currentDate);
+    
+            // round it by granularity (becomes an Int)
+            var rounded = Math.round(currentDate/this.min_granularity)*this.min_granularity;
+            // Convert Int to Date
+            rounded = new Date(rounded*1000);
+            // get hours and minutes in a 24h format 00:00
+            var roundedHours=(rounded.getHours()<10?'0':'') + rounded.getHours();
+            var roundedMinutes=(rounded.getMinutes()<10?'0':'') + rounded.getMinutes();
+    
+            //timeFrame.push(rounded);
+            this.axisx.push(Array(rounded, roundedHours+":"+roundedMinutes));
+    
+            // Generate as man slots as we need
+            for(i=0; i<this.options.leases_slots;i++) {
+                rounded = this.min_granularity+(rounded.getTime()/1000);
+                rounded = new Date(rounded*1000);
+                roundedHours=(rounded.getHours()<10?'0':'') + rounded.getHours();
+                roundedMinutes=(rounded.getMinutes()<10?'0':'') + rounded.getMinutes();
+    
+                //timeFrame.push(rounded);
+                this.axisx.push(Array(rounded, roundedHours+":"+roundedMinutes));
+            }
+        },
+
+        clear: function ()
+        {
+            for (var i=0, len=this.leases.length; i<len; ++i) {
+                var lease=this.leases[i];
+                if (lease.current != lease.initial) {
+                if (lease.initial == 'free') lease_methods.init_free(lease,lease_methods.click_mine);
+                else                             lease_methods.init_mine(lease,lease_methods.click_free);
+                }
+            }
+        },
+
+        // XXX Couldn't find how to inhererit from the raphael objects...
+
+        /* ---------------------------------------------------------------------
+         * The 'all nodes' button
+         */
+        allnodes_methods: {
+            click: function (event) {
+                var scheduler=this.scheduler;
+                /* decide what to do */
+                var unselected=0;
+                for (var i=0, len=scheduler.nodelabels.length; i<len; ++i) 
+                    if (! scheduler.nodelabels[i].selected) unselected++;
+                /* if at least one is not selected : select all */
+                var new_state = (unselected >0) ? 1 : 0;
+                for (var i=0, len=scheduler.nodelabels.length; i<len; ++i) 
+                    this.nodelabel_methods.selected(scheduler.nodelabels[i],new_state);
+            }
+        },
+
+        /* ---------------------------------------------------------------------
+         * The buttons for managing the whole timeslot
+         */
+        timebutton_methods: {
+
+            /* clicking */
+            click: function (event) {
+                var scheduler = this.scheduler;
+                var from_time = this.from_time;
+                var until_time = from_time + scheduler.granularity;
+                /* scan leases on selected nodes, store in two arrays */
+                var relevant_free=[], relevant_mine=[];
+                for (var i=0,len=scheduler.leases.length; i<len; ++i) {
+                    var scan=scheduler.leases[i];
+                    if ( ! scan.nodelabel.selected) continue;
+                    // overlap ?
+                    if (scan.from_time<=from_time && scan.until_time>=until_time) {
+                    if (scan.current == "free")       relevant_free.push(scan);
+                    else if (scan.current == "mine")  relevant_mine.push(scan);
+                    }
+                }
+                // window.console.log("Found " + relevant_free.length + " free and " + relevant_mine.length + " mine");
+                /* decide what to do, whether book or release */
+                if (relevant_mine.length==0 && relevant_free.length==0) {
+                    alert ("Nothing to do in this timeslot on the selected nodes");
+                    return;
+                }
+                // if at least one is free, let's book
+                if (relevant_free.length > 0) {
+                    for (var i=0, len=relevant_free.length; i<len; ++i) {
+                        var lease=relevant_free[i];
+                        lease_methods.init_mine(lease,lease_methods.click_free);
+                    }
+                // otherwise we unselect
+                } else {
+                    for (var i=0, len=relevant_mine.length; i<len; ++i) {
+                        var lease=relevant_mine[i];
+                        lease_methods.init_free(lease,lease_methods.click_mine);
+                    }
+                }
+            } /* click */
+        }, 
+
+        /* ---------------------------------------------------------------------
+         * The nodelabel buttons
+         */
+        nodelabel_methods: {
+            
+            // set selected mode and render visually
+            selected: function (nodelabel, flag) {
+                nodelabel.selected=flag;
+                nodelabel.attr({'font-weight': (flag ? 'bold' : 'normal')});
+                // TODO
+                // 
+                // loop on axis x and select each timebutton
+                // for (var i=0, len=axisx.length; i < len; ++i)
+                // figure out how to use timebutton_methods.click();
+                    
+            },
+
+            // toggle selected
+            click: function (event) {
+                nodelabel_methods.selected( this, ! this.selected );
+            }
+        },
+
+
+        /* ---------------------------------------------------------------------
+         * The lease buttons
+         */
+        lease_methods: {
+        
+            init_free: function (lease, unclick) {
+                var o = lease.scheduler.options;
+                lease.current="free";
+                // set color
+                lease.animate((lease.initial=="free") ? attr_lease_free_free : attr_lease_mine_free, o.anim_delay);
+                // keep track of the current status
+                // record action
+                lease.click (lease_methods.click_free);
+                if (unclick) lease.unclick(unclick);
+            },
+                     
+            // find out all the currently free leases that overlap this one
+            click_free: function (event) {
+                var scheduler = this.scheduler;
+                lease_methods.init_mine(this,lease_methods.click_free);        
+                //publish
+                //this.from_time
+                //this.urn
+                //this.until_time
+                var urn = this.urn
+                var start_time=new Date(this.from_time).getTime() / 1000;        
+                var end_time=new Date(this.until_time).getTime() / 1000;
+                var duration=(end_time-start_time)/1800; // XXX HARDCODED LEASE GRAIN
+
+                /* Add a new lease : XXX should be replaced by a dictionary */
+                // Do we have a lease with the same urn  just before or just after ?
+                var removeIdBefore = null;
+                var removeIdAfter = null;
+                jQuery.each(scheduler.listLeases, function(i, lease) {
+                    if (lease[0] == urn) {
+                        if (lease[1] + lease[2] * 1800 == start_time) { // XXX HARDCODED LEASE GRAIN
+                            // Merge with previous lease
+                            removeIdBefore = i;
+                            start_time = lease[1];
+                            duration += lease[2];
+                        }
+                        if (lease[1] == end_time) {
+                            // Merge with following lease
+                            removeIdAfter = i;
+                            duration += lease[2];
+                        }
+                    }
+                });
+                if (removeIdBefore != null) {
+                    scheduler.listLeases.splice(removeIdBefore , 1);
+                    if (removeIdAfter != null)
+                        removeIdAfter -= 1;
+                }
+                if (removeIdAfter != null) {
+                    scheduler.listLeases.splice(removeIdAfter , 1);
+                }
+
+                scheduler.listLeases.push([this.urn, start_time, duration]);
+
+                console.log(scheduler.listLeases);
+                //jQuery.publish('/update-set/' + scheduler.options.query_uuid, [scheduler.listLeases]);
+                jQuery.publish('/update-set/' + scheduler.options.lease_query_uuid, [scheduler.listLeases]);
+            },
+
+            init_mine: function (lease, unclick) {
+                var o = lease.scheduler.options;
+                lease.current="mine";
+                lease.animate((lease.initial=="mine") ? attr_lease_mine_mine : attr_lease_free_mine,o.anim_delay);
+                lease.click (lease_methods.click_mine);
+                if (unclick) lease.unclick(unclick);
+            },
+            
+            /* TODO: remove selected lease from array listLeases and publish change */
+            click_mine: function (event) {
+                var scheduler = this.scheduler;
+                // this lease was originally free but is now marked for booking
+                // we free just this lease
+                //console.log('this is mine');
+                lease_methods.init_free(this, lease_methods.click_mine);
+            },
+
+
+            init_other: function (lease, slicename) {
+                lease.animate (attr_lease_other,anim_delay);
+                /* a text obj to display the name of the slice that owns that lease */
+                var otherslicelabel = lease.scheduler.paper.text (lease.attr("x")+lease.attr("width")/2,
+                                          // xxx
+                                          lease.attr("y")+lease.attr("height")/2,slicename).attr(txt_otherslice);
+                /* hide it right away */
+                otherslicelabel.hide();
+                /* record it */
+                lease.label=otherslicelabel;
+                lease.hover ( function (e) {this.label.toFront();this.label.show();},
+                          function (e) {this.label.hide();} ); 
+            }
+        }
+
+    });
+
+    $.plugin('Scheduler', Scheduler);
+
+})(jQuery);
diff --git a/plugins/scheduler/template/scheduler.html b/plugins/scheduler/template/scheduler.html
new file mode 100644 (file)
index 0000000..b7b00c8
--- /dev/null
@@ -0,0 +1,49 @@
+<div id="{{domid}}__scheduler" class='plugin scrollx scrolly'>
+<!--
+<p>
+  You have attached one or more reservable nodes to your slice.  Reservable nodes
+  show up with the '' mark. Your slivers will be available only during timeslots
+  where you have obtained leases. You can manage your leases in the tab
+  below.
+</p>
+
+<p>
+  <font color='red'>
+    This is a dummy scheduler for demonstration purposes only, adapted from the
+    MyPLC one. Do not expect it to be working.
+  </font>
+</p>
+-->
+
+<!--
+<div class='center' id='leases_settings'>
+  <label id='leases_offset_label' class='leases_label'>start, in hours from now</label>
+  <input type='text' class='leases_input' id='leases_offset_input' value='$leases_offset' />
+  <label id='leases_slots_label' class='leases_label'># of timeslots</label>
+  <input type='text' class='leases_input' id='leases_slots_input' value='$leases_slots' />
+  <label id='leases_w_label' class='leases_label'>slot width, in pixels</label>
+  <input type='text' class='leases_input' id='leases_w_input' value='$leases_w' />
+</div>
+-->
+
+  <p>Date: <input type='text' id='datepicker' value='2013-01-01' /></p>
+    
+  <p>Search: <input type='text' id='search' name='search' /></p>
+  <!-- <div id='date_refresh'>Submit</div> -->
+    
+  <!-- Leases_data is the name used by Scheduler.js to locate this place first
+       population will be triggered by init_scheduler from Scheduler.js -->
+  <table id='leases_data' class='hidden'></table>
+
+<!-- The general layout for the scheduler -->
+  <div id='{{domid}}__leases_area'></div>
+<!--
+<div id='leases_area'></div>
+
+<div id='leases_buttons'>
+    <button id='leases_refresh' type='submit'>Refresh (Pull)</button>
+    <button id='leases_submit' type='submit'>Submit (Push)</button>
+</div>
+-->
+
+</div>
index 35ab810..006aa87 100644 (file)
@@ -15,6 +15,7 @@ from plugins.querytable              import QueryTable
 from plugins.queryupdater            import QueryUpdater
 from plugins.googlemap               import GoogleMap
 from plugins.senslabmap              import SensLabMap
+from plugins.scheduler               import Scheduler
 from plugins.querycode               import QueryCode
 from plugins.query_editor            import QueryEditor
 from plugins.active_filters          import ActiveFilters
@@ -59,7 +60,7 @@ class SliceView (LoginRequiredAutoLogoutView):
                 'slice_hrn',
                 'resource.hrn', 'resource.hostname', 'resource.type', 
                 'resource.network_hrn',
-                #'lease.urn',
+                'lease.urn',
                 'user.user_hrn',
                 #'application.measurement_point.counter'
         )
@@ -187,6 +188,14 @@ class SliceView (LoginRequiredAutoLogoutView):
                 },
             )
 
+        resources_as_scheduler = Scheduler(
+            page        = page,
+            title       = 'Scheduler',
+            domid       = 'scheduler',
+            query       = sq_resource,
+            query_lease = sq_lease,
+        )
+
        # with the new 'Filter' stuff on top, no need for anything but the querytable
         resources_as_list_area = resources_as_list 
 
@@ -195,8 +204,10 @@ class SliceView (LoginRequiredAutoLogoutView):
                                 togglable=True,
                                 title="Resources",
                                 outline_complete=True,
-                                sons=[ resources_as_gmap, 
-                                       resources_as_3dmap,
+                                sons=[ 
+                                       resources_as_scheduler,
+                                       #resources_as_gmap, 
+                                       #resources_as_3dmap,
                                        resources_as_list_area, ],
                                 active_domid = 'resources-map',
                                 )
diff --git a/third-party/timepicker-addon b/third-party/timepicker-addon
new file mode 120000 (symlink)
index 0000000..c09963d
--- /dev/null
@@ -0,0 +1 @@
+timepicker-addon-1.2
\ No newline at end of file
diff --git a/third-party/timepicker-addon-1.2/README.md b/third-party/timepicker-addon-1.2/README.md
new file mode 100644 (file)
index 0000000..62907c4
--- /dev/null
@@ -0,0 +1,20 @@
+jQuery Timepicker Addon
+=======================
+
+About
+-----
+- Author: [Trent Richardson](http://trentrichardson.com)
+- Documentation: [http://trentrichardson.com/examples/timepicker/](http://trentrichardson.com/examples/timepicker/)
+- Twitter: [@practicalweb](http://twitter.com/practicalweb)
+
+Use
+---
+- To use this plugin you must include jQuery and jQuery UI with datepicker and slider
+- Include timepicker-addon script
+- now use timepicker with $('#selector').datetimepicker() or $('#selector').timepicker()
+
+Contributing Code - Please Read!
+--------------------------------
+- All code contributions and bug reports are much appreciated.
+- Please be sure to apply your fixes to the "dev" branch.
+- Also note tabs are appreciated over spaces.
\ No newline at end of file
diff --git a/third-party/timepicker-addon-1.2/component.json b/third-party/timepicker-addon-1.2/component.json
new file mode 100644 (file)
index 0000000..7e1fc6a
--- /dev/null
@@ -0,0 +1,11 @@
+{
+       "name": "jquery-timepicker-addon",
+       "version": "1.2",
+       "repository": {
+               "type": "git",
+               "url": "git://github.com/trentrichardson/jQuery-Timepicker-Addon.git"
+       },
+       "dependencies": {
+               "jquery-ui": "~1.9.2"
+       }
+}
\ No newline at end of file
diff --git a/third-party/timepicker-addon-1.2/index.html b/third-party/timepicker-addon-1.2/index.html
new file mode 100644 (file)
index 0000000..2993db8
--- /dev/null
@@ -0,0 +1,936 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> 
+       <head> 
+               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+               <title>Adding a Timepicker to jQuery UI Datepicker</title> 
+               <meta name="Description" content="jQuery Timepicker Addon.  Add a timepicker to your jQuery UI Datepicker.  With options to show only time, format time, and much more." />
+               <meta name="Keywords" content="jQuery, UI, datepicker, timepicker, datetime, time, format" />
+               
+               <style type="text/css"> 
+                       body,img,p,h1,h2,h3,h4,h5,h6,form,table,td,ul,ol,li,dl,dt,dd,pre,blockquote,fieldset,label{
+                               margin:0;
+                               padding:0;
+                               border:0;
+                       }
+                       body{ background-color: #777; border-top: solid 10px #7b94b2; font: 90% Arial, Helvetica, sans-serif; padding: 20px; }
+                       h1,h2,h3{ margin: 10px 0; }
+                       h1{}
+                       h2{ color: #f66; }
+                       h3{ color: #6b84a2; }
+                       p{ margin: 10px 0; }
+                       a{ color: #7b94b2; }
+                       ul,ol{ margin: 10px 0 10px 40px; }
+                       li{ margin: 4px 0; }
+                       dl.defs{ margin: 10px 0 10px 40px; }
+                       dl.defs dt{ font-weight: bold; line-height: 20px; margin: 10px 0 0 0; }
+                       dl.defs dd{ margin: -20px 0 10px 160px; padding-bottom: 10px; border-bottom: solid 1px #eee;}
+                       pre{ font-size: 12px; line-height: 16px; padding: 5px 5px 5px 10px; margin: 10px 0; background-color: #e4f4d4; border-left: solid 5px #9EC45F; overflow: auto; }
+
+                       .wrapper{ background-color: #ffffff; width: 800px; border: solid 1px #eeeeee; padding: 20px; margin: 0 auto; }
+                       #tabs{ margin: 20px -20px; border: none; }
+                       #tabs, #ui-datepicker-div, .ui-datepicker{ font-size: 85%; }
+                       .clear{ clear: both; }
+                       
+                       .example-container{ background-color: #f4f4f4; border-bottom: solid 2px #777777; margin: 0 0 20px 40px; padding: 20px; }
+                       .example-container input{ border: solid 1px #aaa; padding: 4px; width: 175px; }
+               </style> 
+               
+               <link rel="stylesheet" media="all" type="text/css" href="http://code.jquery.com/ui/1.10.0/themes/smoothness/jquery-ui.css" />
+               <link rel="stylesheet" media="all" type="text/css" href="jquery-ui-timepicker-addon.css" />
+               
+               <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
+               <script type="text/javascript" src="http://code.jquery.com/ui/1.10.0/jquery-ui.min.js"></script>
+               <script type="text/javascript" src="jquery-ui-timepicker-addon.js"></script>
+               <script type="text/javascript" src="jquery-ui-sliderAccess.js"></script>
+               <script type="text/javascript">
+                       
+                       $(function(){
+                               $('#tabs').tabs();
+               
+                               $('.example-container > pre').each(function(i){
+                                       eval($(this).text());
+                               });
+                       });
+                       
+               </script>
+       </head> 
+       <body> 
+               <div class="wrapper">
+                       <h1>Adding a Timepicker to jQuery UI Datepicker</h1> 
+                       
+                       <p>The timepicker addon adds a timepicker to jQuery UI Datepicker, thus the datepicker and slider components (jQueryUI) are required for using any of these.  In addition all datepicker options are still available through the timepicker addon.</p>
+                       
+                       <p>If you are interested in contributing to Timepicker Addon please <a href="http://github.com/trentrichardson/jQuery-Timepicker-Addon" title="Check out Timepicker on GitHub">check it out on GitHub</a>.  If you do make additions please keep in mind I enjoy tabs over spaces,.. But contributions are welcome in any form.</p>
+                       
+                       <p><a href="http://trentrichardson.com" title="Back to Blog">Back to Blog</a> or <a href="http://twitter.com/practicalweb" title="Follow Me on Twitter">Follow on Twitter</a></p>
+               
+                       <a href="http://carbounce.com" title="Car Bounce" style="float: right;display: inline-block;width:380px;padding: 10px;background-color: #fbfbfb;border: dotted 4px #e8e8e8;color: #9EC45F;font-size: 16px;text-decoration:none;letter-spacing:1px;"><img src="http://carbounce.com/img/logo_small.png" alt="Car Bounce" align="left" style="margin-right: 20px;"/>Try my new app to keep you informed of your car's financing status and value.</a>     
+
+                       <h2>Donation</h2>
+                       <p>Has this Timepicker Addon been helpful to you?</p>
+                       <div class="donation">
+                               <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
+                               <input type="hidden" name="cmd" value="_s-xclick">
+                               <input type="hidden" name="hosted_button_id" value="C2QQHR7JQGD28">
+                               <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
+                               <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
+                               </form>
+                       </div>
+
+                       <div id="tabs">
+                               <ul>
+                                       <li><a href="#tp-getting-started" title="Getting Started">Getting Started</a></li>
+                                       <li><a href="#tp-options" title="Options">Options</a></li>
+                                       <li><a href="#tp-formatting" title="Examples">Formatting</a></li>
+                                       <li><a href="#tp-localization" title="Examples">Localization</a></li>
+                                       <li><a href="#tp-examples" title="Examples">Examples</a></li>
+                               </ul>
+
+                               <!-- ############################################################################# -->
+                               <!-- Getting Started
+                               <!-- ############################################################################# -->
+                               <div id="tp-getting-started">
+                                       <h2>Getting Started</h2>
+                                       
+                                       <h3>Highly Recommended</h3>
+                                       <p><a href="http://trentrichardson.com" title="Subscribe to TrentRichardson.com via email">Subscribe to my blog via email</a> and follow <a href="http://twitter.com/practicalweb" title="Follow Me on Twitter">@PracticalWeb</a> on Twitter.  I post for nearly every new version, so you know about updates.</p>
+
+                                       <h3>Download</h3>
+                                       <p><a href="jquery-ui-timepicker-addon.js" title="Download Timepicker Addon">Download Timepicker Addon</a></p>
+                                       <p><a href="http://github.com/trentrichardson/jQuery-Timepicker-Addon" title="Check out Timepicker on GitHub">Download/Contribute on GitHub</a> (Need the entire repo? Find a bug? See if its fixed here)</p>
+                                       <p>There is a small bit of required CSS (<a href="jquery-ui-timepicker-addon.css" title="Download CSS">Download</a>):</p>
+<pre>/* css for timepicker */
+.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
+.ui-timepicker-div dl { text-align: left; }
+.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
+.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
+.ui-timepicker-div td { font-size: 90%; }
+.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
+
+.ui-timepicker-rtl{ direction: rtl; }
+.ui-timepicker-rtl dl { text-align: right; }
+.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }
+</pre>
+                                       
+                                       <h3>Requirements</h3>
+                                       <p>You also need to include jQuery and jQuery UI with datepicker and slider wigits. You should include them in your page in the following order:</p>
+                                       <ol>
+                                               <li>jQuery</li>
+                                               <li>jQueryUI (with datepicker and slider wigits)</li>
+                                               <li>Timepicker</li>
+                                       </ol>
+
+                                       
+                                       <h3>Version</h3>
+                                       <p>Version 1.2</p>
+
+                                       <p>Last updated on 02/02/2013</p>
+                                       <p>jQuery Timepicker Addon is currently available for use in all personal or commercial projects under both MIT and GPL licenses. This means that you can choose the license that best suits your project, and use it accordingly. </p>
+                                       <p><a href="http://trentrichardson.com/Impromptu/GPL-LICENSE.txt" title="GPL License">GPL License</a></p>
+                                       <p><a href="http://trentrichardson.com/Impromptu/MIT-LICENSE.txt" title="MIT License">MIT License</a></p>
+
+                               </div>
+
+                               <!-- ############################################################################# -->
+                               <!-- Options
+                               <!-- ############################################################################# -->
+                               <div id="tp-options">
+                                       <h2>Options</h2>
+
+                                       <p>The timepicker does inherit all options from datepicker.  However, there are many options that are shared by them both, and many timepicker only options:</p>
+
+                                       <h3>Localization Options</h3>
+                                       <dl class="defs">
+                                               <dt>currentText</dt>
+                                                       <dd><em>Default: "Now", A Localization Setting</em> - Text for the Now button.</dd>
+
+                                               <dt>closeText</dt>
+                                                       <dd><em>Default: "Done", A Localization Setting</em> - Text for the Close button.</dd>
+
+                                               <dt>amNames</dt>
+                                                       <dd><em>Default: ['AM', 'A'], A Localization Setting</em> - Array of strings to try and parse against to determine AM.</dd>
+
+                                               <dt>pmNames</dt>
+                                                       <dd><em>Default: ['PM', 'P'], A Localization Setting</em> - Array of strings to try and parse against to determine PM.</dd>
+
+                                               <dt>timeFormat</dt>
+                                                       <dd><em>Default: "HH:mm", A Localization Setting</em> - String of format tokens to be replaced with the time. <a href="#tp-formatting" title="Formatting" onclick="$('#tabs').tabs('select',2);">See Formatting</a>.</dd>
+
+                                               <dt>timeSuffix</dt>
+                                                       <dd><em>Default: "", A Localization Setting</em> - String to place after the formatted time.</dd>
+
+                                               <dt>timeOnlyTitle</dt>
+                                                       <dd><em>Default: "Choose Time", A Localization Setting</em> - Title of the wigit when using only timepicker.</dd>
+
+                                               <dt>timeText</dt>
+                                                       <dd><em>Default: "Time", A Localization Setting</em> - Label used within timepicker for the formatted time.</dd>
+
+                                               <dt>hourText</dt>
+                                                       <dd><em>Default: "Hour", A Localization Setting</em> - Label used to identify the hour slider.</dd>
+
+                                               <dt>minuteText</dt>
+                                                       <dd><em>Default: "Minute", A Localization Setting</em> - Label used to identify the minute slider.</dd>
+
+                                               <dt>secondText</dt>
+                                                       <dd><em>Default: "Second", A Localization Setting</em> - Label used to identify the second slider.</dd>
+
+                                               <dt>millisecText</dt>
+                                                       <dd><em>Default: "Millisecond", A Localization Setting</em> - Label used to identify the millisecond slider.</dd>
+
+                                               <dt>timezoneText</dt>
+                                                       <dd><em>Default: "Timezone", A Localization Setting</em> - Label used to identify the timezone slider.</dd>
+
+                                               <dt>isRTL</dt>
+                                                       <dd><em>Default: false, A Localization Setting</em> - Right to Left support.</dd>
+                                       </dl>
+
+                                       <h3>Alt Field Options</h3>
+                                       <dl class="defs">
+
+                                               <dt>altFieldTimeOnly</dt>
+                                                       <dd><em>Default: true</em> - When altField is used from datepicker altField will only receive the formatted time and the original field only receives date.</dd>
+
+                                               <dt>altSeparator</dt>
+                                                       <dd><em>Default: (separator option)</em> - String placed between formatted date and formatted time in the altField.</dd>
+
+                                               <dt>altTimeSuffix</dt>
+                                                       <dd><em>Default: (timeSuffix option)</em> - String always placed after the formatted time in the altField.</dd>
+
+                                               <dt>altTimeFormat</dt>
+                                                       <dd><em>Default: (timeFormat option)</em> - The time format to use with the altField.</dd>
+                                       </dl>
+
+                                       <h3>Timezone Options</h3>
+                                       <dl class="defs">
+
+                                               <dt>useLocalTimezone</dt>
+                                                       <dd><em>Default: false</em> - Whether to default timezone to the browser's set timezone.</dd>
+
+                                               <dt>defaultTimezone</dt>
+                                                       <dd><em>Default: "+0000"</em> - If not set, the default timezone used.</dd>
+
+                                               <dt>timezoneIso8601</dt>
+                                                       <dd><em>Default: false</em> - Whether to follow the ISO 8601 standard.</dd>
+
+                                               <dt>timezoneList</dt>
+                                                       <dd><em>Default: [generated timezones]</em> - An array of timezones used to populate the timezone select. Can be an array of values or an array of objects: { label: "EST", value: "+0400" }</dd>
+                                       </dl>
+
+                                       <h3>Time Field Options</h3>
+                                       <dl class="defs">
+
+                                               <dt>controlType</dt>
+                                                       <dd><em>Default: 'slider'</em> - Whether to use 'slider' or 'select'. If 'slider' is unavailable through jQueryUI, 'select' will be used. For advanced usage you may pass an object which implements "create", "options", "value" methods to use controls other than sliders or selects.  See the _controls property in the source code for more details.
+<pre>{
+       create: function(tp_inst, obj, unit, val, min, max, step){      
+               // generate whatever controls you want here, just return obj
+       },
+       options: function(tp_inst, obj, unit, opts, val){
+               // if val==undefined return the value, else return obj
+       },
+       value: function(tp_inst, obj, unit, val){
+               // if val==undefined return the value, else return obj
+       }
+}</pre>
+                                                       </dd>
+
+                                               <dt>showHour</dt>
+                                                       <dd><em>Default: true</em> - Whether to show the hour slider.</dd>
+
+                                               <dt>showMinute</dt>
+                                                       <dd><em>Default: true</em> - Whether to show the minute slider.</dd>
+
+                                               <dt>showSecond</dt>
+                                                       <dd><em>Default: false</em> - Whether to show the second slider.</dd>
+
+                                               <dt>showMillisec</dt>
+                                                       <dd><em>Default: false</em> - Whether to show the millisecond slider.</dd>
+
+                                               <dt>showTimezone</dt>
+                                                       <dd><em>Default: false</em> - Whether to show the timezone select.</dd>
+
+                                               <dt>showTime</dt>
+                                                       <dd><em>Default: true</em> - Whether to show the time selected within the datetimepicker.</dd>
+
+                                               <dt>stepHour</dt>
+                                                       <dd><em>Default: 1</em> - Hours per step the slider makes.</dd>
+
+                                               <dt>stepMinute</dt>
+                                                       <dd><em>Default: 1</em> - Minutes per step the slider makes.</dd>
+
+                                               <dt>stepSecond</dt>
+                                                       <dd><em>Default: 1</em> - Seconds per step the slider makes.</dd>
+
+                                               <dt>stepMilliSec</dt>
+                                                       <dd><em>Default: 1</em> - Milliseconds per step the slider makes.</dd>
+
+                                               <dt>hour</dt>
+                                                       <dd><em>Default: 0</em> - Initial hour set.</dd>
+
+                                               <dt>minute</dt>
+                                                       <dd><em>Default: 0</em> - Initial minute set.</dd>
+
+                                               <dt>second</dt>
+                                                       <dd><em>Default: 0</em> - Initial second set.</dd>
+
+                                               <dt>millisec</dt>
+                                                       <dd><em>Default: 0</em> - Initial millisecond set.</dd>
+
+                                               <dt>timezone</dt>
+                                                       <dd><em>Default: 0</em> - Initial timezone set.</dd>
+
+                                               <dt>hourMin</dt>
+                                                       <dd><em>Default: 0</em> - The minimum hour allowed for all dates.</dd>
+
+                                               <dt>minuteMin</dt>
+                                                       <dd><em>Default: 0</em> - The minimum minute allowed for all dates.</dd>
+
+                                               <dt>secondMin</dt>
+                                                       <dd><em>Default: 0</em> - The minimum second allowed for all dates.</dd>
+
+                                               <dt>millisecMin</dt>
+                                                       <dd><em>Default: 0</em> - The minimum millisecond allowed for all dates.</dd>
+
+                                               <dt>hourMax</dt>
+                                                       <dd><em>Default: 23</em> - The maximum hour allowed for all dates.</dd>
+
+                                               <dt>minuteMax</dt>
+                                                       <dd><em>Default: 59</em> - The maximum minute allowed for all dates.</dd>
+
+                                               <dt>secondMax</dt>
+                                                       <dd><em>Default: 59</em> - The maximum second allowed for all dates.</dd>
+
+                                               <dt>millisecMax</dt>
+                                                       <dd><em>Default: 999</em> - The maximum millisecond allowed for all dates.</dd>
+
+                                               <dt>hourGrid</dt>
+                                                       <dd><em>Default: 0</em> - When greater than 0 a label grid will be generated under the slider.  This number represents the units (in hours) between labels.</dd>
+
+                                               <dt>minuteGrid</dt>
+                                                       <dd><em>Default: 0</em> - When greater than 0 a label grid will be generated under the slider.  This number represents the units (in minutes) between labels.</dd>
+
+                                               <dt>secondGrid</dt>
+                                                       <dd><em>Default: 0</em> - When greater than 0 a label grid will be genereated under the slider.  This number represents the units (in seconds) between labels.</dd>
+
+                                               <dt>millisecGrid</dt>
+                                                       <dd><em>Default: 0</em> - When greater than 0 a label grid will be genereated under the slider.  This number represents the units (in milliseconds) between labels.</dd>
+                                       </dl>
+
+                                       <h3>Other Options</h3>
+                                       <dl class="defs">
+                                               <dt>showButtonPanel</dt>
+                                                       <dd><em>Default: true</em> - Whether to show the button panel at the bottom.  This is generally needed.</dd>
+
+                                               <dt>timeOnly</dt>
+                                                       <dd><em>Default: false</em> - Hide the datepicker and only provide a time interface.</dd>
+
+                                               <dt>onSelect</dt>
+                                                       <dd><em>Default: null</em> - Function to be called when a date is chosen or time has changed (parameters: datetimeText, datepickerInstance).</dd>
+
+                                               <dt>alwaysSetTime</dt>
+                                                       <dd><em>Default: true</em> - Always have a time set internally, even before user has chosen one.</dd>
+
+                                               <dt>separator</dt>
+                                                       <dd><em>Default: " "</em> - When formatting the time this string is placed between the formatted date and formatted time.</dd>
+
+                                               <dt>pickerTimeFormat</dt>
+                                                       <dd><em>Default: (timeFormat option)</em> - How to format the time displayed within the timepicker.</dd>
+                                               
+                                               <dt>pickerTimeSuffix</dt>
+                                                       <dd><em>Default: (timeSuffix option)</em> - String to place after the formatted time within the timepicker.</dd>
+
+                                               <dt>showTimepicker</dt>
+                                                       <dd><em>Default: true</em> - Whether to show the timepicker within the datepicker.</dd>
+
+                                               <dt>addSliderAccess</dt>
+                                                       <dd><em>Default: false</em> - Adds the <a href="http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/" title="jQueryUI Slider Access Plugin">sliderAccess plugin</a> to sliders within timepicker</dd>
+
+                                               <dt>sliderAccessArgs</dt>
+                                                       <dd><em>Default: null</em> - Object to pass to sliderAccess when used.</dd>
+
+                                               <dt>defaultValue</dt>
+                                                       <dd><em>Default: null</em> - String of the default time value placed in the input on focus when the input is empty.</dd>
+
+                                               <dt>minDateTime</dt>
+                                                       <dd><em>Default: null</em> - Date object of the minimum datetime allowed.  Also available as minDate.</dd>
+
+                                               <dt>maxDateTime</dt>
+                                                       <dd><em>Default: null</em> - Date object of the maximum datetime allowed. Also Available as maxDate.</dd>
+
+                                               <dt>parse</dt>
+                                                       <dd><em>Default: 'strict'</em> - How to parse the time string.  Two methods are provided: 'strict' which must match the timeFormat exactly, and 'loose' which uses javascript's new Date(timeString) to guess the time.  You may also pass in a function(timeFormat, timeString, options) to handle the parsing yourself, returning a simple object: 
+<pre>{
+       hour: 19,
+       minute: 10,
+       second: 23,
+       millisec: 45,
+       timezone: '-0400'
+}</pre>
+                                                       </dd>
+                                       </dl>
+
+                               </div>
+
+
+                               <!-- ############################################################################# -->
+                               <!-- Formatting
+                               <!-- ############################################################################# -->
+                               <div id="tp-formatting">
+
+                                       <h2>Formatting Your Time</h2>
+
+                                       <p>The default format is "HH:mm".  To use 12 hour time use something similar to: "hh:mm tt".  When both "t" and lower case "h" are present in the timeFormat, 12 hour time will be used.</p>
+
+                                       <dl class="defs">
+                                               <dt>H</dt><dd>Hour with no leading 0 (24 hour)</dd>
+                                               <dt>HH</dt><dd>Hour with leading 0 (24 hour)</dd>
+                                               <dt>h</dt><dd>Hour with no leading 0 (12 hour)</dd>
+                                               <dt>hh</dt><dd>Hour with leading 0 (12 hour)</dd>
+                                               <dt>m</dt><dd>Minute with no leading 0</dd>
+                                               <dt>mm</dt><dd>Minute with leading 0</dd>
+                                               <dt>s</dt><dd>Second with no leading 0</dd>
+                                               <dt>ss</dt><dd>Second with leading 0</dd>
+                                               <dt>l</dt><dd>Milliseconds always with leading 0</dd>
+                                               <dt>t</dt><dd>a or p for AM/PM</dd>
+                                               <dt>T</dt><dd>A or P for AM/PM</dd>
+                                               <dt>tt</dt><dd>am or pm for AM/PM</dd>
+                                               <dt>TT</dt><dd>AM or PM for AM/PM</dd>
+                                               <dt>z</dt><dd>Timezone as defined by timezoneList</dd>
+                                               <dt>'...'</dt><dd>Literal text (Uses single quotes)</dd>
+                                       </dl>
+
+                                       <p>Formats are used in the following ways:</p>
+                                       <ul>
+                                               <li>timeFormat option</li>
+                                               <li>altTimeFormat option</li>
+                                               <li>pickerTimeFormat option</li>
+                                               <li>$.datepicker.formatTime(format, timeObj, options) utility method</li>
+                                               <li>$.datepicker.parseTime(format, timeStr, options) utility method</li>
+                                       </ul>
+
+                                       <p>For help with  formatting the date portion, visit the datepicker documentation for <a href="http://docs.jquery.com/UI/Datepicker/formatDate" title="jQuery UI Datepicker Formatting">formatting dates</a>.</p>
+                               </div>
+
+                               <!-- ############################################################################# -->
+                               <!-- Localization
+                               <!-- ############################################################################# -->
+                               <div id="tp-localization">
+
+                                       <h2>Working with Localizations</h2>
+                                       
+                                       <p>Timepicker comes with many translations and localizations, thanks to all the contributors.  They can be found in the localization folder in the git repo.</p>
+
+                                       <p>The quick and cheap way to use localizations is to pass in options to a timepicker instance:</p>
+                       
+<pre>$('#example123').timepicker({
+       timeOnlyTitle: 'Выберите время',
+       timeText: 'Время',
+       hourText: 'Часы',
+       minuteText: 'Минуты',
+       secondText: 'Секунды',
+       currentText: 'Теперь',
+       closeText: 'Закрыть'
+});
+</pre>
+                                       <p>However, if you plan to use timepicker extensively you will need to include (build your own) localization.  It is simply assigning those same variables to an object.  As you see in the example below we maintain a separate object for timepicker.  This way we aren't bound to any changes within datepicker.</p>
+               
+<pre>$.datepicker.regional['ru'] = {
+       closeText: 'Закрыть',
+       prevText: '&#x3c;Пред',
+       nextText: 'След&#x3e;',
+       currentText: 'Сегодня',
+       monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
+       'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
+       monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
+       'Июл','Авг','Сен','Окт','Ноя','Дек'],
+       dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
+       dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
+       dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
+       weekHeader: 'Не',
+       dateFormat: 'dd.mm.yy',
+       firstDay: 1,
+       isRTL: false,
+       showMonthAfterYear: false,
+       yearSuffix: ''
+};
+$.datepicker.setDefaults($.datepicker.regional['ru']);
+
+
+$.timepicker.regional['ru'] = {
+       timeOnlyTitle: 'Выберите время',
+       timeText: 'Время',
+       hourText: 'Часы',
+       minuteText: 'Минуты',
+       secondText: 'Секунды',
+       millisecText: 'Миллисекунды',
+       timezoneText: 'Часовой пояс',
+       currentText: 'Сейчас',
+       closeText: 'Закрыть',
+       timeFormat: 'HH:mm',
+       amNames: ['AM', 'A'],
+       pmNames: ['PM', 'P'],
+       isRTL: false
+};
+$.timepicker.setDefaults($.timepicker.regional['ru']);
+</pre>
+                                       <p>Now all you have to do is call timepicker and the Russian localization is used.  Generally you only need to include the localization file, it will setDefaults() for you.</p>
+                                       <p>You can also visit <a href="http://docs.jquery.com/UI/Datepicker/Localization" title="localization for datepicker" target="_BLANK">localization for datepicker</a> for more information about datepicker localizations.</p>
+                               </div>
+
+                               <!-- ############################################################################# -->
+                               <!-- Examples
+                               <!-- ############################################################################# -->
+                               <div id="tp-examples">
+                                       <h2>Examples</h2>
+
+                                       <ul>
+                                               <li><a href="#basic_examples" title="Basic Initializations">Basic Initializations</a></li>
+                                               <li><a href="#timezone_examples" title="Using Timezones">Using Timezones</a></li>
+                                               <li><a href="#slider_examples" title="Slider Modifications">Slider Modifications</a></li>
+                                               <li><a href="#alt_examples" title="Alternate Field">Alternate Fields</a></li>
+                                               <li><a href="#rest_examples" title="Time Restraints">Time Restraints</a></li>
+                                               <li><a href="#utility_examples" title="Utilities">Utilities</a></li>
+                                       </ul>
+
+                                       <h3 id="basic_examples">Basic Initializations</h3>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Add a simple datetimepicker to jQuery UI's datepicker</p>
+                                               <div>
+                                                       <input type="text" name="basic_example_1" id="basic_example_1" value="" />
+                                               </div>                                  
+<pre>
+$('#basic_example_1').datetimepicker();
+</pre>
+                                       </div>
+
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Add only a timepicker:</p>
+                                               <div>
+                                                       <input type="text" name="basic_example_2" id="basic_example_2" value="" />
+                                               </div>                                  
+<pre>
+$('#basic_example_2').timepicker();
+</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Format the time:</p>
+                                               <div>
+                                                       <input type="text" name="basic_example_3" id="basic_example_3" value="" />
+                                               </div>                                  
+<pre>
+$('#basic_example_3').datetimepicker({
+       timeFormat: "hh:mm tt"
+});
+</pre>
+                                       </div>
+
+                                       <h3 id="timezone_examples">Using Timezones</h3>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Simplest timezone usage:</p>
+                                               <div>
+                                                       <input type="text" name="timezone_example_1" id="timezone_example_1" value="" />
+                                               </div>                                  
+<pre>
+$('#timezone_example_1').datetimepicker({
+       timeFormat: 'hh:mm tt z',
+       showTimezone: true
+});
+</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Define your own timezone options:</p>
+                                               <div>
+                                                       <input type="text" name="timezone_example_2" id="timezone_example_2" value="" />
+                                               </div>                                  
+<pre>
+$('#timezone_example_2').datetimepicker({
+       timeFormat: 'HH:mm z',
+       showTimezone: true,
+       timezoneList: [ 
+                       { value: '-0500', label: 'Eastern'}, 
+                       { value: '-0600', label: 'Central' }, 
+                       { value: '-0700', label: 'Mountain' }, 
+                       { value: '-0800', label: 'Pacific' } 
+               ]
+});
+</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Use timezone string abbreviations for values:</p>
+                                               <div>
+                                                       <input type="text" name="timezone_example_3" id="timezone_example_3" value="" />
+                                               </div>                                  
+<pre>
+$('#timezone_example_3').datetimepicker({
+       timeFormat: 'HH:mm z',
+       showTimezone: true,
+       timezone: 'MT',
+       timezoneList: [ 
+                       { value: 'ET', label: 'Eastern'}, 
+                       { value: 'CT', label: 'Central' }, 
+                       { value: 'MT', label: 'Mountain' }, 
+                       { value: 'PT', label: 'Pacific' } 
+               ]
+});
+
+</pre>
+                                       </div>
+
+                                       <h3 id="slider_examples">Slider Modifications</h3>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Add a grid to each slider:</p>
+                                               <div>
+                                                       <input type="text" name="slider_example_1" id="slider_example_1" value="" />
+                                               </div>                                  
+<pre>
+$('#slider_example_1').timepicker({
+       hourGrid: 4,
+       minuteGrid: 10,
+       timeFormat: 'hh:mm tt'
+});
+</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Set the interval step of sliders:</p>
+                                               <div>
+                                                       <input type="text" name="slider_example_2" id="slider_example_2" value="" />
+                                               </div>                                  
+<pre>
+$('#slider_example_2').datetimepicker({
+       showSecond: true,
+       timeFormat: 'HH:mm:ss',
+       stepHour: 2,
+       stepMinute: 10,
+       stepSecond: 10
+});
+</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Add sliderAccess plugin for touch devices:</p>
+                                               <div>
+                                                       <input type="text" name="slider_example_3" id="slider_example_3" value="" />
+                                               </div>                                  
+<pre>
+$('#slider_example_3').datetimepicker({
+       addSliderAccess: true,
+       sliderAccessArgs: { touchonly: false }
+});</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Use dropdowns instead of sliders.  By default if slider is not available dropdowns will be used.</p>
+                                               <div>
+                                                       <input type="text" name="slider_example_4" id="slider_example_4" value="" />
+                                               </div>                                  
+<pre>
+$('#slider_example_4').datetimepicker({
+       controlType: 'select',
+       timeFormat: 'hh:mm tt'
+});</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Create your own control by implementing the create, options, and value methods. If you want to use your new control for all instances use the $.timepicker.setDefaults({controlType:myControl}). Here we implement jQueryUI's spinner control (jQueryUI 1.9+).</p>
+                                               <div>
+                                                       <input type="text" name="slider_example_5" id="slider_example_5" value="" />
+                                               </div>                                  
+<pre>var myControl=  {
+       create: function(tp_inst, obj, unit, val, min, max, step){
+               $('&lt;input class="ui-timepicker-input" value="'+val+'" style="width:50%"&gt;')
+                       .appendTo(obj)
+                       .spinner({
+                               min: min,
+                               max: max,
+                               step: step,
+                               change: function(e,ui){ // key events
+                                               // don't call if api was used and not key press
+                                               if(e.originalEvent !== undefined)
+                                                       tp_inst._onTimeChange();
+                                               tp_inst._onSelectHandler();
+                                       },
+                               spin: function(e,ui){ // spin events
+                                               tp_inst.control.value(tp_inst, obj, unit, ui.value);
+                                               tp_inst._onTimeChange();
+                                               tp_inst._onSelectHandler();
+                                       }
+                       });
+               return obj;
+       },
+       options: function(tp_inst, obj, unit, opts, val){
+               if(typeof(opts) == 'string' && val !== undefined)
+                               return obj.find('.ui-timepicker-input').spinner(opts, val);
+               return obj.find('.ui-timepicker-input').spinner(opts);
+       },
+       value: function(tp_inst, obj, unit, val){
+               if(val !== undefined)
+                       return obj.find('.ui-timepicker-input').spinner('value', val);
+               return obj.find('.ui-timepicker-input').spinner('value');
+       }
+};
+
+$('#slider_example_5').datetimepicker({
+       controlType: myControl
+});</pre>
+                                       </div>
+
+                                       <h3 id="alt_examples">Alternate Fields</h3>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Alt field in the simplest form:</p>
+                                               <div>
+                                                       <input type="text" name="alt_example_1" id="alt_example_1" value="09/15/2012" />
+                                                       <input type="text" name="alt_example_1_alt" id="alt_example_1_alt" value="10:15" />
+                                               </div>                                  
+<pre>
+$('#alt_example_1').datetimepicker({
+       altField: "#alt_example_1_alt"
+});
+</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>With datetime in both:</p>
+                                               <div>
+                                                       <input type="text" name="alt_example_2" id="alt_example_2" value="" />
+                                                       <input type="text" name="alt_example_2_alt" id="alt_example_2_alt" value="" />
+                                               </div>                                  
+<pre>
+$('#alt_example_2').datetimepicker({
+       altField: "#alt_example_2_alt",
+       altFieldTimeOnly: false
+});
+</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Format the altField differently:</p>
+                                               <div>
+                                                       <input type="text" name="alt_example_3" id="alt_example_3" value="" />
+                                                       <input type="text" name="alt_example_3_alt" id="alt_example_3_alt" value="" />
+                                               </div>                                  
+<pre>
+$('#alt_example_3').datetimepicker({
+       altField: "#alt_example_3_alt",
+       altFieldTimeOnly: false,
+       altFormat: "yy-mm-dd",
+       altTimeFormat: "h:m t",
+       altSeparator: " @ "
+});
+</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>With inline mode using altField:</p>
+                                               <div>
+                                                       <input type="text" name="alt_example_4_alt" id="alt_example_4_alt" value="" />
+                                                       <span id="alt_example_4" ></span>
+                                               </div>                                  
+<pre>
+$('#alt_example_4').datetimepicker({
+       altField: "#alt_example_4_alt",
+       altFieldTimeOnly: false
+});
+</pre>
+                                       </div>
+
+                                       <h3 id="rest_examples">Time Restraints</h3>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Set the min/max hour of every date:</p>
+                                               <div>
+                                                       <input type="text" name="rest_example_1" id="rest_example_1" value="" />
+                                               </div>                                  
+<pre>
+$('#rest_example_1').timepicker({
+       hourMin: 8,
+       hourMax: 16
+});
+</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Set the min/max date numerically:</p>
+                                               <div>
+                                                       <input type="text" name="rest_example_2" id="rest_example_2" value="" />
+                                               </div>                                  
+<pre>
+$('#rest_example_2').datetimepicker({
+       numberOfMonths: 2,
+       minDate: 0,
+       maxDate: 30
+});
+</pre>
+                                       </div>                                  
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Set the min/max date and time with a Date object:</p>
+                                               <div>
+                                                       <input type="text" name="rest_example_3" id="rest_example_3" value="" />
+                                               </div>                                  
+<pre>
+$('#rest_example_3').datetimepicker({
+       minDate: new Date(2010, 11, 20, 8, 30),
+       maxDate: new Date(2010, 11, 31, 17, 30)
+});
+</pre>
+                                       </div>                                                                  
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Restrict a start and end date (also shows using onSelect and onClose events):</p>
+                                               <div>
+                                                       <input type="text" name="rest_example_4_start" id="rest_example_4_start" value="" /> 
+                                                       <input type="text" name="rest_example_4_end" id="rest_example_4_end" value="" />
+                                               </div>                                  
+<pre>
+var startDateTextBox = $('#rest_example_4_start');
+var endDateTextBox = $('#rest_example_4_end');
+
+startDateTextBox.datetimepicker({ 
+       onClose: function(dateText, inst) {
+               if (endDateTextBox.val() != '') {
+                       var testStartDate = startDateTextBox.datetimepicker('getDate');
+                       var testEndDate = endDateTextBox.datetimepicker('getDate');
+                       if (testStartDate > testEndDate)
+                               endDateTextBox.datetimepicker('setDate', testStartDate);
+               }
+               else {
+                       endDateTextBox.val(dateText);
+               }
+       },
+       onSelect: function (selectedDateTime){
+               endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
+       }
+});
+endDateTextBox.datetimepicker({ 
+       onClose: function(dateText, inst) {
+               if (startDateTextBox.val() != '') {
+                       var testStartDate = startDateTextBox.datetimepicker('getDate');
+                       var testEndDate = endDateTextBox.datetimepicker('getDate');
+                       if (testStartDate > testEndDate)
+                               startDateTextBox.datetimepicker('setDate', testEndDate);
+               }
+               else {
+                       startDateTextBox.val(dateText);
+               }
+       },
+       onSelect: function (selectedDateTime){
+               startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate') );
+       }
+});
+</pre>
+                                       </div>
+
+                                       
+                                       <h3 id="utility_examples">Utilities</h3>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Get and Set Datetime:</p>
+                                               <div>
+                                                       <input type="text" name="utility_example_1" id="utility_example_1" value="" /> 
+                                                       <button id="utility_example_1_setdt" value="1">Set Datetime</button> 
+                                                       <button id="utility_example_1_getdt" value="1">Get Datetime</button> 
+                                               </div>
+                                       
+<pre>
+var ex13 = $('#utility_example_1');
+
+ex13.datetimepicker({
+       dateFormat: "D MM d, yy",
+       separator: ' @ '
+});
+
+$('#utility_example_1_setdt').click(function(){
+       ex13.datetimepicker('setDate', (new Date()) );
+});
+
+$('#utility_example_1_getdt').click(function(){
+       alert(ex13.datetimepicker('getDate'));
+});
+</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Use the utility function to format your own time. $.datepicker.formatTime(format, time, options)</p>
+                                               <dl class="defs">
+                                                       <dt>format</dt><dd>required - string represenation of the time format to use</dd>
+                                                       <dt>time</dt><dd>required - hash: { hour, minute, second, millisecond, timezone }</dd>
+                                                       <dt>options</dt><dd>optional - hash of any options in regional translation (ampm, amNames, pmNames..)</dd>
+                                               </dl>
+                                               <p>Returns a time string in the specified format.</p>
+                                               <div>
+                                                       <div id="utility_example_2"></div>
+                                               </div>
+                                       
+<pre>
+$('#utility_example_2').text(
+       $.datepicker.formatTime('HH:mm z', { hour: 14, minute: 36, timezone: '+2000' }, {})
+);
+</pre>
+                                       </div>
+
+                                       <!-- ============= example -->
+                                       <div class="example-container">
+                                               <p>Use the utility function to parses a formatted time. $.datepicker.parseTime(format, timeString, options)</p>
+                                               <dl class="defs">
+                                                       <dt>format</dt><dd>required - string represenation of the time format to use</dd>
+                                                       <dt>time</dt><dd>required - time string matching the format given in parameter 1</dd>
+                                                       <dt>options</dt><dd>optional - hash of any options in regional translation (ampm, amNames, pmNames..)</dd>
+                                               </dl>
+                                               <p>Returns an object with hours, minutes, seconds, milliseconds, timezone.</p>
+                                               <div>
+                                                       <div id="utility_example_3"></div>
+                                               </div>
+                                       
+<pre>
+$('#utility_example_3').text(JSON.stringify( 
+       $.datepicker.parseTime('HH:mm:ss:l z', "14:36:21:765 +2000", {}) 
+));
+</pre>
+                                       </div>
+
+                               </div>
+                       </div>
+
+                               
+               </div>
+               <script type="text/javascript"> /*
+               var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+               document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+               */</script> 
+               <script type="text/javascript"> /*
+               try {
+               var pageTracker = _gat._getTracker("UA-7602218-1");
+               pageTracker._trackPageview();
+               } catch(err) {}*/</script>
+       </body> 
+</html>
diff --git a/third-party/timepicker-addon-1.2/jquery-ui-sliderAccess.js b/third-party/timepicker-addon-1.2/jquery-ui-sliderAccess.js
new file mode 100644 (file)
index 0000000..a54cf4a
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * jQuery UI Slider Access
+ * By: Trent Richardson [http://trentrichardson.com]
+ * Version 0.3
+ * Last Modified: 10/20/2012
+ * 
+ * Copyright 2011 Trent Richardson
+ * Dual licensed under the MIT and GPL licenses.
+ * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
+ * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
+ * 
+ */
+ (function($){
+
+       $.fn.extend({
+               sliderAccess: function(options){
+                       options = options || {};
+                       options.touchonly = options.touchonly !== undefined? options.touchonly : true; // by default only show it if touch device
+
+                       if(options.touchonly === true && !("ontouchend" in document))
+                               return $(this);
+                               
+                       return $(this).each(function(i,obj){
+                                               var $t = $(this),
+                                                       o = $.extend({},{ 
+                                                                                       where: 'after',
+                                                                                       step: $t.slider('option','step'), 
+                                                                                       upIcon: 'ui-icon-plus', 
+                                                                                       downIcon: 'ui-icon-minus',
+                                                                                       text: false,
+                                                                                       upText: '+',
+                                                                                       downText: '-',
+                                                                                       buttonset: true,
+                                                                                       buttonsetTag: 'span',
+                                                                                       isRTL: false
+                                                                               }, options),
+                                                       $buttons = $('<'+ o.buttonsetTag +' class="ui-slider-access">'+
+                                                                                       '<button data-icon="'+ o.downIcon +'" data-step="'+ (o.isRTL? o.step : o.step*-1) +'">'+ o.downText +'</button>'+
+                                                                                       '<button data-icon="'+ o.upIcon +'" data-step="'+ (o.isRTL? o.step*-1 : o.step) +'">'+ o.upText +'</button>'+
+                                                                               '</'+ o.buttonsetTag +'>');
+
+                                               $buttons.children('button').each(function(j, jobj){
+                                                       var $jt = $(this);
+                                                       $jt.button({ 
+                                                                                       text: o.text, 
+                                                                                       icons: { primary: $jt.data('icon') }
+                                                                               })
+                                                               .click(function(e){
+                                                                                       var step = $jt.data('step'),
+                                                                                               curr = $t.slider('value'),
+                                                                                               newval = curr += step*1,
+                                                                                               minval = $t.slider('option','min'),
+                                                                                               maxval = $t.slider('option','max'),
+                                                                                               slidee = $t.slider("option", "slide") || function(){},
+                                                                                               stope = $t.slider("option", "stop") || function(){};
+
+                                                                                       e.preventDefault();
+                                                                                       
+                                                                                       if(newval < minval || newval > maxval)
+                                                                                               return;
+                                                                                       
+                                                                                       $t.slider('value', newval);
+
+                                                                                       slidee.call($t, null, { value: newval });
+                                                                                       stope.call($t, null, { value: newval });
+                                                                               });
+                                               });
+                                               
+                                               // before or after                                      
+                                               $t[o.where]($buttons);
+
+                                               if(o.buttonset){
+                                                       $buttons.removeClass('ui-corner-right').removeClass('ui-corner-left').buttonset();
+                                                       $buttons.eq(0).addClass('ui-corner-left');
+                                                       $buttons.eq(1).addClass('ui-corner-right');
+                                               }
+
+                                               // adjust the width so we don't break the original layout
+                                               var bOuterWidth = $buttons.css({
+                                                                       marginLeft: ((o.where == 'after' && !o.isRTL) || (o.where == 'before' && o.isRTL)? 10:0), 
+                                                                       marginRight: ((o.where == 'before' && !o.isRTL) || (o.where == 'after' && o.isRTL)? 10:0)
+                                                               }).outerWidth(true) + 5;
+                                               var tOuterWidth = $t.outerWidth(true);
+                                               $t.css('display','inline-block').width(tOuterWidth-bOuterWidth);
+                                       });             
+               }
+       });
+
+})(jQuery);
\ No newline at end of file
diff --git a/third-party/timepicker-addon-1.2/jquery-ui-timepicker-addon.css b/third-party/timepicker-addon-1.2/jquery-ui-timepicker-addon.css
new file mode 100644 (file)
index 0000000..058a608
--- /dev/null
@@ -0,0 +1,11 @@
+.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
+.ui-timepicker-div dl { text-align: left; }
+.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
+.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
+.ui-timepicker-div td { font-size: 90%; }
+.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
+
+.ui-timepicker-rtl{ direction: rtl; }
+.ui-timepicker-rtl dl { text-align: right; }
+.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }
+
diff --git a/third-party/timepicker-addon-1.2/jquery-ui-timepicker-addon.js b/third-party/timepicker-addon-1.2/jquery-ui-timepicker-addon.js
new file mode 100644 (file)
index 0000000..f9b5faa
--- /dev/null
@@ -0,0 +1,1919 @@
+/*
+ * jQuery timepicker addon
+ * By: Trent Richardson [http://trentrichardson.com]
+ * Version 1.2
+ * Last Modified: 02/02/2013
+ *
+ * Copyright 2013 Trent Richardson
+ * You may use this project under MIT or GPL licenses.
+ * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
+ * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
+ */
+
+/*jslint evil: true, white: false, undef: false, nomen: false */
+
+(function($) {
+
+       /*
+       * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
+       */
+       $.ui.timepicker = $.ui.timepicker || {};
+       if ($.ui.timepicker.version) {
+               return;
+       }
+
+       /*
+       * Extend jQueryUI, get it started with our version number
+       */
+       $.extend($.ui, {
+               timepicker: {
+                       version: "1.2"
+               }
+       });
+
+       /* 
+       * Timepicker manager.
+       * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
+       * Settings for (groups of) time pickers are maintained in an instance object,
+       * allowing multiple different settings on the same page.
+       */
+       var Timepicker = function() {
+               this.regional = []; // Available regional settings, indexed by language code
+               this.regional[''] = { // Default regional settings
+                       currentText: 'Now',
+                       closeText: 'Done',
+                       amNames: ['AM', 'A'],
+                       pmNames: ['PM', 'P'],
+                       timeFormat: 'HH:mm',
+                       timeSuffix: '',
+                       timeOnlyTitle: 'Choose Time',
+                       timeText: 'Time',
+                       hourText: 'Hour',
+                       minuteText: 'Minute',
+                       secondText: 'Second',
+                       millisecText: 'Millisecond',
+                       timezoneText: 'Time Zone',
+                       isRTL: false
+               };
+               this._defaults = { // Global defaults for all the datetime picker instances
+                       showButtonPanel: true,
+                       timeOnly: false,
+                       showHour: true,
+                       showMinute: true,
+                       showSecond: false,
+                       showMillisec: false,
+                       showTimezone: false,
+                       showTime: true,
+                       stepHour: 1,
+                       stepMinute: 1,
+                       stepSecond: 1,
+                       stepMillisec: 1,
+                       hour: 0,
+                       minute: 0,
+                       second: 0,
+                       millisec: 0,
+                       timezone: null,
+                       useLocalTimezone: false,
+                       defaultTimezone: "+0000",
+                       hourMin: 0,
+                       minuteMin: 0,
+                       secondMin: 0,
+                       millisecMin: 0,
+                       hourMax: 23,
+                       minuteMax: 59,
+                       secondMax: 59,
+                       millisecMax: 999,
+                       minDateTime: null,
+                       maxDateTime: null,
+                       onSelect: null,
+                       hourGrid: 0,
+                       minuteGrid: 0,
+                       secondGrid: 0,
+                       millisecGrid: 0,
+                       alwaysSetTime: true,
+                       separator: ' ',
+                       altFieldTimeOnly: true,
+                       altTimeFormat: null,
+                       altSeparator: null,
+                       altTimeSuffix: null,
+                       pickerTimeFormat: null,
+                       pickerTimeSuffix: null,
+                       showTimepicker: true,
+                       timezoneIso8601: false,
+                       timezoneList: null,
+                       addSliderAccess: false,
+                       sliderAccessArgs: null,
+                       controlType: 'slider',
+                       defaultValue: null,
+                       parse: 'strict'
+               };
+               $.extend(this._defaults, this.regional['']);
+       };
+
+       $.extend(Timepicker.prototype, {
+               $input: null,
+               $altInput: null,
+               $timeObj: null,
+               inst: null,
+               hour_slider: null,
+               minute_slider: null,
+               second_slider: null,
+               millisec_slider: null,
+               timezone_select: null,
+               hour: 0,
+               minute: 0,
+               second: 0,
+               millisec: 0,
+               timezone: null,
+               defaultTimezone: "+0000",
+               hourMinOriginal: null,
+               minuteMinOriginal: null,
+               secondMinOriginal: null,
+               millisecMinOriginal: null,
+               hourMaxOriginal: null,
+               minuteMaxOriginal: null,
+               secondMaxOriginal: null,
+               millisecMaxOriginal: null,
+               ampm: '',
+               formattedDate: '',
+               formattedTime: '',
+               formattedDateTime: '',
+               timezoneList: null,
+               units: ['hour','minute','second','millisec'],
+               control: null,
+
+               /* 
+               * Override the default settings for all instances of the time picker.
+               * @param  settings  object - the new settings to use as defaults (anonymous object)
+               * @return the manager object
+               */
+               setDefaults: function(settings) {
+                       extendRemove(this._defaults, settings || {});
+                       return this;
+               },
+
+               /*
+               * Create a new Timepicker instance
+               */
+               _newInst: function($input, o) {
+                       var tp_inst = new Timepicker(),
+                               inlineSettings = {},
+                fns = {},
+                       overrides, i;
+
+                       for (var attrName in this._defaults) {
+                               if(this._defaults.hasOwnProperty(attrName)){
+                                       var attrValue = $input.attr('time:' + attrName);
+                                       if (attrValue) {
+                                               try {
+                                                       inlineSettings[attrName] = eval(attrValue);
+                                               } catch (err) {
+                                                       inlineSettings[attrName] = attrValue;
+                                               }
+                                       }
+                               }
+                       }
+                   overrides = {
+                       beforeShow: function (input, dp_inst) {
+                           if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
+                               return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
+                           }
+                       },
+                       onChangeMonthYear: function (year, month, dp_inst) {
+                           // Update the time as well : this prevents the time from disappearing from the $input field.
+                           tp_inst._updateDateTime(dp_inst);
+                           if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
+                               tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
+                           }
+                       },
+                       onClose: function (dateText, dp_inst) {
+                           if (tp_inst.timeDefined === true && $input.val() !== '') {
+                               tp_inst._updateDateTime(dp_inst);
+                           }
+                           if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
+                               tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
+                           }
+                       }
+                   };
+                   for (i in overrides) {
+                       if (overrides.hasOwnProperty(i)) {
+                           fns[i] = o[i] || null;
+                       }
+                   }
+                   tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, overrides, {
+                       evnts:fns,
+                       timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
+                   });
+                       tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) {
+                               return val.toUpperCase();
+                       });
+                       tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) {
+                               return val.toUpperCase();
+                       });
+
+                       // controlType is string - key to our this._controls
+                       if(typeof(tp_inst._defaults.controlType) === 'string'){
+                               if($.fn[tp_inst._defaults.controlType] === undefined){
+                                       tp_inst._defaults.controlType = 'select';
+                               }
+                               tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
+                       }
+                       // controlType is an object and must implement create, options, value methods
+                       else{ 
+                               tp_inst.control = tp_inst._defaults.controlType;
+                       }
+
+                       if (tp_inst._defaults.timezoneList === null) {
+                               var timezoneList = ['-1200', '-1100', '-1000', '-0930', '-0900', '-0800', '-0700', '-0600', '-0500', '-0430', '-0400', '-0330', '-0300', '-0200', '-0100', '+0000', 
+                                                                       '+0100', '+0200', '+0300', '+0330', '+0400', '+0430', '+0500', '+0530', '+0545', '+0600', '+0630', '+0700', '+0800', '+0845', '+0900', '+0930', 
+                                                                       '+1000', '+1030', '+1100', '+1130', '+1200', '+1245', '+1300', '+1400'];
+
+                               if (tp_inst._defaults.timezoneIso8601) {
+                                       timezoneList = $.map(timezoneList, function(val) {
+                                               return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3));
+                                       });
+                               }
+                               tp_inst._defaults.timezoneList = timezoneList;
+                       }
+
+                       tp_inst.timezone = tp_inst._defaults.timezone;
+                       tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin? tp_inst._defaults.hourMin : 
+                                                       tp_inst._defaults.hour > tp_inst._defaults.hourMax? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
+                       tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin? tp_inst._defaults.minuteMin : 
+                                                       tp_inst._defaults.minute > tp_inst._defaults.minuteMax? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
+                       tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin? tp_inst._defaults.secondMin : 
+                                                       tp_inst._defaults.second > tp_inst._defaults.secondMax? tp_inst._defaults.secondMax : tp_inst._defaults.second;
+                       tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin? tp_inst._defaults.millisecMin : 
+                                                       tp_inst._defaults.millisec > tp_inst._defaults.millisecMax? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
+                       tp_inst.ampm = '';
+                       tp_inst.$input = $input;
+
+                       if (o.altField) {
+                               tp_inst.$altInput = $(o.altField).css({
+                                       cursor: 'pointer'
+                               }).focus(function() {
+                                       $input.trigger("focus");
+                               });
+                       }
+
+                       if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
+                               tp_inst._defaults.minDate = new Date();
+                       }
+                       if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
+                               tp_inst._defaults.maxDate = new Date();
+                       }
+
+                       // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
+                       if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
+                               tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
+                       }
+                       if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
+                               tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
+                       }
+                       if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
+                               tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
+                       }
+                       if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
+                               tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
+                       }
+                       tp_inst.$input.bind('focus', function() {
+                               tp_inst._onFocus();
+                       });
+
+                       return tp_inst;
+               },
+
+               /*
+               * add our sliders to the calendar
+               */
+               _addTimePicker: function(dp_inst) {
+                       var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val();
+
+                       this.timeDefined = this._parseTime(currDT);
+                       this._limitMinMaxDateTime(dp_inst, false);
+                       this._injectTimePicker();
+               },
+
+               /*
+               * parse the time string from input value or _setTime
+               */
+               _parseTime: function(timeString, withDate) {
+                       if (!this.inst) {
+                               this.inst = $.datepicker._getInst(this.$input[0]);
+                       }
+
+                       if (withDate || !this._defaults.timeOnly) {
+                               var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
+                               try {
+                                       var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
+                                       if (!parseRes.timeObj) {
+                                               return false;
+                                       }
+                                       $.extend(this, parseRes.timeObj);
+                               } catch (err) {
+                                       $.timepicker.log("Error parsing the date/time string: " + err +
+                                                                       "\ndate/time string = " + timeString +
+                                                                       "\ntimeFormat = " + this._defaults.timeFormat +
+                                                                       "\ndateFormat = " + dp_dateFormat);
+                                       return false;
+                               }
+                               return true;
+                       } else {
+                               var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
+                               if (!timeObj) {
+                                       return false;
+                               }
+                               $.extend(this, timeObj);
+                               return true;
+                       }
+               },
+
+               /*
+               * generate and inject html for timepicker into ui datepicker
+               */
+               _injectTimePicker: function() {
+                       var $dp = this.inst.dpDiv,
+                               o = this.inst.settings,
+                               tp_inst = this,
+                               litem = '',
+                               uitem = '',
+                               max = {},
+                               gridSize = {},
+                               size = null;
+
+                       // Prevent displaying twice
+                       if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
+                               var noDisplay = ' style="display:none;"',
+                                       html = '<div class="ui-timepicker-div'+ (o.isRTL? ' ui-timepicker-rtl' : '') +'"><dl>' + '<dt class="ui_tpicker_time_label"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' + 
+                                                               '<dd class="ui_tpicker_time"' + ((o.showTime) ? '' : noDisplay) + '></dd>';
+
+                               // Create the markup
+                               for(var i=0,l=this.units.length; i<l; i++){
+                                       litem = this.units[i];
+                                       uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
+                                       // Added by Peter Medeiros:
+                                       // - Figure out what the hour/minute/second max should be based on the step values.
+                                       // - Example: if stepMinute is 15, then minMax is 45.
+                                       max[litem] = parseInt((o[litem+'Max'] - ((o[litem+'Max'] - o[litem+'Min']) % o['step'+uitem])), 10);
+                                       gridSize[litem] = 0;
+
+                                       html += '<dt class="ui_tpicker_'+ litem +'_label"' + ((o['show'+uitem]) ? '' : noDisplay) + '>' + o[litem +'Text'] + '</dt>' + 
+                                                               '<dd class="ui_tpicker_'+ litem +'"><div class="ui_tpicker_'+ litem +'_slider"' + ((o['show'+uitem]) ? '' : noDisplay) + '></div>';
+
+                                       if (o['show'+uitem] && o[litem+'Grid'] > 0) {
+                                               html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
+
+                                               if(litem == 'hour'){
+                                                       for (var h = o[litem+'Min']; h <= max[litem]; h += parseInt(o[litem+'Grid'], 10)) {
+                                                               gridSize[litem]++;
+                                                               var tmph = $.datepicker.formatTime(useAmpm(o.pickerTimeFormat || o.timeFormat)? 'hht':'HH', {hour:h}, o);                                                                       
+                                                               html += '<td data-for="'+litem+'">' + tmph + '</td>';
+                                                       }
+                                               }
+                                               else{
+                                                       for (var m = o[litem+'Min']; m <= max[litem]; m += parseInt(o[litem+'Grid'], 10)) {
+                                                               gridSize[litem]++;
+                                                               html += '<td data-for="'+litem+'">' + ((m < 10) ? '0' : '') + m + '</td>';
+                                                       }
+                                               }
+
+                                               html += '</tr></table></div>';
+                                       }
+                                       html += '</dd>';
+                               }
+                               
+                               // Timezone
+                               html += '<dt class="ui_tpicker_timezone_label"' + ((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
+                               html += '<dd class="ui_tpicker_timezone" ' + ((o.showTimezone) ? '' : noDisplay) + '></dd>';
+
+                               // Create the elements from string
+                               html += '</dl></div>';
+                               var $tp = $(html);
+
+                               // if we only want time picker...
+                               if (o.timeOnly === true) {
+                                       $tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
+                                       $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
+                               }
+                               
+                               // add sliders, adjust grids, add events
+                               for(var i=0,l=tp_inst.units.length; i<l; i++){
+                                       litem = tp_inst.units[i];
+                                       uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
+
+                                       // add the slider
+                                       tp_inst[litem+'_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_'+litem+'_slider'), litem, tp_inst[litem], o[litem+'Min'], max[litem], o['step'+uitem]);
+
+                                       // adjust the grid and add click event
+                                       if (o['show'+uitem] && o[litem+'Grid'] > 0) {
+                                               size = 100 * gridSize[litem] * o[litem+'Grid'] / (max[litem] - o[litem+'Min']);
+                                               $tp.find('.ui_tpicker_'+litem+' table').css({
+                                                       width: size + "%",
+                                                       marginLeft: o.isRTL? '0' : ((size / (-2 * gridSize[litem])) + "%"),
+                                                       marginRight: o.isRTL? ((size / (-2 * gridSize[litem])) + "%") : '0',
+                                                       borderCollapse: 'collapse'
+                                               }).find("td").click(function(e){
+                                                               var $t = $(this),
+                                                                       h = $t.html(),
+                                                                       n = parseInt(h.replace(/[^0-9]/g),10),
+                                                                       ap = h.replace(/[^apm]/ig),
+                                                                       f = $t.data('for'); // loses scope, so we use data-for
+
+                                                               if(f == 'hour'){
+                                                                       if(ap.indexOf('p') !== -1 && n < 12){
+                                                                               n += 12;
+                                                                       }
+                                                                       else{
+                                                                               if(ap.indexOf('a') !== -1 && n === 12){
+                                                                                       n = 0;
+                                                                               }
+                                                                       }
+                                                               }
+                                                               
+                                                               tp_inst.control.value(tp_inst, tp_inst[f+'_slider'], litem, n);
+
+                                                               tp_inst._onTimeChange();
+                                                               tp_inst._onSelectHandler();
+                                                       })
+                                               .css({
+                                                               cursor: 'pointer',
+                                                               width: (100 / gridSize[litem]) + '%',
+                                                               textAlign: 'center',
+                                                               overflow: 'hidden'
+                                                       });
+                                       } // end if grid > 0
+                               } // end for loop
+
+                               // Add timezone options
+                               this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
+                               $.fn.append.apply(this.timezone_select,
+                               $.map(o.timezoneList, function(val, idx) {
+                                       return $("<option />").val(typeof val == "object" ? val.value : val).text(typeof val == "object" ? val.label : val);
+                               }));
+                               if (typeof(this.timezone) != "undefined" && this.timezone !== null && this.timezone !== "") {
+                                       var local_date = new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12);
+                                       var local_timezone = $.timepicker.timeZoneOffsetString(local_date);
+                                       if (local_timezone == this.timezone) {
+                                               selectLocalTimeZone(tp_inst);
+                                       } else {
+                                               this.timezone_select.val(this.timezone);
+                                       }
+                               } else {
+                                       if (typeof(this.hour) != "undefined" && this.hour !== null && this.hour !== "") {
+                                               this.timezone_select.val(o.defaultTimezone);
+                                       } else {
+                                               selectLocalTimeZone(tp_inst);
+                                       }
+                               }
+                               this.timezone_select.change(function() {
+                                       tp_inst._defaults.useLocalTimezone = false;
+                                       tp_inst._onTimeChange();
+                                       tp_inst._onSelectHandler();
+                               });
+                               // End timezone options
+                               
+                               // inject timepicker into datepicker
+                               var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
+                               if ($buttonPanel.length) {
+                                       $buttonPanel.before($tp);
+                               } else {
+                                       $dp.append($tp);
+                               }
+
+                               this.$timeObj = $tp.find('.ui_tpicker_time');
+
+                               if (this.inst !== null) {
+                                       var timeDefined = this.timeDefined;
+                                       this._onTimeChange();
+                                       this.timeDefined = timeDefined;
+                               }
+
+                               // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
+                               if (this._defaults.addSliderAccess) {
+                                       var sliderAccessArgs = this._defaults.sliderAccessArgs,
+                                               rtl = this._defaults.isRTL;
+                                       sliderAccessArgs.isRTL = rtl;
+                                               
+                                       setTimeout(function() { // fix for inline mode
+                                               if ($tp.find('.ui-slider-access').length === 0) {
+                                                       $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
+
+                                                       // fix any grids since sliders are shorter
+                                                       var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
+                                                       if (sliderAccessWidth) {
+                                                               $tp.find('table:visible').each(function() {
+                                                                       var $g = $(this),
+                                                                               oldWidth = $g.outerWidth(),
+                                                                               oldMarginLeft = $g.css(rtl? 'marginRight':'marginLeft').toString().replace('%', ''),
+                                                                               newWidth = oldWidth - sliderAccessWidth,
+                                                                               newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
+                                                                               css = { width: newWidth, marginRight: 0, marginLeft: 0 };
+                                                                       css[rtl? 'marginRight':'marginLeft'] = newMarginLeft;
+                                                                       $g.css(css);
+                                                               });
+                                                       }
+                                               }
+                                       }, 10);
+                               }
+                               // end slideAccess integration
+
+                       }
+               },
+
+               /*
+               * This function tries to limit the ability to go outside the
+               * min/max date range
+               */
+               _limitMinMaxDateTime: function(dp_inst, adjustSliders) {
+                       var o = this._defaults,
+                               dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
+
+                       if (!this._defaults.showTimepicker) {
+                               return;
+                       } // No time so nothing to check here
+
+                       if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
+                               var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
+                                       minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
+
+                               if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null) {
+                                       this.hourMinOriginal = o.hourMin;
+                                       this.minuteMinOriginal = o.minuteMin;
+                                       this.secondMinOriginal = o.secondMin;
+                                       this.millisecMinOriginal = o.millisecMin;
+                               }
+
+                               if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
+                                       this._defaults.hourMin = minDateTime.getHours();
+                                       if (this.hour <= this._defaults.hourMin) {
+                                               this.hour = this._defaults.hourMin;
+                                               this._defaults.minuteMin = minDateTime.getMinutes();
+                                               if (this.minute <= this._defaults.minuteMin) {
+                                                       this.minute = this._defaults.minuteMin;
+                                                       this._defaults.secondMin = minDateTime.getSeconds();
+                                                       if (this.second <= this._defaults.secondMin) {
+                                                               this.second = this._defaults.secondMin;
+                                                               this._defaults.millisecMin = minDateTime.getMilliseconds();
+                                                       } else {
+                                                               if (this.millisec < this._defaults.millisecMin) {
+                                                                       this.millisec = this._defaults.millisecMin;
+                                                               }
+                                                               this._defaults.millisecMin = this.millisecMinOriginal;
+                                                       }
+                                               } else {
+                                                       this._defaults.secondMin = this.secondMinOriginal;
+                                                       this._defaults.millisecMin = this.millisecMinOriginal;
+                                               }
+                                       } else {
+                                               this._defaults.minuteMin = this.minuteMinOriginal;
+                                               this._defaults.secondMin = this.secondMinOriginal;
+                                               this._defaults.millisecMin = this.millisecMinOriginal;
+                                       }
+                               } else {
+                                       this._defaults.hourMin = this.hourMinOriginal;
+                                       this._defaults.minuteMin = this.minuteMinOriginal;
+                                       this._defaults.secondMin = this.secondMinOriginal;
+                                       this._defaults.millisecMin = this.millisecMinOriginal;
+                               }
+                       }
+
+                       if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
+                               var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
+                                       maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
+
+                               if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null) {
+                                       this.hourMaxOriginal = o.hourMax;
+                                       this.minuteMaxOriginal = o.minuteMax;
+                                       this.secondMaxOriginal = o.secondMax;
+                                       this.millisecMaxOriginal = o.millisecMax;
+                               }
+
+                               if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()) {
+                                       this._defaults.hourMax = maxDateTime.getHours();
+                                       if (this.hour >= this._defaults.hourMax) {
+                                               this.hour = this._defaults.hourMax;
+                                               this._defaults.minuteMax = maxDateTime.getMinutes();
+                                               if (this.minute >= this._defaults.minuteMax) {
+                                                       this.minute = this._defaults.minuteMax;
+                                                       this._defaults.secondMax = maxDateTime.getSeconds();
+                                                       if (this.second >= this._defaults.secondMax) {
+                                                               this.second = this._defaults.secondMax;
+                                                               this._defaults.millisecMax = maxDateTime.getMilliseconds();
+                                                       } else {
+                                                               if (this.millisec > this._defaults.millisecMax) {
+                                                                       this.millisec = this._defaults.millisecMax;
+                                                               }
+                                                               this._defaults.millisecMax = this.millisecMaxOriginal;
+                                                       }
+                                               } else {
+                                                       this._defaults.secondMax = this.secondMaxOriginal;
+                                                       this._defaults.millisecMax = this.millisecMaxOriginal;
+                                               }
+                                       } else {
+                                               this._defaults.minuteMax = this.minuteMaxOriginal;
+                                               this._defaults.secondMax = this.secondMaxOriginal;
+                                               this._defaults.millisecMax = this.millisecMaxOriginal;
+                                       }
+                               } else {
+                                       this._defaults.hourMax = this.hourMaxOriginal;
+                                       this._defaults.minuteMax = this.minuteMaxOriginal;
+                                       this._defaults.secondMax = this.secondMaxOriginal;
+                                       this._defaults.millisecMax = this.millisecMaxOriginal;
+                               }
+                       }
+
+                       if (adjustSliders !== undefined && adjustSliders === true) {
+                               var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
+                                       minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
+                                       secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
+                                       millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10);
+
+                               if (this.hour_slider) {
+                                       this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });
+                                       this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
+                               }
+                               if (this.minute_slider) {
+                                       this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax });
+                                       this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
+                               }
+                               if (this.second_slider) {
+                                       this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax });
+                                       this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
+                               }
+                               if (this.millisec_slider) {
+                                       this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });
+                                       this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
+                               }
+                       }
+
+               },
+
+               /*
+               * when a slider moves, set the internal time...
+               * on time change is also called when the time is updated in the text field
+               */
+               _onTimeChange: function() {
+                       var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
+                               minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
+                               second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
+                               millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
+                               timezone = (this.timezone_select) ? this.timezone_select.val() : false,
+                               o = this._defaults,
+                               pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
+                               pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
+
+                       if (typeof(hour) == 'object') {
+                               hour = false;
+                       }
+                       if (typeof(minute) == 'object') {
+                               minute = false;
+                       }
+                       if (typeof(second) == 'object') {
+                               second = false;
+                       }
+                       if (typeof(millisec) == 'object') {
+                               millisec = false;
+                       }
+                       if (typeof(timezone) == 'object') {
+                               timezone = false;
+                       }
+
+                       if (hour !== false) {
+                               hour = parseInt(hour, 10);
+                       }
+                       if (minute !== false) {
+                               minute = parseInt(minute, 10);
+                       }
+                       if (second !== false) {
+                               second = parseInt(second, 10);
+                       }
+                       if (millisec !== false) {
+                               millisec = parseInt(millisec, 10);
+                       }
+
+                       var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
+
+                       // If the update was done in the input field, the input field should not be updated.
+                       // If the update was done using the sliders, update the input field.
+                       var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || millisec != this.millisec 
+                                                               || (this.ampm.length > 0 && (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) 
+                                                               || ((this.timezone === null && timezone != this.defaultTimezone) || (this.timezone !== null && timezone != this.timezone)));
+
+                       if (hasChanged) {
+
+                               if (hour !== false) {
+                                       this.hour = hour;
+                               }
+                               if (minute !== false) {
+                                       this.minute = minute;
+                               }
+                               if (second !== false) {
+                                       this.second = second;
+                               }
+                               if (millisec !== false) {
+                                       this.millisec = millisec;
+                               }
+                               if (timezone !== false) {
+                                       this.timezone = timezone;
+                               }
+
+                               if (!this.inst) {
+                                       this.inst = $.datepicker._getInst(this.$input[0]);
+                               }
+
+                               this._limitMinMaxDateTime(this.inst, true);
+                       }
+                       if (useAmpm(o.timeFormat)) {
+                               this.ampm = ampm;
+                       }
+
+                       // Updates the time within the timepicker
+                       this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
+                       if (this.$timeObj) {
+                               if(pickerTimeFormat === o.timeFormat){
+                                       this.$timeObj.text(this.formattedTime + pickerTimeSuffix);
+                               }
+                               else{
+                                       this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
+                               }
+                       }
+
+                       this.timeDefined = true;
+                       if (hasChanged) {
+                               this._updateDateTime();
+                       }
+               },
+
+               /*
+               * call custom onSelect.
+               * bind to sliders slidestop, and grid click.
+               */
+               _onSelectHandler: function() {
+                       var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
+                       var inputEl = this.$input ? this.$input[0] : null;
+                       if (onSelect && inputEl) {
+                               onSelect.apply(inputEl, [this.formattedDateTime, this]);
+                       }
+               },
+
+               /*
+               * update our input with the new date time..
+               */
+               _updateDateTime: function(dp_inst) {
+                       dp_inst = this.inst || dp_inst;
+                       var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
+                               dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
+                               formatCfg = $.datepicker._getFormatConfig(dp_inst),
+                               timeAvailable = dt !== null && this.timeDefined;
+                       this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
+                       var formattedDateTime = this.formattedDate;
+                       
+                       // if a slider was changed but datepicker doesn't have a value yet, set it
+                       if(dp_inst.lastVal==""){
+                dp_inst.currentYear=dp_inst.selectedYear;
+                dp_inst.currentMonth=dp_inst.selectedMonth;
+                dp_inst.currentDay=dp_inst.selectedDay;
+            }
+
+                       /*
+                       * remove following lines to force every changes in date picker to change the input value
+                       * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker. 
+                       * If the user manually empty the value in the input field, the date picker will never change selected value.
+                       */
+                       //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
+                       //      return;
+                       //}
+
+                       if (this._defaults.timeOnly === true) {
+                               formattedDateTime = this.formattedTime;
+                       } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
+                               formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
+                       }
+
+                       this.formattedDateTime = formattedDateTime;
+
+                       if (!this._defaults.showTimepicker) {
+                               this.$input.val(this.formattedDate);
+                       } else if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
+                               this.$altInput.val(this.formattedTime);
+                               this.$input.val(this.formattedDate);
+                       } else if (this.$altInput) {
+                               this.$input.val(formattedDateTime);
+                               var altFormattedDateTime = '',
+                                       altSeparator = this._defaults.altSeparator ? this._defaults.altSeparator : this._defaults.separator,
+                                       altTimeSuffix = this._defaults.altTimeSuffix ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
+
+                               if (this._defaults.altFormat) altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
+                               else altFormattedDateTime = this.formattedDate;
+                               if (altFormattedDateTime) altFormattedDateTime += altSeparator;
+                               if (this._defaults.altTimeFormat) altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
+                               else altFormattedDateTime += this.formattedTime + altTimeSuffix;
+                               this.$altInput.val(altFormattedDateTime);
+                       } else {
+                               this.$input.val(formattedDateTime);
+                       }
+
+                       this.$input.trigger("change");
+               },
+
+               _onFocus: function() {
+                       if (!this.$input.val() && this._defaults.defaultValue) {
+                               this.$input.val(this._defaults.defaultValue);
+                               var inst = $.datepicker._getInst(this.$input.get(0)),
+                                       tp_inst = $.datepicker._get(inst, 'timepicker');
+                               if (tp_inst) {
+                                       if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
+                                               try {
+                                                       $.datepicker._updateDatepicker(inst);
+                                               } catch (err) {
+                                                       $.timepicker.log(err);
+                                               }
+                                       }
+                               }
+                       }
+               },
+
+               /*
+               * Small abstraction to control types
+               * We can add more, just be sure to follow the pattern: create, options, value
+               */
+               _controls: {
+                       // slider methods
+                       slider: {
+                               create: function(tp_inst, obj, unit, val, min, max, step){
+                                       var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
+                                       return obj.prop('slide', null).slider({
+                                               orientation: "horizontal",
+                                               value: rtl? val*-1 : val,
+                                               min: rtl? max*-1 : min,
+                                               max: rtl? min*-1 : max,
+                                               step: step,
+                                               slide: function(event, ui) {
+                                                       tp_inst.control.value(tp_inst, $(this), unit, rtl? ui.value*-1:ui.value);
+                                                       tp_inst._onTimeChange();
+                                               },
+                                               stop: function(event, ui) {
+                                                       tp_inst._onSelectHandler();
+                                               }
+                                       });     
+                               },
+                               options: function(tp_inst, obj, unit, opts, val){
+                                       if(tp_inst._defaults.isRTL){
+                                               if(typeof(opts) == 'string'){
+                                                       if(opts == 'min' || opts == 'max'){
+                                                               if(val !== undefined)
+                                                                       return obj.slider(opts, val*-1);
+                                                               return Math.abs(obj.slider(opts));
+                                                       }
+                                                       return obj.slider(opts);
+                                               }
+                                               var min = opts.min, 
+                                                       max = opts.max;
+                                               opts.min = opts.max = null;
+                                               if(min !== undefined)
+                                                       opts.max = min * -1;
+                                               if(max !== undefined)
+                                                       opts.min = max * -1;
+                                               return obj.slider(opts);
+                                       }
+                                       if(typeof(opts) == 'string' && val !== undefined)
+                                                       return obj.slider(opts, val);
+                                       return obj.slider(opts);
+                               },
+                               value: function(tp_inst, obj, unit, val){
+                                       if(tp_inst._defaults.isRTL){
+                                               if(val !== undefined)
+                                                       return obj.slider('value', val*-1);
+                                               return Math.abs(obj.slider('value'));
+                                       }
+                                       if(val !== undefined)
+                                               return obj.slider('value', val);
+                                       return obj.slider('value');
+                               }
+                       },
+                       // select methods
+                       select: {
+                               create: function(tp_inst, obj, unit, val, min, max, step){
+                                       var sel = '<select class="ui-timepicker-select" data-unit="'+ unit +'" data-min="'+ min +'" data-max="'+ max +'" data-step="'+ step +'">',
+                                               ul = tp_inst._defaults.timeFormat.indexOf('t') !== -1? 'toLowerCase':'toUpperCase',
+                                               m = 0;
+
+                                       for(var i=min; i<=max; i+=step){                                                
+                                               sel += '<option value="'+ i +'"'+ (i==val? ' selected':'') +'>';
+                                               if(unit == 'hour' && useAmpm(tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat))
+                                                       sel += $.datepicker.formatTime("hh TT", {hour:i}, tp_inst._defaults);
+                                               else if(unit == 'millisec' || i >= 10) sel += i;
+                                               else sel += '0'+ i.toString();
+                                               sel += '</option>';
+                                       }
+                                       sel += '</select>';
+
+                                       obj.children('select').remove();
+
+                                       $(sel).appendTo(obj).change(function(e){
+                                               tp_inst._onTimeChange();
+                                               tp_inst._onSelectHandler();
+                                       });
+
+                                       return obj;
+                               },
+                               options: function(tp_inst, obj, unit, opts, val){
+                                       var o = {},
+                                               $t = obj.children('select');
+                                       if(typeof(opts) == 'string'){
+                                               if(val === undefined)
+                                                       return $t.data(opts);
+                                               o[opts] = val;  
+                                       }
+                                       else o = opts;
+                                       return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
+                               },
+                               value: function(tp_inst, obj, unit, val){
+                                       var $t = obj.children('select');
+                                       if(val !== undefined)
+                                               return $t.val(val);
+                                       return $t.val();
+                               }
+                       }
+               } // end _controls
+
+       });
+
+       $.fn.extend({
+               /*
+               * shorthand just to use timepicker..
+               */
+               timepicker: function(o) {
+                       o = o || {};
+                       var tmp_args = Array.prototype.slice.call(arguments);
+
+                       if (typeof o == 'object') {
+                               tmp_args[0] = $.extend(o, {
+                                       timeOnly: true
+                               });
+                       }
+
+                       return $(this).each(function() {
+                               $.fn.datetimepicker.apply($(this), tmp_args);
+                       });
+               },
+
+               /*
+               * extend timepicker to datepicker
+               */
+               datetimepicker: function(o) {
+                       o = o || {};
+                       var tmp_args = arguments;
+
+                       if (typeof(o) == 'string') {
+                               if (o == 'getDate') {
+                                       return $.fn.datepicker.apply($(this[0]), tmp_args);
+                               } else {
+                                       return this.each(function() {
+                                               var $t = $(this);
+                                               $t.datepicker.apply($t, tmp_args);
+                                       });
+                               }
+                       } else {
+                               return this.each(function() {
+                                       var $t = $(this);
+                                       $t.datepicker($.timepicker._newInst($t, o)._defaults);
+                               });
+                       }
+               }
+       });
+
+       /*
+       * Public Utility to parse date and time
+       */
+       $.datepicker.parseDateTime = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
+               var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
+               if (parseRes.timeObj) {
+                       var t = parseRes.timeObj;
+                       parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
+               }
+
+               return parseRes.date;
+       };
+
+       /*
+       * Public utility to parse time
+       */
+       $.datepicker.parseTime = function(timeFormat, timeString, options) {            
+               var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {});
+
+               // Strict parse requires the timeString to match the timeFormat exactly
+               var strictParse = function(f, s, o){
+
+                       // pattern for standard and localized AM/PM markers
+                       var getPatternAmpm = function(amNames, pmNames) {
+                               var markers = [];
+                               if (amNames) {
+                                       $.merge(markers, amNames);
+                               }
+                               if (pmNames) {
+                                       $.merge(markers, pmNames);
+                               }
+                               markers = $.map(markers, function(val) {
+                                       return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
+                               });
+                               return '(' + markers.join('|') + ')?';
+                       };
+
+                       // figure out position of time elements.. cause js cant do named captures
+                       var getFormatPositions = function(timeFormat) {
+                               var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|t{1,2}|z|'.*?')/g),
+                                       orders = {
+                                               h: -1,
+                                               m: -1,
+                                               s: -1,
+                                               l: -1,
+                                               t: -1,
+                                               z: -1
+                                       };
+
+                               if (finds) {
+                                       for (var i = 0; i < finds.length; i++) {
+                                               if (orders[finds[i].toString().charAt(0)] == -1) {
+                                                       orders[finds[i].toString().charAt(0)] = i + 1;
+                                               }
+                                       }
+                               }
+                               return orders;
+                       };
+
+                       var regstr = '^' + f.toString()
+                                       .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[lz]|'.*?')/g, function (match) {
+                                                       var ml = match.length;
+                                                       switch (match.charAt(0).toLowerCase()) {
+                                                               case 'h': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
+                                                               case 'm': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
+                                                               case 's': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
+                                                               case 'l': return '(\\d?\\d?\\d)';
+                                                               case 'z': return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
+                                                               case 't': return getPatternAmpm(o.amNames, o.pmNames);
+                                                               default:    // literal escaped in quotes
+                                                                       return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
+                                                       }
+                                               })
+                                       .replace(/\s/g, '\\s?') +
+                                       o.timeSuffix + '$',
+                               order = getFormatPositions(f),
+                               ampm = '',
+                               treg;
+
+                       treg = s.match(new RegExp(regstr, 'i'));
+
+                       var resTime = {
+                               hour: 0,
+                               minute: 0,
+                               second: 0,
+                               millisec: 0
+                       };
+
+                       if (treg) {
+                               if (order.t !== -1) {
+                                       if (treg[order.t] === undefined || treg[order.t].length === 0) {
+                                               ampm = '';
+                                               resTime.ampm = '';
+                                       } else {
+                                               ampm = $.inArray(treg[order.t].toUpperCase(), o.amNames) !== -1 ? 'AM' : 'PM';
+                                               resTime.ampm = o[ampm == 'AM' ? 'amNames' : 'pmNames'][0];
+                                       }
+                               }
+
+                               if (order.h !== -1) {
+                                       if (ampm == 'AM' && treg[order.h] == '12') {
+                                               resTime.hour = 0; // 12am = 0 hour
+                                       } else {
+                                               if (ampm == 'PM' && treg[order.h] != '12') {
+                                                       resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
+                                               } else {
+                                                       resTime.hour = Number(treg[order.h]);
+                                               }
+                                       }
+                               }
+
+                               if (order.m !== -1) {
+                                       resTime.minute = Number(treg[order.m]);
+                               }
+                               if (order.s !== -1) {
+                                       resTime.second = Number(treg[order.s]);
+                               }
+                               if (order.l !== -1) {
+                                       resTime.millisec = Number(treg[order.l]);
+                               }
+                               if (order.z !== -1 && treg[order.z] !== undefined) {
+                                       var tz = treg[order.z].toUpperCase();
+                                       switch (tz.length) {
+                                       case 1:
+                                               // Z
+                                               tz = o.timezoneIso8601 ? 'Z' : '+0000';
+                                               break;
+                                       case 5:
+                                               // +hhmm
+                                               if (o.timezoneIso8601) {
+                                                       tz = tz.substring(1) == '0000' ? 'Z' : tz.substring(0, 3) + ':' + tz.substring(3);
+                                               }
+                                               break;
+                                       case 6:
+                                               // +hh:mm
+                                               if (!o.timezoneIso8601) {
+                                                       tz = tz == 'Z' || tz.substring(1) == '00:00' ? '+0000' : tz.replace(/:/, '');
+                                               } else {
+                                                       if (tz.substring(1) == '00:00') {
+                                                               tz = 'Z';
+                                                       }
+                                               }
+                                               break;
+                                       }
+                                       resTime.timezone = tz;
+                               }
+
+
+                               return resTime;
+                       }
+                       return false;
+               };// end strictParse
+
+               // First try JS Date, if that fails, use strictParse
+               var looseParse = function(f,s,o){
+                       try{
+                               var d = new Date('2012-01-01 '+ s);
+                               if(isNaN(d.getTime())){
+                                       d = new Date('2012-01-01T'+ s);
+                                       if(isNaN(d.getTime())){
+                                               d = new Date('01/01/2012 '+ s);
+                                               if(isNaN(d.getTime())){
+                                                       throw "Unable to parse time with native Date: "+ s;
+                                               }
+                                       }
+                               }
+
+                               return {
+                                       hour: d.getHours(),
+                                       minute: d.getMinutes(),
+                                       second: d.getSeconds(),
+                                       millisec: d.getMilliseconds(),
+                                       timezone: $.timepicker.timeZoneOffsetString(d)
+                               };
+                       }
+                       catch(err){
+                               try{
+                                       return strictParse(f,s,o);
+                               }
+                               catch(err2){
+                                       $.timepicker.log("Unable to parse \ntimeString: "+ s +"\ntimeFormat: "+ f);
+                               }                               
+                       }
+                       return false;
+               }; // end looseParse
+               
+               if(typeof o.parse === "function"){
+                       return o.parse(timeFormat, timeString, o)
+               }
+               if(o.parse === 'loose'){
+                       return looseParse(timeFormat, timeString, o);
+               }
+               return strictParse(timeFormat, timeString, o);
+       };
+
+       /*
+       * Public utility to format the time
+       * format = string format of the time
+       * time = a {}, not a Date() for timezones
+       * options = essentially the regional[].. amNames, pmNames, ampm
+       */
+       $.datepicker.formatTime = function(format, time, options) {
+               options = options || {};
+               options = $.extend({}, $.timepicker._defaults, options);
+               time = $.extend({
+                       hour: 0,
+                       minute: 0,
+                       second: 0,
+                       millisec: 0,
+                       timezone: '+0000'
+               }, time);
+
+               var tmptime = format,
+                       ampmName = options.amNames[0],
+                       hour = parseInt(time.hour, 10);
+
+               if (hour > 11) {
+                       ampmName = options.pmNames[0];
+               }
+
+               tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[lz]|('.*?'|".*?"))/g, function(match) {
+               switch (match) {
+                       case 'HH':
+                               return ('0' + hour).slice(-2);
+                       case 'H':
+                               return hour;
+                       case 'hh':
+                               return ('0' + convert24to12(hour)).slice(-2);
+                       case 'h':
+                               return convert24to12(hour);
+                       case 'mm':
+                               return ('0' + time.minute).slice(-2);
+                       case 'm':
+                               return time.minute;
+                       case 'ss':
+                               return ('0' + time.second).slice(-2);
+                       case 's':
+                               return time.second;
+                       case 'l':
+                               return ('00' + time.millisec).slice(-3);
+                       case 'z':
+                               return time.timezone === null? options.defaultTimezone : time.timezone;
+                       case 'T': 
+                               return ampmName.charAt(0).toUpperCase();
+                       case 'TT': 
+                               return ampmName.toUpperCase();
+                       case 't':
+                               return ampmName.charAt(0).toLowerCase();
+                       case 'tt':
+                               return ampmName.toLowerCase();
+                       default:
+                               return match.replace(/\'/g, "") || "'";
+                       }
+               });
+
+               tmptime = $.trim(tmptime);
+               return tmptime;
+       };
+
+       /*
+       * the bad hack :/ override datepicker so it doesnt close on select
+       // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
+       */
+       $.datepicker._base_selectDate = $.datepicker._selectDate;
+       $.datepicker._selectDate = function(id, dateStr) {
+               var inst = this._getInst($(id)[0]),
+                       tp_inst = this._get(inst, 'timepicker');
+
+               if (tp_inst) {
+                       tp_inst._limitMinMaxDateTime(inst, true);
+                       inst.inline = inst.stay_open = true;
+                       //This way the onSelect handler called from calendarpicker get the full dateTime
+                       this._base_selectDate(id, dateStr);
+                       inst.inline = inst.stay_open = false;
+                       this._notifyChange(inst);
+                       this._updateDatepicker(inst);
+               } else {
+                       this._base_selectDate(id, dateStr);
+               }
+       };
+
+       /*
+       * second bad hack :/ override datepicker so it triggers an event when changing the input field
+       * and does not redraw the datepicker on every selectDate event
+       */
+       $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
+       $.datepicker._updateDatepicker = function(inst) {
+
+               // don't popup the datepicker if there is another instance already opened
+               var input = inst.input[0];
+               if ($.datepicker._curInst && $.datepicker._curInst != inst && $.datepicker._datepickerShowing && $.datepicker._lastInput != input) {
+                       return;
+               }
+
+               if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
+
+                       this._base_updateDatepicker(inst);
+
+                       // Reload the time control when changing something in the input text field.
+                       var tp_inst = this._get(inst, 'timepicker');
+                       if (tp_inst) {
+                               tp_inst._addTimePicker(inst);
+
+//                             if (tp_inst._defaults.useLocalTimezone) { //checks daylight saving with the new date.
+//                                     var date = new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay, 12);
+//                                     selectLocalTimeZone(tp_inst, date);
+//                                     tp_inst._onTimeChange();
+//                             }
+                       }
+               }
+       };
+
+       /*
+       * third bad hack :/ override datepicker so it allows spaces and colon in the input field
+       */
+       $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
+       $.datepicker._doKeyPress = function(event) {
+               var inst = $.datepicker._getInst(event.target),
+                       tp_inst = $.datepicker._get(inst, 'timepicker');
+
+               if (tp_inst) {
+                       if ($.datepicker._get(inst, 'constrainInput')) {
+                               var ampm = useAmpm(tp_inst._defaults.timeFormat),
+                                       dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
+                                       datetimeChars = tp_inst._defaults.timeFormat.toString()
+                                                                                       .replace(/[hms]/g, '')
+                                                                                       .replace(/TT/g, ampm ? 'APM' : '')
+                                                                                       .replace(/Tt/g, ampm ? 'AaPpMm' : '')
+                                                                                       .replace(/tT/g, ampm ? 'AaPpMm' : '')
+                                                                                       .replace(/T/g, ampm ? 'AP' : '')
+                                                                                       .replace(/tt/g, ampm ? 'apm' : '')
+                                                                                       .replace(/t/g, ampm ? 'ap' : '') + 
+                                                                                       " " + tp_inst._defaults.separator + 
+                                                                                       tp_inst._defaults.timeSuffix + 
+                                                                                       (tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') + 
+                                                                                       (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) + 
+                                                                                       dateChars,
+                                       chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
+                               return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
+                       }
+               }
+
+               return $.datepicker._base_doKeyPress(event);
+       };
+
+       /*
+       * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
+       */
+       $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
+       /* Update any alternate field to synchronise with the main field. */
+       $.datepicker._updateAlternate = function(inst) {
+               var tp_inst = this._get(inst, 'timepicker');
+               if(tp_inst){
+                       var altField = tp_inst._defaults.altField;
+                       if (altField) { // update alternate field too
+                               var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
+                                       date = this._getDate(inst),
+                                       formatCfg = $.datepicker._getFormatConfig(inst),
+                                       altFormattedDateTime = '', 
+                                       altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator, 
+                                       altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
+                                       altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
+                               
+                               altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
+                               if(!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null){
+                                       if(tp_inst._defaults.altFormat)
+                                               altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
+                                       else altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
+                               }
+                               $(altField).val(altFormattedDateTime);
+                       }
+               }
+               else{
+                       $.datepicker._base_updateAlternate(inst);
+               }
+       };
+
+       /*
+       * Override key up event to sync manual input changes.
+       */
+       $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
+       $.datepicker._doKeyUp = function(event) {
+               var inst = $.datepicker._getInst(event.target),
+                       tp_inst = $.datepicker._get(inst, 'timepicker');
+
+               if (tp_inst) {
+                       if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
+                               try {
+                                       $.datepicker._updateDatepicker(inst);
+                               } catch (err) {
+                                       $.timepicker.log(err);
+                               }
+                       }
+               }
+
+               return $.datepicker._base_doKeyUp(event);
+       };
+
+       /*
+       * override "Today" button to also grab the time.
+       */
+       $.datepicker._base_gotoToday = $.datepicker._gotoToday;
+       $.datepicker._gotoToday = function(id) {
+               var inst = this._getInst($(id)[0]),
+                       $dp = inst.dpDiv;
+               this._base_gotoToday(id);
+               var tp_inst = this._get(inst, 'timepicker');
+               selectLocalTimeZone(tp_inst);
+               var now = new Date();
+               this._setTime(inst, now);
+               $('.ui-datepicker-today', $dp).click();
+       };
+
+       /*
+       * Disable & enable the Time in the datetimepicker
+       */
+       $.datepicker._disableTimepickerDatepicker = function(target) {
+               var inst = this._getInst(target);
+               if (!inst) {
+                       return;
+               }
+
+               var tp_inst = this._get(inst, 'timepicker');
+               $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
+               if (tp_inst) {
+                       tp_inst._defaults.showTimepicker = false;
+                       tp_inst._updateDateTime(inst);
+               }
+       };
+
+       $.datepicker._enableTimepickerDatepicker = function(target) {
+               var inst = this._getInst(target);
+               if (!inst) {
+                       return;
+               }
+
+               var tp_inst = this._get(inst, 'timepicker');
+               $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
+               if (tp_inst) {
+                       tp_inst._defaults.showTimepicker = true;
+                       tp_inst._addTimePicker(inst); // Could be disabled on page load
+                       tp_inst._updateDateTime(inst);
+               }
+       };
+
+       /*
+       * Create our own set time function
+       */
+       $.datepicker._setTime = function(inst, date) {
+               var tp_inst = this._get(inst, 'timepicker');
+               if (tp_inst) {
+                       var defaults = tp_inst._defaults;
+
+                       // calling _setTime with no date sets time to defaults
+                       tp_inst.hour = date ? date.getHours() : defaults.hour;
+                       tp_inst.minute = date ? date.getMinutes() : defaults.minute;
+                       tp_inst.second = date ? date.getSeconds() : defaults.second;
+                       tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
+
+                       //check if within min/max times.. 
+                       tp_inst._limitMinMaxDateTime(inst, true);
+
+                       tp_inst._onTimeChange();
+                       tp_inst._updateDateTime(inst);
+               }
+       };
+
+       /*
+       * Create new public method to set only time, callable as $().datepicker('setTime', date)
+       */
+       $.datepicker._setTimeDatepicker = function(target, date, withDate) {
+               var inst = this._getInst(target);
+               if (!inst) {
+                       return;
+               }
+
+               var tp_inst = this._get(inst, 'timepicker');
+
+               if (tp_inst) {
+                       this._setDateFromField(inst);
+                       var tp_date;
+                       if (date) {
+                               if (typeof date == "string") {
+                                       tp_inst._parseTime(date, withDate);
+                                       tp_date = new Date();
+                                       tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
+                               } else {
+                                       tp_date = new Date(date.getTime());
+                               }
+                               if (tp_date.toString() == 'Invalid Date') {
+                                       tp_date = undefined;
+                               }
+                               this._setTime(inst, tp_date);
+                       }
+               }
+
+       };
+
+       /*
+       * override setDate() to allow setting time too within Date object
+       */
+       $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
+       $.datepicker._setDateDatepicker = function(target, date) {
+               var inst = this._getInst(target);
+               if (!inst) {
+                       return;
+               }
+
+               var tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
+
+               this._updateDatepicker(inst);
+               this._base_setDateDatepicker.apply(this, arguments);
+               this._setTimeDatepicker(target, tp_date, true);
+       };
+
+       /*
+       * override getDate() to allow getting time too within Date object
+       */
+       $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
+       $.datepicker._getDateDatepicker = function(target, noDefault) {
+               var inst = this._getInst(target);
+               if (!inst) {
+                       return;
+               }
+
+               var tp_inst = this._get(inst, 'timepicker');
+
+               if (tp_inst) {
+                       // if it hasn't yet been defined, grab from field
+                       if(inst.lastVal === undefined){
+                               this._setDateFromField(inst, noDefault);
+                       }
+
+                       var date = this._getDate(inst);
+                       if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) {
+                               date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
+                       }
+                       return date;
+               }
+               return this._base_getDateDatepicker(target, noDefault);
+       };
+
+       /*
+       * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
+       * An option in datapicker to ignore extra format characters would be nicer.
+       */
+       $.datepicker._base_parseDate = $.datepicker.parseDate;
+       $.datepicker.parseDate = function(format, value, settings) {
+               var date;
+               try {
+                       date = this._base_parseDate(format, value, settings);
+               } catch (err) {
+                       // Hack!  The error message ends with a colon, a space, and
+                       // the "extra" characters.  We rely on that instead of
+                       // attempting to perfectly reproduce the parsing algorithm.
+                       date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
+                       $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
+               }
+               return date;
+       };
+
+       /*
+       * override formatDate to set date with time to the input
+       */
+       $.datepicker._base_formatDate = $.datepicker._formatDate;
+       $.datepicker._formatDate = function(inst, day, month, year) {
+               var tp_inst = this._get(inst, 'timepicker');
+               if (tp_inst) {
+                       tp_inst._updateDateTime(inst);
+                       return tp_inst.$input.val();
+               }
+               return this._base_formatDate(inst);
+       };
+
+       /*
+       * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
+       */
+       $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
+       $.datepicker._optionDatepicker = function(target, name, value) {
+               var inst = this._getInst(target),
+               name_clone;
+               if (!inst) {
+                       return null;
+               }
+
+               var tp_inst = this._get(inst, 'timepicker');
+               if (tp_inst) {
+                       var min = null,
+                               max = null,
+                               onselect = null,
+                               overrides = tp_inst._defaults.evnts,
+                               fns = {},
+                               prop;
+                   if (typeof name == 'string') { // if min/max was set with the string
+                       if (name === 'minDate' || name === 'minDateTime') {
+                           min = value;
+                       } else if (name === 'maxDate' || name === 'maxDateTime') {
+                           max = value;
+                       } else if (name === 'onSelect') {
+                           onselect = value;
+                       } else if (overrides.hasOwnProperty(name)) {
+                           if (typeof (value) === 'undefined') {
+                               return overrides[name];
+                           }
+                           fns[name] = value;
+                           name_clone = {}; //empty results in exiting function after overrides updated
+                       }
+                   } else if (typeof name == 'object') { //if min/max was set with the JSON
+                       if (name.minDate) {
+                           min = name.minDate;
+                       } else if (name.minDateTime) {
+                           min = name.minDateTime;
+                       } else if (name.maxDate) {
+                           max = name.maxDate;
+                       } else if (name.maxDateTime) {
+                           max = name.maxDateTime;
+                       }
+                       for (prop in overrides) {
+                           if (overrides.hasOwnProperty(prop) && name[prop]) {
+                               fns[prop] = name[prop];
+                           }
+                       }
+                   }
+                   for (prop in fns) {
+                       if (fns.hasOwnProperty(prop)) {
+                           overrides[prop] = fns[prop];
+                           if (!name_clone) { name_clone = $.extend({}, name);}
+                           delete name_clone[prop];
+                       }
+                   }
+                   if (name_clone && isEmptyObject(name_clone)) { return; }
+                   if (min) { //if min was set
+                       if (min === 0) {
+                           min = new Date();
+                       } else {
+                           min = new Date(min);
+                       }
+                       tp_inst._defaults.minDate = min;
+                       tp_inst._defaults.minDateTime = min;
+                   } else if (max) { //if max was set
+                       if (max === 0) {
+                           max = new Date();
+                       } else {
+                           max = new Date(max);
+                       }
+                       tp_inst._defaults.maxDate = max;
+                       tp_inst._defaults.maxDateTime = max;
+                   } else if (onselect) {
+                       tp_inst._defaults.onSelect = onselect;
+                   }
+               }
+               if (value === undefined) {
+                       return this._base_optionDatepicker.call($.datepicker, target, name);
+               }
+               return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
+       };
+       /*
+       * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
+       * it will return false for all objects
+       */
+       var isEmptyObject = function(obj) {
+               var prop;
+               for (prop in obj) {
+                       if (obj.hasOwnProperty(obj)) {
+                               return false;
+                       }
+               }
+               return true;
+       };
+
+       /*
+       * jQuery extend now ignores nulls!
+       */
+       var extendRemove = function(target, props) {
+               $.extend(target, props);
+               for (var name in props) {
+                       if (props[name] === null || props[name] === undefined) {
+                               target[name] = props[name];
+                       }
+               }
+               return target;
+       };
+
+       /*
+       * Determine by the time format if should use ampm
+       * Returns true if should use ampm, false if not
+       */
+       var useAmpm = function(timeFormat){
+               return (timeFormat.indexOf('t') !== -1 && timeFormat.indexOf('h') !== -1);
+       };
+
+       /*
+       * Converts 24 hour format into 12 hour
+       * Returns 12 hour without leading 0
+       */
+       var convert24to12 = function(hour) {
+               if (hour > 12) {
+                       hour = hour - 12;
+               }
+
+               if (hour == 0) {
+                       hour = 12;
+               }
+
+               return String(hour);
+       };
+
+       /*
+       * Splits datetime string into date ans time substrings.
+       * Throws exception when date can't be parsed
+       * Returns [dateString, timeString]
+       */
+       var splitDateTime = function(dateFormat, dateTimeString, dateSettings, timeSettings) {
+               try {
+                       // The idea is to get the number separator occurances in datetime and the time format requested (since time has 
+                       // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
+                       var separator = timeSettings && timeSettings.separator ? timeSettings.separator : $.timepicker._defaults.separator,
+                               format = timeSettings && timeSettings.timeFormat ? timeSettings.timeFormat : $.timepicker._defaults.timeFormat,
+                               timeParts = format.split(separator), // how many occurances of separator may be in our format?
+                               timePartsLen = timeParts.length,
+                               allParts = dateTimeString.split(separator),
+                               allPartsLen = allParts.length;
+
+                       if (allPartsLen > 1) {
+                               return [
+                                               allParts.splice(0,allPartsLen-timePartsLen).join(separator),
+                                               allParts.splice(0,timePartsLen).join(separator)
+                                       ];
+                       }
+
+               } catch (err) {
+                       $.timepicker.log('Could not split the date from the time. Please check the following datetimepicker options' +
+                                       "\nthrown error: " + err +
+                                       "\ndateTimeString" + dateTimeString +
+                                       "\ndateFormat = " + dateFormat +
+                                       "\nseparator = " + timeSettings.separator +
+                                       "\ntimeFormat = " + timeSettings.timeFormat);
+
+                       if (err.indexOf(":") >= 0) {
+                               // Hack!  The error message ends with a colon, a space, and
+                               // the "extra" characters.  We rely on that instead of
+                               // attempting to perfectly reproduce the parsing algorithm.
+                               var dateStringLength = dateTimeString.length - (err.length - err.indexOf(':') - 2),
+                                       timeString = dateTimeString.substring(dateStringLength);
+
+                               return [$.trim(dateTimeString.substring(0, dateStringLength)), $.trim(dateTimeString.substring(dateStringLength))];
+
+                       } else {
+                               throw err;
+                       }
+               }
+               return [dateTimeString, ''];
+       };
+
+       /*
+       * Internal function to parse datetime interval
+       * Returns: {date: Date, timeObj: Object}, where
+       *   date - parsed date without time (type Date)
+       *   timeObj = {hour: , minute: , second: , millisec: } - parsed time. Optional
+       */
+       var parseDateTimeInternal = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
+               var date;
+               var splitRes = splitDateTime(dateFormat, dateTimeString, dateSettings, timeSettings);
+               date = $.datepicker._base_parseDate(dateFormat, splitRes[0], dateSettings);
+               if (splitRes[1] !== '') {
+                       var timeString = splitRes[1],
+                               parsedTime = $.datepicker.parseTime(timeFormat, timeString, timeSettings);
+
+                       if (parsedTime === null) {
+                               throw 'Wrong time format';
+                       }
+                       return {
+                               date: date,
+                               timeObj: parsedTime
+                       };
+               } else {
+                       return {
+                               date: date
+                       };
+               }
+       };
+
+       /*
+       * Internal function to set timezone_select to the local timezone
+       */
+       var selectLocalTimeZone = function(tp_inst, date) {
+               if (tp_inst && tp_inst.timezone_select) {
+                       tp_inst._defaults.useLocalTimezone = true;
+                       var now = typeof date !== 'undefined' ? date : new Date();
+                       var tzoffset = $.timepicker.timeZoneOffsetString(now);
+                       if (tp_inst._defaults.timezoneIso8601) {
+                               tzoffset = tzoffset.substring(0, 3) + ':' + tzoffset.substring(3);
+                       }
+                       tp_inst.timezone_select.val(tzoffset);
+               }
+       };
+
+       /*
+       * Create a Singleton Insance
+       */
+       $.timepicker = new Timepicker();
+
+       /**
+        * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
+        * @param  date
+        * @return string
+        */
+       $.timepicker.timeZoneOffsetString = function(date) {
+               var off = date.getTimezoneOffset() * -1,
+                       minutes = off % 60,
+                       hours = (off - minutes) / 60;
+               return (off >= 0 ? '+' : '-') + ('0' + (hours * 101).toString()).slice(-2) + ('0' + (minutes * 101).toString()).slice(-2);
+       };
+
+       /**
+        * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
+        * enforce date range limits.
+        * n.b. The input value must be correctly formatted (reformatting is not supported)
+        * @param  Element startTime
+        * @param  Element endTime
+        * @param  obj options Options for the timepicker() call
+        * @return jQuery
+        */
+       $.timepicker.timeRange = function(startTime, endTime, options) {
+               return $.timepicker.handleRange('timepicker', startTime, endTime, options);
+       };
+
+       /**
+        * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
+        * enforce date range limits.
+        * @param  Element startTime
+        * @param  Element endTime
+        * @param  obj options Options for the `timepicker()` call. Also supports `reformat`,
+        *   a boolean value that can be used to reformat the input values to the `dateFormat`.
+        * @param  string method Can be used to specify the type of picker to be added
+        * @return jQuery
+        */
+       $.timepicker.dateTimeRange = function(startTime, endTime, options) {
+               $.timepicker.dateRange(startTime, endTime, options, 'datetimepicker');
+       };
+
+       /**
+        * Calls `method` on the `startTime` and `endTime` elements, and configures them to
+        * enforce date range limits.
+        * @param  Element startTime
+        * @param  Element endTime
+        * @param  obj options Options for the `timepicker()` call. Also supports `reformat`,
+        *   a boolean value that can be used to reformat the input values to the `dateFormat`.
+        * @param  string method Can be used to specify the type of picker to be added
+        * @return jQuery
+        */
+       $.timepicker.dateRange = function(startTime, endTime, options, method) {
+               method = method || 'datepicker';
+               $.timepicker.handleRange(method, startTime, endTime, options);
+       };
+
+       /**
+        * Calls `method` on the `startTime` and `endTime` elements, and configures them to
+        * enforce date range limits.
+        * @param  string method Can be used to specify the type of picker to be added
+        * @param  Element startTime
+        * @param  Element endTime
+        * @param  obj options Options for the `timepicker()` call. Also supports `reformat`,
+        *   a boolean value that can be used to reformat the input values to the `dateFormat`.
+        * @return jQuery
+        */
+       $.timepicker.handleRange = function(method, startTime, endTime, options) {
+               $.fn[method].call(startTime, $.extend({
+                       onClose: function(dateText, inst) {
+                               checkDates(this, endTime, dateText);
+                       },
+                       onSelect: function(selectedDateTime) {
+                               selected(this, endTime, 'minDate');
+                       }
+               }, options, options.start));
+               $.fn[method].call(endTime, $.extend({
+                       onClose: function(dateText, inst) {
+                               checkDates(this, startTime, dateText);
+                       },
+                       onSelect: function(selectedDateTime) {
+                               selected(this, startTime, 'maxDate');
+                       }
+               }, options, options.end));
+               // timepicker doesn't provide access to its 'timeFormat' option, 
+               // nor could I get datepicker.formatTime() to behave with times, so I
+               // have disabled reformatting for timepicker
+               if (method != 'timepicker' && options.reformat) {
+                       $([startTime, endTime]).each(function() {
+                               var format = $(this)[method].call($(this), 'option', 'dateFormat'),
+                                       date = new Date($(this).val());
+                               if ($(this).val() && date) {
+                                       $(this).val($.datepicker.formatDate(format, date));
+                               }
+                       });
+               }
+               checkDates(startTime, endTime, startTime.val());
+
+               function checkDates(changed, other, dateText) {
+                       if (other.val() && (new Date(startTime.val()) > new Date(endTime.val()))) {
+                               other.val(dateText);
+                       }
+               }
+               selected(startTime, endTime, 'minDate');
+               selected(endTime, startTime, 'maxDate');
+
+               function selected(changed, other, option) {
+                       if (!$(changed).val()) {
+                               return;
+                       }
+                       var date = $(changed)[method].call($(changed), 'getDate');
+                       // timepicker doesn't implement 'getDate' and returns a jQuery
+                       if (date.getTime) {
+                               $(other)[method].call($(other), 'option', option, date);
+                       }
+               }
+               return $([startTime.get(0), endTime.get(0)]);
+       };
+
+       /**
+        * Log error or data to the console during error or debugging
+        * @param  Object err pass any type object to log to the console during error or debugging
+        * @return void
+        */
+       $.timepicker.log = function(err){
+               if(window.console)
+                       console.log(err);
+       };
+
+       /*
+       * Keep up with the version
+       */
+       $.timepicker.version = "1.2";
+
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-af.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-af.js
new file mode 100644 (file)
index 0000000..6a6353e
--- /dev/null
@@ -0,0 +1,20 @@
+/* Afrikaans translation for the jQuery Timepicker Addon */\r
+/* Written by Deon Heyns */\r
+(function($) {\r
+       $.timepicker.regional['af'] = {\r
+               timeOnlyTitle: 'Kies Tyd',\r
+               timeText: 'Tyd ',\r
+               hourText: 'Ure ',\r
+               minuteText: 'Minute',\r
+               secondText: 'Sekondes',\r
+               millisecText: 'Millisekondes',\r
+               timezoneText: 'Tydsone',\r
+               currentText: 'Huidige Tyd',\r
+               closeText: 'Klaar',\r
+               timeFormat: 'HH:mm',\r
+               amNames: ['AM', 'A'],\r
+               pmNames: ['PM', 'P'],\r
+               isRTL: false\r
+       };\r
+       $.timepicker.setDefaults($.timepicker.regional['af']);\r
+})(jQuery);\r
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-bg.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-bg.js
new file mode 100644 (file)
index 0000000..ffc0cea
--- /dev/null
@@ -0,0 +1,20 @@
+/* Bulgarian translation for the jQuery Timepicker Addon */
+/* Written by Plamen Kovandjiev */
+(function($) {
+       $.timepicker.regional['bg'] = {
+               timeOnlyTitle: 'Изберете време',
+               timeText: 'Време',
+               hourText: 'Час',
+               minuteText: 'Минути',
+               secondText: 'Секунди',
+               millisecText: 'Милисекунди',
+               timezoneText: 'Часови пояс',
+               currentText: 'Сега',
+               closeText: 'Затвори',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['bg']);
+})(jQuery);
\ No newline at end of file
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ca.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ca.js
new file mode 100644 (file)
index 0000000..e3c771d
--- /dev/null
@@ -0,0 +1,20 @@
+/* Catalan translation for the jQuery Timepicker Addon */
+/* Written by Sergi Faber */
+(function($) {
+       $.timepicker.regional['ca'] = {
+               timeOnlyTitle: 'Escollir una hora',
+               timeText: 'Hora',
+               hourText: 'Hores',
+               minuteText: 'Minuts',
+               secondText: 'Segons',
+               millisecText: 'Milisegons',
+               timezoneText: 'Fus horari',
+               currentText: 'Ara',
+               closeText: 'Tancar',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['ca']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-cs.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-cs.js
new file mode 100644 (file)
index 0000000..814dd94
--- /dev/null
@@ -0,0 +1,20 @@
+/* Czech translation for the jQuery Timepicker Addon */
+/* Written by Ondřej Vodáček */
+(function($) {
+       $.timepicker.regional['cs'] = {
+               timeOnlyTitle: 'Vyberte čas',
+               timeText: 'Čas',
+               hourText: 'Hodiny',
+               minuteText: 'Minuty',
+               secondText: 'Vteřiny',
+               millisecText: 'Milisekundy',
+               timezoneText: 'Časové pásmo',
+               currentText: 'Nyní',
+               closeText: 'Zavřít',
+               timeFormat: 'HH:mm',
+               amNames: ['dop.', 'AM', 'A'],
+               pmNames: ['odp.', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['cs']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-de.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-de.js
new file mode 100644 (file)
index 0000000..1a998a0
--- /dev/null
@@ -0,0 +1,20 @@
+/* German translation for the jQuery Timepicker Addon */
+/* Written by Marvin */
+(function($) {
+       $.timepicker.regional['de'] = {
+               timeOnlyTitle: 'Zeit Wählen',
+               timeText: 'Zeit',
+               hourText: 'Stunde',
+               minuteText: 'Minute',
+               secondText: 'Sekunde',
+               millisecText: 'Millisekunde',
+               timezoneText: 'Zeitzone',
+               currentText: 'Jetzt',
+               closeText: 'Fertig',
+               timeFormat: 'HH:mm',
+               amNames: ['vorm.', 'AM', 'A'],
+               pmNames: ['nachm.', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['de']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-el.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-el.js
new file mode 100644 (file)
index 0000000..9109afd
--- /dev/null
@@ -0,0 +1,20 @@
+/* Hellenic translation for the jQuery Timepicker Addon */
+/* Written by Christos Pontikis */
+(function($) {
+       $.timepicker.regional['el'] = {
+               timeOnlyTitle: 'Επιλογή ώρας',
+               timeText: 'Ώρα',
+               hourText: 'Ώρες',
+               minuteText: 'Λεπτά',
+               secondText: 'Δευτερόλεπτα',
+               millisecText: 'μιλιδευτερόλεπτο',
+               timezoneText: 'Ζώνη ώρας',
+               currentText: 'Τώρα',
+               closeText: 'Κλείσιμο',
+               timeFormat: 'HH:mm',
+               amNames: ['π.μ.', 'AM', 'A'],
+               pmNames: ['μ.μ.', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['el']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-es.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-es.js
new file mode 100644 (file)
index 0000000..c446c1c
--- /dev/null
@@ -0,0 +1,20 @@
+/* Spanish translation for the jQuery Timepicker Addon */
+/* Written by Ianaré Sévi */
+(function($) {
+       $.timepicker.regional['es'] = {
+               timeOnlyTitle: 'Elegir una hora',
+               timeText: 'Hora',
+               hourText: 'Horas',
+               minuteText: 'Minutos',
+               secondText: 'Segundos',
+               millisecText: 'Milisegundos',
+               timezoneText: 'Huso horario',
+               currentText: 'Ahora',
+               closeText: 'Cerrar',
+               timeFormat: 'HH:mm',
+               amNames: ['a.m.', 'AM', 'A'],
+               pmNames: ['p.m.', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['es']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-et.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-et.js
new file mode 100644 (file)
index 0000000..a3a4f10
--- /dev/null
@@ -0,0 +1,20 @@
+/* Estonian translation for the jQuery Timepicker Addon */
+/* Written by Karl Sutt (karl@sutt.ee) */
+(function($) {
+       $.timepicker.regional['et'] = {
+               timeOnlyTitle: 'Vali aeg',
+               timeText: 'Aeg',
+               hourText: 'Tund',
+               minuteText: 'Minut',
+               secondText: 'Sekund',
+               millisecText: 'Millisekundis',
+               timezoneText: 'Ajavöönd',
+               currentText: 'Praegu',
+               closeText: 'Valmis',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['et']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-eu.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-eu.js
new file mode 100644 (file)
index 0000000..7b1c510
--- /dev/null
@@ -0,0 +1,20 @@
+/* Basque trannslation for JQuery Timepicker Addon
+/* Translated by Xabi Fer */
+(function($) {
+       $.timepicker.regional['eu'] = {
+               timeOnlyTitle: 'Aukeratu ordua',
+               timeText: 'Ordua',
+               hourText: 'Orduak',
+               minuteText: 'Minutuak',
+               secondText: 'Segunduak',
+               millisecText: 'Milisegunduak',
+               timezoneText: 'Ordu-eremua',
+               currentText: 'Orain',
+               closeText: 'Itxi',
+               timeFormat: 'HH:mm',
+               amNames: ['a.m.', 'AM', 'A'],
+               pmNames: ['p.m.', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['eu']);
+})(jQuery);
\ No newline at end of file
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-fi.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-fi.js
new file mode 100644 (file)
index 0000000..12be648
--- /dev/null
@@ -0,0 +1,20 @@
+/* Finnish translation for the jQuery Timepicker Addon */
+/* Written by Juga Paazmaya (http://github.com/paazmaya) */
+(function($) {
+       $.timepicker.regional['fi'] = {
+               timeOnlyTitle: 'Valitse aika',
+               timeText: 'Aika',
+               hourText: 'Tunti',
+               minuteText: 'Minuutti',
+               secondText: 'Sekunti',
+               millisecText: 'Millisekunnin',
+               timezoneText: 'Aikavyöhyke',
+               currentText: 'Nyt',
+               closeText: 'Sulje',
+               timeFormat: 'HH:mm',
+               amNames: ['ap.', 'AM', 'A'],
+               pmNames: ['ip.', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['fi']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-fr.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-fr.js
new file mode 100644 (file)
index 0000000..805b72d
--- /dev/null
@@ -0,0 +1,20 @@
+/* French translation for the jQuery Timepicker Addon */
+/* Written by Thomas Lété */
+(function($) {
+       $.timepicker.regional['fr'] = {
+               timeOnlyTitle: 'Choisir une heure',
+               timeText: 'Heure',
+               hourText: 'Heures',
+               minuteText: 'Minutes',
+               secondText: 'Secondes',
+               millisecText: 'Millisecondes',
+               timezoneText: 'Fuseau horaire',
+               currentText: 'Maintenant',
+               closeText: 'Terminé',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['fr']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-gl.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-gl.js
new file mode 100644 (file)
index 0000000..4ed889b
--- /dev/null
@@ -0,0 +1,20 @@
+/* Galician translation for the jQuery Timepicker Addon */
+/* Written by David Barral */
+(function($) {
+       $.timepicker.regional['gl'] = {
+               timeOnlyTitle: 'Elixir unha hora',
+               timeText: 'Hora',
+               hourText: 'Horas',
+               minuteText: 'Minutos',
+               secondText: 'Segundos',
+               millisecText: 'Milisegundos',
+               timezoneText: 'Fuso horario',
+               currentText: 'Agora',
+               closeText: 'Pechar',
+               timeFormat: 'HH:mm',
+               amNames: ['a.m.', 'AM', 'A'],
+               pmNames: ['p.m.', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['gl']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-he.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-he.js
new file mode 100644 (file)
index 0000000..a887fbb
--- /dev/null
@@ -0,0 +1,20 @@
+/* Hebrew translation for the jQuery Timepicker Addon */
+/* Written by Lior Lapid */
+(function($) {
+       $.timepicker.regional["he"] = {
+               timeOnlyTitle: "בחירת זמן",
+               timeText: "שעה",
+               hourText: "שעות",
+               minuteText: "דקות",
+               secondText: "שניות",
+               millisecText: "אלפית השנייה",
+               timezoneText: "אזור זמן",
+               currentText: "עכשיו",
+               closeText:"סגור",
+               timeFormat: "HH:mm",
+               amNames: ['לפנה"צ', 'AM', 'A'],
+               pmNames: ['אחה"צ', 'PM', 'P'],
+               isRTL: true
+       };
+       $.timepicker.setDefaults($.timepicker.regional["he"]);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-hu.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-hu.js
new file mode 100644 (file)
index 0000000..1adb8a9
--- /dev/null
@@ -0,0 +1,20 @@
+/* Hungarian translation for the jQuery Timepicker Addon */
+/* Written by Vas Gábor */
+(function($) {
+       $.timepicker.regional['hu'] = {
+               timeOnlyTitle: 'Válasszon időpontot',
+               timeText: 'Idő',
+               hourText: 'Óra',
+               minuteText: 'Perc',
+               secondText: 'Másodperc',
+               millisecText: 'Milliszekundumos',
+               timezoneText: 'Időzóna',
+               currentText: 'Most',
+               closeText: 'Kész',
+               timeFormat: 'HH:mm',
+               amNames: ['de.', 'AM', 'A'],
+               pmNames: ['du.', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['hu']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-id.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-id.js
new file mode 100644 (file)
index 0000000..6c0e858
--- /dev/null
@@ -0,0 +1,20 @@
+/* Indonesian translation for the jQuery Timepicker Addon */
+/* Written by Nia */
+(function($) {
+       $.timepicker.regional['id'] = {
+               timeOnlyTitle: 'Pilih Waktu',
+               timeText: 'Waktu',
+               hourText: 'Pukul',
+               minuteText: 'Menit',
+               secondText: 'Detik',
+               millisecText: 'Milidetik',
+               timezoneText: 'Zona Waktu',
+               currentText: 'Sekarang',
+               closeText: 'OK',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['id']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-it.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-it.js
new file mode 100644 (file)
index 0000000..70124fd
--- /dev/null
@@ -0,0 +1,20 @@
+/* Italian translation for the jQuery Timepicker Addon */
+/* Written by Marco "logicoder" Del Tongo */
+(function($) {
+    $.timepicker.regional['it'] = {
+        timeOnlyTitle: 'Scegli orario',
+        timeText: 'Orario',
+        hourText: 'Ora',
+        minuteText: 'Minuto',
+        secondText: 'Secondo',
+        millisecText: 'Millisecondo',
+        timezoneText: 'Fuso orario',
+        currentText: 'Adesso',
+        closeText: 'Chiudi',
+        timeFormat: 'HH:mm',
+        amNames: ['m.', 'AM', 'A'],
+        pmNames: ['p.', 'PM', 'P'],
+        isRTL: false
+    };
+    $.timepicker.setDefaults($.timepicker.regional['it']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ja.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ja.js
new file mode 100644 (file)
index 0000000..42d8114
--- /dev/null
@@ -0,0 +1,20 @@
+/* Japanese translation for the jQuery Timepicker Addon */
+/* Written by Jun Omae */
+(function($) {
+       $.timepicker.regional['ja'] = {
+               timeOnlyTitle: '時間を選択',
+               timeText: '時間',
+               hourText: '時',
+               minuteText: '分',
+               secondText: '秒',
+               millisecText: 'ミリ秒',
+               timezoneText: 'タイムゾーン',
+               currentText: '現時刻',
+               closeText: '閉じる',
+               timeFormat: 'HH:mm',
+               amNames: ['午前', 'AM', 'A'],
+               pmNames: ['午後', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['ja']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ko.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ko.js
new file mode 100644 (file)
index 0000000..7fe6c47
--- /dev/null
@@ -0,0 +1,20 @@
+/* Korean translation for the jQuery Timepicker Addon */
+/* Written by Genie */
+(function($) {
+       $.timepicker.regional['ko'] = {
+               timeOnlyTitle: '시간 선택',
+               timeText: '시간',
+               hourText: '시',
+               minuteText: '분',
+               secondText: '초',
+               millisecText: '밀리초',
+               timezoneText: '표준 시간대',
+               currentText: '현재 시각',
+               closeText: '닫기',
+               timeFormat: 'tt h:mm',
+               amNames: ['오전', 'AM', 'A'],
+               pmNames: ['오후', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['ko']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-lt.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-lt.js
new file mode 100644 (file)
index 0000000..4ec3eeb
--- /dev/null
@@ -0,0 +1,20 @@
+/* Lithuanian translation for the jQuery Timepicker Addon */
+/* Written by Irmantas Šiupšinskas */
+(function($) {
+       $.timepicker.regional['lt'] = {
+               timeOnlyTitle: 'Pasirinkite laiką',
+               timeText: 'Laikas',
+               hourText: 'Valandos',
+               minuteText: 'Minutės',
+               secondText: 'Sekundės',
+               millisecText: 'Milisekundės',
+               timezoneText: 'Laiko zona',
+               currentText: 'Dabar',
+               closeText: 'Uždaryti',
+               timeFormat: 'HH:mm',
+               amNames: ['priešpiet', 'AM', 'A'],
+               pmNames: ['popiet', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['lt']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-nl.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-nl.js
new file mode 100644 (file)
index 0000000..eff496c
--- /dev/null
@@ -0,0 +1,20 @@
+/* Dutch translation for the jQuery Timepicker Addon */
+/* Written by Martijn van der Lee */
+(function($) {
+       $.timepicker.regional['nl'] = {
+               timeOnlyTitle: 'Tijdstip',
+               timeText: 'Tijd',
+               hourText: 'Uur',
+               minuteText: 'Minuut',
+               secondText: 'Seconde',
+               millisecText: 'Milliseconde',
+               timezoneText: 'Tijdzone',
+               currentText: 'Vandaag',
+               closeText: 'Sluiten',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['nl']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-no.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-no.js
new file mode 100644 (file)
index 0000000..8da6a1d
--- /dev/null
@@ -0,0 +1,20 @@
+/* Norwegian translation for the jQuery Timepicker Addon */
+/* Written by Morten Hauan (http://hauan.me) */
+(function($) {
+       $.timepicker.regional['no'] = {
+               timeOnlyTitle: 'Velg tid',
+               timeText: 'Tid',
+               hourText: 'Time',
+               minuteText: 'Minutt',
+               secondText: 'Sekund',
+               millisecText: 'Millisekund',
+               timezoneText: 'Tidssone',
+               currentText: 'Nå',
+               closeText: 'Lukk',
+               timeFormat: 'HH:mm',
+               amNames: ['am', 'AM', 'A'],
+               pmNames: ['pm', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['no']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-pl.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-pl.js
new file mode 100644 (file)
index 0000000..138b7d3
--- /dev/null
@@ -0,0 +1,20 @@
+/* Polish translation for the jQuery Timepicker Addon */
+/* Written by Michał Pena */
+(function($) {
+       $.timepicker.regional['pl'] = {
+               timeOnlyTitle: 'Wybierz godzinę',
+               timeText: 'Czas',
+               hourText: 'Godzina',
+               minuteText: 'Minuta',
+               secondText: 'Sekunda',
+               millisecText: 'Milisekunda',
+               timezoneText: 'Strefa czasowa',
+               currentText: 'Teraz',
+               closeText: 'Gotowe',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['pl']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-pt-BR.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-pt-BR.js
new file mode 100644 (file)
index 0000000..cd9ee12
--- /dev/null
@@ -0,0 +1,20 @@
+/* Brazilian Portuguese translation for the jQuery Timepicker Addon */
+/* Written by Diogo Damiani (diogodamiani@gmail.com) */
+(function ($) {
+       $.timepicker.regional['pt-BR'] = {
+               timeOnlyTitle: 'Escolha a horário',
+               timeText: 'Horário',
+               hourText: 'Hora',
+               minuteText: 'Minutos',
+               secondText: 'Segundos',
+               millisecText: 'Milissegundos',
+               timezoneText: 'Fuso horário',
+               currentText: 'Agora',
+               closeText: 'Fechar',
+               timeFormat: 'HH:mm',
+               amNames: ['a.m.', 'AM', 'A'],
+               pmNames: ['p.m.', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['pt-BR']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-pt.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-pt.js
new file mode 100644 (file)
index 0000000..029926a
--- /dev/null
@@ -0,0 +1,20 @@
+/* Portuguese translation for the jQuery Timepicker Addon */
+/* Written by Luan Almeida */
+(function($) {
+       $.timepicker.regional['pt'] = {
+               timeOnlyTitle: 'Escolha uma hora',
+               timeText: 'Hora',
+               hourText: 'Horas',
+               minuteText: 'Minutos',
+               secondText: 'Segundos',
+               millisecText: 'Milissegundos',
+               timezoneText: 'Fuso horário',
+               currentText: 'Agora',
+               closeText: 'Fechar',
+               timeFormat: 'HH:mm',
+               amNames: ['a.m.', 'AM', 'A'],
+               pmNames: ['p.m.', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['pt']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ro.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ro.js
new file mode 100644 (file)
index 0000000..2b80a02
--- /dev/null
@@ -0,0 +1,20 @@
+/* Romanian translation for the jQuery Timepicker Addon */
+/* Written by Romeo Adrian Cioaba */
+(function($) {
+       $.timepicker.regional['ro'] = {
+               timeOnlyTitle: 'Alegeţi o oră',
+               timeText: 'Timp',
+               hourText: 'Ore',
+               minuteText: 'Minute',
+               secondText: 'Secunde',
+               millisecText: 'Milisecunde',
+               timezoneText: 'Fus orar',
+               currentText: 'Acum',
+               closeText: 'Închide',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['ro']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ru.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-ru.js
new file mode 100644 (file)
index 0000000..71ea9d5
--- /dev/null
@@ -0,0 +1,20 @@
+/* Russian translation for the jQuery Timepicker Addon */
+/* Written by Trent Richardson */
+(function($) {
+       $.timepicker.regional['ru'] = {
+               timeOnlyTitle: 'Выберите время',
+               timeText: 'Время',
+               hourText: 'Часы',
+               minuteText: 'Минуты',
+               secondText: 'Секунды',
+               millisecText: 'Миллисекунды',
+               timezoneText: 'Часовой пояс',
+               currentText: 'Сейчас',
+               closeText: 'Закрыть',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['ru']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-sk.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-sk.js
new file mode 100644 (file)
index 0000000..4b4042b
--- /dev/null
@@ -0,0 +1,20 @@
+/* Slovak translation for the jQuery Timepicker Addon */
+/* Written by David Vallner */
+(function($) {
+       $.timepicker.regional['sk'] = {
+               timeOnlyTitle: 'Zvoľte čas',
+               timeText: 'Čas',
+               hourText: 'Hodiny',
+               minuteText: 'Minúty',
+               secondText: 'Sekundy',
+               millisecText: 'Milisekundy',
+               timezoneText: 'Časové pásmo',
+               currentText: 'Teraz',
+               closeText: 'Zavrieť',
+               timeFormat: 'H:m',
+               amNames: ['dop.', 'AM', 'A'],
+               pmNames: ['pop.', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['sk']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-sv.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-sv.js
new file mode 100644 (file)
index 0000000..167d2f6
--- /dev/null
@@ -0,0 +1,20 @@
+/* Swedish translation for the jQuery Timepicker Addon */
+/* Written by Nevon */
+(function($) {
+       $.timepicker.regional['sv'] = {
+               timeOnlyTitle: 'Välj en tid',
+               timeText: 'Timme',
+               hourText: 'Timmar',
+               minuteText: 'Minuter',
+               secondText: 'Sekunder',
+               millisecText: 'Millisekunder',
+               timezoneText: 'Tidszon',
+               currentText: 'Nu',
+               closeText: 'Stäng',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['sv']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-th.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-th.js
new file mode 100644 (file)
index 0000000..5d2d561
--- /dev/null
@@ -0,0 +1,17 @@
+/* Thai translation for the jQuery Timepicker Addon */
+/* Written by Yote Wachirapornpongsa */
+(function($) {
+       $.timepicker.regional['th'] = {
+               timeOnlyTitle: 'เลือกเวลา',
+               timeText: 'เวลา ',
+               hourText: 'ชั่วโมง ',
+               minuteText: 'นาที',
+               secondText: 'วินาที',
+               millisecText: 'มิลลิวินาที',
+               timezoneText: 'เขตเวลา',
+               currentText: 'เวลาปัจจุบัน',
+               closeText: 'ปิด',
+               timeFormat: 'hh:mm tt'
+       };
+       $.timepicker.setDefaults($.timepicker.regional['th']);
+})(jQuery);
\ No newline at end of file
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-tr.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-tr.js
new file mode 100644 (file)
index 0000000..dcbf96d
--- /dev/null
@@ -0,0 +1,20 @@
+/* Turkish translation for the jQuery Timepicker Addon */
+/* Written by Fehmi Can Saglam, Edited by Goktug Ozturk */
+(function($) {
+       $.timepicker.regional['tr'] = {
+               timeOnlyTitle: 'Zaman Seçiniz',
+               timeText: 'Zaman',
+               hourText: 'Saat',
+               minuteText: 'Dakika',
+               secondText: 'Saniye',
+               millisecText: 'Milisaniye',
+               timezoneText: 'Zaman Dilimi',
+               currentText: 'Şu an',
+               closeText: 'Tamam',
+               timeFormat: 'HH:mm',
+               amNames: ['ÖÖ', 'Ö'],
+               pmNames: ['ÖS', 'S'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['tr']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-uk.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-uk.js
new file mode 100644 (file)
index 0000000..badcbbd
--- /dev/null
@@ -0,0 +1,20 @@
+/* Ukrainian translation for the jQuery Timepicker Addon */
+/* Written by Sergey Noskov */
+(function($) {
+       $.timepicker.regional['uk'] = {
+               timeOnlyTitle: 'Виберіть час',
+               timeText: 'Час',
+               hourText: 'Години',
+               minuteText: 'Хвилини',
+               secondText: 'Секунди',
+               millisecText: 'Мілісекунди',
+               timezoneText: 'Часовий пояс',
+               currentText: 'Зараз',
+               closeText: 'Закрити',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['uk']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-vi.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-vi.js
new file mode 100644 (file)
index 0000000..93e6bfc
--- /dev/null
@@ -0,0 +1,20 @@
+/* Vietnamese translation for the jQuery Timepicker Addon */
+/* Written by Nguyen Dinh Trung */
+(function($) {
+       $.timepicker.regional['vi'] = {
+               timeOnlyTitle: 'Chọn giờ',
+               timeText: 'Thời gian',
+               hourText: 'Giờ',
+               minuteText: 'Phút',
+               secondText: 'Giây',
+               millisecText: 'Phần nghìn giây',
+               timezoneText: 'Múi giờ',
+               currentText: 'Hiện thời',
+               closeText: 'Đóng',
+               timeFormat: 'H:m',
+               amNames: ['SA', 'AM', 'A'],
+               pmNames: ['CH', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['vi']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-zh-CN.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-zh-CN.js
new file mode 100644 (file)
index 0000000..16ca718
--- /dev/null
@@ -0,0 +1,20 @@
+/* Simplified Chinese translation for the jQuery Timepicker Addon /
+/ Written by Will Lu */
+(function($) {
+       $.timepicker.regional['zh-CN'] = {
+               timeOnlyTitle: '选择时间',
+               timeText: '时间',
+               hourText: '小时',
+               minuteText: '分钟',
+               secondText: '秒钟',
+               millisecText: '微秒',
+               timezoneText: '时区',
+               currentText: '现在时间',
+               closeText: '关闭',
+               timeFormat: 'HH:mm',
+               amNames: ['AM', 'A'],
+               pmNames: ['PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['zh-CN']);
+})(jQuery);
diff --git a/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-zh-TW.js b/third-party/timepicker-addon-1.2/localization/jquery-ui-timepicker-zh-TW.js
new file mode 100644 (file)
index 0000000..ff1ccad
--- /dev/null
@@ -0,0 +1,20 @@
+/* Chinese translation for the jQuery Timepicker Addon */
+/* Written by Alang.lin */
+(function($) {
+       $.timepicker.regional['zh-TW'] = {
+               timeOnlyTitle: '選擇時分秒',
+               timeText: '時間',
+               hourText: '時',
+               minuteText: '分',
+               secondText: '秒',
+               millisecText: '毫秒',
+               timezoneText: '時區',
+               currentText: '現在時間',
+               closeText: '確定',
+               timeFormat: 'HH:mm',
+               amNames: ['上午', 'AM', 'A'],
+               pmNames: ['下午', 'PM', 'P'],
+               isRTL: false
+       };
+       $.timepicker.setDefaults($.timepicker.regional['zh-TW']);
+})(jQuery);