jQuery(function($) {
  
  /* ---------------------------------------------------------------- 
  	drop shadow
  ---------------------------------------------------------------- */
//  $(".box1").dropShadow({left: -1, top: 1, opacity: 0.5, blur: 1});
  
  
  /* ---------------------------------------------------------------- 
  	navigation
  ---------------------------------------------------------------- */
/*
  $('.nav-1 ul, .nav-1 ul ul').hide();
  
  $('.nav-1 > li, .nav-2 > li').hoverIntent({
    interval: 30,
    timeout: 500,
    over: function() {
      var ul = $('> ul', this);
      var h = ul.height();
      ul.stop().show().height(0).animate({height: h}, 100);
    },
    out: function() {
      var ul = $('> ul', this);
      var h = ul.height();
      ul.stop().animate({height: 0}, 100, "linear", function() { $(this).hide().height(h); });
    }
  });
*/  
  
  /* ---------------------------------------------------------------- 
  	4 references
  ---------------------------------------------------------------- */
  
  /*  
  var boxes = $('.ref-home');
  var bHeight = $('.comm-box', boxes).height()
  
  boxes.children('.comm-box').hide();
  
  boxes.hoverIntent({
    interval: 30,
    timeout: 1,
    over: function() {
      boxes.css({'z-index': '10'}).find('.comm-box', boxes).css({'z-index': '10'});
      $(this).addClass('selected').css({'z-index': '100'});
      $('.comm-box', this).stop().css({'z-index': '100'}).show(); // animate({height: 'toggle'}, 300, 'easeOutQuint')
    },
    out: function() {
      var box = $(this);
      $('.comm-box', this).stop().hide(); // .hide(1, function() { $(this).css({'height': bHeight}); box.removeClass('selected'); });
      box.removeClass('selected');
    }
  });
  */
  
  /* ---------------------------------------------------------------- 
  	hScroller
  ---------------------------------------------------------------- */
  $('#ref-all').hScroller();
  
  // Searchbox
  $('input[type="text"][name="q"]').focus(function() {
		(this.value == this.defaultValue) ? this.value = '' : this.select();
		$(this).blur(function() {
			if ($.trim(this.value) == ''){
				this.value = (this.defaultValue ? this.defaultValue : '');
			}
		});
   });

  // Searchbox
  $('input[type="text"][name="zine_reg_mail"]').focus(function() {
		(this.value == this.defaultValue) ? this.value = '' : this.select();
		$(this).blur(function() {
			if ($.trim(this.value) == ''){
				this.value = (this.defaultValue ? this.defaultValue : '');
			}
		});
   });
  
  /* ---------------------------------------------------------------- 
  	jcarousel
  ---------------------------------------------------------------- */
  $('#ref-img ul').jcarousel({
    scroll: 1,
    easing: 'easeOutQuart',
    animation: 500
  });
  
  /* ---------------------------------------------------------------- 
  	browsers
  ---------------------------------------------------------------- */
  if ($.browser.opera) {$('body').addClass('opera');}
  
  
});


jQuery(function($) {
    $("#form").validate({


        rules: {
            "cf[name]": "required",
            "cf[surname]": "required",
            "cf[message]": "required",
            "cf[robocop]": {
                required: true,
            },
            "cf[email]": {
                required: true,
                email: true
            }
        },
       

        messages: {
            "cf[name]": "Musíte vyplnit jméno",
            "cf[surname]": "Musíte vyplnit příjmení",
            "cf[message]": "Musíte vyplnit dotaz",
            "cf[robocop]": {
                required: "",
                min: "",
                max: ""
            },
            "cf[email]": {
                required: "E-mail je povinné pole",
                email: "E-mail je ve špatném formátu"
            }
        },

        errorElement: "div",
        wrapper: "div id='message'",

        errorPlacement: function(error, element) {
            offset = element.offset();
            error.fadeIn(2000);
            error.appendTo(element.parent());
            error.addClass('message');  // add a class to the wrapper
            error.css('position', 'absolute');
            error.css('left', offset.left + element.outerWidth() - 150);
            error.css('top', offset.top);
        }

    });

    $("#robocop").val(6);
    $("#robocop_element").hide();
});

    