var timerFimage;
var speedFimage = 2;
Hdir = 1;
Vdir = 1;
sta = false;
var dialogWidth = 600;
var dialogHeight = 400;

function way()
{               
if(navigator.appName == "Netscape")
{
        z = document.layers["layer1"]

        if(z.top < 0)
        {
                Vdir = 1;
        }
        else
        {
                if (z.top > dialogHeight)
                {
                        Vdir = -1;
                }
        }

        if(z.left < 0)
        {
                Hdir = 1;
        }

        if (z.left > dialogWidth)
        {
                Hdir = -1;
        }
                
        z.top += Vdir * speedFimage;
        z.left += Hdir * speedFimage;
}
else
{
        z = document.all["layer1"]

        if(z.style.posTop < 0)
        {
                Vdir = 1;
        }
        else
        {
                if (z.style.posTop > dialogHeight)
                {
                        Vdir = -1;
                }
        }

        if(z.style.posLeft < 0)
        {
                Hdir = 1;
        }

        if (z.style.posLeft > dialogWidth)
        {
                Hdir = -1;
        }
                
        z.style.posTop += Vdir * speedFimage;
        z.style.posLeft += Hdir * speedFimage;
}
}

function stop()
{
if(navigator.appName == "Netscape")
{
        z = document.layers["layer1"]

        sta = !sta
        if(sta)
        {
                Hdir = 0;
                Vdir = 0;
        }
        else
        {
                Hdir = 1;
                Vdir = 1;
        }
}
else
{
        z = document.all["layer1"]

        sta = !sta
        if(sta)
        {
                Hdir = 0;
                Vdir = 0;
        }
        else
        {
                Hdir = 1;
                Vdir = 1;
        }
}
}

function start()
{
timerFimage = setInterval(way,200)
}

if(navigator.appName == "Netscape")
{
        window.onMouseDown = stop
        window.captureEvents(Event.MOUSEDOWN)
}