How to pass ID as a parameter for a function

How to pass ID as a parameter for a function

Hi guys!

I've been struggling with a piece of code. I'm guessing the solution is quite simple, but I just can't find it!!!

Here's the piece of code:

    $('.i_gal').click(
        function(){
            $('#gal1').removeClass('gal_hide').addClass('gal_show');
            document.getElementById('fade').style.display='block';
/*            var exact_img= this.attr('id');*/
            galleries[0].showImage(5);            
            }
    );

This code should load an image gallery, and the number in purple is the number of the picture that should be opened when I click one of the thumbnails.

The thumbnails are structured as follows (it's a php loop):

<img src='".$row['folder']."thumbs/".$row['filename']."' height='46' class='i_gal' id='".$num."'><span>Menu</span>

The line that I commented out was an attempt at getting a variable that had the value of the image-id, but it doesn't work. Could you help me? I just need to replace that 5 with a variable.

Thanks!!!!