    jQuery(function() {
        // handle buttons that only appear independently.
      jQuery('div.styled input[type=button]').each(function() {
              var el = jQuery(this);
              var newLink = jQuery('<a/>'); // create a new link

              newLink.addClass('button'); // make this link a button
              newLink.addClass(el.attr('class')); // add the original form element's classes

              newLink.html('<em>' + el.val() + '</em>'); // insert the input's value into our link
              if (el.parents('a').length != 0) {
                  if (el.parents("a").attr('href') != undefined) {
                      newLink.attr('href', el.parents("a").attr('href'));
                  } else {
                      newLink.attr('href', '#');
                  }
              } else {
                  newLink.attr('href', '#');
              }
              newLink.attr('rel',el.attr('name')); // store the name of the input
              if (newLink.attr('href') == '#') {
                  newLink.bind('click',function(e) {
                      //don't do anything - this lets the change of state take place.
                      return false;
                  });
              }
              newLink.bind('mouseup',function(e) {
                      this.blur();
                      return false;
                  });
              // we need to insert the hidden form field for this to modify later
              /*
              el.prepend('<input type="hidden" id="'+el.attr('id')+'" name="'+el.attr('name')+'" value=" " />');
              */
              if (el.parents('a').length != 0) {
                  el.parents('a').replaceWith(newLink);
              } else {
                  el.replaceWith(newLink);
              }

          });


        // add these styles to <input> tags instead
            jQuery('form.styled input[type=submit],form.styled input[type=button]').each(function() {
                    var el = jQuery(this);
                    var parentForm = el.parents("form");
                    var newLink = jQuery('<a/>'); // create a new link
                    newLink.addClass('button'); // make this link a button
                    newLink.addClass(el.attr('class')); // add the original form element's classes
                    newLink.html('<em>' + el.val() + '</em>'); // insert the input's value into our link
                    newLink.attr('href','#'); // nullify the href
                    newLink.attr('rel',el.attr('name')); // store the name of the input
                    // we need to insert the hidden form field for this to modify later
                    parentForm.prepend('<input type="hidden" id="'+el.attr('id')+'" name="'+el.attr('name')+'" value=" " />');

                    // add the submit functionality to this link
                    if(el.attr('type') == 'submit') {
                        newLink.bind('click',function(e) {
                                // let's get a reference to our parent form
                                var trigger = jQuery(this);
                                var theForm = trigger.parents("form");
                                // update our hidden form variable with the submit value
                                theForm.find('input#'+trigger.attr('rel')).val(trigger.find('em').html());
                                return false;
                            });
                        newLink.bind('mouseup',function(e) {
                                this.blur();
                                jQuery(this).parents('form').submit(); // submit the parent form
                                return false;
                            });
                    }

                    if(el.attr('type') == 'button') {
                        newLink.bind('click',function(e) {
                                // let's get a reference to our parent form
                                var trigger = jQuery(this);
                                var theForm = trigger.parents("form");
                                // update our hidden form variable with the submit value
                                theForm.find('input#'+trigger.attr('rel')).val(trigger.find('em').html());
                                return false;
                            });
                        //TODO::I'll assume that we need to modify this slightly since the buttons
                        //TODO::might already have functionality bound to them.
                        //TODO::re-bind any bound events to the newLink element
                        newLink.bind('mouseup',function(e) {
                                this.blur();
                                //jQuery(this).parents('form').submit(); // submit the parent form
                                return false;
                            });
                    }
                    el.replaceWith(newLink);
                });

            //this little gem will allow you to hit enter to submit the form
            $('input').keydown(function(e){
                    if (e.keyCode == 13) {
                        $(this).parents('form').submit();
                        return false;
                    }
                });
        });
