function requeryByCategoryOrGenre(intyGenrId) {
	document.pesquisa.query.value = "";
		if(intyGenrId.indexOf("G") == 0) {
			document.pesquisa.genre.value = intyGenrId.substring(1);
		} else {
			document.pesquisa.category.value = intyGenrId.substring(1);
			document.pesquisa.genre.value = "";
		}
	document.pesquisa.submit();
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function replaceAll( str, from, to ) {
    var idx = str.indexOf( from );
    while ( idx > -1 ) {
        str = str.replace( from, to ); 
        idx = str.indexOf( from );
    }
    return str;
}
function doVoip(ingrId,nome) {
	window.open('http://www.hagah.com.br/jsp/voip_applet.jsp?ingrid='+ingrId+'&nome='+nome,'VoipRBS','width=360,height=550');
}
function abrePlayer(video,uf, opcao){
        window.open("http://www.hagah.com.br/jsp/player_hagah.jsp?nomeVideo=" + video + "&uf=" + uf+"&opcao="+opcao,"hagah","width=250,height=300");
}
function abrecs1(video,uf){
        window.open("/clicstation/jsp/player_compact_sr.jsp?nomeVideo="+video+"&uf="+uf,"clicStation","width=250,height=300");
}
function linkAudio(audio,uf){abrePlayer('audio/'+audio,uf);}
function linkVideo(video,uf,opcao){abrePlayer('video/'+video,uf, opcao);}
function linkEncode(p_video,uf){if(uf==null) uf='RS'; abrecs1(p_video,uf);}
function linkTrailer(nomevideo,iw,ih,uf){
	var theURL, features;
	var w = "379";
	var h = "343";
	theURL="/jsp/hagah_trailers.jsp?nomeVideo="+nomevideo+"&w="+iw+"&h="+ih+"&uf="+uf;
	window.open(theURL,"HagahTrailer","width="+w+",height="+h);
}
function linkFlash(p_width,p_height,p_file,p_author,p_copyright,p_legend){
 var popup=null;

 if(!p_file.elements){
  popup = openModal('http://www.clicrbs.com.br/clicstation/jsp/map.jsp?title=hagah&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 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 popupImg(arquivo, autor, copyright, legenda) {
	var url = "popupFoto.jsp?" +
			  "arquivo=" + arquivo + 
			  "&legenda=" + legenda +
			  "&autor=" + autor +
			  "&copyright=" + copyright;
	var dimensao = "width=550,height=420";
	window.open(url,"Foto_Grande",dimensao);
}
function doChatCapa(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 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?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.hagah.com.br/jsp/default.jsp?uf="+uf+"&local="+local+"&regionId="+regionId+"&template=3088.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');
 	}
}
function addToFavoritesBtn(){window.external.AddFavorite('http://www.hagah.com.br','Hagah');}
function setHomePageBtn(){setHomePage('www.hagah.com.br');}
function addToFavorites(url,vtitle){window.external.AddFavorite(url,vtitle);}
function setHome(){
	if(document.setHome.initial.checked){setHomePage('www.hagah.com.br');}
	if(document.setHome.favorites.checked){addToFavorites('http://www.hagah.com.br','Hagah');}
}
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 linkLsb(pSpevId){
	var url = "http://www.clicrbs.com.br/clicesportes/jsp/lsb.jsp?chanid=2&tab=00003&spevid="+pSpevId;
	window.location = "http://www.clicrbs.com.br/clicesportes/";
	openModal( url, 750, 504,'lsbce',false );
}
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=3136.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);
 }*/
}
var oWindow = null;
function openModal( poUrl, poWidth, poHeight,poWindowName, poScroll ){
var oLeft;
var oTop;
var oAttr;
var 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 IE4 =((navigator.appName.indexOf("Microsoft") > -1)) && (parseInt(navigator.appVersion) == 4);
var IE5 =((navigator.appName.indexOf("Microsoft") > -1)) && (parseInt(navigator.appVersion) == 5);
var anyIE = (IE4 || IE5);
var anyNav = (Nav4 || Nav4plus || Nav5);
var oScroll = true;
	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 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=yes');
}

function prevtemp(region){
	window.open('http://www.clicrbs.com.br/especiais/jsp/popup_tempo_hagah.jsp?loadparam='+ region,'tempov2','scrollbars=no,resizable=no,width=600,height=410'); 
}

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="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" bgcolor="' + $cordefundo + '" menu="false" quality="high" salign="tl" scale="noscale" id="' + $id + '" width="' + $largura + '" height="' + $altura + '"></embed>');
    document.writeln('    </object>');
}




















