
function createXMLHTTP(){
	try {ajax = new ActiveXObject("Microsoft.XMLHTTP");  } 
	catch(e){
		try {
			ajax = new ActiveXObject("Msxml2.XMLHTTP");
			alert(ajax);
			 }
		catch(ex){
			   try{
					ajax = new XMLHttpRequest();
					}
			   catch(exc){
						   alert("Esse browser não tem recursos para uso do Ajax");
							ajax = null;
						  }
					}
		 return ajax;
      }
	var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
   "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
   "Microsoft.XMLHTTP"];
   for (var i=0; i < arrSignatures.length; i++) {
	  try  {
		 var oRequest = new ActiveXObject(arrSignatures[i]);
		 return oRequest;
			} 
	  catch (oError) {  }
  	 }
	  throw new Error("MSXML is not installed on your system.");
} 

   function numero_rnd(quanto_rnd){  
  
      return Math.floor(Math.random()*quanto_rnd)  
 }  

function recuperarInfo(tag, method, arq, campo, campo2){
// Criação do objeto XMLHTTP
// campo: input q recebe o valor a ser processado
// div: div q recebera o resultado
// method: recebe "GET" ou "POST"
// arq: no do arquivo que vai processar a informação do campo
// Cria a opcao carregando 

//document.getElementById(tag).innerHTML='<span>carregando...</span>'


var oHTTPRequest = createXMLHTTP(); 
// Abrindo a solicitação HTTP. O primeiro parâmetro informa o método post/get
// O segundo parâmetro informa o arquivo solicitado que pode ser asp, php, txt, xml, etc.
// O terceiro parametro informa que a solicitacao nao assincrona,
// Para solicitação síncrona, o parâmetro deve ser false

oHTTPRequest.open(method, arq+campo+'?'+numero_rnd(999), true);


	oHTTPRequest.onreadystatechange=function() {
		if (oHTTPRequest.readyState==4){
		document.getElementById(tag).innerHTML = oHTTPRequest.responseText;
		 }
	}

oHTTPRequest.send(null);



}

//}
// JavaScript Document

function IEHoverPseudo() {

    var navItems = document.getElementById("primary-nav").getElementsByTagName("li");
    
    for (var i=0; i<navItems.length; i++) {
        if(navItems[i].className == "menuparent") {
            navItems[i].onmouseover=function() { this.className += " over"; }
            navItems[i].onmouseout=function() { this.className = "menuparent"; }
        }
    }

}
window.onload = IEHoverPseudo;


//Fumção da Caixa de Email
function expandcollapse (postid) { 
   whichpost = document.getElementById(postid); 
   if (whichpost.className=="postshown") { 
      whichpost.className="posthidden"; 
   } 
   else { 
      whichpost.className="postshown"; 
   } 
} 

//Função do Menu
startList = function() {

	//code only for IE
	if(!document.body.currentStyle) return;
	var subs = document.getElementsByName('submenu');
	for(var i=0; i<subs.length; i++) {
		var li = subs[i].parentNode;
		if(li && li.lastChild.style) {
			li.onmouseover = function() {
				this.lastChild.style.visibility = 'visible';
			}
			li.onmouseout = function() {
				this.lastChild.style.visibility = 'hidden';
			}
		}
	}
}
window.onload=startList;


//função para validar e-mail

function validar()

{
   if (document.tvcreci.nome.value.length == 0)
   {
      alert("Nome em branco");
	  
      return false;
   }
   if (document.tvcreci.numero.value.length == 0)
   {
      alert("Creci em branco");
	  
      return false;
   }
      if (document.tvcreci.email.value.length == 0)
   {
      alert("E-mail em branco");
	  
      return false;
   }
      if (document.tvcreci.assunto.value.length == 0)
   {
      alert("Assunto em branco");
	  
      return false;
   }

}


//cadastro.asp
function File(){
open('arquivo.asp?id=' + document.prog.id.value, 'iframe') 
	    return true;

	}
	function Div(id) { 
	open('arquivo.asp?id=' + document.prog.id.value, 'iframe');
   whichpost = document.getElementById(id); 
   if ( document.prog.aovivo.value== 1) { 
      whichpost.className="div"; 
	 
   } 
   else { 
      whichpost.className="divoc"; 
	  
   } 
} 
