Removing mouseover from a hide/show

Removing mouseover from a hide/show

Okay, so as the title says, I want to remove the mouseover stuff in this hide/show page. I haven't done jQuery in a long time, and I don't remember how to take care of it without creating a glitch. Here is the page:

EDIT: I removed the images so that it wouldn't be insanely cluttered, and spaced each line out so that everything would be easier to see. Sorry for posting it so sloppily. I was extremely tired last night and totally half-assed it haha. Hopefully this looks a lot better.

EDIT: I have added some indentation to the code. It looks a heck of a lot better now, I think.

NOTE: Also, is there a way for this code to be optimized? When I activated it on my website, the information that is meant to be hidden becomes "un"-hidden immediately as the button is clicked, where instead, the information should be showing as the forum expands.

  1.     $(function() {
  2.         $('.main-head:has(.page-title)').prepend('<a class="collapse tcatCollapse" id="collapse_c_cat1" href="#top" style="visibility: hidden; float: right; margin-top:  -3px;"><img src="IMAGE HERE" alt=""></a>');
  3.         $('.main-head:has(.page-title)').mouseover(function() {
  4.             $(this).find('a.collapse[id]').css('visibility', 'visible')
  5.         });
  6.         $('.main-head:has(.page-title)').mouseout(function() {
  7.             $(this).find('a.collapse[id]').css('visibility', 'hidden')
  8.         });
  9.         $('.main-head a.collapse[id]').click(function(e) {
  10.             e.preventDefault()
  11.         });
  12.         $('.main-head a.collapse[id]').attr('onclick', " if($(this).closest('.main-head').next('.main-content:first').css('display')=='none') {my_setcookie($(this).closest('.main-head').find('.page-title').text()+'_ct','0',10,0); $(this).closest('.main-head').next('.main-content:first').slideDown(500);$(this).find('img').attr('src','IMAGE HERE');$(this).closest('.main-head');$(this).closest('.main-head').removeClass('collapsed')} else {my_setcookie($(this).closest('.main-head').find('.page-title').text()+'_ct','1',10,0); $(this).closest('.main-head').next('.main-content:first').slideUp(500);$(this).find('img').attr('src','IMAGE HERE'); $(this).closest('.main-head').addClass('collapsed');}");
  13.         $(document).ready(function() {
  14.             $('.main-head a.collapse[id]').closest('.main-head').each(function() {
  15.                 if (my_getcookie($(this).find('.page-title').text() + '_ct') == '1') {
  16.                     $(this).next('.main-content:first').css('display', 'none');
  17.                     $(this).find('a.collapse[id] img').attr('src', 'IMAGE HERE');
  18.                     $(this).closest('.main-head').addClass('collapsed')
  19.                 } else {
  20.                     $(this).next('.main-content:first').css('display', 'block');
  21.                     $(this).find('a.collapse[id] img').attr('src', 'IMAGE HERE');
  22.                     $(this).closest('.main-head').removeClass('collapsed')
  23.                 }
  24.             })
  25.         })
  26.     });