function onMouseOverProductBtn() {
	var product_btn = document.getElementById("sort_product_img");
	product_btn.old_src = product_btn.src;
	product_btn.src = sort_product_on_src;
}
function onMouseOutProductBtn() {
	var product_btn = document.getElementById("sort_product_img");
	product_btn.src = product_btn.old_src;
}
function onMouseOverDoctypeBtn() {
	var doctype_btn = document.getElementById("sort_doctype_img");
	doctype_btn.old_src = doctype_btn.src;
	doctype_btn.src = sort_doctype_on_src;
}
function onMouseOutDoctypeBtn() {
	var doctype_btn = document.getElementById("sort_doctype_img");
	doctype_btn.src = doctype_btn.old_src;
}

function openAll() {
	openCloseAll(true);
}
function closeAll() {
	openCloseAll(false);
}
function openCloseAll(expand) {
	// Expand/Collapse products
	openCloseSection("product", expand);
	
	// Expand/Collapse models
	openCloseSection("model", expand);
	
	// Expand/Collapse categories
	openCloseSection("category", expand);
}
function openCloseSection(section_name, expand) {
	var success = true;
	var id = 1;
	while (success) {
		var divId = section_name + "_div_" + id;
		var imgId = section_name + "_img_" + id;
		success = doExpandSpecific(divId, imgId, expand);
		id++;
	}
}

function doExpand(divId, imgId) {
	doExpandSpecific(divId, imgId, null);
}

function doExpandSpecific(divId, imgId, expand) {
	var success = false;
	var divObj = document.getElementById(divId);
	var expandImg = document.getElementById(imgId);
	if (divObj != null && expandImg != null) {
		if (expand == null) {
			expand = (divObj.style.display == "none");
		}
		if (expand) {
			divObj.style.display = "";
			expandImg.src = collapse_src;
		} else {
			divObj.style.display = "none";
			expandImg.src = expand_src;
		}
		success = true;
	}
	return success;
}
