var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
function menuTV_DoFSCommand(command, args) {
	var menuTVObj = isInternetExplorer ? document.all.menuTV : document.menuTV;
	var obj = document.getElementById("crosscontent_wrapper");
	obj.style.top = args;
	obj.style.visibility = 'visible';
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub menuTV_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call menuTV_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

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 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 menuRepos(){
	window.document.menuTV.TPlay("/wrapperrepos_mc");
}

function openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}
function sinopse( calendarioId, agendaId ){
	var url="http://www.clicrbs.com.br/rbstv/jsp/default.jsp?template=1550.dwt&uf=1&local=1&rootdir=%2Fshared&source=DYNAMIC%2Crbstv.RBSTvDataServer%2CgetSinopse&calendarioid="+calendarioId+"&agendaid="+agendaId;
    openBrWindow(url,'grade','scrollbars=yes,width=350,height=250');
}
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 doPops(uf,l,tab,tplt){openModal("/jsp/rt.jsp?template="+tplt+"&rootdir=/shared&uf="+uf+"&l="+l+"&tab="+tab,550,565,"POP" ,true);}


 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 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 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 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 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){
 popup=window.open('/jsp/popup.jsp?catgid='+p_cat+'&template='+p_tem+'.dwt', 'PopUP', 'resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=no,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 abrecs1(video,uf){
        window.open("/clicstation/jsp/player_compact_sr.jsp?nomeVideo="+video+"&uf="+uf,"clicStation","width=250,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 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');
}
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');
}
function calendarioF(calendarioId, template, uf, local, site){
	var urlSite = site;
	var pagina = escape(site+"/jsp/default.jsp?nome=calendario&uf="+uf+"&local="+local+"&calendarioid="+calendarioId+"&template="+template);
	document.location.href=site+"/jsp/default.jsp?nome=calendario&uf="+uf+"&local="+local+"&template=1740.dwt&pagina_calendario="+pagina+"&urlSite="+urlSite;
}
