/* width scaling functions */
/* These are based on initial work by Emrah Baskaya with some modications */

function doWidthChangeMem(elem,startWidth,endWidth,steps,intervals,powr) { 

    if (elem.widthChangeMemInt)
	window.clearInterval(elem.widthChangeMemInt);
    var actStep = 0;
    elem.widthChangeMemInt = window.setInterval(
	function() { 
	  elem.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
	  elem.style.width = elem.currentWidth + "px"; 
	  actStep++;
	  if (actStep > steps) window.clearInterval(elem.widthChangeMemInt);
	} 
	,intervals)
}

function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) { 
    
	var delta = maxValue - minValue; 
    
	//alert("Min Value Is: " + minValue);
	//alert("Change is: " + (parseInt(minValue) + parseInt((Math.pow(((1 / totalSteps) * actualStep), powr) * delta))));
	var stepp = parseInt(minValue) + parseInt(Math.pow(((1 / totalSteps) * actualStep), powr) * delta); 
	
	
	
    return Math.ceil(stepp) 
} 