function changePrefs(param, value)
{
    var url = window.location.href;
  	 if ( url.indexOf("?") > -1 )
    	url = url.substr(0, url.indexOf("?"));

    url += "?" + param + "=" + value;
	//alert ("Ready to " + param + " using " + value  + " with url: " + url);
    window.location.assign(url);
}

function checkXDomainLinks() {
	if (typeof($.livequery) == 'undefined') return;

	$("a:not('.acntxfer')").livequery('click', function() {
		 var this_host = document.location.hostname;
		 var this_href = $(this).attr("href");
		 var host_part = this_href.split("://")[1];
		 if (typeof host_part != 'undefined') {
			if (this_href.indexOf('.jpg') != -1) 
				return;
		 	host_part = host_part.split("/")[0];
			if (host_part != this_host) {
				pageTracker._link(this_href);
				return false;
			}
		 }
	});
}

$(function() {
	checkXDomainLinks();
	$(".sort").change( function(event) { 
		changePrefs('sort', $(this).val());
	}); 
	$(".product-count").change( function(event) { 
		changePrefs('pgSize', $(this).val());
	}); 
});

