﻿//movePic
document.write("<span id='superball' style='position:absolute;left:0;top:0;display:none;z-index:10;'><a href='http://www.fungifthk.com/News.asp?id=1218'  target='_blank'><img name='superballImage' src='pic/59073116.jpg' width='300' height='200' style='z-index:10;border:1px solid #FFFF00;'></a></span>");
var ballWidth=302;
var ballHeight=206;
var BallSpeed=1.4;
var maxBallSpeed = 40;
var xMax;
var yMax;
var xPos = 0;
var yPos = 0;
var xDir = "right";
var yDir = "down";
var superballRunning = true;
var tempBallSpeed;
var currentBallSrc;
var newXDir;
var newYDir;

function movePic() {
if (superballRunning == true) {
calculatePosition();
document.all('superball').style.left = xPos + document.body.offsetLeft;
document.all('superball').style.top = yPos + document.body.scrollTop;
setTimeout('movePic()',30);
}
}
function InitmovePic() {
xMax = document.body.clientWidth;
yMax = document.body.offsetHeight;
document.all('superball').style.display = "";
setTimeout('movePic()',500);
}
function calculatePosition() {
if (xDir == 'right') {if (xPos > (xMax - ballWidth - BallSpeed)) {xDir = 'left';}}
else if (xDir == 'left') {if (xPos < (0 + BallSpeed)) {xDir = 'right';}}
if (yDir == 'down') {if (yPos > (yMax - ballHeight - BallSpeed)) {yDir = 'up';}}
else if (yDir == 'up') {if (yPos < (0 + BallSpeed)) {yDir = 'down';}}
if (xDir == 'right') {xPos = xPos + BallSpeed;}
else if (xDir == 'left') {xPos = xPos - BallSpeed;}
else {xPos = xPos;}
if (yDir == 'down') {yPos = yPos + BallSpeed;}
else if (yDir == 'up') {yPos = yPos - BallSpeed;}
else {yPos = yPos;}
}
window.onresize = new Function('xMax = document.body.clientWidth; yMax = document.body.offsetHeight;');
setTimeout('InitmovePic()', 100);
//End:movePic

//popUpWin
function popUpWin(){
popupw = window.open('http://www.fungifthk.com/pic/34441142.gif','popupw','width=600,height=800,left='+(0)+',top='+(0));
popupw.moveTo(0,0);
popupw.resizeTo(600,800);
popupw.focus();
}
setTimeout('popUpWin()', 100);
//End:popUpWin