<html>

            <head>

            <title>Hello World</title>

 

 

 

 

</head>

 

<body>

 

<div id='lyr' img = "conductor.gif" style='position:absolute; top:40px; left:20px;

width:80px; height:80px; background-color:purple;

color:white; z-index:10; border:3px solid black'>

<IMG SRC="conductor.gif"></div>

 

<script type= "text/javascript" src= "java6-7final.js">

</script>

 

<a href = "javascript://" onmouseover = "soar()"

onmouseout = "stop()">Soar</a>

 

<a href = "javascript://" onmouseover = "sink()"

onmouseout = "stop()">Sink</a>

 

<a href = "javascript://" onmouseover = "left()"

onmouseout = "stop()">Left</a>

 

<a href = "javascript://" onmouseover = "right()"

onmouseout = "stop()">Right</a>

 

<a href = "javascript://" onmouseover = "diagonal()"

onmouseout = "stop()">Diagonal</a>

 

<a href = "javascript://" onmouseover = "square()"

onmouseout = "stop()">Square</a>

</body>

           

</html>

 

// variable for timer

var timer;

 

function soar()

{

            var obj = document.getElementById("lyr");

 

 

// stop if top of page

            // alert(parseInt(obj.style.top))

            if (parseInt(obj.style.top) >= 10)

            {

            obj.style.top = (parseInt(obj.style.top)-1)+"px";

            }

            timer = window.setTimeout("soar()", 50);

}

 

function sink()

{

            var obj = document.getElementById("lyr");

// stop if top of page

            // alert(parseInt(obj.style.top))

            if (parseInt(obj.style.top) <= 400)

            {

            obj.style.top = (parseInt(obj.style.top)+1)+"px";

            }

            timer = window.setTimeout("sink()", 50);

}

 

 

function left()

{

            var obj = document.getElementById("lyr");

 

// stop if top of page

            // alert(parseInt(obj.style.top))

            if (parseInt(obj.style.left) >= 10)

            {

            obj.style.left = (parseInt(obj.style.left)-1)+"px";

            }

            timer = window.setTimeout("left()", 50);

}

 

function right()

{

            var obj = document.getElementById("lyr");

// stop if top of page

            // alert(parseInt(obj.style.top))

            if (parseInt(obj.style.left) <= 400)

            {

            obj.style.left = (parseInt(obj.style.left)+1)+"px";

            }

            timer = window.setTimeout("right()", 50);

}

 

 

 

// for the square routine

 

 

function soarq()

{

            var i=0;

            do

            {

           

                        var obj = document.getElementById("lyr");

 

                        obj.style.top = (parseInt(obj.style.top)-1)+"px";

 

                        i++;

            }

            while (i<=20);

            return;             

}

 

function sinkq()

{

            var i=0;

            do

            {

           

                        var obj = document.getElementById("lyr");

 

                        obj.style.top = (parseInt(obj.style.top)+1)+"px";

 

                        i++;

            }

            while (i<=20);

            return;             

}

 

 

function leftq()

{

            var i=0;

            do

            {

           

                        var obj = document.getElementById("lyr");

 

                        obj.style.left = (parseInt(obj.style.left)-1)+"px";

 

                        i++;

            }

            while (i<=20);

            return;             

}

 

function rightq()

{

            var i=0;

            do

            {

           

                        var obj = document.getElementById("lyr");

 

                        obj.style.left = (parseInt(obj.style.left)+1)+"px";

 

                        i++;

            }

            while (i<=20);

            return;             

}

 

 

function square()

{

            // move around in a square

            window.setTimeout("sinkq()", 1000);

            window.setTimeout("sinkq()", 2000);

            window.setTimeout("sinkq()", 3000);

           

            window.setTimeout("rightq()", 4000);

            window.setTimeout("rightq()", 5000);

            window.setTimeout("rightq()", 6000);

           

            window.setTimeout("soarq()", 7000);

            window.setTimeout("soarq()", 8000);

            window.setTimeout("soarq()", 9000);

 

            window.setTimeout("leftq()", 10000);

            window.setTimeout("leftq()", 11000);

            window.setTimeout("leftq()", 12000);

 

 

            timer=window.setTimeout("square()", 13000);

                        return;

}

 

function diagonal()

{

            var obj = document.getElementById("lyr");

// stop if top of page

            // alert(parseInt(obj.style.top))

           

            obj.style.left = (parseInt(obj.style.left)+1)+"px";

            obj.style.top = (parseInt(obj.style.top)+1)+"px";

            timer = window.setTimeout("diagonal()", 50);

}

 

function stop()

{         

            clearTimeout(timer);

}