(function($)
{$.log=$.log||function(options)
{var con=null;if(typeof console!=='undefined'&&typeof $.log!=='undefined')
{con=console;}
else if(typeof window.console!=='undefined'&&typeof window.$.log!=='undefined')
{con=window.console;}
if(con)
{if(typeof arguments!=='undefined'&&arguments.length>1)
{con.log(arguments);return arguments;}
else
{con.log(options);return options;}}};$.params_to_json=$.params_to_json||function(params)
{params=String(params);params=params.substring(params.indexOf('?')+1);params=params.replace(/\+/g,'%20');if(params.substring(0,1)==='{'&&params.substring(params.length-1)==='}')
{return eval(decodeURIComponent(params));}
params=params.split(/\&|\&amp\;/);var json={};for(var i=0,n=params.length;i<n;++i)
{var param=params[i]||null;if(param===null){continue;}
param=param.split('=');if(param===null){continue;}
var key=param[0]||null;if(key===null){continue;}
if(typeof param[1]==='undefined'){continue;}
var value=param[1];key=decodeURIComponent(key);value=decodeURIComponent(value);try{value=eval(value);}catch(e){}
var keys=key.split('.');if(keys.length===1)
{json[key]=value;}
else
{var path='';for(ii in keys)
{key=keys[ii];path+='.'+key;eval('json'+path+' = json'+path+' || {}');}
eval('json'+path+' = value');}}
return json;};$.LightboxClass=function()
{this.construct();};$.fn.lightbox=function(options)
{$.Lightbox=$.Lightbox||new $.LightboxClass();options=$.extend({start:false,events:true},options);var group=$(this);if(options.events)
{$(group).unbind().click(function(){var obj=$(this);if(!$.Lightbox.init($(obj)[0],group))
{return false;}
if(!$.Lightbox.start())
{return false;}
return false;});$(group).addClass('lightbox-enabled');}
if(options.start)
{var obj=$(this);if(!$.Lightbox.init($(obj)[0],group))
{return this;}
if(!$.Lightbox.start())
{return this;}}
return this;};$.extend($.LightboxClass.prototype,{images:{list:[],image:false,prev:function(image)
{if(typeof image==='undefined')
{image=this.active();if(!image){return image;}}
if(this.first(image))
{return false;}
return this.get(image.index-1);},next:function(image)
{if(typeof image==='undefined')
{image=this.active();if(!image){return image;}}
if(this.last(image))
{return false;}
return this.get(image.index+1);},first:function(image)
{if(typeof image==='undefined')
{return this.get(0);}
return image.index===0;},last:function(image)
{if(typeof image==='undefined')
{return this.get(this.size()-1);}
return image.index===this.size()-1;},single:function()
{return this.size()===1;},size:function()
{return this.list.length;},empty:function()
{return this.size()===0;},clear:function()
{this.list=[];this.image=false;},active:function(image)
{if(typeof image==='undefined')
{return this.image;}
image=this.get(image);if(!image){return image;}
this.image=image;return true;},add:function(obj)
{if(obj[0])
{for(var i=0;i<obj.length;i++)
{this.add(obj[i]);}
return true;}
var image=this.create(obj);if(!image){return image;}
image.index=this.size();this.list.push(image);return true;},create:function(obj)
{var image={src:'',title:'',description:'',name:'',index:-1,image:true};if(obj.image)
{image.src=obj.src||image.src;image.title=obj.title||image.title;image.description=obj.description||image.description;image.name=obj.name||image.name;image.index=obj.index||image.index;}
else if(obj.tagName)
{obj=$(obj);if(obj.attr('src')||obj.attr('href'))
{image.src=obj.attr('src')||obj.attr('href');image.title=obj.attr('title')||obj.attr('alt')||image.title;image.name=obj.attr('name')||'';var s=image.title.indexOf(': ');if(s>0)
{image.description=image.title.substring(s+2)||image.description;image.title=image.title.substring(0,s)||image.title;}}
else
{image=false;}}
else
{image=false;}
if(!image)
{$.log('ERROR','We dont know what we have:',obj);return false;}
return image;},get:function(image)
{if(typeof image==='undefined'||image===null)
{return this.active();}
else
if(typeof image==='number')
{image=this.list[image]||false;}
else
{image=this.create(image);if(!image){return false;}
var f=false;for(var i=0;i<this.size();i++)
{var c=this.list[i];if(c.src===image.src&&c.title===image.title&&c.description===image.description)
{f=c;}}
image=f;}
if(!image)
{$.log('ERROR','The desired image doesn\'t exist: ',image,this.list);return false;}
return image;},debug:function()
{return $.Lightbox.debug(arguments);}},constructed:false,src:null,baseurl:null,files:{js:{lightbox:'scripts/jquery.lightbox.js'},css:{lightbox:'styles/jquery.lightbox.css'},images:{prev:'images/lightbox/prev.gif',next:'images/lightbox/next.gif',blank:'images/lightbox/blank.gif',loading:'images/lightbox/loading.gif'}},text:{image:'Obrázok',of:'z',close:'Zatvoriť',closeInfo:'Kliknite kdekoľvek mimo obrázka pre zatvorenie lightboxu.',help:{close:'',interact:''},about:{text:'',title:'',link:''}},show_linkback:true,keys:{close:'c',prev:'p',next:'n'},handlers:{show:null},opacity:0.75,padding:null,speed:400,rel:'lightbox',auto_relify:true,scroll_with:false,options:['baseurl','files','text','show_linkback','keys','opacity','padding','speed','rel','auto_relify','scroll_with'],construct:function(options)
{var initial=typeof this.constructed==='undefined'||this.constructed===false;this.constructed=true;var domReady=initial;options=$.extend({},options);if(initial&&(typeof options.files==='undefined'))
{this.src=$('script[src*='+this.files.js.lightbox+']:first').attr('src');if(!this.src)
{domReady=false;}
else
{this.baseurl=this.src.substring(0,this.src.indexOf(this.files.js.lightbox));var me=this;$.each(this.files,function(group,val){$.each(this,function(file,val){me.files[group][file]=me.baseurl+val;});});delete me;options=$.extend(options,$.params_to_json(this.src));}}
else
if(typeof options.files==='object')
{var me=this;$.each(options.files,function(group,val){$.each(this,function(file,val){this[file]=me.baseurl+val;});});delete me;}
else
{domReady=false;}
for(i in this.options)
{var name=this.options[i];if((typeof options[name]==='object')&&(typeof this[name]==='object'))
{this[name]=$.extend(this[name],options[name]);}
else if(typeof options[name]!=='undefined')
{this[name]=options[name];}}
if(domReady||typeof options.files==='object'||typeof options.text==='object'||typeof options.show_linkback!=='undefined'||typeof options.scroll_with!=='undefined')
{$(function(){$.Lightbox.domReady();});}
return true;},domReady:function()
{var stylesheets=this.files.css;var bodyEl=document.getElementsByTagName($.browser.safari?'head':'body')[0];for(stylesheet in stylesheets)
{var linkEl=document.createElement('link');linkEl.type='text/css';linkEl.rel='stylesheet';linkEl.media='screen';linkEl.href=stylesheets[stylesheet];linkEl.id='lightbox-stylesheet-'+stylesheet;$('#'+linkEl.id).remove();bodyEl.appendChild(linkEl);}
delete stylesheets;delete bodyEl;$('#lightbox,#lightbox-overlay').remove();$('body').append('<div id="lightbox-overlay"><div id="lightbox-overlay-text">'+(this.show_linkback?'<p><span id="lightbox-overlay-text-about"><a href="#" title="'+this.text.about.title+'">'+this.text.about.text+'</a></span></p><p>&nbsp;</p>':'')+'<p><span id="lightbox-overlay-text-close">'+this.text.help.close+'</span><br/>&nbsp;<span id="lightbox-overlay-text-interact">'+this.text.help.interact+'</span></p></div></div><div id="lightbox"><div id="lightbox-imageBox"><div id="lightbox-imageContainer"><img id="lightbox-image" /><div id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+this.files.images.loading+'" /></a></div></div></div><div id="lightbox-infoBox"><div id="lightbox-infoContainer"><div id="lightbox-infoHeader"><span id="lightbox-caption"><span id="lightbox-caption-title"></span><span id="lightbox-caption-description"></span></span></div><div id="lightbox-infoFooter"><span id="lightbox-currentNumber"></span><span id="lightbox-close"><a href="#" id="lightbox-close-button" title="'+this.text.closeInfo+'">'+this.text.close+'</a></span></div><div id="lightbox-infoContainer-clear"></div></div></div></div>');this.resizeBoxes();this.repositionBoxes();$('#lightbox,#lightbox-overlay,#lightbox-overlay-text-interact').hide();$.each(this.files.images,function()
{var preloader=new Image();preloader.onload=function(){preloader.onload=null;preloader=null;};preloader.src=this;});$(window).unbind().resize(function()
{$.Lightbox.resizeBoxes();$.Lightbox.repositionBoxes();});if($.Lightbox.scroll_with)
{$(window).scroll(function()
{$.Lightbox.repositionBoxes();});}
$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+$.Lightbox.files.images.prev+') left 45% no-repeat'});},function(){$(this).css({'background':'transparent url('+$.Lightbox.files.images.blank+') no-repeat'});}).click(function(){$.Lightbox.showImage($.Lightbox.images.prev());return false;});$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+$.Lightbox.files.images.next+') right 45% no-repeat'});},function(){$(this).css({'background':'transparent url('+$.Lightbox.files.images.blank+') no-repeat'});}).click(function(){$.Lightbox.showImage($.Lightbox.images.next());return false;});if(this.show_linkback)
{$('#lightbox-overlay-text-about a').click(function(){window.open($.Lightbox.text.about.link);return false;});}
$('#lightbox-overlay-text-close').unbind().hover(function(){$('#lightbox-overlay-text-interact').fadeIn();},function(){$('#lightbox-overlay-text-interact').fadeOut();});$('#lightbox-overlay, #lightbox, #lightbox-loading-link, #lightbox-btnClose').unbind().click(function(){$.Lightbox.finish();return false;});if($.Lightbox.auto_relify)
{$.Lightbox.relify();}
return true;},relify:function()
{var groups={};var groups_n=0;var orig_rel=this.rel;$.each($('[@rel*='+orig_rel+']'),function(index,obj){var rel=$(obj).attr('rel');if(rel===orig_rel)
{rel=groups_n;}
if(typeof groups[rel]==='undefined')
{groups[rel]=[];groups_n++;}
groups[rel].push(obj);});$.each(groups,function(index,group){$(group).lightbox();});return true;},init:function(image,images)
{if(typeof images==='undefined')
{images=image;image=0;}
this.images.clear();if(!this.images.add(images))
{return false;}
if(this.images.empty())
{$.log('WARNING','Lightbox started, but no images: ',image,images);return false;}
if(!this.images.active(image))
{return false;}
return true;},start:function()
{$('embed, object, select').css('visibility','hidden');this.resizeBoxes();this.repositionBoxes({'speed':0});$('#lightbox-infoFooter').hide();$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-infoBox').hide();$('#lightbox-overlay').css('opacity',this.opacity).fadeIn(400,function(){$('#lightbox').fadeIn(300);if(!$.Lightbox.showImage($.Lightbox.images.active()))
{$.Lightbox.finish();return false;}});return true;},finish:function()
{$('#lightbox').hide();$('#lightbox-overlay').fadeOut(function(){$('#lightbox-overlay').hide();});$('embed, object, select').css({'visibility':'visible'});},resizeBoxes:function()
{$('#lightbox-overlay').css({width:$(document).width(),height:$(document).height()});},repositioning:false,reposition_failsafe:false,repositionBoxes:function(options)
{if($.Lightbox.repositioning)
{$.Lightbox.reposition_failsafe=true;return null;}
$.Lightbox.repositioning=true;options=$.extend({},options);options.callback=options.callback||null;options.speed=options.speed||'slow';var pageScroll=this.getPageScroll();var nHeight=options.nHeight||parseInt($('#lightbox').height(),10)||$(document).height()/3;var nTop=pageScroll.yScroll+($(document.body).height()-nHeight)/2.5;var nLeft=pageScroll.xScroll;var css={left:nLeft,top:nTop};if(options.speed){$('#lightbox').animate(css,'slow',function(){if($.Lightbox.reposition_failsafe)
{$.Lightbox.repositioning=$.Lightbox.reposition_failsafe=false;$.Lightbox.repositionBoxes(options);}
else
{$.Lightbox.repositioning=false;if(options.callback)
{options.callback();}}});}
else
{$('#lightbox').css(css);if($.Lightbox.reposition_failsafe)
{$.Lightbox.repositioning=$.Lightbox.reposition_failsafe=false;$.Lightbox.repositionBoxes(options);}
else
{$.Lightbox.repositioning=false;}}
return true;},showImage:function(image,options)
{image=this.images.get(image);if(!image){return image;}
options=$.extend({step:1},options);var skipped_step_1=options.step>1&&this.images.active().src!==image.src;var skipped_step_2=options.step>2&&$('#lightbox-image').attr('src')!==image.src;if(skipped_step_1||skipped_step_2)
{$.log('We wanted to skip a few steps: ',options,image,skipped_step_1,skipped_step_2);options.step=1;}
switch(options.step)
{case 1:this.KeyboardNav_Disable();$('#lightbox-loading').show();$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-infoBox').hide();$('#lightbox-imageBox').unbind();if(!this.images.active(image)){return false;}
var preloader=new Image();preloader.onload=function(){$.Lightbox.showImage(null,{step:2,width:preloader.width,height:preloader.height});preloader.onload=null;preloader=null;};preloader.src=image.src;break;case 2:$('#lightbox-image').attr('src',image.src);options=$.extend({width:null,height:null},options);if(typeof this.padding==='undefined'||this.padding===null||isNaN(this.padding))
{this.padding=parseInt($('#lightbox-imageContainer').css('padding-left'),10)||parseInt($('#lightbox-imageContainer').css('padding'),10)||0;}
var iWidth=options.width;var iHeight=options.height;var cWidth=$('#lightbox-imageBox').width();var cHeight=$('#lightbox-imageBox').height();var nWidth=(iWidth+(this.padding*2));var nHeight=(iHeight+(this.padding*2));var dWidth=cWidth-nWidth;var dHeight=cHeight-nHeight;$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:iHeight+(this.padding*2)});$('#lightbox-infoBox').css({width:iWidth+this.padding*2});this.repositionBoxes({'nHeight':nHeight});if(dWidth===0&&dHeight===0)
{this.pause(this.speed/3);$.Lightbox.showImage(null,{step:3});}
else
{$('#lightbox-imageBox').animate({width:nWidth,height:nHeight},this.speed,function(){$.Lightbox.showImage(null,{step:3});});}
break;case 3:$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(500,function(){$.Lightbox.showImage(null,{step:4});});this.preloadNeighbours();if($.Lightbox.handlers.show!==null)
{$.Lightbox.handlers.show(image);}
break;case 4:$('#lightbox-caption-title').html(image.title+(image.description?': ':'')||'');$('#lightbox-caption-description').html(image.description||'&nbsp;');if(this.images.size()>1)
{$('#lightbox-currentNumber').html(this.text.image+'&nbsp;'+(image.index+1)+'&nbsp;'+this.text.of+'&nbsp;'+this.images.size());}else
{$('#lightbox-currentNumber').html('&nbsp;');}
$('#lightbox-imageBox').unbind('mouseover').mouseover(function(){$('#lightbox-infoBox').slideDown(0);$('#lightbox-infoFooter').slideDown('fast');});$('#lightbox-nav-btnPrev, #lightbox-nav-btnNext').css({'background':'transparent url('+this.files.images.blank+') no-repeat'});if(!this.images.first(image)){$('#lightbox-nav-btnPrev').show();}
if(!this.images.last(image)){$('#lightbox-nav-btnNext').show();}
$('#lightbox-nav').show();this.KeyboardNav_Enable();break;default:$.log('ERROR','Don\'t know what to do: ',options);return this.showImage(image,{step:1});}
return true;},preloadNeighbours:function()
{if(this.images.single()||this.images.empty())
{return true;}
var image=this.images.active();if(!image){return image;}
var prev=this.images.prev(image);var objNext;if(prev){objNext=new Image();objNext.src=prev.src;}
var next=this.images.next(image);if(next){objNext=new Image();objNext.src=next.src;}},KeyboardNav_Enable:function(){$(document).keydown(function(objEvent){$.Lightbox.KeyboardNav_Action(objEvent);});},KeyboardNav_Disable:function(){$(document).unbind();},KeyboardNav_Action:function(objEvent){objEvent=objEvent||window.event;var keycode=objEvent.keyCode;var escapeKey=objEvent.DOM_VK_ESCAPE||27;var key=String.fromCharCode(keycode).toLowerCase();if(key===this.keys.close||keycode===escapeKey)
{return $.Lightbox.finish();}
if(key===this.keys.prev||keycode===37)
{return $.Lightbox.showImage($.Lightbox.images.prev());}
if(key===this.keys.next||keycode===39)
{return $.Lightbox.showImage($.Lightbox.images.next());}
return true;},getPageScroll:function(){var xScroll,yScroll;if(self.pageYOffset)
{yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop)
{yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body)
{yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
var arrayPageScroll={'xScroll':xScroll,'yScroll':yScroll};return arrayPageScroll;},pause:function(ms){var date=new Date();var curDate=null;do{curDate=new Date();}
while(curDate-date<ms);}});if(typeof $.Lightbox==='undefined')
{$.Lightbox=new $.LightboxClass();}})(jQuery);
