function sortProduct(url) {
	if (url.indexOf('?') > 0) {
		location.href = url + '&SortBy=Number'; 
	} else {
		location.href = url + '?SortBy=Number'; 
	}
}


function sortColor(url) {
	if (url.indexOf('?') > 0) {
		location.href = url + '&SortBy=Weight'; 
	} else {
		location.href = url + '?SortBy=Weight'; 
	}
}

function sortSize(url) {
	if (url.indexOf('?') > 0) {
		location.href = url + '&SortBy=ShortDescription'; 
	} else {
		location.href = url + '?SortBy=ShortDescription'; 
	}
}

function filterSize(url,size) {
	if (url.indexOf('?') > 0) {
		location.href = url + '&eComSearch=1&ProductShortDescription='+size; 
	} else {
		location.href = url + '?eComSearch=1&ProductShortDescription='+size; 
	}
}

function nextPage(url) {
	var lowerurl = url.toLowerCase();
	var start = lowerurl.indexOf("pagenum=");
	if (start > 0) {
		var end = url.indexOf('&',start);
		if (end == -1)
			end = url.length;

		equal = url.indexOf('=',start);

		var num = new Number(url.substr(equal+1,end-equal-1));
		num += 1;

		newurl = url.substr(0,equal+1) + num + url.substr(end);
		location.href = newurl; 
	} else {
		if (url.indexOf('?') > 0) {
			location.href = url + '&PageNum=2'; 
		} else {
			location.href = url + '?PageNum=2'; 
		}
	}
}

function prevPage(url) {
	var lowerurl = url.toLowerCase();
	var start = lowerurl.indexOf("pagenum=");
	if (start > 0) {
		var end = url.indexOf('&',start);
		if (end == -1)
			end = url.length;

		equal = url.indexOf('=',start);

		var num = new Number(url.substr(equal+1,end-equal-1));
		num -= 1;

		newurl = url.substr(0,equal+1) + num + url.substr(end);
		location.href = newurl; 
	} else {
		//should never occur
		if (url.indexOf('?') > 0) {
			location.href = url + '&PageNum=1'; 
		} else {
			location.href = url + '?PageNum=1'; 
		}
	}
}


