title: Highlight multiple divs using jquery
body: <p>I have a calendar and I'm trying to highlight saturday to saturday on mouseover of any of the days in the month... so if you mousover the monday 7th May it will highlight saturday 5th - Saturday 12th.</p>
  
  <p>I've managed this with the following. The calendar is dynamically generated with php, so each day looks like this:</p>
  
  <pre><code>&lt;td class="calendar-day week_number_' . $this_week_number . '"&gt;
      &lt;div class="hello" id="day_' . $list_day . '"&gt;&lt;div class="day-number"&gt;' . $list_day . '&lt;/div&gt;'
  &lt;/td&gt;
  </code></pre>
  
  <p><code>'week_number_ . $this_week_number'</code> is generated for each week saturday to saturday and the saturday shared by 2 weeks has both classes applied, for example the first available week in the year would be <code>week_number_1</code> (it's a holiday cottage, so not all weeks will be open). <code>$list_day</code> is the date generated for each day elsewhere.</p>
  
  <p>The highlighting happens using the following jquery at the bottom of the page:</p>
  
  <pre><code>$('.hello').mouseover(function() {
      var day = $(this).attr('id');
      $.post('/modules/calendar/get_week_number2', { month:" . $month . ", day:day, year:" . $year . " }, function(data) {
          $('.calendar-day').siblings('.week_number_'+data).css('background', 'yellow');
      });
  });
  
  $('.hello').mouseleave(function() {
      var day = $(this).attr('id');
      $.post('/modules/calendar/get_week_number2', { month:" . $month . ", day:day, year:" . $year . " }, function(data) {
          $('.calendar-day').siblings('.week_number_'+data).css('background', 'red');
      });
  });
  </code></pre>
  
  <p>This is done in Codeigniter so this jquery is generated and inserted at the bottom of the page, just to explain the php variables in there. And finally <code>get_week_number2</code> is a function to determine which week to highlight... </p>
  
  <pre><code>public function get_week_number2() {
      $month = $_POST['month'];
      $day = str_replace("day_", "", $_POST['day']);
      $year = $_POST['year'];
      $date = date('Y-m-d H:i:s', mktime(0,0,0,$month,$day,$year));
      $date2 = strtotime($date);
      foreach($this-&gt;weeks_in_year() AS $week_number =&gt; $week)
      {
          if($date2 &gt; strtotime($week['from']) AND $date2 &lt; strtotime($week['to']))
          {
              echo $week_number;
          }
      }
  }
  </code></pre>
  
  <p><code>$this-&gt;weeks_in_year()</code> is another function that generates an array of weeks in the year... but I don't think that needs to be in here... it's getting too long as it is!</p>
  
  <p>So my question is that, yes, this works, but isn't there a better way? Am I missing something?</p>