jQuery.fn.gallery_sskazka=function(a){function u(){jQuery(f).outerWidth()+jQuery(f).position().left-p>n+l?jQuery(f).animate({left:"-="+l+"px"},a.speed_scroll,function(){$("#"+m).fadeTo("fast",1);jQuery(f).width()+jQuery(f).position().left<n&&jQuery(f).animate({left:"-"+(jQuery(f).width()-n)+"px"},a.speed_scroll,function(){$("#"+j).fadeTo("fast",a.fade);$(this).dequeue()});$(this).dequeue()}):jQuery(f).animate({left:"-"+(jQuery(f).width()-n)+"px"},a.speed_scroll,function(){$("#"+m).fadeTo("fast",1); $("#"+j).fadeTo("fast",a.fade);$(this).dequeue()})}function v(){jQuery(f).position().left<p&&(jQuery(f).position().left+p>=-1*l?jQuery(f).animate({left:"0px"},a.speed_scroll,function(){$("#"+m).fadeTo("fast",a.fade);$("#"+j).fadeTo("fast",1);$(this).dequeue()}):jQuery(f).animate({left:"+="+l+"px"},a.speed_scroll,function(){$("#"+j).fadeTo("fast",1);jQuery(f).position().left+p>0&&jQuery(f).animate({left:"0px"},a.speed_scroll,function(){$("#"+m).fadeTo("fast",a.fade);$(this).dequeue()});$(this).dequeue()}))} function s(c){$(d+" img").attr("src")!=c&&(a.zoom||($(d).css({background:'url("'+$(d+" img").attr("src")+'")'}),$(d+" img").css({display:"none"}),b[$(d+" img").attr("src")]&&a.show_inner?$(d+" img").unwrap('<a href="'+b[c]+'" />'):($("."+o).hide(),$("."+o).remove())),a.zoom&&$(d+" img").stop(!0,!0).css({width:"446px",height:"297px"}),$(d+" img").attr("src",c).fadeIn(a.show_speed,function(){if(a.show_inner)b[c]&&$(d+" img").wrap('<a href="'+b[c]+'" />');else if(a.zoom)$(d+" img").animate({width:"480px", height:"320px"},a.slide_time);else{for(var g in b[c])b[c][g].length==6&&($(d).prepend('<a class="'+o+'" style="left:'+b[c][g][0]+"px; top:"+b[c][g][1]+'px;" href="'+b[c][g][5]+'"><div id="'+b[c][g][0]+'" class="hint"><div class="hint-container"><span class="coll-header">'+b[c][g][2]+"</span>"+b[c][g][3]+'<span class="coll-art">\u0410\u0440\u0442.: '+b[c][g][4]+"</span></div></div></a>"),parseInt(b[c][g][0])+$(".hint").width()+parseInt($(".hint").css("left"))+10>=y&&$("#"+b[c][g][0]).css({left:"auto", right:"21px"}),parseInt(b[c][g][1])+$(".hint").height()+parseInt($(".hint").css("top"))+10>=z&&$("#"+b[c][g][0]).css({top:"auto",bottom:"31px"}),$("."+o).show());$(".marker").ifixpng().css({cursor:"pointer"});$("."+o).hover(function(){$(this).css({"z-index":100});$(this).find(".hint").show()},function(){$(this).find(".hint").hide();$(this).css({"z-index":1})})}}),$(e+" a.selected").fadeTo("fast",a.fade),$(e+" a").removeClass("selected"),$(e+" a").each(function(){if($(this).attr("href")==c){$(this).addClass("selected"); $(this).fadeTo("fast",1);if(q){var a=$(e+" a.selected").position().left;a>l&&a>w?u():a<t-2*l&&v();w=a}return!1}}));return!1}function A(){var c=1,b=!1,d=setInterval(function(){s(i[c]);i.length==c+1&&(b=!0);c==0&&(b=!1);b?c--:c++},a.slide_time);$(e+" a").click(function(){clearInterval(d)})}var a=jQuery.extend({show_speed:400,slide_time:3E3,fade:0.2,fade_preview_bar:0.1,speed_scroll:700,show_inner:!0,zoom:!1},a),q=!1,h=jQuery(this).attr("id"),d=a.zoom?h+"-show-arc":h+"-show",h="#"+h,e=h+"-scroller-container", f=e+"-inner",r=h+"-preview-bar",x=h+"-scroller",n=$(e).width(),l=$(e+" a").outerWidth(),m="scroller-left",j="scroller-right",o="marker",t=$(e+" a").length*l;$(f).width(t);$(h).width();a.show_inner?$(h).prepend('<div id="'+d+'"></div>'):($(h).before('<div id="'+d+'"></div>'),$.browser.msie&&jQuery.browser.version.substr(0,1)<=6&&($("#content").height($(document.body).height()),$("#content").height("100%")));d="#"+d;a.zoom?$(d).append('<img src="" width="446" height="297" alt="" style="display: none;" />'): $(d).append('<img src="" alt="" style="display: none;" />');var z=$(d).height(),y=$(d).width();$(r+" a").click(function(a){a.preventDefault()});$("#overlay").fadeTo("fast",0.85);a.fade_preview_bar<1&&$(r).fadeTo("fast",a.fade_preview_bar);$(e+" a").removeAttr("rel");var k=0,i=[],b=[];$(e+" a").each(function(){i[k]=$(this).attr("href");b[i[k]]=$(this).attr("title");if(!a.show_inner&&!a.zoom){b[i[k]]=b[i[k]].split("|");for(var c in b[i[k]])b[i[k]][c]=b[i[k]][c].split("^")}k++});$(e+" a").removeAttr("title"); $(e+" a").fadeTo("fast",a.fade);var p=$("#"+j).width(),w=0;jQuery.preloadImages=function(){var a=typeof arguments[arguments.length-1]=="function"?arguments[arguments.length-1]:!1;if(typeof arguments[0]=="object")var b=arguments[0],d=b.length;else b=arguments,d=b.length-1;for(var f=d,e=0;e<d;e++)jQuery(new Image).load(function(){--f<1&&typeof a=="function"&&a()}).attr("src",b[e])};$.preloadImages(i,function(){t>n&&($(x).prepend('<a href="#" id="'+m+'"></a>'),$(x).append('<a href="#" id="'+j+'"></a>'), $("#"+m).fadeTo("fast",a.fade),$("#"+j).fadeTo("fast",1),q=!0);s($(e+" a:first").attr("href"));a.fade_preview_bar<1&&$(h).bind({mouseenter:function(){$(r).fadeTo("fast",1)},mouseleave:function(){$(r).fadeTo("fast",a.fade_preview_bar)}});$(e+" a").length>1&&A();$(e+" a").click(function(){s($(this).attr("href"))});jQuery("#"+j).click(function(){q=!1;u();return!1});jQuery("#"+m).click(function(){q=!1;v();return!1})})};
