// Copyright &copy; 2001, 2002 Mark Purtill.
// $Id: layout.js,v 1.2 2002/02/12 05:59:04 purtill Exp $

function layout() {
  shuffle();

  document.write( "<TABLE><TR>\n" );
  document.write( "<TD><font><A HREF=\"" + locationNoArgs()
		  + arg_string_no_seed() + "\">" + "Another deal</A></TD>\n"
		  );
  if( 0 ) {
    document.write( "<TD><A HREF=\"" + locationDirOnly() + "custom.html\">"
		    + "Custom deal</A></TD>\n" );
  }
  document.write( "</TR></TABLE><BR>\n" );

  for( var i=0; i<chunks.length - 1; ++i ) {
    document.write( chunks[ i ] );
    image();
  }
  document.write( chunks[ chunks.length - 1 ] );

}

if( ! args["seed"] ) {
  document.write( "<P>Generating seed...</P>\n" );
  seed = Math.random();
  var new_location = window.location.href;
  if( keys.length == 0 ) {
    new_location += "?seed=" + seed;
  } else {
    new_location += "&seed=" + seed;
  }
  if( ! args[ "card_count" ] ) {
    new_location += "&card_count=" + cardCount;
  }
  window.location = new_location;
} else {
  set_seed( args["seed"] );
  layout();
}
