var cart_div;

function show_box(elem)
{
	load_div = document.getElementById('load'+elem);
	load_div.style.display='inline';
	count_div = document.getElementById('count'+elem);
	_gaq.push(['_trackEvent', 'cart_event', 'reserve_item']);

	$("#cart").load("/index.php?contr=catalog&method=item&id="+elem+"&count="+count_div.value, '', function()
	{
		var left = 0;
		var top = 0;
		cart_div = document.getElementById('cart');
   		cart_div.style.display = 'block';
	
		left = Math.round((document.getElementById('main').clientWidth - cart_div.clientWidth)/2);
		top = Math.round((screen.height - cart_div.clientHeight)/2);

		top = 100+document.documentElement.scrollTop;
		cart_div.style.left = left+'px';
		cart_div.style.top = top+'px';
		load_div.style.display='none';
 	});
}

function hide_box()
{
	cart_div = document.getElementById('cart');
	cart_div.style.display = 'none';
}

function show_box_2(elem)
{
	load_div = document.getElementById('load2'+elem);
	load_div.style.display='inline';
	//count_div = document.getElementById('count'+elem);
	count = document.getElementById('f_count');
	name = document.getElementById('f_name');
	tel = document.getElementById('f_tel');
	email = document.getElementById('f_email');
	time_from = document.getElementById('f_time_from');
	time_to = document.getElementById('f_time_to');
	_gaq.push(['_trackEvent', 'cart_event', 'order_item']);

	$("#cart2").load("/index.php?contr=catalog&method=confirm&id="+elem+"&count="+count.value+"&name="+name.value+"&tel="+tel.value+"&email="+email.value+"&time_from="+time_from.value+"&time_to="+time_to.value, '', function()
	{
		var left = 0;
		var top = 0;
		cart_div = document.getElementById('cart2');
   		cart_div.style.display = 'block';
	
		left = Math.round((document.getElementById('cart').clientWidth - cart_div.clientWidth)/2);
		top = Math.round((screen.height - cart_div.clientHeight)/2);

		top = 100;//+document.documentElement.scrollTop;
		cart_div.style.left = left+'px';
		cart_div.style.top = top+'px';
		load_div.style.display='none';
 	});
}

function hide_box_2()
{
	cart_div = document.getElementById('cart2');
	cart_div.style.display = 'none';
}

