$(document).ready(function() {
    var oldProductSelected = 0;
	$('#compare_selection > select').live('click', function(){
        if ($('#compare_selection option:selected').val() == oldProductSelected) return;
        else oldProductSelected = $('#compare_selection option:selected').val();
		var legacyid = $(this).val();
		if(legacyid=="") return;

		$.ajax({
            url:'/ajax/comparison/get-legacy-firmware/legacy_id/'+legacyid,
            type:'GET',
            dataType:'html',
            success : function(data) {
                $("#results_box > #compare_result").html(data);
            },
            error : function(xhr) {
            	ErrorMessage(xhr);
            }            
        });
	});
});
