// JavaScript Document
var nome_campo='';
var origem='';
var MenuBar1 = '';
var MenuBar2 = '';
var complemento = '';
var alternate=0
var segmento='';
ar_segmento = new Array(3);
ar_segmento[21] = 'geracao';
ar_segmento[22] = 'distribuicao';
ar_segmento[23] = 'motor';
ar_segmento[24] = 'eletrica';

//set player version here
var MM_contentVersion = 6;

//set sub version here
var release = "6,0,67,0";


//check for flash player
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
      var words = navigator.plugins["Shockwave Flash"].description.split(" ");
       for (var i = 0; i < words.length; ++i)
       {
      if (isNaN(parseInt(words[i])))
      continue;
      var MM_PluginVersion = words[i];
       }
   var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
   && (navigator.appVersion.indexOf("Win") != -1)) {
   document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
   document.write('on error resume next \n');
   document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
   document.write('</SCR' + 'IPT\> \n');
}

function writeFlash(swf,flashVarString,w,h,bgcolor,menu,mode,q,id){
if ( MM_FlashCanPlay ) {
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
+'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+release+'" '
+'width="'+w+'" height="'+h+'" id="'+id+'" align="">'
+'<param name="movie" value="'+swf+'">'
+'<param name="menu" value="'+menu+'"> '
+'<param name="quality" value="'+q+'"> '
+'<param name="wmode" value="'+mode+'"> '
+'<param name="bgcolor" value="'+bgcolor+'"> '
+'<param name="flashvars" value="'+flashVarString+'"> '
+'<embed src="'+swf+'" flashvars="'+flashVarString+'" menu="'+menu+'" quality="'+q+'" wmode="'+mode+'" '
+' bgcolor="'+bgcolor+'" width="'+w+'" height="'+h+'" name="'+swf+'" '
+' align="" type="application/x-shockwave-flash" '
+' pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> ');
} else {
//behaviour for if there is no flash player
document.write('You require Flash Player '+MM_contentVersion+' or later to use this site. ');
document.write('<em><a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">');
document.write('Click here to install it now.</a></em>');


//this can be replaced by anything you want
//e.g. document.location.replace("text.html");

}
}

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 fn_menuProdInterno(cntr){
		 if(cntr.getElementsByTagName("ul"))
		 {
			var menu = cntr.getElementsByTagName("ul");
			for(i=0;i<menu.length;i++)
			{
				if(menu[i].getAttribute('id')=='MenuInt')
				{
					var itens = menu[i].getElementsByTagName("a");
					for(x=0;x<itens.length;x++)
					{
						itens[x].onclick = function ()
								   {
									   posicao = this.getAttribute('href').indexOf('ID=')+2;
									   tamanho = this.getAttribute('href').length;
                                       complemento = this.getAttribute('href').substring(posicao+1,tamanho);
                                       segmento=complemento;
									   tipo = this.getAttribute('rel');
                                       nome_campo = tipo;
                                       if(tipo!='acesso')
                                       {
									   	fn_link('conteudo.php?VAR_ID='+complemento+'&VAR_TIPO='+tipo,null);
                                       	return false;
                                       }
								   }
					}
				}
			}
		 }
}
function isEmpty(text){
	var	len = text.length, pos, newtext = "";
	for (pos=0; pos<len; pos++){ if (text.substring(pos, (pos+1)) != " "){ newtext = newtext + text.substring(pos, (pos+1)); } }
	if (newtext.length > 0) return false; else return true;
}

function isEmail(text){
	var arroba = "@", ponto = ".", posponto = 0, posarroba = 0;
	if (text =="") return false;
	for (var indice = 0; indice < text.length; indice++){ if (text.charAt(indice) == arroba) { posarroba = indice; break; } }
	for (var indice = posarroba; indice < text.length; indice++){ if (text.charAt(indice) == ponto) { posponto = indice; break; } }
	if (posponto == 0 || posarroba == 0) return false;
	if (posponto == (posarroba + 1)) return false;
	if ((posponto + 1) == text.length) return false;
	return true;
}
function fn_cadastro(formulario,campos)
{
 var dados = '';
 dados = campos.split('|');
 var x=0;
 for (b=0;b<formulario.elements.length;b++)
 {
	for(a=0;a<dados.length;a++)
    {
      if(formulario.elements[b].name==dados[a] && formulario.elements[b].disabled==false)
 	  	 x += (isEmpty(formulario.elements[b].value)) ? 1 : 0;

 	  if(formulario.elements[b].name == "NM_TX_EMAIL")
        x += (isEmail(formulario.elements[b].value)==false) ? 1 : 0;
 	}

 }
 if(x>0)
 {
	alert('Llene los campos obligatorios.');
    return false;
 }
 else
 	return true;

}
function fn_mais(link){
  fn_link(link,null);
  return false;
}
function fn_campos(formulario){
	var campos = '';
   	for(i=0;i<formulario.elements.length;i++)
    {
     if(formulario.elements[i].value!=undefined && formulario.elements[i].type!='checkbox')
 	    campos += formulario.elements[i].name+'='+escape(formulario.elements[i].value)+'&';
     else
     {
       if(formulario.elements[i].type=='checkbox')
       {
         if(formulario.elements[i].checked==true)
         campos += formulario.elements[i].name+'='+formulario.elements[i].value+'&';
       }
     }
    }
    return campos;
}
function fn_pagina(nrpagina)
{
 document.fPagina.NM_NR_PAGINA.value = nrpagina;
 var campos = fn_campos(document.fPagina);
 fn_link('conteudo.php?VAR_TIPO=busca&'+campos,null);
}
var netscape = "";
ver = navigator.appVersion; len = ver.length;
for(iln = 0; iln < len; iln++) if (ver.charAt(iln) == "(") break;
    netscape = (ver.charAt(iln+1).toUpperCase() != "C");

function fn_capturaTecla(DnEvents)
{
    tecla = (netscape) ? DnEvents.which : window.event.keyCode;
    if(tecla==13)
       {
          for(i=0;i<document.forms.length;i++)
          {
            document.forms[i].onsubmit=function(){return false};
            var formulario = document.forms[i].name;
            if(formulario=='fNoticias' || formulario=='fBoletim' || formulario=='fIndice')
            {
              if(formulario!='fBoletim')
              {
              var valor = document.getElementById('NM_TX_PESQUISA').value;
              if(formulario=='fNoticias')
              	fn_link('conteudo.php?VAR_TIPO=dmi&VAR_BUSCA='+valor,null);
               else if(formulario=='fBoletim')
               {
                	var mes = document.getElementById('NM_TX_MES').value;
               	 	var ano = document.getElementById('NM_TX_ANO').value;
                    if(mes!='' || ano!='')
                    fn_link('informativo.php?VAR_MES='+mes+'&VAR_ANO='+ano,null);
                    else
                    alert('Compruebe que la búsqueda.');
               }
               else
               fn_link('conteudo.php?VAR_TIPO=boletins&VAR_BUSCA='+valor,null);
               }
            }
            if(formulario=='fPagina')
            {
                fn_pagina(document.forms[i].NM_NR_PAGINA.value);
            }
            if(formulario=='fFeira')
            {
            	var valor = document.getElementById('NM_TX_PESQUISA').value;
                var feira = document.fFeira.NM_CD_FEIRA.options[document.fFeira.NM_CD_FEIRA.selectedIndex].value;
                fn_link('conteudo.php?VAR_TIPO=eventos&VAR_BUSCA='+valor+'&NM_CD_FEIRA='+feira,null);
            }
          }
        }
}
function fn_fotos(){
 	var fotos = document.getElementById("fotos");
    var imgs = fotos.getElementsByTagName("img");
    if(imgs.length>0)
    {
	    for(var i=0;i<imgs.length;i++)
	    {
	        imgs[i].onmouseover=function(){
	            this.className='img_over';
	        }
	        imgs[i].onmouseout=function(){
	            this.className='img_out';
	        }
	    }
    }
    var links = fotos.getElementsByTagName("a");
    for(var i=0;i<links.length;i++)
    {
	        links[i].onclick=function(){
	                var codigo = this.getAttribute('rel');
	                codigo = codigo.substring(5,codigo.length);
                    if(nome_campo=='eventos')
	                var janela = window.open('foto.php?VAR_FOTO='+codigo,'NOVA','toolbar=1,statusbar=1,menubar=1,resizable=1,scrollbars=1');
                    else
					var janela = window.open('edicao.php?cd_informativo='+codigo,'EDICAO','resizable=1,scrollbars=1');
	                janela.focus();
	                if(janela)
	                return false;
	            }
    }
}
function fn_formularios(cntr){
 var formularios = cntr.getElementsByTagName('form');
 for(i = 0; i < formularios.length; i++)
 {
	                            if(formularios[i].getAttribute('id')=='fNoticias' || formularios[i].getAttribute('id')=='fBoletim' || formularios[i].getAttribute('id')=='fIndice')
	                            {
	                               document.onkeydown = fn_capturaTecla;
	                               if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP);
                                   if(formularios[i].getAttribute('id')!='fBoletim')
                                   document.getElementById('NM_TX_PESQUISA').focus();
                                   if(formularios[i].getAttribute('id')=='fNoticias')
                                   {
	                                   document.getElementById('NM_BTN_BUSCAR').onclick=function (){
                                           var valor = document.getElementById('NM_TX_PESQUISA').value;
                                           fn_link('conteudo.php?VAR_TIPO=dmi&VAR_BUSCA='+valor,null);
	                                   }
                                   }
                                   if(formularios[i].getAttribute('id')=='fBoletim')
                                   {
	                                   document.getElementById('NM_BTN_BUSCAR').onclick=function (){
                                           var mes = document.getElementById('NM_TX_MES').value;
                                           var ano = document.getElementById('NM_TX_ANO').value;
                                           if(mes!='' || ano!='')
                                           fn_link('conteudo.php?VAR_TIPO=informativo&VAR_MES='+mes+'&VAR_ANO='+ano,null);
                                           else
                                           alert('Compruebe que la búsqueda.');
	                                   }
                                   }
                                   if(formularios[i].getAttribute('id')=='fIndice')
                                   {
	                                   document.getElementById('NM_BTN_BUSCAR').onclick=function (){
                                           var valor = document.getElementById('NM_TX_PESQUISA').value;
                                           fn_link('conteudo.php?VAR_TIPO=boletins&VAR_BUSCA='+valor,null);
	                                   }
                                   }
	                            }
	                            if(formularios[i].getAttribute('id')=='fCadastro' || formularios[i].getAttribute('id')=='fContato' || formularios[i].getAttribute('id')=='fNews')
	                            {
	                                document.onkeydown = fn_capturaTecla;
	                                if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP);
	                                document.forms[i].onsubmit=function(){return false};
	                                document.getElementById('NM_TX_NOME').focus();

                                    if(formularios[i].getAttribute('id')=='fCadastro')
                                    {
                                      document.getElementById('NM_BTN_ENVIAR').onclick=function (){
	                                  	var campos = fn_campos(document.fCadastro);
	                                    if(fn_cadastro(document.fCadastro,'NM_TX_NOME|NM_TX_EMAIL'))
                                         fn_link('conteudo.php?VAR_TIPO=boletim',campos);
                                      }
                                    }
                                    if(formularios[i].getAttribute('id')=='fNews')
                                    {
                                      document.getElementById('NM_BTN_ENVIAR').onclick=function (){
	                                  	var campos = fn_campos(document.fNews);
	                                    if(fn_cadastro(document.fNews,'NM_TX_NOME|NM_TX_EMAIL'))
                                         fn_link('conteudo.php?VAR_TIPO=news',campos);
                                      }
                                    }
                                    if(formularios[i].getAttribute('id')=='fContato')
                                    {
	                                    document.getElementById('NM_BTN_ENVIAR').onclick=function (){
	                                              var campos = fn_campos(document.fContato);
	                                              if(fn_cadastro(document.fContato,'NM_TX_NOME|NM_TX_EMAIL|NM_TX_ASSUNTO'))
	                                              fn_link('conteudo.php?VAR_TIPO=contato',campos);
	                                    }
                                    }
	                            }
                                if(formularios[i].getAttribute('id')=='fBusca')
                                {
                                    document.onkeydown = fn_capturaTecla;
	                                if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP);
                                }
                                if(formularios[i].getAttribute('id')=='fFeira')
                                {
                                       document.getElementById('NM_BTN_BUSCAR').onclick=function (){
                                           var valor = document.getElementById('NM_TX_PESQUISA').value;
                                           var feira = document.fFeira.NM_CD_FEIRA.options[document.fFeira.NM_CD_FEIRA.selectedIndex].value;
                                           fn_link('conteudo.php?VAR_TIPO=eventos&VAR_BUSCA='+valor+'&NM_CD_FEIRA='+feira,null);
	                                   }
                                }
                                if(formularios[i].getAttribute('id')=='fAcesso')
                                {
                                  document.getElementById('NM_BTN_ACONTECE').onclick=function (){
	                                  document.fAcesso.action='http://systray.dmibr.com';
	                                  document.fAcesso.target='_blank';
	                                  document.fAcesso.submit();
                                  }
                                }
 }
}
function fn_carrega()
{

	   for(i=1;i<=ar_segmento.length;i++)
	   {
	       if(document.getElementById('topo_'+ar_segmento[i]))
	        {
	            document.getElementById('topo_'+ar_segmento[i]).setAttribute('id','topo');
	            document.getElementById('conteudo_'+ar_segmento[i]).setAttribute('id','conteudo');
	        }
	   }


var cntr = document.getElementById('texto');
cntr.innerHTML='';
cntr.innerHTML='<div class="carregando">cargando...</div>';

if (http_request.readyState == 4 || http_request.readyState == 0)
    {               // alert(http_request.status);
            if (http_request.status == 200)
	        {
                        if(nome_campo=='segmentos' && segmento!='')
                        {
                            document.getElementById('topo').setAttribute('id','topo_'+ar_segmento[segmento]);
                            document.getElementById('conteudo').setAttribute('id','conteudo_'+ar_segmento[segmento]);
                        }

                        var texto = http_request.responseText;
	                    //Desfaz o urlencode
	                    //texto=texto.replace(/\+/g," ");
	                    //texto=unescape(texto);
	                    cntr.innerHTML = texto;
	                    fn_menuProdInterno(cntr);

	                    if(origem=='home')
                         fn_ini_int();

                        if(nome_campo=='eventos' || nome_campo=='informativo')
                        fn_fotos();

                        fn_formularios(cntr);

                        if(document.getElementById("voltar"))
                        {
                            btn_voltar = document.getElementById("voltar");
                            link = btn_voltar.getElementsByTagName("a");
                            link[0].onclick=function(){
	                           retorno = this.getAttribute("rel");
                               posicao = retorno.split('&');
                               segmento = posicao[1].replace('VAR_ID=','');
                               nome_campo = posicao[0].replace('VAR_TIPO=','');
                               nome_campo = nome_campo.replace(" ",'');
                               if(nome_campo=='')
                               window.location='index.php';
							   else
                               fn_link('conteudo.php?'+retorno,null);
	                           return false;
	                         }
                        }

	          }
    }

}


function fn_link(endereco,campos)
{

    http_request = false;

    if (window.XMLHttpRequest)
    {
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType)
            http_request.overrideMimeType('text/xml');
    }
    else if (window.ActiveXObject)
    {
        try
        {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {}
        }
    }

    http_request.onreadystatechange = fn_carrega;
    http_request.open('POST', endereco, true);
    // http_request.setRequestHeader("Content-Type", "text/html; charset=ISO-8859-1");
    // http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
    http_request.setRequestHeader("CharSet", "iso-8859-1")
    http_request.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    http_request.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
    http_request.setRequestHeader("Pragma", "no-cache");
    campos = (campos==null) ? 'campo=1' : campos;
    http_request.send(campos);
}
function fn_menu_over(imagem,nomeIMG) {
	document.getElementById(nomeIMG).style.backgroundImage="url("+imagem+")";
}
function fn_menu_out(){
    var menu=document.getElementById("menu");
	var links=menu.getElementsByTagName("li");
    for(var i=0;i<links.length;i++)
	{
      fn_menu_over('images/li_'+links[i].getAttribute('id')+'.gif',links[i].getAttribute('id'));
	}
}
function fn_menu(){
		   	var menus = document.getElementsByTagName('ul');
			for(var x=0; x<menus.length; x++)
			{
				if(menus[x].className!='undefined')
				{
				if(menus[x].className=='MenuBarVertical MenuBarActive')
					menus[x].className='MenuBarVertical';
				if(menus[x].className=='MenuBarSubmenuVisible')
					menus[x].className='';
				}
			}

		   	var layers = document.getElementsByTagName('iframe');
		   	while(layers.length > 0)
			{
					layers[0].style.width='0px';
					layers[0].parentNode.removeChild(layers[0]);
      		}

}
function fn_item_menu_out(){
    var menu=document.getElementById("MenuBar2");
    var menus = document.getElementsByTagName('a');
   	for(var x=0; x<menus.length; x++)
	{
		if(menus[x].className!='undefined')
		menus[x].className='';

	}
}
function fn_monta_menu_interno(){
            document.getElementById('MenuBar2').setAttribute('id','MenuBar1');
            document.getElementById("lateral").innerHTML+=document.getElementById('itens').innerHTML;
            var itens_menu = document.getElementById('MenuBar1').innerHTML;
            document.getElementById('MenuBar1').innerHTML = '';
            //INICIO
            nova_li = document.createElement("li");
            nova_href = document.createElement("a");
            nova_span = document.createElement("span");

     		texto_li = document.createTextNode('Home');
            nova_li.appendChild(nova_href);
            nova_href.appendChild(nova_span);
     		nova_span.appendChild(texto_li);
     		document.getElementById('MenuBar1').appendChild(nova_li);
            nova_href.setAttribute('href','index.php');
            nova_href.setAttribute('rel','inicio');
            nova_href.setAttribute('title','Click to return to home page');

            document.getElementById('MenuBar1').innerHTML += itens_menu;

            var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
}
function fn_menuNoticias(indicacao,elecntr){
		 cntr = document.getElementById(elecntr);
		 if(cntr.getElementsByTagName("div"))
		 {
			var menu = cntr.getElementsByTagName("div");
			for(i=0;i<menu.length;i++)
			{
				if(menu[i].getAttribute('id')==indicacao)
				{
					var itens = menu[i].getElementsByTagName("a");
					for(x=0;x<itens.length;x++)
					{
						itens[x].onclick = function ()
								   {
                                        document.getElementById('principal').setAttribute('id','interna');
                                        posicao = this.getAttribute('href').indexOf('#');
									    tamanho = this.getAttribute('href').length;
                                        complemento = '&VAR_ID='+this.getAttribute('href').substring(posicao+1,tamanho);
                                        nome_campo = this.getAttribute('rel');
							            origem = 'home';
	                                    fn_item_menu_out();
	                                    document.getElementById("topo").innerHTML='';
	                                    fn_monta_menu_interno();
	                                    document.getElementById("conteudo").innerHTML='<div id="texto"></div>';
	                                    fn_link('conteudo.php?VAR_TIPO='+nome_campo+complemento,null);
                                        return false;
								   }
					}
				}
			}
		 }
}
function fn_monta_pagina(campo){
    fn_menu();
    nome_campo = campo.getAttribute('rel');
    if(nome_campo!='acesso')
    {
        segmento='';
        document.getElementById('principal').setAttribute('id','interna');
	    posicao = campo.getAttribute('href').indexOf('ID=')+2;
	    tamanho = campo.getAttribute('href').length;
	    complemento = campo.getAttribute('href').substring(posicao+1,tamanho);
        segmento=complemento;
        complemento = '&VAR_ID='+campo.getAttribute('href').substring(posicao+1,tamanho);
        fn_item_menu_out();
	    document.getElementById("topo").innerHTML='';
	    fn_monta_menu_interno();
	    //document.getElementById("conteudo").innerHTML='<div id="texto"></div>';
	    document.getElementById("itens").style.display='none';
	    document.getElementById("noticias").parentNode.removeChild(document.getElementById("noticias"));
        if(document.getElementById("itens").style.display=='none' && nome_campo!='busca')
	     fn_link('conteudo.php?VAR_TIPO='+nome_campo+complemento,null);
     }
}
function fn_bot_busca(){
	var conteudo_check = true;
    var noticias_check = true;
 	document.getElementById('bConteudo').onclick=function(){
        var imagem = this.getElementsByTagName("img");
        if(conteudo_check == true)
        {
            imagem[0].src='images/bot_check_false.jpg';
	        conteudo_check = false;
            document.fBusca.NM_CK_CONTEUDO.value='N';
        }
        else
        {
	        imagem[0].src='images/bot_check_true.jpg';
	        conteudo_check = true;
            document.fBusca.NM_CK_CONTEUDO.value='S';
        }
        document.fBusca.VAR_BUSCA.focus();
        return false;
	}
 	document.getElementById('bNoticias').onclick=function(){
        var imagem = this.getElementsByTagName("img");
        if(noticias_check == true)
        {
	        imagem[0].src='images/bot_check_false.jpg';
	        noticias_check = false;
            document.fBusca.NM_CK_NOTICIAS.value='N';
        }
        else
        {
	        imagem[0].src='images/bot_check_true.jpg';
	        noticias_check = true;
            document.fBusca.NM_CK_NOTICIAS.value='S';
        }
        document.fBusca.VAR_BUSCA.focus();
        return false;
	}
    document.getElementById('bot_buscar').onclick=function(){
	    if(document.fBusca.VAR_BUSCA.value.length>2)
        {
          if(origem=='home')
    		  fn_monta_pagina(this);
	      var campos = fn_campos(document.fBusca);
          nome_campo = 'busca';
          fn_link('conteudo.php?VAR_TIPO=busca&'+campos,null);
          document.fBusca.VAR_BUSCA.value='';
        }
        else
        {
            document.fBusca.VAR_BUSCA.focus();
            alert('Llenar el campo.');
        }
        return false;
    }
    document.getElementById('NM_BTN_ACONTECE').onclick=function (){
	        if(!isEmpty(document.getElementById('login').value) && !isEmpty(document.getElementById('senha').value))
	        {
	            document.fAcesso.action='http://systray.dmibr.com';
	            document.fAcesso.target='_blank';
	            document.fAcesso.submit();
                document.getElementById('login').value='';
                document.getElementById('senha').value='';
	        }
            else
            alert('Introducir en el nombre de usuario y contraseña.');
        }

}
function fn_hora() {
	var Digital=new Date()
	var hours=Digital.getHours()
	var minutes=Digital.getMinutes()
    var horario = '';
    if (hours.toString().length==1)
	hours="0"+hours
	if (minutes<=9)
	minutes="0"+minutes


	if (alternate==0)
	horario=hours+":"+minutes
	else
	horario=hours+"<font color='#EEEEEE'>:</font>"+minutes

    document.getElementById('data').innerHTML = horario;

	alternate=(alternate==0)? 1 : 0
	setTimeout("fn_hora()",1000)
}
function fn_ini(){
 fn_hora();

 //MM_preloadImages('images/li_empresa_over.gif','images/li_produtos_over.gif');
 fn_menuNoticias('noticias','conteudo');   //LINKS NOTICIAS
 fn_menuNoticias('quadro_3','rodape');    //LINKS CONTATO
 fn_menuNoticias('quadro_4','rodape');    //LINKS FILME
 var menu=document.getElementById("itens");
 var links=menu.getElementsByTagName("a");  //li
 var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
 fn_bot_busca(); //BOTOES DA BUSCA
 origem = 'home';

  for(var i=0;i<links.length;i++)
	{
	   links[i].onclick = function (){
            //fn_menu_out();
		     fn_monta_pagina(this);
             if(nome_campo!='acesso')
             return false;
        };
    }
    var formularios = document.getElementsByTagName('form');
	for(i = 0; i < formularios.length; i++)
    {
	    if(formularios[i].getAttribute('id')=='fBusca')
	    {
	        document.onkeydown = fn_capturaTecla;
	        if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP);
	        formularios[i].onsubmit=function(){return false};
	    }
    }
}
function fn_ini_int(){
 var menu=document.getElementById("MenuBar1");
 var links=menu.getElementsByTagName("li");
 var nomeID=menu.getElementsByTagName("a");
 origem = '';
 fn_bot_busca(); //BOTOES DA BUSCA

 for(var i=0;i<links.length;i++)
 {
		   nomeID[i].onclick = function (){
           segmento='';
           nome_campo = this.getAttribute('rel');
           posicao = this.getAttribute('href').indexOf('ID=')+2;
		   tamanho = this.getAttribute('href').length;
		   complemento = this.getAttribute('href').substring(posicao+1,tamanho);
           segmento=complemento;
           fn_menu();
           if(nome_campo!='inicio' && nome_campo!='acesso')
           {
           	fn_link('conteudo.php?VAR_ID='+complemento+'&VAR_TIPO='+nome_campo,null);
           	return false;
           }

        };

 }
 fn_formularios(document.getElementById('texto'));

 //CONTATO FILME
 link_contato = document.getElementById("quadro_3").getElementsByTagName("a");
 link_filme = document.getElementById("quadro_4").getElementsByTagName("a");
 link_contato[0].onclick = link_filme[0].onclick = function (){
           nome_campo = this.getAttribute('rel');
           posicao = this.getAttribute('href').indexOf('#');
		   tamanho = this.getAttribute('href').length;
		   complemento = this.getAttribute('href').substring(posicao+1,tamanho);
           fn_link('conteudo.php?VAR_ID='+complemento+'&VAR_TIPO='+nome_campo,null);
           return false;
 }

}