function pausecomp(millis) 
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); } 
while(curDate-date < millis);
} 


function resizeMe(i,size,wh)
		{
			//2007.12.03		Barry LaLone
			// this function will dynamically resize an image while maintaining the
			//aspect ratio and preventing the CurPage from flickering while rerendering / sizing
			
			var x=i.width;
			var y=i.height;
			var ret=0;
			var retries=5;
			var myret=0;
			
			if(x==0 && y==0)
				for(myret=1;myret<retries;myret++)
				{
					ret=pausecomp(20);
					x=i.width;
					y=i.height;
					if(x!=0 || y!=0)
						break;
				}
			
			var ar=x/y;
			if(wh=='width')
			{
				y=size/ar;
				x=size;
			
			} // end of if width
		else
			{
				x=size*ar;
				y=size;
			}// end of if height
			
			//for extra tall images limit the height to 200 and resize the
			//width based on this
			
			if(y>400)
				{
				y=400;
				size=y;
				
				if(ar<1)
					x=size*ar;
				else
					x=size/ar;	
				}
				
				// assign the new width and height
				i.width=x;
				i.height=y;
				// show the image
				i.style.visibility="visible";
				i.style.position="relative";
				i.style.top="0";
				i.style.left="0";				
		}   // end of function
