jQuery(document).ready(function($) {

	$('#menu').find('span').find('ul').find('li').hover (
		function ()
		{
			$(this).find ('ul').css('display','block');
		},
		function (event)
		{
			$(this).find ('ul').css('display','none');
		}
	);
	
	
	
	
	
	// ?????????? ???????
	$('#caregory').change (function ()
	{});
	$('#filter').change (function ()
	{});
	
	if (jQuery.browser.opera){// ????? footer ??? opera
		//$('#outer').css('background-image', 'url(/orgs/1/images/bottom.jpg)');
	}
		
	$(function () {                             // ????? ???????? ?????????
	$('#menu > span > ul > li > a').each(function () {    // ???????? ?? ?????? ??? ????????
        var location = window.location.href; // ?????????? ? ??????? ????????
        var link = this.href;                // ?????????? ? url ??????
 
        if(location == link) {// ???? ????????? ?????? ? ??????? ?????
            //alert(location);
			$(this).addClass(' active');// ????????? ?????
            $(this).parents('li').addClass('active');// ????????? ?????
        }
		if(location == 'http://zgbi-1.i-complex.ru/' && link == 'index'){
		
			$(this).addClass(' active');// ????????? ?????
            $(this).parents('li').addClass('active');// ????????? ?????
		}
		
	});
	/*$('#menu > span > ul > li').hover(function (){
			$(this).attr('class', 'over');
		});
	$('#menu > span > ul > li').mouseout(function (){
			//alert($(this).width());
			if (window.location.href != 'http://zgbi-1.i-complex.ru'+$(this).children('a').attr('href')){
				$(this).attr('class', '');
			}else{$(this).attr('class', 'active');}
		});
	$('#menu > span > ul > li > a').hover(function (){
			$(this).parents('li').attr('class', 'over');
		});
	$('#menu > span > ul > li > a').mouseout(function (){
			if (window.location.href != 'http://zgbi-1.i-complex.ru/'+$(this).attr('href')){
				$(this).parents('li').attr('class', '');
			}else{$(this).parents('li').attr('class', 'active');}
		});
		// ??? sub menu
	$('#menu > span > ul > li > ul > li').hover(function (){
			$(this).attr('class', 'over');
		});
	$('#menu > span > ul > li > ul > li').mouseout(function (){
			$(this).attr('class', '');
		});*/
});


// ????????? ?????? ????
var ink=0;var width=0;
$('#menu > span > ul > li > a > div').each(function () {
	ink++;
	width=width+parseInt($(this).width());
	//alert($(this).width());
});
$('#menu > span > ul > li > a').each(function () {
	$(this).children('div').css('padding-left', (1000-width)/(ink*2));
	$(this).css('padding-right', (1000-width)/(ink*2)+13);
});








});
