<!--

/*******************************************************************************
*	Function name: SearchProduct(frm)
*	Purpose: search product with criteria
*	Parameter:
*		- frm: form object
*
*	Return: None
*
*	Created Dec 21, 2001 1.45 PM by Weera Kasetsin
*******************************************************************************/
function SearchProduct(frm) {
	var strActionUrl = "";
	var strtmp = "";
	var strtmp2 = "";
	
	if (frm.cmbBrandId.selectedIndex <= 0) {
		alert("Please select brand.");
		frm.cmbBrandId.focus();
		return;
	}
	
	if (frm.cmbBrandId.selectedIndex > 0
		&& frm.cmbCategoryId.selectedIndex <= 0
		&& frm.cmbProductCode.selectedIndex <= 0)
	{
		strActionUrl = "/gallery/search_brand.asp";
		frm.hIsCategory.value = "yes";
	} else if (frm.cmbBrandId.selectedIndex > 0
		&& frm.cmbCategoryId.selectedIndex > 0
		&& frm.cmbProductCode.selectedIndex <= 0)
	{
		strtmp = frm.cmbCategoryId.options[frm.cmbCategoryId.selectedIndex].value;
		strtmp2 = strtmp.substring(0, strtmp.indexOf(";"));
		frm.htmpId.value = strtmp2;
		strtmp = strtmp.substring(strtmp.indexOf(";") + 1);
		
		
		if (strtmp == "C")
			frm.hIsCategory.value = "yes";
		else
			frm.hIsCategory.value = "no";
		
		strActionUrl = "/gallery/search_brand.asp";
		
	} else if (frm.cmbBrandId.selectedIndex > 0
		&& frm.cmbCategoryId.selectedIndex > 0
		&& frm.cmbProductCode.selectedIndex > 0)
	{
		strtmp = frm.cmbCategoryId.options[frm.cmbCategoryId.selectedIndex].value;
		strtmp2 = strtmp.substring(0, strtmp.indexOf(";"));
		frm.htmpId.value = strtmp2;
		strtmp = strtmp.substring(strtmp.indexOf(";") + 1);
		
		
		if (strtmp == "C")
			frm.hIsCategory.value = "yes";
		else
			frm.hIsCategory.value = "no";
		strActionUrl = "/gallery/search_product.asp";
	}
	
	frm.action = strActionUrl;
	frm.submit();
	return;
}

/*******************************************************************************
*	Function name: SearchProductTh(frm)
*	Purpose: search product with criteria
*	Parameter:
*		- frm: form object
*
*	Return: None
*
*	Created Dec 21, 2001 1.45 PM by Weera Kasetsin
*******************************************************************************/
function SearchProductTh(frm) {
	var strActionUrl = "";
	var strtmp = "";
	var strtmp2 = "";
	
	if (frm.cmbBrandId.selectedIndex <= 0) {
		alert("Please select brand.");
		frm.cmbBrandId.focus();
		return;
	}
	
	if (frm.cmbBrandId.selectedIndex > 0
		&& frm.cmbCategoryId.selectedIndex <= 0
		&& frm.cmbProductCode.selectedIndex <= 0)
	{
		strActionUrl = "/gallery/th/search_brand.asp";
		frm.hIsCategory.value = "yes";
	} else if (frm.cmbBrandId.selectedIndex > 0
		&& frm.cmbCategoryId.selectedIndex > 0
		&& frm.cmbProductCode.selectedIndex <= 0)
	{
		strtmp = frm.cmbCategoryId.options[frm.cmbCategoryId.selectedIndex].value;
		strtmp2 = strtmp.substring(0, strtmp.indexOf(";"));
		frm.htmpId.value = strtmp2;
		strtmp = strtmp.substring(strtmp.indexOf(";") + 1);
		
		
		if (strtmp == "C")
			frm.hIsCategory.value = "yes";
		else
			frm.hIsCategory.value = "no";
		
		strActionUrl = "/gallery/th/search_brand.asp";
		
	} else if (frm.cmbBrandId.selectedIndex > 0
		&& frm.cmbCategoryId.selectedIndex > 0
		&& frm.cmbProductCode.selectedIndex > 0)
	{
		strtmp = frm.cmbCategoryId.options[frm.cmbCategoryId.selectedIndex].value;
		strtmp2 = strtmp.substring(0, strtmp.indexOf(";"));
		frm.htmpId.value = strtmp2;
		strtmp = strtmp.substring(strtmp.indexOf(";") + 1);
		
		
		if (strtmp == "C")
			frm.hIsCategory.value = "yes";
		else
			frm.hIsCategory.value = "no";
		strActionUrl = "/gallery/th/search_product.asp";
	}
	
	frm.action = strActionUrl;
	frm.submit();
	return;
}

/*******************************************************************************
*	Function name: ChangeModel(frm, strLinkName)
*	Purpose: view model of the category
*	Parameter:
*		- frm: form object
'*		- strLinkName: destination page
*
*	Return: None
*
*	Created Dec 21, 2001 1.45 PM by Weera Kasetsin
*******************************************************************************/
function ChangeModel(frm, strLinkName) {
	if (frm.cmbModelId.selectedIndex > 0) {
		frm.hModelId.value = frm.cmbModelId.options[frm.cmbModelId.selectedIndex].value;
		frm.action = strLinkName;
		frm.submit();
		return;
	}

	return;
}

/*******************************************************************************
*	Function name: ChangeColor(frm, strLinkName)
*	Purpose: filter product by color
*	Parameter:
*		- frm: form object
'*		- strLinkName: destination page
*
*	Return: None
*
*	Created Dec 21, 2001 1.45 PM by Weera Kasetsin
*******************************************************************************/
function ChangeColor(frm, strLinkName) {
	frm.hColor.value = frm.cmbColor.options[frm.cmbColor.selectedIndex].value;
	frm.action = strLinkName;
	frm.submit();
	return;
}

/*******************************************************************************
*	Function name: ViewSprayType(frm, ProductCode)
*	Purpose: view spray type data
*	Parameter:
*		- frm: form object
'*		- ProductCode
*
*	Return: None
*
*	Created Dec 21, 2001 1.45 PM by Weera Kasetsin
*******************************************************************************/
function ViewSprayType(frm, ProductCode) {
	frm.hProductCode.value = ProductCode;
	frm.action = "/services/ser_sparepart_detail.asp";
	frm.submit();
	return;
}
-->
