var servidor = '';

var URLPLAYERAUDIO = servidor+'/midia/audio/playeraudio.jsp';
var URLSTREAMAUDIO = servidor+'/midia/PlayerServlet';
var URLRADIO_ECKO = servidor+'/midia/audio/radio_ecko.jsp';
var URLRADIO_PHILIPS = servidor+'/midia/audio/radio_philips.jsp';

var URLPLAYERVIDEO = servidor+'/midia/video/playervideo.jsp';
var URLSTREAMVIDEO = servidor+'/midia/PlayerServlet';

var URLTUPLAYERVIDEO = 'http://www.tramauniversitario.com.br/midia/video/playervideotu.jsp'

var URLDOWNLOADAUDIO = servidor+'/mp3/download.jsp';
var URLMIDIADOWNLOAD = servidor+'/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 + "/noticias/index.jsp?id="+numero;
}

function noticialink(link) {
	janela = window.open(link);
	janela.focus();
}

function nota(numero) {
	pop2(servidor + '//templnota.jsp?idnot='+numero.toString(),
	616, 401);
}




function radioEcko() {
	 	pop2(URLRADIO_ECKO, 410, 400, 0);
}

function radioPhilips() {
	 	pop2(URLRADIO_PHILIPS, 410, 400, 0);
}

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);
//		pop2(URLPLAYERAUDIO+'?id='+numero+'&tec='+tipotecnum+'&idv=1',666, 410, 0);
}

function audio(numero) {
      pop2(URLPLAYERAUDIO+'?id='+numero+'&idv=1',530, 410, 0);
//		pop2(URLPLAYERAUDIO+'?id='+numero+'&idv=1',666, 410, 0);
}


function playeraudio(numero) {
	 	pop2 (URLPLAYERAUDIO+'?id='+numero, 530, 410, 0);
//		pop2 (URLPLAYERAUDIO+'?id='+numero, 666, 410, 0);
}

function coletiva(){
		window.open('/transmissoes/tomze/player.jsp','Estudando_o_Pagode','width=535,height=330,top=350,left=350,scrollbars=0');
}

function dj(numero) {
	window.open(('/djarea/download.jsp?id='+numero),'MP3','width=300,height=180,top=350,left=350,scrollbars=1');
}
function blogComentario(id_noticia,css) {
	window.open(('/blogs/comentarios.jsp?id='+id_noticia+'&css='+css),'Blog','width=400,height=400,top=350,left=350,scrollbars=1');
}

function mp3(numero) {
	janela = window.open(('/midia/audio/mp3_login.jsp?id='+numero),'MP3','width=300,height=180,top=350,left=350,scrollbars=1');
	janela.focus();
}

function fileDownload(numero) {
	janela = window.open(('/artista/download_login.jsp?id='+numero),'Download','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);
//        pop2(URLPLAYERVIDEO+'?id='+numero+'&tec='+tipotecnum+'&idv=1', 666, 410, 0);
}

function video(numero) {
     pop2(URLPLAYERVIDEO+'?id='+numero+'&idv=1', 530, 410, 0);
//       pop2(URLPLAYERVIDEO+'?id='+numero+'&idv=1', 666, 410, 0);
}

function playervideo(numero) {
	pop2(URLPLAYERVIDEO+'?id='+numero, 530, 410, 0);
//	pop2(URLPLAYERVIDEO+'?id='+numero, 666, 410, 0);
}

function TUplayervideo(id) {
    var w = window.open(URLTUPLAYERVIDEO + '?id='+id,'PlayerVideo','top=50,left=50,width=500,height=450');
}




function album(numero) {
        window.document.location.href = servidor+'/album/index.jsp?id='+numero;
}

function artista(numero) {
        window.document.location.href = servidor+'/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('/galeria/index.jsp?idg='+idgaleria+'&idi='+idimagem, 100, 100, 405, 30, 0, 'popup_foto');
}

function galeria(idgaleria) {
        pop2('/galeria/index_galeria.jsp?id='+idgaleria,360, 400, 30, 30,1);
}

function eventoPorId(idx) {
	janela = window.open(('/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(('/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(('/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(('/usuario/cadastro.jsp'),'Cadastro','width=400,height=450,top=50,left=350,scrollbars=1');
	janela = window.open(('/usuario/userForm2.jsp'),'Cadastro','width=520,height=510,top=50,left=350,scrollbars=yes');
	janela.focus();
}

function esqueci_senha(){
	janela = window.open(('/esqueceu_senha/'),'Cadastro','width=350,height=350,top=50,left=350,scrollbars=1');
	janela.focus();
}

function cadastroDJ() {
	janela = window.open(('/djarea/cadastro.jsp'),'Cadastro','width=400,height=500,top=50,left=350,scrollbars=1');
	janela.focus();
}

function agendageral() {
        parent.document.location.href = servidor+'/agenda/index_eventos.jsp';
}

function imprensa() {
        alert('A p?gina de imprensa ainda n?o est? pronta');
}

function ajuda(o) {
        pop2(o.href,480,400,100,100,1);
        return false;
}

function institucional() {
        window.document.location.href = servidor+'/institucional.jsp';
}

function faleconosco(o) {
	//janela = window.open(('/faleconosco/visitorComment2.jsp'),'Contato','width=520,height=400,top=50,left=350'); janela.focus();
    //window.document.location.href = 'mailto:faleconosco@trama.com.br';
	
	altura=660;
	largura=680;
	
	w = screen.width;
	h = screen.height;
	meio_w = w/2;
	meio_h = h/2;
	
	altura2 = altura/2;
	largura2 = largura/2;
	t = meio_h-altura2;
	l = meio_w-largura2;
	
	janela = window.open(o.href, 'FaleConosco', 'top='+t+',left='+l+',width=680, height=660');
	return false;
}

function openPopup(addr, name, width, height, top, left, scrollbars) {
	janela = window.open(addr, name, 'width='+width+',height='+height+',top='+top+',left='+left+',scrollbars='+scrollbars);
	janela.focus();
}

// Init functions
$(function(){
	$(".lnkCadastro").click(function(){
		var addr = $(this).attr('href');
		openPopup(addr, 'Cadastro', 520, 510, 50, 350, 'yes');
		return false;
	});
	$(".lnkEsqSenha").click(function(){
		var addr = $(this).attr('href');
		openPopup(addr, 'Cadastro', 350, 350, 50, 350, 1);
		return false;
	});
	
	$("#log-in a.login").click(function() {
		$('#login_form').fadeIn('slow');$(this).parent().hide();
	});

	$("#login_form label").click(function() {
		$(this).parent().hide();$('#log-in').fadeIn('slow');
	});
	
	/*$(".firstClick").click(function(){
		$(this).val("");
		$(this).removeClass("firstClick");
	});
	
	$(".firstClick").focus(function(){
		$(this).val("");
		$(this).removeClass("firstClick");
	});*/
	
	$(".firstClick").blur(function(){
		if ($.trim($(this).val()).length == 0) {
			$(this).val($(this).attr('title'));
		}
	});
	$(".firstClick").focus(function(){
		if ($(this).val() == $(this).attr('title')) {
			$(this).val("");
		}
	});
	
	$("#login_form .logar").click(function() { $(this).blur(); });
});