function linkMultimidia(cid, mid, id, attr, pos, tipo, credito, legenda){
	if (credito == undefined) credito = '';
	if (legenda == undefined) legenda = '';


	if ('AUDIO' == tipo || 'ÁUDIO' == tipo) {
		MM_openBrWindow('player.jsp?cid=' + cid + '&mid=' + mid + '&id=' + id + '&ver=1&ln=pt_BR&attrid=' + attr + '&pos=' + pos + '&tipo=' + tipo,'_blank','height=302,width=250');
		
	} else if ('VIDEO' == tipo || 'VÍDEO' == tipo) {
		MM_openBrWindow('player.jsp?cid=' + cid + '&mid=' + mid + '&id=' + id + '&ver=1&ln=pt_BR&attrid=' + attr + '&pos=' + pos + '&tipo=' + tipo,'_blank','height=302,width=250');
	
	} else if ('PDF' == tipo) {
		MM_openBrWindow('/admcomunidades/jsp/corporatefilepdf.jsp?cid=' + cid + '&mid=' + mid + '&id=' + id + '&ver=1&ln=pt_BR&attrid=' + attr + '&pos=' + pos,'_blank','width=640,height=480,scrollbars=yes,resizable=yes');
		
	} else if ('FLASH' == tipo) {
		MM_openBrWindow('viewFlash.jsp?cid=' + cid + '&mid=' + mid + '&id=' + id + '&ver=1&ln=pt_BR&attrid=' + attr + '&pos=' + pos,'_blank','width=500,height=400');
		
	} else if ('IMAGEM' == tipo || 'FOTO' == tipo) {
		MM_openBrWindow('viewFoto.jsp?cid=' + cid + '&mid=' + mid + '&id=' + id + '&ver=1&ln=pt_BR&attrid=' + attr + '&pos=' + pos + '&credito=' + credito + '&legenda=' + legenda,'_blank','width=580,height=426,scrollbars=yes');
	}
}

function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function print_stars(ranking){
	full_star  = '<img src="/anoticia/icon/i_star_on.gif" alt="" />';
	half_star  = '<img src="/anoticia/icon/i_star_half.gif" alt="" />';
	empty_star = '<img src="/anoticia/icon/i_star_off.gif" alt="" />';
	 
	ranking = ranking.replace(/,/,".");
	
	j = 0;
	
	for(; j < Math.floor(ranking); j++){
	  document.write( full_star );
	}

	decimal = ranking.substring(ranking.indexOf('.')+1,4);
	if (decimal.length == 1) decimal += '0';
	
	if (decimal  > 24 && decimal < 75 ){
	  document.write( half_star );
	  j++;
	} else if (decimal >= 75){
	  document.write( full_star );
	  j++;
	}
	for (; j < 5; j++) {
	  document.write( empty_star );
	}
}

function showPermalink(localizador){
	MM_openBrWindow('permalink.jsp?localizador=' + localizador,'_blank','scrollbars=yes,width=430,height=296');
}

function comentar(cid,mid,id,features){
	form = true;
	if (features != undefined && features.indexOf('form=no') != -1) form = false;

	MM_openBrWindow('post_comentario.jsp?cid=' + cid + '&mid=' + mid + '&id=' + id + '&form=' + form,'_blank','width=514,height=520,scrollbars=yes');
}

function votar(cid,mid,id){
	MM_openBrWindow('votar.jsp?cid=' + cid + '&mid=' + mid + '&id=' + id,'_blank','scrollbars=yes,width=286,height=296');
}

function denunciar(localizador){
	MM_openBrWindow('cgit_denunciar.jsp?localizador=' + localizador,'_blank','width=514,height=520,scrollbars=no');
}

function corrigir(localizador){
	MM_openBrWindow('cgit_denunciar.jsp?type=corrigir&localizador=' + localizador,'popup','scrollbars=yes,width=514,height=520');
}

function enviar_para_amigo(localizador){
	MM_openBrWindow('send_friend.jsp?localizador=' + localizador,'popup','scrollbars=yes,width=510,height=546');
}

function enviar_para_amigo(localizador, modelo, cartola, title){
	MM_openBrWindow('send_friend.jsp?localizador=' + localizador + '&section=' + modelo + '&cartola=' + cartola + '&title=' + title,'popup','scrollbars=yes,width=510,height=546');
}

function imprimir(localizador){
	MM_openBrWindow('detalhe_impressao.jsp?localizador='+ localizador,'_blank','width=605,height=600,scrollbars=yes');
}

function doSearch(id_frm){
	frm         = document.getElementById( id_frm );
	secao       = frm.secao.value;
	localizador = frm.localizador.value;
	key         = frm.key.value;
	
	if(frm.attr != undefined)
		attr = frm.attr.value;
	else
		attr = "";	
	
	if(frm.comparator != undefined)
		comparator = frm.comparator.value;
	else
		comparator = "";	
	
	if(frm.value_from != undefined)
		value_from = frm.value_from.value;
	else
		value_from = "";	
	
	if(frm.value_to != undefined)
		value_to = frm.value_to.value;
	else
		value_to = "";	
	
	url_busca = 'home.jsp?secao=' + secao + '&localizador=' + localizador + '&key=' + key +
				'&attr=' + attr + '&comparator=' + comparator + '&value_from=' + value_from + '&value_to=' + value_to;	
	
	if (frm.order != undefined)	{
		order = frm.order[frm.order.selectedIndex].value;
		url_busca += "&order=" + order;
	}
	
	if (frm.section != undefined)	{
		url_busca += "&section=" + frm.section.value;
	}
	
	location.href = url_busca;
}

function selectByValue(combo, value){
	var obj = document.getElementById( combo );
	for (i = 0; i < obj.options.length; i++){
		if (value == obj.options[i].value){
			obj.selectedIndex = i;
			break;
		}
	}
}

function checkByValue(frm, id, value){

	obj = eval('document.' + frm + '.' + id)
	
	for (i = 0; i < obj.length; i++){
		if (obj[i].value == value)
			obj[i].checked = true;
	}
	
}

function DateFormatter(date){
		
	this.DAY = date.substring(0, date.indexOf('/') ); 
	this.MONTH = date.substring(date.indexOf('/') +1, date.indexOf('/') +3 );
	this.YEAR = date.substring(date.lastIndexOf('/') +1 ,date.lastIndexOf('/') +5 );
	
	this.HOURS  = date.substring(date.indexOf(':') -2, date.indexOf(':') ); 
	this.MINUTES  = date.substring(date.indexOf(':') +1, date.lastIndexOf(':'));
	
	this.d = new Date();
	this.d.setDate( this.DAY );
	this.d.setMonth( this.MONTH - 1 );
	this.d.setYear( this.YEAR );
	
	if (this.HOURS != '' && this.MINUTES != ''){
		this.d.setHours( this.HOURS );
		this.d.setMinutes( this.MINUTES );
	} else {
		this.HOURS = ''; 
		this.MINUTES = '';
	}
	
	this.DAY_OF_WEEK = this.d.getDay() +1;
	
	this.getMonth = function getMonth(){
		months     = new Array()
		months[0]  = 'janeiro'
		months[1]  = 'fevereiro'
		months[2]  = 'março'
		months[3]  = 'abril'
		months[4]  = 'maio'
		months[5]  = 'junho'
		months[6]  = 'julho'
		months[7]  = 'agosto'
		months[8]  = 'setembro'
		months[9]  = 'outubro'
		months[10] = 'novembro'
		months[11] = 'dezembro'
		
		return months[ this.d.getMonth() ];
	}

	this.getDayOfWeek = function getDayOfWeek(){
		week    = new Array();
		week[0] = 'Domingo';
		week[1] = 'Segunda';
		week[2] = 'Terça';
		week[3] = 'Quarta';
		week[4] = 'Quinta';
		week[5] = 'Sexta';
		week[6] = 'Sábado';
		
		return week[  this.d.getDay() ];
	}

}

function selectMenu( secao_menu ){
	obj = document.getElementById('menu');

	objs = obj.getElementsByTagName('a');

	for (i = 0; i < objs.length; i++) {
		objs[i].className = '';

		if (objs[i].id == secao_menu)
			objs[i].className = 'mark';
	}
}

function link_gallery(p_type, p_path, p_template, p_gallery_id, p_group_id, p_popup_width, p_popup_height, p_parameters_site, p_uf, p_local){
 	if (p_uf == ' ') p_uf = "1";
	if (p_local == ' ') p_local = "1";

	var tam = p_path.length;
	if (tam > 0){
		var position = p_path.indexOf("/",0);
		if (position == 0) p_path = p_path.substring(1, tam);
		tam = p_path.length;
		position = p_path.lastIndexOf("/", tam);
		if (position == (tam - 1)) p_path = p_path.substring(0, position);
	}

 	//p_type = 1 (galeria), p_type = 2 (sequencia de fotos)
 	if (p_type == "1"){
		document.location.href = "http://www.clicrbs.com.br/"+p_path+"/jsp/default.jsp?newsID=DYNAMIC%2Cgaleria.GalleryDelivery%2CphotosGalleryXml&pg=1&template="+p_template+"&groupid="+p_group_id+"&galeriaid="+p_gallery_id+"&uf="+p_uf+"&local="+p_local+p_parameters_site;
	}else{
		var pagina = "http://www.clicrbs.com.br/"+p_path+"/jsp/default.jsp?template=4197.dwt&ids=null&initial=null&playsshow=false&b=1&arquivo_xml=galeria_"+p_gallery_id+"_"+p_group_id+".xml&uf="+p_uf+"&local="+p_local+p_parameters_site;
 		MM_openBrWindow(pagina,'Galeria','scrollbars=auto,resizable=yes,width='+p_popup_width+',height='+p_popup_height);
 	}
}

function calendarioF(calendarioId, template, uf, local, site){
	var urlSite = site;
	var pagina = escape(site+"/jsp/default.jsp?uf="+uf+"&local="+local+"&calendarioid="+calendarioId+"&section=Programação&template="+template);
	document.location.href=site+"/jsp/default.jsp?uf="+uf+"&local="+local+"&section=Programaçãoo&template=1740.dwt&pagina_calendario="+pagina+"&urlSite="+urlSite;
}

function newWindow(url){
window.open(url, "","width=700,height=500,toolbar=yes,menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes");
}

function community_logoff(secao,localizador){
	setCookie("cdmuser", "-none");
	if (secao != '' && localizador != '')
		window.location.href = 'home.jsp?secao=' + secao + '&localizador=' + localizador;
	else
		window.location.reload();
}

function setCookie(sName, sValue){
	var date = new Date();
	document.cookie = sName + "=" + escape(sValue) + ";path=/;";
}

function logout(){
	setCookie("cdmuser", "-none");
	document.loginform.op.value = "3";
	document.loginform.action = "/servlet/LogonServlet";
	document.loginform.submit();
}

function update(){
	document.loginform.action = "/servlet/SignUpServlet";
	document.loginform.submit();
} 

function signup(){
	document.loginform.submit();
}

function termos(){
	MM_openBrWindow('/anoticia/termo.htm','_blank','width=530,height=600,scrollbars=yes');
}

function termos_comunidades(){
	MM_openBrWindow('/anoticia/termos_comunidades.htm','_blank','width=530,height=600,scrollbars=yes');
}
function abrecsPorCanal(nCanal,uf,rev){
	top.location.href = "http://www.clicrbs.com.br/clicstation/jsp/expanded_sites.jsp?canal="+nCanal+"&uf="+uf+"&rev=http://www.clicrbs.com.br/anoticia/jsp/"+rev;
}

function cookie_control(uf,local){
	doRedirect = false;
	
	uf_cookie = '';
	local_cookie = '';
	
	conteudo = le_cookie();

	if ( conteudo.length > 0 ) {
		var url = document.URL;
		var url_array = new Array();

		url_array = url.split("?");

		url_redirect = url_array[0]+"?";

		uf_cookie = getInfoCookie( 'uf', conteudo );
		if ( uf == '' && uf_cookie != '') {
			url_redirect += 'uf=' + uf_cookie + '&';
			uf = uf_cookie;
			doRedirect = true;
		}
		
		local_cookie = getInfoCookie( 'local', conteudo );
		if ( local == '' && local_cookie != '' ) {
			url_redirect += 'local=' + local_cookie + '&';
			local = local_cookie;
			doRedirect = true;
		}

		for ( i = 1; i < url_array.length; i++ ) {
			url_redirect += url_array[i];
			if ( i < url_array.length-1 ) url_redirect += "?";
		}

		if ( doRedirect ) {
			url_redirect += "&redirected=true";//parametro que indica que houve redirecionamento
			location.href = url_redirect;
		}

	}  else if ( uf != '' ) {
		if ( uf == "1" ) local = "1";
		else if ( uf == "2" ) local = "18";
	
	} else {
		location.href = 'http://www.clicrbs.com.br/jsp/seleciona_regiao.jsp?url_rs=http%3A//www.clicrbs.com.br/anoticia/jsp/default.jsp%3Fuf%3D1%26local%3D1&url_sc=http%3A//www.clicrbs.com.br/anoticia/jsp/default.jsp%3Fuf%3D2%26local%3D18';
	}

	if ( uf != uf_cookie || local != local_cookie) {
		grava_cookie(uf, local);
	}

}

function le_cookie(){
	var conteudo = '';
	var cookie = document.cookie;
	begin = cookie.indexOf("clicRBSv2.prefs");
	if ( begin > -1 ) {
		conteudo = cookie.substring(cookie.indexOf("clicRBSv2.prefs"));
	}
	
	return conteudo;
}

function getInfoCookie( param, conteudo ){
	if ('uf' == param) {
		temp =  conteudo.substring( conteudo.indexOf("uf=") + 3 , conteudo.indexOf(":usuario") );
		return temp.substring( temp.indexOf( "(" ) + 1 , temp.indexOf( ")" ) );
	
	} else if ('local' == param) {
		temp = conteudo.substring( conteudo.indexOf("local=") + 6, conteudo.indexOf(":uf") );
		return temp.substring( temp.indexOf("(" ) + 1 , temp.indexOf( ")" ) );
	
	} else {
		return '';
	}
}

function grava_cookie(uf, local) {
	//alert('Grava cookie: uf = ' + uf + ', local = ' + local);
	var sigla = '';
	var cidade = '';

	var nextyear = new Date();
	nextyear.setFullYear(nextyear.getFullYear() + 10);
	
	if (uf == '1') {
		sigla = 'RS';
		if (local == '1') cidade = 'Porto%20Alegre';
	} else if (uf == '2') {
		sigla = 'SC';
		if (local == '18') cidade = 'Florianópolis';
	}
		
	document.cookie = "clicRBSv2.prefs=local=" + cidade + "(" + local + "):uf=" + sigla + "(" + uf + "):usuario=; expires="+nextyear.toGMTString()+"; path=/;";
}

function validateURL(url_link) {
	lengthValue = url_link.length;
	if (lengthValue != 0) {
		var j = new RegExp();
		j.compile("^[A-Za-z]+://[A-Za-z0-9-]+\.[A-Za-z0-9]+"); 
		if (!j.test(url_link)) { 
			return false;
		}
	}
	return true;
}


function formatURL( url_link ) {
	if ( url_link.indexOf( "http://" ) < 0 )
		url_link = "http://" + url_link;
		
	return url_link;
}

function doChatHome(room_id) {
	if (room_id != null)
		window.open('http://www.clicrbs.com.br/jsp/popup_ingresso_chat.jsp?room='+room_id, 'ingresso', 'toolbar=no,menubar=no,resizable=no,scrollbars=no,width=250,height=200');
}

function signup(community_path){
	document.cdmloginform.op.value = "1";
	document.cdmloginform.nextop.value = "21";
	document.cdmloginform.action = "/servlet/SignUpServlet";
	document.cdmloginform.url.value = "http://www.clicrbs.com.br/anoticia/jsp/home.jsp?secao=post&localizador=A+Noticia/"+community_path+"/Participe";
	document.cdmloginform.submit();
}

function recover(idForm){
	if (idForm != undefined && idForm != '')
		form = document.getElementById(idForm);
	else
		form = document.cdmloginform;
	
	form.op.value = "1";
	form.action = "/servlet/RecoverServlet";
	form.submit();
}

function loginSubmit(community_path, idForm){

	if (idForm != undefined && idForm != '')
		form = document.getElementById(idForm);
	else
		form = document.cdmloginform;
		
	var status=true;
	if (form.user_name.value == ""){
		alert("Você deve preencher o usuário.");
		form.user_name.focus();
		status=false;
	}else	if(form.encrypted_user_password.value==""){
		form.encrypted_user_password.focus();
		alert("Você deve digitar a senha.");		
		status=false;
	}
	if(status && form.update_info_flag.checked){
		form.url.value="home.jsp?secao=post&localizador=anoticia/"+community_path+"/A+Galera";
	}

	if( status ) {
		form.submit();
	}
}

function onEnter_Submit(e,community_path,idForm){
	if (document.all){ // Internet Explorer
		var tecla = event.keyCode;
	} else if( navigator.userAgent.indexOf('Mozilla') !=-1 ){ // Mozilla
		var tecla = e.which;
	}
	if (tecla == 13) loginSubmit(community_path,idForm);
}

fila = [];
ifila = 0;

function loadBlock(url,b){

	//Carregando...
    document.getElementById(b).innerHTML = "<span class='carregando' style='color: #FF0000; font-style: italic'>Carregando...</span>";
	
	//Adiciona a fila
    fila[fila.length] = [b,url]
	
    //Se nao ha conexoes pendentes, executa
    if ( (ifila+1) == fila.length)
		ajaxRun();


}

function ajaxRun(){

	var xmlhttp = null;
		
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try { 
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) { 
			xmlhttp = false; 
		} 
	}		

	if ( !xmlhttp && typeof XMLHttpRequest != 'undefined' ) {
		xmlhttp = new XMLHttpRequest();
	}
    
	//Abre a conexao
    xmlhttp.open("GET",fila[ifila][1],true);

	
    
	//Funcao para tratamento do retorno
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4){
            //Mostra o HTML recebido
            retorno = unescape(xmlhttp.responseText.replace(/\+/g," "))
            document.getElementById(fila[ifila][0]).innerHTML = retorno
            //Roda o proximo
            ifila++;
            if (ifila < fila.length) ajaxRun();
        }
    }

    //Executa
	try {
    xmlhttp.send(null)
	} catch (e) {}

}

function envieAmigo(title){
	var url = escape(document.URL);
	var caminho = 'http://www.clicrbs.com.br/anoticia/jsp/enviaramigo.jsp?site=anoticia&url=' + url + '&title=' + title  + '&control=form';
	window.open(caminho,'EnviaR','width=510,height=316,scrollbars=yes');
	
}

function showPostadoPor(origem){
	var retorno ='';
	if (origem == 'DETALHE')
		retorno += '<img src="/anoticia/icon/postado_por_kzuka.gif" class="thumb" />';

	retorno += '<div class="poste-autor">' +
				'<span class="poste-for">Postado por:</span>'+
				'<span class="poste-name">Equipe A Noticia</span>' +
			 '</div>';
	
	if (origem == 'DETALHE')
		retorno += '<p>Porto Alegre - RS</p>';
			 
	return retorno;
}

function escreveData(e,obj){
	if (document.all){ // Internet Explorer
		var tecla = event.keyCode;
		if (tecla <= 47 || tecla >= 58) event.returnValue = false;
	} else if( navigator.userAgent.indexOf('Mozilla') !=-1 ){ // Mozilla
		var tecla = e.which;
		if (e.cancelable && tecla >= 32 && tecla <= 47 || tecla >= 58 && tecla <= 126) {
 			e.preventDefault();
		}
	}
	if (tecla > 47 && tecla < 58){
		if (obj.value.length == 2 || obj.value.length == 5)
			obj.value += '/';
	}
}
function validaData(data){
	if (data.value != ''){
		if (data.value.indexOf('/') == 2 && data.value.indexOf( "/", data.value.indexOf("/")+1 ) == 5 ){
			dia = (data.value.substring(0,2)); 
	        mes = (data.value.substring(3,5)); 
	        ano = (data.value.substring(6,10)); 
	
	        var invalida;
			
	        // verifica o dia valido para cada mes 
	        if ((dia < '01')||(dia < '01' || dia > '30') && (  mes == '04' || mes == '06' || mes == '09' || mes == '11' ) || dia > '31') { 
	            invalida = true; 
	        } 
	
	        // verifica se o mes e valido 
	        if (mes < '01' || mes > '12') { 
	            invalida = true; 
	        } 
	
	        // verifica se e ano bissexto 
	        if (mes == '02' && ( dia < '01' || dia > '29' || ( dia > '28' && (parseInt(ano / 4) != ano / 4)))) { 
	            invalida = true; 
	        } 
	
	        if (invalida) { 
	            alert("Data inválida!"); 
	            data.focus(); 
				return false;
	        }
			return true;
		}else{
			alert("Data inválida!"); 
	           data.focus(); 
			return false;
		}
	} else return true;
}

function buscarGalera(){
	submete = false;
	form = document.busca_galera;

	if      (form.cdm_nome.value != '')     submete = true;
	else if (isChecked(form.cdm_sexo) )     submete = true;
	else if (form.cdm_cidade.value != '')   submete = true;
	else if (form.cdm_idadeini.value != '') submete = true;
	else if (form.cdm_idadefim.value != '') submete = true;
	else if (form.cdm_estado.selectedIndex > 0) submete = true;
	
	if (submete) 
		form.submit();
	else
		alert('Informe algum critério para a busca!');
}

function isChecked(radio){
	for (i = 0; i < radio.length; i++){
		if (radio[i].checked) return true;
	}
	
	return false;
}

function testeemail(email) {
	if (email != ''){
		return email.match( /^(([^\W]([\w_\.\-])*[^\W])|(\w))@(([\w_\-])+\.)+([a-zA-Z0-9]{2,4})+$/ ) ? true : false;
	}
	return true;
}


function setAltById(){
var imgs, i, labels, text, corpo;

corpo = document.getElementById('colunaesquerda');
imgs = corpo.getElementsByTagName('img');

	for(var i = 0; i < imgs.length; i++){
		imgs[i].setAttribute("id", "imagem"+i);
		 if(/imagem/.test(imgs[i].id)){
			text = imgs[i].previousSibling;
			if ( text.childNodes.length > 0 ) {
				text = text.childNodes[0].nodeValue;
				imgs[i].setAttribute("alt", text);
				imgs[i].setAttribute("title", text);
				text = "";
			}
		}
	}
}

function showLegenda(){
	window.open('/anoticia/popup_legendas_icones.htm','_blank','width=380,height=296,scrollbars=no')
}

function linkImagem(p_width,p_height,p_file,p_author,p_copyright,p_legend){
	window.open("/rbs/image/"+p_file,"anoticia","width=580,height=426");
}

function addEvent(obj, evType, fn){
	if (obj.addEventListener)
		obj.addEventListener(evType, fn, true)
	if (obj.attachEvent)
		obj.attachEvent("on"+evType, fn)
}

function linkVideoCapas(vId){
window.open("http://mediacenter.kzuka.com.br/templates/DetachedPlayerHome.aspx?vid="+vId,"detached","width=324,height=342,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,copyhistory=no");
}

function doSubmit(t,n,s,l,tplt){
 document.formDefault.tab.value=t;
 document.formDefault.newsID.value=n;
 document.formDefault.subTab.value=s;
 if(l!=null) document.formDefault.l.value=l;
 if(tplt!=null) document.formDefault.template.value=tplt;
 if(t=="00000"){
  document.formDefault.action="/jsp/default.jsp";
  document.formDefault.submit();
 }else if(t=="00002"){
  document.formDefault.action="/clicnoticias/jsp/default.jsp";
  document.formDefault.submit();
 }else if(t=="00003"){
  document.formDefault.action="/clicesportes/jsp/default.jsp";
  document.formDefault.submit();
 }else if( (t=="000053") || (t=="00053") || (t=="00052") ) {
  document.formDefault.action="/especiais/jsp/default.jsp";
  document.formDefault.submit();  
 }else if( (t=="000024") || (t=="00024") ){
  document.formDefault.action="/agrol/jsp/default.jsp";
  document.formDefault.submit();
 }else if( (t=="000013") || (t=="00013") ){
  document.formDefault.action="/eleicoes/jsp/default.jsp";
  document.formDefault.submit();
 }else if(t=="00004"){
  document.formNessa.menu.value="inc/ultimas_detalhe.jsp";
  document.formNessa.conteudo.value="jsp/ultimas_detalhe.jsp";
  document.formNessa.evento.value=n.substring(1,n.indexOf('.'));;
  document.formNessa.submit();
 }else if((t=="00009")|| (t=="00010") || (t=="000010") ){
  source = n.substring(0,n.indexOf("."))+".xml";
  window.location.href="/jornais/anoticia/jsp/default2.jsp?uf=1&local=1&source="+source;
 }else if(t=="00016"){
  	 document.formDefault.action="/planeta/jsp/default.jsp";
	 document.formDefault.submit();
 }else if(t=="00050"){
  	 document.formDefault.action="/jogosolimpicos/jsp/default.jsp";
	 document.formDefault.submit();
 }else if(t=="00035"){
  	 document.formDefault.action="/expointer/jsp/default.jsp";
	 document.formDefault.submit();	
 }else if(t=="00055"){
  	 document.formDefault.action="/forum/jsp/default.jsp";
	 document.formDefault.submit();	 	
 }else if(t=="00059"){
  	 document.formDefault.action="/globaltech/jsp/default.jsp";
	 document.formDefault.submit();  
}else if(t=="00089"){
  	 document.formDefault.action="/anoticia/jsp/default.jsp";
	 document.formDefault.submit(); 	 
	 	 
 }else if(t.indexOf('inc')==0){
  document.formNessa.menu.value=t;
  document.formNessa.conteudo.value=n;
  document.formNessa.ctrl.value=s;
  document.formNessa.evento.value=l;
  document.formNessa.submit();
 }
}

function OpenPopupRodape(tipo) {
	if(tipo==1){
		duvida = "http://www.clicrbs.com.br/atendimento/jsp/default.jsp?template=4208.dwt&newsID=DYNAMIC,atendimento.AtendimentoDataServer,getDuvidas&idcentral=218&logo=clic&dominio=clic";
		window.open( duvida,'Duvidas', 'resizable=no,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes, width=656, height=520');
	}
	if(tipo==2){
		fale = "http://www.clicrbs.com.br/atendimento/jsp/default.jsp?template=4210.dwt&newsID=DYNAMIC,atendimento.AtendimentoDataServer,getFaleConosco&idcentral=218&logo=clic&dominio=clic";
		window.open( fale,'Fale', 'resizable=no,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes, width=656, height=520');
	}
}

function linkGaleriaP (p_type, p_path, p_template, p_gallery_id, p_group_id, p_popup_width, p_popup_height, p_parameters_site, p_site){
        if (p_site == null || p_site == ' ') p_site = "http://www.clicrbs.com.br";
        var tam = p_path.length;
        if (tam > 0){
                var position = p_path.indexOf("/",0);
                if (position == 0) p_path = p_path.substring(1, tam);
                tam = p_path.length;
                position = p_path.lastIndexOf("/", tam);
                if (position == (tam - 1)) p_path = p_path.substring(0, position);
        }
        if (p_site.indexOf("clicrbs") != -1) {
                p_path = p_path+"/jsp";
        }
        //p_type = 1 (galeria), p_type = 2 (sequencia de fotos)
        if (p_type == "1"){
                document.location.href = p_site+"/"+p_path+"/default.jsp?uf="+uf+"&local="+local+"&newsID=DYNAMIC%2Cgaleria.GalleryDelivery%2CphotosGalleryXml&pg=1&template="+p_template+"&groupid="+p_group_id+"&galeriaid="+p_gallery_id+p_parameters_site;
        }else{
                var pagina = "http://www.clicrbs.com.br/jsp/default_galeria.jsp?uf="+uf+"&local="+local+"&template=4197.dwt&ids=null&initial=null&playsshow=false&b=1&site=anoticia&arquivo_xml=galeria_"+p_gallery_id+"_"+p_group_id+".xml";
				//MM_openBrWindow(pagina,'Galeria','scrollbars=auto,resizable=yes,width='+p_popup_width+',height='+p_popup_height);
				MM_openBrWindow(pagina,'Galeria','scrollbars=no,menubar=no,status=no,width=730,height=538');
        }
}

function setFavIcon (urlIcon){
	fvicon = document.createElement("link");
	fvicon.rel = "shortcut icon";
	fvicon.type = "image/x-icon";
	fvicon.href = urlIcon;

	document.getElementsByTagName("head")[0].appendChild(fvicon);
}

  function selecionadaFoto(ids, groupid, galeriaid, uf, local){
		//var groupid1 = "";
		//var galeriaid1 = "";
		//var uf1 = "";
		//var local1 = "";
		
		var pagina = "";
		var arquivo_xml = "";
		
		if (galeriaid != "" && groupid != "" && uf != "" && local != ""){
			pagina = "http://www.clicrbs.com.br/anoticia/jsp/default.jsp?template=4197.dwt&b=1&galeriaid="+galeriaid+"&groupid="+groupid+"&uf="+uf+"&local="+local;
		}
		if (groupid != "" && galeriaid != ""){
			arquivo_xml = "galeria_"+galeriaid+"_"+groupid+".xml";
		}
		
		var selecionou = false;
		var isFirst = 0;
		var initial = "null";

		if (ids != ""){
			selecionou = true;
			initial = ids;
			ids = "null";
		}
		if (selecionou == false){
			//não selecionou nenhuma foto
			ids = "null";
			pagina+= "&arquivo_xml="+arquivo_xml+"&ids="+ids+"&initial="+initial+"&playsshow=false";
		}else{
			pagina+= "&arquivo_xml="+arquivo_xml+"&ids="+ids+"&initial="+initial+"&playsshow=false";
		}
		if (arquivo_xml != "" && selecionou){
			MM_openBrWindow(pagina,'Galeria','scrollbars=auto,resizable=yes,width=728,height=535');
		}
	}
	
function chamaArquivoFlash($arquivo,$altura,$largura,$id){
	document.writeln('<div style="margin:auto; width:200px;">');
	document.writeln('    <object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + $largura + '" height="' + $altura + '" id="' + $id + '" name="' + $id + '">');
	document.writeln('        <param name="movie" value="' + $arquivo + '" />');
	document.writeln('        <param name="FlashVars" value="loc=en_US&htmlApp=false&gatewayURL=gwurl" />');
	document.writeln('        <param name="bgcolor" value="#ffffff" />');
	document.writeln('        <param name="menu" value="false" />');
	document.writeln('        <param name="quality" value="high" />');
	document.writeln('        <param name="salign" value="tl" />');
	document.writeln('        <param name="scale" value="noscale" />');
	document.writeln('        <param name="wmode" value="transparent" />');
	document.writeln('        <embed id="globalnav-embed" src="' + $arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" bgcolor="#ffffff" menu="false" quality="high" salign="tl" scale="noscale" id="' + $id + '" width="' + $largura + '" height="' + $altura + '"></embed>');
    document.writeln('    </object>');
    document.writeln('</div>');

}

function doPopup(url){
	window.open(url);
} 	

function aviso_comunidade(){
	MM_openBrWindow('../avisocomunidade.htm','_blank','width=514,height=520,scrollbars=yes');
}

function controlaFoto(lado,inicializa){

	var sair=false;var i=0;
	var slide = document.getElementById("slideshow");
	if (slide)
		{
		var tempo;
		if (inicializa!="trues"){
		timedCount()
		}else if ((inicializa=="trues")){
			stopCount()
			}		
			var divFotos = slide.getElementsByTagName("div");
			//Pega o 1 item que vai ser off e torna ele on para iniciar
			if (inicializa=="inicia"){
				if(divFotos[0].className == "slide off"){
					divFotos[0].className = "slide on";
				} 	
			}


			while((i<=divFotos.length)&&(!sair)){
				if(lado=="ant"){
					if(divFotos[i].className == "slide on"){
						divFotos[i].className = "slide off";
							if(i==0){
								divFotos[divFotos.length-1].className = "slide on";
							} else {
								divFotos[i-1].className = "slide on";
							}
								sair = true;
					}
				} 
				if(lado=="pro"){
					if(divFotos[i].className == "slide on"){
						divFotos[i].className = "slide off";
						if(i==divFotos.length-1){
							divFotos[0].className = "slide on";
						} else {
							divFotos[i+1].className = "slide on";
						}
						sair = true;
					}
				}
				i++;					
			}
		}
}

var conta=0
var tempo
function timedCount()
  {
  conta=conta+1
  tempo=setTimeout("util()",7000)
  }
  
function stopCount()
  {
  clearTimeout(tempo)
  }
  
function util() { 
controlaFoto('pro','')
}// ----- Minuto a Minutofunction linkLsb(pSpevId){  var cookie = document.cookie;  var begin = cookie.indexOf('clicRBSv2.prefs');  var uf = '1';  if ( begin > -1 ) {     conteudo = cookie.substring(begin);     var tmp =  conteudo.substring(conteudo.indexOf('uf=')+ 3, conteudo.indexOf('):usuario'));     uf = tmp.substring(tmp.indexOf('(') + 1);  }  var url = "http://minutoaminuto.clicrbs.com.br/lsb/index.jsp?spev="+ pSpevId +"&uf="+ uf;  openModal( url, 750, 509,'lsbce',false );}