$(document).ready(function() {

  $('#add').hide();
  $('a#pridat').click(function(e){
  e.preventDefault();
    $('#add').slideToggle(300);
});

  $('#search input').focus(function(){
      var hledat = this.value;
      if(hledat == 'Hledat') this.value = ''; else this.select(); 
  }).blur(function() {
     if(this.value == '') this.value = 'Hledat';
  });
  
  $('#slider').codaSlider({
           autoHeightEaseDuration: 800,
           slideEaseDuration: 800,
           dynamicArrows: false,
           autoSlide: true,
           autoSlideInterval: 5000
  });
  
     	$("a[href$=.jpg],a[href$=.png],a[href$=.gif]").fancybox({
    		'transitionIn'	:	'elastic',
    		'transitionOut'	:	'elastic',
    		'speedIn'		:	400, 
    		'speedOut'		:	200, 
    		'titleShow'	:	false
    	});
    	
  $('a[href^="http://"]').filter(function() {
    return this.hostname && this.hostname !== location.hostname;
    }).attr('target', '_blank');

  $("a[href^=http://www.youtube.com/watch?v=],a[href^=http://youtube.com/watch?v=]").click(function() {
  $.fancybox({
			'padding'		: 0,
    	'transitionIn'	:	'elastic',
    	'transitionOut'	:	'elastic',
    	'speedIn'		:	400, 
    	'speedOut'		:	200, 
    	'titleShow'	:	false,
			'width'		: 480,
			'height'		: 300,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			'wmode'		: 'transparent',
			'allowfullscreen'	: 'true'
			}
		});
		return false;
   });
   
   $('.tip').tipsy({gravity: 's'});

});
