﻿
/// Generic Tracking Implementation, to be populated by page and then
/// interpreted and logged by provider specific tracking code.

var regusTrack = {
    pageName: null,                             
    hier1: null,                                
    hier2: null,                                
    hier3: null,                                
    hier4: null,                                
    hier5: null,                                
    channel: null,                              
    server: null,
    pageType: null,                             
    products: null,
    purchaseID: null,
    currency: null,

    /* Event Tracking */
    _events: new Array(),
    trackEvent: function(eventname) {
        this._events.push(eventname);
    },

    formType: 'Site',                        
    formReference: null,

    searchCountry: null,                        
    searchCity: null,                           
    quickQuoteProduct: null,                    
    quickQuoteWorkforce: null,                  
    meetingRoomType: null,                      
    meetingRoomPeople: null,                    
    centerID: null,                             

    populateFromContent: function() {
        var arrHier = $('.breadcrumbs span').text().split(/ > /);
        this.pageName = arrHier.join(' > ');
        for (var ii = 0; ii < arrHier.length; ii++) this['hier' + (ii + 1)] = arrHier[ii];
        this.channel = arrHier.length > 3 ? arrHier[2] : arrHier[1];
    },
    
    initOmniture: function(s) {
        s.pageName = this.pageName;
        s.server = this.server;
        s.channel = this.channel;
        s.pageType = this.pageType;             
        s.prop6 = this.formType;
        s.prop31 = this.searchCountry;
        s.prop32 = this.searchCity;
        s.prop33 = ""; // Not used
        s.prop34 = ""; // Not used                          
        s.prop35 = this.currency;
        s.prop36 = ""; // Not used                          
        s.hier1 = this.hier1;
        s.hier2 = this.hier2;
        s.hier3 = this.hier3;
        s.hier4 = this.hier4;
        s.hier5 = this.hier5;
        s.products = this.products
        s.events = this._events.join(',');
        s.currencyCode = "";
        s.eVar6 = this.searchCountry;
        s.eVar7 = this.searchCity;
        s.eVar8 = this.quickQuoteProduct;
        s.eVar9 = this.quickQuoteWorkforce;
        s.eVar10 = this.meetingRoomType;
        s.eVar11 = this.meetingRoomPeople;
        s.eVar12 = this.centerID;
        s.eVar37 = this.formReference;
        s.eVar38 = this.formType;
        s.eVar39 = s.channel;
    }
};





