﻿var Omniture = {
    SendEvent: function (eventId, eventName) {
        if (typeof s_account == "undefined") {
            return;
        }

        s = s_gi(s_account);
        if (typeof s == "undefined") {
            return;
        }

        s.linkTrackVars = "events";
        s.linkTrackEvents = eventId;
        s.events = eventId;

        s.tl(this, 'o', eventName);
    },
    SendOutOfStockEvent: function (evarVal) {
        if (typeof s_account == "undefined") {
            return;
        }

        s = s_gi(s_account);
        if (typeof s == "undefined") {
            return;
        }
        s.linkTrackVars = "events,eVar16";
        s.linkTrackEvents = "event16";
        s.events = "event16";
        s.eVar16 = evarVal;

        s.tl(this, 'o', "Out of Stock");
    },
    SendBasketErrEvent: function (evarVal) {
        if (typeof s_account == "undefined") {
            return;
        }

        s = s_gi(s_account);
        if (typeof s == "undefined") {
            return;
        }
        s.linkTrackVars = "events,eVar14";
        s.linkTrackEvents = "event14";
        s.events = "event14";
        s.eVar14 = evarVal;

        s.tl(this, 'o', "Basket Page Errors");
    },
    SendDeliveryPageErrEvent: function (evarVal) {
        if (typeof s_account == "undefined") {
            return;
        }

        s = s_gi(s_account);
        if (typeof s == "undefined") {
            return;
        }
        s.linkTrackVars = "events,eVar15";
        s.linkTrackEvents = "event15";
        s.events = "event15";
        s.eVar15 = evarVal;

        s.tl(this, 'o', "Delivery Page Errors");
    },
    SendPaymentErrEvent: function (evarVal) {
        if (typeof s_account == "undefined") {
            return;
        }

        s = s_gi(s_account);
        if (typeof s == "undefined") {
            return;
        }
        s.linkTrackVars = "events,eVar15";
        s.linkTrackEvents = "event15";
        s.events = "event15";
        s.eVar15 = evarVal;

        s.tl(this, 'o', "Payment Page Errors");
    },
    SendRegErrEvent: function (evarVal) {
        if (typeof s_account == "undefined") {
            return;
        }

        s = s_gi(s_account);
        if (typeof s == "undefined") {
            return;
        }
        s.linkTrackVars = "events,eVar33";
        s.linkTrackEvents = "event31";
        s.events = "event31";
        s.eVar33 = evarVal;

        s.tl(this, 'o', "Registration Page Errors");
    },
    SubmitAddToBasketSingle: function (pid, vid, cid, qty, scopen) {
        if (typeof s_account == "undefined") {
            return;
        }

        s = s_gi(s_account);
        if (typeof s == "undefined") {
            return;
        }
        var events = "";
        s.linkTrackVars = "products,events,eVar3,eVar31";
        if (scopen == "True") {
            s.linkTrackEvents = "scAdd,scOpen";
            s.events = "scAdd,scOpen";
            events = "scAdd,scOpen";
        }
        else {
            s.linkTrackEvents = "scAdd";
            s.events = "scAdd";
            events = "scAdd";
        }
        s.eVar31 = vid;
        s.products = cid + ";" + pid + ";;;;eVar3=" + cid + "|eVar31=" + vid + "|events=" + events;

        s.tl(this, 'o', "Add To Basket");

    },
    RemoveFromBasketSingle: function (pid, vid, qty) {
        if (typeof s_account == "undefined") {
            return;
        }
        s = s_gi(s_account);
        if (typeof s == "undefined") {
            return;
        }
        s.products = ";" + pid;
        s.linkTrackVars = "products,events";
        s.linkTrackEvents = "scRemove";
        s.events = "scRemove";
        s.tl(this, 'o', "Remove From Basket");
    },
    ReadRegValErrors: function () {
        var valSum = document.getElementById('ctl00_cphBodyContent_vsum');
        if (valSum != null) {
            if (valSum.innerHTML == "\n\n") {
                window.setTimeout('Omniture.ReadRegValErrors();', 2000);
            }
            else {
                Omniture.SendRegErrEvent(valSum.innerHTML);
                valSum.innerHTML = "\n\n";
            }
        }
    },
    ReadBRegValErrors: function () {
        var valSum = document.getElementById('ctl00_cphBodyContent_vsumb');
        if (valSum != null) {
            if (valSum.innerHTML == "\n\n") {
                window.setTimeout('Omniture.ReadBRegValErrors();', 2000);
            }
            else {
                Omniture.SendRegErrEvent(valSum.innerHTML);
                valSum.innerHTML = "\n\n";
            }
        }
    },
    ReadPayValErrors: function () {
        var valSum = document.getElementById('ctl00_cphBodyContent_vsum');
        if (valSum != null) {
            if (valSum.innerHTML == "\n\n") {
                window.setTimeout('Omniture.ReadPayValErrors();', 2000);
            }
            else {
                Omniture.SendPaymentErrEvent(valSum.innerHTML);
                valSum.innerHTML = "\n\n";
            }
        }
    }
};