$(document).ready(function(){
	$.fn.hoverClass = function(c) {
		return this.each(function(){
			$(this).hover(
				function() { $(this).addClass(c);  },
				function() { $(this).removeClass(c); }
			);
		});
	};
	if(document.all){$("#menu li, .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.gif" width="18" height="17" />').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'
	});
});

// 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;
		});
	})
})
