(function($){var imgview=function(){function slideimg(el){return $(el).bind('mouseover mousemove',function(event){var offset=$(this).offset(),w=$(this).width();if(event.pageX>=offset.left+w/2){this.style.cursor='url("/images/cover/right.cur"), auto';this.title=lang.imgview.click_next+'»';$(this).data('d',1);}else{this.style.cursor='url("/images/cover/left.cur"), auto';this.title='«'+lang.imgview.click_prev;$(this).data('d',-1);}}).bind('load',function(){$(this).parent().removeClass('loading').css('height','auto').children().show();});}
function go(el,url,alt){alt=alt?alt:'';var h=$(el).parent().height();$(el).parent().height(h).addClass('loading').children().hide();$(el).attr({'src':url,'alt':alt}).data('alt').text(alt);}
return{'init':function(urls,alts){var el=$(this).find('img'),c=0,e=$('<div class="imgviewbar"><a href="#">'+lang.imgview.next+'</a><a href="#">'+lang.imgview.prev+'</a>'+lang.imgview.the+'<span>1</span>/'+urls.length+lang.imgview.piece+'</div>'),f=e.find('span'),g=function(n){c=n<0?urls.length-1:n>=urls.length?0:n;go(el,urls[c],alts[c]);f.text(c+1);};$(el).data({'alt':$(this).find('p')});el=new slideimg(el);el.click(function(){var n=parseInt(c+$(this).data('d'));g(n);});e.find('a').click(function(){var n=$(this).index()==0?1:-1;n=parseInt(c+n);g(n);return false;});$(this).before(e);}};}();$.fn.imgview=imgview.init;})(jQuery);
