function random() { 
  random.seed = (random.seed*random.a + random.c) % random.m; 

  return random.seed / random.m; 
}
random.m=714025; random.a=4096; random.c=150889; 
random.seed = (new Date()).getTime()%random.m;

var constMAXDECKSIZE = 78;
var constMAXHANDSIZE = 5;
var deck = new Object();
deck.shown = new Array();


function whichCard()
{
  var condition=true;
  while(condition)
  {
      condition=false;
      var card = Math.ceil(random()* constMAXDECKSIZE) - 1;
	  for(var index=0; index<deck.shown.length;index++)
	  {
	    if(deck.shown[index] == card) condition=true;
	  }
  }
  deck.shown[deck.shown.length] = card;
  
}

function showHand()
{
    var elem = document.createElement("DIV");
	var innerHTML="";
	elem.setAttribute("ID", "handContainer");
	document.getElementById("displayArea").appendChild(elem);
	document.getElementById("handContainer").className="handStyle";
	for(var index=0;index < deck.shown.length;index++)
	{
	  
	  innerHTML+= "<div class='cardStyle'><img class='imgStyle' src='/tarot/imgs/card"+deck.shown[index]+".jpg'></div>";
	 
	}
	innerHTML+="<br clear='all'>";
	
    document.getElementById("handContainer").innerHTML=innerHTML;

	
}
function shuffleDeck()
{
   if(document.getElementById("handContainer"))document.getElementById("handContainer").innerHTML= "";
   deck.shown = null;
   deck.shown = new Array();
}
function drawCard()
{
  if(deck.shown.length < constMAXHANDSIZE) whichCard();
  showHand();
}

