//A continuación construyo un objeto telon basado en el ojeto ConstructObject
function telonVertical(obj,nest,w,h) { 
	this.constructObject = new ConstructObject(obj,nest);
	this.constructObject.w=w
	this.constructObject.h=h
	this.hm=parseInt((this.constructObject.h-1)/2);
	this.constructObject.setClip(this.hm,this.constructObject.w,this.hm+1,0);
	this.constructObject.setClip(0,this.constructObject.w,this.constructObject.h,0);
	this.clipPath = [];

	this.stoppedTelon=true;

	this.obj = obj + "Telon";
	eval(this.obj + "=this");
	return this 
}

telonVertical.prototype.setClipPathAbrir = function(numPasos){
	var hmfinal = 0;
	var hminicial = this.constructObject.clipBottom;
	var incClip=(hminicial/numPasos);
	this.clipPath.length=numPasos+1;
	this.clipPath[numPasos]=hminicial;
	for (var i=numPasos-1;i>0;i--) this.clipPath[i]=parseInt(incClip*i);
	this.clipPath[0]=hmfinal;
}

telonVertical.prototype.abrirTelon = function(ms,numPasos,onAbrirEnd){
	this.setClipPathAbrir(numPasos);
	if (this.stoppedTelon) this.startAbrirTelon(ms,onAbrirEnd);	
}

telonVertical.prototype.startAbrirTelon = function(ms,onAbrirEnd){
	this.stoppedTelon = false;
	this.constructObject.show();
	this.runTelon(ms,onAbrirEnd);
}

telonVertical.prototype.runTelon = function(ms,onAbrirEnd){
	if (this.clipPath.length<=0){
		this.stoppedTelon = true;
		if (this.hm+1 == this.constructObject.clipBottom) this.constructObject.hide();
		if (onAbrirEnd) eval(onAbrirEnd);
	}else{
		this.constructObject.setClip((this.clipPath[this.clipPath.length-1]),this.constructObject.w,(this.constructObject.h-this.clipPath[this.clipPath.length-1]),0)
		this.clipPath.length--;
		setTimeout(this.obj+".runTelon("+ms+",'"+onAbrirEnd+"')",ms);
	}
}

telonVertical.prototype.setClipPathCerrar = function(numPasos){
	var hmfinal = this.hm;
	var hminicial = 0;
	var incClip=(hmfinal/numPasos);
	this.clipPath.length=numPasos+1
	this.clipPath[numPasos]=hminicial
	for (var i=numPasos-1;i>0;i--) this.clipPath[i]=parseInt(hmfinal-incClip*i);
	this.clipPath[0]=hmfinal;
}

telonVertical.prototype.cerrarTelon = function(ms,numPasos,onCerrarEnd){
	this.setClipPathCerrar(numPasos);
	if (this.stoppedTelon) this.startCerrarTelon(ms,onCerrarEnd);	
}

telonVertical.prototype.startCerrarTelon = function(ms,onCerrarEnd){
	this.stoppedTelon = false;
	this.runTelon(ms,onCerrarEnd);
}

telonVertical.prototype.writeHTML = function(html){
	this.constructObject.writeHTML(html);
}