Cufon.replace('.side-box h2, h2.futura', { hover: true });

$(document).ready(function()
{
	$.fn.kfBox && $('.lightbox').kfBox();

	$('table tr:nth-child(even)').addClass('even');

	$('#q').inputDefaultText({ text: 'Hledaný výraz'});

	$.fn.kfBox && $('.attached-images a').kfBox();

	$('a.external').click(function(){return !window.open($(this).attr("href"))});

	if($.fn.cycle)
	{
		$('.supporters-box .motive-box').each(function(){
			var that = this;
			$(this).find('.motives').cycle({
				fx: 'fade',
				speed: 1500,
				timeout: 5000,
				pause: true,
				pager: $(this).next('.related-images').find('ul'),
				pagerAnchorBuilder: function(idx, slide) {
				    // return selector string for existing anchor
				    return $(that).next('.related-images').find('ul li:eq(' + idx + ') a');
				}
			});
		});

		$('.side-box-gallery .motive-box').each(function(){
			var that = this;
			$(this).find('.motives').cycle({
				fx: 'fade',
				speed: 1500,
				timeout: 5000,
				pause: true,
				pager: $(this).parent().next('.related-images').find('ul'),
				pagerAnchorBuilder: function(idx, slide) {
				    // return selector string for existing anchor
					return $(that).parent().next('.related-images').find('ul li:eq(' + idx + ') a');
				}
			});
		});
	}
});

$.fn.inputDefaultText = function(options)
{
	options = $.extend({
		text: 'Hledany vyraz'
	}, options);

	return this
		.val(options.text)
		.bind('focus', function(){ if(this.value == options.text) this.value = ''; })
		.bind('blur', function(){ if(this.value == '') this.value = options.text; });
};

