storing value in session variable, and checking it
<p>i have made a login form on a light box using a javascript function. Now i want to store a value on session variable, so to check if the user has logined , and not to show him login lightbox again and again on his navigations on the page.. My javascript function is:</p>

<pre><code>&lt;script language="javascript" type="text/javascript"&gt;  
    function createlightbox()  
    {  
        document.getElementById('light').style.display='block';  
        document.getElementById('fade').style.display='block'  
    }  
    function closelightbox()  
    {  
        document.getElementById('light').style.display='none';  
        document.getElementById('fade').style.display='none'  
    } 
     function checksession()  
    {  if (admin=="admin")
    {closelightbox();}
    else
    {createlightbox();}  
    } 

function check(form)/*function to check userid &amp; password*/
{
 /*the following code checkes whether the entered userid and password are matching*/
 if(form.name.value == "admin" &amp;&amp; form.password.value == "admin")
  {
    closelightbox();
     var admin = &lt;?php $_SESSION['Admin']= 1; ?&gt;

  }
 else
 {
  document.getElementById("error").style.display='block';/*displays error message*/
  }
}      
&lt;/script&gt;  
</code></pre>

<p>And i m calling the checksession function in my forms onsubmit event as</p>

<pre><code>&lt;form id="Admin" onreset="checksession()"&gt;
</code></pre>

<p>The problem is, on every reset or submit of form, even on the page changes, the login form is shown. Why it is not checking the check session funtion. 
Please tell me any fault i m making</p>
