this.ASliderUloz = function() {
  var referencje = $('#ASliderData ul li');
  for (i=1;i<=referencje.length;i++) {
    if (i==1) { 
      $('#ASliderList').append(' <a class="hover">'+i+'</a>');
    } else {
      $('#ASliderList').append(' <a class="normal">'+i+'</a>');
    }
  }
  $('#ASliderData ul li').css('display', 'none');
  $('#ASliderData ul li').first().css('display', 'block');
  $('#button-slider').attr('href', $('#ASliderData ul li').first().attr('title'));
}
this.ASlider = function(h) {
  if (h == 1) {
    ASliderUloz();
  }
  var referencje = $('#ASliderData ul li');
  var referencjeSpis = $('#ASliderList a');
  var last = h-1;
  var next = h+1;
  if (h == 1) {
    var last = referencje.length;
  }
  if (h == referencje.length) {
    var next = 1;
  }
  $("#ASliderList a").click(function() {
    var index = $("#ASliderList a").index(this);
    $("#ASliderList a").attr('class', 'normal');
    $('#button-slider').attr('href', $(referencje[index]).attr('title'));
    $(referencjeSpis[index]).attr('class', 'hover');
    $(referencje).css('display','none');
    $(referencje[index]).fadeIn(1500);
  });
  setInterval (function() {
    ASliderTime();
  }, 10000);
}
this.ASliderTime = function() {
  var a = $("#ASliderList a.hover").html();
  var h = parseInt(a);
  var referencje = $('#ASliderData ul li');
  var referencjeSpis = $('#ASliderList a');
  var last = h-2;
  var index = h;
  if (h == 1) {
    var last = referencje.length-1;
  }
  if (h == referencje.length) {
    var index = 0;
  }
  $("#ASliderList a").attr('class', 'normal');
  $('#button-slider').attr('href', $(referencje[index]).attr('title'));
  $(referencjeSpis[index]).attr('class', 'hover');
  $(referencje).css('display','none');
  $(referencje[index]).fadeIn(1500);
}
this.mainBoxH = function() {
  var wysokosc = '0';
  $('.box-main').each(function(i) {
    if ($(this).height() > wysokosc) {
      wysokosc = $(this).height();
    }
  });
  $('.box-main').css('height', wysokosc);
}
$(document).ready(function() {
  ASlider(1);
  if ($('#logo').width() < '500') {
    $('#logo').css('width', '500px');
  }
});

