$(function() {
		    $("a[rel^=lightbox]").lightBox(); 
		    
		// aktuality
    var novinky = $('#flow_aktuality .novinka');
    if (novinky.length > 1) {
	    novinky.each(function() {
	    	$(this).hide();
	    });        
	    if (novinky.length > 0) {
	    	novinkyAnimation(0, "show");
	    }
    }
		$('#flow_aktuality .aktuality').css("visibility", "visible");

});

var novinkyAnimation = function(index, action) {
	var novinky = $('#flow_aktuality .novinka');
	if (index >= novinky.length) {
		index = 0;
	}
	
	if (action == "show") {
		$(novinky[index]).show("slow");
		setTimeout('novinkyAnimation('+index+', "hide")', 5000);
	}
	else {
		$(novinky[index]).hide("slow");
		index++;
		setTimeout('novinkyAnimation('+index+', "show")', 500);
	}
};

function KarieraOknoZavrit() {
 /*   $(" #web ").animate({ opacity: 1}, 500);    */
    $(" #upoutavka ").animate({ height: '1px' }, 200)
                     .animate({ width: '1px' }, 200, function() {
                        $( this ).css("display", "none");
                    /*    $(" .banner1 ").css("display", "block");  */ 
                     } );  
}

function KarieraOkno() {
 /* $(" .banner1 ").css("display", "none");   */
  $(" #upoutavka ").css("display", "block");
 /* $(" #web ").animate({ opacity: .5}, 500, function() { */
    $(" #upoutavka ").animate({ width: '260px' }, 300)
                     .animate({ height: '56px' }, 300);
/*  });     */
                 
  $(" #upoutavka_zavrit ").click(function() {
     KarieraOknoZavrit();
  });                

}

$(document).ready(function()  {

  $(" .external ").click(function() {
    if ( window.open( $( this ).attr("href") ) )
      return false;
    else
      return true;
  });
  
  $("#zobraz_prihlaseni").click(function () {
    $("#prihlaseni_udaje").show("slow");
  });
  
  $("#schov_prihlaseni").click(function () {
    $("#prihlaseni_udaje").hide("slow");
  });
  

  $("#ruce_v_nemocnicich").append("<embed src='http://www.youtube.com/v/LwCK0nKiYqY' type='application/x-shockwave-flash' allowfullscreen='true' allowScriptAccess='always' width='260' height='211'>");
  $("#ruce_v_kancelari").append("<embed src='http://www.youtube.com/v/Jwi2-Yl6Dxs' type='application/x-shockwave-flash' allowfullscreen='true' allowScriptAccess='always' width='260' height='211'>");
  $("#ruce_po_kychnuti").append("<embed src='http://www.youtube.com/v/JN5tIHjxwmI' type='application/x-shockwave-flash' allowfullscreen='true' allowScriptAccess='always' width='260' height='211'>");
  

  
  /*-------------------  upoutavka -------------------*/
  $(" li.kariera a ").css({'background-color' : '#10557c', 'color' : '#fff'});
  
  $(' li.kariera ').mouseover(function() {
    KarieraOkno();                            
    $(" li.kariera a ").css({'background-color' : '#fcce54', 'color' : '#10557c'});
    $(" #upoutavka, #upoutavka .zaves  ").css({'background-color' : '#fcce54'});
    $(" #upoutavka a, #upoutavka .x  ").css({'color' : '#10557c'});
  });
  
  $(' li.kariera ').mouseout(function() {
  /*  KarieraOknoZavrit(); */                
    $(" li.kariera a ").css({'background-color' : '#10557c', 'color' : '#fff'});
    $(" #upoutavka, #upoutavka .zaves  ").css({'background-color' : '#10557c'});
    $(" #upoutavka a, #upoutavka .x  ").css({'color' : '#fff'});
  });
  
  $(' #upoutavka ').mouseover(function() {    
    $(" li.kariera a ").css({'background-color' : '#fcce54', 'color' : '#10557c'});
    $(" #upoutavka, #upoutavka .zaves  ").css({'background-color' : '#fcce54'});
    $(" #upoutavka a, #upoutavka .x ").css({'color' : '#10557c'});
  });
  
  $(' #upoutavka ').mouseout(function() {     
    $(" li.kariera a ").css({'background-color' : '#10557c', 'color' : '#fff'});
    $(" #upoutavka, #upoutavka .zaves ").css({'background-color' : '#10557c'});
    $(" #upoutavka a, #upoutavka .x ").css({'color' : '#fff'});
  });
  /*--------------------------------*/

});
