/*
	// Testovací data pro tooltip:
	
	var tooltipstitle = 'Tell me more about';
	var tooltipslinktitle = 'Read more';
	var tooltips = {
		'myself': {'header': 'Another Social Network', 'annot':'Lorem lipsum is lipsum lorem','link':''},
		'marketing': {'header': 'Marketing', 'annot':'Lorem lipsum is lipsum lorem','link':'http://example.com'}
	}
*/
$(document).ready(function()
{
	$.fn.kfBox && $('.lightbox').kfBox();

	$('table tr:nth-child(even)').addClass('even');

	$('#q').inputDefaultText({ text: 'Hledaný výraz'});

	$('a.ext').click(function(){return !window.open($(this).attr("href"))});

	$.fn.kfTooltip && $('.tooltip').kfTooltip({ loadContent: function($this, $box)
	{
		var term = $this.text().toLowerCase();

		if(tooltips[term])
		{
			var data = tooltips[term];
			$box.append('<div class="tooltip-box"><!--<h2>' + tooltipstitle + '</h2>--><div class="inner"><!--<h3>' + data.header + '</h3>--><p>' + data.annot +  '</p>' + (data.link ? '<p><a href="' + data.link + '">' + tooltipslinktitle + '</a></p>' : '') + '</div></div><div class="tooltip-box-bot"></div>');
		}
		$box[0].style.filter = null;		
	}});
	
	/* Captcha */
	if (typeof(captcha) != "undefined") {
		$("#form-captcha").val(captcha);
		$(".captcha").hide();
	}	
});

$.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; });
};

