var infoElement;
var baseTop = -163;
var targetHeight = 1;
var targetTop = baseTop;
var direction = 0; // 0 piilottaa, 1 avaa
var NN = 10;

function changeInfoStatus(){
	if(direction == 0){
		direction = 1;
		showInfo();
	}else{
		direction = 0;
		hideInfo();
	}
}

function initInfo(){
	infoElement = document.getElementById('rispektiiInfo');
	infoElement.style.height = 0+"px";
	infoElement.style.top = baseTop+"px";
	var infoTimer = setInterval("startInfoAnimation()", 10);
}

function showInfo(){
	targetHeight = 163;
	targetTop = baseTop - 17;
}

function hideInfo(){
	targetHeight = 0;
	targetTop = baseTop;
}

function startInfoAnimation(){
	infoElementCurrentHeight = infoElement.style.height.substring(0, infoElement.style.height.length - 2);
	infoElementCurrentTop = infoElement.style.top.substring(0, infoElement.style.top.length - 2);
	if(infoElementCurrentHeight != targetHeight){
		if(infoElementCurrentHeight > targetHeight){
			infoElement.style.height = (((infoElementCurrentHeight * (NN - 1)) + targetHeight) / NN) + "px";
		}
		else if(infoElementCurrentHeight < targetHeight){
			//infoElement.style.height = eval(infoElementCurrentHeight) + 1 +"px";
			infoElement.style.height = (((infoElementCurrentHeight * (NN - 1)) + targetHeight) / NN) + "px";
		}
	}
	if(infoElementCurrentTop != targetTop){
		if(infoElementCurrentTop > targetTop){
			infoElement.style.top = (((infoElementCurrentTop * (NN - 1)) + targetTop) / NN) + "px";
		}
		if(infoElementCurrentTop < targetTop){
			infoElement.style.top = (((infoElementCurrentTop * (NN - 1)) + targetTop) / NN) + "px";
			
		}
	}
	if(infoElementCurrentHeight == 0){
		infoElement.style.visibility = "hidden";
	}else{
		infoElement.style.visibility = "visible";
	}
	
//	window.status = "targetHeight " + targetHeight + " infoElementCurrentHeight " + infoElementCurrentHeight +"targetTop " + targetTop + " infoElementCurrentTop " + infoElementCurrentTop;
}

