﻿
function SelectedItemChanged(industriesId, productsId, countriesId, fromYearsId, toYearsId, prevItemId) {
	var selIndustry = $("#" + industriesId + " option:selected").attr('value');
	var selProduct = $("#" + productsId + " option:selected").attr('value');
	var selCountry = $("#" + countriesId + " option:selected").attr('value');
	var selFromYear = $("#" + fromYearsId + " option:selected").attr('value');
	var selToYear = $("#" + toYearsId + " option:selected").attr('value');
	var prevValue = $("#" + prevItemId).attr('value');
	var requestStr = dataUrl 
			+ "&" + industriesId + "=" + selIndustry
			+ "&" + productsId + "=" + selProduct
			+ "&" + countriesId + "=" + selCountry
			+ "&" + fromYearsId + "=" + selFromYear
			+ "&" + toYearsId + "=" + selToYear
			+ "&" + prevItemId + "=" + prevValue;
	$.ajax(
	{
		type: 'GET',
		url: requestStr,
		success: function(data) {
			UpdateSelector(data);
		}
	});
}

function UpdateSelector(data) {
	$('#dataselector').replaceWith(data);
	RemoveData();
}
