$(document).ready(function()
{
  $('#cycle').cycle({
    pager: '#pager',
    speed: 1000,
    timeout: 5000
  });

   /*** COLORBOX ***/
  $('a.modal_form').colorbox({
    innerWidth: '1000px',
    innerHeight: '90%',
    close: 'zatvoriť okno',
    iframe: true,
    scrolling: true,
    overlayClose: false,
    opacity: 0.99
  });
  
  $('a.colorbox').colorbox({
    overlayClose: true,
    close: 'zatvoriť'
  });
  
 /*** SCROLLABLE ***/
  $('#carousel').jCarouselLite({
    btnNext: '.carousel_next',
    btnPrev: '.carousel_prev',
    visible: 4,
    auto: 1500,
    speed: 1000
  });

  /*** STATUS ***/
  $('div.status_success,div.status_warning,div.status_failed').each(function() { $(this).fadeIn(1500).delay(15000).fadeOut(1500); });

  $('form.validation').submit(function()
  {
    var ret = true;

    $(this).find(':input').each(function()
    {
      $(this).removeClass('invalid');

      if(this.value=='' && this.className.indexOf('required')!=-1)
      {
        if(ret)
        {
          alert('Prosím zadajte hodnotu v poli "'+this.title+'"');
          this.focus();
          ret = false;
        }

        $(this).addClass('invalid');
      }
    });

    return ret;
  });
});

