	//###### NASTAVENI ######
		var timeout = 500;
	//#######################
	    
	var timer;
	var tips_expanded = 0;
	
	 jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
		
		return this.animate({opacity: 'toggle', height: 'toggle'}, speed, callback); 
      };
	
	  jQuery.fn.slideFadeDown = function(speed, easing, callback) {
		return this.animate({opacity: 'show', height: 'show'}, speed, callback);
        

      };
      
      jQuery.fn.slideFadeUp = function(speed, easing, callback) {
		return this.animate({opacity: 'hide', height: 'hide'}, speed, callback);
      };
      	
	function getQSContent(searchText) {
	
		$('#search-loader').fadeIn();
		$.ajax({
	  		type: "POST",
//	  		url: "/vyhledavani/?cntnt01searchinput="+searchText,	
//			url: "/index.php?mact=Search,cntnt01,dosearch,0&cntnt01returnid=60&cntnt01searchinput="+searchText,
			
			url: "/vyhledavani/?mact=Search,cntnt01,dosearch,0&cntnt01returnid=60&cntnt01searchinput="+searchText,
	  		success: function(data){
	  			if (data == "") {
	  			}
	  			
	  			$('#search-loader').fadeOut();
	    		$('#search-tips').html(data);
	    		$('#search-tips').slideFadeDown();
	    		tips_expanded = 1;
	  		}
		});
	}
	
	function runTimeout() {
		getQSContent($('#cntnt01searchinput').val());
	}

	$(document).ready(function() {
	
 		var loader = $('<img>').attr('src','/images/ajax-loader.gif').attr('id',"search-loader");
 		var window = $('<div>').attr('id','search-tips').hide();
 		
 		$('#search').prepend(window);
 		$('#search').prepend(loader);
		$('#cntnt01searchinput').keyup(function(){
			// pokud jsme zmackli klavesu a zustal neaky text
			if ($('#cntnt01searchinput').val() != "") {
				clearTimeout(timer);
				timer = setTimeout("runTimeout();",timeout); 			
			} else {
				clearTimeout(timer);
				$('#search-tips').slideFadeUp();
				tips_expanded = 0;
			}
		});	
		
		$('body').click(function(){
			if (tips_expanded) { 
 				$('#search-tips').slideFadeUp();				
 				tips_expanded = 0;
 			}	
		});	
		
	});






	  		

