$(document).ready(function()
{
  
   /*** COLORBOX ***/
  $('a.modal_form').colorbox({
    innerWidth: '764px',
    innerHeight: '618px',
    close: 'zatvoriť okno',
    iframe: true,
    scrolling: false,
    overlayClose: false
  });
  
  $('a.colorbox').colorbox({
    overlayClose: true,
    close: 'zatvoriť',
  });
  
  /*** FORM ***/
  $('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');
      }

      if(this.className.indexOf('email')!='-1' && this.value!='')
      {
        var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

        if(reg.test(this.value)==false)
        {
          if(ret)
          {
            alert('Prosím zadajte platnú e-mailovú adresu.');
            this.focus();
            ret = false;
          }

          $(this).addClass('invalid');
        }
      }
    });

    return ret;
  });  
  
  $(function() {
            $("#menu-effect").lavaLamp({
                fx: "backout",
                speed: 700
            });
        });
  
});

