jQuery(document).ready(function() {
if(window.innerWidth > 992) { disabilities(); }
var wapoMainWindowWidth = $(window).width();
$('.sf-menu ul li').mouseover(function(){
// checks if third level menu exist
var subMenuExist = $(this).find('.dropdown').length;
if( subMenuExist > 0){
var subMenuWidth = $(this).find('.dropdown').width();
var subMenuOffset = $(this).find('.dropdown').parent().offset().left + subMenuWidth;
// if sub menu is off screen, give new position
if((subMenuOffset + subMenuWidth) > wapoMainWindowWidth){
var newSubMenuPosition = subMenuWidth + 3;
$(this).find('.dropdown').css({
left: -newSubMenuPosition,
top: '0',
});
}
}
});
enquire.register("screen and (min-width: 768px)", function() {
$('.sf-menu').superfish();
});
enquire.register("screen and (max-width: 992px)", function() {
$(".position-side-left").detach().insertAfter(".content");
});
enquire.register("screen and (min-width: 992px)", function() {
$(".position-side-left").detach().insertBefore(".content");
});
});
$(window).bind("load", function() {
if($('.slider-wrapper').length)
{
$('#slider').nivoSlider({
effect: 'sliceDown,sliceDownLeft,sliceUp,sliceUpLeft,sliceUpDown,sliceUpDownLeft,fold,boxRandom',
animSpeed: 500,
pauseTime: getSlidePauseTime(),
controlNav: false,
directionNav: false,
pauseOnHover: false
});
}
WHCheckCookies();
$('#cookieRozumiem').click(function (e) {
e.preventDefault();
WHCreateCookie('cookies_accepted', 'T', 365);
$('#cookieBoxCont').fadeOut();
});
$('.go-to-search').click(function(){
$('#search-input').focus();
});
$('.sf-menu li a').focusin(function(){
$(this).parent('li').addClass('focused');
});
$('.sf-menu li a').focusout(function(){
$(this).parent('li').removeClass('focused');
});
var $container = $('.masonry');
$container.imagesLoaded( function() {
$container.masonry();
});
if($('#weather').length)
{
$.simpleWeather({
location: $('#weather').attr('data-location'),
woeid: '',
unit: 'c',
success: function(weather) {
html = '';
html += '
'+weather.temp+'°'; $(".weather-content").html(html); }, error: function(error) { $(".weather-content").html('
'+error+'
'); } }); } $.each($('.addon-box .sf-menu li a'), function(index, value) { if($(this).attr('href') == window.location.pathname) { $(this).css('text-decoration', 'underline'); $(this).css('font-weight', 'bold'); $(this).parent().parent().css('display', 'block'); $(this).parent().parent().parent().parent().css('display', 'block'); $(this).parent('li').children('ul').css('display', 'block'); $(this).parent('li').children('ul li ul').css('display', 'block'); } }); if($('#popup').length && !WHReadCookie('interPop')) { WHCreateCookie('interPop','popup',1); $('.modal').modal(); } }); function WHCreateCookie(name, value, days) { var now = new Date(); var expire = new Date(); expire.setFullYear(now.getFullYear()); expire.setMonth(now.getMonth()); expire.setDate(now.getDate()+days); expire.setHours(0); expire.setMinutes(0); document.cookie = name+"="+value+"; expires=" + expire.toString() +"; path=/"; } function WHReadCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } function WHCheckCookies() { if(WHReadCookie('cookies_accepted') != 'T') { var message_container = document.createElement('div'); message_container.id = 'cookieBoxCont'; var html_code = ' '; message_container.innerHTML = html_code; document.body.appendChild(message_container); } if(WHReadCookie('return') != 'T') { $.ajax({url: "http://"+document.domain+"/addviewer"}) .done(function ( data ) { WHCreateCookie('return', 'T', 1); }); } } function updateCalendar(curmonth,curyear) { var loading = document.getElementById('monthyear'); var eventscalendar = document.getElementById('eventscalendar'); $.ajax({url: "http://"+document.domain+"/eventsajax?month="+curmonth+"&year="+curyear, beforeSend: function ( xhr ) { loading.innerHTML='