function paging(page) 
{
	window.location.href = window.location.href.replace(/\/?([0-9]+)?\/?$/, '/' + page);
}

function appendAnchor(anchor, url)
{
	url = url || window.location.href;
	url = url.replace(/#.*$/, '');
	
	return url + '#' + anchor;
}

function searchBoxInit(id)
{
	var searchBox = $(id);
	if (searchBox) {
		searchBox.addEvent('submit', function(e) {
			var searchText = searchBox.getElements('input[type=text]').get('value').toString();
			if (searchText.length > 0) {
				var action = searchBox.get('action') + searchText;
				location.replace(action);
			}
			e.stop();
		});
	}
}
