JavaScript Country State List

My two cents on project http://sourceforge.net/projects/countries/

I just added default select

Diff:
function print_country(country_id,selected){
var indexSelected=0;
// given the id of the tag as function argument, it inserts tags
var option_str = document.getElementById(country_id);
var x, i=0;
for(x in country_arr){
option_str.options[i++] = new Option(country_arr[x],country_arr[x]);
if(selected && country_arr[x] == selected){
//alert(selected);
indexSelected = i-1;
}

}
if(selected){
option_str.selectedIndex = indexSelected;
print_state('state',indexSelected);
}

}

Use:
print_country("country","Brazil");

Project information
http://bdhacker.wordpress.com/2009/11/21/adding-dropdown-country-state-list-dynamically-into-your-html-form-by-javascript/

Enjoy!