var one;
var two;
var three;
var four;
var five;
var six;
var seven;
var eight;
var nine;
var ten;

function take() {
   one = prompt("How much you got to offer kid?","squat");
   if (one == "squat") {
      alert("Stop wasting my time.  I have no use for squat.");
   }
   else if (one == 1) {
      alert("Are you kidding me?  1?");
   }
   else if (one == 5) {
      alert("I'd actually prefer much more that if ya could.  I gotta support the wife and kids ya know");
   }
   else if (one == 10) {
      alert("It's not much, but I can work with that.");
      alert("Oh no wait.. no.");
   }
   else if (one == 100) {
      alert("Well attaboy!  Now we're getting somewhere.  Next, choose your victim's colour.  You can't just put the money down, then how are you supposed to win?");
      alert("Move on");
   }
   else if (one > 100) {
      alert("I have a maximum bid allowance here.  Apparently the law thinks poeple shouldn't lose all their money at once.");
   }
   else if (one < 100) {
      alert("Hah");
   }
   else {
      alert("Try a number");
   }
}


function ask() {
   two = document.gameform.texmex.value;
   if (two == "green") {
      alert("Ahh the colour of MONEY.  Good choice.  By the way, Numero Uno has some nice 1 in 6 odds.");
      alert("Oh yea and remember, if you're going to a casino in Vegas, you're also in USA and Nevada");
      document.gameform.texmex.value = "";
      alert("Moving onward!");
   }
   else if (two == "red") {
      alert("What are ya looking for, Eric's dad??");
      document.gameform.texmex.value = "";
   }
   else {
      document.gameform.texmex.value = "Try again";
   }
}

function place() {
   if (document.gameform.askem[0].checked && document.gameform.askem[1].checked && document.gameform.askem[2].checked) {
      if (document.gameform.askem[3].checked) {
         var name = prompt("What is your name?","");
         if (name != null)
            alert(name + "!  You suck!");
      }
      else if (document.gameform.askem[4].checked) {
         alert("Caeser's Palace is a good choice.  They bring in the money, but if you cheat, like I do, then you can win here.");
         alert("Go.. for it!  Go for it.  You certainly did.");
         alert("I like the 1 in 4 odds for Number 2.  I recommend the Poker and Blackjack at Caesar's Palace by the way.  Hold Ctrl when selecting more than one value in the seclection box.");
      }
      else if (document.gameform.askem[5].checked) {
         alert("Belagio eh?  A good tight casino, but no one wins there.  You wanna win.  Win!");
      }
      else if (document.gameform.askem[6].checked) {
         alert("I don't think The Red Dragon is even real.  I mean come on.  Come oonnnn!");
      }
   }

   // Also if they only check USA then tell them it's a little vague
   if (document.gameform.askem[0].checked) {
      if (!document.gameform.askem[1].checked) {
         if (!document.gameform.askem[2].checked) {
            alert("USA.. well that's a good start, but give me more infomation.");
         }
      }
   }

   // Tell them if they only pick Las Vegas
   if (document.gameform.askem[2].checked) {
      if (!document.gameform.askem[0].checked) {
         if (!document.gameform.askem[1].checked) {
            alert("OK so you want to play in Las Vegas, obviously.. all of the casinos are in Las Vegas.  You are overlooking where Las Vegas is though.");
         }
      }
   }
}

function whichGame() {
   if (document.gameform.thegame[1].selected) {
   }
   else if (document.gameform.thegame[2].selected) {
      alert("Slots?  Are you kidding me?  Definately not slots.");
   }
   else if (document.gameform.thegame[4].selected) {
   }
   else if (document.gameform.thegame[5].selected) {
   }
   else if (document.gameform.thegame[0].selected && document.gameform.thegame[3].selected) {
      alert("Ahh yes, poker and blackjack.  But with respect to real life, try to stay outta the hole.  Haven't you seen Rounders?  True story, well.. might be.. somewhere.  Odds for the third are 1 in 9");
      alert("Ya got it!  Move on");
   }
}

var earnings;

function verify () {
   three = document.gameform.sel1.options.value;
   four = document.gameform.sel2.options.value;
   five = document.gameform.sel3.options.value;
   if ((three == "si") && (four == "fo") && (five == "ni")) {
      alert("Looking pretty good so far.");
      var wager = prompt("What do you wager? (between, but including, 10 and 1000)","");
      if (wager < 10 || wager > 1000) {
         alert("OK seriously, I think people violate instructions on purpose.. meh");
      }
      else if (every <= 12) {
         alert("You totally optimized!  For that you truly have the best odds.  One more time, nice speed!");
         earnings = (wager * 1000 * (Math.random())^(1/5)) / (every+50) - 0.2*every;
         alert("You won " + Math.round(earnings));
         if (earnings > 5000) {
            alert("The winner!  Way to take down the house!");
            window.location.href = "http://www.hellojoel.com/journy.html";
         }
         else {
            alert("Not enough!  Somehow bad luck really claimed you today.  I'm boggled at how you lost with those odds.");
         }
      }
      else if (wager <= 750 && every <= 20) {
         alert("Well done, really quick and a decent bet.");
         earnings = (wager * 1000 * (Math.random())^(1/5)) / (every+50) - 0.2*every;
         alert("You won " + Math.round(earnings));
         if (earnings > 5000) {
            alert("The winner!  Way to take down the house!");
            window.location.href = "http://www.hellojoel.com/journy.html";
         }
         else {
            alert("Not enough!  Well you had nice odds but it didn't work out for ya this time.  No wonder people shouldn't gamble, even when odds are good they get messed up.");
         }
      }
      else if (wager <= 500 && every <= 40) {
         alert("Nice bet, good time, way to sense the moment and grasp the possibility.");
         earnings = (wager * 1000 * (Math.random())^(1/5)) / (every+50) - 0.2*every;
         alert("You won " + Math.round(earnings));
         if (earnings > 5000) {
            alert("The winner!  Way to take down the house!");
            window.location.href = "http://www.hellojoel.com/journy.html";
         }
         else {
            alert("Not enough!  You did really well, but ya still lost. Bad luck eh.");
         }
      }
      else if (wager <= 250 && every <= 60) {
         alert("Not bad.  Still lots of room for improvement though.");
         earnings = (wager * 1000 * (Math.random())^(1/5)) / (every+50) - 0.2*every;
         alert("You won " + Math.round(earnings));
         if (earnings > 5000) {
            alert("The winner!  Way to take down the house!");
            window.location.href = "http://www.hellojoel.com/journy.html";
         }
         else {
            alert("Not enough.  You lost, the luck wasn't with you this time");
         }
      }
      else if (wager < 100) {
         alert("You've barely earned the right to bet.  Ya gotta work that next time.");
         earnings = (wager * 1000 * (Math.random())^(1/5)) / (every+50) - 0.2*every;
         alert("You won " + Math.round(earnings) + " but it's definately not enough.");
      }
      else 
         alert("You bet too much for how well you did.");
   }
   else {
      alert("You lose.  Thank-you come again.");
   }
}



var every = 0;
function sec() {
   setTimeout('sec()', 1000);
   every = every + 1;
   document.gameform.timer.value = every;
/**
   if (every > 100) {
      alert("Gotta be quicker than that");
      document.location.href = "http://www.hellojoel.com/slownesspage.html";
   }
   if (every >= 90) {
      document.gameform.timer.value = every + " Running out of time..";
   }
**/
}

sec();