/*!
 * fancyBox - jQuery Plugin
 * version: 2.0.4 (12/12/2011)
 * @requires jQuery v1.6 or later
 *
 * Examples at http://fancyapps.com/fancybox/
 * License: www.fancyapps.com/fancybox/#license
 *
 * Copyright 2011 Janis Skarnelis - janis@fancyapps.com
 *
 */
(function(f,d,g){var c=g(f),h=g(d),e=g.fancybox=function(){e.open.apply(this,arguments)},b=false,a=null;g.extend(e,{version:"2.0.4",defaults:{padding:15,margin:20,width:800,height:600,minWidth:200,minHeight:200,maxWidth:9999,maxHeight:9999,autoSize:true,fitToView:true,aspectRatio:false,topRatio:0.5,fixed:!g.browser.msie||g.browser.version>6||!d.documentElement.hasOwnProperty("ontouchstart"),scrolling:"auto",wrapCSS:"fancybox-default",arrows:true,closeBtn:true,closeClick:false,nextClick:false,mouseWheel:true,autoPlay:false,playSpeed:3000,modal:false,loop:true,ajax:{},keys:{next:[13,32,34,39,40],prev:[8,33,37,38],close:[27]},index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe class="fancybox-iframe" name="fancybox-frame{rnd}" frameborder="0" hspace="0" '+(g.browser.msie?'allowtransparency="true""':"")+' scrolling="{scrolling}" src="{href}"></iframe>',swf:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{href}" /><embed src="{href}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%" wmode="transparent"></embed></object>',error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<div title="Close" class="fancybox-item fancybox-close"></div>',next:'<a title="Next" class="fancybox-item fancybox-next"><span></span></a>',prev:'<a title="Previous" class="fancybox-item fancybox-prev"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:true,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:true,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:300,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:300,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:{speedIn:0,speedOut:300,opacity:0.8,css:{cursor:"pointer"},closeClick:true},title:{type:"float"}},onCancel:g.noop,beforeLoad:g.noop,afterLoad:g.noop,beforeShow:g.noop,afterShow:g.noop,beforeClose:g.noop,afterClose:g.noop},group:{},opts:{},coming:null,current:null,isOpen:false,isOpened:false,wrap:null,outer:null,inner:null,player:{timer:null,isActive:false},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(j,i){if(!g.isArray(j)){j=[j]}if(!j.length){return}e.close(true);e.opts=g.extend(true,{},e.defaults,i);e.group=j;e._start(e.opts.index||0)},cancel:function(){if(e.coming&&false===e.trigger("onCancel")){return}e.coming=null;e.hideLoading();if(e.ajaxLoad){e.ajaxLoad.abort()}e.ajaxLoad=null;if(e.imgPreload){e.imgPreload.onload=e.imgPreload.onabort=e.imgPreload.onerror=null}},close:function(i){e.cancel();if(!e.current||false===e.trigger("beforeClose")){return}e.unbindEvents();if(!e.isOpen||(i&&i[0]===true)){g(".fancybox-wrap").stop().trigger("onReset").remove();e._afterZoomOut()}else{e.isOpen=e.isOpened=false;g(".fancybox-item").remove();e.wrap.stop(true).removeClass("fancybox-opened");e.inner.css("overflow","hidden");e.transitions[e.current.closeMethod]()}},play:function(j){var i=function(){clearTimeout(e.player.timer)},m=function(){i();if(e.current&&e.player.isActive){e.player.timer=setTimeout(e.next,e.current.playSpeed)}},k=function(){i();g("body").unbind(".player");e.player.isActive=false;e.trigger("onPlayEnd")},l=function(){if(e.current&&(e.current.loop||e.current.index<e.group.length-1)){e.player.isActive=true;g("body").bind({"afterShow.player onUpdate.player":m,"onCancel.player beforeClose.player":k,"beforeLoad.player":i});m();e.trigger("onPlayStart")}};if(e.player.isActive||(j&&j[0]===false)){k()}else{l()}},next:function(){if(e.current){e.jumpto(e.current.index+1)}},prev:function(){if(e.current){e.jumpto(e.current.index-1)}},jumpto:function(i){if(!e.current){return}i=parseInt(i,10);if(e.group.length>1&&e.current.loop){if(i>=e.group.length){i=0}else{if(i<0){i=e.group.length-1}}}if(typeof e.group[i]!=="undefined"){e.cancel();e._start(i)}},reposition:function(i){if(e.isOpen){e.wrap.css(e._getPosition(i))}},update:function(){if(e.isOpen){if(!b){a=setInterval(function(){if(b){b=false;clearTimeout(a);if(e.current){if(e.current.autoSize){e.inner.height("auto");e.current.height=e.inner.height()}e._setDimension();if(e.current.canGrow){e.inner.height("auto")}e.reposition();e.trigger("onUpdate")}}},100)}b=true}},toggle:function(){if(e.isOpen){e.current.fitToView=!e.current.fitToView;e.update()}},hideLoading:function(){g("#fancybox-loading").remove()},showLoading:function(){e.hideLoading();g('<div id="fancybox-loading"></div>').click(e.cancel).appendTo("body")},getViewport:function(){return{x:c.scrollLeft(),y:c.scrollTop(),w:c.width(),h:c.height()}},unbindEvents:function(){if(e.wrap){e.wrap.unbind(".fb")}h.unbind(".fb");c.unbind(".fb")},bindEvents:function(){var j=e.current,i=j.keys;if(!j){return}c.bind("resize.fb, orientationchange.fb",e.update);if(i){h.bind("keydown.fb",function(l){var k;if(!l.ctrlKey&&!l.altKey&&!l.shiftKey&&!l.metaKey&&g.inArray(l.target.tagName.toLowerCase(),["input","textarea","select","button"])<0){k=l.keyCode;if(g.inArray(k,i.close)>-1){e.close();l.preventDefault()}else{if(g.inArray(k,i.next)>-1){e.next();l.preventDefault()}else{if(g.inArray(k,i.prev)>-1){e.prev();l.preventDefault()}}}}})}if(g.fn.mousewheel&&j.mouseWheel&&e.group.length>1){e.wrap.bind("mousewheel.fb",function(l,m){var k=g(l.target).get(0);if(k.clientHeight===0||k.scrollHeight===k.clientHeight){l.preventDefault();e[m>0?"prev":"next"]()}})}},trigger:function(j){var i,k=e[g.inArray(j,["onCancel","beforeLoad","afterLoad"])>-1?"coming":"current"];if(!k){return}if(g.isFunction(k[j])){i=k[j].apply(k,Array.prototype.slice.call(arguments,1))}if(i===false){return false}if(k.helpers){g.each(k.helpers,function(m,l){if(l&&typeof e.helpers[m]!=="undefined"&&g.isFunction(e.helpers[m][j])){e.helpers[m][j](l,k)}})}g.event.trigger(j+".fb")},isImage:function(i){return i&&i.match(/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i)},isSWF:function(i){return i&&i.match(/\.(swf)(.*)?$/i)},_start:function(j){var m={},l=e.group[j]||null,k,i,n,o;if(typeof l==="object"&&(l.nodeType||l instanceof g)){k=true;if(g.metadata){m=g(l).metadata()}}m=g.extend(true,{},e.opts,{index:j,element:l},(g.isPlainObject(l)?l:m));g.each(["href","title","content","type"],function(q,p){m[p]=e.opts[p]||(k&&g(l).attr(p))||m[p]||null});if(typeof m.margin==="number"){m.margin=[m.margin,m.margin,m.margin,m.margin]}if(m.modal){g.extend(true,m,{closeBtn:false,closeClick:false,nextClick:false,arrows:false,mouseWheel:false,keys:null,helpers:{overlay:{css:{cursor:"auto"},closeClick:false}}})}e.coming=m;if(false===e.trigger("beforeLoad")){e.coming=null;return}n=m.type;i=m.href;if(!n){if(k){o=g(l).data("fancybox-type");if(!o&&l.className){o=l.className.match(/fancybox\.(\w+)/);n=o?o[1]:null}}if(!n&&i){if(e.isImage(i)){n="image"}else{if(e.isSWF(i)){n="swf"}else{if(i.match(/^#/)){n="inline"}}}}if(!n){n=k?"inline":"html"}m.type=n}if(n==="inline"||n==="html"){m.content=m.content||(n==="inline"&&i?g(i):l);if(!m.content.length){n=null}}else{m.href=i||l;if(!m.href){n=null}}m.group=e.group;if(n==="image"){e._loadImage()}else{if(n==="ajax"){e._loadAjax()}else{if(n){e._afterLoad()}else{e._error("type")}}}},_error:function(i){g.extend(e.coming,{type:"html",autoSize:true,minHeight:"0",hasError:i,content:e.coming.tpl.error});e._afterLoad()},_loadImage:function(){e.imgPreload=new Image();e.imgPreload.onload=function(){this.onload=this.onerror=null;e.coming.width=this.width;e.coming.height=this.height;e._afterLoad()};e.imgPreload.onerror=function(){this.onload=this.onerror=null;e._error("image")};e.imgPreload.src=e.coming.href;if(!e.imgPreload.complete){e.showLoading()}},_loadAjax:function(){e.showLoading();e.ajaxLoad=g.ajax(g.extend({},e.coming.ajax,{url:e.coming.href,error:function(i,j){if(j!=="abort"){e._error("ajax",i)}else{e.hideLoading()}},success:function(i,j){if(j==="success"){e.coming.content=i;e._afterLoad()}}}))},_preload:function(){var k=e.group,i=e.current.index,j=function(l){if(l&&e.isImage(l)){new Image().src=l}};if(k.length>1){j(g(k[i+1]||k[0]).attr("href"));j(g(k[i-1]||k[k.length-1]).attr("href"))}},_afterLoad:function(){e.hideLoading();if(!e.coming||false===e.trigger("afterLoad",e.current)){e.coming=false;return}if(e.isOpened){g(".fancybox-item").remove();e.wrap.stop(true).removeClass("fancybox-opened");e.inner.css("overflow","hidden");e.transitions[e.current.prevMethod]()}else{g(".fancybox-wrap").stop().trigger("onReset").remove();e.trigger("afterClose")}e.unbindEvents();e.isOpen=false;e.current=e.coming;e.coming=false;e.wrap=g(e.current.tpl.wrap).addClass("fancybox-tmp "+e.current.wrapCSS).appendTo("body");e.outer=g(".fancybox-outer",e.wrap).css("padding",e.current.padding+"px");e.inner=g(".fancybox-inner",e.wrap);e._setContent();e.trigger("beforeShow");e._setDimension();e.wrap.hide().removeClass("fancybox-tmp");e.bindEvents();e._preload();e.transitions[e.isOpened?e.current.nextMethod:e.current.openMethod]()},_setContent:function(){var j,k,l=e.current,i=l.type;switch(i){case"inline":case"ajax":case"html":j=l.content;if(i==="inline"&&j instanceof g){j=j.show().detach();if(j.parent().hasClass("fancybox-inner")){j.parents(".fancybox-wrap").trigger("onReset").remove()}g(e.wrap).bind("onReset",function(){j.appendTo("body").hide()})}if(l.autoSize){k=g('<div class="fancybox-tmp"></div>').appendTo(g("body")).append(j);l.width=k.outerWidth();l.height=k.outerHeight(true);j=k.contents().detach();k.remove()}break;case"image":j=l.tpl.image.replace("{href}",l.href);l.aspectRatio=true;break;case"swf":j=l.tpl.swf.replace(/\{width\}/g,l.width).replace(/\{height\}/g,l.height).replace(/\{href\}/g,l.href);break;case"iframe":j=l.tpl.iframe.replace("{href}",l.href).replace("{scrolling}",l.scrolling).replace("{rnd}",new Date().getTime());break}if(g.inArray(i,["image","swf","iframe"])>-1){l.autoSize=false;l.scrolling=false}e.inner.append(j)},_setDimension:function(){var l=e.wrap,w=e.outer,x=e.inner,p=e.current,q=e.getViewport(),n=p.margin,j=p.padding*2,m=p.width+j,v=p.height+j,r=p.width/p.height,t=p.maxWidth,s=p.maxHeight,k=p.minWidth,u=p.minHeight,o,i;q.w-=(n[1]+n[3]);q.h-=(n[0]+n[2]);if(m.toString().indexOf("%")>-1){m=((q.w*parseFloat(m))/100)}if(v.toString().indexOf("%")>-1){v=((q.h*parseFloat(v))/100)}if(p.fitToView){t=Math.min(q.w,t);s=Math.min(q.h,s)}k=Math.min(m,k);u=Math.min(m,u);t=Math.max(k,t);s=Math.max(u,s);if(p.aspectRatio){if(m>t){m=t;v=((m-j)/r)+j}if(v>s){v=s;m=((v-j)*r)+j}if(m<k){m=k;v=((m-j)/r)+j}if(v<u){v=u;m=((v-j)*r)+j}}else{m=Math.max(k,Math.min(m,t));v=Math.max(u,Math.min(v,s))}m=Math.round(m);v=Math.round(v);g(l.add(w).add(x)).width("auto").height("auto");x.width(m-j).height(v-j);l.width(m);o=l.height();if(m>t||o>s){while((m>t||o>s)&&m>k&&o>u){v=v-10;if(p.aspectRatio){m=Math.round(((v-j)*r)+j);if(m<k){m=k;v=((m-j)/r)+j}}else{m=m-10}x.width(m-j).height(v-j);l.width(m);o=l.height()}}p.dim={width:m,height:o};p.canGrow=p.autoSize&&v>u&&v<s;p.canShrink=false;p.canExpand=false;if((m-j)<p.width||(v-j)<p.height){p.canExpand=true}else{if((m>q.w||o>q.h)&&m>k&&v>u){p.canShrink=true}}i=o-j;e.innerSpace=i-x.height();e.outerSpace=i-w.height()},_getPosition:function(k){var o=e.current,j=e.getViewport(),m=o.margin,l=e.wrap.width()+m[1]+m[3],i=e.wrap.height()+m[0]+m[2],n={position:"absolute",top:m[0]+j.y,left:m[3]+j.x};if(o.fixed&&(!k||k[0]===false)&&i<=j.h&&l<=j.w){n={position:"fixed",top:m[0],left:m[3]}}n.top=Math.ceil(Math.max(n.top,n.top+((j.h-i)*o.topRatio)))+"px";n.left=Math.ceil(Math.max(n.left,n.left+((j.w-l)*0.5)))+"px";return n},_afterZoomIn:function(){var i=e.current;e.isOpen=e.isOpened=true;e.wrap.addClass("fancybox-opened").css("overflow","visible");e.update();e.inner.css("overflow",i.scrolling==="auto"?"auto":(i.scrolling==="yes"?"scroll":"hidden"));if(i.closeClick||i.nextClick){e.inner.css("cursor","pointer").bind("click.fb",i.nextClick?e.next:e.close)}if(i.closeBtn){g(i.tpl.closeBtn).appendTo(e.wrap).bind("click.fb",e.close)}if(i.arrows&&e.group.length>1){if(i.loop||i.index>0){g(i.tpl.prev).appendTo(e.wrap).bind("click.fb",e.prev)}if(i.loop||i.index<e.group.length-1){g(i.tpl.next).appendTo(e.wrap).bind("click.fb",e.next)}}e.trigger("afterShow");if(e.opts.autoPlay&&!e.player.isActive){e.opts.autoPlay=false;e.play()}},_afterZoomOut:function(){e.trigger("afterClose");e.wrap.trigger("onReset").remove();g.extend(e,{group:{},opts:{},current:null,isOpened:false,isOpen:false,wrap:null,outer:null,inner:null})}});e.transitions={getOrigPosition:function(){var k=e.current.element,n={},l=50,j=50,m,i;if(k&&k.nodeName&&g(k).is(":visible")){m=g(k).find("img:first");if(m.length){n=m.offset();l=m.outerWidth();j=m.outerHeight()}else{n=g(k).offset()}}else{i=e.getViewport();n.top=i.y+(i.h-j)*0.5;n.left=i.x+(i.w-l)*0.5}n={top:Math.ceil(n.top)+"px",left:Math.ceil(n.left)+"px",width:Math.ceil(l)+"px",height:Math.ceil(j)+"px"};return n},step:function(j,l){var k,i,m;if(l.prop==="width"||l.prop==="height"){i=m=Math.ceil(j-(e.current.padding*2));if(l.prop==="height"){k=(j-l.start)/(l.end-l.start);if(l.start>l.end){k=1-k}i-=e.innerSpace*k;m-=e.outerSpace*k}e.inner[l.prop](i);e.outer[l.prop](m)}},zoomIn:function(){var k=e.wrap,m=e.current,j,i,l=m.dim;if(m.openEffect==="elastic"){i=g.extend({},l,e._getPosition(true));delete i.position;j=this.getOrigPosition();if(m.openOpacity){j.opacity=0;i.opacity=1}k.css(j).show().animate(i,{duration:m.openSpeed,easing:m.openEasing,step:this.step,complete:e._afterZoomIn})}else{k.css(g.extend({},l,e._getPosition()));if(m.openEffect==="fade"){k.fadeIn(m.openSpeed,e._afterZoomIn)}else{k.show();e._afterZoomIn()}}},zoomOut:function(){var j=e.wrap,k=e.current,i;if(k.closeEffect==="elastic"){if(j.css("position")==="fixed"){j.css(e._getPosition(true))}i=this.getOrigPosition();if(k.closeOpacity){i.opacity=0}j.animate(i,{duration:k.closeSpeed,easing:k.closeEasing,step:this.step,complete:e._afterZoomOut})}else{j.fadeOut(k.closeEffect==="fade"?k.closeSpeed:0,e._afterZoomOut)}},changeIn:function(){var j=e.wrap,k=e.current,i;if(k.nextEffect==="elastic"){i=e._getPosition(true);i.opacity=0;i.top=(parseInt(i.top,10)-200)+"px";j.css(i).show().animate({opacity:1,top:"+=200px"},{duration:k.nextSpeed,complete:e._afterZoomIn})}else{j.css(e._getPosition());if(k.nextEffect==="fade"){j.hide().fadeIn(k.nextSpeed,e._afterZoomIn)}else{j.show();e._afterZoomIn()}}},changeOut:function(){var i=e.wrap,k=e.current,j=function(){g(this).trigger("onReset").remove()};i.removeClass("fancybox-opened");if(k.prevEffect==="elastic"){i.animate({opacity:0,top:"+=200px"},{duration:k.prevSpeed,complete:j})}else{i.fadeOut(k.prevEffect==="fade"?k.prevSpeed:0,j)}}};e.helpers.overlay={overlay:null,update:function(){var k,i,j;this.overlay.width(0).height(0);if(g.browser.msie){i=Math.max(d.documentElement.scrollWidth,d.body.scrollWidth);j=Math.max(d.documentElement.offsetWidth,d.body.offsetWidth);k=i<j?c.width():i}else{k=h.width()}this.overlay.width(k).height(h.height())},beforeShow:function(i){if(this.overlay){return}this.overlay=g('<div id="fancybox-overlay"></div>').css(i.css||{background:"black"}).appendTo("body");this.update();if(i.closeClick){this.overlay.bind("click.fb",e.close)}c.bind("resize.fb",g.proxy(this.update,this));this.overlay.fadeTo(i.speedIn||"fast",i.opacity||1)},onUpdate:function(){this.update()},afterClose:function(i){if(this.overlay){this.overlay.fadeOut(i.speedOut||"fast",function(){g(this).remove()})}this.overlay=null}};e.helpers.title={beforeShow:function(i){var k,j=e.current.title;if(j){k=g('<div class="fancybox-title fancybox-title-'+i.type+'-wrap">'+j+"</div>").appendTo("body");if(i.type==="float"){k.width(k.width());k.wrapInner('<span class="child"></span>');e.current.margin[2]+=Math.abs(parseInt(k.css("margin-bottom"),10))}k.appendTo(i.type==="over"?e.inner:(i.type==="outside"?e.wrap:e.outer))}}};g.fn.fancybox=function(j){var k=j||{},i=this.selector||"";function l(p){var o=[],n,q,m=this.rel;if(!(p.ctrlKey||p.altKey||p.shiftKey||p.metaKey)){p.preventDefault();q=g(this).data("fancybox-group");if(typeof q!=="undefined"){n=q?"data-fancybox-group":false}else{if(m&&m!==""&&m!=="nofollow"){q=m;n="rel"}}if(n){o=i.length?g(i).filter("["+n+'="'+q+'"]'):g("["+n+'="'+q+'"]')}if(o.length){k.index=o.index(this);e.open(o.get(),k)}else{e.open(this,k)}}}if(i){h.undelegate(i,"click.fb-start").delegate(i,"click.fb-start",l)}else{g(this).unbind("click.fb-start").bind("click.fb-start",l)}return this}}(window,document,jQuery));
/*!
 * Thumbnail helper for fancyBox
 * version: 1.0.2
 * @requires fancyBox v2.0 or later
 *
 * Usage:
 *     $(".fancybox").fancybox({
 *         thumbs: {
 *             width	: 50,
 *             height	: 50
 *         }
 *     });
 *
 * Options:
 *     width - thumbnail width
 *     height - thumbnail height
 *     source - function to obtain the URL of the thumbnail image
 *     position - 'top' or 'bottom'
 *
 */
(function(b){var a=b.fancybox;a.helpers.thumbs={wrap:null,list:null,width:0,source:function(d){var c=b(d).find("img");return c.length?c.attr("src"):d.href},init:function(f){var e=this,g,c=f.width||50,h=f.height||50,d=f.source||this.source;g="";for(var i=0;i<a.group.length;i++){g+='<li><a style="width:'+c+"px;height:"+h+'px;" href="javascript:jQuery.fancybox.jumpto('+i+');"></a></li>'}this.wrap=b('<div id="fancybox-thumbs"></div>').addClass(f.position||"bottom").appendTo("body");this.list=b("<ul>"+g+"</ul>").appendTo(this.wrap);b.each(a.group,function(j){b("<img />").load(function(){var o=this.width,k=this.height,n,l,m;if(!e.list||!o||!k){return}n=o/c;l=k/h;m=e.list.children().eq(j).find("a");if(n>=1&&l>=1){if(n>l){o=Math.floor(o/l);k=h}else{o=c;k=Math.floor(k/n)}}b(this).css({width:o,height:k,top:Math.floor(h/2-k/2),left:Math.floor(c/2-o/2)});m.width(c).height(h);b(this).hide().appendTo(m).fadeIn(300)}).attr("src",d(this))});this.width=this.list.children().eq(0).outerWidth();this.list.width(this.width*(a.group.length+1)).css("left",Math.floor(b(window).width()*0.5-(a.current.index*this.width+this.width*0.5)))},update:function(c){if(this.list){this.list.stop(true).animate({left:Math.floor(b(window).width()*0.5-(a.current.index*this.width+this.width*0.5))},150)}},beforeLoad:function(c){if(a.group.length<2){a.coming.helpers.thumbs=false;return}a.coming.margin[c.position==="top"?0:2]=c.height+30},afterShow:function(c){if(this.list){this.update(c)}else{this.init(c)}this.list.children().removeClass("active").eq(a.current.index).addClass("active")},onUpdate:function(){this.update()},beforeClose:function(){if(this.wrap){this.wrap.remove()}this.wrap=null;this.list=null;this.width=0}}}(jQuery));
