$(document).ready(function(){
	$.fn.hoverClass = function(c) {
		return this.each(function(){
			$(this).hover(
				function() { $(this).addClass(c);  },
				function() { $(this).removeClass(c); }
			);
		});
	};
	if(document.all){$(".img-box-outer").hoverClass("sfHover");}
	$(".xfancybox").each(function(){
			$(this).addClass('fancybox');
			$(this).attr('href', $(this).attr('rev')).append('<img class="fancy-fullscreen-ico" alt="" src="/gfx/ico-fullscreen.png" width="22" height"22" />').attr('title', $(this).children('.title-helper').attr('title'));
			$('.fancy-fullscreen-ico').css({"position": "absolute", "right": 0, "top": -5000, "z-index": "5", "cursor": "pointer"});
		}).hover(
			function(){
				var right_margin = 0.5 * ($(this).parent().width() - $(this).width());
				$(this).attr('title', '').children('.fancy-fullscreen-ico').css({"right": right_margin, "top": "0"});
			},
			function(){
				$(this).attr('title', $(this).children('.title-helper').attr('title'));
				$('.fancy-fullscreen-ico').css({"right": 0, "top": -5000});
			}
		).click(
			function(){$(this).attr('title', $(this).children('.title-helper').attr('title'));}
	);
	$("a.fancybox").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	300,
		'speedOut'		:	300,
		'overlayShow'	:	true,
		'overlayOpacity':	0.9,
		'overlayColor'	:	'#000',
		/*'centerOnScroll':	true,*/
		'titleShow'		:	true,
		'titlePosition'	:	'inside'
	});
	$(".newsletter-link").fancybox({
	  'onComplete' : function() {$("#fancybox-wrap").unbind('mousewheel.fb');},
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'width': 600,
		'height': 450,
  	'speedIn': 300,
  	'speedOut': 300,
		'overlayShow'	:	true,
		'overlayOpacity':	0.5,
		'overlayColor'	:	'#000',
		'autoDimensions': false
  });
  $("a.fancybox-intro-swf").fancybox({
		'padding'		:	0,
		'width'			:	500,
		'height'		:	282,
		'autoScale'     :	false,
		'overlayShow'	:	true,
		'overlayOpacity':	0.9,
		'overlayColor'	:	'#000',
		'centerOnScroll':	true,
		'type'			:	'swf',
		//'swf'			:	{flashvars: 'file=/jwplayer/clips/JIHLAVANKA_tagon01.flv&amp;image=/jwplayer/clips/JIHLAVANKA_tagon01.jpg&amp;controlbar=over&amp;controlbar.idlehide=true&amp;logo.hide=true&amp;backcolor=0x540c02&amp;frontcolor=0xf6daa5&amp;lightcolor=0xffffff&amp;autostart=true&amp;logo.hide=true&amp;volume=50', wmode: 'transparent', allowfullscreen: 'true'}
		//'swf'			:	{flashvars: 'file=/jwplayer/clips/Jihlavanka_Kresla_Vanoce_10s_Vanoce.flv&amp;image=/jwplayer/clips/Jihlavanka_Kresla_Vanoce_10s_Vanoce.jpg&amp;controlbar=over&amp;controlbar.idlehide=true&amp;logo.hide=true&amp;backcolor=0x540c02&amp;frontcolor=0xf6daa5&amp;lightcolor=0xffffff&amp;autostart=true&amp;logo.hide=true&amp;volume=50', wmode: 'transparent', allowfullscreen: 'true'}
		'swf'			:	{flashvars: 'file=/jwplayer/clips/Jihlavanka_Kresla_v_pohode.flv&amp;image=/jwplayer/clips/Jihlavanka_Kresla_v_pohode.jpg&amp;controlbar=over&amp;controlbar.idlehide=true&amp;logo.hide=true&amp;backcolor=0x540c02&amp;frontcolor=0xf6daa5&amp;lightcolor=0xffffff&amp;autostart=true&amp;logo.hide=true&amp;volume=50', wmode: 'transparent', allowfullscreen: 'true'}
	});
	$("a.auto-play-click").trigger('click');
});
// zmena obrazku u formulorovych tlacitek a obrazku s tridou "button"
$(function()
{
	$("input[type='image'].button, img.button").each(function() {
		var path = this.src;
		var hoverPath = path.substring(0, path.length - 5) + '1.gif';

		imgs = Array(1);
		i = imgs.length + 1;
		imgs[i] = new Image();
		imgs[i].src = hoverPath;

		$(this).hover(
      		function () {
        		this.src = hoverPath;
      		},
     		function () {
       			 this.src = path;
      		}
		)
		.focus(function() {
			this.src = hoverPath;
		})
		.blur(function () {
			this.src = path;
		});
	})
})
