var regiondb = new Object()
var citylist = new Object()
regiondb["a"] = [{value:"0", text:"District/Town"}];regiondb[1515] = [{value:"0", text:"District/Town"},{value:"1519", text:"Ba Dinh district"},{value:"1520", text:"Cau Giay district"},{value:"1521", text:"Dong Da district"},{value:"1522", text:"Tay Ho district"},{value:"1523", text:"Hai Ba Trung district"},{value:"1524", text:"Tu Liem district"},{value:"1525", text:"Ha Dong district"},{value:"1526", text:"Hoan Kiem district"},{value:"1527", text:"Hoang Mai district"},{value:"1528", text:"Long Bien district"},{value:"1529", text:"Thanh Xuan district"},{value:"1530", text:"Ba Vi district"},{value:"1531", text:"Chuong My district"},{value:"1532", text:"Dan Phuong district"},{value:"1533", text:"Dong Anh district"},{value:"1534", text:"Gia Lam district"},{value:"1535", text:"Hoai Duc district"},{value:"1536", text:"Me Linh district"},{value:"1537", text:"My Duc district"},{value:"1538", text:"Phu Xuyen district"},{value:"1539", text:"Phuc Tho district"},{value:"1540", text:"Quoc Oai district"},{value:"1541", text:"Soc Son district"},{value:"1542", text:"Thanh Oai district"},{value:"1543", text:"Thanh Tri district"},{value:"1544", text:"Thach That district"},{value:"1545", text:"Thuong Tin district"},{value:"1548", text:"Son Tay town"},{value:"1546", text:"Ung Hoa district"}];citylist[0] = [{value:"a", text:"Province/City"},{value:"1515", text:"Hanoi"}];
function setCities(thanpho,quan,valuequan) {
var newElem;
var chooser = document.getElementById(thanpho);
var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
var cityChooser = document.getElementById(quan);
while (cityChooser.options.length) {
cityChooser.remove(0);
}
var choice = chooser.options[chooser.selectedIndex].value;
var db = regiondb[choice];
if(choice === "") choice = 0;
if (choice != "") {
if(choice == "a"){
cityChooser.disabled = true;
}else{
cityChooser.disabled = false;
}
//alert(choice);
for (var i = 0; i < db.length; i++) {
newElem = document.createElement("option");
newElem.text = db[i].text;
newElem.value = db[i].value;
cityChooser.add(newElem, where);
if(valuequan == db[i].value) cityChooser.options[i].selected = true;
}
}
}
function setListCombo(thanpho,valuetp){
var newElem;
var cityId = document.getElementById(thanpho);
var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
var db = citylist[0];
while (cityId.options.length) {
cityId.remove(0);
}
for (var i = 0; i < db.length; i++) {
newElem = document.createElement("option");
newElem.text = db[i].text;
newElem.value = db[i].value;
cityId.add(newElem, where);
if(valuetp == db[i].value) cityId.options[i].selected = true;
}
}