<!--
function openMediaPlayer(idMedia,idGrupo,tipo,idEntidadeX,idDepartamentoX){
	var w = 600;
	var h = 400;
	var l = screen.width/2; l-=w/2;
	var t = screen.height/2; t-=t/2; //t-=parseInt(t/3);
	var idEntidade = idEntidadeX==undefined?'':idEntidadeX;
	var idDepartamento = idDepartamentoX==undefined?'':idDepartamentoX;
	var opMPlayer = window.open('mediaPlayer.asp?idMedia='+idMedia+'&id1='+idGrupo+'&idEntidade='+idEntidade+'&idDepartamento='+idDepartamento,'opMPlayer','width='+w+',height='+h+',top='+t+',left='+l+',scrollbars=1,status=no');
	if (window.focus){opMPlayer.focus();}
}

function openMediaPod(qs){
	var w = 600;
	var h = 400;
	var l = screen.width/2; l-=w/2;
	var t = screen.height/2; t-=t/2; //t-=parseInt(t/3);
	var opMPlayer = window.open('mediaPlayerPod.asp?'+qs,'opMPlayer','width='+w+',height='+h+',top='+t+',left='+l+',scrollbars=1,status=no');
	if (window.focus){opMPlayer.focus();}
}


function playerAoVivo(){
	var w = 600;
	var h = 400;
	var l = screen.width/2; l-=w/2;
	var t = screen.height/2; t-=t/2; //t-=parseInt(t/3);
	var oplAoVivo = window.open('mediaPlayerAoVivo.asp','oplAoVivo','width='+w+',height='+h+',top='+t+',left='+l+',scrollbars=1,status=no');
	if (window.focus){oplAoVivo.focus();}
}

function shL(layer,s,p){
	var obj = document.getElementById(layer);
	if (s=='auto'){
		if (obj.style.visibility=='hidden'){
			obj.style.visibility='visible';
			obj.style.display='block';
			if(p!='no'){obj.style.position='static';}
		}else{
			obj.style.visibility='hidden';
			obj.style.display='none';
			if(p!='no'){obj.style.position='absolute';}
		}
	}else{
		if (s=='show' || s==1){
			obj.style.visibility='visible';
			obj.style.display='block';
			if(p!='no'){obj.style.position='static';}
		}else if (s=='hide' || s==0){
			obj.style.visibility='hidden';
			obj.style.display='none';
			if(p!='no'){obj.style.position='absolute';}
		}
	}
}

function resizeImgInit(img,z){
	var limite = z;
	if(img.width>limite || img.height>limite){
			if(img.width>img.height){
				img.width=limite ;
			}else{
				img.height=limite ;
			}
	}	
}

function addbookmark(){
	if (document.all){	window.external.AddFavorite(document.location,document.title);  }
}

function showItemDiv(div,total,time,showItemDiv_i,showItemDiv_n){
//showItemDiv_i => variavel de controle da repetição - não precisa ser passado como parametro
//showItemDiv_n => variavel de controle da ordenação dos objetos(z-index) - não precisa ser passado como parametro
if(total>1){
		if (showItemDiv_i==undefined)showItemDiv_i=0;
		if (showItemDiv_n==undefined)showItemDiv_n=1000;
		var obj;
		var i = showItemDiv_i;
		var opacity=0;
		var tmp=0;
		showItemDiv_n++;//incrementa para a ordenação

		i++;
		if(i>=total){i=0;}
		obj = document.getElementById(div+'_'+i);
		obj.style.zIndex= showItemDiv_n;
		obj.style.visibility='visible';
		obj.style.opacity = (opacity / 100);obj.style.MozOpacity = (opacity / 100); obj.style.KhtmlOpacity = (opacity / 100); obj.style.filter = "alpha(opacity=" + opacity + ")"; 
		if(document.getElementById(div+'_'+i+'_text')!=undefined)document.getElementById(div+'_'+i+'_text').style.visibility='visible';
		//return false;
		
		var intervalo = window.setInterval(function(){
			opacity+=5;
			obj.style.opacity = (opacity / 100);obj.style.MozOpacity = (opacity / 100); obj.style.KhtmlOpacity = (opacity / 100); obj.style.filter = "alpha(opacity=" + opacity + ")"; 
			if(opacity>=10 && tmp==0){//oculta o texto do objeto anterior
				var x=i-1;
				if(x<0){x=total-1;}
				//alert(opacity+'      '+tmp+'      '+i+'      '+x)
				if(document.getElementById(div+'_'+x+'_text')!=undefined)document.getElementById(div+'_'+x+'_text').style.visibility='hidden';
				tmp=1;
			}
			if(opacity>=100){
				clearInterval(intervalo);
				showItemDiv_i=i;
				
				//deixa o objeto invisivel
				i--;
				if(i<0){i=total-1;}
				obj = document.getElementById(div+'_'+i);
				obj.style.visibility='hidden';
				//if(document.getElementById(div+'_'+i+'_text')!=undefined)document.getElementById(div+'_'+i+'_text').style.visibility='visible';
				obj.style.opacity = (opacity / 100);obj.style.MozOpacity = (opacity / 100); obj.style.KhtmlOpacity = (opacity / 100); obj.style.filter = "alpha(opacity=" + opacity + ")"; 
				
				setTimeout(function(){ showItemDiv(div,total,time,showItemDiv_i,showItemDiv_n) },time);
			}
		}, 50);
	
}
}


var setMediaTop10_loaded=new Array(0,0,0,0,0);
var setMediaTop10_play=-1;//nenhum
var setMediaTop10_url='';//nenhum
function setMediaTop10(i,url){
	//if(setMediaTop10_loaded[i]==0){//somente se não for carregado
		var layer = 'Top10Play_'+i;
		var jx=new AJAX();
		jx.url='mediaLoad.asp?pag=playerHome&i='+i+'&url='+url;
		document.getElementById(layer).innerHTML='aguarde...'
		jx.modo = 'T';
		jx.processaresultado = function(r){
			//para a anteior
			if(setMediaTop10_play>-1)document.getElementById('Top10Play_'+setMediaTop10_play).innerHTML = "<img src='imageSite/ouvir-play.gif' border='0' style='cursor:pointer;cursor:hand;' onClick=\"setMediaTop10("+setMediaTop10_play+",'"+setMediaTop10_url+"');\">";
			//pausa o ao vivo
			aoVivoStop();
			//executa a atual
			document.getElementById(layer).innerHTML= r;
			setMediaTop10_loaded[i]=1;//carregado
			setMediaTop10_play=i;
			setMediaTop10_url=url;
			//stopMediaTop10();
		}
		jx.conectar();
	//}
}


function aoVivoPlay(){
	var campo;
	var n='';
	for (i=0;i<100;i++){
		n+='parent.'
		campo = eval(n+'window.opener');
		if (campo!=undefined){
			if(campo.window.top.pPlay!=undefined){
				campo.window.top.pPlay();
				break;
			}
		}
	}
	
	
}
function aoVivoStop(){
	var campo;
	var n='';
	//for (i=0;i<100;i++){
		if(window.location.href.indexOf('mediaDetalhe.asp')==-1){
			n+='parent.'
			campo = eval(n+'window');
			if (campo!=undefined){
				if(campo.window.top.pStop!=undefined){
					campo.window.top.pStop();
					//break;
				}
			}
		}
	//}
}

function openTudoRadio(){
	var wop=window.open('http://www.tudoradio.com/player.php?radio=1182','jn','width=300,height=210,top=100,left=100');
	if(window.focus){wop.focus();}
	setTimeout(function(){
		if (parent.window!=undefined)parent.window.pStop();
	},1500);
	
	var interIsClosed=setInterval(function(){
		if (wop.closed){
			clearInterval(interIsClosed);
			if (parent.window!=undefined)parent.window.pPlay();
		}
	},500);
}

//********** banners *************

function loadBanner(banners,uLimite){var opt=banners.opt;var list=banners.list;var optLimite=(uLimite==undefined?opt.limit:uLimite);var rd=0;var i=0;var x=0;var obj;var time=0;var rand=function(n){return parseInt(Math.random()*n)};var dwrite=function(rd){var url=list[rd].url;var ext=url.substring(url.lastIndexOf('.'),url.length);var html='';var obj;html+="<div class='bannid_"+list[rd].id+" banner item' style='width:"+list[rd].sizex+"px;height:"+list[rd].sizey+"px;overflow:hidden;'>";if(opt.position.indexOf('#')>-1){html+="<a href='#' class='btClose'>Fechar</a>"}if(ext=='.swf'){html+="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+list[rd].sizex+"' height='"+list[rd].sizey+"'>";html+="<param name='movie' value='"+url+"'/>";html+="<param name='quality' value='high'/>";html+="<param name='menu' value='false'/>";html+="<param name='wmode' value='transparent'/>";html+="<embed src='"+url+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+list[rd].sizex+"' height='"+list[rd].sizey+"'></embed></object>"}else if(ext=='.jpg'||ext=='.jpeg'||ext=='.gif'||ext=='.png'||ext=='.bmp'){if(list[rd].link!='')html+="<a href='"+list[rd].link+"' target='"+list[rd].target+"'>";html+="<img src='"+list[rd].url+"' width='"+list[rd].sizex+"' height='"+list[rd].sizey+"' border='0'/>";if(list[rd].link!='')html+="</a>"}else{html+="<iframe src='"+list[rd].url+"' scrolling='auto' frameborder='0' width='"+list[rd].sizex+"' height='"+list[rd].sizey+"'></iframe>"}html+="</div>";return html};var positionBann=function(rd,isPop){var ps='absolute';var t=0;var l=0;var sW=0;var sH=0;var btW=0;if(opt.tipo==2){btW=$('.banner a.btClose').height();if(btW==undefined)btW=0}if(isPop){sW=screen.width-10;sH=screen.height-10}else{sW=$(window).width();sH=$(window).height()}if(opt.position.indexOf('t')>-1)t=0;if(opt.position.indexOf('l')>-1)l=0;if(opt.position.indexOf('r')>-1)l=sW-list[rd].sizex;if(opt.position.indexOf('b')>-1)t=sH-list[rd].sizey;if(opt.position.indexOf('c')>-1)l=(sW/2)-(list[rd].sizex/2);l=parseInt(l);if(opt.position.indexOf('m')>-1)t=(sH/2)-((list[rd].sizey+btW)/2);t=parseInt(t);if(opt.position.indexOf('x')>-1){if(navigator.appName=='Microsoft Internet Explorer'&&navigator.userAgent.indexOf('MSIE 6.0')>-1){ps='absolute'}else{ps='fixed'}}if(isPop){return{left:l,top:t}}else{return{position:ps,left:l+'px',top:t+'px',zIndex:(ps=='fixed'?9999:1)}}};var initialize=function(){switch(opt.tipo){case 0:{document.write("<div class='banngrid_"+opt.id+"'></div>");var loadBannTipo0=function(){var palco=$('.banngrid_'+opt.id);palco.hide().find('*').remove();list.sort(function(){return 0.5-Math.random()});x=(optLimite>list.length?list.length:optLimite);for(var i=0;i<x;i++){palco.append(dwrite(i))}palco.fadeIn('normal',function(){if(opt.refresh>0)setTimeout(function(){loadBannTipo0()},1000*opt.refresh)})};loadBannTipo0();break}case 1:{rd=rand(list.length);var wobp=window.open('','bannopop_'+list[rd].id,'width='+list[rd].sizex+',height='+list[rd].sizey+',top='+positionBann(rd,true).top+',left='+positionBann(rd,true).left+',scrollbars=auto');$(wobp).bind('load',function(){var html="<html><head><title>Banner</title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";html+="<style>body{margin:0px;}</style></head><body>";html+=dwrite(rd);html+="</body></html>";wobp.document.open();wobp.document.write(html);wobp.document.close();if(window.focus)wobp.focus});break}case 2:{setTimeout(function(){var btClose=false;rd=rand(list.length);obj=$('body').append(dwrite(rd)).find('div.bannid_'+list[rd].id).css(positionBann(rd));obj.find('a.btClose').bind('click',function(){obj.hide();obj.remove();return false});$(window).resize(function(){obj.css(positionBann(rd))});time=0;if(opt.refresh>0){var interTime=setInterval(function(){time++;if(time>=opt.refresh){obj.fadeOut('slow',function(){obj.remove()});clearInterval(interTime)}},1000)}},1);break}default:{break}}};initialize()}

-->
