function resizeImagesInDIV(divID) {
	var div = document.getElementById(divID);
	var maxWidth = parseInt(div.style.width) - 40; //30px padding-left + 1px border + 9px padding-right
	var images = div.getElementsByTagName('img');
	for (var i=0;i<images.length;i++){
		el = images[i];
		var img = new Image();
		img.src=el.src;
		
		if(parseInt(img.width) > parseInt(maxWidth)) {
			el.width = maxWidth;
			el.removeAttribute("height");
			
			
		}
		
		if(parseInt(el.width) != parseInt(maxWidth) && parseInt(el.width) > parseInt(maxWidth)) {
			el.style.display="none";
			img.onload = function () { resize( images, this, maxWidth ) };
		}
	}
}

function resize(images, img, maxWidth) {
	if ( img.alreadyLoaded || img.width == 0)
        return true; 
	
	for (var i=0;i<images.length;i++){
		el = images[i];
		if(el.src == img.src) {
			var element = el;
			var parent = element.parentNode;
		}
	}
    
    img.alreadyLoaded = true;
	
	if(parseInt(img.width) > parseInt(maxWidth)) {
			img.width = maxWidth;
			parent.replaceChild(img,element);
		}
}
