$(document).ready(function(){
	$("div.minimize").each(function(){
		$(this).css("position","relative");
		$(this).css("marginTop","16px");
		$(this).css("marginBottom","30px");
		$(this).prepend("<span class='min_switcher' style='font-size:18px;color:#0095da;border-bottom:2px dashed #0095da;width:100%;cursor:pointer;width:100%;position:relative;'>"+$(this).find("h3:first").html()+"</span>");
		$(this).prepend("<div class='btn' style='position:absolute;top:0px;left:-20px;width:20px;height:20px;cursor:pointer;background:url(/i/arrow1.png) left 8px no-repeat;'></div>");
		//$(this).("span.min_switcher").before("<div class='btn' style='position:absolute;top:0px;left:-20px;wodth:20px;height:20px;'></div>");
		//$(this).prepend("<span></span>");
		$(this).children(":not(.min_switcher:first)").filter(":not(.btn)").filter(":not(.btn1)").wrapAll("<div class='min_wrapper' style='width:100%;border-bottom:2px dashed #0095da;padding-top:10px;padding-bottom:0px;position:relative;'> </div>");
		$(this).find(".min_wrapper").prepend("<div class='btn1' style='position:absolute;bottom:0px;left:-20px;width:20px;height:20px;cursor:pointer;background:url(/i/arrow2.png) left bottom no-repeat;'></div>");
		//$(this).find(".min_wrapper").append("<span class='min_switcher' style='font-size:18px;color:#0095da;width:100%;cursor:pointer;width:100%;'>"+$(this).find("h3:first").html()+"</span>");
		$(this).find("h3:first").remove();		
		//$(this).find(".min_wrapper").css("border-bottom","2px dashed #0095da;");
		//$(this).find("h3:first").css("border-bottom","2px dashed #0095da;").wrap("<a class='min_switcher' style='text-decoration:none;border-bottom:2px dashed #0095da;'> </a>");//<img src='' style='float:left;'/>
		//$(this).find(".min_switcher").before("<img src='/i/arrow1.png' style='margin-right:10px;display:inline;float:left;'/>");
	})
	//$("div.minimize").children(":not(h3:first)").wrapAll("<div class='min_wrapper'> </div>"); //обрамляем содержимое блоком, который будем прятать
	//$("div.minimize h3:first").wrap("<a class='min_switcher' style='text-decoration:line-through;'> </a>"); //h3 будет переключателем показать\скрыть
	//$("div.minimize .min_switcher h3").append("<span class='min_caption' style='color:#aaa;'> показать</span>"); //добавляем к переключателю надпись показать\скрыть
	$("div.minimize .min_switcher").bind('click',function(e){
		e.preventDefault();
		$(this).parent().find(".min_wrapper").slideToggle(400, function(){
			/*var sp = $(this).parent().find(".min_caption").html();
			if(sp==' показать'){
				$(this).parent().find(".min_caption").html(" скрыть");
			} else{
				$(this).parent().find(".min_caption").html(" показать");
			}*/
		});
	});
	$("div.minimize .btn").bind('click',function(e){
		e.preventDefault();
		$(this).parent().find(".min_wrapper").slideToggle(400);
	});	
	$("div.minimize .btn1").bind('click',function(e){
		e.preventDefault();
		$(this).parent().slideToggle(400);
	});		
	$("div.minimize .min_wrapper").css('display','none');
})

