-- fix for CRM-13129

It was broken because once the search form is submitted, gid parameter will no longer exist in the url. So, the if condition failed and causes\d the link to not appear. I have made the fix by storing the variable value in the session, after it is retrieved from the url, so that its value will persist even after the form submission.