﻿(function()
{
	var rc = /^((\/[a-zA-Z-]+)+)(\/default.aspx(\/([a-zA-Z0-9-]+)(\/([a-zA-Z0-9-]+))?)?)?$/;
	var rs = /^\/search\.aspx(\/([a-zA-Z0-9-]+)(\/([a-zA-Z0-9-]+))?)?$/;

	window.setst = function(dsid)
	{
		var ds = document.getElementById(dsid);
		var s = ds[ds.selectedIndex].value;
		var a = rc.exec(location.pathname);
		if(a != null)
		{
			location.href = a[1] + ((s != "") ? ("/default.aspx" + "/" + s) : "") + location.search;
			return;
		}
		a = rs.exec(location.pathname);
		if( a != null )
		{
			location.href = "/search.aspx" + ((s != "") ? ("/" + s) : "") + location.search;
			return;
		}
	}

	window.setct = function(dcid)
	{
		var dc = document.getElementById(dcid);
		var c = dc[dc.selectedIndex].value;
		var a = rc.exec(location.pathname);
		if( a != null)
		{
			location.href = a[1] + "/default.aspx/" + a[5] + ((c != "") ? ("/" + c) : "") + location.search;
			return;
		}
		a = rs.exec(location.pathname);
		if( a != null )
		{
			location.href = "/search.aspx/" + a[2] + ((c != "") ? ("/" + c) : "") + location.search;
			return;
		}
	}
})();
