I'm trying to create a simple craps game with javascript, no bets. I created a simple dice game, but trying to add on to it to create a craps game. The following code rolls 2 dice, so I am part way there - I would like to add the following functionality:

1) if you roll 7 or 11 on the first roll you win
2) if you roll 2, 3, 12 on the first roll you lose
3) if you roll 4, 5, 6, 8, 9, 10 then that becomes point, must roll one of these numbers before 7 to win the game

4) if you roll the point, the game resets, you win, if you roll 7 you lose

How can you add to the code below? (thanks!)

var diceFace=new Array("images/d1.gif", "images/d2.gif", "images/d3.gif", "images/d4.gif", "images/d5.gif", "images/d6.gif"); 

function throwdice(){
//create a random integer between 0 and 5
var randomdice=Math.round(Math.random()*5);
var randomdice2=Math.round(Math.random()*5);

//set timeout function
function timer() {
	setTimeout(function() { throwdice() }, 3000);



<img src="images/d1.gif" name="mydice" id="mydice">
<img src="images/d1.gif" name="mydice2" id="mydice2">

<input type="button" value="Throw dice!" onClick="timer()">