


var imgElement,d,j=1,n=20,t=40;
var swd,sht,lwd,lht
function expandImage(element, width, height, expWidth,expHeight){

	imgElement=element;
	d=1;
	swd=width;
	sht=height;
	lwd=expWidth;
	lht=expHeight;
	rs();
}
function reduceImage(element, width, height, expWidth,expHeight){
	d=-1;
	swd=width;
	sht=height;
	lwd=expWidth;
	lht=expHeight;
	rs();
}

function xy(x1,x2,j){return (x2-x1)*j/n+x1;}
function rs(){
	imgElement.style.width=xy(swd,lwd,j);
	imgElement.style.height=xy(sht,lht,j);
	if(d>0 && n>j){
		j++;
		setTimeout('rs()',t);
	}else if(0>d && j>0){
	j--;setTimeout('rs()',t);
	}
} 

