﻿function OpenBowsPreview(strName)
{
    var myWin = window.open(strName, "bow_image", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=825, height=250");
    myWin.focus();
}

var elementId, oldImage, newImage, middleImage;

function timedCount()
{
    imageNewSwap();
    setTimeout("imageOldSwap()", 250);
    interval = Math.floor(Math.random()*20000);
    setTimeout("timedCount()", interval)
}

function imageNewSwap()
{
    document.getElementById(elementId).src = newImage;
}

function imageOldSwap()
{
    document.getElementById(elementId).src = oldImage;
}

function topFrogTimeCount()
{
    topNewImage();
    setTimeout("topOldImage()", 250);
    interval = Math.floor(Math.random()*60000);
    setTimeout("topFrogTimeCount()", interval);
}

function topNewImage()
{
    document.getElementById('topfrog').src = "images/top_frog2.gif";
}

function topOldImage()
{
    document.getElementById('topfrog').src = "images/top_frog.gif";
}

function singleTwitch(elementIdent, newerImage, olderImage)
{
    newImage = newerImage;
    oldImage = olderImage;
    elementId = elementIdent;
    imageNewSwap();
    setTimeout("imageOldSwap()", 250);
}

function flycatcher()
{
    elementId = "flyeater";
    document.getElementById(elementId).src = "images/flyeater2.jpg";
    newImage = "images/flyeater3.jpg";
    oldImage = "images/flyeater1.jpg";
    setTimeout("imageNewSwap()", 1500);
    setTimeout("imageOldSwap()", 1750);
    interval = Math.floor(Math.random()*21750);
    setTimeout("flycatcher()", interval)
}

function toadSmile()
{
    elementId = "toad";
    var smileTime = 3000;
    newImage = "images/toad2.jpg";
    oldImage = "images/toad.jpg";
    imageNewSwap();
    setTimeout("imageOldSwap()", smileTime);
    interval = Math.floor(Math.random()*21000);
    
    //make sure the interval before the next smile is greater than the time it takes him
    //to change back from smiling.
    while (interval < smileTime)
    {
        interval = Math.floor(Math.random()*21000);
    }
    setTimeout("toadSmile()", interval);
}

function countryOver(country)
{
    document.getElementById('world-map').src = "images/map_01-" + country + "_over.gif";
}

function countryOut(country)
{
    document.getElementById('world-map').src = "images/map_off.gif";
}