function abrecanal(url,uf) {
	top.location.href = "/clicstation/jsp/expanded_sites.jsp?canal="+ url +"&uf="+ uf;
}

function abrecsPorCanal(nCanal,uf,rev){
	top.location.href = "/clicstation/jsp/expanded_sites.jsp?canal="+nCanal+"&uf="+uf+"&rev="+escape(rev);
}
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){
  location.href = "/clicstation/jsp/player_compact_sr.jsp?canal=nenhum&uf="+ uf +"&previousurl=http://www.clicrbs.com.br/";
}

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){
 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;
 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,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 abrecs1(video,uf){
window.open("/clicstation/jsp/player_compact_sr.jsp?nomeVideo="+video+"&uf="+uf,"clicStation","width=250,height=300");
}
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='+p_url, 'PopUP');
     }else{
        popup=window.open('/jsp/popup.jsp?catgid='+p_cat+'&template='+p_tem+'.dwt&p_url='+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 doSubmit(t,n,s,tplt){
 document.formDefault.tab.value=t;
 document.formDefault.newsID.value=n;
 document.formDefault.subTab.value=s;
 if(tplt!=null) document.formDefault.template.value=tplt;
 if(t=="00000"){
  document.formDefault.action="/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=="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=="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=="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="/jogosolimpicos/jsp/default.jsp";
	 document.formDefault.submit();
 }else if(t=="00035"){
  	 document.formDefault.action="/expointer/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 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;
 if(oWindow && oWindow.open)closeModal();
 oWindow=window.open(poUrl,oWindowName,oAttr );
 oWindow.focus();
}
function closeModal(){
 oWindow.close();
 oWindow=null;
}
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  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 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 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=no,width='+p_width+',height='+p_height);}

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();}
  }
}

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 navigate(start){
 document.navigation.start.value = start;
 document.navigation.submit();
}

function popupEnvie(){
//alert(escape(NewsURL));
 var NewsURL = document.URL;
 popup=window.open("http://www.clicrbs.com.br/especiais/jsp/popup_EnvieParaUmAmigo.jsp?url8="+escape(NewsURL), "PopUP", "resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=no,width=430,height=370");
 }			 

 function popupImpressao(){			  
  var NewsURL = document.URL;
  noticia = NewsURL.substring(NewsURL.indexOf('newsID=a')+8,NewsURL.indexOf('.htm',NewsURL.indexOf('newsID=')+7));
  popup=window.open( 'print.jsp?espid='+document.formDefault.espid.value+'&newsID='+noticia , 'PopUP', 'resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes,width=600,height=500');
}

	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 openNews(tab, newsid, subtab, site, espid, uf, local){
//	var uf = "1";
//	var local = "1";
	var canal = tab;
	var materia = newsid;
	var cartola = subtab;
	if (site == " ") site = "http://www.clicrbs.com.br";
	document.location.href=site+"jsp/default.jsp?uf="+uf+"&local="+local+"&tab="+canal+"&newsID="+materia+"&subTab="+cartola+"&espid="+espid+"&uf="+uf+"&local"+local;
}
	
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=570,height=600','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{
		var pagina = "";
		if( p_parameters_site == "&espid=61" ){
			pagina = "http://www.clicrbs.com.br/especiais/jsp/default.jsp?template=3900.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+"&ig=T";
		}
		else{
			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 linkLsb(pSpevId){
  //var url = "http://www.clicrbs.com.br/clicesportes/jsp/lsb.jsp?chanid=2&tab=00003&spevid="+pSpevId;
  var url = "http://minutoaminuto.clicesportes.com.br/lsb/index.jsp?spev="+pSpevId;
  openModal( url, 750, 504,'lsbce',false );
}

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 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/jsp/default_galeria.jsp?template=1552.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');
		}
	}



















