﻿// JScript File
function getLocations() {
    var country = $('Country').value;//this.options[this.selectedIndex].value;
    if(country != 'Select Country') {
        new Ajax.Request("../../showroom/locations.aspx?country="+country, {
	            method: 'get',
	            onSuccess: function(transport) {
    	        
	                var select = $("Location");
                   
                    // clear previous data
                    select.options.length = 1;
                     
                    //alert(transport.responseText);
                    var locations = transport.responseText.split("~~");
                    for(var i=0; i<locations.length; i++) {
                        if(locations[i] != '' || locations[i] != ' ' || locations[i] != null) {
                            var option = document.createElement('option');
                            
                            option.text = locations[i];
                            try
                            {
                                select.add(option,null); // standards compliant
                            }
                            catch(ex)
                            {
                                select.add(option); // IE only
                            }
                        }
                    }
    	            
                }
        });
    }
}
// JScript File
function getLocationsPreSel(preselection) {
    var country = $('Country').value;//this.options[this.selectedIndex].value;
    if(country != 'Select Country') {
        new Ajax.Request("../../showroom/locations.aspx?country="+country, {
	            method: 'get',
	            onSuccess: function(transport) {
    	        
	                var select = $("Location");
                   
                    // clear previous data
                    select.options.length = 1;
                     
                    //alert(transport.responseText);
                    var locations = transport.responseText.split("~~");
                    for(var i=0; i<locations.length; i++) {
                        if(locations[i] != '' || locations[i] != ' ' || locations[i] != null) {
                            var option = document.createElement('option');
                            
                            option.text = locations[i];
                            
                            if(option.text == preselection) {
                                option.selected = true;
                            } 
                            try
                            {
                                select.add(option,null); // standards compliant
                            }
                            catch(ex)
                            {
                                select.add(option); // IE only
                            }
                        }
                    }
    	            
                }
        });
    }
}

