jQuery(document).ready(TB_init);
function TB_init(){
jQuery("a.thickbox").click(function(_1){
_1.preventDefault();
this.blur();
var _2=this.title||this.name||"";
var _3=this.rel||false;
TB_show(_2,this.href,_3);
});
}
function TB_show(_4,_5,_6){
if(!jQuery("#TB_HideSelect").length){
jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
jQuery("#TB_overlay").click(TB_remove);
}
jQuery(window).scroll(TB_position);
TB_overlaySize();
jQuery("body").append("<div id='TB_load'><img src='/img/ajax-loader.gif' /></div>");
TB_load_position();
var _7=_5.match(/(.+)?/)[1]||_5;
var _8=/\.(jpe?g|png|gif|bmp)/gi;
if(_7.match(_8)){
var _9={caption:"",url:"",html:""};
var _a=_9,next=_9,imageCount="";
if(_6){
function getInfo(_b,id,_d){
return {caption:_b.title,url:_b.href,html:"<span id='TB_"+id+"'>&nbsp;&nbsp;<a href='#'>"+_d+"</a></span>"};
}
var _e=jQuery("a[@rel="+_6+"]").get();
var _f=false;
for(var i=0;i<_e.length;i++){
var _11=_e[i];
var _12=_11.href.match(_8);
if(_11.href==_5){
_f=true;
imageCount="Zdj\u0119cie "+(i+1)+" z "+(_e.length);
}else{
if(_f){
next=getInfo(_11,"next","Nast\u0119pne &gt;");
break;
}else{
_a=getInfo(_11,"prev","&lt; Poprzednie");
}
}
}
}
imgPreloader=new Image();
imgPreloader.onload=function(){
imgPreloader.onload=null;
var _13=TB_getPageSize();
var x=_13[0]-150;
var y=_13[1]-150;
var _16=imgPreloader.width;
var _17=imgPreloader.height;
if(_16>x){
_17=_17*(x/_16);
_16=x;
if(_17>y){
_16=_16*(y/_17);
_17=y;
}
}else{
if(_17>y){
_16=_16*(y/_17);
_17=y;
if(_16>x){
_17=_17*(x/_16);
_16=x;
}
}
}
TB_WIDTH=_16+30;
TB_HEIGHT=_17+60;
jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Zamknij'><img id='TB_Image' src='"+_5+"' width='"+_16+"' height='"+_17+"' alt='"+_4+"'/></a>"+"<div id='TB_caption'>"+_4+"<div id='TB_secondLine'>"+imageCount+_a.html+next.html+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Zamknij'>Zamknij</a></div>");
jQuery("#TB_closeWindowButton").click(TB_remove);
function buildClickHandler(_18){
return function(){
jQuery("#TB_window").remove();
jQuery("body").append("<div id='TB_window'></div>");
TB_show(_18.caption,_18.url,_6);
return false;
};
}
var _19=buildClickHandler(_a);
var _1a=buildClickHandler(next);
if(_a.html){
jQuery("#TB_prev").click(_19);
}
if(next.html){
jQuery("#TB_next").click(_1a);
}
document.onkeydown=function(e){
if(e==null){
keycode=event.keyCode;
}else{
keycode=e.which;
}
switch(keycode){
case 27:
TB_remove();
break;
case 190:
if(next.html){
document.onkeydown=null;
_1a();
}
break;
case 188:
if(_a.html){
document.onkeydown=null;
_19();
}
break;
}
};
TB_position();
jQuery("#TB_load").remove();
jQuery("#TB_ImageOff").click(TB_remove);
jQuery("#TB_window").css({display:"block"});
};
imgPreloader.src=_5;
}else{
var _1c=_5.match(/\?(.+)/)[1];
var _1d=TB_parseQuery(_1c);
TB_WIDTH=(_1d["width"]*1)+30;
TB_HEIGHT=(_1d["height"]*1)+40;
var _1e=TB_WIDTH-30,ajaxContentH=TB_HEIGHT-45;
if(_5.indexOf("TB_iframe")!=-1){
urlNoQuery=_5.split("TB_");
jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+_4+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Zamknij'>Zamknij</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(_1e+29)+"px;height:"+(ajaxContentH+17)+"px;' onload='TB_showIframe()'> </iframe>");
}else{
jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+_4+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>Zamknij</a></div></div><div id='TB_ajaxContent' style='width:"+_1e+"px;height:"+ajaxContentH+"px;'></div>");
}
jQuery("#TB_closeWindowButton").click(TB_remove);
if(_5.indexOf("TB_inline")!=-1){
jQuery("#TB_ajaxContent").html(jQuery("#"+_1d["inlineId"]).html());
TB_position();
jQuery("#TB_load").remove();
jQuery("#TB_window").css({display:"block"});
}else{
if(_5.indexOf("TB_iframe")!=-1){
TB_position();
if(frames["TB_iframeContent"]==undefined){
jQuery("#TB_load").remove();
jQuery("#TB_window").css({display:"block"});
jQuery(document).keyup(function(e){
var key=e.keyCode;
if(key==27){
TB_remove();
}
});
}
}else{
jQuery("#TB_ajaxContent").load(_5,function(){
TB_position();
jQuery("#TB_load").remove();
jQuery("#TB_window").css({display:"block"});
});
}
}
}
jQuery(window).resize(TB_position);
document.onkeyup=function(e){
if(e==null){
keycode=event.keyCode;
}else{
keycode=e.which;
}
if(keycode==27){
TB_remove();
}
};
}
function TB_showIframe(){
jQuery("#TB_load").remove();
jQuery("#TB_window").css({display:"block"});
}
function TB_remove(){
jQuery("#TB_imageOff").unbind("click");
jQuery("#TB_overlay").unbind("click");
jQuery("#TB_closeWindowButton").unbind("click");
jQuery("#TB_window").fadeOut("fast",function(){
jQuery("#TB_window,#TB_overlay,#TB_HideSelect").remove();
});
jQuery("#TB_load").remove();
return false;
}
function TB_position(){
var _22=TB_getPageSize();
var _23=TB_getPageScrollTop();
var _24={width:TB_WIDTH,left:(_23[0]+(_22[0]-TB_WIDTH)/2),top:(_23[1]+(_22[1]-TB_HEIGHT)/2)};
jQuery("#TB_window").css(_24);
}
function TB_overlaySize(){
if(window.innerHeight&&window.scrollMaxY||window.innerWidth&&window.scrollMaxX){
yScroll=window.innerHeight+window.scrollMaxY;
xScroll=window.innerWidth+window.scrollMaxX;
var _25=document.documentElement;
var wff=(_25&&_25.clientWidth)||document.body.clientWidth||window.innerWidth||self.innerWidth;
var hff=(_25&&_25.clientHeight)||document.body.clientHeight||window.innerHeight||self.innerHeight;
xScroll-=(window.innerWidth-wff);
yScroll-=(window.innerHeight-hff);
}else{
if(document.body.scrollHeight>document.body.offsetHeight||document.body.scrollWidth>document.body.offsetWidth){
yScroll=document.body.scrollHeight;
xScroll=document.body.scrollWidth;
}else{
yScroll=document.body.offsetHeight;
xScroll=document.body.offsetWidth;
}
}
jQuery("#TB_overlay").css({"height":yScroll,"width":xScroll});
jQuery("#TB_HideSelect").css({"height":yScroll,"width":xScroll});
}
function TB_load_position(){
var _28=TB_getPageSize();
var _29=TB_getPageScrollTop();
jQuery("#TB_load").css({left:(_29[0]+(_28[0]-100)/2),top:(_29[1]+((_28[1]-100)/2))}).css({display:"block"});
}
function TB_parseQuery(_2a){
if(!_2a){
return {};
}
var _2b={};
var _2c=_2a.split(/[;&]/);
for(var i=0;i<_2c.length;i++){
var _2e=_2c[i].split("=");
if(!_2e||_2e.length!=2){
continue;
}
_2b[unescape(_2e[0])]=unescape(_2e[1]).replace(/\+/g," ");
}
return _2b;
}
function TB_getPageScrollTop(){
var _2f;
var _30;
if(self.pageYOffset||self.pageXOffset){
_2f=self.pageYOffset;
_30=self.pageXOffset;
}else{
if(document.documentElement&&document.documentElement.scrollTop||document.documentElement.scrollLeft){
_2f=document.documentElement.scrollTop;
_30=document.documentElement.scrollLeft;
}else{
if(document.body){
_2f=document.body.scrollTop;
_30=document.body.scrollLeft;
}
}
}
arrayPageScroll=new Array(_30,_2f);
return arrayPageScroll;
}
function TB_getPageSize(){
var de=document.documentElement;
var w=window.innerWidth||self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;
var h=window.innerHeight||self.innerHeight||(de&&de.clientHeight)||document.body.clientHeight;
arrayPageSize=new Array(w,h);
return arrayPageSize;
}

