toggling existing html markup, how can i do a function?

toggling existing html markup, how can i do a function?

Hello, i use this piece of code to show/hide actual markup in a web page, but i want to do some function so when i call and pass a parameter it automatically sets the resulting behaviour. the thing is that i am new at jquery
  1. jQuery(document).ready(function($) {
        $('.intertop ul.ultop .loginform a.login').click(function() {
            if ($(this).hasClass('activo')) {
                $(this).removeClass('activo').addClass('inactive');
                $("#login-form").fadeOut().removeClass('activo');
            } else {
                $(this).addClass('activo').removeClass('inactive');
                $("#login-form").fadeIn().addClass('activo');
            }
        });
    })









is there a way in which i can example call function displaymarkup(what) with 2 choices a search form and a login form???

what should i study to do it right??
is there a clever way of doing this....
example of algorithm
  1. incoming data:target
  2. outcome: behaviour
  3. ----------------
  4. function calldisplay(target1:string,target2:string)
  5.     $('target1').click(function() {
            if ($(target1).hasClass('activo')) {
                $(target1).removeClass('activo').addClass('inactive');
                $(target2).fadeOut().removeClass('activo');
            } else {
                $(target1).addClass('activo').removeClass('inactive');
                $(target2).fadeIn().addClass('activo');
            }
        });
    })












  1. Incoming Data: what
  2. outcome: behaviour displaying one or two existent markup with displaynone
  3. -----------------------------------------------
  4. function showmarkup(whatbutton:string,whatblock:string)
  5. if what = search then
  6. calldisplay(searchbutton, search)
  7. if what = loginform then
  8. calldisplay(loginbutton,loginform)
really i know a little of jquery more or less its on the code above in pseudo code algorithm mixed with some actual code i am using.
i think i should have to wrap up everything on the jquery wrappers.
Thanks in advance for your help.
Salutations!!!