function BovespaVai() 
		{window.open('http://www.bovespa.com.br/InstSites/bovespavaiatevoce/Index.asp','abrir','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,menubar=no,width=775,height=540,left=14,top=40');}
		
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function montaFlash(movie, width, height, wmode, FlashVars){  
	var swf  = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
    + 'width="'+ width +'" height="'+ height +'"'
    + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
    + '<param name="movie" value="'+ movie +'" /><param name="quality" value="high" /><param name="devicefont" value="true" /><param name="wmode" value="'+ wmode +'" /><param name="FlashVars" value="'+ FlashVars +'" />'
    + '<embed src="'+ movie +'" quality="high" devicefont="true" '
    + 'width="'+ width +'" height="'+ height +'" align="middle"'
    + 'play="true"'
    + 'loop="false"'
    + 'quality="high"'
    + 'wmode="'+ wmode +'"'
    + 'allowScriptAccess="sameDomain"'
    + 'type="application/x-shockwave-flash"'
    + 'FlashVars="'+ FlashVars +'"'
    + 'pluginspage="http://www.macromedia.com/go/getflashplayer"'
    + '><\/embed>'
    + '<\/object>';
	document.write(swf);
}



function Mascara (formato, objeto)
{
cpf = eval (objeto);
if (formato=='CPF')
{
caracteres = '01234567890';
separacoes = 3;
separacao1 = '.';
separacao2 = '-';
conjuntos = 4;
conjunto1 = 3;
conjunto2 = 7;
conjunto3 = 11;
conjunto4 = 14;
if ((caracteres.search(String.fromCharCode (window.event.keyCode))!=-1) && cpf.value.length < 
(conjunto4))
{
if (cpf.value.length == conjunto1) 
cpf.value = cpf.value + separacao1;
else if (cpf.value.length == conjunto2) 
cpf.value = cpf.value + separacao1;
else if (cpf.value.length == conjunto3) 
cpf.value = cpf.value + separacao2;
}
else 
event.returnValue = false;
} 
}



function validarCPF(){
   var cpf = document.email.cpf.value;
   var filtro = /^\d{3}.\d{3}.\d{3}-\d{2}$/i;
   if(!filtro.test(cpf)){
     window.alert("CPF inválido. Tente novamente.");
	 return false;
   }
   
   cpf = remove(cpf, ".");
   cpf = remove(cpf, "-");
    
   if(cpf.length != 11 || cpf == "00000000000" || cpf == "11111111111" ||
	  cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" ||
	  cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" ||
	  cpf == "88888888888" || cpf == "99999999999"){
	  window.alert("CPF inválido. Tente novamente.");
	  return false;
   }

   soma = 0;
   for(i = 0; i < 9; i++)
   	 soma += parseInt(cpf.charAt(i)) * (10 - i);
   resto = 11 - (soma % 11);
   if(resto == 10 || resto == 11)
	 resto = 0;
   if(resto != parseInt(cpf.charAt(9))){
	 window.alert("CPF inválido. Tente novamente.");
	 return false;
   }
   soma = 0;
   for(i = 0; i < 10; i ++)
	 soma += parseInt(cpf.charAt(i)) * (11 - i);
   resto = 11 - (soma % 11);
   if(resto == 10 || resto == 11)
	 resto = 0;
   if(resto != parseInt(cpf.charAt(10))){
     window.alert("CPF inválido. Tente novamente.");
	 return false;
   }
   return true;
 }
 
 function remove(str, sub) {
   i = str.indexOf(sub);
   r = "";
   if (i == -1) return str;
   r += str.substring(0,i) + remove(str.substring(i + sub.length), sub);
   return r;
 }
 
 function mascara_data(dataNasc){ 
              var mydata = ''; 
              mydata = mydata + dataNasc; 
              if (mydata.length == 2){ 
                  mydata = mydata + '/'; 
                  document.forms[0].dataNasc.value = mydata; 
              } 
              if (mydata.length == 5){ 
                  mydata = mydata + '/'; 
                  document.forms[0].dataNasc.value = mydata; 
              } 
              if (mydata.length == 10){ 
                  verifica_data(); 
              } 
          } 
           
          function verifica_data () { 

            dia = (document.forms[0].dataNasc.value.substring(0,2)); 
            mes = (document.forms[0].dataNasc.value.substring(3,5)); 
            ano = (document.forms[0].dataNasc.value.substring(6,10)); 

            situacao = ""; 
            // verifica o dia valido para cada mes 
            if ((dia < 01)||(dia < 01 || dia > 30) && (  mes == 04 || mes == 06 || mes == 09 || mes == 11 ) || dia > 31) { 
                situacao = "falsa"; 
            } 

            // verifica se o mes e valido 
            if (mes < 01 || mes > 12 ) { 
                situacao = "falsa"; 
            } 

            // verifica se e ano bissexto 
            if (mes == 2 && ( dia < 01 || dia > 29 || ( dia > 28 && (parseInt(ano / 4) != ano / 4)))) { 
                situacao = "falsa"; 
            } 
    
            if (document.forms[0].dataNasc.value == "") { 
                situacao = "falsa"; 
            } 
    
            if (situacao == "falsa") { 
                alert("Data inválida!"); 
                document.forms[0].dataNasc.focus(); 
            } 
          } 
		  
		 
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

 function txtFAQ(object, tabela) {
 
 tb = document.getElementById(tabela);
 
 if (tb.style.display == "none") {
  tb.style.display = "block";
 }
 else {
  tb.style.display = "none";
 }
}

function mostraMAPA(object, tabela) {
 
 tb = document.getElementById(tabela);
 
 if (tb.style.display == "none") {
  tb.style.display = "block";
 }
 else if (tb.style.display == "block") {
  tb.style.display = "block";
 }
 else {
  tb.style.display = "none";
 }
}

