﻿// JScript 文件

function classOpenDiv()
{
	this.width=1;
	this.height=100;
	this.speed=6;
	this.elementDiv=null;
	this.timer=6;
	var thisObj=this;
	var pross=null;
	
	function _openHeight()
	{		
		var currentElementY = parseInt(this.elementDiv.style.height,10);		
		if(currentElementY<this.height) {
			this.elementDiv.style.height = (currentElementY + Math.ceil((this.height-currentElementY)/this.speed))+"px";			
			
		} else {			
			window.clearInterval(pross);
		}	

	}
	
	function _closeHeight()
	{
		var currentElementY = parseInt(this.elementDiv.style.height,10);	
		
		if(currentElementY>1)
		{
		    var value=(currentElementY - Math.ceil(currentElementY/this.speed));
		    value=value==0?1:value;
			this.elementDiv.style.height = value+"px";
		}
		else
		{
			window.clearInterval(pross);		
			this.elementDiv.style.display = "none";			
		}
		
	}
	
	this.openHeight=function()
	{
		if(this.elementDiv.style.display == "block") return;
		window.clearInterval(pross);
		this.elementDiv.style.display = "block";
		this.elementDiv.style.height = "1px";		
		pross=window.setInterval(function(){_openHeight.apply(thisObj)},this.timer);	
			
	}
	
	this.closeHeight=function()
	{
		if(this.elementDiv.style.display == "block")
		{			
			pross=window.setInterval(function(){_closeHeight.apply(thisObj)},this.timer);
		}
	}
	
	this.openWidth=function()
	{
		
	}
}
