// JavaScript Document
<!-- Valida Formulário  -->

function opcaoForm(){
	if(document.getElementById('alunos').checked==true){
		return window.location.replace("http://www.liber.com.br/metodistademinas/aluno/login.htm");
	}else if(document.getElementById('funcionarios').checked==true){
		return window.location.replace("http://www.liber.com.br/metodistademinas/funcionario/login.htm");
	}else if(document.getElementById('professores').checked==true){
		return window.location.replace("http://www.liber.com.br/metodistademinas/professor/login.htm");
	}else{
		alert('selecione alguma opção');
		return false;
	}	
}




function Valida_contato(contato)

{


  if (contato.nome.value == "")
  { alert("Por favor, informe o seu nome."); contato.nome.focus(); return false; }

 if (contato.email.value == "")
  { alert("Por favor, informe o seu e-mail."); contato.email.focus(); return false; }

if ( !valida_mail(contato.email.value) )
  { alert("O e-mail mencionado não parece ser um e-mail válido."); contato.email.focus(); return false; }

 if (contato.assunto.value == "")
  { alert("Por favor, informe o assunto."); contato.assunto.focus(); return false; }
  
  if (contato.mensagem.value == "")
  { alert("Por favor, digite sua mensagem."); contato.mensagem.focus(); return false; }
  
 return true;
}

<!-- Fim Valida Formulário  -->

function valida_mail(valor) {
	prim = valor.indexOf("@")
	if(prim < 1) return false;
	if(valor.indexOf("@",prim + 1) != -1) return false
	if(valor.indexOf(".") < 1) return false;
	if(valor.indexOf("zipmeil.com") > 0) return false;
	if(valor.indexOf("hotmeil.com") > 0) return false;
	if(valor.indexOf(".@") > 0) return false;
	if(valor.indexOf("@.") > 0) return false;
	if(valor.indexOf(".com.br.") > 0) return false;
	if(valor.indexOf("/") > 0) return false;
	if(valor.indexOf("[") > 0) return false;
	if(valor.indexOf("]") > 0) return false;
	if(valor.indexOf("(") > 0) return false;
	if(valor.indexOf(")") > 0) return false;
	if(valor.indexOf("..") > 0) return false;
	if(valor.indexOf(",") > 0) return false;
	return true;

}

function valida_mostra_curso(form) {
	if ( form.codigo.value == "" ){
		alert("Por favor, escolha um curso.");
		form.codigo.focus();			
	}
	else {
		form.submit();
	}
}

function valida_news(form) {
	if ( form.nomenews.value == "" || form.nomenews.value == "Nome" ){
		alert("Por favor, digite o nome.");
		form.nomenews.focus();
		return false			
	}
	if ( form.email.value == "" || form.email.value == "E-mail" ){
		alert("Por favor, digite o e-mail.");
		form.email.focus();
		return false			
	}
	if ( !valida_mail(form.email.value) ){ 
		alert("O e-mail mencionado não parece ser um e-mail válido."); 
		form.email.focus(); 
		return false; 
	}
	if ( form.tipo_colegio.value != "sim" && form.tipo_centro.value != "sim" ){
		alert("Por favor, escolha o assunto.");
		return false			
	}
	send_newsletter('/home/cadastro.asp?nomenews='+form.nomenews.value+'&email='+form.email.value+'&tipo_colegio='+form.tipo_colegio.value+'&tipo_centro='+form.tipo_centro.value);
	form.nomenews.value = "Nome";
	form.email.value = "E-mail";
	form.tipo_colegio.value = "nao";
	form.tipo_centro.value = "nao";
	MM_swapImage('colegio','','../img/news_bot_assunto_off.gif',1);
	MM_swapImage('centro','','../img/news_bot_assunto_off.gif',1);
	return false;
}


function send_newsletter(url)
{
janela=window.open(url,'news','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=400,height=170')
}

function verificacodaluno()
{ if (document.forms["frmLogin"].edtCodigo.value == 'Nome')  
  { alert ('ATENÇÃO: Digite seu código para efetuar a pesquisa !');
    document.forms["frmLogin"].edtCodigo.focus();
	  return false;
	}  
  if (document.forms["frmLogin"].edtSenha.value == 'Senha')  
  { alert ('ATENÇÃO: Digite a senha para efetuar a pesquisa !');
    document.forms["frmLogin"].edtSenha.focus();
	  return false;
	}
	document.forms["frmLogin"].action = "http://alunos.metodistademinas.edu.br/login.php";
	if (document.forms["frmLogin"].edtEscola.value == 'COLIZABELA')
	{ document.forms["frmLogin"].edtTipocurso.value = 'C';
	  return true;
	}
	if (document.forms["frmLogin"].edtEscola.value == 'IHENDRIXBH')
	{ document.forms["frmLogin"].edtTipocurso.value = 'F';
	  return true;
	}
	if (document.forms["frmLogin"].edtEscola.value == 'IHENDRIXNL')
	{ document.forms["frmLogin"].edtTipocurso.value = 'F';
	  return true;
	}
	return false;
}

function popup(url,largura,altura)
{ 
  Left = (window.screen.availWidth - largura) / 2 - 13;
  Top  = (window.screen.availHeight - altura) / 2;
  window.open(url,'Popup'+largura, 'width='+largura+', height='+altura+', top='+Top+', left='+Left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}


function valida_data(dia,mes,ano, form) {
 dias = Array(31,31,31,30,31,30,31,31,30,31,30,31);
 f = document.getElementById(form);

 if (f.mes.value < 1 || f.mes.value > 12) {
	 alert("Mês inválido.");
	 f.mes.focus();
	 return true;
    }

 if (f.dia.value > dias[f.mes.value-1]) {
	 alert("Dia inválido para esse mês.");
	 f.dia.focus();
	 return true;
   }

 return false;
}

<!-- Valida Formulário vestibular -->

// formulario do inicio da inscrisao
function Valida_Inscrisao(form) {
	if (form.evento[0].checked==false && form.evento[1].checked==false && form.evento[2].checked==false)
	{
		alert("Escolha a forma de Processo Seletivo para o qual deseja se inscrever.");
		form.evento[0].focus();
		return false;
	}
}

function Valida_vestibular(vestibular) {
	
	normal = "16";
	enen = "14";

	evento  = vestibular.evento.value;

	if (vestibular.nome.value == "")
		{ alert("Por favor, informe o seu NOME."); vestibular.nome.focus(); return false; }

	if (vestibular.sexo[0].checked == false && vestibular.sexo[1].checked == false) {
		alert("Por favor, informe o seu sexo."); return false;
	}

	if ( vestibular.cpf.value == "" ) {
		alert("Por favor, digite o seu CPF.");
		vestibular.cpf.focus();		
		return false;
	}
	if ( !valida_cpf(vestibular.cpf) ){
		return false;
	}

	if (vestibular.dia.value == "")
		{ alert("Por favor, informe o DIA do seu nascimento."); vestibular.dia.focus(); return false; }

	if (vestibular.mes.value == "")
		{ alert("Por favor, informe o MÊS do seu nascimento."); vestibular.mes.focus(); return false; }

	if (vestibular.ano.value == "")
		{ alert("Por favor, informe o ANO do seu nascimento."); vestibular.ano.focus(); return false; }

	if (valida_data(vestibular.dia,vestibular.value,vestibular.ano, 'vestibular')) {
		return false;
	}

	if (vestibular.tipo.value == "")
		{  alert("Por favor, o tipo do documento."); vestibular.tipo.focus(); return false;  }

	if (vestibular.documento.value == "")
		{ alert("Por favor, informe o ORGÃO EMISSOR do documento."); vestibular.documento.focus(); return false; }

	if (vestibular.estado.value == "") {
		alert("Por favor, informe o ESTADO DE EMISSÃO do documento."); vestibular.estado.focus(); return false;
	}

	if (vestibular.emissor.value == "")
		{ alert("Por favor, informe o NÚMERO do documento."); vestibular.emissor.focus(); return false; }

	if (vestibular.endereco.value == "")
		{ alert("Por favor, informe o ENDEREÇO."); vestibular.endereco.focus(); return false; }

	if (vestibular.numero.value == "")
		{ alert("Por favor, informe o NÚMERO do endereço."); vestibular.numero.focus(); return false; }

	if (vestibular.bairro.value == "")
		{ alert("Por favor, informe o BAIRRO."); vestibular.bairro.focus(); return false; }

	if (vestibular.cidade.value == "")   {
		alert("Por favor, informe a CIDADE."); vestibular.cidade.focus(); return false; 
	}

	if (vestibular.cep.value == "")
		{ alert("Por favor, informe o CEP do endereço."); vestibular.cep.focus(); return false; }


	if (vestibular.estado2.value == ""){ 
		alert("Por favor, informe o ESTADO."); vestibular.estado2.focus(); return false;
	}

	if (vestibular.ddd.value == "")
		{ alert("Por favor, informe o DDD."); vestibular.ddd.focus(); return false; }

	if (vestibular.tel.value == "")
		{ alert("Por favor, informe o TELEFONE."); vestibular.tel.focus(); return false; }

	if (vestibular.sou[0].checked == false && vestibular.sou[1].checked == false) {
		alert("Por favor, informe o tipo da sua escrita."); return false;
	}


	if (vestibular.curso1.value == "") {
		alert("Por favor, informe o curso."); vestibular.curso1.focus(); return false;
	}
	if (vestibular.curso1.value != "18" && document.opcao_2.frmCurso2.curso2.value == "" && document.opcao_3.frmCurso3.curso3.value != "") {
		alert("Por favor, informe a segunda opção de curso."); document.opcao_2.frmCurso2.curso2.focus(); return false;
	}

	if (typeof(vestibular.lingua)!="undefined")
	{
		if (!vestibular.lingua[0].disabled && !vestibular.lingua[1].disabled) {
			if (vestibular.lingua[0].checked == false && vestibular.lingua[1].checked == false)	 {
				alert("Por favor, informe a língua estrangeira."); return false;
			}
		}
	}
	if (vestibular.evento.value!=normal)
	{
		if (!confirm("Questionário Socioeconômico\nPreenchimento opcional\n\nAjude-nos a conhecer melhor as suas necessidades e características."))
		{
			vestibular.action = "/eventos/vestibular2007/inscricao_confirma.asp";
			return true;
		}
	}else
		return true;
}
<!-- Fim Valida Vestibular  -->

<!-- Valida evento -->
function Valida_evento(evento) {


 if (evento.nome.value == "")
  { alert("Por favor, informe o seu NOME."); evento.nome.focus(); return false; }
 
 if (evento.sexo[0].checked == false && evento.sexo[1].checked == false) {
    alert("Por favor, informe o seu sexo."); return false;
 }

if ( evento.cpf.value == "" ) {
		alert("Por favor, digite o seu CPF.");
		evento.cpf.focus();		
		return false;
	}
	if ( !valida_cpf(evento.cpf) ){
		return false;
	}

 if (evento.tipo.value == "")
 {  alert("Por favor, o tipo do documento."); evento.tipo.focus(); return false;  }

if (evento.documento.value == "")
 { alert("Por favor, informe o ORGÃO EMISSOR do documento."); evento.documento.focus(); return false; }

if (evento.estado.value == "") {
  alert("Por favor, informe o ESTADO DE EMISSÃO do documento."); evento.estado.focus(); return false;
}
 
 if (evento.emissor.value == "")
 { alert("Por favor, informe o NÚMERO do documento."); evento.emissor.focus(); return false; }
 
 if (evento.endereco.value == "")
 { alert("Por favor, informe o ENDEREÇO."); evento.endereco.focus(); return false; }
 
 if (evento.numero.value == "")
 { alert("Por favor, informe o NÚMERO do endereço."); evento.numero.focus(); return false; }

 if (evento.bairro.value == "")
 { alert("Por favor, informe o BAIRRO."); evento.bairro.focus(); return false; }

 if (evento.cidade.value == "")   {
	   alert("Por favor, informe a CIDADE."); evento.cidade.focus(); return false; 
   }

 if (evento.cep.value == "")
 { alert("Por favor, informe o CEP do endereço."); evento.cep.focus(); return false; }
 

if (evento.estado2.value == ""){ 
	alert("Por favor, informe o ESTADO."); evento.estado2.focus(); return false;
   }
 
  if (evento.ddd.value == "")
 { alert("Por favor, informe o DDD."); evento.ddd.focus(); return false; }
 
 if (evento.tel.value == "")
 { alert("Por favor, informe o TELEFONE."); evento.tel.focus(); return false; }
 
  if (evento.email.value == "")
 { alert("Por favor, informe o EMAIL."); evento.email.focus(); return false; }

 if ( !valida_mail(evento.email.value) )
  { alert("O e-mail mencionado não parece ser um e-mail válido."); evento.email.focus(); return false; }

  if (evento.perfil.value == "")
 { alert("Por favor, informe o PERFIL."); evento.perfil.focus(); return false; }

 return true;
}
<!-- Fim Valida evento  -->

<!-- Valida Formulário eventos -->
<!-- Fim Valida Eventos  -->

<!-- Valida Formulário 2 via -->
function Valida_2a(via)

{
if ( via.cpf.value == "" ) {
		alert("Por favor, digite o seu CPF.");
		via.cpf.focus();		
		return false;
	}
	if ( !valida_cpf(via.cpf) ){
		return false;
	}
/* if (via.dia.value == "")
  { alert("Por favor, informe o DIA do seu nascimento."); via.dia.focus(); return false; }

 if (via.mes.value == "")
  { alert("Por favor, informe o MÊS do seu nascimento."); via.mes.focus(); return false; }

 if (via.ano.value == "")
  { alert("Por favor, informe o ANO do seu nascimento."); via.ano.focus(); return false; }

 if (valida_data(via.dia, via.mes, via.ano, 'via')) {
     return false;
	}
  */
   return true;
}

<!-- fim Formulário 2 via -->
<!-- VERIFICA CPF  -->
function CPF_OK(Numero_CPF) 
{
  var Parcela;
  var Quociente;
  var Resto;
  var Soma;
  var Fator;
  var I;
  var C1;
  var C2;
  var dv1;
  var dv2;
    
  //Verificacao dos dois digitos finais em relacao ao numero completo
  C1 = parseInt(Numero_CPF.substring(9, 10));  //10º caracter = primeiro dígito verificador
  C2 = parseInt(Numero_CPF.substring(10, 11)); //11º caracter = segundo dígito verificador
    
  //Verificacao do primeiro dígito (C1)
  Soma = 0;
  Parcela = 0;
  Fator = 0;
	
  for(I=1; I<=9; I++)
  {
    Fator = I + 1;

    Parcela = Fator * parseInt(Numero_CPF.substring(9 - I, 9 - I + 1));
    Soma = Soma + Parcela;
  } //fechando o "for".
    
  dv1 = (Soma % 11); 
  dv1 = 11 - dv1;

  if(dv1 >9 )
  {
    dv1 = 0;
  }
    
  if(C1 != dv1)
  {
    return false;
  }
    
  //Verificacao do segundo dígito (C2)
  Soma = 0;
  Parcela = 0;
  Fator = 0;

  for(I=1; I<=10; I++)
  {
    Fator = I + 1;
  
    Parcela = Fator * parseInt(Numero_CPF.substring(10 - I, 10 - I + 1));
    Soma = Soma + Parcela;
  }
	 
  dv2 = (Soma % 11);
  dv2 = 11 - dv2;
  
  if(dv2 > 9)
  {
    dv2 = 0;
  }

  if(C2 != dv2)
  {
    return false;
  }
return true;
}

function valida_cpf(elemento) {

AuxCPFCGC = elemento.value;
var checkOK = "0123456789";

 if (elemento.value == "" || elemento.value == null || AuxCPFCGC.length != 11 )
  {
    alert("CPF deve conter 11 digitos!");
    elemento.focus();
    return(false);
  }

  for (i = 1; i <= AuxCPFCGC.length ; i++) 
  {
    if (AuxCPFCGC.substring(i-1,i) == " ")
    {
      elemento.focus();	  
      alert("O campo CPF nao deve conter espacos!");
      return(false);
    }
  }

var checkStr = AuxCPFCGC;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("O CPF deve conter apenas numeros.");
    elemento.focus();
    return(false);
  }
 
    if (!CPF_OK(AuxCPFCGC)||AuxCPFCGC=="11111111111"||AuxCPFCGC=="22222222222"||AuxCPFCGC=="33333333333"||AuxCPFCGC=="44444444444"||AuxCPFCGC=="55555555555"||AuxCPFCGC=="66666666666"||AuxCPFCGC=="77777777777"||AuxCPFCGC=="88888888888"||AuxCPFCGC=="99999999999"||AuxCPFCGC=="00000000000")
    {
      elemento.focus();
      alert("Numero de CPF invalido! Corrija-o por favor");
      return(false);
    }
return(true);

}
<!-- FIM VERIFICA CPF  -->



function formata(campo, evt) { 
		 
  if(document.all) { // Internet Explorer 
     key = evt.keyCode; } 
     else{ // Nestcape 
        key = evt.which; 
      } 
   return ((key > 47 && key < 58) || key == 8 || key == 13 || key == 0);
}


function etapas_cadastro(url) {
	if (!valida_etapas())	{
		  return false;
	}

	document.cadastro.action = url;
	document.cadastro.submit();
}

function valida_etapas() {
 len = document.cadastro.elements.length;
 for (i=0; i < len; i++) {
       if (document.cadastro.elements[i].type == "select-one")    {
				   if (document.cadastro.elements[i].disabled == true) {
						  return true;
				     }
				   if (document.cadastro.elements[i].value == "")  {
						   alert("Todos os campos são obrigatórios.");
							 document.cadastro.elements[i].focus();
				       return false;
							}
         }
     }
	return true;
}

function Flingua(valor) {
	if (valor != "") 	{
			opcao_2.location = 'opcao_2.asp?curso='+valor;
			cod = Array(23,44,20,7,3,42,5,43,4,25);
			for (i=0; i<cod.length; i++) {
					 if (valor == cod[i]) {
							document.vestibular.lingua[0].checked = false;
							document.vestibular.lingua[1].checked = false;
							document.vestibular.lingua[0].disabled = true;
							document.vestibular.lingua[1].disabled = true;
							return;
						 }
				 }
			 document.vestibular.lingua[0].disabled = false;
			 document.vestibular.lingua[1].disabled = false;
		}
}

function MudaCurso(valor,evento) {
	if (valor != "") 	{
			opcao_2.location = 'opcao_2.asp?curso='+valor+'&evento='+evento;
			cod = Array(23,44,20,7,3,42,5,43,4,25,45,3,4,5,7,23,25,45,46,47,51);
			for (i=0; i<cod.length; i++) {
					 if (valor == cod[i] && typeof(document.vestibular.lingua)!='undefined') {
							document.vestibular.lingua[0].checked = false;
							document.vestibular.lingua[1].checked = false;
							document.vestibular.lingua[0].disabled = true;
							document.vestibular.lingua[1].disabled = true;
							return;
						 }
				 }
			 if (typeof(document.vestibular.lingua)!='undefined') {
				 document.vestibular.lingua[0].disabled = false;
				 document.vestibular.lingua[1].disabled = false;
			}
		}
}

function outroCurso (valor) {
  if (valor == "sim") {
		  document.cadastro.escolas.disabled = false;
    } else {
			  document.cadastro.escolas.value = "";
			  document.cadastro.escolas.disabled = true;
		}
}

//-------------- AJAX -------------

function openAjax() {
   var ajax;

	 try
	 {
	 	ajax = new XMLHttpRequest();
	 }
	 catch (ee)
	 {
		   try
		   {
		   	 ajax = new ActiveXObject("Msxml2.XMLHTTP");
		   }
		   catch (e)
		   {
				  try
				  {
				  	ajax = new  ActiveXObject("Microsoft.XMLHTTP");
				  }
				  catch (E)
				  {
						ajax = false;
				  }
		   }
	 }

    return ajax;
 }

 function setaValor(curso, forma_pagamento) {
   if (document.getElementById)   {
			 var exibeOpcoes = document.getElementById("parcelas");
			 if (curso != "")	 {
			     var ajax = openAjax();
					 var url = "pegaValores.asp?curso=" + curso + "&forma_pagamento=" + forma_pagamento;
					 ajax.open("GET", url, true);
					 ajax.send(null);
  				 ajax.onreadystatechange = function() {
					         if (ajax.readyState == 4)  {
					             if (ajax.status == 200)  {
												   var lista = ajax.responseText;
													 exibeOpcoes.innerHTML = lista;
					               }
										 }
					     }// function onreadystatechange
			   } 
   }
 }



 function Valida_posgraduacao(pos) {


 if (pos.nome.value == "")
  { alert("Por favor, informe o seu NOME."); pos.nome.focus(); return false; }

 if (pos.sexo[0].checked == false && pos.sexo[1].checked == false) {
    alert("Por favor, informe o seu sexo."); return false;
 }

if ( pos.cpf.value == "" ) {
		alert("Por favor, digite o seu CPF.");
		pos.cpf.focus();		
		return false;
	}
	if ( !valida_cpf(pos.cpf) ){
		return false;
	}

 if (pos.dia.value == "")
  { alert("Por favor, informe o DIA do seu nascimento."); pos.dia.focus(); return false; }

 if (pos.mes.value == "")
  { alert("Por favor, informe o MÊS do seu nascimento."); pos.mes.focus(); return false; }

 if (pos.ano.value == "")
  { alert("Por favor, informe o ANO do seu nascimento."); pos.ano.focus(); return false; }

 if (valida_data(pos.dia, pos.mes, pos.ano, 'vestibular')) {
     return false;
	}

 if (pos.tipo.value == "")
 {  alert("Por favor, o tipo do documento."); pos.tipo.focus(); return false;  }

if (pos.documento.value == "")
 { alert("Por favor, informe o ORGÃO EMISSOR do documento."); pos.documento.focus(); return false; }

if (pos.estado.value == "") {
  alert("Por favor, informe o ESTADO DE EMISSÃO do documento."); pos.estado.focus(); return false;
}
 
 if (pos.emissor.value == "")
 { alert("Por favor, informe o NÚMERO do documento."); pos.emissor.focus(); return false; }
 
 if (pos.endereco.value == "")
 { alert("Por favor, informe o ENDEREÇO."); pos.endereco.focus(); return false; }
 
 if (pos.numero.value == "")
 { alert("Por favor, informe o NÚMERO do endereço."); pos.numero.focus(); return false; }

 if (pos.bairro.value == "")
 { alert("Por favor, informe o BAIRRO."); pos.bairro.focus(); return false; }

 if (pos.cidade.value == "")   {
	   alert("Por favor, informe a CIDADE."); pos.cidade.focus(); return false; 
   }

 if (pos.cep.value == "")
 { alert("Por favor, informe o CEP do endereço."); pos.cep.focus(); return false; }
 

if (pos.estado2.value == ""){ 
	alert("Por favor, informe o ESTADO."); pos.estado2.focus(); return false;
   }
 
  if (pos.ddd.value == "")
 { alert("Por favor, informe o DDD."); pos.ddd.focus(); return false; }
 
 if (pos.tel.value == "")
 { alert("Por favor, informe o TELEFONE."); pos.tel.focus(); return false; }

 if (pos.curso.value == "")
 { alert("Por favor, informe o CURSO."); pos.curso.focus(); return false; }

 if (pos.forma_pagamento[0].checked == false && pos.forma_pagamento[1].checked == false) {
    alert("Por favor, informe a forma de pagamento."); return false;
 }


 return true;
}

function formataInteiro(obj, evt) {
			 
  if(document.all) { // Internet Explorer 
     key = evt.keyCode; } 
     else{ // Nestcape 
        key = evt.which; 
      }
	
	//alert(key);
  if ((key < 48 || key > 57) && key != 8) 	return false;

	return true;

}


function llamarasincrono(url, id_contenedor, idTexto){

document.getElementById("spProvas").style.fontWeight = "normal";
document.getElementById("spEnem").style.fontWeight = "normal";

document.getElementById("spProvas").style.color = "#999";
document.getElementById("spEnem").style.color = "#999";

document.getElementById(idTexto).style.fontWeight = 'bold';
document.getElementById(idTexto).style.color = '#346A91';

var pagina_requerida = false
if (window.XMLHttpRequest) {
pagina_requerida = new XMLHttpRequest()
} else if (window.ActiveXObject){
try {
pagina_requerida = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){ 
try{
pagina_requerida = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
pagina_requerida.onreadystatechange=function(){
cargarpagina(pagina_requerida, id_contenedor)
}
pagina_requerida.open('GET', url, true)
pagina_requerida.send(null)
}

function cargarpagina(pagina_requerida, id_contenedor){
if (pagina_requerida.readyState == 4 && (pagina_requerida.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(id_contenedor).innerHTML=pagina_requerida.responseText
}
