var servidor = 'http://portal.trama.com.br';

var URLPLAYERAUDIO = servidor+'/portalv2/midia/audio/playeraudio.jsp';
var URLSTREAMAUDIO = servidor+'/portalv2/midia/PlayerServlet';

var URLPLAYERVIDEO = servidor+'/portalv2/midia/video/playervideo.jsp';
var URLSTREAMVIDEO = servidor+'/portalv2/midia/PlayerServlet';

var URLDOWNLOADAUDIO = servidor+'/portalv2/mp3/download.jsp';
var URLMIDIADOWNLOAD = servidor+'/portalv2/midia/MidiaDownload';

var URLBUSCA = servidor+'/busca/buscaresp.jsp';



function traduzTipoTec(tipotec) {
    var result = 0;
    if (tipotec == 'rm') result = 3;
    if (tipotec == 'wm') result = 1;
    if (tipotec == 'mov') result = 2;
    return result;
}


function pop(endereco, X, Y, rola) {
	var windowX = (window.screen.width-X)/2;
	var windowY = (window.screen.height-Y)/2;
	if (rola != 1) rola=0;
	parametros='fullscreen=0,location=0,directories=0,menubar=0,toolbar=0,status=1,scrollbars='+ rola +',resizable=0,width=' + X.toString()+ ',height=' +Y.toString()
	+ ',left=' + windowX.toString() + ',top=' + windowY.toString();
	nova = window.open (endereco, '', parametros)
	if (navigator.platform == 'MacPPC')
		nova.resizeTo (X, Y);
}


function pop2(endereco, X, Y, XX, YY, rolagem, nomejanela) {
	parametros='fullscreen=0,location=0,directories=0,menubar=0,toolbar=0,status=1,resizable=0,scrollbars='
	+rolagem+', width='+X.toString()+', height='+Y.toString() + ',left=' + XX + ',top=' + YY;
	nova = window.open(endereco, ''+nomejanela, parametros);
	if (navigator.platform == 'MacPPC') nova.resizeTo (X, Y);
	nova.focus();
}

function open_pop2(endereco, X, Y,nome,left,top,rolagem) {
	parametros = "fullscreen=0,location=0,directories=0,menubar=0,toolbar=0,status=0,resizable=0,scrollbars="+rolagem+", width="+X.toString()+", height="+Y.toString()+",left="+left.toString()+",top="+top.toString()
	nova = window.open(endereco,nome,parametros)
	if (navigator.platform == 'MacPPC')
	{
		nova.resizeTo (X, Y);
	}
	nova.focus();
}



function noticia(numero) {
	window.document.location.href = servidor + "/portalv2/noticias/index.jsp?id="+numero;
}

function noticialink(link) {
	janela = window.open(link);
	janela.focus();
}

function nota(numero) {
	pop2(servidor + '/portal/noticia/templnota.jsp?idnot='+numero.toString(),
	616, 401);
}






function audiostream(numero,tipotec) {
    var tipotecnum = traduzTipoTec(tipotec);
    document.location.href=URLSTREAMAUDIO+'?id='+numero+'&tec='+tipotecnum+'&idv=1';
}

function audiostream(numero) {
    document.location.href=URLSTREAMAUDIO+'?id='+numero+'&idv=1';
}

function audio(numero,tipotec) {
        var tipotecnum = traduzTipoTec(tipotec);
        pop2(URLPLAYERAUDIO+'?id='+numero+'&tec='+tipotecnum+'&idv=1',530, 410, 0);
}

function audio(numero) {
        pop2(URLPLAYERAUDIO+'?id='+numero+'&idv=1',530, 410, 0);
}


function playeraudio(numero) {
	pop2 (URLPLAYERAUDIO+'?id='+numero, 530, 410, 0);
}








function mp3(numero) {
	janela = window.open(('/portalv2/midia/audio/mp3_login.jsp?id='+numero),'MP3','width=300,height=180,top=350,left=350,scrollbars=1');
	janela.focus();
}










function videostream(numero,tipotec) {
    var tipotecnum = traduzTipoTec(tipotec);
    document.location.href=URLSTREAMVIDEO+'?id='+numero+'&tec='+tipotecnum+'&idv=1';
}

function videostream(numero) {
    document.location.href=URLSTREAMVIDEO+'?id='+numero+'&idv=1';
}

function video(numero,tipotec) {
        var tipotecnum = traduzTipoTec(tipotec);
        pop2(URLPLAYERVIDEO+'?id='+numero+'&tec='+tipotecnum+'&idv=1', 530, 410, 0);
}

function video(numero) {
        pop2(URLPLAYERVIDEO+'?id='+numero+'&idv=1', 530, 410, 0);
}

function playervideo(numero) {
	pop2(URLPLAYERVIDEO+'?id='+numero, 530, 410, 0);
}





function album(numero) {
        window.document.location.href = servidor+'/portalv2/album/index.jsp?id='+numero;
}

function artista(numero) {
        window.document.location.href = servidor+'/portalv2/artista/index.jsp?id='+numero;
}



var ns = document.layers ? 1 : 0;
var ie = document.all ? 1 : 0;
var moz = (navigator.userAgent.indexOf('Gecko') != -1);
function show(div){
	if(ie) {
		document.all[div].style.visibility="visible";
		document.all[div].style.top=event.clientY+10;
		document.all[div].style.left=event.clientX;
		}
	if(ns) document.layers[div].visibility="show";
	if(moz) document.getElementById(div).style.visibility="visible";
}


function hide(div){
	if(ie) (document.all[div].style.visibility="hidden");
	if(ns) (document.layers[div].visibility="hide");
	if(moz) (document.getElementById(div).style.visibility="hidden");
}

function foto(endereco) {
	sobraX = 12;
	sobraY = (screen.height - screen.availHeight);
	if (navigator.appName != "Microsoft Internet Explorer")
	{sobraX = 0;	sobraY = 0;	}
	nova = window.open('', 'foto', 'fullscreen=0,location=0,directories=0,menubar=0,toolbar=0,status=0,resizable=1,scrollbars=0, width=100, height=50')
	nova.document.open("text/html", "replace");
	nova.document.write('<HTML><HEAD><TITLE>'+endereco+'</TITLE></HEAD>');
	nova.document.write('<BODY bgcolor=black background=f6.jpg leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="margin:0" onload="self.resizeTo(document.pic.width + ' + sobraX.toString() + ', document.pic.height + ' + sobraY.toString() + ');">\r\n');
	nova.document.write('<a href="#"><IMG SRC="' + endereco + '" BORDER=1 name="pic" alt="clique para fechar" onclick="parent.self.close();"></a></BODY></HTML>');
	nova.document.close();
	nova.focus();
}

function fotogaleria(idgaleria,idimagem) {
	pop2('/portalv2/galeria/index.jsp?idg='+idgaleria+'&idi='+idimagem, 100, 100, 405, 30, 0, 'popup_foto');
}

function galeria(idgaleria) {
        pop2('/portalv2/galeria/index_galeria.jsp?id='+idgaleria,360, 400, 30, 30,1);
}

function eventoPorId(idx) {
	janela = window.open(('/portalv2/agenda/index.jsp?id='+idx),'Eventos','width=500,height=350,top=350,left=350,scrollbars=1');
	janela.focus();
}

function eventosDoDia(dia,mes,ano) {
	janela = window.open(('/portalv2/agenda/index.jsp?dia='+dia+'&mes='+mes+'&ano='+ano),'Eventos','width=500,height=350,top=350,left=350,scrollbars=1');
	janela.focus();
}

function eventosDoMes(mes,ano) {
	janela = window.open(('/portalv2/agenda/index.jsp?mes='+mes+'&ano='+ano),'Eventos','width=500,height=350,top=350,left=350,scrollbars=1');
	janela.focus();
}

function cadastro() {
	janela = window.open(('/portalv2/usuario/cadastro.jsp'),'Cadastro','width=400,height=450,top=50,left=350,scrollbars=1');
	janela.focus();
}

function agendageral() {
        parent.document.location.href = servidor+'/portalv2/agenda/index_eventos.jsp';
}

function imprensa() {
        alert('A página de imprensa ainda não está pronta');
}

function ajuda() {
        pop2(servidor+'/portalst/home/ajuda.html',480,400,100,100,1);
}

function institucional() {
        window.document.location.href = servidor+'/portalv2/home/institucional.jsp';
}

function faleconosco() {
        window.document.location.href = 'mailto:faleconosco@trama.com.br';
}



