Image Rollover jQuery method behaving strangely
<p>I built a jQuery function for image rollover i.e. when I hover over particular images they should magnify. But the catch is those images are of two types, sometimes they are with green border and sometimes with red border. When they have a red border then image name ends with <strong>"RB"</strong>. Now the problem is irrespective of the image contains RB or not it is getting magnified. I have used a boolean as a decider parameter, its name is <strong>"pos"</strong>. When I print it, correct value get displayed, but inside the code logic it is all wrong. </p>

<pre><code>&lt;script type="text/javascript"&gt;
            var preLoadImages=['../icons/alfresco64.png','../icons/RSS64.jpg',
                            '../icons/google_calendar64.png','../icons/connections64.png',
                            '../icons/linkedin64.png','../icons/salesforce64.png',
                            '../icons/sharepoint_2010_64.png'];

        var imgs=[];
        for(var i=0;i&lt;preLoadImages.length;i++){
            imgs[i]=new Image();
            imgs[i].src=preLoadImages[i];
        }
        $(document).ready(function(){


            $('#slider img').mouseover(function(){
                var j;
                var imgFile=$(this).attr('src');
                var imgFileID=$(this).attr('id');

                if(imgFileID=="Alfresco"){
                    j=0;
                }
                if(imgFileID=="GoogleCalendar"){
                    j=2;
                }
                if(imgFileID=="Linkedin"){
                    j=4;
                }
                if(imgFileID=="Rss"){
                    j=1;
                }
                if(imgFileID=="Salesforce"){
                    j=5;
                }
                if(imgFileID=="Sharepoint"){
                    j=6;
                }
                if(imgFileID=="Connections"){
                    j=3;
                }
                if((j&gt;=0)&amp;&amp;(j&lt;=6)){
                var pos=/RB.png$/.test(imgFile);

                if(pos){
                    return false;
   } if(!pos){
                $(this).hover(
                function(){
                    $(this).attr('src',imgs[j].src);
        },
                function(){
                    $(this).attr('src',imgFile);
                }
       );
       }
                } 
            });
        });
    &lt;/script&gt;
</code></pre>

<p>According to me when image src contains RB, the method should return false. But it always magnifies the image on hover.
Please help I am a newbie to jQuery.</p>
