function checkFields(frm) {
    for (i=1; i < arguments.length; i++) {
        if (frm[arguments[i]].value == '') {
            frm[arguments[i]].focus();
            alert('Vyplňte prosím všechny položky.');
            return false;
        }
    }
    return true;
}

function externalLinks() {  
 if (!document.getElementsByTagName) return;  
 var anchors = document.getElementsByTagName("a");  
 for (var i=0; i<anchors.length; i++) {  
   var anchor = anchors[i];  
   if (anchor.getAttribute("href") &&  
       anchor.getAttribute("rel") == "external")  
     anchor.target = "_blank";  
 }  
}  
window.onload = externalLinks;
 
$(document).ready(function () {	

  $("a#example1").fancybox();	
  
	$('#nav li').hover(
		function () {
			//show its submenu
			$('ul', this).stop(true, true).slideDown(300);
		}, 
		function () {
			//hide its submenu
			$('ul', this).slideUp(100);			
		} 
	); 
  
  $(".light").hover( 
    function() {  
      $(".light-img", this).stop(true, true).animate({  
          opacity: 0.7  
      }, 200, "swing");  
    },
    function() {
      $(".light-img", this).animate({  
          opacity: 1  
      }, 0);   
    }
  );
  
  $(".services li:gt(0)").hover( 
    function() {  
      $(this).stop(true, true).animate({ bottom: '-=5' }, { queue: false, duration: 200 });  
    },
    function() {
      var bottomOrig = $(this).css("bottom");
      $(this).stop(true, true).animate({ bottom: '+=5' }, { queue: false, duration: 100 });  
    }
  );
  
  $(function(){
  	$('#slides').slides({
  	  randomize: true,
  	  effect: 'fade',
      preloadImage: '/images/loading.gif',
      generatePagination: false,
      play: 3500,
      hoverPause: true
  	});
  });
  
  $(function(){
  	var startSlide = 1; 
  	$('#slides2').slides({
      preload: true,
      preloadImage: '/images/loading.gif',
      generatePagination: false,
      play: 5000,
      pause: 2500,
      hoverPause: true,
      start: startSlide
  	});
  });
  
  
  $("a#picture").fancybox({
    'titlePosition'	: 'over'
  });  
  
	$("a.gallery").fancybox({
			 'transitionIn'		: 'none',
			 'transitionOut'		: 'none',
			 'titlePosition' 	: 'over',
			 'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				  return '<span id="fancybox-title-over">Obrázek ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			 }
	});
  
	height = 450; //Math.round(0.6 * $(window).height());
	$('#popup_article_21').fancybox({
		autoOpen: true,
		title: '',
		frameWidth: 600,
		frameHeight: height,
		hideOnContentClick: false,
		bgiframe: true,
		modal: true,
		imageScale: true,
		overlayOpacity: 0.7,
		overlayColor: "#000"
	});
	$('#popup_article_21').click();
		
});       
     
