// JavaScript Document
//Powered by 港湾（QQ：57404811）
//函数说明：随滚动条滚动的广告代码(XHTML可拖动隐藏)

//gw_js_float_scroll("gw_js_float_scroll/");
//主调函数
function gw_js_float_scroll(selfdir,title){ //参数：图片所在路径
	var str="";
	str+="<div id='gw_js_float_scroll1_div' style='position:absolute; top:110px; right:0px; width:165px; z-index:100000;'>";
	str+="<div id='gw_js_float_scroll1_div_move' style='position:absolute; width:165px;'>";
	str+="<div onmousedown='javascript:gw_js_float_scroll1_mdown(gw_js_float_scroll1_div_move);'>";
	str+="<img src='" + selfdir + "top.gif' alt='' border='0' width='165' height='53' usemap='#gw_js_float_scroll1_div_img_top'  style='height:53px;'/>";
	str+="<map name='gw_js_float_scroll1_div_img_top' id='gw_js_float_scroll1_div_img_top'>";
	str+="<area shape='rect' coords='140,0,165,25' href='javascript:gw_js_float_scroll1_hide(\"gw_js_float_scroll1_div\");' />";
	str+="</map>";
	str+="</div>";
	str+="<div id='gw_js_float_scroll1_div_main'>";
	str+="<div style='padding:0px 0px 0px 40px; font-size:12px; font-weight:bold; color:#000000; line-height:33px; background:url(" + selfdir + "bg1.gif);'>"+title+"</div>";
	str+="<table border='0' cellspacing='0' cellpadding='0' style='width:100%; font-size:12px; line-height:30px; background:url(" + selfdir + "bg.gif);'>";
	//by amao 2011-04-27
	if (isArray(links)==false)
	{
		links = links.split("|")
	}
	var i=0
	for (i=0;i<links.length;i++)
	{
		str+="<tr>";
		str+="<td style='height:28px; text-align:center;color:#000;'>"+links[i]+"</td>";
		str+="</tr>";
	}
	str+="</table>";
	str+="<div style='height:21px;'><img src='" + selfdir + "bottom.gif' alt='' border='0' /></div>";
	str+="</div>";
	str+="</div>";
	str+="</div>";
	window.document.writeln(str);
	
	window.setInterval("gw_js_float_scroll1_heartBeat()",1);
	
	window.document.getElementById("gw_js_float_scroll1_div_move").onmousemove=gw_js_float_scroll1_mmove;
	window.document.getElementById("gw_js_float_scroll1_div_move").onmouseup=gw_js_float_scroll1_mup;
}
function isArray(arr) 
{
     return Object.prototype.toString.apply(arr) === '[object Array]';
} 
var gw_js_float_scroll1_obj='';
var gw_js_float_scroll1_lastScrollY=0;
function gw_js_float_scroll1_heartBeat(){
	//diffY=document.documentElement.scrollTop;
	//by amao 兼容webkit浏览器
	diffY=document.body.scrollTop+document.documentElement.scrollTop;
	percent=0.1*(diffY-gw_js_float_scroll1_lastScrollY);
	if(percent>0)percent=window.Math.ceil(percent);
	else percent=window.Math.floor(percent);
	window.document.getElementById("gw_js_float_scroll1_div").style.top=window.parseInt(window.document.getElementById("gw_js_float_scroll1_div").style.top)+percent+"px";
	gw_js_float_scroll1_lastScrollY=gw_js_float_scroll1_lastScrollY+percent;
}
function gw_js_float_scroll1_mdown(Object){
	gw_js_float_scroll1_obj=Object.id;
	window.document.getElementById(gw_js_float_scroll1_obj).setCapture();
	pX=window.event.x-window.document.getElementById(gw_js_float_scroll1_obj).style.pixelLeft;
	pY=window.event.y-window.document.getElementById(gw_js_float_scroll1_obj).style.pixelTop;
}
function gw_js_float_scroll1_mmove(){
	if(gw_js_float_scroll1_obj!=''){
		window.document.getElementById(gw_js_float_scroll1_obj).style.left=window.event.x-pX;
		window.document.getElementById(gw_js_float_scroll1_obj).style.top=window.event.y-pY;
	}
}
function gw_js_float_scroll1_mup(){
	if(gw_js_float_scroll1_obj!=''){
		window.document.getElementById(gw_js_float_scroll1_obj).releaseCapture();
		gw_js_float_scroll1_obj='';
	}
}
function gw_js_float_scroll1_hide(obj){
	obj=window.document.getElementById(obj);
	if(obj.style.display=="none"){obj.style.display="";}
	else{obj.style.display="none";}
}