
$.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; });
};

$(document).ready(function()
{	
	$('.att-images a').kfBox({ 
		pageSpan: 4,
		htmlTemplate: "<div id='kfb-window'><div id='kfb-paging'><div id='prevnext'><a href='#' id='kfb-prev' rel=''></a><a href='#' id='kfb-next' rel=''></a></div><div id='kfb-page-list'></div></div><div id='kfb-close'><a href='#' id='kfb-close-btn' title=''></a></div><div class='break'></div><h2 id='kfb-caption'></h2> <a href='' id='kfb-image-anchor' title=''></a><p id='kfb-desc'></p><div id='kfb-content'></div></div>"
	});

	$('a.external').click(function(){return !window.open($(this).attr("href"))});

	$('#phorum-form').submit(function(){
		var re = new RegExp("^(.)+@(.)+\.(.)+");
		var email = $('#phorum-email').attr("value");
		var r = email.match(re);
		
		if ($('#phorum-name').attr("value") == "" || $('#phorum-text').attr("value") == "" || !r) {
			alert("Zprávu nelze odeslat, vyplnili jste správně všechny údaje?");
			return false;
		}
	})
	
	// $('#nl-email').inputDefaultText({ text: '@'});

	$('.cycle').cycle({
		fx: 'scrollUp',
		pause: 1,
		speed: 3000,
		timeout: 10000
		}
	);	

});

