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

$('div.green_main ul.green_main_menu li').addClass('li_item');
$('div.green_main ul.green_main_menu li ul li').removeClass('li_item');
$('ul.green_main_menu li.li_item').eq(0).addClass('add-1');
$('ul.green_main_menu li.li_item').eq(1).addClass('add-2');
$('ul.green_main_menu li.li_item').eq(2).addClass('add-3');
$('ul.green_main_menu li.li_item').eq(3).addClass('add-4 last');

$('div.green_page ul.green_page_menu li').addClass('li_item');
$('div.green_page ul.green_page_menu li ul li').removeClass('li_item');
$('ul.green_page_menu li.li_item').eq(0).addClass('add-1');
$('ul.green_page_menu li.li_item').eq(1).addClass('add-2');
$('ul.green_page_menu li.li_item').eq(2).addClass('add-3');
$('ul.green_page_menu li.li_item').eq(3).addClass('add-4');

$('div.menu-add-1-container').appendTo('li.add-1 div.g_add');
$('div.menu-add-2-container').appendTo('li.add-2 div.g_add');
$('div.menu-add-3-container').appendTo('li.add-3 div.g_add');
$('div.menu-add-4-container').appendTo('li.add-4 div.g_add');

$(window).load(function() { 
   $('#acca').hoverAccordion();
   setTimeout(function() {
       $('#acca > li.current_page_ancestor, #acca > li.current_page_parent, #acca > li.current_page_item').children('a').removeClass('closed').addClass('opened');
       $('#acca > li.current_page_ancestor, #acca > li.current_page_parent, #acca > li.current_page_item').children('div').show();
       $('#acca > li.current_page_ancestor, #acca > li.current_page_parent, #acca > li.current_page_item').children('div').children('div').show();
   }, 250);
});

$('div.green_main ul.green_main_menu li.li_item').hover(function(){
 $(this).addClass('hover');
}, function(){
 $(this).removeClass('hover');
});


/*$('div.green_page ul.green_page_menu li.li_item').hover(function(){
 $(this).addClass('hover');
}, function(){
 $(this).removeClass('hover');
});*/


/*$('div.green_page ul.green_page_menu li.li_item ul li').hover(function(){
 $(this).addClass('hover');
}, function(){
 $(this).removeClass('hover');
});*/


$('div.content-blog div.post').hover(function(){
 $(this).addClass('post-hover');
}, function(){
 $(this).removeClass('post-hover');
});

$('body.search div.content-blog div.page').hover(function(){
 $(this).addClass('post-hover');
}, function(){
 $(this).removeClass('post-hover');
});

$('div.nash div.nash_pad').hover(function(){
 $(this).addClass('post-hover');
}, function(){
 $(this).removeClass('post-hover');
});

$('<span class="ques">=</span>').appendTo('label.secq');

$('a[title=Скачать фотографии]').addClass('yeep');
$('body.page-template-comanda-php a[href^="mailto"]').addClass('nyroModal').attr('href', '#comanda_popup');

$('ol.cf-ol li input').hasClass('fldrequired', (function(){ 
$('<span class="req_star">*</span>').appendTo('ol.cf-ol li label');
}));

/*$('div.act_con td:last').addClass('last');
$('div.menu-top-container li:last').addClass('last');*/

$('div.menu_top ul.children li div.g_block').parent('li.page_item').addClass('have_ul');

$('ol.cf-ol li span.reqtxt').parent(function(){
 $('<span class="req_star">*</span>').appendTo('label');
});

$('div.menu_top ul li').hover(function(){
 $(this).addClass('hover');
}, function(){
 $(this).removeClass('hover');
});

$('div.green_main div.g_block').each(function(){
	$(this).css('top', function(){
		var thisHeight = $(this).height()/2;
		var thisHeight = (thisHeight>210) ? 210 : thisHeight;
		var thisTop = '-'+thisHeight+'px';
		return thisTop;
	});
});


function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

$(document).ready(function() {
	equalHeight($('div.quote ul li'));
	equalHeight($('div.nash div.nash_pad'));
	equalHeight($('div.con_eq div.eq_h'));
	});

$('div.partner_left table tr').last().addClass('part_tr_last');
$('div.partner_right table tr').last().addClass('part_tr_last');
$('div.partner_left table tr.part_tr_last td').css('border', 'none');
$('div.partner_right table tr.part_tr_last td').css('border', 'none');

$('div.quote ul li:nth-child(3n+3), div.entry-related li:nth-child(3n)').addClass('last');
$('div.entry-related li:eq(2)').after('<div class="clear"</div>');
$('div.nash div.post:nth-child(3n+3)').addClass('last');
$('div.wp_calen table tr:nth-child(2n+2)').addClass('calen_bg');
$('div.page-content table tr:nth-child(2n+2)').addClass('tr_bg');
$('div.page-content table tr:first').addClass('tr_first');
$('div.entry-content table tr:nth-child(2n+2)').addClass('tr_bg');
$('div.entry-content table tr:first').addClass('tr_first');

$('div.page-content div.partner_left table tr:first').removeClass('tr_first');
$('div.page-content div.partner_left table tr:nth-child(2n+2)').removeClass('tr_bg');
$('div.page-content div.partner_right table tr:nth-child(2n+2)').removeClass('tr_bg');

$('#slideshow > img.frame').not(':first').hide();
$('#slideshow > img.sl-text').not(':first').hide();
$('#slideshow > img.slide:gt(0)').hide();
if (!$('#slideshow').is('.capgemini')) {
    setInterval(function() {
        $('#slideshow > img.frame').filter(':visible').fadeOut(2200);
        if ($('#slideshow > img.frame:last').is(':visible')) {
            $('#slideshow > img.frame').filter(':first').fadeIn(2200);
        } else {
            $('#slideshow > img.frame').filter(':visible').next('img').fadeIn(2200);
        }

        $('#slideshow > img.sl-text').filter(':visible').fadeOut(250);
        if ($('#slideshow > img.sl-text:last').is(':visible')) {
            $('#slideshow > img.sl-text').filter(':first').fadeIn(500);
        } else {
            $('#slideshow > img.sl-text').filter(':visible').next('img').fadeIn(500);
        }
    }, 4200);
} else {
    var capVar = 1;
    setInterval(function() {
        if (capVar == 0) {
            $('#slideshow > img').hide();
            $('#slideshow > img.frame:eq(0)').show();
            $('#slideshow > img.slide-1')
                .css('left', '1000px')
                .show()
                .animate({
                    'left': '0px'
                }, 500);
            capVar = 1;
        } else if (capVar == 1) {
            $('#slideshow > img').hide();
            $('#slideshow > img.frame:eq(1)').show();
            $('#slideshow > img.slide-2').fadeIn(750);
            capVar = 2;
        } else if (capVar == 2) {
            $('#slideshow > img').hide();
            $('#slideshow > img.frame:eq(2), #slideshow > img.slide-3-1').show();
            $('#slideshow > img.slide-3-2')
                .css('left', '120px')
                .show()
                .animate({
                    'left': '0px'
                }, 500);
            if ($.browser.msie) {
                $('#slideshow > img.slide-3-3').show();
            } else {
                $('#slideshow > img.slide-3-3').fadeIn(500);
            }
            capVar = 3;
        } else if (capVar == 3) {
            $('#slideshow > img').hide();
            $('#slideshow > img.frame:eq(2), #slideshow > img.slide-4-1').show();
            $('#slideshow > img.slide-4-2')
                .css('left', '80px')
                .show()
                .animate({
                    'left': '0px'
                }, 500);
            if ($.browser.msie) {
                $('#slideshow > img.slide-4-3').show();
            } else {
                $('#slideshow > img.slide-4-3').fadeIn(500);
            }
            capVar = 4;
        } else if (capVar == 4) {
            $('#slideshow > img').hide();
            $('#slideshow > img.frame:eq(2), #slideshow > img.slide-5-1').show();
            $('#slideshow > img.slide-5-2')
                .css('left', '290px')
                .show()
                .animate({
                    'left': '0px'
                }, 500);
            if ($.browser.msie) {
                $('#slideshow > img.slide-5-3').show();
            } else {
                $('#slideshow > img.slide-5-3').fadeIn(500);
            }
            capVar = 0;
        }
    }, 3000)
}































































































































});
