var timer; // holds the timeout variable, so we can clear it later
function animate(limit, change, speed) {
var div = document.getElementById('event-fp');
clearTimeout(timer); //clears timer
var h = parseInt(div.style.height,""); // gets the current height of the div
if ((change > 0 && h < limit) || h > limit) { // if change is positive and the height isn't at its max, or if the height isn't at its minimum (negative change implied) then change the height
div.style.height = (h+change) + 'px'; // change height
timer = setTimeout(function () {
animate(limit, change, speed);
}, speed);
}
}
function cngImg() {
var arrow = document.getElementById('arrow');
if(arrow.src.indexOf("darrow.gif") > 0 ) {
arrow.src = "images/uarrow.gif";
animate(160,5,2);
}
else if(arrow.src.indexOf("uarrow.gif") > 0) {
arrow.src = "images/darrow.gif";
animate(40,-5,2);
}
}