function abrecanal(url,uf) {

	//alert("/clicstation/jsp/expanded_sites.jsp?canal="+ url +"&uf="+ uf +"&eurl=http://www.clicrbs.com.br/cdm/jsp/cdm_errologin.jsp","clicStation","width=492,height=271");

	top.location.href = "/clicstation/jsp/expanded_sites.jsp?canal="+ url +"&uf="+ uf;

}



function linkSmil(smil,uf) {

      window.open("/clicstation/jsp/player_compact_sr.jsp?nomeVideo=http://www.clicrbs.com.br/clicstation/smil/"+smil+"&uf="+uf+"&canal=smil","clicStation","width=250,height=300");	  

}



function abrecsPorCanal(nCanal,uf,rev){

	top.location.href = "/clicstation/jsp/expanded_sites.jsp?canal="+nCanal+"&uf="+uf+"&rev="+rev;

}



function abrecsPorCanal2( nCanal, uf, rev ){

	if( nCanal == "atlantida" || nCanal == "atlantidasc" ){

		top.location.href = "/atlantidafm/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&template=3781.dwt&section=3&rev="+rev;

	}	else if( nCanal == "itapema" || nCanal == "itapemapoa" ){

		top.location.href = "/itapemafm/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&template=3788.dwt&section=101&rev="+rev;	

	} else if( nCanal == "cidade" ){

		top.location.href = "/radios/radiocidade/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&template=3786.dwt&rev="+rev;

	} else if( nCanal == "gaucha" ){

		top.location.href = "/gaucha/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&template=3787.dwt&section=Ao%20Vivo&rev="+rev;

	} else if( nCanal == "planeta" || nCanal == "planetasc" ){

		top.location.href = "/planeta/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&template=3790.dwt&section=3&rev="+rev;

	} else if( nCanal == "rural" ){

		top.location.href = "/radiotv/ruralam/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&template=3791.dwt&rev="+rev;

	}

}



function abrecsPorCanalMC( nCanal, uf, parent ){

	var local = '1';

	if( uf == '2' ) local = '18'; else local = '1';	//define o local, a partir do uf

	if( nCanal == "atlantida" || nCanal == "atlantidasc" ){

		if( nCanal == "atlantida" ){
			window.open("http://mediacenter.clicrbs.com.br/templates/ResultadoBusca.aspx?tipo=categoria&texto=867&channel=114");
			//ANTIGA CHAMADA
			//MM_openBrWindow('http://mediacenter.clicrbs.com.br/templates/ResultadoBusca.aspx?tipo=categoria&texto=867&channel=114','player','scrollbars=no,width=1024,height=768');			

		}else if( nCanal == "atlantidasc" ){
			window.open("http://mediacenter.clicrbs.com.br/templates/ResultadoBusca.aspx?tipo=categoria&texto=867&channel=114");
			//ANTIGA CHAMADA
			//MM_openBrWindow('http://mediacenter.clicrbs.com.br/templates/ResultadoBusca.aspx?tipo=categoria&texto=867&channel=114','player','scrollbars=no,width=800,height=600');			

		}

		//top.location.href = "/atlantidafm/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&local="+local+"&template=3781.dwt&section=3";

	}else if( nCanal == "planeta" || nCanal == "planetasc" ){

		if( nCanal == "planeta" ){

			MM_openBrWindow('http://mediacenter.clicrbs.com.br/live/templates/playerAoVivo.aspx?channel=32&contentId=1186&uf=1','player','scrollbars=no,width=488,height=270');

		}else if( nCanal == "planetasc" ){

			MM_openBrWindow('http://mediacenter.clicrbs.com.br/live/templates/playerAoVivo.aspx?channel=32&contentId=1187&uf=1','player','scrollbars=no,width=488,height=270');

		}

		top.location.href = "/planeta/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&local="+local+"&template=3790.dwt&section=3";		

	}else if( nCanal == "itapema" || nCanal == "itapemapoa" ){

		if( nCanal == "itapemapoa" ){
			window.open("http://mediacenter.clicrbs.com.br/templates/ResultadoBusca.aspx?tipo=categoria&texto=868&channel=114");
			//ANTIGA CHAMADA
			//MM_openBrWindow('http://mediacenter.clicrbs.com.br/templates/ResultadoBusca.aspx?tipo=categoria&texto=868&channel=114','player','scrollbars=no,width=310,height=310');			

		}else if( nCanal == "itapema" ){
			window.open("http://mediacenter.clicrbs.com.br/templates/ResultadoBusca.aspx?tipo=categoria&texto=868&channel=114");
			//ANTIGA CHAMADA
			//MM_openBrWindow('http://mediacenter.clicrbs.com.br/templates/ResultadoBusca.aspx?tipo=categoria&texto=868&channel=114','player','scrollbars=no,width=310,height=310');			

		}

		//top.location.href = "/itapemafm/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&local="+local+"&template=3788.dwt&section=101";

	}else if( nCanal == "gaucha" ){
		//ANTIGA CHAMADA
		//MM_openBrWindow('http://mediacenter.clicrbs.com.br/templates/playerpopup.aspx?midia=20422&tipoVivo=1&channel=115','player','scrollbars=no,width=310,height=310');
		//top.location.href = "/gaucha/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&local="+local+"&section=Ao%20Vivo&template=3787.dwt";
		window.open("http://mediacenter.clicrbs.com.br/templates/player.aspx?uf="+uf+"&contentID=20422&channel=115&tipoVivo=1");	
		
	} else if( nCanal == "cidade" ){

		MM_openBrWindow('http://mediacenter.clicrbs.com.br/templates/playerpopup.aspx?midia=20421&tipoVivo=1&channel=115','player','scrollbars=no,width=310,height=310');

		top.location.href = "/radios/radiocidade/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&local="+local+"&template=3786.dwt";

	} else if( nCanal == "rural" ){

		MM_openBrWindow('http://mediacenter.clicrbs.com.br/templates/playerpopup.aspx?midia=20414&tipoVivo=1&channel=115','player','scrollbars=no,width=310,height=310');

		top.location.href = "/radiotv/ruralam/jsp/default.jsp?canal="+nCanal+"&uf="+uf+"&local="+local+"&template=3791.dwt";

	} else if( nCanal == "canalrural" ){

		MM_openBrWindow('http://mediacenter.clicrbs.com.br/live/templates/playerAoVivo.aspx?channel=32&contentId=1194&uf=1','player','scrollbars=no,width=488,height=270');

	} else if( nCanal == "tvcom" ){

		MM_openBrWindow('http://mediacenter.clicrbs.com.br/live/templates/playerAoVivo.aspx?channel=32&contentId=1303&uf=1','player','scrollbars=no,width=488,height=270');

	} else if( nCanal == "cbn" ){

		MM_openBrWindow('http://mediacenter.clicrbs.com.br/live/templates/playerAoVivo.aspx?channel=32&contentId=1190&uf=1','player','scrollbars=no,width=488,height=270');

	} else{

		MM_openBrWindow('http://mediacenter.clicrbs.com.br/live/templates/playerAoVivo.aspx?channel=32&uf=1','player','scrollbars=no,width=488,height=270');

	}

	if( parent != null ){

		if( parent != '' || parent != "" ){

			top.location.href = parent;

		}

	}

}



function playersr(nomeVideo, uf) { //v2.0

      var theURL ="/clicstation/jsp/player_compact_mode.jsp?nomeVideo=video/"+nomeVideo+"&uf="+uf;

	  var winName ="clicRBS";

	  var features ="scrollbars=no,width=250,height=300";

	  window.open(theURL,winName,features);

}



function canal(nCanal, nUf){ 

 window.open("/clicstation/jsp/player_compact.jsp?canal="+nCanal+"&uf=RS&nomeVideo=http://www.clicrbs.com.br/clicstation/videos/" +nUf+ "/"+nCanal+".smil","clicStation","width=253,height=326"); 

}



function canal2(nCanal, nUf){ 

 window.open("/clicstation/jsp/player_compact_sr.jsp?canal="+nCanal+"&uf=RS&nomeVideo=http://www.clicrbs.com.br/clicstation/videos/" +nUf+ "/"+nCanal+".smil","clicStation","width=250,height=300"); 

}



function abrecs(video,uf){

 //window.open("/clicstation/jsp/player_expanded.jsp?nomeVideo="+video+"&uf="+uf,"clicStation","width=492,height=271");

  location.href = "/clicstation/jsp/player_compact_sr.jsp?canal=nenhum&uf="+ uf +"&previousurl=http://www.clicrbs.com.br/";

}



function abrecs1(video,uf){

        window.open("/clicstation/jsp/player_compact_sr.jsp?nomeVideo="+video+"&uf="+uf,"clicStation","width=250,height=300");

}



function abrecs2(video,uf,nCanal){

 window.open("/clicstation/jsp/player_compact_sr.jsp?canal="+nCanal+"&nomeVideo="+video+"&uf="+uf,"clicStation","width=250,height=300");

}



function linkImagem(p_width,p_height,p_file,p_author,p_copyright,p_legend){

	if (document.URL.indexOf('zerohora') > -1){
		window.open("/rbs/image/"+p_file,"Zerohora","width=580,height=426");
	} else {
		var popup=null;
		popup=openModal("/jsp/rt.jsp?rootdir=/shared&width="+p_width+"&height="+p_height+"&file="+p_file+"&author="+escape(p_author)+"&copyright="+escape(p_copyright)+"&legend="+escape(p_legend)+"&template=24.dwt",p_width+100,p_height+100,"Imagem");
	}

}



function linkImagemNoticia(p_width,p_height,p_file,p_author,p_copyright,p_legend){

	var popup=null;

	if(!p_file.elements){

		popup=openModal("/jsp/rt.jsp?rootdir=/shared&width="+p_width+"&height="+p_height+"&file="+p_file+"&author="+escape(p_author)+"&copyright="+escape(p_copyright)+"&legend="+escape(p_legend)+"&template=24.dwt",p_width+100,p_height+100,"Imagem");

	}else{

		document.joker.p_comp.value=p_file.p_comp.value;

		document.joker.p_width.value=p_file.p_width.value;

		document.joker.p_height.value=p_file.p_height.value;

		document.joker.p_legend.value=p_file.p_legend.value;

		document.joker.p_author.value=p_file.p_author.value;

		document.joker.p_copyright.value=p_file.p_copyright.value;

		document.joker.p_type.value="I";

		var v_width=p_width+60;

		var v_height=p_height+100;

		popup = window.open("/rbs/html/popup.htm","RBS","resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=no,width="+v_width+",height="+v_height);

	}

}



function linkImagemOriginal(p_width,p_height,p_file,p_author,p_copyright,p_legend){

	if(p_width==''){

		p_width=250;

	}

	if(p_height==''){

		p_height=250;

	}

	var popup=null;

	if(!p_file.elements){

		popup=openModal("/jsp/rt.jsp?rootdir=/shared&width="+p_width+"&height="+p_height+"&file="+p_file+"&author="+escape(p_author)+"&copyright="+escape(p_copyright)+"&legend="+escape(p_legend)+"&template=24.dwt",p_width+100,p_height+100,"Imagem");

	}else{

		document.joker.p_comp.value=p_file.p_comp.value;

		document.joker.p_width.value=p_file.p_width.value;

		document.joker.p_height.value=p_file.p_height.value;

		document.joker.p_legend.value=p_file.p_legend.value;

		document.joker.p_author.value=p_file.p_author.value;

		document.joker.p_copyright.value=p_file.p_copyright.value;

		document.joker.p_type.value="I";

		var v_width=p_width+60;

		var v_height=p_height+100;

		popup = window.open("/rbs/html/popup.htm","RBS","resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=no,width="+v_width+",height="+v_height);

	}

}



function linkFlash(p_width,p_height,p_file,p_author,p_copyright,p_legend){

	var popup=null;

	var title_popup = "clicRBS"

	if (document.URL.indexOf('zerohora') > -1) {

		title_popup = "ZERO HORA.com"

	}

	if(!p_file.elements){

		popup = openModal('/clicstation/jsp/map.jsp?pfile=http://www.clicrbs.com.br/flash/'+p_file+'&pwidth='+p_width+'&pheight='+p_height+'&title='+title_popup,p_width,p_height,p_legend);

	}else{

		document.joker.p_comp.value=p_form.p_comp.value;

		document.joker.p_width.value=p_form.p_width.value;

		document.joker.p_height.value=p_form.p_height.value;

		document.joker.p_legend.value=p_form.p_legend.value;

		document.joker.p_author.value=p_form.p_author.value;

		document.joker.p_copyright.value=p_form.p_copyright.value;

		document.joker.p_type.value="F";

		var v_width=p_width+60;

		var v_heigh=p_height+100;

		popup=window.open("/rbs/html/popup.htm","RBS","resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=no,width="+v_width+",height="+v_height);

	}

}



function linkTrailer(nomevideo56,w56,h56,uf){

	var theURL, features;

	iw56=parseInt(w56);

	ih56=parseInt(h56);

	if (iw56<=347){iw56=348;}

	if (ih56<=359){ih56=360;}

	theURL="/clicstation/jsp/clicstation_trailers.jsp?strNomevideo56="+nomevideo56+"&w56="+iw56+"&h56="+ih56+"&struf="+uf;

	window.open(theURL,"ClicStationTreiler","width="+iw56+",height="+ih56);

}



function linkAudio(p_audio,uf){abrecs1('audio/'+p_audio,uf);}



function linkVideo(p_video,uf){abrecs1('video/'+p_video,uf);}



function linkEncode(p_video,uf){if(uf==null) uf='RS'; abrecs1(p_video,uf);}



function linkPopup(p_cat,p_tem,p_width,p_height,p_url){

	 if (p_width==0 && p_height==0){

        popup=window.open('/jsp/popup.jsp?catgid='+p_cat+'&template='+p_tem+'.dwt&p_url='+escape(p_url), 'PopUP');

     }else{

        popup=window.open('/jsp/popup.jsp?catgid='+p_cat+'&template='+p_tem+'.dwt&p_url='+escape(p_url), 'PopUP', 'resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes,width='+p_width+',height='+p_height);

	}

}



function linkPdf(p_arq,p_width,p_height){

	popup=window.open('/pdf/'+p_arq, 'Pdf', 'resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=no,width='+p_width+',height='+p_height); 

}



function doParceiro(domain,gif,color,dir){

	document.formParceiro.DOMAIN.value=domain;

	document.formParceiro.GIF.value=gif;

	document.formParceiro.COLOR.value=color;

	document.formParceiro.DIR.value=dir;

	document.formParceiro.submit();

}



function doInvest(domain){

	document.formInvest.DOMAIN.value = domain;

	document.formInvest.submit();

}



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/zerohora/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="/olimpiada2004/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.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 doRegiao(p_uf,p_tab,p_nid,p_subtab){

	document.formDefault.uf.value=p_uf;

	if(p_uf=='1')document.formDefault.local.value='1';

	else document.formDefault.local.value='18';

	doSubmit(p_tab,p_nid,p_subtab);

}



function linkRelacionadas(p_tab,p_fsname,p_subtab){

	if(p_tab!=null & p_fsname!=null){doSubmit(p_tab,p_fsname,p_subtab);}

	else{doSubmit('inc/ultimas_detalhe.jsp','html/'+p_tab,'200');}

}



function changeColumn(columnId){

	if(columnId!=''){

		document.formDefault.newsID.value='a'+columnId+'.htm';

		document.formDefault.submit();

	}

}



var oWindow = null;



function openModal(poUrl,poWidth,poHeight,poWindowName,poScroll){

	var oLeft,oTop,oAttr,oWindowName;

	var Nav4=((navigator.appName=="Netscape") && (parseInt(navigator.appVersion)==4));

	var Nav4plus=((navigator.appName=="Netscape") && (parseFloat(navigator.appVersion)>4.04));

	var Nav5=((navigator.appName=="Netscape") && (parseInt(navigator.appVersion)==5));

	var Nav6=((navigator.appName=="Netscape") && (parseInt(navigator.appVersion)==6));

	var IE4=((navigator.appName.indexOf("Microsoft")>-1)) && (parseInt(navigator.appVersion)==4);

	var IE5=((navigator.appName.indexOf("Microsoft")>-1)) && (parseInt(navigator.appVersion)==5);

	var IE6=((navigator.appName.indexOf("Microsoft")>-1)) && (parseInt(navigator.appVersion)==6);

	var anyIE=(IE4||IE5||IE6);

	var anyNav=(Nav4||Nav4plus||Nav5||Nav6);

	var oScroll=false;

	if(poScroll!= null) oScroll=poScroll;

	if(Nav4){

		oLeft=window.screenX+((window.outerWidth-poWidth)/2);

		oTop=window.screenY+((window.outerHeight-poHeight)/2);

		oAttr="screenX="+oLeft+",screenY="+oTop+",location=no,toolbar=no,directories=no,status=no,resizable=no,dependent=yes,width="+poWidth+",height="+poHeight;

	}else{

		oLeft=(screen.width-poWidth)/2;

		oTop=(screen.height-poHeight)/2;			

		oAttr="left="+oLeft+",top="+oTop+",location=no,toolbar=no,directories=no,status=no,resizable=no,width="+poWidth+",height="+poHeight;

	}

	if(oScroll)oAttr+=",scrollbars=yes"

	if(poWindowName==null)oWindowName="modal";

	else oWindowName=poWindowName;
	
	oWindowName = ajustaStr(oWindowName)

	try { //para resolver bug no FF3
		if( oWindow && oWindow.open ) closeModal();
	} catch (e){}

	oWindow=window.open(poUrl,oWindowName,oAttr );

	oWindow.focus();

}



function closeModal(){

	oWindow.close();

	oWindow=null;

}


function ajustaStr(str){
		var arrCharTrocar = new Array(/ /g);
		var arrCharResult = new Array("_");
		var aux = 0;
		str = str.toLowerCase();
		for (var i in arrCharTrocar){
			if (i == 0) aux = 0; //espaço
			str = str.replace(arrCharTrocar[i], arrCharResult[aux]);
		}
		return str;
	}


function doSearch(p_template,p_query,p_order,p_esq,p_tab){

	if(document.formQuery1.searchstring.value.length>0 && document.formQuery1.chanid[document.formQuery1.chanid.selectedIndex].text.indexOf("Selecione") < 0  ){

		doQuery(p_template,p_query,p_order,p_esq,document.formQuery1.chanid[document.formQuery1.chanid.selectedIndex].value,p_tab);

	}else if (document.formQuery1.chanid.selectedIndex==null || document.formQuery1.chanid[document.formQuery1.chanid.selectedIndex].value.indexOf("Selecione") < 0){

		alert("Selecione um dos canais.");

	}else{

		alert("Digite o texto a ser pesquisado.");

	}

	document.formQuery1.searchstring.focus();

}



function doAdvancedSearch(uf,l,tab,tplt){openModal("/jsp/rt.jsp?template=27.dwt&rootdir=/shared&uf="+uf+"&l="+l+"&tab="+tab+"&resulttplt="+tplt,530,480,"avancada");}



function doPops(uf,l,tab,tplt){openModal("/jsp/rt.jsp?template="+tplt+"&rootdir=/shared&uf="+uf+"&l="+l+"&tab="+tab,550,565,"POP" ,true);}



function doPopsPpf(uf,l,tab,tplt){openModal("http://www.clicrbs.com.br/jsp/rt.jsp?template="+tplt+"&rootdir=/shared&uf="+uf+"&l="+l+"&tab="+tab,550,565,"POP" ,true);}



function doFale(uf,l,tab,tplt){openModal("/jsp/rt.jsp?template="+tplt+"&rootdir=/shared&uf="+uf+"&l="+l+"&tab="+tab,570,570,"POP" ,true);}



function doFaq(uf,l,tab,tplt){openModal("/jsp/rt.jsp?template="+tplt+"&rootdir=/shared&uf="+uf+"&l="+l+"&tab="+tab,550,500,"FAQ" ,true);}



function doFaqPpf(uf,l,tab,tplt){openModal("http://www.clicrbs.com.br/jsp/rt.jsp?template="+tplt+"&rootdir=/shared&uf="+uf+"&l="+l+"&tab="+tab,550,500,"FAQ" ,true);}



function doPrint(newsId,chanID){openModal("/jsp/print.jsp?newsID="+newsId+"&chanID="+chanID+"&tab=00000",565,500,"PRINT",true);}



function doFriend(){openModal("/jsp/send_friend.jsp?url="+escape(document.location),550,350,"FRIEND",true);}



function doQuery(p_template,p_query,p_order,p_esq,p_channel,p_tab){

	document.formQuery1.newsID.value=p_query;

	document.formQuery1.template.value=p_template;

	document.formQuery1.source.value=p_query;

	document.formQuery1.order.value=p_order;

	document.formQuery1.l.value=p_esq;

	document.formQuery1.chanid.value=p_channel;

	if(p_tab!=null){document.formQuery1.tab.value=p_tab;}

	document.formQuery1.submit();

}



function MM_preloadImages(){

	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_swapimgRestore(){

	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_findObj(n, d){

	var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length) {

	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

	if(!x && document.getElementById) x=document.getElementById(n); return x;

}



function MM_swapImage(){

	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

	if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}



function OpenPopup(p_url,p_window,p_width,p_height){window.open(p_url,p_window,'resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes,width='+p_width+',height='+p_height);}



function doParceiroInd(comp){

	var ind=comp.selectedIndex;  

	if(ind==0){

		var f='';

	}else{

		var valuetosplit=comp.options[ind].value; 

		var domain = getSplit(valuetosplit,",",0);

		var gif = getSplit(valuetosplit,",",1);

		var color = getSplit(valuetosplit,",",2);

		var dir = getSplit(valuetosplit,",",3);

        //alert(dir);

        if (dir != "'atlantidafm'"){

			doParceiro(domain.substring(1,domain.length-1),gif.substring(1,gif.length-1),color.substring(1,color.length-1),dir.substring(1,dir.length-1));

        }else{

			doInvest(domain.substring(1,domain.length-1),gif.substring(1,gif.length-1),color.substring(1,color.length-1),dir.substring(1,dir.length-1));

        }

	}

}



function getSplit(poTokenized,poDelimiter,poPosition){

	var oTokens=new Array(4);

	var i = 0;

	var oTokenized = poTokenized;

	while( oTokenized.length > 0 ){

		var oToken = null;

		if( oTokenized.indexOf(poDelimiter) != -1 ){

			oToken = oTokenized.substring(0,oTokenized.indexOf(poDelimiter));

			oTokenized = oTokenized.substring(oTokenized.indexOf(poDelimiter)+1);

		}else{

			oToken = oTokenized;

			oTokenized = "";

		}

		oTokens[i] = oToken;

		i++;

	}

	return oTokens[poPosition];

}



function open_chat(){

	var user=document.chat.user.value;

	var screen=document.chat.screen.value;

	var room=document.chat.room.options[document.chat.room.selectedIndex].value;

	var chatter=document.chat.chatter.value;

	user=escape(user);

	var URL ="http://clicpapo.clicrbs.com.br/cgi-bin/inchat/inchat.pl?login=1&user="+user+"&screen="+screen+"&room="+room+"&chatter="+chatter;

	window.open(URL,"OpenInchat","width=710,height=525,top=0,left=0");

	return false;

}



function doChat(){

	if(document.chat.user.value.length==0){

		alert("Por favor, informe o seu apelido.");

	}else{

		if(document.chat.room.options[document.chat.room.selectedIndex].value==''){

			alert("Por favor, escolha uma sala.");

		}else{

			open_chat();

		}

	}

}



// JS novas para o novo layout de capa do clicRBS (alteração de checkbox para button)

function addToFavoritesBtn(){window.external.AddFavorite('http://www.clicrbs.com.br','clicRBS');}



function setHomePageBtn(){setHomePage('www.clicrbs.com.br');}



//Fim



function addToFavorites(url,vtitle){window.external.AddFavorite(url,vtitle);}



function setHome(){

	if(document.setHome.initial.checked){setHomePage('www.clicrbs.com.br');}

	if(document.setHome.favorites.checked){addToFavorites('http://www.clicrbs.com.br','clicRBS');}

}



function setHomePage(url){

	if(document.all && document.getElementById){

		if(!oHomePage.isHomePage(url)){

			oHomePage.setHomePage(url);

			var a=oHomePage.isHomePage(url)

			if(!oHomePage.isHomePage(url))return false;

		}

	}else

		if(document.layers && navigator.javaEnabled()){

			if(!confirm("Deseja fazer o clic sua Página Inicial"))return false;

			netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesWrite');

			navigator.preference('browser.startup.homepage',url);

		}

		return false;

}



function linkEnquete(p_survey_id, p_user_id){

	janela_enquete = window.open("http://www.clicrbs.com.br/servlet/SRServlet.SRSessionServlet?SURVEY_ID="+p_survey_id+"&USER_ID="+p_user_id+"&SHOW_FORM=T","janela_enquete","toolbar=no,menubar=no,resizable=yes,scrollbars=yes,width=400,height=300");

}



function doChatCapa(room_id) {

	if (room_id != null)

	window.open('/jsp/popup_ingresso_chat.jsp?room='+room_id, 'ingresso', 'toolbar=no,menubar=no,resizable=no,scrollbars=no,width=250,height=200');

}





function MM_openBrWindow(theURL,winName,features) { //v2.0

	window.open(theURL,winName,features);

}



function popupFormArq(title,mailTo){

	var url = "http://www.clicrbs.com.br/formulario/jsp/pop_formulario_arq.jsp?titulo=" + title + "&emailAlvo=" + mailTo; 

	window.open(url,'popup','width=590,height=540,scrollbars=1');

}

function popupFormPainel(title,mailTo){

	var url = "http://www.clicrbs.com.br/formulario/jsp/pop_formulario_painel.jsp?titulo=" + title + "&emailAlvo=" + mailTo; 

	window.open(url,'popup','width=590,height=540,scrollbars=1');

}

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{

		if (p_path == 'especiais') 

			p_path='clicnoticias/';

		else

			p_path=p_path+'/';

		var pagina = "http://www.clicrbs.com.br/"+p_path+"jsp/default.jsp?template=1552.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);

		MM_openBrWindow(pagina,'Galeria','scrollbars=no,menubar=no,status=no,width=730,height=538');

 	}

}



function popupFormMsg(title,mailTo){

	var url = "http://www.clicrbs.com.br/formulario/jsp/pop_formulario_msg.jsp?titulo=" + title + "&emailAlvo=" + mailTo; 

	window.open(url,'popup','width=590,height=540,scrollbars=1');

}



function popupFormBinoculo(title,mailTo){

  var url = "http://www.clicrbs.com.br/formulario/jsp/pop_formulario_binoculo.jsp?titulo=" + title + "&emailAlvo=" + mailTo; 

  window.open(url,'popup','width=590,height=540,scrollbars=1');

}



function canal3(nCanal, nUf){ 

	window.open("/clicstation/jsp/player_compact.jsp?canal="+nCanal+"&uf=RS&nomeVideo=http://play.rbsonline.com.br/hurl.html%3fpath%3dclicstation/"+nCanal+"%26file%3d"+nCanal+".smil","clicStation","width=253,height=326"); 

}



function targetblank(domain){

	window.open("http://" + domain);

}



function linkGaleria (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=1552.dwt&ids=null&initial=null&playsshow=false&b=1&arquivo_xml=galeria_"+p_gallery_id+"_"+p_group_id+".xml"+p_parameters_site;

		//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');

	}

}



// ---------- Rank de Notícias

try {

	var e = document.createElement("script");

	e.src = "http://www.clicrbs.com.br/js/notifyReadNews.js";

	e.type="text/javascript";

	document.getElementsByTagName("head")[0].appendChild(e);

} catch(e) {

}



function popupFormCredem(title,mailTo){

	var url = "http://www.clicrbs.com.br/formulario/jsp/pop_formulario_creden_imprensa.jsp?titulo=" + title + "&emailAlvo=" + mailTo; 

	window.open(url,'popup','width=590,height=540,scrollbars=1');

}





function popupFormArqNew(title,mailTo){

	var url = "http://www.clicrbs.com.br/formulario/jsp/pop_formulario_arq2.jsp?titulo=" + title + "&emailAlvo=" + mailTo; 

	window.open(url,'popup','width=590,height=540,scrollbars=1');

}



// FUNCAO PARA ENQUETE CAPA 

function doVoteECapa(w,h,enqueteid,groupid,groupnome,produto,template_popup_votacao,template_popup_resultado,espid){
	if ( espid != undefined ) {
		MM_openBrWindow("http://www.clicrbs.com.br/jsp/seleciona_enquete.jsp?enquete_id="+enqueteid+"&grupo_id="+groupid+"&grupo_nome="+groupnome+"&produto="+produto+"&tpr="+template_popup_resultado+"&tpv="+template_popup_votacao+"&espid="+espid,"clicRBS","scrollbars=yes,width="+w+",height="+h+"");
	} else {
		MM_openBrWindow("http://www.clicrbs.com.br/jsp/seleciona_enquete.jsp?enquete_id="+enqueteid+"&grupo_id="+groupid+"&grupo_nome="+groupnome+"&produto="+produto+"&tpr="+template_popup_resultado+"&tpv="+template_popup_votacao,"clicRBS","scrollbars=yes,width="+w+",height="+h+"");
	}
}

function doVoteECapaXSL(w,h,enqueteid,groupid,groupnome,produto,espid,secaoid){
	if ( espid != undefined ) {
		MM_openBrWindow("http://www.clicrbs.com.br/jsp/selecionaEnqueteXSL.jsp?enquete_id="+enqueteid+"&grupo_id="+groupid+"&grupo_nome="+groupnome+"&produto="+produto+"&espid="+espid+"&secaoid="+secaoid,"clicRBS","scrollbars=yes,width="+w+",height="+h+"");
	} else {
		MM_openBrWindow("http://www.clicrbs.com.br/jsp/selecionaEnqueteXSL.jsp?enquete_id="+enqueteid+"&grupo_id="+groupid+"&grupo_nome="+groupnome+"&produto="+produto,"clicRBS","scrollbars=yes,width="+w+",height="+h+"");
	}
}

// DADOS PARA ENQUETE 

var produto = "clicrbs";

var template_popup_resultado = "3428.dwt";

var template_popup_votacao = "3427.dwt"                                                                                           

// FUNCAO PARA ENQUETE FECHADA - CAPA 



function doVoteEF(enqueteid,groupid,groupnome){

	MM_openBrWindow("http://www.clicrbs.com.br/jsp/seleciona_enquete.jsp?enquete_id="+enqueteid+"&grupo_id="+groupid+"&grupo_nome="+groupnome+"&produto="+produto+"&tpr="+template_popup_resultado+"&tpv="+template_popup_votacao,"clicRBS","scrollbars=yes,width=277,height=296");

}



function doResultEF(enqueteid,groupid,groupnome){

	MM_openBrWindow("http://www.clicrbs.com.br/jsp/interatividade.jsp?newsID=DYNAMIC%2Citools.xml.ItoolsDelivery3%2CgetEnqueteXml&groupid="+groupid+"&enqueteid="+enqueteid+"&b=1&template="+template_popup_resultado+"&grupoOAS="+groupnome+"&interatividadeOAS=enquete","clicrbs","scrollbars=yes,width=277,height=296");

}



// FUNCAO PARA ENQUETE ABERTA - CAPA 

function doVoteEA(enqueteid,groupid,groupnome){

	radio = eval("document.enquete"+enqueteid);

	var achou = false;

	for (i = 0; i < (radio.resposta.length); i++) {

		if (radio.resposta[i].checked) {

			res = radio.resposta[i].value;

			achou = true;

			break;

		}

	}

	if (achou == true) {

		MM_openBrWindow("http://www.clicrbs.com.br/jsp/seleciona_enquete.jsp?enquete_id="+enqueteid+"&resposta_id="+res+"&grupo_id="+groupid+"&grupo_nome="+groupnome+"&produto="+produto+"&tpr="+template_popup_resultado+"&tpv="+template_popup_votacao,"clicrbs","scrollbars=yes,width=277,height=296");

	}else {

		alert("Você deve escolher uma opção.");

	}

}



// FUNCAO PARA ENQUETE - POPUP 

function doVotePopup(enqueteid,codigo){

	var achou = false;

	radio = eval("document.enquete"+enqueteid);

	for (i = 0; i < (radio.resposta.length); i++) {

		if (radio.resposta[i].checked) {

			resposta = radio.resposta[i].value;

			achou = true;

			break;

		}

	}

	if (achou == true) {

		if ( ( (codigo != null) && (codigo == "true") ) && ( radio.palavra2.value == "" ) ) {			

				alert("Você deve digitar o código de validação.");		

		} else {	

			radio.resposta_id.value = resposta;

			radio.url.value = document.URL;

			radio.submit();		

		}		

	}else {	

		alert("Você deve escolher uma opção.");		

	}

}



//  FUNCAO PARA VOTACAO - CAPA 

function doVoteVotacao(url){

	document.location.href="http://www.clicrbs.com.br/cdm/jsp/cdm_login.jsp?url="+escape(url);

}



// FUNCAO PARA VOTACAO - ABERTA 

function doVoteV(votacaoid,codigo){

	var achou = false;

	radio = eval("document.votacao"+votacaoid);

	for (i = 0; i < (radio.resposta.length); i++) {

		if (radio.resposta[i].checked) {

			resposta = radio.resposta[i].value;

			achou = true;

			break;

		}

	}

	if (achou == true) {

		if ( ( (codigo != null) && (codigo == "true") ) && ( radio.palavra2.value == "" ) ) {			

				alert("Você deve digitar o código de validação.");		

		} else {	

			radio.resposta_id.value = resposta;

			radio.url.value = document.URL;

			radio.submit();		

		}		

	}else {	

		alert("Você deve escolher uma opção.");		

	}

}



// FUNCAO PARA ATIVAR BANNERS OAS

// ANTIGA
function chamaFlashOas($arquivo,$altura,$largura,$id){
    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>');
}

// NOVA
function chamaBannerOas($arquivo,$largura,$altura,$wmode,$cordefundo,$id){
    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="allowScriptAccess" value="always">');
    document.writeln('        <param name="bgcolor" value="' + $cordefundo + '" />');
    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="' + $wmode + '" />');
    document.writeln('        <embed id="globalnav-embed" src="' + $arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="' + $wmode + '" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl"  allowScriptAccess="always" bgcolor="' + $cordefundo + '" menu="false" quality="high" salign="tl" scale="noscale" id="' + $id + '" width="' + $largura + '" height="' + $altura + '"></embed>');
    document.writeln('    </object>');
}


function openNews(tab, newsid, subtab, site, especial){
	var pag = "";
	var uf = "1";
	var local = "1";
	var canal = tab;
	var materia = newsid;
	var cartola = subtab;

	if (canal == " "){
		canal = '00001';
	}
	
	if (site == "") site = "http://www.clicrbs.com.br";
		pag=site+"/jsp/default.jsp?uf="+uf+"&local="+local+"&tab="+canal+"&newsID="+materia+"&subTab="+cartola;
	
	if (especial != ""){
		pag = pag + "&espid="+especial;
	}
	
	document.location.href= pag;
}

function linkLsb(pSpevId){
	var url = "http://minutoaminuto.clicrbs.com.br/lsb/jsp/index.jsp?spev="+pSpevId;
	openModal( url, 750, 530,'lsbce',false );
}