function set_parent_display(el){
	//alert(el[0].tagName);
	if(el[0].tagName != 'HTML'){
//		alert('eee');
		el.show();
		if(el.parent()){
			set_parent_display(el.parent());
		};
	};
};

$(document).ready(function() {
$("#nav ul").hide();
$("#nav li:has(ul)").each(function() {
$(this).children().slideUp(400);
});
$("li.p1:has(ul)").click(function(event){
if (this == event.target) {
var current = this;
$("#nav li:has(ul)").each(function() {
if (this != current) $(this).children().slideUp(400);
});
$("ul:first", $(this)).slideToggle(400);
}
});
$("li.p2:has(ul)").click(function(event){
if (this == event.target) {
var current = this;
$("li.p2:has(ul)").each(function() {
if (this != current) $(this).children().slideUp(400);
});
$("li.p3:has(ul)").each(function() {
if (this != current) $(this).children().slideUp(400);
});
$("ul:first", $(this)).slideToggle(400);
}
});

$("li.p3:has(ul)").click(function(event){
if (this == event.target) {
var current = this;
$("li.p3:has(ul)").each(function() {
if (this != current) $(this).children().slideUp(400);
});
$("ul:first", $(this)).slideToggle(400);
}
});
//Max

$('.product_image img').each(function(){
	$(this).wrap('<a target="_blank" class="fancybox" href="' + $(this).attr('src') + '"/>')
});
//$('.fancybox').fancybox();

//menu_href = document.location.pathname;//document.location;
//menu_href = menu_href.replace("http://www.mnogotop.ru", "").replace("http://mnogotop.ru", "");
//alert(menu_href);
//menu_link = $('a[href="' + menu_href + '"]');
//alert(menu_link.html());
//set_parent_display(menu_link);

$('.jqopen').show();
});
