jQuery show/hide + jQuery.session problem

jQuery show/hide + jQuery.session problem

Hi there,

I have an aspx page with two show/hide div's: div#showmap with some addresses on a googlemap, div#showtext with the same addresses in a simple list (gridview).

These divs are either shown or hidden by clicking on a link. For example:

Click on link1: div#showmap is shown, div#showlist is hidden
Click on link2: div#showlist is shown, div#showmap is hidden

Really simple.
By default, div#showmap is show, otherwise the page would be totally empty.

Working code:

<script>
$(document).ready(function(){

        $('#showtext').hide();

   $("a#link1").click(function () {
   $("#showtext").hide();
   $("#showmap").show();
   });

   $("a#link2").click(function () {
   $("#showtext").show();
   $("#showmap").hide();
   });   

  });
</script>


My question: is it possible to store a value into a session upon a click-event?

The page has some dropdownlist with a page_postback event to filter the adresses. But each time div#showmap is shown because that one is hardcoded as default. By using a session it should be possible to do something like:

<script>
$(document).ready(function(){
if $.session("MyView", "showmap"); then
        $('#showtext').hide();
        $("#showmap").show();
elseif $.session("MyView", "showtext"); then
        $('#showtext').show();
        $("#showmap").hide();
end if
        $("a#link1").click(function () {
        $.session("MyView", "showmap");
   $("#showlist").hide();
   $("#showmap").show();
   });

   $("a#link2").click(function () {
        $.session("MyView", "showlist");
   $("#showlist").show();
   $("#showmap").hide();
   });   

  });
</script>


Above sample is not working. I know the if/else statement isn't properly wrapped, but the problem is that the session 'myview' stays empty, even when a user clicks on link1/link2 :(

I've tried jQuery.Session ( http://code.google.com/p/jquery-session/

Can anyone tell me if that's possible and how to do it?

Thanks in advance!