common value in 2 arrays

common value in 2 arrays

      I'm trying to find a common value between two arrays.  In this case I have two select drop downs and each option has multiple classes assigned.  There will always be 1 class value that is common in both selected options.

<select id="optionSel1">
<option class="sku0" value="" selected="selected">-- Select --</option>
<option class="sku7 sku8" value="2">female</option>
<option class="sku10 sku9" value="1">male</option>
</select>


<select id="optionSel2">
<option class="sku0"  selected="selected">-- Select --</option>
<option class="sku8 sku10" value="4">baseball_2</option>
<option class="sku7 sku9" value="3">baseball_1</option>
</select>

My jquery is still pretty weak this is pretty much what I've been trying so far.

$("select#optionSel1 option").click ( function() {
 arr1 = new Array;
$("select#optionSel1 option:selected").each ( function() {
            arr1.push ( $(this).attr('class') );
        });
      
   
   
    $("select#optionSel2 option").click ( function() {
 arr2 = new Array;
$("select#optionSel2 option:selected").each ( function() {
            arr2.push ( $(this).attr('class') );
        });
      
  
   
    if((arr1 != 0) && (arr2 != 0)) {
    var matches = 0;
$.each(arr1, function(i, arr1){
  if($.inArray(arr1, arr2)) matches++;
  alert(matches);
});

    }
});
});    /////  I get 1  


but,
What I want to do is get the sku# and use it to loop through an array to get an  image.  The images are very small so I'll just load them all in the page hidden.

Thank You of any help you can offer,
Mike