function zoom_pic(id) {
 var obj = 'show_big_pic_'+id;  
 document.getElementById(obj).style.display='block';
 document.getElementById(obj).style.zIndex='10';
}    
function unzoom_pic(id) {
 var obj = 'show_big_pic_'+id;  
 document.getElementById(obj).style.display='none';
} 
function get_form_params(form)
{
	var form_params={};	
	$('input, textarea', form).each(function() {
			if($(this).attr('name'))
			{
				var value = $(this).attr('value');
				if($("input[name='"+$(this).attr('name')+"']", form).is(':radio')) 
				{ 
					value = $("input[name='"+$(this).attr('name')+"']:checked").val();
				}
				form_params[$(this).attr('name')] = value;
			}
		})
	form_params['rnd'] = Math.random();
	form_params['utf8'] = 1;		
	return form_params;
}
function create_floating_msg(msg_data)
{
	if($('.floating_msg').length) {$('.floating_msg').remove();}
	$('<div class="floating_msg"></div>').appendTo("body");
	var obj = $('.floating_msg');
	if(msg_data.width) { obj.width(msg_data.width); }
	if(msg_data.height) { obj.height(msg_data.height); }
	center_on_window(obj);
	obj.html('<img src="/js/loading1.gif" width="16" height="16" vspace="50">');
	return obj;
}
function center_on_window(obj)
{
	var w = obj.outerWidth();
	var h = obj.outerHeight()
	obj.css({
		position:'absolute',
		top: parseInt($(window).scrollTop() + ($(window).height() - h) / 2 - 100),
		left: parseInt($(window).scrollLeft() +($(window).width() - w) / 2)
	});
}
function show_basket_info()
{
	if($('.cart').length) 
	{
		$.post("/cgi-bin/dsp.pl", { cl: "order", event: "show_basket_info", rnd: Math.random(), utf8: 1 }, 
		function(data) {
			$('.cart').html(data);
		});	
	}
}

function calc_result_delivery_method(string)
{
	var obj = document.getElementById('divPostCost');
	obj.style.visibility = "visible";
	obj.innerHTML = string;
}
$(document).ready(function() {
	show_basket_info();
	$('.hide_parent_div').live("click", function hide_parent_div()
	{
		$(this).closest('div').hide();
	});		
	$('.delivery_method').click(function post_russia()
	{
	
	if($("input[name='delivery_method']:checked").val()=='8'){
		$('#delivery_city').show();
	}
	else{
		$('#delivery_city').hide();
	}
	});
	
	$('#choose_delivery_city').change(function calc_post(){
	
		var summa_rub=$("#summa_rub").val();
		var weight=$("#weight").val();
		var choose_delivery_city=$("#choose_delivery_city").val();  //DeliveryOrder.choose_town.value;
		
		
		$.post("/cgi-bin/dsp.pl", { cl: "order", event: "calculation_delivery_method", summa_rub:summa_rub, weight:weight, choose_delivery_city:choose_delivery_city, rnd: Math.random(), utf8: 1 }, 
		function(data) {
		
			$('#divPostCost').html(data);
		});	
		
		});
	  
});
