    function getCost() {
		if ($('#calc_t_input').val() == '') {
			alert('Ââåäèòå íîìåð!');
			return false;
		}
		$.get('/costcalc.php', { val: $('#calc_t_input').val() }, function(data) {
			var cost = data.split("qwe");
			$('#calc_t_return').html(cost[0]);
		});
    }
	
	function calcChange()
	{
		$('#calc_t_input').val('');
		$('#calc_t_return').css({'color': '#fe0000'}).html('');
	}	 
	
	function calcPosition() {
		setBounds('calc_t_button_display');
		setBounds('calc_t');
	}
	
	function setBounds(itemId) {
		var left = parseInt($(window).width()) - parseInt($('#' + itemId).width()) - 1;
		var top = ((parseInt($(window).height()) / 2) + parseInt($(window).scrollTop())) - (parseInt($('#' + itemId).height()) / 2);
		$('#' + itemId).css({ 'left': left, 'top': top });
	}
	
	$(window).scroll(function () {
		calcPosition();
	});
	
	$(document).ready(function() {  
		calcPosition();
		getCost();
	});
