//<!--
expColEnabled = true;
//lineal o cuadratico
algoritmo = "cuadratico"
function expandCollapse(divName,maxHeight, duration){
	if (expColEnabled){
		//btnDiv
		divNum = divName.split("bodyDiv")[1]
		animCount = 0;
		_maxHeight = maxHeight;
		animDuration = duration;
		if (document.getElementById(divName).style.height == "1px"){
			document.getElementById("btnDiv"+divNum).innerText = "(cerrar)"
			resizeDiv(divName,maxHeight,"abre")
		}else{
			document.getElementById("btnDiv"+divNum).innerText = "(ampliar)"
			resizeDiv(divName,maxHeight,"cierra")
		}
	}
}
function resizeDiv(divName,height,direccion){
	expColEnabled = false;
	divInterval = setInterval("resizeInterval('"+divName+"',"+height+",'"+direccion+"')",1)
}
function resizeInterval(divName,destHeight,direccion){
	tempheight=document.getElementById(divName).style.height;
	//these lines split the height value from the 'px' units 
	heightArray=tempheight.split('p');
	curheight=parseInt(heightArray[0]);
	if (animCount != animDuration){
		animCount = animCount+1;
		if (direccion == "abre"){
			if (algoritmo == "cuadratico"){ 
				newHeight = Math.round(animCount*animCount * destHeight / animDuration / animDuration)
			}else{
				newHeight = Math.round(animCount * destHeight / animDuration)
			}
		}else{
			if (algoritmo == "cuadratico"){ 
				newHeight = Math.round((animDuration - animCount)*(animDuration - animCount) * destHeight / animDuration / animDuration)
			}else{
			newHeight = Math.round((animDuration - animCount) * destHeight / animDuration)
			}
		}
		if (newHeight == 0){
			document.getElementById(divName).style.height = "1px"
		}else{
			document.getElementById(divName).style.height = newHeight +"px"
		}
	}else{
		clearInterval(divInterval)
		expColEnabled = true;
	}	
}
//-->