problem selecting parent

problem selecting parent

Hello everyone,

I am a newbie studying jquery recently and try to do my website.
I am actually reading the jquery cookbook and thought I understood something.
But in the practice I do not come along with some simple problems.

For example I have these divs in my html:

<div id = "menuItem">
      <div id="FirstPos"      style = "…" onmouseout="fadeinAll();">
            <img id="Collection"   src="images/COLLECTION.png"  onmouseover="fadeoutbutFirst();">
            </img>
      </div>

      <div id="SecondPos" style = "…" onmouseout="fadeinAll();">
            <img id="Recherche"  src="images/RECHERCHE.png"  onmouseover="fadeoutbutSecond();">
            </img>
      </div>

      <div id="ThirdPos"     style = "…" onmouseout="fadeinAll();">
            <img id="Corporate"   src="images/CORPORATE.png"  onmouseover="fadeoutbutThird();">
            </img>
      </div>

     <div id="FourthPos"    style = "…" onmouseout="fadeinAll();">
            <img id="Contact"     src="images/CONTACT.png"       onmouseover="fadeoutbutFourth();">
            </img>
      </div>
</div>

In my header I used these functions:


function fadeoutbutFirst() {
  $('div#menuItem div').not('#FirstPos').fadeOut(600, 'easeOutSine');  
}

function fadeoutbutSecond() {
  $('div#menuItem div').not('#SecondPos').fadeOut(600, 'easeOutSine');     
}

function fadeoutbutThird() {
var me = $(this).parent();
  $('div#menuItem div').not(me).fadeOut(600, 'easeOutSine');  
}

function fadeoutbutFourth() {
  $('div#menuItem div').not('#FourthPos').fadeOut(600, 'easeOutSine');
}

function fadeinAll() { 
  $('div#menuItem div').fadeIn(690, 'linear');
}

to make all the divs fadeOut over which the mouse is NOT.
(I had to split the mouseOver and mouseOut, one in the img, the other in the parent div, to avoid the blinking effect)
So far it works very fine.

But now I wanted to simplify the code by making the function depending on "this" so that I would need only one function instead of 4. In the bold code this is what I tried but it doesn’t work. 
I wanted to tell the function to hide all divs except the one which is the parent of the img where the function is inside.

What is wrong with my syntax?
I tried so may things, couldn’t make it work.

Thank you very much for your comments on "this" ;-)

Garavani