$(function() {
		$('a[rel=lightbox]').lightBox();


    $("a").filter(function() { return this.hostname && this.hostname !== location.hostname;}).attr('target', '_blank');

});



	$.widget( "custom.catcomplete", $.ui.autocomplete, {
		_renderMenu: function( ul, items ) {
			var self = this,
				currentCategory = "";
			$.each( items, function( index, item ) {
				if ( item.category != currentCategory ) {
					ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
					currentCategory = item.category;
				}
				self._renderItem( ul, item );
			});
		}
	});


	$(function() {
		$( "#hledej" ).catcomplete({
			delay: 5,
			source: "/hledej_json.php",
			minLength: 1,
    	select: function(event, ui) {
				$("#hledej").val(ui.item.id);
        $("#vyhledavani").submit();
				}
		});
	});





