﻿


var coremetrics = {
    coremetricsonflag: false,
    productionserverflag: false,
    pagetype: "",
    pageviewtag: { pageid: "", categoryid: null, searchterm: null, searchresults: null },
    productviewtag: { productid: "", productname: "", categoryid: null },
    productselectiontag: { productid: "", productname: "", categoryid: null },
    productcompletiontag: { productid: "", productname: null, customerid: null, transactionid: null, categoryid: null },
    transactiontag: { transactionid: "", customerid: "", customercity: null, customerstate: null, customerzip: null },
    registrationtag: { customerid: "", customeremail: null, customercity: null, customerstate: null, customerzip: null, newslettername: null, subscribedflag: "N", attributes: null },
    errortag: { pageid: "", categoryid: null },
    elementtag: { elementid: "", elementcategory: null },
    conversioneventtag: { eventid: "", actiontype: "", eventcategoryid: null, points: null },
    init: function() {
        cmSetClientID("90301751", false, "ww9.neptunefunds.com");
        this.coremetricsonflag = true;
    },
    maincase: function() {
        if (this.coremetricsonflag) {
            if (this.productionserverflag) {
                cmSetProduction();
            }
            if (this.pagetype == "product_details_page") {
                cmCreateProductViewTag(this.productviewtag.productid, this.productviewtag.productname, this.productviewtag.categoryid)
            } else if (this.pagetype == "application_start_page") {
                cmCreatePageviewTag(this.pageviewtag.pageid, this.pageviewtag.categoryid, this.pageviewtag.searchterm, this.pageviewtag.searchresults);
                cmCreateProductSelectionTag(this.productselectiontag.productid, this.productselectiontag.productname, this.productselectiontag.categoryid);
                cmDisplayProductselectoins();
            } else if (this.pagetype == "application_completion_page") {
                cmCreatPageviewTag(this.pageviewtag.pageid, this.pageviewtag.categoryid, this.pageviewtag.searchterm, this.pageviewtag.searchresults);
                cmCreateProductcompletionTag(this.productcompletiontag.productid, this.productcompletiontag.productname, this.productcompletiontag.customerid, this.productcompletiontag.transactionid, this.productcompletiontag.categoryid);
                cmDisplayProductcompletions();

                cmCreateTransactionTag(this.transactiontag.trannsactionid, this.transactiontag.customerid, this.transactiontag.customercity, this.transactiontag, this.customerstate, this.transactiontag.customerzip);
                cmCreateRegistrationTag(this.registrationtag.customerid, this.registrationtag.customeremail, this.registrationtag.customercity, this.registrationtag.customerstate,
		            this.registrationtag.customerzip, this.registrationtag.newslettername, this.registrationtag.subscribedflag, this.registrationtag.attributes);
            } else {
                cmCreatePageviewTag(this.pageviewtag.pageid, this.pageviewtag.categoryid, this.pageviewtag.searchterm, this.pageviewtag.searchresults);
            }
        }
    }
}