﻿jQuery(document).ready(function () {
    function getParameterByName(name) {
        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
        var regexS = "[\\?&]" + name + "=([^&#]*)";
        var regex = new RegExp(regexS);
        var results = regex.exec(window.location.href);
        if (results == null)
            return "";
        else
            return decodeURIComponent(results[1].replace(/\+/g, " "));
    }


    jQuery('a[href="http://www.facebook.com/brighthorizons"]').click(function () {
        // Track via Omniture  
        s.server = window.location.host;
        s.channel = "";
        s.pageType = "";
        s.prop3 = "";
        s.prop4 = "";
        s.prop5 = "";
        /* Conversion Variables */
        s.campaign = "";
        s.state = "";
        s.zip = "";
        s.events = "event7";
        s.products = "";
        s.purchaseID = "";
        s.eVar13 = "Facebook";
        s.t(); s = s_gi('rs1'); s.tl(this, 'o'); return;
    });
    //
    jQuery('a[href="http://www.twitter.com/brighthorizons"]').click(function () {
        // Track via Omniture  
        s.server = window.location.host;
        s.channel = "";
        s.pageType = "";
        s.prop3 = "";
        s.prop4 = "";
        s.prop5 = "";
        /* Conversion Variables */
        s.campaign = "";
        s.state = "";
        s.zip = "";
        s.events = "event7";
        s.products = "";
        s.purchaseID = "";
        s.eVar13 = "Twitter";
        s.t(); s = s_gi('rs1'); s.tl(this, 'o'); return;
    });
    jQuery('a[href="http://momblog.brighthorizons.com/"]').click(function () {
        // Track via Omniture  
        s.server = window.location.host;
        s.channel = "";
        s.pageType = "";
        s.prop3 = "";
        s.prop4 = "";
        s.prop5 = "";
        /* Conversion Variables */
        s.campaign = "";
        s.state = "";
        s.zip = "";
        s.events = "event7";
        s.products = "";
        s.purchaseID = "";
        s.eVar13 = "Mom Blog";
        s.t(); s = s_gi('rs1'); s.tl(this, 'o'); return;
    });
    jQuery('a[href="http://www.brighthorizons.com/community"]').click(function () {
        // Track via Omniture  
        s.server = window.location.host;
        s.channel = "";
        s.pageType = "";
        s.prop3 = "";
        s.prop4 = "";
        s.prop5 = "";
        /* Conversion Variables */
        s.campaign = "";
        s.state = "";
        s.zip = "";
        s.events = "event7";
        s.products = "";
        s.purchaseID = "";
        s.eVar13 = "Community";
        s.t(); s = s_gi('rs1'); s.tl(this, 'o'); return;
    });

    jQuery('a.br-related-query-link, .br-sf-widget-merchant-title a').click(function () {
        // Track via Omniture  
        s.server = window.location.host;
        s.channel = "";
        s.pageType = "";
        s.prop3 = "";
        s.prop4 = "";
        s.prop5 = "";
        /* Conversion Variables */
        s.campaign = "";
        s.state = "";
        s.zip = "";
        s.events = "event10";
        s.products = "";
        s.purchaseID = "";
        s.eVar16 = jQuery(this).html();
        s.t(); s = s_gi('rs1'); s.tl(this, 'o'); return;
    });

    if (window.location.pathname.toLowerCase() == "/find-a-center" && window.location.hostname == "promotions.brighthorizons.com") {
        // Track via Omniture 
        s.pageName = "Promotions:Find A Center";
        s.server = window.location.hostname;
        s.channel = "";
        s.pageType = "";
        s.prop1 = "Promotions";
        s.prop2 = "Find A Center";
        s.prop4 = "";
        s.prop5 = "";
        /* Conversion Variables */
        s.campaign = "";
        s.state = "";
        s.zip = getParameterByName("zipcode");
        s.events = "event8";
        s.products = "";
        s.purchaseID = "";
        s.eVar3 = getParameterByName("zipcode"); ;
        s.t(); s = s_gi('rs1'); s.tl(this, 'o');

    }

});
