// Baynote search for www.us-mattress.com
// Last updated: May 7, 2008
function bn_updateSearchLinks() {
	var searchLinks = document.getElementsByTagName("A");
	for (var i=0; i<searchLinks.length; i++) {
		if (searchLinks[i].getAttribute("href").match(/http:\/\/bedroom\.us-mattress\.net\/search\?w=([^&]+)/)) {
			searchLinks[i].setAttribute("href", "http://find.us-mattress.net/catalogsearch/search.ep?keyWords="+RegExp.$1);
		}
	}
}
function bn_waitForPolicy(bn_waitCount) {
	var bn_waitLimit = 10;
	if (bn_waitCount > bn_waitLimit) {
		return;
	} else {
		if (bn_policyLoaded) {
			if (bn_searchEnabled) {
				bn_updateSearchLinks();
			}
		} else if ((typeof(bn_policyLoaded) == 'undefined' || !bn_policyLoaded) && bn_waitCount > 0) {
			bn_waitCount++;
			setTimeout("bn_waitForPolicy(\""+bn_waitCount+"\")", 100);
		}
	}
}
bn_waitForPolicy(1);
