$(document).ready(function(){

var SEARCH_BLOCK_SHOWED = false;

	//Form submit
	$('a.submit').click(function(){
		$(this).parents('form').submit();
		return false;
	});




$("form#cse-search-box").submit(function(){

	var $query = $(this).find('input[name=q]').val(),
		 $this = $(this);
//		 $(this).find('input[name=q]').val(encodeURI($(this).find('input[name=q]').val()));
		 $location = $this.attr('action') + '?' + $this.serialize();

	$.ajax({
	  url: '/index.php?ajax=search&query='+ $query,
	  dataType: 'json',
	  data: '',
	  async: false,
	  success: function ($jsonOutput) {}
	});

});


//fItem list hover
$(".fitem_bl").hover(
   function(){$(this).addClass('hover');},
   function(){$(this).removeClass('hover');}
);


//Show/hide products cats
$("a#show_products").click(function(){
   $("#products_letters").slideToggle();return false;
});
//Show/hide cats
$(".cats_bl a.main").click(function(){
   $(".cats_bl #cats_slide").slideToggle();return false;
});
//Show/hide cats
$(".cat_bl .h a[class!=goto]").click(function(){
   $('.cat_bl ul').slideUp();
   $(this).parents('.cat_bl').children('ul').slideToggle();
	return false;
});


//Popup close
$(".popup_close").click(function(){
   $(this).parent().slideUp(); return false;
});





//MAIN!
});


Array.prototype.max = function(){
	return Math.max.apply({},this)
}

