// Baynote Recommendations for www.us-appliance.com
// Last updated: Jan 6, 2010
function show_baynote_guide(pagetype,listsize) {
	baynote_tag.server = "http://usappliance-www.baynote.net";
	baynote_tag.customerId = "usappliance";
	baynote_tag.code = "www";
	baynote_tag.type = "guide";
	var showguide = false;
	if(pagetype == "home") {
		baynote_tag.guide = "HomeGuide";
		baynote_tag.listSize = 3;
	} else if(pagetype == "homeappliances") {
		baynote_tag.guide = "HomeAppliances";
		baynote_tag.listSize = 3;
	} else if(pagetype == "homeelectronics") {
		baynote_tag.guide = "HomeElectronics";
		baynote_tag.listSize = 3;
	} else if(pagetype == "home-custom") {
		baynote_tag.guide = "MostPopular";
		baynote_tag.attrFilter = "PriceFlag:true,Path:$Path";
		baynote_tag.listSize = 3;
	} else if(pagetype == "default") {
		showguide = baynote_checkShowGuide();
		if(showguide) {
			baynote_tag.guide = "AutoGuide";
			baynote_tag.listSize = 5;
		}
	}
	if(listsize != null && listsize > 0) { baynote_tag.listSize = listsize;}
	if(baynote_tag.guide != "" && baynote_tag.listSize > 0) {
		baynote_tag.show();
		if(showguide) { baynote_waitForGuide(); }
	} else {
		baynote_tag.noshow();
	}
}
function baynote_waitForGuide() {
	if(baynote_isNotEmpty(bnResourceManager)) {
		bnResourceManager.waitForResource("GLResults0", "baynote_guideLoaded()");
	}
}
function baynote_guideLoaded() {
	baynote_waitForFooter(1); 
}
function baynote_waitForFooter(bn_wait_count) {
	var bn_footerId = "bn_g_footer_usapp";
	if(document.getElementById(bn_footerId)) {
		(document.getElementById(bn_footerId)).style.display = "block";
	}
	else if(bn_wait_count < 10) {
		bn_wait_count++;
		setTimeout("baynote_waitForFooter("+bn_wait_count+")", 200);
	}
}	
function baynote_checkShowGuide() {
	var showguide = true;
	var page_url = window.location.href;
	
	if(page_url.indexOf("?") > 0) { page_url = page_url.substring(0,page_url.indexOf("?")); }
	if(page_url.indexOf("http://us-appliance.com/") == 0) { page_url = page_url.replace(/http:\/\/us\-appliance\.com\//,"http://www.us-appliance.com/"); }

	if(page_url == "http://www.us-appliance.com/") { showguide = false; }
	else if(page_url == "http://www.us-appliance.com/index.html") { showguide = false; }
	else if(page_url == "http://www.us-appliance.com/homepagetest.html") { showguide = false; }
	else if(page_url.match(/^http:\/\/us\-f[\d]\-edit\.store\.yahoo\.com\/RT\/NEWEDIT\.usappliance\/[^\/]+\/index\.html$/)) { showguide = false; }
	else if(page_url.match(/^http:\/\/us\-f[\d]\-edit\.store\.yahoo\.com\/RT\/NEWEDIT\.usappliance\/[^\/]+\/homepagetest\.html$/)) { showguide = false; }
	else if(page_url.match(/^http:\/\/www\.us\-appliance\.com\/sony([^\/]+)?\.html$/)) { showguide = false; }
	else if(page_url.match(/^http:\/\/www\.us\-appliance\.com\/kds[^\/]+\.html$/)) { showguide = false; }
	else if(page_url.match(/^http:\/\/www\.us\-appliance\.com\/kdl[^\/]+\.html$/)) { showguide = false; }
	else if(page_url.match(/^http:\/\/www\.us\-appliance\.com\/hts[^\/]+\.html$/)) { showguide = false; }
	else if(page_url.match(/^http:\/\/www\.us\-appliance\.com\/bdp[^\/]+\.html$/)) { showguide = false; }
	else if(page_url.match(/^http:\/\/www\.us\-appliance\.com\/davis[^\/]+\.html$/)) { showguide = false; }

	return showguide;
}
function baynote_isNotEmpty(name) {
	return (typeof(name) != "undefined") && (name != null) && (name != "");
}