function new_city(sel)
{
	document.getElementById('city_other').style.display = sel.value == 0 ? 'block' : 'none';	
}

function new_country(sel)
{
	if (sel.value == 133)
	{
		document.getElementById('city_select').style.display = 'block';
		new_city(document.getElementById('city_select'));
	}
	else
	{
		document.getElementById('city_select').style.display = 'none';
		document.getElementById('city_other').style.display = 'block';		
	}	
}

function add_education()
{
	education_count += 1;
	options = "";
	var d = new Date();
	for (var i = d.getFullYear(); i >= 1950; i--) options += '<option value="' + i + '">' + i + '</option>';
	change_outer_html('new_education', 'span', '<div class="multiblock" id="education_' + education_count + '"><div class="del_link"><span class="local_link" onclick="javascript:del_education(' + education_count + ');">Удалить</span></div><select name="fields[education][' + education_count + '][cve_s_year]">' + options + '</select>&nbsp;&mdash;&nbsp;<select name="fields[education][' + education_count + '][cve_e_year]"><option value="now">наст. вр.</option>' + options + '</select><div class="long_input"><label for="fields[education][' + education_count + '][cve_uni]">Учебное заведение</label><input type="text" name="fields[education][' + education_count + '][cve_uni]"></div><div class="long_input"><label for="fields[education][' + education_count + '][cve_spec]">Специальность</label><input type="text" name="fields[education][' + education_count + '][cve_spec]"></div></div><span id="new_education">')
}

function del_education(id)
{
	change_outer_html('education_' + id, 'div', '');
}

function add_exp()
{
	exp_count += 1;
	options = "";
	var d = new Date();
	for (var i = d.getFullYear(); i >= 1950; i--) options += '<option value="' + i + '">' + i + '</option>';
	change_outer_html('new_exp', 'span', '<div class="multiblock" id="exp_' + exp_count + '"><div class="del_link"><span class="local_link" onclick="javascript:del_exp(' + exp_count + ');">Удалить</span></div><select name="fields[experience][' + exp_count + '][cvx_s_year]">' + options + '</select>&nbsp;&mdash;&nbsp;<select name="fields[experience][' + exp_count + '][cvx_e_year]"><option value="now">наст. вр.</option>' + options + '</select><div class="long_input"><label for="fields[experience][' + exp_count + '][cvx_company]">Компания</label><input type="text" name="fields[experience][' + exp_count + '][cvx_company]"></div><div class="long_input"><label for="fields[experience][' + exp_count + '][cvx_position]">Должность</label><input type="text" name="fields[experience][' + exp_count + '][cvx_position]"></div><div class="long_input"><label for="fields[experience][' + exp_count + '][cvx_duties]">Основные обязанности, достижения</label><textarea name="fields[experience][' + exp_count + '][cvx_duties]"></textarea><span class="comment">Каждая строка будет отформатирована в виде пункта списка</span></div></div><span id="new_exp">')
}

function del_exp(id)
{
	change_outer_html('exp_' + id, 'div', '');
}

