Animating a horizontally and vertically centred DIV

Animating a horizontally and vertically centred DIV

Hi, i've been wrestling with this issue for the last hour. I can't seem to get this centred div to animate properly. 
What it currently does: 
A small div, (10x2px) expands to full 100% width and 100% height. However, it expands in the bottom right hand corner of the screen.

What I am trying to get it to do:
To expand equally in all four directions. 

Please help me with this. Im new to jquery and would appreciate your help. 

Code:

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Jquery</title>
  6. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
  7. <script type="text/javascript">
  8. $(function() { 
  9.    
  10. $('#smallscreen').css({
  11.      "opacity": "1",
  12. "bottom": "50%",
  13. "right": "50%",
  14. "top": "50%",
  15. "left": "50%",
  16.  
  17. });
  18. $('#smallscreen').animate({
  19.  "opacity": "1",
  20.    "width": "100%",
  21.  "height": "100%"
  22.  });
  23.   });
  24. </script>
  25. <style type="text/css">
  26.     .test { font-weight: bold; }
  27.    .blue { color: blue; }
  28.     .red { color: red; }
  29.  #smallscreen {
  30. position:absolute;
  31. width:10px;
  32. height:2px;
  33. z-index:1;
  34. background-color: #FFF;
  35. text-align:center;
  36. }
  37. body {
  38. background-color: #000;
  39. height: 100%;
  40. text-align:center;
  41. }
  42. </style>
  43.     </head>

  44. <body>
  45. <div id="smallscreen"></div>
  46. </body>
  47. </html>