        Event.observe(window, 'load', init, false);
        wasDomestic = 'applesauce';
        function init()
        {
                if($('ShippingCountry'))$('ShippingCountry').observe('change',function(){ toggleStates(); updateShippingOptions(); });
                if($('ShippingState'))$('ShippingState').observe('change',function(){ toggleStates(); updateShippingOptions(); });
                toggleStates();
                updateShippingOptions();
        }

        function displayShippingOptions(t)
        {
                var shippingContainer = $('ShippingMethod').parentNode;
                shippingContainer.innerHTML = t.responseText;
        }

        function updateShippingOptions()
        {
		if(!$('ShippingCountry')) return false;

		var currentShippingMethod = $('ShippingMethod').value;
		var currentShippingState = '';
		if($('ShippingState')) 
		{
			currentShippingState = $('ShippingState').value;
		}

		var country = ($('ShippingCountry').value == 'United States');

                var shippingCountry = $('ShippingCountry').value;
                var params = "Country="+shippingCountry+"&CurrentShippingMethod="+currentShippingMethod+"&IsUSA="+country+"&ShippingState="+currentShippingState;
                new Ajax.Request("GetShippingOptions.php",{parameters:params,onComplete:displayShippingOptions});

		return true;

		if(!$('ShippingMethod')) return false;
		if(!$('shippingDomesticMethod')) return false;
		if(!$('shippingIntlMethod')) return false;
                var isDomestic = ($('ShippingCountry').value == 'United States');
                if(isDomestic == wasDomestic) return true;
                wasDomestic = isDomestic;
                var sel = $('ShippingMethod');
                var i = 0;
                if(!sel) return false;
                for(i = sel.length - 1; i>=0; i--) if(sel.length)sel.remove(i);
                if(isDomestic)
                {
                        var newsel = $('shippingDomesticMethod');
                }
                else
                {
                        var newsel = $('shippingIntlMethod')
                }
                if(!newsel)
                {
                        var newEl = document.createElement('option');
                        newEl.text = '--No Shipping Methods Available For Selected Destination--';
                        newEl.value = '';
                        try{ sel.add(newEl, null);} // standards complient
                        catch(ex){sel.add(newEl);}  // IE
                        return false;
                }
                 for(i = 0; i < newsel.length; i++)
                {
                        var newEl = document.createElement('option');
                        newEl.text = newsel.options[i].text;
                        newEl.value = newsel.options[i].value;
                        newEl.selected = newsel.options[i].selected;
                        try{ sel.add(newEl, null);} // standards complient
                        catch(ex){sel.add(newEl);}  // IE
                }
                return true;
        }
        function toggleStates()
        {
		if(!$('ShippingCountry')) return false;
                var country = ($('ShippingCountry').value == 'United States');
                if(country)
                {
                        if($('usstates'))$('usstates').show();
                        if($('states')) $('states').show();
                        if($('stateProvince')) $('stateProvince').hide();
                        if($('province')) $('province').hide();
                }
                else
                {
                        if($('usstates')) $('usstates').hide();
                        if($('states')) $('states').hide();
                        if($('stateProvince')) $('stateProvince').show();
                        if($('province')) $('province').show();
                }
                return true;
        }


