﻿


//document.write("<div id='ad' style='position:absolute;z-index:2000; text-align:right' >");


//if(ad_float_type!="swf")
//	document.write("<a href='" + ad_float_url + "' target = '_blank'><img src='" + ad_float_src + "' alt='" + ad_float_alt + "' border = 0  ></a>");
//else
//	document.write("<EMBED src='" + ad_float_src + "' quality=high TYPE='application/x-shockwave-flash' id=floatAdFlash ></EMBED>");

//document.write("<div style='font-size: 9pt; cursor: pointer;' onclick='hidead();' >关闭×</div></div>");
var html;
if(ad_float_type!="swf")
	html ="<a href='" + ad_float_url + "' target = '_blank'><img src='" + ad_float_src + "' alt='" + ad_float_alt + "' border = 0 width='"+ad_float_Width+"' height='"+ad_float_Height+"' ></a>";
else
	html="<EMBED src='" + ad_float_src + "' quality=high TYPE='application/x-shockwave-flash' id=floatAdFlash ></EMBED>";

html+= "<div style='font-size: 9pt; cursor: pointer;' onclick='hidead();' >关闭×</div>";
 

var x = 50,y = 60
var xin = true, yin = true
var step =3;
var delay = 50
var floatAdObj = document.createElement("IFRAME");
floatAdObj.id = "ad";
floatAdObj.style.position="absolute";
floatAdObj.style.zIndex = "3000";
floatAdObj.frameBorder = false;
floatAdObj.allowTransparency = true;  
document.getElementById('divFloatAD').appendChild(floatAdObj); 
var doc = floatAdObj.contentWindow.document;
doc.write(html); 
doc.close();
doc.body.style.margin="0";
doc.body.style.padding="0";
doc.body.style.backgroundColor="Transparent";

floatAdObj.style.height = doc.body.scrollHeight + 1;
floatAdObj.style.width = doc.body.all[0].children[0].width;  
 
 

function floatAD() {
var L=T=0
var R= document.documentElement.clientWidth-floatAdObj.offsetWidth ;
var B = document.documentElement.clientHeight-floatAdObj.offsetHeight
floatAdObj.style.left = x + document.documentElement.scrollLeft+"px"; 
floatAdObj.style.top = y + document.documentElement.scrollTop+"px";
x = x + step*(xin?1:-1)
if (x < L) { xin = true; x = L}
if (x > R){ xin = false; x = R}
y = y + step*(yin?1:-1)
if (y < T) { yin = true; y = T }
if (y > B) { yin = false; y = B }
}
var itl= setInterval("floatAD()", delay)
floatAdObj.onmouseover=function(){clearInterval(itl)}

floatAdObj.onmouseout=function(){itl=setInterval("floatAD()", delay)}

floatAdObj.contentWindow.hidead = function(){clearInterval(itl); floatAdObj.style.display='none';}



