function mOvr(src,clrOver) { 
 if (!src.contains(event.fromElement)) { 
 	src.style.cursor = 'hand'; src.bgColor = clrOver; 
 	}
 }

function mOut(src,clrIn) { 
 if (!src.contains(event.toElement)) { 
 	src.style.cursor = 'default'; src.bgColor = clrIn; 
 	}
 } 

function mClk(src) { 
  if(event.srcElement.tagName=='TD') {
	src.children.tags('A')[0].click();
        }
 }

function MM_preloadImages() { //v3.0
  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() { //v3.0
  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) { //v3.0
  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); return x;
}

function MM_swapImage() { //v3.0
  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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function doLink(channel, source, section, template,menu)
{
// window.location.href= '/jornais/dsm/jsp/default.jsp?channel='+channel+'&source='+source+ 	'&template='+template+'&edition='+document.frmEd.hedition.value+'&section='+section;
// window.location.href= '/jsp/jornais/verarticle1.jsp?channel='+channel+'&source='+source+ 	'&template='+template+'&edition='+document.frmEd.hedition.value+'&section='+section;	
document.frmEd.channel.value = '9';
document.frmEd.source.value = source;
document.frmEd.section.value = section;
document.frmEd.template.value = template;
document.frmEd.content.value = '';
document.frmEd.start.value = '1';
document.frmEd.titanterior.value = '';
if (menu != null) document.frmEd.menu.value = menu;
else document.frmEd.menu.value = '23';
document.frmEd.submit();
if (section == 'Home') {
	window.location.href = 'default.jsp?section='+section + '&channel='+		channel+'&edition='+document.frmEd.edition.value;
}
		
}

function doLink2(channel, source, section, supplement, template)
{
// window.location.href= '/jornais/dsm/jsp/default.jsp?channel='+channel+'&source='+source+ 	'&template='+template+'&edition='+document.frmEd.hedition.value+'&section='+section;
// window.location.href= '/jsp/jornais/verarticle1.jsp?channel='+channel+'&source='+source+ 	'&template='+template+'&edition='+document.frmEd.hedition.value+'&section='+section;	
document.frmEd.channel.value = channel;
document.frmEd.source.value = source;
if (supplement == 'Primeiro Caderno')
	document.frmEd.section.value = section;
else
	document.frmEd.section.value = supplement;
document.frmEd.template.value = template;
document.frmEd.content.value = '';
document.frmEd.start.value = '1';
document.frmEd.titanterior.value = '';
if (document.frmEd.menu.value.length == 0) document.frmEd.menu.value = '23';
document.frmEd.submit();	
}

function doNews(source,section,supplement,menu)
{
if (section != 'Colunas e Charges')
	document.frmEd.source.value = 'Busca,'+source;
else
	document.frmEd.source.value = source;	

if (supplement == 'Primeiro Caderno')
	document.frmEd.section.value = section;
else
	document.frmEd.section.value = supplement;
document.frmEd.template.value = '';
document.frmEd.start.value = '1';
document.frmEd.content.value = '';
document.frmEd.menu.value = menu;
if (menu == null) {
	if (supplement == 'Segundo Caderno') document.frmEd.menu.value = '22';
	else if (supplement == 'Vestibular') document.frmEd.menu.value = '24';
	else if (supplement == 'Revista ZH Donna' || supplement == 'Donna ZH') document.frmEd.menu.value = '19';
	else if (supplement == 'ZH Digital') document.frmEd.menu.value = '20';
	else if (supplement == 'Campo e Lavoura') document.frmEd.menu.value = '25';
	else if (supplement == 'Vida') document.frmEd.menu.value = '21';
	else if (supplement == 'Cultura') document.frmEd.menu.value = '26';
	else if (supplement == 'Sobre Rodas') document.frmEd.menu.value = '28';
	else if (supplement == 'Casa & Cia') document.frmEd.menu.value = '31';
	else if (supplement == 'Viagem') document.frmEd.menu.value = '32';
	else if (supplement == 'Eureka!') document.frmEd.menu.value = '33';
	else if (supplement == 'TV+Show') document.frmEd.menu.value = '34';
	else if (supplement == 'ZH Escola') document.frmEd.menu.value = '35';
	else if (supplement == 'ZH Comunidade') document.frmEd.menu.value = '40';	
	else if (supplement == 'Ambiente') document.frmEd.menu.value = '68';		
	else if (supplement == 'Patrola') document.frmEd.menu.value = '73';
	else document.frmEd.menu.value = '23';
}
document.frmEd.submit();
}

function doSectionCad(source,section,menu)
{
document.frmEd.source.value = source;
document.frmEd.section.value = section;
document.frmEd.template.value = '';
document.frmEd.menu.value = menu;
document.frmEd.start.value = '1';
document.frmEd.content.value = '';
document.frmEd.submit();
}

function doAnteriores(oid,template,start,titanterior)
{
 document.frmEd.id.value = oid;
 document.frmEd.source.value = 'DYNAMIC,oracle.br.dataservers.NewspaperDataServerv2,getOldColumnsByTheme';
 //document.frmEd.section.value = 'Colunas e Charges';
 document.frmEd.template.value = template;
 document.frmEd.start.value = start;
 document.frmEd.titanterior.value = titanterior;
 document.frmEd.content.value = '';
 document.frmEd.submit();
}

function doPDFColAnteriores(oid,template,start,titanterior)
{
 document.frmEd.id.value = oid;
 document.frmEd.source.value = 'DYNAMIC,oracle.br.dataservers.NewspaperDataServerv2,getOldColumnsPDF';
 //document.frmEd.section.value = 'Colunas e Charges';
 document.frmEd.template.value = template;
 document.frmEd.start.value = start;
 document.frmEd.titanterior.value = titanterior;
 document.frmEd.content.value = '';
 document.frmEd.submit();
}


function doChargeAnteriores(oid,template,start,titanterior)
{
 document.frmEd.id.value = oid;
 document.frmEd.source.value = 'DYNAMIC,oracle.br.dataservers.ChargeDataServer,getOldCharges';
 document.frmEd.section.value = 'Colunas e Charges';
 document.frmEd.template.value = template;
 document.frmEd.start.value = start;
 document.frmEd.titanterior.value = titanterior;
 document.frmEd.content.value = '';
 document.frmEd.submit();
}

function doSubmit(channel, id, tab)
{

if (channel=="00002") {
	window.location.href = "/clicnoticias/jsp/default.jsp?tab="+channel+"&newsID="+id+"&subTab="+tab+"&l=&template=";
} else if (channel=="00003") {
	window.location.href = "/clicesportes/jsp/default.jsp?tab="+channel+"&newsID="+id+"&subTab="+tab+"&l=&template=";
} else if (channel=="00004") {
	window.location.href = " /clicnessa/jsp/default.jsp?menu=inc%2Fultimas_detalhe.jsp&conteudo=jsp%2Fultimas_detalhe.jsp&ctrl=0&evento="+id;
} else if ( (channel=="00009") || (channel=="00010") ) {
	document.frmEd.source.value = id.substring(0,id.indexOf("."))+".xml";
	document.frmEd.template.value = '';
	document.frmEd.start.value = '1';
	document.frmEd.content.value = '';
	document.frmEd.section.value = '';
	document.frmEd.submit();
 }
}

function doEdition(edition)
{
 document.frmEd.edition.value = edition;
 document.frmEd.section.value = 'Home';
 document.frmEd.source.value = 'ind';
 document.frmEd.template.value = '502.dwt';
 document.frmEd.start.value = '1';
 document.frmEd.content.value = '';
 document.frmEd.submit();
}

function doEditAnteriores(template)
{
 document.frmEd.edition.evalue = '';
 document.frmEd.section.value = 'Anteriores';
 document.frmEd.template.value = template;
 document.frmEd.source.value = 'DYNAMIC,oracle.br.dataservers.NewspaperDataServerv2,getOldEditions';
 document.frmEd.start.value = '1';
 document.frmEd.content.value = '';
 document.frmEd.submit();
}

function doBusca(palavra,template)
{
 document.frmEd.template.value = template;
 document.frmEd.source.value = 'DYNAMIC,oracle.br.dataservers.NewspaperDataServerv2,searchNewspaper';
 document.frmEd.start.value = '1';
 document.frmEd.section.value = '';
 while (palavra.indexOf("%") > -1)
 	palavra = palavra.substring(0,palavra.indexOf("%")) + palavra.substring(palavra.indexOf("%")+1)
 document.frmEd.content.value = palavra;
 document.frmEd.submit();
}

function doBuscaAvancada(palavra,template,themid,sectid,suppid,fromdate,todate)
{
 document.frmEd.template.value = template;
 document.frmEd.source.value = 'DYNAMIC,oracle.br.dataservers.NewspaperDataServerv2,advancedSearchNewspaper';
 document.frmEd.start.value = '1';
 document.frmEd.section.value = 'Busca';
 document.frmEd.content.value = palavra;

 document.frmEd.themeid.value = themid;
 document.frmEd.sectionid.value = sectid;
 document.frmEd.suppid.value = suppid;
 document.frmEd.fromdate.value = fromdate;
 document.frmEd.todate.value = todate;
  
 document.frmEd.submit();
}

function doCaderno(channel, menu, section, template)
{
document.frmEd.channel.value = channel;
document.frmEd.source.value = 'ind';
document.frmEd.menu.value = menu;
document.frmEd.section.value = section;
document.frmEd.template.value = template;
document.frmEd.content.value = '';
document.frmEd.start.value = '1';
document.frmEd.titanterior.value = '';
document.frmEd.submit();
}

function doTela(template)
{
document.frmEd.source.value = 'capa.xml';
document.frmEd.section.value = 'Busca';
document.frmEd.template.value = template;
document.frmEd.content.value = '';
document.frmEd.start.value = '1';
document.frmEd.titanterior.value = '';
document.frmEd.submit();	
}

function doInteratividade(tooltype,template,section)
{
	window.location.href = '/jornais/zerohora/jsp/default.jsp?section='+section + '&channel='+
		document.frmEd.channel.value+'&source=DYNAMIC,itools.xml.ItoolsDelivery2,getCentralXml&itooltype='+tooltype+
		'&order=null&mnit=4&template='+template;
}

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 setInicial(oThis){
if(document.all && document.getElementById){
	oThis.style.behavior='url(#default#homepage)';
	oThis.setHomePage('www.clicrbs.com.br/jornais/zerohora/jsp/default.jsp');}
else{
	alert("Desculpe, somente  o browser Internet Explorer 5.0 ou superior suporta esta função.");}
}

/* Função alterada para os jornais */
function linkFotoColuna(p_file){
	openModal("/jornais/zerohora/jsp/montafotocoluna.jsp?width=400&height=450&file="+p_file,500,550,"Fotos",1);
}

function linkFotoVerissimo(p_file){
	openModal("/jornais/zerohora/jsp/montafotocoluna.jsp?width=700&height=540&file="+p_file,720,540,"Charge",1);
}

function linkConexao(p_file){
	openModal("/jornais/zerohora/jsp/montarsvip_importa.jsp?width=400&height=450&file="+p_file,500,550,"Fotos",1);
}

function doInvest(domain,logo,dir){
   window.location.href= "http://" + domain;
}

function doSSL(domain){
window.location.href= "https://" + domain;
}

function doClicpapo(){
window.location.href= "http://www.clicrbs.com.br/jsp/index_clicpapo.jsp";
}

function doClassif(domain,logo,color,dir){
window.location.href= "http://www.clicrbs.com.br/jsp/parceiro.jsp?uf=1&local=1&DOMAIN="+ domain + "&GIF="+ logo + "&COLOR="+ color + "&DIR="+ dir;
}

function checkIt(e) {
	var charCode = e.keyCode
	if (charCode == 13) {
		 doBusca(document.frmBusca.palavra.value,'576.dwt');
	 	 return(frmBusca.palavra.value);	
    }		
}

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');
}
