title: Opening bigger version of picture in new window /w javascript
body: <p>I've managed to get the picture to open the bigger version of the picture into a new window using this code:</p>
  
  <pre><code>&lt;IMG SRC="pic_small.jpg" onClick="view();"&gt;
  
  &lt;script language="JavaScript"&gt;
  
  function view() {
  imgsrc = "pic_big.jpg";
  
  
  viewwin = window.open(imgsrc,'viewwin', 'width=600,height=300');    
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>The problem I got now is that I got many more pictures on my webpage and I'd like to not have to write another function for every script but instead having one function for all the pictures. In other words I'd like to have a script that does the same thing as above, but works on all of these (modified if needed) HTML lines</p>
  
  <pre><code>&lt;IMG SRC="pic1_small.jpg" onClick="view();"&gt;
  &lt;IMG SRC="pic2_small.jpg" onClick="view();"&gt;
  &lt;IMG SRC="pic3_small.jpg" onClick="view();"&gt;
  &lt;IMG SRC="pic4_small.jpg" onClick="view();"&gt;
  </code></pre>
  
  <p>I was also wondering if there is some way to make the window that opens the the same size as the big picture.</p>