﻿
function attachClick(selector, func) { $(selector).each(function () { var handler = this.onclick; this.onclick = function () { }; singleClick(this, handler, func); }); } function singleClick(obj, handler, func) { $(obj).one("click", function () { var result = true; var seoHierarchy = $(obj).attr("name"); func(seoHierarchy); if (handler != null) { result = handler(); } setTimeout(function () { singleClick(obj, handler, function (seoHierarchy) { func(seoHierarchy); }); }, 500); return result; }); } function BindLodgingData() { attachClick(".tagLodgingData", function (seoHierarchy) { var tagArray = omniturePixels.split(":"); linkTrackVars = 'products'; linkTrackEvents = 'scAdd'; s.events = 'scAdd, event33'; s.products = tagArray[tagArray.length - 1]; s.tl(this, 'o', omniturePixels); }); } function BindLodgingDetail() { attachClick(".tagcontforcart", function (seoHierarchy) { var seoHierarchy = $(".tagcontforcart").prev().attr("value"); var productCode = $("input[type=hidden][name$=hdnLodgingProduct]").val(); if (seoHierarchy != null) { linkTrackVars = 'products'; linkTrackEvents = 'scAdd'; s.events = 'scAdd, event33'; s.products = productCode; s.tl(this, 'o', seoHierarchy); } }); } function TagEquipmentRentalResults() {
    if (document.getElementById('hdnEquipmentRentals') != null) {
        attachClick(".tagEquipmentRentalData", function (seoHierarchy) {
            var hdtag = ''; $('.dropItem li').each(function (i) {
                if (hdtag == '') { hdtag = $(this).find('.boxData #hdSelectedSKU').val(); } else
                { hdtag += "," + $(this).find('.boxData #hdSelectedSKU').val(); } 
            }); var omniturePixels = document.getElementById('hdnEquipmentRentals').value; linkTrackVars = 'products'; linkTrackEvents = 'scAdd'; s.events = 'scAdd'; s.products = hdtag; s.tl(this, 'o', omniturePixels);
    });
    } 
} function TagLessonResults() {
    attachClick(".tagClassesData", function (seoHierarchy) {
        var hdtag = ''; $("ul.dropItem li").each(function (i) {
            if (hdtag == '') { var hdnValue = $(this).find("input[type=hidden][name=purchasedLessonID]").val(); if (hdnValue != '') { var ArrProductCodes = hdnValue.split('|'); hdtag = ArrProductCodes[0]; } } else
            { var hdnValue = $(this).find("input[type=hidden][name=purchasedLessonID]").val(); if (hdnValue != '') { var ArrProductCodes = hdnValue.split('|'); hdtag += "," + ArrProductCodes[0]; } } 
        }); var seoHierarchy = $(".tagClassesData").prev().attr("value"); document.getElementById('hdnLessonDetails').value += ":" + hdtag; var completeHierarchy = document.getElementById('hdnLessonDetails').value; if (completeHierarchy != null) { var tagArray = completeHierarchy.split(":"); linkTrackVars = 'products'; linkTrackEvents = 'scAdd'; s.events = 'scAdd'; s.products = tagArray[tagArray.length - 1]; s.tl(this, 'o', seoHierarchy); } 
	        });
} function BindFlightTags() { attachClick(".tagContinueData", function (seoHierarchy) { var seoHierarchy = $(".tagContinueData").prev().attr("value"); var productCode = $("input[type=hidden][name=flightSearch]").val(); if (seoHierarchy != null) { linkTrackVars = 'products'; linkTrackEvents = 'scAdd'; s.events = 'scAdd'; s.products = productCode; s.tl(this, 'o', seoHierarchy); } }); } function BindCCNContinueTags() { var seoHierarchy = ""; $("#ChildCareTypeContainer .radioButtonList").each(function () { if ($(this).find(":radio").length > 0) { var value = $(this).find(":radio:selected").val(); } else { var value = $(this).find(":hidden:eq(0)").val(); } seoHierarchy += ";" + value; }); if (seoHierarchy != null) { linkTrackVars = 'products'; linkTrackEvents = 'scAdd'; s.events = 'scAdd'; s.products = seoHierarchy; s.tl(this, 'o', $(".ccnseoHierarchy").val()); } } function BindDiningBookItTags() { var seoHierarchy = ""; seoHierarchy = ";" + $("#merchantId").val(); if (seoHierarchy != null) { linkTrackVars = 'products'; linkTrackEvents = 'scAdd'; s.events = 'scAdd'; s.products = seoHierarchy; var val = $(".DiningProduct").val(); s.tl(this, 'o', val); } } function BindSaveItineraryTags() { if ($(".SaveItinerary_pixels").val() != "") { s.tl(this, 'o', $(".SaveItinerary_pixels").val()); s.events = "event15"; } } $(function () {
    if ($(".tagSaveItinerary").length > 0) { attachClick(".tagSaveItinerary", function () { BindSaveItineraryTags(); }); } if ($(".tagBookDining").length > 0) { attachClick(".tagBookDining", function () { BindDiningBookItTags(); }); } if ($(".tagCCNContinue").length > 0) { attachClick(".tagCCNContinue", function () { BindCCNContinueTags(); }); } attachClick(".tagPromoLink", function (seoHierarchy) { s.evar5 = 'INT_PROMO_ID'; s.events = 'event1'; s.tl(s.pageURL, 'o', seoHierarchy); }); attachClick(".tagPlanButton", function (seoHierarchy) { var seoHierarchy = $(".tagPlanButton").prev().attr("value"); s.evar35 = seoHierarchy; s.tl(s.pageURL, 'o', seoHierarchy); }); attachClick(".inputButton", function (seoHierarchy) { var seoHierarchy = $(".inputButton").prev().attr("value"); s.evar35 = seoHierarchy; s.tl(s.pageURL, 'o', seoHierarchy); }); attachClick(".tagQuickLink", function (seoHierarchy) { if (seoHierarchy != null) { seoHierarchy = seoHierarchy.replace("http://", "").replace("http%3A//", ""); s.tl(s.pageURL, 'o', seoHierarchy); } }); if ($(".tagLodgingData").length > 0) { BindLodgingData(); } if ($(".tagcontforcart").length > 0) { BindLodgingDetail(); } if ($(".tagContinueData").length > 0) { BindFlightTags(); } attachClick(".tagLiftTicketContinueData", function (seoHierarchy) {
        var hdtag = ''; $("ul.dropItem li").each(function (i) {
            if (hdtag == '') { hdtag = $(this).find("input[type=hidden][name=SelectedSKU]").val(); } else
            { hdtag += "," + $(this).find("input[type=hidden][name=SelectedSKU]").val(); } 
        }); document.getElementById('hdnLiftTicket').value += ":" + hdtag; var seoHierarchy = $(".tagLiftTicketContinueData").prev().attr("value"); if (seoHierarchy != null) { var tagArray = seoHierarchy.split(":"); linkTrackVars = 'products'; linkTrackEvents = 'scAdd'; s.events = 'scAdd'; s.products = tagArray[tagArray.length - 1]; s.tl(this, 'o', seoHierarchy); } 
    }); if ($(".tagClassesData").length > 0) { TagLessonResults(); } if ($(".tagEquipmentRentalData").length > 0) { TagEquipmentRentalResults(); } attachClick(".tagSeasonPassesExplorerData", function (seoHierarchy) {
        var hdtag = ''; $("ul.dropItem li").each(function (i) {
            var div1 = $(this).find(".boxData"); var div2 = div1.find(".amount"); var sSKU = div2.find("input[type=hidden][class='hdnSKU']").val(); if (hdtag == '') { hdtag = sSKU; } else
            { hdtag += "," + sSKU; } 
        }); var seoHierarchy = document.getElementById('hdnSeasonPasses').value; if (hdtag != null) { linkTrackVars = 'products'; linkTrackEvents = 'scAdd'; s.events = 'scAdd'; s.products = hdtag; s.tl(this, 'o', seoHierarchy); } 
    }); attachClick(".btnRight", function (seoHierarchy) { var seoHierarchy = $(".btnRight").prev().attr("value"); if (seoHierarchy != null) { var tagArray = seoHierarchy.split(":"); linkTrackVars = 'products'; linkTrackEvents = 'scAdd'; s.events = 'scAdd'; s.products = tagArray[tagArray.length - 1]; s.tl(this, 'o', seoHierarchy); } }); attachClick(".openModalForTraveller", function (seoHierarchy) { var seoHierarchy = $(".openModalForTraveller").prev().attr("value"); if (seoHierarchy != null) { var tagArray = seoHierarchy.split(":"); linkTrackVars = 'products'; linkTrackEvents = 'scAdd'; s.events = 'scAdd'; s.products = tagArray[tagArray.length - 1]; s.tl(this, 'o', seoHierarchy); } }); attachClick("ul.resultPanel li h4 a", function (seoHierarchy) { linkTrackVars = 'events'; linkTrackEvents = 'event32'; s.events = 'event32'; s.tl(this, 'o', 'keystoneresort:internal search clicked'); }); attachClick(".tagLearnMore", function (seoHierarchy) { if (seoHierarchy != null) { var tagArray = seoHierarchy.split(":"); s.evar5 = tagArray[tagArray.length - 1]; s.events = 'event1'; s.tl(s.pageURL, 'o', seoHierarchy); } });
}); (function (A) { A.fn.rssLinks = function (B) { return this.each(function () { var E = A(this); var G = A.extend({}, A.fn.rssLinks.defaults, B); var F = A(G.target || A(this).attr("target")); var C = []; G.url = G.url || this.tagName.toLowerCase() == "a" ? A(this).attr("href").split("#")[0] : A(this).attr("rel"); G.url = G.url.replace("http://", "").replace("http%3A//", ""); for (var D = 0; D < G.services.length; D++) { C[D] = '<a href="' + G.serviceList[G.services[D]].pattern + '" name="' + G.services[D] + '"><img src="' + G.serviceList[G.services[D]].image + '" alt="Add to ' + G.services[D] + '" /></a>'; C[D] = C[D].replace(/\{url\}/gi, escape(unescape(G.url))) } C = A(C.join("")); F[G.insertionType](C); if (G.wrapper) { C.each(function () { A(this).wrap(G.wrapper) }) } if (G.taggingPattern && s && s.tl) { C.each(function () { A(this).click(function () { s.tl(this, "o", G.taggingPattern.replace(/\{name\}/gi, E.attr("name")).replace(/\{service\}/gi, A(this).attr("name"))) }) }) } }) }; A.fn.rssLinks.defaults = { target: false, url: false, wrapper: false, insertionType: "html", taggingPattern: "keystoneresort:rss feeds:{name}:{service}", services: ["my yahoo", "my aol", "google", "windows live"], serviceList: { MyYahoo: { pattern: "http://us.rd.yahoo.com/my/atm/*http://add.my.yahoo.com/rss?url=http%3A//{url}", image: "/vailresorts/sites/snow/assets/img/rss/rss_yahoo.gif" }, MyAOL: { pattern: "http://feeds.my.aol.com/?url=http%3A//{url}", image: "/vailresorts/sites/snow/assets/img/rss/rss_aol.gif" }, Google: { pattern: "http://fusion.google.com/add?source=atgs&feedurl=http%3A//{url}", image: "/vailresorts/sites/snow/assets/img/rss/rss_google.gif" }, WindowsLive: { pattern: "http://www.live.com/?add=http://{url}", image: "/vailresorts/sites/snow/assets/img/rss/rss_windows.gif"}}} })(jQuery);
