/*==== jquery.galleria ====*/
(function(b){var a;a=b.fn.galleria=function(g){if(!a.hasCSS()){return false}b.historyInit(a.onPageLoad);var l={insert:".galleria_container",history:true,clickNext:true,onImage:function(o,m,n,i){},onThumb:function(i){}};var k=b.extend(l,g);for(var f in k){b.galleria[f]=k[f]}var e=(b(k.insert).is(k.insert))?b(k.insert):jQuery(document.createElement("div")).insertBefore(this);var c=b(document.createElement("div")).addClass("galleria_wrapper");var h=b(document.createElement("span")).addClass("caption");var d=b(document.createElement("div")).addClass("desc");var j=b(document.createElement("div")).addClass("tracker");e.addClass("galleria_container").append(c).append(d).append(h).append(j).append("<div class='clear'></div>");return this.each(function(){b(this).addClass("galleria");b(this).children("li").each(function(s){var o=b(this);var m=b.meta?b.extend({},k,o.data()):k;m.clickNext=b(this).is(":only-child")?false:m.clickNext;var r=b(this).find("a:first").is("a")?b(this).find("a:first"):false;var n=b(this).children("img").css("display","none");var t=r?r.attr("href"):n.attr("src");var q=r?s+"^"+r.attr("title"):s+"^"+n.attr("title");var p=new Image();if(m.history&&(window.location.hash&&window.location.hash.replace(/\#/,"")==t)){o.siblings(".active").removeClass("active");o.addClass("active")}b(p).load( function(){   b(this).attr("alt",n.attr("alt"));var v=r?r.find("img").addClass("thumb noscale").css("display","none"):n.clone(true).addClass("thumb").css("display","none");if(r){r.replaceWith(v)}if(!v.hasClass("noscale")){var i=Math.ceil(n.width()/n.height()*o.height());var u=Math.ceil(n.height()/n.width()*o.width());if(i<u){v.css({/*height:"auto",width:o.width(),marginTop:-(u-o.height())/2*/})}else{v.css({/*width:"auto",height:o.height(),marginLeft:-(i-o.width())/2*/})}}else{window.setTimeout(function(){v.css({marginLeft:-(v.width()-o.width())/2,marginTop:-(v.height()-o.height())/2})},1)}v.attr("rel",t);v.click(function(){b.galleria.activate(t)});v.hover(function(){b(this).addClass("hover")},function(){b(this).removeClass("hover")});o.hover(function(){o.addClass("hover")},function(){o.removeClass("hover")});o.prepend(v);v.css("display","block");m.onThumb(jQuery(v));if(o.hasClass("active")){b.galleria.activate(t)}n.remove()}).error(function(){o.html('<span class="error" style="color:red">Error loading image: '+t+"</span>")}).attr("src",t)})})};a.nextSelector=function(c){return b(c).is(":last-child")?b(c).siblings(":first-child"):b(c).next()};a.previousSelector=function(c){return b(c).is(":first-child")?b(c).siblings(":last-child"):b(c).prev()};a.hasCSS=function(){b("body").append(b(document.createElement("div")).attr("id","css_test").css({width:"1px",height:"1px",display:"none"}));var c=(b("#css_test").width()!=1)?false:true;b("#css_test").remove();return c};a.onPageLoad=function(i){var f=b(".galleria_wrapper");var h=b('.galleria img[rel="'+i+'"]');var e=b('.galleria img[rel="'+i+'"] + p');if(i){if(b.galleria.history){window.location=window.location.href.replace(/\#.*/,"")+"#"+i}h.parents("li").siblings(".active").removeClass("active");h.parents("li").addClass("active");var d=b(new Image()).attr("src",i).addClass("replaced");f.empty().append(d);/*f.siblings(".caption").text(h.attr("title"));*/var iddds = $(".active").attr('jcarouselindex');var idDecn=$("#photolink"+iddds).html();var idDecription="#photoname"+h.parents('li.active').attr("jcarouselindex");$(".title_photo").hide();$(idDecription).show();$(".photo_link").attr('href',idDecn);$(".photo_mail").attr('href','mailto:?subject=9may%202010&body=http://may9.ru'+i+'');
																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																					
	
/*var idDecription2="#photo_tit_"+h.parents('li.active').attr("jcarouselindex"); $(idDecription2).show();*/ var indexzz = $('.active').attr('jcarouselindex'); if(indexzz >= 6){ $('#mycarousel').animate({'top': '-=59'}); }else{ $('#mycarousel').animate({'top': '0'}); } f.siblings(".desc").html(e.html());b.galleria.onImage(d,f.siblings(".caption"),f.siblings(".desc"),f.siblings(".tracker"),h);if(b.galleria.clickNext){d.css("cursor","pointer").click(function(){b.galleria.next()})}var g=b(".replaced");var c=b(".galleria_wrapper");g.hide();window.setTimeout(function(){g.css({marginLeft:-(g.width()-c.width())/2/*,marginTop:-(g.height()-c.height())/2*/}).fadeIn("fast")},500)}else{f.siblings().andSelf().empty();b(".galleria li.active").removeClass("active")}b.galleria.current=i};b.extend({galleria:{current:"",onImage:function(){},activate:function(c){if(b.galleria.history){b.historyLoad(c)}else{a.onPageLoad(c)}},next:function(){var c=b(a.nextSelector(b('.galleria img[rel="'+b.galleria.current+'"]').parents("li"))).find("img").attr("rel");b.galleria.activate(c)},prev:function(){var c=b(a.previousSelector(b('.galleria img[rel="'+b.galleria.current+'"]').parents("li"))).find("img").attr("rel");b.galleria.activate(c)}}})})(jQuery);jQuery.extend({historyCurrentHash:undefined,historyCallback:undefined,historyIframeSrc:undefined,historyInit:function(e,d){jQuery.historyCallback=e;if(d){jQuery.historyIframeSrc=d}var c=location.hash.replace(/\?.*$/,"");jQuery.historyCurrentHash=c;if(jQuery.browser.msie){if(jQuery.historyCurrentHash==""){jQuery.historyCurrentHash="#"}jQuery("body").prepend('<iframe id="jQuery_history" style="display: none;"'+(jQuery.historyIframeSrc?' src="'+jQuery.historyIframeSrc+'"':"")+"></iframe>");var a=jQuery("#jQuery_history")[0];var b=a.contentWindow.document;b.open();b.close();b.location.hash=c}else{if(jQuery.browser.safari){jQuery.historyBackStack=[];jQuery.historyBackStack.length=history.length;jQuery.historyForwardStack=[];jQuery.lastHistoryLength=history.length;jQuery.isFirst=true}}if(c){jQuery.historyCallback(c.replace(/^#/,""))}setInterval(jQuery.historyCheck,100)},historyAddHistory:function(a){jQuery.historyBackStack.push(a);jQuery.historyForwardStack.length=0;this.isFirst=true},historyCheck:function(){if(jQuery.browser.msie){var a=jQuery("#jQuery_history")[0];var d=a.contentDocument||a.contentWindow.document;var f=d.location.hash.replace(/\?.*$/,"");if(f!=jQuery.historyCurrentHash){location.hash=f;jQuery.historyCurrentHash=f;jQuery.historyCallback(f.replace(/^#/,""))}}else{if(jQuery.browser.safari){if(jQuery.lastHistoryLength==history.length&&jQuery.historyBackStack.length>jQuery.lastHistoryLength){jQuery.historyBackStack.shift()}if(!jQuery.dontCheck){var b=history.length-jQuery.historyBackStack.length;jQuery.lastHistoryLength=history.length;if(b){jQuery.isFirst=false;if(b<0){for(var c=0;c<Math.abs(b);c++){jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop())}}else{for(var c=0;c<b;c++){jQuery.historyBackStack.push(jQuery.historyForwardStack.shift())}}var e=jQuery.historyBackStack[jQuery.historyBackStack.length-1];if(e!=undefined){jQuery.historyCurrentHash=location.hash.replace(/\?.*$/,"");jQuery.historyCallback(e)}}else{if(jQuery.historyBackStack[jQuery.historyBackStack.length-1]==undefined&&!jQuery.isFirst){if(location.hash){var f=location.hash;jQuery.historyCallback(location.hash.replace(/^#/,""))}else{var f="";jQuery.historyCallback("")}jQuery.isFirst=true}}}}else{var f=location.hash.replace(/\?.*$/,"");if(f!=jQuery.historyCurrentHash){jQuery.historyCurrentHash=f;jQuery.historyCallback(f.replace(/^#/,""))}}}},historyLoad:function(d){var e;d=decodeURIComponent(d.replace(/\?.*$/,""));if(jQuery.browser.safari){e=d}else{e="#"+d;location.hash=e}jQuery.historyCurrentHash=e;if(jQuery.browser.msie){var a=jQuery("#jQuery_history")[0];var c=a.contentWindow.document;c.open();c.close();c.location.hash=e;jQuery.lastHistoryLength=history.length;jQuery.historyCallback(d)}else{if(jQuery.browser.safari){jQuery.dontCheck=true;this.historyAddHistory(d);var b=function(){jQuery.dontCheck=false};window.setTimeout(b,200);jQuery.historyCallback(d);location.hash=e}else{jQuery.historyCallback(d)}}}});(function(a){this.version="(beta)(0.0.3)";this.all={};this.special_keys={27:"esc",9:"tab",32:"space",13:"return",8:"backspace",145:"scroll",20:"capslock",144:"numlock",19:"pause",45:"insert",36:"home",46:"del",35:"end",33:"pageup",34:"pagedown",38:"up",40:"down",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"};this.shift_nums={"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"};this.add=function(c,b,h){if(a.isFunction(b)){h=b;b={}}var d={},f={type:"keydown",propagate:false,disableInInput:false,target:a("html")[0],checkParent:true},e=this;d=a.extend(d,f,b||{});c=c.toLowerCase();var g=function(j){j=a.event.fix(j);var o=j.target;o=(o.nodeType==3)?o.parentNode:o;if(d.disableInInput){var s=a(o);if(s.is("input")||s.is("textarea")){return}}var l=j.which,u=j.type,r=String.fromCharCode(l).toLowerCase(),t=e.special_keys[l],m=j.shiftKey,i=j.ctrlKey,p=j.altKey,q=true,k=null;if(a.browser.opera||a.browser.safari||d.checkParent){while(!e.all[o]&&o.parentNode){o=o.parentNode}}var v=e.all[o].events[u].callbackMap;if(!m&&!i&&!p){k=v[t]||v[r]}else{var n="";if(p){n+="alt+"}if(i){n+="ctrl+"}if(m){n+="shift+"}k=v[n+t]||v[n+r]||v[n+e.shift_nums[r]]}if(k){k.cb(j);if(!k.propagate){j.stopPropagation();j.preventDefault();return false}}};if(!this.all[d.target]){this.all[d.target]={events:{}}}if(!this.all[d.target].events[d.type]){this.all[d.target].events[d.type]={callbackMap:{}};a.event.add(d.target,d.type,g)}this.all[d.target].events[d.type].callbackMap[c]={cb:h,propagate:d.propagate};return a};this.remove=function(c,b){b=b||{};target=b.target||a("html")[0];type=b.type||"keydown";c=c.toLowerCase();delete this.all[target].events[type].callbackMap[c];return a};a.hotkeys=this;return a})(jQuery);jQuery.fn.extend({everyTime:function(b,c,d,e,a){return this.each(function(){jQuery.timer.add(this,b,c,d,e,a)})},oneTime:function(a,b,c){return this.each(function(){jQuery.timer.add(this,a,b,c,1)})},stopTime:function(a,b){return this.each(function(){jQuery.timer.remove(this,a,b)})}});jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1000,das:10000,hs:100000,ks:1000000},timeParse:function(c){if(c==undefined||c==null){return null}var a=this.regex.exec(jQuery.trim(c.toString()));if(a[2]){var b=parseInt(a[1],10);var d=this.powers[a[2]]||1;return b*d}else{return c}},add:function(e,c,d,g,h,b){var a=0;if(jQuery.isFunction(d)){if(!h){h=g}g=d;d=c}c=jQuery.timer.timeParse(c);if(typeof c!="number"||isNaN(c)||c<=0){return}if(h&&h.constructor!=Number){b=!!h;h=0}h=h||0;b=b||false;if(!e.$timers){e.$timers={}}if(!e.$timers[d]){e.$timers[d]={}}g.$timerID=g.$timerID||this.guid++;var f=function(){if(b&&this.inProgress){return}this.inProgress=true;if((++a>h&&h!==0)||g.call(e,a)===false){jQuery.timer.remove(e,d,g)}this.inProgress=false};f.$timerID=g.$timerID;if(!e.$timers[d][g.$timerID]){e.$timers[d][g.$timerID]=window.setInterval(f,c)}if(!this.global[d]){this.global[d]=[]}this.global[d].push(e)},remove:function(c,b,d){var e=c.$timers,a;if(e){if(!b){for(b in e){this.remove(c,b,d)}}else{if(e[b]){if(d){if(d.$timerID){window.clearInterval(e[b][d.$timerID]);delete e[b][d.$timerID]}}else{for(var d in e[b]){window.clearInterval(e[b][d]);delete e[b][d]}}for(a in e[b]){break}if(!a){a=null;delete e[b]}}}for(a in e){break}if(!a){c.$timers=null}}}}});if(jQuery.browser.msie){jQuery(window).one("unload",function(){var d=jQuery.timer.global;for(var a in d){var c=d[a],b=c.length;while(--b){jQuery.timer.remove(c[b],a)}}})};

