<!-- Template ID = 18450 Template Name = MediaBrix SocialFlex 1.4 Video MP4/FLV [IFRAME] -->
         
          <script type="text/javascript">
          var mb_type = "%eenv!"
          var mb_payload = {
          "euui" : "%ebuy!", //populated from mediabrix metrics server
          "myfbuserid" : null, // From publisher
          "orderName" : "Sandro's test order", //manually entered in DFP
          "adid" : "%eaid!", //ad id from DFP macro
          "crid" : "%ecid!", //creative id from DFP macro
          "siteName" : "%s", //site name from DFP
          "zoneName" : "", //manually entered in DFP template as zone.
          "postUrl" : "http://mediabrix-metrics-us.cloudapp.net/", //Domain of the metrics server
          "host" : document.domain,
          "session" : null,
          "product_type" : "socialFlex",
          }
          function addMetrics(){
                    var ad_page;
                    if(mb_type=="j"){
                         ad_page = parent.document.getElementById('socialFlexHolder').parentNode;
                    }else{
                         ad_page = document.body;
               }
          var metrics_script = document.createElement('script');
          metrics_script.id = "mb_metrics";
          metrics_script.src = "https://mediabrix.hs.llnwd.net/o38/v1_4/metrics.js"
          ad_page.appendChild(metrics_script);
          }
          //Populate missing optional values in socialVars with the corresponding var from mbDefaults.
          function compareSocialWithDefault(){
          var options = ["confirmText","autoplay","automute","iconURL","backgroundURL","share", "youtube", "twitter", "tweet","facebook","linkedin","feedback", "data_capture"];
          for (var i=0;i<options.length;i++) {
          if(typeof(socialVars[options[i]]) === 'undefined'){
          socialVars[options[i]] = mbDefaults[options[i]];
          }
          }
          }
          // **** start feedback engine **** //
          function mb_feedback_message(){
          var mb_message = "<h3>Thank you for your feedback</h3>";
          document.getElementById('mb_feedback_form').innerHTML = mb_message;
          document.getElementById('mb_feedback_form').style.textAlign = "center";
          document.getElementById('mb_feedback_form').style.top = "210px";
          setTimeout('mb_kill_message()', 1500);
          }
          // ** Fetch forms from limelight ** //
          function mb_fetch_form(form_id){
          var new_script = document.createElement('script');
          new_script.id = "preview_form_script";
          new_script.src = "https://mediabrix.hs.llnwd.net/o38/data_capture/form_" +form_id+ ".js";
          document.body.appendChild(new_script);
          }
          function mb_kill_message(){
          document.getElementById('mb_feedback_form').style.display = "none";
          }
          function mb_cancel_feedback(){
          document.getElementById('mb_feedback_form').style.display = "none";
          document.getElementById('mb_click_pop1').style.display = "block";
          document.getElementById('mb_click_pop2').style.display = "block";
          document.getElementById('mb_click_pop3').style.display = "block";
          }
          function mb_show_feedback(form_id){
          mb_fetch_form(form_id);
          document.getElementById('mb_feedback_form').style.display = "block";
          document.getElementById('mb_click_pop1').style.display = "none";
          document.getElementById('mb_click_pop2').style.display = "none";
          document.getElementById('mb_click_pop3').style.display = "none";
          }
          function mb_show_data_cap(){
          if(mb_vars.dc){mb_fetch_form(mb_vars.dc);}
          document.getElementById('mb_data_cap').style.display = "block";
          }
          function mb_submit_data_cap(){
          document.getElementById('mb_data_cap').style.display = "none";
          }
          // **** end feedback engine **** //

          // **** Start Sharing Options **** //
          // ** Sharing data
          var mbDefaults ={
          "youtube" : "mebiabrix", "twitter" : "mebiabrix",
          "tweet" : "mebiabrix",
          "facebook" : "mebiabrix", "linkedin" : "mebiabrix", "feedback" : 30, "data_capture" : 27,
          "share" : [], "autoplay" : "true", "automute" : "false"
          }
          var options = ["youtube", "twitter", "tweet","facebook","linkedin"];
          for (var i=0;i<options.length;i++) {
          if(typeof(mbDefaults[options[i]]) !== 'undefined' && mbDefaults[options[i]] != ""){
          mbDefaults.share.push(options[i]);
          }
          }
          //Toggle visibility of share buttons
          function toggleShareIcons(){
          //Loop through socialVars.share and display those elements
          if(typeof(socialVars.share) != 'undefined'){
          shares = socialVars.share;
          }else if(typeof(socialVars.share) != 'undefined'){
          shares = socialVars.share;
          }
          //Hide all share icons unless shares = all
          if(shares === "all"){return false;}
          var icons = document.getElementsByClassName('mb_share_icon');
          for (var i=0;i<icons.length;i++) {
          icons[i].style.display = "none"; }
          //Loop through socialVars.share and display those elements; reuse var i
          for (var i=0;i<shares.length;i++) {
          //window["mb_"+shares[i]+"_share"](document.getElementById('mb_confirm_'+shares[i]));
          window["mb_"+shares[i]+"_share"](document.getElementById('mb_share_'+shares[i]));
          }
          }
          // *** Display share icons and attach click events ***// //Facebook buttons
          function mb_facebook_share(button){
          button.onclick = function(){
          window.open('http://www.facebook.com/sharer/sharer.php?u='+socialVars.facebook +'/','_blank','width=640,height=400, toolbar=no');
          mb_metrics.logEvent('share', 'facebook');
          return false;
          };
          button.style.display = "block";
          }
          //LinkedIn buttons
          function mb_linkedin_share(button){
          button.onclick = function(){ window.open('http://www.linkedin.com/cws/share?url='+socialVars.linkedin+'&original_referer=&token=&isFramed=false&_ts=','_blank','width=600,height=400, toolbar=no');
          mb_metrics.logEvent('share', 'linkedin');
          return false;
          };
          button.style.display = "block";
          }
          //Tweet buttons
          function mb_tweet_share(button){
          button.onclick = function(){ window.open('https://twitter.com/intent/tweet?original_referer='+document.location.href+'&source=tweetbutton&text=&url='+socialVars.tweet+'/' ,'_blank','width=640,height=400, toolbar=no');
          mb_metrics.logEvent('share', 'tweet');
          return false;
          };
          button.style.display = "block";
          }
          //Twitter buttons
          function mb_twitter_share(button){
          button.onclick = function(){
          window.open('https://twitter.com/'+socialVars.twitter +'/','_blank');
          mb_metrics.logEvent('share', 'twitter');
          return false;
          };
          button.style.display = "block";
          }
          //Youtube buttons
          function mb_youtube_share(button){
          button.onclick = function(){
          window.open('http://www.youtube.com/user/'+socialVars.youtube +'/','_blank');
          mb_metrics.logEvent('share', 'youtube');
          return false;
          };
          button.style.display = "block";
          }
          // **** End Sharing Options **** //
          // **** Start Countdown Timer **** //
          var time_to = "";
          var timer_count = 5;
          function sf_start_Timer(){
          if(time_to == ""){
          time_to = window.setInterval("sf_countDown()", 1000);
          }else{
          sf_stop_Timer();
          }
          }
          function sf_stop_Timer(){
          if(time_to != ""){
          window.clearInterval(time_to);
          time_to = "";
          document.getElementById('mb_divForTimer').innerHTML = "";
          document.getElementById('mb_close').style.display = "block";
          }
          }
          function sf_countDown(){
          document.getElementById('mb_divForTimer').innerHTML = timer_count;
          timer_count--;
          if(timer_count == -1){
          sf_stop_Timer();
          }
          }
          // **** End Countdown Timer **** //
          //Apply publisher settings to the unit
          function initSocialVars(){
          if(typeof(socialVars) == 'undefined'){socialVars={}};
          //Compare socialVars with mbDefaults.
          compareSocialWithDefault();
          attachSocialFlex();
          //Toggle Share buttons
          toggleShareIcons(); }
          // **** Start Removal of SocialFlex Instance **** //
          function closeSocialFlex(){
          var t_div = document.getElementById('socialFlexHolder');
          var d_div = document.getElementById('mb_canvas');
          t_div.style.width = '1px';
          t_div.style.height = '1px';
          t_div.removeChild(d_div);
          //Send termination message to publisher if(typeof(socialVars.callback) != 'undefined') fireCallBack();
          }
          // **** End Removal of SocialFlex Instance **** //
         
          function attachSocialFlex(){
              
               var strVar = "          <style type=\"text\/css\">\n          #socialFlexHolder { position:absolute: z-index:400000; width:100%; overflow:hidden; left:0px; top:0px; }\n          #mb_canvas { font-family:Lucida Grande, Arial; overflow:hidden; width:644px; height:500px; border:3px solid black; margin:0 auto; border-radius:10px; -moz-border-radius:10px; -webkit-border-radius:10px; box-shadow:0px 0px 5px #000; -moz-box-shadow:0px 0px 5px #000; -webkit-box-shadow:0px 0px 5px #000; }\n          #mb_branded_bg { float:left; width:644px; height:453px; overflow:hidden; background:url(\'https:\/\/mediabrix.hs.llnwd.net\/o38\/brands\/tmobile\/bg.jpg\') #ccc; text-align:center; }\n          #mb_close { margin:3px 3px 0 0; display:none; float:right; width:33px; height:32px; background:url(\'https:\/\/mediabrix.hs.llnwd.net\/o38\/socialflex\/images\/share\/mb_close.png\'); cursor:pointer; }\n          #mb_video_holder { margin:182px 0 0 241px; width:360px; height:203px; overflow:hidden; background:#fff; }\n          #mb_social_share_links { float:left; width:634px; padding:5px; overflow:hidden; background:#fff; }\n          #mb_logo { overflow:hidden; float:left; margin:0 80px 0 0; width:100px; height:36px; background:url(\'https:\/\/mediabrix.hs.llnwd.net\/o38\/socialflex\/images\/share\/mb_logo.png\'); }\n          .mb_share_icon { float:left; height:36px; padding:0 8px 0 8px; margin:0 0 0 0; cursor:pointer; }\n          #mb_feedback { overflow:hidden; float:right; width:75px; height:19px; cursor:pointer; background:url(\'https:\/\/mediabrix.hs.llnwd.net\/o38\/socialflex\/images\/share\/feedback.png\'); }\n          #mb_feedback_form { display:none; line-height:3.0em; float:left; width:644px; height:494px; color:#252525; overflow:hidden; background:#fff; text-align:center; font-family:Lucida Grande, Arial; }\n          <\/style>\n          <div id=\"mb_canvas\">\n          <div id=\"mb_feedback_form\">\n          <div id=\"mb_data_form\"><\/div>\n          <\/div>\n          <div id=\"mb_branded_bg\">\n          <div id=\"mb_click_pop1\" class=\"clicker\" onclick=\"window.open(\'%c%u\');\"><img src=\"http:\/\/www.google.com\" border=\"0\" width=\"1\" height=\"1\" \/><\/div>\n          <div id=\"mb_click_pop2\" class=\"clicker\" onclick=\"window.open(\'%c%u\');\"><\/div>\n          <div id=\"mb_click_pop3\" class=\"clicker\" onclick=\"window.open(\'%c%u\');\"><\/div>\n          <div id=\"mb_close\" onclick=\"closeSocialFlex(); mb_metrics.logEvent(\'close\', true);\"><\/div>\n          <div id=\"mb_divForTimer\" style=\"margin:9px 3px 0 0; float:right; width:33px; height:32px; line-height:1.8em; color:#000; font-weight:bold; font-size:0.7em; font-family:arial;\"><\/div>\n          <div id=\"mb_video_holder\">\n          <object type=\"application\/x-shockwave-flash\" data=\"http:\/\/mediabrix.vo.llnwd.net\/o38\/socialflex\/jwplayer\/player.swf\" width=\"360\" height=\"203\">\n          <param name=\"movie\" value=\"http:\/\/mediabrix.vo.llnwd.net\/o38\/socialflex\/jwplayer\/player.swf\" \/>\n          <param name=\"allowfullscreen\" value=\"true\" \/>\n          <param name=\"allowscr"+"iptaccess\" value=\"always\" \/>\n          <param name=\"flashvars\" value=\"file=http:\/\/mediabrix.vo.llnwd.net\/o38\/brands\/tmobile\/tmobile.mp4&autostart="+socialVars.autoplay+"&controlbar.position=over&mute="+socialVars.automute+"&provider=video\" \/>\n          <\/object>\n          <\/div>\n          <\/div>\n          <div id=\"mb_social_share_links\">\n          <div id=\"mb_logo\"><\/div>\n          <div id=\"mb_share_txt\" style=\"overflow:hidden; float:left; width:43px; height:36px; background:url(\'https:\/\/mediabrix.hs.llnwd.net\/o38\/socialflex\/images\/share\/share.png\')\"><\/div>\n          <div class=\"mb_share_icon\" id=\"mb_share_facebook\">\n          <img src=\"https:\/\/mediabrix.hs.llnwd.net\/o38\/socialflex\/images\/share\/facebook.png\" border=\"0\" alt=\"like us facebook\" \/>\n          <\/div>\n          <div class=\"mb_share_icon\" id=\"mb_share_linkedin\">\n          <img src=\"https:\/\/mediabrix.hs.llnwd.net\/o38\/socialflex\/images\/share\/linkedin.png\" border=\"0\" alt=\"like us facebook\" \/>\n          <\/div>\n          <div class=\"mb_share_icon\" id=\"mb_share_tweet\">\n          <img src=\"https:\/\/mediabrix.hs.llnwd.net\/o38\/socialflex\/images\/share\/tweet.png\" border=\"0\" alt=\"Tweet!\" \/>\n          <\/div>\n          <div class=\"mb_share_icon\" id=\"mb_share_twitter\">\n          <img src=\"https:\/\/mediabrix.hs.llnwd.net\/o38\/socialflex\/images\/share\/twitter.png\" border=\"0\" alt=\"Follow us on Twitter\" \/>\n          <\/div>\n          <div class=\"mb_share_icon\" id=\"mb_share_youtube\">\n          <img src=\"https:\/\/mediabrix.hs.llnwd.net\/o38\/socialflex\/images\/share\/youtube.png\" border=\"0\" alt=\"Follow us on YouTube\" \/>\n          <\/div>\n          <div id=\"mb_feedback\" onclick=\"mb_show_feedback(\'30\'); return false;\"><\/div>\n          <\/div>\n\n          <\/div>"

               if(mb_type == "j"){
                    document.getElementById('socialFlexHolder').innerHTML = strVar;
                    document.getElementbyId('mb_canvas').className = 'jstag';
               } else {
                    document.write(strVar);
               }              
              
          }
         
          initSocialVars();
          addMetrics();
          sf_start_Timer();
          </script>