So all we need is index.html to try it all out.

index.html
<html>
<head>
  <title>Free Cell</title>
  <link rel='stylesheet' href='styles.css'>
  <script src='library.js'></script>
  <script src='globals.js'></script>
  <script src='functions.js'></script>
</head>
<body>
  <div id='main_panel'>
    <script>setup_main();</script>
  </div>
  <script>deal(); draw();</script>
</body>
</html>

Make sure that you try all of the foregoing before proceeding.

A good start but not quite what we want!

The browser will draw the images in the order they were created.
Notice how the King of Hearts (id=51) is always on top no matter how many times you refresh the screen.