var s;
sAgent     = navigator.userAgent;
bIsIE      = sAgent.indexOf("MSIE") > -1;
bIsNav     = sAgent.indexOf("Mozilla") > -1 && !bIsIE;
var xmouse = 0;
var ymouse = 0;
document.onmousemove = MouseMove;

function Hint(objNome, action){
	if (bIsIE)
	{
		objHint = document.all[objNome]; 
	}
	if (bIsNav)
	{
		objHint = document.getElementById(objNome);
		event = objHint;
	}
	
	switch (action)
	{
		case 1: //Esconde
			objHint.style.visibility = "hidden";
			break;
		case 2: //Move
			objHint.style.visibility = "visible";
			objHint.style.left = xmouse + 12;
			objHint.style.top = ymouse + 5;
			break;
	}
}

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 AguardarPagina(){ //DOM

	document.getElementById('aguarde').style.display="none";
	//document.getElementById('baseFolhaNotas').style.display="none";
	//alert("aqui")
/*
	if (document.getElementById){
		document.getElementById('aguarde').style.display="none";
		//document.getElementById('baseFolhaNotas').style.display="none";
	}
	else{
		if (document.layers){ //NS4
			document.aguarde.display = "none";
			//document.baseFolhaNotas.display = "none";
		}
		else { //IE4
			document.all.aguarde.style.display="none";
			//document.all.baseFolhaNotas.style.display="none";
		}
	}*/
}

function AbreDiv(obj, param){	
	
	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 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 AbreDivGrupo(div, td){	
	//var div;
	//div = obj;

	if (document.getElementById(div).style.display == "none")
	{
		document.getElementById(div).style.display = "block";
		document.getElementById(td).style.height = '140px';		
	}
	else
	{
		document.getElementById(div).style.display = "none";
		document.getElementById(td).style.height = '0px';
    }
}

function AbreMidia(Midia, Tipo, cesc){
	if (Tipo == 1){

		if (cesc == 'True')
		    caminho = 'http://interna.coceducacao.com.br/Eventos/fotos/'
		else
			caminho = 'http://www.jornal.coc.com.br/fotos/'
			
		window.open(caminho + Midia,'wind','toolbar=no,width=628,height=504,scrollbars=yes,resizable=no');
		return
	}
	if (Tipo == 2){
		window.open('Eventos/EventosVideoXML.asp?Video=' + Midia +'&cesc='+ cesc,'video','width=325,height=300,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no')
		return
	}
}

function ValidaNotas()
{
	var f = document.forms['notas'];
	if (f.Materia.value.length > 6000)
	{
		alert('A quantidade de caracteres inserida em sua nota não pode ser maior que 3500.')
		return
	}

	if (f.Materia.value.length < 0)
	{
		alert('A quantidade de caracteres inserida em sua nota não pode ser menor que 0.')
		return
	}

	f.action = 'anotacoes.asp';
	f.submit();
}

function AbreGaleria(Id, Nome, cesc){
		
	window.open('http://www.jornal.coc.com.br/galeria.asp?Id='+ Id +'&Nome='+ Nome +'&cesc='+ cesc,'wind','toolbar=no,width=645,height=544,scrollbars=yes,resizable=no');
	
}

function AbreArquivo(arquivo){
		
	window.open(arquivo,'_blank');
	
}

function abrejogo(arq,alt,lag){
	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=0,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=0,scrollbars=0,width=' + lag + ',height=' + alt);
}

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 redim(iframe){	
	var altura = parseInt(document.body.scrollHeight);
	parent.document.getElementById(iframe).style.height = altura + "px";
	clearInterval(s)
}

function redimPai(iframe){	
	var altura = parseInt(document.body.scrollHeight);
	parent.document.getElementById(iframe).style.height = altura + "px";
	parent.parent.document.getElementById('corpo').style.height = altura + "px";
	clearInterval(s)
}

function redimOriginal(iframe)
{
	if(navigator.appName=="Microsoft Internet Explorer")
		var altura = parseInt(document.body.scrollHeight);
	else
		var altura = parseInt(document.body.offsetHeight);

	parent.document.getElementById(iframe).style.height = altura + 'px';
}

function redim2(iframe){	
	var altura = parseInt(document.body.scrollHeight);
	parent.document.getElementById(iframe).style.height = altura + "px";
	clearInterval(s)
}

function MostraDiv(obj1, obj2, url) {	

	var div, div2, topo;
	div	 = obj1;
	div2 = obj2;
	
	//alert(url)

	document.getElementById(div2).style.display = "block";
	document.getElementById(div).style.display  = "none";
	 
	window.destaque.location.href = 'descricoes.asp?'+ url;

	topo  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="776" height="150">'
	topo += '<param name="movie" value="flash/topoAmbiente.swf" />'
	topo += '<param name="quality" value="high" />'
	topo += '<param name="bgcolor" value="#4C7DA8" />'
	topo += '<param name="menu" value="0"  />'
	topo += '<param name="FlashVars" value="'+url+'" />'
	topo += '<embed src="flash/topoAmbiente.swf" FlashVars="'+url+'" quality="high" menu="false" bgcolor="#4C7DA8" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="776" height="150"></embed>'
	topo += '</object>'
		
	document.getElementById('topoAmbiente').innerHTML = topo;
}

function MostraDivFlash(obj1, obj2, url, tipo) {	

	var div, div2, topo, dado;
	div	 = obj1;
	div2 = obj2;
	dado = tipo;

	document.getElementById(div2).style.display = "block";
	document.getElementById(div).style.display  = "none";	
	
	
	if (dado == 1) {
		window.corpo.location.href = 'ajuda.asp?' + url;
		window.destaque.location.href = 'descricoes.asp?idAmbiente=366';
	}
	
	if (dado == 2) {
		window.corpo.location.href = 'saibaMais.asp?' + url;
		window.destaque.location.href = 'descricoes.asp?' + url;
	}
	
	if (dado == 3) {
		window.corpo.location.href = 'faleConosco.asp?' + url;
		window.destaque.location.href = 'descricoes.asp?idAmbiente=365';
	}
	
	if (dado == 4) {
		window.corpo.location.href = 'FiquePorDentroComunicados.asp?' + url;
		window.destaque.location.href = 'descricoes.asp?idAmbiente=367';
	}

	if (dado == 5) {
		window.corpo.location.href = 'anotacoes.asp?'+ url;
		window.destaque.location.href = 'descricoes.asp?idAmbiente=345';
	}
	
	if (dado == 6) {
		window.corpo.location.href = 'passaporteSenha/PassaporteSenha.aspx?' + url;
		window.destaque.location.href = 'descricoes.asp?' + url;
	}
	
	if (dado == 7) {
		window.corpo.location.href = 'SimuladosOnlineNew.asp?' + url;
		window.destaque.location.href = 'descricoes.asp?idAmbiente=367' + url;
	}

	if (dado == 8) {
		window.corpo.location.href = 'AdesaoSimuladaoCOC.asp?' + url;
		window.destaque.location.href = 'descricoes.asp?idAmbiente=408';
	}	
	
	if (dado == 9) {
		window.corpo.location.href = 'aprofundamentoOnline.asp?' + url;
		window.destaque.location.href = 'descricoes.asp?idAmbiente=452';
	}
	
	if (dado == 10) {
		window.corpo.location.href = 'MediaCenter.asp?' + url;
		window.destaque.location.href = 'descricoes.asp?idAmbiente=516';
	}
	
	if (dado == 11) {
		window.corpo.location.href = 'IntensivoProENEM.asp?' + url;
		window.destaque.location.href = 'descricoes.asp?idAmbiente=518';
	}		
	
	topo  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="776" height="150">'
	topo += '<param name="movie" value="flash/topoAmbiente.swf" />'
	topo += '<param name="quality" value="high" />'
	topo += '<param name="bgcolor" value="#4C7DA8" />'
	topo += '<param name="menu" value="0"  />'
	topo += '<param name="FlashVars" value="'+url+'" />'
	topo += '<embed src="flash/topoAmbiente.swf" FlashVars="'+url+'" quality="high" menu="false" bgcolor="#4C7DA8" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="776" height="150"></embed>'
	topo += '</object>'
		
	document.getElementById('topoAmbiente').innerHTML = topo;	
	
}

function barra()
{
	try
	{
		window.corpo.document.location = "inicio.asp";	
		clearInterval(s);
	}
	catch(e)
	{
		clearInterval(s);
	}
}

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 mudaFundo(obj,cor) {
	document.getElementById(obj).style.backgroundColor = cor;
}

function troca_img_original(qual, img)
	{
		document.images[qual].src = "imagens/" + img
	}
	
function ValidaAdesaoSimulado()
{
	form = document.forms['Simuladao']
	var AlgumChecado;
	
	if(form.nome_simuladao.value==""){
		alert('Preencha corretamente o campo Nome do Responsável.')
		form.nome_simuladao.focus()
		return
	}
	if(form.login_simuladao.value==""){
		alert('Preencha corretamente o campo Login.')
		form.login_simuladao.focus()
		return
	}
	if(form.senha_simuladao.value==""){
		alert('Preencha corretamente o campo Senha.')
		form.senha_simuladao.focus()
		return
	}
	
	AlgumChecado = 0;			
	
	for(i=0; i<form.length; i++){
		if (form.elements[i].type == "radio"){
			if(form.elements[i].checked == true){
				AlgumChecado = 1;
			}
		}	
	}
	
	if(AlgumChecado == 0){
		alert("É necessário selecionar uma opção de parcelamento!");
		return;
	}	  
	
	form.action="funcs/AdesaoSimuladaoCOC.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 ValidaTurmaCOC(){

   	var form = document.forms['formmail']

   	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;
	  }
	  
		form.action="../funcs/TurmaCOC.asp"
	  	form.submit()
}

	function CheckaTodos(algumAlterado) {
	 f = document.formmail;
	 if (algumAlterado) {
	  if (algumAlterado.checked == false) f.br.checked = false;
	 }
	 else
	  for (i=0; i<f.length; i++)
	   if (f.elements[i].type == "checkbox")
	    if (f.br.checked) f.elements[i].checked = true
	    else f.elements[i].checked = false
	}


	function Pula(Quant,Campo1,Campo2){
	
			var ValidChar = "#48;#49;#50;#51;#52;#53;#54;#55;#56;#57;#13;";
			if (ValidChar.indexOf("#" + String(event.keyCode+ ";")) == -1)
			event.returnValue = false;	
	
			var C1 = document.getElementById(Campo1).value.length + 1;
			var C2 = document.getElementById(Campo2);
			
			if (C1 > Quant) {
				C2.focus()
			}
		}

/**** FUNCOES DO CURSO DE INGLES FUNDAMENTAL *************************/

	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 janela_tarefa()
	{
		var abrir;
		abrir = window.open('tarefa.asp','impressao', 'width=640,height=500,scrollbars=yes');
		abrir.focus();
	}

	
	function dic(palavra)
	{
		var new_window;
		new_window = window.open('InglesDicionario.asp?palavra=' + palavra, 'dicionario', 'width=188,height=140');
		new_window.focus();
	}

	function troca_img(qual, img)
	{
		document.images[qual].src = "../images/" + img
	}

	function troca_img_inglesvestibular(qual, img)
	{
		document.images[qual].src = "imagens/" + img
	}

	function resposta_alt_livros(alt,qtde,alt_correta)
	{
		var img  = document.images[alt]
		var imgstr = String(img.src)
		var new_img

			ArrayAlt = alt.split('_');
			imgstr = imgstr.substring(imgstr.lastIndexOf('/')+1,imgstr.lastIndexOf('.'));
			
			if ((imgstr == 'bt_checked') || (imgstr == 'bt_inativo'))
			{
				alert('Você ja respondeu esta questão, a resposta se encontra logo abaixo.')
				return ;
			}
			
			for (var i=1;i<=qtde;i++)
			{
				new_img = document.images[ArrayAlt[0] + '_a' + i]
				new_img.src = img.src.substring(0,img.src.lastIndexOf('/')) + "/bt_inativo.gif";
				//alert(new_img.src);
			}
			
			document.images[alt].src = img.src.substring(0,img.src.lastIndexOf('/')) + "/bt_checked.gif";
			var img_som = document.images['som_'+ArrayAlt[0]]
			
			img_som.src = "imagens" + "/alternativa_" + alt_correta + ".gif";
			document.location = '#'+'anchor_'+'som_' + ArrayAlt[0];
	}

	function resposta_alt(alt,qtde,som)
	{
				
		var img  = document.images[alt];
		var imgstr = String(img.src);
		var new_img;
		
			ArrayAlt = alt.split('_');
			imgstr = imgstr.substring(imgstr.lastIndexOf('/')+1,imgstr.lastIndexOf('.'));
			
			if ((imgstr == 'bt_checked') || (imgstr == 'bt_inativo'))
			{
				if (confirm('A pergunta ja foi respondida, ouça a resposta.\nGostaria de ouvir agora ?'))
					multi('InglesSom.asp?arquivo='+som,1);
				
				return ;
			}
			
			for (var i=1;i<=qtde;i++)
			{
				new_img = document.images[ArrayAlt[0] + '_a' + i]
				new_img.src = img.src.substring(0,img.src.lastIndexOf('/')) + "/bt_inativo.gif";
				//alert(new_img.src);
			}
			

			document.images[alt].src = img.src.substring(0,img.src.lastIndexOf('/')) + "/bt_checked.gif";
			var img_som = document.images['som_'+ArrayAlt[0]]
			
			img_som.src = img_som.src.substring(0,img_som.src.lastIndexOf('/')) + "/bt_som.gif";
			document.location = '#'+'anchor_'+'som_' + ArrayAlt[0];
	}

	function resposta_alt_T(alt,qtde, desc,som, total_lacunas)
	{
		var img  = document.images[alt]
		var imgstr = String(img.src)
		var new_img
		
		resposta = desc.split('•');
		ArrayAlt = alt.split('_');
	

		imgstr = imgstr.substring(imgstr.lastIndexOf('/')+1,imgstr.lastIndexOf('.'));
			
			if ((imgstr == 'bt_checked') || (imgstr == 'bt_inativo'))
				resposta_alt(alt,qtde,som);
			else
			{
				for (var i = 1; i <= total_lacunas; i++)
					document.forms['InglesPerguntas'].elements[ArrayAlt[0]+'_text_'+i].value = resposta[i-1];
				//document.forms['perguntas'].elements[ArrayAlt[0]+'_text'].value = desc;
				resposta_alt(alt,qtde,som);
			}
	}

	function resposta_abe(alt,qtde)
	{
	   	var form  = document.forms['InglesPerguntas'].elements[alt];
		
		ArrayAlt = alt.split('_');
				
		var img_som = document.images['som_' + ArrayAlt[0]];
		
		var com_som = img_som.src.substring(0,img_som.src.lastIndexOf('/')) + "/bt_som.gif";
		var sem_som = img_som.src.substring(0,img_som.src.lastIndexOf('/')) + "/bt_sem_som.gif";

		if (form.value.length >= qtde){
			if (img_som.src == sem_som){
				img_som.src = com_som;
				document.location = '#'+'anchor_'+'som_' + ArrayAlt[0];
				form.focus();
				form.value = form.value.substring(0,form.value.length)
			}
		}
		else
			img_som.src = sem_som;
	}

	function ouvir_resposta(som, arq)
	{
		var img_som = document.images[som]
		var imgstr = img_som.src.substring(img_som.src.lastIndexOf('/')+1,img_som.src.lastIndexOf('.'));
		
		if (imgstr == 'bt_sem_som') 
		{
			alert('É necessário que você tente responder a perguntar para obter a resposta.')
			return ;
		}
		else
			multi('InglesSom.asp?arquivo='+arq,1)
	}
	
	function ouvir_resposta_inglesvestibular(som, arq)
	{
		var img_som = document.images[som]
		var imgstr = img_som.src.substring(img_som.src.lastIndexOf('/')+1,img_som.src.lastIndexOf('.'));
		
		if (imgstr == 'bt_sem_som') 
		{
			alert('É necessário que você tente responder a perguntar para obter a resposta.')
			return ;
		}
		else
			multi('InglesSom.asp?arquivo='+arq,1)
	}
	
	function multi(arquivo,som)
	{
		var new_window;
		if (! som)
			new_window = window.open(arquivo, 'multimidia', 'width=193,height=40');
		else
			new_window = window.open(arquivo, 'multimidia', 'width=193,height=40');
		new_window.focus();
	}

	function multi2(arquivo,som)
	{
		var new_window;

		if (som)
			new_window = window.open(arquivo, 'multimidia', 'width=193,height=40');
		else
			new_window = window.open(arquivo, 'multimidia', 'width=193,height=184');
		new_window.focus();
	}

	function MM_findObj(n, d) 
	{
		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

	function MM_showHideLayers()
	{ 
		var i,p,v,obj,args=MM_showHideLayers.arguments;
		for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(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 MM_reloadPage(init)
		{
		  if (init==true) with (navigator) 
		    {
			  if ((appName=="Netscape")&&(parseInt(appVersion)==4))
				{
				  document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
				}
			}
		  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
		 }
	
	MM_reloadPage(true);

	function ws(titulo)
	{
		window.status = titulo;
	}

/************************************ FIM DAS FUNCOES DO CURSO DE INGLES FUNDAMENTAL *************************/		

function ValidaFaleConosco(){

   	var form = document.forms['formmail'];
   	
   	if (form.email.value == '' || form.email.value.indexOf(".") < 2 || form.email.value.indexOf("@") < 2){
		alert('O Email deve ser preenchido corretamente');
		form.email.focus();
		return;
	}

	if (form.mensagem.value == '')
	  {
		alert('A Mensagem deve ser preenchida');
		form.mensagem.focus();
		return;
	  }
	
	form.action = 'funcs/faleConosco.asp';
	form.submit();
}


function ValidaCamposRedacao(){
   	var form = document.forms['redacao']
   	if (form.titulo.value == '')
	  {
		alert('O Título deve ser preenchido');
		form.titulo.focus();
		return;
	  }
	  
	if (form.email.value == '' || form.email.value.indexOf(".") < 2 || form.email.value.indexOf("@") < 2){
		alert('Preencha corretamente o campo e-mail.');
		form.email.focus();
		return;
	}

	if (form.redacao.value == '')
	  {
		alert('A Redação deve ser preenchida');
		form.redacao.focus();
		return;
	  }
	  
	form.target = 'corpo';
	form.action = 'funcs/RedacaoOnline.asp';
	form.submit();
}

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();
}

/*******************************************************

VESTIBULAR INFORMATIVOS...

********************************************************/
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 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('/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=('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 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 ValidaSimuladaoCOC() {  
	
	form = document.forms['Simuladao']
	if(form.nome_simuladao.value==""){
		alert('Preencha corretamente o campo Nome do Responsável.')
		form.nome_simuladao.focus()
		return
	}
	if(form.login_simuladao.value==""){
		alert('Preencha corretamente o campo Login.')
		form.login_simuladao.focus()
		return
	}
	if(form.senha_simuladao.value==""){
		alert('Preencha corretamente o campo Senha.')
		form.senha_simuladao.focus()
		return
	}
	form.action="../../funcs/SimuladaoCOC.asp"
  	form.submit()
}

	function abrepopup (mode2,mode,idUnidade,idSegmento,idSerie){
		strDia = document.getElementById('txtdia').value
		strMes = document.getElementById('txtmes').value
		strAno = document.getElementById('txtano').value
		
		if(strDia == "" || strMes == "" || strAno== ""){
			alert("Informe o período para que o relatório possa ser gerado com sucesso");
			return;
		}
	
		var qrStr = "dia=" + strDia + "&mes=" + strMes + "&ano=" + strAno
		qrStr += "&mode2=" + mode2 + "&mode=" + mode + "&idUnidade=" + idUnidade
		qrStr += "&idSegmento=" + idSegmento + "&idSerie=" + idSerie
		qrStr += "&periodo=" + strDia + "/" + strMes + "/" + strAno

		var urlPop = 'http://internas.cocemsuacasa.com.br/logs/report2.asp'
		win = window.open(urlPop + '?'+ qrStr,'winReport','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,menubar=no,width=710,height=420,left=0, top=0')
		win.focus()
	}
	
/***************************Valida o Envio de Receitas ******************************************************/

    function ValidarReceita(){
		var f = document.forms['formmail'];
    	if (f.email.value == ''){
	    	alert('É necessário preencher o campo Email!');
	    	return
	    }    	
    	if (f.receita.value == ''){
	    	alert('É necessário preencher o campo Receita!');
	    	return
	    }
	    
	    f.action = 'funcs/EnviarReceita.asp';
		f.submit();
	}
	
/****************************Fim da Validação *****************************************************************/

/***************************Valida Inscricao Enem**************************************************************/

function EnviaInscricaoEnem(){
	var f 	  = document.forms['FORM']
	f.action  = 'SimuladosCOC/BoletimResultadoEnem.asp';
	f.target  = '_blank';
	f.submit();
}

function EnviaInscricaoSimuladoEnem(){
	var f 	  = document.forms['FORM']
	f.action  = 'SimuladosCOC/BoletimResultadoSimuladoEnem.asp';
	f.target  = '_blank';
	f.submit();
}

/***************************************************************************************************************/

function abreLab(arq,alt,lag){
	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=1,resizable=0,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=0,scrollbars=1,width=' + lag + ',height=' + alt);
}
