How to calculate a 20 character string from a fixed session id and a non-fixed length page name
<p>It's Friday afternoon and my brain is fried.</p>

<p>I have a unique server side ID stored in a cookie.</p>

<p>For site stat purposes i need to have a unique event identifier of no more than 20 characters which is made up of the page name and the remaining number of charcaters from the session id.</p>

<p>So if the page name = selectPlan that is 10 characters.</p>

<p>Therefore i would need the last 10 characters from the session ID to complete the event identifier.</p>

<p>So far i have come up with:</p>

<pre><code>var $JSESSIONID = $.cookies.get('JSESSIONID');
var $event22 = 'selectPlan';
var $remLength = 20 - $event22.length;
var $remSession = $JSESSIONID.substr(0,$remLength);
var $event22 = $event22 + $remSession;

alert($event22);
</code></pre>

<p>Am mostly confused about reading the JSESSIONID from the end rather then the start with substr.</p>
