function ADMM_showHideLayers() { //v9.0
  var i,p,v,obj,args=ADMM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function RightADClass(ImgID)
{
	
	//浮动图片对象	
	this.ADNode = null;
	
	//当前Y坐标
	this.lastScrollY = 0;

	function setToRightCorner(ele)
	{
		if(ele)
		{	    
			var body = document.body;		
			ele.style.top=(body.scrollTop+30)+"px";
			ele.style.left=(body.scrollLeft+body.clientWidth-ele.offsetWidth-1)+"px";		
		}
	}

	this.heartBeat = function()
	{
		var diffY=document.documentElement.scrollTop; 
		var percent=0.1*(diffY-this.lastScrollY); 
		if(percent>0)
			percent=Math.ceil(percent); 
		else 
			percent=Math.floor(percent); 		
		if(this.ADNode)
		{			
			this.ADNode.style.top=parseInt(this.ADNode.style.top)+percent+"px";
		}
		this.lastScrollY=this.lastScrollY+percent; 
	}

	
	var _self = this;//当前对象	

	this.ActionStart = function(ADObj)
	{
		return function()
		{
			if(!ADObj.ADNode)
			{
				ADObj.ADNode = document.createElement('div');
				ADObj.ADNode.id = ImgID;
				var htmlStr = "<div id=\"sorollDiv1\" style=\"width:104px; height:384px; right:10px; position:absolute; top:120px;\">"
	+ "<div id=\"apDiv3\" style=\"position:absolute;width:104px;height:385px;z-index:2;\">"
	+ "<table width=\"104\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
    + "<tr>"
    + "<td>"
	+ "<img src=\"http://www.chinagames.net/tuiguang/images/rmtj1.gif\" width=\"104\" height=\"37\" border=\"0\" usemap=\"#Map30\">"
	+ "</td>"
    + "</tr>"
    + "<tr>"
    + "<td align=\"center\">"
	+ "<iframe marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" width=\"104\" height=\"228\" scrolling=\"NO\" src=\"http://www.chinagames.net/node_3663.htm\" allowTransparency=\"true\">"
	+ "</iframe>"
	+ "</td>"
    + "</tr>"
    + "<tr>"
    + "<td align=\"center\">"
	+ "<img src=\"http://www.chinagames.net/tuiguang/images/shou.gif\" style=\"cursor:hand;\" alt=\"收起\" width=\"100\" height=\"21\" border=\"0\" onclick=\"ADMM_showHideLayers('apDiv3','','hide','apDiv2','','show')\">"
	+ "</td>"
    + "</tr>"
    + "</table>"
	+ "<map name=\"Map30\" id=\"Map30\">"
    + "<area shape=\"rect\" coords=\"87,3,100,15\" href=\"#\" alt=\"关闭\" onclick=\"ADMM_showHideLayers('sorollDiv1','','hide','apDiv3','','hide','apDiv2','','hide');return false;\">"
    + "</map>"
	+ "</div>"
	+ "<div id=\"apDiv2\" style=\"position:absolute;width:105px;height:76px;z-index:3;visibility: hidden;\">"
    + "<table width=\"104\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
    + "<tr>"
    + "<td>"
	+ "<img src=\"http://www.chinagames.net/tuiguang/images/rmtj1.gif\" width=\"104\" height=\"37\" border=\"0\" usemap=\"#Map20\">"
	+ "</td>"
    + "</tr>"
    + "<tr>"
    + "<td>"
	+ "<img src=\"http://www.chinagames.net/tuiguang/images/xl.gif\" style=\"cursor:hand;\" alt=\"展开\" width=\"104\" height=\"23\" border=\"0\" onclick=\"ADMM_showHideLayers('apDiv3','','show','apDiv2','','hide')\">"
	+ "</td>"
    + "</tr>"
    + "<tr>"
    + "<td align=\"center\">"
	+ "<img src=\"http://www.chinagames.net/tuiguang/images/xlx.gif\" width=\"100\" height=\"15\">"
	+ "</td>"
    + "</tr>"
    + "</table>"
	+ "<map name=\"Map20\" id=\"Map20\">"
	+ "<area shape=\"rect\" coords=\"87,3,100,15\" href=\"#\" alt=\"关闭\" onclick=\"ADMM_showHideLayers('sorollDiv1','','hide','apDiv3','','hide','apDiv2','','hide');return false;\">"
    + "</map>"
	+ "</div>"
	+ "</div>";
				ADObj.ADNode.innerHTML = htmlStr;
				ADObj.ADNode.style.position = "absolute";
				ADObj.ADNode.style.top = "30px";	
				ADObj.ADNode.style.right = "10px";
				var parentObj = document.body;				
				if(parentObj)
					parentObj.appendChild(ADObj.ADNode,null);			
			}
			setToRightCorner(ADObj.ADNode);
		}
	}
	
	if (document.all) 
	{ 	
		window.attachEvent('onload', this.ActionStart(this));
		window.attachEvent('onresize', this.ActionStart(this));
		window.attachEvent('onscroll', this.ActionStart(this));
	}   
	else 
	{      
		document.addEventListener( "DOMContentLoaded", this.ActionStart(this), false );
	    window.addEventListener('resize', this.ActionStart(this), false);
		window.addEventListener('scroll', this.ActionStart(this), false);
	}		
}

new RightADClass("ADTest");
