	var bool = false;
	var keyboardEvent;

	function startCheckKey(element)
	{
		if(!bool)
		{
			keyboardEvent = keyboardDown.bindAsEventListener(element);
			Event.observe(document,"keydown",keyboardEvent);
			bool = true; 
		}	
	}

	function stopCheckKey()
	{
		Event.stopObserving(document,"keydown",keyboardEvent);
		bool = false;
	}

	function keyboardDown(event)
	{
		var key=event.keyCode;
		if(key==13){
			if(Prototype.Browser.Gecko)
			{
				sendSearch();
			}
		}
	}

	function checkKeywordsLength()
	{
		
	}

	function sendSearch()
	{
		var url = portal_url + '/checks/search.php';
		var keywords =  $('search_keywords').value;	
		
		if(!keywords.empty())
		{
			/**if(Prototype.Browser.Gecko && !url.empty())
			{
				console.log('Search Request Url -> ' + url);
			}**/
			new Ajax.Request(
		 			url,{ 
		 			  parameters: 'keywords=' + keywords,
		 			  onSuccess: function (t)
		 			  {
		 			  	$('carousel_container_container').update(t.responseText);
		 			  	stopCheckKey();
		 			  	$('search_keywords').value = "";
		 			  },
		 			  onFailure: function (t)
		 			  {
		 			  	/**if(Prototype.Browser.Gecko)
						{
							console.warn(t.responseText);
						}**/
						stopCheckKey();
		 			  }		 				
		 			}
		 		)
		}
		else
		{
			/**if(Prototype.Browser.Gecko)
			{
				console.warn('kein keyword vorhanden');
			}**/
			stopCheckKey();
		}
	}