+
+/**
+ * function: $.fn.formValues
+ * usage: $('#frmLogin').formValues()
+ * docs: Gets form values and creates a key=>value array of the found values (for ENABLED elements!)
+ */
+$.fn.formValues = function() {
+ var a = [];
+ $("input,textarea,option",this).filter(":enabled").each(function(){
+ // Skip selects with options which are not selected
+ if ((this.parentNode.type == 'select-one' || this.parentNode.type == 'select-multiple') && !this.selected) {
+ return null;
+ }
+
+ // Skip radio and checkbox elements which are not checked
+ if ((this.type == 'radio' || this.type == 'checkbox') && !this.checked) {
+ return null;
+ }
+
+ // All other elements are valid
+ a.push({
+ name: this.name || this.id || this.parentNode.name || this.parentNode.id,
+ value: this.value
+ });
+ });
+ return a;
+};
+
+/**
+ * function: $.update
+ * usage: $.update('someJQueryObject', 'someurl', 'array');
+ * docs: Mimics the ajaxUpdater from prototype. Posts the key=>value array to the url and
+ * puts the results from that call in the jQuery object specified.
+ * --> If you set the blnNoEval to true, the script tags are NOT evaluated.
+ */
+$.update = function(objElement, strURL, arrValues, fncCallback) {
+ $.post(strURL, arrValues, function(strHTML) {
+ // Update the element with the new HTML
+ objElement.html(strHTML);
+
+ // Evaluate the scripts
+ objElement.html(strHTML).find("script").each(function(){
+ try {
+ $.eval( this.text || this.textContent || this.innerHTML );
+ } catch(e) { }
+ });
+
+ // Callback handler
+ if (fncCallback) { fncCallback(); }
+ });
+};