function CensorComponent(idComponent){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="censor";this.url="";this.isSendingForm=false;}
CensorComponent.prototype.create=function(videoData){this.url=videoData.getServices().urlCensor;this.theEvent=this.CustomEvent("onModulesEvent");if(jQuery(this.idComponent).find('.reportbaduse_video_player').length==0)
{jQuery(this.idComponent).append('<div id="" class="gp-extra-functionality gp-reportbaduse-video-player reportbaduse_video_player">'+'<div class="gp-extra-functionality-content">'+'<div class="gp-extra-content-close">'+'<a href="javascript:;" title="Cerrar" class="gp-extra-content-close-ico">&times;</a>'+'</div>'+'<div class="gp-extra-content">'+'<form name="form_censor" id="form_censor" method="post" action="" class="gp-extra-form">'+'<label>este contenido como inapropiado? Háznoslo saber.</label>'+'<input type="text" name="nameFrom" id="nameFrom" class="" placeholder="tu nombre" />'+'<input type="email" name="mailFrom" id="mailFrom" class="" placeholder="tu e-mail" />'+'<input type="hidden" name="idContent" id="idContent" value="'+videoData.getItemSelected().id+'" />'+'<input type="hidden" name="sendFrom" id="sendFrom" value="player" />'+'<div class="gp-extra-content-buttons">'+'<input type="submit" name="send_reportbaduse" id="send_reportbaduse" value="enviar" class="">'+'<input type="reset" name="reset_send_reportbaduse" id="reset_send_reportbaduse" value="cancelar" class="gp-last-button">'+'</div>'+'<div class="gp-extra-message message-successful" style="display:none;"><span>mensaje de exito</span></div>'+'<div class="gp-extra-message message-error" style="display:none;"><span>mensaje de error</span></div>'+'<div class="gp-extra-message message-warning" style="display:none;"><span>mensaje de advertencia</span></div>'+'<div class="gp-extra-message message-common" style="display:none;"><span></span></div>'+'</form>'+'</div>'+'<h3 class="gp-extra-title">Marcar como inadecuado</h3>'+'</div>'+'</div>');this.activateListeners();this.translate();}
jQuery(this.idComponent).find('.reportbaduse_video_player').show();}
CensorComponent.prototype.close=function(){jQuery(this.idComponent).find('.reportbaduse_video_player').hide();this.dispatchEvent(["close",this.typeModule]);}
CensorComponent.prototype.remove=function(){jQuery(this.idComponent).find('.reportbaduse_video_player').remove();}
CensorComponent.prototype.activateListeners=function(){var _this=this;if(jQuery(this.idComponent).find('.gp-extra-content-close-ico').length>0){jQuery(this.idComponent).find('.gp-extra-content-close-ico').on(this.clickEvent,function(e){e.preventDefault();_this.close();});}
if(jQuery(this.idComponent).find('.gp-last-button').length>0){jQuery(this.idComponent).find('.gp-last-button').on(this.clickEvent,function(e){e.preventDefault();_this.close();});}
if(jQuery(this.idComponent).find('form[id=form_censor]').length>0){jQuery(this.idComponent).find('form[id=form_censor]').on('submit',function(event){event.preventDefault();if(_this.url==""||typeof _this.url=='undefined'){_this.showErrorMessage();}else if(!_this.isSendingForm){_this.isSendingForm=true;_this.showSendMessage();var divSuccerful=jQuery(_this.idComponent).find('.message-successful');var divError=jQuery(_this.idComponent).find('.message-error');jQuery(divSuccerful).hide();jQuery(divError).hide();jQuery(divError).on(clickEvent,function(e){e.preventDefault();jQuery(this).hide();});jQuery(divSuccerful).on(clickEvent,function(e){e.preventDefault();jQuery(this).hide();});if(_this.validateFields()==false){_this.isSendingForm=false;jQuery(divError).show();_this.hideSendMessage();jQuery(divError).html('<span>'+Translation.getText('player.msjcamposvacios','Los campos no pueden ir vacíos')+'</span>');return;}
var params=jQuery(this).serialize();jQuery.ajax({url:_this.url,type:'post',dataType:'json',data:params,success:function(data,textStatus,jqXHR){_this.isSendingForm=false;_this.hideSendMessage();jQuery(divSuccerful).hide();jQuery(divError).hide();if(data.result=='ok'){jQuery(_this.idComponent).find('form[id=form_censor] input[type=text]').each(function(){jQuery(this).val('');});jQuery(divSuccerful).show();}else{jQuery(divError).html('');var isFirst=true;if(data.errors&&typeof data.errors=="string"){jQuery(divError).append('<span>'+data.errors+'</span>');}else if(data.errors&&typeof data.errors=="object"&&data.errors.length>0){jQuery(divError).append('<span>'+data.errors[0]+'</span>');}
jQuery(divError).show();}},error:function(){_this.isSendingForm=false;_this.hideSendMessage();jQuery(divError).html('<span>'+Translation.getText('player.msjerrorservicio','Error en el servicio. Inténtelo más tarde.')+'</span>');jQuery(divError).show();}});}});}}
CensorComponent.prototype.validateFields=function(){if(jQuery(this.idComponent).find("#nameFrom").val().length<1){return false;}
if(jQuery(this.idComponent).find("#mailFrom").val().length<1){return false;}}
CensorComponent.prototype.hideSendMessage=function(){jQuery(this.idComponent).find('.message-common').hide();clearInterval(this.interval);}
CensorComponent.prototype.showErrorMessage=function(){jQuery(this.idComponent).find('.message-error').find('span').html(Translation.getText('player.msjerrorservicio2','No se puede enviar el mensaje. Disculpe las molestias.'));jQuery(this.idComponent).find('.message-error').show();}
CensorComponent.prototype.translate=function(){jQuery(this.idComponent).find('.gp-extra-content-close a').attr('title',Translation.getText('player.cerrar','Cerrar'));jQuery(this.idComponent).find('#form_censor label').html(Translation.getText('player.msjcontinapropiado','¿Consideras este contenido como inapropiado? Háznoslo saber.'));jQuery(this.idComponent).find('#nameFrom').attr('placeholder',Translation.getText('player.tunombre','tu nombre'));jQuery(this.idComponent).find('#mailFrom').attr('placeholder',Translation.getText('player.tumail','tu e-mail'));jQuery(this.idComponent).find('#send_reportbaduse').attr('value',Translation.getText('player.enviar','enviar--'));jQuery(this.idComponent).find('#reset_send_reportbaduse').attr('value',Translation.getText('player.cancelar','cancelar--'));jQuery(this.idComponent).find('h3[class=gp-extra-title]').html(Translation.getText('player.marcarinapropiado','Marcar como inapropiado'));}
CensorComponent.prototype.showSendMessage=function(){var _this=this;var text=Translation.getText('player.enviandocorreo','Enviando correo');var lod=['.','..','...'];var lodSelected=0;jQuery(this.idComponent).find('.message-common').show();this.interval=setInterval(function(){if(lodSelected<lod.length-1){lodSelected++;}else{lodSelected=0;}
jQuery(_this.idComponent).find('.message-common').find('span').html(text+" "+lod[lodSelected]);},500);}
CensorComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
CensorComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function ConfigComponent(idComponent,qualities){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="config";this.qualities=qualities;this.qualitySelected;}
ConfigComponent.prototype.create=function(qualitySelected){this.qualitySelected=qualitySelected;this.theEvent=this.CustomEvent("onModulesEvent");if(jQuery(this.idComponent).find('.gp-configuration-functionality').length==0)
{jQuery(this.idComponent).append('<div id="" class="gp-extra-functionality gp-configuration-functionality"> '+'<form id="" class=""> '+'<label for="gp-quality" class="gp-quality-conf-label">CALIDAD</label> '+'<select name="gp-quality" class="gp-quality-conf"> '+'</select> '+'</form> '+'</div>');this.activateListeners();}
this.translate();jQuery(this.idComponent).find('.gp-configuration-functionality').show();}
ConfigComponent.prototype.getIndexQualitySelected=function(){var i=0;var index=0;for(i=0;i<this.qualities.length;i++){if(this.qualities[i].value==this.qualitySelected){index=i;}}
return index;}
ConfigComponent.prototype.close=function(){var _this=this;jQuery(this.idComponent).find('.gp-configuration-functionality').animate({opacity:0},300,function(){jQuery(this.idComponent).find('.gp-configuration-functionality').hide();jQuery(this.idComponent).find('.gp-configuration-functionality').css('opacity',1);_this.dispatchEvent(["close",_this.typeModule]);})}
ConfigComponent.prototype.remove=function(){jQuery(this.idComponent).find('.gp-configuration-functionality').remove();}
ConfigComponent.prototype.activateListeners=function(){var _this=this;if(jQuery(this.idComponent).find('.gp-configuration-functionality').length>0){jQuery(this.idComponent).find('.gp-configuration-functionality').mouseleave(function(){_this.close();});}
jQuery('.gp-quality-conf').ddslick({data:_this.qualities,height:73,defaultSelectedIndex:_this.getIndexQualitySelected(),onSelected:function(selectedData){_this.dispatchEvent(["qualitySelected",_this.typeModule,selectedData.selectedData.value]);}});}
ConfigComponent.prototype.translate=function(){jQuery(this.idComponent).find('label[class=gp-quality-conf-label]').html(Translation.getText('player.calidad','CALIDAD'))}
ConfigComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
ConfigComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function ControlsComponent(idComponent,config,controllerId){this.duration;this.currentTime;this.displayBar;this.displayVolume;this.displayTitle;this.theEvent;this.volume=50;this.idComponent=idComponent;this.config=config;this.isLike=false;this.interval;this.isAudio=false;this.controllerId=controllerId;}
ControlsComponent.prototype.createControls=function(isAudio){this.theEvent=this.CustomEvent("onControlsEvent");this.isAudio=isAudio;codDisplayVol=(this.config.volume)?'':'style="display:none"';if(jQuery(this.idComponent).find('.gp-interface').length==0)
{jQuery(this.idComponent).append('<div class="gp-interface" style="display:none;">'+'<div class="gp-progress">'+'<div class="gp-seek-bar">'+'<div class="gp-play-bar" style="width:0%;"></div>'+'</div>'+'</div>'+'<ul class="gp-controls-holder">'+'<li><a href="javascript:;" title="Pantalla Completa" class="gp-icon gp-icon-full-screen gp-full-screen">Pantalla Completa</a></li>'+'<li><a href="javascript:;" title="Restaurar Pantalla" class="gp-icon gp-icon-restore-screen gp-restore-screen">Restaurar pantalla</a></li>'+'<li '+codDisplayVol+'>'+'<a href="javascript:;" class="gp-icon gp-icon-mute-btn gp-mute-btn" title="Silenciar">Silenciar</a>'+'<a href="javascript:;" class="gp-icon gp-icon-unmute-btn gp-unmute-btn" title="Activar volumen" style="">Activar volumen</a>'+'<div class="gp-volume-bar-content">'+'<a href="javascript:;" class="gp-icon gp-icon-mute gp-mute" title="Mute">Mute</a>'+'<a href="javascript:;" class="gp-icon gp-icon-unmute gp-unmute" title="unMute" style="">unMute</a>'+'<div class="gp-volume-bar">'+'<div class="gp-volume-bar-value" style="height: 80%;"></div>'+'</div>'+'</div>'+'</li>'+'<li><a href="javascript:;" title="Configuration" class="gp-icon gp-icon-configuration gp-configuration">Calidades de vídeo</a></li>'+'<li><a href="javascript:;" title="Informar" class="gp-icon gp-icon-inform gp-inform">Informar</a></li>'+'<li><a href="javascript:;" title="Compartir" class="gp-icon gp-icon-share-more gp-share-more">Compartir</a></li>'+'<li><a href="javascript:;" title="Me gusta" class="gp-icon gp-icon-like gp-like">Me gusta</a></li>'+'</ul>'+'<ul class="gp-controls-holder-left">'+'<li><a href="javascript:;" title="Play" class="gp-icon gp-icon-play gp-play">Reproducir</a></li>'+'<li><a href="javascript:;" title="Pause" class="gp-icon gp-icon-pause gp-pause">Pausar</a></li>'+'<li class="gp-controls-time-content"><span class="gp-current-time">00:00:00</span> / <span class="gp-duration">00:00:00</span></li>'+'</ul>'+'</div>');}
this.translate();if(isAudio){jQuery(this.idComponent).find('.gp-interface').addClass('gp-interface-radio');jQuery(".gp-volume-bar-value").css('width',this.volume+'%');}else{jQuery(".gp-volume-bar-value").css('height',this.volume+'%');}
this.updateConfig();this.activateListeners();}
ControlsComponent.prototype.loadingDuration=function(){var _this=this;var text=Translation.getText('player.cargando','Cargando');var lod=[' ','.','..','...'];var lodSelected=0;_this.interval=setInterval(function(){if(_this.duration<1){if(lodSelected<lod.length-1){lodSelected++;}else{lodSelected=0;}
jQuery(_this.idComponent).find(".gp-duration").html(text+" "+lod[lodSelected]);}},500);}
ControlsComponent.prototype.resetValues=function(){this.duration=00;this.currentTime=0;jQuery(this.idComponent).find(".gp-play-bar").css('width','0%');}
ControlsComponent.prototype.setDuration=function(value){clearInterval(this.interval);this.duration=value;if(this.duration>0)
jQuery(this.idComponent).find(".gp-duration").html(this.secondstotime(value));}
ControlsComponent.prototype.setCurrentTime=function(value){this.currentTime=value;jQuery(this.idComponent).find(".gp-current-time").html(this.secondstotime(value));if(this.duration>0&&this.currentTime>0){jQuery(this.idComponent).find(".gp-play-bar").css('width',this.calculatePercentSeek()+'%');}}
ControlsComponent.prototype.setTitle=function(value){jQuery(this.idComponent).find("div[class=gp-title] ul li").html(value);}
ControlsComponent.prototype.displayBar=function(isDisplay){(isDisplay)?jjQuery(this.idComponent).find(".gp-progress").show():jQuery(this.idComponent).find(".gp-progress").hide();}
ControlsComponent.prototype.displayTime=function(isDisplay){(isDisplay)?jQuery(this.idComponent).find(".gp-controls-time-content").show():jQuery(this.idComponent).find(".gp-controls-time-content").hide();}
ControlsComponent.prototype.setVolume=function(value){if(this.config.volume==true){if(value>0)this.volume=value;if(jQuery(this.idComponent).find('.gp-interface-radio').length==0){jQuery(this.idComponent).find(".gp-volume-bar-value").css('height',value+'%');jQuery(this.idComponent).find(".gp-volume-bar-value").css('width','100%');if(value==0){jQuery(this.idComponent).find(".gp-mute").show();jQuery(this.idComponent).find(".gp-unmute").hide();jQuery(this.idComponent).find(".gp-mute-btn").show();jQuery(this.idComponent).find(".gp-unmute-btn").hide();}else{jQuery(this.idComponent).find(".gp-mute").hide();jQuery(this.idComponent).find(".gp-unmute").show();jQuery(this.idComponent).find(".gp-mute-btn").hide();jQuery(this.idComponent).find(".gp-unmute-btn").show();}}else{jQuery(this.idComponent).find(".gp-volume-bar-value").css('width',value+'%');jQuery(this.idComponent).find(".gp-volume-bar-value").css('height','100%');}
if(value==0){}else{}}}
ControlsComponent.prototype.getVolume=function(){return this.volume;}
ControlsComponent.prototype.displayControls=function(isDisplay){var controller=scgp_videoControllers.getItem(this.controllerId);if(controller.videoData.playList[controller.videoData.indexSelected].isYT&&this.config.showSubtitles){jQuery(this.idComponent).find(".gp-interface").hide();}else{(isDisplay)?jQuery(this.idComponent).find(".gp-interface").show():jQuery(this.idComponent).find(".gp-interface").hide();}}
ControlsComponent.prototype.displayVolume=function(isDisplay){(isDisplay)?jQuery(this.idComponent).find(".gp-volume-bar").show():jQuery(this.idComponent).find(".gp-volume-bar").hide();}
ControlsComponent.prototype.displayTitle=function(isDisplay){(isDisplay)?jQuery(this.idComponent).find(".gp-title").show():jQuery(this.idComponent).find(".gp-title").hide();}
ControlsComponent.prototype.updateConfig=function(conf){if(typeof conf!='undefined'){this.config=conf;}
if((navigator.userAgent.match(/iPad/i))||(navigator.userAgent.match(/iPhone/i)))this.config.volume=false;if((navigator.userAgent.match(/iPad/i))||(navigator.userAgent.match(/iPhone/i)))this.config.fullscreen=false;if(this.config){this.displayButton(".gp-enviar",this.config.sendfriend);this.displayButton(".gp-rating",this.config.rating);this.displayButton(".gp-compartir",this.config.share);this.displayButton(".gp-share-more",this.config.share);this.displayButton(".gp-progress",!this.config.isLive);this.displayButton(".gp-controls-time-content",!this.config.isLive);this.displayButton(".gp-inform",this.config.censor);this.displayButton(".gp-code",this.config.embed);this.displayButton(".gp-like",this.config.like);this.displayButton(".gp-unmute-btn",this.config.volume);this.displayButton(".gp-configuration",this.config.configuration);this.displayButton(".gp-full-screen",this.config.fullscreen);this.displayButton(".gp-share-more",(this.config.socialview=='center'));this.displayButton(".gp-like",(this.config.socialview=='center'));}}
ControlsComponent.prototype.activateListeners=function(){var _this=this;var clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";jQuery(_this.idComponent).find(".gp-play").on(clickEvent,function(e){_this.dispatchEvent(["onclickplay"]);});jQuery(_this.idComponent).find(".gp-like").on(clickEvent,function(e){if(!_this.isLike){_this.dispatchEvent(["onclicklike"]);}});jQuery(_this.idComponent).find(".gp-pause").on(clickEvent,function(e){_this.dispatchEvent(["onclickpause"]);});jQuery(_this.idComponent).find(".gp-mute").on(clickEvent,function(e){if(jQuery(_this.idComponent).find('.gp-interface-radio').length>0){jQuery(_this.idComponent).find(".gp-unmute").show();jQuery(this).hide();}
_this.setVolume(_this.volume);_this.dispatchEvent(["onclickunmute",_this.volume]);});jQuery(_this.idComponent).find(".gp-unmute").on(clickEvent,function(e){if(jQuery(_this.idComponent).find('.gp-interface-radio').length>0){jQuery(_this.idComponent).find(".gp-mute").show();jQuery(this).hide();}
_this.setVolume(0);_this.dispatchEvent(["onclickmute",0]);});jQuery(_this.idComponent).find(".gp-mute-btn").on(clickEvent,function(e){jQuery(_this.idComponent).find('.gp-volume-bar-content').show();if(jQuery(_this.idComponent).find('.gp-interface-radio').length>0){jQuery(_this).hide();jQuery(_this.idComponent).find('.gp-unmute-btn').hide();if(_this.volume>0){jQuery(_this.idComponent).find(".gp-unmute").show();jQuery(_this.idComponent).find(".gp-mute").hide();}else{jQuery(_this.idComponent).find(".gp-unmute").hide();jQuery(_this.idComponent).find(".gp-mute").show();}}});jQuery(_this.idComponent).find(".gp-unmute-btn").on(clickEvent,function(e){jQuery(_this.idComponent).find('.gp-volume-bar-content').show();if(jQuery(_this.idComponent).find('.gp-interface-radio').length>0){jQuery(this).hide();jQuery(_this.idComponent).find('.gp-mute-btn').hide();if(_this.volume>0){jQuery(_this.idComponent).find(".gp-unmute").show();jQuery(_this.idComponent).find(".gp-mute").hide();}else{jQuery(_this.idComponent).find(".gp-unmute").hide();jQuery(_this.idComponent).find(".gp-mute").show();}}});jQuery(_this.idComponent).find(".gp-volume-max").on(clickEvent,function(e){_this.dispatchEvent(["onclickvolmax",100]);});jQuery(_this.idComponent).find(".gp-controls-holder").find(".gp-full-screen").on(clickEvent,function(e){_this.dispatchEvent(["onclickfullscreen",_this.idComponent]);});jQuery(_this.idComponent).find(".gp-votar").on(clickEvent,function(e){_this.dispatchEvent(["onclickvotar"]);});jQuery(_this.idComponent).find(".gp-code").on(clickEvent,function(e){_this.dispatchEvent(["onclickembed"]);});jQuery(_this.idComponent).find(".gp-inform").on(clickEvent,function(e){_this.dispatchEvent(["onclickcensor"]);});jQuery(_this.idComponent).find(".gp-configuration").on(clickEvent,function(e){_this.dispatchEvent(["onclickconfig"]);});jQuery(_this.idComponent).find(".gp-compartir").on(clickEvent,function(e){_this.dispatchEvent(["onclickcompartir"]);});jQuery(_this.idComponent).find(".gp-share-more").on(clickEvent,function(e){_this.dispatchEvent(["onclickcompartirtabs"]);});jQuery(_this.idComponent).find(".gp-enviar").on(clickEvent,function(e){_this.dispatchEvent(["onclickenviar"]);});jQuery(_this.idComponent).find(".gp-icon-self-playlist-next").on(clickEvent,function(e){_this.dispatchEvent(["onclicknext"]);});jQuery(_this.idComponent).find(".gp-icon-self-playlist-prev").on(clickEvent,function(e){_this.dispatchEvent(["onclickprevious"]);});jQuery(_this.idComponent).find(".gp-seek-bar").on(clickEvent,function(e){var x=0;if(e.pageX){x=e.pageX;}else{x=e.originalEvent.changedTouches[0].pageX;}
x=x-jQuery(this).offset().left;var wd=jQuery(e.currentTarget).width();var percent=parseInt(100*x/wd);jQuery(_this.idComponent).find(".gp-play-bar").css('width',percent+'%');_this.dispatchEvent(["onclickseek",percent]);});jQuery(_this.idComponent).find(".gp-volume-bar-content").mouseleave(function(){if(jQuery(_this.idComponent).find('.gp-interface-radio').length>0){if(_this.volume>0){jQuery(_this.idComponent).find(".gp-unmute-btn").show();jQuery(_this.idComponent).find(".gp-mute-btn").hide();}else{jQuery(_this.idComponent).find(".gp-unmute-btn").hide();jQuery(_this.idComponent).find(".gp-mute-btn").show();}}
jQuery(this).hide();});jQuery(_this.idComponent).find(".gp-volume-bar").on(clickEvent,function(e){if(jQuery(_this.idComponent).find('.gp-interface-radio').length==0){var x=e.pageY-jQuery(this).offset().top;var wd=jQuery(e.currentTarget).height();var percent=Math.abs(parseInt(100*x/wd)-100);}else{var x=e.pageX-jQuery(this).offset().left;var wd=jQuery(e.currentTarget).width();var percent=Math.abs(parseInt(100*x/wd));}
if(percent<=2)percent=0;_this.setVolume(percent);_this.dispatchEvent(["onclickvolume",percent]);});}
ControlsComponent.prototype.setListInfo=function(currentItem,totalItems){jQuery(this.idComponent).find(".gp-self-playlist-info").html('<span>'+currentItem+'</span>/'+totalItems);}
ControlsComponent.prototype.displayListInfo=function(isDisplay){if(isDisplay){jQuery(this.idComponent).find(".gp-self-playlist-info").show();jQuery(this.idComponent).find(".gp-icon-self-playlist-prev").show();jQuery(this.idComponent).find(".gp-icon-self-playlist-next").show();}else{jQuery(this.idComponent).find(".gp-self-playlist-info").hide();jQuery(this.idComponent).find(".gp-icon-self-playlist-prev").hide();jQuery(this.idComponent).find(".gp-icon-self-playlist-next").hide();}}
ControlsComponent.prototype.displayButton=function(buttonClass,isDisplay){if(isDisplay){jQuery(this.idComponent).find(buttonClass).show();}else{jQuery(this.idComponent).find(buttonClass).hide();}}
ControlsComponent.prototype.displayPause=function(isDisplay){if(isDisplay){jQuery(this.idComponent).find(".gp-play").hide();jQuery(this.idComponent).find(".gp-pause").show();}else{jQuery(this.idComponent).find(".gp-play").show();jQuery(this.idComponent).find(".gp-pause").hide();}}
ControlsComponent.prototype.calculatePercentSeek=function(){try{return(this.currentTime*100)/this.duration;}catch(error){return 0;}}
ControlsComponent.prototype.calculatePercentVolume=function(){try{return(this.getVolume()*100);}catch(error){return 0;}}
ControlsComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{alert('Nothing subscribed to the '+this.eventName+' event!');}};return this;}
ControlsComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});}
ControlsComponent.prototype.secondstotime=function(secs)
{var t=new Date(1970,0,1);t.setSeconds(secs);var s=t.toTimeString().substr(0,8);if(secs>86399)
s=Math.floor((t-Date.parse("1/1/70"))/3600000)+s.substr(2);return s;}
ControlsComponent.prototype.activateLike=function(isDisplay)
{if(isDisplay){jQuery(this.idComponent).find(".gp-like").addClass('active');jQuery(this.idComponent).find(".gp-like").attr('title','Me gusta');this.isLike=true;this.showInfoLike();}else{jQuery(this.idComponent).find(".gp-like").removeClass('active');}}
ControlsComponent.prototype.showInfoLike=function(){var _this=this;jQuery(this.idComponent).find('.gp-display-like-info').css('bottom',10);jQuery(this.idComponent).find('.gp-display-like-info').css('opacity',0);jQuery(this.idComponent).find('.gp-display-like-info').show();jQuery(this.idComponent).find('.gp-display-like-info').animate({opacity:1,bottom:50},1000,function(){setTimeout(function(){jQuery(_this.idComponent).find('.gp-display-like-info').animate({opacity:0},{duration:500,complete:function(){jQuery(_this.idComponent).find('.gp-display-like-info').hide();}});},1000);});}
ControlsComponent.prototype.hideControls=function(){var _this=this;var bttomNum=(this.isAudio)?0:-50
this.movingControls=true;jQuery(this.idComponent).find('.gp-interface').animate({bottom:bttomNum},{duration:500,queue:false,complete:function(){_this.movingControls=false;if(jQuery(_this.idComponent).find('.gp-configuration-functionality').length>0){jQuery(_this.idComponent).find('.gp-configuration-functionality').hide();}}});}
ControlsComponent.prototype.showControls=function(){var _this=this;this.movingControls=true;jQuery(this.idComponent).find('.gp-interface').animate({bottom:0},{duration:500,queue:false,complete:function(){_this.movingControls=false}});}
ControlsComponent.prototype.getHeight=function(){return jQuery(this.idComponent).find('.gp-interface').height();}
ControlsComponent.prototype.setIntroduction=function(intro){if(this.config.showRadioFormat&&this.config.showRadioFormat==true&&intro!=""){jQuery(this.idComponent).find('.gp-controls-time-content').html(intro);this.displayButton(".gp-controls-time-content",true);}}
ControlsComponent.prototype.translate=function(){jQuery(this.idComponent).find('a[class*=gp-full-screen]').html(Translation.getText('player.pantcompleta','Pantalla Completa'));jQuery(this.idComponent).find('a[class*=gp-full-screen]').attr('title',Translation.getText('player.pantcompleta','Pantalla Completa'));jQuery(this.idComponent).find('a[class*=gp-restore-screen]').html(Translation.getText('player.restpantalla','Restaurar Pantalla'));jQuery(this.idComponent).find('a[class*=gp-restore-screen]').attr('title',Translation.getText('player.restpantalla','Restaurar Pantalla'));jQuery(this.idComponent).find('a[class*=gp-mute-btn]').html(Translation.getText('player.silenciar','Silenciar'));jQuery(this.idComponent).find('a[class*=gp-mute-btn]').attr('title',Translation.getText('player.silenciar','Silenciar'));jQuery(this.idComponent).find('a[class*=gp-unmute-btn]').html(Translation.getText('player.actvol','Activar volumen'));jQuery(this.idComponent).find('a[class*=gp-unmute-btn]').attr('title',Translation.getText('player.actvol','Activar volumen'));jQuery(this.idComponent).find('a[class*=gp-mute]').html(Translation.getText('player.munte','Silenciar'));jQuery(this.idComponent).find('a[class*=gp-mute]').attr('title',Translation.getText('player.munte','Silenciar'));jQuery(this.idComponent).find('a[class*=gp-unmute]').html(Translation.getText('player.unmute','Activar volumen'));jQuery(this.idComponent).find('a[class*=gp-unmute]').attr('title',Translation.getText('player.unmute','Activar volumen'));jQuery(this.idComponent).find('a[class*=gp-configuration]').html(Translation.getText('player.calidadesvideo','Calidades de vídeo'));jQuery(this.idComponent).find('a[class*=gp-configuration]').attr('title',Translation.getText('player.calidadesvideo','Calidades de vídeo'));jQuery(this.idComponent).find('a[class*=gp-inform]').html(Translation.getText('player.informar','Informar'));jQuery(this.idComponent).find('a[class*=gp-inform]').attr('title',Translation.getText('player.informar','Informar'));jQuery(this.idComponent).find('a[class*=gp-share-more]').html(Translation.getText('player.compartir','Compartir'));jQuery(this.idComponent).find('a[class*=gp-share-more]').attr('title',Translation.getText('player.compartir','Compartir'));jQuery(this.idComponent).find('a[class*=gp-like]').html(Translation.getText('player.megusta','Me gusta'));jQuery(this.idComponent).find('a[class*=gp-like]').attr('title',Translation.getText('player.megusta','Me gusta'));jQuery(this.idComponent).find('a[class*=gp-play]').html(Translation.getText('player.reproducir','Reproducir'));jQuery(this.idComponent).find('a[class*=gp-play]').attr('title',Translation.getText('player.reproducir','Reproducir'));jQuery(this.idComponent).find('a[class*=gp-pause]').html(Translation.getText('player.pausar','Pausar'));jQuery(this.idComponent).find('a[class*=gp-pause]').attr('title',Translation.getText('player.pausar','Pausar'));};function DisplayComponent(idComponent,isAudio,config,controllerId){this.theEvent=this.CustomEvent("onDisplayEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="display";this.isAudio=isAudio;this.config=config;this.controllerId=controllerId;}
DisplayComponent.prototype.create=function(urlCrop,title,desc){this.theEvent=this.CustomEvent("onDisplayEvent");codDisplayVol=(this.config.volume)?'':'style="display:none"';if(jQuery(this.idComponent).find('.gp-display').length==0)
{var className=(this.isAudio)?'gp-icon-radio-start':'gp-icon-play-start';jQuery(this.idComponent).append('<div class="gp-display-title" >'+title+'</div>');jQuery(this.idComponent).append('<div id="gp-display" name="gp-display" class="gp-display">'+'<div class="gp-display-crop" style="background-image:url(\''+urlCrop+'\');filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+urlCrop+'\', sizingMethod=\'scale\');'+'-ms-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+urlCrop+'\', sizingMethod=\'scale\');">'+'<a href="javascript:;" title=""></a>'+'</div>'+'<div class="gp-display-video"> '+'<div class="gp-cubierta-onmove" style="display:none;"></div></div>'+'<div class="gp-start-content gp-start-content-position"> '+'<a href="javascript:;" class="gp-start-link gp-start-custom"> '+'<div class="gp-start"> '+'<span class="gp-icon gp-icon-play-start">PLAY</span> '+'</div> '+'<div class="coverLayerTitle" style="display:none;"> '+'<div class="coverLayerTitleContent">'+' <h1 class="layerTitle">'+title+'</h1> '+' <h2 class="layerTitleDescription">'+desc+'</h2> '+'</div>'+'</div> '+' </a> '+'</div> '+'<div class="gp-loading" style="display:none;"> '+'<div class="gp-loading-img">cargando</div> '+'</div> '+'<div class="gp-display-radio" style="display:none;"> '+'<div class="gp-display-radio-box"> '+'<div class="gp-display-radio-img">((( radio )))</div> '+'</div> '+'</div>'+'<a href="javascript:;" target="_blank" class="gp-coverAd gp-coverAd-hide_" style="display:none;"></a> '+'<a href="javascript:;" title="Ir al contenido" class="closeaddiv" style="display:none;">Ir al contenido</a> '+'<div class="gp-display-adv-interface" style="display:none;"> '+'<div class="gp-display-adv-label"></div> '+'<div class="gp-display-adv-controls-holder"> '+'<ul class="gp-display-adv-controls"> '+'<li '+codDisplayVol+'><a href="javascript:;" title="Silenciar" class="gp-icon gp-icon-mute-btn">Silenciar</a></li> '+'<li '+codDisplayVol+'><a href="javascript:;" title="Activar volumen" class="gp-icon gp-icon-unmute-btn">Activar volumen</a></li> '+'<li><a href="javascript:;" title="Pantalla completa" class="gp-icon gp-icon-full-screen gp-full-screen">Pantalla completa</a></li> '+'</ul> '+' <div class="gp-display-adv-time">00:00</div> '+'</div> '+'</div> '+'</div>');if(detectmob()){if(detectIpad()){jQuery(this.idComponent).find('.gp-display-video').append('<video id="my_video" class="my_video" src="" preload="metadata" style="display:none;"></video>');jQuery(this.idComponent).find('#gp-display').removeClass('gp-display');}else{if(typeof APP_URL_STATIC=='undefined')APP_URL_STATIC="http://s3.smarty.generanet.com.s3-eu-west-1.amazonaws.com/";jQuery(this.idComponent).find('.gp-display-video').append('<video id="my_video" class="my_video" src="'+APP_URL_STATIC+'player/video/negro4segs.mp4" preload="metadata" style="display:block;opacity:0;"></video>');}}
if(this.config.fullscreen==false){jQuery(this.idComponent).find('.gp-full-screen').hide();}
this.displayIOS7Button(detectIOS7());this.displayCoverAd(false,false);this.activateListeners();}
this.translate();jQuery(this.idComponent).find('.gp-display').show();this.displayPlayButton(true);}
DisplayComponent.prototype.showTitleDesc=function(display){(display)?jQuery(this.idComponent).find('.coverLayerTitle').show():jQuery(this.idComponent).find('.coverLayerTitle').hide();}
DisplayComponent.prototype.translate=function(){jQuery(this.idComponent).find('div[class=gp-loading-img]').html(Translation.getText('player.cargando','Cargando'));jQuery(this.idComponent).find('a[class=closeaddiv]').html(Translation.getText('player.iralcontenido','Ir al Contenido'));jQuery(this.idComponent).find('a[class=closeaddiv]').attr('title',Translation.getText('player.iralcontenido','Ir al Contenido'));jQuery(this.idComponent).find('a[class*=gp-mute]').html(Translation.getText('player.munte','Silenciar'));jQuery(this.idComponent).find('a[class*=gp-mute]').attr('title',Translation.getText('player.munte','Silenciar'));jQuery(this.idComponent).find('a[class*=gp-unmute]').html(Translation.getText('player.unmute','Activar volumen'));jQuery(this.idComponent).find('a[class*=gp-unmute]').attr('title',Translation.getText('player.unmute','Activar volumen'));jQuery(this.idComponent).find('a[class*=gp-full-screen]').html(Translation.getText('player.pantcompleta','Pantalla Completa'));jQuery(this.idComponent).find('a[class*=gp-full-screen]').attr('title',Translation.getText('player.pantcompleta','Pantalla Completa'));jQuery(this.idComponent).find('div[class=gp-display-adv-ios7-label]').html(Translation.getText('player.iranunciante','PINCHA AQUI PARA IR AL ANUNCIANTE'));jQuery(this.idComponent).find('a[class*=gp-icon-mute-btn]').html(Translation.getText('player.silenciar','Silenciar'));jQuery(this.idComponent).find('a[class*=gp-icon-mute-btn]').attr('title',Translation.getText('player.silenciar','Silenciar'));jQuery(this.idComponent).find('a[class*=gp-icon-unmute-btn]').html(Translation.getText('player.actvol','Activar volumen'));jQuery(this.idComponent).find('a[class*=gp-icon-unmute-btn]').attr('title',Translation.getText('player.actvol','Activar volumen'));}
DisplayComponent.prototype.updateLabelSkipAd=function(typeContent){switch(typeContent){case"7":jQuery(this.idComponent).find('a[class=closeaddiv]').html(Translation.getText('player.iralcontenido','Ir al Contenido'));jQuery(this.idComponent).find('a[class=closeaddiv]').attr('title',Translation.getText('player.iralcontenido','Ir al Contenido'));break;case"15":case"8":case"8":jQuery(this.idComponent).find('a[class=closeaddiv]').html(Translation.getText('player.saltar','Saltar'));jQuery(this.idComponent).find('a[class=closeaddiv]').attr('title',Translation.getText('player.saltar','Saltar'));break;}}
DisplayComponent.prototype.setTitle=function(value){jQuery(this.idComponent).find('.gp-display-title').html(value.toUpperCase());}
DisplayComponent.prototype.setLabel=function(value){if(typeof value=='undefined')value='publicidad';jQuery(this.idComponent).find('.gp-display-adv-label').html(value.toUpperCase());}
DisplayComponent.prototype.setRemainingTime=function(value){jQuery(this.idComponent).find('.gp-display-adv-time').html(this.secondstotime(value));}
DisplayComponent.prototype.displayLoading=function(isDisplay){if(isDisplay){jQuery(this.idComponent).find('.gp-loading').css('opacity','0');jQuery(this.idComponent).find('.gp-loading').show();jQuery(this.idComponent).find('.gp-loading').animate({opacity:1},500);}else{jQuery(this.idComponent).find('.gp-loading').animate({opacity:0},500,function(){jQuery(this).hide();});}}
DisplayComponent.prototype.displayPlayingRadio=function(isDisplay){if(this.isAudio&&jQuery(this.idComponent).find('.gp-display-slider').length==0){if(isDisplay){jQuery(this.idComponent).find('.gp-display-radio').css('opacity','0');jQuery(this.idComponent).find('.gp-display-radio').show();jQuery(this.idComponent).find('.gp-display-radio').animate({opacity:1},500);}else{jQuery(this.idComponent).find('.gp-display-radio').animate({opacity:0},500,function(){jQuery(this).hide();});}}else{jQuery(this.idComponent).find('.gp-display-radio').hide();}}
DisplayComponent.prototype.displayPlayButton=function(isDisplay){if(this.config.showRadioFormat){jQuery(this.idComponent).find('.gp-start').hide();}else{if(this.isAudio)
jQuery(this.idComponent).find('.gp-start').find('span').addClass('gp-icon-radio-start').removeClass('gp-icon-play-start');else
jQuery(this.idComponent).find('.gp-start').find('span').addClass('gp-icon-play-start').removeClass('gp-icon-radio-start');(isDisplay)?jQuery(this.idComponent).find('.gp-start-content').show():jQuery(this.idComponent).find('.gp-start-content').hide();}}
DisplayComponent.prototype.displayCrop=function(isDisplay){if(this.config.showRadioFormat){jQuery(this.idComponent).find('.gp-display-crop').show();}else{if(this.isAudio)
jQuery(this.idComponent).find('.gp-display-crop').show();else
(isDisplay)?jQuery(this.idComponent).find('.gp-display-crop').show():jQuery(this.idComponent).find('.gp-display-crop').hide();}}
DisplayComponent.prototype.showTitle=function(isDisplay){var _this=this;jQuery(this.idComponent).find('.gp-display-title').css('top',-jQuery(this.idComponent).find('.gp-display-title').height());jQuery(this.idComponent).find('.gp-display-title').animate({top:"0px"},{duration:500,queue:false,complete:function(){_this.movingControls=false;}});}
DisplayComponent.prototype.hideTitle=function(isDisplay){var _this=this;this.movingControls=true;jQuery(this.idComponent).find('.gp-display-title').animate({top:-(jQuery(this.idComponent).find('.gp-display-title').height()+10)+"px"},{duration:700,complete:function(){_this.movingControls=false;}});}
DisplayComponent.prototype.displayTitle=function(isDisplay){(isDisplay)?jQuery(this.idComponent).find('.gp-display-title').show():jQuery(this.idComponent).find('.gp-display-title').hide();}
DisplayComponent.prototype.displayCoverAd=function(isDisplay,showEffect){var _this=this;if(typeof showEffect!='undefined'){showEffect=true;}
if(isDisplay){if(jQuery(this.idComponent).find('.gp-display-adv-interface').css('bottom')!='0px'){this.displaySkipAd(false);if(!scgp_isFlashEnabled())jQuery(this.idComponent).find('.gp-coverAd').show();if(detectIphone())jQuery(this.idComponent).find('.gp-coverAd').hide();jQuery(this.idComponent).find('.gp-display-adv-interface').show();jQuery(this.idComponent).find('.gp-display-adv-interface').css('bottom',-jQuery(this.idComponent).find('.gp-display-adv-interface').height());jQuery(this.idComponent).find('.gp-display-adv-interface').animate({bottom:"0px"},{duration:500,complete:function(){jQuery(this).find('.gp-display-adv-interface').show();}});}else{jQuery(this.idComponent).find('.gp-display-adv-interface').show();}}else{if(showEffect){jQuery(this.idComponent).find('.gp-display-adv-interface').animate({bottom:-jQuery(this.idComponent).find('.gp-display-adv-interface').height()+"px"},{duration:700,complete:function(){jQuery(_this.idComponent).find('.gp-display-adv-interface').hide();jQuery(_this.idComponent).find('.gp-coverAd').hide();jQuery(_this.idComponent).find('.closeaddiv').hide();}});}else{jQuery(_this.idComponent).find('.gp-display-adv-interface').hide();jQuery(_this.idComponent).find('.gp-coverAd').hide();jQuery(_this.idComponent).find('.closeaddiv').hide();}}}
DisplayComponent.prototype.displaySkipAd=function(isDisplay){if(isDisplay){jQuery(this.idComponent).find('.closeaddiv').css('opacity','0');jQuery(this.idComponent).find('.closeaddiv').show();jQuery(this.idComponent).find('.closeaddiv').animate({opacity:1},500);}else{jQuery(this.idComponent).find('.closeaddiv').hide();}}
DisplayComponent.prototype.displayAdControls=function(value){if(value)jQuery(this.idComponent).find('.gp-display-adv-controls').show();else jQuery(this.idComponent).find('.gp-display-adv-controls').hide();}
DisplayComponent.prototype.displayIOS7Button=function(value){var _this=this;if(value){jQuery(this.idComponent).find('.gp-display-adv-controls-holder').append('<div class="gp-display-adv-ios7-label">PINCHA AQUI PARA IR AL ANUNCIANTE</div>');jQuery(this.idComponent).find('.gp-display-adv-ios7-label').on(this.clickEvent,function(e){e.preventDefault();_this.dispatchEvent(["onclickad"]);});}}
DisplayComponent.prototype.secondstotime=function(secs)
{var t=new Date(1970,0,1);t.setSeconds(secs);var s=t.toTimeString().substr(0,8);if(secs>86399)
s=Math.floor((t-Date.parse("1/1/70"))/3600000)+s.substr(2);return s;}
DisplayComponent.prototype.activateListeners=function(){var _this=this;if(jQuery(_this.idComponent).find('.gp-start-content').length>0){jQuery(_this.idComponent).find('.gp-start-content').on(this.clickEvent,function(e){e.preventDefault();_this.displayPlayButton(false);_this.dispatchEvent(["onclickplay"]);});}
if(jQuery(_this.idComponent).find('.gp-display-video').length>0&&!detectWebBrowserAndroid()){jQuery(_this.idComponent).find('.gp-display-video').on(this.clickEvent,function(e){e.preventDefault();_this.displayPlayButton(false);if(jQuery(this).find('object').length==0)
_this.dispatchEvent(["onclickplay"]);});}
jQuery(_this.idComponent).find('.gp-display-adv-controls').find('.gp-icon-mute-btn').show();jQuery(_this.idComponent).find('.gp-display-adv-controls').find('.gp-icon-unmute-btn').hide();jQuery(_this.idComponent).find('.gp-display-adv-controls').find('.gp-icon-mute-btn').on(this.clickEvent,function(e){e.preventDefault();jQuery(this).hide();jQuery(_this.idComponent).find('.gp-display-adv-controls').find('.gp-icon-unmute-btn').show();_this.dispatchEvent(["onclickmute",0]);});jQuery(_this.idComponent).find('.gp-display-adv-controls').find('.gp-icon-unmute-btn').on(this.clickEvent,function(e){e.preventDefault();jQuery(this).hide();jQuery(_this.idComponent).find('.gp-display-adv-controls').find('.gp-icon-mute-btn').show();_this.dispatchEvent(["onclickunmute",100]);});jQuery(_this.idComponent).find(".gp-display-adv-controls").find('.gp-icon-full-screen').on(this.clickEvent,function(e){e.preventDefault();_this.dispatchEvent(["onclickfullscreen",_this.idComponent]);});jQuery(_this.idComponent).find('.closeaddiv').on(this.clickEvent,function(e){e.preventDefault();_this.displayCoverAd(false);_this.dispatchEvent(["onclicknext",_this.typeModule]);});jQuery(_this.idComponent).find('.gp-coverAd').on(this.clickEvent,function(e){e.preventDefault();if(!detectIOS7())_this.dispatchEvent(["onclickad"]);});jQuery(_this.idComponent).find('.gp-display-title').on(this.clickEvent,function(e){e.preventDefault();_this.dispatchEvent(["onclicktitle"]);});}
DisplayComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
DisplayComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function EmbedComponent(idComponent){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="embed";}
EmbedComponent.prototype.create=function(code,urlDownload){this.theEvent=this.CustomEvent("onModulesEvent");if(typeof code=='undefined'){code=Translation.getText('player.codnodisponible','C&oacute;digo no disponible')};if(jQuery(this.idComponent).find('.embed_video_player').length==0)
{jQuery(this.idComponent).append('<div id="" class="gp-extra-functionality gp-embed-video-player embed_video_player" style=""> '+'<div class="gp-extra-functionality-content"> '+'<div class="gp-extra-content-close"> '+'<a href="javascript:;" title="Cerrar ventana" class="gp-extra-content-close-ico">&times;</a> '+'</div> '+'<div class="gp-extra-content"> '+'<form name="form_embed" id="form_embed" method="post" action="" class="gp-extra-form"> '+'<label for="textarea">Copia este c&oacute;digo y ponlo en tu web</label> '+'<textarea name="textarea" id="textarea" class="gp-extra-textarea-embed" placeholder="c&oacute;digo del v&iacute;deo">'+code+'</textarea> '+'<input type="hidden" name="codeEmbed" id="codeEmbed" value="" /> '+'<input type="hidden" name="sendFrom" id="sendFrom" value="player" /> '+'<div class="gp-extra-content-buttons" > '+'<input type="submit" name="copy_embed_player" id="copy_embed_player" value="seleccionar" class="" /> '+'<input type="reset" name="reset_embed_player" id="reset_embed_player" value="cancelar" class="gp-last-button" /> '+'</div> '+'<div class="gp-extra-dwld-buttons" style="display:none;"> '+'<a href="'+urlDownload+'" target="_blank" class="gp-button gp-alone-button gp-last-button"><i class="icon-download"></i>descargar</a> '+'</div> '+'<div class="gp-extra-message message-common" style="display:none;"> '+'<span>Copia el c&oacute;digo seleccionado al portapapeles (Ctrl + C)</span> '+'</div> '+'</form> '+'</div> '+'<h3 class="gp-extra-title">Pon este v&iacute;deo en tu web</h3> '+'</div> '+'</div>');if(urlDownload!=''){jQuery(this.idComponent).find('.gp-extra-dwld-buttons').show();}
this.activateListeners();}
this.translate();jQuery(this.idComponent).find('.embed_video_player').show();}
EmbedComponent.prototype.translate=function(){jQuery(this.idComponent).find('a[class=gp-extra-content-close-ico]').attr('title',Translation.getText('player.cerrar','Cerrar'));jQuery(this.idComponent).find('#form_embed label').html(Translation.getText('player.msjcopiaentuweb','Copia este c&oacute;digo y ponlo en tu web'));jQuery(this.idComponent).find('.gp-extra-textarea-embed').attr('placeholder',Translation.getText('player.codigovideo','Codigo del Video'));jQuery(this.idComponent).find('#form_embed span').html(Translation.getText('player.copiaalportapapeles','Copia el código seleccionado al portapapeles (Ctrl + C)'));jQuery(this.idComponent).find('#copy_embed_player').attr('value',Translation.getText('player.seleccionar','Seleccionar'));jQuery(this.idComponent).find('#reset_embed_player').attr('value',Translation.getText('player.cancelar','Cancelar'));jQuery(this.idComponent).find('h3[class=gp-extra-title]').html(Translation.getText('player.ponentuweb','Pon este video en tu web'));}
EmbedComponent.prototype.close=function(){jQuery(this.idComponent).find('.embed_video_player').hide();jQuery(this.idComponent).find('.message-common').hide();this.dispatchEvent(["close",this.typeModule]);}
EmbedComponent.prototype.remove=function(){jQuery(this.idComponent).find('.embed_video_player').remove();}
EmbedComponent.prototype.activateListeners=function(){var _this=this;if(jQuery(this.idComponent).find('.gp-extra-content-close-ico').length>0){jQuery(this.idComponent).find('.gp-extra-content-close-ico').on(this.clickEvent,function(e){e.preventDefault();_this.close();});}
if(jQuery(this.idComponent).find('#reset_embed_player').length>0){jQuery(this.idComponent).find('#reset_embed_player').on(this.clickEvent,function(e){e.preventDefault();_this.close();});}
if(jQuery(this.idComponent).find('#copy_embed_player').length>0){jQuery(this.idComponent).find('#copy_embed_player').on(this.clickEvent,function(e){e.preventDefault();jQuery(_this.idComponent).find('.gp-extra-textarea-embed').select();jQuery(_this.idComponent).find('.message-common').show();});}
if(jQuery(this.idComponent).find('.message-common').length>0){jQuery(this.idComponent).find('.message-common').on(this.clickEvent,function(e){e.preventDefault();jQuery(this).hide();});}}
EmbedComponent.prototype.getSelected=function(){var t='';if(window.getSelection){t=window.getSelection();}else if(document.getSelection){t=document.getSelection();}else if(document.selection){t=document.selection.createRange().text;}
return t;}
EmbedComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
EmbedComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function EndVideoComponent(idComponent,config){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.config=config;}
EndVideoComponent.prototype.create=function(){this.theEvent=this.CustomEvent("onModulesEvent");if(jQuery(this.idComponent).find('.gp-end-video').length==0)
{jQuery(this.idComponent).append('<div id="" class="gp-extra-functionality gp-end-video" style="opacity:0;">'+'<div class="gp-extra-functionality-content">'+'<div class="gp-end-video-content">'+'<div class="gp-replay-link">'+'<a href="javascript:;" title="Volver a visualizar" class="gp-icon gp-icon-play-start gp-icon-replay gp-replay">Volver a visualizar</a>'+'<a href="javascript:;" title="Volver a visualizar" class="gp-replay-text">Volver a visualizar</a>'+'</div>'+'<ul class="gp-rrss-holder">'+'<li><a href="javascript:;" title="compartir" class="gp-icon gp-icon-share gp-share">compartir</a></li>'+'<li><a href="javascript:;" title="me gusta" class="gp-icon gp-icon-like gp-like">me gusta</a></li>'+'<li><a href="javascript:;" title="Informar" class="gp-icon gp-icon-inform gp-inform">Informar</a></li>'+'</ul>'+'</div>'+'</div>'+'</div>');if(this.config.socialview==false){jQuery(this.idComponent).find('.gp-rrss-holder').hide();}
this.activateListeners();}
this.updateConfig()
this.translate();this.show();}
EndVideoComponent.prototype.translate=function(){jQuery(this.idComponent).find('div[class=gp-replay-link] a').html(Translation.getText('player.volvervisualizar','Volver a Visualizar'));jQuery(this.idComponent).find('div[class=gp-replay-link] a').attr('title',Translation.getText('player.volvervisualizar','Volver a Visualizar'));jQuery(this.idComponent).find('ul[class=gp-rrss-holder] > li > a[class*=gp-share]').attr('title',Translation.getText('player.compartir','Compartir'));jQuery(this.idComponent).find('ul[class=gp-rrss-holder] > li > a[class*=gp-share]').html(Translation.getText('player.compartir','Compartir'));jQuery(this.idComponent).find('ul[class=gp-rrss-holder] > li > a[class*=gp-like]').attr('title',Translation.getText('player.megusta','Me gusta'));jQuery(this.idComponent).find('ul[class=gp-rrss-holder] > li > a[class*=gp-like]').html(Translation.getText('player.megusta','Me gusta'));jQuery(this.idComponent).find('ul[class=gp-rrss-holder] > li > a[class*=gp-inform]').attr('title',Translation.getText('player.informar','Informar'));jQuery(this.idComponent).find('ul[class=gp-rrss-holder] > li > a[class*=gp-inform]').html(Translation.getText('player.informar','Informar'));}
EndVideoComponent.prototype.hide=function(remove){var _this=this;if(typeof remove=='undefined')remove=false;jQuery(this.idComponent).find('.gp-end-video').animate({opacity:0},700,function(){jQuery(this.idComponent).find('.gp-end-video').hide();if(remove==true){_this.remove();}});}
EndVideoComponent.prototype.updateConfig=function(){if(this.config){this.displayButton(".gp-share",this.config.share);this.displayButton(".gp-like",this.config.like);this.displayButton(".gp-inform",this.config.censor);}}
EndVideoComponent.prototype.displayButton=function(buttonClass,isDisplay){if(isDisplay){jQuery(this.idComponent).find(buttonClass).show();}else{jQuery(this.idComponent).find(buttonClass).hide();}}
EndVideoComponent.prototype.show=function(){jQuery(this.idComponent).find('.gp-end-video').css('opacity',0);jQuery(this.idComponent).find('.gp-end-video').show();jQuery(this.idComponent).find('.gp-end-video').animate({opacity:1},700);}
EndVideoComponent.prototype.remove=function(){jQuery(this.idComponent).find('.gp-end-video').remove();}
EndVideoComponent.prototype.activateListeners=function(){var _this=this;if(jQuery(this.idComponent).find('.gp-replay').length>0){jQuery(this.idComponent).find('.gp-replay').on(this.clickEvent,function(e){e.preventDefault();_this.hide(true);_this.dispatchEvent(["onclickreplay"]);});}
if(jQuery(this.idComponent).find('.gp-share').length>0){jQuery(this.idComponent).find('.gp-share').on(this.clickEvent,function(e){e.preventDefault();_this.hide();_this.dispatchEvent(["onclickopencompartirtabs"]);});}
if(jQuery(this.idComponent).find('.gp-like').length>0){jQuery(this.idComponent).find('.gp-like').on(this.clickEvent,function(e){e.preventDefault();_this.dispatchEvent(["onclicklike"]);});}
if(jQuery(this.idComponent).find('.gp-inform').length>0){jQuery(this.idComponent).find('.gp-inform').on(this.clickEvent,function(e){e.preventDefault();_this.hide();_this.dispatchEvent(["onclickcensor"]);});}}
EndVideoComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
EndVideoComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function LayerTitleComponent(){this.title;this.description;}
LayerTitleComponent.prototype.create=function(idComponent,title,description){if(jQuery(idComponent).find('div[class*=coverLayerTitle]').length==0)
{jQuery(idComponent).find('.ppdisplay').append('<div class="coverLayerTitle">'+'<h1 class="layerTitle">'+title+'</h1>'+'<h2 class="layerTitleDescription">'+description+'</h2> </div>');}
jQuery(idComponent).find('div[class*=coverLayerTitle] h1').html(title);jQuery(idComponent).find('div[class*=coverLayerTitle] h2').html(description);};function RatingComponent(idComponent){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="rating";}
RatingComponent.prototype.create=function(){this.theEvent=this.CustomEvent("onModulesEvent");if(jQuery(this.idComponent).find('.vote_video_player').length==0)
{jQuery(this.idComponent).append('<div id="vote_video_player" class="div_container_extra_functionality vote_video_player" style="display: none;">'+'<div class="container_txt_extra_functionality">'+'<h3 class="tit_container_txt_extra_functionality">Votaci&oacute;n</h3>'+'<div class="close_div_container_extra_functionality">'+'<a href="javascript:;" title="Cerrar ventana" class="ico_close_extra_functionality" onclick="jQuery(\'div[id=vote_video_player] div[id=message]\').html(\'\').hide();">&times;</a>'+'</div>'+'<div id="wrapper_scrollv2">'+'<div class="scrollv"> '+'<div class="ratecontainer vote"> '+'<ul class="rateStart_ul">'+'<li class="rateStart_li rateStart_li_off"><a class="rateStart_a" href="javascrip:void(0);"></a></li>'+'<li class="rateStart_li rateStart_li_off"><a class="rateStart_a" href="javascrip:void(0);"></a></li>'+'<li class="rateStart_li rateStart_li_off"><a class="rateStart_a" href="javascrip:void(0);"></a></li>'+'<li class="rateStart_li rateStart_li_off"><a class="rateStart_a" href="javascrip:void(0);"></a></li>'+'<li class="rateStart_li rateStart_li_off"><a class="rateStart_a" href="javascrip:void(0);"></a></li>'+'<li><p class="note_container_txt_extra_functionality rate_number">1 Votos </p></li>'+'</ul>'+'<p class="note_container_txt_extra_functionality" style="float:left;;margin-left: 5%;">Para dar tu valoraci&oacute;n pulsa sobre las estrellas.</p>'+'</div>'+'<div class="ratecontainer_ed"> '+'<ul class="rateStart_ul">'+'<li class="rateStart_li rateStart_li_off" onclick="javascrip:rateByUser(1);"><a class="rateStart_a" href="#"></a></li>'+'<li class="rateStart_li rateStart_li_off" onclick="javascrip:rateByUser(2);"><a class="rateStart_a" href="#"></a></li>'+'<li class="rateStart_li rateStart_li_off" onclick="javascrip:rateByUser(3);"><a class="rateStart_a" href="#"></a></li>'+'<li class="rateStart_li rateStart_li_off" onclick="javascrip:rateByUser(4);"><a class="rateStart_a" href="#"></a></li>'+'<li class="rateStart_li rateStart_li_off" onclick="javascrip:rateByUser(5);"><a class="rateStart_a" href="#"></a></li>'+'</ul>'+'</div>'+'<div id="message_vote_succeful" class="message_player message_succeful" style="display:none;"></div>'+'<div id="message_vote_error" class="message_player message_error" style="display:none;"></div>'+'</div>'+' </div></div></div></div>');this.activateListeners();}
jQuery(this.idComponent).find('.vote_video_player').show();}
RatingComponent.prototype.close=function(){jQuery(this.idComponent).find('.vote_video_player').hide();this.dispatchEvent(["close",this.typeModule]);}
RatingComponent.prototype.remove=function(){jQuery(this.idComponent).find('.vote_video_player').remove();}
RatingComponent.prototype.activateListeners=function(){var _this=this;if(jQuery(this.idComponent).find('.ico_close_extra_functionality').length>0){jQuery(this.idComponent).find('.ico_close_extra_functionality').on(this.clickEvent,function(e){e.preventDefault();_this.close();});}}
RatingComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
RatingComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function SendVideoComponent(idComponent){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="sendvideo";this.url="";this.isSendingForm=false;this.interval=0;}
SendVideoComponent.prototype.create=function(videoData){this.url=videoData.getServices().urlSendToFriend+"/0";var contentTpe=(!videoData.isAudio)?'20007':'20017';this.theEvent=this.CustomEvent("onModulesEvent");if(jQuery(this.idComponent).find('.send_video_player').length==0)
{jQuery(this.idComponent).append('<div id="" class="gp-extra-functionality gp-send-video-player send_video_player" style=""> '+'<div class="gp-extra-functionality-content">'+'<div class="gp-extra-content-close">'+'<a href="javascript:;" title="Cerrar ventana" class="gp-extra-content-close-ico">&times;</a>'+'</div>'+'<div class="gp-extra-content">'+'<form name="form_send" id="form_send" method="post" action="" class="gp-extra-form">'+'<input type="email" name="mailFrom" id="mailFrom" class="" placeholder="tu e-mail" />'+'<input type="email" name="mailTo" id="mailTo" class="" placeholder="e-mail de tu amig@" />'+'<textarea name="comment" id="comment" class="" placeholder="tu mensaje"></textarea>'+'<input type="hidden" name="idContent" id="idContent" value="'+videoData.getIdContent()+'"/>'+'<input type="hidden" name="contentType" id="contentType" value="'+contentTpe+'" />'+'<input type="hidden" name="sendFrom" id="sendFrom" value="player" />'+'<div class="gp-extra-content-buttons">'+'<input type="submit" name="send_email_player" id="send_email_player" value="enviar" class="">'+'<input type="reset" name="reset_send_email_player" id="reset_send_email_player" value="cancelar" class="gp-last-button">'+'</div>'+'<div class="gp-extra-message message-successful" style="display:none">'+'<span>El mensaje se ha enviado correctamente.</span>'+'</div>'+'<div class="gp-extra-message message-error" style="display:none">'+'<span>mensaje de error</span>'+'</div>'+'<div class="gp-extra-message message-common" style="display:none"> '+'<span>Enviando correo</span> '+'</div> '+'</form>'+'</div>'+'<h3 class="gp-extra-title">Enviar a un amigo</h3>'+'</div>'+'</div>');this.activateListeners();}
jQuery(this.idComponent).find('.send_video_player').show();}
SendVideoComponent.prototype.close=function(){jQuery(this.idComponent).find('.send_video_player').hide();this.dispatchEvent(["close",this.typeModule]);}
SendVideoComponent.prototype.remove=function(){jQuery(this.idComponent).find('.send_video_player').remove();}
SendVideoComponent.prototype.activateListeners=function(){var _this=this;if(jQuery(this.idComponent).find('.gp-extra-content-close-ico').length>0){jQuery(this.idComponent).find('.gp-extra-content-close-ico').on(this.clickEvent,function(e){e.preventDefault();_this.close();});}
if(jQuery(this.idComponent).find('#reset_send_email_player').length>0){jQuery(this.idComponent).find('#reset_send_email_player').on(this.clickEvent,function(e){e.preventDefault();_this.close();});}
if(jQuery(this.idComponent).find('form[id=form_send]').length>0){jQuery(this.idComponent).find('form[id=form_send]').on('submit',function(event){if(!_this.isSendingForm){_this.isSendingForm=true;event.preventDefault();_this.showSendMessage();var divSuccerful=jQuery(_this.idComponent).find('.message-successful');var divError=jQuery(_this.idComponent).find('.message-error');jQuery(divSuccerful).hide();jQuery(divError).hide();jQuery(divError).on(_this.clickEvent,function(e){e.preventDefault();jQuery(this).hide();});jQuery(divSuccerful).on(_this.clickEvent,function(e){e.preventDefault();jQuery(this).hide();});if(_this.validateFields()==false){_this.isSendingForm=false;jQuery(divError).show();_this.hideSendMessage();jQuery(divError).html('<span>Los campos no pueden ir vacíos</span>');return;}
var params=jQuery(this).serialize();jQuery.ajax({url:_this.url,type:'post',dataType:'json',data:params,success:function(data,textStatus,jqXHR){_this.isSendingForm=false;_this.hideSendMessage();jQuery(divSuccerful).hide();jQuery(divError).hide();if(data.result=='ok'){jQuery(_this.idComponent).find('form[id=form_send] input[type=text]').each(function(){jQuery(this).val('');});jQuery(_this.idComponent).find('form[id=form_send] textarea').val('');jQuery(divSuccerful).show();}else{jQuery(divError).html('');var isFirst=true;if(data.errors&&typeof data.errors=="string"){jQuery(divError).append('<span>'+data.errors+'</span>');}else if(data.errors&&typeof data.errors=="object"&&data.errors.length>0){jQuery(divError).append('<span>'+data.errors[0]+'</span>');}
jQuery(divError).show();}},error:function(){_this.isSendingForm=false;_this.hideSendMessage();jQuery(divError).html('<span>Error en el servicio. Inténtelo más tarde.</span>');jQuery(divError).show();}});}});}}
SendVideoComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
SendVideoComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});}
SendVideoComponent.prototype.showSendMessage=function(){var _this=this;var text="Enviando correo";var lod=['.','..','...'];var lodSelected=0;jQuery(this.idComponent).find('.message-common').show();this.interval=setInterval(function(){if(lodSelected<lod.length-1){lodSelected++;}else{lodSelected=0;}
jQuery(_this.idComponent).find('.message-common').find('span').html(text+" "+lod[lodSelected]);},500);}
SendVideoComponent.prototype.hideSendMessage=function(){jQuery(this.idComponent).find('.message-common').hide();clearInterval(this.interval);}
SendVideoComponent.prototype.validateFields=function(){if(jQuery(this.idComponent).find("#mailFrom").val().length<1){return false;}
if(jQuery(this.idComponent).find("#mailTo").val().length<1){return false;}
if(jQuery(this.idComponent).find("#comment").val().length<1){return false;}};function SendVisitComponent(isFlashEnabled,config,isPlayerPlus){this.isFlashEnabled=isFlashEnabled;this.config=config;this.events=new Array();this.sendingEvents=false;this.EVENT_TYPES=['','start','firstQuartile','midpoint','thirdQuartile','complete','loadPlayer'];if(typeof isPlayerPlus!='undefined'){this.isPlayerPlus=isPlayerPlus;}else{this.isPlayerPlus=false;}}
SendVisitComponent.prototype.sendVisit=function(videoData,fire_track_custom)
{if(typeof fire_track_custom=='undefined')fire_track_custom=true;if(this.config&&this.config.isAdminType==true){return;}
if(videoData&&videoData.getItemSelected()&&this.events.length>0){var urlService=videoData.getServices().urlSendVisit;var variables=new Object();variables.identificador=videoData.getIdenty();variables.eventType=this.events;variables.playerType=(this.isPlayerPlus)?10:this.getPlayerType(this.config.playerType);variables.typeContent=(this.isPlayerPlus)?0:videoData.getItemSelected().typeContent;variables.adServer=videoData.getItemSelected().adServerId;variables.referer=0;variables.campaignId=videoData.getItemSelected().idCampaing;variables.videoId=videoData.getIdContent();if(urlService&&urlService!=""){$.ajax({async:true,type:"POST",url:urlService,data:variables,dataType:'json',success:function(data){},error:function(xhr,ajaxOptions,thrownError){}});}
if(fire_track_custom==true){for(var j=0;j<this.events.length;j++){var array_custom_tracking=videoData.getTrackingEventsVideoByType(this.getEventById(this.events[j]));if(typeof array_custom_tracking!='undefined'&&array_custom_tracking.length>0){for(var i=0;i<array_custom_tracking.length;i++){if(typeof array_custom_tracking[i]!='undefined'){var _url=array_custom_tracking[i].replace("[random]",new Date().getTime());this.fireTrackers(_url);}}}}}
this.events=new Array();}else{return;}}
SendVisitComponent.prototype.sendVisitByType=function(videoData,eventType)
{var arrData=new Array();arrData.push(eventType);if(this.config&&this.config.isAdminType==true){return;}
var array_custom_tracking=videoData.getTrackingEventsVideoByType(this.getEventById(eventType));if(typeof array_custom_tracking!='undefined'&&array_custom_tracking.length>0){for(var i=0;i<array_custom_tracking.length;i++){if(typeof array_custom_tracking[i]!='undefined'){var _url=array_custom_tracking[i].replace("[random]",new Date().getTime());this.fireTrackers(_url);}}}
if(videoData&&videoData.getItemSelected()){var urlService=videoData.getServices().urlSendVisit;var variables=new Object();variables.identificador=videoData.getIdenty();variables.eventType=arrData;variables.playerType=(this.isPlayerPlus)?10:this.getPlayerType(this.config.playerType);variables.typeContent=(this.isPlayerPlus)?0:videoData.getItemSelected().typeContent;variables.adServer=videoData.getItemSelected().adServerId;variables.referer=0;variables.campaignId=videoData.getItemSelected().idCampaing;variables.videoId=videoData.getIdContent();if(urlService&&urlService!=""){$.ajax({async:true,type:"POST",url:urlService,data:variables,dataType:'json',success:function(data){},error:function(xhr,ajaxOptions,thrownError){console.log("error en el marcador "+thrownError);}});}}else{return;}}
SendVisitComponent.prototype.fireTrackers=function(trackerURL){$('body').prepend('<img src="'+trackerURL+'" style="display:none" />');};SendVisitComponent.prototype.addEvent=function(typeEvent){if(this.events){this.events.push(typeEvent);}}
SendVisitComponent.prototype.startRec=function(){}
SendVisitComponent.prototype.finishRec=function(videoData,fire_track_custom){this.sendVisit(videoData,fire_track_custom);}
SendVisitComponent.prototype.getPlayerType=function(playerType)
{if(!scgp_isFlashEnabled()){switch(playerType){case SCGP_PLAYER_TYPES.EDITORIAL:return SCGP_PLAYER_TYPES.EDIT_HTML;break;case SCGP_PLAYER_TYPES.VERTICAL:return SCGP_PLAYER_TYPES.VERT_HTML;break;case SCGP_PLAYER_TYPES.HORIZONTAL:return SCGP_PLAYER_TYPES.HOR_HTML;break;case SCGP_PLAYER_TYPES.PLAYLIST:return SCGP_PLAYER_TYPES.PLAYLIST_HTML;break;case SCGP_PLAYER_TYPES.EVO:return SCGP_PLAYER_TYPES.EVO_HTML;break;default:return playerType;break;}}else{return playerType;}}
SendVisitComponent.prototype.getEventById=function(id){var result='';try{result=this.EVENT_TYPES[id];}catch(error){}
return result;}
SendVisitComponent.prototype.sendVisitLoadPlayer=function(videoData,eventType)
{var arrData=new Array();arrData.push(eventType);if(this.config&&this.config.isAdminType==true){return;}
var array_custom_tracking=videoData.getTrackingEventsPlayerByType(this.getEventById(eventType));if(typeof array_custom_tracking!='undefined'&&array_custom_tracking.length>0){for(var i=0;i<array_custom_tracking.length;i++){if(typeof array_custom_tracking[i]!='undefined'){var _url=array_custom_tracking[i].replace("[random]",new Date().getTime());this.fireTrackers(_url);}}}}
SendVisitComponent.prototype.sendVisitVideoPP=function(videoData)
{if(this.config&&this.config.isAdminType==true){return;}
var array_custom_tracking=videoData.getTrackingEventsVideoContent(this.getEventById(1));if(typeof array_custom_tracking!='undefined'&&array_custom_tracking.length>0){for(var i=0;i<array_custom_tracking.length;i++){if(typeof array_custom_tracking[i]!='undefined'){var _url=array_custom_tracking[i].replace("[random]",new Date().getTime());this.fireTrackers(_url);}}}};function LikeComponent(idComponent){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="like";}
LikeComponent.prototype.create=function(){this.theEvent=this.CustomEvent("onModulesEvent");if(jQuery(this.idComponent).find('.gp-display .gp-like-text').length==0)
{jQuery(this.idComponent).find('.gp-display').append('<div id="" class="gp-like-text" style="display:none;">'+'<div class="gp-like-text-content">'+'<span class="gp-like-text-text">ME GUSTA</span>'+'</div>'+'</div>');}
this.translate();this.activateListeners();}
LikeComponent.prototype.translate=function(){jQuery(this.idComponent).find('div[class=gp-like-text-content] > span').html(Translation.getText('player.megusta','ME GUSTA'));}
LikeComponent.prototype.close=function(){this.dispatchEvent(["close",this.typeModule]);}
LikeComponent.prototype.remove=function(){}
LikeComponent.prototype.activateListeners=function(){}
LikeComponent.prototype.sendLike=function(videoData,isFlashEnabled){var _this=this;var urlService=videoData.getServices().urlLike;if(urlService){var params=new Object();params.sendFrom='player';params.idContent=videoData.getIdContent();jQuery.ajax({url:urlService,type:'post',dataType:'json',data:params,success:function(data,textStatus,jqXHR){if(data.result=="success"){data.error=1;_this.activateLike(true);}else if(data.message.code==1){_this.activateLike(true);}
_this.dispatchEvent(["success",_this.typeModule,data]);},error:function(){_this.dispatchEvent(["failed",_this.typeModule]);}});}else{_this.dispatchEvent(["failed",_this.typeModule]);}}
LikeComponent.prototype.getLike=function(videoData){var _this=this;var urlService=videoData.getServices().urlGetAlreadyVote;if(urlService){var params=new Object();params.sendFrom='player';params.itemId=videoData.getIdContent();jQuery.ajax({url:urlService,type:'post',dataType:'json',data:params,success:function(data,textStatus,jqXHR){_this.dispatchEvent(["success",_this.typeModule,data]);},error:function(){_this.dispatchEvent(["failed",_this.typeModule]);}});}else{_this.dispatchEvent(["failed",_this.typeModule]);}}
LikeComponent.prototype.activateLike=function(isDisplay)
{if(isDisplay){jQuery(this.idComponent).find(".gp-like").addClass('active');jQuery(this.idComponent).find(".gp-like").attr('title','Me gusta');this.isLike=true;this.showInfoLike();}else{jQuery(this.idComponent).find(".gp-like").removeClass('active');}}
LikeComponent.prototype.showInfoLike=function(){var _this=this;jQuery(this.idComponent).find('.gp-like-text').css('top','30%');jQuery(this.idComponent).find('.gp-like-text').css('opacity',0);jQuery(this.idComponent).find('.gp-like-text').show();jQuery(this.idComponent).find('.gp-like-text').animate({opacity:1,top:'5%'},1000,function(){setTimeout(function(){jQuery(_this.idComponent).find('.gp-like-text').animate({opacity:0},{duration:500,complete:function(){jQuery(_this.idComponent).find('.gp-like-text').hide();}});},1000);});}
LikeComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
LikeComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function ShareTabsComponent(idComponent){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="censor";this.isSendingForm=false;this.url="";}
ShareTabsComponent.prototype.create=function(videoData){this.theEvent=this.CustomEvent("onModulesEvent");this.url=videoData.getServices().urlSendToFriend;this.urlEmbed=videoData.getServices().urlEmbed;if(typeof this.urlEmbed==="string"){this.urlEmbed=this.urlEmbed.replace(/\%width\%/g,jQuery(this.idComponent).width());this.urlEmbed=this.urlEmbed.replace(/\%height\%/g,jQuery(this.idComponent).height());}
var urlToShare=videoData.getServices().urlToShare;if(typeof urlToShare=='undefined')urlToShare=videoData.getUrlToShareSelected();if(jQuery(this.idComponent).find('.shareTabsComponent').length==0)
{jQuery(this.idComponent).append('<div id="" class="gp-extra-functionality gp-reportbaduse-video-player shareTabsComponent">'+'<div class="gp-extra-functionality-content">'+'<div class="gp-extra-content-close">'+'<a href="javascript:;" title="Cerrar ventana" class="gp-extra-content-close-ico">&times;</a>'+'</div>'+'<div id="tabs" class="gp-extra-tabs">'+'<div class="gp-extra-title">'+'<h3>COMPARTIR ESTE VÍDEO</h3>'+'<ul>'+'<li><a href="#tabs-1" class="gp-enlace">ENLACE</a></li>'+'<li><a href="#tabs-2" class="gp-porcorreo">POR CORREO</a></li>'+'<li><a href="#tabs-3" class="gp-incrustar">INCRUSTAR</a></li>'+'</ul>'+'</div>'+'<div class="gp-extra-content">'+'<div id="tabs-1">'+'<form name="form_censor" id="form_censor" method="post" action="" class="gp-extra-form">'+'<label>Enlace:</label>'+'<input type="text" name="url_video" id="url_video" class="" placeholder="http://..."  value="'+urlToShare+'" />'+'<div class="gp-extra-content-buttons">'+'<input type="button" name="select_url_video" id="select_url_video" value="seleccionar" class="">'+'<input type="reset" name="reset_url_video" id="reset_url_video" value="cancelar" class="gp-last-button">'+'</div>'+'<div class="gp-extra-message message-successful" style="display:none;"><span>mensaje de exito</span></div>'+'<div class="gp-extra-message message-error" style="display:none;"><span>mensaje de error</span></div>'+'<div class="gp-extra-message message-warning" style="display:none;"><span>mensaje de advertencia</span></div>'+'<div class="gp-extra-message message-common" style="display:none;"><span></span></div>'+'</form>'+'</div>'+'<div id="tabs-2">'+'<form name="form_send" id="form_send" method="post" action="" class="gp-extra-form">'+'<input type="email" name="mailFrom" id="mailFrom" class="" placeholder="tu e-mail" />'+'<input type="email" name="mailTo" id="mailTo" class="" placeholder="e-mail de tu amig@" />'+'<textarea name="comment" id="comment" class="" placeholder="tu mensaje"></textarea>'+'<input type="hidden" name="idContent" id="idContent" value="'+videoData.getIdSelected()+'" />'+'<input type="hidden" name="urlToShare" id="urlToShare" value="'+urlToShare+'" />'+'<input type="hidden" name="sendFrom" id="sendFrom" value="player" />'+'<div class="gp-extra-content-buttons">'+'<input type="submit" name="send_email_player" id="send_email_player" value="enviar" class="">'+'<input type="reset" name="reset_send_email_player" id="reset_send_email_player" value="cancelar" class="gp-last-button">'+'</div>'+'<div class="gp-extra-message message-successful" style="display:none;"><span>Se ha enviado el correo</span></div>'+'<div class="gp-extra-message message-error" style="display:none;"><span>mensaje de error</span></div>'+'<div class="gp-extra-message message-warning" style="display:none;"><span>mensaje de advertencia</span></div>'+'<div class="gp-extra-message message-common" style="display:none;"><span></span></div>'+'</form>'+'</div>'+'<div id="tabs-3">'+'<form name="form_embed" id="form_embed" method="post" action="" class="gp-extra-form">'+'<label for="textarea">Copia este c&oacute;digo y ponlo en tu web</label>'+'<textarea name="textarea" id="textarea" class="gp-extra-textarea-embed" placeholder="código del vídeo">'+this.urlEmbed+'</textarea>'+'<input type="hidden" name="codeEmbed" id="codeEmbed" value="" />'+'<input type="hidden" name="sendFrom" id="sendFrom" value="player" />'+'<div class="gp-extra-content-buttons">'+'<input type="submit" name="copy_embed_player" id="copy_embed_player" value="seleccionar" class="" />'+'<input type="reset" name="reset_embed_player" id="reset_embed_player" value="cancelar" class="gp-last-button" />'+'</div>'+'<div class="gp-extra-message message-successful" style="display:none;"><span>mensaje de exito</span></div>'+'<div class="gp-extra-message message-error" style="display:none;"><span>mensaje de error</span></div>'+'<div class="gp-extra-message message-warning" style="display:none;"><span>mensaje de advertencia</span></div>'+'<div class="gp-extra-message message-common" style="display:none;"><span></span></div>'+'</form>'+'</div>'+'</div>'+'</div>'+'</div>'+'</div>');this.activateListeners();}
this.translate();jQuery(this.idComponent).find('.shareTabsComponent').show();}
ShareTabsComponent.prototype.translate=function(){jQuery(this.idComponent).find('div[class*=gp-extra-tabs] h3').html(Translation.getText('player.compartirvideo','COMPARTIR ESTE VIDEO').toUpperCase());jQuery(this.idComponent).find('div[class*=gp-extra-title] > ul > li > a[class*=gp-enlace]').html(Translation.getText('player.enlace','ENLACE').toUpperCase());jQuery(this.idComponent).find('div[class*=gp-extra-title] > ul > li > a[class*=gp-porcorreo]').html(Translation.getText('player.porcorreo','POR CORREO').toUpperCase());jQuery(this.idComponent).find('div[class*=gp-extra-title] > ul > li > a[class*=gp-incrustar]').html(Translation.getText('player.incrustar','INCRUSTAR').toUpperCase());jQuery(this.idComponent).find('input[id=select_url_video]').attr('value',Translation.getText('player.seleccionar','Seleccionar'));jQuery(this.idComponent).find('input[id=reset_url_video]').attr('value',Translation.getText('player.cancelar','Cancelar'));jQuery(this.idComponent).find('input[id=mailFrom]').attr('placeholder',Translation.getText('player.tumail','Tu e-mail'));jQuery(this.idComponent).find('input[id=mailTo]').attr('placeholder',Translation.getText('player.mailto','E-mail de tu amigo'));jQuery(this.idComponent).find('textarea[id=comment]').attr('placeholder',Translation.getText('player.tumensaje','Tu mensaje'));jQuery(this.idComponent).find('input[id=send_email_player]').attr('value',Translation.getText('player.enviar','Enviar'));jQuery(this.idComponent).find('input[id=reset_send_email_player]').attr('value',Translation.getText('player.cancelar','Cancelar'));jQuery(this.idComponent).find('textarea[class=gp-extra-textarea-embed]').attr('placeholder',Translation.getText('player.codigovideo','Código del vídeo'));jQuery(this.idComponent).find('input[id=copy_embed_player]').attr('value',Translation.getText('player.seleccionar','Seleccionar'));jQuery(this.idComponent).find('input[id=reset_embed_player]').attr('value',Translation.getText('player.cancelar','Cancelar'));jQuery(this.idComponent).find('form[id=form_embed] > label').html(Translation.getText('player.msjcopiaentuweb','Copia este código y ponlo en tu web'));jQuery(this.idComponent).find('form[id=form_censor] > label').html(Translation.getText('player.enlace','Enlace')+':');jQuery(this.idComponent).find('div[class=gp-extra-content-close] a').html(Translation.getText('player.cerrar','Cerrar Ventana'));jQuery(this.idComponent).find('div[class=gp-extra-content-close] a').attr('title',Translation.getText('player.cerrar','Cerrar Ventana'));}
ShareTabsComponent.prototype.close=function(){jQuery(this.idComponent).find('.shareTabsComponent').hide();this.dispatchEvent(["close",this.typeModule]);}
ShareTabsComponent.prototype.remove=function(){jQuery(this.idComponent).find('.shareTabsComponent').remove();}
ShareTabsComponent.prototype.activateListeners=function(){var _this=this;jQuery(function(){jQuery(_this.idComponent).find("#tabs").tabs().addClass("ui-tabs-vertical ui-helper-clearfix");jQuery(_this.idComponent).find("#tabs li").removeClass("ui-corner-top").addClass("ui-corner-left");});loadjscssfile('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css','css');if(jQuery(this.idComponent).find('.gp-extra-content-close-ico').length>0){jQuery(this.idComponent).find('.gp-extra-content-close-ico').on(this.clickEvent,function(e){e.preventDefault();_this.close();});}
jQuery(_this.idComponent).find("#tabs").tabs().on(this.clickEvent,function(){jQuery(_this.idComponent).find(".gp-extra-message").hide();});if(jQuery(this.idComponent).find('.gp-last-button').length>0){jQuery(this.idComponent).find('.gp-last-button').on(this.clickEvent,function(e){e.preventDefault();_this.close();});}
if(jQuery(this.idComponent).find('#select_url_video').length>0){jQuery(this.idComponent).find('#select_url_video').on(this.clickEvent,function(e){e.preventDefault();jQuery(_this.idComponent).find('#url_video').select();});}
if(jQuery(this.idComponent).find('#copy_embed_player').length>0){jQuery(this.idComponent).find('#copy_embed_player').on(this.clickEvent,function(e){e.preventDefault();jQuery(_this.idComponent).find('.gp-extra-textarea-embed').select();});}
if(jQuery(this.idComponent).find('form[id=form_send]').length>0){jQuery(this.idComponent).find('form[id=form_send]').on('submit',function(event){event.preventDefault();if(_this.url==""||typeof _this.url=='undefined'){_this.showErrorMessage();}else if(!_this.isSendingForm){_this.isSendingForm=true;_this.showSendMessage();var divSuccerful=jQuery(_this.idComponent).find('.message-successful');var divError=jQuery(_this.idComponent).find('.message-error');jQuery(divSuccerful).hide();jQuery(divError).hide();jQuery(divError).on(clickEvent,function(e){e.preventDefault();jQuery(this).hide();});jQuery(divSuccerful).on(clickEvent,function(e){e.preventDefault();jQuery(this).hide();});if(_this.validateFields()==false){_this.isSendingForm=false;jQuery(divError).show();_this.hideSendMessage();jQuery(divError).html('<span>Los campos no pueden ir vacíos</span>');return;}
var params=jQuery(this).serialize();jQuery.ajax({url:_this.url,type:'post',dataType:'json',data:params,success:function(data,textStatus,jqXHR){_this.isSendingForm=false;_this.hideSendMessage();jQuery(divSuccerful).hide();jQuery(divError).hide();if(data.result=='ok'){jQuery(_this.idComponent).find('form[id=form_send] input[type=text]').each(function(){jQuery(this).val('');});jQuery(_this.idComponent).find('form[id=form_send] textarea').val('');jQuery(divSuccerful).show();}else{var mensaje_final='';var isFirst=true;if(data.errors&&typeof data.errors=="string"){mensaje_final='<span>'+data.errors+'</span>';}else if(data.errors&&typeof data.errors=="object"&&data.errors.hasOwnProperty('error')){mensaje_final='<span>'+data.errors.error+'</span>';}else if(data.errors&&typeof data.errors=="array"&&data.errors.length>0){mensaje_final='<span>'+data.errors[0]+'</span>';}
if(mensaje_final!=''){jQuery(divError).html(mensaje_final);}
jQuery(divError).show();}},error:function(){_this.isSendingForm=false;_this.hideSendMessage();jQuery(divError).html('<span>Error en el servicio. Inténtelo más tarde.</span>');jQuery(divError).show();}});}});}}
ShareTabsComponent.prototype.showErrorMessage=function(){jQuery(this.idComponent).find('.message-error').find('span').html('No se puede enviar el mensaje. Disculpe las molestias.');jQuery(this.idComponent).find('.message-error').show();}
ShareTabsComponent.prototype.showSendMessage=function(){var _this=this;var text="Enviando correo";var lod=['.','..','...'];var lodSelected=0;jQuery(this.idComponent).find('#form_send').find('.message-common').show();this.interval=setInterval(function(){if(lodSelected<lod.length-1){lodSelected++;}else{lodSelected=0;}
jQuery(_this.idComponent).find('#form_send').find('.message-common').find('span').html(text+" "+lod[lodSelected]);},500);}
ShareTabsComponent.prototype.hideSendMessage=function(){jQuery(this.idComponent).find('.message-common').hide();clearInterval(this.interval);}
ShareTabsComponent.prototype.validateFields=function(){if(jQuery(this.idComponent).find("#mailFrom").val().length<1){return false;}
if(jQuery(this.idComponent).find("#mailTo").val().length<1){return false;}
if(jQuery(this.idComponent).find("#comment").val().length<1){return false;}}
ShareTabsComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
ShareTabsComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function SocialNetworkComponent(idComponent,config){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="social";this.url="";this.isSendingForm=false;this.config=config;this.viewMode={LEFT:'left',RIGHT:'right',CENTER:'center',NONE:'none'};this.videoData;this.isShowButtons=false;}
SocialNetworkComponent.prototype.create=function(videoData){this.videoData=videoData;this.url="";this.theEvent=this.CustomEvent("onModulesEvent");if(jQuery(this.idComponent).find('.gp-rrss-functionality').length==0)
{jQuery(this.idComponent).append('<div id="" class="gp-extra-functionality gp-rrss-functionality gp-rrss-flip" style="display:none;">'+'<ul class="gp-rrss-holder">'+'<li><a href="javascript:;" target="_blank" title="facebook" class="gp-icon gp-icon-facebook gp-facebook">facebook</a></li>'+'<li><a href="javascript:;" target="_blank" title="twitter" class="gp-icon gp-icon-twitter gp-twitter">twitter</a></li>'+'<li><a href="javascript:;" target="_blank" title="google plus" class="gp-icon gp-icon-google-plus gp-google-plus">google plus</a></li>'+'<li><a href="javascript:;" target="_blank" title="linkedin" class="gp-icon gp-icon-linkedin gp-linkedin">linkedin</a></li>'+'</ul>'+'</div>'+'<div id="" class="gp-share-functionality gp-share-functionality gp-share-flip" style="display:none;">'+'<ul class="gp-rrss-holder">'+'<li><a href="javascript:;" title="compartir" class="gp-icon gp-icon-share gp-share">compartir</a></li>'+'<li><a href="javascript:;" title="¿te gusta?" class="gp-icon gp-icon-like gp-like gp-like-rrss">me gusta</a></li>'+'</ul>'+'</div>'+'<div id="" class="gp-share-more-functionality" style="display:none;">'+'<ul class="gp-rrss-holder">'+'<li><a href="javascript:;" target="_blank" title="facebook" class="gp-icon gp-icon-facebook gp-facebook">facebook</a></li>'+'<li><a href="javascript:;" target="_blank" title="twitter" class="gp-icon gp-icon-twitter gp-twitter">twitter</a></li>'+'<li><a href="javascript:;" target="_blank" title="google plus" class="gp-icon gp-icon-google-plus gp-google-plus">google plus</a></li>'+'<li><a href="javascript:;" target="_blank" title="linkedin" class="gp-icon gp-icon-linkedin gp-linkedin">linkedin</a></li>'+'<li><a href="javascript:;" target="_blank" title="compartir" class="gp-icon gp-icon-share gp-share">compartir</a></li>'+'</ul>'+'</div>');this.activateListeners();}
switch(this.config.socialview){case this.viewMode.RIGHT:jQuery(this.idComponent).find('.gp-rrss-functionality').hide();jQuery(this.idComponent).find('.gp-share-functionality').hide();jQuery(this.idComponent).find('.gp-share-more-functionality').hide();break;case this.viewMode.LEFT:jQuery(this.idComponent).find('.gp-rrss-functionality').removeClass('gp-rrss-flip');jQuery(this.idComponent).find('.gp-share-functionality').removeClass('gp-share-flip');jQuery(this.idComponent).find('.gp-rrss-functionality').hide();jQuery(this.idComponent).find('.gp-share-functionality').hide();jQuery(this.idComponent).find('.gp-share-more-functionality').hide();break;case this.viewMode.CENTER:jQuery(this.idComponent).find('.gp-rrss-functionality').hide();jQuery(this.idComponent).find('.gp-share-functionality').hide();jQuery(this.idComponent).find('.gp-share-more-functionality').css('opacity',0);jQuery(this.idComponent).find('.gp-share-more-functionality').hide();break;default:jQuery(this.idComponent).find('.gp-rrss-functionality').hide();jQuery(this.idComponent).find('.gp-share-functionality').hide();jQuery(this.idComponent).find('.gp-rrss-functionality').hide();jQuery(this.idComponent).find('.gp-share-functionality').hide();jQuery(this.idComponent).find('.gp-share-more-functionality').hide();break;}
this.hideButtons();this.translate();}
SocialNetworkComponent.prototype.translate=function(){jQuery(this.idComponent).find('ul[class=gp-rrss-holder] > li > a[class*=gp-share]').attr('title',Translation.getText('player.compartir','Compartir'));jQuery(this.idComponent).find('ul[class=gp-rrss-holder] > li > a[class*=gp-share]').html(Translation.getText('player.compartir','Compartir'));jQuery(this.idComponent).find('ul[class=gp-rrss-holder] > li > a[class*=gp-like]').attr('title',Translation.getText('player.megusta','Me gusta'));jQuery(this.idComponent).find('ul[class=gp-rrss-holder] > li > a[class*=gp-like]').html(Translation.getText('player.megusta','Me gusta'));}
SocialNetworkComponent.prototype.initStateButtons=function(){if(!this.isShowButtons&&(this.config.socialview==this.viewMode.RIGHT||this.config.socialview==this.viewMode.LEFT)){jQuery(this.idComponent).find('.gp-rrss-functionality').show();jQuery(this.idComponent).find('.gp-share-functionality').show();this.isShowButtons=true;}}
SocialNetworkComponent.prototype.hideButtons=function(){var _this=this;var widthRrss=jQuery(this.idComponent).find('.gp-rrss-functionality').width();var widthShare=jQuery(this.idComponent).find('.gp-share-functionality').width();this.movingControls=true;if(detectmob()){jQuery(this.idComponent).find('.gp-rrss-functionality').hide();jQuery(this.idComponent).find('.gp-share-functionality').hide();}else{if(jQuery(this.idComponent).find('.gp-rrss-functionality').hasClass('gp-rrss-flip')){jQuery(this.idComponent).find('.gp-rrss-functionality').animate({right:-widthRrss,opacity:0},{duration:500,queue:false,complete:function(){_this.movingControls=false;}});}else{jQuery(this.idComponent).find('.gp-rrss-functionality').animate({'margin-left':-40,opacity:0},{duration:500,queue:false,complete:function(){_this.movingControls=false;}});}
if(jQuery(this.idComponent).find('.gp-share-functionality').hasClass('gp-share-flip')){jQuery(this.idComponent).find('.gp-share-functionality').animate({left:-widthShare,opacity:0},{duration:500,queue:false,complete:function(){_this.movingControls=false;}});}else{jQuery(this.idComponent).find('.gp-share-functionality').animate({'margin-right':-40,opacity:0},{duration:500,queue:false,complete:function(){_this.movingControls=false;}});}}}
SocialNetworkComponent.prototype.showButtons=function(){var _this=this;var widthRrss=jQuery(this.idComponent).find('.gp-rrss-functionality').width();var widthShare=jQuery(this.idComponent).find('.gp-share-functionality').width();this.movingControls=true;if(detectmob()){jQuery(this.idComponent).find('.gp-rrss-functionality').show();jQuery(this.idComponent).find('.gp-share-functionality').show();}else{if(jQuery(this.idComponent).find('.gp-rrss-functionality').hasClass('gp-rrss-flip')){jQuery(this.idComponent).find('.gp-rrss-functionality').animate({right:0,opacity:1},{duration:500,queue:false,complete:function(){_this.movingControls=false;}});}else{jQuery(this.idComponent).find('.gp-rrss-functionality').animate({'margin-left':0,opacity:1},{duration:500,queue:false,complete:function(){_this.movingControls=false;}});}
if(jQuery(this.idComponent).find('.gp-share-functionality').hasClass('gp-share-flip')){jQuery(this.idComponent).find('.gp-share-functionality').animate({left:0,opacity:1},{duration:500,queue:false,complete:function(){_this.movingControls=false;}});}else{jQuery(this.idComponent).find('.gp-share-functionality').animate({'margin-right':0,opacity:1},{duration:500,queue:false,complete:function(){_this.movingControls=false;}});}}}
SocialNetworkComponent.prototype.showCenterButtons=function(){var _this=this;if(this.config.socialview==this.viewMode.CENTER){if(jQuery(this.idComponent).find('.gp-share-more-functionality').css('opacity')==0){jQuery(this.idComponent).find('.gp-share-more-functionality').show();jQuery(this.idComponent).find('.gp-share-more-functionality').animate({opacity:1},{duration:500,queue:false,complete:function(){_this.movingControls=false;}});}else if(jQuery(this.idComponent).find('.gp-share-more-functionality').css('opacity')==1){jQuery(this.idComponent).find('.gp-share-more-functionality').animate({opacity:0},{duration:500,queue:false,complete:function(){_this.movingControls=false;jQuery(this).hide();}});}}}
SocialNetworkComponent.prototype.activateListeners=function(){var _this=this;if(jQuery(this.idComponent).find('.gp-extra-content-close-ico').length>0){jQuery(this.idComponent).find('.gp-extra-content-close-ico').on(this.clickEvent,function(e){e.preventDefault();_this.close();});}
if(jQuery(this.idComponent).find('.gp-share').length>0){jQuery(this.idComponent).find('.gp-share').on(this.clickEvent,function(e){e.preventDefault();_this.showCenterButtons();_this.dispatchEvent(["onclickopencompartirtabs"]);});}
if(jQuery(this.idComponent).find('.gp-facebook').length>0){jQuery(this.idComponent).find('.gp-facebook').on(this.clickEvent,function(e){var urltoShared='http://www.facebook.com/sharer.php?s=100&p[title]=%title%&p[url]=%url%&p[summary]=%description%&p[images][0]=%image%';e.preventDefault();_this.dispatchEvent(["onclicktoshareurl",urltoShared,"facebook"]);});}
if(jQuery(this.idComponent).find('.gp-twitter').length>0){jQuery(this.idComponent).find('.gp-twitter').on(this.clickEvent,function(e){e.preventDefault();var urltoShared='http://twitter.com/home?status=%title% %20 %url%';_this.dispatchEvent(["onclicktoshareurl",urltoShared,"twitter"]);});}
if(jQuery(this.idComponent).find('.gp-google-plus').length>0){jQuery(this.idComponent).find('.gp-google-plus').on(this.clickEvent,function(e){e.preventDefault();var urltoShared='https://plus.google.com/share?url=%url%';_this.dispatchEvent(["onclicktoshareurl",urltoShared,"googleplus"]);});}
if(jQuery(this.idComponent).find('.gp-linkedin').length>0){jQuery(this.idComponent).find('.gp-linkedin').on(this.clickEvent,function(e){e.preventDefault();var urltoShared='http://www.linkedin.com/shareArticle?mini=true&url=%url%&title=%title%&summary=%description%&source=smartycontent';_this.dispatchEvent(["onclicktoshareurl",urltoShared,"linkedin"]);});}
if(jQuery(this.idComponent).find('.gp-like-rrss').length>0){jQuery(this.idComponent).find('.gp-like-rrss').on(this.clickEvent,function(e){e.preventDefault();_this.dispatchEvent(["onclicklike"]);});}}
SocialNetworkComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
SocialNetworkComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function TLTwitterComponent(idComponent,twsearch){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="twitter";this.search=twsearch;this.result_twitter;this.intervalTweets;this.timeToUpdate=60000;this.numNewItems=0;this.items_tw=new Array();this.isOpen=false;}
TLTwitterComponent.prototype.load=function(component,url_tweets){var _this=this;this.theEvent=this.CustomEvent("onModulesEvent");this.result_twitter=jQuery.getJSON(url_tweets+this.search,function(){}).done(function(data){var new_items=new Array();if(jQuery.isArray(data)){new_items=data;}else if(typeof result_twitter.statuses!='undefined'&&jQuery.isArray(result_twitter.statuses)){new_items=result_twitter.statuses;}
_this.createWidgetTwitter(this.search);_this.addItemstoArray(new_items)}).fail(function(){console.log("[twitter]error no se han podido cargar los tweets");});}
TLTwitterComponent.prototype.translate=function(){jQuery(this.idComponent).find('div[class*=gp-extra-content-close] a').attr('title',Translation.getText('player.cerrar','Cerrar Ventana'));}
TLTwitterComponent.prototype.createWidgetTwitter=function(search_term){var _this=this;search_term=search_term.replace('%23','#');search_term=search_term.replace('%40','@');if(jQuery(this.idComponent).find('.tw_main_container').length==0){jQuery(this.idComponent).append('<div class="tw_main_container">'+'<div class="tw_head">'+'<ul>'+'<li><a href="#"><img src="'+APP_URL_STATIC+'/img/video/ico_tw.png"/></a></li>'+'<li><h3><a href="http://twitter.com/'+search_term+'" target="_blank">'+search_term+'</h3></li>'+'<li><p style="float:right;padding-right:10px;font-size:0.7em;display:none;">+'+this.numNewItems+'</p></li>'+'</ul>'+'</div>'+'<div class="tw_timeline">'+'<ul class="tw_timeline_list">'+'</ul>'+'</div>'+'</div>');jQuery(document).on('click','.tw_new_tweets',function(){_this.hideButtonReload();_this.addItemsToWidget();});this.calculateTweetListHeight();jQuery(window).resize(function(){_this.calculateTweetListHeight();});}
this.translate();}
TLTwitterComponent.prototype.hideButtonReload=function(){jQuery(this.idComponent).find('.tw_new_tweets').hide();jQuery(this.idComponent).find('.tw_head').find('p').hide();}
TLTwitterComponent.prototype.addItemsToWidget=function(){var i;jQuery(this.idComponent).find('.tw_main_container').find('.tw_timeline_list').html('');if(this.items_tw.length==0){jQuery(this.idComponent).find('.tw_main_container').find('.tw_timeline_list').prepend('<li class="tw_timeline_item"><div class="caja"><p class="tw_list_empty">No hay tweets</p></div></li>');}else{for(i=0;i<this.items_tw.length;i++){this.createItemTweet(this.items_tw[i]);}}
this.contractPlayer();}
TLTwitterComponent.prototype.contractPlayer=function(){var _this=this;jQuery(this.idComponent).addClass('sc_container-with-twitter').removeClass('sc_container');jQuery(this.idComponent).find('#gp_container').addClass('gp-player-with-twitter').removeClass('gp-player');jQuery(this.idComponent).find('.tw_main_container').fadeIn("slow");jQuery(this.idComponent).find('.gp-tw-button').hide();jQuery(_this.idComponent).find('.tw_volver_button').show();this.isOpen=true;this.dispatchEvent(["openTwitter"]);}
TLTwitterComponent.prototype.expandPlayer=function(){var _this=this;jQuery(this.idComponent).addClass('sc_container').removeClass('sc_container-with-twitter');jQuery(this.idComponent).find('#gp_container').addClass('gp-player').removeClass('gp-player-with-twitter');jQuery(_this.idComponent).find('.tw_main_container').fadeOut('slow',function(){jQuery(this).remove();});jQuery(this.idComponent).find('.gp-tw-button').show();jQuery(_this.idComponent).find('.tw_volver_button').hide();this.isOpen=false;this.dispatchEvent(["closeTwitter"]);}
TLTwitterComponent.prototype.calculateTweetListHeight=function(){var altContainer=jQuery(this.idComponent).height();var altTwHead=jQuery(this.idComponent).find('.tw_head').outerHeight();var altTwClose=jQuery(this.idComponent).find('.tw_volver_button').outerHeight();var alto=parseInt(altContainer-altTwHead-altTwClose);jQuery(this.idComponent).find('.tw_timeline').css({'height':alto});}
TLTwitterComponent.prototype.createItemTweet=function(obj_item_tw){var obj_tw;var display="none";var fromTime="";var mainText="";var display_photo="none";var url_photo="";if(typeof obj_item_tw.retweeted_status!='undefined'){obj_tw=obj_item_tw.retweeted_status;display="block";}else{obj_tw=obj_item_tw;}
var f1=new Date();var f2=new Date(obj_item_tw.created_at);var difDias=Math.floor((f2.getTime()-f1.getTime())/(1000*60*60*24))+1;fromTime=Math.abs(difDias)+"d";if(difDias==0){difDias=Math.floor((f2.getTime()-f1.getTime())/(1000*60*60))+1;fromTime=Math.abs(difDias)+"h";if(difDias==0){difDias=Math.floor((f2.getTime()-f1.getTime())/(1000*60))+1;fromTime=Math.abs(difDias)+"m";if(Math.abs(difDias)==0){fromTime="Ahora"}}}
mainText=obj_item_tw.text.replace(/(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/ig,'<a href="$1" target="_blank">$1</a>');mainText=mainText.replace(/(^|\W)(#[a-z\d][\w-]*)/ig,'$1<span class="hash"><a href="http://twitter.com/$2" target="_blank">$2</a></span>');mainText=mainText.replace(/(^|\W)(@[a-z\d][\w-]*)/ig,'$1<span class="hash"><a href="http://twitter.com/$2" target="_blank">$2</a></span>');if(obj_tw.entities.media&&obj_tw.entities.media.length>0){for(var im=0;im<obj_tw.entities.media.length;im++){if(obj_tw.entities.media[im].type=='photo'){display_photo="block";url_photo=obj_tw.entities.media[im].media_url;}}}
jQuery(this.idComponent).find('.tw_timeline_list').append('<li class="tw_timeline_item">'+'<div class="caja">'+'<ul>'+'<li><img class="tw_img_profile" src="'+obj_tw.user.profile_image_url+'"></li>'+'<li><div class="tw_timeline_item_text">'+'<span class="tw_name_profile">'+obj_tw.user.name+'</span>'+'<span class="tw_user_profile"><a href="http://twitter.com/@'+obj_tw.user.screen_name+'" target="_blank">@'+obj_tw.user.screen_name+'</a></span>'+'<span class="tw_item_time">'+fromTime+'</span>'+'<p class="tw_item_text">'+mainText+'</p>'+'<img class="tw_item_image" style="display:'+display_photo+';" src="'+url_photo+'"></img>'+'<p class="tw_item_reweet" style="display:'+display+';"><i class="tw_item_rtw_ico"></i>Retwiteado por <a href="http://twitter.com/@'+obj_item_tw.user.screen_name+'" target="_blank">'+obj_item_tw.user.name+'</a></p></div></li>'+'</ul>'+'</div>'+'</li>');}
TLTwitterComponent.prototype.loadTwitterButton=function(tw_sch){this.search=tw_sch;twitter_search=this.search;if(typeof twitter_search!='undefined'&&twitter_search!=''){twitter_search=twitter_search.replace('%23','#');twitter_search=twitter_search.replace('%40','@');if(jQuery(this.idComponent).find('.gp-tw-button').length==0){jQuery(this.idComponent).append('<div class="gp-tw-button" style=""><i class="gp-icon-twitter-button"></i> <span>'+this.search+'</span></div>');}else{jQuery(this.idComponent).find('div[class=gp-tw-button]>span').html(this.search);}
if(jQuery(this.idComponent).find('.gp-extra-content-close').length==0){jQuery(this.idComponent).prepend('<div class="gp-extra-content-close tw_volver_button" style="display:none;">'+'<a href="javascript:;" title="Cerrar ventana" class="gp-extra-content-close-ico">×</a>'+'</div>');this.activateListeners();}}}
TLTwitterComponent.prototype.loadTweets=function(url_tweets,search){var _this=this;result_twitter=jQuery.getJSON(url_tweets+search,function(){}).done(function(data){var new_items=new Array();if(jQuery.isArray(data)){new_items=data;}else if(typeof result_twitter.statuses!='undefined'&&jQuery.isArray(result_twitter.statuses)){new_items=result_twitter.statuses;}
_this.createWidgetTwitter(search);_this.addItemstoArray(new_items);_this.contractPlayer();}).fail(function(){console.log("[twitter]error no se han podido cargar los tweets");});}
TLTwitterComponent.prototype.addItemstoArray=function(newItems){if(this.items_tw.length==0){this.items_tw=newItems;this.hideButtonReload();this.addItemsToWidget();return true;}else{var aux=new Array();for(var i=0;i<newItems.length;i++){var nuevoId=newItems[i].id_str;if(nuevoId!=this.items_tw[0].id_str){aux.push(newItems[i]);}else{break;}}
if(aux.length>0){numNewItems=aux.length;this.items_tw=aux.concat(this.items_tw);if(this.items_tw.length>100)this.items_tw.length=100;this.showButtonReload();return true;}else{return false;}}}
TLTwitterComponent.prototype.showButtonReload=function(){if(jQuery('.tw_new_tweets').length==0){jQuery(this.idComponent).find('.tw_main_container').find('.tw_timeline_list').prepend('<li class="tw_timeline_item"><div class="caja"><p class="tw_new_tweets">nuevos tweets</p></div></li>');}
jQuery(this.idComponent).find('.tw_new_tweets').show();jQuery(this.idComponent).find('.tw_head').find('p').html('+ '+numNewItems);jQuery(this.idComponent).find('.tw_head').find('p').show();}
TLTwitterComponent.prototype.close=function(){jQuery(this.idComponent).find('.reportbaduse_video_player').hide();this.dispatchEvent(["close",this.typeModule]);}
TLTwitterComponent.prototype.remove=function(){jQuery(this.idComponent).find('.gp-tw-button').remove();jQuery(this.idComponent).find('.tw_main_container').remove();}
TLTwitterComponent.prototype.activateListeners=function(){var _this=this;if(jQuery(this.idComponent).find('.gp-tw-button').length>0){jQuery(this.idComponent).find('.gp-tw-button').on(this.clickEvent,function(e){e.preventDefault();twitter_search=_this.search.replace('#','%23');twitter_search=twitter_search.replace('@','%40');clearInterval(_this.intervalTweets);_this.items_tw=new Array();_this.loadTweets(APP_URL_TWEETS,twitter_search);_this.intervalTweets=setInterval(function(){_this.loadTweets(APP_URL_TWEETS,twitter_search)},_this.timeToUpdate);});}
if(jQuery(this.idComponent).find('.tw_volver_button').length>0){jQuery(this.idComponent).find('.tw_volver_button').on(this.clickEvent,function(e){e.preventDefault();clearInterval(_this.intervalTweets);_this.expandPlayer();});}}
TLTwitterComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{console.log('Nothing subscribed to the '+this.eventName+' event!'+sender);}};return this;}
TLTwitterComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function RelatedVideoComponent(idComponent,arrVideos){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.arrVideos=arrVideos;}
RelatedVideoComponent.prototype.create=function(){this.theEvent=this.CustomEvent("onModulesEvent");if(jQuery(this.idComponent).find('.gp-end-video2').length==0)
{jQuery(this.idComponent).append('<div id="" class="gp-extra-functionality gp-end-video2" style="opacity:0">'+'<div class="gp-end-video2-content">'+'<ul class="gp-end-video2-list"></ul>'+'</div>'+'<div class="gp-interface gp-interface-block">'+'<ul class="gp-controls-holder">'+'<li><a href="javascript:;" title="Full screen" class="gp-icon gp-icon-full-screen gp-full-screen">Full screen</a></li>'+'<li><a href="javascript:;" title="Restore screen" class="gp-icon gp-icon-restore-screen gp-restore-screen">Restore screen</a></li>'+'<li><a href="javascript:;" title="Informar" class="gp-icon gp-icon-inform gp-inform">Informar</a></li>'+'<li><a href="javascript:;" title="compartir" class="gp-icon gp-icon-share gp-share">compartir</a></li>'+'<li><a href="javascript:;" title="me gusta" class="gp-icon gp-icon-like gp-like">me gusta</a></li>'+'</ul>'+'<ul class="gp-controls-holder-left">'+'<li><a href="javascript:;" title="Volver a visualizar" class="gp-icon gp-icon-replay gp-replay">Volver a visualizar</a></li>'+'<li class="gp-controls-time-content"><a href="javascript:;" title="Volver a visualizar">VOLVER A VISUALIZAR</a></li>'+'</ul>'+'</div>'+'</div>');this.addVideos();this.activateListeners();}
this.translate();this.show();}
RelatedVideoComponent.prototype.translate=function(){jQuery(this.idComponent).find('ul[class=gp-controls-holder-left] a').html(Translation.getText('player.volvervisualizar','Volver a Visualizar').toUpperCase());jQuery(this.idComponent).find('ul[class=gp-controls-holder-left] a').attr('title',Translation.getText('player.volvervisualizar','Volver a Visualizar'));jQuery(this.idComponent).find('ul[class=gp-controls-holder] > li > a[class*=gp-full-screen]').attr('title',Translation.getText('player.pantcompleta','Pantalla Completa'));jQuery(this.idComponent).find('ul[class=gp-controls-holder] > li > a[class*=gp-full-screen]').html(Translation.getText('player.pantcompleta','Pantalla Completa'));jQuery(this.idComponent).find('ul[class=gp-controls-holder] > li > a[class*=gp-restore-screen]').attr('title',Translation.getText('player.restpantalla','Restaurar Pantalla'));jQuery(this.idComponent).find('ul[class=gp-controls-holder] > li > a[class*=gp-restore-screen]').html(Translation.getText('player.restpantalla','Restaurar Pantalla'));jQuery(this.idComponent).find('ul[class=gp-controls-holder] > li > a[class*=gp-share]').attr('title',Translation.getText('player.compartir','Compartir'));jQuery(this.idComponent).find('ul[class=gp-controls-holder] > li > a[class*=gp-share]').html(Translation.getText('player.compartir','Compartir'));jQuery(this.idComponent).find('ul[class=gp-controls-holder] > li > a[class*=gp-like]').attr('title',Translation.getText('player.megusta','Me gusta'));jQuery(this.idComponent).find('ul[class=gp-controls-holder] > li > a[class*=gp-like]').html(Translation.getText('player.megusta','Me gusta'));jQuery(this.idComponent).find('ul[class=gp-controls-holder] > li > a[class*=gp-inform]').attr('title',Translation.getText('player.informar','Informar'));jQuery(this.idComponent).find('ul[class=gp-controls-holder] > li > a[class*=gp-inform]').html(Translation.getText('player.informar','Informar'));}
RelatedVideoComponent.prototype.addVideos=function(){jQuery(this.idComponent).find('.gp-end-video2-list').html();if(Object.prototype.toString.call(this.arrVideos)==='[object Array]'&&this.arrVideos.length>0){for(var m=0;m<this.arrVideos.length;m++){var _title=this.arrVideos[m].title;var _picture=this.arrVideos[m].picture;var _urlEmbed=this.arrVideos[m].urlEmbed;var _idComponent=this.idComponent;jQuery(this.idComponent).find('.gp-end-video2-list').append('<li class="gp-end-video2-item" style="background-image:url(\''+_picture+'\');">'+'<a href="javascript:document.location.href=\''+_urlEmbed+'\';" class="gp-start-link gp-start-custom">'+'<div class="gp-start">'+'<span class="gp-icon gp-icon-play-start">PLAY</span>'+'</div>'+'<div class="coverLayerTitle">'+'<div class="coverLayerTitleContent">'+'<h1 class="layerTitle">'+_title+'</h1>'+'<h2 class="layerTitleDescription"></h2>'+'</div>'+'</div>'+'</a>'+'</li>');}}}
RelatedVideoComponent.prototype.hide=function(remove){var _this=this;if(typeof remove=='undefined')remove=false;jQuery(this.idComponent).find('.gp-end-video2').animate({opacity:0},700,function(){jQuery(this.idComponent).find('.gp-end-video2').hide();if(remove==true){_this.remove();}});}
RelatedVideoComponent.prototype.show=function(){jQuery(this.idComponent).find('.gp-end-video2').css('opacity',0);jQuery(this.idComponent).find('.gp-end-video2').show();jQuery(this.idComponent).find('.gp-end-video2').animate({opacity:1},700,function(){jQuery('div[class*=gp-extra-functionality] > div[class*=gp-interface]').show();});}
RelatedVideoComponent.prototype.remove=function(){jQuery(this.idComponent).find('.gp-end-video2').remove();}
RelatedVideoComponent.prototype.activateListeners=function(){var _this=this;if(jQuery(this.idComponent).find('.gp-replay').length>0){jQuery(this.idComponent).find('.gp-replay').on(this.clickEvent,function(e){e.preventDefault();_this.hide(true);_this.dispatchEvent(["onclickreplay"]);});}
if(jQuery(this.idComponent).find('.gp-share').length>0){jQuery(this.idComponent).find('.gp-share').on(this.clickEvent,function(e){e.preventDefault();_this.hide();_this.dispatchEvent(["onclickopencompartirtabs"]);});}
if(jQuery(this.idComponent).find('.gp-like').length>0){jQuery(this.idComponent).find('.gp-like').on(this.clickEvent,function(e){e.preventDefault();_this.dispatchEvent(["onclicklike"]);});}
if(jQuery(this.idComponent).find('.gp-inform').length>0){jQuery(this.idComponent).find('.gp-inform').on(this.clickEvent,function(e){e.preventDefault();_this.hide();_this.dispatchEvent(["onclickcensor"]);});}}
RelatedVideoComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
RelatedVideoComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function PlayListHComponent(idComponent,config,idController){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="playlistH";this.config=config;this.idController=idController;this.idComponentPL="gp-container-lite-h_"+idController;this.totalItems=0;}
PlayListHComponent.prototype.create=function(items,nombreCanal){this.theEvent=this.CustomEvent("onModulesEvent");this.totalItems=items.length;if(jQuery('body').find('.gp-container-lite-h').length==0)
{jQuery('body').prepend('  <div class="gp-container-lite-h" id="'+this.idComponentPL+'">'+'<div class="gp-container-lite-h-left">'+'</div>'+'<div class="gp-container-lite-h-right" style="z-index:3">'+'<h1 class="layerTitleMain layerTitleMain-flip_ layerTitleMain-center_">'+'<span class="layerTitleMainChannel"><!--Canal--> <strong>'+nombreCanal+'</strong></span>'+'<span class="layerTitleMainLogo">&nbsp;</span> '+'</h1>'+'<div class="gp-playlist" style="">'+'<div class="gp-playlist-v" style="">'+'<div id="default" class="gp-related-videos ps-container ps-active-y" style="">'+'<ul class="gp-related-videos-list" style="height: 905px;"></ul>'+'</div></div></div></div>'+'</div>');var comp=jQuery('#'+this.idComponentPL).find('.gp-container-lite-h-left');jQuery(this.idComponent).parent().parent().appendTo(comp);var containerText='<div class="gp-container-text">'+'<div class="coverLayerTitle" style="z-index:3">'+'<div class="coverLayerTitleContent">'+'<h2 class="layerTitle"></h2>'+'<h3 class="layerTitleDescription"></h3>'+'</div>'+'</div>'+'</div>';jQuery(comp).append(containerText);var i=0;for(i=0;i<items.length;i++){this.createItem(i,items[i]);}
this.activateListeners();}
this.calculateHeight();}
PlayListHComponent.prototype.createItem=function(index,item){var miIndex=index;if(typeof item.realIndex!='undefined')miIndex=item.realIndex;jQuery('#'+this.idComponentPL).find('.gp-related-videos-list').append('<li class="gp-related-videos-item">'+'<div class="gp-embed-responsive gp-embed-responsive-16by9">'+'<div class="gp-display-crop" style="background-image:url(\''+item.picture+'\');'+'filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+item.picture+'\', sizingMethod=\'scale\');'+'-ms-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+item.picture+'\', sizingMethod=\'scale\')">'+'<a href="javascript:;" id="'+miIndex+'" title="'+item.title+'">'+item.title+'</a>'+'</div>'+'<a href="javascript:;" class="gp-start-link gp-start-custom" id="'+miIndex+'" >'+'<div class="gp-start">'+'<span class="gp-icon gp-icon-play-start">PLAY</span>'+'</div>'+'<div class="coverLayerTitle">'+'<div class="coverLayerTitleContent">'+'<h1 class="layerTitle">'+item.title+'</h1>'+'<h2 class="layerTitleDescription">'+item.description+'</h2>'+'</div>'+'</div>'+'</a>'+'</div>'+'</li>');}
PlayListHComponent.prototype.close=function(){jQuery('#'+this.idComponentPL).hide();this.dispatchEvent(["close",this.typeModule]);}
PlayListHComponent.prototype.remove=function(){jQuery('#'+this.idComponentPL).remove();}
PlayListHComponent.prototype.activateListeners=function(){var _this=this;if(jQuery('#'+this.idComponentPL).find('.gp-start-link').length>0){jQuery('#'+this.idComponentPL).find('.gp-related-videos-list').find('.gp-start-link').on(this.clickEvent,function(e){e.preventDefault();_this.dispatchEvent(["itemSelected",this.id]);});}
if(jQuery('#'+this.idComponentPL).find('.gp-related-videos-list').find('.gp-display-crop a').length>0){jQuery('#'+this.idComponentPL).find('.gp-related-videos-list').find('.gp-display-crop a').on(this.clickEvent,function(e){e.preventDefault();_this.dispatchEvent(["itemSelected",this.id]);});}}
PlayListHComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
PlayListHComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});}
PlayListHComponent.prototype.calculateHeight=function(){var ratio=0;var numModHor=this.totalItems;var anchVideoItem=jQuery('#'+this.idComponentPL).find('.gp-related-videos-item').innerWidth();var altVideoItem=parseInt(anchVideoItem*0.5625);jQuery('#'+this.idComponentPL).find('.gp-related-videos-item').css({'height':altVideoItem});var altVideoItemOuter=jQuery('#'+this.idComponentPL).find('.gp-related-videos-item').outerHeight(true);if(numModHor%2!=0)++numModHor;var altVideoList=parseInt(altVideoItemOuter*(numModHor/2));jQuery('#'+this.idComponentPL).find('.gp-related-videos-list').css({'height':altVideoList});var descontarAlto=jQuery('#'+this.idComponentPL).find('.layerTitleMain').outerHeight();jQuery('#'+this.idComponentPL).find('.gp-related-videos').css({'min-height':altVideoList});jQuery('#'+this.idComponentPL).find('.gp-related-videos').css({'height':altVideoList-descontarAlto});"use_strict";jQuery('#'+this.idComponentPL).find('.gp-related-videos').perfectScrollbar();}
PlayListHComponent.prototype.setVideoData=function(title,description){var currentTitle=jQuery('#'+this.idComponentPL).find('div.gp-container-lite-h-left > div.gp-container-text > div.coverLayerTitle > div.coverLayerTitleContent > h2.layerTitle').html();if(currentTitle!=title){jQuery('#'+this.idComponentPL).find('div.gp-container-lite-h-left > div.gp-container-text > div.coverLayerTitle > div.coverLayerTitleContent').fadeOut(500,function(){jQuery(this).find('.layerTitle').html(title);jQuery(this).find('.layerTitleDescription').html(description);jQuery(this).fadeIn(1000);});}};function PlayListVComponent(idComponent,config,idController){this.theEvent=this.CustomEvent("onModulesEvent");this.idComponent=idComponent;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.typeModule="playlistH";this.config=config;this.idController=idController;this.idComponentPL="gp-container-lite-v_"+idController;this.totalItems=0;}
PlayListVComponent.prototype.create=function(items,nombreCanal){this.theEvent=this.CustomEvent("onModulesEvent");this.totalItems=items.length;if(jQuery('body').find('.gp-container-lite-v').length==0)
{jQuery('body').prepend('  <div class="gp-container-lite-v" id="'+this.idComponentPL+'" style="z-index: 3;">'+'<h1 class="layerTitleMain layerTitleMain-flip_ layerTitleMain-center_">'+'<span class="layerTitleMainChannel"><!--Canal--> <strong>'+nombreCanal+'</strong></span>'+'<span class="layerTitleMainLogo">&nbsp;</span> '+'</h1>'+'</div>');var comp=jQuery('#'+this.idComponentPL);jQuery(this.idComponent).parent().parent().appendTo(comp);var containerText='<div class="gp-playlist" style="">'+' <div class="gp-playlist-h" style="">'+'<div id="default" class="gp-related-videos ps-container ps-active-x">'+'<ul class="gp-related-videos-list"></ul>'+'</div></div></div>';jQuery(comp).append(containerText);var i=0;for(i=0;i<items.length;i++){this.createItem(i,items[i]);}
this.activateListeners();}
this.calculateHeight();}
PlayListVComponent.prototype.createItem=function(index,item){var miIndex=index;if(typeof item.realIndex!='undefined')miIndex=item.realIndex;jQuery('#'+this.idComponentPL).find('.gp-related-videos-list').append('<li class="gp-related-videos-item">'+'<div class="gp-embed-responsive gp-embed-responsive-16by9">'+'<div class="gp-display-crop" style="background-image:url(\''+item.picture+'\');'+'filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+item.picture+'\', sizingMethod=\'scale\');'+'-ms-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+item.picture+'\', sizingMethod=\'scale\')">'+'<a href="javascript:;" id="'+miIndex+'" title="'+item.title+'">'+item.title+'</a>'+'</div>'+'<a href="javascript:;" class="gp-start-link gp-start-custom" id="'+miIndex+'" >'+'<div class="gp-start">'+'<span class="gp-icon gp-icon-play-start">PLAY</span>'+'</div>'+'<div class="coverLayerTitle">'+'<div class="coverLayerTitleContent">'+'<h1 class="layerTitle">'+item.title+'</h1>'+'<h2 class="layerTitleDescription">'+item.description+'</h2>'+'</div>'+'</div>'+'</a>'+'</div>'+'</li>');}
PlayListVComponent.prototype.close=function(){jQuery('#'+this.idComponentPL).hide();this.dispatchEvent(["close",this.typeModule]);}
PlayListVComponent.prototype.remove=function(){jQuery('#'+this.idComponentPL).remove();}
PlayListVComponent.prototype.activateListeners=function(){var _this=this;if(jQuery('#'+this.idComponentPL).find('.gp-start-link').length>0){jQuery('#'+this.idComponentPL).find('.gp-related-videos-list').find('.gp-start-link').on(this.clickEvent,function(e){e.preventDefault();_this.dispatchEvent(["itemSelected",this.id]);});}
if(jQuery('#'+this.idComponentPL).find('.gp-related-videos-list').find('.gp-display-crop a').length>0){jQuery('#'+this.idComponentPL).find('.gp-related-videos-list').find('.gp-display-crop a').on(this.clickEvent,function(e){e.preventDefault();_this.dispatchEvent(["itemSelected",this.id]);});}}
PlayListVComponent.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
PlayListVComponent.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});}
PlayListVComponent.prototype.calculateHeight=function(){var numModHor=this.totalItems;var altVideoItem=jQuery('#'+this.idComponentPL).find('.gp-related-videos-list').innerHeight();var anchVideoItem=parseInt(altVideoItem*1.77);var anchVideoList=parseInt(anchVideoItem*numModHor);jQuery('#'+this.idComponentPL).find('.gp-related-videos-item').css({'width':anchVideoItem});jQuery('#'+this.idComponentPL).find('.gp-related-videos-list').css({'width':anchVideoList});"use_strict";jQuery('#'+this.idComponentPL).find('.gp-related-videos').perfectScrollbar();}
PlayListVComponent.prototype.setVideoData=function(title,description){var currentTitle=jQuery('#'+this.idComponentPL).find('div.gp-container-lite-h-left > div.gp-container-text > div.coverLayerTitle > div.coverLayerTitleContent > h2.layerTitle').html();if(currentTitle!=title){jQuery('#'+this.idComponentPL).find('div.gp-container-lite-h-left > div.gp-container-text > div.coverLayerTitle > div.coverLayerTitleContent').fadeOut(500,function(){jQuery(this).find('.layerTitle').html(title);jQuery(this).find('.layerTitleDescription').html(description);jQuery(this).fadeIn(1000);});}};function VideoController(config){this.videoData;this.containerPlayerDiv;this.pl;this.completeReached=false;this.impressionsReached=false;this.firstQuartileReached=false;this.midpointReached=false;this.thirdQuartileReached=false;this.skipAdReached=false;this.coverAdHideReached=false;this.metadataLoaded=false;this.intervalTime;this.isFlashEnabled=false;this.controls;this.theEvent;this.controllerId;this.sendVisit;this.layerTitle;this.layerSocial;this.module;this.config=config;if(typeof this.config.default_volume!='undefined'){this.volume=config.default_volume}else{this.volume=50;}
this.seeking=false;this.EVENT_TYPES={START:1,FIRSTQUARTILE:2,MIDPOINT:3,THIRDQUERTILE:4,COMPLETE:5,LOAD:6,SEND_MAIL:7,SHARE_TWITTER:8,SHARE_FACEBOOK:9,SHARE_LINKEDIN:10,CLICK_THRU:11,SHARE_GPLUS:12,MUTE:30,UNMUTE:31,FULLSCREEN:32,PAUSE:33,RESUME:34};this.isLike=false;this.lastState="";this.statePlayer="standby";this.isOpenTwitter=false;this.skipoffset=0;}
VideoController.prototype.initializePlayer=function(controllerId){var _this=this;this.sendVisit=new SendVisitComponent(isFlashEnabled,this.config);this.sendVisit.playlistId=controllerId;this.sendVisit.sendVisitLoadPlayer(this.videoData,this.EVENT_TYPES.LOAD);this.controls=new ControlsComponent(this.containerPlayerDiv,this.config,controllerId);this.layerTitle=new DisplayComponent(this.containerPlayerDiv,this.videoData.isPlayerAudio(),this.config,controllerId);this.layerSocial=new SocialNetworkComponent(this.containerPlayerDiv,this.config);this.controls.createControls(this.videoData.isPlayerAudio());this.layerTitle.create(this.videoData.getUrlCrop(),this.videoData.getTitle(),this.videoData.getDescription());this.layerTitle.showTitleDesc(this.videoData.showTitleDesc());this.controls.setTitle(this.videoData.getTitle());this.controls.setIntroduction(this.videoData.getIntroduction());this.layerSocial.create(this.videoData);if(this.videoData.getTotalVideoContent()>1&&this.config.isLive==false){this.controls.displayListInfo(true);this.controls.setListInfo(this.videoData.getIndexContent(),this.videoData.getTotalVideoContent());if(this.config.playerType==4){this.playListComp=new PlayListHComponent(this.containerPlayerDiv,this.config,controllerId);this.playListComp.create(this.videoData.getContentItems(),this.videoData.getChannelName());this.playListComp.setVideoData(this.videoData.getTitle(),this.videoData.getDescription());this.playListComp.theEvent.subscribe(function(sender,eventArgs){_this.playListEvent(sender.controllerId,eventArgs.message);});}else if(this.config.playerType==1){this.playListComp=new PlayListVComponent(this.containerPlayerDiv,this.config,controllerId);this.playListComp.create(this.videoData.getContentItems(),this.videoData.getChannelName());this.playListComp.setVideoData(this.videoData.getTitle(),this.videoData.getDescription());this.playListComp.theEvent.subscribe(function(sender,eventArgs){_this.playListEvent(sender.controllerId,eventArgs.message);});}}else{this.controls.displayListInfo(false);}
_this.controls.theEvent.subscribe(function(sender,eventArgs){_this.controlsEvent(sender.controllerId,eventArgs.message);});_this.layerSocial.theEvent.subscribe(function(sender,eventArgs){_this.controlsEvent(sender.controllerId,eventArgs.message);});_this.layerTitle.theEvent.subscribe(function(sender,eventArgs){_this.controlsEvent(sender.controllerId,eventArgs.message);});if(!detectAndroid())this.controls.displayControls(this.config.showRadioFormat);if(this.videoData.getItemSelected()==undefined)msj="data_failed";if(this.config.autoPlay&&this.config.autoPlay==true)this.play();if(this.config.ytAccounting){var indice_yt=this.videoData.getIndexForYTVideoContent(this.videoData.indexSelected,true);if(indice_yt>-1){this.videoData.goToIndex(indice_yt,false);this.play();this.layerTitle.displayPlayButton(false);}}
if(typeof this.config.twitter_search!='undefined'&&this.config.twitter_search!=''){if(typeof this.twComp=='undefined'){this.twComp=new TLTwitterComponent('#sc_container_'+this.controllerId,this.config.twitter_search);this.twComp.theEvent.subscribe(function(sender,eventArgs){_this.twitterEvent(sender.controllerId,eventArgs.message);});}
this.twComp.loadTwitterButton(this.config.twitter_search);}
this.activateListeners(this.controllerId);}
VideoController.prototype.loadData=function(url,controllerId,isFlashEnabled,callBackDataLoaded){var msj="";this.statePlayer="standby"
var _this=this;this.controllerId=controllerId;this.theEvent=this.CustomEvent("OnVideoControllerEvent");if(this.config.dataType=='json'){this.videoData=new VideoDataJSON(!this.config.isAdminType);}else{this.videoData=new VideoData();}
this.isFlashEnabled=isFlashEnabled;this.containerPlayerDiv='#container_player_'+controllerId;this.videoData.isFlashEnabled=isFlashEnabled;if(typeof url!='undefined'&&url!=''){this.videoData.load(url,controllerId,function(data,message){switch(message){case"success":msj="data_loaded";_this.initializePlayer(controllerId);break;case"error":msj="data_failed";break;}
callBackDataLoaded(data,msj);});}else{var playerDiv='player_'+controllerId;urlVideoAd=jQuery('#'+playerDiv).attr('data-simple-url-ad');urlVideoContent=jQuery('#'+playerDiv).attr('data-simple-url-content');if(typeof urlVideoAd!='undefined'&&urlVideoAd!=""){_this.videoData.id=controllerId;_this.videoData.playList.push(_this.videoData.createItemPlayList(controllerId,urlVideoAd,true,'intext','','','Publicidad','','',null,"video/mp4",0,0,new Array(),false));}
if(typeof urlVideoContent!='undefined'&&urlVideoContent!=""){_this.videoData.id=controllerId;_this.videoData.playList.push(_this.videoData.createItemPlayList(controllerId,urlVideoContent,false,'content','','','','','',null,"video/mp4",0,0,new Array(),false));}
if(_this.videoData.playList.length>0){msj="data_loaded";_this.initializePlayer(controllerId);}else{msj="data_failed";}
callBackDataLoaded(controllerId,msj);}}
VideoController.prototype.twitterEvent=function(controllerId,message){var _this=this;switch(message[0]){case"openTwitter":if(_this.pl)_this.pl.resize();this.isOpenTwitter=true;break;case"closeTwitter":if(_this.pl)_this.pl.resize();this.isOpenTwitter=false;this.removeTwitter();break;}
this.dispatchEvent(message[0]);}
VideoController.prototype.playListEvent=function(controllerId,message){var _this=this;switch(message[0]){case"itemSelected":try{this.layerTitle.displayLoading(true);this.removePlayer();this.goToIndex(this.videoData.getPubliByIndex(message[1]));if(this.endControls)this.endControls.hide();}catch(error){console.log("no se ha podido cambiar de video");}
break;}}
VideoController.prototype.controlsEvent=function(controllerId,message){var _this=this;switch(message[0]){case"onclickplay":if(!detectmob()){this.layerTitle.displayLoading(true);}
if(this.pl){if(this.pl.paused){this.pl.play();}else{this.pause();}}else{this.play();}
break;case"onclickpause":this.pause();break;case"onclickseek":this.seekTo(message[1]);if(this.pl.paused==false)
this.layerTitle.displayLoading(true);break;case"onclickvolume":this.setVolume(message[1]);break;case"onclickmute":this.setVolume(message[1]);if(this.sendVisit)this.sendVisit.addEvent(this.EVENT_TYPES.MUTE);break;case"onclickunmute":if(this.sendVisit)this.sendVisit.addEvent(this.EVENT_TYPES.UNMUTE);this.setVolume(message[1]);break;case"onclickvolmax":this.setVolume(message[1]);break;case"onclickfullscreen":if(!inFullScreen&&this.sendVisit)this.sendVisit.addEvent(this.EVENT_TYPES.FULLSCREEN);toggleFullScreen(message[1]);break;case"onclickvotar":if(typeof this.module!="undefined"){this.module.remove();}
this.module=new RatingComponent(this.containerPlayerDiv);this.module.create();this.module.theEvent.subscribe(function(sender,eventArgs){_this.onModuleEvent(sender.idComponent,eventArgs.message);});break;case"onclickembed":if(typeof this.module!="undefined"){this.module.remove();}
this.contract(false);this.module=new EmbedComponent(this.containerPlayerDiv);this.module.create(this.videoData.getServices().embed,this.videoData.getItemSelected().urlDownload);this.module.theEvent.subscribe(function(sender,eventArgs){_this.onModuleEvent(sender.idComponent,eventArgs.message);});break;case"onclickcensor":if(typeof this.module!="undefined"){this.module.remove();}
this.module=new CensorComponent(this.containerPlayerDiv);this.module.create(this.videoData);this.module.theEvent.subscribe(function(sender,eventArgs){_this.onModuleEvent(sender.idComponent,eventArgs.message);});break;case"onclickcompartir":if(typeof this.module!="undefined"){this.module.remove();}
this.module=new ShareComponent(this.containerPlayerDiv);this.module.create();this.module.theEvent.subscribe(function(sender,eventArgs){_this.onModuleEvent(sender.idComponent,eventArgs.message);});break;case"onclickcompartirtabs":if(this.layerSocial!=null){this.layerSocial.showCenterButtons();}
break;case"onclickopencompartirtabs":if(typeof this.module!="undefined"){this.module.remove();}
this.module=new ShareTabsComponent(this.containerPlayerDiv);this.module.create(this.videoData);this.module.theEvent.subscribe(function(sender,eventArgs){_this.onModuleEvent(sender.idComponent,eventArgs.message);});break;case"onclicktoshareurl":var titulos=this.videoData.playList[this.videoData.getIndexCurrentVideoContent()].title;titulos=titulos.replace(/\;/g,escape(';'));titulos=titulos.replace(/\&/g,escape('&'));var urlToShare=message[1];var urlPage=this.videoData.playList[this.videoData.getIndexCurrentVideoContent()].urlToShare;if(this.config.shareRefererPage==true){urlPage=scgp_getRefererPage();}
urlToShare=urlToShare.replace(/\%url\%/g,escape(urlPage));urlToShare=urlToShare.replace(/\%title\%/g,titulos);urlToShare=urlToShare.replace(/\%description\%/g,escape(this.videoData.playList[this.videoData.getIndexCurrentVideoContent()].description));urlToShare=urlToShare.replace(/\%image\%/g,escape(this.videoData.playList[this.videoData.getIndexCurrentVideoContent()].picture));switch(message[2]){case"googleplus":this.sendVisit.addEvent(this.EVENT_TYPES.SHARE_GPLUS);break;case"linkedin":this.sendVisit.addEvent(this.EVENT_TYPES.SHARE_LINKEDIN);break;case"twitter":this.sendVisit.addEvent(this.EVENT_TYPES.SHARE_TWITTER);break;case"facebook":this.sendVisit.addEvent(this.EVENT_TYPES.SHARE_FACEBOOK);break;}
window.open(urlToShare);break;case"onclickconfig":if(typeof this.module!="undefined"){this.module.remove();}
this.module=new ConfigComponent(this.containerPlayerDiv,this.parseQualities(this.pl.getAvailableQualityLevels()));this.module.create(this.pl.getPlaybackQuality());this.module.theEvent.subscribe(function(sender,eventArgs){_this.onModuleEvent(sender.idComponent,eventArgs.message);});break;case"onclickenviar":if(typeof this.module!="undefined"){this.module.remove();}
this.module=new SendVideoComponent(this.containerPlayerDiv);this.module.create(this.videoData);this.module.theEvent.subscribe(function(sender,eventArgs){_this.onModuleEvent(sender.idComponent,eventArgs.message);});break;case"onclicklike":if(typeof this.module!="undefined"){this.module.remove();}
this.module=new LikeComponent(this.containerPlayerDiv);this.module.create();this.module.theEvent.subscribe(function(sender,eventArgs){_this.onModuleEvent(sender.idComponent,eventArgs.message);});this.module.sendLike(this.videoData,this.isFlashEnabled);break;case"onclicknext":try{if(typeof message[1]!='undefined'&&message[1]=='display'){if(scgp_isFlashEnabled()){if(this.pl instanceof FlashAdPlayer)
this.pl.fireTrackers();}else{this.videoData.getItemSelected().vast.throwTrackingsByType('skip');}}}catch(error){console.log("no se ha podido enviar el track de skipad "+error);}
this.playNextItem();break;case"onclickad":this.openAd();break;case"onclickprevious":this.playPreviousItem();break;case"onclickreplay":this.play();break;case"onclicktitle":if(this.videoData.getItemSelected().isYT){this.pause();window.open('https://www.youtube.com/watch?v='+this.videoData.getItemSelected().srcYT);}}}
VideoController.prototype.openAd=function(){try{if(this.videoData.getItemSelected().isPubli){if(this.pl instanceof NativePlayer){if(this.pl.paused){this.pl.play();}else{this.pl.pause();window.open(this.videoData.getItemSelected().vast.getClickThrough());this.videoData.getItemSelected().vast.throwClickTrackings();}}else{window.open(this.pl.getUrlClick());}
this.sendVisit.addEvent(this.EVENT_TYPES.CLICK_THRU);}}catch(error){console.log("no se ha podido abrir la página del anunciante");}}
VideoController.prototype.pause=function(){if(this.pl&&!this.pl.paused)
this.pl.pause();this.statePlayer="pause";}
VideoController.prototype.play=function(){if(this.pl&&this.pl.paused){this.playVideo();}
else{this.createPlayer();}
this.statePlayer="play";}
VideoController.prototype.seekTo=function(percent){if(this.pl){this.seeking=true;this.pl.seekTo(percent);}
this.statePlayer="seek";}
VideoController.prototype.setVolume=function(percent){this.volume=percent;if(this.pl)
this.pl.setVolume(percent);}
var event_previou;VideoController.prototype.createPlayer=function(){var _this=this;if(typeof this.videoData.getItemSelected()!='undefined'){if(this.videoData.getItemSelected().isYT){this.removePlayer(this.videoData.getId());this.pl=new YoutubePlayer(this.videoData.getId());if(this.pl.createPlayer(this.containerPlayerDiv,this.videoData.getItemSelected(),this.config)){this.pl.theEvent.subscribe(function(sender,eventArgs){_this.onPlayStatusEvent(sender.id,eventArgs.message);});this.layerTitle.displayLoading(false);}else{console.log("es un video de directo y no tiene acceso");this.dispatchEvent(["error"]);}}else if(this.videoData.getItemSelected().isVimeo){this.removePlayer(this.videoData.getId());this.pl=new VimeoPlayer(this.videoData.getId());this.pl.createPlayer(this.containerPlayerDiv,this.videoData.getItemSelected());this.pl.theEvent.subscribe(function(sender,eventArgs){_this.onPlayStatusEvent(sender.id,eventArgs.message);});this.layerTitle.displayLoading(false);}else{if((this.videoData.getItemSelected().src=="")&&(this.videoData.getItemSelected().isPubli)){if(this.isFlashEnabled){this.removePlayer(this.videoData.getId());this.pl=new FlashAdPlayer(this.videoData.getId());this.pl.createPlayer(this.containerPlayerDiv,this.videoData.getItemSelected());this.pl.theEvent.subscribe(function(sender,eventArgs){_this.onPlayStatusEvent(sender.id,eventArgs.message);});setTimeout(function(){try{_this.pl.play();}catch(error){return;}},2000);}else{this.pl=new NativePlayer(this.videoData.getId(),this.videoData.getItemSelected().vast);this.pl.createPlayer(this.containerPlayerDiv,this.videoData.getItemSelected(),this.videoData.getTimeToCloseConnection(),this.config.ratio);this.getPreroll(this.videoData.getId());}}else{if(!(this.videoData.pl instanceof NativePlayer)){if(this.isFlashEnabled){this.removePlayer(this.videoData.getId());this.pl=new FlashPlayer(this.videoData.getId(),this.config.delay_change_stream);}else{if(!this.pl instanceof NativePlayer){this.removePlayer(this.videoData.getId());}else if(this.pl instanceof YoutubePlayer){this.removePlayer(this.videoData.getId());}
this.pl=new NativePlayer(this.videoData.getId(),this.videoData.getItemSelected().vast);}}
this.pl.createPlayer(this.containerPlayerDiv,this.videoData.getItemSelected(),this.videoData.getTimeToCloseConnection(),this.config.ratio);this.pl.theEvent.subscribe(function(sender,eventArgs){if(event_previou!=eventArgs.message[0]||eventArgs.message[0]=="time"){_this.onPlayStatusEvent(sender.id,eventArgs.message);}
event_previou=eventArgs.message[0];});if(!detectWebBrowserAndroid()){this.pl.showControls(detectAndroid());if(!detectmob()){this.pl.play();}else{if(this.videoData.getItemSelected().isPubli==false){setTimeout(function(){_this.pl.play();},1000);}}}}}}}
VideoController.prototype.onPlayStatusEvent=function(videoId,status){switch(status[0]){case"buffering":this.layerTitle.displayLoading(true);case"suspend":break;case"startPreroll":if(this.videoData.indexSelected!=this.videoData.getPubliByIndex(this.videoData.indexSelected)){this.goToIndex(this.videoData.getPubliByIndex(this.videoData.indexSelected));}else{if(this.sendVisit)this.sendVisit.sendVisitByType(this.videoData,this.EVENT_TYPES.START);this.controls.displayControls(true);}
break;case"start":this.contract(this.videoData.isItemAudioSelected());this.controls.setTitle(this.videoData.getItemSelected().title);this.controls.setListInfo(this.videoData.getIndexContent(),this.videoData.getTotalVideoContent());this.controls.displayPause(true);this.controls.loadingDuration();this.layerTitle.displayCrop(false);this.layerTitle.setTitle(this.videoData.getItemSelected().title);this.layerTitle.displayLoading(false);this.layerTitle.displayPlayButton(false);if(this.videoData.getItemSelected().trackInfo){this.trackInfo=new InfoTrackComponent(this.containerPlayerDiv,this.videoData.getItemSelected().trackInfo);this.trackInfo.create();}
this.getLike();this.controls.setVolume(this.volume);this.pl.setVolume(this.volume);isFirstTime=true;this.controls.showControls();this.controls.displayControls(!this.videoData.getItemSelected().isPubli);this.layerTitle.displayTitle(!this.videoData.getItemSelected().isPubli);if(this.videoData.getItemSelected().vast)
this.videoData.getItemSelected().vast.throwStartImpressions();if(this.videoData.getItemSelected().isPubli){this.layerTitle.updateLabelSkipAd(this.videoData.getItemSelected().typeContent)
this.layerTitle.setLabel(this.pl.getAdText(this.videoData.getItemSelected().vast));this.layerSocial.hideButtons();var _this=this;if(typeof this.pl!='undefined'&&this.pl.getAdTwitter()!=''){if(typeof this.twComp=='undefined'){this.twComp=new TLTwitterComponent('#sc_container_'+this.controllerId);this.twComp.theEvent.subscribe(function(sender,eventArgs){_this.twitterEvent(sender.controllerId,eventArgs.message);});}
this.twComp.loadTwitterButton(this.pl.getAdTwitter());}
if(typeof this.pl!='undefined'&&this.pl.getAdMute()){this.pl.setVolume(0);}
this.videoData.getItemSelected().idCampaing=this.pl.getIdCampaing(this.videoData.getItemSelected().vast);this.layerTitle.displayPlayingRadio(false);this.controls.displayControls(false);this.sendImpression();}else{this.layerTitle.displayCoverAd(false);this.layerSocial.showButtons();if(this.config.showRadioFormat&&this.config.showRadioFormat==true){this.layerTitle.displayPlayingRadio(false);}else{if(this.videoData.isPlayerAudio()){var slid=this.videoData.getSlider();if(slid.length>0){var slidComp=new SliderComponent(this.containerPlayerDiv);slidComp.create(slid);}
this.layerTitle.displayPlayingRadio(true);}}
this.controls.displayControls(true);}
if(this.lastState!="start"){if(this.sendVisit){this.sendVisit.sendVisitByType(this.videoData,this.EVENT_TYPES.START);}
this.lastState="start";}
if(this.pl.getAvailableQualityLevels().length>0&&this.config.configuration){this.controls.displayButton(".gp-configuration",true);}else{this.controls.displayButton(".gp-configuration",false);}
this.dispatchEvent(["start"]);break;case"end":var _this=this;this.layerTitle.displayLoading(!this.videoData.isLastItem());this.controls.setTitle("");this.controls.displayControls(false);this.layerTitle.displayTitle(false);this.layerTitle.displayPlayingRadio(false);this.layerTitle.displayCrop(true);if(this.videoData.getItemSelected().vast)
this.videoData.getItemSelected().vast.throwCompleteImpressions();if(this.sendVisit&&status[1]>0&&status[2]>0){this.sendVisit.addEvent(this.EVENT_TYPES.COMPLETE);}
if(this.videoData.isLastItem()&&this.videoData.getItemSelected().typeContent==this.videoData.contentType.CONTENT_TYPE_INTEXT){_this.playNextItem();}else{setTimeout(function(){_this.playNextItem()},300);}
this.removeTwitter();break;case"error":this.layerTitle.displayPlayButton(false);this.controls.displayControls(false);this.layerTitle.displayTitle(false);this.layerTitle.displayPlayingRadio(false);this.dispatchEvent(["error"]);if(this.videoData.getItemSelected().isPubli){try{this.sendVastError(this.videoData.getItemSelected().vast.timestamp,"el video no se puede reproducir ",this.videoData.getItemSelected().vast.url)}catch(error){console.log("error---"+error.toString());}}
break;case"click":if(this.videoData.getItemSelected().isPubli){this.play();}
break;case"paused":if(this.sendVisit)this.sendVisit.addEvent(this.EVENT_TYPES.PAUSE);this.lastState="paused";this.layerTitle.displayLoading(false);this.controls.displayPause(false);this.layerTitle.displayPlayingRadio(false);if(this.trackInfo){this.trackInfo.desactivateInterval();}
if(this.videoData.getItemSelected().vast)
this.videoData.getItemSelected().vast.throwTrackingsByType('pause');this.dispatchEvent(["paused"]);break;case"playing":if(this.lastState=="paused"){if(this.sendVisit)this.sendVisit.addEvent(this.EVENT_TYPES.RESUME);if(this.videoData.getItemSelected().vast)
this.videoData.getItemSelected().vast.throwTrackingsByType('resume');}
this.lastState="";if(this.videoData.getItemSelected().isPubli){this.layerTitle.displayCoverAd(true);}else{this.controls.displayControls(true);this.layerTitle.displayTitle(true);}
this.layerTitle.displayLoading(false);this.controls.displayPause(!this.pl.paused);this.layerTitle.displayPlayButton(false);if(!this.videoData.getItemSelected().isPubli){if(this.config.showRadioFormat&&this.config.showRadioFormat==true){this.layerTitle.displayPlayingRadio(false);}else{this.layerTitle.displayPlayingRadio(true);}}
if(this.trackInfo){this.trackInfo.activateInterval();}
this.dispatchEvent(["playing"]);break;case"loadeddata":this.layerTitle.displayLoading(false);this.layerTitle.displayPlayButton(false);this.controls.setTitle(this.videoData.getItemSelected().title);this.controls.setDuration(status[2]);if(this.videoData.getItemSelected().isPubli){if((typeof this.pl.getSkipoffset()!='undefined')&&(this.pl.getSkipoffset()!=null)&&(this.pl.getSkipoffset()!="")){this.skipoffset=scgp_formatSkipAd(this.pl.getSkipoffset(),parseInt(status[2]));}else{this.skipoffset=this.pl.getSkipAd();}}else{this.skipoffset=0;}
this.controls.setCurrentTime(status[1]);this.dispatchEvent(["loadeddata"]);break;case"time":this.controls.setCurrentTime(status[1]);if(this.seeking==true){this.layerTitle.displayLoading(false);this.seeking=false;}
if(status[2]&&status[2]>0){this.controls.setDuration(status[2]);this.layerTitle.setRemainingTime(status[2]-status[1]);}
var percent=this.percentPlayback(status[1],status[2]);if(percent>=25&&this.firstQuartileReached==false)
{this.firstQuartileReached=true;if(this.videoData.getItemSelected().vast){this.videoData.getItemSelected().vast.throwTrackingsByType('firstQuartile');}
if(this.sendVisit)this.sendVisit.addEvent(this.EVENT_TYPES.FIRSTQUARTILE);}
else if(percent>=50&&this.midpointReached==false)
{this.midpointReached=true;if(this.videoData.getItemSelected().vast){this.videoData.getItemSelected().vast.throwTrackingsByType('midpoint');}
if(this.sendVisit)this.sendVisit.addEvent(this.EVENT_TYPES.MIDPOINT);}
else if(percent>=75&&this.thirdQuartileReached==false)
{this.thirdQuartileReached=true;if(this.videoData.getItemSelected().vast){this.videoData.getItemSelected().vast.throwTrackingsByType('thirdQuartile');}
if(this.sendVisit)this.sendVisit.addEvent(this.EVENT_TYPES.THIRDQUERTILE);}
if(this.videoData.getItemSelected().isPubli&&this.skipoffset>0&&(status[1]>this.skipoffset)&&this.skipAdReached==false){this.skipAdReached=true;this.layerTitle.displaySkipAd(true);this.dispatchEvent(["showButtonAd"]);}
if(this.videoData.getItemSelected().isPubli&&status[1]>0&&status[1]>(status[2]-2)&&this.coverAdHideReached==false){this.coverAdHideReached=true;this.layerTitle.displayCoverAd(false);}
this.dispatchEvent(["time"]);break;case"onQualityChange":break;}}
VideoController.prototype.percentPlayback=function(currentTime,duration)
{if(duration>0)
{return duration>0?parseInt(100*currentTime/duration):0;}else{return 0;}}
VideoController.prototype.removePlayer=function(videoId){if(this.pl){this.pl.removePlayer();this.pl=undefined;}}
VideoController.prototype.playVideo=function(){if(this.pl&&this.pl.paused){this.pl.play();}}
VideoController.prototype.playNextItem=function(){this.removeTwitter();var _this=this;if(this.sendVisit.finishRec(this.videoData));this.resetDataPlayer();var id=this.videoData.getItemSelected().id;if(this.videoData.setNextItem()){this.dispatchEvent(["end"]);_this.lastState="";if(_this.config.ytAccounting){if(!this.videoData.getItemSelected().isPubli){var indice_yt=_this.videoData.getIndexForYTVideoContent(_this.videoData.indexSelected,_this.videoData.getItemSelected().activateAccounting);if(indice_yt>-1&&indice_yt!=_this.videoData.indexSelected){_this.videoData.goToIndex(indice_yt,false);_this.lastState="start";}}}
_this.play();if(this.playListComp)this.playListComp.setVideoData(this.videoData.playList[this.videoData.getIndexCurrentVideoContent()].title,this.videoData.playList[this.videoData.getIndexCurrentVideoContent()].description);}else{this.dispatchEvent(["endOfReproduction"]);this.removePlayer(id);if(this.videoData.getVideoRelated().length==4){this.endControls=new RelatedVideoComponent(this.containerPlayerDiv,this.videoData.getVideoRelated());this.endControls.create();this.endControls.theEvent.subscribe(function(sender,eventArgs){_this.controlsEvent(sender.idComponent,eventArgs.message);});}else{this.endControls=new EndVideoComponent(this.containerPlayerDiv,this.config);this.endControls.create();this.endControls.theEvent.subscribe(function(sender,eventArgs){_this.controlsEvent(sender.idComponent,eventArgs.message);});}
if(this.playListComp)this.playListComp.setVideoData(this.videoData.getTitle(),this.videoData.getDescription());this.layerTitle.displayLoading(false);this.controls.displayControls(false);this.layerTitle.displayTitle(false);this.statePlayer="standby";}}
VideoController.prototype.goToIndex=function(index){var _this=this;if(this.sendVisit.finishRec(this.videoData));if(this.videoData.goToIndex(index)){if(this.playListComp)this.playListComp.setVideoData(this.videoData.playList[this.videoData.getIndexCurrentVideoContent()].title,this.videoData.playList[this.videoData.getIndexCurrentVideoContent()].description);this.dispatchEvent(["end"]);this.play();}}
VideoController.prototype.onModuleEvent=function(videoId,status){try{switch(status[0]){case"close":if(status[1]&&status[1]=="endvideo"){this.play();}
this.contract(true);this.module.remove();this.module=undefined;if(this.endControls!=null&&typeof this.endControls!='undefined'){this.endControls.show();}
break;case"qualitySelected":this.pl.setPlaybackQuality(status[2]);break;case"success":if(status[1]&&status[1]=="like"){var numVotos=0;if(status[2]){numVotos=status[2].data.num_valuations;if(status[2].error==1){this.isLike=true;this.controls.activateLike(true);}else{this.controls.activateLike(false);}}}
break;case"failed":if(status[1]&&status[1]=="like"){var numVotos=0;if(status[2])numVotos=status[2].data.num_valuations;this.controls.activateLike(false);}
break;}}catch(error){}}
VideoController.prototype.playPreviousItem=function(){this.resetDataPlayer();if(this.sendVisit.finishRec(this.videoData));var id=this.videoData.getItemSelected().id;if(this.videoData.setPreviousItem()){this.dispatchEvent(["end"]);if(this.pl.theEvent)this.pl.theEvent.unsubscribe();if(this.playListComp)this.playListComp.setVideoData(this.videoData.playList[this.videoData.getIndexCurrentVideoContent()].title,this.videoData.playList[this.videoData.getIndexCurrentVideoContent()].description);this.play();}else{this.removePlayer(id);this.dispatchEvent(["endOfReproduction"]);}}
VideoController.prototype.resetDataPlayer=function(){this.pl.removePlayer();if(this.controls)this.controls.resetValues();this.resetTrackingVariables();if(this.pl)this.pl.isMuted(false);}
VideoController.prototype.resetTrackingVariables=function(){this.completeReached=false;this.impressionsReached=false;this.firstQuartileReached=false;this.midpointReached=false;this.thirdQuartileReached=false;this.metadataLoaded=false;this.skipAdReached=false;this.coverAdHideReached=false;clearInterval(this.intervalTime);}
VideoController.prototype.getUrlCrop=function(){return this.videoData.getUrlCrop();}
VideoController.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
VideoController.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});}
VideoController.prototype.getPreroll=function(videoId){var _this=this;var vastData=new VastData();vastData.load(videoId,this.videoData.getItemSelected().srcPubli,function(videoId,status,vast){switch(status){case"vastLoaded":_this.videoData.getItemSelected().vast=vast;_this.videoData.getItemSelected().src=vast.getMedia();_this.videoData.getItemSelected().urlClick=vast.getClickThrough();_this.videoData.getItemSelected().idCampaing=vast.getCompaingId();_this.videoData.getItemSelected().skipAd=vast.getSkipAd();_this.videoData.getItemSelected().isYT=(_this.videoData.getCodeTY(_this.videoData.getItemSelected().src)=="")?false:true;_this.videoData.getItemSelected().srcYT=_this.videoData.getCodeTY(_this.videoData.getItemSelected().src);if(_this.videoData.getItemSelected().src!=""){_this.createPlayer();}else{_this.playNextItem();}
break;case"vastError":_this.sendVastError(vast.timestamp,vast.errorMsj,vast.url)
_this.getNextAdServer(videoId);break;default:break;}});}
VideoController.prototype.sendVastError=function(identificador,error,url){var urlService="http://frontal.idsp.smartycenter.com/save_request_error";var variables=new Object();variables.identificador=identificador;variables.error=error;variables.url=url;if((url.lastIndexOf('frontal.idsp.smartycenter.com')>0)&&(error.lastIndexOf('<img src="http://widget.smartycenter.com/img/1pxtrans.gif" class="emptyGif" width="1" height="1" border="0">')==0)){$.ajax({async:true,type:"POST",url:urlService,data:variables,dataType:'json',success:function(data){console.log("se ha enviado el error de VAST "+data);},error:function(xhr,ajaxOptions,thrownError){}});}}
VideoController.prototype.getNextAdServer=function(videoId){numServers=0;if(this.videoData.getItemSelected().servers&&this.videoData.getItemSelected().servers.length){numServers=this.videoData.getItemSelected().servers.length;}
if(this.videoData.getItemSelected().indexServerSelected<numServers-1){this.videoData.getItemSelected().indexServerSelected++;this.videoData.getItemSelected().srcPubli=this.videoData.getItemSelected().servers[this.videoData.getItemSelected().indexServerSelected].url;this.videoData.getItemSelected().adServerId=this.videoData.getItemSelected().servers[this.videoData.getItemSelected().indexServerSelected].adserverId;this.getPreroll(videoId);}else{this.playNextItem(videoId);}}
VideoController.prototype.parseQualities=function(qualities){var result=new Array;var obj;for(var i=0;i<qualities.length;i++){obj=new Object();obj.value=qualities[i];obj.text=qualities[i];result.push(obj);}
return result;}
VideoController.prototype.getLike=function(){}
VideoController.prototype.sendImpression=function(){try{if(typeof this.videoData.getItemSelected().servers[0].url_impression!='undefined'){jQuery('body').append('<img id="impresion" src="'+this.videoData.getItemSelected().servers[0].url_impression+'" style="display:none;"></img>');}}catch(error){}}
VideoController.prototype.contract=function(isContract){try{var alto=this.controls.getHeight();var altoVideo=parseInt(jQuery(this.containerPlayerDiv).width()*(9/16));if(this.config.showRadioFormat&&this.config.showRadioFormat==true){if(isContract==true){jQuery(this.containerPlayerDiv).animate({height:alto},500);}else{jQuery(this.containerPlayerDiv).animate({height:altoVideo},500);}}}catch(error){}}
VideoController.prototype.showContractView=function(isContract){try{var alto=this.controls.getHeight();var altoVideo=jQuery(this.containerPlayerDiv).width()*(9/16);this.contract(true);}catch(error){}}
VideoController.prototype.isTwitterOpen=function(isContract){return this.isOpenTwitter;}
VideoController.prototype.activateListeners=function(controllerId){var containerPlayerDiv='#container_player_'+controllerId;var _this=this;if(this.videoData.isPlayerAudio()){this.controls.showControls();}else{jQuery(containerPlayerDiv).on('mouseleave',function(e){_this.controls.hideControls();_this.layerSocial.hideButtons();_this.layerTitle.hideTitle();});if(!detectWebBrowserAndroid()){jQuery(containerPlayerDiv).on('mouseenter',function(e){if(!detectIpad()){_this.layerSocial.initStateButtons();_this.controls.showControls();if(!_this.videoData.getItemSelected().isPubli||_this.statePlayer=="standby"){if(!detectIpad())
_this.layerSocial.showButtons();}
_this.layerTitle.showTitle();}
if(_this.videoData.getItemSelected().typeContent==_this.videoData.contentType.CONTENT_TYPE_INTEXT&&typeof _this.pl!='undefined'){_this.pl.setVolume(_this.volume);setTimeout(function(){jQuery(containerPlayerDiv+'>#coverenter').remove();},2000);}});}
var activate=false;var timeoutmousemov;jQuery(containerPlayerDiv).on('mousemove',function(event){clearTimeout(timeoutmousemov);timeoutmousemov=setTimeout(function(){if(typeof inFullScreen!='undefined'&&inFullScreen==true){_this.controls.hideControls();_this.layerSocial.hideButtons();_this.layerTitle.hideTitle();}
activate=true;},2000);if(activate==true){if(!detectIpad()){_this.layerSocial.initStateButtons();_this.controls.showControls();if(!_this.videoData.getItemSelected().isPubli||_this.statePlayer=="standby"){if(!detectIpad())
_this.layerSocial.showButtons();}
_this.layerTitle.showTitle();}
activate=false;}});}
if(_this.videoData.getItemSelected().typeContent==_this.videoData.contentType.CONTENT_TYPE_INTEXT){jQuery(containerPlayerDiv).prepend('<div id="coverenter" style="width:100%;height:100%;position: absolute;opacity: 1;z-index: 9999;"></div>');}}
VideoController.prototype.removeTwitter=function(){if(this.twComp&&this.isOpenTwitter==false){if(typeof this.config.twitter_search=='undefined'||this.config.twitter_search==''){this.twComp.remove();this.twComp=null;}else{this.twComp.loadTwitterButton(this.config.twitter_search);}}}
function requestFullScreen(divObj){var jObj=jQuery(divObj).find('video');if(jObj.length==0){jObj=jQuery(divObj).find('iframe');}
if(jObj.length>0){if(jObj[0].webkitRequestFullScreen){if(navigator.userAgent.match(/Safari/i)){jObj[0].webkitRequestFullScreen();}else{jObj[0].webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);}}else if(jObj[0].webkitSupportsFullscreen){jObj[0].webkitEnterFullscreen();}else{}}}
var inFullScreen=false;var actual_index=30;function toggleFullScreen(idComponent){if(navigator.userAgent.match(/iPad/i)){requestFullScreen(jQuery(idComponent));}else if((document.fullScreenElement&&document.fullScreenElement!==null)||(!document.mozFullScreen&&!document.webkitIsFullScreen&&!document.msFullscreenElement&&!document.requestFullScreen)){if(document.documentElement.requestFullScreen){document.documentElement.requestFullScreen();}else if(document.documentElement.msRequestFullscreen){document.documentElement.msRequestFullscreen();}else if(document.documentElement.mozRequestFullScreen){document.documentElement.mozRequestFullScreen();}else if(document.documentElement.webkitRequestFullScreen){if(navigator.userAgent.match(/Safari/i)){document.documentElement.webkitRequestFullScreen();}else{document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);}}
actual_index=parseInt(jQuery(idComponent).parent().parent().css('z-index'));jQuery(idComponent).parent().parent().css('z-index',(actual_index+1));inFullScreen=true;}else{if(document.cancelFullScreen){document.cancelFullScreen();}else if(document.msExitFullscreen){document.msExitFullscreen();}else if(document.mozCancelFullScreen){document.mozCancelFullScreen();}else if(document.webkitCancelFullScreen){document.webkitCancelFullScreen();}
jQuery('.timeline-item-post-media').css('z-index',actual_index);inFullScreen=false;}
(inFullScreen)?jQuery('div[class*=cubierta-onmove]').show():jQuery('div[class*=cubierta-onmove]').hide();};function VideoDataJSON(hasPubli){this.id=0;this.xmlDoc;this.channelName='';this.title='';this.description='';this.urlCrop='';this.xmlServices='';this.vast=null;this.playList=new Array();this.indexSelected=0;this.isFlashEnabled=false;this.skipAdRemain=10;this.identify=this.getRandomInt(0,4294967295);this.contentType={CONTENT_TYPE_CONTENT:"0",CONTENT_TYPE_PREROLL:"7",CONTENT_TYPE_POSROLL:"8",CONTENT_TYPE_OVERLAY:"9",CONTENT_TYPE_INTEXT:"15",CONTENT_TYPE_MIDROLL:"14"};this.clips=new Array();this.hasPubli=(typeof hasPubli=='undefined')?true:hasPubli;}
VideoDataJSON.prototype.getSkipAdRemain=function(){return this.skipAdRemain;}
VideoDataJSON.prototype.load=function(urlService,id,callback){this.id=id;try
{var httpRequest;if(window.XMLHttpRequest)
{httpRequest=new XMLHttpRequest();}
else if(window.ActiveXObject)
{try{httpRequest=new ActiveXObject("MSXML2.XMLHTTP");}catch(e){try{httpRequest=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!httpRequest)
{}}
catch(e)
{try{var httpRequest=new window.XMLHttpRequest();}
catch(e)
{callback(id,'error');this.xmlDoc=undefined;}}
try{httpRequest.open("GET",urlService,false);httpRequest.send();var patt1=new RegExp('\r\n','g');var patt2=new RegExp('\t','g');var mi=httpRequest.responseText;mi=mi.replace(patt1,'');mi=mi.replace(patt2,'');var myJSONText=JSON.stringify(mi);var aux=eval('('+myJSONText+')');this.xmlDoc=JSON.parse(aux);this.xmlDoc=this.xmlDoc;}catch(error){callback(id,'error');}
if(this.xmlDoc){this.createPlayList();if(this.playList.length>0){callback(id,'success');}else{callback(id,'error');}}else{callback(id,'error');}}
VideoDataJSON.prototype.getId=function(){try{return this.id;}catch(error){return"";}}
VideoDataJSON.prototype.getChannelName=function(){var result="";try{if(typeof this.xmlDoc!='undefined'&&typeof this.xmlDoc.channel!='undefined'){result=this.xmlDoc.channel;}
return result;}catch(error){return"";}}
VideoDataJSON.prototype.getTitle=function(){try{return this.xmlDoc.title;}catch(error){return"";}}
VideoDataJSON.prototype.getTrackingEventsVideoByType=function(type){var result=new Array();try{var datos=this.xmlDoc.contents.video[this.indexSelected].TrackingEvents.Tracking;if(typeof datos!='undefined'){if(Object.prototype.toString.call(datos)==='[object Array]'){for(var i=0;i<datos.length;i++){if(typeof datos[i]['@attributes'].event!='undefined'&&datos[i]['@attributes'].event==type){result.push(datos[i].url);}}}else if(Object.prototype.toString.call(datos)==='[object Object]'){if(typeof datos['@attributes'].event!='undefined'&&datos['@attributes'].event==type){result.push(datos.url);}}}
return result;}catch(error){return result;}}
VideoDataJSON.prototype.getTrackingEventsVideoContent=function(type){var result=new Array();try{var datos=this.xmlDoc.contents.video[this.getIndexCurrentVideoContent()].TrackingEvents.Tracking;if(typeof datos!='undefined'){if(Object.prototype.toString.call(datos)==='[object Array]'){for(var i=0;i<datos.length;i++){if(typeof datos[i]['@attributes'].event!='undefined'&&datos[i]['@attributes'].event==type){result.push(datos[i].url);}}}else if(Object.prototype.toString.call(datos)==='[object Object]'){if(typeof datos['@attributes'].event!='undefined'&&datos['@attributes'].event==type){result.push(datos.url);}}}
return result;}catch(error){return result;}}
VideoDataJSON.prototype.getTrackingEventsPlayerByType=function(type){var result=new Array();try{var datos=this.xmlDoc.TrackingEvents.Tracking;if(typeof datos!='undefined'){if(Object.prototype.toString.call(datos)==='[object Array]'){for(var i=0;i<datos.length;i++){if(typeof datos[i]['@attributes'].event!='undefined'&&datos[i]['@attributes'].event==type){result.push(datos[i].url);}}}else if(Object.prototype.toString.call(datos)==='[object Object]'){if(typeof datos['@attributes'].event!='undefined'&&datos['@attributes'].event==type){result.push(datos.url);}}}
return result;}catch(error){return result;}}
VideoDataJSON.prototype.getDescription=function(){try{var result="";if(isEmpty(this.xmlDoc.description)){return result;}
result=this.xmlDoc.description;return result;}catch(error){return"";}}
VideoDataJSON.prototype.showTitleDesc=function(){try{var result=false;if(isEmpty(this.xmlDoc.showTitleDesc)){return result;}
result=(this.xmlDoc.showTitleDesc==0)?false:true;return result;}catch(error){return"";}}
VideoDataJSON.prototype.getIntroduction=function(){try{return this.xmlDoc.introduction;}catch(error){return"";}}
VideoDataJSON.prototype.getUrlCrop=function(){var result="";try{if(isEmpty(this.xmlDoc.picture)){result="";}else{result=this.xmlDoc.picture;}
if(result.lastIndexOf('1pxtrans.gif')>0||result==""){var contentItems=this.getContentItems();if(contentItems.length>0){result=this.getContentItems()[0].picture;}}
return result;}catch(error){return"";}}
VideoDataJSON.prototype.getTimeToCloseConnection=function(){var result=0;try{return result;}catch(error){return 0;}}
VideoDataJSON.prototype.getServices=function(){var new_services=new Object();new_services.urlSendToFriend="";new_services.urlRating="";new_services.urlGetRating="";new_services.urlSendVisit="";new_services.urlSendComment="";new_services.urlLegalPage="";try{if(typeof this.xmlDoc.services=='undefined'){return new_services;}else{return this.xmlDoc.services;}}catch(error){return new_services;}}
VideoDataJSON.prototype.getIdenty=function(){return this.identify;}
VideoDataJSON.prototype.getAvailableQualityLevels=function(urlXML){var result=new Array;try{result=this.playList[this.indexSelected].qualities;}catch(error){return new Array();}}
VideoDataJSON.prototype.getPlayList=function(){return this.playList;}
VideoDataJSON.prototype.createPlayList=function(){this.playList=new Array();var qualities;try{var contentsXML=new Array();var xmlContent;if(typeof this.xmlDoc=='undefined'&&typeof this.xmlDoc.contents.video=='undefined'){return;}else if(Object.prototype.toString.call(this.xmlDoc.contents.video)==='[object Array]'){contentsXML=this.xmlDoc.contents.video;}else{contentsXML.push(this.xmlDoc.contents.video);}
if(contentsXML.length>0)
{eventos=new Array();}
for(var i=0;i<contentsXML.length;i++)
{xmlContent=contentsXML[i];if(xmlContent['@attributes'].type=='content'){urlVideo="";if(this.isFlashEnabled){urlVideo=xmlContent.url;}else{urlVideo=xmlContent.urlHtml;if((typeof urlVideo!="string")&&(urlVideo.length>1)){qualities=new Array;try{var obj;for(var qa=0;qa<urlVideo.length;qa++){obj=new Object();obj.value=urlVideo[qa].quality;obj.url=urlVideo[qa].url;qualities.push(obj);}}catch(error){qualities=new Array;}}}
var bannerTop="";if(xmlContent.bannerTop&&xmlContent.bannerTop.activated&&xmlContent.bannerTop.activated=='yes')
bannerTop=xmlContent.bannerTop.url;var numPlay="0";var overlay;var totalValuations=(xmlContent.valuations&&xmlContent.valuations.total)?xmlContent.valuations.total:'';var avgValuations=(xmlContent.valuations&&xmlContent.valuations.avg)?xmlContent.valuations.avg:'';if(urlVideo!=""){this.playList.push(this.createItemPlayList((xmlContent.id)?xmlContent.id:'',(typeof urlVideo!="string"&&urlVideo.length>0)?urlVideo[0].url:urlVideo.trim(),false,xmlContent['@attributes'].type,bannerTop,(typeof xmlContent.picture=='string')?xmlContent.picture.trim():'',(typeof xmlContent.title=='string')?xmlContent.title.trim():'',(typeof xmlContent.description=='string')?xmlContent.description.trim():'','',overlay,"video/theora",totalValuations,avgValuations,null,false,qualities,(xmlContent.urlToShare)?xmlContent.urlToShare.trim():''));}else{console.log("[smarty] url de vídeo vacía");}}else if(((xmlContent['@attributes'].type=='preroll')||(xmlContent['@attributes'].type=='postroll'))&&this.hasPubli){var servers=new Array();var serversXML=xmlContent.url;try{if(typeof xmlContent.url=='object'){serversXML=new Array();serversXML.push(xmlContent.url);}
for(var j=0;j<serversXML.length;j++)
{serverXML=serversXML[j];var server=new Object();server.url=serverXML.url;server.adserverId=serverXML['@attributes'].adserverId;servers.push(server);}
var numPlay=xmlContent['@attributes'].numPlay;if(numPlay!=null&&typeof numPlay!='undefined'){numPlay=parseInt(numPlay);}else{numPlay=0;}}catch(error){console.log("[VideoData] no se ha leido correctamente el adcall "+error.toString());}
if(numPlay>0&&servers.length>0){for(var ip=0;ip<numPlay;ip++){this.playList.push(this.createItemPlayList('0',(servers.length>0)?servers[0].url:'',true,xmlContent['@attributes'].type,'','','Publicidad','',(servers.length>0&&servers[0].adserverId)?servers[0].adserverId:'',null,"video/mp4",0,0,servers,false));}}}}
return this.playList;}catch(error){return this.playList;}}
VideoDataJSON.prototype.createItemPlayList=function(idVideo,urlVideo,isPubli,typeContent,top,picture,title,desc,adServerId,overlay,type,totalValuations,avgValuations,servers,isAudio,qualities,urlToShare){var obj1={id:idVideo,src:(!isPubli)?urlVideo:'',isPubli:isPubli,typeContent:this.getIdContentType(typeContent),isAudio:(isAudio=="true")?true:false,isYT:(this.getCodeTY(urlVideo)=="")?false:true,srcPubli:(isPubli)?urlVideo:'',srcYT:this.getCodeTY(urlVideo),isVimeo:(this.getCodeVimeo(urlVideo)=="")?false:true,srcVimeo:this.getCodeVimeo(urlVideo),urlClick:"",adCallTop:top,picture:picture,title:title,description:desc,idCampaing:"",skipAd:"",adServerId:adServerId,overlay:overlay,type:type,totalValuations:totalValuations,avgValuations:avgValuations,servers:servers,indexServerSelected:0,qualities:qualities,urlToShare:urlToShare};return obj1;}
VideoDataJSON.prototype.createOverlayObject=function(urlVast,urlMedia,urlClick,numPlay,adServerId){var obj1={url:urlVast,urlMedia:urlMedia,urlClick:urlClick,numPlay:numPlay,duration:1000000,campaignId:'--',adServerId:adServerId};return obj1;}
VideoDataJSON.prototype.getIdContentType=function(contentName){var result="0";switch(contentName){case"content":result=this.contentType.CONTENT_TYPE_CONTENT;break;case"preroll":result=this.contentType.CONTENT_TYPE_PREROLL;break;case"postroll":case"posroll":result=this.contentType.CONTENT_TYPE_POSROLL;break;case"intext":result=this.contentType.CONTENT_TYPE_INTEXT;break;}
return result;}
VideoDataJSON.prototype.getItemsByContent=function(idContent){var result=new Array();for(var i=0;i<this.playList.length;i++){if(this.playList[i].typeContent==this.contentType.CONTENT_TYPE_CONTENT){result.push(this.playList[i]);}}
return result;}
VideoDataJSON.prototype.getItemByIdContent=function(idContent){var result=this.createEmptyItem();for(var i=0;i<this.playList.length;i++){if((this.playList[i].typeContent==this.contentType.CONTENT_TYPE_CONTENT)&&(idContent==this.playList[i].id)){result=this.playList[i];break;}}
return result;}
VideoDataJSON.prototype.getContentItems=function(){var result=new Array();for(var i=0;i<this.playList.length;i++){if(!this.playList[i].isPubli){this.playList[i].realIndex=i;result.push(this.playList[i]);}}
return result;}
VideoDataJSON.prototype.getTotalVideoContent=function(){try{return this.getItemsByContent().length;}catch(error){return 0;}}
VideoDataJSON.prototype.getIndexContent=function(){try{var result=0;for(var i=0;i<this.playList.length;i++){if(!this.playList[i].isPubli){result++;if(i==this.indexSelected){return result;}}}}catch(error){return 0;}}
VideoDataJSON.prototype.getIndexCurrentVideoContent=function(){var i=0;var j=0;var result=0;try{if(this.playList[this.indexSelected].typeContent==this.contentType.CONTENT_TYPE_CONTENT){result=this.indexSelected;}else if(this.playList[this.indexSelected].typeContent==this.contentType.CONTENT_TYPE_PREROLL){for(i=this.indexSelected+1;i<this.playList.length;i++){if(this.playList[i].typeContent==this.contentType.CONTENT_TYPE_CONTENT){result=i;break;}}}else if(this.playList[this.indexSelected].typeContent==this.contentType.CONTENT_TYPE_POSROLL){for(j=this.indexSelected;j>0;j--){if(this.playList[j].typeContent==this.contentType.CONTENT_TYPE_CONTENT){result=j;break;}}}else{result=0;}
return result;}catch(error){return result;}}
VideoDataJSON.prototype.getCodeTY=function(url){var youtube_id="";if(url.match('http://(www.)?youtube|youtu\.be')){if(url.match('embed')){youtube_id=url.split(/embed\//)[1].split('"')[0];}
else{youtube_id=url.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0];}}
if(youtube_id.lastIndexOf('?')>-1){youtube_id=youtube_id.split('?')[0];}
return youtube_id;}
VideoDataJSON.prototype.getCodeVimeo=function(url){var result="";if(url.match('http(s)?://(www.)?vimeo.com')){var index=url.lastIndexOf('/')+1;result=url.substring(index);}
return result;}
VideoDataJSON.prototype.isNextItem=function(){if(this.indexSelected>=this.playList.length-1){return false;}else{return true;}}
VideoDataJSON.prototype.isPreviousItem=function(){if(this.indexSelected==0){return false;}else{return true;}}
VideoDataJSON.prototype.setNextItem=function(){var result=false;if(this.isNextItem()){this.indexSelected++;result=true;}else{this.indexSelected=0;}
return result;}
VideoDataJSON.prototype.setPreviousItem=function(){var result=false;if(this.isPreviousItem()){this.indexSelected--;result=true;}
return result;}
VideoDataJSON.prototype.goToIndex=function(index,showPreroll){var result=false;if(typeof showPreroll=='undefined')showPreroll=true;if(this.playList.length>index){if(showPreroll==true){if(((index-1)>=0)&&(this.playList[index-1].typeContent==this.contentType.CONTENT_TYPE_PREROLL)){index--;}}
this.indexSelected=index;result=true;}
return result;}
VideoDataJSON.prototype.getItemSelected=function(){return this.playList[this.indexSelected];}
VideoDataJSON.prototype.getUrlToShareSelected=function(){try{return this.getItemByIdContent(this.getIdContent()).urlToShare}catch(error){return"";}}
VideoDataJSON.prototype.getIdSelected=function(){try{return this.getItemByIdContent(this.getIdContent()).id}catch(error){return"";}}
VideoDataJSON.prototype.getPubliByIndex=function(ind){var indAux=ind;if(this.playList[ind].typeContent==this.contentType.CONTENT_TYPE_CONTENT){for(var i=ind-1;i>=0;i--){if(this.playList[i].typeContent==this.contentType.CONTENT_TYPE_PREROLL){indAux=i;}else{break;}}}
return indAux;},VideoDataJSON.prototype.getIdContent=function(){var result="0";if(this.playList[this.indexSelected].typeContent==this.contentType.CONTENT_TYPE_CONTENT){result=this.playList[this.indexSelected].id;}else if(this.playList[this.indexSelected].typeContent==this.contentType.CONTENT_TYPE_PREROLL){for(var i=this.indexSelected+1;i<this.playList.length;i++){if(this.playList[i].typeContent==this.contentType.CONTENT_TYPE_CONTENT){result=this.playList[i].id;break;}}}else if(this.playList[this.indexSelected].typeContent==this.contentType.CONTENT_TYPE_POSROLL){for(var j=this.indexSelected;j>-1;j--){if(this.playList[j].typeContent==this.contentType.CONTENT_TYPE_CONTENT){result=this.playList[j].id;break;}}}
return result;}
VideoDataJSON.prototype.isPlayerAudio=function(){var aux=(typeof this.xmlDoc!='undefined')?this.xmlDoc.contents['@attributes'].type:'video';if(aux!="audio"&&aux!="video"){console.log("formato de contenido no reconocido");}
return(aux=="video")?false:true;}
VideoDataJSON.prototype.isItemAudioSelected=function(){return this.playList[this.indexSelected].isAudio;}
VideoDataJSON.prototype.getVideoRelated=function(){if(typeof this.xmlDoc!='undefined'&&typeof this.xmlDoc.videoRelateds!='undefined'&&typeof this.xmlDoc.videoRelateds.video!='undefined'){return this.xmlDoc.videoRelateds.video;}else{return new Array();}}
VideoDataJSON.prototype.createEmptyItem=function(){var obj1={id:'',src:'',isPubli:'',typeContent:'',isYT:'',srcPubli:'',srcYT:'',isVimeo:false,srcVimeo:'',urlClick:'',adCallTop:'',picture:'',title:'',description:'',idCampaing:"",skipAd:"",adServerId:'',overlay:'',type:'',totalValuations:'',avgValuations:'',servers:'',indexServerSelected:0};return obj1;}
VideoDataJSON.prototype.getIndexForYTVideoContent=function(index,activateAccount){if(this.playList[this.indexSelected].isPubli==true){for(var i=index;i<this.playList.length;i++){if(this.playList[i].isPubli==false){if(this.playList[i].isYT==true){if(typeof this.playList[i].activateAccounting=='undefined')
this.playList[i].activateAccounting=activateAccount;return i;}else
return-1;}}
return-1;}else{if(this.playList[this.indexSelected].isYT==true){this.playList[this.indexSelected].activateAccounting=activateAccount;return this.indexSelected;}else{return-1;}}}
VideoDataJSON.prototype.getRandomInt=function(min,max){return Math.floor(Math.random()*(max-min+1))+min;}
VideoDataJSON.prototype.isLastItem=function(){return(this.indexSelected==this.playList.length-1);};function VastData(_fromPage){this.url;this.xmlDoc;this.companionId;this.trackingEvents=new Array();this.mediaFiles;this.companionAds;this.clickThrough;this.EVENTS={START:'start',FIRSTQUARTILE:'firstQuartile',MIDPOINT:'midpoint',THIRDQUARTILE:'thirdQuartile',COMPLETE:'complete',CREATIVEVIEW:'creativeView',SKIP:'skip',PAUSE:'pause',RESUME:'resume'};this.iswrapper=false;this.wrapperImpressions=new Array();this.wrapperTrackingEvents=new Array();this.clickTrackingEvents=new Array();this.videoId;this.skipad=8;this.skipoffset="";this.adtext="";this.admute="";this.adtwitter="";this.fromUrlPage=_fromPage;this.errorMsj="";this.timestamp=new Date().getTime()+parseInt(Math.random()*1000);this.adParameters;}
VastData.prototype.load=function(videoId,_url,callback){this.videoId=videoId;var _this=this;_this.errorMsj="\n[VASTData] ["+this.timestamp+"] ";_url=this.setTimestamp(_url);_url=this.addFromUrlPage(_url);try
{this.url=_url;var xhr=this.createCORSRequest('GET',_url);var _this=this;xhr.onerror=function(){callback(_this.videoId,"vastError",_this);return;};xhr.onload=function(){if(typeof this.responseXML!='undefined'&&this.responseXML!=null&&this.responseXML.getElementsByTagName('Ad').length>0){_this.xmlDoc=this.responseXML.getElementsByTagName('Ad')[0].getElementsByTagName('InLine')[0];if(typeof _this.xmlDoc=='undefined'){_this.errorMsj+="no he podido leer la publicidad inline "+this.responseXML;_this.xmlDoc=this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('Wrapper')[0];if(typeof _this.xmlDoc=='undefined'){callback(this.videoId,"vastError");}else{_this.iswrapper=true;_this.wrapperImpressions=_this.getImpressions();_this.getWrapperTrackingEvents();_this.getWrapperClickTrackingEvents();var urlwrapper="";try{if(typeof this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('VASTAdTagURI')[0].childNodes[1]!='undefined'){urlwrapper=this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('VASTAdTagURI')[0].childNodes[1].nodeValue;}else{urlwrapper=this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('VASTAdTagURI')[0].firstChild.nodeValue;}}catch(error){urlwrapper='';_this.errorMsj="No tenemos url de wrapper "+error.toString();}
try{if(typeof this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('skipad')[0].childNodes[1]!='undefined'){_this.skipad=this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('skipad')[0].childNodes[1].nodeValue;}else{_this.skipad=this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('skipad')[0].firstChild.nodeValue;}}catch(error){}
try{if((typeof this.responseXML.documentElement.getElementsByTagName('Linear')[0]!='undefined')&&this.responseXML.documentElement.getElementsByTagName('Linear')[0].getAttribute('skipoffset')!=null){_this.skipoffset=this.responseXML.documentElement.getElementsByTagName('Linear')[0].getAttribute('skipoffset');}}catch(error){}
try{if(typeof this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('adtext')[0].childNodes[1]!='undefined'){_this.adtext=this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('adtext')[0].childNodes[1].nodeValue;}else{_this.adtext=this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('adtext')[0].firstChild.nodeValue;}}catch(error){}
try{if(typeof this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('admute')[0].childNodes[1]!='undefined'){_this.admute=this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('admute')[0].childNodes[1].nodeValue;}else{_this.admute=this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('admute')[0].firstChild.nodeValue;}}catch(error){}
try{if(typeof this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('adtwitter')[0].childNodes[1]!='undefined'){_this.adtwitter=this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('adtwitter')[0].childNodes[1].nodeValue;}else{_this.adtwitter=this.responseXML.documentElement.getElementsByTagName('Ad')[0].getElementsByTagName('adtwitter')[0].firstChild.nodeValue;}}catch(error){}
setTimeout(function(){_this.load(_this.videoId,urlwrapper,callback)},200);}}else{_this.getTrackingEvents();_this.getClickTrackingEvents();_this.getCompanions();callback(_this.videoId,"vastLoaded",_this);}}else{_this.errorMsj="la respuesta no es valida: "+this.responseText;this.xmlDoc=undefined;callback(this.videoId,"vastError",_this);}};xhr.send();}catch(error){_this.errorMsj="se ha producido un error no definido "+error.toString();this.xmlDoc=undefined;callback(this.videoId,"vastError",this);}};VastData.prototype.createCORSRequest=function(method,url){var xhr=new XMLHttpRequest();if("withCredentials"in xhr){xhr.open(method,url,true);xhr.withCredentials=true;}else if(typeof XDomainRequest!="undefined"){xhr=new XDomainRequest();xhr.open(method,url);}else{xhr=null;}
return xhr;}
VastData.prototype.getCompaingId=function(){var result="";try{if(this.getImpressions()&&this.getImpressions().length>0){result=this.getImpressions()[0];var idCamp=result.split("/SmartyContent/")[1];idCamp=idCamp.substr(0,idCamp.indexOf("/"));result=idCamp;}}catch(error){result='no definida';}
return result;};VastData.prototype.getSkipAd=function(){var result="0";try{if(!this.iswrapper){if(typeof this.xmlDoc.getElementsByTagName('skipad')[0].childNodes[1]!='undefined'){result=this.xmlDoc.getElementsByTagName('skipad')[0].childNodes[1].nodeValue;}else{result=this.xmlDoc.getElementsByTagName('skipad')[0].firstChild.nodeValue;}}else{result=this.skipad;}
result=(result=="")?"0":result;}catch(error){}
return result;};VastData.prototype.getAdParameters=function(){var result="";try{if(!this.iswrapper){if(typeof this.xmlDoc.getElementsByTagName('AdParameters')[0].childNodes[1]!='undefined'){result=this.xmlDoc.getElementsByTagName('AdParameters')[0].childNodes[1].nodeValue;}else{result=this.xmlDoc.getElementsByTagName('AdParameters')[0].firstChild.nodeValue;}}else{result="";}
result=(result=="")?"":result;}catch(error){}
return result;};VastData.prototype.getAdText=function(){var result=Translation.getText('player.publicidad','PUBLICIDAD').toUpperCase();try{if(!this.iswrapper){if(typeof this.xmlDoc.getElementsByTagName('adtext')[0].childNodes[1]!='undefined'){result=this.xmlDoc.getElementsByTagName('adtext')[0].childNodes[1].nodeValue;}else{result=this.xmlDoc.getElementsByTagName('adtext')[0].firstChild.nodeValue;}}else{result=this.adtext;}
result=(result=="")?Translation.getText('player.publicidad','PUBLICIDAD').toUpperCase():result;}catch(error){}
return result;};VastData.prototype.getAdMute=function(){var result="";try{if(!this.iswrapper){if(typeof this.xmlDoc.getElementsByTagName('admute')[0].childNodes[1]!='undefined'){result=this.xmlDoc.getElementsByTagName('adtext')[0].childNodes[1].nodeValue;}else{result=this.xmlDoc.getElementsByTagName('admute')[0].firstChild.nodeValue;}}else{result=this.admute;}}catch(error){}
return result;};VastData.prototype.getAdTwitter=function(){var result="";try{if(!this.iswrapper){if(typeof this.xmlDoc.getElementsByTagName('adtwitter')[0].childNodes[1]!='undefined'){result=this.xmlDoc.getElementsByTagName('adtwitter')[0].childNodes[1].nodeValue;}else{result=this.xmlDoc.getElementsByTagName('adtwitter')[0].firstChild.nodeValue;}}else{result=this.adtwitter;}}catch(error){}
return result;};VastData.prototype.getImpressions=function(){var result=new Array();try{for(var i=0;i<this.xmlDoc.getElementsByTagName('Impression').length;i++){if(typeof this.xmlDoc.getElementsByTagName('Impression')[i].childNodes[1]!='undefined'){result.push(this.xmlDoc.getElementsByTagName('Impression')[i].childNodes[1].nodeValue);}else{result.push(this.xmlDoc.getElementsByTagName('Impression')[i].firstChild.nodeValue);}}}catch(error){}
if(this.iswrapper){result=result.concat(this.wrapperImpressions);}
return result;};VastData.prototype.getTrackingEvents=function(){var xml_aux;var events=new Array();try{xml_aux=this.xmlDoc.getElementsByTagName('Creatives')[0].getElementsByTagName('Creative')[0].getElementsByTagName('TrackingEvents')[0].getElementsByTagName('Tracking');lengthTrackins=xml_aux.length;for(var i=0;i<xml_aux.length;i++){if(this.isEvent(xml_aux[i].getAttribute('event'))){if(typeof this.trackingEvents[xml_aux[i].getAttribute('event')]!=""){if(typeof this.trackingEvents[xml_aux[i].getAttribute('event')]=='undefined')
this.trackingEvents[xml_aux[i].getAttribute('event')]=new Array();}
if(typeof xml_aux[i].childNodes[1]!='undefined'){this.trackingEvents[xml_aux[i].getAttribute('event')].push(xml_aux[i].childNodes[1].nodeValue);}else{this.trackingEvents[xml_aux[i].getAttribute('event')].push(xml_aux[i].firstChild.nodeValue);}}}}catch(error){}};VastData.prototype.getWrapperTrackingEvents=function(){var xml_aux;var events=new Array();try{xml_aux=this.xmlDoc.getElementsByTagName('Creatives')[0].getElementsByTagName('Creative')[0].getElementsByTagName('TrackingEvents')[0].getElementsByTagName('Tracking');lengthTrackins=xml_aux.length;for(var i=0;i<xml_aux.length;i++){if(this.isEvent(xml_aux[i].getAttribute('event'))){if(typeof this.wrapperTrackingEvents[xml_aux[i].getAttribute('event')]=='undefined'){this.wrapperTrackingEvents[xml_aux[i].getAttribute('event')]=new Array();}
if(typeof xml_aux[i].childNodes[1]!='undefined'){this.wrapperTrackingEvents[xml_aux[i].getAttribute('event')].push(xml_aux[i].childNodes[1].nodeValue);}else{this.wrapperTrackingEvents[xml_aux[i].getAttribute('event')].push(xml_aux[i].firstChild.nodeValue);}}}}catch(error){}};VastData.prototype.getSkipoffset=function(){var aux="";try{if(this.iswrapper){return _this.skipoffset;}else{xml_aux=this.xmlDoc.getElementsByTagName('Creatives')[0].getElementsByTagName('Creative');if(xml_aux.length>0){try{aux=xml_aux[0].getElementsByTagName('Linear')[0].getAttribute('skipoffset');}catch(error){aux="";console.log('esta publicidad no tiene skipoffset -- ');}}
return aux;}}catch(error){return aux;}}
VastData.prototype.getDuration=function(){var aux="";try{xml_aux=this.xmlDoc.getElementsByTagName('Creatives')[0].getElementsByTagName('Creative');if(xml_aux.length>0){try{aux=xml_aux[0].getElementsByTagName('Linear')[0].getElementsByTagName('Duration')[0].textContent;}catch(error){aux="";}}
return aux;}catch(error){return aux;}}
VastData.prototype.getWrapperClickTrackingEvents=function(){var xml_aux;try{xml_aux=this.xmlDoc.getElementsByTagName('Creatives')[0].getElementsByTagName('Creative');for(var u=0;u<xml_aux.length;u++){try{var aux=xml_aux[u].getElementsByTagName('Linear')[0].getElementsByTagName('VideoClicks');for(var u2=0;u2<aux.length;u2++){try{this.clickTrackingEvents.push(aux[u2].getElementsByTagName('ClickTracking')[0].textContent);}catch(error){}}}catch(error){console.log('este nodo no tiene clicktrackings -- '+u);}}}catch(error){}};VastData.prototype.isEvent=function(prp){if(this.EVENTS.hasOwnProperty(prp.toUpperCase())){return true;}else{return false;}};VastData.prototype.getClickThrough=function(){var click="";try{var xml_aux=this.xmlDoc.getElementsByTagName('Creatives')[0].getElementsByTagName('Creative')[0];if(typeof xml_aux.getElementsByTagName('VideoClicks')[0].getElementsByTagName('ClickThrough')[0].childNodes[1]!=''){click=xml_aux.getElementsByTagName('VideoClicks')[0].getElementsByTagName('ClickThrough')[0].textContent;}else{click=xml_aux.getElementsByTagName('VideoClicks')[0].getElementsByTagName('ClickThrough')[0].firstChild.nodeValue;}}catch(error){}
return click.trim();};VastData.prototype.getClickTrackingEvents=function(){var click="";try{var xml_aux=this.xmlDoc.getElementsByTagName('Creatives')[0].getElementsByTagName('Creative')[0].getElementsByTagName('VideoClicks');for(var u2=0;u2<xml_aux.length;u2++){try{this.clickTrackingEvents.push(xml_aux[u2].getElementsByTagName('ClickTracking')[0].textContent);}catch(error){console.log('error al obtener el dato de  clicktrackings -- '+u+'--'+u2);}}}catch(error){}
return click.trim();};VastData.prototype.getMedia=function(){var media="";try{var xml_aux=this.xmlDoc.getElementsByTagName('Creatives')[0].getElementsByTagName('Creative')[0];var medias=xml_aux.getElementsByTagName('MediaFiles')[0].getElementsByTagName('MediaFile');for(var i=0;medias.length;i++){if(medias[i].getAttribute('type')=='video/mp4'){if(typeof medias[i].childNodes[1]!='undefined'){media=medias[i].childNodes[1].nodeValue;}else{media=medias[i].firstChild.nodeValue;}
break;}else if(medias[i].getAttribute('type')=='application/javascript'){if(typeof medias[i].childNodes[1]!='undefined'){media=medias[i].childNodes[1].nodeValue;}else{media=medias[i].firstChild.nodeValue;}}}}catch(error){var companions=this.getCompanions();for(var i=0;i<companions.length;i++){if((companions[i].position=='/x38/')||(companions[i].position=='/x32/')){media=validateUrlVideo(companions[i].code);break;}}}
return media.trim();};VastData.prototype.getCompanions=function(){var companions=new Array();var media="";var companion;try{companion=this.xmlDoc.getElementsByTagName('Creative')[1].getElementsByTagName("Companion");var aux=new CompanionAd(companion);if(aux.code!=''){drawCompanionAd(aux.code,aux.click,aux.type);companions.push(aux);}}catch(error){}
return companions;};VastData.prototype.getNonLinearMedia=function(){var result="";var xml_aux=this.xmlDoc.getElementsByTagName('Creatives')[0].getElementsByTagName('Creative')[0].getElementsByTagName('NonLinear')[0].getElementsByTagName('StaticResource')[0];try{if(typeof xml_aux.childNodes[1]!=""){result=xml_aux.childNodes[1].nodeValue;}else{result=xml_aux.firstChild.nodeValue;}}catch(error){}
return result;};VastData.prototype.getNonLinearClickThrough=function(){var result="";var xml_aux=this.xmlDoc.getElementsByTagName('Creatives')[0].getElementsByTagName('Creative')[0].getElementsByTagName('NonLinear')[0].getElementsByTagName('NonLinearClickThrough')[0];try{if(typeof xml_aux.childNodes[1]!=""){result=xml_aux.childNodes[1].nodeValue;}else{result=xml_aux.firstChild.nodeValue;}}catch(error){}
return result;};VastData.prototype.setTimestamp=function(url){return url.replace('[random]',new Date().getTime());};VastData.prototype.addFromUrlPage=function(url){if(url!=""&&url.lastIndexOf('?')>0){url+='&format_sc=html5'+'&_RM_HTML_URLAFFID_='+this.getRefererPage();}
return url;};VastData.prototype.getRefererPage=function(){var fromUrlPage="";try{fromUrlPage=(window.location!=window.parent.location)?document.referrer:document.location.href;}catch(error){fromUrlPage="";console.log("error al obtener referer "+error.toString())}
return fromUrlPage;};VastData.prototype.throwTrackingsByType=function(type){try{for(i=0;i<this.trackingEvents[type].length;i++){this.fireTrackers(this.trackingEvents[type][i]);}
for(i=0;i<this.wrapperTrackingEvents[type].length;i++){this.fireTrackers(this.wrapperTrackingEvents[type][i]);}}catch(error){}}
VastData.prototype.throwClickTrackings=function(){try{for(i=0;i<this.clickTrackingEvents.length;i++){this.fireTrackers(this.clickTrackingEvents[i]);}}catch(error){}}
VastData.prototype.throwCompleteImpressions=function(){try{for(i=0;i<this.trackingEvents[this.EVENTS.COMPLETE].length;i++){this.fireTrackers(this.trackingEvents[this.EVENTS.COMPLETE][i]);}
for(i=0;i<this.wrapperTrackingEvents[this.EVENTS.COMPLETE].length;i++){this.fireTrackers(this.wrapperTrackingEvents[this.EVENTS.COMPLETE][i]);}}catch(error){}}
VastData.prototype.throwStartImpressions=function(){var i;try{for(i=0;i<this.getImpressions().length;i++){this.fireTrackers(this.getImpressions()[i]);}
for(i=0;i<this.trackingEvents[this.EVENTS.START].length;i++){this.fireTrackers(this.trackingEvents[this.EVENTS.START][i]);}
for(i=0;i<this.trackingEvents[this.EVENTS.CREATIVEVIEW].length;i++){this.fireTrackers(this.trackingEvents[this.EVENTS.CREATIVEVIEW][i]);}
for(i=0;i<this.wrapperTrackingEvents[this.EVENTS.START].length;i++){this.fireTrackers(this.wrapperTrackingEvents[this.EVENTS.START][i]);}
for(i=0;i<this.wrapperTrackingEvents[this.EVENTS.CREATIVEVIEW].length;i++){this.fireTrackers(this.wrapperTrackingEvents[this.EVENTS.CREATIVEVIEW][i]);}}catch(error){}}
VastData.prototype.fireTrackers=function(trackerURL){$('body').prepend('<img src="'+trackerURL+'" style="display:none" />');};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');};function validateUrlVideo(value){var result="";try{value=value.substr(value.lastIndexOf("src="));result=value.split('"')[1];}catch(error){result="";}
return result;};function AudioFlashPlayer(controllerId){this.type="flash";this.url;this.state;this.myPlayer;this.duration;this.paused;this.currentTime;this.id;this.isFirstStart=false;this.controllerId=controllerId;this.idComponent;this.theEvent;this.currentSrc;this.baseURI=window.location.href;this.volume;this.muted;}
AudioFlashPlayer.prototype.createPlayer=function(idComponent,_url,id){this.isFirstStart=false;this.idComponent=idComponent;this.theEvent=this.CustomEvent("OnSomethingHappened");this.id=id;this.currentSrc=_url;var playerSwf=STATIC_URL+"swf/player.swf";var currentWidth;var currentHeight;var playerDiv='player_'+this.id+'_flash';jQuery(this.idComponent).find('.gp-display-video').append('<div id="'+playerDiv+'" class="'+playerDiv+'"></div>');currentWidth=jQuery(this.idComponent).width();currentHeight=jQuery(this.idComponent).height();var flashvars={urlVideo:_url,idVideoController:this.controllerId,debugEnable:false};var params={};params.quality="high";params.allowscriptaccess="always";params.allowfullscreen="true";var attributes={};attributes.id=playerDiv;attributes.name=playerDiv;attributes.align="left";swfobject.embedSWF(playerSwf,playerDiv,'100%','100%',"11.1.0","expressInstall.swf",flashvars,params,attributes);this.myPlayer=thisMovie(playerDiv);}
AudioFlashPlayer.prototype.activateListeners=function(type,duration,currentTime){this.duration=duration;this.currentTime=currentTime;switch(type){case"onstart":jQuery(this).trigger({type:"play",message:"play",time:new Date()});this.dispatchEvent(["start",currentTime,duration]);break;case"ontime":jQuery(this).trigger({type:"progress",message:"progress",time:new Date()});this.dispatchEvent(["time",currentTime,duration]);break;case"onmetadata":jQuery(this.idComponent).find('.gp-display-video').show();this.dispatchEvent(["loadeddata",currentTime,duration]);break;case"onplaying":jQuery(this).trigger({type:"playing",message:"playing",time:new Date()});this.dispatchEvent(["playing",currentTime,duration]);break;case"onend":jQuery(this).trigger({type:"ended",message:"ended",time:new Date()});this.dispatchEvent(["end",currentTime,duration]);break;case"onpaused":jQuery(this).trigger({type:"pause",message:"pause",time:new Date()});this.dispatchEvent(["paused",currentTime,duration]);break;case"onerror":this.dispatchEvent(["error",currentTime,duration]);break;case"onclick":this.dispatchEvent(["click",currentTime,duration]);break;}}
AudioFlashPlayer.prototype.play=function(){if(this.myPlayer&&this.myPlayer.paused){this.myPlayer.play();this.paused=this.myPlayer.paused;this.dispatchEvent(["playing",this.currentTime,this.duration]);}}
AudioFlashPlayer.prototype.playSuspend=function(){this.myPlayer.play();this.paused=this.myPlayer.paused;}
AudioFlashPlayer.prototype.pause=function(){if(this.myPlayer&&!this.myPlayer.paused()){this.myPlayer.pause();this.paused=this.myPlayer.paused();this.dispatchEvent(["paused",this.currentTime,this.duration]);}}
AudioFlashPlayer.prototype.seekTo=function(percent){if(this.myPlayer){this.myPlayer.seekTo((percent*this.getDuration())/100);}}
AudioFlashPlayer.prototype.setVolume=function(percent){if(this.myPlayer){if(percent<0)percent=0;else if(percent>100)percent=100;this.myPlayer.setVolume(percent/100);this.volume=this.getVolume();if(this.volume==0){this.muted=true;}else{this.muted=false;}
jQuery(this).trigger({type:"volumechange",message:"volumechange",time:new Date()});}}
AudioFlashPlayer.prototype.getVolume=function(){if(this.myPlayer){return this.myPlayer.getVolume()*100;}}
AudioFlashPlayer.prototype.getDuration=function(){return this.duration;}
AudioFlashPlayer.prototype.getCurrentTime=function(){return this.currentTime;}
AudioFlashPlayer.prototype.isMetadataLoaded=function(){return(this.getDuration()&&this.getDuration()>0)?true:false;}
AudioFlashPlayer.prototype.showControls=function(value){if(typeof this.myPlayer!='undefined')
this.myPlayer.controls=value;}
AudioFlashPlayer.prototype.isMuted=function(value){if(typeof this.myPlayer!='undefined')
this.myPlayer.muted=value;}
AudioFlashPlayer.prototype.removePlayer=function(){var playerDiv='player_'+this.id+'_flash';this.myPlayer=undefined;swfobject.removeSWF(playerDiv);}
AudioFlashPlayer.prototype.getAvailableQualityLevels=function(){var aux=new Array()
return aux;}
AudioFlashPlayer.prototype.getPlaybackQuality=function(){return"";}
AudioFlashPlayer.prototype.setPlaybackQuality=function(value){}
AudioFlashPlayer.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.unsubscribe=function(fn){eventAction=null;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
AudioFlashPlayer.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function FlashAdPlayer(controllerId){this.type="flash";this.url;this.state;this.myPlayer;this.duration;this.paused=false;this.currentTime;this.id;this.isFirstStart=false;this.controllerId=controllerId;this.idComponent;this.theEvent;this.urlClick;this.playerDiv='player_'+controllerId+'_flashad_'+new Date().getTime();this.isStarted=false;this.loadedDuration=false;this.skipEventUrls="";}
FlashAdPlayer.prototype.createPlayer=function(idComponent,videoData){this.isFirstStart=false;this.idComponent=idComponent;this.theEvent=this.CustomEvent("OnSomethingHappened");this.id=videoData.id;var playerSwf=APP_STATIC+"swf/playerAd.swf";var currentWidth;var currentHeight;jQuery(this.idComponent).find('.gp-display-video').show();jQuery(this.idComponent).find('.gp-display-video').html('<div class="gp-cubierta-onmove" style="display:none;"></div><div class="gp-left-cubierta-onmove" style="display:none;"></div><div class="gp-right-cubierta-onmove" style="display:none;"></div><div id="'+this.playerDiv+'" class="'+this.playerDiv+'"></div>');currentWidth=jQuery(this.idComponent).width();currentHeight=jQuery(this.idComponent).height();videoData.srcPubli=videoData.srcPubli.replace(/&amp;/g,'%26');videoData.srcPubli=videoData.srcPubli.replace(/&/g,'%26');if(videoData.srcPubli.lastIndexOf('?')>0){videoData.srcPubli+='%26format_sc=flash%26_RM_HTML_URLAFFID_='+scgp_getRefererPage();}
var flashvars={urlVideo:videoData.srcPubli,idVideoController:this.controllerId,debugEnable:false,isAudio:true};var params={};params.quality="high";params.allowscriptaccess="always";params.allowfullscreen="true";params.bgcolor="000000";params.wmode="transparent";var attributes={};attributes.id=this.playerDiv;attributes.name=this.playerDiv;attributes.align="left";swfobject.embedSWF(playerSwf,this.playerDiv,'100%','100%',"11.1.0","expressInstall.swf",flashvars,params,attributes);if(navigator.userAgent.indexOf('Safari')!=-1&&navigator.userAgent.indexOf('Chrome')==-1){var _playerDiv=this.playerDiv;jQuery(idComponent).find('#'+_playerDiv).height(jQuery(idComponent).find('.gp-display-video').height());jQuery(window).resize(function(){jQuery(idComponent).find('#'+_playerDiv).height(jQuery(idComponent).find('.gp-display-video').height());});}
this.myPlayer=thisMovie(this.playerDiv);}
FlashAdPlayer.prototype.resize=function(){jQuery(this.idComponent).find('#'+this.playerDiv).height(jQuery(this.idComponent).find('.gp-display-video').height());}
FlashAdPlayer.prototype.activateListeners=function(type,duration,currentTime){this.duration=(duration)?duration:0;this.currentTime=(currentTime)?currentTime:0;switch(type){case"onstart":if(this.getAdAPI()=="VPAID")jQuery('#'+this.playerDiv).height(jQuery('#'+this.playerDiv).height()-jQuery('.gp-display-adv-interface').height());this.isStarted=true;jQuery(this).trigger({type:"play",message:"play",time:new Date()});this.dispatchEvent(["start",currentTime,duration]);break;case"ontime":jQuery(this).trigger({type:"progress",message:"progress",time:new Date()});if(this.loadedDuration==false&&duration>0){this.loadedDuration=true;this.skipEventUrls=this.getSkipEventUrls();this.dispatchEvent(["loadeddata",currentTime,duration]);}
this.dispatchEvent(["time",currentTime,duration]);break;case"onmetadata":this.dispatchEvent(["loadeddata",currentTime,duration]);break;case"onplaying":if(this.isStarted==true){jQuery(this).trigger({type:"playing",message:"playing",time:new Date()});this.dispatchEvent(["playing",currentTime,duration]);}
break;case"onend":this.isStarted=false;this.paused=false;this.removePlayer();jQuery(this).trigger({type:"ended",message:"ended",time:new Date()});this.dispatchEvent(["end",currentTime,duration]);break;case"onpaused":jQuery(this).trigger({type:"pause",message:"pause",time:new Date()});this.dispatchEvent(["paused",currentTime,duration]);break;case"onerror":this.dispatchEvent(["error",currentTime,duration]);break;case"onclick":this.dispatchEvent(["click",currentTime,duration]);break;}}
FlashAdPlayer.prototype.getUrlClick=function(){var urlC="";if(this.myPlayer&&this.myPlayer.getUrlClick()){urlC=this.myPlayer.getUrlClick();}
return urlC;}
FlashAdPlayer.prototype.getSkipAd=function(){var urlC=0;if(this.myPlayer&&this.myPlayer.getSkipAd()){urlC=this.myPlayer.getSkipAd();}
return urlC;}
FlashAdPlayer.prototype.getSkipoffset=function(){var urlC=0;if(this.myPlayer&&this.myPlayer.getSkipoffset()){urlC=this.myPlayer.getSkipoffset();}
return urlC;}
FlashAdPlayer.prototype.getSkipEventUrls=function(){var urlC="";if(this.myPlayer&&this.myPlayer.getSkipEventUrls()){urlC=this.myPlayer.getSkipEventUrls();}
return urlC;}
FlashAdPlayer.prototype.getIdCampaing=function(){var urlC="";if(this.myPlayer&&this.myPlayer.getIdCampaing()){urlC=this.myPlayer.getIdCampaing();}
return urlC;}
FlashAdPlayer.prototype.fireTrackers=function(){var arr=this.skipEventUrls.split(',')
for(var i=0;i<arr.length;i++){$('body').prepend('<img src="'+arr[i]+'" style="display:none" />');}};FlashAdPlayer.prototype.getAdText=function(){var urlC="";try{if(this.myPlayer&&this.myPlayer.getAdText()){urlC=this.myPlayer.getAdText();}}catch(error){urlC="sponsor";}
return urlC;}
FlashAdPlayer.prototype.getAdMute=function(){var result=false;if(this.myPlayer&&this.myPlayer.getAdMute()){result=(this.myPlayer.getAdMute()=='y')?true:false;}
return result;}
FlashAdPlayer.prototype.getAdTwitter=function(){var urlC="";try{if(this.myPlayer&&this.myPlayer.getAdTwitter()){urlC=this.myPlayer.getAdTwitter();}}catch(error){urlC="";}
return urlC;}
FlashAdPlayer.prototype.getAdAPI=function(){var urlC="";try{if(this.myPlayer&&this.myPlayer.getAdAPI()){urlC=this.myPlayer.getAdAPI();}}catch(error){urlC="";}
return urlC;}
FlashAdPlayer.prototype.play=function(){this.myPlayer=thisMovie(this.playerDiv);this.myPlayer.play();this.paused=false;this.dispatchEvent(["playing",this.currentTime,this.duration]);}
FlashAdPlayer.prototype.playSuspend=function(){this.myPlayer.play();this.paused=false;}
FlashAdPlayer.prototype.pause=function(){if(this.myPlayer&&!this.paused){this.myPlayer.pause();this.paused=true;this.dispatchEvent(["paused",this.currentTime,this.duration]);}}
FlashAdPlayer.prototype.seekTo=function(percent){if(this.myPlayer){this.myPlayer.seekTo((percent*this.getDuration())/100);}}
FlashAdPlayer.prototype.setVolume=function(percent){this.myPlayer=thisMovie(this.playerDiv);if(this.myPlayer){if(percent<0)percent=0;else if(percent>100)percent=100;this.myPlayer.setVolume(percent);}}
FlashAdPlayer.prototype.getVolume=function(){this.myPlayer=thisMovie(this.playerDiv);if(this.myPlayer){return this.myPlayer.getVolume()*100;}}
FlashAdPlayer.prototype.getDuration=function(){return this.duration;}
FlashAdPlayer.prototype.getCurrentTime=function(){return this.currentTime;}
FlashAdPlayer.prototype.isMetadataLoaded=function(){return(this.getDuration()&&this.getDuration()>0)?true:false;}
FlashAdPlayer.prototype.showControls=function(value){if(typeof this.myPlayer!='undefined')
this.myPlayer.controls=value;}
FlashAdPlayer.prototype.isMuted=function(value){if(typeof this.myPlayer!='undefined')
this.myPlayer.muted=value;}
FlashAdPlayer.prototype.removePlayer=function(){this.myPlayer=undefined;swfobject.removeSWF(this.playerDiv);if(document.getElementById(this.playerDiv))
document.getElementById(this.playerDiv).parentNode.removeChild(document.getElementById(this.playerDiv));}
FlashAdPlayer.prototype.getAvailableQualityLevels=function(){var aux=new Array()
return aux;}
FlashAdPlayer.prototype.getPlaybackQuality=function(){return"";}
FlashAdPlayer.prototype.setPlaybackQuality=function(value){}
FlashAdPlayer.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.unsubscribe=function(fn){eventAction=null;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
FlashAdPlayer.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function FlashPlayer(controllerId,delayChangeStream){this.type="flash";this.url;this.state;this.myPlayer;this.duration;this.paused=false;this.currentTime;this.id;this.isFirstStart=false;this.controllerId=controllerId;this.idComponent;this.theEvent;this.currentSrc;this.baseURI=window.location.href;this.volume;this.muted;this.ended=false;this.delayChangeStream=delayChangeStream;this.playerDiv='player_'+controllerId+'_flash_'+new Date().getTime();}
FlashPlayer.prototype.createPlayer=function(idComponent,videoData,timeToCloseConnection,ratio){this.isFirstStart=false;this.idComponent=idComponent;this.theEvent=this.CustomEvent("OnFlashPlayerEvent");this.id=videoData.id;this.currentSrc=videoData.src;if(typeof ratio=="undefined")ratio='';var playerSwf=APP_STATIC+"swf/player"+ratio+".swf";var currentWidth;var currentHeight;jQuery(this.idComponent).find('.gp-display-video').html('<div class="gp-cubierta-onmove" style="display:none;"></div><div id="'+this.playerDiv+'" class="'+this.playerDiv+'"></div>');currentWidth=jQuery(this.idComponent).width();currentHeight=jQuery(this.idComponent).height();videoData.src=videoData.src.replace(/&amp;/g,'%26');videoData.src=videoData.src.replace(/&/g,'%26');var flashvars={urlVideo:videoData.src,idVideoController:this.controllerId,debugEnable:false,isAudio:videoData.isAudio,timeToCloseConnection:timeToCloseConnection,delay_change_stream:this.delayChangeStream,baseDir:APP_STATIC};var params={};params.quality="high";params.allowscriptaccess="always";params.allowfullscreen="true";params.wmode="transparent";var attributes={};attributes.id=this.playerDiv;attributes.name=this.playerDiv;attributes.align="left";swfobject.embedSWF(playerSwf,this.playerDiv,(videoData.isAudio)?'1%':'100%',(videoData.isAudio)?'100%':'100%',"11.1.0","expressInstall.swf",flashvars,params,attributes);this.myPlayer=thisMovie(this.playerDiv);if(videoData.isAudio){jQuery(this.idComponent).find('.gp-display-video').css('height','1%');}else{jQuery(this.idComponent).find('.gp-display-video').css('height','100%');}
if(navigator.userAgent.indexOf('Safari')!=-1&&navigator.userAgent.indexOf('Chrome')==-1){var _playerDiv=this.playerDiv;jQuery(idComponent).find('#'+_playerDiv).height(jQuery(idComponent).find('.gp-display-video').height());jQuery(window).resize(function(){if(videoData.isAudio){jQuery(idComponent).find('#'+_playerDiv).height(1);}else{jQuery(idComponent).find('#'+_playerDiv).height(jQuery(idComponent).find('.gp-display-video').height());}
console.log("redimensiono "+jQuery(idComponent).find('#'+_playerDiv).height());});}}
FlashPlayer.prototype.resize=function(){jQuery(this.idComponent).find('#'+this.playerDiv).height(jQuery(this.idComponent).find('.gp-display-video').height());}
FlashPlayer.prototype.activateListeners=function(type,duration,currentTime){this.duration=duration;this.currentTime=currentTime;switch(type){case"onstart":jQuery(this).trigger({type:"play",message:"play",time:new Date()});this.dispatchEvent(["start",currentTime,duration]);break;case"ontime":this.dispatchEvent(["time",currentTime,duration]);break;case"onmetadata":jQuery(this.idComponent).find('.gp-display-video').show();this.dispatchEvent(["loadeddata",currentTime,duration]);break;case"onplaying":jQuery(this).trigger({type:"playing",message:"playing",time:new Date()});this.dispatchEvent(["playing",currentTime,duration]);break;case"onend":this.ended=true;jQuery(this).trigger({type:"ended",message:"ended",time:new Date()});this.dispatchEvent(["end",currentTime,duration]);break;case"onpaused":jQuery(this).trigger({type:"pause",message:"pause",time:new Date()});this.dispatchEvent(["paused",currentTime,duration]);break;case"onerror":this.dispatchEvent(["error",currentTime,duration]);break;case"onclick":this.dispatchEvent(["click",currentTime,duration]);break;case"onbuffering":jQuery(this).trigger({type:"waiting",message:"waiting",time:new Date()});this.dispatchEvent(["buffering",currentTime,duration]);break;case"onQualityChangeRequested":this.dispatchEvent(["onQualityChange",true]);break;case"onQualityChangeCompleted":this.dispatchEvent(["onQualityChange",false]);break;}}
FlashPlayer.prototype.play=function(){if(typeof this.myPlayer=='undefined')this.myPlayer=thisMovie(this.playerDiv);if(this.myPlayer&&this.myPlayer.paused){this.myPlayer.playVideo();this.paused=false;this.dispatchEvent(["playing",this.currentTime,this.duration]);}}
FlashPlayer.prototype.playSuspend=function(){if(typeof this.myPlayer=='undefined')this.myPlayer=thisMovie(this.playerDiv);this.myPlayer.playVideo();this.paused=false;}
FlashPlayer.prototype.pause=function(){try{if(typeof this.myPlayer=='undefined')
this.myPlayer=thisMovie(this.playerDiv);if(this.myPlayer&&!this.paused){this.myPlayer.pause();this.paused=true;this.dispatchEvent(["paused",this.currentTime,this.duration]);}}catch(error){console.log("errorrrrrr "+error.toString());}}
FlashPlayer.prototype.seekTo=function(percent){if(typeof this.myPlayer=='undefined')this.myPlayer=thisMovie(this.playerDiv);if(this.myPlayer){this.myPlayer.seekTo((percent*this.getDuration())/100);}}
FlashPlayer.prototype.setVolume=function(percent){if(typeof this.myPlayer=='undefined')this.myPlayer=thisMovie(this.playerDiv);if(this.myPlayer){if(percent<0)percent=0;else if(percent>100)percent=100;this.myPlayer.setVolume(percent/100);this.volume=this.getVolume();if(this.volume==0){this.muted=true;}else{this.muted=false;}
jQuery(this).trigger({type:"volumechange",message:"volumechange",time:new Date()});}}
FlashPlayer.prototype.getVolume=function(){if(typeof this.myPlayer=='undefined')this.myPlayer=thisMovie(this.playerDiv);if(this.myPlayer){return this.myPlayer.getVolume()*100;}}
FlashPlayer.prototype.getDuration=function(){return this.duration;}
FlashPlayer.prototype.getCurrentTime=function(){return this.currentTime;}
FlashPlayer.prototype.isMetadataLoaded=function(){return(this.getDuration()&&this.getDuration()>0)?true:false;}
FlashPlayer.prototype.showControls=function(value){if(typeof this.myPlayer=='undefined')this.myPlayer=thisMovie(this.playerDiv);if(typeof this.myPlayer!='undefined')
this.myPlayer.controls=value;}
FlashPlayer.prototype.isMuted=function(value){if(typeof this.myPlayer=='undefined')this.myPlayer=thisMovie(this.playerDiv);if(typeof this.myPlayer!='undefined')
this.myPlayer.muted=value;}
FlashPlayer.prototype.removePlayer=function(){this.myPlayer=undefined;swfobject.removeSWF(this.playerDiv);}
FlashPlayer.prototype.getAvailableQualityLevels=function(){var aux=new Array()
try{if(this.myPlayer!=null){aux=this.myPlayer.getAvailableQualityLevels();return aux;}}catch(error){return aux;}}
FlashPlayer.prototype.getPlaybackQuality=function(){var aux="";try{if(this.myPlayer!=null){aux=this.myPlayer.getPlaybackQuality();return aux;}}catch(error){return aux;}}
FlashPlayer.prototype.setPlaybackQuality=function(value){try{if(this.myPlayer!=null){this.myPlayer.setPlaybackQuality(value);}}catch(error){}}
FlashPlayer.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.unsubscribe=function(fn){eventAction=null;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
FlashPlayer.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function VimeoPlayer(controllerId){this.type="vimeo";this.url;this.state;this.myPlayer;this.duration;this.paused;this.api_loaded;this.currentTime;this.id;this.controllerId=controllerId;this.idComponent;this.theEvent;this.currentSrc;this.baseURI=window.location.href;this.volume;this.muted;this.loaded=false;}
VimeoPlayer.prototype.createPlayer=function(idComponent,videoData){var _this=this;this.id=videoData.id;this.idComponent=idComponent;this.theEvent=this.CustomEvent("OnSomethingHappened");this.currentSrc=videoData.srcVimeo
this.duration=0;if(detectIpad())jQuery(this.idComponent).find('#gp-display').addClass('gp-display');if(jQuery(idComponent).find('.gp-display-video').length)
{var altoFrame="";if(navigator.userAgent.indexOf('Safari')!=-1&&navigator.userAgent.indexOf('Chrome')==-1){jQuery(idComponent).find('.gp-display').css({top:'0px',position:'absolute'})
altoFrame=jQuery(idComponent).find('.gp-display-video').height()+'px';}else{altoFrame="100%"}
jQuery(idComponent).find('.gp-display-video').append('<div class="gp-cubierta-onmove" style="display:none;"></div><div class="gp-left-cubierta-onmove" style="display:none;"></div><div class="gp-right-cubierta-onmove" style="display:none;"></div>');jQuery(idComponent).find('.gp-display-video').append('<iframe id="player_'+this.id+'" src="http://player.vimeo.com/video/'+this.currentSrc+'?api=1&amp;player_id=player_'+videoData.id+'" style="height: '+altoFrame+';width: 100%;" frameborder="0" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" scrolling="no"></iframe>');setTimeout(function(){if(_this.loaded==false){jQuery(_this).trigger({type:"error",message:"error",time:new Date()});_this.dispatchEvent(["error",0,_this.duration]);}},5000);if(navigator.userAgent.indexOf('Safari')!=-1&&navigator.userAgent.indexOf('Chrome')==-1){jQuery(idComponent).find('#player_'+_this.id).height(jQuery(idComponent).find('.gp-display-video').height());jQuery(window).resize(function(){jQuery(idComponent).find('#player_'+_this.id).height(jQuery(idComponent).find('.gp-display-video').height());console.log("redimensiono "+jQuery(idComponent).find('#player_'+_this.id).height());});}}
this.activateListeners(this);}
VimeoPlayer.prototype.resize=function(){jQuery(this.idComponent).find('#player_'+this.id).height(jQuery(this.idComponent).find('.gp-display-video').height());}
VimeoPlayer.prototype.activateListeners=function(obj){var done=false;var vimeoPlayers=document.querySelectorAll('iframe#player_'+obj.id),player;var dur=0;var _this=obj;for(var i=0,length=vimeoPlayers.length;i<length;i++){player=vimeoPlayers[i];player_id='player_'+obj.id;_this.myPlayer=$f(player);$f(player).addEvent('ready',function(){_this.loaded=true;if(!detectIpad()){$f(player).api('play');}
$f(player).addEvent('play',function(){_this.paused=false;$f(player).api('getDuration',function(value,player_id){_this.duration=value;});if(!done){jQuery(this).trigger({type:"play",message:"play",time:new Date()});_this.dispatchEvent(["start",0,_this.duration]);done=true;}else{jQuery(this).trigger({type:"playing",message:"playing",time:new Date()});_this.dispatchEvent(["playing",0,_this.duration]);}});$f(player).addEvent('pause',function(){if(_this.currentTime<_this.duration-1){_this.paused=true;jQuery(this).trigger({type:"pause",message:"pause",time:new Date()});_this.dispatchEvent(["paused",_this.currentTime,_this.duration]);}});$f(player).addEvent('finish',function(){jQuery(this).trigger({type:"ended",message:"ended",time:new Date()});_this.dispatchEvent(["end",_this.currentTime,_this.duration]);});$f(player).addEvent('playProgress',function(){$f(player).api('getCurrentTime',function(value,player_id){_this.currentTime=value;jQuery(this).trigger({type:"progress",message:"progress",time:new Date()});_this.dispatchEvent(["time",value,_this.duration]);});});});}}
VimeoPlayer.prototype.getSkipAd=function(vastData){var result=0;return result;}
VimeoPlayer.prototype.getIdCampaing=function(vastData){var result="";return result;}
VimeoPlayer.prototype.getAdText=function(vastData){var result="";return result;}
VimeoPlayer.prototype.play=function(){if(this.myPlayer&&this.paused){this.myPlayer.api('play');}}
VimeoPlayer.prototype.pause=function(){if(this.myPlayer&&!this.paused){this.myPlayer.api('pause');}}
VimeoPlayer.prototype.seekTo=function(percent){if(this.myPlayer){this.myPlayer.api('seekTo',((percent*this.getDuration())/100));}}
VimeoPlayer.prototype.setVolume=function(percent){if(this.myPlayer){if(percent>0)percent=percent/100;this.myPlayer.api('setVolume',percent);this.volume=this.getVolume();if(this.volume==0){this.muted=true;}else{this.muted=false;}
jQuery(this).trigger({type:"volumechange",message:"volumechange",time:new Date()});}}
VimeoPlayer.prototype.getVolume=function(){if(this.myPlayer){return this.myPlayer.api('getVolume');}}
VimeoPlayer.prototype.getDuration=function(){return this.duration;}
VimeoPlayer.prototype.getCurrentTime=function(){return this.currentTime;}
VimeoPlayer.prototype.isMetadataLoaded=function(){return(this.myPlayer.api('getDuration')&&this.myPlayer.api('getDuration')>0)?true:false;}
VimeoPlayer.prototype.showControls=function(value){}
VimeoPlayer.prototype.isMuted=function(value){}
VimeoPlayer.prototype.removePlayer=function(){jQuery("iframe[id=player_"+this.id+"]").remove();}
VimeoPlayer.prototype.getAvailableQualityLevels=function(){var aux=new Array()
return aux;}
VimeoPlayer.prototype.getPlaybackQuality=function(){return"";}
VimeoPlayer.prototype.setPlaybackQuality=function(value){}
VimeoPlayer.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.unsubscribe=function(fn){eventAction=null;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
VimeoPlayer.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});};function NativePlayer(controllerId,vastData){this.type="native";this.url;this.state;this.myPlayer;this.duration;this.paused=false;this.currentTime;this.id;this.isFirstStart=false;this.controllerId=controllerId;this.idComponent;this.theEvent;this.currentSrc;this.baseURI=window.location.href;this.volume;this.muted;this.ended=false;this.isActivateListeners=false;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";this.vastData=vastData;}
NativePlayer.prototype.createPlayer=function(idComponent,videoData,timeToCloseConnection){this.isFirstStart=false;this.idComponent=idComponent;this.theEvent=this.CustomEvent("OnSomethingHappened");this.id=videoData.id;this.url=videoData.src;this.currentSrc=videoData.src;this.videoData=videoData;if(jQuery(idComponent).find('.gp-display-video').find('#my_video').length==0){if(videoData.isAudio){jQuery(idComponent).find('.gp-display-video').html('<audio id="my_video" class="my_audio" src="'+videoData.src+'" preload="metadata"></audio>');}else{jQuery(idComponent).find('.gp-display-video').html('<video id="my_video" class="my_video" src="'+videoData.src+'" style="display:none;" poster="'+videoData.picture+'"></video>');}
if(detectmob()){jQuery(this.idComponent).find("#my_video").show();}
if(navigator.userAgent.indexOf('Safari')!=-1&&navigator.userAgent.indexOf('Chrome')==-1){}
this.activateListeners();}else{jQuery(this.idComponent).find('.gp-display-video').show();this.myPlayer=document.getElementById("my_video");this.myPlayer.src=videoData.src;this.myPlayer.load();if(!detectWebBrowserAndroid()){if(!detectmob()){this.myPlayer.play();}else{jQuery(this.idComponent).find("#my_video").css({"z-index":"0","left":"0px","top":"0px","position":"absolute"});if(navigator.userAgent.match(/Android/i)){if(videoData.isPubli==false){this.myPlayer.play();}}else{this.myPlayer.play();}}}else{this.myPlayer.play();}}
if(videoData.isAudio){jQuery(this.idComponent).find("#my_video").css('opacity',0);}else{jQuery(this.idComponent).find("#my_video").css('opacity',1);}
jQuery(idComponent).find('#my_video').height(jQuery(idComponent).find('.gp-display-video').height());jQuery(idComponent).find('#my_video').width(jQuery(idComponent).find('.gp-display-video').width());jQuery(window).resize(function(){jQuery(idComponent).find('#my_video').height(jQuery(idComponent).find('.gp-display-video').height());jQuery(idComponent).find('#my_video').width(jQuery(idComponent).find('.gp-display-video').width());});jQuery(this.idComponent).find('.gp-display-video').show();this.myPlayer=document.getElementById("my_video");if(this.isActivateListeners==false){this.activateListeners();}}
NativePlayer.prototype.createPlayerPP=function(idComponent,videoData){this.isFirstStart=false;this.idComponent=idComponent;this.theEvent=this.CustomEvent("OnSomethingHappened");this.id=videoData.id;this.url=videoData.src;this.currentSrc=videoData.src;this.videoData=videoData;if(jQuery(idComponent).find('#my_video_pp').length==0){jQuery(idComponent).html('<video id="my_video_pp" preload="metadata" muted name="my_video_pp" class="my_video_pp" src="'+videoData.src+'" style="display:none;opacity:0.1;width:1px;height:2px;"></video>');if(detectmob()){jQuery(this.idComponent).find("#my_video_pp").show();}
if(navigator.userAgent.indexOf('Safari')!=-1&&navigator.userAgent.indexOf('Chrome')==-1){}
this.activateListeners();}else{jQuery(this.idComponent).find("#my_video_pp").show();this.myPlayer=document.getElementById("my_video_pp");this.myPlayer.volume=0;this.myPlayer.src=videoData.src;this.myPlayer.load();if(!detectWebBrowserAndroid()){if(!detectmob()){this.myPlayer.play();}else{if(navigator.userAgent.match(/Android/i)){if(videoData.isPubli==false){this.myPlayer.play();}}else{this.myPlayer.play();}}}else{this.myPlayer.play();}
jQuery(this.idComponent).find("#my_video_pp").show();}
jQuery(this.idComponent).find("#my_video_pp").css('opacity',0.1);this.myPlayer=document.getElementById("my_video_pp");this.myPlayer.play();if(this.isActivateListeners==false){this.activateListeners();}}
NativePlayer.prototype.resize=function(){jQuery(this.idComponent).find('#my_video').height(jQuery(this.idComponent).find('.gp-display-video').height());jQuery(this.idComponent).find('#my_video').width(jQuery(this.idComponent).find('.gp-display-video').width());}
NativePlayer.prototype.bandWidthEvent=function(message){switch(message[0]){case"loaded":var indexSelected=this.getIndexByQualityValue(this.getPlaybackQuality());if((message[1]>2)&&(indexSelected<this.videoData.qualities.length-1)){this.setPlaybackQuality(this.videoData.qualities[this.videoData.qualities.length-1].value);}
break;}}
NativePlayer.prototype.activateListeners=function(){var _this=this;var isTestedBandwidth=false;if(this.myPlayer!=null&&this.myPlayer.src!=''){if(typeof handlers!='undefined')handlers.forEach(Handler.removeListener);handlers=new Array();this.isActivateListeners=true;handlers[0]=Handler.addListener(this.myPlayer,'play',function(){_this.showControls(false);if(!_this.isFirstStart){jQuery(_this).trigger({type:"play",message:"play",time:new Date()});_this.dispatchEvent(["buffering",this.currentTime,this.duration]);_this.isFirstStart=true;}else{_this.dispatchEvent(["playing",this.currentTime,this.duration]);}},false);handlers[1]=Handler.addListener(this.myPlayer,'timeupdate',function(){if(this.duration&&this.duration>0&&this.currentTime>=(this.duration-0.1)&&_this.isFirstStart){this.ended=true;jQuery(_this).trigger({type:"ended",message:"ended",time:new Date()});_this.dispatchEvent(["end",this.currentTime,this.duration]);_this.isFirstStart=false;}else{_this.dispatchEvent(["time",this.currentTime,this.duration]);}
if(!detectmob()){if(this.currentTime&&this.currentTime>3&&!isTestedBandwidth&&_this.getAvailableQualityLevels().length>1){isTestedBandwidth=true;var bandWidth=new DetectBandWidth();bandWidth.theEvent.subscribe(function(sender,eventArgs){_this.bandWidthEvent(eventArgs.message);});bandWidth.check();}}},false);handlers[2]=Handler.addListener(this.myPlayer,'error',function(err){if(_this.myPlayer.src!='undefined'&&_this.myPlayer.src!=""){switch(err.target.error.code){case err.target.error.MEDIA_ERR_ABORTED:break;case err.target.error.MEDIA_ERR_NETWORK:_this.dispatchEvent(["error",0,0]);break;case err.target.error.MEDIA_ERR_DECODE:_this.dispatchEvent(["error",0,0]);break;case err.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:_this.dispatchEvent(["error",0,0]);break;default:_this.dispatchEvent(["error",0,0]);break;}}},false);handlers[3]=Handler.addListener(this.myPlayer,'waiting',function(){jQuery(_this).trigger({type:"waiting",message:"waiting",time:new Date()});},false);handlers[4]=Handler.addListener(this.myPlayer,'playing',function(){jQuery(_this).trigger({type:"playing",message:"playing",time:new Date()});_this.dispatchEvent(["playing",this.currentTime,this.duration]);},false);handlers[5]=Handler.addListener(this.myPlayer,'suspend',function(){if(this.src!='undefined'&&this.src!=""){_this.playSuspend();_this.dispatchEvent(["suspend",0,0]);}},false);handlers[6]=Handler.addListener(this.myPlayer,'abort',function(){},false);handlers[7]=Handler.addListener(this.myPlayer,'loadeddata',function(){jQuery(_this.idComponent).find('video[class*=my_video]').show();_this.dispatchEvent(["start",this.currentTime,this.duration]);},false);handlers[8]=Handler.addListener(this.myPlayer,'loadeddata',function(){_this.dispatchEvent(["loadeddata",this.currentTime,this.duration]);},false);handlers[9]=Handler.addListener(this.myPlayer,'canplaythrough',function(){},false);handlers[10]=Handler.addListener(this.myPlayer,_this.clickEvent,function onClickEvent(){if(!detectIphone()){if(!_this.myPlayer.paused){_this.dispatchEvent(["click",0,0]);}
if(detectWebBrowserAndroid()){this.play();}}
this.addEventListener(_this.clickEvent,function onClickTogglePause(){this.removeEventListener(_this.clickEvent,onClickTogglePause);},false);},false);handlers[11]=Handler.addListener(this.myPlayer,"pause",function(){jQuery(_this).trigger({type:"pause",message:"pause",time:new Date()});_this.paused=this.paused;if(this.currentTime<this.duration){_this.dispatchEvent(["paused",this.currentTime,this.duration]);}else if(this.currentTime>=this.duration){_this.paused=false;}},false);handlers[12]=Handler.addListener(this.myPlayer,"canplay",function(){if(detectWebBrowserAndroid()){this.play();}
jQuery(_this).trigger({type:"canplay",message:"canplay",time:new Date()});},false);if(detectIphone()){handlers[3]=Handler.addListener(this.myPlayer,'ended',function(){jQuery(_this).trigger({type:"ended",message:"ended",time:new Date()});},false);}}}
NativePlayer.prototype.play=function(){if(this.myPlayer&&this.myPlayer.paused){this.myPlayer.play();}
this.paused=this.myPlayer.paused;}
NativePlayer.prototype.playSuspend=function(){if(!detectWebBrowserAndroid()){this.myPlayer.play();}
this.paused=this.myPlayer.paused;}
NativePlayer.prototype.pause=function(){if(this.myPlayer&&!this.myPlayer.paused){this.myPlayer.pause();this.paused=this.myPlayer.paused;}}
NativePlayer.prototype.seekTo=function(percent){if(this.myPlayer){this.myPlayer.currentTime=(percent*this.getDuration())/100;}}
NativePlayer.prototype.setVolume=function(percent){if(this.myPlayer){if(percent<0)percent=0;else if(percent>100)percent=100;this.myPlayer.volume=percent/100;this.volume=this.getVolume();if(this.volume==0){this.muted=true;}else{this.muted=false;}
jQuery(this).trigger({type:"volumechange",message:"volumechange",time:new Date()});}}
NativePlayer.prototype.getVolume=function(){if(this.myPlayer){return this.myPlayer.volume*100;}}
NativePlayer.prototype.getDuration=function(){return this.myPlayer.duration;}
NativePlayer.prototype.getCurrentTime=function(){return this.myPlayer.currentTime;}
NativePlayer.prototype.isMetadataLoaded=function(){return(this.getDuration()&&this.getDuration()>0)?true:false;}
NativePlayer.prototype.showControls=function(value){if((typeof this.myPlayer!='undefined')&&(this.myPlayer!=null))
this.myPlayer.controls=value;}
NativePlayer.prototype.isMuted=function(value){if(typeof this.myPlayer!='undefined')
this.myPlayer.muted=value;}
NativePlayer.prototype.removePlayer=function(){handlers.forEach(Handler.removeListener);this.isActivateListeners=false;if(!detectmob()){this.myPlayer=undefined;jQuery(this.idComponent).find('#my_video').remove();}else{if(this.myPlayer){this.myPlayer.src='';this.myPlayer.load();}}}
NativePlayer.prototype.getAvailableQualityLevels=function(){var result=new Array();if(this.videoData.qualities&&this.videoData.qualities.length>1){for(var i=0;i<this.videoData.qualities.length;i++){result.push(this.videoData.qualities[i].value);}}
return result;}
NativePlayer.prototype.getPlaybackQuality=function(){var result=0;var ruta=jQuery(this.idComponent).find("#my_video").attr('src');if(this.videoData.qualities&&this.videoData.qualities.length>1){for(var i=0;i<this.videoData.qualities.length;i++){debugPlayer("indice seleccionado ruta "+ruta);debugPlayer("indice seleccionado this.videoData.qualities[i].url "+this.videoData.qualities[i].url);debugPlayer("indice seleccionado this.videoData.qualities[i].url "+ruta.indexOf(this.videoData.qualities[i].url));if(ruta.indexOf(this.videoData.qualities[i].url)==0){debugPlayer("indice seleccionado "+i);return this.videoData.qualities[i].value;}}}
return 0;}
NativePlayer.prototype.setPlaybackQuality=function(value){if(this.videoData.qualities&&this.videoData.qualities.length>1){for(var i=0;i<this.videoData.qualities.length;i++){if(this.videoData.qualities[i].value==value){Handler.removeListener(this.handler);this.dispatchEvent(["buffering",this.getCurrentTime(),this.getDuration()]);jQuery(this.idComponent).find("#my_video").attr('autoplay',!this.myPlayer.paused);jQuery(this.idComponent).find("#my_video").attr('src',this.videoData.qualities[i].url+'#t='+parseInt(this.getCurrentTime()));return;}}}}
NativePlayer.prototype.getIndexByQualityValue=function(value){var result=0;if(this.videoData.qualities&&this.videoData.qualities.length>1){for(var i=0;i<this.videoData.qualities.length;i++){if(this.videoData.qualities[i].value==value){result=i;break;}}}
return result;}
NativePlayer.prototype.getMetadataID3=function(){var datos="";var _this=this;try{ID3.loadTags(this.url,function(){var tags=ID3.getAllTags(_this.url);for(var propertyName in tags){if(typeof tags[propertyName]=="object"){if(typeof tags[propertyName].id!='undefined'){datos+=tags[propertyName].id+":"+tags[propertyName].data+",";}}}
datos=datos.substring(0,datos.length-1);getStreamTitle(datos);},{tags:["title","artist","album","picture"]});}catch(error){console.log("No se han podido obtener los metadatos "+error);}}
NativePlayer.prototype.getUrlClick=function(){var urlC="";if(this.myPlayer&&this.myPlayer.getUrlClick()){urlC=this.myPlayer.getUrlClick();}
console.log('[NativePlayer] getURlClick '+urlC);return urlC;}
NativePlayer.prototype.getSkipAd=function(){var result=0;if(this.vastData){result=this.vastData.getSkipAd();}
return result;}
NativePlayer.prototype.getSkipoffset=function(){var result=0;if(this.vastData){result=this.vastData.getSkipoffset();}
return result;}
NativePlayer.prototype.getIdCampaing=function(){var result="";if(this.vastData){result=this.vastData.getCompaingId();}
return result;}
NativePlayer.prototype.getAdText=function(){var result="";if(this.vastData){result=this.vastData.getAdText();}
return result;}
NativePlayer.prototype.getAdMute=function(){var result=false;if(this.vastData){result=(this.vastData.getAdMute()=='y')?true:false;}
return result;}
NativePlayer.prototype.getAdTwitter=function(){var urlC="";try{if(this.vastData){urlC=this.vastData.getAdTwitter();}}catch(error){urlC="";}
return urlC;}
NativePlayer.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.unsubscribe=function(fn){eventAction=null;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
NativePlayer.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});}
NativePlayer.prototype.addOnProgressHandler=function(){var _this=this;return Handler.addListener(_this.myPlayer,'progress',function(){if(this.buffered.length>0){var percentLoaded=parseInt(((this.buffered.end(this.buffered.length-1)/this.duration)*100));var percentLoaded=parseInt(((this.buffered.end(this.buffered.length-1)/this.duration)*100));}},false);}
var Handler=(function(){var i=1,listeners={};return{addListener:function(element,event,handler,capture){element.addEventListener(event,handler,capture);listeners[i]={element:element,event:event,handler:handler,capture:capture};return i++;},removeListener:function(id){if(id in listeners){var h=listeners[id];h.element.removeEventListener(h.event,h.handler,h.capture);}}};}());;var idvideoYTGlobal;function YoutubePlayer(controllerId){this.type="youtube";this.url;this.state;this.myPlayer;this.duration;this.paused;this.api_loaded;this.currentTime;this.id;this.controllerId=controllerId;this.idComponent;this.intervalTime;this.theEvent;this.states={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5}
this.currentSrc;this.baseURI=window.location.href;this.volume;this.muted;this.config;this.videoData;this.autoPlay=true;this.clickEvent=(navigator.userAgent.match(/iPad/i))?"touchstart":"click";}
YoutubePlayer.prototype.createPlayer=function(idComponent,videoData,config){var result="";this.videoData=videoData;this.id=videoData.id;this.config=config;this.idComponent=idComponent;this.url=videoData.srcYT;this.currentSrc=videoData.srcYT;this.theEvent=this.CustomEvent("OnSomethingHappened");var is_safari=navigator.userAgent.indexOf("Safari")>-1;if(jQuery(idComponent).find('.gp-display-video').length)
{jQuery(idComponent).find('.gp-display-video').html('<div class="gp-cubierta-onmove" style="display:none;"></div><div class="gp-left-cubierta-onmove" style="display:none;"></div><div class="gp-right-cubierta-onmove" style="display:none;"></div><div id="youtube-player"></div>');jQuery(this.idComponent).find('.gp-display-video').show();if(navigator.userAgent.indexOf('Safari')!=-1&&navigator.userAgent.indexOf('Chrome')==-1){jQuery(idComponent).find('#youtube-player').height(jQuery(idComponent).find('.gp-display-video').height());jQuery(window).resize(function(){jQuery(idComponent).find('#youtube-player').height(jQuery(idComponent).find('.gp-display-video').height());});}
if(detectIpad())jQuery(idComponent).find('.gp-display-crop').hide();}
if(true){if(typeof YT=='undefined'){var tag=document.createElement('script');tag.src="https://www.youtube.com/iframe_api";var firstScriptTag=document.getElementsByTagName('script')[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);this.api_loaded=true;idvideoYTGlobal=this.controllerId;}else{onYouTubeIframeAPIReady();}
return true;}else{return false;}}
YoutubePlayer.prototype.resize=function(){jQuery(this.idComponent).find('#youtube-player').height(jQuery(this.idComponent).find('.gp-display-video').height());}
YoutubePlayer.prototype.createPlayer2=function(){var showControls=0;if(this.config.showSubtitles)showControls=1;if(typeof this.videoData.activateAccounting=='undefined')this.videoData.activateAccounting=false;this.autoPlay=(this.videoData.activateAccounting==true)?0:1;var params=new Object();params.origin='https://';params.showinfo=0;params.controls=showControls;params.autoplay=this.autoPlay;if(this.config.showSubtitles==true){params.cc_load_policy=1;params.cc_lang_pref=this.config.subtitlesLang;}
params.iv_load_policy=3;params.disablekb=1;this.myPlayer=new YT.Player('youtube-player',{height:'100%',width:'100%',videoId:this.url,controls:0,autohide:0,playerVars:params});this.activateListeners();}
YoutubePlayer.prototype.activateListeners=function(){var done=false;var _this=this;var intervalYT;if(this.myPlayer!=null){this.myPlayer.addEventListener("onReady",function videoStart(event){if(event.data==null){_this.dispatchEvent(["loadeddata",_this.getCurrentTime(),_this.getDuration()]);event.target.addEventListener("onStateChange",function onTimeUpdate(evt){if(evt.data==YT.PlayerState.PLAYING&&!done){if(_this.videoData.activateAccounting==false){_this.intervalTime=setInterval(function(){_this.dispatchEvent(["time",_this.getCurrentTime(),_this.getDuration()]);},1000);_this.dispatchEvent(["start",_this.getCurrentTime(),_this.getDuration()]);}else{_this.intervalTime=setInterval(function(){_this.dispatchEvent(["time",_this.getCurrentTime(),_this.getDuration()]);},1000);_this.videoData.activateAccounting=false;_this.dispatchEvent(["startPreroll",_this.getCurrentTime(),_this.getDuration()]);}
done=true;}else if(evt.data==YT.PlayerState.ENDED){clearInterval(_this.intervalTime);_this.paused=false;_this.dispatchEvent(["end",_this.getCurrentTime(),_this.getDuration()]);_this.removePlayer();done=false;}else if(evt.data==YT.PlayerState.PAUSED){clearInterval(_this.intervalTime);if(_this.getCurrentTime()<_this.getDuration())
_this.dispatchEvent(["paused",_this.getCurrentTime(),_this.getDuration()]);}else if(evt.data==YT.PlayerState.PLAYING){if(_this.myPlayer)_this.paused=(_this.myPlayer.getPlayerState()==_this.states.PAUSED);clearInterval(_this.intervalTime);_this.intervalTime=setInterval(function(){_this.dispatchEvent(["time",_this.getCurrentTime(),_this.getDuration()]);},1000);_this.dispatchEvent(["playing",_this.getCurrentTime(),_this.getDuration()]);}
if(_this.myPlayer)_this.paused=(_this.myPlayer.getPlayerState()==_this.states.PAUSED);},false);event.target.addEventListener("onError",function videoFailed(err){_this.dispatchEvent(["error",_this.getCurrentTime(),_this.getDuration()]);},false);event.target.addEventListener("onPlaybackQualityChange",function onQualityChange(evt){_this.dispatchEvent(["onQualityChange",evt.data]);},false);}},false);this.myPlayer.addEventListener(_this.clickEvent,function onSpotClickThrough(){_this.dispatchEvent(["error",_this.getCurrentTime(),_this.getDuration()]);},false);}}
YoutubePlayer.prototype.getSkipAd=function(vastData){var result=0;return result;}
YoutubePlayer.prototype.getIdCampaing=function(vastData){var result="";return result;}
YoutubePlayer.prototype.getAdText=function(vastData){var result="";return result;}
YoutubePlayer.prototype.play=function(){if(this.myPlayer&&this.paused){this.myPlayer.playVideo();this.paused=this.myPlayer.paused;}}
YoutubePlayer.prototype.pause=function(){if(this.myPlayer&&!this.paused){this.myPlayer.pauseVideo();}}
YoutubePlayer.prototype.seekTo=function(percent){if(this.myPlayer){this.myPlayer.seekTo((percent*this.getDuration())/100,true);}}
YoutubePlayer.prototype.setVolume=function(percent){if(this.myPlayer){if(percent<0)percent=0;else if(percent>100)percent=100;this.myPlayer.setVolume(percent);}}
YoutubePlayer.prototype.getVolume=function(){if(this.myPlayer){return this.myPlayer.getVolume();}}
YoutubePlayer.prototype.getDuration=function(){return this.myPlayer.getDuration();}
YoutubePlayer.prototype.getCurrentTime=function(){return this.myPlayer.getCurrentTime();}
YoutubePlayer.prototype.isMetadataLoaded=function(){return(this.getDuration()&&this.getDuration()>0)?true:false;}
YoutubePlayer.prototype.showControls=function(value){}
YoutubePlayer.prototype.isMuted=function(value){}
YoutubePlayer.prototype.removePlayer=function(){clearInterval(this.intervalTime);if(this.myPlayer!=null){this.myPlayer.destroy();this.myPlayer=null;}}
YoutubePlayer.prototype.getAvailableQualityLevels=function(){var aux=new Array()
try{if(this.myPlayer!=null){aux=this.myPlayer.getAvailableQualityLevels();return aux;}}catch(error){return aux;}}
YoutubePlayer.prototype.getPlaybackQuality=function(){var aux="";try{if(this.myPlayer!=null){aux=this.myPlayer.getPlaybackQuality();return aux;}}catch(error){return aux;}}
YoutubePlayer.prototype.setPlaybackQuality=function(value){try{if(this.myPlayer!=null){this.myPlayer.setPlaybackQuality(value);}}catch(error){}}
YoutubePlayer.prototype.CustomEvent=function(){this.eventName=arguments[0];var mEventName=this.eventName;var eventAction=null;this.subscribe=function(fn){eventAction=fn;};this.unsubscribe=function(fn){eventAction=null;};this.fire=function(sender,eventArgs){if(eventAction!=null){eventAction(sender,eventArgs);}
else{}};return this;}
YoutubePlayer.prototype.dispatchEvent=function(arg){this.theEvent.fire(this,{message:arg});}
YoutubePlayer.prototype.getTypeContent=function(codeYT){var result="";var urlAPI="https://www.googleapis.com/youtube/v3/videos?id="+codeYT+"&key=AIzaSyAXoFZINvdQ5O15nGw748ilvfWImcyQx0Y&part=snippet"
$.ajax({url:urlAPI,dataType:'json',async:false,success:function(json){result=json.items[0].snippet.liveBroadcastContent;},error:function(objXMLHttpRequest){result="";}});return result;}
function onYouTubeIframeAPIReady(){if(scgp_videoControllers.getItem(idvideoYTGlobal).pl)
scgp_videoControllers.getItem(idvideoYTGlobal).pl.createPlayer2();};var Froogaloop=(function(){function Froogaloop(iframe){return new Froogaloop.fn.init(iframe);}
var eventCallbacks={},hasWindowEvent=false,isReady=false,slice=Array.prototype.slice,playerOrigin='*';Froogaloop.fn=Froogaloop.prototype={element:null,init:function(iframe){if(typeof iframe==="string"){iframe=document.getElementById(iframe);}
this.element=iframe;return this;},api:function(method,valueOrCallback){if(!this.element||!method){return false;}
var self=this,element=self.element,target_id=element.id!==''?element.id:null,params=!isFunction(valueOrCallback)?valueOrCallback:null,callback=isFunction(valueOrCallback)?valueOrCallback:null;if(callback){storeCallback(method,callback,target_id);}
postMessage(method,params,element);return self;},addEvent:function(eventName,callback){if(!this.element){return false;}
var self=this,element=self.element,target_id=element.id!==''?element.id:null;storeCallback(eventName,callback,target_id);if(eventName!='ready'){postMessage('addEventListener',eventName,element);}
else if(eventName=='ready'&&isReady){callback.call(null,target_id);}
return self;},removeEvent:function(eventName){if(!this.element){return false;}
var self=this,element=self.element,target_id=element.id!==''?element.id:null,removed=removeCallback(eventName,target_id);if(eventName!='ready'&&removed){postMessage('removeEventListener',eventName,element);}}};function postMessage(method,params,target){if(!target.contentWindow.postMessage){return false;}
var data=JSON.stringify({method:method,value:params});target.contentWindow.postMessage(data,playerOrigin);}
function onMessageReceived(event){var data,method;try{data=JSON.parse(event.data);method=data.event||data.method;}
catch(e){}
if(method=='ready'&&!isReady){isReady=true;}
if(!(/^https?:\/\/player.vimeo.com/).test(event.origin)){return false;}
if(playerOrigin==='*'){playerOrigin=event.origin;}
var value=data.value,eventData=data.data,target_id=target_id===''?null:data.player_id,callback=getCallback(method,target_id),params=[];if(!callback){return false;}
if(value!==undefined){params.push(value);}
if(eventData){params.push(eventData);}
if(target_id){params.push(target_id);}
return params.length>0?callback.apply(null,params):callback.call();}
function storeCallback(eventName,callback,target_id){if(target_id){if(!eventCallbacks[target_id]){eventCallbacks[target_id]={};}
eventCallbacks[target_id][eventName]=callback;}
else{eventCallbacks[eventName]=callback;}}
function getCallback(eventName,target_id){if(target_id){return eventCallbacks[target_id][eventName];}
else{return eventCallbacks[eventName];}}
function removeCallback(eventName,target_id){if(target_id&&eventCallbacks[target_id]){if(!eventCallbacks[target_id][eventName]){return false;}
eventCallbacks[target_id][eventName]=null;}
else{if(!eventCallbacks[eventName]){return false;}
eventCallbacks[eventName]=null;}
return true;}
function isFunction(obj){return!!(obj&&obj.constructor&&obj.call&&obj.apply);}
function isArray(obj){return toString.call(obj)==='[object Array]';}
Froogaloop.fn.init.prototype=Froogaloop.fn;if(window.addEventListener){window.addEventListener('message',onMessageReceived,false);}
else{window.attachEvent('onmessage',onMessageReceived);}
return(window.Froogaloop=window.$f=Froogaloop);})();;function HashTable(obj)
{this.length=0;this.items={};for(var p in obj){if(obj.hasOwnProperty(p)){this.items[p]=obj[p];this.length++;}}
this.setItem=function(key,value)
{var previous=undefined;if(this.hasItem(key)){previous=this.items[key];}
else{this.length++;}
this.items[key]=value;return previous;}
this.getItem=function(key){return this.hasItem(key)?this.items[key]:undefined;}
this.hasItem=function(key)
{return this.items.hasOwnProperty(key);}
this.removeItem=function(key)
{if(this.hasItem(key)){previous=this.items[key];this.length--;delete this.items[key];return previous;}
else{return undefined;}}
this.keys=function()
{var keys=[];for(var k in this.items){if(this.hasItem(k)){keys.push(k);}}
return keys;}
this.values=function()
{var values=[];for(var k in this.items){if(this.hasItem(k)){values.push(this.items[k]);}}
return values;}
this.each=function(fn){for(var k in this.items){if(this.hasItem(k)){fn(k,this.items[k]);}}}
this.clear=function()
{this.items={}
this.length=0;}};
/* SWFObject v2.2 <http://code.google.com/p/swfobject/> 
 is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var UNDEF="undefined",OBJECT="object",SHOCKWAVE_FLASH="Shockwave Flash",SHOCKWAVE_FLASH_AX="ShockwaveFlash.ShockwaveFlash",FLASH_MIME_TYPE="application/x-shockwave-flash",EXPRESS_INSTALL_ID="SWFObjectExprInst",ON_READY_STATE_CHANGE="onreadystatechange",win=window,doc=document,nav=navigator,plugin=false,domLoadFnArr=[main],regObjArr=[],objIdArr=[],listenersArr=[],storedAltContent,storedAltContentId,storedCallbackFn,storedCallbackObj,isDomLoaded=false,isExpressInstallActive=false,dynamicStylesheet,dynamicStylesheetMedia,autoHideShow=true,ua=function(){var w3cdom=typeof doc.getElementById!=UNDEF&&typeof doc.getElementsByTagName!=UNDEF&&typeof doc.createElement!=UNDEF,u=nav.userAgent.toLowerCase(),p=nav.platform.toLowerCase(),windows=p?/win/.test(p):/win/.test(u),mac=p?/mac/.test(p):/mac/.test(u),webkit=/webkit/.test(u)?parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,ie=!+"\v1",playerVersion=[0,0,0],d=null;if(typeof nav.plugins!=UNDEF&&typeof nav.plugins[SHOCKWAVE_FLASH]==OBJECT){d=nav.plugins[SHOCKWAVE_FLASH].description;if(d&&!(typeof nav.mimeTypes!=UNDEF&&nav.mimeTypes[FLASH_MIME_TYPE]&&!nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)){plugin=true;ie=false;d=d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");playerVersion[0]=parseInt(d.replace(/^(.*)\..*$/,"$1"),10);playerVersion[1]=parseInt(d.replace(/^.*\.(.*)\s.*$/,"$1"),10);playerVersion[2]=/[a-zA-Z]/.test(d)?parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0;}}
else if(typeof win.ActiveXObject!=UNDEF){try{var a=new ActiveXObject(SHOCKWAVE_FLASH_AX);if(a){d=a.GetVariable("$version");if(d){ie=true;d=d.split(" ")[1].split(",");playerVersion=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)];}}}
catch(e){}}
return{w3:w3cdom,pv:playerVersion,wk:webkit,ie:ie,win:windows,mac:mac};}(),onDomLoad=function(){if(!ua.w3){return;}
if((typeof doc.readyState!=UNDEF&&doc.readyState=="complete")||(typeof doc.readyState==UNDEF&&(doc.getElementsByTagName("body")[0]||doc.body))){callDomLoadFunctions();}
if(!isDomLoaded){if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("DOMContentLoaded",callDomLoadFunctions,false);}
if(ua.ie&&ua.win){doc.attachEvent(ON_READY_STATE_CHANGE,function(){if(doc.readyState=="complete"){doc.detachEvent(ON_READY_STATE_CHANGE,arguments.callee);callDomLoadFunctions();}});if(win==top){(function(){if(isDomLoaded){return;}
try{doc.documentElement.doScroll("left");}
catch(e){setTimeout(arguments.callee,0);return;}
callDomLoadFunctions();})();}}
if(ua.wk){(function(){if(isDomLoaded){return;}
if(!/loaded|complete/.test(doc.readyState)){setTimeout(arguments.callee,0);return;}
callDomLoadFunctions();})();}
addLoadEvent(callDomLoadFunctions);}}();function callDomLoadFunctions(){if(isDomLoaded){return;}
try{var t=doc.getElementsByTagName("body")[0].appendChild(createElement("span"));t.parentNode.removeChild(t);}
catch(e){return;}
isDomLoaded=true;var dl=domLoadFnArr.length;for(var i=0;i<dl;i++){domLoadFnArr[i]();}}
function addDomLoadEvent(fn){if(isDomLoaded){fn();}
else{domLoadFnArr[domLoadFnArr.length]=fn;}}
function addLoadEvent(fn){if(typeof win.addEventListener!=UNDEF){win.addEventListener("load",fn,false);}
else if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("load",fn,false);}
else if(typeof win.attachEvent!=UNDEF){addListener(win,"onload",fn);}
else if(typeof win.onload=="function"){var fnOld=win.onload;win.onload=function(){fnOld();fn();};}
else{win.onload=fn;}}
function main(){if(plugin){testPlayerVersion();}
else{matchVersions();}}
function testPlayerVersion(){var b=doc.getElementsByTagName("body")[0];var o=createElement(OBJECT);o.setAttribute("type",FLASH_MIME_TYPE);var t=b.appendChild(o);if(t){var counter=0;(function(){if(typeof t.GetVariable!=UNDEF){var d=t.GetVariable("$version");if(d){d=d.split(" ")[1].split(",");ua.pv=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)];}}
else if(counter<10){counter++;setTimeout(arguments.callee,10);return;}
b.removeChild(o);t=null;matchVersions();})();}
else{matchVersions();}}
function matchVersions(){var rl=regObjArr.length;if(rl>0){for(var i=0;i<rl;i++){var id=regObjArr[i].id;var cb=regObjArr[i].callbackFn;var cbObj={success:false,id:id};if(ua.pv[0]>0){var obj=getElementById(id);if(obj){if(hasPlayerVersion(regObjArr[i].swfVersion)&&!(ua.wk&&ua.wk<312)){setVisibility(id,true);if(cb){cbObj.success=true;cbObj.ref=getObjectById(id);cb(cbObj);}}
else if(regObjArr[i].expressInstall&&canExpressInstall()){var att={};att.data=regObjArr[i].expressInstall;att.width=obj.getAttribute("width")||"0";att.height=obj.getAttribute("height")||"0";if(obj.getAttribute("class")){att.styleclass=obj.getAttribute("class");}
if(obj.getAttribute("align")){att.align=obj.getAttribute("align");}
var par={};var p=obj.getElementsByTagName("param");var pl=p.length;for(var j=0;j<pl;j++){if(p[j].getAttribute("name").toLowerCase()!="movie"){par[p[j].getAttribute("name")]=p[j].getAttribute("value");}}
showExpressInstall(att,par,id,cb);}
else{displayAltContent(obj);if(cb){cb(cbObj);}}}}
else{setVisibility(id,true);if(cb){var o=getObjectById(id);if(o&&typeof o.SetVariable!=UNDEF){cbObj.success=true;cbObj.ref=o;}
cb(cbObj);}}}}}
function getObjectById(objectIdStr){var r=null;var o=getElementById(objectIdStr);if(o&&o.nodeName=="OBJECT"){if(typeof o.SetVariable!=UNDEF){r=o;}
else{var n=o.getElementsByTagName(OBJECT)[0];if(n){r=n;}}}
return r;}
function canExpressInstall(){return!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac)&&!(ua.wk&&ua.wk<312);}
function showExpressInstall(att,par,replaceElemIdStr,callbackFn){isExpressInstallActive=true;storedCallbackFn=callbackFn||null;storedCallbackObj={success:false,id:replaceElemIdStr};var obj=getElementById(replaceElemIdStr);if(obj){if(obj.nodeName=="OBJECT"){storedAltContent=abstractAltContent(obj);storedAltContentId=null;}
else{storedAltContent=obj;storedAltContentId=replaceElemIdStr;}
att.id=EXPRESS_INSTALL_ID;if(typeof att.width==UNDEF||(!/%$/.test(att.width)&&parseInt(att.width,10)<310)){att.width="310";}
if(typeof att.height==UNDEF||(!/%$/.test(att.height)&&parseInt(att.height,10)<137)){att.height="137";}
doc.title=doc.title.slice(0,47)+" - Flash Player Installation";var pt=ua.ie&&ua.win?"ActiveX":"PlugIn",fv="MMredirectURL="+encodeURI(window.location).toString().replace(/&/g,"%26")+"&MMplayerType="+pt+"&MMdoctitle="+doc.title;if(typeof par.flashvars!=UNDEF){par.flashvars+="&"+fv;}
else{par.flashvars=fv;}
if(ua.ie&&ua.win&&obj.readyState!=4){var newObj=createElement("div");replaceElemIdStr+="SWFObjectNew";newObj.setAttribute("id",replaceElemIdStr);obj.parentNode.insertBefore(newObj,obj);obj.style.display="none";(function(){if(obj.readyState==4){obj.parentNode.removeChild(obj);}
else{setTimeout(arguments.callee,10);}})();}
createSWF(att,par,replaceElemIdStr);}}
function displayAltContent(obj){if(ua.ie&&ua.win&&obj.readyState!=4){var el=createElement("div");obj.parentNode.insertBefore(el,obj);el.parentNode.replaceChild(abstractAltContent(obj),el);obj.style.display="none";(function(){if(obj.readyState==4){obj.parentNode.removeChild(obj);}
else{setTimeout(arguments.callee,10);}})();}
else{obj.parentNode.replaceChild(abstractAltContent(obj),obj);}}
function abstractAltContent(obj){var ac=createElement("div");if(ua.win&&ua.ie){ac.innerHTML=obj.innerHTML;}
else{var nestedObj=obj.getElementsByTagName(OBJECT)[0];if(nestedObj){var c=nestedObj.childNodes;if(c){var cl=c.length;for(var i=0;i<cl;i++){if(!(c[i].nodeType==1&&c[i].nodeName=="PARAM")&&!(c[i].nodeType==8)){ac.appendChild(c[i].cloneNode(true));}}}}}
return ac;}
function createSWF(attObj,parObj,id){var r,el=getElementById(id);if(ua.wk&&ua.wk<312){return r;}
if(el){if(typeof attObj.id==UNDEF){attObj.id=id;}
if(ua.ie&&ua.win){var att="";for(var i in attObj){if(attObj[i]!=Object.prototype[i]){if(i.toLowerCase()=="data"){parObj.movie=attObj[i];}
else if(i.toLowerCase()=="styleclass"){att+=' class="'+attObj[i]+'"';}
else if(i.toLowerCase()!="classid"){att+=' '+i+'="'+attObj[i]+'"';}}}
var par="";for(var j in parObj){if(parObj[j]!=Object.prototype[j]){par+='<param name="'+j+'" value="'+parObj[j]+'" />';}}
el.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+att+'>'+par+'</object>';objIdArr[objIdArr.length]=attObj.id;r=getElementById(attObj.id);}
else{var o=createElement(OBJECT);o.setAttribute("type",FLASH_MIME_TYPE);for(var m in attObj){if(attObj[m]!=Object.prototype[m]){if(m.toLowerCase()=="styleclass"){o.setAttribute("class",attObj[m]);}
else if(m.toLowerCase()!="classid"){o.setAttribute(m,attObj[m]);}}}
for(var n in parObj){if(parObj[n]!=Object.prototype[n]&&n.toLowerCase()!="movie"){createObjParam(o,n,parObj[n]);}}
el.parentNode.replaceChild(o,el);r=o;}}
return r;}
function createObjParam(el,pName,pValue){var p=createElement("param");p.setAttribute("name",pName);p.setAttribute("value",pValue);el.appendChild(p);}
function removeSWF(id){var obj=getElementById(id);if(obj&&obj.nodeName=="OBJECT"){if(ua.ie&&ua.win){obj.style.display="none";(function(){if(obj.readyState==4){removeObjectInIE(id);}
else{setTimeout(arguments.callee,10);}})();}
else{obj.parentNode.removeChild(obj);}}}
function removeObjectInIE(id){var obj=getElementById(id);if(obj){for(var i in obj){if(typeof obj[i]=="function"){obj[i]=null;}}
obj.parentNode.removeChild(obj);}}
function getElementById(id){var el=null;try{el=doc.getElementById(id);}
catch(e){}
return el;}
function createElement(el){return doc.createElement(el);}
function addListener(target,eventType,fn){target.attachEvent(eventType,fn);listenersArr[listenersArr.length]=[target,eventType,fn];}
function hasPlayerVersion(rv){var pv=ua.pv,v=rv.split(".");v[0]=parseInt(v[0],10);v[1]=parseInt(v[1],10)||0;v[2]=parseInt(v[2],10)||0;return(pv[0]>v[0]||(pv[0]==v[0]&&pv[1]>v[1])||(pv[0]==v[0]&&pv[1]==v[1]&&pv[2]>=v[2]))?true:false;}
function createCSS(sel,decl,media,newStyle){if(ua.ie&&ua.mac){return;}
var h=doc.getElementsByTagName("head")[0];if(!h){return;}
var m=(media&&typeof media=="string")?media:"screen";if(newStyle){dynamicStylesheet=null;dynamicStylesheetMedia=null;}
if(!dynamicStylesheet||dynamicStylesheetMedia!=m){var s=createElement("style");s.setAttribute("type","text/css");s.setAttribute("media",m);dynamicStylesheet=h.appendChild(s);if(ua.ie&&ua.win&&typeof doc.styleSheets!=UNDEF&&doc.styleSheets.length>0){dynamicStylesheet=doc.styleSheets[doc.styleSheets.length-1];}
dynamicStylesheetMedia=m;}
if(ua.ie&&ua.win){if(dynamicStylesheet&&typeof dynamicStylesheet.addRule==OBJECT){dynamicStylesheet.addRule(sel,decl);}}
else{if(dynamicStylesheet&&typeof doc.createTextNode!=UNDEF){dynamicStylesheet.appendChild(doc.createTextNode(sel+" {"+decl+"}"));}}}
function setVisibility(id,isVisible){if(!autoHideShow){return;}
var v=isVisible?"visible":"hidden";if(isDomLoaded&&getElementById(id)){getElementById(id).style.visibility=v;}
else{createCSS("#"+id,"visibility:"+v);}}
function urlEncodeIfNecessary(s){var regex=/[\\\"<>\.;]/;var hasBadChars=regex.exec(s)!=null;return hasBadChars&&typeof encodeURIComponent!=UNDEF?encodeURIComponent(s):s;}
var cleanup=function(){if(ua.ie&&ua.win){window.attachEvent("onunload",function(){var ll=listenersArr.length;for(var i=0;i<ll;i++){listenersArr[i][0].detachEvent(listenersArr[i][1],listenersArr[i][2]);}
var il=objIdArr.length;for(var j=0;j<il;j++){removeSWF(objIdArr[j]);}
for(var k in ua){ua[k]=null;}
ua=null;for(var l in swfobject){swfobject[l]=null;}
swfobject=null;});}}();return{registerObject:function(objectIdStr,swfVersionStr,xiSwfUrlStr,callbackFn){if(ua.w3&&objectIdStr&&swfVersionStr){var regObj={};regObj.id=objectIdStr;regObj.swfVersion=swfVersionStr;regObj.expressInstall=xiSwfUrlStr;regObj.callbackFn=callbackFn;regObjArr[regObjArr.length]=regObj;setVisibility(objectIdStr,false);}
else if(callbackFn){callbackFn({success:false,id:objectIdStr});}},getObjectById:function(objectIdStr){if(ua.w3){return getObjectById(objectIdStr);}},embedSWF:function(swfUrlStr,replaceElemIdStr,widthStr,heightStr,swfVersionStr,xiSwfUrlStr,flashvarsObj,parObj,attObj,callbackFn){var callbackObj={success:false,id:replaceElemIdStr};if(ua.w3&&!(ua.wk&&ua.wk<312)&&swfUrlStr&&replaceElemIdStr&&widthStr&&heightStr&&swfVersionStr){setVisibility(replaceElemIdStr,false);addDomLoadEvent(function(){widthStr+="";heightStr+="";var att={};if(attObj&&typeof attObj===OBJECT){for(var i in attObj){att[i]=attObj[i];}}
att.data=swfUrlStr;att.width=widthStr;att.height=heightStr;var par={};if(parObj&&typeof parObj===OBJECT){for(var j in parObj){par[j]=parObj[j];}}
if(flashvarsObj&&typeof flashvarsObj===OBJECT){for(var k in flashvarsObj){if(typeof par.flashvars!=UNDEF){par.flashvars+="&"+k+"="+flashvarsObj[k];}
else{par.flashvars=k+"="+flashvarsObj[k];}}}
if(hasPlayerVersion(swfVersionStr)){var obj=createSWF(att,par,replaceElemIdStr);if(att.id==replaceElemIdStr){setVisibility(replaceElemIdStr,true);}
callbackObj.success=true;callbackObj.ref=obj;}
else if(xiSwfUrlStr&&canExpressInstall()){att.data=xiSwfUrlStr;showExpressInstall(att,par,replaceElemIdStr,callbackFn);return;}
else{setVisibility(replaceElemIdStr,true);}
if(callbackFn){callbackFn(callbackObj);}});}
else if(callbackFn){callbackFn(callbackObj);}},switchOffAutoHideShow:function(){autoHideShow=false;},ua:ua,getFlashPlayerVersion:function(){return{major:ua.pv[0],minor:ua.pv[1],release:ua.pv[2]};},hasFlashPlayerVersion:hasPlayerVersion,createSWF:function(attObj,parObj,replaceElemIdStr){if(ua.w3){return createSWF(attObj,parObj,replaceElemIdStr);}
else{return undefined;}},showExpressInstall:function(att,par,replaceElemIdStr,callbackFn){if(ua.w3&&canExpressInstall()){showExpressInstall(att,par,replaceElemIdStr,callbackFn);}},removeSWF:function(objElemIdStr){if(ua.w3){removeSWF(objElemIdStr);}},createCSS:function(selStr,declStr,mediaStr,newStyleBoolean){if(ua.w3){createCSS(selStr,declStr,mediaStr,newStyleBoolean);}},addDomLoadEvent:addDomLoadEvent,addLoadEvent:addLoadEvent,getQueryParamValue:function(param){var q=doc.location.search||doc.location.hash;if(q){if(/\?/.test(q)){q=q.split("?")[1];}
if(param==null){return urlEncodeIfNecessary(q);}
var pairs=q.split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=")+1)));}}}
return"";},expressInstallCallback:function(){if(isExpressInstallActive){var obj=getElementById(EXPRESS_INSTALL_ID);if(obj&&storedAltContent){obj.parentNode.replaceChild(storedAltContent,obj);if(storedAltContentId){setVisibility(storedAltContentId,true);if(ua.ie&&ua.win){storedAltContent.style.display="block";}}
if(storedCallbackFn){storedCallbackFn(storedCallbackObj);}}
isExpressInstallActive=false;}}};}();;(function($){$.fn.ddslick=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1));}else if(typeof method==='object'||!method){return methods.init.apply(this,arguments);}else{$.error('Method '+method+' does not exists.');}};var methods={},defaults={data:[],keepJSONItemsOnTop:false,width:260,height:null,background:"#eee",selectText:"",defaultSelectedIndex:null,truncateDescription:true,imagePosition:"left",showSelectedHTML:true,clickOffToClose:true,onSelected:function(){}},ddSelectHtml='<div class="dd-select"><input class="dd-selected-value" type="hidden" /><a class="dd-selected"></a><span class="dd-pointer dd-pointer-down"></span></div>',ddOptionsHtml='<ul class="dd-options"></ul>',ddslickCSS='<style id="css-ddslick" type="text/css">'+'.dd-select{ border-radius:2px; border:solid 1px #ccc; position:relative; cursor:pointer;}'+'.dd-desc { color:#aaa; display:block; overflow: hidden; font-weight:normal; line-height: 1.4em; }'+'.dd-selected{ overflow:hidden; display:block; padding:10px; font-weight:bold;}'+'.dd-pointer{ width:0; height:0; position:absolute; right:10px; top:50%; margin-top:-3px;}'+'.dd-pointer-down{ border:solid 5px transparent; border-top:solid 5px #000; }'+'.dd-pointer-up{border:solid 5px transparent !important; border-bottom:solid 5px #000 !important; margin-top:-8px;}'+'.dd-options{ border:solid 1px #ccc; border-top:none; list-style:none; box-shadow:0px 1px 5px #ddd; display:none; position:absolute; z-index:2000; margin:0; padding:0;background:#fff; overflow:auto;}'+'.dd-option{ padding:10px; display:block; border-bottom:solid 1px #ddd; overflow:hidden; text-decoration:none; color:#333; cursor:pointer;-webkit-transition: all 0.25s ease-in-out; -moz-transition: all 0.25s ease-in-out;-o-transition: all 0.25s ease-in-out;-ms-transition: all 0.25s ease-in-out; }'+'.dd-options > li:last-child > .dd-option{ border-bottom:none;}'+'.dd-option:hover{ background:#f3f3f3; color:#000;}'+'.dd-selected-description-truncated { text-overflow: ellipsis; white-space:nowrap; }'+'.dd-option-selected { background:#f6f6f6; }'+'.dd-option-image, .dd-selected-image { vertical-align:middle; float:left; margin-right:5px; max-width:64px;}'+'.dd-image-right { float:right; margin-right:15px; margin-left:5px;}'+'.dd-container{ position:relative;}​ .dd-selected-text { font-weight:bold}​</style>';if($('#css-ddslick').length<=0){$(ddslickCSS).appendTo('head');}
methods.init=function(options){var options=$.extend({},defaults,options);return this.each(function(){var obj=$(this),data=obj.data('ddslick');if(!data){var ddSelect=[],ddJson=options.data;obj.find('option').each(function(){var $this=$(this),thisData=$this.data();ddSelect.push({text:$.trim($this.text()),value:$this.val(),selected:$this.is(':selected'),description:thisData.description,imageSrc:thisData.imagesrc});});if(options.keepJSONItemsOnTop)
$.merge(options.data,ddSelect);else options.data=$.merge(ddSelect,options.data);var original=obj,placeholder=$('<div id="'+obj.attr('id')+'"></div>');obj.replaceWith(placeholder);obj=placeholder;obj.addClass('dd-container').append(ddSelectHtml).append(ddOptionsHtml);var ddSelect=obj.find('.dd-select'),ddOptions=obj.find('.dd-options');ddOptions.css({width:options.width});ddSelect.css({width:options.width,background:options.background});obj.css({width:options.width});if(options.height!=null)
ddOptions.css({height:options.height,overflow:'auto'});$.each(options.data,function(index,item){if(item.selected)options.defaultSelectedIndex=index;ddOptions.append('<li>'+'<a class="dd-option">'+
(item.value?' <input class="dd-option-value" type="hidden" value="'+item.value+'" />':'')+
(item.imageSrc?' <img class="dd-option-image'+(options.imagePosition=="right"?' dd-image-right':'')+'" src="'+item.imageSrc+'" />':'')+
(item.text?' <label class="dd-option-text">'+item.text+'</label>':'')+
(item.description?' <small class="dd-option-description dd-desc">'+item.description+'</small>':'')+'</a>'+'</li>');});var pluginData={settings:options,original:original,selectedIndex:-1,selectedItem:null,selectedData:null}
obj.data('ddslick',pluginData);if(options.selectText.length>0&&options.defaultSelectedIndex==null){obj.find('.dd-selected').html(options.selectText);}
else{var index=(options.defaultSelectedIndex!=null&&options.defaultSelectedIndex>=0&&options.defaultSelectedIndex<options.data.length)?options.defaultSelectedIndex:0;selectIndex(obj,index);}
obj.find('.dd-select').on('click.ddslick',function(){open(obj);});obj.find('.dd-option').on('click.ddslick',function(){selectIndex(obj,$(this).closest('li').index());});if(options.clickOffToClose){ddOptions.addClass('dd-click-off-close');obj.on('click.ddslick',function(e){e.stopPropagation();});$('body').on('click',function(){$('.dd-click-off-close').slideUp(50).siblings('.dd-select').find('.dd-pointer').removeClass('dd-pointer-up');});}}});};methods.select=function(options){return this.each(function(){if(options.index)
selectIndex($(this),options.index);});}
methods.open=function(){return this.each(function(){var $this=$(this),pluginData=$this.data('ddslick');if(pluginData)
open($this);});};methods.close=function(){return this.each(function(){var $this=$(this),pluginData=$this.data('ddslick');if(pluginData)
close($this);});};methods.destroy=function(){return this.each(function(){var $this=$(this),pluginData=$this.data('ddslick');if(pluginData){var originalElement=pluginData.original;$this.removeData('ddslick').unbind('.ddslick').replaceWith(originalElement);}});}
function selectIndex(obj,index){var pluginData=obj.data('ddslick');var ddSelected=obj.find('.dd-selected'),ddSelectedValue=ddSelected.siblings('.dd-selected-value'),ddOptions=obj.find('.dd-options'),ddPointer=ddSelected.siblings('.dd-pointer'),selectedOption=obj.find('.dd-option').eq(index),selectedLiItem=selectedOption.closest('li'),settings=pluginData.settings,selectedData=pluginData.settings.data[index];obj.find('.dd-option').removeClass('dd-option-selected');selectedOption.addClass('dd-option-selected');pluginData.selectedIndex=index;pluginData.selectedItem=selectedLiItem;pluginData.selectedData=selectedData;if(settings.showSelectedHTML){ddSelected.html((selectedData.imageSrc?'<img class="dd-selected-image'+(settings.imagePosition=="right"?' dd-image-right':'')+'" src="'+selectedData.imageSrc+'" />':'')+
(selectedData.text?'<label class="dd-selected-text">'+selectedData.text+'</label>':'')+
(selectedData.description?'<small class="dd-selected-description dd-desc'+(settings.truncateDescription?' dd-selected-description-truncated':'')+'" >'+selectedData.description+'</small>':''));}
else ddSelected.html(selectedData.text);ddSelectedValue.val(selectedData.value);pluginData.original.val(selectedData.value);obj.data('ddslick',pluginData);close(obj);adjustSelectedHeight(obj);if(typeof settings.onSelected=='function'){settings.onSelected.call(this,pluginData);}}
function open(obj){var $this=obj.find('.dd-select'),ddOptions=$this.siblings('.dd-options'),ddPointer=$this.find('.dd-pointer'),wasOpen=ddOptions.is(':visible');$('.dd-click-off-close').not(ddOptions).slideUp(50);$('.dd-pointer').removeClass('dd-pointer-up');if(wasOpen){ddOptions.slideUp('fast');ddPointer.removeClass('dd-pointer-up');}
else{ddOptions.slideDown('fast');ddPointer.addClass('dd-pointer-up');}
adjustOptionsHeight(obj);}
function close(obj){obj.find('.dd-options').slideUp(50);obj.find('.dd-pointer').removeClass('dd-pointer-up').removeClass('dd-pointer-up');}
function adjustSelectedHeight(obj){var lSHeight=obj.find('.dd-select').css('height');var descriptionSelected=obj.find('.dd-selected-description');var imgSelected=obj.find('.dd-selected-image');if(descriptionSelected.length<=0&&imgSelected.length>0){obj.find('.dd-selected-text').css('lineHeight',lSHeight);}}
function adjustOptionsHeight(obj){obj.find('.dd-option').each(function(){var $this=$(this);var lOHeight=$this.css('height');var descriptionOption=$this.find('.dd-option-description');var imgOption=obj.find('.dd-option-image');if(descriptionOption.length<=0&&imgOption.length>0){$this.find('.dd-option-text').css('lineHeight',lOHeight);}});}})(jQuery);;var context=context||(function(){var options={fadeSpeed:100,filter:function($obj){},above:'auto',preventDoubleContext:true,compress:false};function initialize(opts){options=jQuery.extend({},options,opts);jQuery(document).on('click','html',function(){jQuery('.dropdown-context').fadeOut(options.fadeSpeed,function(){jQuery('.dropdown-context').css({display:''}).find('.drop-left').removeClass('drop-left');});});if(options.preventDoubleContext){jQuery(document).on('contextmenu','.dropdown-context',function(e){e.preventDefault();});}
jQuery(document).on('mouseenter','.dropdown-submenu',function(){var $sub=jQuery(this).find('.dropdown-context-sub:first'),subWidth=$sub.width(),subLeft=$sub.offset().left,collision=(subWidth+subLeft)>window.innerWidth;if(collision){$sub.addClass('drop-left');}});}
function updateOptions(opts){options=jQuery.extend({},options,opts);}
function buildMenu(data,id,subMenu){var subClass=(subMenu)?' dropdown-context-sub':'',compressed=options.compress?' compressed-context':'',$menu=jQuery('<ul class="dropdown-menu dropdown-context'+subClass+compressed+'" id="dropdown-'+id+'"></ul>');var i=0,linkTarget='';for(i;i<data.length;i++){if(typeof data[i].divider!=='undefined'){$menu.append('<li class="divider"></li>');}else if(typeof data[i].header!=='undefined'){$menu.append('<li class="nav-header">'+data[i].header+'</li>');}else{if(typeof data[i].href=='undefined'){data[i].href='#';}
if(typeof data[i].target!=='undefined'){linkTarget=' target="'+data[i].target+'"';}
if(typeof data[i].subMenu!=='undefined'){$sub=('<li class="dropdown-submenu"><a tabindex="-1" href="'+data[i].href+'">'+data[i].text+'</a></li>');}else{$sub=jQuery('<li><a tabindex="-1" href="'+data[i].href+'"'+linkTarget+'>'+data[i].text+'</a></li>');}
if(typeof data[i].action!=='undefined'){var actiond=new Date(),actionID='event-'+actiond.getTime()*Math.floor(Math.random()*100000),eventAction=data[i].action;$sub.find('a').attr('id',actionID);jQuery('#'+actionID).addClass('context-event');jQuery(document).on('click','#'+actionID,eventAction);}
$menu.append($sub);if(typeof data[i].subMenu!='undefined'){var subMenuData=buildMenu(data[i].subMenu,id,true);$menu.find('li:last').append(subMenuData);}}
if(typeof options.filter=='function'){options.filter($menu.find('li:last'));}}
return $menu;}
function addContext(selector,data){var d=new Date(),id=d.getTime(),$menu=buildMenu(data,id);jQuery('body').append($menu);jQuery(document).on('contextmenu',selector,function(e){e.preventDefault();e.stopPropagation();jQuery('.dropdown-context:not(.dropdown-context-sub)').hide();$dd=jQuery('#dropdown-'+id);if(typeof options.above=='boolean'&&options.above){$dd.addClass('dropdown-context-up').css({top:e.pageY-20-jQuery('#dropdown-'+id).height(),left:e.pageX-13}).fadeIn(options.fadeSpeed);}else if(typeof options.above=='string'&&options.above=='auto'){$dd.removeClass('dropdown-context-up');var autoH=$dd.height()+12;if((e.pageY+autoH)>jQuery('html').height()){$dd.addClass('dropdown-context-up').css({top:e.pageY-20-autoH,left:e.pageX-13}).fadeIn(options.fadeSpeed);}else{$dd.css({top:e.pageY+10,left:e.pageX-13}).fadeIn(options.fadeSpeed);}}});}
function destroyContext(selector){jQuery(document).off('contextmenu',selector).off('click','.context-event');}
return{init:initialize,settings:updateOptions,attach:addContext,destroy:destroyContext};})();;var userLang=(navigator.language)?navigator.language:navigator.userLanguage;String.prototype.printf=function(){var formatted=this;for(i=0;i<arguments.length;i++){formatted=formatted.replace("%s",arguments[i]);}
return formatted;};var Translation={userLang:'es',getLang:function(){this.userLang=(navigator.language)?navigator.language:navigator.userLanguage;},strTrans:translatorData,getText:function(){var cadena=arguments[0];if(typeof this.strTrans[this.userLang]!=="undefined"){cadena=this.strTrans[this.userLang][cadena];}else{cadena=arguments[1];}
if(typeof cadena=="undefined"){console.log('cadena no definida');cadena=arguments[1];}
if(typeof cadena=="undefined"){console.log('cadena no definida');cadena=arguments[0];}
total=arguments.length;for(i=2;i<total;i++){valor=arguments[i];cadena=cadena.replace("%s",arguments[i]);}
return cadena;}};var scgp_videoControllers=new HashTable();var SCGP_PLAYER_TYPES={EDITORIAL:0,EDIT_HTML:2,VERTICAL:1,HORIZONTAL:4,VERT_HTML:3,HOR_HTML:5,PLAYLIST:6,PLAYLIST_HTML:7,EVO:8,EVO_HTML:9,PLUS:10}
var scgp_config={sendfriend:true,share:true,rating:false,censor:true,isLive:false,embed:true,like:true,volume:false,configuration:true,fullscreen:true,showPlayList:false,htmlForce:false,showSubtitles:false,subtitlesLang:'en',skipAd:22,ytAccounting:false,autoPlay:false,twitter_search:'#madrid',socialview:'center',default_volume:0,shareRefererPage:true};var _scgp_controllerId="0";function loadPlayer(controllerId,my_config)
{console.log('[WARNING]llamada a funcion loadPlayer() deprecada. Debe llamar a scgp_loadPlayer()');scgp_loadPlayer(controllerId,my_config);}
function scgp_loadPlayer(controllerId,my_config)
{if(typeof APP_STATIC=='undefined'){APP_STATIC=APP_URL;}
if(typeof new_config!='undefined'){scgp_config=new_config;if(typeof scgp_config.isAdminType=="undefined")scgp_config.isAdminType=false;if(typeof scgp_config.showPlayList=="undefined")scgp_config.showPlayList=false;}
if(typeof my_config!='undefined')scgp_config=my_config;if(typeof scgp_config.ratio=='undefined'){scgp_config.ratio='';}else{if(scgp_config.ratio!='1_1'&&scgp_config.ratio!='4_3')scgp_config.ratio=''}
if(typeof scgp_config.htmlForce=='undefined'){scgp_config.htmlForce=false;}
if(typeof scgp_config.showSubtitles=='undefined'){scgp_config.showSubtitles=false;}
if(typeof scgp_config.subtitlesLang=='undefined'){scgp_config.subtitlesLang='';}
if(typeof scgp_config.autoPlay=='undefined'){scgp_config.autoPlay=false;}else{scgp_config.autoPlay=(scgp_config.autoPlay==1)?true:false;}
if(typeof scgp_config.ytAccounting=='undefined'){scgp_config.ytAccounting=false;}
if(detectmob()){scgp_config.ytAccounting=false;}
if(typeof scgp_config.socialview=='undefined'){scgp_config.socialview='none';}
if(typeof scgp_config.showRadioFormat=='undefined'){scgp_config.showRadioFormat=false;}
if(scgp_config.autoPlay==true){scgp_config.ytAccounting=false;}
if(typeof scgp_config.hasVideoRelated=='undefined'){scgp_config.hasVideoRelated=false;}else{scgp_config.hasVideoRelated=(scgp_config.hasVideoRelated==1)?true:false;}
if(typeof scgp_config.shareRefererPage=='undefined'){scgp_config.shareRefererPage=true;}
_scgp_controllerId=controllerId;if(undefined!=controllerId)
{scpg_loadPlayerHtml5(controllerId);}else{scgp_showErrorMessage(controllerId,Translation.getText('player.cerrar',"No se ha podido cargar el player"));}
setMenuContext('.sc_container');}
function removePlayer(controllerId){console.log('[WARNING]funcion removePlayer deprecada, deberia llamar a scpg_removePlayer');scpg_removePlayer(controllerId);}
function scpg_removePlayer(controllerId){var containerPlayerDiv='#container_player_'+controllerId;jQuery(containerPlayerDiv).remove();scgp_videoControllers.removeItem(controllerId);}
function loadPlayerHtml5(controllerId)
{console.log('[WARNING]funcion loadPlayerHtml5 deprecada, deberia llamar a scpg_loadPlayerHtml5');scpg_loadPlayerHtml5(controllerId);}
function scpg_loadPlayerHtml5(controllerId)
{var playerDiv='player_'+controllerId;var urlServiceVideo=(typeof jQuery('#'+playerDiv).attr('data-rel')!='undefined')?jQuery('#'+playerDiv).attr('data-rel'):'';var containerPlayerDiv=jQuery('#container_player_'+controllerId).parent();if(jQuery(containerPlayerDiv).hasClass('gp-embed-responsive')){if(scgp_config.ratio=='1_1'){jQuery(containerPlayerDiv).addClass('gp-embed-responsive-1by1');}else if(scgp_config.ratio=='4_3'){jQuery(containerPlayerDiv).addClass('gp-embed-responsive-4by3');}else{jQuery(containerPlayerDiv).addClass('gp-embed-responsive-16by9');}}
scgp_setPaddingPlayer();var rule=scgp_checkRule();if(scgp_config.autoPlay==false&&rule.isAutoPlay==1){scgp_config.default_volume=0;}
if(detectmob()){scgp_config.volume=false;}
scgp_config.autoPlay=(!scgp_config.autoPlay)?rule.isAutoPlay:scgp_config.autoPlay;urlServiceVideo=scgp_generateUrlWebserviceVideo(urlServiceVideo,scgp_config.autoPlay,rule.isVideoRelated)
scgp_videoControllers.setItem(controllerId,new VideoController(scgp_config));scgp_videoControllers.getItem(controllerId).loadData(urlServiceVideo,controllerId,scgp_isFlashEnabled(),scgp_vcStatus);scgp_videoControllers.getItem(controllerId).theEvent.subscribe(function(sender,eventArgs){scgp_handlerVideoControllerEvent(sender.controllerId,eventArgs.message);});}
function scgp_handlerVideoControllerEvent(controllerId,message){switch(message[0]){case"end":break;case"start":break;case"playing":break;case"paused":break;case"error":scgp_showErrorMessage(controllerId,Translation.getText('player.msjnoreproduce',"El vídeo no se puede reproducir"));setTimeout(function(){scgp_videoControllers.getItem(controllerId).playNextItem();scgp_hideErrorMessage(controllerId)},5000);break;case"endOfReproduction":break;case"showButtonAd":break;case"openTwitter":break;case"closeTwitter":break;}}
function scgp_vcStatus(controllerId,message){switch(message){case"data_loaded":if(scgp_config.isAdminType==false)scgp_drawPlayerPlus(controllerId);break;case"data_failed":scgp_showErrorMessage(controllerId,Translation.getText('player.nodatosvideo',"Error al obtener los datos del video"));break;}}
function thisMovie(movieName){if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName];}else{return document[movieName];}}
jQuery(window).bind("beforeunload",function(){scgp_sendVisitsBeforeClose();})
jQuery(window).resize(function(){var it=0;for(it=0;it<scgp_videoControllers.keys().length;it++){if(scgp_videoControllers.getItem(scgp_videoControllers.keys()[it]).playListComp){scgp_videoControllers.getItem(scgp_videoControllers.keys()[it]).playListComp.calculateHeight();}}
scgp_setPaddingPlayer();});function scgp_sendVisitsBeforeClose(){scgp_videoControllers.each(function(k,item){item.sendVisit.finishRec(item.videoData);});}
function scgp_showErrorMessage(controllerId,mensaje){var containerPlayerDiv='#container_player_'+controllerId;if(typeof mensaje=='undefined'||mensaje==''){mensaje="Se ha producido un error";}
if(jQuery(containerPlayerDiv).find('.gp-display-error').length>0){jQuery(containerPlayerDiv).find('.gp-display-error').remove();}
if(jQuery(containerPlayerDiv).find('.gp-display').length>0){jQuery(containerPlayerDiv).find('.gp-display').append('<div class="gp-display-error" style="display:none;"><p>'+mensaje+'</p></div>');}else{jQuery(containerPlayerDiv).append('<div class="gp-display-error" style="display:none;"><p>'+mensaje+'</p></div>');}
jQuery(containerPlayerDiv).find('.gp-display-error').css('opacity',0);jQuery(containerPlayerDiv).find('.gp-display-error').show();jQuery(containerPlayerDiv).find('.gp-display-error').animate({opacity:0.9},500);}
function scgp_hideErrorMessage(controllerId){var containerPlayerDiv='#container_player_'+controllerId;jQuery(containerPlayerDiv).find('.gp-display-error').animate({opacity:0},500,function(){jQuery(this).remove();});}
function isFlashEnabled()
{console.log('[WARNING]funcion isFlashEnabled() deprecada, deberia llamar a scpg_isFlashEnabled()');scgp_isFlashEnabled();}
function scgp_isFlashEnabled()
{var hasFlash=false;if(scgp_config.htmlForce)return false;try
{var fo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash');if(fo)hasFlash=true;}
catch(e)
{if(navigator.mimeTypes["application/x-shockwave-flash"]!=undefined&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)hasFlash=true;}
return hasFlash;}
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');};function detectmob(){if(detectIpad()||detectAndroid()){return true;}
else{return false;}}
function detectAndroid(){if(navigator.userAgent.match(/Android/i)){return true;}
else{return false;}}
function detectWebBrowserAndroid(){if(navigator.userAgent.match(/Android/i)&&navigator.userAgent.match(/Mobile Safari/i)){return true;}
else{return false;}}
function detectIpad(){if(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)){return true;}
else{return false;}}
function detectIphone(){if(navigator.userAgent.match(/iPhone/i))
return true;else
return false;}
function detectIOS7(){var result=false;return(navigator.userAgent.match(/(iPad|iPhone);.*CPU.*OS 7_\d/i)!=null)}
function flashCompanionAd(compxml){var com=new CompanionAd(compxml);drawCompanionAd(com.code,com.click,com.type);}
function hex2rgb(hex,opacity){var h=hex.replace('#','');h=h.match(new RegExp('(.{'+h.length/3+'})','g'));for(var i=0;i<h.length;i++)
h[i]=parseInt(h[i].length==1?h[i]+h[i]:h[i],16);if(typeof opacity!='undefined')h.push(opacity);return'rgba('+h.join(',')+')';}
function loadjscssfile(filename,filetype){if(filetype=="js"){var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src",filename)}
else if(filetype=="css"){var fileref=document.createElement("link")
fileref.setAttribute("rel","stylesheet")
fileref.setAttribute("type","text/css")
fileref.setAttribute("href",filename)}
if(typeof fileref!="undefined")
var x=document.getElementsByTagName("head")[0]
var y=document.getElementsByTagName("head")[0].getElementsByTagName("link")[0]
x.insertBefore(fileref,y);}
function sendLoadStats(urlStats){if(urlStats!=""){urlStats=urlStats.replace("[random]",new Date().getTime())
jQuery('body').append('<img src="'+urlStats+'" style="width:1px;height:1px;"></img>');}}
function scgp_checkRule(){var result={isAutoPlay:false,isVideoRelated:scgp_config.hasVideoRelated};if(typeof scgp_config.temporalRules!='undefined'&&scgp_config.temporalRules.length>0){var i=0;var now_date=new Date();var init_date,end_date;for(i=0;i<scgp_config.temporalRules.length;i++){end_date=new Date(scgp_config.temporalRules[i].tiempo.end);init_date=new Date(scgp_config.temporalRules[i].tiempo.ini);if((init_date<now_date)&&(end_date>now_date)){if(scgp_config.temporalRules[i].autoplay==1)result.isAutoPlay=true;if(scgp_config.temporalRules[i].related_videos==1)result.isVideoRelated=true;}else{}}}
return result;}
function scgp_generateUrlWebserviceVideo(url,autoPlay,videoRelated){try{var expRegular=new RegExp('webservice/video*[^/]+/');var result=url;var params=url.split(expRegular)[1].split('/');if(params&&params.length==6){params.push((autoPlay)?1:0);params.push((videoRelated)?1:0);}else if(params&&params.length>6){params[6]=(autoPlay)?1:0;params[7]=(videoRelated)?1:0;}
result=url.split(expRegular)[0]+expRegular.exec(url)+params.join('/');if(scgp_config.dataType=='json')result+='/?json=1';if(params.indexOf('rand')>-1){console.log('hay random ');if(result.indexOf('/?json=1')>0){result+='&version='+scgp_randomIntFromInterval(0,10);}else{result+='/?version='+scgp_randomIntFromInterval(0,10);}}
return result;}catch(error){if(result.lastIndexOf('.json')>0)return result;if(result!=''){return(scgp_config.dataType=='json')?result+='/?json=1':result;}else{return"";}}}
function scgp_drawPlayerPlus(controllerId){jQuery('div[class*=sc_container]').append('<div id="pixeldiv" width="1" height="1"></div>');if(typeof playerPlus.percentage_load_pplus=='undefined'||playerPlus.percentage_load_pplus=='')playerPlus.percentage_load_pplus=0;if(typeof playerPlus.per_thousand_track_pplus=='undefined'||playerPlus.per_thousand_track_pplus=='')playerPlus.per_thousand_track_pplus=0;if(typeof playerPlus.per_thousand_views_pplus=='undefined'||playerPlus.per_thousand_views_pplus=='')playerPlus.per_thousand_views_pplus=0;if(typeof playerPlus.percent_views_complete_pplus=='undefined'||playerPlus.percent_views_complete_pplus=='')playerPlus.percent_views_complete_pplus=0;var random_number=scgp_randomIntFromInterval(0,1000);if(typeof playerPlus.url_ad_player_plus!='undefined'&&playerPlus.url_ad_player_plus.length>0&&random_number<parseInt(playerPlus.percentage_load_pplus)){if(scgp_isFlashEnabled()){playerPlus.url_ad_player_plus=playerPlus.url_ad_player_plus.replace(/&amp;/g,'%26');playerPlus.url_ad_player_plus=playerPlus.url_ad_player_plus.replace(/&/g,'%26');playerPlus.url_ad_player_plus+='%26format_sc=flash%26_RM_HTML_URLAFFID_='+scgp_getRefererPage();var playerPixel=APP_STATIC+"swf/playerAds.swf";var flashvars={urlVideo:playerPlus.url_ad_player_plus,debugEnable:false};var params={};params.quality="high";params.allowscriptaccess="always";params.allowfullscreen="true";params.wmode="transparent";params.volume="0";var attributes={};attributes.id="pixeldiv";attributes.name="pixeldiv";attributes.align="left";attributes.volume="0";swfobject.embedSWF(playerPixel,"pixeldiv",'1','1',"11.1.0","expressInstall.swf",flashvars,params,attributes);}else{if(!detectIpad()){var vastData=new VastData();vastData.load(controllerId,playerPlus.url_ad_player_plus,function(videoId,status,vast){var completeReached=false;var impressionsReached=false;var firstQuartileReached=false;var midpointReached=false;var thirdQuartileReached=false;var intervalTrack;switch(status){case"vastLoaded":var videoData=new Object();videoData.vast=vast;videoData.src=vast.getMedia();videoData.urlClick=vast.getClickThrough();videoData.idCampaing=vast.getCompaingId();videoData.skipAd=vast.getSkipAd();videoData.isAudio=false;var duracion=scgp_formatSkipAd(vast.getDuration());duracion=(duracion==0)?20:duracion;var pl_pp=new NativePlayer(controllerId,vast);pl_pp.createPlayerPP('#pixeldiv',videoData);pl_pp.theEvent.subscribe(function(sender,eventArgs){switch(eventArgs.message[0]){case"loadeddata":duracion=parseInt(eventArgs.message[2]);var tm=parseInt(parseInt(duracion)/4)*1000;if(vast)vast.throwStartImpressions();intervalTrack=setInterval(function(){if(!firstQuartileReached){vast.throwTrackingsByType('firstQuartile');firstQuartileReached=true;}else if(!midpointReached){vast.throwTrackingsByType('midpoint');midpointReached=true;}else if(!thirdQuartileReached){vast.throwTrackingsByType('thirdQuartile');thirdQuartileReached=true;}else if(!completeReached){if(vast)vast.throwCompleteImpressions();completeReached=true;clearInterval(intervalTrack);jQuery('#pixeldiv').remove();}},tm);var valorRdm=scgp_randomIntFromInterval(0,100);if(valorRdm<playerPlus.per_thousand_track_pplus){jQuery('body').prepend('<iframe id="imagen'+i+'" style="display:none;" src="'+vast.getClickThrough()+'"></iframe>');for(var u=0;u<vast.clickTrackingEvents.length;u++){jQuery('body').prepend('<img id="imagen'+i+'" style="display:none;" src="'+vast.clickTrackingEvents[u]+'"/>');}}
try{var senVisit=new SendVisitComponent(scgp_isFlashEnabled,scgp_config,true);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.START);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.FIRSTQUARTILE);var random_percent=scgp_randomIntFromInterval(0,100);if(parseInt(playerPlus.percent_views_complete_pplus)>0&&random_percent<=parseInt(playerPlus.percent_views_complete_pplus)){senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.MIDPOINT);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.THIRDQUERTILE);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.COMPLETE);}
senVisit.finishRec(scgp_videoControllers.getItem(_scgp_controllerId).videoData);senVisit.sendVisitVideoPP(scgp_videoControllers.getItem(_scgp_controllerId).videoData);}catch(error){console.log("error "+error.toString());}
break;}});break;case"vastError":break;default:break;}});}}}else if(typeof playerPlus.url_ad_player_plus!='undefined'&&playerPlus.url_ad_player_plus.length>0&&(random_number<(parseInt(playerPlus.per_thousand_views_pplus)+parseInt(playerPlus.percentage_load_pplus)))){var senVisit=new SendVisitComponent(scgp_isFlashEnabled,scgp_config,true);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.START);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.FIRSTQUARTILE);var random_percent=scgp_randomIntFromInterval(0,100);if(parseInt(playerPlus.percent_views_complete_pplus)>0&&random_percent<=parseInt(playerPlus.percent_views_complete_pplus)){senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.MIDPOINT);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.THIRDQUERTILE);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.COMPLETE);}
senVisit.finishRec(scgp_videoControllers.getItem(_scgp_controllerId).videoData,false);senVisit.sendVisitVideoPP(scgp_videoControllers.getItem(_scgp_controllerId).videoData);}else{}}
function removePlayerPlus(){console.log('[WARNING]llamada a funcion removePlayerPlus() deprecada. Debe llamar a scpg_removePlayerPlus()');scgp_removePlayerPlus();}
function scgp_removePlayerPlus(){var playerDiv='pixeldiv';if(document.getElementById(playerDiv))
document.getElementById(playerDiv).parentNode.removeChild(document.getElementById(playerDiv));}
function scgp_randomIntFromInterval(min,max)
{return Math.floor(Math.random()*(max-min+1)+min);}
function statuspixel(status,duration,currentTime){switch(status){case"onstart":var valorRdm=scgp_randomIntFromInterval(0,100);if(valorRdm<playerPlus.per_thousand_track_pplus){var urls=thisMovie('pixeldiv').getUrlClick().split('[--]');if(urls&&urls.length>0){for(var i=0;i<urls.length;i++){jQuery('body').prepend('<iframe id="imagen'+i+'" style="display:none;" src="'+urls[i]+'"></iframe>');}}}
try{var senVisit=new SendVisitComponent(scgp_isFlashEnabled,scgp_config,true);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.START);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.FIRSTQUARTILE);var random_percent=scgp_randomIntFromInterval(0,100);if(parseInt(playerPlus.percent_views_complete_pplus)>0&&random_percent<=parseInt(playerPlus.percent_views_complete_pplus)){senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.MIDPOINT);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.THIRDQUERTILE);senVisit.addEvent(scgp_videoControllers.getItem(_scgp_controllerId).EVENT_TYPES.COMPLETE);}
senVisit.finishRec(scgp_videoControllers.getItem(_scgp_controllerId).videoData);senVisit.sendVisitVideoPP(scgp_videoControllers.getItem(_scgp_controllerId).videoData);}catch(error){console.log("error "+error.toString());}
break;case"onend":setTimeout(function(){scgp_removePlayerPlus();},2000);default:break;}}
function test(){if(scgp_randomIntFromInterval(1,2)==1){return true;}else{return false;}}
function scgp_randomIntFromInterval(min,max)
{return Math.floor(Math.random()*(max-min+1)+min);}
function scgp_getRefererPage(){var fromUrlPage="";try{fromUrlPage=(window.location!=window.parent.location)?document.referrer:document.location.href;}catch(error){fromUrlPage="";}
return fromUrlPage;}
function debugPlayer(mm){}
function setMenuContext(element){if(typeof element=='undefined'){element='html'}
context.init({preventDoubleContext:false});context.attach(element,[{text:Translation.getText('player.playerby','Player by smartycontent.com'),href:'http://www.smartycontent.com',target:'_blank'},{text:Translation.getText('player.conoceismarty','Conoce ismarty'),href:'http://www.ismarty.tv',target:'_blank'}]);}
var hasOwnProperty=Object.prototype.hasOwnProperty;function isEmpty(obj){if(obj==null)return true;if(obj.length>0)return false;if(obj.length===0)return true;for(var key in obj){if(hasOwnProperty.call(obj,key))return false;}
return true;}
function getWidth(){return jQuery('.sc_container').outerWidth(true);}
function getHeight(){return jQuery('.sc_container').outerHeight(true);}
function setPaddingPlayer(){console.log('[WARNING]llamada a funcion setPaddingPlayer() deprecada. Debe llamar a scpg_setPaddingPlayer()');scgp_setPaddingPlayer()}
function scgp_setPaddingPlayer(){if((scgp_config.playerType==SCGP_PLAYER_TYPES.EDITORIAL)||(scgp_config.playerType==SCGP_PLAYER_TYPES.EDITORIAL)){var alto=(getHeight()*100)/getWidth();jQuery('.gp-embed-responsive').css('padding-bottom',alto+'%')}}
function scgp_formatSkipAd(value,duration){var aux=0;if(typeof value!='undefined'&&value!=''){if(value.indexOf('%')==value.length-1&&duration>0){var pp=value.replace('%','');aux=parseInt(pp);aux=parseInt(aux*duration/100);}else if(value.split(':').length==3){aux=(parseInt(value.split(':')[0])*360)+(parseInt(value.split(':')[1])*60)+(parseInt(value.split(':')[2]));}}
return aux;};(function(factory){'use strict';if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else if(typeof exports==='object'){factory(require('jquery'));}else{factory(jQuery);}})(function($){'use strict';function int(x){if(typeof x==='string'){return parseInt(x,10);}else{return~~x;}}
var defaultSettings={wheelSpeed:1,wheelPropagation:false,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:false,useKeyboard:true,suppressScrollX:false,suppressScrollY:false,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:false};var getEventClassName=(function(){var incrementingId=0;return function(){var id=incrementingId;incrementingId+=1;return'.perfect-scrollbar-'+id;};})();$.fn.perfectScrollbar=function(suppliedSettings,option){return this.each(function(){var settings=$.extend(true,{},defaultSettings);var $this=$(this);if(typeof suppliedSettings==="object"){$.extend(true,settings,suppliedSettings);}else{option=suppliedSettings;}
if(option==='update'){if($this.data('perfect-scrollbar-update')){$this.data('perfect-scrollbar-update')();}
return $this;}
else if(option==='destroy'){if($this.data('perfect-scrollbar-destroy')){$this.data('perfect-scrollbar-destroy')();}
return $this;}
if($this.data('perfect-scrollbar')){return $this.data('perfect-scrollbar');}
$this.addClass('ps-container');var containerWidth;var containerHeight;var contentWidth;var contentHeight;var isRtl=$this.css('direction')==="rtl";var eventClassName=getEventClassName();var ownerDocument=this.ownerDocument||document;var $scrollbarXRail=$("<div class='ps-scrollbar-x-rail'>").appendTo($this);var $scrollbarX=$("<div class='ps-scrollbar-x'>").appendTo($scrollbarXRail);var scrollbarXActive;var scrollbarXWidth;var scrollbarXLeft;var scrollbarXBottom=int($scrollbarXRail.css('bottom'));var isScrollbarXUsingBottom=scrollbarXBottom===scrollbarXBottom;var scrollbarXTop=isScrollbarXUsingBottom?null:int($scrollbarXRail.css('top'));var railBorderXWidth=int($scrollbarXRail.css('borderLeftWidth'))+int($scrollbarXRail.css('borderRightWidth'));var $scrollbarYRail=$("<div class='ps-scrollbar-y-rail'>").appendTo($this);var $scrollbarY=$("<div class='ps-scrollbar-y'>").appendTo($scrollbarYRail);var scrollbarYActive;var scrollbarYHeight;var scrollbarYTop;var scrollbarYRight=int($scrollbarYRail.css('right'));var isScrollbarYUsingRight=scrollbarYRight===scrollbarYRight;var scrollbarYLeft=isScrollbarYUsingRight?null:int($scrollbarYRail.css('left'));var railBorderYWidth=int($scrollbarXRail.css('borderTopWidth'))+int($scrollbarXRail.css('borderBottomWidth'));function updateScrollTop(currentTop,deltaY){var newTop=currentTop+deltaY;var maxTop=containerHeight-scrollbarYHeight;if(newTop<0){scrollbarYTop=0;}else if(newTop>maxTop){scrollbarYTop=maxTop;}else{scrollbarYTop=newTop;}
var scrollTop=int(scrollbarYTop*(contentHeight-containerHeight)/(containerHeight-scrollbarYHeight));$this.scrollTop(scrollTop);}
function updateScrollLeft(currentLeft,deltaX){var newLeft=currentLeft+deltaX;var maxLeft=containerWidth-scrollbarXWidth;if(newLeft<0){scrollbarXLeft=0;}else if(newLeft>maxLeft){scrollbarXLeft=maxLeft;}else{scrollbarXLeft=newLeft;}
var scrollLeft=int(scrollbarXLeft*(contentWidth-containerWidth)/(containerWidth-scrollbarXWidth));$this.scrollLeft(scrollLeft);}
function getThumbSize(thumbSize){if(settings.minScrollbarLength){thumbSize=Math.max(thumbSize,settings.minScrollbarLength);}
if(settings.maxScrollbarLength){thumbSize=Math.min(thumbSize,settings.maxScrollbarLength);}
return thumbSize;}
function updateCss(){var xRailOffset={width:containerWidth,display:scrollbarXActive?"inherit":"none"};if(isRtl){xRailOffset.left=$this.scrollLeft()+containerWidth-contentWidth;}else{xRailOffset.left=$this.scrollLeft();}
if(isScrollbarXUsingBottom){xRailOffset.bottom=scrollbarXBottom-$this.scrollTop();}else{xRailOffset.top=scrollbarXTop+$this.scrollTop();}
$scrollbarXRail.css(xRailOffset);var railYOffset={top:$this.scrollTop(),height:containerHeight,display:scrollbarYActive?"inherit":"none"};if(isScrollbarYUsingRight){if(isRtl){railYOffset.right=contentWidth-$this.scrollLeft()-scrollbarYRight-$scrollbarY.outerWidth();}else{railYOffset.right=scrollbarYRight-$this.scrollLeft();}}else{if(isRtl){railYOffset.left=$this.scrollLeft()+containerWidth*2-contentWidth-scrollbarYLeft-$scrollbarY.outerWidth();}else{railYOffset.left=scrollbarYLeft+$this.scrollLeft();}}
$scrollbarYRail.css(railYOffset);$scrollbarX.css({left:scrollbarXLeft,width:scrollbarXWidth-railBorderXWidth});$scrollbarY.css({top:scrollbarYTop,height:scrollbarYHeight-railBorderYWidth});}
function updateGeometry(){$scrollbarXRail.hide();$scrollbarYRail.hide();containerWidth=settings.includePadding?$this.innerWidth():$this.width();containerHeight=settings.includePadding?$this.innerHeight():$this.height();contentWidth=$this.prop('scrollWidth');contentHeight=$this.prop('scrollHeight');if(!settings.suppressScrollX&&containerWidth+settings.scrollXMarginOffset<contentWidth){scrollbarXActive=true;scrollbarXWidth=getThumbSize(int(containerWidth*containerWidth/contentWidth));scrollbarXLeft=int($this.scrollLeft()*(containerWidth-scrollbarXWidth)/(contentWidth-containerWidth));}else{scrollbarXActive=false;scrollbarXWidth=0;scrollbarXLeft=0;$this.scrollLeft(0);}
if(!settings.suppressScrollY&&containerHeight+settings.scrollYMarginOffset<contentHeight){scrollbarYActive=true;scrollbarYHeight=getThumbSize(int(containerHeight*containerHeight/contentHeight));scrollbarYTop=int($this.scrollTop()*(containerHeight-scrollbarYHeight)/(contentHeight-containerHeight));}else{scrollbarYActive=false;scrollbarYHeight=0;scrollbarYTop=0;$this.scrollTop(0);}
if(scrollbarXLeft>=containerWidth-scrollbarXWidth){scrollbarXLeft=containerWidth-scrollbarXWidth;}
if(scrollbarYTop>=containerHeight-scrollbarYHeight){scrollbarYTop=containerHeight-scrollbarYHeight;}
updateCss();if(scrollbarXActive){$this.addClass('ps-active-x');}else{$this.removeClass('ps-active-x');}
if(scrollbarYActive){$this.addClass('ps-active-y');}else{$this.removeClass('ps-active-y');}
if(!settings.suppressScrollX){$scrollbarXRail.show();}
if(!settings.suppressScrollY){$scrollbarYRail.show();}}
function bindMouseScrollXHandler(){var currentLeft;var currentPageX;$scrollbarX.bind('mousedown'+eventClassName,function(e){currentPageX=e.pageX;currentLeft=$scrollbarX.position().left;$scrollbarXRail.addClass('in-scrolling');e.stopPropagation();e.preventDefault();});$(ownerDocument).bind('mousemove'+eventClassName,function(e){if($scrollbarXRail.hasClass('in-scrolling')){updateScrollLeft(currentLeft,e.pageX-currentPageX);updateGeometry();e.stopPropagation();e.preventDefault();}});$(ownerDocument).bind('mouseup'+eventClassName,function(e){if($scrollbarXRail.hasClass('in-scrolling')){$scrollbarXRail.removeClass('in-scrolling');}});currentLeft=currentPageX=null;}
function bindMouseScrollYHandler(){var currentTop;var currentPageY;$scrollbarY.bind('mousedown'+eventClassName,function(e){currentPageY=e.pageY;currentTop=$scrollbarY.position().top;$scrollbarYRail.addClass('in-scrolling');e.stopPropagation();e.preventDefault();});$(ownerDocument).bind('mousemove'+eventClassName,function(e){if($scrollbarYRail.hasClass('in-scrolling')){updateScrollTop(currentTop,e.pageY-currentPageY);updateGeometry();e.stopPropagation();e.preventDefault();}});$(ownerDocument).bind('mouseup'+eventClassName,function(e){if($scrollbarYRail.hasClass('in-scrolling')){$scrollbarYRail.removeClass('in-scrolling');}});currentTop=currentPageY=null;}
function shouldPreventDefault(deltaX,deltaY){var scrollTop=$this.scrollTop();if(deltaX===0){if(!scrollbarYActive){return false;}
if((scrollTop===0&&deltaY>0)||(scrollTop>=contentHeight-containerHeight&&deltaY<0)){return!settings.wheelPropagation;}}
var scrollLeft=$this.scrollLeft();if(deltaY===0){if(!scrollbarXActive){return false;}
if((scrollLeft===0&&deltaX<0)||(scrollLeft>=contentWidth-containerWidth&&deltaX>0)){return!settings.wheelPropagation;}}
return true;}
function bindMouseWheelHandler(){var shouldPrevent=false;function getDeltaFromEvent(e){var deltaX=e.originalEvent.deltaX;var deltaY=-1*e.originalEvent.deltaY;if(typeof deltaX==="undefined"||typeof deltaY==="undefined"){deltaX=-1*e.originalEvent.wheelDeltaX/6;deltaY=e.originalEvent.wheelDeltaY/6;}
if(e.originalEvent.deltaMode&&e.originalEvent.deltaMode===1){deltaX*=10;deltaY*=10;}
if(deltaX!==deltaX&&deltaY!==deltaY){deltaX=0;deltaY=e.originalEvent.wheelDelta;}
return[deltaX,deltaY];}
function mousewheelHandler(e){var delta=getDeltaFromEvent(e);var deltaX=delta[0];var deltaY=delta[1];shouldPrevent=false;if(!settings.useBothWheelAxes){$this.scrollTop($this.scrollTop()-(deltaY*settings.wheelSpeed));$this.scrollLeft($this.scrollLeft()+(deltaX*settings.wheelSpeed));}else if(scrollbarYActive&&!scrollbarXActive){if(deltaY){$this.scrollTop($this.scrollTop()-(deltaY*settings.wheelSpeed));}else{$this.scrollTop($this.scrollTop()+(deltaX*settings.wheelSpeed));}
shouldPrevent=true;}else if(scrollbarXActive&&!scrollbarYActive){if(deltaX){$this.scrollLeft($this.scrollLeft()+(deltaX*settings.wheelSpeed));}else{$this.scrollLeft($this.scrollLeft()-(deltaY*settings.wheelSpeed));}
shouldPrevent=true;}
updateGeometry();shouldPrevent=(shouldPrevent||shouldPreventDefault(deltaX,deltaY));if(shouldPrevent){e.stopPropagation();e.preventDefault();}}
if(typeof window.onwheel!=="undefined"){$this.bind('wheel'+eventClassName,mousewheelHandler);}else if(typeof window.onmousewheel!=="undefined"){$this.bind('mousewheel'+eventClassName,mousewheelHandler);}}
function bindKeyboardHandler(){var hovered=false;$this.bind('mouseenter'+eventClassName,function(e){hovered=true;});$this.bind('mouseleave'+eventClassName,function(e){hovered=false;});var shouldPrevent=false;$(ownerDocument).bind('keydown'+eventClassName,function(e){if(e.isDefaultPrevented&&e.isDefaultPrevented()){return;}
if(!hovered){return;}
var activeElement=document.activeElement?document.activeElement:ownerDocument.activeElement;while(activeElement.shadowRoot){activeElement=activeElement.shadowRoot.activeElement;}
if($(activeElement).is(":input,[contenteditable]")){return;}
var deltaX=0;var deltaY=0;switch(e.which){case 37:deltaX=-30;break;case 38:deltaY=30;break;case 39:deltaX=30;break;case 40:deltaY=-30;break;case 33:deltaY=90;break;case 32:case 34:deltaY=-90;break;case 35:if(e.ctrlKey){deltaY=-contentHeight;}else{deltaY=-containerHeight;}
break;case 36:if(e.ctrlKey){deltaY=$this.scrollTop();}else{deltaY=containerHeight;}
break;default:return;}
$this.scrollTop($this.scrollTop()-deltaY);$this.scrollLeft($this.scrollLeft()+deltaX);shouldPrevent=shouldPreventDefault(deltaX,deltaY);if(shouldPrevent){e.preventDefault();}});}
function bindRailClickHandler(){function stopPropagation(e){e.stopPropagation();}
$scrollbarY.bind('click'+eventClassName,stopPropagation);$scrollbarYRail.bind('click'+eventClassName,function(e){var halfOfScrollbarLength=int(scrollbarYHeight/2);var positionTop=e.pageY-$scrollbarYRail.offset().top-halfOfScrollbarLength;var maxPositionTop=containerHeight-scrollbarYHeight;var positionRatio=positionTop/maxPositionTop;if(positionRatio<0){positionRatio=0;}else if(positionRatio>1){positionRatio=1;}
$this.scrollTop((contentHeight-containerHeight)*positionRatio);});$scrollbarX.bind('click'+eventClassName,stopPropagation);$scrollbarXRail.bind('click'+eventClassName,function(e){var halfOfScrollbarLength=int(scrollbarXWidth/2);var positionLeft=e.pageX-$scrollbarXRail.offset().left-halfOfScrollbarLength;var maxPositionLeft=containerWidth-scrollbarXWidth;var positionRatio=positionLeft/maxPositionLeft;if(positionRatio<0){positionRatio=0;}else if(positionRatio>1){positionRatio=1;}
$this.scrollLeft((contentWidth-containerWidth)*positionRatio);});}
function bindTouchHandler(){function applyTouchMove(differenceX,differenceY){$this.scrollTop($this.scrollTop()-differenceY);$this.scrollLeft($this.scrollLeft()-differenceX);updateGeometry();}
var startOffset={};var startTime=0;var speed={};var breakingProcess=null;var inGlobalTouch=false;function globalTouchStart(e){inGlobalTouch=true;}
function globalTouchEnd(e){inGlobalTouch=false;}
function getTouch(e){if(e.originalEvent.targetTouches){return e.originalEvent.targetTouches[0];}else{return e.originalEvent;}}
function touchStart(e){var touch=getTouch(e);startOffset.pageX=touch.pageX;startOffset.pageY=touch.pageY;startTime=(new Date()).getTime();if(breakingProcess!==null){clearInterval(breakingProcess);}
e.stopPropagation();}
function touchMove(e){if(!inGlobalTouch&&e.originalEvent.targetTouches.length===1){var touch=getTouch(e);var currentOffset={pageX:touch.pageX,pageY:touch.pageY};var differenceX=currentOffset.pageX-startOffset.pageX;var differenceY=currentOffset.pageY-startOffset.pageY;applyTouchMove(differenceX,differenceY);startOffset=currentOffset;var currentTime=(new Date()).getTime();var timeGap=currentTime-startTime;if(timeGap>0){speed.x=differenceX/timeGap;speed.y=differenceY/timeGap;startTime=currentTime;}
e.preventDefault();}}
function touchEnd(e){clearInterval(breakingProcess);breakingProcess=setInterval(function(){if(Math.abs(speed.x)<0.01&&Math.abs(speed.y)<0.01){clearInterval(breakingProcess);return;}
applyTouchMove(speed.x*30,speed.y*30);speed.x*=0.8;speed.y*=0.8;},10);}
$(window).bind("touchstart"+eventClassName,globalTouchStart);$(window).bind("touchend"+eventClassName,globalTouchEnd);$this.bind("touchstart"+eventClassName,touchStart);$this.bind("touchmove"+eventClassName,touchMove);$this.bind("touchend"+eventClassName,touchEnd);if(window.PointerEvent){$(window).bind("pointerdown"+eventClassName,globalTouchStart);$(window).bind("pointerup"+eventClassName,globalTouchEnd);$this.bind("pointerdown"+eventClassName,touchStart);$this.bind("pointermove"+eventClassName,touchMove);$this.bind("pointerup"+eventClassName,touchEnd);}else if(window.MSPointerEvent){$(window).bind("MSPointerDown"+eventClassName,globalTouchStart);$(window).bind("MSPointerUp"+eventClassName,globalTouchEnd);$this.bind("MSPointerDown"+eventClassName,touchStart);$this.bind("MSPointerMove"+eventClassName,touchMove);$this.bind("MSPointerUp"+eventClassName,touchEnd);}}
function bindScrollHandler(){$this.bind('scroll'+eventClassName,function(e){updateGeometry();});}
function destroy(){$this.unbind(eventClassName);$(window).unbind(eventClassName);$(ownerDocument).unbind(eventClassName);$this.data('perfect-scrollbar',null);$this.data('perfect-scrollbar-update',null);$this.data('perfect-scrollbar-destroy',null);$scrollbarX.remove();$scrollbarY.remove();$scrollbarXRail.remove();$scrollbarYRail.remove();$scrollbarXRail=$scrollbarYRail=$scrollbarX=$scrollbarY=scrollbarXActive=scrollbarYActive=containerWidth=containerHeight=contentWidth=contentHeight=scrollbarXWidth=scrollbarXLeft=scrollbarXBottom=isScrollbarXUsingBottom=scrollbarXTop=scrollbarYHeight=scrollbarYTop=scrollbarYRight=isScrollbarYUsingRight=scrollbarYLeft=isRtl=eventClassName=null;}
var supportsTouch=(('ontouchstart'in window)||window.DocumentTouch&&document instanceof window.DocumentTouch);var supportsIePointer=window.navigator.msMaxTouchPoints!==null;function initialize(){updateGeometry();bindScrollHandler();bindMouseScrollXHandler();bindMouseScrollYHandler();bindRailClickHandler();bindMouseWheelHandler();if(supportsTouch||supportsIePointer){bindTouchHandler();}
if(settings.useKeyboard){bindKeyboardHandler();}
$this.data('perfect-scrollbar',$this);$this.data('perfect-scrollbar-update',updateGeometry);$this.data('perfect-scrollbar-destroy',destroy);}
initialize();return $this;});};});