//fonction to transform link

  function processNode() {
    var href = jQuery(this).attr("href");
    if(/[a-z]\:\/\//.exec(href) === null) {
      if(href[0] == "/")
        jQuery(this).attr("href", "http://www.imdb.com" + href);
    }
  }

CmdUtils.CreateCommand({
  name: "imdbPreview",
  icon:"http://www.imdb.com/favicon.ico",
  takes: {"input": noun_arb_text},
  homepage: "http://gist.github.com/57852", 
  author: { name: "A.BLANC", email: "amau96@gmail.com"}, 
  license: "MPL", 
  description: "Find information about a movie on IMDB.com", 

  preview: function(previewBlock,input) {

     previewBlock.innerHTML ="Welcome to IMDB search, please enter the name of the movie :<br /><center><img src=\"http://i.media-imdb.com/images/nb15/logo2.gif\" width=\"50%\" height=\"50%\" ></center>";

     url="http://www.google.com/search?btnI=ok&q=imdb+"+input.text;


   if(input.text!=""){
    Utils.parseRemoteDocument(
      url, // URL
      null, // post data
      function(doc) { // success callback


jQuery("*",doc).css("color","#CCC");
jQuery("a",doc).css("color","#003399");
jQuery("span",doc).css("font-size","59%");
jQuery("#top_center_wrapper",doc).hide();
jQuery("#top_center_after",doc).hide();
jQuery("#tn15adrhs",doc).hide();
jQuery(".starbar .inner",doc).css("background","transparent url(http://i.media-imdb.com/images/SF9cafc9501d815ffdcef81a364ea168dd/tn15/stars.gif) no-repeat scroll 0 -20px");
jQuery(".starbar .inner",doc).css("height","20px");
jQuery("#tn15rating.two .general",doc).css("top","-40");
jQuery("#tn15rating.two .us",doc).css("height","3em");
jQuery("#tn15rating .rating",doc).css("position","relative");
jQuery(".starbar .outer",doc).css("background","transparent url(http://i.media-imdb.com/images/SF9cafc9501d815ffdcef81a364ea168dd/tn15/stars.gif) no-repeat scroll 0 0");
jQuery(".starbar .outer",doc).css("width","200px");
jQuery(".meta",doc).css("position","absolute");

jQuery("#tn15rating .bottom div.left",doc).css("top","20px");
jQuery("#tn15rating .bottom div.left",doc).css("position","absolute");
jQuery("#tn15main .info h5",doc).css("position","absolute");
jQuery("#tn15main .info h5",doc).css("margin-left","-10em");
jQuery("#tn15main .info",doc).css("margin-left","10em");
jQuery("#tn15main h5",doc).css("font-size","100%");
jQuery("#tn15rating.two .usr",doc).css("height","3em");
jQuery("#tn15main .info h5",doc).css("margin-top","0");
jQuery("#tn15rating.two .usr",doc).css("height","3em");
jQuery("#tn15rating.two .usr",doc).css("height","3em");

jQuery("table",doc).find("a").each(processNode);
jQuery(".info",doc).find("a").each(processNode);


         previewBlock.innerHTML = "<div style=\"position:relative;    min-height:50px;max-height: 500px;overflow-y: scroll;\">"+jQuery("#tn15title", doc).html()+jQuery("#tn15content", doc).html()+"</div>";


      },
      function() { // error callback
        previewBlock.innerHTML = "Error!";
      }
    );
   }//end of if input.text==""
  } //fin de preview
});