<!-- Beginning of JavaScript - 

var x,y
var marginbottom
var marginleft=0
var margintop=0
var marginright
//改变移动一次的时间，毫秒级
var tempo=70
//改变移动一次的x,y坐标值
var stepx=2
var stepy=2
var timer

function setValues() {
var firsttimer= setTimeout("setValues2()",1000)
}

function setValues2() {
if (document.all) {
marginbottom = document.body.clientHeight-50
marginright = document.body.clientWidth-50
document.all.pic.style.posLeft=10
document.all.pic.style.posTop=10
moveball()
}

if (document.layers) {
marginbottom = window.innerHeight-10
marginright = window.innerWidth-10
document.pic.left=10
document.pic.top=10
moveball()
}
}

function randommaker(range) { 
rand=Math.floor(range*Math.random())
return rand
}

function moveball() {
if (document.all) {
checkposition()
document.all.pic.style.posLeft+=stepx
document.all.pic.style.posTop+=stepy
timer=setTimeout("moveball()",tempo)
}
if (document.layers) {
checkposition()
document.pic.left+=stepx
document.pic.top+=stepy
timer=setTimeout("moveball()",tempo)
}
}

function checkposition() {
if (document.all) {
if (document.all.pic.style.posLeft>=marginright) {
stepx=(stepx+randommaker(2))*-1
document.all.pic.style.posLeft-=10
}
if (document.all.pic.style.posLeft<=marginleft) {
stepx=(stepx+randommaker(2))*-1
document.all.pic.style.posLeft+=10
} 
if (document.all.pic.style.posTop>=marginbottom) {
stepy=(stepy+randommaker(2))*-1
document.all.pic.style.posTop-=10
}
if (document.all.pic.style.posTop<=margintop) {
stepy=(stepy+randommaker(2))*-1
document.all.pic.style.posTop+=10
}
}
if (document.layers) {
if (document.pic.left>=marginright) {
stepx=(stepx+randommaker(2))*-1
document.pic.left-=10
}
if (document.pic.left<=marginleft) {
stepx=(stepx+randommaker(2))*-1
document.pic.left+=10
} 
if (document.pic.top>=marginbottom) {
stepy=(stepy+randommaker(2))*-1
document.pic.top-=10
}
if (document.pic.top<=margintop) {
stepy=(stepy+randommaker(2))*-1
document.pic.top+=10
}
}
}


// - En?〢"獵??????逘????????遠?悰˙???秴?遈?嫨???仈???d of JavaScript - -->
setValues();