$(document).ready(function(){
  // various bits to keep track of
  var $modal = $('<div class="jqmWindow get-satisfaction" id="jq"><div class="modalcontent"><iframe id="fdbk_iframe_inline" allowTransparency="true" frameborder="0" src="http://getsatisfaction.com/theamandaproject/feedback/topics/new?display=inline&amp;style=idea"></iframe></div><a href="#" class="close jqmClose">close</a></div>');
  
  // the parameters
  var jqm_showing = false;
  
  // add the modal
  $('body').append($modal.jqm({
                            modal: false,
                            overlay: 80,
                            onShow: function(hash){
                              hash.o.hide()
                                    .prependTo('body')
                                    .fadeIn('fast', function(){hash.w.fadeIn('slow');});
                              jqm_showing = true;
                            },
                            onHide: function(hash){
                              hash.w.fadeOut('slow', function(){
                                hash.o.fadeOut('slow',function(){hash.o.remove();})
                              });
                              jqm_showing = false;
                            }
                          })
                         .hide());
  
  // make the link
  $('<a href="#">Feedback</a>').click(function(){
                                  $modal.jqmShow();
                                  return false;
                                })
                               .appendTo('#nav-info')
                               .wrap('<li></li>');
  
});
