$(document).ready(function(){
	$("#content, #sidebar").wrapAll("<div class='content-wrapper'>");
	$(".content-wrapper").append("<div class='clear' />");
	$(".menu>li:not(:last-child)").after("<li class='separator' />");
	$("#header .home.banner p span").each(function(){
		$(this).css("margin-left", (4.5-0.67*$("#header .home.banner p span").index(this)) + "em");
	});
	$("#sidebar").append("<span class='decorator' />");
	$(".bottom-bordered").wrap("<div class='bordered-wrapper' />");
	$(".bordered-wrapper").each(function(){
		$(this).height($(this).find(".bottom-bordered").outerHeight() - 1);
	});
	$("#footer").wrap("<div class='footer-wrapper'/>");
	$(".businness .title").each(function(){
		 $(this).parent().height($(this).height());
	});
	$(".businness .title").click(function(){
		  var d = $(this).attr("target");
		  var t = $("#" + d);
		  $(".businness .title.active").removeClass("active");
		  $(".businness .details.open").parent().animate({height: $(this).height()}, 500);
		  var dontOpen = t.hasClass("open");
		  $(".businness .details.open").removeClass("open");
		  if (dontOpen) return;
		  $(this).addClass("active");
		  t.parent().animate({height: 20 + $(this).height() + t.outerHeight()}, 500);
		  t.addClass("open");
	});
	$(".item-wrapper").wrapAll("<div class='items-holder' />");
	
	$("#vopros-otvet").hover(function() {
		$(this).attr('src', '/media/img/vopros_otvet_2.gif');
	}, function() {
		$(this).attr('src', '/media/img/vopros_otvet_1.gif');
	});
});

