var object = new Array();

function Slide(N,oCont){
	this.N  = N;
	this.S  = 1.1;
	this.object = new Array();

	this.getSumPrevTitleH = function(N){
		var res = 0;
		if (N >= 0) {
			for (var i = N-1; i >= 0; i-=1){
				res += this.object[i].tit.clientHeight;
			}
		} else {
			for (var i = Math.abs(N); i < this.NF; i+=1){
				res += this.object[i].tit.clientHeight;
			}
		}
		return res;
	}

	this.CObj = function (parent,N){

		this.parent = parent;
		this.N = N;
		this.obj = this.parent.frm[N];
		this.tit = this.obj.firstChild;
		this.div = this.obj.getElementsByTagName("div")[1];
		this.div.style.visibility = "hidden";

		this.y0 = this.y1 = this.parent.getSumPrevTitleH(N);

		this.obj.style.top = (this.y0)+"px";
		this.obj.style.height = (this.parent.H - this.y0)+"px";
		this.obj.style.visibility = "visible";
		this.obj.parent = this;
		this.run = false;

		this.move = function(){
			with(this){
				dy = (y1-y0)/parent.S;
				if(Math.abs(dy)>.05){
					y0+=dy;
					obj.style.top = (Math.round(y0))+'px';
					setTimeout("object["+parent.N+"].object["+N+"].move();", 16);
				} else {
					run = false;
					if(dy>0)div.style.visibility="hidden";
					else if(N>0)parent.object[N-1].div.style.visibility="hidden";
				}
			}
		}

		this.obj.onclick = function(){
			with(this.parent){
				if(!run){
					run = true;
					div.style.visibility="visible";
					for(i=0;i<=N;i++){
						parent.object[i].y1 = parent.getSumPrevTitleH(i);
						parent.object[i].move();
					}
					for(i=N+1;i<parent.NF;i++){
						parent.object[i].y1 = (parent.H - parent.getSumPrevTitleH(-i));
						parent.object[i].move();
					}
				}
			}
		}
	}

	this.frm = document.getElementById(oCont);
	this.H = this.frm.clientHeight;
	this.frm = this.frm.getElementsByTagName("div");
	var frm1 = new Array();
	var kkk = 0;
	for (ii=0; ii<this.frm.length;ii++){
		if (this.frm[ii].id.match("top_menu_content")){frm1[kkk] = this.frm[ii]; kkk++;}
	}
	this.frm = frm1;
	this.NF = this.frm.length;
	for(i=0;i<this.NF;i++) this.object[i] = new this.CObj(this, i);
	this.object[0].obj.onclick();
	this.S = 8;
}