(function(b){b.fn.gzGallery=function(c){c=b.extend({keyControl:true,index:0},c);c.$=this;return new a(c)};function a(c){this.$=c.$;this.$.addClass("gzgallery");this.origin=this.$.find("ul").hide();this.$.append(this.templates);this.imgWrapper=this.$.find(".img-wrapper");this.gzgSlider=this.$.find(".gzg-slider-ul ul");this.index=0;this.length=0;this.leftItem=0;this.navWidth=142;this.length=this.origin.children("li").length;this.origin.children("li").each(function(d){return function(f){d.gzgSlider.append('
'+((f+1)+"/"+d.length)+"")}}(this));this.navLen=Math.floor(this.$.find(".gzg-slider-ul").width()/this.navWidth);this.$.find(".pic-silde-right,.gzg-next").click(function(d){return function(){d.slideNext()}}(this));this.$.find(".pic-silde-left,.gzg-front").click(function(d){return function(){d.slideFront()}}(this));this.$.find(".gzg-nav li").click(function(d){return function(){d.show(d.$.find(".gzg-nav li").index(this))}}(this));this.$.find(".gzg-next,.gzg-front").hover(function(){b(this).children("a").fadeIn()},function(){b(this).children("a").fadeOut()});if(c.index<0||c.index>this.length){c.index=0}this.show(c.index);if(c.keyControl){b(document.body).keydown(function(d){return function(g){var f=g.keyCode;if(f==37){d.slideFront()}else{if(f==39){d.slideNext()}}}}(this))}}a.prototype.templates=' ';a.prototype.slideNext=function(){if(this.index>=this.length-1){this.index=-1}this.index++;this.show(this.index)};a.prototype.slideFront=function(){if(this.index<=0){this.index=this.length}this.index--;this.show(this.index)};a.prototype.show=function(c){if(c<0||c>this.length){return false}this.index=c;if(c>=this.leftItem+this.navLen){var d=c-this.navLen-this.leftItem+1;this.$.find(".gzg-slider-ul ul").animate({left:"-="+this.navWidth*d},200);this.leftItem+=d}else{if(cg){f.nextImg.css({width:g,height:g/h*i})}f.$.find(".gzg-next,.gzg-front").height(f.$.find(".gzg-img").height())}}}(this);var d=this.origin.find("li:eq("+e+") ");var c=d.children("div");if(c.length>0){this.$.find(".gzg-txt").show().html(c.html())}else{this.$.find(".gzg-txt").hide()}this.nextImg.attr("src",d.children("img").attr("data-origin"))}})(jQuery)