$("document").ready(function(){
   // menu hover
      $('#menu a').hover(
         function () {
            $('.over', this).stop(true, true).fadeIn(500);
         }, function () {
            $('.over', this).stop(true, true).fadeOut(250);
         }
      );
   // end
   
   // leftmenu
      $("#line-up-selector div").click(function(){
         $("#line-up-selector div").removeClass('active');
         $(this).addClass('active');
         var clickId = $(this).attr('id');
         $(".lineupzz").hide(0,function(){
            $("#menu-"+clickId).show();
         });
      });
   
   // fancybox
   $(".img-line a").fancybox({
      'transitionIn':'fade',
      'transitionOut':'fade',
      'speedIn':300, 
      'speedOut':300, 
      'overlayOpacity':0,
      'padding':0,
      'margin':20,
      'titleShow':true,
      'titlePosition':'over',
      'centerOnScroll':true
   });
   
   // newsletter
   $("#newsletter-open").click(function(){
      $("#footer").fadeOut();
      $('#newsletter').animate({
         height: '214'
      }, 200, function() {
         
      });
   });
   $("#newsletter-close").click(function(){
      $("#footer").fadeIn();
      $('#newsletter').animate({
         height: '80'
      }, 200, function() {
         
      });
   });
      // email
         $('#newsletter .text').focus(function(){
         	if($(this).attr('value') == 'Vaša e-mailová adresa'){ $(this).attr('value', ''); }
         });
         $('#newsletter .text').blur(function(){
            if($(this).attr('value') == '') { $(this).attr('value', 'Vaša e-mailová adresa'); }
         });
   
   // countdown
      var blastOff = new Date(2011,8-1,5,14,0,0); 
      $('#countdown-holder').countdown({until: blastOff, timezone: +1, compact: true,
          layout: '<span class="image{d100}"></span><span class="image{d10}"></span><span class="image{d1}"></span>' + 
              '<span class="imageSpace"></span>' + 
              '<span class="image{h10}"></span><span class="image{h1}"></span>' + 
              '<span class="imageSep"></span>' + 
              '<span class="image{m10}"></span><span class="image{m1}"></span>' + 
              '<span class="imageSep"></span>'});

   //hover clankov
      $('.clanok-parny').hover(
         function(){ $(this).removeClass('clanok-parny'); $(this).addClass('clanok-parny-hover');
         },
         function(){ $(this).removeClass('clanok-parny-hover'); $(this).addClass('clanok-parny');
         }
      );
      $('.clanok-neparny').hover(
         function(){ $(this).removeClass('clanok-neparny'); $(this).addClass('clanok-neparny-hover');
         },
         function(){ $(this).removeClass('clanok-neparny-hover'); $(this).addClass('clanok-neparny');
         }
      );
      $('.clanok-dlhy-parny').hover(
         function(){ $(this).removeClass('clanok-dlhy-parny'); $(this).addClass('clanok-dlhy-parny-hover');
         },
         function(){ $(this).removeClass('clanok-dlhy-parny-hover'); $(this).addClass('clanok-dlhy-parny');
         }
      );
      $('.clanok-dlhy-neparny').hover(
         function(){ $(this).removeClass('clanok-dlhy-neparny'); $(this).addClass('clanok-dlhy-neparny-hover');
         },
         function(){ $(this).removeClass('clanok-dlhy-neparny-hover'); $(this).addClass('clanok-dlhy-neparny');
         }
      );
      
      
      
	// newsletter form
   var options = {
       url: '/forms/newsletter.php',
       beforeSubmit: function validate(formData, jqForm, options){
         var email = $('input[name=email]').fieldValue();
         if (email[0] == 'Vaša e-mailová adresa'){ return false; }
       },
       success: function(){
         if(typeof document.body.style.maxHeight === "undefined"){
               $("#newsletter-open").unbind();
               $("#newsletter-text").fadeOut(400, function(){
                  $("#newsletter-text").html('Potvrdte odkaz, ktorý sme vám poslali do e-mailu aby sme si boli 100% istí, že ste to vy :-)');
                  $("#newsletter-text").fadeIn(400);
                  $("#newsform").fadeOut(400);
               });
         }
         else{
            $('#newsletter').animate({
               height: '135'
            }, 400, function() {
               $("#newsletter-open").unbind();
               $("#newsletter-text").fadeOut(400, function(){
                  $("#newsletter-text").html('Potvrdte odkaz, ktorý sme vám poslali do e-mailu aby sme si boli 100% istí, že ste to vy :-)');
                  $("#newsletter-text").fadeIn(400);
                  $("#newsform").fadeOut(400);
               });
            });
         }
       }
   };
	$('#newsform').ajaxForm(options);
      
});

