<!--
/* scripts for EOS product_search */

function set_search_type(str_search_type, str_search_form)
{

	// reset search category id's
	if (str_search_form =='product')
	{
		set_field_value('product_search', 'int_product_category1_id', 0);
		set_field_value('product_search', 'int_product_category2_id', 0);
		set_field_value('product_search', 'str_product_category1', '');
		set_field_value('product_search', 'str_product_category2', '');
		set_field_value('product_search', 'str_search_type', str_search_type);
	}
	
	if (str_search_form =='customer')
	{
		set_field_value('customer_search', 'str_search_type', str_search_type);
	}
	
}


// function which based on users selection sets category and resubmits page
function get_category($int_category_level, $int_category)
{
	//alert('get_category');
	set_field_value('product_search', 'int_product_category'+$int_category_level+'_id', $int_category);
	//alert(get_field_value('product_search', 'int_product_category'+$int_category_level+'_id'));
	document.forms['product_search'].submit();
}


function set_category($int_category_level, $str_product_category)
{
	set_field_value('product_search', 'str_product_category'+$int_category_level, $str_product_category);
	reset_manufacturer();
}


function search(str_type)
{
	switch (str_type)
	{
	case 'adv':
		if( validateForm('product_search', 'str_general_search') ) { reset_manufacturer(); document.forms['product_search'].submit() ;}
		break;
	case 'att':
		reset_manufacturer();
		set_search_type('attribute_search','product');
		document.forms['product_search'].submit();
		break;
	}
}

function reset_manufacturer()
{
	set_field_value('product_search', 'int_product_manufacturer_id', 0);
}


function get_results_page(int_form_no, int_page)
{
	//alert(document.forms['sel-page'+int_form_no].action);
	cur_search_str = document.forms['sel-page'+int_form_no].action+'&int_cur_page='+int_page;
	document.location.href=cur_search_str;
}


function get_manufacturer(int_form_no, int_product_manufacturer_id)
{
	set_field_value('product_search', 'int_product_manufacturer_id', int_product_manufacturer_id);
	cur_search_str = document.forms['sel-page'+int_form_no].action;
	cur_search_str = replVal(cur_search_str, "int_product_manufacturer_id=\\d*", "int_product_manufacturer_id="+int_product_manufacturer_id);
	document.location.href=cur_search_str;
}

-->
