$(document).ready(function() {
$('.ukryj').hide();
$('a.pokaz').click(function() {
$(this).parent('.content').find('.ukryj').slideToggle(400);
return false;
});
//^ukrywanie tekstu
$('.mzn').click(function() {
alert("plan chwilowo niedostępny");
return false;
});
$('a[@href^="http://"],a[rel="external"]').click(function() {
window.open($(this).attr('href'));
return false;
});
var ciasteczko = $.cookie('menuright') || '';
$('#menu-right h4').each(function(index) {
var con = $(this).next();
if(ciasteczko.indexOf(bigIndex(index)) > -1) {
con.hide();
$(this).addClass('tg');
}
$(this).click(function() {
$(this).toggleClass('tg');
if(con.is(':visible')) {
con.slideUp();
ciasteczko = ciasteczko + bigIndex(index);
$.cookie('menuright',ciasteczko);
} else {
con.slideDown();
ciasteczko = ciasteczko.replace(bigIndex(index),'');
$.cookie('menuright',ciasteczko);
}
});
});
$('.kl').parents('tr').siblings().hide();
$('.kl').click(function() {
if($(this).is('.tg')) {
$(this).removeClass(' tg').parents('tr').siblings().hide(); /*fadeOut('slow');*/
} else {
$(this).addClass(' tg').parents('tr').siblings().show(); /*fadeIn('slow');*/
}
});
$('div#search,#menuarchiwum li ul').hide();
var tglink = $('<p><a href="#">[+] pokaż panel szukania</a></p>');
tglink.insertBefore('div#search');
tglink.children().click(function() {
var ds = $(this).parent().next();
if(ds.is(':hidden')) {
$(this).text($(this).text().replace('[+] pokaż','[-] ukryj'));
ds.slideDown();
} else {
$(this).text($(this).text().replace('[-] ukryj','[+] pokaż'));
ds.slideUp();
}
return false;
});
var ciasteczko2 = $.cookie('menurok') || '';
$('#menuarchiwum strong a').each(function(index) {
var lista = $(this).parent().next();
if(ciasteczko2.indexOf(bigIndex(index)) > -1) {
lista.show();
}
$(this).click(function() {
if(lista.is(':hidden')) {
lista.slideDown();
ciasteczko2 = ciasteczko2 + bigIndex(index);
$.cookie('menurok',ciasteczko2);
} else {
lista.slideUp();
ciasteczko2 = ciasteczko2.replace(bigIndex(index),'');
$.cookie('menurok',ciasteczko2);
}
return false;
});
});
var ciasteczko3 = $.cookie('menu');
if(ciasteczko3) {
$('#menu-left dt').not('#'+ciasteczko3).next('dd').hide();
$('#'+ciasteczko3).addClass('n');
} else {
$('#menu-left dd').hide();
}
$('#menu-left dt').next('dd').prev().find('a').click(function() {
var bor = $(this).parent(),bor2 = bor.next().siblings('dd:visible');
if(bor2.length) {
bor2.slideUp('fast',function() {
$(this).prev().removeClass();
$.cookie('menu',null);
bor.addClass('n').next().slideDown(function() {
$.cookie('menu',bor.attr('id'));
});
});
} else {
if(bor.is('.n')) {
bor.next().slideUp('fast',function() {
bor.removeClass();
$.cookie('menu',null);
});
} else {
bor.addClass('n').next().slideDown();
$.cookie('menu',bor.attr('id'));
}
}
return false;
});
});
function bigIndex(inival) {
return inival < 10 ? '0' + inival + '-' : '' + inival + '-';
}
