inited = false;
function init() {
	measurer_jq = $("#measurer"); // Измеритель
	measurer_el = measurer_jq[0];
	content_jq = $("#content"); // Содержимое
	content_el = content_jq[0];
	outfit_jq = $("#outfit"); // Фантик
	outfit_el = outfit_jq[0];
	
	footer_img_jq = $("#footer img"); // Картинка, прибитая книзу (нет на гравной странице)
	footer_img_el = null;
	if (footer_img_jq.length > 0) {
		footer_img_el = footer_img_jq[0];
	};
	header_height = $("#headerRight")[0].clientHeight;
	footer_img_height = footer_img_el ? footer_img_el.clientHeight : 0;
	
	min_width = 928; // Минимальная ширина страницы
	max_width = 1000; // Максимальная ширина страницы
	//outfit_jq.height("100%");
	inited = true;
}
	
function computeSizes() {
	if (!inited) init();
	var measurer_width = measurer_el.clientWidth;
	var content_width = content_el.clientWidth;
	var w;
	 if (measurer_width >= min_width && measurer_width <= max_width) {
		w = "100%";
	} else if (measurer_width > max_width) {
		w = max_width + "px";
	} else {
		w = min_width + "px";
	}
	if (w > 200) content_jq.width(w);
	
	var h = header_height; // Высота блока заголовка
	var h1 = $("#mainRight")[0].clientHeight; // Высота блока содержимого
	var h2 = $("#mainLeft")[0].clientHeight + footer_img_height + 50; // Высота левой панели + высота нижней картинки + отступ
	h += Math.max(h1, h2) + $("#footer")[0].clientHeight;
	h = Math.max(h, measurer_el.clientHeight);
	/*if (!$.browser.msie && h > 200)*/ outfit_jq.height(h);
}

window.cs = computeSizes;
window.onresize = computeSizes;

window.onload = function () {
	window.cs();
	setTimeout("window.cs();", 3000);
}

$(document).ready(
  function() {
    setTimeout("window.cs();", 1000);

  }
);

