parseInt(f.wlt.value)) f.msg.value="У Вас нет таких денег!";
else
if(fancy == "") f.msg.value="Выберите цвет";
else
if(stake == "") f.msg.value="Нажмите на сумму ставки";
else
{
running = 1;
run_race();
}
}
}
function run_race()
{
var n = Math.floor(Math.random() * 4);
if(document.all)
{
switch(n)
{
case 0 : document.all.redc.style.left = parseInt(document.all.redc.style.left)+step[0];
if(parseInt(document.all.redc.style.left) >= 288)
{
document.all.redc.style.left = 288;
winner = "Ferrari";
running = 0;
stopped = 1;
}
break;
case 1 : document.all.grnc.style.left = parseInt(document.all.grnc.style.left)+step[1];
if(parseInt(document.all.grnc.style.left) >= 288)
{
document.all.grnc.style.left = 288;
winner = "Jaguar";
running = 0;
stopped = 1;
}
break;
case 2 : document.all.bluc.style.left = parseInt(document.all.bluc.style.left)+step[2];
if(parseInt(document.all.bluc.style.left) >= 288)
{
document.all.bluc.style.left = 288;
winner = "Williams";
running = 0;
stopped = 1;
}
break;
case 3 : document.all.yelc.style.left = parseInt(document.all.yelc.style.left)+step[3];
if(parseInt(document.all.yelc.style.left) >= 288)
{
document.all.yelc.style.left = 288;
winner = "Jordan";
running = 0;
stopped = 1;
}
break;
}
}
if(document.layers)
{
switch(n)
{
case 0 : document.redc.left += step[0];
if(document.redc.left >= 288)
{
document.redc.left = 288;
winner = "Ferrari";
running = 0;
stopped = 1;
}
break;
case 1 : document.grnc.left += step[1];
if(document.grnc.left >= 288)
{
document.grnc.left = 288;
winner = "Jaguar";
running = 0;
stopped = 1;
}
break;
case 2 : document.bluc.left += step[2];
if(document.bluc.left >= 288)
{
document.bluc.left = 288;
winner = "Williams";
running = 0;
stopped = 1;
}
break;
case 3 : document.yelc.left += step[3];
if(document.yelc.left >= 288)
{
document.yelc.left = 288;
winner = "Jordan";
running = 0;
stopped = 1;
}
break;
}
}
if(running) window.setTimeout("run_race()", 100);
else
results();
}
function results()
{
if(document.all)
{
if(winner == fancy)
{
var winnings = parseInt(stake) * parseInt(level.charAt(0));
document.f.msg.value = winner+" выиграл: получите "+winnings;
total += winnings;
document.f.wlt.value = total;
}
else
{
document.f.msg.value = winner+" выиграл: проиграли "+stake;
total -= parseInt(stake);
document.f.wlt.value = total;
}
if(parseInt(document.f.wlt.value) == 0) var refill = confirm("Вы проиграли! - Еще сыграть?");
if(refill)
{
total = 10000;
document.f.wlt.value = total;
init();
}
}
if(document.layers)
{
with(document.book)
{
if(winner == fancy)
{
var winnings = parseInt(stake) * parseInt(level.charAt(0));
document.f.msg.value = winner+" wins: win "+winnings;
total += winnings;
document.f.wlt.value = total;
}
else
{
document.f.msg.value = winner+" wins: lose"+stake;
total -= parseInt(stake);
document.f.wlt.value = total;
}
if(parseInt(document.f.wlt.value) == 0) var refill = confirm("Вы проиграли! - Еще сыграть?");
if(refill)
{
total = 10000;
document.f.wlt.value = total;
init();
}
}
}
}
// End -->