//////////////////////////////////////////////////////////////////////////
// Обновление поля даты                                                 //
//////////////////////////////////////////////////////////////////////////

function mobile_phone_update_field( id )
{
	var contry_code = document.getElementById("mobile_phone_contry_code_" + id).value;
		
	var operator_code = document.getElementById("mobile_phone_operator_code_" + id).value;
	
	var number = document.getElementById("mobile_phone_number_" + id).value;
	
	document.getElementById("mobile_phone_field_" + id).value = contry_code + operator_code + number;
}

//////////////////////////////////////////////////////////////////////////
// Изменение кода страны                                                //
//////////////////////////////////////////////////////////////////////////

function mobile_phone_contry_code_on_change( id )
{
	mobile_phone_update_field(id);
}

function mobile_phone_contry_code_on_key_up( id )
{
	var contry_code = document.getElementById("mobile_phone_contry_code_" + id).value;
	var operator_code = document.getElementById("mobile_phone_operator_code_" + id);
	//alert(contry_code.length);
	if(contry_code.length == 1)
		operator_code.select();
}

//////////////////////////////////////////////////////////////////////////
// Изменение кода оператора                                             //
//////////////////////////////////////////////////////////////////////////

function mobile_phone_operator_code_on_change( id )
{
	mobile_phone_update_field(id);
}

function mobile_phone_operator_code_on_key_up( id )
{
	var operator_code = document.getElementById("mobile_phone_operator_code_" + id).value;
	var number = document.getElementById("mobile_phone_number_" + id);
	if(operator_code.length == 3)
	{
		number.select();
	}
}

//////////////////////////////////////////////////////////////////////////
// Изменение номера                                                     //
//////////////////////////////////////////////////////////////////////////

function mobile_phone_number_on_change( id )
{
	mobile_phone_update_field(id);
}