$(document).ready(function(){


if($('.slider').length){
	
	$('.slider').each(function(){
	
		$(this).nextAll('div').eq(0).hide();
	
	});
	

	$('.slider').click(function(){
		
		if($(this).nextAll('div').eq(0).is(':visible')){
			
			$(this)
				.removeClass('slider_act')
				.nextAll('div').eq(0)
				.slideUp()
				.next('.closediv').remove();
			
		} else {
		
			$(this)
				.addClass('slider_act')
				.nextAll('div').eq(0)
				.slideDown('normal', function(){
					$(this).after('<a href="#" class="closediv">Свернуть</a>'); 
				});
				
			
		}

	});

	$('.closediv').live('click', function(){
		
		$(this).prev('div').slideUp().end().remove();		
		return false;

	});

	$('.expand_link').click(function(){

		if(!$(this).hasClass('act')){

			$(this).addClass('act').text($(this).text().replace('Развернуть', 'Свернуть'));

			$('.slider').each(function(){

				$(this).addClass('slider_act').nextAll('div').eq(0).show().after('<a href="#" class="closediv">Свернуть</a>');

			});


		} else {
			
			$(this).removeClass('act').text($(this).text().replace('Свернуть', 'Развернуть'));

			$('.slider').each(function(){

				$(this).removeClass('slider_act').nextAll('div').eq(0).hide().next('.closediv').remove();

			});

		}

		return false;

	});

}


	var windheight = 0;  
	var heightcontainer = 0;
	var heightcontainerindex = 0;
	
	if(window.innerHeight){                                      
		windheight = window.innerHeight;                               
	}                                                            
	else if(document.body && document.body.clientHeight){         
		windheight = document.body.clientHeight;                       
	}
	if(document.documentElement && document.documentElement.clientHeight){ 
		windheight = document.documentElement.clientHeight;
	}
	
	heightcontainer = windheight - 468;
	heightcontainerindex = windheight - 564;
	
	if(cmsBrowser.ie){
		$('#content').css('min-height', heightcontainer +'px');
	} else {
		$('#content').css('min-height', heightcontainer +'px');
	}
	
	
	
	if(cmsBrowser.ie){

		$('.bg-catalog-index').css("height", heightcontainerindex +'px');
	} else {
		$('.bg-catalog-index').css("min-height", heightcontainerindex +'px');
	}
	
	
	
});
