(function(){var g=navigator.appVersion!=="Microsoft Internet Explorer"||parseInt(navigator.appVersion.match(/MSIE\s+(\d+\.\d+)/)[1])>8,a=jQuery("body").prepend('<div id="jquery-modal-mask"><div class="jquery-modal-mask-color"></div><div class="jquery-modal-mask-image"></div></div>'),f=null,e=false,c=null,b=jQuery("#jquery-modal-mask").bind("click",d);function d(){if(f){f.fadeOut(500);b.fadeOut(500).attr("class","");if(e){f.empty();f.remove()}f=null;if(jQuery.isFunction(c)){c.call(null);c=null}}return false}jQuery(document).bind("keydown",function(h){if(h.originalEvent.keyCode===27){d()}});jQuery.modal=function(l,j){j=jQuery.extend({top:50,callback:null,center:false,width:0,height:0},j);if(j.center&&j.height<1&&j.width<1){j.center=false;j.top=50}d();c=j.unload;e=false;if(typeof l==="string"){f=jQuery("#"+l)}if(!f||f.length===0){f=jQuery(l);if(!f||f.length===0){f=null;return}jQuery("body").append(f);e=true}else{if(!f.parent().is("body")){f.appendTo("body")}}var k=window.innerWidth||document.documentElement.offsetWidth,i=window.innerHeight||document.documentElement.offsetHeight,h=f.find("input:text, input:password").get(0);
if(h){setTimeout(function(){h.focus()},500)}jQuery.isFunction(j.load)&&j.load.call(null,f,j);b.css({height:i,width:k}).fadeIn(500);if(j.className){b.addClass(j.className);f.addClass(j.className)}f.css({width:(j.width>0?j.width+"px":""),height:(j.height>0?j.height+"px":""),top:j.center?(i-(j.height||f.outerHeight()))/2:j.top,left:(k-(j.width||f.outerWidth()))/2}).fadeIn(500,function(){jQuery.isFunction(j.show)&&j.show.call(null,f,j)}).find(".jquery-modal-close").one("click",d)};jQuery.modal.close=function(){d()};jQuery.gallery=function(k,h){h=jQuery.extend({prev:"prev",next:"next"},h);var j='<div class="jquery-modal-window clear gallery-window"><div class="jquery-modal-close"><em>[close]</em>, or press esc key</div><div class="jquery-modal-image"><div class="jquery-modal-title"><h2></h2><p class="jquery-modal-counter"><span class="jquery-modal-current-index"></span> of <span class="jquery-modal-total-count"></span></p></div><img class="jquery-modal-current-image" src="" alt="" /></div><a href="#" class="jquery-modal-button-prev">'+h.prev+'</a><a href="#" class="jquery-modal-button-next">'+h.next+"</a></div>",i=h.load;
h.id=k;if(!h.images||h.images.length===0){h.images=jQuery(h.container||"body").find("a[rel="+k+"] > img, img[rel="+k+"]").map(function(){return{src:this.src,title:this.title||this.alt||"",element:this}}).get()}if(!h.images||h.images.length===0){return true}h.load=function(p,m){var l=-1,q=$();p.image=p.find("img.jquery-modal-current-image");p.title=p.find("div.jquery-modal-title > h2");if(m.hideTitleOnMouseOut){q=q.add(p.find("div.jquery-modal-title"))}if(m.images.length===1){p.find("p.jquery-modal-counter, a.jquery-modal-button-prev, a.jquery-modal-button-next").hide()}else{p.currentIndex=p.find("span.jquery-modal-current-index");p.find("span.jquery-modal-total-count").text(m.images.length);var o=p.find("a.jquery-modal-button-prev").bind("click",function(){p.showImage(l-1);this.blur();return false});var n=p.find("a.jquery-modal-button-next").bind("click",function(){p.showImage(l+1);this.blur();return false});if(m.hidePagerOnMouseOut){q=q.add(o).add(n)}}if(q.length>0){var r=null;p.bind("mouseout",function(){r=setTimeout(function(){r=null;
if(g){q.fadeOut()}else{q.hide()}},500)}).bind("mouseover",function(){if(r){clearTimeout(r)}else{if(g){q.fadeIn()}else{q.show()}}})}p.showImage=function(s){if(m.images.length===s){s=0}else{if(s===-1){s=m.images.length-1}}l=s;var t=m.images[l];p.image.fadeOut(100,function(){p.image.prop("src",t.src);p.image.fadeIn(100)});p.title.text(t.title);if(p.currentIndex){p.currentIndex.text(l+1)}jQuery.isFunction(m.change)&&m.change.call(null,l,t,p,m)};jQuery.isFunction(i)&&i.call(null,p,m);if(l===-1){p.showImage(0)}};jQuery.modal(jQuery(j),h)};jQuery.each(["modal","gallery"],function(i,h){jQuery.fn[h]=function(j){j=j||{};return this.each(function(){var k=jQuery(this),l=(k.attr("href")||k.attr("rel")).replace(/^#+/,"");k.bind("click",function(){jQuery[h](l,j);return false});if(j.forceShow||(j.autoShow&&new RegExp("^#"+l+"($|(?:-.+)?)").test(document.location.hash))){k.trigger("click")}})}})})();
