Under Review
If 80% of the container width is smaller than the image default width the image is reduced to 80% of the container width.
qw.innerHTML="Div Width = "+divWidth+"
"
+"80% = "+percentageWidth+"
"
+"Pic current width = "+document.images["mypic"].offsetWidth+"
"
+"Pic width = "+pic.width