function changeLocation() {
document.getElementById("locationIdDiv").innerHTML = '<select name="locationId" id="locationId" onchange="calcUSA()" tabindex="101"><option value="0">--Загрузка--</option></select>';
document.getElementById('locationId').disabled="disabled";
auction = document.getElementById('auctionId').value;
var ajax = new Ajax.Request('/calc/location/',
          {
               method: 'post', 
               parameters: 'auction=' + auction,
               onSuccess: function(transport) {
				   document.getElementById('locationId').disabled="";
				   //alert(document.getElementById('locationId').innerHTML);
                   document.getElementById('locationIdDiv').innerHTML = '<select name="locationId" id="locationId" onchange="calcUSA()" tabindex="101">'+transport.responseText+'</select>';
				   //document.print(transport.responseText);
				   //alert(document.getElementById('locationId').innerHTML);
                        },
               onFailure: function() {
                    alert('Error');
               }
          });
}
function calcUSA() {
document.getElementById('results_usa').innerHTML = '<span  style="color:#CDCDCD"> Загрузка... </span>';
auction = document.getElementById('auctionId').value;
locationid = document.getElementById('locationId').value;
var ajax = new Ajax.Request('/calc/usa/',
          {
               method: 'post', 
               parameters: 'auction=' + auction + '&locationid=' + locationid,
               onSuccess: function(transport) {
                   document.getElementById('results_usa').innerHTML = transport.responseText;
                        },
               onFailure: function() {
                    alert('Error');
               }
          });
}
function changePort() {
document.getElementById('portIdDiv').innerHTML = '<select name="portId" id="portId" onchange="calcSea()" tabindex="101"><option value="0">--Загрузка--</option></select>';
document.getElementById('portId').disabled="disabled";
country = document.getElementById('countryId').value;
var ajax = new Ajax.Request('/calc/port/',
          {
               method: 'post', 
               parameters: 'country=' + country,
               onSuccess: function(transport) {
				   document.getElementById('portId').disabled="";
                   document.getElementById('portIdDiv').innerHTML = '<select name="portId" id="portId" onchange="calcSea()" tabindex="101">'+transport.responseText+'</select>';
                        },
               onFailure: function() {
                    alert('Error');
               }
          });
}
function calcSea() {
document.getElementById('results_sea').innerHTML = '<span  style="color:#CDCDCD"> Загрузка... </span>';
country = document.getElementById('countryId').value;
port = document.getElementById('portId').value;
var ajax = new Ajax.Request('/calc/sea/',
          {
               method: 'post', 
               parameters: 'country=' + country + '&port=' + port,
               onSuccess: function(transport) {
                   document.getElementById('results_sea').innerHTML = transport.responseText;
                        },
               onFailure: function() {
                    alert('Error');
               }
          });
}

