// JavaScript Document
var startHeight = 360; //Set this to the start height of your flash content
//var animationIntervall = 20; //Time in miliseconds betweem each animation step
var animationIntervall = 31; //Time in miliseconds betweem each animation step


var easeValue = 10; //The easeing vallue
var animateFlashContentDelay; //TimeoutID
var heightTgt; //The target variable uesed to animate the flash content
var flashObj;
var flashBox;
var currHeight = startHeight;

//Function called from flash to resize the content to a specific height

function animateContent(h) {     
	//alert("flashobj: " + document.getElementById('flashContent'));
	//alert("flashBox: " + document.getElementById('flashBox'));

    flashObj = document.getElementById('flashContent');
	flashBox = document.getElementById('flashBox');
		
	//alert("flashBox.style.height: " + flashBox.style.height)
	
	heightTgt = h;		
	//Starts the animation
	//alert("ska strax kicka animationIntervall");
	animateFlashContentDelay = setTimeout('animateFlashContent()',animationIntervall);
}



function animateFlashContent() {
    var newHeight = currHeight;
    newHeight += (heightTgt-newHeight)/easeValue;
    
	if(Math.abs(heightTgt - newHeight)<4) {
		//alert("klara nu i JS");
        newHeigth = heightTgt;  
		//ml 101007
		
		flashBox.style.height = newHeight + 'px';
		flashObj.onResize(newHeight);
				
		//clearTimeout(animateFlashContentDelay);
		currHeight = newHeight;
		
    //elsegren nytt 101007
	}else{
		//flashObj.style.height = newHeight + 'px';	
		flashBox.style.height = newHeight + 'px';
		//alert("scrolla nu till: " + newHeight);
		//flashObj.style.height = newHeight + 'px';	
		//alert("newHeight: " + newHeight);
		//alert(flashObj.onResize);
		
		//funkar ej i IE 9
		flashObj.onResize(newHeight);
		//flashObj.onResize(600);
		
		
		//alert("kommer hit: " + newHeight);
		
		animateFlashContentDelay = setTimeout('animateFlashContent()',animationIntervall);
		currHeight = newHeight;
	}
}




