﻿var martin;
var flashFile;
$(function(){
   flashFile = $.flash.create({ swf: '800video.swf', height: 360, width: 640 });
}); 
    function MartinAgency() {
        this.showOverlay = function () {
            //tb_show(null, '/viewpopdynamic.aspx?page=HowToOrderVideo&KeepThis=true&TB_iframe=true&height=385&width=655', null);
            tb_show(null, '#TB_inline?height=540&width=708&inlineId=howToVideoModalContent', null);
             $("#howToVideoDiv").html(flashFile);
        }
        
        this.search = function(searchTerm) {
            window.parent.location.href = '/ProductSearch/?term=' + searchTerm;
        }
        
        this.launchChat = function() {
            popWin('Chat', '/clicktochat.aspx', 650, 420, 0, 0, 0, 0, 0, 0, 1);
        }

        this.setEvar32 = function(value) {
            var s = s_gi(s_account);
            s.linkTrackVars = 'eVar32,prop16';
            s.eVar32 = value;
            s.prop16 = value;
            s.tl(true, 'o', 'homePageFlashTracking');
            s.trackInlineStats = true;
        }

        this.spotlightClick = function(slideClicked) {
            switch (slideClicked) {
                case 'martin.showOverlay':
                    this.setEvar32('clickedToPlayVideo');
                    this.showOverlay();
                    break;

                case 'martin.launchChat':
                    this.setEvar32('clickedToChat');
                    this.launchChat();
                    break;
            }
        }

        this.loadSpotlight = function (slideIndex) {
        	// We no longer set Evar 32 here. It was deflating natural search tracking see TFS-13463
        }

        this.logOmnitureEventForVideoPercent = function(percent) {
            this.setEvar32('video' + percent + 'Percent');
        }

        this.searchedFromVideo = function(searchTerm) {
            this.setEvar32('searchedFromVideo');
            this.search(searchTerm);
        }

        this.logOmnitureEventForVideoCompleted = function() {
            this.setEvar32('videoCompleted');
        }

        this.logOmnitureEventForVideoPlayerButtonClick = function() {
            this.setEvar32('videoplayerButtonClicked');
        }

    };
martin = new MartinAgency();

