function check_img_size(img) { //alert("IW: "+img.width); if (img.width>=600) { img.width=600; } if (img.height>=400) { img.height=400; } }