if (typeof Cobalt == "undefined") var Cobalt = {};
Cobalt.NewModelsPage_lexus = {
    getLocalUrl: function(url) {
        window.location = url;
    },
    getExternalUrl: function(url) {
        window.open(url);
    },
    contactUs: function() {
        var contactUs = new ContactUs();
    },
    /**
     * Open the QuickQuoteForm (CTA action)
     * 
     * @param {String} modelName code for the model to obtain a quote for
     */
    quickQuoteForm: function(modelName) {        
        if (typeof modelName !== "string" || modelName === "") {
            // tagging currently applies only to top level CTAs
            Cobalt.partners.Lexus.NewModelsPage.clickShowcaseCTALink('Purchase Inquiry');
        }

        this.getLocalUrl("./QuickQuoteForm?model=" + modelName);
    },
    /**
     * Open the NewModelsPageDetails (CTA action)
     * 
     * @param {String} model code for the model to display
     */
    modelDetails: function(model) {
        this.getLocalUrl("./NewModelsPageDetails?model=" + model);
    },
    /**
     * Open the vehicle builder (CTA action)
     * 
     * @param {Boolean} topLevel called from a top level CTA?
     */
    buildYourLexus: function(topLevel) {        
        if (topLevel === true || topLevel === "true") {
            Cobalt.partners.Lexus.NewModelsPage.clickShowcaseCTALink('Build Your Lexus');
        }

        this.getLocalUrl("./Redirect2");
    },
    /**
     * Open the vehicle comparator (CTA action)
     */
    compareVehicles: function() {
        this.getLocalUrl("./Redirect1");
        Cobalt.partners.Lexus.NewModelsPage.clickShowcaseCTALink('Compare Vehicles');
    },
    /**
     * Determine whether to display the SOTD CTA
     */
    displaySOTD: function() {
        return (typeof onlineSchedulerLink === "object" &&
                onlineSchedulerLink !== null &&
                onlineSchedulerLink.enabled === true);
    },
    /**
     * Open the SOTD site form (CTA action)
     */
    scheduleTestDrive: function() {
        this.getExternalUrl("http://www.shoplexusdealer.com/testDrive/consumer/home.htm?dealerCode=" + ContextManager.dealerCode);
        Cobalt.partners.Lexus.NewModelsPage.clickScheduleTestDriveLink();
    },
    /**
     * Determine whether to display the inventory CTA
     */
    displayInventory: function() {
        return (typeof Cobalt.lexus === "object" &&
                Cobalt.lexus !== null &&
                typeof Cobalt.lexus.browseInventory === "object"  &&
                Cobalt.lexus.browseInventory !== null &&
                Cobalt.lexus.browseInventory.enabled === true);
    },
    /**
     * Open the inventory site (CTA action)
     */
    browseInventory: function(use_model) {
        Cobalt.lexus.browseInventory.open(use_model);
        Cobalt.partners.Lexus.NewModelsPage.clickShowcaseCTALink('View New Inventory');
    }
};
