Javascript: resize image to fit window, then toggle full size and adjust size on click?
<p>I'm trying to create a small snippet to allow the onloaded image to be adjusted to fit the users resolution. And then allow the user to toggle between the actual image size, and the adjusted image size for their resolution. Here's what I got so far:</p>

<pre><code>&lt;img src="&lt;?=$file['direct_url']?&gt;" border="0" onload="if(this.width&gt;screen.width/1.5) {this.width=screen.width/1.5;this.alt='Click image to view full size';}window.status=this.width;" onmouseover="if(this.alt) this.style.cursor='hand';" onclick="if (this.width=screen.width/1.5) {this.width=screen.width*1.5} else {this.width=screen.width/1.5}"&gt;
</code></pre>

<p>Any help is greatly appreciated!</p>
