
var isflash = 1; 			//是否为FLASH文件的漂浮 1=是 0=否
var pic = "/f.gif"; 		//图片的地址
var alt = "德文车业";  //鼠标放在图片上时显示的提示文字
var url = "http://www.ln2car.com/"; //图片链接的地址
var flashurl = "http://www.ln2car.com/upload/uploadfile/200911416204.swf";  	//FLASH文件的路径
var Wimg = 120;  			//图像的宽度
var Himg = 80; 			  //图像的高度

if (isflash == 1) {
    document.write("<div id='AD' style=' z-index: 1;position: absolute;top: 0 px;left: 0 px;'><embed pluginspage='http://&#13;&#10;www.macromedia.com/go/getflashplayer' src='" + flashurl + "' width='" + Wimg + "' height='" + Himg + "' type='application/x-shockwave-flash' quality='high' wmode='opaque'></embed></div>");
}
else {
    document.write("<div id='AD' style=' z-index: 1;position: absolute;top: 0 px;left: 0 px;'><a href='http://whsp.db2car.com/' target='_blank'><img border='0' src='" + url + "' width='" + Wimg + "' height='" + Himg + "'></a></div>");
}

var xPos = 20;

var yPos = document.documentElement.clientHeight;

var step = 1;

var delay = 30;

var height = 0;

var Hoffset = 0;

var Woffset = 0;

var yon = 0;

var xon = 0;

var pause = true;

var interval;

AD.style.top = yPos;

function changePos() {

    width = document.documentElement.clientWidth;

    height = document.documentElement.clientHeight;

    Hoffset = AD.offsetHeight;

    Woffset = AD.offsetWidth;

    AD.style.left = xPos + document.documentElement.scrollLeft;

    AD.style.top = yPos + document.documentElement.scrollTop;

    if (yon) {

        yPos = yPos + step;

    }

    else {

        yPos = yPos - step;

    }

    if (yPos < 0) {

        yon = 1;

        yPos = 0;

    }

    if (yPos >= (height - Hoffset)) {

        yon = 0;

        yPos = (height - Hoffset);

    }

    if (xon) {

        xPos = xPos + step;

    }

    else {

        xPos = xPos - step;

    }

    if (xPos < 0) {

        xon = 1;

        xPos = 0;

    }

    if (xPos >= (width - Woffset)) {

        xon = 0;

        xPos = (width - Woffset);

    }

}

function start() {

    AD.visibility = "visible";

    interval = setInterval('changePos()', delay);

}

function pause_resume() {

    if (pause) {

        clearInterval(interval);

        pause = false;

    }

    else {

        interval = setInterval('changePos()', delay);

        pause = true;

    }

}

start();