function imprimirFlash(arquivo,w,h,transparente,params,id) {
    document.write('<object'+(((typeof id != 'undefined') && (navigator.appVersion.indexOf('MSIE') > -1))?' id="'+id+'"':'')+' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"' + ((typeof w == 'undefined')?'':' width="'+w+'"') + ((typeof h == 'undefined')?'':' height="'+h+'"') + '>');
    document.write('<param name="movie" value="'+arquivo+'">');
    document.write('<param name=quality value=high>');
    document.write('<param name="menu" value="false">');
    if (typeof params != 'undefined') {
        var p = '';

        for (var i in params) {
            p += i + '="' + params[i] + '" ';
            document.write('<param name="'+i+'" value="'+params[i]+'">');
        }
    }
    if (transparente) {
        document.write('<param name="wmode" value="transparent">');
    }
    document.write('<embed'+(((typeof id != 'undefined') && (navigator.appVersion.indexOf('MSIE') < 0))?' id="'+id+'"':'')+' src="'+arquivo+'" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"' + ((typeof w == 'undefined')?'':' width="'+w+'"') + ((typeof h == 'undefined')?'':' height="'+h+'"') + ' ');
    if (transparente) {
        document.write('wmode="transparent" ');
    }
    document.write(p);
    document.write(' menu="false"></embed>');
    document.write('</object>');
}



	var idTime, idTimeMenu;
	fig=1;
	total=3;
	caminho="";
	function MostraOculta(obj){
   if(document.getElementById(obj).style.display=='none'){
     document.getElementById(obj).style.display='';
     //document.getElementById(obj+'I').src='imagens/seta.jpg';
   }else{
     //document.getElementById(obj+'I').src='imagens/seta2.jpg';
     document.getElementById(obj).style.display='none';}
	}
	function SetCaminho(c){caminho=c;}
 function MostrarColegios(){ document.getElementById('Colegio').style.display='';  }
 function Atualizar(item, texto){ document.getElementById(item).innerHTML=texto; }
	function Recarregar(){
     if(document.getElementById('altsenha').style.display=='none' && document.getElementById('O1').style.display=='none' && document.getElementById('O3').style.display=='none')
     {document.getElementById('Colegio').style.display='none';window.open(caminho+'direito.php','direito');}
     else{window.setTimeout('Recarregar()',5000);}
 }
	function Pagina(){document.getElementById('geral').style.display='';}
	function Abrir(pag){
       window.location.href='?'+pag;
	}

	function Mudar(){
	  if(total>1 && document.getElementById('altsenha').style.display=='none' && document.getElementById('O1').style.display=='none' && document.getElementById('O3').style.display=='none'){
		if (fig<total) fig++;
		else fig=1;
		document.getElementById('foto').src="imagens/" + "ft"+ fig + ".gif";
		idTime=window.setTimeout("Mudar()",5000);
		} else{ idTime=window.setTimeout("Mudar()",2000); }
	}
	function MostrarSeta(num){
     //document.getElementById(''+num).innerHTML="<img src=imagens/seta.jpg onmouseover=clearTimeout(idTimeMenu)>";
     document.getElementById(''+num).style.backgroundImage='url(imagens/seta.gif)';
     if (num=='M1') {document.getElementById('O1').style.display='';}
     else{  if(document.getElementById('M1').style.backgroundImage=="") {document.getElementById('O1').style.display='none';}}
     if (num=='M3') {document.getElementById('O3').style.display='';}
     else{  if(document.getElementById('M3').style.backgroundImage=="") {document.getElementById('O3').style.display='none';}}
     if (num=='C13') {document.getElementById('O13').style.display='';}
     if (num=='C16') {document.getElementById('O16').style.display='';}
	}
	function OcultarSeta(num){
     document.getElementById(''+num).style.backgroundImage=''
     if(num!='M1' && num!='C13' && num!='C16' && document.getElementById('M1').style.backgroundImage=="") {
        document.getElementById('O1').style.display='none';
        document.getElementById('O13').style.display='none';
        document.getElementById('O16').style.display='none';
     }
     if(num!='M3' && document.getElementById('M3').style.backgroundImage=="") {
        document.getElementById('O3').style.display='none'; }
     if(num!='C13' && document.getElementById('C13').style.backgroundImage=="") {
        document.getElementById('O13').style.display='none';
     }
     if(num!='C16' && document.getElementById('C16').style.backgroundImage=="") {
        document.getElementById('O16').style.display='none';
     }
	}
	function MostrarSeta2(num1,num2){
     MostrarSeta(num1); MostrarSeta(num2);
	}
	function OcultarSeta2(num1,num2){
     OcultarSeta(num1); OcultarSeta(num2);
	}
	function resize_iframe(NFrame){
    Pagina();
    document.getElementById(NFrame).height=window.frames[NFrame].document.body.scrollHeight;
    document.getElementById('sp').style.top=0;
}
function EscondeMenus(){
   if(document.getElementById('O1').style.display=='' && document.getElementById('M1').style.backgroundImage=="" ){
       document.getElementById('O1').style.display='none';
       document.getElementById('O13').style.display='none';
       document.getElementById('O16').style.display='none';
   }else if(document.getElementById('O3').style.display=='' && document.getElementById('M3').style.backgroundImage=="" ){
       document.getElementById('O3').style.display='none';
   }

}
function VerUsuario(){
  if(document.getElementById('user').value!='' && document.getElementById('pass').value!=''){
      document.getElementById('apelido').value=document.getElementById('user').value;
      //alert(document.getElementById('apelido').value);
      document.getElementById('entra').submit();
  }
  else {alert('Preencha corretamente os campos\nUsuário e Senha ao lado\ne clique novamente!');}
}
function EnviarForm(){
  //if (document.getElementById('DLogin').style.display=='') {
      if(document.getElementById('user').value!='' && document.getElementById('pass').value!=''){
          document.getElementById('login').submit();
      }
      else {alert('Preencha corretamente os\ncampos Usuário e Senha!');}
  //}
}
function ValidaMail(mail){
 var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
 if(typeof(mail) == "string"){
     if(er.test(mail)){ return true; }
 }else if(typeof(mail) == "object"){
     if(er.test(mail.value)){
                 return true;
             }
 }else{
     return false;
     }
}
function EnviarSenha(){
   if(document.getElementById('DEmail').style.display==''){
     if(document.getElementById('email').value!=''){
       if(ValidaMail(document.getElementById('email').value)){
           document.getElementById('DEmail').style.display='none';
           var d = new Date();
           window.open('envia_senha.php?t='+d.getTime()+'&email='+document.getElementById('email').value,'exe');
       }else{alert('E-mail inválido!');}
     }else{document.getElementById('DEmail').style.display='none';}
   }else{document.getElementById('DEmail').style.display='';
         document.getElementById('email').value='';
         alert('Preencha o campo E-mail\nabaixo e clique novamente\nem Esqueci a senha!!');}
}
function MenuAdm(texto){
    if(texto==''){texto='<span id=altsenha style=display:none;position:relative;></span>';}
    document.getElementById('adm').innerHTML=texto;
}
//funcoes setas imagens antiga

function Mostrar(arq,inc,total,nome){
    s=document.getElementById(nome).src;
    l=s.lastIndexOf('_');
    foto=s.substring(l+1,l+2)*1;
    foto=foto+inc;
    if(foto<1){ foto=total;}
    if(foto>total){ foto=1;}
    document.getElementById(nome).src=arq+foto+'G.jpg';
}

//funcoes para a enquete
function votarenquete(action,theURL,winName,winWidth,winHeight,features) {      
    var w = (screen.width - winWidth)/2;
    var h = (screen.height - winHeight)/2 - 20;
    features = features+',width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
    option_id = '';
    for (i=0; i<self.document.enquete.opcao.length; i++) {
        if(self.document.enquete.opcao[i].checked == true) {
            option_id = self.document.enquete.opcao[i].value;
            self.document.enquete.opcao[i].checked = false; // limpa opção escolhida depois de votar
            break;
        }
    }
    //option_id = (option_id != '') ? '&option_id='+option_id : '';
    if (option_id != '' ) {
        theURL = theURL+'&id='+option_id;
        enquete_popup = window.open(theURL,winName,features);
        enquete_popup.focus();
    }
    return false;
}

function resultadoenquete(action,theURL,winName,winWidth,winHeight,features){
	var w = (screen.width - winWidth)/2;
    var h = (screen.height - winHeight)/2 - 20;
    features = features+',width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
	resultado_popup = window.open(theURL,winName,features);
    resultado_popup.focus();
}