Javascript change variable using buttons
<p>I am trying to make a button open up another window using jquery. </p>

<p>The button should be able to open the window. Then the same button should be used to close the window afterwards. The problem I seem to be having appears that my variables are not being set after the button opens the window. I am really new to javascript and jquery, so I'm not sure if I did something wrong.</p>

<pre><code>&lt;html&gt;
  &lt;head&gt;
   &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript"&gt; 
      var FileEdit = 0;
      $(document).ready(function(){
        if (FileEdit == 0)
        {
           $("button").click(function(){
             $("div").animate({opacity:0.4},"fast");
             $("div").animate({height:300,width:300},"slow");
             $("div").animate({opacity:1},"slow");
             FileEdit = 1;
           });
        }  
        if (FileEdit == 1)
        {
             $("button").click(function(){
                $("div").animate({height:000,width:000},"slow");
                FileEdit = 0;
             });
        }
      });
    &lt;/script&gt; 
  &lt;/head&gt;

     &lt;body&gt;
       &lt;button&gt;Start Animation&lt;/button&gt;
       &lt;br /&gt;&lt;br /&gt;
       &lt;div style="background:#98bf21;height:000px;width:000px;"&gt;
       &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p><a href="http://jsfiddle.net/tqpTE/" rel="nofollow">http://jsfiddle.net/tqpTE/</a></p>
