$(document).ready(function() {
	
	$('#menu li').mouseover(function () {
			$(this).find('.submenu').show();
	});
	$('#menu li').mouseout(function () {
		$(this).find('.submenu').hide();
	});		
	
	var template = 'ru-dn';
	
	$('.lightbox').lightBox({imageBtnPrev: '/e2/templates/' + template + '/images/lightbox-btn-prev.gif', 
		imageBtnNext: '/e2/templates/' + template + '/images/lightbox-btn-next.gif', imageBtnClose: '/e2/templates/' + template + '/images/lightbox-btn-close.gif',
		imageLoading: '/e2/templates/' + template + '/images/lightbox-ico-loading.gif'});
	
	$('#search_form input[name=price_min]').focus(function() {
		if ($(this).val() == 'от') $(this).val('');		
	});
	$('#search_form input[name=price_max]').focus(function() {
		if ($(this).val() == 'до') $(this).val('');		
	});	
	
	$('#search_form input[name=price_min]').blur(function() {
		if ($(this).val() == '') $(this).val('от');		
	});
	$('#search_form input[name=price_max]').blur(function() {
		if ($(this).val() == '') $(this).val('до');		
	});		
	
	
});

function show_window (elem) {
	$('body').unbind('click');
	if ($(elem).is(":visible")) {
		$('.window').hide(1);
	} else {
		$('.window').hide(1);
		$(elem).show('fast', set_click);
	}		
	return false;	
}

function set_click () {
	
	$('body').one('click', function() {
		$('.window').hide(1);
	});

}


