function country2City(countryID)

	{
	var intCityChild ; 
	var strCountryID;
	var intRow; 
	intRow			= 0 ;
	intCityChild	= document.fmMain.CITY.options.length;
	strCountryID	= document.fmMain.COUNTRY.options[document.fmMain.COUNTRY.selectedIndex].value;
	//remove all of the city field's option tag
	for(i = 0 ; i < intCityChild ; i++ )
		{
		document.fmMain.CITY.options[0] = null;
		}			
	//judge the strCountryID length
	//switch(strCountryID.length){
	//case 1 :
		//strCountryID = "00" + strCountryID ;
		//break;
	//case 2 :
	//	strCountryID = "0" + strCountryID ;
	//	break;
	//}
				
	var intToken = 0;
	var intLength = Math.round((document.fmCity.elements.length / 2));
	var intBegin = 0;

	//dichotomy
	if(document.fmCity.elements[intLength].name < strCountryID)
		{
		intBegin = intLength;
		intLength = document.fmCity.elements.length ;
		}
	else if(document.fmCity.elements[intLength].name > strCountryID)
		{
		intBegin = 0 ;
		}

	//add new option tag to city field
	for(var i = intBegin ; i < intLength ; i++ )
		{
		if(document.fmCity.elements[i].name == strCountryID)
			{
			//for stop the non necessary process
			if(intToken == 0) intToken = strCountryID ;
			if(intToken != strCountryID) return false;
			document.fmMain.CITY.options[intRow] = new Option(document.fmCity.elements[i].value , document.fmCity.elements[i].id);
			intRow ++ ;
			}
		}
		
		//set the default value
		document.fmMain.CITY.options[0].selected = true;
	}

//-->
function varifyCityFromCountry(){
	country2City("city");
	if(fmCity.catchSelectedCityIndex.value != "")
		document.fmMain.CITY.options[fmCity.catchSelectedCityIndex.value].selected = true;
}

function catchCityIndex(){
	fmCity.catchSelectedCityIndex.value = document.fmMain.CITY.selectedIndex;
}


