function checkPosition(image,max_height)
{
	var img = new Image();
	img.src = image.src;
	image_height=img.height;	
	margin_top=(max_height-image_height)/2;	
	image.style.marginTop=margin_top+'px';
}
function ImageResize( image , maxWidth , maxHeight )
{
	var img = new Image();

	img.src = image.src;
	
	if( ( img.width > 0 ) && ( img.height > 0 ) )
	{
		if( img.width / img.height >= maxWidth / maxHeight )
		{
			if( img.width > maxWidth )
			{ 
				image.width = maxWidth;
				image.height = ( img.height * maxWidth ) / img.width;
			}
			else
			{
				image.width = img.width; 
				image.height = img.height;
			}
		}
		else
		{
			if( img.height > maxHeight )
			{ 
				image.height = maxHeight;
				image.width = ( img.width * maxHeight ) / img.height; 
			}
			else
			{
				image.width = img.width; 
				image.height = img.height;
			}
		}
	}
}