(function(a){a.BigImg_Window=function(b){this.title=b|"";a("body").append(a.BigImg_Window.options.html);a("#bigimg").hide();this.hidden=true;this.open=function(){a("#bigimg .close").click(function(c){return function(){c.close()}}(this));a(document).bind("keydown.bigimg",function(c){return function(d){if(d.keyCode==27){c.close()}}}(this));a("#bigimg").css({top:getPageScroll()[1]+(getPageHeight()/10),left:a(window).width()/2-(a("#bigimg").width()/2)});a("#bigimg").fadeIn("normal");this.hidden=false};this.close=function(){a("#bigimg .close").unbind("click");a(document).unbind("keydown.bigimg");a("#bigimg").fadeOut("normal");this.hidden=true};this.image=function(c){this.clear();a("#bigimg .content .image").append('<img src="'+c.src+'" alt="">');a("#bigimg .content .sub p").text(c.description);a("#bigimg .m .loading").remove()};this.nav=function(d,c){var e=false;a("#bigimg .content .navigation").remove();if(typeof d!=="undefined"){a("#bigimg .content").append('<a href="'+d.src+'" class="prev navigation"><span>предыдущая</span></a>');e=true}if(typeof c!=="undefined"){a("#bigimg .content").append('<a href="'+c.src+'" class="next navigation"><span>предыдущая</span></a>');e=true}if(e){a("#bigimg .content .sub").addClass("with_nav")}};this.loading=function(){a("#bigimg").stop(true,true);if(this.hidden){this.clear();a("#bigimg .content").css("width",a.BigImg_Window.options.min_width+"px");a("#bigimg .content .image").css("height","auto");this.open()}else{a("#bigimg img").css("opacity","0.5");a("#bigimg .navigation").unbind("click").click(function(){return false}).addClass("disable");a("#bigimg").css({top:getPageScroll()[1]+(getPageHeight()/10)})}if(!a("#bigimg .m .loading").length){a("#bigimg .m").append('<b class="loading"><i><span>загрузка</span></i></b>')}};this.clear=function(){a("#bigimg .content .image").empty();a("#bigimg .content .sub p").empty()};this.resize=function(e,d){if(e<a.BigImg_Window.options.min_width){e=a.BigImg_Window.options.min_width}var c=a("#bigimg").offset().left+Math.round((a("#bigimg .content").width()-e)/2);a("#bigimg").css("left",c+"px");a("#bigimg .content").animate({width:e+"px"},"normal");a("#bigimg .content .image").animate({height:d+"px"},"normal")}};a.BigImg_Window.options={html:'			<table id="bigimg" style="display: none;"><tr><td>				<p class="t"><b><!--уголок--></b><i><!--уголок--></i></p>				<div class="m">					<div class="wrapper">						<div class="content">							<div class="image"></div>							<div class="sub"><p></p></div>						</div>					</div>					<button class="close" title="закрыть картинку"><span>закрыть</span></button>				</div>				<p class="b"><b><!--уголок--></b><i><!--уголок--></i></p>			</td></tr></table>		',min_width:300};a.BigImg_Gallery=function(b){this.elements=b;this.current_image_index=0;var c=[];b.each(function(d,e){var f={src:a(e).attr("href"),description:a(e).attr("title")};c.push(f)});this.images=c;this.loadImage=function(e){if(typeof e==="undefined"){e=this.current_image_index}a.bigImg_Window.loading();a("#bigimg .content .next").unbind("click",function(g){return function(){g.next();return false}}(this));a("#bigimg .content .prev").unbind("click",function(g){return function(){g.prev();return false}}(this));var d=this.images;var f=new Image();f.onload=function(g){return function(){a.bigImg_Window.resize(f.width,f.height);a.bigImg_Window.image(d[e]);a.bigImg_Window.nav(d[e-1],d[e+1]);a("#bigimg .content .next").bind("click",function(h){return function(){h.next();return false}}(g));a("#bigimg .content .prev").bind("click",function(h){return function(){h.prev();return false}}(g))}}(this);f.src=d[e].src;this.current_image_index=e};this.prev=function(){var d=this.current_image_index-1;if(typeof this.images[d]!=="undefined"){this.loadImage(d)}};this.next=function(){var d=this.current_image_index+1;if(typeof this.images[d]!=="undefined"){this.loadImage(d)}}};a.fn.bigimg=function(){if(typeof a.bigImg_Window==="undefined"){a.bigImg_Window=new a.BigImg_Window}var b=new a.BigImg_Gallery(this);return this.click(function(){b.loadImage(b.elements.index(this));return false})};a.bigimg=function(){};a.bigimg.options={automatic:true,rel:"bigimg"};if(a.bigimg.options.automatic){a(document).ready(function(){var b={};var c=0;a("a[rel|="+a.bigimg.options.rel+"]").each(function(e,f){var d=a(f).attr("rel");if(d===a.bigimg.options.rel){d="single_"+c;c++}if(typeof b[d]==="undefined"){b[d]=[]}b[d].push(f)});a.each(b,function(d,e){a(e).bigimg()})})}})(jQuery);function getPageScroll(){var b,a;if(self.pageYOffset){a=self.pageYOffset;b=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){a=document.documentElement.scrollTop;b=document.documentElement.scrollLeft}else{if(document.body){a=document.body.scrollTop;b=document.body.scrollLeft}}}return new Array(b,a)}function getPageHeight(){var a;if(self.innerHeight){a=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientHeight}else{if(document.body){a=document.body.clientHeight}}}return a};