// Baynote Observer for www.us-appliance.com
// Last updated: September 24, 2009
function baynote_checkShowObserver() {
	var showObs = true;
	var pageUrl = window.location.href;
	if (pageUrl.match(/^https?:\/\/([^\/]+\.)?store\.yahoo\.net\//)) {
		if (pageUrl.indexOf("sectionId=ysco.confirm") > 0) { }
		else { showObs = false; }
	}
	return showObs;
}
function baynote_checkCapturePurchase() {
	var capturePur = false;
	var pageUrl = window.location.href;
	if (pageUrl.match(/^https?:\/\/([^\/]+\.)?store\.yahoo\.net\//)) {
		if (pageUrl.indexOf("sectionId=ysco.confirm") > 0) {
			capturePur = true;
		}
	}
	return capturePur;
}
function baynote_capturePurchase() {
	if(!baynote_tag.attrs) baynote_tag.attrs = new Object();
	if (typeof(orderTotal) != "undefined" && baynote_isNotEmpty(orderTotal))
		baynote_tag.attrs.totalPurchases = parseFloat(orderTotal);
	if (typeof(orderNum) != "undefined" && baynote_isNotEmpty(orderNum))
		baynote_tag.attrs.purchaseId = orderNum;
	
	var orderDetails = new Array();
	
	if (typeof(ids) != "undefined" && baynote_isNotEmpty(ids)) {
		for (var i = 0; i < ids.length; i++) {
		    orderDetails[i] = ids[i]+":"+qtys[i]+":"+price[i];
		}
		/*
		if (typeof(orderTax) != "undefined" && baynote_isNotEmpty(orderTax)) {
		    orderDetails[orderDetails.length] = "orderTax:1:"+orderTax;
		}
		
		if (typeof(orderShipping) != "undefined" && baynote_isNotEmpty(orderShipping)) {
		    orderDetails[orderDetails.length] = "orderShipping:1:"+orderShipping;
		}
		
		if (typeof(orderDiscount) != "undefined" && baynote_isNotEmpty(orderDiscount)) {
		    orderDetails[orderDetails.length] = "orderDiscount:1:"+orderDiscount;
		}
		
		if (typeof(orderSubTotal) != "undefined" && baynote_isNotEmpty(orderSubTotal)) {
		    orderDetails[orderDetails.length] = "orderSubTotal:1:"+orderSubTotal;
		}*/
	}
	
	if (typeof(orderDetails) != "undefined" && baynote_isNotEmpty(orderDetails)) {
	    baynote_tag.attrs.purchaseDetails = orderDetails;
	}
}
function baynote_isNotEmpty(name) {
	return (name != null) && (name != "");
}
var bn_locHref = window.location.href;
if (bn_locHref.indexOf("https://") == 0) { 
	baynote_tag.server = "https://usappliance-www.baynote.net"; 
}
else { 
	baynote_tag.server = "http://usappliance-www.baynote.net"; 
}
baynote_tag.customerId = "usappliance";
baynote_tag.code = "www";
baynote_tag.type = "baynoteObserver";
baynote_globals.cookieDomain = "us-appliance.com";
if (baynote_checkShowObserver()) {
	if (baynote_checkCapturePurchase()) { baynote_capturePurchase(); }
	baynote_tag.show();
} else {
	baynote_tag.noshow();
}