function setCookie (name, value, expires, path, domain, secure)
{
	document.cookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
}


$(document).ready(	  
	function() {
		var heightes = [];
		$(".more_text").each(function(index,domElement) {
			heightes[index]=$(this).height();
			if ($(this).attr('open')!='1') $(this).css({'overflow':'hidden', 'height':'1px'});
			else $(this).css({'overflow':'hidden'});
		});
		
		$(".more_text_link").attr('href','javascript:void(0);');
		$(".more_text_link").each(function(index){
			$(this).click(function(){
				elem = this;
				if ($(this).text()=='развернуть описание') 
				{
					$(this).parent().find('.more_text').animate({'height':heightes[index]+'px'}, "slow", function(){$(elem).text('свернуть описание'); $(elem).attr('class','more_text_link_open');});		
				}
				else if($(this).text()=='свернуть описание') 
				{
					$(this).parent().find('.more_text').animate({'height':'1px'}, "slow", function(){$(elem).text('развернуть описание');  $(elem).attr('class','more_text_link');});			
				}
				else if ($(this).text()=='развернуть') 
				{
					$(this).parent().find('.more_text').animate({'height':heightes[index]+'px'}, "slow", function(){$(elem).text('свернуть'); $(elem).attr('class','more_text_link_open');});		
				}
				else if($(this).text()=='свернуть') 
				{
					$(this).parent().find('.more_text').animate({'height':'1px'}, "slow", function(){$(elem).text('развернуть');  $(elem).attr('class','more_text_link');});			
				}
				else if ($(this).text()=='подробнее') 
				{
					$(this).parent().find('.more_text').animate({'height':heightes[index]+'px'}, "slow", function(){$(elem).text('скрыть подробности'); $(elem).attr('class','more_text_link_open');});		
				}
				else if($(this).text()=='скрыть подробности') 
				{
					$(this).parent().find('.more_text').animate({'height':'1px'}, "slow", function(){$(elem).text('подробнее');  $(elem).attr('class','more_text_link');});			
				}
				else
				{
					if ($(this).parent().find('.more_text').css('height')=='1px') {$(this).parent().find('.more_text').animate({'height':heightes[index]+'px'}, "slow");}
					else {$(this).parent().find('.more_text').animate({'height':'1px'}, "slow");		}
				}
				return false;
			});
		});
		$(".more_text_link_open").each(function(index){
			$(this).click(function(){
				elem = this;
				if ($(this).text()=='развернуть описание') 
				{
					$(this).parent().find('.more_text').animate({'height':heightes[index]+'px'}, "slow", function(){$(elem).text('свернуть описание'); $(elem).attr('class','more_text_link_open');});		
				}
				else if($(this).text()=='свернуть описание') 
				{
					$(this).parent().find('.more_text').animate({'height':'1px'}, "slow", function(){$(elem).text('развернуть описание');  $(elem).attr('class','more_text_link');});			
				}
				else if ($(this).text()=='развернуть') 
				{
					$(this).parent().find('.more_text').animate({'height':heightes[index]+'px'}, "slow", function(){$(elem).text('свернуть'); $(elem).attr('class','more_text_link_open');});		
				}
				else if($(this).text()=='свернуть') 
				{
					$(this).parent().find('.more_text').animate({'height':'1px'}, "slow", function(){$(elem).text('развернуть');  $(elem).attr('class','more_text_link');});			
				}
				else if ($(this).text()=='подробнее') 
				{
					$(this).parent().find('.more_text').animate({'height':heightes[index]+'px'}, "slow", function(){$(elem).text('скрыть подробности'); $(elem).attr('class','more_text_link_open');});		
				}
				else if($(this).text()=='скрыть подробности') 
				{
					$(this).parent().find('.more_text').animate({'height':'1px'}, "slow", function(){$(elem).text('подробнее');  $(elem).attr('class','more_text_link');});			
				}
				else
				{
					if ($(this).parent().find('.more_text').css('height')=='1px') {$(this).parent().find('.more_text').animate({'height':heightes[index]+'px'}, "slow");}
					else {$(this).parent().find('.more_text').animate({'height':'1px'}, "slow");		}
				}
				return false;
			});
		});
		
	});

