﻿<!--
function StateChanged()
{
//alert('StateChanged');
    var os = document.forms[0].state;
    var oc = document.forms[0].city;
    var idx = os.selectedIndex;
    var id = os.options[idx].value;  //arg
    if (id == 0) {
        ClearCity();
        oc.options[0] = new Option("请选择城市", 0);
        oc.style.display = "inline";
        document.forms[0].othercity.style.display = "none";
        return;
    }
    var name = os.options[idx].text;
    document.forms[0].statename.value = name;
    if (name == "其它") {
        ClearCity();
        oc.options[0] = new Option("请选择城市", 0);
        oc.style.display = "none";
        document.forms[0].othercity.style.display = "inline";
        return;
    }
    oc.style.display = "inline";
    document.forms[0].othercity.style.display = "none";
    ToChangeCity(id, "");
}
function ReceiveCity(arg, context)
{
//alert('ReceiveCity, arg=' + arg);
    var len = arg.length;
    if (len<=0) return;
    
    ClearCity();
    var j=0, count=0;
    var s;
    var i = arg.indexOf(",");
    var o = document.forms[0].city;
    while(i>=0)
    {
        s = arg.substring(j,i);
        o.options[count++] = new Option(s, s);
        j=i+1;
        i = arg.indexOf(",", j);
    }
    s = arg.substring(j,len);
    o.options[count] = new Option(s, s);
}
function ClearCity(obj)
{
    obj = document.forms[0].city;
    var i, len=obj.length;
	if (len>0) {
		for(i=len-1; i>=0; i--) {
			obj.options[i] = null;
		}
	}
}
function EnableInput()
{
    document.forms[0].state.disabled = false;
    document.forms[0].city.disabled = false;
    document.forms[0].othercity.readOnly = false;    
}
//-->

