//Versao 3.4
//GMCEmbed -------------------
function GMCEmbed(config)
{
this.config = config;
this.id = "gmc_embed_iframe_" + (new Date().getTime()) + (Math.random()+"").replace(".","_");
}
GMCEmbed.prototype =
{
_largura:function() { return (gmcEmbedUtil.getLargura(this.config.banda)); },
_altura:function()
{
var a = this.config.escondeTrocaBanda ? 64 : 88;
return (gmcEmbedUtil.getAltura(this.config.banda) + a);
},
toString:function()
{
var h = '';
return h;
},
makeIframe:function()
{
var iframe = document.createElement("iframe");
iframe.id = this.id;
iframe.name = this.id;
iframe.style.width = this._largura() + 'px'
iframe.style.height = this._altura() + 'px';
return iframe;
},
play:function()
{
var url = gmcEmbedUtil.getUrlPlay(this.config);
var i = document.getElementById(this.id);
i.src = url;
},
destroy:function()
{
var i = document.getElementById(this.id);
i.src = "about:blank";
},
print:function()
{
document.writeln(this.toString());
if( arguments.length == 0 )
{
this.play();
}
else
{
var self = this;
setTimeout( function() { self.play(); }, arguments[0] );
}
},
attach:function(div)
{
document.getElementById(div).innerHTML = "";
document.getElementById(div).innerHTML = this.toString();
if( arguments.length == 1 )
{
this.play();
}
else
{
var self = this;
setTimeout( function() { self.play(); }, arguments[1] );
}
},
resize:function(b)
{
this.config.banda = b;
document.getElementById(this.id).style.width = this._largura() + 'px';
document.getElementById(this.id).style.height = this._altura() + 'px';
}
}
//Detecter
function GMCDetectWMP()
{
// objeto activex do windows media 6
var wmp64 = "MediaPlayer.MediaPlayer.1";
// objeto activex do windows media 7+
var wmp7 = "WMPlayer.OCX.7";
// objeto de retorno da fun??o
var wmpInfo = {
installed: false, // wmp instalado
scriptable: false, // wmp com activex
version: 0 // vers?o do wmp
};
var player = null;
try {
if(window.ActiveXObject) {
wmpInfo.scriptable = true; // pode ser controlado por script
// tenta criar o player windows media 7+
player = createActiveXObject(wmp7);
// se criou o player windows media 7+
if(player) {
wmpInfo.installed = true; // wmp instalado
wmpInfo.version = parseInt(player.versionInfo); // seta a vers?o
return wmpInfo; // retorna o objeto
}
// tenta criar o player windows media 6
player = createActiveXObject(wmp64);
if(player) {
wmpInfo.installed = true; // wmp instalado
wmpInfo.version = 6; // seta a vers?o 6
return wmpInfo; // retorna o objeto
}
}
} catch (e) {
}
try {
if(navigator.mimeTypes) {
player = navigator.mimeTypes['application/x-mplayer2'].enabledPlugin;
if(player) {
wmpInfo.scriptable = false; // n?o pode ser controlado por script
wmpInfo.installed = true; // wmp instalado
wmpInfo.version = 'embed'; // seta a vers?o 'embed'
return wmpInfo;
}
}
} catch (e) {}
return wmpInfo;
}
function createActiveXObject(id) {
var error;
var control = null;
try {
if (window.ActiveXObject) control = new ActiveXObject(id);
else if (window.GeckoActiveXObject) control = new GeckoActiveXObject(id);
} catch (e) {}
return control;
}
function GMCEmbedDetecter()
{
this.wmp = GMCDetectWMP();
}
GMCEmbedDetecter.prototype.isWmpEmbed = function()
{
return this.wmp.version == "embed";
}
GMCEmbedDetecter.prototype.isWmpInstalado = function()
{
return ( this.wmp.installed && ( this.isWmpEmbed() || this.wmp.version >= 9 ) );
}
function createScript(f,t,e) {
var script = document.createElement('script');
script.language='javascript';
script.type='text/javascript';
script.htmlFor=f;
script.text=t;
script.event=e;
document.body.appendChild(script);
var script = document.createElement('script');
script.language='javascript';
script.type='text/javascript';
script.text = 'function ' + f + '_DoFSCommand(p1, p2) {' + t + '}';
document.body.appendChild(script);
}
var gmcEmbedDetecter = new GMCEmbedDetecter();
//GMCEmbedUtil
function GMCEmbedUtil()
{
this.bandas = {
P : { largura: 186, altura: 116 },
N : { largura: 320, altura: 200 },
L : { largura: 480, altura: 300 }
};
this.urlPlay = "http://playervideo.globo.com/webmedia/player/GMCPlayMidia";
this.urlPlayEmbed = "http://playervideo.globo.com/webmedia/player/embed/GMCPlayMidia";
this.urlStop = "http://playervideo.globo.com/webmedia/player/GMCAbrePlayer";
this.urlStopEmbed = "http://playervideo.globo.com/webmedia/player/embed/GMCAbrePlayer";
this.urlFim = "http://playervideo.globo.com/webmedia/player/GMCFimVideo";
this.urlFimEmbed = "http://playervideo.globo.com/webmedia/player/embed/GMCFimVideo";
this.urlEnviar = "http://playervideo.globo.com/webmedia/GMCEnviarEmail";
this.urlLogin = "http://playervideo.globo.com/webmedia/player/GMCLogin";
this.urlLoginEmbed = "http://playervideo.globo.com/webmedia/player/embed/GMCLogin";
}
GMCEmbedUtil.prototype =
{
getLargura:function(b)
{
if(!b) b = 'N';
var l = this.bandas[b];
if(!l) l = this.bandas['N'];
return l.largura;
},
getAltura:function(b)
{
if(!b) b = 'N';
var l = this.bandas[b];
if(!l) l = this.bandas['N'];
return l.altura;
},
doLogin:function(f)
{
if( f.login.value == "" )
{
alert("Preencha seu Login/Email para ter acesso");
f.login.focus();
return false;
}
if( f.senha.value == "" )
{
alert("Preencha sua senha para ter acesso");
f.senha.focus();
return false;
}
var url = ( f.embedInterno && f.embedInterno.value == 'true' ) ? this.urlLogin : this.urlLoginEmbed;
f.action = url;
return true;
},
doRequisitos:function(id)
{
this.setCookie('Requisitos','true',7);
this.doSubmit(id);
},
doSubmit:function(id)
{
var f = document.getElementById(id);
url = ( f.embedInterno && f.embedInterno.value == 'true' ) ? this.urlPlay : this.urlPlayEmbed;
f.action = url;
f.submit();
},
setCookie:function(name,value,dias)
{
if (dias) {
var date = new Date();
date.setTime(date.getTime()+(dias*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
var path = "/".length>0 ? "; path=/" : "";
var domain = ".globo.com".length>0 ? "; domain=.globo.com" : "";
var cookieString = name + "=" + escape(value) + path + domain + expires;
document.cookie = cookieString;
},
getCookie:function(name)
{
var start = document.cookie.indexOf(name+"=");
var len = start+name.length+1;
if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
if (start == -1) return null;
var end = document.cookie.indexOf(";",len);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(len,end));
},
getParametros:function(c)
{
var p = "?midiaId=" + c.midiaId;
p += "&autoStart=" + (c.autoStart ? "true" : "false");
if( c.imagem ) p += "&imagem=" + c.imagem;
if( c.banda ) p += "&banda=" + c.banda;
if( c.embedInterno ) p += "&embedInterno=" + c.embedInterno;
if( c.tema ) p += "&tema=" + c.tema;
if( c.corFundo ) p += "&corFundo=" + c.corFundo;
if( c.corFonte ) p += "&corFonte=" + c.corFonte;
if( c.corLink ) p += "&corLink=" + c.corLink;
if( c.corBorda ) p += "&corBorda=" + c.corBorda;
if( c.escondeFimVideo ) p += "&escondeFimVideo=true";
if( c.escondeTrocaBanda ) p += "&escondeTrocaBanda=true";
if( c.autoStart )
if( !gmcEmbedDetecter.isWmpInstalado() || gmcEmbedDetecter.isWmpEmbed() )
p += "&requisitos=true";
p += "&nocache=" + new Date().getTime();
return p;
},
getUrlPlay:function(config)
{
var url;
if( config.autoStart ) url = config.embedInterno ? this.urlPlay : this.urlPlayEmbed;
else url = config.embedInterno ? this.urlStop : this.urlStopEmbed;
return url + this.getParametros(config);
},
getUrlFim:function(config)
{
var url = config.embedInterno ? this.urlFim : this.urlFimEmbed;
return url + this.getParametros(config);
},
adaptaBanda:function(banda)
{
if( document.getElementById("videoBarra") )
{
if( banda == 'L' )
{
document.getElementById("tamanhoNormal").style.display = "inline";
document.getElementById("tamanhoGrande").style.display = "none";
}
else
{
document.getElementById("tamanhoNormal").style.display = "none";
document.getElementById("tamanhoGrande").style.display = "inline";
}
document.getElementById("videoBarra").style.display = "block";
}
},
openWin:function(url,w,h)
{
var left = (screen.width - w) / 2;
var top = (screen.height - h) / 2;
var s = "width=" + w + ", height=" + h + ", top=" + top + ", left=" + left + ",scrollbars=yes";
var j = window.open(url, "embed", s);
if (j == null || j == undefined) {
alert("Por favor, desative o seu bloqueador de popups e tente novamente");
}
}
}
var gmcEmbedUtil = new GMCEmbedUtil();
// Mashup ---------------------------
function MashupEmbed()
{
this.isVideoEmbedOpen = false;
this.img = null;
this.embed = null;
}
MashupEmbed.prototype.addVideoEmbed = function(q,config)
{
if(!this.isVideoEmbedOpen)
{
var divT = document.createElement('div');
divT.id = 'boxVideo';
var html = '';
html += '';
html += '