if(typeof(MONITUS) == "undefined") {
	var MONITUS = {
		_version: 8,
		_objectQueue: new Array(),
		internal: {
			_test_object: function(pObjectName) {
				try {
					eval("var vObject = window." + pObjectName + ";");
					return vObject;
				} catch(e) {
					return null;
				}
			},
			_wait_object: function(pQueueIndex) {
				if((pQueueIndex >= 0) && (pQueueIndex < MONITUS._objectQueue.length)) {
					var vSpecs = MONITUS._objectQueue[pQueueIndex];
					var vObject = MONITUS.internal._test_object(vSpecs.object);
					if(!vObject) setTimeout("MONITUS.internal._wait_object(" + pQueueIndex + ");", 10);
					else {
						MONITUS._objectQueue.splice(pQueueIndex, 1);
						vSpecs.args.unshift(vObject);
						vSpecs.callback.apply(this, vSpecs.args);
					}
				}
			}
		},
		
		community: {
			utilities: {
				non_null_string: function(pString, pDefault) {
					if(!pDefault) pDefault = "";
					return (pString ? pString : pDefault);
				},
				wait_object: function(pObjectName, pCallBack, pArguments) {
					var vObject = MONITUS.internal._test_object(pObjectName);
					if(vObject) {
						pArguments.unshift(vObject);
						pCallBack.apply(this, pArguments);
					} else {
						var vIndex = MONITUS._objectQueue.length;
						MONITUS._objectQueue[vIndex] = {object: pObjectName, callback: pCallBack, args: pArguments};
						setTimeout("MONITUS.internal._wait_object(" + vIndex + ");", 10);
					}
				},
				is_landing_page: function(pIgnoreDomains) {
					var vReferringDomain = document.referrer.match(/https?\:\/\/([^/]+)/i);
					if(!vReferringDomain) return true;
					vReferringDomain = vReferringDomain[1];
					for(var vLoop=0; vLoop < pIgnoreDomains.length; vLoop++) {
						if(vReferringDomain.indexOf(pIgnoreDomains[vLoop]) >= 0) return false;
					}
					return true;
				},
				object_by_name_attribute: function(pTag, pName) {
					var vElements = document.getElementsByTagName(pTag);
					for(var vLoop = 0; vLoop < vElements.length; vLoop++) {
						if(vElements[vLoop].getAttribute("name") == pName) return vElements[vLoop];
					}
					return null;
				},
				inflate: function(pString) {
					do {
						var vTokens = pString.match(/%([^%]+)%/);
						if(vTokens) {
							var vObject = document.getElementById(vTokens[1]);
							var vValue = "";
							try { vValue = vObject.value } catch(e) { }
							var vRE = new RegExp(vTokens[0], "g");
							pString = pString.replace(vRE, vValue);
						}
					} while(vTokens);
					return pString;
				}
			},
			
			ga: {
				track_event: function(pTrackerObject, pEventCategory, pEventAction, pEventLabel) {
					if(pEventCategory && pEventAction && (pEventCategory != "") && (pEventAction != "")) {
						if(!pTrackerObject || (typeof(pTrackerObject) == "undefined") || (typeof(pTrackerObject._trackEvent) != "function")) MONITUS.community.utilities.wait_object(pTrackerObject, MONITUS.community.ga.track_event, [pEventCategory, pEventAction, MONITUS.community.utilities.non_null_string(pEventLabel)]);
						else {
							var vCategory = MONITUS.community.utilities.inflate(pEventCategory);
							var vAction = MONITUS.community.utilities.inflate(pEventAction);
							var vLabel = MONITUS.community.utilities.inflate(MONITUS.community.utilities.non_null_string(pEventLabel));
							pTrackerObject._trackEvent(vCategory, vAction, vLabel);
						}
					}
				},
				attach_tracking_info: function(pObject, pTrackerObject, pOptionalEventAction, pOptionalEventLabel, pOptionalEventCategory) {
					if(pObject) {
						pObject.ga_tracker = pTrackerObject;
						pObject.ga_action = MONITUS.community.utilities.non_null_string(pOptionalEventAction);
						pObject.ga_label = MONITUS.community.utilities.non_null_string(pOptionalEventLabel);
						pObject.ga_category = MONITUS.community.utilities.non_null_string(pOptionalEventCategory);
					}
				},
				track_event_attached_to_object: function(pObject) {
					if(pObject) MONITUS.community.ga.track_event(pObject.ga_tracker, MONITUS.community.utilities.non_null_string(pObject.ga_category), MONITUS.community.utilities.non_null_string(pObject.ga_action), MONITUS.community.utilities.non_null_string(pObject.ga_label));
					return true;
				}
			},
			
			gwo: {
				track_variation_as_event: function(pTrackerObject, pExperimentName, pVariationName) {
					MONITUS.community.ga.track_event(pTrackerObject, pExperimentName, pVariationName);
				}
			},
			
			yahoo: {
				page_id: function() {
					var vTokens;
					if(window.location.search && (window.location.search.match(/(sectionId\=[^&]*)/) || window.location.pathname.match(/\/wg\-order/))) {
						vTokens = window.location.search.match(/sectionId\=([^&]*)/);
						if(vTokens) return vTokens[1];
						else return "ysco.cart";
					} else {
						vTokens = window.location.pathname.match(/([^\/\.]+)\..+?$/);
						if(vTokens) return vTokens[1];
						else return "homepage";
					}
				},
				cleanup_order_data: function() {
					if(MONITUS.community.yahoo.page_id() == "ysco.confirm") {
						var vMerged = new Array();
						for(var vLoop = 0; vLoop < window.ids.length; vLoop++) {
							var vIndex = "item_" + window.ids[vLoop] + ";" + window.price[vLoop];
							if(typeof(vMerged[vIndex]) != "undefined") {
								vMerged[vIndex].qty += parseInt(window.qtys[vLoop]);
							} else {
								vMerged[vIndex] = {id: window.ids[vLoop], item: window.items[vLoop], code: window.codes[vLoop], price: window.price[vLoop], qty: parseInt(window.qtys[vLoop])};
							}
						}
						window.mon_order_ids = new Array();
						window.mon_order_items = new Array();
						window.mon_order_codes = new Array();
						window.mon_order_price = new Array();
						window.mon_order_qtys = new Array();
						for(var vLoop in vMerged) {
							if((typeof(vLoop) == "string") && vLoop.match(/^item_/)) {
								var vRecord = vMerged[vLoop];
								window.mon_order_ids[window.mon_order_ids.length] = vRecord.id;
								window.mon_order_items[window.mon_order_items.length] = vRecord.item;
								window.mon_order_codes[window.mon_order_codes.length] = vRecord.code;
								window.mon_order_price[window.mon_order_price.length] = vRecord.price;
								window.mon_order_qtys[window.mon_order_qtys.length] = vRecord.qty;
							}
						}
					}
				},
				install_track_cart_update: function(pTrackerObject, pOptionalEventAction, pOptionalEventLabel, pOptionalEventCategory) {
					var vButton = MONITUS.community.utilities.object_by_name_attribute("input", "eventName.updateEvent");
					if(!vButton) setTimeout("MONITUS.community.yahoo.install_track_cart_update('" + pTrackerObject + "', '" + MONITUS.community.utilities.non_null_string(pOptionalEventAction, "Update Cart") + "', '" + MONITUS.community.utilities.non_null_string(pOptionalEventLabel) + "', '" + MONITUS.community.utilities.non_null_string(pOptionalEventCategory, "Checkout Button Clicked") + "');", 10);
					else {
						MONITUS.community.ga.attach_tracking_info(vButton, pTrackerObject, MONITUS.community.utilities.non_null_string(pOptionalEventAction, "Update Cart"), MONITUS.community.utilities.non_null_string(pOptionalEventLabel), MONITUS.community.utilities.non_null_string(pOptionalEventCategory, "Checkout Button Clicked"));
						vButton.onclick = function() { return MONITUS.community.ga.track_event_attached_to_object(this); };
					}
				},
				install_track_ship_update: function(pTrackerObject, pOptionalEventAction, pOptionalEventLabel, pOptionalEventCategory) {
					var vPage = MONITUS.community.yahoo.page_id().replace(/ysco\./, '');
					var vDefaultLabel = "%shipping-zip% - %shipping-state";
					if(vPage == "cart") vDefaultLabel += "-for-shipping-calculator";
					vDefaultLabel += "% - %merchant-selected-shipping-methods%";
					var vButton = MONITUS.community.utilities.object_by_name_attribute("input", "eventName.updateShippingMethodEvent");
					if(!vButton) setTimeout("MONITUS.community.yahoo.install_track_ship_update('" + pTrackerObject + "', '" + MONITUS.community.utilities.non_null_string(pOptionalEventAction, "Update Shipping - " + vPage + " page") + "', '" + MONITUS.community.utilities.non_null_string(pOptionalEventLabel, vDefaultLabel) + "', '" + MONITUS.community.utilities.non_null_string(pOptionalEventCategory, "Checkout Button Clicked") + "');", 10);
					else {
						MONITUS.community.ga.attach_tracking_info(vButton, pTrackerObject, MONITUS.community.utilities.non_null_string(pOptionalEventAction, "Update Shipping - " + vPage + " page"), MONITUS.community.utilities.non_null_string(pOptionalEventLabel, vDefaultLabel), MONITUS.community.utilities.non_null_string(pOptionalEventCategory, "Checkout Button Clicked"));
						vButton.onclick = function() { return MONITUS.community.ga.track_event_attached_to_object(this); };
					}
				},
				track_add_to_cart: function(pTrackerObject, pOptionalEventAction, pOptionalEventLabel, pOptionalEventCategory) {
					MONITUS.community.ga.track_event(pTrackerObject, MONITUS.community.utilities.non_null_string(pOptionalEventCategory, "Add to Cart"), MONITUS.community.utilities.non_null_string(pOptionalEventAction, MONITUS.community.yahoo.page_id()), MONITUS.community.utilities.non_null_string(pOptionalEventLabel));
					return true;
				},
				track_click_to_enlarge: function(pTrackerObject, pOptionalEventAction, pOptionalEventLabel, pOptionalEventCategory) {
					MONITUS.community.ga.track_event(pTrackerObject, MONITUS.community.utilities.non_null_string(pOptionalEventCategory, "Click to enlarge"), MONITUS.community.utilities.non_null_string(pOptionalEventAction, "clicked"), MONITUS.community.utilities.non_null_string(pOptionalEventLabel, MONITUS.community.yahoo.page_id()));
					return true;
				}
			}
		}
	};
}