$(document).ready(function(){
	setPosition();
	$(window).bind("resize", setPosition);
	
	$(".type em").click(function () {
		var varid = $(this).attr("rel");
		$(".type_more").hide("slow");
		$("#"+varid).slideToggle("slow", function () {
			checkinblock();
		});
	});
	
	checkinblock();
	
});

function checkinblock() {
	var he = $(window).height();
	var he = he - he * 0.3;
	$("#material_block_information .text-popup-block").height(he);
	$("#furnitura_block_information .text-popup-block").height(he);
}
function setPosition() {

	//var obj = $("#map_block");

	var wi = $(window).width();
	var he = $(window).height();
	
	//$("#body_container").width($(window).width());
	
	var sh = (document.documentElement.scrollHeight) ? document.documentElement.scrollHeight + 30 : he + 200;
	
	
	if (sh < he) { sh = he };
	if (sh < 650) { sh = 650 };
	
	
		$("#cover").width(wi);
		$("#cover").height(sh);

	
	
	//$("#body_container").height(sh);

	//var wiB = $(obj).width();
	//var heB = $(obj).height();

	//var shiftX = (wi - wiB)/2 + 100;
	//var shiftY = (he - heB)/2;
	//var shiftY = shiftY - 30;

	//shiftX = (shiftX < 120) ? 120 : shiftX ;
	//shiftY = (shiftY < 110) ? 110 : shiftY ;

	//$(obj).css({top: shiftY+"px", left: shiftX+"px"});

	/*
	if ($("#enter_form").css("display") == "block") {
		var topY = ($(window).height() - $("#enter_form").height())/2 - 20;
		$("#enter_form").css("top", topY+"px");
	}
	*/
}
