﻿document.write('<div id="piaoimg" style="position:absolute; z-index:1000; left: 10px; top: 10px;" onMouseOver="pause_resume()" onMouseOut="pause_resume()" onclick="alert(\'mmmm\');">');
document.write("<iframe style='width:100px;height:100px;filter:alpha(opacity=0);Opacity:0;position:absolute; left:0px; top:0px;z-index:10;'>");
document.write("</iframe><div style='z-index:1001;'>");
document.write("<a href='#' target=_blank >");
document.write("<img src='/images/piao.jpg' alt='' border=0 width='100' height='100' ></a>");

document.write("</div></div>");

var xPos = document.body.clientWidth-20;
var yPos = document.body.clientHeight/2;
var step = 1;
var delay = 5; 
var pheight = 0;
var pwidth = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
var img=document.getElementById("piaoimg");
img.style.top = yPos;
function changePos() {
pwidth = document.body.clientWidth;
pheight = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
img.style.left = xPos + document.body.scrollLeft+'px';
img.style.top = yPos + document.body.scrollTop+'px';
if (yon) {
yPos = yPos + step;
}else {
yPos = yPos - step;
}
if (yPos < 0) {
yon = 1;
yPos = 0;
}
if (yPos >= (pheight - Hoffset)) {
yon = 0;
yPos = (pheight - Hoffset);
}
if (xon) {
xPos = xPos + step;
}else {
xPos = xPos - step;
}
if (xPos < 0) {
xon = 1;
xPos = 0;
}
if (xPos >= (pwidth - Woffset)) {
xon = 0;
xPos = (pwidth - Woffset);
}
} 
function start() {
img.visibility = "visible";
interval = setInterval('changePos()', delay);
}
function pause_resume() {
if(pause) {
clearInterval(interval);
pause = false;
}else {
interval = setInterval('changePos()',delay);
pause = true;
}
}

function bbbccc(){
alert('ttt');
//img.style.display="none";
//clearInterval(interval);
}


start();
