/**
* This method is tied to the select box 'sortingSelect'.  When its state changes, 
* this method will change the current page's URL to the destination in the sort select. 
**/
function onSortChange() {
    // find the select
	select = $("sortingSelect")
	
	// grab the destination string
	destination = select[select.selectedIndex].value;
		
	// if it exists (i.e. is not the "Select One:" option
	if (destination && destination!="noop") {
		
		$j.cookie('orderBy', destination, {expires: 7, path: '/'});
		$j.cookie('searchType', "newsort", {expires: 1, path: '/'});
		
		// then go there
		doSort();
	}
}


function doSort() {
	$j.cookie('newSort', 1);
	window.location = window.location;
}

/**
 * Sets the page size via a cookie.
 */
function doSetPageSize(action, pageSizeSelect, defaultPageSize, defaultAction) {
	var newPageSize = Number(pageSizeSelect.options[pageSizeSelect.selectedIndex].text);
	
	$j.cookie('pageSize', newPageSize, {expires: 7, path: '/'});
	
	doSort();
}


/**
 * Let's make sure the new sort cookie destroyed
 * It should only be sent when the client performs
 * a new sort
 */
 $j.cookie('newSort', null);
