jQuery.imageSlider = function (imgList, options, i) {

  var $imgList = $(imgList);
  var id = "imgwr"+i;

  $imgList.wrap("<div id=\""+id+"\" class=\"imageslider-wrapper\"></div>");

  var $imgWrapper= $("#"+id);

  $imgWrapper.css("width",options.width);
  $imgWrapper.css("height",options.height);

  $imgList.css("position","relative");

  /*$("img",$imgList).mouseover(function(){

    var $Container = $(".search-detail");
    var $Img = $(".search-detail img");
    var $Info = $(".search-detail .info");
    var $this = $(this);

    $Container.fadeOut(300,function(){

      $Img.attr("src",$(".details .src",$this.parent()).html());
      $Info.html($(".details .info",$this.parent()).html());
      $Img.attr("id",$(".details .id",$this.parent()).html());

      if($this.width()>$this.height()){
        $Img.removeClass("portrait");
        $Img.addClass("landscape");
      } else {
        $Img.removeClass("landscape");
        $Img.addClass("portrait");
      }

      $Container.fadeIn(300);


    });




  });*/

//  if(scale>0){
    var tt = $imgList.offset().top+(options.paddingtop/2);


    $imgWrapper.hover(
      function(e){

        $(this).mousemove( function(e) {

            var scale = ($imgList.height()-options.height)/(options.height-options.paddingtop);
            var iw = (options.height/scale)/2;

            var y = e.pageY - tt;
            var scrolly = $.browser.safari ? (y*scale) : (y*-scale);

            $imgList.css("top",scrolly);

          } );

      },
      function(e){
        $(this).unbind("mousemove");
      }
    );
  //}

}

jQuery.fn.imageSlider = function (options) {

    options = options || {};
    options.width = options.width || 100;
    options.height = options.height || 400;
    options.detailmaxwidth = options.detailmaxwidth || 400;
    options.detailmaxheight = options.detailmaxheight || 400;
    options.paddingtop = options.paddingtop || 50;

    return this.each(function (i) {
        new jQuery.imageSlider(this, options, i);
    });

};
