// ==UserScript==
// @name imdb.com - IMDb Image DeBlocker
// @author Jeff Prout 
// @namespace http://userjs.org/ 
// @version 1.0
// @description  Allows right click access to photos in IMDb's photo
//			gallery.
// @ujs:category site: enhancements
// @ujs:published 2005-05-28 16:54
// @ujs:modified 2005-09-19 09:19
// @ujs:documentation http://userjs.org/scripts/site/enhancements/imdb-image-deblocker 
// @ujs:download http://userjs.org/scripts/download/site/enhancements/imdb-image-deblocker.js 
// @ujs:download.gm http://userjs.org/scripts/download/site/enhancements/imdb-image-deblocker.user.js
// ==/UserScript==


/* 
 * Some Rights Reserved
 * Creative Commons - Attribution 2.0
 * http://creativecommons.org/licenses/by/2.0/
 */

if(window.location.hostname.match(/(^|\.)imdb.com$/i)) {
  window.addEventListener('load', function(ev) {
    var tables = document.getElementsByTagName("table");
    for (var i = 0 ; table = tables[i]; i++) { 
      if (table.getAttribute("class") == "photosrc") {
        var src = table.getAttribute("background")
        var newImg = document.createElement("img");
        newImg.setAttribute("src", src);
        table.parentNode.replaceChild(newImg, table);
      }
    }
  }, false);
}
