/*
** Автор: Lastron
** Компания: WebElite
** v: 1.0.0
*/

	var $j = jQuery.noConflict();
	var i = 0;
	var count = new Array();

	$j(document).ready(function(){
		$j('.menu-nav').html($j('.menu-nav').html().replace(/\n/g," ").replace(/span/gi,"strong"));

		$j('.menu-nav > li > ul').each(function(){
			var uli = $j(this).parent().html();
			uli = uli.replace(/^(<a href.*?\s*?.*?\s*?.*?a>)[\s]*?(<ul[\s|\S]+ul>)/gi, "$1\n<div class=\"ulwrapper\" style=\"display: none;\">\n$2\n</div>\n");
			$j(this).parent().html(uli);
		});

		$j('.ulwrapper > ul > li > ul').each(function(){
			var uli = $j(this).parent().html().replace(/^(<a href.*?\s*?.*?\s*?.*?a>)[\s]*?(<ul[\s|\S]+ul>)/gi, "$1\n<div class=\"ulwrapper\" style=\"display: none;\">\n$2\n</div>\n");
			count[i] = uli;
			i++;
			$j(this).parent().html(uli);
//			console.log(uli);
		});

		$j('.ulwrapper > ul > li > .ulwrapper > ul > li > ul').each(function(){
			var uli = $j(this).parent().html().replace(/^(<a href.*?\s*?.*?\s*?.*?a>)[\s]*?(<ul[\s|\S]+ul>)/gi, "$1\n<div class=\"ulwrapper\" style=\"display: none;\">\n$2\n</div>\n");
			$j(this).parent().html(uli);
		});


		$j('.ulwrapper > ul > li > .ulwrapper > ul > li > .ulwrapper > ul > li > ul').each(function(){
			uli = $j(this).parent().html().replace(/^(<a href.*?\s*?.*?\s*?.*?a>)[\s]*?(<ul[\s|\S]+ul>)/gi, "$1\n<div class=\"ulwrapper\" style=\"display: none;\">\n$2\n</div>\n");
			$j(this).parent().html(uli);
		});

		$j('.menu_header').slideDown(600);

		$j('.menu-nav li').hover(function() {
				$j(this).addClass("active");
				$j(this).find('> .ulwrapper').stop(false, true).slideDown(150);
				//.animate({left:'+50'},2000);
			},
			function() {
				$j(this).removeClass("active");
				$j(this).find('div').stop(false, true).slideUp(100);
			}
		);
	});




	$j(document).ready(function(){		//$j('ul.menu-nav  li > div.ulwrapper').css('opacity','0.9');
		//$j('ul.menu-nav  li > div.ulwrapper').css('boxshadow','0 0 10px rgba(0,0,0,0.5)');
	});
