﻿function showDl(id,closeID,y,speed){
	this.y = y;
	this.speed = speed;
	this.box = document.getElementById(id);
	this.closeId = document.getElementById(closeID);
	this.box.style.top = this.y + "px";
	this.conut = 0;
	this.closeId.onclick = function(){
		this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);
		return false;
	}
}

showDl.prototype.dlScroll = function(){
	var _this = this;
	var top = parseInt(this.box.style.top);
	var scrollTop = window.pageYOffset
		|| document.documentElement.scrollTop
		|| document.body.scrollTop
		|| 0;
	if(top-scrollTop-this.y < 0){
		this.conut += Math.ceil((scrollTop + this.y - top)/this.speed);
		this.box.style.top = top + this.conut + 'px';
		setTimeout(function(){_this.dlScroll()},15);
	}else{
		this.conut = 0;
	}
	if(top-scrollTop-this.y > 0){
		this.conut += Math.ceil((top - scrollTop - this.y)/this.speed);
		this.box.style.top = top - this.conut + 'px';
		setTimeout(function(){_this.dlScroll()},15);
	}else{
		this.count = 0;
	}
}