function update_trench_age(){
	new Ajax.Updater('list_trench_interval', 'includes/ajax/analysis_options_trends_age.php', {
		parameters: { age_from: $F('form_age_from'),age_interval: $F('form_age_interval') }
	});
}

function update_country(){
	new Ajax.Updater('country_id', 'includes/ajax/analysis_options_trends_country.php', {
		parameters: { country: $F('country_id') ,incidence: $F('type_0'),mortality: $F('type_1')},
		 onComplete: function(){ update_year(); }
	});
}

function update_year(){
	update_year_min();
	update_year_max();
	$('year_range_lenght').hide();
}

function update_last_year(){
	new Ajax.Updater('last_date', 'includes/ajax/analysis_options_trends_last_year_period.php', {
		parameters: { country: $F('country_id') ,incidence: $F('type_0'),mortality: $F('type_1'),last_date:$F('last_date')}
	});
}

function update_year_min(){
	new Ajax.Updater('min_date', 'includes/ajax/analysis_options_trends_age_period.php', {
		parameters: { country: $F('country_id') ,incidence: $F('type_0'),mortality: $F('type_1'),max_date:$F('max_date'),min_date:$F('min_date'),update_date:'min'}
	});
}

function update_year_max(){
	new Ajax.Updater('max_date', 'includes/ajax/analysis_options_trends_age_period.php', {
		parameters: { country: $F('country_id') ,incidence: $F('type_0'),mortality: $F('type_1'),max_date:$F('max_date'),min_date:$F('min_date'),update_date:'max'}
	});
}

function update_sex(){
	new Ajax.Updater('sex_choice', 'includes/ajax/analysis_options_age_sex.php', {
		parameters: { cancer:$F('cancer_id') }
	});
}

function update_cmp_year(){
	new Ajax.Updater('year_range_lenght', 'includes/ajax/analysis_options_cmp_year.php', {
		parameters: { min_date:$F('min_date'),max_date:$F('max_date') }
	});
	$('year_range_lenght').show();
}

function toggle_graph_birth_cohort(display_graph){
	$('img_arithmetic').hide();
	$('img_logarithmic').hide();
	$('img_age_cohort_logarithmic').hide();
	$('img_age_cohort_arithmetic').hide();
	$('img_cohort_age_logarithmic').hide();
	$('img_cohort_age_arithmetic').hide();
	new Effect.Appear(display_graph,{duration:0.5});
	$('img_arithmetic_link').className="";
	$('img_logarithmic_link').className="";
	$('img_age_cohort_logarithmic_link').className="";
	$('img_age_cohort_arithmetic_link').className="";
	$('img_cohort_age_logarithmic_link').className="";
	$('img_cohort_age_arithmetic_link').className="";
	$(display_graph+'_link').className="selected";
	return(false);
}

function selectall(name,checked){
	var toselect = document.getElementsByName(name);
	var numbertoselect = toselect.length;
	for(i=0;i<numbertoselect;i++){
		toselect[i].checked=checked;
	}
}