function AbreFechaDiscip( div_ )
{
		statysatual = document.all( "DivDiscipPergDet" + div_ ).style.display;
		if ( statysatual == '' )
		{
			document.all( "DivDiscipPergDet" + div_ ).style.display = "none";
			document.all( "DivDiscipPerg" + div_ ).style.display = "";
			document.all( "DivDiscipPergB" + div_ ).style.display = "none";
		}
	 	else
		{
			document.all( "DivDiscipPergDet" + div_ ).style.display = "";
			document.all( "DivDiscipPerg" + div_ ).style.display = "none";
			document.all( "DivDiscipPergB" + div_ ).style.display = "";
		}
}


function EnviaFaqAdm()
{
	FormFaqAdm.action = "RegistraFaqAdm.asp";
  FormFaqAdm.submit();
  return true;
}











function EnviaDuvida()
{
	if ( Verifica(document.faq) ){
	 										document.FormSGPI.action = "EnviarDuvidas.asp";
	 										document.FormSGPI.F13.value = document.faq.email.value;
	 										document.FormSGPI.F20.value = document.faq.Texto.value;
	 										document.FormSGPI.submit();
										}
}




 function Verifica(F) {



	       if(F.email.value == ""){
            F.email.focus();
            alert( "Por favor, informe seu e-mail" );
            return false; }


				if ( !verificaemail(F.email.value) ) {
					 F.email.focus();
           alert( "Por favor, informe-nos um e-mail válido." );
					 return;
				}


       if(F.Texto.value == ""){
            F.Texto.focus();
            alert( "Por favor, informe a sua Dúvida" );
            return false; }

		return true;
	}










function EnviaForm( r )
{
	 document.FormSGPI.action = r;
	 document.FormSGPI.submit();
}


function faq( d )
{
	 document.FormSGPI.action = "faq.asp";
	 document.FormSGPI.F20.value = d;
	 document.FormSGPI.submit();
}

function midiateca( d )
{
	 document.FormSGPI.action = "midiateca.asp";
	 document.FormSGPI.F20.value = d;
	 document.FormSGPI.submit();
}


function tarefadomiciliarADMIN( g, s )
{
		for ( g_ = 1; g_ < 3; g_++ )
		{
			if( g_ == 1 )
			{ i = 6; f = 9; }
			else
			{ i = 1; f = 3; }
				for( s_ = i; s_ <= f; s_++ )
				{
					 if(  ( document.all( "SpanPastaFechada_" + g_ + "_" + s_ )  && typeof( document.all( "SpanPastaFechada_" + g_ + "_" + s_ ) ) ) == "object" )
					 {
							document.all( "SpanPastaFechada_" + g_ + "_" + s_ ).style.display = "";
							document.all( "SpanPastaAberta_" + g_ + "_" + s_ ).style.display = "none";
							document.all( "DivTD_"  + g_ + "_" + s_ ).style.display = "none";
					 }
				}
		}

	 document.all( "SpanPastaFechada_" + g + "_" + s ).style.display = "none";
	 document.all( "SpanPastaAberta_"  + g + "_" + s ).style.display = "";
	 document.all( "DivTD_"  + g + "_" + s ).style.display = "";

}

function materialditicoADMIN( g, s )
{
		for ( g_ = 1; g_ < 3; g_++ )
		{
			if( g_ == 1 )
			{ i = 1; f = 9; }
			else
			{ i = 1; f = 3; }
				for( s_ = i; s_ <= f; s_++ )
				{
					 if(  ( document.all( "SpanPastaFechada_" + g_ + "_" + s_ )  && typeof( document.all( "SpanPastaFechada_" + g_ + "_" + s_ ) ) ) == "object" )
					 {
							document.all( "SpanPastaFechada_" + g_ + "_" + s_ ).style.display = "";
							document.all( "SpanPastaAberta_" + g_ + "_" + s_ ).style.display = "none";
							document.all( "DivTD_"  + g_ + "_" + s_ ).style.display = "none";
					 }
				}
		}

	 document.all( "SpanPastaFechada_" + g + "_" + s ).style.display = "none";
	 document.all( "SpanPastaAberta_"  + g + "_" + s ).style.display = "";
	 document.all( "DivTD_"  + g + "_" + s ).style.display = "";

}


function faqADMIN( g, s )
{
	 			FormSGPI.action = "faqAdmin.asp";
	 			FormSGPI.F21.value = g;
				FormSGPI.F22.value = s;
	 			FormSGPI.submit();

}


function EnviarfaqADMIN( g, s, d )
{
	 			FormSGPI.action = "faqAdmin.asp";
				FormSGPI.F20.value = d;
				FormSGPI.F21.value = g;
				FormSGPI.F22.value = s;
	 			FormSGPI.submit();

}

function Enviar( url ){
			popupprova = window.open( '' , 'popupprova', 'width=' + screen.width + ',height=' + screen.height - 27 + ',resizable=0,scrollbars=0,menubar=no,status=0' );
			popupprova.moveTo(0,0);
			popupprova.resizeTo( screen.width, screen.height - 27 );
      popupprova.location.href = url;
}



			function EnviarTurma( turma )
			{
	 			FormSGPI.action = "turma.asp";
	 			FormSGPI.F20.value = turma;
	 			FormSGPI.submit();
			}


function EnviarInstitMestre( c, i )
{
	 			FormSGPI.action = "RelatInst.asp";
				FormSGPI.F06.value = c;
				FormSGPI.F07.value = i;
	 			FormSGPI.submit();

}


function EnviarPagina( c, i, d, p )
{
	 			FormSGPI.action = p;
				FormSGPI.F06.value = c;
				FormSGPI.F07.value = i;
    	        FormSGPI.F20.value = d;
	 			FormSGPI.submit();

}






			function verificaemail(vlremail)
			{
			  stremail = vlremail;
				while (true)  {
			    if (stremail.charAt(0) != " " ) {
						break;
					}
			    stremail = stremail.substring(1,stremail.length)
				}
				while (true)  {
			    if (stremail.charAt(stremail.length-1) != " ") {
						break;
					}
			    stremail = stremail.substring(0,stremail.length-1)
				}
			  if (stremail == "") {
					return false;
				}
			  if ( stremail.indexOf('@',0) == -1 || stremail.indexOf('.',0) == -1 || stremail.indexOf('..',0) > -1 || stremail.charAt(stremail.length-1) == "." ) {
					return false;
				}
				validos = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@-_'
				n_arroba = 0
			  n_total = stremail.length
			   for (i=0;i < n_total ;i++){
			      if (validos.indexOf(stremail.charAt(i))==-1){
			        return false;
			   	}
			    if (stremail.charAt(i) == '@') {
						n_arroba = n_arroba+1
						if (n_arroba == 2) {
			        return false
						}
					}
				}
				return true;
			}









function EnviaEmailFaqAdm( c )
{
	FormEmail.para.value = FormFaqAdm( "para" + c ).value;
  FormEmail.msg.value = FormFaqAdm( "FPergunta" + c ).value;
	FormEmail.rsp.value = FormFaqAdm( "FResposta" + c ).value;

  FormEmail.submit();
  return true;
}





function ValidaForm( F )
{

	 LimparAlertasValidaAluno();

		       if(F.FNome.value == ""){
						document.all( "AlertaValidaNome" ).innerHTML = "Por favor, informe seu nome.";
            F.FNome.focus();
            return false; }


		       if(F.Femail.value == ""){
						document.all( "AlertaValidaemail" ).innerHTML = "Por favor, informe seu e-mail.";
            F.Femail.focus();
            return false; }


				if ( !verificaemail(F.Femail.value) ) {
					 document.all( "AlertaValidaemail" ).innerHTML = "Por favor, informe-nos um e-mail válido.";
					 F.Femail.focus();
					 return;
				}


		     /*  if(F.FTelefone.value == ""){
						document.all( "AlertaValidaTelefone" ).innerHTML = "Por favor, informe seu telefone.";
            F.FTelefone.focus();
            return false; } */


		       if(F.FNascimento.value == ""){
						document.all( "AlertaValidaNascimento" ).innerHTML = "Por favor, informe a data de seu nascimento (dd/mm/aa).";
            F.FNascimento.focus();
            return false; }



  	valor = ""
  	for( var i = 0; i < F.Fsexo.length; i++ )
  	   if ( F.Fsexo[i].checked)
  	     valor = F.Fsexo[i].value;

    if( valor == "" ){
       document.all( "AlertaValidaSexo" ).innerHTML = "Por favor, informe seu sexo.";
       F.Fsexo[0].focus();
       return;
		}


		      /* if(F.FTurma.value == ""){
						document.all( "AlertaValidaTurma" ).innerHTML = "Por favor, informe a sua Turma.";
            F.FTurma.focus();
            return false; } */


		F.submit();
		return true;


}



function LimparAlertasValidaAluno()
{
	document.all( "AlertaValidaNome"       ).innerHTML = "";
	document.all( "AlertaValidaemail"      ).innerHTML = "";
	document.all( "AlertaValidaTelefone"   ).innerHTML = "";
	document.all( "AlertaValidaNascimento" ).innerHTML = "";
	document.all( "AlertaValidaSexo"       ).innerHTML = "";
/*	document.all( "AlertaValidaTurma"      ).innerHTML = "";*/


}


