	function image_auto_resize(this_s,width,height){
		var ta_image = new Image();
		ta_image.src = this_s.src;

		var widthMargin=ta_image.width-width;
		var heightMargin=ta_image.height-height;
		var src=this_s.src;

		var perW=ta_image.width*(4/7);
		var perH=ta_image.height*(3/7);

/*
		var ss=src.split("/");
		if(ss[5]=="Lifting.JPG") {
			alert(ta_image.width);
			alert(ta_image.height);
		}
*/
		var modd=perW-perH;

		if(widthMargin > 0 && heightMargin > 0 && widthMargin > heightMargin) {//°¡·Î»çÀÌÁî°¡ ¼¼·Î»çÀÌÁîº¸´Ù ´õ ¸¹ÀÌ Å©´Ù¸é (°¡·Î¸¦ ÁÙÀÎ´Ù.)
			if(widthMargin > 0 && heightMargin > 0 && modd < width-height) {
				this_s.width=width;
			} else {
				this_s.height=height;
			}
		} else if(widthMargin > 0 && heightMargin > 0 && widthMargin < heightMargin) {
				this_s.height=height;
		} else {
			this_s.width=ta_image.width;
			this_s.height=ta_image.height;
		}
	}
	
	function image_auto_resize_inarea(this_s,width,height,view){
		//this_s¾ÈÀÇ ¸ðµç ÀÌ¹ÌÁö´Â ÀÚµ¿ ¸®»çÀÌÁî µÈ´Ù.
		//alert(this_s.childNodes.length);
		if(!view){view=true;}
		if(!this_s){return;}
		if(this_s.nodeType!=1){return;}
		for(var i=0,m=this_s.childNodes.length;i<m;i++){
			var ta = this_s.childNodes[i];
			
			if(ta.nodeName=='IMG'){
				//ta.style.border='1px solid #333333';
				image_auto_resize(ta,width,height);
				
				if(view){
					if(!ta.title){ta.title=ta.src;}
					if(!ta.onclick){
						ta.style.cursor='pointer';
						ta.onclick=function(){js_image_view(this,1);}
					}
					if(!ta.onload)
					ta.onload=function(){image_auto_resize(this,width,height);}
					if(!ta.onmouseover)
					ta.onmouseover=function(){image_auto_resize(this,width,height);}
				}
			}
			if(ta.childNodes.length>0){
				image_auto_resize_inarea(ta,width,height);
			}
		}
		return;
		
	}

