﻿
function loadCategory(area, category) {
	var a = $get(area);
	var c = $get(category);

	var url = "/";
	if(a)
		url += a.selectedIndex == 0 ? "" : a.options[a.selectedIndex].value + "/";
	else
		url += area.length == 0 ? "" :  area + "/";

	if(c)
		url += c.options[c.selectedIndex].value;
	else
		url += category;

	document.location.href = url.toLowerCase();
}

function fixpath(path) { // can't use because of poor safari regex support

	path = trim(path);
	path = path.replace(/\/~*/g, "-");
	path = path.replace(/, /g, ",");
	path = path.replace(/&/g, "and");
	path = path.replace(/[\u00A0\s]+/g, "_");

	return path;
}

function trim(str) {
	return str.replace(/^[\s\u00A0]+/g, "").replace(/[\s\u00A0]+$/g, "")
}

