
var omnitureCustom = function() {
	var URL = window.location.href;
	return {
		getOmniCustomValues : function() {
			if(URL.match("/hotels/travel-guide") || URL.match("/hotels/event-planning/wedding-planning/")) {
    			omnitureStandard.setEventValue(",event34");
    		} else if(URL.match("/hotels/hotel-deals")) {
     			omnitureStandard.setEventValue(",event21");
			}
			var buttonsList = document.getElementsByTagName("BUTTON");
			var aButtonsList = YAHOO.util.Dom.getElementsByClassName("button-submit");
			YAHOO.util.Event.addListener(buttonsList, "click", omnitureCustom.processOmniCookie);
			YAHOO.util.Event.addListener(aButtonsList, "click", omnitureCustom.processOmniCookie);
		},
		processOmniCookie : function() {
			var omnitureCookie = omnitureStandard.getOmniCookie("omniData");
			var hwsSearch = "";
			var searchType = "";
			if(omnitureCookie.match("hwsSearchType")) {
				hwsSearch = omnitureCookie.substring(omnitureCookie.indexOf("hwsSearchType"));
				hwsSearch = hwsSearch.substring(0, hwsSearch.indexOf("&") + 1);
			}
			if(this.form && this.form.id.match("fullRatesCalloutForm") && this.form.action.match("/reservation/availabilitySearch.mi")){
				if(omnitureCookie.match("omniMultiSearch") || omnitureCookie.match("hwsSearchType")) {
					if(hwsSearch != "") {
						omnitureCookie = omnitureCookie.replace(hwsSearch, "hwsSearchTypeEdit&");
					} else {
						omnitureCookie += "hwsSearchTypeEdit&";
					}
				} else {
					if(hwsSearch != "") {
						omnitureCookie = omnitureCookie.replace(hwsSearch, "hwsSearchTypeInitial&");
					} else {
						omnitureCookie += "hwsSearchTypeInitial&";
					}
				}
			}else if(this.href && URL.match("hotels/hotel-rooms") && this.href.match("/hotels/checkAvailability.mi?")) {
				if(hwsSearch != "") {
					omnitureCookie = omnitureCookie.replace(hwsSearch, "hwsSearchTypeRoom&");
				} else {
					omnitureCookie += "hwsSearchTypeRoom&";
				}
			}else if(this.href && this.href.match("/hotels/continueReservation.mi")) {
				if(hwsSearch != "") {
					omnitureCookie = omnitureCookie.replace(hwsSearch, "hwsSearchTypeContinue&");
				} else {
					omnitureCookie += "hwsSearchTypeContinue&";
				}
			}
			document.cookie = "omniData=" + omnitureCookie + ";path=/";
		}	
	};
}();