Sie sind auf Seite 1von 21

(function(window,undefined){if(window.WM&&window.WM.PlayerManager){return;} var Env={};Env.

defaultEnvironment="prod";var Builder={};var Ajax={};var Util={}; var Effect={};var Event={};var Data={};var Auth={};var Signer={};var QueryString ={};var Playlist={};var PlayerHtml5={};var WMClass=function(){};(function(Class) {var initializing=false,xyz=true,fnTest=/xyz/.test(function(){return xyz;})?/\b_ super\b/:/.*/;Class.extend=function(prop){var _super=this.prototype;initializing =true;var prototype=new this();initializing=false;for(var name in prop){prototyp e[name]=typeof prop[name]=="function"&&typeof _super[name]=="function"&&fnTest.t est(prop[name])?(function(name,fn){return function(){var tmp=this._super;this._s uper=_super[name];var ret=fn.apply(this,arguments);this._super=tmp;return ret;}; })(name,prop[name]):prop[name];} function Class(){if(!initializing&&this.init) this.init.apply(this,arguments);} Class.prototype=prototype;Class.prototype.constructor=Class;Class.extend=argumen ts.callee;return Class;};})(WMClass);Env.environment=Env.defaultEnvironment;Env. hostForEnvironment=function(hosts,replaceParams){if(Env.environment==="qa1"){ret urn Util.replace(hosts.qa1,replaceParams);}else if(Env.isInternal()){return Util .replace(hosts.internal,replaceParams);}else{return Util.replace(hosts.live,repl aceParams);}};Env.isTest=function(){return false;};Env.isInternal=function(){ret urn(/\.globoi\.com$/).test(Util.getHostname());};Env.isGloboDomain=function(){re turn(Env.isInternal()&&Env.environment==="qa1")||(/\.globo\.com$/).test(Util.get Hostname());};Env.HOSTS={API:{qa1:"api.video.qa01.globoi.com",internal:"api.vide o.globoi.com",live:"api.globovideos.com"},SECURITY:{qa1:"security.video.qa01.glo boi.com",internal:"security.video.globo.com",live:"security.video.globo.com"},PL AYER:{qa1:"s.videos.cma.qa01.globoi.com",internal:"s.videos.globo.com",live:"s.v ideos.globo.com"},CADUN:{qa1:"login.qa01.globoi.com",internal:"login.globo.com", live:"login.globo.com"},THUMB:{qa1:"img.video.qa01.globoi.com",internal:"s0{inde x}.video.glbimg.com",live:"s0{index}.video.glbimg.com"}};Env.apiHostname=functio n(){return Env.hostForEnvironment(Env.HOSTS.API);};Env.securityHostname=function (){return Env.hostForEnvironment(Env.HOSTS.SECURITY);};Env.playerHostname=functi on(){return Env.hostForEnvironment(Env.HOSTS.PLAYER);};Env.cadunHostname=functio n(){return Env.hostForEnvironment(Env.HOSTS.CADUN);};Env.thumbHostname=function( settings){return Env.hostForEnvironment(Env.HOSTS.THUMB,{index:(settings.videoID %4)+1});};RegExp.escape=function(str){var specials=new RegExp("[.*+?|()\\[\\]{}\ \\\]","g");return str.replace(specials,"\\$&");} if(!Array.prototype.indexOf){Array.prototype.indexOf=function(obj,start){for(var i=(start||0),j=this.length;i<j;i++){if(this[i]===obj){return i;}} return-1;}} QueryString.PLAYER_PARAMS_PREFIX="wmp_";QueryString.parse=function(url,prefix){p refix=(prefix!==undefined)?prefix:'';var parameters={};if(url){var queryString=u rl.split('?')[1];if(queryString){var allParams=queryString.split('&');for(var i= 0;i<allParams.length;i++){var keyValuePair=allParams[i].split('=');var paramKey= keyValuePair[0].toLowerCase();if((prefix.length===0)||(paramKey.indexOf(prefix)> =0)){parameters[QueryString.removePrefix(paramKey,prefix)]=QueryString._parseVal ue(keyValuePair[1]);}}}} return parameters;} QueryString.removePrefix=function(key,prefix){prefix=(prefix!==undefined)?prefix :'';return((prefix.length>0)&&(key.indexOf(prefix)===0))?key.substring(prefix.le ngth,key.length):key;} QueryString._parseValue=function(value){if(value===undefined||value=='true'){ret urn true;}else if(value=='false'){return false;}else{return value;}} Ajax.jsonp=function(settings){settings.callbackName=settings.callbackName||"json _callback";settings.timeout=settings.timeout||10000;window[settings.callbackName ]=function(data){if(!Ajax.isErrorObject(data)){settings.success(data);}else{sett ings.error(data);}} var head=Util.head();var script=document.createElement("script");script.setAttri bute("src",settings.url);script.setAttribute("async","async");script.onload=scri pt.onreadystatechange=function(eventLoad){if(!script.readyState||/loaded|complet e/.test(script.readyState)){if(settings.timeoutId){window.clearTimeout(settings.

timeoutId);} script.onload=script.onreadystatechange=null;if(head&&script.parentNode)head.rem oveChild(script);script=undefined;}};head.insertBefore(script,head.firstChild);i f(settings.error){settings.timeoutId=window.setTimeout(settings.error,settings.t imeout);}};Ajax.isErrorObject=function(data){return data&&data.http_status_code& &data.http_status_code!=200;} Util.Exception=function(message){this.message=message;};Util.notWhite=/\S/.test( "\xA0");Util.TrimRegex={trimLeft:Util.notWhite?/^[\s\xA0]+/:/^\s+/,trimRight:Uti l.notWhite?/[\s\xA0]+$/:/\s+$/};Util.nativeTrim=function(text){return text==null ?"":String.prototype.trim.call(text);};Util.customTrim=function(text){var trimLe ft=Util.TrimRegex.trimLeft;var trimRight=Util.TrimRegex.trimRight;return text==n ull?"":text.toString().replace(trimLeft,"").replace(trimRight,"");};Util.trim=St ring.prototype.trim?Util.nativeTrim:Util.customTrim;Util.findFirst=function(coll ection,callback){for(var index=0;index<collection.length;index++){if(callback(co llection[index],index)){return collection[index];}} return null;} Util.each=function(collection,callback){var index;if(collection instanceof Array ){for(index=0;index<collection.length;index++){callback(collection[index],index) ;}}else{for(index in collection){if(!collection.hasOwnProperty||collection.hasOw nProperty(index)){callback(collection[index],index);}}}};Util.eachObject=functio n(collection,callback){Util.each(collection,function(value,index){if(Util.isObje ct(value)){callback(value,index);}});};Util.map=function(array,callback){var res ult=[];Util.each(array,function(value,index){result.push(callback(value,index)); });return result;};Util.joinWithCamelCase=function(array){var first=array.splice (0,1);var joined="";Util.each(array,function(value){if(value){joined+=Util.capit alize(value);}});return first+joined;};Util.capitalize=function(value){return va lue.replace(value.charAt(0),value.charAt(0).toUpperCase());};Util.uncapitalize=f unction(value){return value.replace(value.charAt(0),value.charAt(0).toLowerCase( ));};Util.replace=function(template,params){var result=template;Util.each(params ,function(value,key){result=result.replace(new RegExp("{"+key+"}","g"),value);}) ;return result;};Util.JSONRegex={validChars:/^[\],:{}\s]*$/,validEscape:/\\(?:[" \\\/bfnrt]|u[0-9a-fA-F]{4})/g,validTokens:/"[^"\\\n\r]*"|true|false|null|-?\d+(? :\.\d*)?(?:[eE][+\-]?\d+)?/g,validBraces:/(?:^|:|,)(?:\s*\[)+/g};Util.parseJSON= function(data){if(typeof data!=="string"||!data){return null;} data=Util.trim(data);if(window.JSON&&window.JSON.parse){try{return window.JSON.p arse(data);}catch(e){throw new Util.Exception("Invalid JSON: "+data);}} var rvalidchars=Util.JSONRegex.validChars;var rvalidescape=Util.JSONRegex.validE scape;var rvalidtokens=Util.JSONRegex.validTokens;var rvalidbraces=Util.JSONRege x.validBraces;if(rvalidchars.test(data.replace(rvalidescape,"@").replace(rvalidt okens,"]").replace(rvalidbraces,""))){return(new Function("return "+data))();} throw new Util.Exception("Invalid JSON: "+data);};Util.getUserAgent=function(){r eturn navigator.userAgent;};Util.getHostname=function(){return location.hostname ;};Util.getCurrentUrl=function(){return location.href;};Util.isIPhone=function() {var userAgent=Util.getUserAgent();return(/iPhone/i).test(userAgent)||(/iPod/i). test(userAgent);};Util.isIPad=function(){return(/iPad/i).test(Util.getUserAgent( ));};Util.isAndroid=function(){return(/Android/i).test(Util.getUserAgent());};Ut il.isMobileBrowser=function(){return(Util.isIPhone()||Util.isIPad()||Util.isAndr oid());};Util.canUseFlashPlayer=function(){return!Util.isMobileBrowser();};Util. canPlayType=function(src){var video=document.createElement('video');return(video .canPlayType('video/'+src.split('?')[0].split('.').pop())!=="");};Util.navigateT o=function(uri){window.location.href=uri;} Util.isPrivate=function(attribute){return attribute.indexOf('_')===0;};Util.isPr imitive=function(value){return!(Util.isUndefined(value)||Util.isFunction(value)| |Util.isObject(value));};Util.isFunction=function(value){return(typeof value===" function");};Util.isObject=function(value){return(typeof value==="object");};Uti l.isUndefined=function(value){return(typeof value==="undefined");};Util.createEl ement=function(tagName,id,backgroundColor,opacity,width,height,position,top,left ,zIndex){var element=document.createElement(tagName);element.setAttribute('id',i d);if(arguments.length>2){element.style.display='none';element.style.backgroundC olor=backgroundColor;element.style.opacity=opacity;element.style.filter='alpha(o

pacity='+(opacity*100)+')';element.style.width=width;element.style.height=height ;element.style.position=position;element.style.top=top;element.style.left=left;e lement.style.zIndex=zIndex;} return element;};Util.customGetElementsByClassName=function(element,tagName,clas sName){var elements=(tagName=="*"&&element.all)?element.all:element.getElementsB yTagName(tagName),elementsToReturn=[],classNamePattern=new RegExp("(^|\\s)"+clas sName.replace(/\-/g,"\\-")+"(\\s|$)");for(var i=0;i<elements.length;i++){element =elements[i];if(classNamePattern.test(element.className)){elementsToReturn.push( element);}} return elementsToReturn;} if(document.getElementsByClassName){Util.getElementsByClassName=function(element ,tagName,className){return element.getElementsByClassName(className);}}else{Util .getElementsByClassName=Util.customGetElementsByClassName;} Util.getFirstElementByClassName=function(element,className){var elements=Util.ge tElementsByClassName(element,"*",className);return elements.length>0?elements[0] :null;};Util.getStyle=function(element,property){if(element.currentStyle){return element.currentStyle[property];}else if(window.getComputedStyle){return documen t.defaultView.getComputedStyle(element,null).getPropertyValue(property);} return null;};Util.getDefaultDisplay=function(element){var newElement=document.c reateElement(element.nodeName);var body=Util.body();body.appendChild(newElement) ;var defaultDisplay=Util.getStyle(newElement,"display");body.removeChild(newElem ent);return defaultDisplay;};Util.log=function(){if(window.console&&window.conso le.log&&window.console.log.apply){window.console.log.apply(window.console,argume nts);}};Util.getCookie=function(cookieName){var results=document.cookie.match('( ^|;) ?'+cookieName+'=([^;]*)(;|$)');if(results){return(window.unescape(results[2 ]));} return null;};Util.head=function(){return document.head||document.getElementsByT agName("head")[0];};Util.body=function(){return document.body||document.getEleme ntsByTagName('body')[0];};Util.checkExistenceOfPushedStyle=function(pushedName){ if(pushedName){var styles=document.getElementsByTagName("style");for(var i=0;i<s tyles.length;i++){if(styles[i].pushName&&styles[i].pushName==pushedName)return t rue;}} return false;};Util.pushCss=function(arrayWithCss,pushName,paramsToReplace){if(U til.checkExistenceOfPushedStyle(pushName))return;var head=Util.head();var style= document.createElement('style');style.type="text/css";style.media="all";style.re l="stylesheet";if(pushName){style.pushName=pushName;} var rules=document.createTextNode(Util.replace(arrayWithCss.join("\n"),paramsToR eplace||{}));if(style.styleSheet){style.styleSheet.cssText=rules.nodeValue;}else {style.appendChild(rules);} head.appendChild(style);};Util.getCurrentDate=function(){return new Date();};Uti l.getCurrentTime=function(){return Util.getCurrentDate().getTime();};Util.mergeO bjects=function(object,settings){var existingKeys={};Util.each(object,function(v alue,key){var keyLower=key.toLowerCase();existingKeys[keyLower]=1;object[key]=se ttings[keyLower]!==undefined?settings[keyLower]:object[key];});Util.each(setting s,function(value,key){if(!existingKeys[key]){object[key]=settings[key];}});};Uti l.getUrlParameters=function(prefix){return QueryString.parse(Util.getCurrentUrl( ),prefix);};Util.hasFlashInstalled=function(){try{return!!new ActiveXObject('Sho ckwaveFlash.ShockwaveFlash');}catch(e1){} var mimeType=Util.getMimeType("application/x-shockwave-flash");return!!(mimeType &&mimeType.enabledPlugin);};Util.getMimeType=function(type){return navigator.mim eTypes[type];};Util.clearElement=function(element){try{if(element.hasChildNodes( )){while(element.childNodes.length>=1){element.removeChild(element.firstChild);} }}catch(e){Util.log(e);} element.innerHTML='';};var Metrics=WMClass.extend({_account:'UA-296593-12',_trac kerName:'WMPlayer',init:function(settings){settings=settings||{};this._account=s ettings.account||this._account;this._trackerName=(settings.trackerName===undefin ed)?this._trackerName:settings.trackerName;this._formatTrackerName();this._initi alizeGAQ();this.push([this._trackerName+'_setAccount',this._account]);this.push( [this._trackerName+'_trackPageview']);this._loadScript();},push:function(array){ window._gaq.push(array);},play:function(settings){settings.category=settings.cat

egory.substr(0,3).toUpperCase();var _playUrl=Util.replace(Metrics.PLAY_TEMPLATE_ URL,settings);this.push([this._trackerName+'_trackPageview',_playUrl]);this.push ([this._trackerName+'_trackEvent','Videos',"Play",settings.videoID+" - "+setting s.title]);},end:function(settings){settings.category=settings.category.substr(0, 3).toUpperCase();var _endUrl=Util.replace(Metrics.END_TEMPLATE_URL,settings);thi s.push([this._trackerName+'_trackPageview',_endUrl]);this.push([this._trackerNam e+'_trackEvent','Videos',"End Of The Video",settings.videoID+" - "+settings.titl e]);},_formatTrackerName:function(){this._trackerName=(this._trackerName.length> 0)?this._trackerName+'.':this._trackerName;},_initializeGAQ:function(){window._g aq=window._gaq||[];},_loadScript:function(){if(!window._gat){var ga=document.cre ateElement('script');ga.type='text/javascript';ga.async=true;ga.src=('https:'==d ocument.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga. js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(g a,s);}}});Metrics.getDefaultInstance=function(){return(Metrics._defaultInstance= Metrics._defaultInstance||new Metrics());};Metrics.PLAY_TEMPLATE_URL='/use/play/ {channel}/{program}/{category}/{videoID}';Metrics.END_TEMPLATE_URL='/use/end/{ch annel}/{program}/{category}/{videoID}';Playlist.CALLBACK_TEMPLATE="wmPlayerPlayl istLoaded{playerId}";Playlist.urlFor=function(videoID,callbackName){return"http: //"+Env.apiHostname()+"/videos/"+videoID+"/playlist/callback/"+callbackName;} Playlist.load=function(settings){var callbackName=Playlist._callbackNameFor(sett ings.playerId);Ajax.jsonp({url:Playlist.urlFor(settings.videoID,callbackName),ca llbackName:callbackName,success:settings.success,error:settings.error});} Playlist._callbackNameFor=function(playerId){var params={playerId:playerId>0?pla yerId:""};return Util.replace(Playlist.CALLBACK_TEMPLATE,params);} Playlist._isTargetDeviceEqual=function(resource,targetDevice){return resource.ta rget_device&&(resource.target_device.indexOf(targetDevice)>=0);} Playlist._isPlayerTypeEqual=function(resource,playerType){return resource.player _type&&(resource.player_type.indexOf(playerType)>=0);} Playlist._findResource=function(video,targetDevice,playerType,kind){var resource ={};Util.each(video.resources,function(_resource){if(Playlist._isTargetDeviceEqu al(_resource,targetDevice)&&Playlist._isPlayerTypeEqual(_resource,playerType)){r eturn(resource=_resource);}});if(!resource.url){Util.each(video.resources,functi on(_resource){if(kind===_resource.kind){return(resource=_resource);}});} resource.id=resource._id;if(resource.target_device){resource.targetDevice=resour ce.target_device;} if(resource.player_type){resource.playerType=resource.player_type;} return resource;} Playlist._isVideoIndexAvailable=function(playlist,videoIndex){return playlist&&p laylist.videos&&playlist.videos.length>videoIndex;} Playlist._isChildrenIndexAvailable=function(video,childrenIndex){return!!(video. children&&video.children.length>childrenIndex);} Playlist.isGalleryOrFullEpisode=function(video){return Playlist._isChildrenIndex Available(video,0);} Playlist._getVideo=function(playlist,videoIndex,childrenIndex){var video=playlis t.videos[videoIndex];return Playlist._isChildrenIndexAvailable(video,childrenInd ex)?video.children[childrenIndex]:video;} Playlist.getResource=function(playlist,videoIndex,childrenIndex){var resource={} ;videoIndex=videoIndex||0;childrenIndex=childrenIndex||0;if(Playlist._isVideoInd exAvailable(playlist,videoIndex)){var video=Playlist._getVideo(playlist,videoInd ex,childrenIndex);if(Util.isIPhone()){resource=Playlist._findResource(video,"iph one","html5","M4");}else if(Util.isIPad()){resource=Playlist._findResource(video ,"ipad","html5","H4");if(resource.url.indexOf('rtmp')===0){resource=Playlist._fi ndResource(video,"iphone","html5","M4");}else if(resource.url){resource.url=reso urce.url.replace("flashvideo","ipadvideo");}}else if(Util.isAndroid()){resource= Playlist._findResource(video,"android","html5","M4");}else{resource=Playlist._fi ndResource(video,"web","flash","H4");if(!resource.url){resource=Playlist._findRe source(video,"web","flash","FS");}}} return resource;};Playlist.totalChildren=function(playlist,videoIndex){if(Playli st._isVideoIndexAvailable(playlist,videoIndex)){var video=playlist.videos[videoI ndex];return video.children?video.children.length:1;}

return 1;};Playlist.getServiceId=function(playlist){if(Playlist._isVideoIndexAva ilable(playlist,0)){return playlist.videos[0].service_id;}};Playlist.parametersF orMetrics=function(playlist,videoIndex){if(Playlist._isVideoIndexAvailable(playl ist,videoIndex)){var video=playlist.videos[videoIndex];return{channel:video.chan nel,program:video.program,category:video.category,title:video.title,videoID:vide o.id}} return{};};Playlist.hasSubscriberOnly=function(playlist){if(Playlist._isVideoInd exAvailable(playlist,0)){var subscribers_only=false;Util.each(playlist.videos,fu nction(video){if(video.subscriber_only){subscribers_only=true;}});return subscri bers_only;} return true;};Event.Exception=function(message){this.message=message;};Event.lin ker=function(method,instance){return function(){return method.apply(instance,arg uments);};} Event.createLinkedMethodsFor=function(instance,methods){Util.each(methods,functi on(method){var methodName=/^_/.test(method)?method.replace("_",""):method;var pr efix=/^_/.test(method)?"_linked":"linked";var name=prefix+Util.capitalize(method Name);instance[name]=Event.linker(instance[method],instance);});} Event.bind=function(element,eventType,handler){var listenerMethod=element.addEve ntListener||element.attachEvent;Event._bindOrUnbind(listenerMethod,element,event Type,handler);};Event.unbind=function(element,eventType,handler){var listenerMet hod=element.removeEventListener||element.detachEvent;Event._bindOrUnbind(listene rMethod,element,eventType,handler);};Event._bindOrUnbind=function(listenerMethod ,element,eventType,handler){if(element.nodeType===3||element.nodeType===8){throw new Event.Exception("It is not possible to attach events to text or comment nod es");} if(element.addEventListener||element.removeEventListener){listenerMethod.call(el ement,eventType,handler,false);}else if(element.attachEvent||element.detachEvent ){listenerMethod("on"+eventType,handler);}};var ErrorPage=WMClass.extend({init:f unction(settings){this.rendered=false;this.width=settings.width;this.height=sett ings.height;this.element=settings.element;this.errorMessages=[ErrorPage.DEFAULT_ MESSAGE,ErrorPage.GEO_BLOCKED,ErrorPage.NOT_FOUND,ErrorPage.DEVICE_NOT_SUPPORTED ];this._mergeWithErrorMessages(settings.errorMessages);this.ops_url="http://"+En v.playerHostname()+"/p2/i/ops.png";},render:function(code){var codeToRender=code ?code:ErrorPage.DEFAULT_MESSAGE.code;var error=this.messageFor(codeToRender);thi s._applyCss();Util.clearElement(this.element);this.element.innerHTML=Util.replac e(ErrorPage.TEMPLATE,{ops_url:this.ops_url,title:error.title,description:error.d escription,code:error.code});this.rendered=true;this.resize();},isNotFound:funct ion(errorObject){return errorObject&&errorObject.http_status_code==404;},isGeoBl ocked:function(errorObject){return errorObject&&errorObject.http_status_code==40 3&&errorObject.code=='GB';},isNotAuthorized:function(errorObject){return errorOb ject&&errorObject.http_status_code==403&&errorObject.code=='AUT';},messageFor:fu nction(code){return Util.findFirst(this.errorMessages,function(error){return err or.code.toLowerCase()==code.toLowerCase();});},_mergeWithErrorMessages:function( errorObjects){var self=this;Util.each(errorObjects,function(obj){var message=sel f.messageFor(obj.code);if(message){self.errorMessages.splice(self.errorMessages. indexOf(message),1);} self.errorMessages.push(obj);});},_applyCss:function(){Util.pushCss(this._cssRul es(),"wm-error");},resize:function(settings){settings=settings||{};this.width=se ttings.width||this.width;this.height=settings.height||this.height;if(this.elemen t&&this.rendered){var wmError=Util.getFirstElementByClassName(this.element,"wm-e rror");if(wmError){var sizeClass=this._getSizeClass();wmError.className=wmError. className.replace(/(\s?wm-error-small)+/,"").replace(/(\s?wm-error-big)+/,"");wm Error.className+=(" "+sizeClass);}}},_getSizeClass:function(){return(this.height ===undefined||this.height>240)?"wm-error-big":"wm-error-small";},_cssRules:funct ion(){var rules=[];rules.push(".wm-error { background-color: #2C2C2C; font-famil y: Arial; width: 100%; height: 100%; position: relative; }");rules.push(".wm-err or img { border: 0; }");rules.push(".wm-error-title { color: #999999; }");rules. push(".wm-error-description { color: #838383; }");rules.push(".wm-error-code { c olor: #838383; position: absolute; }");rules.push(".wm-error-code-number { color : #D5D5D5; }");rules.push(".wm-error a, a:visited { text-decoration: underline;

color: #B6B6B6; }");rules.push(".wm-error a:hover { color: #ECECEC; }");rules.pu sh(".wm-error-big img { height: 73; margin: 38px 0 0 38px; }");rules.push(".wm-e rror-big .wm-error-title { font-size: 22px; margin: 30px 38px 0 38px; }");rules. push(".wm-error-big .wm-error-description { font-size: 12px; margin: 24px 38px 0 38px; }");rules.push(".wm-error-big .wm-error-code { font-size: 10px; margin: 0 38px; bottom: 38px}");rules.push(".wm-error-small img { height: 54; margin: 20p x 0 0 20px; }");rules.push(".wm-error-small .wm-error-title { font-size: 18px; m argin: 20px 20px 0 20px; }");rules.push(".wm-error-small .wm-error-description { font-size: 10px; margin: 18px 20px 0 20px; }");rules.push(".wm-error-small .wmerror-code { font-size: 8px; margin: 0 20px; bottom: 20px}");return rules;}});Er rorPage.TEMPLATE='<div class="wm-error">'+'<img src="{ops_url}" />'+'<div class= "wm-error-title">{title}</div>'+'<div class="wm-error-description">{description} </div>'+'<div class="wm-error-code">Cdigo do Erro - <span class="wm-error-code-nu mber">{code}</span></div>'+'</div>';ErrorPage.DEFAULT_MESSAGE={title:"No foi possv el exibir o vdeo!",description:'Ocorreu um problema ao tentar carregar o vdeo. '+' Tente <a href="" onclick="window.location.reload(); return false;">recarregar</a > a sua pgina.',code:"load-error"} ErrorPage.GEO_BLOCKED={title:"O vdeo no pode ser exibido nessa regio",description:" Infelizmente este vdeo no est disponvel para ser exibido na sua regio ou pas. Desculpe -nos pelo inconveniente.",code:"GB"} ErrorPage.NOT_FOUND={title:"Contedo no disponvel.",description:"Infelizmente este vd eo no est disponvel. Desculpe-nos pelo inconveniente.",code:"NF"} ErrorPage.DEVICE_NOT_SUPPORTED={title:"Dispositivo no suportado.",description:"In felizmente o seu dispositivo no possui os requisitos mnimos para exibir esse vdeo." ,code:"DNS"} var Message={interval_id:null,last_hash:null,cache_bust:1,has_postMessage:window .postMessage,rm_callback:null,post:function(message,target_url,target){if(!targe t_url){return;} if(typeof message!=='string'){return;} target=target||parent;if(Message.has_postMessage){target.postMessage(message,tar get_url.replace(/([^:]+:\/\/[^\/]+).*/,'$1'));}else if(target_url){target.locati on=target_url.replace(/#.*$/,'')+'#'+(+new Date())+(Message.cache_bust++)+'&'+me ssage;}},receive:function(callback,source_origin,delay){if(Message.has_postMessa ge){if(callback){if(Message.rm_callback){Message.receive();} Message.rm_callback=function(e){if((typeof source_origin==='string'&&e.origin!== source_origin)||(Util.isFunction(source_origin)&&source_origin(e.origin)===false )){return false;} callback(e);};Event.bind(window,'message',Message.rm_callback);}else{Event.unbin d(window,'message',Message.rm_callback);}}else{if(Message.interval_id){clearInte rval(Message.interval_id);} Message.interval_id=null;if(callback){delay=(typeof source_origin==='number')?so urce_origin:((typeof delay==='number')?delay:100);Message.interval_id=setInterva l(function(){var hash=document.location.hash,re=/^#?\d+&/;if(hash!==Message.last _hash&&re.test(hash)){document.location.hash=null;Message.last_hash=hash;callbac k({data:hash.replace(re,'')});}},delay);}}}} Effect._resizeAndPositioningShadowTimer=null;Effect.FADE_TICK=10;Effect.Fade=fun ction(options){this.elements=[].concat(options.element||[]).concat(options.eleme nts||[]);this.instances={};this._init(options);};Effect.Fade.prototype={fadeIn:f unction(maxFade){this._eachInstance(function(){if(!this.isVisible()){this.fadeSt ate='visible';this.maxFade=maxFade||this.maxFade;this._start();}});},fadeOut:fun ction(maxFadeOut){this._eachInstance(function(){if(this.isVisible()){this.fadeSt ate='invisible';this.maxFadeOut=maxFadeOut||this.maxFadeOut;this._start();}});}, _init:function(options){this.duration=options.duration;var self=this;Util.each(t his.elements,function(value,key){self.instances[key]=self._newInstance(value,opt ions.maxFade,options.maxFadeOut);});},_newInstance:function(element,maxFade,maxF adeOut){var obj={};obj.element=element;obj.duration=this.duration;if(!maxFade){v ar opacity=element.style.opacity;obj.maxFade=(!this._isWithoutOpacity(element)&& opacity!=='0')?parseFloat(opacity):1;}else{obj.maxFade=maxFade;} obj.maxFadeOut=maxFadeOut||0;obj.defaultDisplay=Util.getDefaultDisplay(element); if(this._isDisplayed(element)&&(this._isWithoutOpacity(element)||this._isOpaque(

element,obj.maxFade))&&parseFloat(element.style.opacity)!==maxFadeOut){obj.fadeS tate='visible';}else{obj.fadeState='invisible';} var self=this;obj._start=function(){self._start.call(obj);};obj.isVisible=functi on(){return self._isVisible.call(obj);} return obj;},_isVisible:function(){return this.fadeState==='visible';},_eachInst ance:function(block){Util.each(this.instances,function(value){block.call(value); });},_isDisplayed:function(element){return Util.getStyle(element,"display")!=="n one";},_isWithoutOpacity:function(element){var opacity=element.style.opacity;ret urn opacity===null||opacity===undefined||opacity==='';},_isOpaque:function(eleme nt,maxFade){return element.style.opacity===''+maxFade;},_start:function(){this.f adeTimeLeft=this.duration;var currentTick=new Date().getTime();var self=this;set Timeout(function(){Effect._animateFade(currentTick,self)},Effect.FADE_TICK);}};E ffect._animateFade=function(lastTick,fadeObj){var duration=fadeObj.duration;var maxFade=fadeObj.maxFade;var maxFadeOut=fadeObj.maxFadeOut;var style=fadeObj.elem ent.style;var currentTick=new Date().getTime();var elapsedTicks=currentTick-last Tick;if(fadeObj.fadeTimeLeft<=elapsedTicks){style.opacity=fadeObj.isVisible()?'' +maxFade:''+maxFadeOut;style.filter='alpha(opacity = '+(fadeObj.isVisible()?''+( maxFade*100):''+(maxFadeOut*100))+')';if(fadeObj.isVisible()||maxFadeOut>0){styl e.display=fadeObj.defaultDisplay;}else{style.display='none';} return;} fadeObj.fadeTimeLeft-=elapsedTicks;var newOpacityValue=(fadeObj.fadeTimeLeft/dur ation)*maxFade;if(fadeObj.isVisible()){newOpacityValue=maxFade-newOpacityValue;i f(maxFadeOut===0||(newOpacityValue>maxFadeOut&&maxFadeOut>0)){style.opacity=newO pacityValue;style.filter='alpha(opacity = '+(newOpacityValue*100)+')';}}else if( maxFadeOut===0||newOpacityValue>maxFadeOut){style.opacity=newOpacityValue;style. filter='alpha(opacity = '+(newOpacityValue*100)+')';} if(Util.getStyle(fadeObj.element,"display")=="none"){style.display=fadeObj.defau ltDisplay;} setTimeout(function(){Effect._animateFade(currentTick,fadeObj)},Effect.FADE_TICK );};Effect.createShadow=function(zIndex,duration,maxFade){var wmPlayerShadow=doc ument.getElementById('wmPlayerShadow');if(wmPlayerShadow===undefined||wmPlayerSh adow==null){zIndex=zIndex||100000;wmPlayerShadow=Util.createElement('div','wmPla yerShadow');Util.body().appendChild(wmPlayerShadow);var left=Effect._newShadowDi v('wmPlayerShadowLeft',zIndex);var top=Effect._newShadowDiv('wmPlayerShadowTop', zIndex);var right=Effect._newShadowDiv('wmPlayerShadowRight',zIndex);var bottom= Effect._newShadowDiv('wmPlayerShadowBottom',zIndex);wmPlayerShadow.appendChild(l eft);wmPlayerShadow.appendChild(top);wmPlayerShadow.appendChild(right);wmPlayerS hadow.appendChild(bottom);wmPlayerShadow.wmFade=new Effect.Fade({duration:durati on||500,maxFade:maxFade||0.8,elements:[left,top,right,bottom]});}};Effect._newSh adowDiv=function(id,zIndex){return Util.createElement('div',id,'black',0.8,0,0,' absolute',0,0,zIndex);};Effect.showShadow=function(){Effect._animateShadow("fade In");};Effect.hideShadow=function(){Effect._animateShadow("fadeOut");};Effect._a nimateShadow=function(animation){var wmPlayerShadow=document.getElementById('wmP layerShadow');if((wmPlayerShadow!==undefined)&&(wmPlayerShadow!=null)&&(wmPlayer Shadow.wmFade!=null)){wmPlayerShadow.wmFade[animation]();}};Effect._clientHeight =function(){var n_win=window.innerHeight?window.innerHeight:0;var n_docel=docume nt.documentElement?document.documentElement.clientHeight:0;var n_scroll=document .documentElement?document.documentElement.scrollHeight:0;var n_body=Util.body()? Util.body().clientHeight:0;return Math.max(n_win,Math.max(n_docel,Math.max(n_scr oll,n_body)));};Effect._clientWidth=function(){var n_win=window.innerWidth?windo w.innerWidth:Number.MAX_VALUE;var n_docel=document.documentElement?document.docu mentElement.clientWidth:Number.MAX_VALUE;var n_body=Util.body()?Util.body().clie ntWidth:Number.MAX_VALUE;return Math.min(n_win,Math.min(n_docel,n_body));};Effec t.findCoordinates=function(element){var leftSide=0,topSide=0,rightSide=0,bottomS ide=0,obj=element;if(obj.offsetParent){do{topSide+=obj.offsetTop;leftSide+=obj.o ffsetLeft;}while(obj=obj.offsetParent);rightSide=element.offsetWidth+leftSide;bo ttomSide=element.offsetHeight+topSide;} return[leftSide,topSide,rightSide,bottomSide];};Effect.resizeAndPositioningShado w=function(element){if((element!==undefined)&&(element!=null)){var coords=Effect .findCoordinates(element);var clientWidth=Math.max(document.documentElement.scro

llLeft,Util.body().scrollLeft)+Effect._clientWidth();var clientHeight=Effect._cl ientHeight();Effect._updatePosition('wmPlayerShadowTop',0,0,clientWidth,coords[1 ]);Effect._updatePosition('wmPlayerShadowLeft',coords[1],0,coords[0],(coords[3]coords[1]));Effect._updatePosition('wmPlayerShadowRight',coords[1],coords[2],(cl ientWidth-coords[2]),(coords[3]-coords[1]));Effect._updatePosition('wmPlayerShad owBottom',coords[3],0,clientWidth,(clientHeight-coords[3]));}};Effect._updatePos ition=function(id,top,left,width,height){var style=document.getElementById(id).s tyle;style.top=top+'px';style.left=left+'px';style.width=width+'px';style.height =height+'px';};Effect._onResizeOrScroll=function(){clearTimeout(Effect._resizeAn dPositioningShadowTimer);Effect._resizeAndPositioningShadowTimer=setTimeout(this .wmResizeAndPositioningShadow,10);};Effect._onResizeAndPositioningShadow=functio n(){Effect.resizeAndPositioningShadow(this);};Effect.onLightOff=function(element ,zIndex){element.wmResizeOrScroll=Event.linker(Effect._onResizeOrScroll,element) ;element.wmResizeAndPositioningShadow=Event.linker(Effect._onResizeAndPositionin gShadow,element);Effect.createShadow(zIndex);Effect.resizeAndPositioningShadow(e lement);Effect.showShadow();Event.bind(window,'resize',element.wmResizeOrScroll) ;Event.bind(window,'scroll',element.wmResizeOrScroll);};Effect.onLightOn=functio n(element){Effect.hideShadow();Event.unbind(window,'resize',element.wmResizeOrSc roll);Event.unbind(window,'scroll',element.wmResizeOrScroll);};Effect.Lightbox=W MClass.extend({init:function(settings){Event.createLinkedMethodsFor(this,['_clos edByUser','_alignLightbox','_resizeIframe']);this.firstLoad=true;this.body=Util. body();this.element=settings.element;this.modal=settings.modal||false;this.onClo seCallback=settings.onClose;this._applyCss();this._createElements();this._bindEv ents();this._bindIframeOnloadEvent();this._appendElements();this._alignLightbox( );this.fadeOverlay=new Effect.Fade({element:this.overlay,duration:settings.overl ayFadeDuration||300,maxFade:settings.overlayMaxFade||0.6});this.fadeInnerWrapper =new Effect.Fade({element:this.innerWrapper,duration:settings.boxFadeDuration||2 00});},open:function(){this.wrapper.style.display="block";this.fadeOverlay.fadeI n();this.fadeInnerWrapper.fadeIn();},close:function(){this.fadeInnerWrapper.fade Out();this.fadeOverlay.fadeOut();this.wrapper.style.display="none";},_closedByUs er:function(){if(this.onCloseCallback){this.onCloseCallback();} this.close();},_bindEvents:function(){var self=this;this.closeButton.onclick=thi s._linkedClosedByUser;if(!this.modal){this.outerWrapper.style.cursor="pointer";t his.outerWrapper.onclick=this._linkedClosedByUser;this.innerWrapper.onclick=func tion(event){var e=event||window.event;e.cancelBubble=true;if(e.stopPropagation){ e.stopPropagation();}};} Event.bind(window,'resize',this._linkedAlignLightbox);Event.bind(window,'scroll' ,this._linkedAlignLightbox);},_bindIframeOnloadEvent:function(){this.iframe=this .element.getElementsByTagName("iframe")[0];if(this.iframe){Event.bind(this.ifram e,'load',this._linkedResizeIframe);}},_resizeIframe:function(){if(!this.firstLoa d){this.iframe.width="100%";this.iframe.height="100%";this.element.style.width=" 980px";this._alignLightbox();} this.firstLoad=false;},_getViewPort:function(){this.viewPortWidth=window.innerWi dth||document.documentElement.clientWidth||this.body.clientWidth;this.viewPortHe ight=window.innerHeight||document.documentElement.clientHeight||this.body.client Height;},_alignLightbox:function(){this._getViewPort();var width=parseInt(Util.g etStyle(this.element,"width").replace(/\D+/,''),10);var height=parseInt(Util.get Style(this.element,"height").replace(/\D+/,''),10);if(width&&height){var innerLe ft=(Effect._clientWidth()/2)-(width/2);var innerTop=(this.viewPortHeight/2)-(hei ght/2);this.innerWrapper.style.left=innerLeft+"px";this.innerWrapper.style.top=i nnerTop+"px";}},_createElements:function(){this.overlay=this._createElementWithC lass("div","wm-lightbox-black-overlay");this.outerWrapper=this._createElementWit hClass("div","wm-lightbox-outer-wrapper");this.innerWrapper=this._createElementW ithClass("div","wm-lightbox-inner-wrapper");this.content=this._createElementWith Class("div","wm-lightbox-content");this.closeButton=this._createElementWithClass ("div","wm-lightbox-close");this.wrapper=this._createElementWithClass("div","wmlightbox-wrapper");this.wrapper.style.display="none";},_createElementWithClass:f unction(nodeType,className){var node=document.createElement(nodeType);node.class Name=className;return node;},_appendElements:function(){this.content.appendChild (this.element);this.innerWrapper.appendChild(this.content);this.innerWrapper.app

endChild(this.closeButton);this.outerWrapper.appendChild(this.innerWrapper);this .wrapper.appendChild(this.outerWrapper);this.element.style.display=Util.getDefau ltDisplay(this.element);this.element.style.visibility="visible";this.body.append Child(this.overlay);this.body.appendChild(this.wrapper);},_applyCss:function(){v ar closeUrl="http://"+Env.playerHostname()+"/p2/i/close.png";var rules=[];rules. push(".wm-lightbox-black-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: black; z-index: 10000; }");rule s.push(".wm-lightbox-wrapper { z-index: 10001; position: fixed; top: 0; left: 0; width: 100%; height: 100%; }");rules.push(".wm-lightbox-outer-wrapper { positio n: relative; width: 100%; height: 100%; }");rules.push(".wm-lightbox-inner-wrapp er { position: absolute; z-index: 10002; cursor: default; min-width: "+this.scro llWidth+"px; min-height: "+this.scrollHeight+"px; }");rules.push(".wm-lightbox-c ontent { float: left; } ");rules.push(".wm-lightbox-close { z-index: 10003; curs or: pointer; width: 24px; height: 24px; float: left; background:url('"+closeUrl+ "') no-repeat transparent; margin-left: -12px; margin-top: -10px; position: rela tive; }");Util.pushCss(rules,"wm-lightbox",{scrollWidth:this.scrollWidth,scrollH eight:this.scrollHeight,closeUrl:closeUrl});}});var Poster=WMClass.extend({init: function(){Event.createLinkedMethodsFor(this,['_showImage','_onClick']);},render :function(settings){if(this._hasChanged(settings)){this._settings=settings;this. _create();this.enable();} if(settings.callback){this._settings.callback=settings.callback;}},resize:functi on(settings){if(!this._settings){return;} this._settings.width=settings.width;this._settings.height=settings.height;var pl ayWidth=(this._settings.width/2)-(117/2);var playHeight=(this._settings.height/2 )-(98/2);this.play.style.top=playHeight+"px";this.play.style.left=playWidth+"px" ;this.wrapper.style.width=this._settings.width+"px";this.wrapper.style.height=th is._settings.height+"px";this.image.src=Poster._thumbUrl({height:this._settings. height,videoID:this._settings.videoID});this._applyLetterbox();},disable:functio n(){this._disabled=true;this._disableEffects();this.play.style.display='none';th is.innerWrapper.style.cursor='default';},enable:function(){this._disabled=false; this.play.style.display='';this.innerWrapper.style.cursor='pointer';this._enable Effects();},_onClick:function(){if(!this._disabled){this.disable();this._setting s.callback();}},_create:function(){this._applyCss();this._createImage();this._cr eatePlayIcon();this._createInnerWrapper();this._createWrapper();this.resize(this ._settings);this._settings.element.appendChild(this.wrapper);},_hasChanged:funct ion(settings){return this._settings===undefined||this._settings.videoID!==settin gs.videoID||this._settings.width!==settings.width||this._settings.height!==setti ngs.height;},_applyCss:function(settings){var playUrl="http://"+Env.playerHostna me()+"/p2/i/play.png";var allRules=[];allRules.push(".wm-poster-wrapper { backgr ound: black; }");allRules.push(".wm-poster-inner-wrapper { position: relative; w idth: 100%; height: 100%; text-align: center;}");allRules.push(".wm-poster-inner -wrapper img { visibility:hidden; } ");allRules.push(".wm-poster-inner-wrapper:h over { cursor: pointer; }");allRules.push(".wm-poster-play { background:url('"+p layUrl+"') no-repeat transparent; } ");allRules.push(".wm-poster-play { width:11 7px; height:98px; position:absolute; }");if(Poster.isIE()){allRules.push(".wm-po ster-play { opacity:"+Poster.MAX_FADE_OUT+"; background-position: 0px -97px; }") ;allRules.push(".wm-poster-inner-wrapper:hover .wm-poster-play { background-posi tion: 0px 0px; }");} Util.pushCss(allRules,"wm-poster");},_enableEffects:function(){if(!Poster.isIE() ){var fade=new Effect.Fade({element:this.play,duration:300,maxFadeOut:Poster.MAX _FADE_OUT});this.innerWrapper.onmouseover=function(event){fade.fadeIn(1);} this.innerWrapper.onmouseout=function(event){var toElement=event.toElement||even t.relatedTarget||null;if(toElement&&Poster.CLASSES.indexOf(toElement.getAttribut e("class"))==-1){fade.fadeOut();}} fade.fadeOut();}},_disableEffects:function(){this.innerWrapper.onmouseover=funct ion(event){};this.innerWrapper.onmouseout=function(event){};},_createImage:funct ion(){var img=this.image=new Image();this.image.className="wm-poster-image";this .image.onload=this._linkedShowImage;},_createPlayIcon:function(){this.play=docum ent.createElement("div");this.play.className="wm-poster-play";if(!Poster.isIE()) {this.play.style.opacity=""+Poster.MAX_FADE_OUT;this.play.style.filter="alpha(op

acity="+(Poster.MAX_FADE_OUT*100)+")";}},_createInnerWrapper:function(){this.inn erWrapper=document.createElement("div");this.innerWrapper.className="wm-poster-i nner-wrapper";this.innerWrapper.appendChild(this.play);this.innerWrapper.appendC hild(this.image);this.innerWrapper.onclick=this._linkedOnClick;},_createWrapper: function(){Util.clearElement(this._settings.element);this.wrapper=document.creat eElement("div");this.wrapper.className="wm-poster-wrapper";this.wrapper.appendCh ild(this.innerWrapper);},_applyLetterbox:function(){var ratioPlayer=this._settin gs.width/this._settings.height;var ratioImg=this.imageWidth/this.imageHeight;if( isNaN(this.imageWidth)||isNaN(this.imageHeight)||isNaN(ratioPlayer)||isNaN(ratio Img)){return;} var width,height;if(ratioPlayer>ratioImg){width=Math.round(this._settings.height *ratioImg);}else if(ratioPlayer<ratioImg){height=Math.round(this._settings.width /ratioImg);} height=height||this._settings.height;var style=this.image.style;style.width=(wid th||this._settings.width)+"px";style.height=(height)+"px";this._centerImage(heig ht);},_centerImage:function(height){this.image.style.marginTop=((this._settings. height-height)/2)+"px";},_showImage:function(){this._measureImage();this._applyL etterbox();this.image.style.visibility='visible';},_getImageSize:function(){this .imageWidth=parseInt(Util.getStyle(this.image,"width").replace(/\D+/,''),10);thi s.imageHeight=parseInt(Util.getStyle(this.image,"height").replace(/\D+/,''),10); },_measureImage:function(){this._getImageSize();if(isNaN(this.imageWidth)||isNaN (this.imageHeight)){var body=Util.body();var newElement=document.createElement(' div');newElement.style.width='1px';newElement.style.height='1px';body.appendChil d(newElement);newElement.appendChild(this.image);this._getImageSize();body.remov eChild(newElement);this.innerWrapper.appendChild(this.image);}}});Poster.MAX_FAD E_OUT=0.6;Poster.AVAILABLE_HEIGHTS=[216,240,360];Poster.CLASSES=["wm-poster-imag e","wm-poster-play","wm-poster-inner-wrapper","wm-poster-wrapper"];Poster._thumb Url=function(settings){var height=Poster._fixHeight(settings.height);var hostnam e=Env.thumbHostname(settings);return"http://"+hostname+"/x"+height+"/"+settings. videoID+".jpg";} Poster._fixHeight=function(height){height=parseInt(height,10);for(var i=0;i<Post er.AVAILABLE_HEIGHTS.length;i++){if(Poster.AVAILABLE_HEIGHTS[i]>=height){return Poster.AVAILABLE_HEIGHTS[i];}} return Poster.AVAILABLE_HEIGHTS[Poster.AVAILABLE_HEIGHTS.length-1];} Poster.isIE=function(){return window.ActiveXObject;} Data.all=function(element,removePrefix){var prefix=removePrefix||"player";var da taSet=Data._getDataSet(element);var result={};Util.each(dataSet,function(value,k ey){var formattedKey=Util.uncapitalize(key.replace(prefix,""));result[formattedK ey]=value;});return result;};Data._getDataSet=function(element){var dataSet={};v ar attributes=element.attributes;Util.eachObject(element.attributes,function(val ue){var name=value.name;if(typeof name==="string"&&name.match(/^data-/)){var new Key=Util.joinWithCamelCase(name.toLowerCase().replace("data-","").split("-"));da taSet[newKey]=QueryString._parseValue(element.getAttribute(name));}});return dat aSet;};Auth._lightbox=null;Auth.hasGlbId=function(){var glbid=Util.getCookie('GL BID');return(typeof glbid==='string')&&glbid.length>10;};Auth.getHash=function(s ettings){var callbackName='getHash_'+Util.getCurrentTime();var hashPath="/videos /"+settings.videosIDs+"/hash?resource_id="+settings.resourceId+"&callback="+call backName;var hashUrl="http://"+Env.securityHostname()+hashPath;var callbackWrapp er=Auth._getHashCallbackWrapper(settings.success,settings.error);Ajax.jsonp({url :hashUrl,callbackName:callbackName,success:callbackWrapper,error:callbackWrapper });};Auth._getHashCallbackWrapper=function(success,error){return function(hash){ if(Auth._isValidHash(hash)){if(success){success(hash);}}else{if(error){error(Uti l.isObject(hash)?hash:{});}}}};Auth.isAuthenticationRequired=function(playlist){ return Playlist.hasSubscriberOnly(playlist);};Auth._isValidHash=function(hash){r eturn(hash!==undefined)&&(hash!=null)&&(hash.hash!==undefined)&&(hash.hash!=null )&&(hash.hash!=='');};Auth.checkAuthorized=function(settings){if(Env.isGloboDoma in()&&!Auth.hasGlbId()){settings.callback(false);}else{var callbackSuccessWrappe r=function(hash){if(settings.callback){settings.callback(true,hash);}} var callbackErrorWrapper=function(hash){if(settings.callback){settings.callback( false,hash);}}

Auth.getHash({videosIDs:settings.videosIDs,resourceId:settings.resourceId,succes s:callbackSuccessWrapper,error:callbackErrorWrapper});}};Auth._loginIframeUrl=fu nction(serviceId,lightbox,size){size=size||"widget";var siteUrl=encodeURICompone nt(Util.getCurrentUrl());var returnUrl=(lightbox)?encodeURIComponent('http://'+E nv.playerHostname()+'/p2/close_box_login.html?url='+siteUrl):siteUrl;var protoco l=Env.isTest()?'http':'https';var loginIframeUrl=protocol+"://"+Env.cadunHostnam e()+"/login/"+serviceId+"?tam="+size+"&url="+returnUrl;return loginIframeUrl;};A uth.redirectToAuthenticationScreen=function(settings){location.href=Auth._loginI frameUrl(settings.serviceId,false);};Auth.showAuthenticationScreen=function(sett ings){var callbackWrapper=function(){Auth._authenticationScreenCallback(settings .callback);} Message.receive(callbackWrapper,'http://'+Env.playerHostname());var loginWrapper =document.getElementById('wmPlayerBoxLogin');if(loginWrapper){Util.clearElement( loginWrapper);}else{loginWrapper=Util.createElement('div','wmPlayerBoxLogin','#F FFFFF',1,'350px','520px','relative','0px','0px',1);Util.body().appendChild(login Wrapper);} var iframe=Util.createElement('iframe','','#FFFFFF',1,'100%','100%','relative',' 0px','0px',1);iframe.setAttribute('src',Auth._loginIframeUrl(settings.serviceId, true));iframe.style.display='block';iframe.style.border='none';loginWrapper.appe ndChild(iframe);if(!Auth._lightbox){Auth._lightbox=new Effect.Lightbox({element: loginWrapper,modal:true,onClose:settings.onClose});} Auth._openLightbox();};Auth._openLightbox=function(){if(Auth._lightbox){Auth._li ghtbox.open();}};Auth.closeAuthenticationScreen=function(){if(Auth._lightbox){Au th._lightbox.close();}};Auth._authenticationScreenCallback=function(callback){Me ssage.receive();Auth.closeAuthenticationScreen();if(callback){callback();}};Auth .closeBoxLoginScreen=function(){var queryStringParams=Util.getUrlParameters();Me ssage.post('{"operation":"close"}',window.unescape(queryStringParams.url));} Signer._random=function(){var rand=(Math.round(Math.random()*10000000000)).toStr ing();while(rand.length<10){rand="0"+rand;} return rand;};Signer.getCurrentTime=function(){return Util.getCurrentTime().toSt ring().substr(0,10);};Signer.sign=function(receivedHash){var version=receivedHas h.substr(0,2);var receivedTime=receivedHash.substr(2,10);var receivedRandom=rece ivedHash.substr(12,10);var receivedGrf=receivedHash.substr(22,22);var currentTim e=Signer.getCurrentTime();var randomNumber=Signer._random();var grf=Signer.Encry ptor.b64_grf(receivedGrf+currentTime+randomNumber);return version+receivedTime+r eceivedRandom+currentTime+randomNumber+grf;};Signer.Encryptor={hexcase:0,b64pad: "",PADDINGgrf:"=0xAC10FD",b64_grf:function(s){return this.rstr2b64(this.rstr_grf (this.str2rstr_utf8(s)));},rstr_grf:function(s){return this.binl2rstr(this.binl_ grf(this.rstr2binl(s),s.length*8));},rstr2b64:function(input){var output="";var len=input.length;for(var i=0;i<len;i+=3){var triplet=(input.charCodeAt(i)<<16)|( i+1<len?input.charCodeAt(i+1)<<8:0)|(i+2<len?input.charCodeAt(i+2):0);for(var j= 0;j<4;j++){if(i*8+j*6>input.length*8)output+=this.b64pad;else output+=Signer.Enc ryptor.B64_TAB.charAt((triplet>>>6*(3-j))&0x3F);}} return output;},str2rstr_utf8:function(input){var output="";var i=-1;var x,y;var padding=this.PADDINGgrf;input=input+padding.substr(1,8);while(++i<input.length) {x=input.charCodeAt(i);y=i+1<input.length?input.charCodeAt(i+1):0;if(0xD800<=x&& x<=0xDBFF&&0xDC00<=y&&y<=0xDFFF){x=0x10000+((x&0x03FF)<<10)+(y&0x03FF);i++;} if(x<=0x7F){output+=String.fromCharCode(x);}else if(x<=0x7FF){output+=String.fro mCharCode(0xC0|((x>>>6)&0x1F),0x80|(x&0x3F));}else if(x<=0xFFFF){output+=String. fromCharCode(0xE0|((x>>>12)&0x0F),0x80|((x>>>6)&0x3F),0x80|(x&0x3F));}else if(x< =0x1FFFFF){output+=String.fromCharCode(0xF0|((x>>>18)&0x07),0x80|((x>>>12)&0x3F) ,0x80|((x>>>6)&0x3F),0x80|(x&0x3F));}} return output;},rstr2binl:function(input){var output=new Array(input.length>>2); for(var i=0;i<output.length;i++){output[i]=0;} for(i=0;i<input.length*8;i+=8){output[i>>5]|=(input.charCodeAt(i/8)&0xFF)<<(i%32 );} return output;},binl2rstr:function(input){var output="";for(var i=0;i<input.leng th*32;i+=8){output+=String.fromCharCode((input[i>>5]>>>(i%32))&0xFF);} return output;},binl_grf:function(x,len){x[len>>5]|=0x80<<((len)%32);x[(((len+64 )>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271

733878;for(var i=0;i<x.length;i+=16){var olda=a;var oldb=b;var oldc=c;var oldd=d ;a=this.grf_ff(a,b,c,d,x[i+0],7,-680876936);d=this.grf_ff(d,a,b,c,x[i+1],12,-389 564586);c=this.grf_ff(c,d,a,b,x[i+2],17,606105819);b=this.grf_ff(b,c,d,a,x[i+3], 22,-1044525330);a=this.grf_ff(a,b,c,d,x[i+4],7,-176418897);d=this.grf_ff(d,a,b,c ,x[i+5],12,1200080426);c=this.grf_ff(c,d,a,b,x[i+6],17,-1473231341);b=this.grf_f f(b,c,d,a,x[i+7],22,-45705983);a=this.grf_ff(a,b,c,d,x[i+8],7,1770035416);d=this .grf_ff(d,a,b,c,x[i+9],12,-1958414417);c=this.grf_ff(c,d,a,b,x[i+10],17,-42063); b=this.grf_ff(b,c,d,a,x[i+11],22,-1990404162);a=this.grf_ff(a,b,c,d,x[i+12],7,18 04603682);d=this.grf_ff(d,a,b,c,x[i+13],12,-40341101);c=this.grf_ff(c,d,a,b,x[i+ 14],17,-1502002290);b=this.grf_ff(b,c,d,a,x[i+15],22,1236535329);a=this.grf_gg(a ,b,c,d,x[i+1],5,-165796510);d=this.grf_gg(d,a,b,c,x[i+6],9,-1069501632);c=this.g rf_gg(c,d,a,b,x[i+11],14,643717713);b=this.grf_gg(b,c,d,a,x[i+0],20,-373897302); a=this.grf_gg(a,b,c,d,x[i+5],5,-701558691);d=this.grf_gg(d,a,b,c,x[i+10],9,38016 083);c=this.grf_gg(c,d,a,b,x[i+15],14,-660478335);b=this.grf_gg(b,c,d,a,x[i+4],2 0,-405537848);a=this.grf_gg(a,b,c,d,x[i+9],5,568446438);d=this.grf_gg(d,a,b,c,x[ i+14],9,-1019803690);c=this.grf_gg(c,d,a,b,x[i+3],14,-187363961);b=this.grf_gg(b ,c,d,a,x[i+8],20,1163531501);a=this.grf_gg(a,b,c,d,x[i+13],5,-1444681467);d=this .grf_gg(d,a,b,c,x[i+2],9,-51403784);c=this.grf_gg(c,d,a,b,x[i+7],14,1735328473); b=this.grf_gg(b,c,d,a,x[i+12],20,-1926607734);a=this.grf_hh(a,b,c,d,x[i+5],4,-37 8558);d=this.grf_hh(d,a,b,c,x[i+8],11,-2022574463);c=this.grf_hh(c,d,a,b,x[i+11] ,16,1839030562);b=this.grf_hh(b,c,d,a,x[i+14],23,-35309556);a=this.grf_hh(a,b,c, d,x[i+1],4,-1530992060);d=this.grf_hh(d,a,b,c,x[i+4],11,1272893353);c=this.grf_h h(c,d,a,b,x[i+7],16,-155497632);b=this.grf_hh(b,c,d,a,x[i+10],23,-1094730640);a= this.grf_hh(a,b,c,d,x[i+13],4,681279174);d=this.grf_hh(d,a,b,c,x[i+0],11,-358537 222);c=this.grf_hh(c,d,a,b,x[i+3],16,-722521979);b=this.grf_hh(b,c,d,a,x[i+6],23 ,76029189);a=this.grf_hh(a,b,c,d,x[i+9],4,-640364487);d=this.grf_hh(d,a,b,c,x[i+ 12],11,-421815835);c=this.grf_hh(c,d,a,b,x[i+15],16,530742520);b=this.grf_hh(b,c ,d,a,x[i+2],23,-995338651);a=this.grf_ii(a,b,c,d,x[i+0],6,-198630844);d=this.grf _ii(d,a,b,c,x[i+7],10,1126891415);c=this.grf_ii(c,d,a,b,x[i+14],15,-1416354905); b=this.grf_ii(b,c,d,a,x[i+5],21,-57434055);a=this.grf_ii(a,b,c,d,x[i+12],6,17004 85571);d=this.grf_ii(d,a,b,c,x[i+3],10,-1894986606);c=this.grf_ii(c,d,a,b,x[i+10 ],15,-1051523);b=this.grf_ii(b,c,d,a,x[i+1],21,-2054922799);a=this.grf_ii(a,b,c, d,x[i+8],6,1873313359);d=this.grf_ii(d,a,b,c,x[i+15],10,-30611744);c=this.grf_ii (c,d,a,b,x[i+6],15,-1560198380);b=this.grf_ii(b,c,d,a,x[i+13],21,1309151649);a=t his.grf_ii(a,b,c,d,x[i+4],6,-145523070);d=this.grf_ii(d,a,b,c,x[i+11],10,-112021 0379);c=this.grf_ii(c,d,a,b,x[i+2],15,718787259);b=this.grf_ii(b,c,d,a,x[i+9],21 ,-343485551);a=this.safe_add(a,olda);b=this.safe_add(b,oldb);c=this.safe_add(c,o ldc);d=this.safe_add(d,oldd);} return[a,b,c,d];},grf_cmn:function(q,a,b,x,s,t){return this.safe_add(this.bit_ro l(this.safe_add(this.safe_add(a,q),this.safe_add(x,t)),s),b);},grf_ff:function(a ,b,c,d,x,s,t){return this.grf_cmn((b&c)|((~b)&d),a,b,x,s,t);},grf_gg:function(a, b,c,d,x,s,t){return this.grf_cmn((b&d)|(c&(~d)),a,b,x,s,t);},grf_hh:function(a,b ,c,d,x,s,t){return this.grf_cmn(b^c^d,a,b,x,s,t);},grf_ii:function(a,b,c,d,x,s,t ){return this.grf_cmn(c^(b|(~d)),a,b,x,s,t);},safe_add:function(x,y){var lsw=(x& 0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF );},bit_rol:function(num,cnt){return(num<<cnt)|(num>>>(32-cnt));}};Signer.Encryp tor.B64_TAB="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";B uilder.toObjectTag=function(player){player.channel=player.playlist.videos[0].cha nnel;var lines=[];lines.push('<object id="'+player.objectId+'" width="100%" heig ht="100%" ');lines.push('data="'+Builder.swfUrl(player)+'" type="application/x-s hockwave-flash">');lines.push('<param value="true" name="allowFullScreen">');lin es.push('<param value="always" name="allowScriptAccess" />');lines.push('<param value="high" name="quality" />');lines.push('<param value="opaque" name="wmode" />');lines.push('<param value="#000000" name="bgcolor" />');lines.push('<param v alue="'+Builder.swfUrl(player)+'" name="movie" />');lines.push('<param value="vi deosIDs='+player.videosIDs+Builder._toFlashVars(player)+'" name="flashvars" />') ;lines.push('</object>');return lines.join('');};Builder.toVideoTag=function(par ams){return Util.replace(Builder.videoTagTemplate,params);};Builder.videoTagTemp late='<video width="100%" height="100%" src="{src}" controls="controls"'+' style ="background-color: black;" poster="{poster}"></video>';Builder._toFlashVars=fun

ction(player){var flashvars='';Util.each(player,function(value,key){if((key.toLo werCase()!=='videosids')&&!Util.isPrivate(key)&&Util.isPrimitive(player[key])){f lashvars+='&'+key+'='+player[key];}});return flashvars;};Builder.swfUrl=function (player){if(player.swf){return player.swf;} return"http://"+Env.playerHostname()+"/p2/player.swf";};Builder.convertSizeToBan da=function(width,height){var size=width+'x'+height;var banda=null;switch(size){ case"288x216":banda="I";break;case"320x240":banda="N";break;case"480x360":banda= "L";break;case"640x360":banda="X";break;} return banda;};var PlayerFactory={create:function(settings){if(Util.canUseFlashP layer()){return new PlayerFlash(settings);}else{if(Util.isIPad()){return new Pla yerHtml5.IPad(settings);}else if(Util.isIPhone()){return new PlayerHtml5.IPhone( settings);}else{return new PlayerHtml5.Android(settings);}}}} var PlayerManager=[];var Player=function(options){if(Util.isObject(options)){var self=this;Util.each(options,function(value,key){if(Util.isPrivate(key)||Player. PROTECTED_ATTRIBUTES.indexOf(key)!=-1){throw new Player.Exception(key+" should n ot be overrided");} self[key]=value;});} this.errorMessages=this.errorMessages||[];this._definedProperties();this._defaul tValues();Util.mergeObjects(this,Util.getUrlParameters(QueryString.PLAYER_PARAMS _PREFIX));Env.environment=this.environment;};Player.prototype={attachTo:function (element){this._element=element;this._element.style.background='black';this._set ElementSize();this._createAndStart();},playVideo:function(){if(this._hasPlayerIm pl())this._playerImpl.playVideo();},seek:function(settings){if(this._hasPlayerIm pl())this._playerImpl.seek(settings);},pauseVideo:function(){if(this._hasPlayerI mpl())this._playerImpl.pauseVideo();},stopVideo:function(){if(this._hasPlayerImp l())this._playerImpl.stopVideo();},mute:function(){if(this._hasPlayerImpl())this ._playerImpl.mute();},unmute:function(){if(this._hasPlayerImpl())this._playerImp l.unmute();},volume:function(settings){if(this._hasPlayerImpl())this._playerImpl .volume(settings);},lightOn:function(){if(this._hasPlayerImpl())this._playerImpl .lightOn();},lightOff:function(){if(this._hasPlayerImpl())this._playerImpl.light Off();},load:function(settings){this.videosIDs=settings.videosIDs;this.autoPlay= ((settings.autoPlay===undefined)||(settings.autoPlay));if((this.autoPlay)&&(this ._hasPlayerImpl())){this._playerImpl.load(settings);}else{this._createAndStart() ;}},loadSecondary:function(settings){if(this._hasPlayerImpl())this._playerImpl.l oadSecondary(settings);},hideSecondary:function(){if(this._hasPlayerImpl())this. _playerImpl.hideSecondary();},dynamicStream:function(settings){if(this._hasPlaye rImpl())this._playerImpl.dynamicStream(settings);},isStopped:function(){if(this. _hasPlayerImpl())return this._playerImpl.isStopped();},isPlaying:function(){if(t his._hasPlayerImpl())return this._playerImpl.isPlaying();},isPaused:function(){i f(this._hasPlayerImpl())return this._playerImpl.isPaused();},resize:function(set tings){this.width=settings.width||this.width;this.height=settings.height||this.h eight;this._setElementSize();if(this._hasPlayerImpl()){this._playerImpl.resize({ width:this.width,height:this.height});}},authenticationRequired:function(){if(th is._hasPlayerImpl()){this._playerImpl.loadPlaylist();}else{this._createAndStart( );}},getErrorMessageFor:function(code){if(this._hasPlayerImpl()){return this._pl ayerImpl.getErrorMessageFor(code);}},getUserId:function(){return Util.getCookie( "__utma");},_setElementSize:function(){this._element.style.width=this.width+'px' ;this._element.style.height=this.height+'px';},_hasPlayerImpl:function(){return( this._playerImpl!==undefined);},_createAndStart:function(){this._create();this._ start();},_create:function(){this._playerImpl=PlayerFactory.create({playerId:thi s.id,width:this.width,height:this.height,autoPlay:this.autoPlay,element:this._el ement,player:this});},_start:function(){if(this.autoPlay){this._playerImpl.loadP laylist();}else{this._playerImpl.showPoster();}},_definedProperties:function(){t his.id=PlayerManager.push(this)-1;this.objectId="wmPlayer-"+this.id;this.playerN amespace="WM.PlayerManager["+this.id+"]";},_defaultValues:function(){this.autoPl ay=this.autoPlay||this.autoplay||false;this.videosIDs=String(this.videosIDs||thi s.videosids||'');this.width=this.width||320;this.height=this.height||240;this.st retchWidth=this.stretchWidth||this.stretchwidth||this.width;this.stretchHeight=t his.stretchHeight||this.stretchheight||this.height;this.environment=this.environ ment||Env.defaultEnvironment;this.simulateAutoPlay=this.simulateAutoPlay||!this.

autoPlay;this.onLightOn=this.onLightOn||this.playerNamespace+'._onLightOn';this. onLightOff=this.onLightOff||this.playerNamespace+'._onLightOff';this.onStretch=t his.onStretch||this.playerNamespace+'._onStretch';this.onShrink=this.onShrink||t his.playerNamespace+'._onShrink';this.playRelated=(this.onPlayRelatedClick&&Util .isFunction(this.onPlayRelatedClick)?this.onPlayRelatedClick:window[this.onPlayR elatedClick]);this.playRelated=this.playRelated||this._onPlayRelatedClick;},_int erfaceReady:function(){if(this._hasPlayerImpl())this._playerImpl.setCallbacks(); },_onShrink:function(){this.resize({width:this._beforeStretchWidth||this.width,h eight:this._beforeStretchHeight||this.height});},_onStretch:function(){this._bef oreStretchWidth=this.width;this._beforeStretchHeight=this.height;this.resize({wi dth:this.stretchWidth,height:this.stretchHeight});},_onLightOn:function(){Effect .onLightOn(document.getElementById(this.objectId));},_onLightOff:function(){Effe ct.onLightOff(document.getElementById(this.objectId),this.zIndex);},_onPlayRelat edClick:function(){return false;}};Player.Exception=function(message){this.messa ge=message;};Player.PROTECTED_ATTRIBUTES=["id","attachTo","objectId","playerName space","playVideo","seek","pauseVideo","stopVideo","mute","unmute","volume","lig htOn","lightOff","load","loadSecondary","hideSecondary","authenticationRequired" ,"dynamicStream","resize","getErrorMessageFor","isStopped","isPlaying","isPaused ","playRelated","getUserId"];var PlayerFlash=WMClass.extend({_videoIndex:0,_tota lChildren:1,_hasRenderedPlayer:false,init:function(settings){this.settings=setti ngs;this._setup();},showPoster:function(){this._renderPoster();this._getPoster() .enable();},loadPlaylist:function(){Playlist.load({playerId:this.settings.player Id,videoID:this._mainVideoID(),success:this._linkedPlaylistLoaded,error:this._li nkedPlaylistLoadError});},posterClicked:function(){if(Util.isFunction(this.playe r.onPlay)){this.player.onPlay();} this.loadPlaylist();},playVideo:function(){if(this._hasRenderedPlayer){this._get Object().playVideo();}else{this.posterClicked();}},seek:function(settings){if(th is._hasRenderedPlayer)this._getObject().seek(settings);},pauseVideo:function(){i f(this._hasRenderedPlayer)this._getObject().pauseVideo();},stopVideo:function(){ if(this._hasRenderedPlayer)this._getObject().stopVideo();},mute:function(){if(th is._hasRenderedPlayer)this._getObject().mute();},unmute:function(){if(this._hasR enderedPlayer)this._getObject().unmute();},volume:function(settings){if(this._ha sRenderedPlayer)this._getObject().volume(settings);},lightOn:function(){if(this. _hasRenderedPlayer)this._getObject().lightOn();},lightOff:function(){if(this._ha sRenderedPlayer)this._getObject().lightOff();},load:function(settings){if(this._ hasRenderedPlayer){this._getObject().load(settings);}else{this.loadPlaylist();}} ,loadSecondary:function(settings){if(this._hasRenderedPlayer)this._getObject().l oadSecondary(settings);},hideSecondary:function(){if(this._hasRenderedPlayer)thi s._getObject().hideSecondary();},dynamicStream:function(settings){if(this._hasRe nderedPlayer)this._getObject().dynamicStream(settings);},isStopped:function(){if (this._hasRenderedPlayer){return this._getObject().isVideoStopped();} return true;},isPlaying:function(){if(this._hasRenderedPlayer){return this._getO bject().isVideoPlaying();} return false;},isPaused:function(){if(this._hasRenderedPlayer){return this._getO bject().isVideoPaused();} return false;},resize:function(settings){if(this._getPoster()){this._getPoster() .resize(settings);} this.error.resize(settings);},setCallbacks:function(){if(this._hasRenderedPlayer ){var object=this._getObject();if(object){this._setCallbacks(object,object.addLi stener,PlayerFlash.CALLBACKS);this._setCallbacks(object,object.addInputListener, PlayerFlash.INPUTCALLBACKS);}else{Util.log("Object tag not found");}}},getErrorM essageFor:function(code){return this.error.messageFor(code);},_setup:function(){ this.player=this.settings.player;this.error=new ErrorPage({element:this.settings .element,errorMessages:this.player.errorMessages,width:this.settings.width,heigh t:this.settings.height});Event.createLinkedMethodsFor(this,this._methodsToLink() );},_getObject:function(){return document.getElementById(this.player.objectId);} ,_mainVideoID:function(){return this.player.videosIDs.split('|')[0];},_setCallba cks:function(object,listener,callbacks){var self=this;Util.each(callbacks,functi on(callbackName){var callback=self.player[callbackName.toLowerCase()]||self.play er[callbackName];if(callback){if(Util.isFunction(callback)){self.player[callback

Name]=callback;callback=self.player.playerNamespace+'.'+callbackName;} try{listener.call(object,callbackName,callback);}catch(e){Util.log(e);}}});},_pl aylistLoaded:function(playlist){this._setPlaylist(playlist);this._getResource(); this._getTotalChildren();if(this._isAuthenticationRequired()){this._checkAuthori zed();}else{this._authorized();}},_setPlaylist:function(playlist){this.playlist= this.player.playlist=playlist;},_isAuthenticationRequired:function(){return Auth .isAuthenticationRequired(this.playlist)},_playlistLoadError:function(errorData) {this._renderError(errorData);},_getResource:function(){this.resource=Playlist.g etResource(this.playlist,this._videoIndex,this._childrenIndex);},_checkAuthorize d:function(){Auth.checkAuthorized({videosIDs:this._mainVideoID(),resourceId:this ._getResourcesIds(),callback:this._linkedAuthorizationChecked});},_authorization Checked:function(authorized,errorObject){if(authorized){this._authorized();}else if(this._isNotAuthorized(errorObject)){this._handleAuthentication();}else{this. _renderError(errorObject);}},_isNotAuthorized:function(errorObject){return error Object===undefined||this.error.isNotAuthorized(errorObject);},_authorized:functi on(){this._render();},_handleAuthentication:function(){this._renderPoster();this ._getPoster().disable();this._showAuthenticationScreen();},_showAuthenticationSc reen:function(){Auth.showAuthenticationScreen({serviceId:Playlist.getServiceId(t his.playlist),element:this.settings.element,callback:this._linkedAuthorized,onCl ose:this.linkedShowPoster});},_renderError:function(errorObject){var code;if(thi s.error.isNotFound(errorObject)){code=ErrorPage.NOT_FOUND.code;}else if(this.err or.isGeoBlocked(errorObject)){code=ErrorPage.GEO_BLOCKED.code;} this.error.render(code);},_renderFlashErrorPage:function(){this.error.render(Err orPage.DEVICE_NOT_SUPPORTED.code);},_getPoster:function(){if(this._poster===unde fined){this._poster=new Poster();} return this._poster;},_renderPoster:function(){this._getPoster().render({element :this.settings.element,videoID:this._mainVideoID(),width:this.settings.width,hei ght:this.settings.height,callback:this.linkedPosterClicked});this._hasRenderedPl ayer=false;},_render:function(){Util.clearElement(this.settings.element);if(Util .hasFlashInstalled()){this._hasRenderedPlayer=true;this.settings.element.innerHT ML=Builder.toObjectTag(this.player);}else{this._renderFlashErrorPage();}},_getRe sourcesIds:function(){var resourcesIds=[];for(var index=0;index<this._totalChild ren;index++){resourcesIds.push(Playlist.getResource(this.playlist,this._videoInd ex,index).id);} return resourcesIds.join('|');},_getTotalChildren:function(){this._totalChildren =Playlist.totalChildren(this.playlist,this._videoIndex);},_methodsToLink:functio n(){return['showPoster','posterClicked','_playlistLoaded','_playlistLoadError',' _authorizationChecked','_authorized'];}});PlayerFlash.CALLBACKS=["onLightOn","on LightOff","complete"];PlayerFlash.INPUTCALLBACKS=["onPlay","onPause","onStop","o nSeek","onVolumeChange","onMute","onUnmute","onEnterFullScreen","onExitFullScree n","onShrink","onStretch","onDynamicStream"];PlayerHtml5.BLACK_VIDEO="http://fla shvideo.globo.com/entretenimento/1/propaganda/black.mp4";PlayerHtml5.IPad=Player Flash.extend({_childrenIndex:0,_eventsRegistered:false,_hasTrackedPlay:false,_si gnedHashes:[],playVideo:function(){if(this._isRendered()){this._video.play();}el se{this.posterClicked();}},seek:function(settings){if(this._isRendered()){var du ration=this._video.duration;if(!isNaN(duration)){var percentage=parseFloat(setti ngs.seekPercentage);this._video.currentTime=duration*percentage;}}},pauseVideo:f unction(){if(this._isRendered())this._video.pause();},stopVideo:function(){if(th is._isRendered()){this._video.pause();this._video.currentTime=0;var callbackFunc tion=this._callbackFunction("onStop");if(callbackFunction){callbackFunction();}} },mute:function(){if(this._isRendered())this._video.muted=true;},unmute:function (){if(this._isRendered())this._video.muted=false;},volume:function(settings){if( this._isRendered())this._video.volume=parseFloat(settings.value);},load:function (settings){Util.clearElement(this.settings.element);this._video=undefined;this.l oadPlaylist();},isStopped:function(){if(this._isRendered()){return this._video.e nded||(this._video.paused&&this._video.currentTime===0);}},isPlaying:function(){ if(this._isRendered()){return!this._video.paused&&!this._video.ended;}},isPaused :function(){if(this._isRendered()){return this._video.paused&&this._video.curren tTime!==0;}},setCallbacks:function(){this._setCallbacks("onPlay","play");this._s etCallbacks("onPause","pause");this._setCallbacks("onStop","ended");this._setCal

lbacks("complete","ended");this._setCallbacks("onSeek","seeked");},_callbackFunc tion:function(callbackName){var callback=this.player[callbackName.toLowerCase()] ||this.player[callbackName];var callbackFunction=null;if(callback){if(Util.isFun ction(callback)){this.player[callbackName]=callback;callbackFunction=Event.linke r(this.player[callbackName],this.player);}else{callbackFunction=new Function('re turn '+callback)();}} return callbackFunction;},_setCallbacks:function(callbackName,eventName){var cal lbackFunction=this._callbackFunction(callbackName);if(callbackFunction){Event.bi nd(this._video,eventName,callbackFunction);}},showPoster:function(){this._render ();this._setupFirstPlay();},_setup:function(){this._super();this._metrics=Metric s.getDefaultInstance();},_playlistLoaded:function(playlist){this._getResource(); this._super(playlist);},_playlistLoadError:function(errorData){this._renderError (errorData);},_authorized:function(){this._loadHash();},_handleAuthentication:fu nction(){if(this.settings.autoPlay){this.showPoster();this._hideVideo();} this._showAuthenticationScreen();},_loadHash:function(){Auth.getHash({videosIDs: this._mainVideoID(),resourceId:this._getResourcesIds(),success:this._linkedHashL oaded,error:this._linkedHashError});},_hashLoaded:function(hashData){this._signH ashes(hashData);this._play();},_signHashes:function(hashData){var hashes=hashDat a.hash instanceof Array?hashData.hash:[hashData.hash];this._signedHashes=Util.ma p(hashes,function(hash){return Signer.sign(hash);});},_play:function(){var video Url=this.resource.url+'?'+this._signedHashes[this._childrenIndex];if(this._isRen dered()){this._showVideo();this._loadAndPlay(videoUrl);}else{this._render(videoU rl);}},_hashError:function(errorData){this._renderError(errorData);},_isRendered :function(){return this._video!==undefined;},_loadAndPlay:function(src){this._vi deo.src=src;if(!this._eventsRegistered){this._setupEventListeners();} this._video.load();this._video.play();},_showVideo:function(){this._video.style. display='block';},_hideVideo:function(){this._video.style.display='none';},_rend er:function(src){Util.clearElement(this.settings.element);this.settings.element. innerHTML=Builder.toVideoTag({width:this.settings.width,height:this.settings.hei ght,src:src||PlayerHtml5.BLACK_VIDEO,poster:this._getPosterUrl()});this._video=t his.settings.element.getElementsByTagName('video')[0];if(src){this._setupEventLi steners();}},_getPosterUrl:function(){return Poster._thumbUrl({videoID:this._mai nVideoID(),height:this.settings.height});},_setupFirstPlay:function(){Event.bind (this._video,'play',this._linkedOnFirstPlay);},_onFirstPlay:function(){Event.unb ind(this._video,'play',this._linkedOnFirstPlay);this._hideVideo();this.loadPlayl ist();},_setupEventListeners:function(){Event.bind(this._video,'play',this._link edOnPlay);Event.bind(this._video,'ended',this._linkedOnEnded);this.setCallbacks( );this._eventsRegistered=true;},_onPlay:function(){if(this._isFirstChild()&&!thi s._hasTrackedPlay){this._metrics.play(Playlist.parametersForMetrics(this.playlis t,this._videoIndex));this._hasTrackedPlay=true;}},_onEnded:function(){if(this._i sLastChild()){this._metrics.end(Playlist.parametersForMetrics(this.playlist,this ._videoIndex));} this._next();},_isFirstChild:function(){return this._childrenIndex===0;},_isLast Child:function(){return this._childrenIndex==(this._totalChildren-1);},_next:fun ction(){if(!this._isLastChild()){this._childrenIndex++;this._getResource();this. _play();}},_getResource:function(){this.resource=Playlist.getResource(this.playl ist,this._videoIndex,this._childrenIndex);},_methodsToLink:function(){return thi s._super().concat(["_loadHash","_hashLoaded","_hashError","_onFirstPlay","_onPla y","_onEnded","_volumeChanged"]);}});PlayerHtml5.IPhone=PlayerHtml5.IPad.extend( {showPoster:function(){this.loadPlaylist();},posterClicked:function(){this._redi rectToAuthenticationPage();},_handleAuthentication:function(){if(this.settings.a utoPlay){this._redirectToAuthenticationPage();}else{this._renderPoster();}},_red irectToAuthenticationPage:function(){Auth.redirectToAuthenticationScreen({servic eId:Playlist.getServiceId(this.playlist)});}});PlayerHtml5.Android=PlayerHtml5.I Phone.extend({_getVideoFromPlaylist:function(){return this.playlist.videos[this. _videoIndex];},posterClicked:function(){if(this._src){Util.navigateTo(this._src) ;}else{this._super();}},_render:function(src){if(Playlist.isGalleryOrFullEpisode (this._getVideoFromPlaylist())){if(Util.hasFlashInstalled()){this._fallbackToFla shPlayer();}else{this._renderFlashErrorPage();}}else{if(Util.canPlayType(src||Pl ayerHtml5.BLACK_VIDEO)){this._super(src);}else{this._src=(src||PlayerHtml5.BLACK

_VIDEO);this._renderPoster();}}},_fallbackToFlashPlayer:function(){Util.clearEle ment(this.settings.element);this.settings.element.innerHTML=Builder.toObjectTag( this.player);}});window.WM={Player:Player,PlayerManager:PlayerManager,closeBoxLo ginScreen:Auth.closeBoxLoginScreen,getUrlParameters:Util.getUrlParameters,getDat aAttributes:Data.all,convertSizeToBanda:Builder.convertSizeToBanda};if((window.j Query!==undefined)&&(window.jQuery!=null)){(function($){$.fn.playerInstance=func tion(){var playerInstances=[];this.each(function(){if(this.wmPlayer){playerInsta nces.push(this.wmPlayer);}});return playerInstances;};$.fn.playerApiCaller=funct ion(method,params){return this.each(function(){if(this.wmPlayer){this.wmPlayer[m ethod](params);}});};$.fn.player=function(options){var settings={};$.each(option s||{},function(key,value){settings[key.toLowerCase()]=value;});return this.each( function(){var _options={videosIDs:'',autoPlay:false,width:320,height:240};Util. mergeObjects(_options,Data.all(this,"player"));Util.mergeObjects(_options,settin gs);if((_options.autoPlay===false)||(_options.autoPlay==='false')){delete _optio ns.autoPlay;} var resultSettings=$.extend({},_options);var banda=Builder.convertSizeToBanda(re sultSettings.width,resultSettings.height);if((resultSettings.videosIDs==='')||(! banda)){$(this).html('No foi possvel exibir o player');var message='Parmetro videos IDs invlido: '+resultSettings.videosIDs;if(!banda){message='Parmetro width ou heig ht invlidos. Tamanhos vlidos: 288x216, 320x240, 480x360, 640x360';} Util.log(message);}else{var player=new Player(resultSettings);this.wmPlayer=play er;player.attachTo(this);}});};})(window.jQuery);}})(window);try{RegistradorGMCE mbed.existo();} catch(e){RegistradorGMCEmbed={existo:function(){},registrar:function(embed){},ob ter:function(idEmbed){return WM.PlayerManager[idEmbed];}}} function GMCEmbed(config){this.deprecated('Esta classe nao deve mais ser utiliza da, mude para a WM.Player');this.config=config;if((this.config.novoPlayer===unde fined)||(this.config.novoPlayer==null)||(this.config.novoPlayer==="")){this.conf ig.novoPlayer=true;} if((this.config.hostNovoPlayer===undefined)||(this.config.hostNovoPlayer==null)| |(this.config.hostNovoPlayer==="")){this.config.environment="";this.config.hostN ovoPlayer="s.videos.globo.com";} this.id="globovideos_embed_"+this.config.idEmbed;if(!this.config.pp&&this.config .embedInterno){this.config.pp=this.config.embedInterno;} this.config.escondeBarraInferior=this.config.escondeTrocaBanda;this.tamanhos={P: {largura:186,altura:138,barraInferior:0},I:{largura:288,altura:216,barraInferior :0},N:{largura:320,altura:240,barraInferior:0},L:{largura:480,altura:360,barraIn ferior:0},X:{largura:640,altura:360,barraInferior:0},PaginaPlayer:{largura:480,a ltura:360,barraInferior:0}};if(this.config.novoPlayer){this.config.titulo=this.c onfig.destaque=this.config.imagem=this.config.css=null;this.config.pp=false;this .config.escondeBarraInferior=this.config.escondeTrocaBanda=this.config.escondFim Video=true;} if(this.config.midiaId)this.config.videosIDs=this.config.midiaId;delete this.con fig.midiaId;if(this.config.autoStart)this.config.autoPlay=this.config.autoStart; delete this.config.autoStart;this.config.width=this._largura();this.config.heigh t=this._altura();if(this.config.onTerminoDoVideo){this.config.complete=this.conf ig.onTerminoDoVideo;this.config.onStop=this.config.onTerminoDoVideo;} if(!this.config.escondeTrocaBanda)this.config.displayThumbsUpButton=true;this.pl ayer=new WM.Player(this.config);this.config.idEmbed=this.player.id;var domain=(( /\.globoi\.com$/).test(location.hostname))?"globoi.com":"globo.com";try{document .domain=domain;}catch(e){if(window.console&&window.console.log){var msg='GloboVi deosEmbed Warning: \nEventos s\u00f3 devem ser ';msg+='configurados para paginas no dom\u00ednio '+domain;window.console.log(msg);}}} GMCEmbed.prototype={setConfigParaNovoPlayer:function(){},deprecated:function(mes sage){if(window&&window.console&&window.console.log){window.console.log('DEPRECA TION WARNING: '+message);}},_chave:function(){if('PINLX'.indexOf(this.config.ban da)==-1){this.config.banda='N';} if(this.config.novoPlayer){return(this.config.banda?this.config.banda:'N');}else {return this.config.pp?'PaginaPlayer':(this.config.banda?this.config.banda:'N'); }},_largura:function(){return this.tamanhos[this._chave()].largura;},_altura:fun

ction(){var t=this.tamanhos[this._chave()];return this.config.escondeBarraInferi or?t.altura-t.barraInferior:t.altura;},toString:function(poeSrc){},makeIframe:fu nction(){},play:function(){},destroy:function(){},_vp:function(tempo){},print:fu nction(tempo){var testId='gmcembed_wrapper_test_'+this.config.idEmbed;document.w riteln('<span id="'+testId+'"></span>');var testElement=document.getElementById( testId);var parent=testElement.parentNode;if(parent.nodeName.toLowerCase()=='p') {this.id="globovideos_embed_"+this.config.idEmbed;this.config.midiaId=this.confi g.videosIDs;var h='<iframe allowtransparency="true" name="'+this.id+'" id="'+th is.id+'" style="';h+='position: relative;';h+='width:'+this._largura()+'px;';h+= 'height:'+this._altura()+'px"';h+=" src=\""+gmcEmbedUtil.getUrlPlay(this.config) +"\" ";h+=' marginheight="0" frameborder="0" ';h+=' marginwidth="0" scrolling="n o"></iframe>';document.writeln(h);}else{var id='gmcembed_wrapper_'+this.config.i dEmbed;document.writeln('<div id="'+id+'" style="margin: 0 auto; clear: both;">< /div>');this.player.attachTo(document.getElementById(id));} parent.removeChild(testElement);},attach:function(div,tempo){var d=document.getE lementById(div);var id='gmcembed_wrapper_'+this.config.idEmbed;d.innerHTML='<div id="'+id+'" style="margin: 0 auto; clear: both; "></div>';this.player.attachTo( document.getElementById(id));},acertaFrameFlash:function(){},acertaFrameH264:fun ction(){},resize:function(b){this.config.banda=b;this.player.resize({width:this. _largura(),height:this._altura()});},observarEventos:function(){},verificarEvent osDefault:function(){},notificaEvento:function(nome){},metodoDoEvento:function(n omeEvento){},load:function(options){this.player.load(options);},loadSecondary:fu nction(options){this.player.loadSecondary(options);},hideSecondary:function(){th is.player.hideSecondary();},playVideo:function(){this.player.playVideo();},pause Video:function(){this.player.pauseVideo();},stopVideo:function(){this.player.sto pVideo();},mute:function(){this.player.mute();},unmute:function(){this.player.un mute();},volume:function(object){this.player.volume(object);},seek:function(obje ct){this.player.seek(object);},lightOn:function(){this.player.lightOn();},lightO ff:function(){this.player.lightOff();}} function GMCEmbedDetecter(){this.isIE=(navigator.appVersion.indexOf("MSIE")!=-1) ?true:false;this.isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?t rue:false;this.isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;thi s.wmp=this.detectWmp();this.flashMinimo=this.detectSwf(9,0,115);if(this.flashMin imo)this.flashInstalado=true;else this.flashInstalado=this.detectSwf(6,0,65);} GMCEmbedDetecter.prototype={isWmpEmbed:function(){return this.wmp.version=="embe d";},isWmpInstalado:function(){return(this.wmp.installed&&(this.isWmpEmbed()||th is.wmp.version>=9));},isFlashMinimo:function(){return this.flashMinimo;},isFlash Instalado:function(){return this.flashInstalado;},detectSwf:function(reqMajorVer ,reqMinorVer,reqRevision){versionStr=this.getSwfVer();if(versionStr==-1){return false;}else if(versionStr!=0){if(this.isIE&&this.isWin&&!this.isOpera){tempArray =versionStr.split(" ");tempString=tempArray[1];versionArray=tempString.split("," );}else{versionArray=versionStr.split(".");} var versionMajor=versionArray[0];var versionMinor=versionArray[1];var versionRev ision=versionArray[2];if(versionMajor>parseFloat(reqMajorVer)){return true;}else if(versionMajor==parseFloat(reqMajorVer)){if(versionMinor>parseFloat(reqMinorVe r)) return true;else if(versionMinor==parseFloat(reqMinorVer)){if(versionRevision>=p arseFloat(reqRevision)) return true;}} return false;}},getSwfVerWin:function(){var version;var axo;var e;try{axo=new Ac tiveXObject("ShockwaveFlash.ShockwaveFlash.7");version=axo.GetVariable("$version ");}catch(e){} if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");versio n="WIN 6,0,21,0";axo.AllowScriptAccess="always";version=axo.GetVariable("$versio n");}catch(e){}} if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");versio n=axo.GetVariable("$version");}catch(e){}} if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");versio n="WIN 3,0,18,0";}catch(e){}} if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");version=

"WIN 2,0,0,11";}catch(e){version=-1;}} return version;},getSwfVer:function(){var flashVer=-1;if(navigator.plugins!=null &&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navig ator.plugins["Shockwave Flash"]){var swVer2=navigator.plugins["Shockwave Flash 2 .0"]?" 2.0":"";var flashDescription=navigator.plugins["Shockwave Flash"+swVer2]. description;var descArray=flashDescription.split(" ");var tempArrayMajor=descArr ay[2].split(".");var versionMajor=tempArrayMajor[0];var versionMinor=tempArrayMa jor[1];if(descArray[3]!=""){tempArrayMinor=descArray[3].split("r");}else{tempArr ayMinor=descArray[4].split("r");} var versionRevision=tempArrayMinor[1]>0?tempArrayMinor[1]:0;var flashVer=version Major+"."+versionMinor+"."+versionRevision;}} else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1)flashVer=4;el se if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1)flashVer=3;else if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1)flashVer=2;else if(th is.isIE&&this.isWin&&!this.isOpera){flashVer=this.getSwfVerWin();} return flashVer;},detectWmp:function(){var wmp64="MediaPlayer.MediaPlayer.1";var wmp7="WMPlayer.OCX.7";var wmpInfo={installed:false,scriptable:false,version:0}; var player=null;try{if(window.ActiveXObject){wmpInfo.scriptable=true;player=this .createActiveXObject(wmp7);if(player){wmpInfo.installed=true;wmpInfo.version=par seInt(player.versionInfo);return wmpInfo;} player=this.createActiveXObject(wmp64);if(player){wmpInfo.installed=true;wmpInfo .version=6;return wmpInfo;}}}catch(e){} try{if(navigator.mimeTypes){player=navigator.mimeTypes['application/x-mplayer2'] .enabledPlugin;if(player){wmpInfo.scriptable=false;wmpInfo.installed=true;wmpInf o.version='embed';return wmpInfo;}}}catch(e){} return wmpInfo;},createActiveXObject:function(id){var error;var control=null;try {if(window.ActiveXObject)control=new ActiveXObject(id);else if(window.GeckoActiv eXObject)control=new GeckoActiveXObject(id);}catch(e){} return control;}} var gmcEmbedDetecter=new GMCEmbedDetecter();function GMCEmbedUtil() {this.bandas={wmp:{P:{largura:186,altura:116},N:{largura:320,altura:200},L:{larg ura:480,altura:300},I:{largura:288,altura:180},X:{largura:640,altura:360}},swf:{ P:{largura:186,altura:170},N:{largura:320,altura:272},L:{largura:480,altura:392} ,I:{largura:288,altura:248},X:{largura:640,altura:360}},novoPlayer:{P:{largura:1 86,altura:138},I:{largura:288,altura:216},N:{largura:320,altura:240},L:{largura: 480,altura:360},X:{largura:640,altura:360}}} var hostPlayer=((/\.globoi\.com$/).test(location.hostname))?"conteudo.globoi.com ":"playervideo.globo.com";var h="http://"+hostPlayer+"/webmedia/";this.urlPlay=h +"player/GMCPlayMidia";this.urlPlayEmbed=h+"player/embed/GMCPlayMidia";this.urlS top=h+"player/GMCAbrePlayer";this.urlStopEmbed=h+"player/embed/GMCAbrePlayer";th is.urlFim=h+"player/GMCFimVideo";this.urlFimEmbed=h+"player/embed/GMCFimVideo";t his.urlEnviar=h+"GMCEnviarEmail";this.urlLogin=h+"player/GMCLogin";this.urlLogin Embed=h+"player/embed/GMCLogin";this.urlPlay=this.urlPlayEmbed="http://s.videos. globo.com/p2/abreplayer.html";this.urlStop=this.urlStopEmbed="http://s.videos.gl obo.com/p2/abreplayer.html";} GMCEmbedUtil.prototype={getTamanho:function(banda,flash,novoPlayer){if(!banda)ba nda='N';var tipo;if(novoPlayer){tipo='novoPlayer';}else if(flash){tipo='swf';}el se{tipo='wmp';} var tamanho=this.bandas[tipo][banda];if(!tamanho)tamanho=this.bandas[tipo]['N']; return tamanho;},getLargura:function(banda,flash,novoPlayer) {return this.getTamanho(banda,flash,novoPlayer).largura;},getAltura:function(ban da,flash,novoPlayer) {return this.getTamanho(banda,flash,novoPlayer).altura;},doLoginNovo:function(f, novoPlayer) {if(this.isFazendoLogin)return false;this.isFazendoLogin=true;var boxErro=docume nt.getElementById("box-erro-form");var liLogin=document.getElementById("li-login ");var liSenha=document.getElementById("li-senha");boxErro.className="";liLogin. className="";liSenha.className="";var o=null;if(!f.login.value||f.login.value.le ngth==0) {liLogin.className="erro-form";o=f.login;}

if(!f.senha.value||f.senha.value.length==0) {liSenha.className="erro-form";o=f.login;} if(o){boxErro.className="on";o.focus();this.isFazendoLogin=false;return false;} var url=(f.pp&&f.pp.value=='true')?this.urlLogin:this.urlLoginEmbed;f.action=url ;return true;},doRequisitos:function(id) {this.setCookie('ntr','true',7);this.doSubmit(id);},doSubmit:function(id) {var f=document.getElementById(id);url=(f.pp&&f.pp.value=='true')?this.urlPlay:t his.urlPlayEmbed;f.action=url;f.submit();},setCookie:function(name,value,dias) {if(dias){var date=new Date();date.setTime(date.getTime()+(dias*24*60*60*1000)); var expires="; expires="+date.toGMTString();} var path="/".length>0?"; path=/":"";var cookieHost=((/\.globoi\.com$/).test(loca tion.hostname))?".globoi.com":".globo.com";var domain=cookieHost.length>0?"; dom ain="+cookieHost:"";var cookieString=name+"="+escape(value)+path+domain+expires; document.cookie=cookieString;},getCookie:function(name) {var start=document.cookie.indexOf(name+"=");var len=start+name.length+1;if((!st art)&&(name!=document.cookie.substring(0,name.length)))return null;if(start==-1) return null;var end=document.cookie.indexOf(";",len);if(end==-1)end=document.coo kie.length;return unescape(document.cookie.substring(len,end));},getParametros:f unction(c) {var p="?midiaId="+c.midiaId;p+="&autoStart="+(c.autoStart?"true":"false");p+="& idEmbed="+c.idEmbed;if(c.imagem)p+="&imagem="+c.imagem;if(c.css)p+="&css="+c.css ;if(c.banda)p+="&banda="+c.banda;if(c.pp)p+="&pp="+c.pp;if(c.escondeFimVideo)p+= "&escondeFimVideo=true";if(c.escondeTrocaBanda)p+="&escondeTrocaBanda=true";if(c .telaCheia)p+="&telaCheia=true";if(!gmcEmbedDetecter.isFlashInstalado())p+="&ntf =true";if(c.environment)p+="&environment="+c.environment;if(c.novoPlayer)p+="&no voPlayer="+c.novoPlayer;if(c.hostNovoPlayer)p+="&hostNovoPlayer="+c.hostNovoPlay er;if(c.displayLightButton)p+="&displayLightButton="+c.displayLightButton;if(c.d isplayThumbsUpButton)p+="&displayThumbsUpButton="+c.displayThumbsUpButton;if(c.a utoStart) if(!gmcEmbedDetecter.isWmpInstalado()||gmcEmbedDetecter.isWmpEmbed()){p+="&ntr=t rue";} if(c.sitePage)p+="&sitePage="+c.sitePage;for(var key in c){if(key.indexOf('fl_') ==0){if((c[key]!=undefined)||(c[key]!=null)){p+="&"+key+"="+c[key];}}} p+="&nocache="+new Date().getTime();return p;},getUrlPlay:function(config) {var url;if(config.autoStart)url=config.pp?this.urlPlay:this.urlPlayEmbed;else u rl=config.pp?this.urlStop:this.urlStopEmbed;return url+this.getParametros(config );},getUrlFim:function(config) {var url=config.pp?this.urlFim:this.urlFimEmbed;return url+this.getParametros(co nfig);},adaptaBanda:function(banda) {if(document.getElementById("videoBarra")) {if(banda=='L') {document.getElementById("tamanhoNormal").style.display="inline";document.getEle mentById("tamanhoGrande").style.display="none";} else {document.getElementById("tamanhoNormal").style.display="none";document.getEleme ntById("tamanhoGrande").style.display="inline";} document.getElementById("videoBarra").style.display="block";}},openWin:function( url,w,h) {var left=(screen.width-w)/2;var top=(screen.height-h)/2;var s="width="+w+", hei ght="+h+", top="+top+", left="+left+",scrollbars=yes";var j=window.open(url,"emb ed",s);if(j==null||j==undefined){alert("Por favor, desative o seu bloqueador de popups e tente novamente");}}} var gmcEmbedUtil=new GMCEmbedUtil();function MashupEmbed() {this.isVideoEmbedOpen=false;this.img=null;this.embed=null;} MashupEmbed.prototype.addVideoEmbed=function(q,config) {if(!this.isVideoEmbedOpen) {var divT=document.createElement('div');divT.id='boxVideo';var html='<a class="c lose" href="javascript:;" onclick="mashupEmbed.videoClose(this);">';html+='<img src="http://video.globo.com/Portal/globonoticias/img/boxBuscaClose.gif" width="1 5" height="15" alt="fechar" border="0" />';html+='</a><h3><img src="http://video

.globo.com/Portal/homeglobocom/2006_2/img/gmc_video.gif" /></h3>';divT.innerHTML =html;var divC=document.createElement('div');divC.id='boxVideoConteudo';divT.sty le.width=eval(gmcEmbedUtil.getLargura(config.banda))+"px";divT.style.height=eval (gmcEmbedUtil.getAltura(config.banda)+125)+"px";divT.appendChild(divC);document. body.appendChild(divT);this.move(q,divT,-20,17);this.embed=new GMCEmbed(config); this.embed.attach("boxVideoConteudo");this.isVideoEmbedOpen=true;}} MashupEmbed.prototype.move=function(target,objMove,offx,offy){this.target=target ;this.obj=objMove;this.offx=offx;this.offy=offy;this.obj.style.left=this.moveX(t his.offx,this.target)+"px";this.obj.style.top=this.moveY(this.offy,this.target)+ "px";return false;} MashupEmbed.prototype.moveX=function(x,elem){if(!document.layers){var onWindows= navigator.platform?navigator.platform=="Win32":false;var mac=document.all&&!onWi ndows&&getExplorerVersion()==4.5;var par=elem;var lastOffset=0;while(par){if(par .leftMargin&&!onWindows)x+=parseInt(par.leftMargin);if((par.offsetLeft!=lastOffs et)&&par.offsetLeft)x+=parseInt(par.offsetLeft);if(par.offsetLeft!=0)lastOffset= par.offsetLeft;par=mac?par.parentElement:par.offsetParent;}}else if(elem.x)x+=el em.x;return x;} MashupEmbed.prototype.moveY=function(y,elem){if(!document.layers){var onWindows= navigator.platform?navigator.platform=="Win32":false;var mac=document.all&&!onWi ndows&&getExplorerVersion()==4.5;var par=elem;var lastOffset=0;while(par){if(par .topMargin&&!onWindows)y+=parseInt(par.topMargin);if((par.offsetTop!=lastOffset) &&par.offsetTop)y+=parseInt(par.offsetTop);if(par.offsetTop!=0)lastOffset=par.of fsetTop;par=mac?par.parentElement:par.offsetParent;}}else if(elem.y>=0)y+=elem.y ;return y;} MashupEmbed.prototype.videoClose=function(o) {if(this.isVideoEmbedOpen) {this.isVideoEmbedOpen=false;this.embed.destroy();o.parentNode.parentNode.remove Child(o.parentNode);}} var mashupEmbed=new MashupEmbed();

Das könnte Ihnen auch gefallen