$(document).ready(function()
{
	$.fn.kfBox && $('.lightbox').kfBox();

	$('table tr:nth-child(even)').addClass('even');

	$('#q').inputDefaultText({ text: 'Hledaný výraz'});

	$('a.external').click(function(){return !window.open($(this).attr("href"))});

	$("ul[id^='params']").hide();

	$.fn.cycle && $('.motive-box').cycle({
		fx: 'fade',
		speed: 2000,
		timeout: 5000
	});

	var SPPrices = SPPrices || [
		[1, 1, 0],
		[0, 1, 1]
	];

	$('input[id^=order-shipping]').bind('click', function()
	{
		var i = parseInt(this.id.substr(15)) - 1;
		for(var j = 0; j < SPPrices[i].length; j++)
		{
			if(SPPrices[i][j] == 0) $('input#order-payment-' + (j + 1)).attr('disabled', true).attr('checked', false);
			else $('input#order-payment-' + (j + 1)).removeAttr('disabled');
		}
	}).filter(':checked').triggerHandler('click');


	/* vkladani flashe */
	$('.flash-banner').each(function(){
		flashsize = $(this).find('a').attr('data-flashsize');
		flashsize = flashsize.split("x");
		$(this).flash(
		{
			src: $(this).find('a').attr('href'),
			width: flashsize[0],
			height: flashsize[1],
			wmode: 'opaque',
			flashvars: {}
		});
		$(this).find('.alt').css("display","none");
	});
});

$.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; });
};
