function redim(iframe){	
	var altura = parseInt(document.body.scrollHeight);
	parent.document.getElementById(iframe).style.height = altura + "px";
}

function AbreDiv(obj){	
	var div;
	div = obj;
	
	if (document.getElementById(div).style.display == "none"){
		document.getElementById(div).style.display = "block";
		}
	else{
		document.getElementById(div).style.display = "none";
    	}

}


function AtualizaCampo(){
	var form = document.forms['form'];
	if(form.Dest.value == ''){
		return;
	}
	else{
		var Dest = form.Dest.value;
		/*CarregarPagina2(1,"FaleConosco.asp?Dest="+Dest,"principal");*/
		window.location.href ="FaleConosco.asp?Dest="+Dest
		
	}
}
function MouseMove(e) {
    if (e) { MousePos(e); } else { MousePos(); }
}

function MousePos(e) {
    if (bIsNav) {
        xmouse = e.pageX;
        ymouse = e.pageY;
    }
    if (bIsIE) {
        xmouse = document.body.scrollLeft + event.x;
        ymouse = document.body.scrollTop + event.y;
    }
}

function ValidaProfessor(opc){
	var form    = document.forms['form'];
	var flag    = false;
	var flagAnt = false;
	if (form.Prof[0].checked == false && form.Prof[1].checked == false){
		alert('Escolha Sou professor COC ou Quero ser professor COC.');
		return;
	}
	if (form.nome.value == '' || form.nome.value.length < 5){
		alert('Preencha corretamente o campo nome.');
		form.nome.focus();
		return;
	}
	if (form.cidade.value == '' || form.cidade.value.length < 3){
		alert('Preencha corretamente o campo cidade.');
		form.cidade.focus();
		return;
	}	
	if (form.mail.value == '' || form.mail.value.indexOf(".") < 2 || form.mail.value.indexOf("@") < 2){
		alert('Preencha corretamente o campo e-mail.');
		form.mail.focus();
		return;
	}
	for(i=1;i<=6;i++)
	{
		if(form.elements['escola'+i].value != '')
		{
			flag = true;
			if(form.elements['sistema'+i].value == '')				
			{
				alert('Escolha o sistema de ensino.');
				form.elements['sistema'+i].focus();
				return;						
			}
			else
			{
				if(form.elements['sistema'+i].value == 'outros')				
				{
					if(form.elements['sistemaOutro'+i].value == '')				
					{
						alert('Preencha o sistema de ensino.');
						form.elements['sistemaOutro'+i].focus();
						return;						
					}
				}					
			}
			
			if(form.elements['tempo'+i].value == '')				
			{
				alert('Escolha o tempo.');
				form.elements['tempo'+i].focus();
				return;
			}
			else
			{
				if(form.elements['tempo'+i].value == 'outros')				
				{
					if(form.elements['tempoOutro'+i].value == '')				
					{
						alert('Preencha o tempo.');
						form.elements['tempoOutro'+i].focus();
						return;						
					}
				}						
			}				
		}
		if(flag == false)				
		{
			alert('Preencha ao menos uma escola');
			form.elements['escola1'].focus();
			return;
		}			
	}
	
	for(i=1;i<=6;i++)
	{
		if(form.elements['escolaAnt'+i].value != '')
		{
			flagAnt = true;
			if(form.elements['sistemaAnt'+i].value == '')				
			{
				alert('Escolha o sistema de ensino.');
				form.elements['sistemaAnt'+i].focus();
				return;						
			}
			else
			{
				if(form.elements['sistemaAnt'+i].value == 'outros')				
				{
					if(form.elements['sistemaAntOutro'+i].value == '')				
					{
						alert('Preencha o sistema de ensino.');
						form.elements['sistemaAntOutro'+i].focus();
						return;						
					}
				}					
			}
			
			if(form.elements['tempoAnt'+i].value == '')				
			{
				alert('Escolha o tempo.');
				form.elements['tempoAnt'+i].focus();
				return;
			}
			else
			{
				if(form.elements['tempoAnt'+i].value == 'outros')				
				{
					if(form.elements['tempoAntOutro'+i].value == '')				
					{
						alert('Preencha o tempo.');
						form.elements['tempoAntOutro'+i].focus();
						return;						
					}
				}						
			}				
		}
		if(flagAnt == false)				
		{
			alert('Preencha ao menos uma escola');
			form.elements['escolaAnt1'].focus();
			return;
		}			
	}
	
	form.action = "includes/cadastroProfessorNew.asp";
	form.submit();
	
}


function HabilitaCampo(campo, valor)
{
	
	if(valor == 'outros')
	{
		document.getElementById(campo).style.display = "block";
	}
	else
	{
		document.getElementById(campo).style.display = "none";
	}
}


function ValidaFale(){
	var form = document.forms['form'];
	if (form.nome.value == '' || form.nome.value.length < 5){
		alert('Preencha corretamente o campo nome.');
		form.nome.focus();
		return;
	}
	if (form.mail.value == '' || form.mail.value.indexOf(".") < 2 || form.mail.value.indexOf("@") < 2){
		alert('Preencha corretamente o campo e-mail.');
		form.mail.focus();
		return;
	}
	if (form.assunto.value == ''){
		alert('Preencha corretamente o campo assunto.');
		form.assunto.focus();
		return;
	}
	if (form.msg.value == ''){
		alert('Preencha corretamente o campo mensagem.');
		form.msg.focus();
		return;
	}
	
	form.action = "includes/EnviaFaleConosco.asp";
	form.submit();
	
	//window.location.href ="includes/EnviaFaleConosco.asp"
}


function ValidaFaleProjetoDigital() {
    var form = document.forms['form'];
    if (form.nome.value == '' || form.nome.value.length < 5) {
        alert('Preencha corretamente o campo nome.');
        form.nome.focus();
        return;
    }
    if (form.mail.value == '' || form.mail.value.indexOf(".") < 2 || form.mail.value.indexOf("@") < 2) {
        alert('Preencha corretamente o campo e-mail.');
        form.mail.focus();
        return;
    }
    if (form.assunto.value == '') {
        alert('Preencha corretamente o campo assunto.');
        form.assunto.focus();
        return;
    }
    if (form.msg.value == '') {
        alert('Preencha corretamente o campo mensagem.');
        form.msg.focus();
        return;
    }

    form.action = "includes/EnviaFaleConoscoProjetoDigital.asp";
    form.submit();

    //window.location.href ="includes/EnviaFaleConosco.asp"
}


function abre(arq,alt,lag,res){
	if(navigator.appName=="Microsoft Internet Explorer")
	{
	  window.open(arq,'Condi','fullscreen=0,channelmode=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=' + res + ',width=' + lag + ',height=' + alt + ',top=100,left=100');
	  }else{window.open(arq,'Condi','location=0,fullscreen=0,menubar=0,toolbar=0,status=0,screenX=100,screenY=100,resizable=1,width=' + lag + ',height=' + alt);
	}
}



function FechaDivMsg(){	
	
	if (document.getElementById('msg').style.display == "block"){
		document.getElementById('msg').style.display = "none";
	}
	
}

function ValidaDadosLogin(){
	
	var f = document.forms['login'];
	
	if(f.usuario.value==''){
		alert('Preencha o usuário');
		f.usuario.focus();
		return;
	}

	if(f.senha.value==''){
		alert('Preencha a senha');
		f.senha.focus();
		return;
	}

	f.action = 'funcs/login.asp';
	f.submit();

}




function MudaCor(opc, obj){
	
	if(opc==1)
		document.getElementById(obj).style.backgroundColor = '#F8F8F8';
	else
		document.getElementById(obj).style.backgroundColor = '#FFFFFF';	
}

function ConfirmaExclusao(opc){

	if (confirm('Deseja excluir esta incrição?'))
		window.location.href = opc;

}

function ConfirmaDesbloqueio(opc){

	if (confirm('Deseja Desbloquear o Parceiro?'))
		window.location.href = opc;

}

function abre_janela(arquivo, x, y, sc) {
    if (!sc)
        sc = 'no'

    var abre;
    abre = window.open(arquivo, 'notas', 'width=' + x + ',height=' + y + ',scrollbars=' + sc);
    abre.focus();
}

function GravaLog_AbreDiv (IdPai,IdAcao,Desc,obj1,obj2){
	if (document.getElementById(obj1).style.display == "none")
		RJCI.call ('funcs/FunGravaLog.asp','IdPai=' + IdPai + '&IdItem=0&IdAcao=' + IdAcao + '&Desc=' + Desc )
	MostraDivFilha (obj1,obj2)
}

function GravaLog_AbreDiv2(IdPai, IdAcao, Desc, obj1) {
    if (document.getElementById(obj1).style.display == "none")
        RJCI.call('funcs/FunGravaLog.asp', 'IdPai=' + IdPai + '&IdItem=0&IdAcao=' + IdAcao + '&Desc=' + Desc)
    MostraDivFilha2(obj1)
}
function MostraDivPai(obj,obj2)
{		

	var div, div2;
	
	div	 = obj;
	div2 = obj2;
	
	parent.document.getElementById(div).style.display  = "none";
	parent.document.getElementById(div2).style.display = "block";
	
	s = setInterval('barra()', 1)

}

function MostraDivFilha(obj1, obj2) {

    var div, icone, cor;

    div = obj1;
    icone = obj2;

    if (document.getElementById(div).style.display == "none") {
        document.getElementById(div).style.display = "block";
        document.getElementById(icone).src = "../images/setaOver.gif";
    }
    else {
        document.getElementById(div).style.display = "none";
        document.getElementById(icone).src = "../images/seta.gif";
    }
}

function MostraDivFilha2(obj1) {

    var div;

    div = obj1;

    if (document.getElementById(div).style.display == "none") {
        document.getElementById(div).style.display = "block";
    }
    else {
        document.getElementById(div).style.display = "none";
    }
}


function AbreDivNew(obj, param) {

    var div;
    div = obj;

    if (param == "abre") {
        document.getElementById(div).style.display = "block";
    }

    if (param == "fecha") {
        document.getElementById(div).style.display = "none";
    }

    if (param == "alterna") {
        if (document.getElementById(div).style.display == "none") {
            document.getElementById(div).style.display = "block";
        }
        else {
            document.getElementById(div).style.display = "none";
        }
    }

}



function openBrWindow(theURL,winName,features) {
	win = window.open(theURL,winName,features);
	win.focus();
}
function MM_openBrWindow(theURL,winName,features){
  window.open(theURL,winName,features);
}

function ValidaMensagensAlunos() {

    var form = document.forms['formmail']
    if (form.Resposta.value == '') {
        alert('A Mensagem deve ser preenchida');
        form.Resposta.focus();
        return;
    }
    form.target = 'corpo';
    form.action = '../funcs/MensagensAlunos.asp';
    form.submit();
}

function openPOL(id, idusuario) {
    //window.open('/pol/AbrePol.asp?SWFParam='+id+'_'+idusuario,'_blank','width=800,height=600,toolbar=no,copyhistory=no,location=no,status=no,menubar=no,scrollbars=no,fullscreen=yes,resizable=no,top=0,left=0');
    window.open('http://www.relacionamento.editoracoc.com.br/Pol/AbrePol.asp?SWFParam=' + id + '_' + idusuario, '', 'width=800,height=600,scrollbars=no,top=0,left=0,resizable=yes')
}

function EnviaEmailPlantao(IdPlantao, IdProfessor) {
    window.location.href = ('http://www.relacionamento.editoracoc.com.br/funcs/PlantaoOnlineAtivar.asp?IdPlantao=' + IdPlantao + '&IdProfessor=' + IdProfessor);
}

function ValidaDol() {

    var form = document.forms['formmail']

    if (form.email.value == '') {
        alert('O Email deve ser preenchido');
        form.email.focus();
        return;
    }
    if (form.duvida.value == '') {
        alert('A Mensagem deve ser preenchida');
        form.duvida.focus();
        return;
    }

    form.action = "funcs/DependenciaOnline.asp"
    form.submit()

}

function ValidaSalaProfessor() {

    var form = document.forms['formmail']
    var AlgumChecado;

    if (form.email.value == '') {
        alert('O Email deve ser preenchido');
        form.email.focus();
        return;
    }
    if (form.titulo.value == '') {
        alert('O Titulo da Mensagem deve ser preenchido');
        form.titulo.focus();
        return;
    }
    if (form.mensagem.value == '') {
        alert('A Mensagem deve ser preenchida');
        form.mensagem.focus();
        return;
    }
    AlgumChecado = 0;

    for (i = 0; i < form.length; i++) {
        if (form.elements[i].type == "checkbox") {
            if (form.elements[i].checked == true) {
                AlgumChecado = 1;
            }
        }
    }

    if (AlgumChecado == 0) {
        alert("É Necessário Selecionar um Professor !");
        return;
    }

    form.action = "funcs/MeusProfessores.asp"
    form.submit()
}


function ValidaSalaProf() {

    var form = document.forms['formmail']
    var AlgumChecado;

    if (form.email.value == '') {
        alert('O Email deve ser preenchido');
        form.email.focus();
        return;
    }
    if (form.titulo.value == '') {
        alert('O Titulo da Mensagem deve ser preenchido');
        form.titulo.focus();
        return;
    }
    if (form.mensagem.value == '') {
        alert('A Mensagem deve ser preenchida');
        form.mensagem.focus();
        return;
    }
    AlgumChecado = 0;

    for (i = 0; i < form.length; i++) {
        if (form.elements[i].type == "checkbox") {
            if (form.elements[i].checked == true) {
                AlgumChecado = 1;
            }
        }
    }

    if (AlgumChecado == 0) {
        alert("É Necessário Selecionar um Professor !");
        return;
    }

    form.action = "funcs/teste.asp"
    form.submit()
}

function ValidaCOCVIP() {

    var form = document.forms['cocvip'];
    if (form.nome.value == '') {
        alert('O Nome deve ser preenchido');
        form.nome.focus();
        return;
    }
    if (form.cargo.value == '') {
        alert('O Cargo deve ser preenchido');
        form.cargo.focus();
        return;
    }
    if (form.escola.value == '') {
        alert('A Escola deve ser preenchida');
        form.escola.focus();
        return;
    }
    if (form.cidade.value == '') {
        alert('A cidade deve ser preenchida');
        form.cidade.focus();
        return;
    }
    if (form.email.value == '' || form.email.value.indexOf(".") < 2 || form.email.value.indexOf("@") < 2) {
        alert('Preencha corretamente seu E-mail.');
        form.email.focus();
        return;
    }
    if (form.telefone.value == '') {
        alert('O Telefone deve ser preenchido');
        form.telefone.focus();
        return;
    }

    form.action = 'COCVip.asp';
    form.submit();
}

function ImprimirDIV(DIV) {
    window.print(DIV);
}


function CarregarPagina(op, id, tipo){
	
	var formulario, pagina, resposta, metodo, mensagem, script
	Mensagem();
	

	if (op == 1){ // Carrega Opções do Usuário
		formulario = 'form'
		pagina    = 'includes/EnviaFaleConoscoParceiros.asp';
	  	resposta  = 'faleConosco.asp?Enviado=1';
		page = RJCI.postCall(formulario, pagina, resposta);
	}	

}




function Conta(){
	var form = document.forms['form'];
	total = form.msg.value.length;
	form.msg.focus();
	if(total <= 3000){
		form.total.value = 'Máximo de 3000 caracteres. '+ total +' caracteres já digitados'
	}
	else{
		form.total.value = 'Máximo de 3000 caracteres. 3000 caracteres já digitados'
		form.msg.value = form.msg.value.substring(0,3000);
		alert('Excedido o número máximo de caracteres.');
		return;
	}
}


function ValidaFaleConoscoParceiros(){
	var form = document.forms['form'];
	if (form.nome.value == '' || form.nome.value.length < 5){
		alert('Preencha corretamente o campo nome.');
		form.nome.focus();
		return;
	}
	if (form.mail.value == '' || form.mail.value.indexOf(".") < 2 || form.mail.value.indexOf("@") < 2){
		alert('Preencha corretamente o campo e-mail.');
		form.mail.focus();
		return;
	}
	if (form.assunto.value == ''){
		alert('Preencha corretamente o campo assunto.');
		form.assunto.focus();
		return;
	}
	if (form.msg.value == ''){
		alert('Preencha corretamente o campo mensagem.');
		form.msg.focus();
		return;
	}
	CarregarPagina(8)
}



function Vest_EnviaFacInfo(AnoNet) {
    form = document.forms['facInformativo']
    CODInst = form.cod_instituicao.value
    window.open('FiquePorDentro/Informativo.asp?AnoNet=' + AnoNet + '&cod_instituicao=' + CODInst, 'Faculdade', 'toolbar=no,width=680,height=504,scrollbars=yes,resizable=no');
}

function Vest_EnviaFacInfo2(AnoNet, CODInst) {
    window.open('FiquePorDentro/Informativo.asp?AnoNet=' + AnoNet + '&cod_instituicao=' + CODInst, 'Faculdade', 'toolbar=no,width=680,height=504,scrollbars=yes,resizable=no');
}

function MM_openBrWindow(theURL, winName, features) {
    window.open(theURL, winName, features);
}

function ValidaSalaAniversario() {

    var form = document.forms['formmail']
    if (form.email.value == '') {
        alert('O Email deve ser preenchido');
        form.email.focus();
        return;
    }
    if (form.nome.value == '') {
        alert('O Nome deve ser preenchido');
        form.nome.focus();
        return;
    }
    if (form.mensagem.value == '') {
        alert('A Mensagem deve ser preenchida');
        form.mensagem.focus();
        return;
    }
    form.action = "funcs/SalaAniversario.asp"
    form.submit()
}


function MarcarTodas() {

    var formx = document.forms['FProfissional'];

    for (i = 0; i < formx.length; i++) {
        if (formx.elements[i].type == "checkbox" && formx.elements[i].name != "sp") {
            formx.elements[i].checked = true;
        }
    }
}

function DesmarcarTodas() {

    var formx = document.forms['FProfissional'];

    for (i = 0; i < formx.length; i++) {
        if (formx.elements[i].type == "checkbox" && formx.elements[i].name != "sp") {
            formx.elements[i].checked = false;
        }
    }
}

function ExcluirAluno(pPagina, pDadoUsuario) {
    if (confirm("Excluir o(a) Aluno \n\n  " + pDadoUsuario + "  ?  ")) {
        window.location.href = (pPagina);
    }
}
function ValidaAlunos() {
    var f = document.forms['Aluno'];

    if (f.fNomeUsuario.value == '') {
        alert('Você deve preencher o campo Nome !');
        f.fNomeUsuario.focus();
        return;
    }

    if (f.fLogin.value == '') {
        alert('Você deve preencher o campo Código !');
        f.fLogin.focus();
        return;
    }

    if (f.fSenha.value == '') {
        alert('Você deve preencher o campo Senha !');
        f.fSenha.focus();
        return;
    }
    f.action = "funcs/Alunos.asp?opc=1";
    f.submit()
}

function AlteraAlunos() {
    var f = document.forms['Aluno'];

    if (f.fNomeUsuario.value == '') {
        alert('Você deve preencher o campo Nome !');
        f.fNomeUsuario.focus();
        return;
    }

    if (f.fLogin.value == '') {
        alert('Você deve preencher o campo Código !');
        f.fLogin.focus();
        return;
    }

    if (f.fSenha.value == '') {
        alert('Você deve preencher o campo Senha !');
        f.fSenha.focus();
        return;
    }
    f.action = "funcs/Alunos.asp?opc=2";
    f.submit()
}

function GeraSenha() {

    var f = document.forms['Aluno'];

    f.fSenha.value = Math.round(Math.random() * 10000, 0);

    while (f.fSenha.value < 1000) {
        f.fSenha.value = Math.round(Math.random() * 10000, 0);
    }
}

/************LIVRO ELETRÔNICO*****************************/

function popAnimacao(URL) {
    window.open('http://internas.cocemsuacasa.com.br/' + URL, 'pop_animacao', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=400,height=300')
}

function openBrWindow(theURL, winName, features) {
    win = window.open(theURL, winName, features);
    win.focus();
}

function openEbookWindow(remessa, file) {
    winEbook = window.open('http://internas.cocemsuacasa.com.br/ebook/pages/' + file + '.htm', 'EbookWindow', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes')
    //winEbook.focus();
}

function openEbookWindow1(remessa, file) {
    winEbook = window.open('http://internas.cocemsuacasa.com.br/ebook/' + file + '.htm', 'EbookWindow', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes')
    //winEbook.focus();
}

function EventosAbreVideo(video) {
    winEbook = window.open('http://internas.cocemsuacasa.com.br/EventosVideoXML.asp?Video=' + video, 'video', 'width=325,height=300,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no')
}
/************FIM******************************************/


function ValidaMensagensAlunos() {

    var form = document.forms['formmail']
    if (form.Resposta.value == '') {
        alert('A Mensagem deve ser preenchida');
        form.Resposta.focus();
        return;
    }
    form.action = '../funcs/MensagensAlunos.asp';
    form.submit();
}