// JavaScript Document
function resizeImage(img,nsize)
{
	var nWidth=img.width;
	var	nHeight=img.height;	
	nScale = nWidth/nHeight;		
	//Check:
	if (nScale > 1) {
		nWidth = nsize;		
		nHeight = (nWidth*img.height)/img.width;
		//fix vertical-align:	
		nMargin = (nWidth - nHeight)/2;
		//Set style to image:
		img.width = nWidth;
		img.height = nHeight;
		img.style.margin = nMargin + 'px 0px';
		}
	else {
		//Return size:
		nHeight = nsize;
		nWidth = (nHeight*img.width)/img.height;
		//fix align:	
		nMargin = (nHeight - nWidth)/2;	
		//Set style to image:	
		img.width = nWidth;
		img.height = nHeight;
		img.style.margin = '0px ' + nMargin + 'px';
	}	
};
function scaleSize(a,b,c){var d=a.height;var e=a.width;var f=d/e;if(e>=b&&f<=1){d=calHeight(b,f,c);e=d/f;var g=(c-d)/2}else if(d>=c){e=calWidth(c,f,b);d=e*f;var g=(b-e)/2;a.style.margin='0px '+g+'px'}var h=(c-d)/2;var i=(b-e)/2;a.style.margin=h+'px '+i+'px';a.height=d;a.width=e}function calHeight(w,a,b){var h=w*a;if(h>b){h=b}return h}function calWidth(h,a,b){var w=h/a;if(w>b){w=b}return w}
