function show_contacts(id_town){
	//alert(id_town);
	if(undefined != id_town){
		var	town = id_town;
	}else{
		var town = $('#town').val();	
	}
	//alert(town);
	
	result_town = $.ajax({
	  url: "/bitrix/tools/ballisticka/ajax/select_town.php",
	  type: "POST",
	  dataType: "text",
	  data: 'ID=' + town,
	  success: function(MSG) {
	  	var words = MSG.split("|");
	    $("#numb_phone").html(words[0]);
	    $("#fphone").html(words[0]);
	    $("#faddress").html(words[1]);
		if (words[2] == 1) {
			$("#link").html('<a href="/about/branches/'+town+'/#map">Карта проезда</a>');
	    } else {
			$("#link").html('');
		}
		$("#numb_phone").show();
	    $("#link_send_form").show();
	    //$("#form_contacts_send").css('display','none');
	  }
	});
	$('#send_form').css('display','none');
} 
function Send_from_to_mod(){
	users_name_contacts = $('#users_name_contacts').val();
	users_email_contacts = $('#users_email_contacts').val();
	if(users_name_contacts == 'вашe имя') users_name_contacts = '';
	if(users_email_contacts == 'телефон') users_email_contacts = '';	
	if(users_name_contacts != '' && users_email_contacts != ''){
		$.ajax({
		  url: "/bitrix/tools/ballisticka/ajax/send_from.php",
		  type: "POST",
		  dataType: "html",
		  data: 'NAME=' + users_name_contacts + '&EMAIL=' + users_email_contacts,
		  success: function(MSG) {
		  }
		});
		$('#contacts_to_admin').remove();
		content_end = 'Спасибо за вашу заявку!<br/>Наши менеджеры свяжутся с вами в ближайщие время.<br/><a href="Javascript:void(0)" id="close_content_end">Закрыть</a>'
		$('div#send_form').html(content_end);
	}
	return false;
}
$('#close_content_end').live('click',function(){
	$('#link_send_form').remove();
	$('#send_form').css('display','none');
	
})

function show_form_send(status){
	if(status == true){
		$('#send_form').css('display','block');
		$('#link_send_form').css('display','none');
	}else{
		$('#send_form').css('display','none');
		$('#link_send_form').css('display','block');
	}
}

function change_img_about(){
	width_menu_top = $('#menu_top_3').width();
	width_menu_top -= 42;
	$('.about_td_img').css('width',width_menu_top + 'px');
}


function Change_size_call(){
	width_menu_call_top = $('.cols_2').width();
	width_menu_call_top -= 21;
	$('.contscts_show_block').css('width',width_menu_call_top + 'px');
}


$(window).resize(function(){
	change_img_about();
	Change_size_call();
});
$(window).load(function() {
	change_img_about();
	Change_size_call();
});

$(document).ready(function() {
	$("#form_text_9").focus(function () {
		if($(this).val() == '+7 (123) 123-45-67'){
			$(this).val('');
			$(this).css('color', '#000000');			
		}
	});	
	
	$("#form_text_9").blur(function () {
		if($(this).val() == ''){
			$(this).val('+7 (123) 123-45-67');
			$(this).css('color', '#999999');
		}
	});	
	$("#form_send #phone").focus(function () {
		if($(this).val() == '+7 (123) 123-45-67'){
			$(this).val('');
			$(this).css('color', '#000000');			
		}
	});	
	
	$("#form_send #phone").blur(function () {
		if($(this).val() == ''){
			$(this).val('+7 (123) 123-45-67');
			$(this).css('color', '#999999');
		}
	});	
	
	
	$('.seo-blocks .seo-blocks-selector span').click(function(){
		$('.seo-blocks .seo-block').hide();
		var block_id = '#' + $(this).attr('id')+'-content';
		$(block_id).show();
	});
	
		$('.label-val').focus(function(){
		if ($(this).val() == $(this).next('label').text()) {
			$(this).val('');
		}
	});
	
	$('.label-val').blur(function(){
		if ($(this).val() == '') {
			$(this).val($(this).next('label').text());
		}
	});
	
	$('.catalog-filter .filter-clear').click(function(){
		$('.catalog-filter select').val('');
	});
	
	$('.catalog-hint').click(function(){
		$('#product-search').val($(this).text());
	});
	
	$('.popup-form .x-close').click(function(){
		show_form_send(false);
	});
	
	$('.auth-form label.label').click(function(){
		$(this).next('input').focus();
	});
	
	$('.auth-form input.text').focus(function(){
		$(this).prev('label.label').hide();
	});
	$('.auth-form input.text').blur(function(){
		if (this.value=='')
			$(this).prev('label.label').show();
	});
	
	
	
});









