title: limit javascript toggle according to select box value
body: <p>Here is link of my current fiddle</p>
  
  <p><a href="http://jsfiddle.net/demo_Ashif/4QkM8/" rel="nofollow">jsFiddle</a></p>
  
  <p>JS --</p>
  
  <pre><code>$('.click').on({
      'click': function () {
  
          var origsrc = $(this).attr('src');
          var src = '';
          if (origsrc == 'http://imageshack.us/a/img703/8236/l6hu.png') src = 'http://imageshack.us/a/img20/1651/fibz.png';
          if (origsrc == 'http://imageshack.us/a/img20/1651/fibz.png') src = 'http://imageshack.us/a/img703/8236/l6hu.png';
  
          $(this).attr('src', src);
  
      }
  });
  </code></pre>
  
  <p>i am able to toggle image onclick with another image and vice versa. This is okay, but i want to limit the toggle only when green image is already selected. If i select 3 from select box then i can toggle white image into green image only 3 times, not more than 3. I also need help for another scenerio - if i select 3 from select box and toggle first 3 image and next moment i change the 2nd image into white and click 5th image to turn green then it will be possible. I am week in javascript or jquery, so need proper information about this problem. So plz help me out.  </p>