<HTML>
<HEAD>
<TITLE>The Show</TITLE>
<SCRIPT LANGUAGE = "JavaScript1.2">


function getCookie(name){
var cname = name + "=";               
var dc = document.cookie;             
    if (dc.length > 0) {              
    begin = dc.indexOf(cname);       
        if (begin != -1) {           
        begin += cname.length;       
        end = dc.indexOf(";", begin);
            if (end == -1) end = dc.length;
            return unescape(dc.substring(begin, end));
        } 
    }
return null;
}

function setCookie(name, value) {
document.cookie = name + "=" + escape(value) + "; path=/" +
((expire == null) ? "" : "; expires=" + expire.toGMTString());
}

function playAudio(target, file, loop) {
    target.document.open('text/html');
    target.document.write('<EMBED SRC = "' + file + '" HIDDEN = "TRUE" LOOP = "' + ((loop) ? 'TRUE' : 'FALSE') + '" AUTOSTART = "TRUE">');
    target.document.close();
}

function stopAudio(target) {
    target.document.open('text/html');
    target.document.write('');
    target.document.close();
}

function showEnding() {
    for (var i = 0; i < pos.length; i++) faces[i].visibility = 'HIDE';
    var critique = new Array('Hmmm... you didn\'t do terribly well. As the French would say if they knew English \"Tu es stupide.\" And as we at The Show would say, \"That bites.\"', 'Perhaps you don\'t understand the concept of this game. The more you get right, the better off your are.', 'Five out of ten; not a glorious ratio.', 'Quiz shows may not be your \"thing\". Don\'t quit your day job.', 'Actually, you didn\'t do so badly. But don\'t go patting yourself on the back.', 'Pretty good for a newbie. But if we were you, we\'d gain a few more IQ points before coming back.', 'We have to hand it to you; not bad at all. But still not good enough to go on to our second round.', 'You are truly one of our best contestants; surely you must have cheated.');
        if (player.score < 3) rating = 0;
        else rating = player.score - 3; 
    showDialog(3, critique[rating] + '<P>Score: ' + player.score + '<BR>Average Time: ' +  Math.ceil(avgtime / 10) + ' sec.</P>');
}

function rotateFaces() {
var recursive = true;
        for (var i = 0; i < pos.length; i++) {
            pos[i] += inc; faces[i].visibility = 'SHOW';
            faces[i].moveTo((r * Math.cos(pos[i])) + xoff, (r * Math.sin(pos[i])) + yoff);
        }
        if (r < 2) {
            recursive = false;
            setTimeout(showEnding, 2000);
        } 
    r -= 2;
    fgTimer = (recursive) ? setTimeout(rotateFaces, 25) : null;
}

function showDialog(state, value) {
    var dialog = '<DIV ALIGN = "CENTER">'
        if (state == 0) {
            dialog += '<IMG HEIGHT = "138" WIDTH = "322" SRC = "timesup.gif">';
        }
        if (state == 1) {
            dialog += '<IMG HEIGHT = "122" WIDTH = "322" SRC = "correct.gif">';
            playAudio(soundLayer.layer, 'cheer.au', false);
        } 
        if (state == 2) {
            dialog += '<IMG HEIGHT = "109" WIDTH = "322" SRC = "wrong.gif">'; 
            playAudio(soundLayer.layer, 'aww.au', false);
        }
        if (state == 3) {
            dialog += '<IMG HEIGHT = "116" WIDTH = "254" SRC = "show.gif">'; 
        }
    dialog += '</DIV><SPACER TYPE = "VERTICAL" SIZE = "10"><DIV STYLE = "font-size: 22px; font-family: times;">' + value + '</DIV><SPACER TYPE = "VERTICAL" SIZE = "10"><DIV ALIGN = "CENTER"><A HREF = "#" onClick = "setTimeout(nextQuestion, 100); return false;"><IMG HEIGHT = "42" WIDTH = "107" BORDER = "0" SRC = "ok.gif"></A></DIV>';
    dialogBoxLayer.layer.document.write(dialog);
    dialogBoxLayer.layer.document.close();
    dialogBoxLayer.layer.visibility = 'SHOW';
}

function submitAnswer(value) {
        if (ticking) {
            player.answer = value;
            checkAnswer();
        }
}

function doTick() {
    tick--;
    var ones = tick % 10;
    var tens = Math.floor(tick / 10) % 10;
    statsTimeLayer.layer.document.images['ones'].src = ones + '.gif';
    statsTimeLayer.layer.document.images['tens'].src = tens + '.gif';
        if (tick > 0) tickerID = setTimeout(doTick, 1000);
        else checkAnswer();
}

function showScore() {
    var score = tallyScore();
    var ones = score % 10;
    var tens = Math.floor(score / 10) % 10;
    statsScoreLayer.layer.document.images['ones'].src = ones + '.gif';
    statsScoreLayer.layer.document.images['tens'].src = tens + '.gif';
}

function tallyScore() {
player.score = 0;
        for (var i = 0; i < order.length; i++) {
                if (questions[order[i]].isCorrect) player.score++;
        }
return player.score;        
}

function playerSetup() {
    this.score = 0;
    this.answer = null;
    this.name = getCookie('s_name');
    this.sex = parseInt(getCookie('s_sex'));
    this.iq = parseInt(getCookie('s_smart'));
}

function questionSetup(q, a0, a1, a2, a3, c) {
    this.question = q;
    this.answers = new Array(a0, a1, a2, a3);
    this.correct = c;
    this.isCorrect = false;
}

function newQuestion (q, a0, a1, a2, a3, c) {
    questions[questions.length] = new questionSetup(q, a0, a1, a2, a3, c);
}

function startUpGame() {
    now = -1;
    player = new playerSetup();
    maxtime = ((5 - player.iq) * 5) + 5;
    questions = new Array();
    newQuestion('If x + 5 is an even integer, then x could be which of the following?', '-4', '-1', '2', '0', 1);
    newQuestion('Refugee is to Asylum as...', 'astronaut is to capsule', 'dog is to owner', 'consumer is to impulse', 'opportunist is to advantage', 3);
    newQuestion('Hobbes is to Calvin as Pooh is to who?', 'Tigger', 'Christopher Robin', 'Piglet', 'Eorye', 1);
    newQuestion('Who is James Gosling?', 'CEO of Sun Microsystems', 'creator of Java', 'co-founder of Marimba', 'head of technology at Microsoft', 1);
    newQuestion('Linguists believe that our ability to learn language is ----, that it is woven into our genetic makeup.', 'empirical', 'incremental', 'innate', 'deductive', 2);
    newQuestion('Which of the following values is not equal to 10<SUP>2<SUP>2</SUP></SUP>?', '1,000,000<SUP>1/3</SUP>', '10<SUP>4</SUP>', '100,000,000<SUP>1/2</SUP>', '100<SUP>2</SUP>', 0);
    newQuestion('What was the name of the older brother in \"The Brady Bunch\"?', 'Bobby', 'Peter', 'Greg', 'Danny', 2);
    newQuestion('Who wrote \"The Art of War\"?', 'Connie Chung', 'Sun Tzu', 'Ghangus Khan', 'Sow Lin', 1);
    newQuestion('Which of the following is not an Evergreen?', 'Birch', 'Rhododendron', 'Spruce', 'Fir', 0);
    newQuestion('Which of the following animals does not polinate flowers?', 'Humming Bird', 'Bee', 'Moth', 'Ant', 3);
    /*
    newQuestion('For what did Richard feynman win the nobel prize?', 'for inventing Feynman Diagrams', 'for his work on the atomic bomb', 'for his work in Quantum Electro Dynamics', 'for the theory of the electron envelope', 0);
    newQuestion('Up to what speed can a peregrine falcon reach during a dive?', '75 mph', '100 mph', '200 mph', '250 mph', 3);
    newQuestion('In what country would you be most likely to find Laplands?', 'Sweden', 'Australia', 'Japan', 'Italy', 0);
    newQuestion('Which of the following is not an alkaloid?', 'LSD', 'Prozac', 'Cocaine', 'Morphine', 1);
    newQuestion('What denomination is the Church of England?', 'Presbyterian', 'Catholic', 'Episcopal', 'Baptist', 2);
    newQuestion('What year was George Washington born?', '1720', '1725', '1731', '1732', 3);
    newQuestion('What is the 3rd root of 1000?', '1x10<SUP><FONT SIZE = 3>9</FONT></SUP>', '1000', '10', '3', 2);
    newQuestion('A parody is to imitation as...', 'diamond is to a gem.', 'farce is to laughter.', 'caricature is to a likeness.', 'hilarious is to amusing.', 2);
    newQuestion('An ion with a -2 charge must combine with another of charge...', '+2', '-2', '1', '0', 0);
    */
    order = new Array();
        for (var i = 0; i < questions.length; i++) {
            var unique = false;
                while (!unique) {
                var matches = 0;
                var rand = Math.floor(Math.random() * questions.length);
                        for (var j = 0; j < order.length; j++) {
                            if (rand == order[j]) matches++;
                        }
                unique = (matches == 0);
                }
        order[i] = rand;
        }
    tick = maxtime + 1;
    var iq = new Array('a rock\'s', 'a worms\'s', 'a monkey\'s', 'God\'s');
    var job = new Array('a professional pet groomer', 'a welfare recipient', 'a recently fired Mircosoft employee turned Satan worshipping masochistic atheist', 'a happy-go-lucky-make-no-money webmaster');
    var welcome = 'Welcome to our show; The Show. Our first contestant is ' + player.name + ', '+ job[Math.floor(4 * Math.random())] + ' who compares ' + ((player.sex == 1) ? 'his' : 'her' ) + ' intelligence to that of ' + iq[player.iq - 1] + '.'
    stopAudio(musicLayer.layer);
    showDialog(3, welcome);
}

function checkAnswer() {
    clearTimeout(tickerID);
    ticking = false;
    stopAudio(musicLayer.layer);
    gameContainerLayer.layer.visibility = 'HIDE';
        if (player.answer == null) {
            questions[order[now]].isCorrect = false;
            var comment = new Array('Give an answer; don\'t just sit there picking your teeth.', 'You should be timed with a calender, not a clock', 'I\'m sorry, do you need a formal invitation to answer?', 'The mind is willing, but the body is too darn slow.', 'Time is of the essence here buddy.', 'When the clock reaches zero, it\'s a bad thing.', '', 'As the French would say, \"Tu es en retard.\"', 'The clock is ticking, why the heck aren\'t you?', 'At leasts you could have made an educated guess.'); 
            showDialog(0, comment[now] + ' The answer is ' + questions[order[now]].answers[questions[order[now]].correct] + '.'); 
        }
        else if (player.answer == questions[order[now]].correct) {
            questions[order[now]].isCorrect = true;
            var comment = new Array('I\'ll give you that one.', 'Surely you must have cheated.', 'We grudgingly admit... you\'re correct.', 'Don\'t let it get to your head.', 'Though we\'d love to tell you how wrong you are, we are obligated to inform you otherwise. ', 'Gee, you accidentally answered correctly.', 'You are, due to unforseen circumstances, correct.', 'The odds are in your favor anyway.', 'Don\'t get used to it, but you\'re right.', 'Not a bad way to end the game.');
            showDialog(1, comment[now]);
        }
        else if (player.answer != questions[order[now]].correct) {
            questions[order[now]].isCorrect = false;
            var comment = new Array('You and your brain should get together some time.', 'You were born wrong.', 'Tragically, our contestant doesn\'t realize just how wrong ' + ((player.sex == 1) ? 'he' : 'she' ) + ' really is.', 'If this were a drag race, you\'d be going in the wrong direction.', 'The sad things is you actually thought that was the right answer.', 'Great Job! But you\'re still wrong.', 'Let your brain catch up with your trigger finger next time.', 'Wrong: (noun) An incorrect answer, A state of wrongness. You.', 'At least TRY to answer it correctly.', 'In programmer speak, ' + player.name + ' = wrong.');   
            showDialog(2, comment[now] + ' The correct answer is ' + questions[order[now]].answers[questions[order[now]].correct] + '.');
        }
}

function nextQuestion() {
    showScore();
    statsTimeLayer.layer.document.images['ones'].src = '0.gif';
    statsTimeLayer.layer.document.images['tens'].src = '0.gif'; 
    dialogBoxLayer.layer.visibility = 'HIDE';
    now++;
        if (now < questions.length) {
            avgtime += maxtime - tick; // avg time
            tick = maxtime; // reset clock
            player.answer = null; // reset answer
            resetLayer(ans1BodyLayer);
            resetLayer(ans2BodyLayer);
            resetLayer(ans3BodyLayer);
            resetLayer(ans4BodyLayer);
            questBodyLayer.layer.document.write('<DIV STYLE = "font-size: 22px; font-family: times;">' + questions[order[now]].question + '</DIV>'); questBodyLayer.layer.document.close();
            ans1BodyLayer.layer.document.write('<DIV STYLE = "font-size: 22px; font-family: times;"><A HREF = "#" onClick = "submitAnswer(0); return false;">' +  questions[order[now]].answers[0] + '</A></DIV>'); ans1BodyLayer.layer.document.close();
            ans2BodyLayer.layer.document.write('<DIV STYLE = "font-size: 22px; font-family: times;"><A HREF = "#" onClick = "submitAnswer(1); return false;">' +  questions[order[now]].answers[1] + '</A></DIV>'); ans2BodyLayer.layer.document.close();
            ans3BodyLayer.layer.document.write('<DIV STYLE = "font-size: 22px; font-family: times;"><A HREF = "#" onClick = "submitAnswer(2); return false;">' +  questions[order[now]].answers[2] + '</A></DIV>'); ans3BodyLayer.layer.document.close();
            ans4BodyLayer.layer.document.write('<DIV STYLE = "font-size: 22px; font-family: times;"><A HREF = "#" onClick = "submitAnswer(3); return false;">' +  questions[order[now]].answers[3] + '</A></DIV>'); ans4BodyLayer.layer.document.close();
            gameContainerLayer.layer.visibility = 'SHOW';
            enterAnswers(40, ans1BodyLayer.layer); // enter anwsers
        }
        else if (now == questions.length) {
           faces = new Array(document.layers["dead"], document.layers["sad"], document.layers["happy"]);
           pos = new Array();
           pos[0] = 0;
                for (var i = 1; i < faces.length; i++) {
                    pos[i] = parseFloat(pos[i - 1] + ((2 * pi) / faces.length));
                    faces[i].zIndex = 0;
                }
                if (player.score <= 3) faces[0].zIndex = 1;
                else if (player.score <= 5) faces[1].zIndex = 1;
                else faces[2].zIndex = 1;
            rotateFaces();
        }
        else {
            window.close();
        }
}

function enterAnswers(difX, target) {
var recursive = true;
        if (target.left - difX >= 215 && Math.abs(target.left - 215) >= difX) {
            target.left -= difX;
        }
        else if (target.left - difX >= 215) {
            target.left -= Math.abs(target.left - 215);
        }
        else {
                if (target.name == "ans1Body") target = ans2BodyLayer.layer;
                else if (target.name == "ans2Body") target = ans3BodyLayer.layer;
                else if (target.name == "ans3Body") target = ans4BodyLayer.layer;
                else {
                   recursive = false;
                   playAudio(musicLayer.layer, 'suspense.mid', false); // music
                   ticking = true; // ticking
                   doTick();
                }
        }
fgTimer = (recursive && !ticking) ? setTimeout(enterAnswers, 25, difX, target) : null;
}

function reviewSetup() {
        if (getCookie('s_name') != null && getCookie('s_sex') != null && getCookie('s_smart') != null) {
            resetLayer(setupContainerLayer);
            resetLayer(floatBgLayer);
            clearTimeout(bgTimer);
            startUpGame();
        }
}

function floatBg(difX) {
        if ((difX < 0 && floatBgLayer.layer.left > -308) || (difX > 0 && floatBgLayer.layer.left < 308)) {
            floatBgLayer.layer.left += difX;
        }
        else floatBgLayer.layer.left = 0;
bgTimer = setTimeout(floatBg, 25, difX);
}

function expandSetupCell(difX, target) {
var recursive = true;
        if (target.left + difX <= 34 && Math.abs(target.left - 34) >= difX) {
            target.left += difX;
            target.clip.left -= difX
        }
        else if (target.left + difX <= 34) {
            target.left += Math.abs(target.left - 34);
            target.clip.left -= target.clip.left;
        }
        else {
                if (target.name == "cellName") target = cellSexLayer.layer;
                else if (target.name == "cellSex") target = cellSmartLayer.layer;
                else recursive = false; 
        }
fgTimer = (recursive) ? setTimeout(expandSetupCell, 25, difX, target) : null;
}

function enterSetup(difY) {
var recursive = true;
        if (setupContainerLayer.layer.top + difY <= 0 && -setupContainerLayer.layer.top >= difY) {
            setupContainerLayer.layer.top += difY;
        }
        else if (setupContainerLayer.layer.top + difY <= 0) {
            setupContainerLayer.layer.top += -setupContainerLayer.layer.top;
        }
        else {
            recursive = false;
            cellTalkLayer.layer.visibility = 'SHOW';
            expandSetupCell(20, cellNameLayer.layer);
        }
fgTimer = (recursive) ? setTimeout(enterSetup, 25, difY) : null;
}

function dropShowLogo(difY, down, dist) {
var recursive = true;
        if (!soundLayerPlaying) {
            playAudio(soundLayer.layer, 'sweep.au', false);
            soundLayerPlaying = true;
        }
        if (down && dist > 0) {
                if (showLogoLayer.layer.top + difY <= 145) {
                    showLogoLayer.layer.top += difY;
                }
                else {
                    showLogoLayer.layer.top += Math.abs(showLogoLayer.layer.top - 145);
                    down = false;
                }
        }
        else if (!down && dist > 0) {
            var bounce = Math.floor(dist / 4);
                if (showLogoLayer.layer.top - difY >= Math.abs(145 - bounce)) {
                    showLogoLayer.layer.top -= difY;
                }
                else {
                    showLogoLayer.layer.top -= Math.abs(showLogoLayer.layer.top - (145 - bounce));
                    down = true;
                    dist = bounce;
                }
        }
        else {
            recursive = false;
            soundLayerPlaying = false;
            setTimeout('resetLayer(showLogoLayer); floatBgLayer.layer.visibility = "SHOW"; floatBg(-4); setupContainerLayer.layer.visibility = "SHOW"; enterSetup(20);', 2000);
        }
fgTimer = (recursive) ? setTimeout(dropShowLogo, 25, difY, down, dist) : null;
}

function wipeIntroText1(difX) {
var recursive = true;
        if (!soundLayerPlaying) {
            playAudio(soundLayer.layer, 'sweep.au', false);
            soundLayerPlaying = true;
        }
        if (introText1Layer.layer.left + difX <= winX && Math.abs(introText1Layer.layer.left - winX) >= difX) {
            introText1Layer.layer.left += difX;
        }
        else if (introText1Layer.layer.left + difX <= winX) {
            introText1Layer.layer.left += Math.abs(introText1Layer.layer.left - winX);
        }
        else {
            recursive = false;
            resetLayer(introText1Layer);
            soundLayerPlaying = false;
            spotLeftLayer.layer.visibility = 'SHOW';
            floatBgLayer.layer.visibility = 'HIDE';
            clearTimeout(bgTimer);
            slideLeftSpot(20);
        }
fgTimer = (recursive) ? setTimeout(wipeIntroText1, 50, difX) : null;
}

function wipeIntroText2(difX) {
var recursive = true;
        if (!soundLayerPlaying) {
            playAudio(soundLayer.layer, 'sweep.au', false);
            soundLayerPlaying = true;
        }
        if (introText2Layer.layer.left - difX >= -168 && Math.abs(introText2Layer.layer.left + 168) >= difX) {
            introText2Layer.layer.left -= difX;
        }
        else if (introText2Layer.layer.left - difX >= -168) {
            introText2Layer.layer.left -= Math.abs(introText2Layer.layer.left + 168);
        }
        else {
            recursive = false;
            resetLayer(introText2Layer);
            soundLayerPlaying = false;
            spotRightLayer.layer.visibility = 'SHOW';
            floatBgLayer.layer.visibility = 'HIDE';
            clearTimeout(bgTimer);
            slideRightSpot(20);
        }
fgTimer = (recursive) ? setTimeout(wipeIntroText2, 50, difX): null;
}

function slideLeftSpot(difX) {
var recursive = true;
        if (spotLeftLayer.layer.left + difX <= winX && Math.abs(spotLeftLayer.layer.left - winX ) >= difX) {
            spotLeftLayer.layer.left += difX;
        }
        else if (spotLeftLayer.layer.left + difX <= winX) {
            spotLeftLayer.layer.left += Math.abs(spotLeftLayer.layer.left - winX); 
        }
        else {
            recursive = false;
            resetLayer(spotLeftLayer);
            floatBgLayer.layer.visibility = 'SHOW';
            floatBg(4);
            introText2Layer.layer.visibility = 'SHOW';
            setTimeout(wipeIntroText2, 1000, 20);
        }
fgTimer = (recursive) ? setTimeout(slideLeftSpot, 50, difX) : null;
}

function slideRightSpot(difX) {
var recursive = true;
        if (spotRightLayer.layer.left - difX >= -527 && Math.abs(spotRightLayer.layer.left + 527) >= difX) {
            spotRightLayer.layer.left -= difX;
        }
        else if (spotRightLayer.layer.left - difX >= -527) {
            spotRightLayer.layer.left -= Math.abs(spotRightLayer.layer.left + 527);
        }
        else { 
            recursive = false;
            resetLayer(spotRightLayer);
            showLogoLayer.layer.visibility = 'SHOW';
            setTimeout(dropShowLogo, 1000, 20, true, 261);
        }
fgTimer = (recursive) ? setTimeout(slideRightSpot, 50, difX) : null;
}

function setupLayer(l_object, l_visibility, l_left, l_top, l_clipLeft, l_clipTop, l_clipRight, l_clipBottom) {
    this.layer = l_object;
    this.l_visibility = l_visibility;
    this.l_left = l_left;
    this.l_top = l_top;
    this.l_clipLeft = l_clipLeft;
    this.l_clipTop = l_clipTop;
    this.l_clipRight = l_clipRight;
    this.l_clipBottom = l_clipBottom;
}

function resetLayer(target) {
        if (target.l_visibility != null) target.layer.visibility = target.l_visibility;
        if (target.l_left != null) target.layer.left = target.l_left;
        if (target.l_top != null) target.layer.top = target.l_top;
        if (target.l_clipLeft != null) target.layer.clip.left = target.l_clipLeft;
        if (target.l_clipTop != null) target.layer.clip.top = target.l_clipTop;
        if (target.l_clipRight != null) target.layer.clip.right = target.l_clipRight;
        if (target.l_clipBottom != null) target.layer.clip.bottom = target.l_clipBottom;
}

function startUpIntro() {
    floatBgLayer.layer.visibility = 'SHOW';
    floatBg(-4);
    playAudio(musicLayer.layer, 'intro.mid', false);
    loadingLayer.layer.visibility = 'HIDE';
    introText1Layer.layer.visibility = 'SHOW';
    setTimeout(wipeIntroText1, 1000, 20);
}


</SCRIPT>

<BODY BGCOLOR = "#000000" TEXT = "#FFFFFF" ALINK = "#FFFFFF" LINK = "#FFFFFF" VLINK = "#FFFFFF">
<LAYER NAME = "sound" VISIBILITY = "HIDE">
<EMBED SRC = "sweep.au" HIDDEN = "TRUE" AUTOSTART = "FALSE">
<EMBED SRC = "cheer.au" HIDDEN = "TRUE" AUTOSTART = "FALSE">
<EMBED SRC = "aww.au" HIDDEN = "TRUE" AUTOSTART = "FALSE">
</LAYER>
<LAYER NAME = "music" VISIBILITY = "HIDE">
<EMBED SRC = "intro.mid" HIDDEN = "TRUE" AUTOSTART = "FALSE">
<EMBED SRC = "suspense.mid" HIDDEN = "TRUE" AUTOSTART = "FALSE">
</LAYER>
<LAYER NAME = "floatBg" VISIBILITY = "HIDE">
<TABLE CELLPADDING = "0" CELLSPACING = "0" BORDER = "0"><TR><TD><IMG HEIGHT = "230" WIDTH = "308" SRC = "lights.gif"></TD><TD><IMG HEIGHT = "230" WIDTH = "308" SRC = "lights.gif"></TD><TD><IMG HEIGHT = "230" WIDTH = "308" SRC = "lights.gif"></TD><TD><IMG HEIGHT = "230" WIDTH = "308" SRC = "lights.gif"></TD></TR><TR><TD><IMG HEIGHT = "230" WIDTH = "308" SRC = "lights.gif"></TD><TD><IMG HEIGHT = "230" WIDTH = "308" SRC = "lights.gif"></TD><TD><IMG HEIGHT = "230" WIDTH = "308" SRC = "lights.gif"></TD><TD><IMG HEIGHT = "230" WIDTH = "308" SRC = "lights.gif"></TD></TR><TR><TD><IMG HEIGHT = "230" WIDTH = "308" SRC = "lights.gif"></TD><TD><IMG SRC = "lights.gif"></TD><TD><IMG SRC = "lights.gif"></TD><TD><IMG SRC = "lights.gif"></TD></TR></TABLE>
</LAYER>

<LAYER NAME = "gameContainer" VISIBILITY = "HIDE" WIDTH = "610" HEIGHT = "405" BGCOLOR = "#000000">
    <LAYER NAME = "stats" WIDTH = "178" HEIGHT = "331" LEFT = "0" TOP = "0">
    <IMG WIDTH = "178" HEIGHT = "331" SRC = "stats_bg.gif">    
    </LAYER>
    <LAYER NAME = "statsTime" WIDTH = "26" HEIGHT = "32">
    <IMG NAME = "tens" WIDTH = "13" HEIGHT = "16" SRC = "0.gif"><IMG NAME = "ones" WIDTH = "13" HEIGHT = "16" SRC = "0.gif">
    </LAYER>
    <LAYER NAME = "statsScore" WIDTH = "26" HEIGHT = "32">
    <IMG NAME = "tens" WIDTH = "13" HEIGHT = "16" SRC = "0.gif"><IMG NAME = "ones" WIDTH = "13" HEIGHT = "16" SRC = "0.gif">
    </LAYER>
    <LAYER NAME = "questHead" WIDTH = "40" HEIGHT = "30" LEFT = "190" TOP = "5">
    <DIV STYLE = "font-size: 26px; font-family: times; font-weight: bold; color: #909090;">Q.</DIV>
    </LAYER>
    <LAYER NAME = "questBody" WIDTH = "375" HEIGHT = "100">
    </LAYER>
    <LAYER NAME = "ans1Buzz" LEFT = "190" TOP = "155">
    <DIV STYLE = "font-size: 26px; font-family: times; font-weight: bold; color: #909090;">1.</DIV>
    </LAYER>
    <LAYER NAME = "ans1Body" WIDTH = "375" HEIGHT = "25" onMouseOver = "this.bgColor = '#606060'" onMouseOut = "this.bgColor = '#000000'">
    </LAYER>
    <LAYER NAME = "ans2Buzz" LEFT = "190" TOP = "190">
    <DIV STYLE = "font-size: 26px; font-family: times; font-weight: bold; color: #909090;">2.</DIV>
    </LAYER>
    <LAYER NAME = "ans2Body" WIDTH = "375" HEIGHT = "25" onMouseOver = "this.bgColor = '#606060'" onMouseOut = "this.bgColor = '#000000'">
    </LAYER>
    <LAYER NAME = "ans3Buzz" LEFT = "190" TOP = "225">
    <DIV STYLE = "font-size: 26px; font-family: times; font-weight: bold; color: #909090;">3.</DIV>
    </LAYER>
    <LAYER NAME = "ans3Body" WIDTH = "375" HEIGHT = "25" onMouseOver = "this.bgColor = '#606060'" onMouseOut = "this.bgColor = '#000000'">
    </LAYER>
    <LAYER NAME = "ans4Buzz" LEFT = "190" TOP = "260">
    <DIV STYLE = "font-size: 26px; font-family: times; font-weight: bold; color: #909090;">4.</DIV>
    </LAYER>
    <LAYER NAME = "ans4Body" WIDTH = "400" HEIGHT = "25" onMouseOver = "this.bgColor = '#606060'" onMouseOut = "this.bgColor = '#000000'">
    </LAYER>
</LAYER>

<LAYER NAME = "setupContainer" VISIBILITY = "HIDE" WIDTH = "218">
    <LAYER NAME = "cellName" HEIGHT = "47" WIDTH = "184" BACKGROUND = "setup_cell.gif">
    <FORM><SPACER TYPE = "VERTICAL" SIZE = "8"><SPACER TYPE = "HORIZONTAL" SIZE = "14"><DIV STYLE = "font-size: 14px; font-family: times;"><INPUT TYPE = "TEXT" SIZE = "12" onChange = "setCookie('s_name', this.value)"></DIV></FORM>
    </LAYER>
    <LAYER NAME = "cellSex" HEIGHT = "47" WIDTH = "184" BACKGROUND = "setup_cell.gif">
    <FORM><SPACER TYPE = "VERTICAL" SIZE = "8"><SPACER TYPE = "HORIZONTAL" SIZE = "14"><DIV STYLE = "font-size: 14px; font-family: times;"><INPUT TYPE = "RADIO" NAME = "s" onClick = "setCookie('s_sex', '1')"> Male <INPUT TYPE = "RADIO" NAME = "s" onClick = "setCookie('s_sex', '2')"> Female</DIV></FORM>
    </LAYER>
    <LAYER NAME = "cellSmart" HEIGHT = "47" WIDTH = "184" BACKGROUND = "setup_cell.gif">
    <FORM><SPACER TYPE = "VERTICAL" SIZE = "8"><SPACER TYPE = "HORIZONTAL" SIZE = "20"><DIV STYLE = "font-size: 14px; font-family: times;"><SELECT onChange = "if (this.selectedIndex > 0) { setCookie('s_smart', this.selectedIndex); reviewSetup() }"><OPTION>Your Intelligence<OPTION>Rock<OPTION>Worm<OPTION>Monkey<OPTION>God</SELECT></DIV></FORM>
    </LAYER>
    <LAYER NAME = "cellTalk" HEIGHT = "96" WIDTH = "183">
    <DIV STYLE = "font-size: 26px; font-family: times;">Indicate your name and your sex, and rate your intellect on a scale of one to four.</DIV>
    </LAYER>
    <LAYER NAME = "cellShaft" LEFT = "0" TOP = "0">
    <IMG HEIGHT = "343" WIDTH = "34" SRC = "setup_shaft.gif">
    </LAYER>
</LAYER>
<LAYER NAME = "introText1" HEIGHT = "45" WIDTH = "238" VISIBILITY = "HIDE">
<IMG HEIGHT = "45" WIDTH = "238" SRC = "intro1.gif">
</LAYER>
<LAYER NAME = "introText2" HEIGHT = "45" WIDTH = "168" VISIBILITY = "HIDE">
<IMG HEIGHT = "45" WIDTH = "168" SRC = "intro2.gif">
</LAYER>
<LAYER NAME = "showLogo" HEIGHT = "116" WIDTH = "254" VISIBILITY = "HIDE">
<IMG HEIGHT = "116" WIDTH = "254" SRC = "show.gif">
</LAYER>
<LAYER NAME = "spotLeft" HEIGHT = "423" WIDTH = "527" VISIBILITY = "HIDE">
<IMG HEIGHT = "423" WIDTH = "527" SRC = "spot_l.gif">
</LAYER>
<LAYER NAME = "spotRight" HEIGHT = "423" WIDTH = "527" VISIBILITY = "HIDE">
<IMG HEIGHT = "423" WIDTH = "527" SRC = "spot_r.gif">
</LAYER>
<LAYER NAME = "dialogBox" VISIBILITY = "HIDE" WIDTH = "325" HEIGHT = "300">
</LAYER>
<LAYER NAME = "loading" VISIBILITY = "HIDE" WIDTH = "300" HEIGHT = "30">
<DIV STYLE = "font-size: 22px; font-family: times;">Loading... Just A Moment</DIV>
</LAYER>
<LAYER NAME = "dead" VISIBILITY = "HIDE">
<IMG HEIGHT = "92" WIDTH = "92" SRC = "imdead.gif">
</LAYER>
<LAYER NAME = "sad" VISIBILITY = "HIDE">
<IMG HEIGHT = "92" WIDTH = "92" SRC = "imsad.gif">
</LAYER>
<LAYER NAME = "happy" VISIBILITY = "HIDE">
<IMG HEIGHT = "92" WIDTH = "92" SRC = "imhappy.gif">
</LAYER>

<SCRIPT LANGUAGE = "JavaScript1.2">


// BUG NOTES:
// cannot use pre-declared style sheets in PR 4 w/o errors, must use inline.
// switch/case statements longer than 60 lines and 11 cases have problems

var expire = new Date(); 
expire.setTime(expire.getTime() + 2678400000);
var soundLayerPlaying = false;
var fgTimer = null;
var bgTimer = null;
var winX = window.innerWidth;
var winY = window.innerHeight;
var player; // player obj
var maxtime; // max time
var questions; // questions obj array
var order; // order of questions
var ticking; // clock ticking?
var tick;    // current clock tick
var tickerID; // clock's ticking timer ID
var now; // current location in game
var avgtime = 0; // average time to complete question
// variables for ending rotating faces
var r = 160; // radius
var xoff = 270; // x pos
var yoff = 150; // y pos
var pi = Math.PI;  // PI    
var inc = pi / 45; // increment per cycle
var faces;
var pos;

soundLayer              = new setupLayer(document.layers['sound'],                              null,           null,                           null,                           null,   null,   null,   null);
musicLayer              = new setupLayer(document.layers['music'],                              null,           null,                           null,                           null,   null,   null,   null);
introText1Layer         = new setupLayer(document.layers['introText1'],                         'HIDE',         -238,                           Math.floor((winY - 45) / 2),    null,   null,   null,   null);
introText2Layer         = new setupLayer(document.layers['introText2'],                         'HIDE',         winX,                           Math.floor((winY - 45) / 2),    null,   null,   null,   null);
showLogoLayer           = new setupLayer(document.layers['showLogo'],                           'HIDE',         Math.floor((winX - 254) / 2),   -116,                           null,   null,   null,   null);
spotLeftLayer           = new setupLayer(document.layers['spotLeft'],                           'HIDE',         -527,                           0,                              null,   null,   null,   null);
spotRightLayer          = new setupLayer(document.layers['spotRight'],                          'HIDE',         (winX - 1),                     0,                              null,   null,   null,   null);
setupContainerLayer     = new setupLayer(document.layers['setupContainer'],                     'HIDE',         Math.floor((winX - 218) / 2),   -343,                           null,   null,   null,   null);
cellTalkLayer           = new setupLayer(setupContainerLayer.layer.document.layers['cellTalk'], 'HIDE',         23,                             20,                             null,   null,   null,   null);
cellNameLayer           = new setupLayer(setupContainerLayer.layer.document.layers['cellName'], 'INHERIT',      -134,                           176,                            160,    null,   null,   null);
cellSexLayer            = new setupLayer(setupContainerLayer.layer.document.layers['cellSex'],  'INHERIT',      -134,                           236,                            160,    null,   null,   null);
cellSmartLayer          = new setupLayer(setupContainerLayer.layer.document.layers['cellSmart'],'INHERIT',      -134,                           297,                            160,    null,   null,   null);
floatBgLayer            = new setupLayer(document.layers['floatBg'],                            'HIDE',         0,                              0,                              null,   null,   null,   null);
gameContainerLayer      = new setupLayer(document.layers['gameContainer'],                      'HIDE',         Math.floor((winX - 610) / 2),   Math.floor((winY - 405) / 2),   null,   null,   null,   null);
statsScoreLayer         = new setupLayer(gameContainerLayer.layer.document.layers['statsScore'],'INHERIT',      50,                             309,                            null,   null,   null,   null);
statsTimeLayer          = new setupLayer(gameContainerLayer.layer.document.layers['statsTime'], 'INHERIT',      102,                            140,                            null,   null,   null,   null);
questBodyLayer          = new setupLayer(gameContainerLayer.layer.document.layers['questBody'], 'INHERIT',      220,                            10,                             null,   null,   null,   null);
ans1BodyLayer           = new setupLayer(gameContainerLayer.layer.document.layers['ans1Body'],  'INHERIT',      610,                            160,                            null,   null,   null,   null);
ans2BodyLayer           = new setupLayer(gameContainerLayer.layer.document.layers['ans2Body'],  'INHERIT',      610,                            195,                            null,   null,   null,   null);
ans3BodyLayer           = new setupLayer(gameContainerLayer.layer.document.layers['ans3Body'],  'INHERIT',      610,                            230,                            null,   null,   null,   null);
ans4BodyLayer           = new setupLayer(gameContainerLayer.layer.document.layers['ans4Body'],  'INHERIT',      610,                            265,                            null,   null,   null,   null);
dialogBoxLayer          = new setupLayer(document.layers['dialogBox'],                          'HIDE',         Math.floor((winX - 300) / 2),   Math.floor((winY - 300) / 2),   null,   null,   null,   null);
loadingLayer            = new setupLayer(document.layers['loading'],                            'SHOW',         Math.floor((winX - 200) / 2),   Math.floor((winY - 30) / 2),    null,   null,   null,   null);

resetLayer(introText1Layer);
resetLayer(introText2Layer);
resetLayer(showLogoLayer);
resetLayer(spotLeftLayer);
resetLayer(spotRightLayer);
resetLayer(setupContainerLayer);
resetLayer(cellTalkLayer);
resetLayer(cellNameLayer);
resetLayer(cellSexLayer);
resetLayer(cellSmartLayer);
resetLayer(floatBgLayer);
resetLayer(gameContainerLayer);
resetLayer(statsScoreLayer);
resetLayer(statsTimeLayer);
resetLayer(questBodyLayer);
resetLayer(ans1BodyLayer);
resetLayer(ans2BodyLayer);
resetLayer(ans3BodyLayer);
resetLayer(ans4BodyLayer);
resetLayer(dialogBoxLayer);
resetLayer(loadingLayer);

// prelod various images
var imgs = new Array();
imgs[0] = new Image(); imgs[0].src = '0.gif';
imgs[1] = new Image(); imgs[1].src = '1.gif';
imgs[2] = new Image(); imgs[2].src = '2.gif';
imgs[3] = new Image(); imgs[3].src = '3.gif';
imgs[4] = new Image(); imgs[4].src = '4.gif';
imgs[5] = new Image(); imgs[5].src = '5.gif';
imgs[6] = new Image(); imgs[6].src = '6.gif';
imgs[7] = new Image(); imgs[7].src = '7.gif';
imgs[8] = new Image(); imgs[8].src = '8.gif';
imgs[9] = new Image(); imgs[9].src = '9.gif';
imgs[10] = new Image(); imgs[10].src = 'ok.gif';
imgs[11] = new Image(); imgs[11].src = 'correct.gif';
imgs[12] = new Image(); imgs[12].src = 'wrong.gif';
imgs[13] = new Image(); imgs[13].src = 'timesup.gif';
imgs[14] = new Image(); imgs[14].src = 'show.gif';

window.onload = startUpIntro;

//window.onload = startUpGame;


</SCRIPT>

</BODY>
</HTML>