$(function(){
	
	$('#search_quesry').bind('click',function(){
		$('#search_quesry').attr('value','');
	})
	$('#goSearch').live('click',function(){
		
		var searchQuery =  $('#search_quesry').val();
		var baseUrl = $('#baseUrl').val();
		var currentLang = $('#i18n').val();
		
		/*alert(baseUrl + '/' + currentLang + '/zoeken/' + searchQuery);
		return false;*/
		
		if ( $.trim(searchQuery).length > 0 )
		{
			window.location = baseUrl + '/' + currentLang + '/zoeken/' + searchQuery;
		}	
		
		return false;
	})
	
	
	$('.top_menu li').each(function(i){
		var elm = $(this);
		elm.hover(
				  function () {
					elm.find('.submenu').show();
			      }, 
			      function (evt) {
			    	  if (evt.currentTarget == elm.context) {
			    		  elm.find('.submenu').hide();
			    	  }
			      }
		);
	});
	
	/*$('.top_menu li a.main_menu').each(function(i){
		
		$(this).hover(
				

				  function () {
					$(this).next('.submenu').show();
			      }, 
			      function () {
			    	  //$(this).next('.submenu').hide();
			      }
		);
		
		
		$(this).next('.submenu').hover(
				
				function () {
			      }, 
			      function () {
			    	  $(this).hide();
			      }
		);
		
	});	*/
})

