Wrong count value with mouseenter/mouseover event
Hello!
I'm a newbie in JQuery, so my problem may be no big deal but anyway I'm stucked with this for a few days so I'm asking the help of any nice person who could solve it! 
Here is the thing: I'm working on a partners page where partners are categorized, each category contains a various number of partners's logos, so I had to define different min and max_height for each category, so that it can enlarge/reduce when mouse is over/out the div.
The problem is that I use a for loop which increment $id_cat each time it's looped, the value of $id_cat is correct when I test it with alert(count); OUT of mouseenter or mouseleave events, but wrong when I test it IN mouseenter or mouseleave (it returns the max value of count var no matter what I try...), so the script doesn't work fine, as I'm using this count to get the corresponding max_height and min_height values from an array (cat_height).
Here is the code:
cat_height = new Array('70 115','70 115','140 230','140 230','140 230');
- $(document).ready(function(){
- for (var $id_cat=0;$id_cat<=4;$id_cat++)
- {
- currentcat = $('#cat-'+$id_cat);
- count = $id_cat;
- _height = cat_height[count].split(' ');
- min_height = _height[0];
- max_height = _height[1];
- currentcat.mouseenter(function(){
- alert(count);
- $(this).animate({height: max_height}, 300);
- }).mouseleave(function(){
- $(this).animate({height: min_height}, 300);
- });
- }
- });
So my problem is situated between lines 10 and 15.
Can anybody tell me what's wrong and if there's a way to properly get my count value within these mouseenter and mouseleave events?
Thank you for interest and future help if there's any. 