Need help with some kind of collision detection via jQuery
<p>i am working on a calendar interaction module. the calendar shows days reserved. a reservation interval is 7 days. i have set up via javascript that hovering a day adds a class and auto-hovers 3 days before and 3 days after this day too to visualize the 7-day-interval setting that class there too. now i stuck with the following problem.</p>

<p>if i hover a day and one of the prev. 3 or next 3 is already part of a reservation i want to prepend the difference to the other end of the 7-day interval. an example:</p>

<ol>
<li>i hover day 12</li>
<li>then the interval looks like xxx12xxx</li>
<li>i move the cursor to 13</li>
<li>the interval looks like xxx13xxx</li>
<li>if i now move the cursor to 14 then 15,16,17 would be marked too, but what if 16 is the starting point of a reservation? then it would look like xxx14x</li>
<li>In either case i finally need to know the id of the left and right outer end as these are values i have to send via form. how to get these?</li>
<li>how to make that the difference (16 and 17) is getting prepended on the left end so it would look like xxxxx14x?</li>
</ol>

<p>the only way i see it to have a 7 cases switch with a huge code block. but somehow i feel there was an easier way. </p>

<p>can you guys probably show me?</p>

<p>many thanks in advance for reading!</p>

<p>regards</p>
