function RefreshModelsCity(nhasanxuatSelectBox , kieu_SelectBox)
{
	var list_nhasanxuat = eval("theform." + nhasanxuatSelectBox);
	var list_kieu = eval("theform." + kieu_SelectBox);	
	var nhasanxuat_id = list_nhasanxuat.options[list_nhasanxuat.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	list_kieu.length = 0 ;				
	var strChildKieuList = theform.ModelList.value;
	arrChildren = strChildKieuList.split("|")	;
	
	var x = 0;
	list_kieu.options[x] = new Option("-- Toàn quốc --", "0");
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{
		arrTemp = arrChildren[i].split("~");
		if (nhasanxuat_id == arrTemp[0]) 
		{
			list_kieu.options[x] = new Option(arrTemp[2], arrTemp[1]);
			x++;
		}
	}
}


function RefreshModelsDistr(nhasanxuatSelectBox , kieu_SelectBox)
{
	var list_nhasanxuat = eval("theform." + nhasanxuatSelectBox);
	var list_kieu = eval("theform." + kieu_SelectBox);	
	var nhasanxuat_id = list_nhasanxuat.options[list_nhasanxuat.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	list_kieu.length = 0 ;				
	var strChildKieuList = theform.ModelDisList.value;
	arrChildren = strChildKieuList.split("|")	;
	
	var x = 0;
	list_kieu.options[x] = new Option("-- Quận/huyện --", "0");
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{
		arrTemp = arrChildren[i].split("~");
		if (nhasanxuat_id == arrTemp[0]) 
		{
			list_kieu.options[x] = new Option(arrTemp[2], arrTemp[1]);
			x++;
		}
	}
}


function RefreshModelsCityEn(nhasanxuatSelectBox , kieu_SelectBox)
{
	var list_nhasanxuat = eval("theform." + nhasanxuatSelectBox);
	var list_kieu = eval("theform." + kieu_SelectBox);	
	var nhasanxuat_id = list_nhasanxuat.options[list_nhasanxuat.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	list_kieu.length = 0 ;				
	var strChildKieuList = theform.ModelList.value;
	arrChildren = strChildKieuList.split("|")	;
	
	var x = 0;
	list_kieu.options[x] = new Option("-- Nationwide --", "0");
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{
		arrTemp = arrChildren[i].split("~");
		if (nhasanxuat_id == arrTemp[0]) 
		{
			list_kieu.options[x] = new Option(arrTemp[2], arrTemp[1]);
			x++;
		}
	}
}

function RefreshModelsDistrEn(nhasanxuatSelectBox , kieu_SelectBox)
{
	var list_nhasanxuat = eval("theform." + nhasanxuatSelectBox);
	var list_kieu = eval("theform." + kieu_SelectBox);	
	var nhasanxuat_id = list_nhasanxuat.options[list_nhasanxuat.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	list_kieu.length = 0 ;				
	var strChildKieuList = theform.ModelDisList.value;
	arrChildren = strChildKieuList.split("|")	;
	
	var x = 0;
	list_kieu.options[x] = new Option("--  	District --", "0");
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{
		arrTemp = arrChildren[i].split("~");
		if (nhasanxuat_id == arrTemp[0]) 
		{
			list_kieu.options[x] = new Option(arrTemp[2], arrTemp[1]);
			x++;
		}
	}
}


function RefreshModelsNew(nhasanxuatSelectBox , kieu_SelectBox)
{	
	var list_nhasanxuat = eval("theformNew." + nhasanxuatSelectBox);
	var list_kieu = eval("theformNew." + kieu_SelectBox);	
	var nhasanxuat_id = list_nhasanxuat.options[list_nhasanxuat.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	
	list_kieu.length = 0 ;				
	var strChildKieuList = theformNew.ModelListNew.value;	
	arrChildren = strChildKieuList.split("|")	;
	
	var x = 0;
	list_kieu.options[x] = new Option("Model xe", "0");
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{
		arrTemp = arrChildren[i].split("~");
		if (nhasanxuat_id == arrTemp[0]) 
		{
			list_kieu.options[x] = new Option(arrTemp[2], arrTemp[1]);
			x++;
		}
	}
}


function RefreshModelslist(nhasanxuatSelectBox , kieu_SelectBox)
{	
	var list_nhasanxuat = eval("theformlist." + nhasanxuatSelectBox);
	var list_kieu = eval("theformlist." + kieu_SelectBox);	
	var nhasanxuat_id = list_nhasanxuat.options[list_nhasanxuat.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	
	list_kieu.length = 0 ;				
	var strChildKieuList = theformlist.ModelListForm.value;	
	arrChildren = strChildKieuList.split("|")	;
	
	var x = 0;
	list_kieu.options[x] = new Option("Model xe", "0");
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{
		arrTemp = arrChildren[i].split("~");
		if (nhasanxuat_id == arrTemp[0]) 
		{
			list_kieu.options[x] = new Option(arrTemp[2], arrTemp[1]);
			x++;
		}
	}
}

function RefreshProducts(kieu_SelectBox , loai_SelectBox)
{
	var list_kieu = eval("theform." + kieu_SelectBox);
	var list_loai = eval("theform." + loai_SelectBox);	
	var kieu_id = list_kieu.options[list_kieu.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	list_loai.length = 0 ;				
	var strChildLoaiList = theform.ProductList.value;
	arrChildren = strChildLoaiList.split("|")	;
	
	var x = 0;
	list_loai.options[x] = new Option("---Chọn loại xe---", "0");
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{
		arrTemp = arrChildren[i].split("~");
		if (kieu_id == arrTemp[0]) 
		{
			list_loai.options[x] = new Option(arrTemp[2], arrTemp[1]);
			x++;
		}
	}
}





function GenerateModels(theSelectedModel , theManufacturesSelectBox , theModelsSelectBox)
{
	var listManufactures = eval("theform." + theManufacturesSelectBox);
	var listModels = eval("theform." + theModelsSelectBox);	
	var ManufactureID = listManufactures.options[listManufactures.selectedIndex].value;
	
	var arrChildren;
	var arrTemp	;
	var i;
		
	listModels.length = 0 ;				
	var strChildModelsList = theform.ModelList.value;
	arrChildren = strChildModelsList.split("|")	;
	
	var x = 0;
	
	listModels.options[x] = new Option("model xe", "0");
	
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{

		arrTemp = arrChildren[i].split("~");
		if (ManufactureID == arrTemp[0]) 
		{
			listModels.options[x] = new Option(arrTemp[2], arrTemp[1]);
			
			listModels.options[x].selected = (arrTemp[1] == theSelectedModel) ? (true) : (false);
			
			x++;
		}
		
	}

}

function GenerateModelsList(theSelectedModel,theSelectedManufac , theManufacturesSelectBox , theModelsSelectBox)
{
	var listManufactures = eval("theformlist." + theManufacturesSelectBox);
	var listModels = eval("theformlist." + theModelsSelectBox);	
	var ManufactureID = theSelectedManufac;
	
	var arrChildren;
	var arrTemp	;
	var i;
		
	listModels.length = 0 ;				
	var strChildModelsList = theformlist.ModelListForm.value;
	arrChildren = strChildModelsList.split("|")	;
	
	var x = 0;
	
	listModels.options[x] = new Option("model xe", "0");
	
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{

		arrTemp = arrChildren[i].split("~");		
		if (ManufactureID == arrTemp[0]) 
		{
			listModels.options[x] = new Option(arrTemp[2], arrTemp[1]);						
			listModels.options[x].selected = (arrTemp[1] == theSelectedModel) ? (true) : (false);
			
			x++;
		}
		
	}

}

function GenerateProducts(theSelectedProduct , theModelsSelectBox , theProductsSelectBox)
{
	var listModels = eval("theform." + theModelsSelectBox);
	var listProducts = eval("theform." + theProductsSelectBox);	
	var ModelID = listModels.options[listModels.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	listProducts.length = 0 ;				
	var strChildProductsList = theform.ProductList.value;
	arrChildren = strChildProductsList.split("|")	;
	
	var x = 0;
	
	listProducts.options[x] = new Option("loại xe", "0");
	
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{

		arrTemp = arrChildren[i].split("~");
		if (ModelID == arrTemp[0]) 
		{
			listProducts.options[x] = new Option(arrTemp[2], arrTemp[1]);
			
			listProducts.options[x].selected = (arrTemp[1] == theSelectedProduct) ? (true) : (false);
			
			x++;
		}
		
	}

}


// fact
function RefreshFactNew(nhasanxuatSelectBox , kieu_SelectBox)
{	
	var list_nhasanxuat = eval("theformNew." + nhasanxuatSelectBox);
	var list_kieu = eval("theformNew." + kieu_SelectBox);	
	var nhasanxuat_id = list_nhasanxuat.options[list_nhasanxuat.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	
	list_kieu.length = 0 ;				
	var strChildKieuList = theformNew.ModelFactNew.value;	
	arrChildren = strChildKieuList.split("|")	;
	
	var x = 0;
	list_kieu.options[x] = new Option("Hãng Xe", "0");
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{
		arrTemp = arrChildren[i].split("~");
		if (nhasanxuat_id == arrTemp[0]) 
		{
			list_kieu.options[x] = new Option(arrTemp[2], arrTemp[1]);
			x++;
		}
	}
}

function RefreshFactOld(nhasanxuatSelectBox , kieu_SelectBox)
{	
	var list_nhasanxuat = eval("theform." + nhasanxuatSelectBox);
	var list_kieu = eval("theform." + kieu_SelectBox);	
	var nhasanxuat_id = list_nhasanxuat.options[list_nhasanxuat.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	
	list_kieu.length = 0 ;				
	var strChildKieuList = theform.ModelFactOld.value;	
	arrChildren = strChildKieuList.split("|")	;
	
	var x = 0;
	list_kieu.options[x] = new Option("Hãng Xe", "0");
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{
		arrTemp = arrChildren[i].split("~");
		if (nhasanxuat_id == arrTemp[0]) 
		{
			list_kieu.options[x] = new Option(arrTemp[2], arrTemp[1]);
			x++;
		}
	}
}

// MEMBER
function RefreshlistCat(nhasanxuatSelectBox , kieu_SelectBox)
{
	var list_nhasanxuat = eval("theformlist." + nhasanxuatSelectBox);
	var list_kieu = eval("theformlist." + kieu_SelectBox);	
	var nhasanxuat_id = list_nhasanxuat.options[list_nhasanxuat.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	list_kieu.length = 0 ;				
	var strChildKieuList = theformlist.ModelListCatForm.value;
	arrChildren = strChildKieuList.split("|")	;
	
	var x = 0;
	list_kieu.options[x] = new Option("----- Loại xe -----", "0");
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{
		arrTemp = arrChildren[i].split("~");
		if (nhasanxuat_id == arrTemp[0]) 
		{
			list_kieu.options[x] = new Option(arrTemp[2], arrTemp[1]);
			x++;
		}
	}
}

function RefreshlistFact(nhasanxuatSelectBox , kieu_SelectBox)
{	
	var list_nhasanxuat = eval("theformlist." + nhasanxuatSelectBox);
	var list_kieu = eval("theformlist." + kieu_SelectBox);	
	var nhasanxuat_id = list_nhasanxuat.options[list_nhasanxuat.selectedIndex].value;
	var arrChildren;
	var arrTemp	;
	var i;
		
	
	list_kieu.length = 0 ;				
	var strChildKieuList = theformlist.ModelListCatTypeForm.value;	
	arrChildren = strChildKieuList.split("|")	;
	
	var x = 0;
	list_kieu.options[x] = new Option("Hãng Xe", "0");
	x++;
	
	for (i = 0; i< arrChildren.length; i++)
	{
		arrTemp = arrChildren[i].split("~");
		if (nhasanxuat_id == arrTemp[0]) 
		{
			list_kieu.options[x] = new Option(arrTemp[2], arrTemp[1]);
			x++;
		}
	}
}

