var recalc=function(){

	//clear
	$('tr.data4 input, tr.data5 input').val('');

	//poluchaem tip dostavki
	$('tr.data1 select').change(function () {
		var typed = $('tr.data1 select option:selected').attr('class');
		$('tr.data1 select').attr({name: typed});
	});

	//poluchaem vid dostavki
	$('tr.data11 select').change(function () {
		var typed = $('tr.data11 select option:selected').attr('class');
		$('tr.data11 select').attr({name: typed});
	});

	//get city 'from'
	$('tr.data2 select').change(function () {
		var cityfrom = $('tr.data2 select option:selected').attr('class');
		$('tr.data2 select').attr({name: cityfrom});
	});

	//get city 'to'
	$('tr.data3 select').change(function () {
		var cityto = $('tr.data3 select option:selected').attr('class');
		$('tr.data3 select').attr({name: cityto});
	});

	//get 'weight'
	$('tr.data4 input').keyup(function () {
		var weight = $(this).val();
		$(this).val( weight.replace(/,/gi,'.') );
		$(this).keyup(function () {
			var weight2 = $(this).val();
			$(this).val( weight2.replace(/[a-zA-Zа-яА-Я@\,;:\'\"%#]/gi,'') );
		});
		$(this).removeClass();
		$(this).addClass(weight);

		var fromcity = $('.data2 select').attr('name');
		var tocity = $('.data3 select').attr('name');

	});

	//get 'volume'
	$('tr.data5 input').keyup(function () {
		var volume = $(this).val();
		$(this).val( volume.replace(/,/gi,'.') );
		//$(this).val( weight.replace(/[a-zA-Zа-яА-Я@\,;:\'\"%#]/gi,'.') );
		$(this).removeClass();
		$(this).addClass(volume);
	});

	//pokazyvaem dostavku kur'erom dlay spb, msk
	$('.data2 select, .data3 select').change(function () {
		var fromcity = $('.data2 select').attr('name');
		var tocity = $('.data3 select').attr('name');

		if ( fromcity == 'city999' && tocity == 'city999' || fromcity == 'city9999' && tocity == 'city9999' || fromcity == 'city999' && tocity == 'city9999' || fromcity == 'city9999' && tocity == 'city999' ) {
			$('option.dost1').remove();
			$('.data1 select').append('<option class="dost1">Курьерская</option>')
		}
		else {
			$('option.dost1').remove();
		}

		if ((tocity != 'tocity' && fromcity != 'fromocity') && ((fromcity == 'city999' && tocity != 'city9999') || (fromcity == 'city9999' && tocity != 'city999')))
		{
			$('option.dost2').attr('selected', 'selected');
			$('.data1 select').attr('disabled', 'disabled').change();
		}
		else
		{
			$('.data1 select').removeAttr('disabled');
			$('option.dost2').removeAttr('selected', 'selected');
		}

	});


	//show new pole for sbp-msk, esli zhd dostavka
	$('.data2 select, .data3 select, .data1 select').change(function () {
		var fromcity = $('.data2 select').attr('name');
		var tocity = $('.data3 select').attr('name');
		var dost = $('.data1 select').attr('name');

		$('.data5, .data5-com').hide();
		if ( fromcity == 'city999' && tocity == 'city9999' && dost == 'dost2' || fromcity == 'city9999' && tocity == 'city999' && dost == 'dost2' || fromcity == 'city999' && tocity == 'city999' && dost == 'dost2' || fromcity == 'city9999' && tocity == 'city9999' && dost == 'dost2' ) {
			$('tr.data5 input').val('');
			$('.data5, .data5-com').show(0).css({opacity: '0'}).animate({opacity: '1'}, 400);

		}

		//hide spb or msk from lists, esli dostavka zhd
		if ( dost == 'dost2' ) {
			$('tr.data2 select option, tr.data3 select option').show();
			$('tr.data2 select option.' + tocity).hide();
			$('tr.data3 select option.' + fromcity).hide();
		}
		else {
			$('tr.data2 select option, tr.data3 select option').show();
		}

	});

	//esli dostavka kur'erom - pokazyvaem eshe odno pole (dazhe 2va!)
	$('.data1 select, .data2 select, .data3 select').change(function () {
		var dosttype = $('.data1 select').attr('name');
		var cityfrom = $('.data2 select').attr('name');
		var cityto = $('.data3 select').attr('name');
		//alert(dosttype);
		$('.data4-com').hide();

		$('tr.data11 td select option').remove();
		if ( dosttype == 'dost1' ) {
			$('.data4 input').attr({ id: 'limit10'});

			//ogranichivaem max ves do 10kg dlya dostavki kur'erom
			$('.data4 #limit10').live('keyup', function () {
				var weight = $(this).val();
				if ( weight > 10 ) {
					$(this).val('10');
				}
			});

			//esli dostavka kur'erom po spb - predlagaem varianty dostavki
			if ( cityfrom == 'city999' && cityto == 'city999' ) {
				$('tr.data11 td select').html('<option>Выбрать</option><option class="vid1">Срочная</option><option class="vid2">Стандартная</option><option class="vid3">Эконом</option>');
			}
			//esli dostavka kur'erom po msk - predlagaem varianty dostavki
			if ( cityfrom == 'city9999' && cityto == 'city9999' ) {
				$('tr.data11 td select').html('<option>Выбрать</option><option class="vid4">Срочная до ТТК</option><option class="vid5">Срочная до МКАД</option><option class="vid6">Рабочий день</option><option class="vid7">Один день</option>');
			}
			//esli dostavka kur'erom msk-spb - predlagaem varianty dostavki
			if ( cityfrom == 'city9999' && cityto == 'city999' || cityfrom == 'city999' && cityto == 'city9999' ) {
				$('tr.data11 td select').html('<option>Выбрать</option><option class="vid8">Сверх срочная</option><option class="vid9">Срочная</option><option class="vid10">Стандартная</option><option class="vid11">Офис &mdash; офис</option>');
			}

			$('tr.data11').show().css({opacity: '0'}).animate({opacity: '1'}, 400);

			//$('tr.data4 td:last').html('<p class="vid-comment2">&mdash; вес до 10 кг</p>');
			$('.data4-com').show();

			//pokazyvaem pole ob'em
			$('.data5, .data5-com').hide();
			$('tr.data5 input').val('');
			$('.data5, .data5-com').show().css({opacity: '0'}).animate({opacity: '1'}, 400);

		} else {
			$('.data4 input').attr({ id: ''});
			$('tr.data11').hide();
		}

	});

	//pokazyvaem kommenty dlya vida dostavki
	$('.data11 select').change(function () {
		var vid = $('.data11 select').attr('name');
		$('.vid-comment').remove();

		//dosatavka po spb
		if ( vid == 'vid1' ) { $('tr.data11-comment td').html('<p class="vid-comment">* Доставка в течение 60-90 минут</p>'); }
		if ( vid == 'vid2' ) { $('tr.data11-comment td').html('<p class="vid-comment">* Доставка до 18:00 в день заказа</p>'); }
		if ( vid == 'vid3' ) { $('tr.data11-comment td').html('<p class="vid-comment">* Доставка до 18:00 на следующий рабочий день</p>'); }
		//dostavka po msk
		if ( vid == 'vid4' ) { $('tr.data11-comment td').html('<p class="vid-comment">* Доставка в течение 60-90 минут</p>'); }
		if ( vid == 'vid5' ) { $('tr.data11-comment td').html('<p class="vid-comment">* Доставка в течение 60-90 минут</p>'); }
		if ( vid == 'vid6' ) { $('tr.data11-comment td').html('<p class="vid-comment">* Доставка до 18:00 в день заказа</p>'); }
		if ( vid == 'vid7' ) { $('tr.data11-comment td').html('<p class="vid-comment">* Доставка до 18:00 на следующий рабочий день</p>'); }
		//dostavka spb-msk
		if ( vid == 'vid8' ) { $('tr.data11-comment td').html('<p class="vid-comment">* Доставка на следующий рабочий день до 12:00</p>'); }
		if ( vid == 'vid9' ) { $('tr.data11-comment td').html('<p class="vid-comment">* Доставка на следующий рабочий день до 18:00</p>'); }
		if ( vid == 'vid10' ) { $('tr.data11-comment td').html('<p class="vid-comment">* Доставка в течение 1-2 рабочих дней</p>'); }
		if ( vid == 'vid11' ) { $('tr.data11-comment td').html('<p class="vid-comment">* Доставка на следующий</p>'); }

		$('.vid-comment').show().css({opacity: '0'}).animate({opacity: '1'}, 400);
	});


	$('.data1 select, .data11 select, .data2 select, .data3 select').change(function () {
		$(this).parent('td').parent('tr').removeClass('this-tr');
		//$(this).parent('td').parent('tr').find('td').eq(2).html('');
		$(this).parent('td').parent('tr').next('tr').find('td').find('.some-trouble').remove();
		$('.hidden-block').hide();
	});
	$('.data4 input, .data5 input').keyup(function () {
		$(this).parent('td').parent('tr').removeClass('this-tr');
		$(this).parent('td').parent('tr').next('tr').find('td').html('');
		$('.hidden-block').hide();
	});

	//final calc on press 'enter'
	$(document).keypress(function(e) {
		switch(e.which)	{
			case 13: $('.calc-me').click();
		}
	});

	//final calc
	$('.calc-me').click(function () {
		var typedost = $('tr.data1 select').attr('name');
		var viddost = $('tr.data11 select').attr('name');
		var cityto = $('tr.data3 select').attr('name');
		var cityfrom = $('tr.data2 select').attr('name');
		var weight = $('tr.data4 input').attr('class');
		var volume = $('tr.data5 input').attr('class') * 200;


		//form validation
		$('.some-trouble').remove();
		if ( typedost == ''  ) {
			$('tr.data1').addClass('this-tr');
			$('tr.data1-comment td').html('<p class="some-trouble">Выберите тип доставки</p>');
		}
		if ( typedost == 'dost1' && viddost == '' ) {
			$('tr.data11').addClass('this-tr');
			$('tr.data11-comment td').html('<p class="some-trouble">Выберите вид курьерской доставки</p>');
		}
		if ( cityfrom == 'fromcity'  ) {
			$('tr.data2').addClass('this-tr');
			$('tr.data2-comment td').html('<p class="some-trouble">Выберите город, из которого нужно доставить груз</p>');
		}
		if ( cityto == 'tocity'  ) {
			$('tr.data3').addClass('this-tr');
			$('tr.data3-comment td').html('<p class="some-trouble">Выберите город, в который нужно доставить груз</p>');
		}
		if ( $('tr.data4 input').val().length == 0 ) {
			$('tr.data4').addClass('this-tr');
			$('tr.data4-comment td').html('<p class="some-trouble">Укажите вес груза</p>');
		}
		if ( $('tr.data5').is(':visible') && $('tr.data5 input').val().length == 0 ) {
			$('tr.data5').addClass('this-tr');
			$('tr.data5-comment td').html('<p class="some-trouble">Укажите объем груза</p>');
		}


		//esli zhd dostavka to schitaem
		if ( typedost == 'dost2' ) {

			if ((cityto != 'tocity' && cityfrom != 'fromocity') && ((cityfrom == 'city999' && cityto != 'city9999') || (cityfrom == 'city9999' && cityto != 'city999')))
			{
				if (weight < 10)
				{
					weight = 10;
				}
			}

			//get actual price
			if ( weight < 500 ) { var treq = '1'; }
			if ( weight >= 500 && weight < 1500 ) { var treq = '2'; }
			if ( weight >= 1500 && weight < 3000 ) { var treq = '3'; }
			if ( weight >= 3000 ) { var treq = '4'; }

			var tarif = $('#calcdata tbody .' + cityto).find('td').eq(treq).html().replace(/[a-zA-Zа-яА-Я@\,;:\'\"%#]/gi,'.');

			if ( volume >= weight ) {
				var finalprice = (tarif * volume).toFixed(0) * 1;
			}
			else if ( volume < weight ) {
				var finalprice = (tarif * weight).toFixed(0) * 1;
			}

			//esli zhd dostavka to v zavisimosti ot vesa gruza izmenyaem stoimost
			if ( cityto != 'city9999' && cityto != 'city999' ) {
				if ( weight <= 50 ) { var finalprice2 = finalprice + 100; }
				if ( weight > 50 && weight < 100 ) { var finalprice2 = finalprice + 50; }
				if ( weight >= 100 ) { var finalprice2 = finalprice; }
			}
			else {
				var finalprice2 = finalprice;
			}

			//zhd spb minimalnaya stoimost
			if ( cityfrom == 'city999' && finalprice2 < 200) {
				var finalprice3 = 200;
			}
			//zhd msk minimalnaya stoimost
			else if ( cityfrom == 'city9999' && finalprice2 < 200 ) {
				var finalprice3 = 200;
			}
			//kur'er spb-spb minimalnaya stoimost
			//else if ( typedost == 'dost1' && cityfrom == 'city999' && cityto == 'city999' && finalprice2 < 200 ) {
			//	var finalprice3 = 200;
			//}
			//kur'er msk-msk minimalnaya stoimost (??)
			//else if ( typedost == 'dost1' && cityfrom == 'city9999' && cityto == 'city9999' && finalprice2 < 200 ) {
			//	var finalprice3 = 200;
			//}
			//kur'er spb-msk minimalnaya stoimost
			//else if ( typedost == 'dost1' && cityfrom == 'city999' && cityto == 'city9999' && finalprice2 < 300 ) {
			//	var finalprice3 = 300;
			//}
			//kur'er msk-spb minimalnaya stoimost
			//else if ( typedost == 'dost1' && cityfrom == 'city9999' && cityto == 'city999' && finalprice2 < 300 ) {
			//	var finalprice3 = 300;
			//}
			else {
				var finalprice3 = finalprice2;
			}

			//esli dostavka iz msk ili spb v drugie goroda, to pokazyvaem comment
			if ( cityfrom == 'city999' && cityto != 'city999' && cityto != 'city9999' ) {
				$('.upakovka').show();
			}
			else if ( cityfrom == 'city9999' && cityto != 'city999' && cityto != 'city9999' ) {
				$('.upakovka').show();
			}
			else {
				$('.upakovka').hide();
			}

			//final tadam!
			if ( cityfrom != 'fromcity' && cityto != 'tocity' && $('tr.data4 input').val().length > 0 ) {
				$('.hidden-block').show().css({opacity: '0'}).animate({opacity: '1'});
				$('p.price span').html(finalprice3 + ' руб.');
			}

		}


		//esli dostavka kur'erom to schitaem po-drugomu
		else if ( typedost == 'dost1' )	{

			if ( volume > weight) {
				superwieght = volume;
			}
			else {
				superwieght = weight;
			}

			//dostavka po spb
			if ( viddost == 'vid1' ) {
				var tarif1 = $('#t-spb tbody tr').eq(0).find('td').eq(1).text() * 1;
				var tarif2 = $('#t-spb tbody tr').eq(0).find('td').eq(2).text() * 1;
				var tarif3 = $('#t-spb tbody tr').eq(0).find('td').eq(3).text() * 1;
				var tarif4 = $('#t-spb tbody tr').eq(0).find('td').eq(4).text() * 1;
				var tarif5 = $('#t-spb tbody tr').eq(0).find('td').eq(5).text() * 1;

				if ( superwieght < 0.5 ) { var finalprice =  tarif1; }
				if ( superwieght >= 0.5 && superwieght < 1  ) { var finalprice = tarif2; }
				if ( superwieght >= 1 && superwieght < 3  ) { var finalprice = tarif3; }
				if ( superwieght >= 3 && superwieght < 5  ) { var finalprice = tarif4; }
				if ( superwieght >= 5 ) { var finalprice = tarif4 + (superwieght - 5) * tarif5; }
			}
			if ( viddost == 'vid2' ) {
				var tarif1 = $('#t-spb tbody tr').eq(1).find('td').eq(1).text() * 1;
				var tarif2 = $('#t-spb tbody tr').eq(1).find('td').eq(2).text() * 1;
				var tarif3 = $('#t-spb tbody tr').eq(1).find('td').eq(3).text() * 1;
				var tarif4 = $('#t-spb tbody tr').eq(1).find('td').eq(4).text() * 1;
				var tarif5 = $('#t-spb tbody tr').eq(1).find('td').eq(5).text() * 1;

				if ( superwieght < 0.5 ) { var finalprice =  tarif1; }
				if ( superwieght >= 0.5 && superwieght < 1  ) { var finalprice = tarif2; }
				if ( superwieght >= 1 && superwieght < 3  ) { var finalprice = tarif3; }
				if ( superwieght >= 3 && superwieght < 5  ) { var finalprice = tarif4; }
				if ( superwieght >= 5 ) { var finalprice = tarif4 + (superwieght - 5) * tarif5; }
			}
			if ( viddost == 'vid3' ) {
				var tarif1 = $('#t-spb tbody tr').eq(2).find('td').eq(1).text() * 1;
				var tarif2 = $('#t-spb tbody tr').eq(2).find('td').eq(2).text() * 1;
				var tarif3 = $('#t-spb tbody tr').eq(2).find('td').eq(3).text() * 1;
				var tarif4 = $('#t-spb tbody tr').eq(2).find('td').eq(4).text() * 1;
				var tarif5 = $('#t-spb tbody tr').eq(2).find('td').eq(5).text() * 1;

				if ( superwieght < 0.5 ) { var finalprice =  tarif1; }
				if ( superwieght >= 0.5 && superwieght < 1  ) { var finalprice = tarif2; }
				if ( superwieght >= 1 && superwieght < 3  ) { var finalprice = tarif3; }
				if ( superwieght >= 3 && superwieght < 5  ) { var finalprice = tarif4; }
				if ( superwieght >= 5 ) { var finalprice = tarif4 + (superwieght - 5) * tarif5; }
			}

			//dostavka po msk
			if ( viddost == 'vid4' ) {
				var tarif1 = $('#t-msk tbody tr').eq(0).find('td').eq(1).text() * 1;
				var tarif2 = $('#t-msk tbody tr').eq(0).find('td').eq(2).text() * 1;
				var tarif3 = $('#t-msk tbody tr').eq(0).find('td').eq(3).text() * 1;

				if ( superwieght < 0.3 ) { var finalprice =  tarif1; }
				if ( superwieght >= 0.3 && superwieght < 1  ) { var finalprice = tarif2; }
				if ( superwieght >= 1 ) { var finalprice = tarif2 + (superwieght - 1) * tarif3; }
			}
			if ( viddost == 'vid5' ) {
				var tarif1 = $('#t-msk tbody tr').eq(1).find('td').eq(1).text() * 1;
				var tarif2 = $('#t-msk tbody tr').eq(1).find('td').eq(2).text() * 1;
				var tarif3 = $('#t-msk tbody tr').eq(1).find('td').eq(3).text() * 1;

				if ( superwieght < 0.3 ) { var finalprice =  tarif1; }
				if ( superwieght >= 0.3 && superwieght < 1  ) { var finalprice = tarif2; }
				if ( superwieght >= 1 ) { var finalprice = tarif2 + (superwieght - 1) * tarif3; }
			}
			if ( viddost == 'vid6' ) {
				var tarif1 = $('#t-msk tbody tr').eq(2).find('td').eq(1).text() * 1;
				var tarif2 = $('#t-msk tbody tr').eq(2).find('td').eq(2).text() * 1;
				var tarif3 = $('#t-msk tbody tr').eq(2).find('td').eq(3).text() * 1;

				if ( superwieght < 0.3 ) { var finalprice =  tarif1; }
				if ( superwieght >= 0.3 && superwieght < 1  ) { var finalprice = tarif2; }
				if ( superwieght >= 1 ) { var finalprice = tarif2 + (superwieght - 1) * tarif3; }
			}
			if ( viddost == 'vid7' ) {
				var tarif1 = $('#t-msk tbody tr').eq(3).find('td').eq(1).text() * 1;
				var tarif2 = $('#t-msk tbody tr').eq(3).find('td').eq(2).text() * 1;
				var tarif3 = $('#t-msk tbody tr').eq(3).find('td').eq(3).text() * 1;

				if ( superwieght < 0.3 ) { var finalprice =  tarif1; }
				if ( superwieght >= 0.3 && superwieght < 1  ) { var finalprice = tarif2; }
				if ( superwieght >= 1 ) { var finalprice = tarif2 + (superwieght - 1) * tarif3; }
			}

			//dostavka spb-msk
			if ( viddost == 'vid8' ) {
				var tarif1 = $('#t-spb-msk tbody tr').eq(0).find('td').eq(1).text() * 1;
				var tarif2 = $('#t-spb-msk tbody tr').eq(0).find('td').eq(2).text() * 1;
				var tarif3 = $('#t-spb-msk tbody tr').eq(0).find('td').eq(3).text() * 1;
				var tarif4 = $('#t-spb-msk tbody tr').eq(0).find('td').eq(4).text() * 1;
				var tarif5 = $('#t-spb-msk tbody tr').eq(0).find('td').eq(5).text() * 1;

				if ( superwieght < 0.5 ) { var finalprice =  tarif1; }
				if ( superwieght >= 0.5 && superwieght < 1  ) { var finalprice = tarif2; }
				if ( superwieght >= 1 && superwieght < 3  ) { var finalprice = tarif3; }
				if ( superwieght >= 3 && superwieght < 5  ) { var finalprice = tarif4; }
				if ( superwieght >= 5 ) { var finalprice = tarif4 + (superwieght - 5) * tarif5; }
			}
			if ( viddost == 'vid9' ) {
				var tarif1 = $('#t-spb-msk tbody tr').eq(1).find('td').eq(1).text() * 1;
				var tarif2 = $('#t-spb-msk tbody tr').eq(1).find('td').eq(2).text() * 1;
				var tarif3 = $('#t-spb-msk tbody tr').eq(1).find('td').eq(3).text() * 1;
				var tarif4 = $('#t-spb-msk tbody tr').eq(1).find('td').eq(4).text() * 1;
				var tarif5 = $('#t-spb-msk tbody tr').eq(1).find('td').eq(5).text() * 1;

				if ( superwieght < 0.5 ) { var finalprice =  tarif1; }
				if ( superwieght >= 0.5 && superwieght < 1  ) { var finalprice = tarif2; }
				if ( superwieght >= 1 && superwieght < 3  ) { var finalprice = tarif3; }
				if ( superwieght >= 3 && superwieght < 5  ) { var finalprice = tarif4; }
				if ( superwieght >= 5 ) { var finalprice = tarif4 + (superwieght - 5) * tarif5; }
			}
			if ( viddost == 'vid10' ) {
				var tarif1 = $('#t-spb-msk tbody tr').eq(2).find('td').eq(1).text() * 1;
				var tarif2 = $('#t-spb-msk tbody tr').eq(2).find('td').eq(2).text() * 1;
				var tarif3 = $('#t-spb-msk tbody tr').eq(2).find('td').eq(3).text() * 1;
				var tarif4 = $('#t-spb-msk tbody tr').eq(2).find('td').eq(4).text() * 1;
				var tarif5 = $('#t-spb-msk tbody tr').eq(2).find('td').eq(5).text() * 1;

				if ( superwieght < 0.5 ) { var finalprice =  tarif1; }
				if ( superwieght >= 0.5 && superwieght < 1  ) { var finalprice = tarif2; }
				if ( superwieght >= 1 && superwieght < 3  ) { var finalprice = tarif3; }
				if ( superwieght >= 3 && superwieght < 5  ) { var finalprice = tarif4; }
				if ( superwieght >= 5 ) { var finalprice = tarif4 + (superwieght - 5) * tarif5; }
			}
			if ( viddost == 'vid11' ) {
				var tarif1 = $('#t-spb-msk tbody tr').eq(3).find('td').eq(1).text() * 1;
				var tarif2 = $('#t-spb-msk tbody tr').eq(3).find('td').eq(2).text() * 1;
				var tarif3 = $('#t-spb-msk tbody tr').eq(3).find('td').eq(3).text() * 1;
				var tarif4 = $('#t-spb-msk tbody tr').eq(3).find('td').eq(4).text() * 1;
				var tarif5 = $('#t-spb-msk tbody tr').eq(3).find('td').eq(5).text() * 1;

				if ( cityfrom == 'city999' ) {
					if ( superwieght <= 35 ) { var finalprice =  tarif1; }
					if ( superwieght > 35 ) { var finalprice = superwieght * 7; }
				}
				if ( cityfrom == 'city9999' ) {
					if ( superwieght <= 35 ) { var preprice =  tarif1; }
					if ( superwieght > 35 ) { var preprice = superwieght * 7; }

					if ( preprice < 300 ) {
						preprice2 = 300;
					}
					if ( preprice >= 300 ) {
						preprice2 = preprice;
					}
					finalprice = preprice2;
				}
			}

			//final tadam!
			if ( cityfrom != 'fromcity' && cityto != 'tocity' && $('tr.data4 input').val().length > 0 ) {
				$('.hidden-block').show().css({opacity: '0'}).animate({opacity: '1'});
				$('p.price span').html(finalprice + ' руб.');
			}

		}

		return false;
	});


	// some js
	$('.tar-tbl tr:odd').addClass('grtd');

	//tabs
	$('#tslctr li span').click(function () {
		$('#tslctr li').removeClass('thac').removeClass('thac2');

		var tid = $(this).parent('li').index();
		if ( tid == '0' ) {
			$(this).parent('li').addClass('thac');
		}
		else if (tid == '1') {
			$(this).parent('li').addClass('thac2');
		}

		$('.tblSlct').hide();
		$('.tblSlct').eq(tid).show();

	});

	$('#tslctr2 li span').click(function () {
		var tid = $(this).parent('li').index();

		$('div.tblSlct').eq(1).find('table').hide();
		$('div.tblSlct').eq(1).find('table').eq(tid).show();
	});

	var hashlink = window.location.hash;
	if ( hashlink == '#mu' || hashlink == '#ar' || hashlink == '#be' || hashlink == '#ek' || hashlink == '#so' || hashlink == '#mu' ){
		$('#tslctr li:last span').click();
	}
	if ( hashlink == '#mu' || hashlink == '#ar' || hashlink == '#be' || hashlink == '#ek' ){
		$('#tslctr2 li:first span').click();
	}
	if ( hashlink == '#mu' ) {
		$('#tslctr2 li').eq(1).find('span').click();
	}
	if ( hashlink == '#so' ) {
		$('#tslctr2 li').eq(2).find('span').click();
	}

};
$(function(){
	recalc();
});

