/*
** exed.js - Exed Javascript Library
** jgriffith
**
*/


Core.settings({site:'exed',
               plugins:'/js/plugins'
               });


(function($){

var Exed = {
    
    domready: function() {
        if (document.body && document.body.className.indexOf('admin') > -1) {return;}
        Exed.currproduct();
        Exed.allprograms();
        Exed.upcoming();
        Exed.sidebarhacks();
        Exed.programfinder();
        Exed.expandprograms();
        Exed.sortprograms();
        Exed.sendtofriend();
        Exed.rendervideos();
        Exed.embeddedvideo();
        Exed.links();
        Exed.videolightbox();
        Exed.videoboxes();
        Exed.mediaplex();
        if (window.before_analytics_save) {before_analytics_save()}
        if (window.analytics) {analytics.save();}
    },
    
    asap: function() {
        if (document.body && document.body.className.indexOf('admin') > -1) {return;}
        Exed.topnav();
        Exed.subnav()
        Exed.innernav();
        Exed.currprogram();
        Exed.currtopic();
        $("#subnav").css('visibility','visible');  //have it become visible after rendering
    },
    
    
    
    /*
     * Handles the "search" text in the search box
     */
    
     search_input: function(text,input) {  
       input = document.getElementById(input);
       if (!input) return false;
       input.onfocus = function() {
          if (this.value == text) {this.value = "";}
       }
       input.onblur = function() {
          if (this.value == "") {this.value = text;}
       }
     },
    
     /*
      * Add an 'on' class to the top nav
      */
     
     topnav: function() {
        function sethere(id) {
            var a = document.getElementById(id+'-nav');
            if (!a){return};
            a.parentNode.className += ' on';
            a.className += ' on';
        }
        if (document.location.href.indexOf('/advantage/') > -1) {
            sethere('advantage');
        } else if (document.location.href.indexOf('/products/') > -1) {
            sethere('advantage');
        } else if (document.location.href.indexOf('/programs/') > -1) {
            sethere('programs');
        } else if (document.location.href.indexOf('/atwork/') > -1) {
            sethere('atwork');
        } else if (document.location.href.indexOf('/campuslife/') > -1) {
            sethere('campuslife');
        } else if (document.location.href.indexOf('/connect/') > -1) {
            sethere('connect');
        } else if (RegExp('/(request|admissions)/').test(document.location.href)) {
            sethere('admissions');
        } else if (document.location.href.indexOf('/faq.html') > -1) {
            sethere('faqs');
        }
    },
    
    /*
     * Add an 'on' class to 'innernav'
     */
    
    innernav: function() {
         var nav = document.getElementById('innernav');
         if (!nav) return;
         
         var links = nav.getElementsByTagName('a');
         var thisurl = Exed.thisurl();
         for (x=0,total=links.length;x<total;x++) {
             if (Exed.sameurl(thisurl,links[x])) {
                  links[x].className = 'selected';
                  var li = links[x].parentNode;
                  li.className += 'on';
                  li = li.parentNode;
                  li.className += ' on';
             }
         }
    },

    /*
     * Add an 'selected' class to 'subnav'
     */

    subnav: function() {
         var nav = document.getElementById('subnav');
         if (document.getElementById('expandall')) return;
         if (!nav) return
        
         var links = nav.getElementsByTagName('a');
         var thisurl = Exed.thisurl();
         for (x=0,total=links.length;x<total;x++) {
             if (Exed.sameurl(thisurl,links[x])) {
                  links[x].className = 'on';
             } 
         }
        
    },

    currproduct: function() {
        var nav = document.getElementById('tel-nav');
        if (!nav) return;
        if (RegExp("/products/").test(document.location.href)) {nav.className='on'}
    },

    upcoming: function() {
        if (!document.getElementById('upcoming2')) { return }
        
        $("#upcoming2-months a").click(function() {
           var id = this.id.replace("a2-",'');
           $("#upcoming2-months a.active").removeClass("active");
           $(this).addClass("active");
           document.getElementById("upcoming-iframe").contentWindow.scrollto(id);
           return false;
        });
    

    },
    
    programfinder: function(){
      $("#results td.more a").click(function(){
        if ($(this).text() == "Close") {
           $(this).text("More");
        } else {
           $(this).text("Close");
        }
        $(this).parent().parent().toggleClass("expanded");
        return false;
      });
    },

    sidebarhacks: function() {
      var html =  $("#content div.video-feature").hide().html();
      $("#sidebar div.feature2").before(html);
    },
    
    /*
     * All Programs Button
     */

    allprograms: function() {
       $("#expandall").click(function(){
            $("#subnav ul.expandable li").attr("class","open");
            $(this).hide();
            $("#closeall").show();
            return false;
       });
       $("#closeall").click(function(){
            $("#subnav ul.expandable li").attr("class","closed");
            $(this).hide();
            $("#expandall").show();
            return false;
       });
    },


    /*
     * Highlight the current program 
     */

     currprogram: function() {
         if($("#subnav ul.expandable").size() == 0) {return;}
         var re = new RegExp("/programs/(.*?)/")
         var m = document.location.href.match(re);
         if (!m && !window.program_nav) return;
         
         var curr = window.program_nav || m[1];
         var a = document.getElementById(curr+'-subnav');
         if (!a) return;
         a.className = "on";
         
         if (curr == 'custom') {return};
         
         var parent = a;
         for (var x=0;x<5;x++) {
            parent = parent.parentNode;
            if (parent.id == 'subnav') return;
            
            if (parent.className.indexOf('expandable') == -1) {
                parent.className = "open";
            }
            if (parent.nodeName == 'LI') {
                var links = parent.getElementsByTagName('a');
                if (links[0]) {
                   if (links[0].className.indexOf('toggler') > -1) {
                      links[0].className = 'on toggler';
                   } else {
                      links[0].className = 'on';
                   }
                }
            }
            
         }
     
     },


    /*
     * Highlight the current topic 
     */
     currtopic: function() {
         if (!window.topic_nav) return;
         var curr = window.topic_nav;
         $("#subnav a:contains('"+curr+"')").each(function(){
           var $this = $(this);
           $this.addClass("on");
           $this.parent().addClass("open");
           $this.parent().parent().addClass("open");
           $this.parent().parent().parent().addClass("open");
         });
     },

    /*
     * Expand Program Nav
     */

     expandprograms: function () {
        $("#subnav ul.expandable a.toggler").click(function(){ 
              var mom = this.parentNode;
              if ( mom.className == "open" ) {
                    mom.className = "closed";
              } else { 
                    var grandma = this.parentNode.parentNode;
                    var aunts = grandma.getElementsByTagName('li');
                    for ( var c=0; c<aunts.length; c++ ) {
                         aunts[c].className = "closed";
                    }
                    mom.className = "open";
              }
              return false;
        });
    },


    /*
     * Program sorting on /category/ and /landing/ pages
     */
     
     sortprograms: function() {
       $("div.programlist").each(function(){ 
         var $container = $(this);
         var $programs = $(this).find(".program");
         $programs.each(function(){
            var d = $("div.sortdate:first",this).text()
            $("div.sortdate:first",this).text(new Date(parseInt(d+"000")).toString());
            $(this).attr("sortdate",d);
         });
         $sorted = $.makeArray($programs);
         $sorted.sort(function(a,b) {
            var as = $(a).attr("sortdate");
            var bs = $(b).attr("sortdate");
            return as - bs;
         });
         
         $container.empty();
         var now = new Date();
         var others = new Array();
         $.each($sorted,function(){
            var date = $(this).attr("sortdate");
            var then = new Date();
            then.setTime(date+"000");
            if (then<now) {
               others.push(this);
            } else {
               $container.append(this);
            }
         });
         others.reverse();
         $.each(others,function(){
               $container.append(this);
         })
         $container.css("visibility","visible");
       })
       
       
     },


    /*
     * Adds the referral url to the friend link
     */

    sendtofriend: function() {
       $("#sentofriend").each(function(x,y){ 
         var link = $(y);
         link.addClass('new_window');
         link.attr("href",link.attr("href")+'&referrer='+document.location);
       })
    },

    /*
     *  finds and enables video objects
     */ 

    rendervideos: function() {
       var num = 0;
       $("object[@class='video']").each( function(i,v) {
           var vid = $(v);
           var src = $("param[@name='source']",vid).attr('value');
           var img = $("param[@name='image']",vid).attr('value');
           var fmt = $("param[@name='format']",vid).attr('value');
           var size = $("param[@name='size']",vid).attr('value');
           vid.replaceWith('<div id="video-embed-'+num+'"></div>');
           
           var fo;
           if (fmt == 'wide' && size == 'large') {
               fo = new SWFObject("/flash/player.swf", "flash"+num, 480, 270+30, "8", "#000000");
               fo.addVariable("image","/images/site/video_frame_large.gif");
               fo.addVariable("source",src);
               fo.addVariable("autoplay",true);
               fo.addVariable("allowFullScreen", "true");
               fo.addVariable("analytics", "true");
               fo.addParam("allowFullScreen", "true");
           } else if (size == 'large') {
               fo = new SWFObject("/flash/player.swf", "flash"+num, 480, 360+29, "8", "#000000");
               fo.addVariable("image","/images/site/video_frame_large.gif");
               fo.addVariable("source",src);
               fo.addVariable("autoplay",true);
               fo.addVariable("allowFullScreen", "true");
               fo.addVariable("analytics", "true");
               fo.addParam("allowFullScreen", "true");
           } else if (size == 'frontpage') {
               fo = new SWFObject("/flash/exec_inline_vid_336x189.swf", "flash"+num, 336, 189+29, "8", "#000000");
               fo.addVariable("screenshot","/images/site/video_frame_wide.gif");
               fo.addVariable("vidSource",src);
           } else if (fmt == 'wide') {
               fo = new SWFObject("/flash/exec_inline_vid_240x135.swf", "flash"+num, "240", "164", "8", "#000000");
               fo.addVariable("screenshot","/images/site/video_frame_wide.gif");
               fo.addVariable("vidSource",src);
           } else {
               fo = new SWFObject("/flash/exec_inline_vid.swf", "flash"+num, "240", "209", "8", "#000000");
               fo.addVariable("screenshot","/images/site/video_frame.gif");
               fo.addVariable("vidSource",src);
           }
           fo.addParam("wmode","transparent");
           
           
           if (!fo.installedVer.versionIsValid(fo.getAttribute('version'))) {
              //fo.installedVer.major
              $("#video-embed-"+num).append('<p class="noflash">Adobe Flash is required.  <a href="http://www.adobe.com/go/getflashplayer"><br /><img src="/images/site/get_flash_player.gif" height="31" width="88" /></a></p>');
           } else {
              fo.write("video-embed-"+num);
           }
           num += 1;
       });
    },


    /*
     * Handles the embedded video on the video-insights
     */ 
     
     embeddedvideo: function() {
       var loc = $("#video-embed");
       if (!loc) {return};
       $("a.embedded-video").click(function() {
             var a = $(this);
             var url = a.attr('href');
             loc.hide();
             loc.load(url+" table.video",null,function(a){
                Exed.rendervideos(); 
                loc.fadeIn('slow');
             });
             return false;
          });
    
     },

     videolightbox: function() {
        $("a.video-lightbox[href~=/assets/videos/]").click(function(){return false;});
        if( $("a.video-lightbox[href~=/assets/videos/]").size() != 0) {
              $.ajax({
                      type: 'GET',
                      url: '/js/plugins/fancyzoom.js',
                      cache: true,
                      success: function() {
                          $("a.video-lightbox[href~=/assets/videos/]").each(function(){
                               var height = 400;
                               if ($(this).hasClass('ratio-4-3')) { height = 500 };
                               $(this).fancyZoom({width:500, height:height,directory: '/js/plugins/fancyzoom/images'});
                               $(this).click(function() {
                                      var a = $(this);
                                      var url = a.attr('href');
                                      $("#zoom_content").load(url+" table.video",null,function(a){
                                               analytics.view(url);
                                               window.setTimeout(function(){$("#tmpimage").hide();Exed.rendervideos();},100);
                                               //Exed.rendervideos();
                                               //$("#zoom_content td.desc").append('<img src="/images/site/video_still.gif" id="tmpimage" height="389" width="480">');
                                              });
                                      return false;
                               });
                            });
                      },
                      dataType: 'script',
                      data: null
              });
        }
     },
     
     videoboxes: function(){
        $(".featured-videos div.more").hide();
        $(".featured-videos p.more a").click(function(){
            if ($(this).hasClass('nomore')) { return; }
            $(".featured-videos div.more").slideToggle('fast');
            $(this).toggleClass('open');
            return false;
        });
     },
     

    /*
     * Reworks anchor tags
     */ 
     
     links: function() {
   
       $("a").each(function(x,link){

          if (link.className.indexOf("new_window") > -1) {
             $(link).click(function(){
                     Exed.new_window(link);
                     analytics.view(link.href);
                     return false;
             });
          }
          
          if (Exed.has_completed_leadgen() && link.className.indexOf("pdf") > -1) {
             $(link).click(function(){
                     Exed.new_window(link);
                     analytics.view(link.href);
                     return false;
             });
          }
          
          if (link.className.indexOf('print') > -1 && link.href.indexOf('#') > -1) {
             $(link).click(function(){
                     window.print();
                     return false;
             });
          }

          if (link.className.indexOf('mp3') > -1) {
              Exed.make_audio_player(link);
          }
          

          if (/\/apply.pdf$/.test(link.href)) {
             $(link).click(function(){
                 var re = new RegExp("/programs/(.*?)/")
                 var m = this.href.match(re);
                 Marketing.track_apply_pdf(m[1]);
             });
          }
          
          if (/\.pdf$/.test(link.href)) {
             $(link).click(function(){
                Exed.new_window(this);
                analytics.view(this.href);
                return false;
             });
          }
          
          if (/medvideo_nocaption.html/.test(link.href)) {
             $(link).click(function(){
                Exed.video_popup(link);
                analytics.view(link.href);
                return false;
             });
          }
          
          if (/video_flash.html/.test(link.href)) {
             $(link).click(function(){
                Exed.video_popup(link);
                analytics.view(link.href);
                return false;
             });
          }
          
          
       
       });
    
     },

     make_audio_player: function(a){
         var src = $(a).attr('href');
         var fo = new SWFObject("/flash/audio/audio-player.swf", "flashObject", "290", "24", "8", "#ffffff");
         fo.addVariable("soundFile", src);
         fo.addVariable("bg","0xEFEFEF");
         fo.addVariable("leftbg","0x265086");
         fo.addVariable("lefticon","0xF2F2F2");
         fo.addVariable("rightbg","0x265086");
         fo.addVariable("rightbghover","0x5a87c0");
         fo.addVariable("righticon","0xF2F2F2");
         fo.addVariable("righticonhover","0xFFFFFF");
         fo.addVariable("text","0x454545");
         fo.addVariable("slider","0x454545");
         fo.addVariable("track","0xF6F6E8");
         fo.addVariable("border","0xF6F6E8");
         fo.addVariable("loader","0xAAAAAA");
         if (fo.installedVer.versionIsValid(fo.getAttribute('version'))) {
             fo.write(a);
         }
     },

     feature_push_append: function(html){
        $("#sidebar div.feature2 div.featurelink").append(html);
     },

     mediaplex: function() {
        $("a.applyonline").click(function() { 
          //set program name for Mediaplex Adserver call-back on application submission
          var re = new RegExp("/programs/(.*?)/")
          var m = document.location.href.match(re);
          Core.cookie('mediaplexprogramapp', m[1], {expires: 30}); 
          //send Mediaplex Adserver call-back for program application 
          Marketing.track_apply_web();
          return true;
        });
     },

    /*
     * Analytics Campaigning
     */

     campaigns: function() {
         var c = Exed.getParam('campaign');
         if (Exed.getParam('mp')) { c = "ee-"+Exed.getParam('mp') }
         if (Exed.getParam('lsoft')) { c = "ee-lsoft-"+Exed.getParam('lsoft') }
         if (c) {analytics.campaignStart(c)}
     },


    /*
     * Support Functions
     */

    thisurl: function() {
         var thisurl = document.location.href;
         if (thisurl.indexOf('#') > -1) {
            thisurl = thisurl.split(/#/)[0];
         }
         if (thisurl.indexOf('list_editables') > -1 ) {
            thisurl = document.referrer;
         }
         return thisurl;
    },

    normalize: function(url) {
        url = url.replace(/index.html/,'')
        return url;
    },

    sameurl: function(url,link) {
        if (!link || !link.href){return 0}
        if (Exed.normalize(url) == Exed.normalize(link.href)) {return 1};
        return 0;
    },
    
    checkMail: function(email) {
        var result = 0;
        var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if (filter.test(email)) result = 1;
        return result;
    },
    
    has_completed_leadgen: function() {
        if (Core.cookie('leadgen') == 'complete') {
           return 1;
        } else {
           return 0;
        }
    },
    
    getParam: function(param,paramStr) {
        // gets a parameter value from the query string
        var query = paramStr || window.location.search.substring(1);
        var parms = query.split('&');
        for (var i=0; i<parms.length; i++) {
           var pos = parms[i].indexOf('=');
           if (pos > 0) {
              var key = parms[i].substring(0,pos);
              var val = parms[i].substring(pos+1);
              val = val.replace(/\+/g,' ');
              if (key == param) {
                return unescape(val)
            }
          }
       }
        return null
    },

    new_window: function(link) {
      var url = link.href || link;
      var nw = window.open(url, "newwin", 'width=800,height=650,directories=yes,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
      if (nw) {nw.focus();}
    },
    
    video_popup: function(link) {
      var url = link.href;
      var nw = window.open(url, "videopopup", 'width=515,height=460,directories=yes,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
      if (nw) {nw.focus();}
    }
  
    
}

var Marketing = {

    imgs: [],
   
    track_brochure_request: function() {
       analytics.conversion("brochure-request") 
       if(!analytics.user.isAdmin()) {
           Marketing.img("http://altfarm.mediaplex.com/ad/bk/9203-51920-3840-0?BroThx=1&mpuid=");
					 Marketing.iframe("http://img-cdn.mediaplex.com/0/12896/universal.html?page_name=brochure_request_thanks&Brochure_Request_Thanks=1&mpuid=");
					 // following were removed 09/29/09, can be deleted next time this is updated
           //Marketing.img("http://www.burstnet.com/enlightn/3778//7830/");
           //Marketing.img("http://www.burstbeacon.com/beacon/55109/0/broreq/0");
           //var axel = Math.random()+""; var a = axel * 10000000000000;
           //Marketing.img("http://ad.doubleclick.net/activity;src=1538374;type=hbs08607;cat=confi527;ord=1;num="+a);
       }
    },

    track_brochure_download: function() {
       // this code is in www.hbs.edu/apps/irm/js/irm.js
    },

    /*
     * program application
     */
     
    track_apply_web: function() {
       if(!analytics.user.isAdmin()) { 
          Marketing.img("http://altfarm.mediaplex.com/ad/bk/9203-51920-3840-0?AppWeb=1&mpuid=");
       }
    },

    track_apply_thanks: function(pgm) {
       
       if (!pgm) { pgm = "unknown"}

       pgm = pgm.toLowerCase();
          
       // Unica
       analytics.conversion("apply-"+pgm);
          
       // don't send conversion info for admin users (Faculty/Staff) - re: the preceding conversion code, Unica is covered 
       // within the conversion function 
       if(!analytics.user.isAdmin()) { 

           // Google
           if(pgm && window.pageTracker) {
               pageTracker._trackPageview("/event/apply/"+pgm+"/completed");
               pageTracker._trackEvent("apply",pgm);
           }

           // This bit of javascript generates the correct call-back to Mediaplex Adserver.
           // Users follow links to applications, served by member.exed, from www.exed. The application confirmation
           // page, served by member.exed, src's this file from www.exed as an iFrame. The page that is sourcing this file
           // is itself part of a frameset.
           //
           // Following a program application link on www.exed sets a cookie, mediaplexprogramapp, that contains the name of the program.
           // This reads the program name out of the cookie and checks it against of a list of programs that have unique Mediaplex tags.
           // Finally, it sets the tag accordingly and nulls out the cookie.
           //
           // Unique tags are simply the program acronym.          
           var url = 'http://altfarm.mediaplex.com/ad/bk/9203-51920-3840-0?';
           var programList = new Array('amp', 'gmp', 'pld', 'opm', 'blcc', 'sbsca', 'dme', 'ac', 'agbi', 'bms', 'bv', 'cc', 'crma', 'dcp', 'dis', 'dm', 'dmi', 'fse', 'gsm', 'hplp', 'lbp', 'lcor', 'lhco', 'lpi', 'lpsf', 'lrie', 'mbse', 'lsec', 'lspb', 'mcb', 'mcbc', 'mi', 'path', 're', 'rei', 'sfa', 'smm', 'spnm', 'tcl', 'tgn', 'wlf', 'sepc', 'ret', 'tmd', 'cfs', 'mhcd', 'rem', 'abs', 'csr', 'fib', 'pevc', 'med', 'medc', 'gne', 'agb', 'bgei', 'lnv', 'sn', 'sfsb', 'mndp', 'turn'); 
           if($.inArray(pgm,programList) > -1) { url = url + pgm.toUpperCase() + '=1'; } 
           else { url = url + 'AppThx=1'; }
           url = url + '&mpuid=';
           Marketing.img(url);

					 Marketing.iframe("http://img-cdn.mediaplex.com/0/12896/universal.html?page_name=application_thanks&Application_Thanks=1&mpuid=");

					 // following were removed 09/29/09, can be deleted next time this is updated
           //var axel = Math.random()+""; var a = axel * 10000000000000;
           //Marketing.img("http://ad.doubleclick.net/activity;src=1538374;type=hbs08607;cat=confi527;ord=1;num="+a);
           //Marketing.img("http://www.burstbeacon.com/beacon/55109/0/appthx/0");
           //Marketing.img("http://www.burstnet.com/enlightn/3778//7830/");
        }
      
    },

    track_leadgen: function() {
       analytics.conversion("leadgen") 
       if(!analytics.user.isAdmin()) {
          Marketing.img("http://altfarm.mediaplex.com/ad/bk/9203-51920-3840-0?LeadGen=1&mpuid=");
					Marketing.iframe("http://img-cdn.mediaplex.com/0/12896/universal.html?page_name=lead_gen&LeadGen=1&mpuid=");
       }
    },

    track_apply_pdf: function(pgm) {
       if(!analytics.user.isAdmin()) {
          Marketing.img("http://altfarm.mediaplex.com/ad/bk/9203-51920-3840-0?AppPDF=1&mpuid=");
					Marketing.iframe("http://img-cdn.mediaplex.com/0/12896/universal.html?page_name=application_pdf&Application_PDF=1&mpuid=");
					// following were removed 09/29/09, can be deleted next time this is updated
          //Marketing.img("http://www.burstbeacon.com/beacon/55109/0/apppdf/0");
          //Marketing.img("http://www.burstnet.com/enlightn/3778//7830/");
          //var axel = Math.random()+""; var a = axel * 10000000000000;
          //Marketing.img("http://ad.doubleclick.net/activity;src=1538374;type=hbs08607;cat=confi527;ord=1;num="+a);
       }
       if (!pgm) { pgm = "unknown"}
       analytics.conversion("applypdf-"+pgm);
    },

    iframe: function(src) {
       $("body").append('<iframe height="1" width="1" frameborder="0" src="'+src+'">');
    },

    img: function(src){
        var i = new Image(1,1);
        i.src = src;
        Marketing.imgs.push(i);
    }


}



var Outage = {

    links: "a[href*='iapply.html'], a[href*='/request/'], a[href*='member.exed.hbs.edu']",

    lead: function() {
        $(document).ready(function(){
           $(Outage.links).each( function(i,a) {
              a.href = "/cgi-bin/proceed?"+escape(a.href);
           });
        });    
    },

    down: function() {
        $(document).ready(function(){
            $(Outage.links).attr("href","/outage/"); 
        });
    }
    
}


window.Outage = Outage;
window.Exed = Exed;
window.Marketing = Marketing;
$(document).ready(function(){Exed.domready()});
Exed.asap();

})(jQuery);

function showClip(url,w,h)
{
       var x='http://www.exed.hbs.edu/corporaterelations/movie_player.html?&w='+w+'&h='+h+'&x='+url;
       var my_w=w+10;
       var my_h=h+10;
       window.open(x,'_video_window','width='+my_w+',height='+my_h
+',status=no,scrollbars=no,resizable=no,toolbar=no,menubar=no,left=30,screenX=30,top=20,screenY=20');
}

function new_window(u) {return Exed.new_window(u)};

// movie analytics
function flashEvent(msg) {
  analytics.view(msg);
}
